From 318fe2814a5cc298871302c4f590bebde10a5a78 Mon Sep 17 00:00:00 2001 From: Haikal Izzuddin Date: Tue, 15 Jan 2019 12:12:29 +0800 Subject: [PATCH 1/5] [DNM] Small changes to CMake to avoid downloading documentation images Signed-off-by: Haikal Izzuddin --- CMakeFiles/3.13.2/CMakeSystem.cmake | 15 +++++++++++++ CMakeFiles/3.13.2/VCTargetsPath.vcxproj | 28 +++++++++++++++++++++++++ CMakeFiles/CMakeOutput.log | 1 + Source/CMakeLists.txt | 6 +++--- 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 CMakeFiles/3.13.2/CMakeSystem.cmake create mode 100644 CMakeFiles/3.13.2/VCTargetsPath.vcxproj create mode 100644 CMakeFiles/CMakeOutput.log diff --git a/CMakeFiles/3.13.2/CMakeSystem.cmake b/CMakeFiles/3.13.2/CMakeSystem.cmake new file mode 100644 index 000000000..bdd1e31f8 --- /dev/null +++ b/CMakeFiles/3.13.2/CMakeSystem.cmake @@ -0,0 +1,15 @@ +set(CMAKE_HOST_SYSTEM "Windows-10.0.17134") +set(CMAKE_HOST_SYSTEM_NAME "Windows") +set(CMAKE_HOST_SYSTEM_VERSION "10.0.17134") +set(CMAKE_HOST_SYSTEM_PROCESSOR "AMD64") + + + +set(CMAKE_SYSTEM "Windows-10.0.17134") +set(CMAKE_SYSTEM_NAME "Windows") +set(CMAKE_SYSTEM_VERSION "10.0.17134") +set(CMAKE_SYSTEM_PROCESSOR "AMD64") + +set(CMAKE_CROSSCOMPILING "FALSE") + +set(CMAKE_SYSTEM_LOADED 1) diff --git a/CMakeFiles/3.13.2/VCTargetsPath.vcxproj b/CMakeFiles/3.13.2/VCTargetsPath.vcxproj new file mode 100644 index 000000000..811d5245a --- /dev/null +++ b/CMakeFiles/3.13.2/VCTargetsPath.vcxproj @@ -0,0 +1,28 @@ + + + + + Debug + x64 + + + + {F3FC6D86-508D-3FB1-96D2-995F08B142EC} + Win32Proj + x64 + 10.0.17134.0 + + + + Utility + MultiByte + v141 + + + + + echo VCTargetsPath=$(VCTargetsPath) + + + + diff --git a/CMakeFiles/CMakeOutput.log b/CMakeFiles/CMakeOutput.log new file mode 100644 index 000000000..950a48024 --- /dev/null +++ b/CMakeFiles/CMakeOutput.log @@ -0,0 +1 @@ +The system is: Windows - 10.0.17134 - AMD64 diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 72365bd49..6afc3bcc5 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -189,9 +189,9 @@ set(COMPILED_ASSETS_VERSION_FILE ${BSF_SOURCE_DIR}/../Data/.reqversion) file (STRINGS ${COMPILED_ASSETS_VERSION_FILE} COMPILED_ASSETS_VERSION) check_and_update_builtin_assets(bsfCompiled ${BSF_SOURCE_DIR}/../Data Data ${COMPILED_ASSETS_VERSION} NO) -set(DOC_IMAGES_VERSION_FILE ${BSF_SOURCE_DIR}/../Documentation/.reqversion) -file (STRINGS ${DOC_IMAGES_VERSION_FILE} DOC_IMAGES_VERSION) -check_and_update_builtin_assets(bsfDocImages ${BSF_SOURCE_DIR}/../Documentation Documentation ${DOC_IMAGES_VERSION} NO) +#set(DOC_IMAGES_VERSION_FILE ${BSF_SOURCE_DIR}/../Documentation/.reqversion) +#file (STRINGS ${DOC_IMAGES_VERSION_FILE} DOC_IMAGES_VERSION) +#check_and_update_builtin_assets(bsfDocImages ${BSF_SOURCE_DIR}/../Documentation Documentation ${DOC_IMAGES_VERSION} NO) ## Install install( From 94b8fe3e0dd4df3456bec28a839974c8330d110a Mon Sep 17 00:00:00 2001 From: Haikal Izzuddin Date: Tue, 15 Jan 2019 01:55:33 +0800 Subject: [PATCH 2/5] Updated PhysX to 4.0 Changes made: * PxConvexFlag::eINFLATE_CONVEX is removed in 4.0, suggest to find other way around * Not sure line 235 on BsPhysX.cpp does, commented it since we're no longer using the old pair.contactStream * PxSceneQueryHitType is renamed to PxQueryHitType Signed-off-by: Haikal Izzuddin --- Source/Plugins/bsfPhysX/BsPhysX.cpp | 39 +++++++++++-------- .../bsfPhysX/BsPhysXCharacterController.cpp | 6 +-- Source/Plugins/bsfPhysX/BsPhysXMesh.cpp | 4 +- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Source/Plugins/bsfPhysX/BsPhysX.cpp b/Source/Plugins/bsfPhysX/BsPhysX.cpp index 932874d89..bc9881b32 100644 --- a/Source/Plugins/bsfPhysX/BsPhysX.cpp +++ b/Source/Plugins/bsfPhysX/BsPhysX.cpp @@ -191,6 +191,9 @@ namespace bs void onContact(const PxContactPairHeader& pairHeader, const PxContactPair* pairs, PxU32 count) override { + const PxU32 bufferSize = 64; + PxContactPairPoint contacts[bufferSize]; + for (PxU32 i = 0; i < count; i++) { const PxContactPair& pair = pairs[i]; @@ -220,17 +223,19 @@ namespace bs event.type = type; PxU32 contactCount = pair.contactCount; - const PxU8* stream = pair.contactStream; + //const PxU8* stream = pair.contactStream; + const PxU32 stream = pair.extractContacts(contacts, bufferSize); PxU16 streamSize = pair.contactStreamSize; if (contactCount > 0 && streamSize > 0) { PxU32 contactIdx = 0; - PxContactStreamIterator iter((PxU8*)stream, streamSize); + PxContactStreamIterator iter(pair.contactPatches,pair.contactPoints, pair.getInternalFaceIndices(), pair.patchCount, pair.contactCount); - stream += ((streamSize + 15) & ~15); + //stream += ((streamSize + 15) & ~15); - const PxReal* impulses = reinterpret_cast(stream); + const PxReal* impulses = pair.contactImpulses; + PxU32 flippedContacts = (pair.flags & PxContactPairFlag::eINTERNAL_CONTACTS_ARE_FLIPPED); PxU32 hasImpulses = (pair.flags & PxContactPairFlag::eINTERNAL_HAS_IMPULSES); while (iter.hasNextPatch()) @@ -240,15 +245,14 @@ namespace bs { iter.nextContact(); + PxVec3 pointIter = iter.getContactPoint(); + ContactPoint point; point.position = fromPxVector(iter.getContactPoint()); point.separation = iter.getSeparation(); point.normal = fromPxVector(iter.getContactNormal()); - if (hasImpulses) - point.impulse = impulses[contactIdx]; - else - point.impulse = 0.0f; + point.impulse = hasImpulses ? impulses[contactIdx] : 0.0f; event.points.push_back(point); @@ -457,7 +461,7 @@ namespace bs static PhysXAllocator gPhysXAllocator; static PhysXErrorCallback gPhysXErrorHandler; static PhysXCPUDispatcher gPhysXCPUDispatcher; - static PhysXEventCallback gPhysXEventCallback; + //static PhysXEventCallback gPhysXEventCallback; static PhysXBroadPhaseCallback gPhysXBroadphaseCallback; static const UINT32 SIZE_16K = 1 << 14; @@ -487,11 +491,11 @@ namespace bs sceneDesc.gravity = toPxVector(input.gravity); sceneDesc.cpuDispatcher = &gPhysXCPUDispatcher; sceneDesc.filterShader = PhysXFilterShader; - sceneDesc.simulationEventCallback = &gPhysXEventCallback; + //sceneDesc.simulationEventCallback = &gPhysXEventCallback; sceneDesc.broadPhaseCallback = &gPhysXBroadphaseCallback; // Optionally: eENABLE_KINEMATIC_STATIC_PAIRS, eENABLE_KINEMATIC_PAIRS, eENABLE_PCM - sceneDesc.flags = PxSceneFlag::eENABLE_ACTIVETRANSFORMS; + sceneDesc.flags = PxSceneFlag::eENABLE_ACTIVE_ACTORS; if (input.flags.isSet(PhysicsFlag::CCD_Enable)) sceneDesc.flags |= PxSceneFlag::eENABLE_CCD; @@ -542,19 +546,20 @@ namespace bs // Update rigidbodies with new transforms PxU32 numActiveTransforms; - const PxActiveTransform* activeTransforms = mScene->getActiveTransforms(numActiveTransforms); + PxActor** activeActors = mScene->getActiveActors(numActiveTransforms); for (PxU32 i = 0; i < numActiveTransforms; i++) { - Rigidbody* rigidbody = static_cast(activeTransforms[i].userData); + Rigidbody* rigidbody = static_cast(activeActors[i]->userData); // Note: This should never happen, as actors gets their userData set to null when they're destroyed. However // in some cases PhysX seems to keep those actors alive for a frame or few, and reports their state here. Until // I find out why I need to perform this check. - if(activeTransforms[i].actor->userData == nullptr) + if(activeActors[i]->userData == nullptr) continue; - const PxTransform& transform = activeTransforms[i].actor2World; + //const PxTransform& transform = activeActors[i]->getGlobalPose(); + const PxTransform& transform = (PxTransform&)activeActors[i]->userData; // Note: Make this faster, avoid dereferencing Rigidbody and attempt to access pos/rot destination directly, // use non-temporal writes @@ -1059,10 +1064,10 @@ namespace bs PxRaycastHit hitInfo; PxU32 maxHits = 1; bool anyHit = false; - PxHitFlags hitFlags = PxHitFlag::eDEFAULT | PxHitFlag::eUV; + PxHitFlags hitFlags = PxHitFlag::eDEFAULT | PxHitFlag::eUV | PxHitFlag::eMESH_ANY; PxU32 hitCount = PxGeometryQuery::raycast(toPxVector(origin), toPxVector(unitDir), shape->getGeometry().any(), transform, - maxDist, hitFlags, maxHits, &hitInfo, anyHit); + maxDist, hitFlags, maxHits, &hitInfo); if(hitCount > 0) parseHit(hitInfo, hit); diff --git a/Source/Plugins/bsfPhysX/BsPhysXCharacterController.cpp b/Source/Plugins/bsfPhysX/BsPhysXCharacterController.cpp index 55b4126ea..64540ecb1 100644 --- a/Source/Plugins/bsfPhysX/BsPhysXCharacterController.cpp +++ b/Source/Plugins/bsfPhysX/BsPhysXCharacterController.cpp @@ -258,15 +258,15 @@ namespace bs bool canCollide = gPhysics().isCollisionEnabled(colliderLayer, getLayer()); if(canCollide) - return PxSceneQueryHitType::eBLOCK; + return PxQueryHitType::eBLOCK; - return PxSceneQueryHitType::eNONE; + return PxQueryHitType::eNONE; } PxQueryHitType::Enum PhysXCharacterController::postFilter(const PxFilterData& filterData, const PxQueryHit& hit) { - return PxSceneQueryHitType::eBLOCK; + return PxQueryHitType::eBLOCK; } bool PhysXCharacterController::filter(const PxController& a, const PxController& b) diff --git a/Source/Plugins/bsfPhysX/BsPhysXMesh.cpp b/Source/Plugins/bsfPhysX/BsPhysXMesh.cpp index 8b3048750..6c9824b1a 100644 --- a/Source/Plugins/bsfPhysX/BsPhysXMesh.cpp +++ b/Source/Plugins/bsfPhysX/BsPhysXMesh.cpp @@ -44,7 +44,7 @@ namespace bs } // Try inflating the convex mesh - convexDesc.flags |= PxConvexFlag::eINFLATE_CONVEX; + //convexDesc.flags |= PxConvexFlag::eINFLATE_CONVEX; // TODO: Add this back once issue is solved if (cooking->cookConvexMesh(convexDesc, output)) { size = output.getSize(); @@ -78,7 +78,7 @@ namespace bs convexDesc.points.count = 8; convexDesc.points.stride = sizeof(Vector3); convexDesc.points.data = &aabbVerts[0]; - convexDesc.flags &= ~PxConvexFlag::eINFLATE_CONVEX; + //convexDesc.flags &= ~PxConvexFlag::eINFLATE_CONVEX; // TODO: Add this back once issue is solved if (cooking->cookConvexMesh(convexDesc, output)) { From 212fdab9fb159866a3f0cdb23b31df2e616397e1 Mon Sep 17 00:00:00 2001 From: Haikal Izzuddin Date: Tue, 15 Jan 2019 19:19:14 +0800 Subject: [PATCH 3/5] Update for Physx 4.0 Signed-off-by: Haikal Izzuddin --- Source/CMake/Modules/FindPhysX.cmake | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Source/CMake/Modules/FindPhysX.cmake b/Source/CMake/Modules/FindPhysX.cmake index 180897b04..4d36af006 100644 --- a/Source/CMake/Modules/FindPhysX.cmake +++ b/Source/CMake/Modules/FindPhysX.cmake @@ -13,27 +13,27 @@ gen_default_lib_search_dirs(PhysX) if(NOT APPLE) if(BS_64BIT) - set(BS_PHYSX_SUFFIX _x64) + set(BS_PHYSX_SUFFIX _64) else() - set(BS_PHYSX_SUFFIX _x86) + set(BS_PHYSX_SUFFIX _86) endif() endif() find_imported_includes(PhysX PxPhysics.h) if(NOT APPLE) - find_imported_library_shared2(PhysX PhysX3${BS_PHYSX_SUFFIX} PhysX3CHECKED${BS_PHYSX_SUFFIX}) - find_imported_library_shared2(PhysX PhysX3Common${BS_PHYSX_SUFFIX} PhysX3CommonCHECKED${BS_PHYSX_SUFFIX}) - find_imported_library_shared2(PhysX PhysX3Cooking${BS_PHYSX_SUFFIX} PhysX3CookingCHECKED${BS_PHYSX_SUFFIX}) - find_imported_library_shared2(PhysX PhysX3CharacterKinematic${BS_PHYSX_SUFFIX} PhysX3CharacterKinematicCHECKED${BS_PHYSX_SUFFIX}) - find_imported_library2(PhysX PhysX3Extensions PhysX3ExtensionsCHECKED) + find_imported_library_shared2(PhysX PhysX${BS_PHYSX_SUFFIX} PhysXCHECKED${BS_PHYSX_SUFFIX}) + find_imported_library_shared2(PhysX PhysXCommon${BS_PHYSX_SUFFIX} PhysXCommonCHECKED${BS_PHYSX_SUFFIX}) + find_imported_library_shared2(PhysX PhysXCooking${BS_PHYSX_SUFFIX} PhysXCookingCHECKED${BS_PHYSX_SUFFIX}) + find_imported_library_shared2(PhysX PhysXCharacterKinematic_static${BS_PHYSX_SUFFIX} PhysXCharacterKinematicCHECKED_static${BS_PHYSX_SUFFIX}) + find_imported_library2(PhysX PhysXExtensions_static${BS_PHYSX_SUFFIX} PhysXExtensionsCHECKED_static${BS_PHYSX_SUFFIX}) else() find_imported_library(PhysX LowLevel) find_imported_library(PhysX LowLevelCloth) - find_imported_library(PhysX PhysX3) - find_imported_library(PhysX PhysX3Common) - find_imported_library(PhysX PhysX3Cooking) - find_imported_library(PhysX PhysX3CharacterKinematic) - find_imported_library(PhysX PhysX3Extensions) + find_imported_library(PhysX PhysX) + find_imported_library(PhysX PhysXCommon) + find_imported_library(PhysX PhysXCooking) + find_imported_library(PhysX PhysXCharacterKinematic) + find_imported_library(PhysX PhysXExtensions) find_imported_library(PhysX PhysXProfileSDK) find_imported_library(PhysX PvdRuntime) find_imported_library(PhysX PxTask) @@ -43,4 +43,4 @@ endif() install_dependency_binaries(PhysX) -end_find_package(PhysX PhysX3${BS_PHYSX_SUFFIX}) +end_find_package(PhysX PhysX${BS_PHYSX_SUFFIX}) From fba72fceec8757061d5a772c2810e0025a072f01 Mon Sep 17 00:00:00 2001 From: Haikal Izzuddin Date: Thu, 17 Jan 2019 15:49:52 +0800 Subject: [PATCH 4/5] Update PhysXEventCallback to reflect Physx 4.0 changes Signed-off-by: Haikal Izzuddin --- Source/Plugins/bsfPhysX/BsPhysX.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Plugins/bsfPhysX/BsPhysX.cpp b/Source/Plugins/bsfPhysX/BsPhysX.cpp index bc9881b32..e6f0b645c 100644 --- a/Source/Plugins/bsfPhysX/BsPhysX.cpp +++ b/Source/Plugins/bsfPhysX/BsPhysX.cpp @@ -128,6 +128,7 @@ namespace bs { void onWake(PxActor** actors, PxU32 count) override { /* Do nothing */ } void onSleep(PxActor** actors, PxU32 count) override { /* Do nothing */ } + void onAdvance(const PxRigidBody *const *bodyBuffer, const PxTransform *poseBuffer, const PxU32 count) override { /* Do nothing */ } void onTrigger(PxTriggerPair* pairs, PxU32 count) override { @@ -461,7 +462,7 @@ namespace bs static PhysXAllocator gPhysXAllocator; static PhysXErrorCallback gPhysXErrorHandler; static PhysXCPUDispatcher gPhysXCPUDispatcher; - //static PhysXEventCallback gPhysXEventCallback; + static PhysXEventCallback gPhysXEventCallback; static PhysXBroadPhaseCallback gPhysXBroadphaseCallback; static const UINT32 SIZE_16K = 1 << 14; @@ -491,7 +492,7 @@ namespace bs sceneDesc.gravity = toPxVector(input.gravity); sceneDesc.cpuDispatcher = &gPhysXCPUDispatcher; sceneDesc.filterShader = PhysXFilterShader; - //sceneDesc.simulationEventCallback = &gPhysXEventCallback; + sceneDesc.simulationEventCallback = &gPhysXEventCallback; sceneDesc.broadPhaseCallback = &gPhysXBroadphaseCallback; // Optionally: eENABLE_KINEMATIC_STATIC_PAIRS, eENABLE_KINEMATIC_PAIRS, eENABLE_PCM From f055efd5e9cabc476b78d525fcd36eb2677a4185 Mon Sep 17 00:00:00 2001 From: Haikal Izzuddin Date: Thu, 17 Jan 2019 15:51:01 +0800 Subject: [PATCH 5/5] Revert commit webhaikal/bsf@318fe2814a5cc298871302c4f590bebde10a5a78 Signed-off-by: Haikal Izzuddin --- Source/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6afc3bcc5..72365bd49 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -189,9 +189,9 @@ set(COMPILED_ASSETS_VERSION_FILE ${BSF_SOURCE_DIR}/../Data/.reqversion) file (STRINGS ${COMPILED_ASSETS_VERSION_FILE} COMPILED_ASSETS_VERSION) check_and_update_builtin_assets(bsfCompiled ${BSF_SOURCE_DIR}/../Data Data ${COMPILED_ASSETS_VERSION} NO) -#set(DOC_IMAGES_VERSION_FILE ${BSF_SOURCE_DIR}/../Documentation/.reqversion) -#file (STRINGS ${DOC_IMAGES_VERSION_FILE} DOC_IMAGES_VERSION) -#check_and_update_builtin_assets(bsfDocImages ${BSF_SOURCE_DIR}/../Documentation Documentation ${DOC_IMAGES_VERSION} NO) +set(DOC_IMAGES_VERSION_FILE ${BSF_SOURCE_DIR}/../Documentation/.reqversion) +file (STRINGS ${DOC_IMAGES_VERSION_FILE} DOC_IMAGES_VERSION) +check_and_update_builtin_assets(bsfDocImages ${BSF_SOURCE_DIR}/../Documentation Documentation ${DOC_IMAGES_VERSION} NO) ## Install install(