feat(physics): wire physx sdk into build
This commit is contained in:
174
CMakeLists.txt
174
CMakeLists.txt
@@ -42,6 +42,180 @@ enable_testing()
|
||||
|
||||
option(XCENGINE_ENABLE_MONO_SCRIPTING "Build the Mono-based C# scripting runtime" ON)
|
||||
option(XCENGINE_BUILD_XCUI_EDITOR_APP "Build the XCUI editor shell app" ON)
|
||||
set(
|
||||
XCENGINE_PHYSX_ROOT_DIR
|
||||
"${CMAKE_SOURCE_DIR}/engine/third_party/physx"
|
||||
CACHE PATH
|
||||
"Path to the bundled PhysX SDK root")
|
||||
set(XCENGINE_PHYSX_INCLUDE_DIR "${XCENGINE_PHYSX_ROOT_DIR}/include")
|
||||
set(XCENGINE_ENABLE_PHYSX OFF)
|
||||
set(XCENGINE_PHYSX_LINK_TARGETS)
|
||||
set(XCENGINE_PHYSX_RUNTIME_DLL_TARGETS)
|
||||
|
||||
if(EXISTS "${XCENGINE_PHYSX_INCLUDE_DIR}/PxPhysicsAPI.h")
|
||||
file(GLOB XCENGINE_PHYSX_BIN_ROOT_CANDIDATES_MD LIST_DIRECTORIES true
|
||||
"${XCENGINE_PHYSX_ROOT_DIR}/bin/win.x86_64.vc*.md")
|
||||
file(GLOB XCENGINE_PHYSX_BIN_ROOT_CANDIDATES_MT LIST_DIRECTORIES true
|
||||
"${XCENGINE_PHYSX_ROOT_DIR}/bin/win.x86_64.vc*.mt")
|
||||
|
||||
if(XCENGINE_PHYSX_BIN_ROOT_CANDIDATES_MD)
|
||||
list(SORT XCENGINE_PHYSX_BIN_ROOT_CANDIDATES_MD COMPARE NATURAL ORDER DESCENDING)
|
||||
list(GET XCENGINE_PHYSX_BIN_ROOT_CANDIDATES_MD 0 XCENGINE_PHYSX_BIN_ROOT_DIR)
|
||||
elseif(XCENGINE_PHYSX_BIN_ROOT_CANDIDATES_MT)
|
||||
list(SORT XCENGINE_PHYSX_BIN_ROOT_CANDIDATES_MT COMPARE NATURAL ORDER DESCENDING)
|
||||
list(GET XCENGINE_PHYSX_BIN_ROOT_CANDIDATES_MT 0 XCENGINE_PHYSX_BIN_ROOT_DIR)
|
||||
else()
|
||||
set(XCENGINE_PHYSX_BIN_ROOT_DIR "")
|
||||
endif()
|
||||
|
||||
set(XCENGINE_PHYSX_BIN_DIR_DEBUG "${XCENGINE_PHYSX_BIN_ROOT_DIR}/debug")
|
||||
set(XCENGINE_PHYSX_BIN_DIR_RELEASE "${XCENGINE_PHYSX_BIN_ROOT_DIR}/release")
|
||||
set(XCENGINE_PHYSX_BIN_DIR_PROFILE "${XCENGINE_PHYSX_BIN_ROOT_DIR}/profile")
|
||||
set(XCENGINE_PHYSX_BIN_DIR_CHECKED "${XCENGINE_PHYSX_BIN_ROOT_DIR}/checked")
|
||||
|
||||
if(WIN32 AND
|
||||
EXISTS "${XCENGINE_PHYSX_BIN_DIR_DEBUG}/PhysXFoundation_64.lib" AND
|
||||
EXISTS "${XCENGINE_PHYSX_BIN_DIR_DEBUG}/PhysXFoundation_64.dll" AND
|
||||
EXISTS "${XCENGINE_PHYSX_BIN_DIR_DEBUG}/PhysXCommon_64.lib" AND
|
||||
EXISTS "${XCENGINE_PHYSX_BIN_DIR_DEBUG}/PhysXCommon_64.dll" AND
|
||||
EXISTS "${XCENGINE_PHYSX_BIN_DIR_DEBUG}/PhysX_64.lib" AND
|
||||
EXISTS "${XCENGINE_PHYSX_BIN_DIR_DEBUG}/PhysX_64.dll" AND
|
||||
EXISTS "${XCENGINE_PHYSX_BIN_DIR_DEBUG}/PhysXExtensions_static_64.lib")
|
||||
set(XCENGINE_ENABLE_PHYSX ON)
|
||||
message(STATUS "PhysX SDK headers found: ${XCENGINE_PHYSX_INCLUDE_DIR}")
|
||||
message(STATUS "PhysX SDK binaries found: ${XCENGINE_PHYSX_BIN_DIR_DEBUG}")
|
||||
|
||||
function(xcengine_add_physx_imported_shared target base_name)
|
||||
add_library(${target} SHARED IMPORTED GLOBAL)
|
||||
set(imported_configs)
|
||||
|
||||
foreach(config_name DEBUG RELEASE RELWITHDEBINFO MINSIZEREL)
|
||||
if(config_name STREQUAL "DEBUG")
|
||||
set(config_dir "${XCENGINE_PHYSX_BIN_DIR_DEBUG}")
|
||||
elseif(config_name STREQUAL "RELEASE")
|
||||
set(config_dir "${XCENGINE_PHYSX_BIN_DIR_RELEASE}")
|
||||
elseif(config_name STREQUAL "RELWITHDEBINFO")
|
||||
set(config_dir "${XCENGINE_PHYSX_BIN_DIR_PROFILE}")
|
||||
else()
|
||||
set(config_dir "${XCENGINE_PHYSX_BIN_DIR_CHECKED}")
|
||||
endif()
|
||||
|
||||
set(import_lib "${config_dir}/${base_name}.lib")
|
||||
set(runtime_dll "${config_dir}/${base_name}.dll")
|
||||
if(EXISTS "${import_lib}" AND EXISTS "${runtime_dll}")
|
||||
list(APPEND imported_configs ${config_name})
|
||||
set_property(TARGET ${target} PROPERTY "IMPORTED_IMPLIB_${config_name}" "${import_lib}")
|
||||
set_property(TARGET ${target} PROPERTY "IMPORTED_LOCATION_${config_name}" "${runtime_dll}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT imported_configs)
|
||||
message(FATAL_ERROR "PhysX target ${target} has no available runtime binaries.")
|
||||
endif()
|
||||
|
||||
set_property(TARGET ${target} PROPERTY IMPORTED_CONFIGURATIONS "${imported_configs}")
|
||||
endfunction()
|
||||
|
||||
function(xcengine_add_physx_imported_static target base_name)
|
||||
add_library(${target} STATIC IMPORTED GLOBAL)
|
||||
set(imported_configs)
|
||||
|
||||
foreach(config_name DEBUG RELEASE RELWITHDEBINFO MINSIZEREL)
|
||||
if(config_name STREQUAL "DEBUG")
|
||||
set(config_dir "${XCENGINE_PHYSX_BIN_DIR_DEBUG}")
|
||||
elseif(config_name STREQUAL "RELEASE")
|
||||
set(config_dir "${XCENGINE_PHYSX_BIN_DIR_RELEASE}")
|
||||
elseif(config_name STREQUAL "RELWITHDEBINFO")
|
||||
set(config_dir "${XCENGINE_PHYSX_BIN_DIR_PROFILE}")
|
||||
else()
|
||||
set(config_dir "${XCENGINE_PHYSX_BIN_DIR_CHECKED}")
|
||||
endif()
|
||||
|
||||
set(static_lib "${config_dir}/${base_name}.lib")
|
||||
if(EXISTS "${static_lib}")
|
||||
list(APPEND imported_configs ${config_name})
|
||||
set_property(TARGET ${target} PROPERTY "IMPORTED_LOCATION_${config_name}" "${static_lib}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT imported_configs)
|
||||
message(FATAL_ERROR "PhysX target ${target} has no available static libraries.")
|
||||
endif()
|
||||
|
||||
set_property(TARGET ${target} PROPERTY IMPORTED_CONFIGURATIONS "${imported_configs}")
|
||||
endfunction()
|
||||
|
||||
function(xcengine_copy_physx_runtime_dlls target)
|
||||
foreach(physx_target IN LISTS XCENGINE_PHYSX_RUNTIME_DLL_TARGETS)
|
||||
add_custom_command(TARGET ${target} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_FILE:${physx_target}>
|
||||
$<TARGET_FILE_DIR:${target}>/$<TARGET_FILE_NAME:${physx_target}>
|
||||
)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
xcengine_add_physx_imported_shared(XCPhysXFoundation "PhysXFoundation_64")
|
||||
xcengine_add_physx_imported_shared(XCPhysXCommon "PhysXCommon_64")
|
||||
xcengine_add_physx_imported_shared(XCPhysXCore "PhysX_64")
|
||||
|
||||
if(EXISTS "${XCENGINE_PHYSX_BIN_DIR_DEBUG}/PVDRuntime_64.lib" AND
|
||||
EXISTS "${XCENGINE_PHYSX_BIN_DIR_DEBUG}/PVDRuntime_64.dll")
|
||||
xcengine_add_physx_imported_shared(XCPhysXPVDRuntime "PVDRuntime_64")
|
||||
list(APPEND XCENGINE_PHYSX_RUNTIME_DLL_TARGETS XCPhysXPVDRuntime)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${XCENGINE_PHYSX_BIN_DIR_DEBUG}/PhysXCooking_64.lib" AND
|
||||
EXISTS "${XCENGINE_PHYSX_BIN_DIR_DEBUG}/PhysXCooking_64.dll")
|
||||
xcengine_add_physx_imported_shared(XCPhysXCooking "PhysXCooking_64")
|
||||
list(APPEND XCENGINE_PHYSX_RUNTIME_DLL_TARGETS XCPhysXCooking)
|
||||
endif()
|
||||
|
||||
xcengine_add_physx_imported_static(XCPhysXExtensions "PhysXExtensions_static_64")
|
||||
|
||||
if(EXISTS "${XCENGINE_PHYSX_BIN_DIR_DEBUG}/PhysXPvdSDK_static_64.lib")
|
||||
xcengine_add_physx_imported_static(XCPhysXPvdSDK "PhysXPvdSDK_static_64")
|
||||
endif()
|
||||
|
||||
if(EXISTS "${XCENGINE_PHYSX_BIN_DIR_DEBUG}/PhysXTask_static_64.lib")
|
||||
xcengine_add_physx_imported_static(XCPhysXTask "PhysXTask_static_64")
|
||||
endif()
|
||||
|
||||
list(APPEND XCENGINE_PHYSX_LINK_TARGETS
|
||||
XCPhysXCore
|
||||
XCPhysXCommon
|
||||
XCPhysXFoundation
|
||||
XCPhysXExtensions
|
||||
)
|
||||
|
||||
if(TARGET XCPhysXPVDRuntime)
|
||||
list(APPEND XCENGINE_PHYSX_LINK_TARGETS XCPhysXPVDRuntime)
|
||||
endif()
|
||||
|
||||
if(TARGET XCPhysXCooking)
|
||||
list(APPEND XCENGINE_PHYSX_LINK_TARGETS XCPhysXCooking)
|
||||
endif()
|
||||
|
||||
if(TARGET XCPhysXPvdSDK)
|
||||
list(APPEND XCENGINE_PHYSX_LINK_TARGETS XCPhysXPvdSDK)
|
||||
endif()
|
||||
|
||||
if(TARGET XCPhysXTask)
|
||||
list(APPEND XCENGINE_PHYSX_LINK_TARGETS XCPhysXTask)
|
||||
endif()
|
||||
|
||||
list(APPEND XCENGINE_PHYSX_RUNTIME_DLL_TARGETS
|
||||
XCPhysXFoundation
|
||||
XCPhysXCommon
|
||||
XCPhysXCore
|
||||
)
|
||||
else()
|
||||
message(STATUS "PhysX SDK headers found, but required binaries are missing; native PhysX backend will stay disabled until the SDK is built")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "PhysX SDK headers not found; PhysicsWorld will build without native PhysX backend")
|
||||
endif()
|
||||
|
||||
set(
|
||||
XCENGINE_MONO_ROOT_DIR
|
||||
"${CMAKE_SOURCE_DIR}/参考/Fermion/Fermion/external/mono"
|
||||
|
||||
@@ -175,3 +175,7 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
${XCENGINE_ASSIMP_DLL}
|
||||
$<TARGET_FILE_DIR:${PROJECT_NAME}>/assimp-vc143-mt.dll
|
||||
)
|
||||
|
||||
if(WIN32 AND XCENGINE_ENABLE_PHYSX)
|
||||
xcengine_copy_physx_runtime_dlls(${PROJECT_NAME})
|
||||
endif()
|
||||
|
||||
3
engine/third_party/physx/.gitignore
vendored
Normal file
3
engine/third_party/physx/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
compiler/linux-*
|
||||
compiler/vc*
|
||||
include/PxConfig.h
|
||||
5587
engine/third_party/physx/CHANGELOG.md
vendored
Normal file
5587
engine/third_party/physx/CHANGELOG.md
vendored
Normal file
File diff suppressed because it is too large
Load Diff
63
engine/third_party/physx/README.md
vendored
Normal file
63
engine/third_party/physx/README.md
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
# NVIDIA PhysX SDK 5
|
||||
|
||||
Copyright (c) 2008-2025 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 for CPUs and GPUs. See [PhysX SDK on developer.nvidia.com](https://developer.nvidia.com/physx-sdk).
|
||||
|
||||
The [Release Notes](./CHANGELOG.md) contain 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.
|
||||
|
||||
Note that the PhysX distribution downloads binary content, such as the PhysX GPU binaries, from Amazon CloudFront on demand, using the packman package manager.
|
||||
|
||||
## 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 | cmake |
|
||||
| LLVM | University of Illinois at Urbana-Champaign | clang-physxmetadata |
|
||||
| Visual Studio Locator | Microsoft Corporation | VsWhere |
|
||||
| Freeglut | Pawel W. Olszta | freeglut-windows<br>opengl-linux |
|
||||
| Mesa 3-D graphics library | Brian Paul | opengl-linux |
|
||||
| RapidJSON | THL A29 Limited, a Tencent company, and Milo Yip<br>Alexander Chemeris (msinttypes) | rapidjson |
|
||||
| OpenGL Ext Wrangler Lib | Nigel Stewart, Milan Ikits, Marcelo E. Magallon, Lev Povalahev | [SDK_ROOT]/snippets/graphics |
|
||||
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PVDRuntime_64.dll
vendored
Normal file
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PVDRuntime_64.dll
vendored
Normal file
Binary file not shown.
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PVDRuntime_64.lib
vendored
Normal file
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PVDRuntime_64.lib
vendored
Normal file
Binary file not shown.
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCommon_64.dll
vendored
Normal file
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCommon_64.dll
vendored
Normal file
Binary file not shown.
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCommon_64.lib
vendored
Normal file
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCommon_64.lib
vendored
Normal file
Binary file not shown.
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCooking_64.dll
vendored
Normal file
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCooking_64.dll
vendored
Normal file
Binary file not shown.
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCooking_64.lib
vendored
Normal file
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCooking_64.lib
vendored
Normal file
Binary file not shown.
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXExtensions_static_64.lib
vendored
Normal file
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXExtensions_static_64.lib
vendored
Normal file
Binary file not shown.
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXFoundation_64.dll
vendored
Normal file
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXFoundation_64.dll
vendored
Normal file
Binary file not shown.
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXFoundation_64.lib
vendored
Normal file
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXFoundation_64.lib
vendored
Normal file
Binary file not shown.
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXPvdSDK_static_64.lib
vendored
Normal file
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXPvdSDK_static_64.lib
vendored
Normal file
Binary file not shown.
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXTask_static_64.lib
vendored
Normal file
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXTask_static_64.lib
vendored
Normal file
Binary file not shown.
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysX_64.dll
vendored
Normal file
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysX_64.dll
vendored
Normal file
Binary file not shown.
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysX_64.lib
vendored
Normal file
BIN
engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysX_64.lib
vendored
Normal file
Binary file not shown.
419
engine/third_party/physx/buildtools/cmake_generate_projects.py
vendored
Normal file
419
engine/third_party/physx/buildtools/cmake_generate_projects.py
vendored
Normal file
@@ -0,0 +1,419 @@
|
||||
import sys
|
||||
import os
|
||||
import glob
|
||||
import os.path
|
||||
import shutil
|
||||
import subprocess
|
||||
import xml.etree.ElementTree
|
||||
|
||||
|
||||
def cmakeExt():
|
||||
if sys.platform == 'win32':
|
||||
return '.exe'
|
||||
return ''
|
||||
|
||||
|
||||
def filterPreset(presetPath):
|
||||
# If this is a file path, extract the actual preset name from XML or filename
|
||||
if os.path.isfile(presetPath):
|
||||
try:
|
||||
presetXml = xml.etree.ElementTree.parse(presetPath).getroot()
|
||||
presetName = presetXml.get('name')
|
||||
except:
|
||||
# Fall back to just using the basename without extension if XML parsing fails
|
||||
basename = os.path.basename(presetPath)
|
||||
presetName = os.path.splitext(basename)[0]
|
||||
else:
|
||||
# If not a file path, assume it's already a preset name
|
||||
presetName = presetPath
|
||||
|
||||
# Platform-specific filtering
|
||||
winPresetFilter = ['win','switch','crosscompile']
|
||||
if sys.platform == 'win32':
|
||||
# On Windows, include presets that contain win, switch, or crosscompile
|
||||
# (but not windows-crosscompile)
|
||||
if any((presetName.find(elem) != -1 and 'windows-crosscompile' not in presetName) for elem in winPresetFilter):
|
||||
return True
|
||||
else:
|
||||
# On non-Windows, include Linux presets and windows-crosscompile
|
||||
# Check for Linux or other Unix/macOS presets (those not containing Windows-specific terms)
|
||||
# Special case: include windows-crosscompile, which is for cross-compiling Windows targets
|
||||
if 'linux' in presetName.lower() or 'mac' in presetName.lower() or 'windows-crosscompile' in presetName:
|
||||
return True
|
||||
if all(presetName.find(elem) == -1 for elem in ['win', 'switch']):
|
||||
return True
|
||||
return False
|
||||
|
||||
def noPresetProvided(physx_root_dir):
|
||||
global input
|
||||
print('Preset parameter required, available presets:')
|
||||
presets_dir = os.path.join(physx_root_dir, "buildtools", "presets")
|
||||
internal_presets = os.path.join(presets_dir, "*.xml")
|
||||
public_presets = os.path.join(presets_dir, "public", "*.xml")
|
||||
|
||||
# Get all XML files in the presets directory
|
||||
internal_preset_files = glob.glob(internal_presets)
|
||||
|
||||
# Check if we have any non-directory XML files directly in presets folder
|
||||
presetfiles = []
|
||||
for file in internal_preset_files:
|
||||
if not os.path.isdir(file): # Make sure it's a file, not a directory
|
||||
basename = os.path.basename(file)
|
||||
dirname = os.path.dirname(file)
|
||||
if os.path.basename(dirname) != "public": # Skip files in public subdirectory
|
||||
presetfiles.append(file)
|
||||
|
||||
# If no XML files in main presets directory, we're in public distribution
|
||||
# So use the files from public directory
|
||||
if len(presetfiles) == 0:
|
||||
print("No presets in main folder, using public presets")
|
||||
presetfiles = glob.glob(public_presets)
|
||||
|
||||
if len(presetfiles) == 0:
|
||||
print("Error: No preset files found. Make sure the directory structure is correct.")
|
||||
exit(1)
|
||||
|
||||
counter = 0
|
||||
presetList = []
|
||||
for preset in presetfiles:
|
||||
if filterPreset(preset):
|
||||
try:
|
||||
presetXml = xml.etree.ElementTree.parse(preset).getroot()
|
||||
if preset.find('user') == -1:
|
||||
print('(' + str(counter) + ') ' + presetXml.get('name') +
|
||||
' <--- ' + presetXml.get('comment'))
|
||||
presetList.append(presetXml.get('name'))
|
||||
else:
|
||||
print('(' + str(counter) + ') ' + presetXml.get('name') +
|
||||
'.user <--- ' + presetXml.get('comment'))
|
||||
presetList.append(presetXml.get('name') + '.user')
|
||||
counter = counter + 1
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not parse preset file {preset}: {e}")
|
||||
continue
|
||||
|
||||
if counter == 0:
|
||||
print("Error: No valid presets found for this platform.")
|
||||
exit(1)
|
||||
|
||||
# Fix Python 2.x.
|
||||
try:
|
||||
input = raw_input
|
||||
except NameError:
|
||||
pass
|
||||
mode = int(eval(input('Enter preset number: ')))
|
||||
return presetList[mode]
|
||||
|
||||
class CMakePreset:
|
||||
presetName = ''
|
||||
targetPlatform = ''
|
||||
compiler = ''
|
||||
generator = ''
|
||||
cmakeSwitches = []
|
||||
cmakeParams = []
|
||||
|
||||
def __init__(self, presetName, physx_root_dir):
|
||||
xmlPath = os.path.join(physx_root_dir, "buildtools", "presets", f"{presetName}.xml")
|
||||
if os.path.isfile(xmlPath):
|
||||
print('Using preset xml: '+xmlPath)
|
||||
else:
|
||||
xmlPath = os.path.join(physx_root_dir, "buildtools", "presets", "public", f"{presetName}.xml")
|
||||
if os.path.isfile(xmlPath):
|
||||
print('Using preset xml: '+xmlPath)
|
||||
else:
|
||||
print('Preset xml file: '+xmlPath+' not found')
|
||||
exit()
|
||||
|
||||
# get the xml
|
||||
presetNode = xml.etree.ElementTree.parse(xmlPath).getroot()
|
||||
self.presetName = presetNode.attrib['name']
|
||||
for platform in presetNode.findall('platform'):
|
||||
self.targetPlatform = platform.attrib['targetPlatform']
|
||||
self.compiler = platform.attrib['compiler']
|
||||
self.generator = platform.get('generator')
|
||||
print('Target platform: ' + self.targetPlatform +
|
||||
' using compiler: ' + self.compiler)
|
||||
if self.generator is not None:
|
||||
print(' using generator: ' + self.generator)
|
||||
|
||||
for cmakeSwitch in presetNode.find('CMakeSwitches'):
|
||||
cmSwitch = '-D' + \
|
||||
cmakeSwitch.attrib['name'] + '=' + \
|
||||
cmakeSwitch.attrib['value'].upper()
|
||||
self.cmakeSwitches.append(cmSwitch)
|
||||
|
||||
for cmakeParam in presetNode.find('CMakeParams'):
|
||||
if cmakeParam.attrib['name'] == 'CMAKE_INSTALL_PREFIX' or cmakeParam.attrib['name'] == 'PX_OUTPUT_LIB_DIR' or cmakeParam.attrib['name'] == 'PX_OUTPUT_EXE_DIR' or cmakeParam.attrib['name'] == 'PX_OUTPUT_DLL_DIR':
|
||||
cmParam = '-D' + cmakeParam.attrib['name'] + '=\"' + \
|
||||
os.environ['PHYSX_ROOT_DIR'] + '/' + \
|
||||
cmakeParam.attrib['value'] + '\"'
|
||||
else:
|
||||
cmParam = '-D' + \
|
||||
cmakeParam.attrib['name'] + '=' + \
|
||||
cmakeParam.attrib['value']
|
||||
self.cmakeParams.append(cmParam)
|
||||
pass
|
||||
|
||||
def isMultiConfigPlatform(self):
|
||||
if self.targetPlatform == 'linux':
|
||||
return False
|
||||
elif self.targetPlatform == 'linuxAarch64':
|
||||
return False
|
||||
elif self.compiler == 'x86_64-w64-mingw32-g++':
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def getCMakeSwitches(self):
|
||||
outString = ''
|
||||
# We need to check both GPU-related switches
|
||||
gpuProjectsEnabled = False
|
||||
gpuProjectsOnlyEnabled = False
|
||||
|
||||
# Define the switch names for clarity and consistency
|
||||
GPU_PROJECTS_SWITCH = 'PX_GENERATE_GPU_PROJECTS'
|
||||
GPU_PROJECTS_ONLY_SWITCH = 'PX_GENERATE_GPU_PROJECTS_ONLY'
|
||||
|
||||
# First pass: Check the state of GPU-related switches
|
||||
gpu_projects_found = False
|
||||
gpu_projects_only_found = False
|
||||
|
||||
for cmakeSwitch in self.cmakeSwitches:
|
||||
# Format of cmakeSwitch is "-DSWITCH_NAME=VALUE"
|
||||
# Use a more flexible approach to match switches
|
||||
if f'-D{GPU_PROJECTS_SWITCH}=' in cmakeSwitch:
|
||||
gpu_projects_found = True
|
||||
gpuProjectsEnabled = cmakeSwitch.endswith('=TRUE')
|
||||
elif f'-D{GPU_PROJECTS_ONLY_SWITCH}=' in cmakeSwitch:
|
||||
gpu_projects_only_found = True
|
||||
gpuProjectsOnlyEnabled = cmakeSwitch.endswith('=TRUE')
|
||||
|
||||
# Log the state of GPU switches for debugging
|
||||
if not gpu_projects_found:
|
||||
print(f"Warning: {GPU_PROJECTS_SWITCH} switch not found in preset. Defaulting to disabled.")
|
||||
if not gpu_projects_only_found:
|
||||
print(f"Warning: {GPU_PROJECTS_ONLY_SWITCH} switch not found in preset. Defaulting to disabled.")
|
||||
|
||||
# Determine if we need to add CUDA paths
|
||||
gpuEnabled = gpuProjectsEnabled or gpuProjectsOnlyEnabled
|
||||
|
||||
# Log GPU status
|
||||
print(f"GPU projects enabled: {gpuEnabled} ({GPU_PROJECTS_SWITCH}={gpuProjectsEnabled}, {GPU_PROJECTS_ONLY_SWITCH}={gpuProjectsOnlyEnabled})")
|
||||
|
||||
# Second pass: Add all switches to output
|
||||
for cmakeSwitch in self.cmakeSwitches:
|
||||
outString = outString + ' ' + cmakeSwitch
|
||||
|
||||
# Only add CUDA paths if GPU is enabled
|
||||
if gpuEnabled:
|
||||
if os.environ.get('PM_CUDA_PATH') is not None:
|
||||
if os.environ.get('PM_CUDA_PATH') is not None:
|
||||
outString = outString + ' -DCUDAToolkit_ROOT_DIR=' + \
|
||||
os.environ['PM_CUDA_PATH']
|
||||
if self.compiler in ['vc15', 'vc16', 'vc17'] and self.generator != 'ninja':
|
||||
outString = outString + ' -T cuda=' + os.environ['PM_CUDA_PATH']
|
||||
# TODO: Need to do the same for gcc (aarch64) when we package it with Packman
|
||||
elif self.compiler == 'clang':
|
||||
if os.environ.get('PM_clang_PATH') is not None:
|
||||
outString = outString + ' -DCMAKE_CUDA_HOST_COMPILER=' + \
|
||||
os.environ['PM_clang_PATH'] + '/bin/clang++'
|
||||
|
||||
return outString
|
||||
|
||||
def getCMakeParams(self):
|
||||
outString = ''
|
||||
for cmakeParam in self.cmakeParams:
|
||||
outString = outString + ' ' + cmakeParam # + ' --trace'
|
||||
return outString
|
||||
|
||||
def getPlatformCMakeParams(self):
|
||||
cmake_modules_root = os.environ['PHYSX_ROOT_DIR'] + '/source/compiler/cmake/modules'
|
||||
outString = ' '
|
||||
|
||||
vs_versions = {
|
||||
'vc15': '\"Visual Studio 15 2017\"',
|
||||
'vc16': '\"Visual Studio 16 2019\"',
|
||||
'vc17': '\"Visual Studio 17 2022\"'
|
||||
}
|
||||
|
||||
# Visual studio
|
||||
if self.compiler in vs_versions:
|
||||
generator = '-G \"Ninja Multi-Config\"' if self.generator == 'ninja' else '-G ' + vs_versions[self.compiler]
|
||||
outString += generator
|
||||
# Windows crosscompile
|
||||
elif self.compiler == 'x86_64-w64-mingw32-g++':
|
||||
outString = outString + '-G \"Ninja\"'
|
||||
# mac
|
||||
elif self.compiler == 'xcode':
|
||||
outString = outString + '-G Xcode'
|
||||
# Linux
|
||||
elif self.targetPlatform in ['linux', 'linuxAarch64']:
|
||||
if self.generator is not None and self.generator == 'ninja':
|
||||
outString = outString + '-G \"Ninja\"'
|
||||
outString = outString + ' -DCMAKE_MAKE_PROGRAM=' + os.environ['PM_ninja_PATH'] + '/ninja'
|
||||
else:
|
||||
outString = outString + '-G \"Unix Makefiles\"'
|
||||
|
||||
if self.targetPlatform == 'win64':
|
||||
if self.generator != 'ninja':
|
||||
outString = outString + ' -Ax64'
|
||||
outString = outString + ' -DTARGET_BUILD_PLATFORM=windows'
|
||||
outString = outString + ' -DPX_OUTPUT_ARCH=x86'
|
||||
if self.compiler == 'x86_64-w64-mingw32-g++':
|
||||
outString = outString + ' -DCMAKE_TOOLCHAIN_FILE=' + \
|
||||
cmake_modules_root + '/linux/WindowsCrossToolchain.linux-unknown-x86_64.cmake'
|
||||
return outString
|
||||
elif self.targetPlatform == 'switch64':
|
||||
outString = outString + ' -DTARGET_BUILD_PLATFORM=switch'
|
||||
outString = outString + ' -DCMAKE_TOOLCHAIN_FILE=' + \
|
||||
cmake_modules_root + '/switch/NX64Toolchain.txt'
|
||||
outString = outString + ' -DCMAKE_GENERATOR_PLATFORM=NX64'
|
||||
return outString
|
||||
elif self.targetPlatform == 'linux':
|
||||
outString = outString + ' -DTARGET_BUILD_PLATFORM=linux'
|
||||
outString = outString + ' -DPX_OUTPUT_ARCH=x86'
|
||||
if self.compiler == 'clang-crosscompile':
|
||||
outString = outString + ' -DCMAKE_TOOLCHAIN_FILE=' + \
|
||||
cmake_modules_root + '/linux/LinuxCrossToolchain.x86_64-unknown-linux-gnu.cmake'
|
||||
outString = outString + ' -DCMAKE_MAKE_PROGRAM=' + os.environ.get('PM_MinGW_PATH') + '/bin/mingw32-make.exe'
|
||||
elif self.compiler == 'clang':
|
||||
if os.environ.get('PM_clang_PATH') is not None:
|
||||
outString = outString + ' -DCMAKE_C_COMPILER=' + \
|
||||
os.environ['PM_clang_PATH'] + '/bin/clang'
|
||||
outString = outString + ' -DCMAKE_CXX_COMPILER=' + \
|
||||
os.environ['PM_clang_PATH'] + '/bin/clang++'
|
||||
else:
|
||||
outString = outString + ' -DCMAKE_C_COMPILER=clang'
|
||||
outString = outString + ' -DCMAKE_CXX_COMPILER=clang++'
|
||||
return outString
|
||||
elif self.targetPlatform == 'linuxAarch64':
|
||||
outString = outString + ' -DTARGET_BUILD_PLATFORM=linux'
|
||||
outString = outString + ' -DPX_OUTPUT_ARCH=arm'
|
||||
if self.compiler == 'clang-crosscompile':
|
||||
outString = outString + ' -DCMAKE_TOOLCHAIN_FILE=' + \
|
||||
cmake_modules_root + '/linux/LinuxCrossToolchain.aarch64-unknown-linux-gnueabihf.cmake'
|
||||
outString = outString + ' -DCMAKE_MAKE_PROGRAM=' + os.environ.get('PM_MinGW_PATH') + '/bin/mingw32-make.exe'
|
||||
elif self.compiler == 'gcc':
|
||||
# TODO: To change so it uses Packman's compiler. Then add it as
|
||||
# host compiler for CUDA above.
|
||||
outString = outString + ' -DCMAKE_TOOLCHAIN_FILE=\"' + \
|
||||
cmake_modules_root + '/linux/LinuxAarch64.cmake\"'
|
||||
elif self.compiler == 'clang':
|
||||
if os.environ.get('PM_clang_PATH') is not None:
|
||||
outString = outString + ' -DCMAKE_C_COMPILER=' + \
|
||||
os.environ['PM_clang_PATH'] + '/bin/clang'
|
||||
outString = outString + ' -DCMAKE_CXX_COMPILER=' + \
|
||||
os.environ['PM_clang_PATH'] + '/bin/clang++'
|
||||
else:
|
||||
outString = outString + ' -DCMAKE_C_COMPILER=clang'
|
||||
outString = outString + ' -DCMAKE_CXX_COMPILER=clang++'
|
||||
|
||||
return outString
|
||||
elif self.targetPlatform == 'mac64':
|
||||
outString = outString + ' -DTARGET_BUILD_PLATFORM=mac'
|
||||
outString = outString + ' -DPX_OUTPUT_ARCH=x86'
|
||||
return outString
|
||||
return ''
|
||||
|
||||
|
||||
def getCommonParams():
|
||||
outString = '--no-warn-unused-cli'
|
||||
outString = outString + ' -DCMAKE_PREFIX_PATH=\"' + os.environ['PM_PATHS'] + '\"'
|
||||
outString = outString + ' -DPHYSX_ROOT_DIR=\"' + \
|
||||
os.environ['PHYSX_ROOT_DIR'] + '\"'
|
||||
outString = outString + ' -DPX_OUTPUT_LIB_DIR=\"' + \
|
||||
os.environ['PHYSX_ROOT_DIR'] + '\"'
|
||||
outString = outString + ' -DPX_OUTPUT_BIN_DIR=\"' + \
|
||||
os.environ['PHYSX_ROOT_DIR'] + '\"'
|
||||
if os.environ.get('GENERATE_SOURCE_DISTRO') == '1':
|
||||
outString = outString + ' -DPX_GENERATE_SOURCE_DISTRO=1'
|
||||
return outString
|
||||
|
||||
def cleanupCompilerDir(compilerDirName):
|
||||
if os.path.exists(compilerDirName):
|
||||
if sys.platform == 'win32':
|
||||
os.system('rmdir /S /Q ' + compilerDirName)
|
||||
else:
|
||||
shutil.rmtree(compilerDirName, True)
|
||||
if os.path.exists(compilerDirName) == False:
|
||||
os.makedirs(compilerDirName)
|
||||
|
||||
def presetProvided(pName, physx_root_dir):
|
||||
parsedPreset = CMakePreset(pName, physx_root_dir)
|
||||
|
||||
print('PM_PATHS: ' + os.environ['PM_PATHS'])
|
||||
|
||||
if os.environ.get('PM_cmake_PATH') is not None:
|
||||
cmakeExec = os.environ['PM_cmake_PATH'] + '/bin/cmake' + cmakeExt()
|
||||
else:
|
||||
cmakeExec = 'cmake' + cmakeExt()
|
||||
print('Cmake: ' + cmakeExec)
|
||||
|
||||
# gather cmake parameters
|
||||
cmakeParams = parsedPreset.getPlatformCMakeParams()
|
||||
cmakeParams = cmakeParams + ' ' + getCommonParams()
|
||||
cmakeParams = cmakeParams + ' ' + parsedPreset.getCMakeSwitches()
|
||||
cmakeParams = cmakeParams + ' ' + parsedPreset.getCMakeParams()
|
||||
# print(cmakeParams)
|
||||
|
||||
if os.path.isfile(physx_root_dir + '/compiler/internal/CMakeLists.txt'):
|
||||
cmakeMasterDir = 'internal'
|
||||
else:
|
||||
cmakeMasterDir = 'public'
|
||||
if parsedPreset.isMultiConfigPlatform():
|
||||
# cleanup and create output directory
|
||||
outputDir = os.path.join(physx_root_dir, 'compiler', parsedPreset.presetName)
|
||||
cleanupCompilerDir(outputDir)
|
||||
|
||||
# run the cmake script
|
||||
#print('Cmake params:' + cmakeParams)
|
||||
os.chdir(outputDir)
|
||||
os.system(cmakeExec + ' \"' +
|
||||
physx_root_dir + '/compiler/' + cmakeMasterDir + '\"' + cmakeParams)
|
||||
os.chdir(physx_root_dir)
|
||||
else:
|
||||
configs = ['debug', 'checked', 'profile', 'release']
|
||||
for config in configs:
|
||||
# cleanup and create output directory
|
||||
outputDir = os.path.join(physx_root_dir, 'compiler', parsedPreset.presetName + '-' + config)
|
||||
cleanupCompilerDir(outputDir)
|
||||
|
||||
# run the cmake script
|
||||
#print('Cmake params:' + cmakeParams)
|
||||
os.chdir(outputDir)
|
||||
# print(cmakeExec + ' \"' + physx_root_dir + '/compiler/' + cmakeMasterDir + '\"' + cmakeParams + ' -DCMAKE_BUILD_TYPE=' + config)
|
||||
os.system(cmakeExec + ' \"' + physx_root_dir + '/compiler/' +
|
||||
cmakeMasterDir + '\"' + cmakeParams + ' -DCMAKE_BUILD_TYPE=' + config)
|
||||
os.chdir(physx_root_dir)
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
if (sys.version_info[0] < 3) or (sys.version_info[0] == 3 and sys.version_info[1] < 5):
|
||||
print("You are using Python {}. You must use Python 3.5 and up. Please read README.md for requirements.").format(sys.version)
|
||||
exit()
|
||||
|
||||
physx_root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
|
||||
os.environ['PHYSX_ROOT_DIR'] = physx_root_dir.replace("\\", "/")
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
presetName = noPresetProvided(physx_root_dir) # Ensure this function returns the preset name
|
||||
if sys.platform == 'win32':
|
||||
print('Running generate_projects.bat ' + presetName)
|
||||
cmd_path = os.path.join(physx_root_dir, 'generate_projects.bat')
|
||||
cmd = f'"{cmd_path}" {presetName}'
|
||||
result = subprocess.run(cmd, cwd=physx_root_dir, check=True, shell=True, universal_newlines=True)
|
||||
# TODO: catch exception and add capture errors
|
||||
else:
|
||||
print('Running generate_projects.sh ' + presetName)
|
||||
cmd_path = os.path.join(physx_root_dir, 'generate_projects.sh')
|
||||
cmd = [cmd_path, presetName]
|
||||
result = subprocess.run(cmd, cwd=physx_root_dir, check=True, universal_newlines=True)
|
||||
# TODO: catch exception and add capture errors
|
||||
else:
|
||||
presetName = sys.argv[1]
|
||||
if filterPreset(presetName):
|
||||
presetProvided(presetName, physx_root_dir)
|
||||
else:
|
||||
print('Preset not supported on this build platform.')
|
||||
main()
|
||||
169
engine/third_party/physx/buildtools/packman/bootstrap/configure.bat
vendored
Normal file
169
engine/third_party/physx/buildtools/packman/bootstrap/configure.bat
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
:: Copyright 2019-2025 NVIDIA CORPORATION
|
||||
::
|
||||
:: 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.
|
||||
|
||||
set PM_PACKMAN_VERSION=7.23.1
|
||||
|
||||
:: Specify where packman command is rooted
|
||||
set PM_INSTALL_PATH=%~dp0..
|
||||
|
||||
:: The external root may already be configured and we should do minimal work in that case
|
||||
if defined PM_PACKAGES_ROOT goto ENSURE_DIR
|
||||
|
||||
:: If the folder isn't set we assume that the best place for it is on the drive that we are currently
|
||||
:: running from
|
||||
set PM_DRIVE=%CD:~0,2%
|
||||
|
||||
set PM_PACKAGES_ROOT=%PM_DRIVE%\packman-repo
|
||||
|
||||
:: We use *setx* here so that the variable is persisted in the user environment
|
||||
echo Setting user environment variable PM_PACKAGES_ROOT to %PM_PACKAGES_ROOT%
|
||||
setx PM_PACKAGES_ROOT %PM_PACKAGES_ROOT%
|
||||
if %errorlevel% neq 0 ( goto ERROR )
|
||||
|
||||
:: The above doesn't work properly from a build step in VisualStudio because a separate process is
|
||||
:: spawned for it so it will be lost for subsequent compilation steps - VisualStudio must
|
||||
:: be launched from a new process. We catch this odd-ball case here:
|
||||
if defined PM_DISABLE_VS_WARNING goto ENSURE_DIR
|
||||
if not defined VSLANG goto ENSURE_DIR
|
||||
echo The above is a once-per-computer operation. Unfortunately VisualStudio cannot pick up environment change
|
||||
echo unless *VisualStudio is RELAUNCHED*.
|
||||
echo If you are launching VisualStudio from command line or command line utility make sure
|
||||
echo you have a fresh launch environment (relaunch the command line or utility).
|
||||
echo If you are using 'linkPath' and referring to packages via local folder links you can safely ignore this warning.
|
||||
echo You can disable this warning by setting the environment variable PM_DISABLE_VS_WARNING.
|
||||
echo.
|
||||
|
||||
:: Check for the directory that we need. Note that mkdir will create any directories
|
||||
:: that may be needed in the path
|
||||
:ENSURE_DIR
|
||||
if not exist "%PM_PACKAGES_ROOT%" (
|
||||
echo Creating packman packages cache at %PM_PACKAGES_ROOT%
|
||||
mkdir "%PM_PACKAGES_ROOT%"
|
||||
)
|
||||
if %errorlevel% neq 0 ( goto ERROR_MKDIR_PACKAGES_ROOT )
|
||||
|
||||
:: The Python interpreter may already be externally configured
|
||||
if defined PM_PYTHON_EXT (
|
||||
set PM_PYTHON=%PM_PYTHON_EXT%
|
||||
goto PACKMAN
|
||||
)
|
||||
|
||||
set PM_PYTHON_VERSION=3.10.5-1-windows-x86_64
|
||||
set PM_PYTHON_BASE_DIR=%PM_PACKAGES_ROOT%\python
|
||||
set PM_PYTHON_DIR=%PM_PYTHON_BASE_DIR%\%PM_PYTHON_VERSION%
|
||||
set PM_PYTHON=%PM_PYTHON_DIR%\python.exe
|
||||
|
||||
if exist "%PM_PYTHON%" goto PACKMAN
|
||||
if not exist "%PM_PYTHON_BASE_DIR%" call :CREATE_PYTHON_BASE_DIR
|
||||
|
||||
set PM_PYTHON_PACKAGE=python@%PM_PYTHON_VERSION%.cab
|
||||
for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do set TEMP_FILE_NAME=%%a
|
||||
set TARGET=%TEMP_FILE_NAME%.zip
|
||||
call "%~dp0fetch_file_from_packman_bootstrap.cmd" %PM_PYTHON_PACKAGE% "%TARGET%"
|
||||
if %errorlevel% neq 0 (
|
||||
echo !!! Error fetching python from CDN !!!
|
||||
goto ERROR
|
||||
)
|
||||
|
||||
for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_folder.ps1" -parentPath "%PM_PYTHON_BASE_DIR%"') do set TEMP_FOLDER_NAME=%%a
|
||||
echo Unpacking Python interpreter ...
|
||||
"%SystemRoot%\system32\expand.exe" -F:* "%TARGET%" "%TEMP_FOLDER_NAME%" 1> nul
|
||||
del "%TARGET%"
|
||||
:: Failure during extraction to temp folder name, need to clean up and abort
|
||||
if %errorlevel% neq 0 (
|
||||
echo !!! Error unpacking python !!!
|
||||
call :CLEAN_UP_TEMP_FOLDER
|
||||
goto ERROR
|
||||
)
|
||||
|
||||
:: If python has now been installed by a concurrent process we need to clean up and then continue
|
||||
if exist "%PM_PYTHON%" (
|
||||
call :CLEAN_UP_TEMP_FOLDER
|
||||
goto PACKMAN
|
||||
) else (
|
||||
if exist "%PM_PYTHON_DIR%" ( rd /s /q "%PM_PYTHON_DIR%" > nul )
|
||||
)
|
||||
|
||||
:: Perform atomic move (allowing overwrite, /y)
|
||||
move /y "%TEMP_FOLDER_NAME%" "%PM_PYTHON_DIR%" 1> nul
|
||||
:: Verify that python.exe is now where we expect
|
||||
if exist "%PM_PYTHON%" goto PACKMAN
|
||||
|
||||
:: Wait a second and try again (can help with access denied weirdness)
|
||||
timeout /t 1 /nobreak 1> nul
|
||||
move /y "%TEMP_FOLDER_NAME%" "%PM_PYTHON_DIR%" 1> nul
|
||||
if %errorlevel% neq 0 (
|
||||
echo !!! Error moving python %TEMP_FOLDER_NAME% -> %PM_PYTHON_DIR% !!!
|
||||
call :CLEAN_UP_TEMP_FOLDER
|
||||
goto ERROR
|
||||
)
|
||||
|
||||
:PACKMAN
|
||||
:: The packman module may already be externally configured
|
||||
if defined PM_MODULE_DIR_EXT (
|
||||
set PM_MODULE_DIR=%PM_MODULE_DIR_EXT%
|
||||
) else (
|
||||
set PM_MODULE_DIR=%PM_PACKAGES_ROOT%\packman-common\%PM_PACKMAN_VERSION%
|
||||
)
|
||||
|
||||
set PM_MODULE=%PM_MODULE_DIR%\run.py
|
||||
|
||||
if exist "%PM_MODULE%" goto END
|
||||
|
||||
:: Clean out broken PM_MODULE_DIR if it exists
|
||||
if exist "%PM_MODULE_DIR%" ( rd /s /q "%PM_MODULE_DIR%" > nul )
|
||||
|
||||
set PM_MODULE_PACKAGE=packman-common@%PM_PACKMAN_VERSION%.zip
|
||||
for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do set TEMP_FILE_NAME=%%a
|
||||
set TARGET=%TEMP_FILE_NAME%
|
||||
call "%~dp0fetch_file_from_packman_bootstrap.cmd" %PM_MODULE_PACKAGE% "%TARGET%"
|
||||
if %errorlevel% neq 0 (
|
||||
echo !!! Error fetching packman from CDN !!!
|
||||
goto ERROR
|
||||
)
|
||||
|
||||
echo Unpacking ...
|
||||
"%PM_PYTHON%" -S -s -u -E "%~dp0\install_package.py" "%TARGET%" "%PM_MODULE_DIR%"
|
||||
if %errorlevel% neq 0 (
|
||||
echo !!! Error unpacking packman !!!
|
||||
goto ERROR
|
||||
)
|
||||
|
||||
del "%TARGET%"
|
||||
|
||||
goto END
|
||||
|
||||
:ERROR_MKDIR_PACKAGES_ROOT
|
||||
echo Failed to automatically create packman packages repo at %PM_PACKAGES_ROOT%.
|
||||
echo Please set a location explicitly that packman has permission to write to, by issuing:
|
||||
echo.
|
||||
echo setx PM_PACKAGES_ROOT {path-you-choose-for-storing-packman-packages-locally}
|
||||
echo.
|
||||
echo Then launch a new command console for the changes to take effect and run packman command again.
|
||||
exit /B %errorlevel%
|
||||
|
||||
:ERROR
|
||||
echo !!! Failure while configuring local machine :( !!!
|
||||
exit /B %errorlevel%
|
||||
|
||||
:CLEAN_UP_TEMP_FOLDER
|
||||
rd /S /Q "%TEMP_FOLDER_NAME%"
|
||||
exit /B
|
||||
|
||||
:CREATE_PYTHON_BASE_DIR
|
||||
:: We ignore errors and clean error state - if two processes create the directory one will fail which is fine
|
||||
md "%PM_PYTHON_BASE_DIR%" > nul 2>&1
|
||||
exit /B 0
|
||||
|
||||
:END
|
||||
53
engine/third_party/physx/buildtools/packman/bootstrap/download_file_from_url.ps1
vendored
Normal file
53
engine/third_party/physx/buildtools/packman/bootstrap/download_file_from_url.ps1
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
<#
|
||||
Copyright 2019 NVIDIA CORPORATION
|
||||
|
||||
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.
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][string]$source=$null,
|
||||
[string]$output="out.exe"
|
||||
)
|
||||
$filename = $output
|
||||
|
||||
$triesLeft = 4
|
||||
$delay = 2
|
||||
do
|
||||
{
|
||||
$triesLeft -= 1
|
||||
|
||||
try
|
||||
{
|
||||
Write-Host "Downloading from bootstrap.packman.nvidia.com ..."
|
||||
$wc = New-Object net.webclient
|
||||
$wc.Downloadfile($source, $fileName)
|
||||
exit 0
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Host "Error downloading $source!"
|
||||
Write-Host $_.Exception|format-list -force
|
||||
if ($triesLeft)
|
||||
{
|
||||
Write-Host "Retrying in $delay seconds ..."
|
||||
Start-Sleep -seconds $delay
|
||||
}
|
||||
$delay = $delay * $delay
|
||||
}
|
||||
} while ($triesLeft -gt 0)
|
||||
# We only get here if the retries have been exhausted, remove any left-overs:
|
||||
if (Test-Path $fileName)
|
||||
{
|
||||
Remove-Item $fileName
|
||||
}
|
||||
exit 1
|
||||
35
engine/third_party/physx/buildtools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd
vendored
Normal file
35
engine/third_party/physx/buildtools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
:: Copyright 2019 NVIDIA CORPORATION
|
||||
::
|
||||
:: 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.
|
||||
|
||||
:: You need to specify <package-name> <target-path> as input to this command
|
||||
@setlocal
|
||||
@set PACKAGE_NAME=%1
|
||||
@set TARGET_PATH=%2
|
||||
|
||||
@echo Fetching %PACKAGE_NAME% ...
|
||||
|
||||
@powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0download_file_from_url.ps1" ^
|
||||
-source "http://bootstrap.packman.nvidia.com/%PACKAGE_NAME%" -output %TARGET_PATH%
|
||||
:: A bug in powershell prevents the errorlevel code from being set when using the -File execution option
|
||||
:: We must therefore do our own failure analysis, basically make sure the file exists:
|
||||
@if not exist %TARGET_PATH% goto ERROR_DOWNLOAD_FAILED
|
||||
|
||||
@endlocal
|
||||
@exit /b 0
|
||||
|
||||
:ERROR_DOWNLOAD_FAILED
|
||||
@echo Failed to download file from S3
|
||||
@echo Most likely because endpoint cannot be reached or file %PACKAGE_NAME% doesn't exist
|
||||
@endlocal
|
||||
@exit /b 1
|
||||
161
engine/third_party/physx/buildtools/packman/bootstrap/generate_temp_file_name.ps1
vendored
Normal file
161
engine/third_party/physx/buildtools/packman/bootstrap/generate_temp_file_name.ps1
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
<#
|
||||
Copyright 2019 NVIDIA CORPORATION
|
||||
|
||||
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.
|
||||
#>
|
||||
|
||||
$out = [System.IO.Path]::GetTempFileName()
|
||||
Write-Host $out
|
||||
# SIG # Begin signature block
|
||||
# MIIaVwYJKoZIhvcNAQcCoIIaSDCCGkQCAQExDzANBglghkgBZQMEAgEFADB5Bgor
|
||||
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
|
||||
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAK+Ewup1N0/mdf
|
||||
# 1l4R58rxyumHgZvTmEhrYTb2Zf0zd6CCCiIwggTTMIIDu6ADAgECAhBi50XpIWUh
|
||||
# PJcfXEkK6hKlMA0GCSqGSIb3DQEBCwUAMIGEMQswCQYDVQQGEwJVUzEdMBsGA1UE
|
||||
# ChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xHzAdBgNVBAsTFlN5bWFudGVjIFRydXN0
|
||||
# IE5ldHdvcmsxNTAzBgNVBAMTLFN5bWFudGVjIENsYXNzIDMgU0hBMjU2IENvZGUg
|
||||
# U2lnbmluZyBDQSAtIEcyMB4XDTE4MDcwOTAwMDAwMFoXDTIxMDcwOTIzNTk1OVow
|
||||
# gYMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRQwEgYDVQQHDAtT
|
||||
# YW50YSBDbGFyYTEbMBkGA1UECgwSTlZJRElBIENvcnBvcmF0aW9uMQ8wDQYDVQQL
|
||||
# DAZJVC1NSVMxGzAZBgNVBAMMEk5WSURJQSBDb3Jwb3JhdGlvbjCCASIwDQYJKoZI
|
||||
# hvcNAQEBBQADggEPADCCAQoCggEBALEZN63dA47T4i90jZ84CJ/aWUwVtLff8AyP
|
||||
# YspFfIZGdZYiMgdb8A5tBh7653y0G/LZL6CVUkgejcpvBU/Dl/52a+gSWy2qJ2bH
|
||||
# jMFMKCyQDhdpCAKMOUKSC9rfzm4cFeA9ct91LQCAait4LhLlZt/HF7aG+r0FgCZa
|
||||
# HJjJvE7KNY9G4AZXxjSt8CXS8/8NQMANqjLX1r+F+Hl8PzQ1fVx0mMsbdtaIV4Pj
|
||||
# 5flAeTUnz6+dCTx3vTUo8MYtkS2UBaQv7t7H2B7iwJDakEQKk1XHswJdeqG0osDU
|
||||
# z6+NVks7uWE1N8UIhvzbw0FEX/U2kpfyWaB/J3gMl8rVR8idPj8CAwEAAaOCAT4w
|
||||
# ggE6MAkGA1UdEwQCMAAwDgYDVR0PAQH/BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUF
|
||||
# BwMDMGEGA1UdIARaMFgwVgYGZ4EMAQQBMEwwIwYIKwYBBQUHAgEWF2h0dHBzOi8v
|
||||
# ZC5zeW1jYi5jb20vY3BzMCUGCCsGAQUFBwICMBkMF2h0dHBzOi8vZC5zeW1jYi5j
|
||||
# b20vcnBhMB8GA1UdIwQYMBaAFNTABiJJ6zlL3ZPiXKG4R3YJcgNYMCsGA1UdHwQk
|
||||
# MCIwIKAeoByGGmh0dHA6Ly9yYi5zeW1jYi5jb20vcmIuY3JsMFcGCCsGAQUFBwEB
|
||||
# BEswSTAfBggrBgEFBQcwAYYTaHR0cDovL3JiLnN5bWNkLmNvbTAmBggrBgEFBQcw
|
||||
# AoYaaHR0cDovL3JiLnN5bWNiLmNvbS9yYi5jcnQwDQYJKoZIhvcNAQELBQADggEB
|
||||
# AIJKh5vKJdhHJtMzATmc1BmXIQ3RaJONOZ5jMHn7HOkYU1JP0OIzb4pXXkH8Xwfr
|
||||
# K6bnd72IhcteyksvKsGpSvK0PBBwzodERTAu1Os2N+EaakxQwV/xtqDm1E3IhjHk
|
||||
# fRshyKKzmFk2Ci323J4lHtpWUj5Hz61b8gd72jH7xnihGi+LORJ2uRNZ3YuqMNC3
|
||||
# SBC8tAyoJqEoTJirULUCXW6wX4XUm5P2sx+htPw7szGblVKbQ+PFinNGnsSEZeKz
|
||||
# D8jUb++1cvgTKH59Y6lm43nsJjkZU77tNqyq4ABwgQRk6lt8cS2PPwjZvTmvdnla
|
||||
# ZhR0K4of+pQaUQHXVIBdji8wggVHMIIEL6ADAgECAhB8GzU1SufbdOdBXxFpymuo
|
||||
# MA0GCSqGSIb3DQEBCwUAMIG9MQswCQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNp
|
||||
# Z24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNV
|
||||
# BAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
|
||||
# IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmlj
|
||||
# YXRpb24gQXV0aG9yaXR5MB4XDTE0MDcyMjAwMDAwMFoXDTI0MDcyMTIzNTk1OVow
|
||||
# gYQxCzAJBgNVBAYTAlVTMR0wGwYDVQQKExRTeW1hbnRlYyBDb3Jwb3JhdGlvbjEf
|
||||
# MB0GA1UECxMWU3ltYW50ZWMgVHJ1c3QgTmV0d29yazE1MDMGA1UEAxMsU3ltYW50
|
||||
# ZWMgQ2xhc3MgMyBTSEEyNTYgQ29kZSBTaWduaW5nIENBIC0gRzIwggEiMA0GCSqG
|
||||
# SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDXlUPU3N9nrjn7UqS2JjEEcOm3jlsqujdp
|
||||
# NZWPu8Aw54bYc7vf69F2P4pWjustS/BXGE6xjaUz0wt1I9VqeSfdo9P3Dodltd6t
|
||||
# HPH1NbQiUa8iocFdS5B/wFlOq515qQLXHkmxO02H/sJ4q7/vUq6crwjZOeWaUT5p
|
||||
# XzAQTnFjbFjh8CAzGw90vlvLEuHbjMSAlHK79kWansElC/ujHJ7YpglwcezAR0yP
|
||||
# fcPeGc4+7gRyjhfT//CyBTIZTNOwHJ/+pXggQnBBsCaMbwDIOgARQXpBsKeKkQSg
|
||||
# mXj0d7TzYCrmbFAEtxRg/w1R9KiLhP4h2lxeffUpeU+wRHRvbXL/AgMBAAGjggF4
|
||||
# MIIBdDAuBggrBgEFBQcBAQQiMCAwHgYIKwYBBQUHMAGGEmh0dHA6Ly9zLnN5bWNk
|
||||
# LmNvbTASBgNVHRMBAf8ECDAGAQH/AgEAMGYGA1UdIARfMF0wWwYLYIZIAYb4RQEH
|
||||
# FwMwTDAjBggrBgEFBQcCARYXaHR0cHM6Ly9kLnN5bWNiLmNvbS9jcHMwJQYIKwYB
|
||||
# BQUHAgIwGRoXaHR0cHM6Ly9kLnN5bWNiLmNvbS9ycGEwNgYDVR0fBC8wLTAroCmg
|
||||
# J4YlaHR0cDovL3Muc3ltY2IuY29tL3VuaXZlcnNhbC1yb290LmNybDATBgNVHSUE
|
||||
# DDAKBggrBgEFBQcDAzAOBgNVHQ8BAf8EBAMCAQYwKQYDVR0RBCIwIKQeMBwxGjAY
|
||||
# BgNVBAMTEVN5bWFudGVjUEtJLTEtNzI0MB0GA1UdDgQWBBTUwAYiSes5S92T4lyh
|
||||
# uEd2CXIDWDAfBgNVHSMEGDAWgBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG
|
||||
# 9w0BAQsFAAOCAQEAf+vKp+qLdkLrPo4gVDDjt7nc+kg+FscPRZUQzSeGo2bzAu1x
|
||||
# +KrCVZeRcIP5Un5SaTzJ8eCURoAYu6HUpFam8x0AkdWG80iH4MvENGggXrTL+QXt
|
||||
# nK9wUye56D5+UaBpcYvcUe2AOiUyn0SvbkMo0yF1u5fYi4uM/qkERgSF9xWcSxGN
|
||||
# xCwX/tVuf5riVpLxlrOtLfn039qJmc6yOETA90d7yiW5+ipoM5tQct6on9TNLAs0
|
||||
# vYsweEDgjY4nG5BvGr4IFYFd6y/iUedRHsl4KeceZb847wFKAQkkDhbEFHnBQTc0
|
||||
# 0D2RUpSd4WjvCPDiaZxnbpALGpNx1CYCw8BaIzGCD4swgg+HAgEBMIGZMIGEMQsw
|
||||
# CQYDVQQGEwJVUzEdMBsGA1UEChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xHzAdBgNV
|
||||
# BAsTFlN5bWFudGVjIFRydXN0IE5ldHdvcmsxNTAzBgNVBAMTLFN5bWFudGVjIENs
|
||||
# YXNzIDMgU0hBMjU2IENvZGUgU2lnbmluZyBDQSAtIEcyAhBi50XpIWUhPJcfXEkK
|
||||
# 6hKlMA0GCWCGSAFlAwQCAQUAoHwwEAYKKwYBBAGCNwIBDDECMAAwGQYJKoZIhvcN
|
||||
# AQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEOMAwGCisGAQQBgjcCARUw
|
||||
# LwYJKoZIhvcNAQkEMSIEIPW+EpFrZSdzrjFFo0UT+PzFeYn/GcWNyWFaU/JMrMfR
|
||||
# MA0GCSqGSIb3DQEBAQUABIIBAA8fmU/RJcF9t60DZZAjf8FB3EZddOaHgI9z40nV
|
||||
# CnfTGi0OEYU48Pe9jkQQV2fABpACfW74xmNv3QNgP2qP++mkpKBVv28EIAuINsFt
|
||||
# YAITEljLN/VOVul8lvjxar5GSFFgpE5F6j4xcvI69LuCWbN8cteTVsBGg+eGmjfx
|
||||
# QZxP252z3FqPN+mihtFegF2wx6Mg6/8jZjkO0xjBOwSdpTL4uyQfHvaPBKXuWxRx
|
||||
# ioXw4ezGAwkuBoxWK8UG7Qu+7CSfQ3wMOjvyH2+qn30lWEsvRMdbGAp7kvfr3EGZ
|
||||
# a3WN7zXZ+6KyZeLeEH7yCDzukAjptaY/+iLVjJsuzC6tCSqhgg1EMIINQAYKKwYB
|
||||
# BAGCNwMDATGCDTAwgg0sBgkqhkiG9w0BBwKggg0dMIINGQIBAzEPMA0GCWCGSAFl
|
||||
# AwQCAQUAMHcGCyqGSIb3DQEJEAEEoGgEZjBkAgEBBglghkgBhv1sBwEwMTANBglg
|
||||
# hkgBZQMEAgEFAAQg14BnPazQkW9whhZu1d0bC3lqqScvxb3SSb1QT8e3Xg0CEFhw
|
||||
# aMBZ2hExXhr79A9+bXEYDzIwMjEwNDA4MDkxMTA5WqCCCjcwggT+MIID5qADAgEC
|
||||
# AhANQkrgvjqI/2BAIc4UAPDdMA0GCSqGSIb3DQEBCwUAMHIxCzAJBgNVBAYTAlVT
|
||||
# MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
|
||||
# b20xMTAvBgNVBAMTKERpZ2lDZXJ0IFNIQTIgQXNzdXJlZCBJRCBUaW1lc3RhbXBp
|
||||
# bmcgQ0EwHhcNMjEwMTAxMDAwMDAwWhcNMzEwMTA2MDAwMDAwWjBIMQswCQYDVQQG
|
||||
# EwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xIDAeBgNVBAMTF0RpZ2lDZXJ0
|
||||
# IFRpbWVzdGFtcCAyMDIxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
|
||||
# wuZhhGfFivUNCKRFymNrUdc6EUK9CnV1TZS0DFC1JhD+HchvkWsMlucaXEjvROW/
|
||||
# m2HNFZFiWrj/ZwucY/02aoH6KfjdK3CF3gIY83htvH35x20JPb5qdofpir34hF0e
|
||||
# dsnkxnZ2OlPR0dNaNo/Go+EvGzq3YdZz7E5tM4p8XUUtS7FQ5kE6N1aG3JMjjfdQ
|
||||
# Jehk5t3Tjy9XtYcg6w6OLNUj2vRNeEbjA4MxKUpcDDGKSoyIxfcwWvkUrxVfbENJ
|
||||
# Cf0mI1P2jWPoGqtbsR0wwptpgrTb/FZUvB+hh6u+elsKIC9LCcmVp42y+tZji06l
|
||||
# chzun3oBc/gZ1v4NSYS9AQIDAQABo4IBuDCCAbQwDgYDVR0PAQH/BAQDAgeAMAwG
|
||||
# A1UdEwEB/wQCMAAwFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwgwQQYDVR0gBDowODA2
|
||||
# BglghkgBhv1sBwEwKTAnBggrBgEFBQcCARYbaHR0cDovL3d3dy5kaWdpY2VydC5j
|
||||
# b20vQ1BTMB8GA1UdIwQYMBaAFPS24SAd/imu0uRhpbKiJbLIFzVuMB0GA1UdDgQW
|
||||
# BBQ2RIaOpLqwZr68KC0dRDbd42p6vDBxBgNVHR8EajBoMDKgMKAuhixodHRwOi8v
|
||||
# Y3JsMy5kaWdpY2VydC5jb20vc2hhMi1hc3N1cmVkLXRzLmNybDAyoDCgLoYsaHR0
|
||||
# cDovL2NybDQuZGlnaWNlcnQuY29tL3NoYTItYXNzdXJlZC10cy5jcmwwgYUGCCsG
|
||||
# AQUFBwEBBHkwdzAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuZGlnaWNlcnQuY29t
|
||||
# ME8GCCsGAQUFBzAChkNodHRwOi8vY2FjZXJ0cy5kaWdpY2VydC5jb20vRGlnaUNl
|
||||
# cnRTSEEyQXNzdXJlZElEVGltZXN0YW1waW5nQ0EuY3J0MA0GCSqGSIb3DQEBCwUA
|
||||
# A4IBAQBIHNy16ZojvOca5yAOjmdG/UJyUXQKI0ejq5LSJcRwWb4UoOUngaVNFBUZ
|
||||
# B3nw0QTDhtk7vf5EAmZN7WmkD/a4cM9i6PVRSnh5Nnont/PnUp+Tp+1DnnvntN1B
|
||||
# Ion7h6JGA0789P63ZHdjXyNSaYOC+hpT7ZDMjaEXcw3082U5cEvznNZ6e9oMvD0y
|
||||
# 0BvL9WH8dQgAdryBDvjA4VzPxBFy5xtkSdgimnUVQvUtMjiB2vRgorq0Uvtc4GEk
|
||||
# JU+y38kpqHNDUdq9Y9YfW5v3LhtPEx33Sg1xfpe39D+E68Hjo0mh+s6nv1bPull2
|
||||
# YYlffqe0jmd4+TaY4cso2luHpoovMIIFMTCCBBmgAwIBAgIQCqEl1tYyG35B5AXa
|
||||
# NpfCFTANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGln
|
||||
# aUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtE
|
||||
# aWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMTYwMTA3MTIwMDAwWhcNMzEw
|
||||
# MTA3MTIwMDAwWjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5j
|
||||
# MRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBT
|
||||
# SEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5nIENBMIIBIjANBgkqhkiG9w0BAQEF
|
||||
# AAOCAQ8AMIIBCgKCAQEAvdAy7kvNj3/dqbqCmcU5VChXtiNKxA4HRTNREH3Q+X1N
|
||||
# aH7ntqD0jbOI5Je/YyGQmL8TvFfTw+F+CNZqFAA49y4eO+7MpvYyWf5fZT/gm+vj
|
||||
# RkcGGlV+Cyd+wKL1oODeIj8O/36V+/OjuiI+GKwR5PCZA207hXwJ0+5dyJoLVOOo
|
||||
# CXFr4M8iEA91z3FyTgqt30A6XLdR4aF5FMZNJCMwXbzsPGBqrC8HzP3w6kfZiFBe
|
||||
# /WZuVmEnKYmEUeaC50ZQ/ZQqLKfkdT66mA+Ef58xFNat1fJky3seBdCEGXIX8RcG
|
||||
# 7z3N1k3vBkL9olMqT4UdxB08r8/arBD13ays6Vb/kwIDAQABo4IBzjCCAcowHQYD
|
||||
# VR0OBBYEFPS24SAd/imu0uRhpbKiJbLIFzVuMB8GA1UdIwQYMBaAFEXroq/0ksuC
|
||||
# MS1Ri6enIZ3zbcgPMBIGA1UdEwEB/wQIMAYBAf8CAQAwDgYDVR0PAQH/BAQDAgGG
|
||||
# MBMGA1UdJQQMMAoGCCsGAQUFBwMIMHkGCCsGAQUFBwEBBG0wazAkBggrBgEFBQcw
|
||||
# AYYYaHR0cDovL29jc3AuZGlnaWNlcnQuY29tMEMGCCsGAQUFBzAChjdodHRwOi8v
|
||||
# Y2FjZXJ0cy5kaWdpY2VydC5jb20vRGlnaUNlcnRBc3N1cmVkSURSb290Q0EuY3J0
|
||||
# MIGBBgNVHR8EejB4MDqgOKA2hjRodHRwOi8vY3JsNC5kaWdpY2VydC5jb20vRGln
|
||||
# aUNlcnRBc3N1cmVkSURSb290Q0EuY3JsMDqgOKA2hjRodHRwOi8vY3JsMy5kaWdp
|
||||
# Y2VydC5jb20vRGlnaUNlcnRBc3N1cmVkSURSb290Q0EuY3JsMFAGA1UdIARJMEcw
|
||||
# OAYKYIZIAYb9bAACBDAqMCgGCCsGAQUFBwIBFhxodHRwczovL3d3dy5kaWdpY2Vy
|
||||
# dC5jb20vQ1BTMAsGCWCGSAGG/WwHATANBgkqhkiG9w0BAQsFAAOCAQEAcZUS6VGH
|
||||
# VmnN793afKpjerN4zwY3QITvS4S/ys8DAv3Fp8MOIEIsr3fzKx8MIVoqtwU0HWqu
|
||||
# mfgnoma/Capg33akOpMP+LLR2HwZYuhegiUexLoceywh4tZbLBQ1QwRostt1AuBy
|
||||
# x5jWPGTlH0gQGF+JOGFNYkYkh2OMkVIsrymJ5Xgf1gsUpYDXEkdws3XVk4WTfraS
|
||||
# Z/tTYYmo9WuWwPRYaQ18yAGxuSh1t5ljhSKMYcp5lH5Z/IwP42+1ASa2bKXuh1Eh
|
||||
# 5Fhgm7oMLSttosR+u8QlK0cCCHxJrhO24XxCQijGGFbPQTS2Zl22dHv1VjMiLyI2
|
||||
# skuiSpXY9aaOUjGCAk0wggJJAgEBMIGGMHIxCzAJBgNVBAYTAlVTMRUwEwYDVQQK
|
||||
# EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xMTAvBgNV
|
||||
# BAMTKERpZ2lDZXJ0IFNIQTIgQXNzdXJlZCBJRCBUaW1lc3RhbXBpbmcgQ0ECEA1C
|
||||
# SuC+Ooj/YEAhzhQA8N0wDQYJYIZIAWUDBAIBBQCggZgwGgYJKoZIhvcNAQkDMQ0G
|
||||
# CyqGSIb3DQEJEAEEMBwGCSqGSIb3DQEJBTEPFw0yMTA0MDgwOTExMDlaMCsGCyqG
|
||||
# SIb3DQEJEAIMMRwwGjAYMBYEFOHXgqjhkb7va8oWkbWqtJSmJJvzMC8GCSqGSIb3
|
||||
# DQEJBDEiBCCHEAmNNj2zWjWYRfEi4FgzZvrI16kv/U2b9b3oHw6UVDANBgkqhkiG
|
||||
# 9w0BAQEFAASCAQCdefEKh6Qmwx7xGCkrYi/A+/Cla6LdnYJp38eMs3fqTTvjhyDw
|
||||
# HffXrwdqWy5/fgW3o3qJXqa5o7hLxYIoWSULOCpJRGdt+w7XKPAbZqHrN9elAhWJ
|
||||
# vpBTCEaj7dVxr1Ka4NsoPSYe0eidDBmmvGvp02J4Z1j8+ImQPKN6Hv/L8Ixaxe7V
|
||||
# mH4VtXIiBK8xXdi4wzO+A+qLtHEJXz3Gw8Bp3BNtlDGIUkIhVTM3Q1xcSEqhOLqo
|
||||
# PGdwCw9acxdXNWWPjOJkNH656Bvmkml+0p6MTGIeG4JCeRh1Wpqm1ZGSoEcXNaof
|
||||
# wOgj48YzI+dNqBD9i7RSWCqJr2ygYKRTxnuU
|
||||
# SIG # End signature block
|
||||
167
engine/third_party/physx/buildtools/packman/bootstrap/generate_temp_folder.ps1
vendored
Normal file
167
engine/third_party/physx/buildtools/packman/bootstrap/generate_temp_folder.ps1
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
<#
|
||||
Copyright 2019 NVIDIA CORPORATION
|
||||
|
||||
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.
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][string]$parentPath=$null
|
||||
)
|
||||
[string] $name = [System.Guid]::NewGuid()
|
||||
$out = Join-Path $parentPath $name
|
||||
New-Item -ItemType Directory -Path ($out) | Out-Null
|
||||
Write-Host $out
|
||||
|
||||
# SIG # Begin signature block
|
||||
# MIIaVwYJKoZIhvcNAQcCoIIaSDCCGkQCAQExDzANBglghkgBZQMEAgEFADB5Bgor
|
||||
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
|
||||
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCB29nsqMEu+VmSF
|
||||
# 7ckeVTPrEZ6hsXjOgPFlJm9ilgHUB6CCCiIwggTTMIIDu6ADAgECAhBi50XpIWUh
|
||||
# PJcfXEkK6hKlMA0GCSqGSIb3DQEBCwUAMIGEMQswCQYDVQQGEwJVUzEdMBsGA1UE
|
||||
# ChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xHzAdBgNVBAsTFlN5bWFudGVjIFRydXN0
|
||||
# IE5ldHdvcmsxNTAzBgNVBAMTLFN5bWFudGVjIENsYXNzIDMgU0hBMjU2IENvZGUg
|
||||
# U2lnbmluZyBDQSAtIEcyMB4XDTE4MDcwOTAwMDAwMFoXDTIxMDcwOTIzNTk1OVow
|
||||
# gYMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRQwEgYDVQQHDAtT
|
||||
# YW50YSBDbGFyYTEbMBkGA1UECgwSTlZJRElBIENvcnBvcmF0aW9uMQ8wDQYDVQQL
|
||||
# DAZJVC1NSVMxGzAZBgNVBAMMEk5WSURJQSBDb3Jwb3JhdGlvbjCCASIwDQYJKoZI
|
||||
# hvcNAQEBBQADggEPADCCAQoCggEBALEZN63dA47T4i90jZ84CJ/aWUwVtLff8AyP
|
||||
# YspFfIZGdZYiMgdb8A5tBh7653y0G/LZL6CVUkgejcpvBU/Dl/52a+gSWy2qJ2bH
|
||||
# jMFMKCyQDhdpCAKMOUKSC9rfzm4cFeA9ct91LQCAait4LhLlZt/HF7aG+r0FgCZa
|
||||
# HJjJvE7KNY9G4AZXxjSt8CXS8/8NQMANqjLX1r+F+Hl8PzQ1fVx0mMsbdtaIV4Pj
|
||||
# 5flAeTUnz6+dCTx3vTUo8MYtkS2UBaQv7t7H2B7iwJDakEQKk1XHswJdeqG0osDU
|
||||
# z6+NVks7uWE1N8UIhvzbw0FEX/U2kpfyWaB/J3gMl8rVR8idPj8CAwEAAaOCAT4w
|
||||
# ggE6MAkGA1UdEwQCMAAwDgYDVR0PAQH/BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUF
|
||||
# BwMDMGEGA1UdIARaMFgwVgYGZ4EMAQQBMEwwIwYIKwYBBQUHAgEWF2h0dHBzOi8v
|
||||
# ZC5zeW1jYi5jb20vY3BzMCUGCCsGAQUFBwICMBkMF2h0dHBzOi8vZC5zeW1jYi5j
|
||||
# b20vcnBhMB8GA1UdIwQYMBaAFNTABiJJ6zlL3ZPiXKG4R3YJcgNYMCsGA1UdHwQk
|
||||
# MCIwIKAeoByGGmh0dHA6Ly9yYi5zeW1jYi5jb20vcmIuY3JsMFcGCCsGAQUFBwEB
|
||||
# BEswSTAfBggrBgEFBQcwAYYTaHR0cDovL3JiLnN5bWNkLmNvbTAmBggrBgEFBQcw
|
||||
# AoYaaHR0cDovL3JiLnN5bWNiLmNvbS9yYi5jcnQwDQYJKoZIhvcNAQELBQADggEB
|
||||
# AIJKh5vKJdhHJtMzATmc1BmXIQ3RaJONOZ5jMHn7HOkYU1JP0OIzb4pXXkH8Xwfr
|
||||
# K6bnd72IhcteyksvKsGpSvK0PBBwzodERTAu1Os2N+EaakxQwV/xtqDm1E3IhjHk
|
||||
# fRshyKKzmFk2Ci323J4lHtpWUj5Hz61b8gd72jH7xnihGi+LORJ2uRNZ3YuqMNC3
|
||||
# SBC8tAyoJqEoTJirULUCXW6wX4XUm5P2sx+htPw7szGblVKbQ+PFinNGnsSEZeKz
|
||||
# D8jUb++1cvgTKH59Y6lm43nsJjkZU77tNqyq4ABwgQRk6lt8cS2PPwjZvTmvdnla
|
||||
# ZhR0K4of+pQaUQHXVIBdji8wggVHMIIEL6ADAgECAhB8GzU1SufbdOdBXxFpymuo
|
||||
# MA0GCSqGSIb3DQEBCwUAMIG9MQswCQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNp
|
||||
# Z24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNV
|
||||
# BAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
|
||||
# IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmlj
|
||||
# YXRpb24gQXV0aG9yaXR5MB4XDTE0MDcyMjAwMDAwMFoXDTI0MDcyMTIzNTk1OVow
|
||||
# gYQxCzAJBgNVBAYTAlVTMR0wGwYDVQQKExRTeW1hbnRlYyBDb3Jwb3JhdGlvbjEf
|
||||
# MB0GA1UECxMWU3ltYW50ZWMgVHJ1c3QgTmV0d29yazE1MDMGA1UEAxMsU3ltYW50
|
||||
# ZWMgQ2xhc3MgMyBTSEEyNTYgQ29kZSBTaWduaW5nIENBIC0gRzIwggEiMA0GCSqG
|
||||
# SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDXlUPU3N9nrjn7UqS2JjEEcOm3jlsqujdp
|
||||
# NZWPu8Aw54bYc7vf69F2P4pWjustS/BXGE6xjaUz0wt1I9VqeSfdo9P3Dodltd6t
|
||||
# HPH1NbQiUa8iocFdS5B/wFlOq515qQLXHkmxO02H/sJ4q7/vUq6crwjZOeWaUT5p
|
||||
# XzAQTnFjbFjh8CAzGw90vlvLEuHbjMSAlHK79kWansElC/ujHJ7YpglwcezAR0yP
|
||||
# fcPeGc4+7gRyjhfT//CyBTIZTNOwHJ/+pXggQnBBsCaMbwDIOgARQXpBsKeKkQSg
|
||||
# mXj0d7TzYCrmbFAEtxRg/w1R9KiLhP4h2lxeffUpeU+wRHRvbXL/AgMBAAGjggF4
|
||||
# MIIBdDAuBggrBgEFBQcBAQQiMCAwHgYIKwYBBQUHMAGGEmh0dHA6Ly9zLnN5bWNk
|
||||
# LmNvbTASBgNVHRMBAf8ECDAGAQH/AgEAMGYGA1UdIARfMF0wWwYLYIZIAYb4RQEH
|
||||
# FwMwTDAjBggrBgEFBQcCARYXaHR0cHM6Ly9kLnN5bWNiLmNvbS9jcHMwJQYIKwYB
|
||||
# BQUHAgIwGRoXaHR0cHM6Ly9kLnN5bWNiLmNvbS9ycGEwNgYDVR0fBC8wLTAroCmg
|
||||
# J4YlaHR0cDovL3Muc3ltY2IuY29tL3VuaXZlcnNhbC1yb290LmNybDATBgNVHSUE
|
||||
# DDAKBggrBgEFBQcDAzAOBgNVHQ8BAf8EBAMCAQYwKQYDVR0RBCIwIKQeMBwxGjAY
|
||||
# BgNVBAMTEVN5bWFudGVjUEtJLTEtNzI0MB0GA1UdDgQWBBTUwAYiSes5S92T4lyh
|
||||
# uEd2CXIDWDAfBgNVHSMEGDAWgBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG
|
||||
# 9w0BAQsFAAOCAQEAf+vKp+qLdkLrPo4gVDDjt7nc+kg+FscPRZUQzSeGo2bzAu1x
|
||||
# +KrCVZeRcIP5Un5SaTzJ8eCURoAYu6HUpFam8x0AkdWG80iH4MvENGggXrTL+QXt
|
||||
# nK9wUye56D5+UaBpcYvcUe2AOiUyn0SvbkMo0yF1u5fYi4uM/qkERgSF9xWcSxGN
|
||||
# xCwX/tVuf5riVpLxlrOtLfn039qJmc6yOETA90d7yiW5+ipoM5tQct6on9TNLAs0
|
||||
# vYsweEDgjY4nG5BvGr4IFYFd6y/iUedRHsl4KeceZb847wFKAQkkDhbEFHnBQTc0
|
||||
# 0D2RUpSd4WjvCPDiaZxnbpALGpNx1CYCw8BaIzGCD4swgg+HAgEBMIGZMIGEMQsw
|
||||
# CQYDVQQGEwJVUzEdMBsGA1UEChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xHzAdBgNV
|
||||
# BAsTFlN5bWFudGVjIFRydXN0IE5ldHdvcmsxNTAzBgNVBAMTLFN5bWFudGVjIENs
|
||||
# YXNzIDMgU0hBMjU2IENvZGUgU2lnbmluZyBDQSAtIEcyAhBi50XpIWUhPJcfXEkK
|
||||
# 6hKlMA0GCWCGSAFlAwQCAQUAoHwwEAYKKwYBBAGCNwIBDDECMAAwGQYJKoZIhvcN
|
||||
# AQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEOMAwGCisGAQQBgjcCARUw
|
||||
# LwYJKoZIhvcNAQkEMSIEIG5YDmcpqLxn4SB0H6OnuVkZRPh6OJ77eGW/6Su/uuJg
|
||||
# MA0GCSqGSIb3DQEBAQUABIIBAA3N2vqfA6WDgqz/7EoAKVIE5Hn7xpYDGhPvFAMV
|
||||
# BslVpeqE3apTcYFCEcwLtzIEc/zmpULxsX8B0SUT2VXbJN3zzQ80b+gbgpq62Zk+
|
||||
# dQLOtLSiPhGW7MXLahgES6Oc2dUFaQ+wDfcelkrQaOVZkM4wwAzSapxuf/13oSIk
|
||||
# ZX2ewQEwTZrVYXELO02KQIKUR30s/oslGVg77ALnfK9qSS96Iwjd4MyT7PzCkHUi
|
||||
# ilwyGJi5a4ofiULiPSwUQNynSBqxa+JQALkHP682b5xhjoDfyG8laR234FTPtYgs
|
||||
# P/FaeviwENU5Pl+812NbbtRD+gKlWBZz+7FKykOT/CG8sZahgg1EMIINQAYKKwYB
|
||||
# BAGCNwMDATGCDTAwgg0sBgkqhkiG9w0BBwKggg0dMIINGQIBAzEPMA0GCWCGSAFl
|
||||
# AwQCAQUAMHcGCyqGSIb3DQEJEAEEoGgEZjBkAgEBBglghkgBhv1sBwEwMTANBglg
|
||||
# hkgBZQMEAgEFAAQgJhABfkDIPbI+nWYnA30FLTyaPK+W3QieT21B/vK+CMICEDF0
|
||||
# worcGsdd7OxpXLP60xgYDzIwMjEwNDA4MDkxMTA5WqCCCjcwggT+MIID5qADAgEC
|
||||
# AhANQkrgvjqI/2BAIc4UAPDdMA0GCSqGSIb3DQEBCwUAMHIxCzAJBgNVBAYTAlVT
|
||||
# MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
|
||||
# b20xMTAvBgNVBAMTKERpZ2lDZXJ0IFNIQTIgQXNzdXJlZCBJRCBUaW1lc3RhbXBp
|
||||
# bmcgQ0EwHhcNMjEwMTAxMDAwMDAwWhcNMzEwMTA2MDAwMDAwWjBIMQswCQYDVQQG
|
||||
# EwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xIDAeBgNVBAMTF0RpZ2lDZXJ0
|
||||
# IFRpbWVzdGFtcCAyMDIxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
|
||||
# wuZhhGfFivUNCKRFymNrUdc6EUK9CnV1TZS0DFC1JhD+HchvkWsMlucaXEjvROW/
|
||||
# m2HNFZFiWrj/ZwucY/02aoH6KfjdK3CF3gIY83htvH35x20JPb5qdofpir34hF0e
|
||||
# dsnkxnZ2OlPR0dNaNo/Go+EvGzq3YdZz7E5tM4p8XUUtS7FQ5kE6N1aG3JMjjfdQ
|
||||
# Jehk5t3Tjy9XtYcg6w6OLNUj2vRNeEbjA4MxKUpcDDGKSoyIxfcwWvkUrxVfbENJ
|
||||
# Cf0mI1P2jWPoGqtbsR0wwptpgrTb/FZUvB+hh6u+elsKIC9LCcmVp42y+tZji06l
|
||||
# chzun3oBc/gZ1v4NSYS9AQIDAQABo4IBuDCCAbQwDgYDVR0PAQH/BAQDAgeAMAwG
|
||||
# A1UdEwEB/wQCMAAwFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwgwQQYDVR0gBDowODA2
|
||||
# BglghkgBhv1sBwEwKTAnBggrBgEFBQcCARYbaHR0cDovL3d3dy5kaWdpY2VydC5j
|
||||
# b20vQ1BTMB8GA1UdIwQYMBaAFPS24SAd/imu0uRhpbKiJbLIFzVuMB0GA1UdDgQW
|
||||
# BBQ2RIaOpLqwZr68KC0dRDbd42p6vDBxBgNVHR8EajBoMDKgMKAuhixodHRwOi8v
|
||||
# Y3JsMy5kaWdpY2VydC5jb20vc2hhMi1hc3N1cmVkLXRzLmNybDAyoDCgLoYsaHR0
|
||||
# cDovL2NybDQuZGlnaWNlcnQuY29tL3NoYTItYXNzdXJlZC10cy5jcmwwgYUGCCsG
|
||||
# AQUFBwEBBHkwdzAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuZGlnaWNlcnQuY29t
|
||||
# ME8GCCsGAQUFBzAChkNodHRwOi8vY2FjZXJ0cy5kaWdpY2VydC5jb20vRGlnaUNl
|
||||
# cnRTSEEyQXNzdXJlZElEVGltZXN0YW1waW5nQ0EuY3J0MA0GCSqGSIb3DQEBCwUA
|
||||
# A4IBAQBIHNy16ZojvOca5yAOjmdG/UJyUXQKI0ejq5LSJcRwWb4UoOUngaVNFBUZ
|
||||
# B3nw0QTDhtk7vf5EAmZN7WmkD/a4cM9i6PVRSnh5Nnont/PnUp+Tp+1DnnvntN1B
|
||||
# Ion7h6JGA0789P63ZHdjXyNSaYOC+hpT7ZDMjaEXcw3082U5cEvznNZ6e9oMvD0y
|
||||
# 0BvL9WH8dQgAdryBDvjA4VzPxBFy5xtkSdgimnUVQvUtMjiB2vRgorq0Uvtc4GEk
|
||||
# JU+y38kpqHNDUdq9Y9YfW5v3LhtPEx33Sg1xfpe39D+E68Hjo0mh+s6nv1bPull2
|
||||
# YYlffqe0jmd4+TaY4cso2luHpoovMIIFMTCCBBmgAwIBAgIQCqEl1tYyG35B5AXa
|
||||
# NpfCFTANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGln
|
||||
# aUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtE
|
||||
# aWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMTYwMTA3MTIwMDAwWhcNMzEw
|
||||
# MTA3MTIwMDAwWjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5j
|
||||
# MRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBT
|
||||
# SEEyIEFzc3VyZWQgSUQgVGltZXN0YW1waW5nIENBMIIBIjANBgkqhkiG9w0BAQEF
|
||||
# AAOCAQ8AMIIBCgKCAQEAvdAy7kvNj3/dqbqCmcU5VChXtiNKxA4HRTNREH3Q+X1N
|
||||
# aH7ntqD0jbOI5Je/YyGQmL8TvFfTw+F+CNZqFAA49y4eO+7MpvYyWf5fZT/gm+vj
|
||||
# RkcGGlV+Cyd+wKL1oODeIj8O/36V+/OjuiI+GKwR5PCZA207hXwJ0+5dyJoLVOOo
|
||||
# CXFr4M8iEA91z3FyTgqt30A6XLdR4aF5FMZNJCMwXbzsPGBqrC8HzP3w6kfZiFBe
|
||||
# /WZuVmEnKYmEUeaC50ZQ/ZQqLKfkdT66mA+Ef58xFNat1fJky3seBdCEGXIX8RcG
|
||||
# 7z3N1k3vBkL9olMqT4UdxB08r8/arBD13ays6Vb/kwIDAQABo4IBzjCCAcowHQYD
|
||||
# VR0OBBYEFPS24SAd/imu0uRhpbKiJbLIFzVuMB8GA1UdIwQYMBaAFEXroq/0ksuC
|
||||
# MS1Ri6enIZ3zbcgPMBIGA1UdEwEB/wQIMAYBAf8CAQAwDgYDVR0PAQH/BAQDAgGG
|
||||
# MBMGA1UdJQQMMAoGCCsGAQUFBwMIMHkGCCsGAQUFBwEBBG0wazAkBggrBgEFBQcw
|
||||
# AYYYaHR0cDovL29jc3AuZGlnaWNlcnQuY29tMEMGCCsGAQUFBzAChjdodHRwOi8v
|
||||
# Y2FjZXJ0cy5kaWdpY2VydC5jb20vRGlnaUNlcnRBc3N1cmVkSURSb290Q0EuY3J0
|
||||
# MIGBBgNVHR8EejB4MDqgOKA2hjRodHRwOi8vY3JsNC5kaWdpY2VydC5jb20vRGln
|
||||
# aUNlcnRBc3N1cmVkSURSb290Q0EuY3JsMDqgOKA2hjRodHRwOi8vY3JsMy5kaWdp
|
||||
# Y2VydC5jb20vRGlnaUNlcnRBc3N1cmVkSURSb290Q0EuY3JsMFAGA1UdIARJMEcw
|
||||
# OAYKYIZIAYb9bAACBDAqMCgGCCsGAQUFBwIBFhxodHRwczovL3d3dy5kaWdpY2Vy
|
||||
# dC5jb20vQ1BTMAsGCWCGSAGG/WwHATANBgkqhkiG9w0BAQsFAAOCAQEAcZUS6VGH
|
||||
# VmnN793afKpjerN4zwY3QITvS4S/ys8DAv3Fp8MOIEIsr3fzKx8MIVoqtwU0HWqu
|
||||
# mfgnoma/Capg33akOpMP+LLR2HwZYuhegiUexLoceywh4tZbLBQ1QwRostt1AuBy
|
||||
# x5jWPGTlH0gQGF+JOGFNYkYkh2OMkVIsrymJ5Xgf1gsUpYDXEkdws3XVk4WTfraS
|
||||
# Z/tTYYmo9WuWwPRYaQ18yAGxuSh1t5ljhSKMYcp5lH5Z/IwP42+1ASa2bKXuh1Eh
|
||||
# 5Fhgm7oMLSttosR+u8QlK0cCCHxJrhO24XxCQijGGFbPQTS2Zl22dHv1VjMiLyI2
|
||||
# skuiSpXY9aaOUjGCAk0wggJJAgEBMIGGMHIxCzAJBgNVBAYTAlVTMRUwEwYDVQQK
|
||||
# EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xMTAvBgNV
|
||||
# BAMTKERpZ2lDZXJ0IFNIQTIgQXNzdXJlZCBJRCBUaW1lc3RhbXBpbmcgQ0ECEA1C
|
||||
# SuC+Ooj/YEAhzhQA8N0wDQYJYIZIAWUDBAIBBQCggZgwGgYJKoZIhvcNAQkDMQ0G
|
||||
# CyqGSIb3DQEJEAEEMBwGCSqGSIb3DQEJBTEPFw0yMTA0MDgwOTExMDlaMCsGCyqG
|
||||
# SIb3DQEJEAIMMRwwGjAYMBYEFOHXgqjhkb7va8oWkbWqtJSmJJvzMC8GCSqGSIb3
|
||||
# DQEJBDEiBCDvFxQ6lYLr8vB+9czUl19rjCw1pWhhUXw/SqOmvIa/VDANBgkqhkiG
|
||||
# 9w0BAQEFAASCAQB9ox2UrcUXQsBI4Uycnhl4AMpvhVXJME62tygFMppW1l7QftDy
|
||||
# LvfPKRYm2YUioak/APxAS6geRKpeMkLvXuQS/Jlv0kY3BjxkeG0eVjvyjF4SvXbZ
|
||||
# 3JCk9m7wLNE+xqOo0ICjYlIJJgRLudjWkC5Skpb1NpPS8DOaIYwRV+AWaSOUPd9P
|
||||
# O5yVcnbl7OpK3EAEtwDrybCVBMPn2MGhAXybIHnth3+MFp1b6Blhz3WlReQyarjq
|
||||
# 1f+zaFB79rg6JswXoOTJhwICBP3hO2Ua3dMAswbfl+QNXF+igKLJPYnaeSVhBbm6
|
||||
# VCu2io27t4ixqvoD0RuPObNX/P3oVA38afiM
|
||||
# SIG # End signature block
|
||||
172
engine/third_party/physx/buildtools/packman/bootstrap/install_package.py
vendored
Normal file
172
engine/third_party/physx/buildtools/packman/bootstrap/install_package.py
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
# Copyright 2019 NVIDIA CORPORATION
|
||||
|
||||
# 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.
|
||||
|
||||
import logging
|
||||
import zipfile
|
||||
import tempfile
|
||||
import sys
|
||||
import os
|
||||
import stat
|
||||
import time
|
||||
import hashlib
|
||||
from typing import Any, Callable, Union
|
||||
|
||||
|
||||
RENAME_RETRY_COUNT = 100
|
||||
RENAME_RETRY_DELAY = 0.1
|
||||
|
||||
logging.basicConfig(level=logging.WARNING, format="%(message)s")
|
||||
logger = logging.getLogger("install_package")
|
||||
|
||||
|
||||
def remove_directory_item(path):
|
||||
if os.path.islink(path) or os.path.isfile(path):
|
||||
try:
|
||||
os.remove(path)
|
||||
except PermissionError:
|
||||
# make sure we have access and try again:
|
||||
os.chmod(path, stat.S_IRWXU)
|
||||
os.remove(path)
|
||||
else:
|
||||
# try first to delete the dir because this will work for folder junctions, otherwise we would follow the junctions and cause destruction!
|
||||
clean_out_folder = False
|
||||
try:
|
||||
# make sure we have access preemptively - this is necessary because recursing into a directory without permissions
|
||||
# will only lead to heart ache
|
||||
os.chmod(path, stat.S_IRWXU)
|
||||
os.rmdir(path)
|
||||
except OSError:
|
||||
clean_out_folder = True
|
||||
|
||||
if clean_out_folder:
|
||||
# we should make sure the directory is empty
|
||||
names = os.listdir(path)
|
||||
for name in names:
|
||||
fullname = os.path.join(path, name)
|
||||
remove_directory_item(fullname)
|
||||
# now try to again get rid of the folder - and not catch if it raises:
|
||||
os.rmdir(path)
|
||||
|
||||
|
||||
class StagingDirectory:
|
||||
def __init__(self, staging_path):
|
||||
self.staging_path = staging_path
|
||||
self.temp_folder_path = None
|
||||
os.makedirs(staging_path, exist_ok=True)
|
||||
|
||||
def __enter__(self):
|
||||
self.temp_folder_path = tempfile.mkdtemp(prefix="ver-", dir=self.staging_path)
|
||||
return self
|
||||
|
||||
def get_temp_folder_path(self):
|
||||
return self.temp_folder_path
|
||||
|
||||
# this function renames the temp staging folder to folder_name, it is required that the parent path exists!
|
||||
def promote_and_rename(self, folder_name):
|
||||
abs_dst_folder_name = os.path.join(self.staging_path, folder_name)
|
||||
os.rename(self.temp_folder_path, abs_dst_folder_name)
|
||||
|
||||
def __exit__(self, type, value, traceback):
|
||||
# Remove temp staging folder if it's still there (something went wrong):
|
||||
path = self.temp_folder_path
|
||||
if os.path.isdir(path):
|
||||
remove_directory_item(path)
|
||||
|
||||
|
||||
def rename_folder(staging_dir: StagingDirectory, folder_name: str):
|
||||
try:
|
||||
staging_dir.promote_and_rename(folder_name)
|
||||
except OSError as exc:
|
||||
# if we failed to rename because the folder now exists we can assume that another packman process
|
||||
# has managed to update the package before us - in all other cases we re-raise the exception
|
||||
abs_dst_folder_name = os.path.join(staging_dir.staging_path, folder_name)
|
||||
if os.path.exists(abs_dst_folder_name):
|
||||
logger.warning(
|
||||
f"Directory {abs_dst_folder_name} already present, package installation already completed"
|
||||
)
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
def call_with_retry(
|
||||
op_name: str, func: Callable, retry_count: int = 3, retry_delay: float = 20
|
||||
) -> Any:
|
||||
retries_left = retry_count
|
||||
while True:
|
||||
try:
|
||||
return func()
|
||||
except (OSError, IOError) as exc:
|
||||
logger.warning(f"Failure while executing {op_name} [{str(exc)}]")
|
||||
if retries_left:
|
||||
retry_str = "retry" if retries_left == 1 else "retries"
|
||||
logger.warning(
|
||||
f"Retrying after {retry_delay} seconds"
|
||||
f" ({retries_left} {retry_str} left) ..."
|
||||
)
|
||||
time.sleep(retry_delay)
|
||||
else:
|
||||
logger.error("Maximum retries exceeded, giving up")
|
||||
raise
|
||||
retries_left -= 1
|
||||
|
||||
|
||||
def rename_folder_with_retry(staging_dir: StagingDirectory, folder_name):
|
||||
dst_path = os.path.join(staging_dir.staging_path, folder_name)
|
||||
call_with_retry(
|
||||
f"rename {staging_dir.get_temp_folder_path()} -> {dst_path}",
|
||||
lambda: rename_folder(staging_dir, folder_name),
|
||||
RENAME_RETRY_COUNT,
|
||||
RENAME_RETRY_DELAY,
|
||||
)
|
||||
|
||||
|
||||
def generate_sha256_for_file(file_path: Union[str, os.PathLike]) -> str:
|
||||
"""Returns the SHA-256 hex digest for the file at `file_path`"""
|
||||
hash = hashlib.sha256()
|
||||
# Read the file in binary mode and update the hash object with data
|
||||
with open(file_path, "rb") as file:
|
||||
for chunk in iter(lambda: file.read(4096), b""):
|
||||
hash.update(chunk)
|
||||
return hash.hexdigest()
|
||||
|
||||
|
||||
def install_common_module(package_path, install_path):
|
||||
COMMON_SHA256 = "0a2064434cca0170411c86f23349f9618556dc380d3589a2361db38ffeea9cac"
|
||||
package_sha256 = generate_sha256_for_file(package_path)
|
||||
if package_sha256 != COMMON_SHA256:
|
||||
raise RuntimeError(
|
||||
f"Package at '{package_path}' must have a sha256 of '{COMMON_SHA256}' "
|
||||
f"but was found to have '{package_sha256}'"
|
||||
)
|
||||
staging_path, version = os.path.split(install_path)
|
||||
with StagingDirectory(staging_path) as staging_dir:
|
||||
output_folder = staging_dir.get_temp_folder_path()
|
||||
with zipfile.ZipFile(package_path, allowZip64=True) as zip_file:
|
||||
zip_file.extractall(output_folder)
|
||||
|
||||
# attempt the rename operation
|
||||
rename_folder_with_retry(staging_dir, version)
|
||||
|
||||
print(f"Package successfully installed to {install_path}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
executable_paths = os.getenv("PATH")
|
||||
paths_list = executable_paths.split(os.path.pathsep) if executable_paths else []
|
||||
target_path_np = os.path.normpath(sys.argv[2])
|
||||
target_path_np_nc = os.path.normcase(target_path_np)
|
||||
for exec_path in paths_list:
|
||||
if os.path.normcase(os.path.normpath(exec_path)) == target_path_np_nc:
|
||||
raise RuntimeError(f"packman will not install to executable path '{exec_path}'")
|
||||
install_common_module(sys.argv[1], target_path_np)
|
||||
9
engine/third_party/physx/buildtools/packman/config.packman.xml
vendored
Normal file
9
engine/third_party/physx/buildtools/packman/config.packman.xml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<config remotes="cloudfront urm">
|
||||
<remote2 name="cloudfront">
|
||||
<transport actions="download" protocol="https" packageLocation="d4i3qtqj3r0z5.cloudfront.net/${name}@${version}" />
|
||||
</remote2>
|
||||
<remote2 name="urm">
|
||||
<transport actions="download" protocol="https" packageLocation="urm.nvidia.com/artifactory/ct-omniverse-generic/pkgs/${name}/${name}@${version}" />
|
||||
<transport actions="list" protocol="http" packageLocation="omnipackages.nvidia.com/api/v1/list/artifactory" />
|
||||
</remote2>
|
||||
</config>
|
||||
192
engine/third_party/physx/buildtools/packman/packman
vendored
Normal file
192
engine/third_party/physx/buildtools/packman/packman
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2019-2025 NVIDIA CORPORATION
|
||||
|
||||
# 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.
|
||||
SAVED_SETTINGS="$-"
|
||||
set -eu
|
||||
|
||||
if echo ${PM_VERBOSITY-} | grep -i "debug" > /dev/null ; then
|
||||
set -x
|
||||
PM_CURL_SILENT=""
|
||||
PM_WGET_QUIET=""
|
||||
else
|
||||
PM_CURL_SILENT="-s -S"
|
||||
PM_WGET_QUIET="--quiet"
|
||||
fi
|
||||
export PM_PACKMAN_VERSION=7.23.1
|
||||
|
||||
# This is necessary for newer macOS
|
||||
if [ `uname` == 'Darwin' ]; then
|
||||
export LC_ALL=en_US.UTF-8
|
||||
export LANG=en_US.UTF-8
|
||||
fi
|
||||
|
||||
# We cannot rely on realpath, it isn't installed on macOS and some Linux distros
|
||||
get_abs_filename() {
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# Specify where packman command exists
|
||||
export PM_INSTALL_PATH="$(get_abs_filename "$(dirname "${BASH_SOURCE}")")"
|
||||
|
||||
# The packages root may already be configured by the user
|
||||
if [ -z "${PM_PACKAGES_ROOT:-}" ]; then
|
||||
# Set variable temporarily in this process so that the following execution will work
|
||||
if [ `uname` == 'Darwin' ]; then
|
||||
export PM_PACKAGES_ROOT="${HOME}/Library/Application Support/packman-cache"
|
||||
else
|
||||
if [ -z "${XDG_CACHE_HOME:-}" ]; then
|
||||
export PM_PACKAGES_ROOT="${HOME}/.cache/packman"
|
||||
else
|
||||
export PM_PACKAGES_ROOT="${XDG_CACHE_HOME}/packman"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Ensure the packages root path exists:
|
||||
if [ ! -d "$PM_PACKAGES_ROOT" ]; then
|
||||
echo "Creating packman packages cache at $PM_PACKAGES_ROOT"
|
||||
mkdir -p -m a+rwx "$PM_PACKAGES_ROOT"
|
||||
fi
|
||||
|
||||
fetch_file_from_s3()
|
||||
{
|
||||
SOURCE=$1
|
||||
SOURCE_URL=http://bootstrap.packman.nvidia.com/$SOURCE
|
||||
TARGET=$2
|
||||
echo "Fetching $SOURCE from bootstrap.packman.nvidia.com ..."
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
wget $PM_WGET_QUIET -O$TARGET $SOURCE_URL
|
||||
else
|
||||
curl -o $TARGET $SOURCE_URL $PM_CURL_SILENT
|
||||
fi
|
||||
}
|
||||
|
||||
generate_temp_file_name()
|
||||
{
|
||||
if [ `uname` == "Darwin" ]; then
|
||||
local tmpfile=`mktemp -t packman`
|
||||
else
|
||||
local tmpfile=`mktemp -t packman.XXXXXXXX`
|
||||
fi
|
||||
echo "$tmpfile"
|
||||
}
|
||||
|
||||
install_python()
|
||||
{
|
||||
PLATFORM=`uname`
|
||||
PROCESSOR=`uname -m`
|
||||
PYTHON_VERSION=3.10.5-1
|
||||
|
||||
if [ $PLATFORM == 'Darwin' ]; then
|
||||
PYTHON_PACKAGE=$PYTHON_VERSION-macos-x86_64
|
||||
elif [ $PLATFORM == 'Linux' ] && [ $PROCESSOR == 'x86_64' ]; then
|
||||
PYTHON_PACKAGE=$PYTHON_VERSION-linux-x86_64
|
||||
elif [ $PLATFORM == 'Linux' ] && [ $PROCESSOR == 'aarch64' ]; then
|
||||
PYTHON_PACKAGE=$PYTHON_VERSION-linux-aarch64
|
||||
else
|
||||
echo "Operating system not supported"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PYTHON_INSTALL_FOLDER="$PM_PACKAGES_ROOT/python/$PYTHON_PACKAGE"
|
||||
if [ ! -d "$PYTHON_INSTALL_FOLDER" ]; then
|
||||
mkdir -p "$PYTHON_INSTALL_FOLDER"
|
||||
fi
|
||||
|
||||
export PM_PYTHON="$PYTHON_INSTALL_FOLDER/python"
|
||||
|
||||
if [ ! -f "$PM_PYTHON" ]; then
|
||||
PYTHON_PACKAGE_TMP=$(generate_temp_file_name)
|
||||
fetch_file_from_s3 "python@$PYTHON_PACKAGE.tar.gz" "$PYTHON_PACKAGE_TMP"
|
||||
if [ "$?" -eq "0" ]; then
|
||||
echo "Unpacking python"
|
||||
tar -xf "$PYTHON_PACKAGE_TMP" -C "$PYTHON_INSTALL_FOLDER"
|
||||
rm "$PYTHON_PACKAGE_TMP"
|
||||
else
|
||||
echo "Failed downloading the Python interpreter"
|
||||
exit $?
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Ensure python is available:
|
||||
if [ -z "${PM_PYTHON_EXT:-}" ]; then
|
||||
install_python
|
||||
else
|
||||
PM_PYTHON="$PM_PYTHON_EXT"
|
||||
fi
|
||||
|
||||
# The packman module may be externally configured
|
||||
if [ -z "${PM_MODULE_DIR_EXT:-}" ]; then
|
||||
PM_MODULE_DIR="$PM_PACKAGES_ROOT/packman-common/$PM_PACKMAN_VERSION"
|
||||
else
|
||||
PM_MODULE_DIR="$PM_MODULE_DIR_EXT"
|
||||
fi
|
||||
export PM_MODULE="$PM_MODULE_DIR/run.py"
|
||||
|
||||
# Ensure the packman package exists:
|
||||
if [ ! -f "$PM_MODULE" ]; then
|
||||
# Remove a previously corrupt packman-common if it's there
|
||||
if [ -d "$PM_MODULE_DIR" ]; then
|
||||
rm -rf "$PM_MODULE_DIR"
|
||||
fi
|
||||
PM_MODULE_PACKAGE="packman-common@$PM_PACKMAN_VERSION.zip"
|
||||
TARGET=$(generate_temp_file_name)
|
||||
# We always fetch packman from S3:
|
||||
fetch_file_from_s3 "$PM_MODULE_PACKAGE" "$TARGET"
|
||||
if [ "$?" -eq "0" ]; then
|
||||
echo "Unpacking ..."
|
||||
"$PM_PYTHON" -S -s -u -E "$PM_INSTALL_PATH/bootstrap/install_package.py" "$TARGET" "$PM_MODULE_DIR"
|
||||
rm "$TARGET"
|
||||
else
|
||||
echo "Failure while fetching packman module from S3!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Generate temporary file name for environment variables:
|
||||
PM_VAR_PATH=`mktemp -u -t tmp.$$.pmvars.XXXXXX`
|
||||
|
||||
if [ $# -ne 0 ]
|
||||
then
|
||||
PM_VAR_PATH_ARG=--var-path="$PM_VAR_PATH"
|
||||
fi
|
||||
|
||||
"$PM_PYTHON" -S -s -u -E "$PM_MODULE" "$@" ${PM_VAR_PATH_ARG:-}
|
||||
exit_code=$?
|
||||
# Export the variables if the file was used and remove the file:
|
||||
if [ -f "$PM_VAR_PATH" ]; then
|
||||
while read -r line
|
||||
do
|
||||
if [ ${#line} -gt 0 ]; then
|
||||
export "$line"
|
||||
fi
|
||||
done < "$PM_VAR_PATH"
|
||||
rm -f "$PM_VAR_PATH"
|
||||
fi
|
||||
|
||||
# avoid leaking -e and -u into the host script if they weren't originally set
|
||||
if [[ ! ( "$SAVED_SETTINGS" =~ e ) ]]; then
|
||||
set +e
|
||||
fi
|
||||
|
||||
if [[ ! ( "$SAVED_SETTINGS" =~ u ) ]]; then
|
||||
set +u
|
||||
fi
|
||||
|
||||
# Return the exit code from python
|
||||
if [ "$exit_code" != 0 ]; then
|
||||
exit "$exit_code"
|
||||
fi
|
||||
89
engine/third_party/physx/buildtools/packman/packman.cmd
vendored
Normal file
89
engine/third_party/physx/buildtools/packman/packman.cmd
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
:: RUN_PM_MODULE must always be at the same spot for packman update to work (batch reloads file during update!)
|
||||
:: [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]
|
||||
:: Reset errorlevel status (don't inherit from caller)
|
||||
@call :ECHO_AND_RESET_ERROR
|
||||
|
||||
:: You can remove this section if you do your own manual configuration of the dev machines
|
||||
call :CONFIGURE
|
||||
if %errorlevel% neq 0 ( exit /b %errorlevel% )
|
||||
|
||||
:: Everything below is mandatory
|
||||
if not defined PM_PYTHON goto :PYTHON_ENV_ERROR
|
||||
if not defined PM_MODULE goto :MODULE_ENV_ERROR
|
||||
|
||||
set PM_VAR_PATH_ARG=
|
||||
|
||||
if "%1"=="pull" goto :SET_VAR_PATH
|
||||
if "%1"=="install" goto :SET_VAR_PATH
|
||||
|
||||
:RUN_PM_MODULE
|
||||
"%PM_PYTHON%" -S -s -u -E "%PM_MODULE%" %* %PM_VAR_PATH_ARG%
|
||||
if %errorlevel% neq 0 ( exit /b %errorlevel% )
|
||||
|
||||
:: Marshall environment variables into the current environment if they have been generated and remove temporary file
|
||||
if exist "%PM_VAR_PATH%" (
|
||||
for /F "usebackq tokens=*" %%A in ("%PM_VAR_PATH%") do set "%%A"
|
||||
)
|
||||
if %errorlevel% neq 0 ( goto :VAR_ERROR )
|
||||
|
||||
if exist "%PM_VAR_PATH%" (
|
||||
del /F "%PM_VAR_PATH%"
|
||||
)
|
||||
if %errorlevel% neq 0 ( goto :VAR_ERROR )
|
||||
|
||||
set PM_VAR_PATH=
|
||||
goto :eof
|
||||
|
||||
:: Subroutines below
|
||||
:PYTHON_ENV_ERROR
|
||||
@echo User environment variable PM_PYTHON is not set! Please configure machine for packman or call configure.bat.
|
||||
exit /b 1
|
||||
|
||||
:MODULE_ENV_ERROR
|
||||
@echo User environment variable PM_MODULE is not set! Please configure machine for packman or call configure.bat.
|
||||
exit /b 1
|
||||
|
||||
:VAR_ERROR
|
||||
@echo Error while processing and setting environment variables!
|
||||
exit /b 1
|
||||
|
||||
:: pad [xxxx]
|
||||
:ECHO_AND_RESET_ERROR
|
||||
@echo off
|
||||
if /I "%PM_VERBOSITY%"=="debug" (
|
||||
@echo on
|
||||
)
|
||||
exit /b 0
|
||||
|
||||
:SET_VAR_PATH
|
||||
:: Generate temporary path for variable file
|
||||
for /f "delims=" %%a in ('%PM_PYTHON% -S -s -u -E -c "import tempfile;file = tempfile.NamedTemporaryFile(mode='w+t', delete=False);print(file.name)"') do (set PM_VAR_PATH=%%a)
|
||||
set PM_VAR_PATH_ARG=--var-path="%PM_VAR_PATH%"
|
||||
goto :RUN_PM_MODULE
|
||||
|
||||
:CONFIGURE
|
||||
:: Must capture and set code page to work around issue #279, powershell invocation mutates console font
|
||||
:: This issue only happens in Windows CMD shell when using 65001 code page. Some Git Bash implementations
|
||||
:: don't support chcp so this workaround is a bit convoluted.
|
||||
:: Test for chcp:
|
||||
chcp > nul 2>&1
|
||||
if %errorlevel% equ 0 (
|
||||
for /f "tokens=2 delims=:" %%a in ('chcp') do (set PM_OLD_CODE_PAGE=%%a)
|
||||
) else (
|
||||
call :ECHO_AND_RESET_ERROR
|
||||
)
|
||||
:: trim leading space (this is safe even when PM_OLD_CODE_PAGE has not been set)
|
||||
set PM_OLD_CODE_PAGE=%PM_OLD_CODE_PAGE:~1%
|
||||
if "%PM_OLD_CODE_PAGE%" equ "65001" (
|
||||
chcp 437 > nul
|
||||
set PM_RESTORE_CODE_PAGE=1
|
||||
)
|
||||
call "%~dp0\bootstrap\configure.bat"
|
||||
set PM_CONFIG_ERRORLEVEL=%errorlevel%
|
||||
if defined PM_RESTORE_CODE_PAGE (
|
||||
:: Restore code page
|
||||
chcp %PM_OLD_CODE_PAGE% > nul
|
||||
)
|
||||
set PM_OLD_CODE_PAGE=
|
||||
set PM_RESTORE_CODE_PAGE=
|
||||
exit /b %PM_CONFIG_ERRORLEVEL%
|
||||
32
engine/third_party/physx/buildtools/packman/python.bat
vendored
Normal file
32
engine/third_party/physx/buildtools/packman/python.bat
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
:: Copyright 2019-2025 NVIDIA CORPORATION
|
||||
::
|
||||
:: 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.
|
||||
|
||||
@echo off
|
||||
setlocal enableextensions
|
||||
|
||||
call "%~dp0\packman" init
|
||||
set "PYTHONPATH=%PM_MODULE_DIR%;%PYTHONPATH%"
|
||||
|
||||
if not defined PYTHONNOUSERSITE (
|
||||
set PYTHONNOUSERSITE=1
|
||||
)
|
||||
|
||||
REM For performance, default to unbuffered; however, allow overriding via
|
||||
REM PYTHONUNBUFFERED=0 since PYTHONUNBUFFERED on windows can truncate output
|
||||
REM when printing long strings
|
||||
if not defined PYTHONUNBUFFERED (
|
||||
set PYTHONUNBUFFERED=1
|
||||
)
|
||||
|
||||
"%PM_PYTHON%" %*
|
||||
42
engine/third_party/physx/buildtools/packman/python.sh
vendored
Normal file
42
engine/third_party/physx/buildtools/packman/python.sh
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2019-2025 NVIDIA CORPORATION
|
||||
|
||||
# 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.
|
||||
|
||||
set -e
|
||||
|
||||
PACKMAN_CMD="$(dirname "${BASH_SOURCE}")/packman"
|
||||
if [ ! -f "$PACKMAN_CMD" ]; then
|
||||
PACKMAN_CMD="${PACKMAN_CMD}.sh"
|
||||
fi
|
||||
source "$PACKMAN_CMD" init
|
||||
export PYTHONPATH="${PM_MODULE_DIR}:${PYTHONPATH}"
|
||||
|
||||
if [ -z "${PYTHONNOUSERSITE:-}" ]; then
|
||||
export PYTHONNOUSERSITE=1
|
||||
fi
|
||||
|
||||
# For performance, default to unbuffered; however, allow overriding via
|
||||
# PYTHONUNBUFFERED=0 since PYTHONUNBUFFERED on windows can truncate output
|
||||
# when printing long strings
|
||||
if [ -z "${PYTHONUNBUFFERED:-}" ]; then
|
||||
export PYTHONUNBUFFERED=1
|
||||
fi
|
||||
|
||||
# workaround for our python not shipping with certs
|
||||
if [[ -z ${SSL_CERT_DIR:-} ]]; then
|
||||
export SSL_CERT_DIR=/etc/ssl/certs/
|
||||
fi
|
||||
|
||||
"${PM_PYTHON}" "$@"
|
||||
12
engine/third_party/physx/buildtools/presets/public/linux-aarch64-clang-cpu-only.xml
vendored
Normal file
12
engine/third_party/physx/buildtools/presets/public/linux-aarch64-clang-cpu-only.xml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preset name="linux-aarch64-clang-cpu-only" comment="Linux-aarch64 clang PhysX SDK general settings (cpu only)">
|
||||
<platform targetPlatform="linuxAarch64" compiler="clang" />
|
||||
<CMakeSwitches>
|
||||
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
|
||||
<cmakeSwitch name="PX_BUILDPVDRUNTIME" value="True" comment="Generate the OmniPVD project" />
|
||||
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="True" comment="Generate static libs" />
|
||||
</CMakeSwitches>
|
||||
<CMakeParams>
|
||||
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/linux-aarch64-clang-cpu-only/PhysX" comment="Install path relative to PhysX SDK root" />
|
||||
</CMakeParams>
|
||||
</preset>
|
||||
20
engine/third_party/physx/buildtools/presets/public/linux-aarch64-clang.xml
vendored
Normal file
20
engine/third_party/physx/buildtools/presets/public/linux-aarch64-clang.xml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preset name="linux-aarch64-clang" comment="Linux-aarch64 clang PhysX SDK general settings">
|
||||
<platform targetPlatform="linuxAarch64" compiler="clang" />
|
||||
<CMakeSwitches>
|
||||
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
|
||||
<cmakeSwitch name="PX_BUILDPVDRUNTIME" value="True" comment="Generate the OmniPVD project" />
|
||||
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="True" comment="Generate static libs" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_PROJECTS" value="True" comment="Generate the GPU projects, if possible." />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_PROJECTS_ONLY" value="False" comment="Generate ONLY the GPU projects, if possible." />
|
||||
<cmakeSwitch name="PX_SCALAR_MATH" value="False" comment="Disable SIMD math" />
|
||||
<cmakeSwitch name="NV_USE_STATIC_WINCRT" value="True" comment="Use the statically linked windows CRT" />
|
||||
<cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="True" comment="Use the debug version of the CRT" />
|
||||
<cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="False" comment="Float point precise math" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_STATIC_LIBRARIES" value="False" comment="Generate PhysXGPU static libraries" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_REDUCED_ARCHITECTURES" value="False" comment="Generate only a reduced number of GPU architectures for faster compilation" />
|
||||
</CMakeSwitches>
|
||||
<CMakeParams>
|
||||
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/linux-aarch64-clang/PhysX" comment="Install path relative to PhysX SDK root" />
|
||||
</CMakeParams>
|
||||
</preset>
|
||||
12
engine/third_party/physx/buildtools/presets/public/linux-aarch64-gcc-cpu-only.xml
vendored
Normal file
12
engine/third_party/physx/buildtools/presets/public/linux-aarch64-gcc-cpu-only.xml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preset name="linux-aarch64-gcc-cpu-only" comment="Linux-aarch64 gcc PhysX SDK general settings (cpu only)">
|
||||
<platform targetPlatform="linuxAarch64" compiler="gcc" />
|
||||
<CMakeSwitches>
|
||||
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
|
||||
<cmakeSwitch name="PX_BUILDPVDRUNTIME" value="True" comment="Generate the OmniPVD project" />
|
||||
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="True" comment="Generate static libs" />
|
||||
</CMakeSwitches>
|
||||
<CMakeParams>
|
||||
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/linux-aarch64-gcc-cpu-only/PhysX" comment="Install path relative to PhysX SDK root" />
|
||||
</CMakeParams>
|
||||
</preset>
|
||||
20
engine/third_party/physx/buildtools/presets/public/linux-aarch64-gcc.xml
vendored
Normal file
20
engine/third_party/physx/buildtools/presets/public/linux-aarch64-gcc.xml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preset name="linux-aarch64-gcc" comment="Linux-aarch64 gcc PhysX SDK general settings">
|
||||
<platform targetPlatform="linuxAarch64" compiler="gcc" />
|
||||
<CMakeSwitches>
|
||||
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
|
||||
<cmakeSwitch name="PX_BUILDPVDRUNTIME" value="True" comment="Generate the OmniPVD project" />
|
||||
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="True" comment="Generate static libs" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_PROJECTS" value="True" comment="Generate the GPU projects, if possible." />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_PROJECTS_ONLY" value="False" comment="Generate ONLY the GPU projects, if possible." />
|
||||
<cmakeSwitch name="PX_SCALAR_MATH" value="False" comment="Disable SIMD math" />
|
||||
<cmakeSwitch name="NV_USE_STATIC_WINCRT" value="True" comment="Use the statically linked windows CRT" />
|
||||
<cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="True" comment="Use the debug version of the CRT" />
|
||||
<cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="False" comment="Float point precise math" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_STATIC_LIBRARIES" value="False" comment="Generate PhysXGPU static libraries" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_REDUCED_ARCHITECTURES" value="False" comment="Generate only a reduced number of GPU architectures for faster compilation" />
|
||||
</CMakeSwitches>
|
||||
<CMakeParams>
|
||||
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/linux-aarch64-gccPhysX" comment="Install path relative to PhysX SDK root" />
|
||||
</CMakeParams>
|
||||
</preset>
|
||||
12
engine/third_party/physx/buildtools/presets/public/linux-clang-cpu-only.xml
vendored
Normal file
12
engine/third_party/physx/buildtools/presets/public/linux-clang-cpu-only.xml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preset name="linux-clang-cpu-only" comment="Linux clang PhysX SDK general settings (cpu only)">
|
||||
<platform targetPlatform="linux" compiler="clang" />
|
||||
<CMakeSwitches>
|
||||
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
|
||||
<cmakeSwitch name="PX_BUILDPVDRUNTIME" value="True" comment="Generate the OmniPVD project" />
|
||||
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="True" comment="Generate static libs" />
|
||||
</CMakeSwitches>
|
||||
<CMakeParams>
|
||||
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/linux-clang-cpu-only/PhysX" comment="Install path relative to PhysX SDK root" />
|
||||
</CMakeParams>
|
||||
</preset>
|
||||
20
engine/third_party/physx/buildtools/presets/public/linux-clang.xml
vendored
Normal file
20
engine/third_party/physx/buildtools/presets/public/linux-clang.xml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preset name="linux-clang" comment="Linux clang PhysX SDK general settings">
|
||||
<platform targetPlatform="linux" compiler="clang" />
|
||||
<CMakeSwitches>
|
||||
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
|
||||
<cmakeSwitch name="PX_BUILDPVDRUNTIME" value="True" comment="Generate the OmniPVD project" />
|
||||
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="True" comment="Generate static libs" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_PROJECTS" value="True" comment="Generate the GPU projects, if possible." />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_PROJECTS_ONLY" value="False" comment="Generate ONLY the GPU projects, if possible." />
|
||||
<cmakeSwitch name="PX_SCALAR_MATH" value="False" comment="Disable SIMD math" />
|
||||
<cmakeSwitch name="NV_USE_STATIC_WINCRT" value="True" comment="Use the statically linked windows CRT" />
|
||||
<cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="True" comment="Use the debug version of the CRT" />
|
||||
<cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="False" comment="Float point precise math" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_STATIC_LIBRARIES" value="False" comment="Generate PhysXGPU static libraries" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_REDUCED_ARCHITECTURES" value="False" comment="Generate only a reduced number of GPU architectures for faster compilation" />
|
||||
</CMakeSwitches>
|
||||
<CMakeParams>
|
||||
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/linux-clang/PhysX" comment="Install path relative to PhysX SDK root" />
|
||||
</CMakeParams>
|
||||
</preset>
|
||||
12
engine/third_party/physx/buildtools/presets/public/linux-gcc-cpu-only.xml
vendored
Normal file
12
engine/third_party/physx/buildtools/presets/public/linux-gcc-cpu-only.xml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preset name="linux-gcc-cpu-only" comment="Linux gcc PhysX SDK general settings (cpu only)">
|
||||
<platform targetPlatform="linux" compiler="gcc" />
|
||||
<CMakeSwitches>
|
||||
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
|
||||
<cmakeSwitch name="PX_BUILDPVDRUNTIME" value="True" comment="Generate the OmniPVD project" />
|
||||
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="True" comment="Generate static libs" />
|
||||
</CMakeSwitches>
|
||||
<CMakeParams>
|
||||
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/linux-gcc-cpu-only/PhysX" comment="Install path relative to PhysX SDK root" />
|
||||
</CMakeParams>
|
||||
</preset>
|
||||
20
engine/third_party/physx/buildtools/presets/public/linux-gcc.xml
vendored
Normal file
20
engine/third_party/physx/buildtools/presets/public/linux-gcc.xml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preset name="linux-gcc" comment="Linux gcc PhysX SDK general settings">
|
||||
<platform targetPlatform="linux" compiler="gcc" />
|
||||
<CMakeSwitches>
|
||||
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
|
||||
<cmakeSwitch name="PX_BUILDPVDRUNTIME" value="True" comment="Generate the OmniPVD project" />
|
||||
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="True" comment="Generate static libs" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_PROJECTS" value="True" comment="Generate the GPU projects, if possible." />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_PROJECTS_ONLY" value="False" comment="Generate ONLY the GPU projects, if possible." />
|
||||
<cmakeSwitch name="PX_SCALAR_MATH" value="False" comment="Disable SIMD math" />
|
||||
<cmakeSwitch name="NV_USE_STATIC_WINCRT" value="True" comment="Use the statically linked windows CRT" />
|
||||
<cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="True" comment="Use the debug version of the CRT" />
|
||||
<cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="False" comment="Float point precise math" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_STATIC_LIBRARIES" value="False" comment="Generate PhysXGPU static libraries" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_REDUCED_ARCHITECTURES" value="False" comment="Generate only a reduced number of GPU architectures for faster compilation" />
|
||||
</CMakeSwitches>
|
||||
<CMakeParams>
|
||||
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/linux-gcc/PhysX" comment="Install path relative to PhysX SDK root" />
|
||||
</CMakeParams>
|
||||
</preset>
|
||||
15
engine/third_party/physx/buildtools/presets/public/vc16win64-cpu-only.xml
vendored
Normal file
15
engine/third_party/physx/buildtools/presets/public/vc16win64-cpu-only.xml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preset name="vc16win64-cpu-only" comment="VC16 Win64 PhysX general settings (cpu only)">
|
||||
<platform targetPlatform="win64" compiler="vc16" />
|
||||
<CMakeSwitches>
|
||||
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
|
||||
<cmakeSwitch name="PX_BUILDPVDRUNTIME" value="True" comment="Generate the OmniPVD project" />
|
||||
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="False" comment="Generate static libraries" />
|
||||
<cmakeSwitch name="NV_USE_STATIC_WINCRT" value="True" comment="Use the statically linked windows CRT" />
|
||||
<cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="True" comment="Use the debug version of the CRT" />
|
||||
<cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="False" comment="Float point precise math" />
|
||||
</CMakeSwitches>
|
||||
<CMakeParams>
|
||||
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/vc16win64-cpu-only/PhysX" comment="Install path relative to PhysX SDK root" />
|
||||
</CMakeParams>
|
||||
</preset>
|
||||
20
engine/third_party/physx/buildtools/presets/public/vc16win64.xml
vendored
Normal file
20
engine/third_party/physx/buildtools/presets/public/vc16win64.xml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preset name="vc16win64" comment="VC16 Win64 PhysX general settings">
|
||||
<platform targetPlatform="win64" compiler="vc16" />
|
||||
<CMakeSwitches>
|
||||
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
|
||||
<cmakeSwitch name="PX_BUILDPVDRUNTIME" value="True" comment="Generate the OmniPVD project" />
|
||||
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="False" comment="Generate static libraries" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_PROJECTS" value="True" comment="Generate the GPU projects, if possible." />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_PROJECTS_ONLY" value="False" comment="Generate ONLY the GPU projects, if possible." />
|
||||
<cmakeSwitch name="PX_SCALAR_MATH" value="False" comment="Disable SIMD math" />
|
||||
<cmakeSwitch name="NV_USE_STATIC_WINCRT" value="True" comment="Use the statically linked windows CRT" />
|
||||
<cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="True" comment="Use the debug version of the CRT" />
|
||||
<cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="False" comment="Float point precise math" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_STATIC_LIBRARIES" value="False" comment="Generate PhysXGPU static libraries" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_REDUCED_ARCHITECTURES" value="False" comment="Generate only a reduced number of GPU architectures for faster compilation" />
|
||||
</CMakeSwitches>
|
||||
<CMakeParams>
|
||||
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/vc16win64/PhysX" comment="Install path relative to PhysX SDK root" />
|
||||
</CMakeParams>
|
||||
</preset>
|
||||
15
engine/third_party/physx/buildtools/presets/public/vc17win64-cpu-only.xml
vendored
Normal file
15
engine/third_party/physx/buildtools/presets/public/vc17win64-cpu-only.xml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preset name="vc17win64-cpu-only" comment="VC17 Win64 PhysX general settings (cpu only)">
|
||||
<platform targetPlatform="win64" compiler="vc17" />
|
||||
<CMakeSwitches>
|
||||
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
|
||||
<cmakeSwitch name="PX_BUILDPVDRUNTIME" value="True" comment="Generate the OmniPVD project" />
|
||||
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="False" comment="Generate static libraries" />
|
||||
<cmakeSwitch name="NV_USE_STATIC_WINCRT" value="True" comment="Use the statically linked windows CRT" />
|
||||
<cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="True" comment="Use the debug version of the CRT" />
|
||||
<cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="False" comment="Float point precise math" />
|
||||
</CMakeSwitches>
|
||||
<CMakeParams>
|
||||
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/vc17win64-cpu-only/PhysX" comment="Install path relative to PhysX SDK root" />
|
||||
</CMakeParams>
|
||||
</preset>
|
||||
20
engine/third_party/physx/buildtools/presets/public/vc17win64.xml
vendored
Normal file
20
engine/third_party/physx/buildtools/presets/public/vc17win64.xml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preset name="vc17win64" comment="VC17 Win64 PhysX general settings">
|
||||
<platform targetPlatform="win64" compiler="vc17" />
|
||||
<CMakeSwitches>
|
||||
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
|
||||
<cmakeSwitch name="PX_BUILDPVDRUNTIME" value="True" comment="Generate the OmniPVD project" />
|
||||
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="False" comment="Generate static libraries" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_PROJECTS" value="True" comment="Generate the GPU projects, if possible." />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_PROJECTS_ONLY" value="False" comment="Generate ONLY the GPU projects, if possible." />
|
||||
<cmakeSwitch name="PX_SCALAR_MATH" value="False" comment="Disable SIMD math" />
|
||||
<cmakeSwitch name="NV_USE_STATIC_WINCRT" value="True" comment="Use the statically linked windows CRT" />
|
||||
<cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="True" comment="Use the debug version of the CRT" />
|
||||
<cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="False" comment="Float point precise math" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_STATIC_LIBRARIES" value="False" comment="Generate PhysXGPU static libraries" />
|
||||
<cmakeSwitch name="PX_GENERATE_GPU_REDUCED_ARCHITECTURES" value="False" comment="Generate only a reduced number of GPU architectures for faster compilation" />
|
||||
</CMakeSwitches>
|
||||
<CMakeParams>
|
||||
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/vc17win64/PhysX" comment="Install path relative to PhysX SDK root" />
|
||||
</CMakeParams>
|
||||
</preset>
|
||||
15
engine/third_party/physx/buildtools/presets/vc17win64-cpu-only.user.xml
vendored
Normal file
15
engine/third_party/physx/buildtools/presets/vc17win64-cpu-only.user.xml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<preset name="vc17win64-cpu-only" comment="VC17 Win64 PhysX general settings (cpu only, dynamic CRT)">
|
||||
<platform targetPlatform="win64" compiler="vc17" />
|
||||
<CMakeSwitches>
|
||||
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
|
||||
<cmakeSwitch name="PX_BUILDPVDRUNTIME" value="True" comment="Generate the OmniPVD project" />
|
||||
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="False" comment="Generate static libraries" />
|
||||
<cmakeSwitch name="NV_USE_STATIC_WINCRT" value="False" comment="Use the dynamically linked windows CRT" />
|
||||
<cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="True" comment="Use the debug version of the CRT" />
|
||||
<cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="False" comment="Float point precise math" />
|
||||
</CMakeSwitches>
|
||||
<CMakeParams>
|
||||
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/vc17win64-cpu-only/PhysX" comment="Install path relative to PhysX SDK root" />
|
||||
</CMakeParams>
|
||||
</preset>
|
||||
113
engine/third_party/physx/buildtools/steps/build_linux.sh
vendored
Normal file
113
engine/third_party/physx/buildtools/steps/build_linux.sh
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
#!/bin/bash +x
|
||||
|
||||
set -e
|
||||
|
||||
# Function to display an error and exit
|
||||
error_exit() {
|
||||
echo "$1" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if two arguments are passed
|
||||
if [ "$#" -ne 2 ]; then
|
||||
error_exit "Usage: $0 <preset> <build_config>. Example: $0 linux-aarch64-gcc debug"
|
||||
fi
|
||||
|
||||
# Assign arguments
|
||||
PRESET="$1"
|
||||
BUILD_CONFIG="$2"
|
||||
|
||||
# Validate build configuration
|
||||
if [[ ! "checked debug profile release all" =~ (^|[[:space:]])$BUILD_CONFIG($|[[:space:]]) ]]; then
|
||||
error_exit "Invalid build configuration. Use one of: checked, debug, profile, release, all."
|
||||
fi
|
||||
|
||||
# Get number of CPU cores
|
||||
if [ -f /proc/cpuinfo ]; then
|
||||
CPUS=$(grep processor /proc/cpuinfo | wc -l)
|
||||
else
|
||||
CPUS=1
|
||||
fi
|
||||
|
||||
# Stackoverflow suggests jobs count of (CPU cores + 1) as a good number!
|
||||
JOBS=$(expr $CPUS + 1)
|
||||
|
||||
# Define build function for presets other than linux-carbonite and linux-aarch64-carbonite (no install)
|
||||
build() {
|
||||
CONFIG=$1
|
||||
BUILD_DIR="$(dirname "$0")/../../compiler/$PRESET-$CONFIG"
|
||||
pushd "$BUILD_DIR" || error_exit "Directory not found for build: $BUILD_DIR"
|
||||
make -j$JOBS || error_exit "Build failed for $PRESET-$CONFIG"
|
||||
popd
|
||||
}
|
||||
|
||||
# Function to handle file copying for linux-aarch64-carbonite and linux-carbonite debug builds
|
||||
copy_vhacd_files() {
|
||||
CONFIG=$1
|
||||
if [[ "$CONFIG" == "debug" ]]; then
|
||||
if [[ "$PRESET" == "linux-aarch64-carbonite" ]]; then
|
||||
TARGET_PATH="install/$PRESET/VHACD/bin/linux.aarch64/debug/"
|
||||
SRC_PATH="bin/linux.aarch64/debug/"
|
||||
elif [[ "$PRESET" == "linux-carbonite" ]]; then
|
||||
TARGET_PATH="install/$PRESET/VHACD/bin/linux.x86_64/debug/"
|
||||
SRC_PATH="bin/linux.x86_64/debug/"
|
||||
fi
|
||||
mkdir -p "$TARGET_PATH" || error_exit "Failed to create directory $TARGET_PATH"
|
||||
|
||||
# Check if VHACD files exist before attempting to copy
|
||||
if ls "$SRC_PATH"*VHACD* 1> /dev/null 2>&1; then
|
||||
cp "$SRC_PATH"*VHACD* "$TARGET_PATH" || error_exit "Failed to copy VHACD files"
|
||||
else
|
||||
echo "Warning: No VHACD files found in $SRC_PATH. Skipping copy operation."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Define build function for linux-aarch64-carbonite and linux-carbonite (with install)
|
||||
build_with_install() {
|
||||
CONFIG=$1
|
||||
BUILD_DIR="$(dirname "$0")/../../compiler/$PRESET-$CONFIG"
|
||||
pushd "$BUILD_DIR" || error_exit "Directory not found for build: $BUILD_DIR"
|
||||
make -j$JOBS install || error_exit "Build and install failed for $PRESET-$CONFIG"
|
||||
popd
|
||||
|
||||
copy_vhacd_files $CONFIG
|
||||
}
|
||||
|
||||
# Build process based on the preset and configuration
|
||||
if [[ "$PRESET" == "linux-aarch64-carbonite" || "$PRESET" == "linux-carbonite" ]]; then
|
||||
# Build with install for linux-aarch64-carbonite and linux-carbonite
|
||||
if [ "$BUILD_CONFIG" = "all" ]; then
|
||||
build_with_install debug
|
||||
build_with_install checked
|
||||
build_with_install profile
|
||||
build_with_install release
|
||||
else
|
||||
build_with_install $BUILD_CONFIG
|
||||
fi
|
||||
|
||||
# Additional installations not specific to any build
|
||||
INSTALL_PATH="install/$PRESET"
|
||||
|
||||
pushd "$(dirname "$0")/../.." || error_exit "Failed to enter base directory"
|
||||
mkdir -p "$INSTALL_PATH/PhysX/PACKAGE-LICENSES/" "$INSTALL_PATH/VHACD/" "$INSTALL_PATH/VHACD/include/" "$INSTALL_PATH/VHACD/PACKAGE-LICENSES/" || error_exit "Failed to create installation directories"
|
||||
|
||||
cp "documentation/license/PACKAGE-LICENSES/LICENSE.md" "$INSTALL_PATH/PhysX/PACKAGE-LICENSES/physxsdk-LICENSE.md" || error_exit "Failed to copy PhysX license"
|
||||
cp "documentation/license/PACKAGE-LICENSES/vhacd-LICENSE.md" "$INSTALL_PATH/VHACD/PACKAGE-LICENSES/vhacd-LICENSE.md" || error_exit "Failed to copy VHACD license"
|
||||
|
||||
cp "documentation/license/physxsdk-PACKAGE-INFO.yaml" "$INSTALL_PATH/PhysX/PACKAGE-INFO.yaml" || error_exit "Failed to copy PhysX package info"
|
||||
cp "documentation/license/vhacd-PACKAGE-INFO.yaml" "$INSTALL_PATH/VHACD/PACKAGE-INFO.yaml" || error_exit "Failed to copy VHACD package info"
|
||||
|
||||
cp "externals/VHACD/public/"* "$INSTALL_PATH/VHACD/include/" || error_exit "Failed to copy VHACD include files"
|
||||
popd
|
||||
else
|
||||
# Build without install for other presets
|
||||
if [ "$BUILD_CONFIG" = "all" ]; then
|
||||
build checked
|
||||
build debug
|
||||
build profile
|
||||
build release
|
||||
else
|
||||
build $BUILD_CONFIG
|
||||
fi
|
||||
fi
|
||||
189
engine/third_party/physx/buildtools/steps/build_win_x86_64.bat
vendored
Normal file
189
engine/third_party/physx/buildtools/steps/build_win_x86_64.bat
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
@echo off
|
||||
SETLOCAL EnableDelayedExpansion
|
||||
|
||||
:: Check if at least one argument is provided (preset)
|
||||
if "%~1"=="" (
|
||||
echo You must specify a preset: e.g. vc17win64...
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
:: Set the preset based on the argument
|
||||
set "PRESET=%1"
|
||||
|
||||
:: Extract the Visual Studio version from the preset
|
||||
set "VS_PREFIX=%PRESET:~0,4%" :: Get the first 4 characters (vc15, vc16, vc17)
|
||||
|
||||
:: Determine the correct Visual Studio version based on the preset prefix
|
||||
if "%VS_PREFIX%" == "vc15" (
|
||||
set "VS_VERSION=[15.0,16.0)"
|
||||
) else if "%VS_PREFIX%" == "vc16" (
|
||||
set "VS_VERSION=[16.0,17.0)"
|
||||
) else if "%VS_PREFIX%" == "vc17" (
|
||||
set "VS_VERSION=[17.0,18.0)"
|
||||
) else (
|
||||
echo Unsupported Visual Studio version in preset: %PRESET%
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
:: Check if a build configuration is provided, default to 'all' if not
|
||||
if "%~2" == "" (
|
||||
set "BUILD_CONFIG=all"
|
||||
) else (
|
||||
set "BUILD_CONFIG=%2"
|
||||
)
|
||||
|
||||
:: Validate BUILD_CONFIG
|
||||
if not "%BUILD_CONFIG%"=="debug" if not "%BUILD_CONFIG%"=="release" if not "%BUILD_CONFIG%"=="checked" if not "%BUILD_CONFIG%"=="profile" if not "%BUILD_CONFIG%"=="all" (
|
||||
echo Invalid build configuration. Use one of: debug, release, checked, profile, all.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
:: Locate Visual Studio using vswhere
|
||||
IF EXIST "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer" (
|
||||
set "VS_INSTALLER_DIR=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
|
||||
echo VS_INSTALLER_DIR: "!VS_INSTALLER_DIR!"
|
||||
|
||||
:: Check if VS_INSTALLER_DIR is already in PATH
|
||||
echo !PATH! | findstr /i /c:"!VS_INSTALLER_DIR!" >nul
|
||||
if errorlevel 1 (
|
||||
set "PATH=!PATH!;!VS_INSTALLER_DIR!"
|
||||
echo Updated PATH: !PATH!
|
||||
) else (
|
||||
echo VS_INSTALLER_DIR is already in PATH
|
||||
)
|
||||
)
|
||||
|
||||
:: Use vswhere to locate the specified Visual Studio installation
|
||||
for /f "usebackq tokens=*" %%i in (`vswhere -version "%VS_VERSION%" -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
|
||||
set "VSINSTALLPATH=%%i"
|
||||
echo VSINSTALLPATH: "!VSINSTALLPATH!"
|
||||
)
|
||||
|
||||
:: Check if VSINSTALLPATH is set
|
||||
if not defined VSINSTALLPATH (
|
||||
echo Visual Studio installation not found.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
:: Set COMNTOOLS to point to the correct path
|
||||
set "COMNTOOLS=!VSINSTALLPATH!\VC\Auxiliary\Build\vcvarsx86_amd64.bat"
|
||||
echo COMNTOOLS: "!COMNTOOLS!"
|
||||
call "!COMNTOOLS!"
|
||||
if errorlevel 1 (
|
||||
echo Failed to initialize Visual Studio environment.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
:: Safely handle directory changes
|
||||
pushd "%~dp0\..\..\compiler"
|
||||
set "ROOT_PATH=%CD%"
|
||||
popd
|
||||
|
||||
:: Build configurations
|
||||
if "%BUILD_CONFIG%" == "all" (
|
||||
call :BUILD debug
|
||||
if errorlevel 1 goto ERROR
|
||||
|
||||
call :BUILD release
|
||||
if errorlevel 1 goto ERROR
|
||||
|
||||
call :BUILD checked
|
||||
if errorlevel 1 goto ERROR
|
||||
|
||||
call :BUILD profile
|
||||
if errorlevel 1 goto ERROR
|
||||
) else (
|
||||
call :BUILD %BUILD_CONFIG%
|
||||
if errorlevel 1 goto ERROR
|
||||
)
|
||||
|
||||
:: Success
|
||||
echo Build completed successfully.
|
||||
exit /B 0
|
||||
|
||||
:ERROR
|
||||
echo Failure while building *Windows %VS_PREFIX%* targets!
|
||||
exit /B 1
|
||||
|
||||
:: Build subroutine
|
||||
:BUILD
|
||||
echo ** Building %PRESET% %1 ... **
|
||||
|
||||
:: Check if PRESET ends with -carbonite using string manipulation
|
||||
setlocal enabledelayedexpansion
|
||||
set "SUFFIX=-carbonite"
|
||||
set "PRESET_LENGTH=!PRESET:~-10!"
|
||||
|
||||
if "%PRESET_LENGTH%" == "%SUFFIX%" (
|
||||
:: Build INSTALL.vcxproj when the preset ends with -carbonite
|
||||
msbuild /property:configuration=%1 "%ROOT_PATH%\%PRESET%\INSTALL.vcxproj" /maxcpucount /t:Rebuild /v:m
|
||||
) else (
|
||||
:: Build PhysXSDK.sln when the preset does not end with -carbonite
|
||||
msbuild /property:configuration=%1 "%ROOT_PATH%\%PRESET%\PhysXSDK.sln" /maxcpucount /t:Rebuild /v:m
|
||||
)
|
||||
|
||||
if errorlevel 1 (
|
||||
echo Build failed for %1.
|
||||
exit /B 1
|
||||
)
|
||||
echo ** End of %PRESET% %1 **
|
||||
echo.
|
||||
goto :EOF
|
||||
|
||||
|
||||
|
||||
@REM This is for binary distro only (carbonite). Keeping it here in case we need it.
|
||||
@REM However if we need the licenses and the logic below, it will be probably better to do that in the zipup script not here
|
||||
|
||||
|
||||
:: Copying licenses and files directly, similar to individual scripts
|
||||
:: Ensure that destination directories exist by creating them before copying
|
||||
|
||||
@REM echo Copying LICENSE.md to PhysX...
|
||||
@REM mkdir "%ROOT_PATH%\..\install\%INSTALL_PATH%\PhysX\PACKAGE-LICENSES" 2>nul
|
||||
@REM echo f | xcopy /S /Y /I "%ROOT_PATH%\..\documentation\license\PACKAGE-LICENSES\LICENSE.md" "%ROOT_PATH%\..\install\%INSTALL_PATH%\PhysX\PACKAGE-LICENSES\physxsdk-LICENSE.md"
|
||||
@REM if errorlevel 1 (
|
||||
@REM echo Failed to copy LICENSE.md to PhysX.
|
||||
@REM goto ERROR
|
||||
@REM )
|
||||
|
||||
@REM echo Copying vhacd-LICENSE.md to VHACD...
|
||||
@REM mkdir "%ROOT_PATH%\..\install\%INSTALL_PATH%\VHACD\PACKAGE-LICENSES" 2>nul
|
||||
@REM echo f | xcopy /S /Y /I "%ROOT_PATH%\..\documentation\license\PACKAGE-LICENSES\vhacd-LICENSE.md" "%ROOT_PATH%\..\install\%INSTALL_PATH%\VHACD\PACKAGE-LICENSES\vhacd-LICENSE.md"
|
||||
@REM if errorlevel 1 (
|
||||
@REM echo Failed to copy vhacd-LICENSE.md to VHACD.
|
||||
@REM goto ERROR
|
||||
@REM )
|
||||
|
||||
@REM echo Copying physxsdk-PACKAGE-INFO.yaml to PhysX...
|
||||
@REM mkdir "%ROOT_PATH%\..\install\%INSTALL_PATH%\PhysX" 2>nul
|
||||
@REM echo f | xcopy /S /Y /I "%ROOT_PATH%\..\documentation\license\physxsdk-PACKAGE-INFO.yaml" "%ROOT_PATH%\..\install\%INSTALL_PATH%\PhysX\PACKAGE-INFO.yaml"
|
||||
@REM if errorlevel 1 (
|
||||
@REM echo Failed to copy physxsdk-PACKAGE-INFO.yaml to PhysX.
|
||||
@REM goto ERROR
|
||||
@REM )
|
||||
|
||||
@REM echo Copying vhacd-PACKAGE-INFO.yaml to VHACD...
|
||||
@REM mkdir "%ROOT_PATH%\..\install\%INSTALL_PATH%\VHACD" 2>nul
|
||||
@REM echo f | xcopy /S /Y /I "%ROOT_PATH%\..\documentation\license\vhacd-PACKAGE-INFO.yaml" "%ROOT_PATH%\..\install\%INSTALL_PATH%\VHACD\PACKAGE-INFO.yaml"
|
||||
@REM if errorlevel 1 (
|
||||
@REM echo Failed to copy vhacd-PACKAGE-INFO.yaml to VHACD.
|
||||
@REM goto ERROR
|
||||
@REM )
|
||||
|
||||
@REM :: Copying VHACD binaries and includes
|
||||
@REM echo Copying VHACD debug binaries...
|
||||
@REM mkdir "%ROOT_PATH%\..\install\%INSTALL_PATH%\VHACD\bin\%BINARY_PATH%\debug" 2>nul
|
||||
@REM xcopy /Y "%ROOT_PATH%\..\bin\%BINARY_PATH%\debug\VHACD*.*" "%ROOT_PATH%\..\install\%INSTALL_PATH%\VHACD\bin\%BINARY_PATH%\debug\"
|
||||
@REM if errorlevel 1 (
|
||||
@REM echo Failed to copy VHACD debug binaries.
|
||||
@REM goto ERROR
|
||||
@REM )
|
||||
|
||||
@REM echo Copying VHACD includes...
|
||||
@REM mkdir "%ROOT_PATH%\..\install\%INSTALL_PATH%\VHACD\include" 2>nul
|
||||
@REM xcopy /Y "%ROOT_PATH%\..\externals\VHACD\public\*.*" "%ROOT_PATH%\..\install\%INSTALL_PATH%\VHACD\include\"
|
||||
@REM if errorlevel 1 (
|
||||
@REM echo Failed to copy VHACD includes.
|
||||
@REM goto ERROR
|
||||
@REM )
|
||||
8
engine/third_party/physx/buildtools/templates/PxIncludeTemplate.h
vendored
Normal file
8
engine/third_party/physx/buildtools/templates/PxIncludeTemplate.h
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
${BOILERPLATE_CONTENT}
|
||||
|
||||
#ifndef PX_${HEADER_GUARD_NAME}
|
||||
#define PX_${HEADER_GUARD_NAME}
|
||||
|
||||
${HEADER_CONTENT}
|
||||
|
||||
#endif // PX_${HEADER_GUARD_NAME}
|
||||
25
engine/third_party/physx/buildtools/templates/boilerplate_bsd.txt
vendored
Normal file
25
engine/third_party/physx/buildtools/templates/boilerplate_bsd.txt
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
21
engine/third_party/physx/dependencies.xml
vendored
Normal file
21
engine/third_party/physx/dependencies.xml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<project toolsVersion="6.4">
|
||||
<dependency name="clangMetadata" tags="requiredForDistro requiredForMetaGen">
|
||||
<package name="clang-physxmetadata" version="4.0.0.32489833_1"/>
|
||||
</dependency>
|
||||
|
||||
<dependency name="vswhere">
|
||||
<package name="VsWhere" version="2.7.3111.17308_1.0" platforms="vc15win64* vc16win64* vc17win64* linux-crosscompile linux-aarch64-crosscompile "/>
|
||||
</dependency>
|
||||
|
||||
<dependency name="freeglut">
|
||||
<package name="freeglut-windows" version="3.4_1.1" platforms="vc15win64* vc16win64* vc17win64*"/>
|
||||
</dependency>
|
||||
|
||||
<dependency name="opengllinux" tags="requiredForDistro">
|
||||
<package name="opengl-linux" version="2017.5.19.1" platforms="linux-gcc* linux-clang*"/>
|
||||
</dependency>
|
||||
|
||||
<dependency name="rapidjson">
|
||||
<package name="rapidjson" version="1.1.0-67fac85-073453e1" />
|
||||
</dependency>
|
||||
</project>
|
||||
97
engine/third_party/physx/generate_projects.bat
vendored
Normal file
97
engine/third_party/physx/generate_projects.bat
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
:: Reset errorlevel status so we are not inheriting this state from the calling process:
|
||||
:: @call :CLEAN_EXIT
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set "PHYSX_ROOT_DIR=%~dp0"
|
||||
|
||||
:: Convert backslashes to forward slashes
|
||||
set "PHYSX_ROOT_DIR=%PHYSX_ROOT_DIR:\=/%"
|
||||
|
||||
set PACKMAN_CMD="%PHYSX_ROOT_DIR%buildtools\packman\packman"
|
||||
|
||||
:: Initialize Packman (Needed to get PM_PYTHON)
|
||||
call %PACKMAN_CMD% init
|
||||
if errorlevel 1 @exit /b %errorlevel%
|
||||
|
||||
IF "%1"=="" GOTO ADDITIONAL_PARAMS_MISSING
|
||||
|
||||
:: Run packman to ensure dependencies are present and run cmake generation script afterwards
|
||||
echo Running packman in preparation for cmake ...
|
||||
set "str1=%1"
|
||||
if not x%str1:.user=%==x%str1% (
|
||||
call %PACKMAN_CMD% pull "%PHYSX_ROOT_DIR%dependencies.xml" --platform %str1:.user=%
|
||||
) else (
|
||||
call %PACKMAN_CMD% pull "%PHYSX_ROOT_DIR%dependencies.xml" --platform %1
|
||||
)
|
||||
|
||||
for /f "usebackq tokens=*" %%i in (`"%PM_vswhere_PATH%\VsWhere.exe -version [15.0,16.0) -latest -property installationPath"`) do (
|
||||
set "Install2017Dir=%%i"
|
||||
set "VS150PATH=%%i"
|
||||
)
|
||||
|
||||
for /f "usebackq tokens=*" %%i in (`"%PM_vswhere_PATH%\VsWhere.exe -version [16.0,17.0) -latest -property installationPath"`) do (
|
||||
set "Install2019Dir=%%i"
|
||||
set "VS160PATH=%%i"
|
||||
@REM Setting VS160COMNTOOLS: This is mainly needed for building for Switch
|
||||
@REM Reason: When both MS build tools and Visual Studio are installed together in the same system
|
||||
@REM Cmake will use msbuild to generate the project instead of Visual Studio. Which make Cmake fail
|
||||
@REM When generating the project for Switch. However, if an environment variable of the form VS##0COMNTOOLS,
|
||||
@REM where ## the Visual Studio major version number, is set and points to the Common7/Tools directory within
|
||||
@REM one of the VS instances, that instance will be used. see: https://cmake.org/cmake/help/latest/variable/CMAKE_GENERATOR_INSTANCE.html
|
||||
set "VS160COMNTOOLS=%%i\Common7\Tools\"
|
||||
)
|
||||
|
||||
for /f "usebackq tokens=*" %%i in (`"%PM_vswhere_PATH%\VsWhere.exe -version [17.0,18.0) -latest -property installationPath"`) do (
|
||||
set "Install2022Dir=%%i"
|
||||
set "VS170PATH=%%i"
|
||||
set "VS170COMNTOOLS=%%i\Common7\Tools\"
|
||||
)
|
||||
|
||||
if exist "%Install2017Dir%\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt" (
|
||||
pushd "%Install2017Dir%\VC\Auxiliary\Build\"
|
||||
set /p Version=<Microsoft.VCToolsVersion.default.txt
|
||||
for /f "delims=" %%x in (Microsoft.VCToolsVersion.default.txt) do (
|
||||
if not "%%x"=="" (
|
||||
rem Example hardcodes x64 as the host and target architecture, but you could parse it from arguments
|
||||
set "VS150CLPATH=%Install2017Dir%\VC\Tools\MSVC\%%x\bin\HostX64\x64\cl.exe"
|
||||
)
|
||||
)
|
||||
popd
|
||||
)
|
||||
|
||||
if exist "%Install2019Dir%\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt" (
|
||||
pushd "%Install2019Dir%\VC\Auxiliary\Build\"
|
||||
set /p Version=<Microsoft.VCToolsVersion.default.txt
|
||||
for /f "delims=" %%x in (Microsoft.VCToolsVersion.default.txt) do (
|
||||
if not "%%x"=="" (
|
||||
rem Example hardcodes x64 as the host and target architecture, but you could parse it from arguments
|
||||
set "VS160CLPATH=%Install2019Dir%\VC\Tools\MSVC\%%x\bin\HostX64\x64\cl.exe"
|
||||
)
|
||||
)
|
||||
popd
|
||||
)
|
||||
|
||||
if exist "%Install2022Dir%\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt" (
|
||||
pushd "%Install2022Dir%\VC\Auxiliary\Build\"
|
||||
set /p Version=<Microsoft.VCToolsVersion.default.txt
|
||||
for /f "delims=" %%x in (Microsoft.VCToolsVersion.default.txt) do (
|
||||
if not "%%x"=="" (
|
||||
rem Example hardcodes x64 as the host and target architecture, but you could parse it from arguments
|
||||
set "VS170CLPATH=%Install2022Dir%\VC\Tools\MSVC\%%x\bin\HostX64\x64\cl.exe"
|
||||
)
|
||||
)
|
||||
popd
|
||||
)
|
||||
|
||||
:ADDITIONAL_PARAMS_MISSING
|
||||
call "%PM_PYTHON%" "%PHYSX_ROOT_DIR%buildtools/cmake_generate_projects.py" %1
|
||||
if %ERRORLEVEL% neq 0 (
|
||||
set /p DUMMY=Hit ENTER to continue...
|
||||
exit /b %errorlevel%
|
||||
) else (
|
||||
goto CLEAN_EXIT
|
||||
)
|
||||
|
||||
:CLEAN_EXIT
|
||||
@exit /b 0
|
||||
36
engine/third_party/physx/generate_projects.sh
vendored
Normal file
36
engine/third_party/physx/generate_projects.sh
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash +x
|
||||
|
||||
if [ -n "${BASH_SOURCE[0]}" ]; then
|
||||
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
|
||||
else
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
fi
|
||||
|
||||
PACKMAN_CMD="$SCRIPT_DIR/buildtools/packman/packman"
|
||||
if [ ! -f "$PACKMAN_CMD" ]; then
|
||||
PACKMAN_CMD="${PACKMAN_CMD}.sh"
|
||||
fi
|
||||
source "$PACKMAN_CMD" init
|
||||
|
||||
if [[ $# -eq 0 ]] ; then
|
||||
exec "$SCRIPT_DIR/buildtools/packman/python.sh" "$SCRIPT_DIR/buildtools/cmake_generate_projects.py"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo Running packman in preparation for cmake ...
|
||||
cutName=${1%%.*}
|
||||
export targetPlatform=$1
|
||||
|
||||
if [ "$1" = "$cutName" ] ; then
|
||||
source "$PACKMAN_CMD" pull "$SCRIPT_DIR/dependencies.xml" --platform $1
|
||||
exec "$SCRIPT_DIR/buildtools/packman/python.sh" "$SCRIPT_DIR/buildtools/cmake_generate_projects.py" "$targetPlatform"
|
||||
else
|
||||
source "$PACKMAN_CMD" pull "$SCRIPT_DIR/dependencies.xml" --platform $cutName
|
||||
exec "$SCRIPT_DIR/buildtools/packman/python.sh" "$SCRIPT_DIR/buildtools/cmake_generate_projects.py" "$targetPlatform"
|
||||
fi
|
||||
|
||||
status=$?
|
||||
if [ "$status" -ne "0" ]; then
|
||||
echo "Error $status"
|
||||
exit 1
|
||||
fi
|
||||
383
engine/third_party/physx/include/PxActor.h
vendored
Normal file
383
engine/third_party/physx/include/PxActor.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
#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 <b>Sleeping:</b>
|
||||
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<PxActorFlag::Enum,PxU8> 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 deformable surface
|
||||
\see PxDeformableSurface
|
||||
*/
|
||||
eDEFORMABLE_SURFACE,
|
||||
|
||||
/**
|
||||
\brief A deformable volume
|
||||
\see PxDeformableVolume
|
||||
*/
|
||||
eDEFORMABLE_VOLUME,
|
||||
|
||||
/**
|
||||
\brief Deprecated
|
||||
\see eDEFORMABLE_VOLUME
|
||||
*/
|
||||
eSOFTBODY PX_DEPRECATED = eDEFORMABLE_VOLUME,
|
||||
|
||||
/**
|
||||
\brief A PBD ParticleSystem
|
||||
\see PxPBDParticleSystem
|
||||
*/
|
||||
ePBD_PARTICLESYSTEM,
|
||||
|
||||
//! \brief internal use only!
|
||||
eACTOR_COUNT,
|
||||
|
||||
//! \brief internal use only!
|
||||
eACTOR_FORCE_DWORD = 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.
|
||||
|
||||
<b>Default:</b> 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
|
||||
|
||||
<b>Sleeping:</b> Does <b>NOT</b> 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.
|
||||
|
||||
<b>Default:</b> 0
|
||||
|
||||
<b>Sleeping:</b> Changing the dominance group does <b>NOT</b> wake the actor up automatically.
|
||||
|
||||
\param[in] dominanceGroup The dominance group identifier. <b>Range:</b> [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.
|
||||
|
||||
<b>Default:</b> 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;
|
||||
|
||||
/************************************************************************************************/
|
||||
/** \name Environment ID
|
||||
*/
|
||||
|
||||
/**
|
||||
\brief Sets the environment ID for this actor.
|
||||
|
||||
The environment ID is an extra built-in filter group for the GPU broadphase. Actors will only collide with each-other if they have the
|
||||
same environment ID.
|
||||
|
||||
The default value is PX_INVALID_U32. Actors with this ID will collide with other actors, regardless of which environment they are a part of.
|
||||
|
||||
The environment ID must be set before adding the actor to a scene, and cannot change while the actor is in the scene.
|
||||
|
||||
If it is not PX_INVALID_U32, the environment ID must be smaller than 1<<24, i.e. the system does not support more than 1<<24 environments.
|
||||
|
||||
<b>Default:</b> PX_INVALID_U32
|
||||
|
||||
\note This is not available for CPU broadphases.
|
||||
|
||||
\param[in] envID Environment ID for this actor.
|
||||
\return True if success.
|
||||
|
||||
\see getEnvironmentID()
|
||||
*/
|
||||
virtual bool setEnvironmentID(PxU32 envID) = 0;
|
||||
|
||||
/**
|
||||
\brief Returns the environment ID for this actor.
|
||||
|
||||
\return Environment ID for this actor.
|
||||
|
||||
\see setEnvironmentID()
|
||||
*/
|
||||
virtual PxU32 getEnvironmentID() 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 { PX_IS_KIND_OF(name, "PxActor", PxBase); }
|
||||
};
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
281
engine/third_party/physx/include/PxAggregate.h
vendored
Normal file
281
engine/third_party/physx/include/PxAggregate.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
#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.
|
||||
|
||||
\return Max actor size.
|
||||
|
||||
\see PxPhysics::createAggregate()
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
\brief Sets the environment ID for this aggregate.
|
||||
|
||||
The environment ID is an extra built-in filter group for the GPU broadphase. Aggregates will only collide with actors or aggregates that
|
||||
have the same environment ID.
|
||||
|
||||
The default value is PX_INVALID_U32. Aggregates with this ID will collide with other actors or aggregates, regardless of which environment
|
||||
they are a part of.
|
||||
|
||||
The environment ID must be set before adding the aggregate to a scene, and cannot change while the aggregate is in the scene.
|
||||
|
||||
If it is not PX_INVALID_U32, the environment ID must be smaller than 1<<24, i.e. the system does not support more than 1<<24 environments.
|
||||
|
||||
Aggregated actors must have a default environment ID (PX_INVALID_U32). The environment ID of the aggregate is used in the broadphase, not
|
||||
the environment IDs from aggregated actors.
|
||||
|
||||
<b>Default:</b> PX_INVALID_U32
|
||||
|
||||
\note This is not available for CPU broadphases.
|
||||
|
||||
\param[in] envID Environment ID for this aggregate.
|
||||
\return True if success.
|
||||
|
||||
\see getEnvironmentID()
|
||||
*/
|
||||
virtual bool setEnvironmentID(PxU32 envID) = 0;
|
||||
|
||||
/**
|
||||
\brief Returns the environment ID for this aggregate.
|
||||
|
||||
\return Environment ID for this aggregate.
|
||||
|
||||
\see setEnvironmentID()
|
||||
*/
|
||||
virtual PxU32 getEnvironmentID() const = 0;
|
||||
|
||||
virtual const char* getConcreteTypeName() const PX_OVERRIDE PX_FINAL { 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 { PX_IS_KIND_OF(name, "PxAggregate", PxBase); }
|
||||
};
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
218
engine/third_party/physx/include/PxAnisotropy.h
vendored
Normal file
218
engine/third_party/physx/include/PxAnisotropy.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PX_ANISOTROPY_H
|
||||
#define PX_ANISOTROPY_H
|
||||
|
||||
|
||||
#include "cudamanager/PxCudaContext.h"
|
||||
#include "cudamanager/PxCudaContextManager.h"
|
||||
|
||||
#include "foundation/PxSimpleTypes.h"
|
||||
#include "foundation/PxVec4.h"
|
||||
#include "PxParticleSystem.h"
|
||||
|
||||
#include "foundation/PxArray.h"
|
||||
#include "PxParticleGpu.h"
|
||||
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
#if PX_SUPPORT_GPU_PHYSX
|
||||
|
||||
class PxgKernelLauncher;
|
||||
class PxParticleNeighborhoodProvider;
|
||||
|
||||
/**
|
||||
\brief Computes anisotropy information for a particle system to improve rendering quality
|
||||
*/
|
||||
class PxAnisotropyGenerator
|
||||
{
|
||||
public:
|
||||
/**
|
||||
\brief Schedules the compuation of anisotropy information on the specified cuda stream
|
||||
|
||||
\param[in] gpuParticleSystem A gpu pointer to access particle system data
|
||||
\param[in] numParticles The number of particles
|
||||
\param[in] stream The stream on which the cuda call gets scheduled
|
||||
*/
|
||||
virtual void generateAnisotropy(PxGpuParticleSystem* gpuParticleSystem, PxU32 numParticles, CUstream stream) = 0;
|
||||
|
||||
/**
|
||||
\brief Schedules the compuation of anisotropy information on the specified cuda stream
|
||||
|
||||
\param[in] particlePositionsGpu A gpu pointer containing the particle positions
|
||||
\param[in] neighborhoodProvider A neighborhood provider object that supports fast neighborhood queries
|
||||
\param[in] numParticles The number of particles
|
||||
\param[in] particleContactOffset The particle contact offset
|
||||
\param[in] stream The stream on which the cuda call gets scheduled
|
||||
*/
|
||||
virtual void generateAnisotropy(PxVec4* particlePositionsGpu, PxParticleNeighborhoodProvider& neighborhoodProvider, PxU32 numParticles, PxReal particleContactOffset, CUstream stream) = 0;
|
||||
|
||||
/**
|
||||
\brief Set a host buffer that holds the anisotropy data after the timestep completed
|
||||
|
||||
\param[in] anisotropy1 A host buffer holding the first row of the anisotropy matrix with memory for all particles already allocated
|
||||
\param[in] anisotropy2 A host buffer holding the second row of the anisotropy matrix with memory for all particles already allocated
|
||||
\param[in] anisotropy3 A host buffer holding the third row of the anisotropy matrix with memory for all particles already allocated
|
||||
*/
|
||||
virtual void setResultBufferHost(PxVec4* anisotropy1, PxVec4* anisotropy2, PxVec4* anisotropy3) = 0;
|
||||
|
||||
/**
|
||||
\brief Set a device buffer that holds the anisotrpy data after the timestep completed
|
||||
|
||||
\param[in] anisotropy1 A device buffer holding the first row of the anisotropy matrix with memory for all particles already allocated
|
||||
\param[in] anisotropy2 A device buffer holding the second row of the anisotropy matrix with memory for all particles already allocated
|
||||
\param[in] anisotropy3 A device buffer holding the third row of the anisotropy matrix with memory for all particles already allocated
|
||||
*/
|
||||
virtual void setResultBufferDevice(PxVec4* anisotropy1, PxVec4* anisotropy2, PxVec4* anisotropy3) = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the maximum value anisotropy can reach in any direction
|
||||
|
||||
\param[in] maxAnisotropy The maximum anisotropy value
|
||||
*/
|
||||
virtual void setAnisotropyMax(float maxAnisotropy) = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the minimum value anisotropy can reach in any direction
|
||||
|
||||
\param[in] minAnisotropy The minimum anisotropy value
|
||||
*/
|
||||
virtual void setAnisotropyMin(float minAnisotropy) = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the anisotropy scale
|
||||
|
||||
\param[in] anisotropyScale The anisotropy scale
|
||||
*/
|
||||
virtual void setAnisotropyScale(float anisotropyScale) = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the maximal number of particles
|
||||
|
||||
\return The maximal number of particles
|
||||
*/
|
||||
virtual PxU32 getMaxParticles() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the maximal number of particles
|
||||
|
||||
\param[in] maxParticles The maximal number of particles
|
||||
*/
|
||||
virtual void setMaxParticles(PxU32 maxParticles) = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the device pointer for the anisotropy in x direction. Only available after calling setResultBufferHost or setResultBufferDevice
|
||||
|
||||
\return The device pointer for the anisotropy x direction and scale (w component contains the scale)
|
||||
*/
|
||||
virtual PxVec4* getAnisotropy1DevicePointer() const = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the device pointer for the anisotropy in y direction. Only available after calling setResultBufferHost or setResultBufferDevice
|
||||
|
||||
\return The device pointer for the anisotropy y direction and scale (w component contains the scale)
|
||||
*/
|
||||
virtual PxVec4* getAnisotropy2DevicePointer() const = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the device pointer for the anisotropy in z direction. Only available after calling setResultBufferHost or setResultBufferDevice
|
||||
|
||||
\return The device pointer for the anisotropy z direction and scale (w component contains the scale)
|
||||
*/
|
||||
virtual PxVec4* getAnisotropy3DevicePointer() const = 0;
|
||||
|
||||
/**
|
||||
\brief Enables or disables the anisotropy generator
|
||||
|
||||
\param[in] enabled The boolean to set the generator to enabled or disabled
|
||||
*/
|
||||
virtual void setEnabled(bool enabled) = 0;
|
||||
|
||||
/**
|
||||
\brief Allows to query if the anisotropy generator is enabled
|
||||
|
||||
\return True if enabled, false otherwise
|
||||
*/
|
||||
virtual bool isEnabled() const = 0;
|
||||
|
||||
/**
|
||||
\brief Releases the instance and its data
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
|
||||
/**
|
||||
\brief Destructor
|
||||
*/
|
||||
virtual ~PxAnisotropyGenerator() {}
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Default implementation of a particle system callback to trigger anisotropy calculations. A call to fetchResultsParticleSystem() on the
|
||||
PxScene will synchronize the work such that the caller knows that the post solve task completed.
|
||||
*/
|
||||
class PxAnisotropyCallback : public PxParticleSystemCallback
|
||||
{
|
||||
public:
|
||||
/**
|
||||
\brief Initializes the anisotropy callback
|
||||
|
||||
\param[in] anistropyGenerator The anisotropy generator
|
||||
*/
|
||||
void initialize(PxAnisotropyGenerator* anistropyGenerator)
|
||||
{
|
||||
mAnistropyGenerator = anistropyGenerator;
|
||||
}
|
||||
|
||||
virtual void onPostSolve(const PxGpuMirroredPointer<PxGpuParticleSystem>& gpuParticleSystem, CUstream stream)
|
||||
{
|
||||
if (mAnistropyGenerator)
|
||||
{
|
||||
mAnistropyGenerator->generateAnisotropy(gpuParticleSystem.mDevicePtr, gpuParticleSystem.mHostPtr->mCommonData.mMaxParticles, stream);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onBegin(const PxGpuMirroredPointer<PxGpuParticleSystem>& /*gpuParticleSystem*/, CUstream /*stream*/) { }
|
||||
|
||||
virtual void onAdvance(const PxGpuMirroredPointer<PxGpuParticleSystem>& /*gpuParticleSystem*/, CUstream /*stream*/) { }
|
||||
|
||||
private:
|
||||
PxAnisotropyGenerator* mAnistropyGenerator;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
74
engine/third_party/physx/include/PxArrayConverter.h
vendored
Normal file
74
engine/third_party/physx/include/PxArrayConverter.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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_CONVERTER_H
|
||||
#define PX_ARRAY_CONVERTER_H
|
||||
|
||||
#include "cudamanager/PxCudaContext.h"
|
||||
#include "cudamanager/PxCudaContextManager.h"
|
||||
|
||||
#include "foundation/PxSimpleTypes.h"
|
||||
#include "foundation/PxVec4.h"
|
||||
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
#if PX_SUPPORT_GPU_PHYSX
|
||||
|
||||
/**
|
||||
\brief Utility class to convert gpu arrays to a different memory layout
|
||||
*/
|
||||
class PxArrayConverter
|
||||
{
|
||||
public:
|
||||
/**
|
||||
\brief Helper function to merge two separate PxVec4 arrays into one interleaved PxVec3 array
|
||||
\param[in] verticesD The vertices device memory buffer
|
||||
\param[in] normalsD The normals device memory buffer
|
||||
\param[in] length The number of vertices and normals
|
||||
\param[out] interleavedResultBufferD The resulting interleaved buffer containing 2*length elements with the format vertex0, normal0, vertex1, normal1...
|
||||
\param[in] stream The cuda stream on which the conversion is processed
|
||||
*/
|
||||
virtual void interleaveGpuBuffers(const PxVec4* verticesD, const PxVec4* normalsD, PxU32 length, PxVec3* interleavedResultBufferD, CUstream stream) = 0;
|
||||
|
||||
/**
|
||||
\brief Destructor
|
||||
*/
|
||||
virtual ~PxArrayConverter() {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
74
engine/third_party/physx/include/PxArticulationFlag.h
vendored
Normal file
74
engine/third_party/physx/include/PxArticulationFlag.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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 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. Link velocities cannot be set except for the root link velocity via PxArticulationCache::rootLinkData.
|
||||
eLINK_ACCELERATION = (1 << 5), //!< The link accelerations, see PxArticulationCache::linkAcceleration.
|
||||
eROOT_TRANSFORM = (1 << 6), //!< The root link transform, see PxArticulationCache::rootLinkData.
|
||||
eROOT_VELOCITIES = (1 << 7), //!< The root link velocities (read/write) and accelerations (read), see PxArticulationCache::rootLinkData.
|
||||
eLINK_INCOMING_JOINT_FORCE = (1 << 10), //!< The link incoming joint forces, see PxArticulationCache::linkIncomingJointForce.
|
||||
eJOINT_TARGET_POSITIONS = (1 << 11), //!< The joint target positions, see PxArticulationCache::jointTargetPositions.
|
||||
eJOINT_TARGET_VELOCITIES = (1 << 12), //!< The joint target velocities, see PxArticulationCache::jointTargetVelocities.
|
||||
eLINK_FORCE = (1 << 13), //!< The link forces, see PxArticulationCache::linkForce.
|
||||
eLINK_TORQUE = (1 << 14), //!< The link torques, see PxArticulationCache::linkTorque.
|
||||
eALL = (eVELOCITY | eACCELERATION | ePOSITION | eLINK_VELOCITY | eLINK_ACCELERATION | eROOT_TRANSFORM | eROOT_VELOCITIES)
|
||||
};
|
||||
};
|
||||
|
||||
typedef PxFlags<PxArticulationCacheFlag::Enum, PxU32> PxArticulationCacheFlags;
|
||||
PX_FLAGS_OPERATORS(PxArticulationCacheFlag::Enum, PxU32)
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
551
engine/third_party/physx/include/PxArticulationJointReducedCoordinate.h
vendored
Normal file
551
engine/third_party/physx/include/PxArticulationJointReducedCoordinate.h
vendored
Normal file
@@ -0,0 +1,551 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. 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
|
||||
|
||||
#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.
|
||||
<b>Default:</b> 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.
|
||||
<b>Default:</b> 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 amend the joint type, remove and then re-add the articulation to the scene.
|
||||
|
||||
<b>Default:</b> PxArticulationJointType::eUNDEFINED
|
||||
|
||||
\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.
|
||||
|
||||
<b>Default:</b> PxArticulationMotion::eLOCKED
|
||||
|
||||
\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] limit The joint limits.
|
||||
|
||||
\note This call is not allowed while the simulation is running.
|
||||
|
||||
\note For PxArticulationJointType::eSPHERICAL, limit.min and limit.max must both be in range [-Pi, Pi].
|
||||
\note For PxArticulationJointType::eREVOLUTE, limit.min and limit.max must both be in range [-2*Pi, 2*Pi].
|
||||
\note For PxArticulationJointType::eREVOLUTE_UNWRAPPED, limit.min and limit.max must both be in range [-PX_MAX_REAL, PX_MAX_REAL].
|
||||
\note For PxArticulationJointType::ePRISMATIC, limit.min and limit.max must both be in range [-PX_MAX_REAL, PX_MAX_REAL].
|
||||
|
||||
<b>Default:</b> (0,0)
|
||||
|
||||
\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] drive The drive parameters
|
||||
|
||||
\note This call is not allowed while the simulation is running.
|
||||
|
||||
\see getDriveParams, PxArticulationAxis, PxArticulationDrive
|
||||
|
||||
<b>Default:</b> PxArticulationDrive(0.0f, 0.0f, 0.0f, PxArticulationDriveType::eNONE)
|
||||
*/
|
||||
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 This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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
|
||||
|
||||
<b>Default:</b> 0.0
|
||||
*/
|
||||
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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\see PxArticulationAxis, getDriveVelocity
|
||||
|
||||
<b>Default:</b> 0.0
|
||||
*/
|
||||
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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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
|
||||
|
||||
<b>Default:</b> 0.0
|
||||
*/
|
||||
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
|
||||
|
||||
<b>Default:</b> 0.05
|
||||
*/
|
||||
virtual PX_DEPRECATED void setFrictionCoefficient(const PxReal coefficient) = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the joint friction coefficient.
|
||||
|
||||
\return The joint friction coefficient.
|
||||
|
||||
\see setFrictionCoefficient
|
||||
*/
|
||||
virtual PX_DEPRECATED PxReal getFrictionCoefficient() const = 0;
|
||||
|
||||
/**
|
||||
\brief Configures joint friction.
|
||||
|
||||
See PxJointFrictionParams for parameter details; and the manual for further information. The new friction model is applied to all axes where setFrictionParams() has been called.
|
||||
For axes where setFrictionParams() hasn't been used, the deprecated friction model remains in effect. See setFrictionCoefficient().
|
||||
|
||||
\param[in] axis The target axis.
|
||||
\param[in] jointFrictionParams The joint friction parameters.
|
||||
|
||||
\note This call is not allowed while the simulation is running.
|
||||
|
||||
<b>Default:</b> PxJointFrictionParams(0.0f, 0.0f, 0.0f)
|
||||
*/
|
||||
virtual void setFrictionParams(PxArticulationAxis::Enum axis, const PxJointFrictionParams& jointFrictionParams) = 0;
|
||||
|
||||
/**
|
||||
\brief Gets per-axis joint friction parameters struct.
|
||||
|
||||
\param[in] axis The target axis.
|
||||
|
||||
\return The joint friction parameters.
|
||||
|
||||
\see setFrictionParams()
|
||||
*/
|
||||
virtual PxJointFrictionParams getFrictionParams(PxArticulationAxis::Enum axis) 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
|
||||
|
||||
<b>Default:</b> 100.0
|
||||
*/
|
||||
virtual PX_DEPRECATED 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 PX_DEPRECATED PxReal getMaxJointVelocity() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the maximal joint velocity enforced for the given axis.
|
||||
|
||||
- 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] axis The target axis.
|
||||
\param[in] maxJointV The maximal per-axis joint velocity.
|
||||
|
||||
\note This call is not allowed while the simulation is running.
|
||||
|
||||
\see getMaxJointVelocity()
|
||||
|
||||
<b>Default:</b> 100.0
|
||||
*/
|
||||
virtual void setMaxJointVelocity(PxArticulationAxis::Enum axis, const PxReal maxJointV) = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the maximal joint velocity enforced for the given axis.
|
||||
|
||||
\param[in] axis The target axis.
|
||||
|
||||
\return The maximal joint velocity for the given axis.
|
||||
|
||||
\see setMaxJointVelocity()
|
||||
*/
|
||||
virtual PxReal getMaxJointVelocity(PxArticulationAxis::Enum axis) 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 This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\note For PxArticulationJointType::eSPHERICAL, jointPos must be in range [-Pi, Pi].
|
||||
\note For PxArticulationJointType::eREVOLUTE, jointPos must be in range [-2*Pi, 2*Pi].
|
||||
\note For PxArticulationJointType::eREVOLUTE_UNWRAPPED, jointPos must be in range [-PX_MAX_REAL, PX_MAX_REAL].
|
||||
\note For PxArticulationJointType::ePRISMATIC, jointPos must be in range [-PX_MAX_REAL, PX_MAX_REAL].
|
||||
|
||||
\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
|
||||
|
||||
<b>Default:</b> 0.0
|
||||
*/
|
||||
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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\see PxArticulationAxis, getJointVelocity, PxArticulationCache::jointVelocity, PxArticulationReducedCoordinate::updateKinematic
|
||||
|
||||
<b>Default:</b> 0.0
|
||||
*/
|
||||
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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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 PX_OVERRIDE PX_FINAL { 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.
|
||||
|
||||
/**
|
||||
\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.
|
||||
|
||||
<b>Default:</b> 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;
|
||||
|
||||
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 { PX_IS_KIND_OF(name, "PxArticulationJointReducedCoordinate", PxBase); }
|
||||
};
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
208
engine/third_party/physx/include/PxArticulationLink.h
vendored
Normal file
208
engine/third_party/physx/include/PxArticulationLink.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
#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 low-level indices are built after an articulation is added to the scene following a breadth-first approach,
|
||||
where all the links at the current depth are indexed sequentially before moving to the links at the next depth level.
|
||||
The root of the articulation has therefore the index 0.
|
||||
Note that the low-level indices may be different from the order in which the links were originally added to the articulation.
|
||||
|
||||
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.
|
||||
|
||||
<b>Default:</b> 0.025
|
||||
<b>Range:</b> [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.
|
||||
|
||||
- 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.
|
||||
|
||||
\note The linear velocity is reported with respect to the link's center of mass and not the actor frame origin.
|
||||
|
||||
\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 PX_OVERRIDE PX_FINAL { 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 { PX_IS_KIND_OF(name, "PxArticulationLink", PxRigidBody); }
|
||||
};
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
166
engine/third_party/physx/include/PxArticulationMimicJoint.h
vendored
Normal file
166
engine/third_party/physx/include/PxArticulationMimicJoint.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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_MIMIC_JOINT_H
|
||||
#define PX_ARTICULATION_MIMIC_JOINT_H
|
||||
|
||||
#include "foundation/PxSimpleTypes.h"
|
||||
#include "solver/PxSolverDefs.h"
|
||||
#include "common/PxBase.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
class PxArticulationReducedCoordinate;
|
||||
class PxArticulationJointReducedCoordinate;
|
||||
|
||||
/**
|
||||
* \brief A mimic joint enforces a linear relationship between the positions of two joints of the same articulation instance.
|
||||
\see PxArticulationReducedCoodinate::createMimicJoint()
|
||||
*/
|
||||
class PxArticulationMimicJoint : public PxBase
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
\brief Releases the mimic joint.
|
||||
|
||||
\note Releasing a mimic joint is not allowed while the articulation is in a scene. In order to
|
||||
release a mimic joint, remove and then re-add the articulation to the scene.
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
|
||||
/**
|
||||
\brief Returns the articulation that this mimic joint is part of.
|
||||
|
||||
\return A reference to the articulation.
|
||||
*/
|
||||
virtual PxArticulationReducedCoordinate& getArticulation() const = 0;
|
||||
|
||||
/**
|
||||
\brief Get the gear of a mimic joint.
|
||||
\return The gear ratio.
|
||||
*/
|
||||
virtual PxReal getGearRatio() const = 0;
|
||||
|
||||
/**
|
||||
\brief Set the gear ratio of a mimic joint.
|
||||
\param[in] gearRatio is the new gear ratio to be used in the next simulation step.
|
||||
*/
|
||||
virtual void setGearRatio(PxReal gearRatio) = 0;
|
||||
|
||||
/**
|
||||
\brief Get the offset of a mimic joint.
|
||||
\return The offset.
|
||||
*/
|
||||
virtual PxReal getOffset() const = 0;
|
||||
|
||||
/**
|
||||
\brief Set the offset of a mimic joint.
|
||||
\param[in] offset is the new offset to be used in the next simulation step.
|
||||
*/
|
||||
virtual void setOffset(PxReal offset) = 0;
|
||||
|
||||
/**
|
||||
\brief Get the natural frequency of a mimic joint.
|
||||
\return The natural frequency.
|
||||
*/
|
||||
virtual PxReal getNaturalFrequency() const = 0;
|
||||
|
||||
/**
|
||||
\brief Set the natural frequency of a mimic joint.
|
||||
\param[in] naturalFrequency is the new natural frequency to be used in the next simulation step.
|
||||
*/
|
||||
virtual void setNaturalFrequency(PxReal naturalFrequency) = 0;
|
||||
|
||||
/**
|
||||
\brief Get the damping ratio of a mimic joint.
|
||||
\return The damping ratio.
|
||||
*/
|
||||
virtual PxReal getDampingRatio() const = 0;
|
||||
|
||||
/**
|
||||
\brief Set the damping ratio of a mimic joint.
|
||||
\param[in] dampingRatio is the new damping ratio to be used in the next simulation step.
|
||||
*/
|
||||
virtual void setDampingRatio(PxReal dampingRatio) = 0;
|
||||
|
||||
|
||||
/**
|
||||
\brief Return the jointA specified in PxArticulationReducedCoordinate::createMimicJoint()
|
||||
\return The jointA specified in PxArticulationReducedCoordinate::createMimicJoint()
|
||||
\see PxArticulationReducedCoordinate::createMimicJoint()
|
||||
*/
|
||||
virtual PxArticulationJointReducedCoordinate& getJointA() const = 0;
|
||||
|
||||
/**
|
||||
\brief Return the jointB specified in PxArticulationReducedCoordinate::createMimicJoint()
|
||||
\return The jointB specified in PxArticulationReducedCoordinate::createMimicJoint()
|
||||
\see PxArticulationReducedCoordinate::createMimicJoint()
|
||||
*/
|
||||
virtual PxArticulationJointReducedCoordinate& getJointB() const = 0;
|
||||
|
||||
/**
|
||||
\brief Return the axisA specified in PxArticulationReducedCoordinate::createMimicJoint()
|
||||
\return The axisA specified in PxArticulationReducedCoordinate::createMimicJoint()
|
||||
\see PxArticulationReducedCoordinate::createMimicJoint()
|
||||
*/
|
||||
|
||||
virtual PxArticulationAxis::Enum getAxisA() const = 0;
|
||||
|
||||
/**
|
||||
\brief Return the axisB specified in PxArticulationReducedCoordinate::createMimicJoint()
|
||||
\return The axisB specified in PxArticulationReducedCoordinate::createMimicJoint()
|
||||
\see PxArticulationReducedCoordinate::createMimicJoint()
|
||||
*/
|
||||
virtual PxArticulationAxis::Enum getAxisB() const = 0;
|
||||
|
||||
/**
|
||||
\brief Returns the string name of the dynamic type.
|
||||
|
||||
\return The string name.
|
||||
*/
|
||||
virtual const char* getConcreteTypeName() const PX_OVERRIDE PX_FINAL { return "PxArticulationMimicJoint"; }
|
||||
|
||||
virtual ~PxArticulationMimicJoint() {}
|
||||
|
||||
void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object.
|
||||
|
||||
protected:
|
||||
PX_INLINE PxArticulationMimicJoint(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {}
|
||||
PX_INLINE PxArticulationMimicJoint(PxBaseFlags baseFlags) : PxBase(baseFlags) {}
|
||||
};
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif //PX_ARTICULATION_MIMIC_JOINT_H
|
||||
1546
engine/third_party/physx/include/PxArticulationReducedCoordinate.h
vendored
Normal file
1546
engine/third_party/physx/include/PxArticulationReducedCoordinate.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
630
engine/third_party/physx/include/PxArticulationTendon.h
vendored
Normal file
630
engine/third_party/physx/include/PxArticulationTendon.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
#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.
|
||||
<b>Default:</b> 0
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
<b>Default:</b> (PX_MAX_F32, -PX_MAX_F32) (i.e. an invalid configuration that can only work if stiffness is zero)
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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 PX_OVERRIDE PX_FINAL { 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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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 PX_OVERRIDE PX_FINAL { 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.
|
||||
<b>Default:</b> 0
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\see getStiffness()
|
||||
*/
|
||||
virtual void setStiffness(const PxReal stiffness) = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the spring stiffness of the tendon.
|
||||
|
||||
\return The spring stiffness.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
<b>Default:</b> 0
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
<b>Default:</b> 0
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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. <b>Default:</b> 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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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 PX_OVERRIDE PX_FINAL { 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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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.
|
||||
|
||||
\note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details.
|
||||
|
||||
\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 PX_OVERRIDE PX_FINAL { 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
|
||||
|
||||
120
engine/third_party/physx/include/PxArticulationTendonData.h
vendored
Normal file
120
engine/third_party/physx/include/PxArticulationTendonData.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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 PxDirectGPUAPI::getArticulationData PxDirectGPUAPI::setArticulationData
|
||||
*/
|
||||
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 PxDirectGPUAPI::getArticulationData PxDirectGPUAPI::setArticulationData
|
||||
*/
|
||||
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 PxDirectGPUAPI::getArticulationData PxDirectGPUAPI::setArticulationData
|
||||
*/
|
||||
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 PxDirectGPUAPI::getArticulationData PxDirectGPUAPI::setArticulationData
|
||||
*/
|
||||
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
|
||||
60
engine/third_party/physx/include/PxBaseMaterial.h
vendored
Normal file
60
engine/third_party/physx/include/PxBaseMaterial.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
#include "PxPhysXConfig.h"
|
||||
#include "common/PxBase.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
\brief Base material class.
|
||||
|
||||
\see PxPhysics.createMaterial PxPhysics.createDeformableSurfaceMaterial PxPhysics.createDeformableVolumeMaterial 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 { PX_IS_KIND_OF(name, "PxBaseMaterial", PxRefCounted); }
|
||||
|
||||
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
|
||||
802
engine/third_party/physx/include/PxBroadPhase.h
vendored
Normal file
802
engine/third_party/physx/include/PxBroadPhase.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
#include "PxPhysXConfig.h"
|
||||
#include "foundation/PxBounds3.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
class PxBaseTask;
|
||||
class PxCudaContextManager;
|
||||
class PxAllocatorCallback;
|
||||
|
||||
/**
|
||||
\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 Descriptor for the GPU broad-phase.
|
||||
|
||||
This struct contains parameters that are only relevant for the GPU broad-phase.
|
||||
|
||||
\see PxBroadPhaseType::eGPU
|
||||
*/
|
||||
struct PxGpuBroadPhaseDesc
|
||||
{
|
||||
PxGpuBroadPhaseDesc() :
|
||||
gpuBroadPhaseNbBitsShiftX (4),
|
||||
gpuBroadPhaseNbBitsShiftY (4),
|
||||
gpuBroadPhaseNbBitsShiftZ (4),
|
||||
gpuBroadPhaseNbBitsEnvIDX (0),
|
||||
gpuBroadPhaseNbBitsEnvIDY (0),
|
||||
gpuBroadPhaseNbBitsEnvIDZ (0)
|
||||
{
|
||||
}
|
||||
|
||||
// The GPU broadphase encodes bounds as integers, and then right-shifts the data by this amount of bits.
|
||||
// This makes the bounds a bit larger, which avoids losing and recreating overlaps over and over when
|
||||
// two objects are just touching. This effect is similar to what can be achieved with the contact distance
|
||||
// parameter, and the amount by which the bounds are inflated depends on the distance from the bounds to
|
||||
// the origin (as the bounds encoding does not use a regular float-to-integer conversion, but instead a
|
||||
// reinterpretation of the float's bits). The default value in the GPU broadphase has always been 4 bits
|
||||
// but it is safe to use 0 here for more accurate bounds.
|
||||
PxU8 gpuBroadPhaseNbBitsShiftX; //!< number of bits used for "snap to grid" on the X axis
|
||||
PxU8 gpuBroadPhaseNbBitsShiftY; //!< number of bits used for "snap to grid" on the Y axis
|
||||
PxU8 gpuBroadPhaseNbBitsShiftZ; //!< number of bits used for "snap to grid" on the Z axis
|
||||
|
||||
// The bits lost by the previous shifts (gpuBroadPhaseNbBitsShiftXYZ) can be replaced with bits of the
|
||||
// environment IDs. This only makes sense when these parameters are used (see PxActor::setEnvironmentID
|
||||
// and PxAggregate::setEnvironmentID). In this case a number of bits from the environment IDs are stored
|
||||
// in the MSBs of encoded bounds. This has the effect of virtually spreading the bounds over 3D space,
|
||||
// which reduces the number of internal overlaps inside the broad-phase. This is mainly useful in RL
|
||||
// scenarios with "co-located" environments, but it can also provide performance gains with regular grid
|
||||
// configurations, that also generate a lot of internal overlaps on all coordinate axes.
|
||||
//
|
||||
// Beware: when using this feature, each object of each environment should be assigned a proper environment
|
||||
// ID. Objects shared between all environments (i.e. objects whose environment ID is PX_INVALID_U32) will
|
||||
// otherwise be internally assigned bounds that cover the entire 3D space, creating a lot of overlaps and
|
||||
// potential performance issues. This is only a concern when gpuBroadPhaseNbBitsEnvIDX/Y/Z are non zero,
|
||||
// shared objects are fine otherwise.
|
||||
PxU8 gpuBroadPhaseNbBitsEnvIDX; //!< number of environment ID bits merged with the bounds on the X axis
|
||||
PxU8 gpuBroadPhaseNbBitsEnvIDY; //!< number of environment ID bits merged with the bounds on the Y axis
|
||||
PxU8 gpuBroadPhaseNbBitsEnvIDZ; //!< number of environment ID bits merged with the bounds on the Z axis
|
||||
|
||||
PX_INLINE bool isValid() const
|
||||
{
|
||||
// This is used on 32bit data so it makes no sense to shift more than 32 bits.
|
||||
// It also makes no sense to shift all the bits of source data.
|
||||
if( gpuBroadPhaseNbBitsShiftX > 31
|
||||
|| gpuBroadPhaseNbBitsShiftY > 31
|
||||
|| gpuBroadPhaseNbBitsShiftZ > 31)
|
||||
return false;
|
||||
|
||||
if( gpuBroadPhaseNbBitsEnvIDX > 31
|
||||
|| gpuBroadPhaseNbBitsEnvIDY > 31
|
||||
|| gpuBroadPhaseNbBitsEnvIDZ > 31)
|
||||
return false;
|
||||
|
||||
// We can only store bits from environment IDs in bits shifted away from the source data.
|
||||
// So we need to drop (shift) at least as many bits of the source data as we need for env IDs.
|
||||
if( gpuBroadPhaseNbBitsEnvIDX > gpuBroadPhaseNbBitsShiftX
|
||||
|| gpuBroadPhaseNbBitsEnvIDY > gpuBroadPhaseNbBitsShiftY
|
||||
|| gpuBroadPhaseNbBitsEnvIDZ > gpuBroadPhaseNbBitsShiftZ)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
\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.
|
||||
|
||||
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 updateAndFetchResults(PxBroadPhaseResults& results, const PxBroadPhaseUpdateData& updateData)
|
||||
{
|
||||
update(updateData);
|
||||
fetchResults(results);
|
||||
}
|
||||
|
||||
/**
|
||||
\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_DEPRECATED 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 updateAndFetchResults(PxBroadPhaseResults& results)
|
||||
{
|
||||
update();
|
||||
fetchResults(results);
|
||||
}
|
||||
|
||||
/**
|
||||
\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_DEPRECATED 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
|
||||
57
engine/third_party/physx/include/PxClient.h
vendored
Normal file
57
engine/third_party/physx/include/PxClient.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
124
engine/third_party/physx/include/PxConeLimitedConstraint.h
vendored
Normal file
124
engine/third_party/physx/include/PxConeLimitedConstraint.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
|
||||
#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()
|
||||
{
|
||||
setToDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Set values such that constraint is disabled.
|
||||
*/
|
||||
PX_INLINE void setToDefault()
|
||||
{
|
||||
mAxis = PxVec3(0.f, 0.f, 0.f);
|
||||
mAngle = -1.f;
|
||||
mLowLimit = -1.f;
|
||||
mHighLimit = -1.f;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Checks for valitity.
|
||||
|
||||
\return true if the constaint is valid
|
||||
*/
|
||||
PX_INLINE bool isValid() const
|
||||
{
|
||||
//disabled
|
||||
if (mAngle < 0.f && mLowLimit < 0.f && mHighLimit < 0.f)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mAxis.isNormalized())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//negative signifies that cone is disabled
|
||||
if (mAngle >= PxPi)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//negative signifies that distance limits are disabled
|
||||
if (mLowLimit > mHighLimit && mHighLimit >= 0.0f && mLowLimit >= 0.0f)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
PxVec3 mAxis; //!< Axis of the cone in actor space
|
||||
PxReal mAngle; //!< Opening angle in radians, negative indicates unlimited
|
||||
PxReal mLowLimit; //!< Minimum distance, negative indicates unlimited
|
||||
PxReal mHighLimit; //!< Maximum distance, negative indicates unlimited
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Compressed form of cone limit parameters
|
||||
\see PxConeLimitedConstraint
|
||||
*/
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct PxConeLimitParams
|
||||
{
|
||||
PX_CUDA_CALLABLE PxConeLimitParams() {}
|
||||
|
||||
PX_CUDA_CALLABLE PxConeLimitParams(const PxConeLimitedConstraint& coneLimitedConstraint) :
|
||||
lowHighLimits(coneLimitedConstraint.mLowLimit, coneLimitedConstraint.mHighLimit, 0.0f, 0.0f),
|
||||
axisAngle(coneLimitedConstraint.mAxis, coneLimitedConstraint.mAngle)
|
||||
{
|
||||
}
|
||||
|
||||
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
|
||||
291
engine/third_party/physx/include/PxConstraint.h
vendored
Normal file
291
engine/third_party/physx/include/PxConstraint.h
vendored
Normal file
@@ -0,0 +1,291 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. 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
|
||||
|
||||
|
||||
#include "PxPhysXConfig.h"
|
||||
#include "PxConstraintDesc.h"
|
||||
#include "common/PxBase.h"
|
||||
#include "PxResidual.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
|
||||
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, //!< \deprecated Will be removed in a future version and the limits will always be forces. 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, //!< please do not raise this flag as it is for internal use only
|
||||
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<PxConstraintFlag::Enum, PxU16> 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
|
||||
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 PxConstraintVisualize
|
||||
*/
|
||||
virtual void setConstraintFunctions(PxConstraintConnector& connector, const PxConstraintShaderTable& shaders) = 0;
|
||||
|
||||
virtual const char* getConcreteTypeName() const PX_OVERRIDE PX_FINAL { return "PxConstraint"; }
|
||||
|
||||
/**
|
||||
\brief Returns the residual for this constraint.
|
||||
|
||||
The residual represents the current error in this constraint measured as the delta impulse applied in the last velocity or position iteration.
|
||||
If the solver converges perfectly, the residual should approach zero.
|
||||
|
||||
\return The residual for this constraint.
|
||||
|
||||
\see PxConstraintResidual
|
||||
*/
|
||||
virtual PxConstraintResidual getSolverResidual() const = 0;
|
||||
|
||||
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 { PX_IS_KIND_OF(name, "PxConstraint", PxBase); }
|
||||
|
||||
public:
|
||||
/**
|
||||
\cond
|
||||
*/
|
||||
|
||||
// for internal use only
|
||||
virtual PxConstraintGPUIndex getGPUIndex() const = 0;
|
||||
|
||||
/**
|
||||
\endcond
|
||||
*/
|
||||
};
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
491
engine/third_party/physx/include/PxConstraintDesc.h
vendored
Normal file
491
engine/third_party/physx/include/PxConstraintDesc.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
|
||||
#include "PxPhysXConfig.h"
|
||||
#include "foundation/PxFlags.h"
|
||||
#include "foundation/PxVec3.h"
|
||||
#include "foundation/PxTransform.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
|
||||
{
|
||||
PX_CUDA_CALLABLE 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::eDRIVE_LIMITS_ARE_FORCES is set)
|
||||
eANGULAR_CONSTRAINT = 1<<6, //!< whether this is an angular or linear constraint
|
||||
};
|
||||
};
|
||||
|
||||
typedef PxFlags<Px1DConstraintFlag::Type, PxU16> 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, //!< for internal purpose only, please do not use.
|
||||
eROTATIONAL_INEQUALITY = 1025, //!< for internal purpose only, please do not use.
|
||||
|
||||
/**
|
||||
\brief Mark as equality constraint.
|
||||
|
||||
If a 1D constraint is an equality constraint with [-PX_MAX_FLT, PX_MAX_FLT] force limits and a velocity target equal zero, then this
|
||||
flag can be raised to allow the solver to internally change the jacobian of this constraint and have it being orthogonalized relative
|
||||
to other equality constraints in the same PxConstraint (unless PxConstraintFlag::eDISABLE_PREPROCESSING is set). This can improve
|
||||
the convergence when solving the constraints.
|
||||
*/
|
||||
eEQUALITY = 2048,
|
||||
|
||||
/**
|
||||
\brief Mark as inequality constraint.
|
||||
|
||||
If a 1D constraint is an inequality constraint with [0, PX_MAX_FLT] force limits, then this flag can be raised to allow the solver
|
||||
to internally change the jacobian of this constraint and have it being orthogonalized relative to the equality constraints in the
|
||||
same PxConstraint (unless PxConstraintFlag::eDISABLE_PREPROCESSING is set). This can improve the convergence when solving the
|
||||
constraints.
|
||||
*/
|
||||
eINEQUALITY = 2049
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief A one-dimensional constraint that constrains the relative motion of two rigid bodies.
|
||||
|
||||
A constraint is expressed as a set of 1-dimensional constraint rows which define the required constraint
|
||||
on the objects' velocities.
|
||||
|
||||
The constraint Jacobian J is specified by the parameters linear0, angular0, linear1, angular1 as follows
|
||||
|
||||
J = {linear0, angular0, -linear1, -angular1}
|
||||
|
||||
The velocity target of the constraint is specified by Px1DConstraint::velocityTarget and the geometric error of the constraint
|
||||
is specified by Px1DConstraint::geometricError.
|
||||
|
||||
The output of the constraint is a velocity state (sdot = ds/dt with s denoting the constraint state) expressed in the world frame:
|
||||
|
||||
sdot = {linearVelocity0, angularVelocity0, linearVelocity1, angularVelocity1}
|
||||
|
||||
with linearVelocity0 and angularVelocity0 denoting the linear and angular velocity of body0 of the constraint;
|
||||
and linearVelocity1 and angularVelocity1 denoting the linear and angular velocity of body1 of the constraint.
|
||||
|
||||
The constraint seeks an updated sdot that obeys a simple constraint rule:
|
||||
|
||||
J*sdot + BaumgarteTerm*geometricError/dt - velocityTarget = 0
|
||||
|
||||
where BaumgarteTerm is a multiplier in range (0, 1). The Baumgarte term is not exposed but is instead internally
|
||||
set according to a simple metric chosen to enhance numerical stability. If the PGS solver is employed then dt is
|
||||
taken from the scene timestep.
|
||||
|
||||
Another way of expressing the constraint rule is as follows:
|
||||
|
||||
linear0.dot(linearVelocity0) + angular0.dot(angularVelocity0)
|
||||
- linear1.dot(linearVelocity1) - angular1.dot(angularVelocity1)
|
||||
+ BaumgarteTerm*geometricError/dt - velocityTarget = 0
|
||||
|
||||
The PhysX solver runs two phases: position iterations followed by velocity iterations. Position iterations derive
|
||||
the velocity that is used to integrate the transform of a rigid body. Velocity iterations on the other hand derive
|
||||
the final velocity of a rigid body. The constraint rule presented above only gets applied during position iterations,
|
||||
during velocity iterations the geometricError term is usually ignored and the applied constraint rule is:
|
||||
|
||||
J*sdot - velocityTarget = 0
|
||||
|
||||
The flag Px1DConstraintFlag::eKEEPBIAS can be used to have velocity iterations apply the same constraint rule as
|
||||
position iterations.
|
||||
|
||||
A 1d constraint may be either a restitution constraint or a hard constraint or a spring constraint.
|
||||
|
||||
Restitution constraints have two modes of operation, depending on the speed of the constraint. These two modes are:
|
||||
a) a bounce mode that employs a restitution value specified by RestitutionModifiers::restitution
|
||||
b) a non-bounce mode that employs zero restitution and ignores RestitutionModifiers::restitution.
|
||||
The constraint speed immediately before the solver begins is computed as follows:
|
||||
constraintPreSolverSpeed = J * sdotPreSolver
|
||||
with sdotPreSolver denoting the rigid body velocities recorded after applying external forces and torques to the rigid bodies
|
||||
but before the solver begins.
|
||||
If the bounce mode is active, the pre solver velocity is expected to flip direction and have restitution applied:
|
||||
bounceSpeed = -restitution * constraintPreSolverSpeed
|
||||
Restitution will kick in if the following conditions are met:
|
||||
\li -constraintPreSolverSpeed exceeds the bounce threshold (RestitutionModifiers::velocityThreshold)
|
||||
\li (bounceSpeed * Px1DConstraint::geometricError) <= 0 (bounceSpeed points in the
|
||||
opposite direction of the geometric error)
|
||||
If these hold, then the provided Px1DConstraint::geometricError and Px1DConstraint::velocityTarget parameter will get overriden
|
||||
internally. The former will get set to zero, the latter will get set to bounceSpeed. If restitution does not activate because
|
||||
the listed conditions are not met, then the target velocity will be taken from the value stored in velocityTarget and the
|
||||
geometric error will be taken from the value stored in geometricError.
|
||||
RestitutionModifiers::restitution may be greater than 1 and may be less than 0 ie it is not limited to 0 <= restitution <= 1.
|
||||
|
||||
Hard constraints attempt to find sdot that satisfies the constraint equation:
|
||||
|
||||
J*sdot + BaumgarteTerm*geometricError/dt - velocityTarget = 0
|
||||
|
||||
Spring constraints are quite different from restitution and hard constraints in that they attempt to compute and apply a spring force as follows:
|
||||
|
||||
F = stiffness * -geometricError + damping * (velocityTarget - J*sdot)
|
||||
|
||||
where F is the constraint force or acceleration and J*sdot is the instantaneous constraint speed. Springs are
|
||||
implemented with a fully implicit time-stepping scheme: that is, the force or acceleration is a function of the position
|
||||
and velocity after the solve. Note that F gets applied to the first rigid body and -F to the second rigid body.
|
||||
|
||||
All constraints support limits on the minimum or maximum impulse applied.
|
||||
*/
|
||||
|
||||
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
|
||||
|
||||
union
|
||||
{
|
||||
struct SpringModifiers
|
||||
{
|
||||
PxReal stiffness; //!< spring parameter, for spring constraints
|
||||
PxReal damping; //!< damping parameter, for spring constraints
|
||||
} spring;
|
||||
struct RestitutionModifiers
|
||||
{
|
||||
PxReal restitution; //!< restitution parameter for determining additional "bounce"
|
||||
PxReal velocityThreshold; //!< minimum impact velocity for bounce
|
||||
} bounce;
|
||||
} mods;
|
||||
|
||||
PxU16 flags; //!< a set of Px1DConstraintFlags
|
||||
PxU16 solveHint; //!< constraint optimization hint, should be an element of PxConstraintSolveHint
|
||||
|
||||
PxU32 pad; // for padding only
|
||||
}
|
||||
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
|
||||
{
|
||||
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 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
|
||||
*/
|
||||
virtual void visualizeLinearLimit(const PxTransform& t0, const PxTransform& t1, PxReal value) = 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
|
||||
*/
|
||||
virtual void visualizeAngularLimit(const PxTransform& t0, PxReal lower, PxReal upper) = 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
|
||||
*/
|
||||
virtual void visualizeLimitCone(const PxTransform& t, PxReal tanQSwingY, PxReal tanQSwingZ) = 0;
|
||||
|
||||
/** \brief Visualize joint double cone
|
||||
|
||||
\param[in] t Transformation for the visualization
|
||||
\param[in] angle Limit angle
|
||||
*/
|
||||
virtual void visualizeDoubleCone(const PxTransform& t, PxReal angle) = 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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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()
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
844
engine/third_party/physx/include/PxContact.h
vendored
Normal file
844
engine/third_party/physx/include/PxContact.h
vendored
Normal file
@@ -0,0 +1,844 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. 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
|
||||
|
||||
|
||||
#include "foundation/PxVec3.h"
|
||||
#include "foundation/PxAssert.h"
|
||||
#include "PxConstraintDesc.h"
|
||||
#include "PxNodeIndex.h"
|
||||
#include "PxMaterial.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 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, PxConstraintInvMassScale mMassModification);
|
||||
|
||||
/**
|
||||
\brief Contact normal
|
||||
*/
|
||||
PX_ALIGN(16, PxVec3 normal);
|
||||
|
||||
/**
|
||||
\brief Restitution coefficient
|
||||
*/
|
||||
PxReal restitution;
|
||||
|
||||
/**
|
||||
\brief Dynamic friction coefficient
|
||||
*/
|
||||
PxReal dynamicFriction;
|
||||
|
||||
/**
|
||||
\brief Static friction coefficient
|
||||
*/
|
||||
PxReal staticFriction;
|
||||
|
||||
/**
|
||||
\brief Damping coefficient (for compliant contacts)
|
||||
*/
|
||||
PxReal damping;
|
||||
|
||||
/**
|
||||
\brief Index of the first contact in the patch
|
||||
*/
|
||||
PxU16 startContactIndex;
|
||||
|
||||
/**
|
||||
\brief The number of contacts in this patch
|
||||
*/
|
||||
PxU8 nbContacts;
|
||||
|
||||
/**
|
||||
\brief The combined material flag of two actors that come in contact
|
||||
\see PxMaterialFlag, PxCombineMode
|
||||
*/
|
||||
PxU8 materialFlags;
|
||||
|
||||
/**
|
||||
\brief The PxContactPatchFlags for this patch
|
||||
*/
|
||||
PxU16 internalFlags;
|
||||
|
||||
/**
|
||||
\brief Material index of first body
|
||||
*/
|
||||
PxU16 materialIndex0;
|
||||
|
||||
/**
|
||||
\brief Material index of second body
|
||||
*/
|
||||
PxU16 materialIndex1;
|
||||
|
||||
PxU16 pad[5];
|
||||
}
|
||||
PX_ALIGN_SUFFIX(16);
|
||||
|
||||
/**
|
||||
\brief Contact point data
|
||||
*/
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct PxContact
|
||||
{
|
||||
/**
|
||||
\brief Contact point in world space
|
||||
*/
|
||||
PxVec3 contact;
|
||||
/**
|
||||
\brief Separation value (negative implies penetration).
|
||||
*/
|
||||
PxReal separation;
|
||||
}
|
||||
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);
|
||||
/**
|
||||
\brief Maximum impulse
|
||||
*/
|
||||
PxReal maxImpulse;
|
||||
}
|
||||
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);
|
||||
/**
|
||||
\brief Restitution coefficient
|
||||
*/
|
||||
PxReal restitution;
|
||||
|
||||
/**
|
||||
\brief Material Flags
|
||||
*/
|
||||
PxU32 materialFlags;
|
||||
|
||||
/**
|
||||
\brief Shape A's material index
|
||||
*/
|
||||
PxU16 materialIndex0;
|
||||
/**
|
||||
\brief Shape B's material index
|
||||
*/
|
||||
PxU16 materialIndex1;
|
||||
/**
|
||||
\brief static friction coefficient
|
||||
*/
|
||||
PxReal staticFriction;
|
||||
/**
|
||||
\brief dynamic friction coefficient
|
||||
*/
|
||||
PxReal dynamicFriction;
|
||||
}
|
||||
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<const PxContactPatch*>(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<const PxContact*>(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<const PxContact*>(reinterpret_cast<const PxU8*>(contact) + contactPointSize * nbToStep);
|
||||
}
|
||||
patch = reinterpret_cast<const PxContactPatch*>(reinterpret_cast<const PxU8*>(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<const PxContact*>(reinterpret_cast<const PxU8*>(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.linear0;
|
||||
}
|
||||
|
||||
/**
|
||||
\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.linear1;
|
||||
}
|
||||
|
||||
/**
|
||||
\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.angular0;
|
||||
}
|
||||
|
||||
/**
|
||||
\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.angular1;
|
||||
}
|
||||
|
||||
/**
|
||||
\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<const PxContact*>(reinterpret_cast<const PxU8*>(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<const PxContactPatch*>(patch);
|
||||
}
|
||||
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxExtendedContact& getExtendedContact() const
|
||||
{
|
||||
PX_ASSERT(mStreamFormat == eMODIFIABLE_STREAM || mStreamFormat == eCOMPRESSED_MODIFIABLE_STREAM);
|
||||
return *static_cast<const PxExtendedContact*>(contact);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Contact patch friction information.
|
||||
*/
|
||||
struct PxFrictionPatch
|
||||
{
|
||||
/**
|
||||
\brief Max anchors per patch
|
||||
*/
|
||||
static const PxU32 MAX_ANCHOR_COUNT = 2;
|
||||
|
||||
/**
|
||||
\brief Friction anchors' positions
|
||||
*/
|
||||
PxVec3 anchorPositions[MAX_ANCHOR_COUNT];
|
||||
|
||||
/**
|
||||
\brief Friction anchors' impulses
|
||||
*/
|
||||
PxVec3 anchorImpulses[MAX_ANCHOR_COUNT];
|
||||
|
||||
/**
|
||||
\brief Friction anchor count
|
||||
*/
|
||||
PxU32 anchorCount;
|
||||
};
|
||||
|
||||
/**
|
||||
\brief A class to iterate over a friction anchor stream.
|
||||
*/
|
||||
class PxFrictionAnchorStreamIterator
|
||||
{
|
||||
public:
|
||||
/**
|
||||
\brief Constructor
|
||||
\param contactPatches Pointer to first patch header in contact stream containing contact patch data
|
||||
\param frictionPatches Buffer containing contact patches friction information.
|
||||
\param patchCount Number of contact patches stored in the contact stream
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxFrictionAnchorStreamIterator(const PxU8* contactPatches, const PxU8* frictionPatches, PxU32 patchCount)
|
||||
:
|
||||
mContactPatches(reinterpret_cast<const PxContactPatch*>(contactPatches)),
|
||||
mFrictionPatches(reinterpret_cast<const PxFrictionPatch*>(frictionPatches)),
|
||||
mPatchCount(patchCount),
|
||||
mFrictionAnchorIndex(-1),
|
||||
mPatchIndex(-1)
|
||||
{}
|
||||
|
||||
/**
|
||||
\brief Check if there are more patches.
|
||||
\return true if there are more patches.
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE bool hasNextPatch() const
|
||||
{
|
||||
return isValid() && mPatchIndex < PxI32(mPatchCount) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Advance to the next patch.
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE void nextPatch()
|
||||
{
|
||||
PX_ASSERT(hasNextPatch());
|
||||
++mPatchIndex;
|
||||
mFrictionAnchorIndex = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Check if current patch has more friction anchors.
|
||||
\return true if there are more friction anchors in current patch.
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE bool hasNextFrictionAnchor() const
|
||||
{
|
||||
return patchIsValid() && mFrictionAnchorIndex < PxI32(mFrictionPatches[mPatchIndex].anchorCount) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Advance to the next friction anchor in the patch.
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE void nextFrictionAnchor()
|
||||
{
|
||||
PX_ASSERT(hasNextFrictionAnchor());
|
||||
mFrictionAnchorIndex++;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Get the friction anchor's position.
|
||||
\return The friction anchor's position.
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& getPosition() const
|
||||
{
|
||||
PX_ASSERT(frictionAnchorIsValid());
|
||||
return mFrictionPatches[mPatchIndex].anchorPositions[mFrictionAnchorIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Get the friction anchor's impulse.
|
||||
\return The friction anchor's impulse.
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& getImpulse() const
|
||||
{
|
||||
PX_ASSERT(frictionAnchorIsValid());
|
||||
return mFrictionPatches[mPatchIndex].anchorImpulses[mFrictionAnchorIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Get the friction anchor's normal.
|
||||
\return The friction anchor's normal.
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& getNormal() const
|
||||
{
|
||||
PX_ASSERT(patchIsValid());
|
||||
return mContactPatches[mPatchIndex].normal;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Get current patch's static friction coefficient.
|
||||
\return The patch's static friction coefficient.
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getStaticFriction() const
|
||||
{
|
||||
PX_ASSERT(patchIsValid());
|
||||
return mContactPatches[mPatchIndex].staticFriction;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Get current patch's dynamic friction coefficient.
|
||||
\return The patch's dynamic friction coefficient.
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getDynamicFriction() const
|
||||
{
|
||||
PX_ASSERT(patchIsValid());
|
||||
return mContactPatches[mPatchIndex].dynamicFriction;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Get current patch's combined material flags.
|
||||
\return The patch's combined material flags.
|
||||
\see PxMaterialFlag, PxCombineMode
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxMaterialFlags getMaterialFlags() const
|
||||
{
|
||||
PX_ASSERT(patchIsValid());
|
||||
return PxMaterialFlags(mContactPatches[mPatchIndex].materialFlags);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxFrictionAnchorStreamIterator();
|
||||
|
||||
/**
|
||||
\brief Check if valid.
|
||||
\return true if valid.
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isValid() const
|
||||
{
|
||||
return mContactPatches && mFrictionPatches;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Check if current patch is valid.
|
||||
\return true if current patch is valid.
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE bool patchIsValid() const
|
||||
{
|
||||
return isValid() && mPatchIndex >= 0 && mPatchIndex < PxI32(mPatchCount);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Check if current friction anchor is valid.
|
||||
\return true if current friction anchor is valid.
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE bool frictionAnchorIsValid() const
|
||||
{
|
||||
return patchIsValid() && mFrictionAnchorIndex >= 0 && mFrictionAnchorIndex < PxI32(mFrictionPatches[mPatchIndex].anchorCount);
|
||||
}
|
||||
|
||||
const PxContactPatch* mContactPatches;
|
||||
const PxFrictionPatch* mFrictionPatches;
|
||||
PxU32 mPatchCount;
|
||||
PxI32 mFrictionAnchorIndex;
|
||||
PxI32 mPatchIndex;
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Contains contact information for a contact reported by the direct-GPU contact report API. See PxDirectGPUAPI::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.
|
||||
PxU8* frictionPatches; //!< Ptr to friction patch information. Type: PxFrictionPatch*, size: nbPatches.
|
||||
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
|
||||
523
engine/third_party/physx/include/PxContactModifyCallback.h
vendored
Normal file
523
engine/third_party/physx/include/PxContactModifyCallback.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
#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 as seen from the second actor in the contact pair, i.e., the solver will try to achieve targetVel == (vel1 - vel2)
|
||||
\note The sign of the velocity needs to be flipped depending on the order of the actors in the pair. There is no guarantee about the consistency of the order from frame to 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<PxU32*>(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.linear0;
|
||||
}
|
||||
|
||||
/**
|
||||
\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.linear1;
|
||||
}
|
||||
|
||||
/**
|
||||
\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.angular0;
|
||||
}
|
||||
|
||||
/**
|
||||
\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.angular1;
|
||||
}
|
||||
|
||||
/**
|
||||
\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.linear0 = 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.linear1 = 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.angular0 = 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.angular1 = 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<PxContactPatch*>(reinterpret_cast<PxU8*>(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.
|
||||
|
||||
<b>Threading:</b> It is <b>necessary</b> 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.
|
||||
|
||||
<b>Threading:</b> It is <b>necessary</b> 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
|
||||
237
engine/third_party/physx/include/PxDeformableAttachment.h
vendored
Normal file
237
engine/third_party/physx/include/PxDeformableAttachment.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PX_DEFORMABLE_ATTACHMENT_H
|
||||
#define PX_DEFORMABLE_ATTACHMENT_H
|
||||
|
||||
#include "PxConeLimitedConstraint.h"
|
||||
#include "PxFiltering.h"
|
||||
#include "PxNodeIndex.h"
|
||||
#include "foundation/PxTransform.h"
|
||||
#include "common/PxCoreUtilityTypes.h"
|
||||
#include "common/PxBase.h"
|
||||
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
\brief Struct to specify attachment between a particle/vertex and a rigid
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
*/
|
||||
struct PX_DEPRECATED PxParticleRigidAttachment : public PxParticleRigidFilterPair
|
||||
{
|
||||
PxParticleRigidAttachment() {}
|
||||
|
||||
PxParticleRigidAttachment(const PxConeLimitedConstraint& coneLimitedConstraint, const PxVec4& localPose0):
|
||||
PxParticleRigidFilterPair(PxNodeIndex().getInd(), PxNodeIndex().getInd()),
|
||||
mLocalPose0(localPose0),
|
||||
mConeLimitParams(coneLimitedConstraint)
|
||||
{
|
||||
}
|
||||
|
||||
PX_ALIGN(16, PxVec4 mLocalPose0); //!< local pose in body frame - except for statics, these are using world positions.
|
||||
PxConeLimitParams mConeLimitParams; //!< Parameters to specify cone constraints
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Identifies the attachment target type for an actor involved in an attachment.
|
||||
|
||||
The target type provides actor related information about what kind of attachment should be created.
|
||||
\see PxDeformableAttachmentData
|
||||
*/
|
||||
struct PxDeformableAttachmentTargetType
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eVERTEX, //!< Attachment to vertex points of deformable mesh.
|
||||
eTRIANGLE, //!< Attachment to points on triangles of deformable mesh.
|
||||
eTETRAHEDRON, //!< Attachment to points in tetrahedrons of deformable mesh.
|
||||
eRIGID, //!< Attachment to points in rigid actor local frame.
|
||||
eWORLD, //!< Attachment to points in global frame.
|
||||
eUNDEFINED //!< Internal use only.
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Attachment data for a pair of actors where one of the actors must be a deformable. For attaching rigids to rigids or rigids to the world, use joints instead.
|
||||
|
||||
An attachment is created based on a collection of attachment points. The attachment
|
||||
points are specified relatively to each of the two actors. They can be defined on the basis of
|
||||
deformable mesh elements, such as vertices, triangles or tetrahedrons. Depending on the deformable mesh element type,
|
||||
a baricentric coordinate further specifies the location on the element. For rigid or world attachments, the points are
|
||||
specified using cartesion coordinates.
|
||||
|
||||
The points are specified by:
|
||||
- Two actor instances and their types
|
||||
- Two attachment target types
|
||||
- Two sets of attachment data related to the target types
|
||||
|
||||
<a name="attachment_table1"></a>
|
||||
Table 1) The type of an actor limits which target types can be used:
|
||||
|
||||
PxDeformableSurface: eVERTEX, eTRIANGLE
|
||||
PxDeformableVolume: eVERTEX, eTETRAHEDRON (simulation mesh)
|
||||
PxRigidActor: eRIGID
|
||||
NULL: eWORLD
|
||||
|
||||
<a name="attachment_table2"></a>
|
||||
Table 2) On the other hand, the target type dictates which per-actor attachment data is needed:
|
||||
|
||||
eVERTEX: indices
|
||||
eTRIANGLE: indices, coords (barycentric: x, y, z)
|
||||
eTETRAHEDRON: indices, coords (barycentric: x, y, z, w)
|
||||
eRIGID: pose, coords (cartesian, local space: x, y, z)
|
||||
eWORLD: pose, coords (cartesion, world space: x, y, z)
|
||||
|
||||
Each entry pair in (indices, coords) defines an attachment point. Therefore, the size of indices and coords need to match up, if both are required.
|
||||
|
||||
\note The topology of an attachment is fixed once it's been created. To change the attachment points,
|
||||
the application will need to release the attachment and create a new attachment with the updated attachment points.
|
||||
The pose for attachments to eRIGID or eWORLD, however, can be updated without re-creating the attachment.
|
||||
|
||||
\see PxDeformableAttachment, PxPhysics::createDeformableAttachment()
|
||||
*/
|
||||
struct PxDeformableAttachmentData
|
||||
{
|
||||
PxDeformableAttachmentData()
|
||||
{
|
||||
for (PxU32 i = 0; i < 2; i++)
|
||||
{
|
||||
actor[i] = NULL;
|
||||
type[i] = PxDeformableAttachmentTargetType::eUNDEFINED;
|
||||
pose[i] = PxTransform(PxIdentity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Actor 0 and Actor 1. At least one of the actors must be a deformable. For attaching statically to the world, one actor is allowed to be NULL while the other is a deformable.
|
||||
*/
|
||||
PxActor* actor[2];
|
||||
|
||||
/**
|
||||
\brief One target type per actor.
|
||||
The target type must be supported by the corresponding actor type, see [table 1](#attachment_table1).
|
||||
*/
|
||||
PxDeformableAttachmentTargetType::Enum type[2];
|
||||
|
||||
/**
|
||||
\brief Indices data per actor.
|
||||
The content of the two index arrays depends on the corresponding target types 'type[0]' and 'type[1]'
|
||||
as well as the number of attachments:
|
||||
For PxDeformableAttachmentTargetType::eVERTEX, eTRIANGLE and eTETRAHEDRON, the corresponding array describes vertex,
|
||||
triangle or tetrahedon indices, and the size of the array needs to match the number of attachments.
|
||||
For PxDeformableAttachmentTargetType::eRIGID and eWORLD, the corresponding array needs to be empty.
|
||||
See [table 2](#attachment_table2).
|
||||
*/
|
||||
PxTypedBoundedData<const PxU32> indices[2];
|
||||
|
||||
/**
|
||||
\brief Coordinate data per actor.
|
||||
The content of the two coords arrays depends on the corresponding target types 'type[0]' and 'type[1]'
|
||||
as well as the number of attachments:
|
||||
For PxDeformableAttachmentTargetType::eVERTEX, the corresponding array needs to be empty.
|
||||
For PxDeformableAttachmentTargetType::eTRIANGLE and eTETRAHEDRON, the corresponding array descibes barycentric coordinates,
|
||||
and the size of the array needs to match the number of attachments.
|
||||
For PxDeformableAttachmentTargetType::eRIGID and eWORLD, the corresponding array describes cartesian coordinates and the size
|
||||
of the array needs to match the number of attachments.
|
||||
See [table 2](#attachment_table2).
|
||||
*/
|
||||
PxTypedBoundedData<const PxVec4> coords[2];
|
||||
|
||||
/**
|
||||
\brief Pose per actor.
|
||||
Global pose for PxDeformableAttachmentTargetType::eWORLD or local pose for PxDeformableAttachmentTargetType::eRIGID, see [table 2](#attachment_table2).
|
||||
The pose represents a coordinate frame for all attachment points specified by the array of euclidean coords in the case of PxDeformableAttachmentTargetType::eRIGID and eWORLD attachments.
|
||||
It can be updated after the attachment has been created.
|
||||
|
||||
\see PxDeformableAttachment::updatePose()
|
||||
*/
|
||||
PxTransform pose[2];
|
||||
};
|
||||
|
||||
/**
|
||||
\brief PxDeformableAttachment class representing an attachment for deformable actors.
|
||||
|
||||
An attachment is a collection of one or more positional constraints between a point on one actor and a point on another actor.
|
||||
|
||||
\see PxDeformableAttachmentData, PxPhysics::createDeformableAttachment()
|
||||
*/
|
||||
class PxDeformableAttachment : public PxBase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
\brief Gets the two actors for this attachment.
|
||||
|
||||
\param[out] actor0 The first actor, may be NULL
|
||||
\param[out] actor1 The second actor, may be NULL
|
||||
*/
|
||||
virtual void getActors(PxActor*& actor0, PxActor*& actor1) const = 0;
|
||||
|
||||
/**
|
||||
\brief Updates the pose of the attachment.
|
||||
|
||||
\param[in] pose Pose relative to world or rigid actor transform. Valid only for attachment against world or rigid actor.
|
||||
*/
|
||||
virtual void updatePose(const PxTransform& pose) = 0;
|
||||
|
||||
/**
|
||||
\brief Returns string name of PxDeformableAttachment, used for serialization
|
||||
*/
|
||||
virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxDeformableAttachment"; }
|
||||
|
||||
void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object.
|
||||
|
||||
protected:
|
||||
virtual ~PxDeformableAttachment() {}
|
||||
|
||||
//serialization
|
||||
|
||||
/**
|
||||
\brief Constructor
|
||||
*/
|
||||
PX_INLINE PxDeformableAttachment(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {}
|
||||
|
||||
/**
|
||||
\brief Deserialization constructor
|
||||
*/
|
||||
PX_INLINE PxDeformableAttachment(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 PX_OVERRIDE { PX_IS_KIND_OF(name, "PxDeformableAttachment", PxBase); }
|
||||
};
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
396
engine/third_party/physx/include/PxDeformableBody.h
vendored
Normal file
396
engine/third_party/physx/include/PxDeformableBody.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PX_DEFORMABLE_BODY_H
|
||||
#define PX_DEFORMABLE_BODY_H
|
||||
|
||||
#include "PxActor.h"
|
||||
#include "PxDeformableBodyFlag.h"
|
||||
#include "PxFEMParameter.h" // deprecated
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
#if PX_VC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4435)
|
||||
#endif
|
||||
|
||||
class PxCudaContextManager;
|
||||
|
||||
/**
|
||||
\brief Represents a deformable body, a base class for deformable actors
|
||||
\see PxDeformableSurface, PxDeformableVolume, PxActor
|
||||
*/
|
||||
class PxDeformableBody : public PxActor
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
\brief Raises or clears a particular deformable body flag.
|
||||
|
||||
See the list of flags #PxDeformableBodyFlag
|
||||
|
||||
<b>Default:</b> No flags are set
|
||||
|
||||
\param[in] flag The PxDeformableBodyFlag to raise(set) or clear. See #PxDeformableBodyFlag.
|
||||
\param[in] val The new boolean value for the flag.
|
||||
*/
|
||||
virtual void setDeformableBodyFlag(PxDeformableBodyFlag::Enum flag, bool val) = 0;
|
||||
|
||||
/**
|
||||
\brief Sets deformable body flags.
|
||||
|
||||
See the list of flags #PxDeformableBodyFlag
|
||||
|
||||
<b>Default:</b> No flags are set
|
||||
|
||||
\param[in] flags The PxDeformableBodyFlags to set.
|
||||
*/
|
||||
virtual void setDeformableBodyFlags(PxDeformableBodyFlags flags) = 0;
|
||||
|
||||
/**
|
||||
\brief Reads the deformable body flags.
|
||||
|
||||
See the list of flags #PxDeformableBodyFlag
|
||||
|
||||
\return The values of the deformable body flags.
|
||||
|
||||
\see setDeformableBodyFlag()
|
||||
*/
|
||||
virtual PxDeformableBodyFlags getDeformableBodyFlags() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the linear damping parameter.
|
||||
|
||||
After every timestep the velocity is reduced while the magnitude of the
|
||||
reduction depends on the linearDamping value.
|
||||
\see PxRigidBody.setLinearDamping
|
||||
<b>Default:</b> 0.05
|
||||
\param[in] linearDamping The linear damping parameter
|
||||
*/
|
||||
virtual void setLinearDamping(const PxReal linearDamping) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves linear velocity damping parameter.
|
||||
\see setLinearDamping
|
||||
|
||||
\return The linear damping parameter
|
||||
*/
|
||||
virtual PxReal getLinearDamping() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the maximal velocity vertices can reach
|
||||
|
||||
Allows to limit the vertices' maximal velocity to control the maximal distance a vertex can move per frame
|
||||
<b>Default:</b> 1.0e32
|
||||
\param[in] maxLinearVelocity The maximal linear velocity
|
||||
*/
|
||||
virtual void setMaxLinearVelocity(const PxReal maxLinearVelocity) = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the maximal velocity vertices can reach
|
||||
|
||||
\deprecated Use setMaxLinearVelocity instead.
|
||||
|
||||
Allows to limit the vertices' maximal velocity to control the maximal distance a vertex can move per frame
|
||||
<b>Default:</b> 1.0e32
|
||||
\param[in] maxVelocity The maximal velocity
|
||||
*/
|
||||
PX_DEPRECATED PX_FORCE_INLINE void setMaxVelocity(const PxReal maxVelocity) { setMaxLinearVelocity(maxVelocity); }
|
||||
|
||||
/**
|
||||
\brief Retrieves maximal velocity a vertex can have.
|
||||
|
||||
\return The maximal velocity
|
||||
*/
|
||||
virtual PxReal getMaxLinearVelocity() const = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves maximal velocity a vertex can have.
|
||||
|
||||
\deprecated Use getMaxLinearVelocity instead.
|
||||
|
||||
\return The maximal velocity
|
||||
*/
|
||||
PX_DEPRECATED PX_FORCE_INLINE PxReal getMaxVelocity() const { return getMaxLinearVelocity(); }
|
||||
|
||||
/**
|
||||
\brief Sets the maximal depenetration velocity vertices can reach
|
||||
|
||||
Allows to limit the vertices' maximal depenetration velocity to avoid that collision responses lead to very high particle velocities
|
||||
<b>Default:</b> 1.0e32
|
||||
\param[in] maxDepenetrationVelocity The maximal depenetration velocity
|
||||
*/
|
||||
virtual void setMaxDepenetrationVelocity(const PxReal maxDepenetrationVelocity) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves maximal depenetration velocity a vertex can have.
|
||||
|
||||
\return The maximal depenetration velocity
|
||||
*/
|
||||
virtual PxReal getMaxDepenetrationVelocity() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the self collision filter distance.
|
||||
|
||||
Penetration distance that needs to be exceeded before contacts for self collision are generated.
|
||||
Will only have an effect if self collisions are enabled.
|
||||
<b>Default:</b> 0.1
|
||||
|
||||
\param[in] selfCollisionFilterDistance The self collision filter distance
|
||||
*/
|
||||
virtual void setSelfCollisionFilterDistance(const PxReal selfCollisionFilterDistance) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves the self collision filter distance.
|
||||
|
||||
\return The self collision filter distance
|
||||
\see setSelfCollisionFilterDistance
|
||||
*/
|
||||
virtual PxReal getSelfCollisionFilterDistance() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the solver iteration count for the deformable body.
|
||||
|
||||
Since deformables are currently implemented using an XPBD solver (extended position based dynamics), minVelocityIters is ignored.
|
||||
<b>Default:</b> 4 position iterations, 1 velocity iteration
|
||||
|
||||
\param[in] minPositionIters Number of position iterations the solver should perform for this deformable body. <b>Range:</b> [1,255]
|
||||
\param[in] minVelocityIters Number of velocity iterations, currently ignored. <b>Range:</b> [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 Sets the threshold controlling sleeping of the deformable body.
|
||||
|
||||
Threshold that defines the maximal magnitude of the linear motion a deformable body can move in one second
|
||||
before it becomes a candidate for sleeping.
|
||||
|
||||
\see PxRigidDynamic.setSleepThreshold
|
||||
<b>Default:</b> 0.05
|
||||
|
||||
\param[in] sleepThreshold The sleep threshold
|
||||
*/
|
||||
virtual void setSleepThreshold(const PxReal sleepThreshold) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves the sleep threshold.
|
||||
\see setSleepThreshold
|
||||
|
||||
\return The sleep threshold
|
||||
*/
|
||||
virtual PxReal getSleepThreshold() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the threshold controlling settling phase before sleeping of the deformable body.
|
||||
|
||||
Threshold that defines the maximal magnitude of the linear motion a deformable body can move
|
||||
in one second before it becomes a candidate for sleeping and settling damping is engaged.
|
||||
The settling threshold needs to be higher than the sleep threshold.
|
||||
<b>Default:</b> 0.1
|
||||
\see setSettlingDamping
|
||||
|
||||
\param[in] settlingThreshold The settling threshold
|
||||
*/
|
||||
virtual void setSettlingThreshold(const PxReal settlingThreshold) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves the settling threshold.
|
||||
\see setSettlingThreshold
|
||||
|
||||
\return The settling threshold
|
||||
*/
|
||||
virtual PxReal getSettlingThreshold() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the damping parameter used for settling phase.
|
||||
|
||||
If the maximum linear velocity of the deformable body falls below the settling threshold, the deformable body
|
||||
enters the settling phase in which the settling damping is applied.
|
||||
|
||||
<b>Default:</b> 10.0
|
||||
\param[in] settlingDamping The settling damping
|
||||
\see setLinearDamping, setSettlingThreshold
|
||||
*/
|
||||
virtual void setSettlingDamping(const PxReal settlingDamping) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves settling damping parameter.
|
||||
\see setSettlingDamping
|
||||
|
||||
\return The settling damping parameter
|
||||
*/
|
||||
virtual PxReal getSettlingDamping() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the wake counter for the deformable body.
|
||||
|
||||
The wake counter value determines the minimum amount of time until the deformable body can be put to sleep. Please note
|
||||
that a deformable 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 deformable body up automatically.
|
||||
|
||||
<b>Default:</b> 0.4 (which corresponds to 20 frames for a time step of 0.02)
|
||||
|
||||
\param[in] wakeCounterValue Wake counter value. <b>Range:</b> [0, PX_MAX_F32)
|
||||
|
||||
\see isSleeping() getWakeCounter()
|
||||
*/
|
||||
virtual void setWakeCounter(PxReal wakeCounterValue) = 0;
|
||||
|
||||
/**
|
||||
\brief Returns the wake counter of the deformable body.
|
||||
|
||||
\return The wake counter of the deformable body.
|
||||
|
||||
\see isSleeping() setWakeCounter()
|
||||
*/
|
||||
virtual PxReal getWakeCounter() const = 0;
|
||||
|
||||
/**
|
||||
\brief Returns true if this deformable 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 deformable volume can only go to sleep if all vertices are ready for sleeping. A deformable 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 deformable 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 deformable 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 deformable body has not been added to a scene already.
|
||||
|
||||
\return True if the deformable body is sleeping.
|
||||
|
||||
\see isSleeping()
|
||||
*/
|
||||
virtual bool isSleeping() const = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieve a shape pointer belonging to the actor.
|
||||
|
||||
\see PxShape getNbShapes() PxShape::release()
|
||||
*/
|
||||
|
||||
virtual PxShape* getShape() = 0;
|
||||
|
||||
/**
|
||||
\brief Attaches a shape
|
||||
|
||||
Attaches the shape to use for collision detection for deformable surfaces and volumes.
|
||||
Each deformable needs to have exactly one exclusive shape attached for simulation. If a shape has
|
||||
already been attached to a deformable, detachShape needs to be called prior to attaching
|
||||
a new shape.
|
||||
|
||||
Deformable surfaces need a shape with triangle mesh geometry, which can be created with
|
||||
PxPhysics::createShape(const PxGeometry&, const PxDeformableSurfaceMaterial& material, bool, PxShapeFlags), or
|
||||
PxPhysics::createShape(const PxGeometry&, PxDeformableSurfaceMaterial*const*, PxU16, bool, PxShapeFlags)
|
||||
Deformable surfaces use the same triangle mesh for collision detection and dynamics computations.
|
||||
|
||||
Deformable volumes need a shape with tetrahedron mesh geometry, which can be created with
|
||||
PxPhysics::createShape(const PxGeometry&, const PxDeformableVolumeMaterial& material, bool, PxShapeFlags), or
|
||||
PxPhysics::createShape(const PxGeometry&, PxDeformableVolumeMaterial*const*, PxU16, bool, PxShapeFlags)
|
||||
Deformable volumes additionally need a separate tetrahedron mesh for dynamics, which can be attached using
|
||||
PxDeformbleVolume::attachSimulationMesh.
|
||||
|
||||
\param[in] shape The shape to use for collisions, (and dynamics in case of deformable surfaces)
|
||||
|
||||
\return Returns true if the operation was successful
|
||||
*/
|
||||
virtual bool attachShape(PxShape& shape) = 0;
|
||||
|
||||
/**
|
||||
\brief Detaches the shape
|
||||
|
||||
Detaches the shape used for collision detection.
|
||||
|
||||
\see void PxDeformableVolume.detachSimulationMesh()
|
||||
*/
|
||||
virtual void detachShape() = 0;
|
||||
|
||||
/**
|
||||
\brief Returns the cuda context manager
|
||||
|
||||
\return The cuda context manager
|
||||
*/
|
||||
virtual PxCudaContextManager* getCudaContextManager() const = 0;
|
||||
|
||||
/**
|
||||
\brief Deprecated: Sets parameters for FEM internal solve
|
||||
\param[in] params parameters
|
||||
\see getParameter()
|
||||
*/
|
||||
PX_DEPRECATED virtual void setParameter(const PxFEMParameters& params) = 0;
|
||||
|
||||
/**
|
||||
\brief Deprecated: Gets parameters for FEM internal solve
|
||||
\return parameters
|
||||
\see setParameter()
|
||||
*/
|
||||
PX_DEPRECATED virtual PxFEMParameters getParameter() const = 0;
|
||||
|
||||
protected:
|
||||
PX_INLINE PxDeformableBody(PxType concreteType, PxBaseFlags baseFlags) : PxActor(concreteType, baseFlags) {}
|
||||
PX_INLINE PxDeformableBody(PxBaseFlags baseFlags) : PxActor(baseFlags) {}
|
||||
virtual ~PxDeformableBody() {}
|
||||
virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxDeformableBody", PxActor); }
|
||||
};
|
||||
|
||||
|
||||
#if PX_VC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif // PX_DEFORMABLE_BODY_H
|
||||
59
engine/third_party/physx/include/PxDeformableBodyFlag.h
vendored
Normal file
59
engine/third_party/physx/include/PxDeformableBodyFlag.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PX_DEFORMABLE_BODY_FLAGS_H
|
||||
#define PX_DEFORMABLE_BODY_FLAGS_H
|
||||
|
||||
#include "PxPhysXConfig.h"
|
||||
#include "foundation/PxFlags.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
\brief Flags to enable or disable special modes of a PxDeformableBody instance
|
||||
*/
|
||||
struct PxDeformableBodyFlag
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eDISABLE_SELF_COLLISION = 1 << 0, //!< Determines if self collision will be detected and resolved
|
||||
eENABLE_SPECULATIVE_CCD = 1 << 1, //!< Enables support for speculative contact generation, see #PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD
|
||||
eKINEMATIC = 1 << 2 //!< Enables support for kinematic motion of the simulation mesh, see #PxRigidBodyFlag::eKINEMATIC
|
||||
};
|
||||
};
|
||||
|
||||
typedef PxFlags<PxDeformableBodyFlag::Enum, PxU8> PxDeformableBodyFlags;
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // PX_DEFORMABLE_BODY_FLAGS_H
|
||||
169
engine/third_party/physx/include/PxDeformableElementFilter.h
vendored
Normal file
169
engine/third_party/physx/include/PxDeformableElementFilter.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PX_DEFORMABLE_ELEMENT_FILTER_H
|
||||
#define PX_DEFORMABLE_ELEMENT_FILTER_H
|
||||
|
||||
#include "common/PxCoreUtilityTypes.h"
|
||||
#include "common/PxBase.h"
|
||||
|
||||
/** \addtogroup physics
|
||||
@{
|
||||
*/
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
\brief Element filter data for a pair of actors where one of the actors must be a deformable.
|
||||
|
||||
An element filter defines mesh element wise collision filtering between two deformable actors, or one deformable actor and
|
||||
a rigid actor.
|
||||
|
||||
The element types used for collision filtering are implicitely given by the deformable actor type:
|
||||
|
||||
PxDeformableSurface: PxTriangleMesh triangle indices.
|
||||
PxDeformableVolume: PxTetrahedronMesh tetrahedron indices (collision mesh)
|
||||
|
||||
If the actor is rigid, then filtering always relates to the actor as a whole.
|
||||
|
||||
In order to effectively specify which elements shouldn't collide against which other elements, the following representation is used.
|
||||
A pair of element groups specifies that none of the elements in the first group collides against any elements of the second group. One group relates
|
||||
to one actor, and the other group relates to the other actor. The whole collision filter consists of a set of element group pairs.
|
||||
|
||||
In the following we use "A" to denote one of the two actors, so either actor with index 0 or index 1 in the actor array, and "B" for the other actor.
|
||||
|
||||
The element groups are specified for each actor separately:
|
||||
The groups for actor A are specified by groupElemCounts[A] and groupElemIndices[A]
|
||||
|
||||
The size of groupElemCounts[A] and groupElemCounts[B] specifies the number of group pairs. They need to have the same number of entries (there is an exception, see further below).
|
||||
Each entry in the groupElemCounts[A] specifies the size of each group of elements in the mesh of actor A.
|
||||
|
||||
The entries in groupElemIndices[A] represent all elements referenced by the groupElemCounts[A], in the order of the groups specified in groupElemCounts[A].
|
||||
|
||||
Below are some examples to clarify the concept.
|
||||
|
||||
Example 1: Two groups for each actor.
|
||||
groupElemCounts[0] = [2, 1], groupElemIndices[0] = [3, 4, 6]
|
||||
groupElemCounts[1] = [2, 3], groupElemIndices[1] = [9, 7, 2, 5, 6]
|
||||
For the first group, the count is 2 for both actors. So element 3 and 4 of actor[0] is filtered against element 9 and 7 of actor[1].
|
||||
For the second group, the element count is 1 for actor[0] and 3 for actor[1]. So element 6 of actor[0] is filtered against element 2, 5 and 6 of actor[1].
|
||||
|
||||
Example 2: Pairwise filtering.
|
||||
groupElemCounts[0] = [1, 1], groupElemIndices[0] = [3, 4]
|
||||
groupElemCounts[1] = [1, 1], groupElemIndices[1] = [9, 7]
|
||||
For the first group, element 3 of actor[0] is filtered against element 9 of actor[1]
|
||||
For the second group, element 4 of actor[0] is filtered against element 7 of actor[1]
|
||||
|
||||
There are two special cases that are supported by the element filter.
|
||||
- groupElemCounts[A] entries that are 0, indicate that elements of the corresponding group of actor B are filtered against all elements of actor A.
|
||||
- empty groupElemCounts[A], indicates that all groups of actor B are filtered against all elements of actor A. This is always the case if actor A is a rigid.
|
||||
|
||||
\see PxDeformableElementFilter, PxPhysics::createDeformableElementFilter()
|
||||
*/
|
||||
struct PxDeformableElementFilterData
|
||||
{
|
||||
PxDeformableElementFilterData()
|
||||
{
|
||||
for (PxU32 i = 0; i < 2; i++)
|
||||
{
|
||||
actor[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Actor 0 and Actor 1. NULL actors are not allowed.
|
||||
*/
|
||||
PxActor* actor[2];
|
||||
|
||||
/**
|
||||
\brief Element counts for all filter groups, per actor.
|
||||
*/
|
||||
PxTypedBoundedData<const PxU32> groupElementCounts[2];
|
||||
|
||||
/**
|
||||
\brief Element indices for all filter groups, per actor.
|
||||
*/
|
||||
PxTypedBoundedData<const PxU32> groupElementIndices[2];
|
||||
};
|
||||
|
||||
/**
|
||||
\brief PxDeformableElementFilter class representing an element level collision filter for deformable actors.
|
||||
|
||||
Element filters define how parts of deformable actors are excluded from collisions.
|
||||
They are usually added to avoid conflicting attachment and contact constraints.
|
||||
|
||||
\see PxDeformableElementFilterData, PxPhysics::createDeformableElementFilter()
|
||||
*/
|
||||
class PxDeformableElementFilter : public PxBase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
\brief Gets the actors for this element filter.
|
||||
|
||||
\param[out] actor0 The first actor.
|
||||
\param[out] actor1 The second actor.
|
||||
*/
|
||||
virtual void getActors(PxActor*& actor0, PxActor*& actor1) const = 0;
|
||||
|
||||
/**
|
||||
\brief Returns string name of PxDeformableElementFilter, used for serialization
|
||||
*/
|
||||
virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxDeformableElementFilter"; }
|
||||
|
||||
void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object.
|
||||
|
||||
protected:
|
||||
virtual ~PxDeformableElementFilter() {}
|
||||
|
||||
//serialization
|
||||
|
||||
/**
|
||||
\brief Constructor
|
||||
*/
|
||||
PX_INLINE PxDeformableElementFilter(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {}
|
||||
|
||||
/**
|
||||
\brief Deserialization constructor
|
||||
*/
|
||||
PX_INLINE PxDeformableElementFilter(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 PX_OVERRIDE { PX_IS_KIND_OF(name, "PxDeformableElementFilter", PxBase); }
|
||||
};
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
133
engine/third_party/physx/include/PxDeformableMaterial.h
vendored
Normal file
133
engine/third_party/physx/include/PxDeformableMaterial.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PX_DEFORMABLE_MATERIAL_H
|
||||
#define PX_DEFORMABLE_MATERIAL_H
|
||||
|
||||
#include "PxPhysXConfig.h"
|
||||
#include "PxBaseMaterial.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
class PxScene;
|
||||
|
||||
/**
|
||||
\brief Material class to represent a set of deformable material properties.
|
||||
|
||||
\see PxPhysics.createDeformableVolumeMaterial
|
||||
*/
|
||||
class PxDeformableMaterial : public PxBaseMaterial
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
\brief Sets young's modulus which defines the body's stiffness
|
||||
|
||||
<b>Default:</b> 1.e6
|
||||
\param[in] young Young's modulus. <b>Range:</b> [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.
|
||||
|
||||
<b>Default:</b> 0.45
|
||||
\param[in] poisson Poisson's ratio. <b>Range:</b> [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.
|
||||
|
||||
<b>Default:</b> 0.0
|
||||
\param[in] dynamicFriction The dynamic friction value. <b>Range:</b> [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;
|
||||
|
||||
/**
|
||||
\brief Sets material damping
|
||||
|
||||
\param[in] elasticityDamping Material damping.
|
||||
|
||||
\see getDamping()
|
||||
*/
|
||||
virtual void setElasticityDamping(PxReal elasticityDamping) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves the material damping.
|
||||
\return damping.
|
||||
|
||||
\see setDamping()
|
||||
*/
|
||||
virtual PxReal getElasticityDamping() const = 0;
|
||||
|
||||
protected:
|
||||
PX_INLINE PxDeformableMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxBaseMaterial(concreteType, baseFlags) {}
|
||||
PX_INLINE PxDeformableMaterial(PxBaseFlags baseFlags) : PxBaseMaterial(baseFlags) {}
|
||||
virtual ~PxDeformableMaterial() {}
|
||||
virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxDeformableMaterial", PxBaseMaterial); }
|
||||
};
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif // PX_DEFORMABLE_MATERIAL_H
|
||||
224
engine/third_party/physx/include/PxDeformableSkinning.h
vendored
Normal file
224
engine/third_party/physx/include/PxDeformableSkinning.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
|
||||
#ifndef PX_DEFORMABLE_SKINNING_H
|
||||
#define PX_DEFORMABLE_SKINNING_H
|
||||
|
||||
#include "foundation/PxPreprocessor.h"
|
||||
#include "foundation/PxVec2.h"
|
||||
#include "foundation/PxVec3.h"
|
||||
#include "foundation/PxFlags.h"
|
||||
#include "PxNodeIndex.h"
|
||||
#include "cudamanager/PxCudaContextManager.h"
|
||||
#include "common/PxCoreUtilityTypes.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
\brief Structure for triangle mesh skinning embedding information.
|
||||
*/
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct PxTriangleMeshEmbeddingInfo
|
||||
{
|
||||
/**
|
||||
\brief UV coordinates for skinning.
|
||||
*/
|
||||
PxVec2 uv;
|
||||
|
||||
/**
|
||||
\brief Offset along the interpolated normal.
|
||||
*/
|
||||
PxReal offsetAlongInterpolatedNormal;
|
||||
|
||||
/**
|
||||
\brief ID of the guide triangle.
|
||||
*/
|
||||
PxU32 guideTriangleId;
|
||||
|
||||
/**
|
||||
\brief Constructor for PxTriangleMeshEmbeddingInfo.
|
||||
\param uv_ UV coordinates.
|
||||
\param offsetAlongInterpolatedNormal_ Offset along the interpolated normal.
|
||||
\param guideTriangleId_ ID of the guide triangle.
|
||||
*/
|
||||
PxTriangleMeshEmbeddingInfo(
|
||||
const PxVec2& uv_,
|
||||
PxReal offsetAlongInterpolatedNormal_, PxU32 guideTriangleId_) :
|
||||
uv(uv_), offsetAlongInterpolatedNormal(offsetAlongInterpolatedNormal_), guideTriangleId(guideTriangleId_)
|
||||
{}
|
||||
} PX_ALIGN_SUFFIX(16);
|
||||
|
||||
/**
|
||||
\brief Structure for tetrahedron mesh skinning embedding information.
|
||||
*/
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct PxTetrahedronMeshEmbeddingInfo
|
||||
{
|
||||
/**
|
||||
\brief UVW coordinates for skinning.
|
||||
*/
|
||||
PxVec3 uvw;
|
||||
|
||||
/**
|
||||
\brief ID of the guide tetrahedron.
|
||||
*/
|
||||
PxU32 guideTetrahedronId;
|
||||
|
||||
/**
|
||||
\brief Constructor for PxTetrahedronMeshEmbeddingInfo.
|
||||
\param uvw_ UVW coordinates.
|
||||
\param guideTetrahedronId_ ID of the guide tetrahedron.
|
||||
*/
|
||||
PxTetrahedronMeshEmbeddingInfo(const PxVec3& uvw_, PxU32 guideTetrahedronId_) :
|
||||
uvw(uvw_), guideTetrahedronId(guideTetrahedronId_)
|
||||
{}
|
||||
} PX_ALIGN_SUFFIX(16);
|
||||
|
||||
#if PX_SUPPORT_GPU_PHYSX
|
||||
/**
|
||||
\brief Structure for GPU data related to tetmesh skinning.
|
||||
*/
|
||||
struct PxTetmeshSkinningGpuData
|
||||
{
|
||||
/**
|
||||
\brief Pointer to guide vertices data on the GPU.
|
||||
*/
|
||||
PxTypedBoundedData<PxVec3> guideVerticesD;
|
||||
|
||||
/**
|
||||
\brief Pointer to guide tetrahedra data on the GPU.
|
||||
*/
|
||||
PxU32* guideTetrahedraD;
|
||||
|
||||
/**
|
||||
\brief Pointer to skinning information per vertex on the GPU.
|
||||
*/
|
||||
PxTetrahedronMeshEmbeddingInfo* skinningInfoPerVertexD;
|
||||
|
||||
/**
|
||||
\brief Pointer to embedded vertices data on the GPU.
|
||||
*/
|
||||
PxTypedBoundedData<PxVec3> skinnedVerticesD;
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Structure for GPU data related to trimesh skinning.
|
||||
*/
|
||||
struct PxTrimeshSkinningGpuData
|
||||
{
|
||||
/**
|
||||
\brief Pointer to guide vertices data on the GPU.
|
||||
*/
|
||||
PxTypedBoundedData<PxVec3> guideVerticesD;
|
||||
|
||||
/**
|
||||
\brief Pointer to guide normals data on the GPU.
|
||||
*/
|
||||
PxTypedBoundedData<PxVec3> guideNormalsD;
|
||||
|
||||
/**
|
||||
\brief Pointer to guide triangles data on the GPU.
|
||||
*/
|
||||
PxU32* guideTrianglesD;
|
||||
|
||||
/**
|
||||
\brief Pointer to skinning information per vertex on the GPU.
|
||||
*/
|
||||
PxTriangleMeshEmbeddingInfo* skinningInfoPerVertexD;
|
||||
|
||||
/**
|
||||
\brief Pointer to skinned vertices data on the GPU.
|
||||
*/
|
||||
PxTypedBoundedData<PxVec3> skinnedVerticesD;
|
||||
|
||||
/**
|
||||
\brief Half of the deformable surface thickness.
|
||||
*/
|
||||
PxReal halfSurfaceThickness;
|
||||
|
||||
/**
|
||||
\brief Number of guide triangles.
|
||||
*/
|
||||
PxU32 nbGuideTriangles;
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Abstract base class for deformable skinning operations.
|
||||
*/
|
||||
class PxDeformableSkinning
|
||||
{
|
||||
public:
|
||||
/**
|
||||
\brief Computes normal vectors for cloth skinning data.
|
||||
\param skinningDataArrayD Array of cloth skinning data structures.
|
||||
\param arrayLength The number of elements in the skinning data array.
|
||||
\param stream CUDA stream to be used for computation.
|
||||
\param nbGpuThreads Number of GPU threads to use per cloth (default is 8192).
|
||||
*/
|
||||
virtual void computeNormalVectors(
|
||||
PxTrimeshSkinningGpuData* skinningDataArrayD, PxU32 arrayLength,
|
||||
CUstream stream, PxU32 nbGpuThreads = 8192) = 0;
|
||||
|
||||
/**
|
||||
\brief Evaluates interpolated deformable surface vertices.
|
||||
\param skinningDataArrayD Array of deformable surface skinning data structures.
|
||||
\param arrayLength The number of elements in the skinning data array.
|
||||
\param stream CUDA stream to be used for computation.
|
||||
\param nbGpuThreads Number of GPU threads to use per deformable surface (default is 8192).
|
||||
*/
|
||||
virtual void evaluateVerticesEmbeddedIntoSurface(
|
||||
PxTrimeshSkinningGpuData* skinningDataArrayD, PxU32 arrayLength,
|
||||
CUstream stream, PxU32 nbGpuThreads = 8192) = 0;
|
||||
|
||||
/**
|
||||
\brief Evaluates interpolated deformable volume vertices.
|
||||
\param skinningDataArrayD Array of deformable volume skinning data structures.
|
||||
\param arrayLength Length of the skinning data array.
|
||||
\param stream CUDA stream to be used for computation.
|
||||
\param nbGpuThreads Number of GPU threads to use per deformable volume (default is 8192).
|
||||
*/
|
||||
virtual void evaluateVerticesEmbeddedIntoVolume(
|
||||
PxTetmeshSkinningGpuData* skinningDataArrayD, PxU32 arrayLength,
|
||||
CUstream stream, PxU32 nbGpuThreads = 8192) = 0;
|
||||
|
||||
/**
|
||||
\brief Virtual destructor for PxDeformableSkinning.
|
||||
*/
|
||||
virtual ~PxDeformableSkinning() { }
|
||||
};
|
||||
#endif
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
287
engine/third_party/physx/include/PxDeformableSurface.h
vendored
Normal file
287
engine/third_party/physx/include/PxDeformableSurface.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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_DEFORMABLE_SURFACE_H
|
||||
#define PX_PHYSICS_DEFORMABLE_SURFACE_H
|
||||
|
||||
#include "PxDeformableBody.h"
|
||||
#include "PxDeformableSurfaceFlag.h"
|
||||
#include "foundation/PxArray.h"
|
||||
#include "PxConeLimitedConstraint.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
#if PX_VC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4435)
|
||||
#endif
|
||||
|
||||
|
||||
class PxCudaContextManager;
|
||||
|
||||
/**
|
||||
\brief The maximum number of triangles supported in a surface deformable mesh
|
||||
|
||||
The current limit is 1'048'575.
|
||||
*/
|
||||
#define PX_MAX_NB_DEFORMABLE_SURFACE_TRI 0x000fffff
|
||||
|
||||
/**
|
||||
\brief The maximum number of vertices supported in a surface deformable mesh
|
||||
|
||||
The current limit is 1'048'575.
|
||||
*/
|
||||
#define PX_MAX_NB_DEFORMABLE_SURFACE_VTX 0x000fffff
|
||||
|
||||
/**
|
||||
\brief The maximum number of deformable surfaces supported in a scene
|
||||
|
||||
The current limit is 4095.
|
||||
*/
|
||||
#define PX_MAX_NB_DEFORMABLE_SURFACE 0xfff
|
||||
|
||||
/**
|
||||
\brief Represents a deformable surface
|
||||
|
||||
The deformable surface feature is exclusively supported on GPU. The full GPU pipeline needs to
|
||||
be enabled in order to make use of deformable bodies, see #PxSceneFlag::eENABLE_GPU_DYNAMICS,
|
||||
#PxBroadPhaseType::eGPU.
|
||||
*/
|
||||
class PxDeformableSurface : public PxDeformableBody
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
\brief Raises or clears a particular deformable surface flag.
|
||||
|
||||
See the list of flags #PxDeformableSurfaceFlag
|
||||
|
||||
<b>Default:</b> No flags are set
|
||||
|
||||
\param[in] flag The PxDeformableSurfaceFlag to raise(set) or clear. See #PxDeformableSurfaceFlag.
|
||||
\param[in] val The new boolean value for the flag.
|
||||
*/
|
||||
virtual void setDeformableSurfaceFlag(PxDeformableSurfaceFlag::Enum flag, bool val) = 0;
|
||||
|
||||
/**
|
||||
\brief Sets deformable surface flags.
|
||||
|
||||
See the list of flags #PxDeformableSurfaceFlag
|
||||
|
||||
<b>Default:</b> No flags are set
|
||||
|
||||
\param[in] flags The PxDeformableSurfaceFlags to set.
|
||||
*/
|
||||
virtual void setDeformableSurfaceFlags(PxDeformableSurfaceFlags flags) = 0;
|
||||
|
||||
/**
|
||||
\brief Reads the deformable surface flags.
|
||||
|
||||
See the list of flags #PxDeformableSurfaceFlag
|
||||
|
||||
\return The values of the deformable surface flags.
|
||||
|
||||
\see setDeformableSurfaceFlag()
|
||||
*/
|
||||
virtual PxDeformableSurfaceFlags getDeformableSurfaceFlags() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the number of collision pair updates per timestep.
|
||||
|
||||
Collision pair is updated at least once per timestep and increasing the frequency provides better collision pairs.
|
||||
<b>Default:</b> 1
|
||||
|
||||
\param[in] frequency It sets the number of collision pair updates per timestep.
|
||||
|
||||
\see getNbCollisionPairUpdatesPerTimestep()
|
||||
*/
|
||||
virtual void setNbCollisionPairUpdatesPerTimestep(const PxU32 frequency) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves number of collision pair updates per timestep.
|
||||
|
||||
\return The number of collision pair updates per timestep.
|
||||
\see setNbCollisionPairUpdatesPerTimestep()
|
||||
*/
|
||||
virtual PxU32 getNbCollisionPairUpdatesPerTimestep() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the number of collision substeps in each sub-timestep.
|
||||
|
||||
Collision constraints can be applied multiple times in each sub-timestep
|
||||
<b>Default:</b> 1
|
||||
|
||||
\param[in] frequency It sets the number of collision substeps in each sub-timestep.
|
||||
|
||||
\see getNbCollisionSubsteps()
|
||||
*/
|
||||
virtual void setNbCollisionSubsteps(const PxU32 frequency) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves the number of collision substeps in each sub-timestep.
|
||||
|
||||
\return The number of collision substeps in each sub-timestep.
|
||||
|
||||
\see setNbCollisionSubsteps()
|
||||
*/
|
||||
virtual PxU32 getNbCollisionSubsteps() const = 0;
|
||||
|
||||
/**
|
||||
\brief Gets a pointer to a device buffer containing positions and inverse masses of the
|
||||
surface deformable.
|
||||
|
||||
This function returns a pointer to device memory for the positions and inverse masses of
|
||||
the surface deformable. The device memory buffer is used to both initialize/update the vertices of the surface deformable and
|
||||
read the simulation results.
|
||||
|
||||
\note It is mandatory to call PxDeformableSurface::markDirty() with PxDeformableSurfaceDataFlag::ePOSITION_INVMASS when
|
||||
updating data in this buffer.
|
||||
|
||||
The simulation expects 4 consecutive floats for each vertex, aligned to a 16B boundary.
|
||||
The first 3 floats specify the positions and the last float specifies the inverse mass of the vertex.
|
||||
The size of the buffer is the number of vertices of the surface deformable mesh * sizeof(PxVec4).
|
||||
\see PxTriangleMesh::getNbVertices().
|
||||
|
||||
The device memory pointed to by this pointer is allocated when a shape is attached to the
|
||||
deformable surface. Calling PxDeformableSurface::detachShape() will deallocate the memory.
|
||||
|
||||
It is not allowed to write to this buffer from the start of the PxScene::simulate() call
|
||||
until PxScene::fetchResults() returns. Reading the data is allowed once all the PhysX tasks
|
||||
have finished, reading the data during a completion task is explicitly allowed. The
|
||||
simulation will read and write directly from/into this buffer.
|
||||
|
||||
It is the users' responsibility to initialize this buffer with the initial positions of
|
||||
the vertices of the surface deformable mesh.
|
||||
|
||||
\return PxVec4* A pointer to a device buffer containing positions and inverse masses of
|
||||
the surface deformable mesh.
|
||||
*/
|
||||
virtual PxVec4* getPositionInvMassBufferD() = 0;
|
||||
|
||||
/**
|
||||
\brief Gets a pointer to a device buffer containing velocities of the deformable surface.
|
||||
|
||||
This function returns a pointer to device memory for the velocities of the deformable surface. This buffer
|
||||
is used to both initialize/update the vertices of the surface deformable and read the simulation results.
|
||||
|
||||
\note It is mandatory to call PxDeformableSurface::markDirty() with PxDeformableSurfaceDataFlag::eVELOCITY when
|
||||
updating data in this buffer.
|
||||
|
||||
|
||||
The simulation expects 4 consecutive floats for each vertex, aligned to a 16B boundary. The
|
||||
first 3 floats specify the velocity of the vertex. The final float is unused. The size of
|
||||
the buffer is the number of vertices of the surface deformable mesh * sizeof(PxVec4).
|
||||
\see PxTriangleMesh::getNbVertices().
|
||||
|
||||
The device memory pointed to by this pointer is allocated when a shape is attached to the
|
||||
deformable surface. Calling PxDeformableSurface::detachShape() will deallocate the memory.
|
||||
|
||||
It is not allowed to write to this buffer from the start of the PxScene::simulate() call
|
||||
until PxScene::fetchResults() returns. Reading the data is allowed once all the PhysX tasks
|
||||
have finished, reading the data during a completion task is explicitly allowed. The
|
||||
simulation will read and write directly from/into this buffer.
|
||||
|
||||
It is the users' responsibility to initialize this buffer with the initial velocities of
|
||||
the vertices of the surface deformable mesh.
|
||||
|
||||
\return PxVec4* A pointer to a device buffer containing the velocities of the surface deformable mesh.
|
||||
*/
|
||||
virtual PxVec4* getVelocityBufferD() = 0;
|
||||
|
||||
/**
|
||||
\brief Gets a pointer to a device buffer containing the rest positions of the deformable surface.
|
||||
|
||||
This function returns a pointer to device memory for the rest positions of the deformable surface.
|
||||
This buffer is used to initialize/update the rest positions of the vertices of the deformable surface.
|
||||
|
||||
\note It is mandatory to call PxDeformableSurface::markDirty() with PxDeformableSurfaceDataFlag::eREST_POSITION when
|
||||
updating data in this buffer.
|
||||
|
||||
The simulation expects 4 consecutive floats for each vertex, aligned to a 16B boundary.
|
||||
The first 3 specify the rest position. The last float is unused. The size of the buffer
|
||||
is the number of vertices of the surface deformable mesh * sizeof(PxVec4). \see PxTriangleMesh::getNbVertices().
|
||||
|
||||
The device memory pointed to by this pointer is allocated when a shape is attached to the
|
||||
deformable surface. Calling PxDeformableSurface::detachShape() will deallocate the memory.
|
||||
|
||||
It is not allowed to write to this buffer from the start of the PxScene::simulate() call
|
||||
until PxScene::fetchResults() returns. Reading the data is allowed once all the PhysX tasks
|
||||
have finished, reading the data during a completion task is explicitly allowed. The
|
||||
simulation will read directly from this buffer.
|
||||
|
||||
It is the users' responsibility to initialize this buffer with the initial rest positions of
|
||||
the vertices of the surface deformable mesh.
|
||||
|
||||
\return PxVec4* A pointer to a device buffer containing the rest positions of the surface deformable mesh.
|
||||
*/
|
||||
virtual PxVec4* getRestPositionBufferD() = 0;
|
||||
|
||||
/**
|
||||
\brief Marks per-vertex simulation state and configuration buffers dirty to signal to the simulation
|
||||
that changes have been made.
|
||||
|
||||
Calling this function is required to notify the simulation of changes made in the positionInvMass,
|
||||
velocity and rest position buffers.
|
||||
|
||||
This function can be called multiple times, and dirty flags are accumulated internally until
|
||||
PxScene::simulate() is called.
|
||||
|
||||
\see getPositionInvMassBufferD, getVelocityBufferD, getRestPositionBufferD
|
||||
|
||||
\param flags The buffers that have been updated.
|
||||
*/
|
||||
virtual void markDirty(PxDeformableSurfaceDataFlags flags) = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the concrete type name.
|
||||
\return The name of the concrete type.
|
||||
*/
|
||||
virtual const char* getConcreteTypeName() const PX_OVERRIDE PX_FINAL { return "PxDeformableSurface"; }
|
||||
|
||||
protected:
|
||||
PX_INLINE PxDeformableSurface(PxType concreteType, PxBaseFlags baseFlags) : PxDeformableBody(concreteType, baseFlags) {}
|
||||
PX_INLINE PxDeformableSurface(PxBaseFlags baseFlags) : PxDeformableBody(baseFlags) {}
|
||||
virtual ~PxDeformableSurface() {}
|
||||
virtual bool isKindOf(const char* name) const PX_OVERRIDE { PX_IS_KIND_OF(name, "PxDeformableSurface", PxDeformableBody); }
|
||||
};
|
||||
|
||||
#if PX_VC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif // PX_PHYSICS_DEFORMABLE_SURFACE_H
|
||||
|
||||
73
engine/third_party/physx/include/PxDeformableSurfaceFlag.h
vendored
Normal file
73
engine/third_party/physx/include/PxDeformableSurfaceFlag.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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_DEFORMABLE_SURFACE_FLAGS_H
|
||||
#define PX_PHYSICS_DEFORMABLE_SURFACE_FLAGS_H
|
||||
|
||||
#include "foundation/PxFlags.h"
|
||||
#include "foundation/PxSimpleTypes.h"
|
||||
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
struct PxDeformableSurfaceFlag
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eUSE_ANISOTROPIC_MODEL = 1 << 0, // 0: use isotropic model, 1: use anistropic model
|
||||
eENABLE_FLATTENING = 1 << 1 // 0: query rest bending angle from rest shape, 1: use zero rest bending angle
|
||||
};
|
||||
};
|
||||
|
||||
typedef PxFlags<PxDeformableSurfaceFlag::Enum, PxU16> PxDeformableSurfaceFlags;
|
||||
|
||||
/**
|
||||
\brief Identifies input and output buffers for PxDeformableSurface.
|
||||
*/
|
||||
struct PxDeformableSurfaceDataFlag
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eNONE = 0,
|
||||
ePOSITION_INVMASS = 1 << 0,
|
||||
eVELOCITY = 1 << 1,
|
||||
eREST_POSITION = 1 << 2,
|
||||
eALL = ePOSITION_INVMASS | eVELOCITY | eREST_POSITION
|
||||
};
|
||||
};
|
||||
|
||||
typedef PxFlags<PxDeformableSurfaceDataFlag::Enum, PxU32> PxDeformableSurfaceDataFlags;
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif // PX_PHYSICS_DEFORMABLE_SURFACE_FLAGS_H
|
||||
119
engine/third_party/physx/include/PxDeformableSurfaceMaterial.h
vendored
Normal file
119
engine/third_party/physx/include/PxDeformableSurfaceMaterial.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PX_DEFORMABLE_SURFACE_MATERIAL_H
|
||||
#define PX_DEFORMABLE_SURFACE_MATERIAL_H
|
||||
|
||||
#include "PxDeformableMaterial.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
\brief Material class to represent surface deformable material properties.
|
||||
|
||||
\see PxPhysics.createDeformableSurfaceMaterial
|
||||
*/
|
||||
class PxDeformableSurfaceMaterial : public PxDeformableMaterial
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
\brief Sets material thickness
|
||||
|
||||
<b>Default:</b> 0.001
|
||||
\param[in] thickness Material thickness.
|
||||
|
||||
\see getThickness()
|
||||
*/
|
||||
virtual void setThickness(PxReal thickness) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves the material thickness.
|
||||
|
||||
<b>Default:</b> 0.001
|
||||
\return thickness.
|
||||
\see setThickness()
|
||||
*/
|
||||
virtual PxReal getThickness() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets material bending stiffness
|
||||
|
||||
<b>Default:</b> 0.0
|
||||
\param[in] bendingStiffness Material bending stiffness.
|
||||
\see getBendingStiffness()
|
||||
*/
|
||||
virtual void setBendingStiffness(PxReal bendingStiffness) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves the material bending stiffness.
|
||||
|
||||
\return bendingStiffness.
|
||||
\see setBendingStiffness()
|
||||
*/
|
||||
virtual PxReal getBendingStiffness() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets material bending damping
|
||||
|
||||
\param[in] bendingDamping Material bending damping.
|
||||
|
||||
\see getBendingDamping()
|
||||
*/
|
||||
virtual void setBendingDamping(PxReal bendingDamping) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves the material bending damping.
|
||||
\return bending damping.
|
||||
|
||||
\see setBendingDamping()
|
||||
*/
|
||||
virtual PxReal getBendingDamping() const = 0;
|
||||
|
||||
|
||||
/**
|
||||
\brief Gets the concrete type name.
|
||||
\return The name of the concrete type.
|
||||
*/
|
||||
virtual const char* getConcreteTypeName() const PX_OVERRIDE PX_FINAL { return "PxDeformableSurfaceMaterial"; }
|
||||
|
||||
protected:
|
||||
PX_INLINE PxDeformableSurfaceMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxDeformableMaterial(concreteType, baseFlags) {}
|
||||
PX_INLINE PxDeformableSurfaceMaterial(PxBaseFlags baseFlags) : PxDeformableMaterial(baseFlags) {}
|
||||
virtual ~PxDeformableSurfaceMaterial() {}
|
||||
virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxDeformableSurfaceMaterial", PxDeformableMaterial); }
|
||||
};
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif // PX_DEFORMABLE_SURFACE_MATERIAL_H
|
||||
702
engine/third_party/physx/include/PxDeformableVolume.h
vendored
Normal file
702
engine/third_party/physx/include/PxDeformableVolume.h
vendored
Normal file
@@ -0,0 +1,702 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PX_DEFORMABLE_VOLUME_H
|
||||
#define PX_DEFORMABLE_VOLUME_H
|
||||
|
||||
#include "PxDeformableBody.h"
|
||||
#include "PxDeformableVolumeFlag.h"
|
||||
#include "PxConeLimitedConstraint.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
#if PX_VC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4435)
|
||||
#endif
|
||||
|
||||
class PxCudaContextManager;
|
||||
class PxTetrahedronMesh;
|
||||
class PxDeformableVolumeAuxData;
|
||||
class PxDeformableSurface;
|
||||
class PxParticleBuffer;
|
||||
|
||||
/**
|
||||
\brief The maximum number of tetrahedrons supported in a deformable volume tetrahedron mesh
|
||||
|
||||
The current limit is 1'048'575.
|
||||
*/
|
||||
#define PX_MAX_NB_DEFORMABLE_VOLUME_TET 0x000fffff
|
||||
|
||||
/**
|
||||
\brief The maximum number of deformable volumes supported in a scene
|
||||
|
||||
The current limit is 4095.
|
||||
*/
|
||||
#define PX_MAX_NB_DEFORMABLE_VOLUME 0xfff
|
||||
|
||||
/**
|
||||
\brief Represents a deformable volume
|
||||
|
||||
The deformable volume feature is exclusively supported on GPU. The full GPU pipeline needs to
|
||||
be enabled in order to make use of deformable bodies, see #PxSceneFlag::eENABLE_GPU_DYNAMICS,
|
||||
#PxBroadPhaseType::eGPU.
|
||||
*/
|
||||
class PxDeformableVolume : public PxDeformableBody
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
\brief Raises or clears a particular deformable volume flag.
|
||||
|
||||
See the list of flags #PxDeformableVolumeFlag
|
||||
|
||||
<b>Default:</b> No flags are set
|
||||
|
||||
\param[in] flag The PxDeformableVolumeFlag to raise(set) or clear. See #PxDeformableVolumeFlag.
|
||||
\param[in] val The new boolean value for the flag.
|
||||
*/
|
||||
virtual void setDeformableVolumeFlag(PxDeformableVolumeFlag::Enum flag, bool val) = 0;
|
||||
|
||||
/**
|
||||
\brief Sets deformable volume flags.
|
||||
|
||||
See the list of flags #PxDeformableVolumeFlag
|
||||
|
||||
<b>Default:</b> No flags are set
|
||||
|
||||
\param[in] flags The PxDeformableVolumeFlags to set.
|
||||
*/
|
||||
virtual void setDeformableVolumeFlags(PxDeformableVolumeFlags flags) = 0;
|
||||
|
||||
/**
|
||||
\brief Reads the deformable volume flags.
|
||||
|
||||
See the list of flags #PxDeformableVolumeFlag
|
||||
|
||||
\return The values of the deformable volume flags.
|
||||
|
||||
\see setDeformableVolumeFlag()
|
||||
*/
|
||||
virtual PxDeformableVolumeFlags getDeformableVolumeFlags() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the self collision stress tolerance.
|
||||
|
||||
Stress threshold to deactivate collision contacts in case the local stress magnitude exceeds the threshold.
|
||||
<b>Default:</b> 0.9
|
||||
|
||||
\param[in] selfCollisionStressTolerance The maximal depenetration velocity
|
||||
*/
|
||||
virtual void setSelfCollisionStressTolerance(const PxReal selfCollisionStressTolerance) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves the self collision stress tolerance.
|
||||
|
||||
\return The self collision filter distance
|
||||
\see setSelfCollisionFilterDistance
|
||||
*/
|
||||
virtual PxReal getSelfCollisionStressTolerance() const = 0;
|
||||
|
||||
/**
|
||||
\brief Gets a pointer to a device buffer containing positions and inverse masses of the
|
||||
collision mesh.
|
||||
|
||||
This function returns a pointer to device memory for the positions and inverse masses of
|
||||
the deformable volume. This buffer is used to both initialize/update the collision mesh vertices
|
||||
of the deformable volume and read the simulation results.
|
||||
|
||||
\note It is mandatory to call PxDeformableVolume::markDirty() with PxDeformableVolumeDataFlag::ePOSITION_INVMASS
|
||||
when updating data in this buffer.
|
||||
|
||||
The simulation expects 4 consecutive floats for each vertex, aligned to a 16B boundary.
|
||||
The first 3 floats specify the vertex position and the last float contains the inverse mass of the
|
||||
vertex. The size of the buffer is the number of vertices of the collision mesh * sizeof(PxVec4).
|
||||
\see PxTetrahedronMesh::getNbVertices().
|
||||
|
||||
The device memory pointed to by this pointer is allocated when a shape is attached to the
|
||||
deformable volume. Calling PxDeformableVolume::detachShape() will deallocate the memory.
|
||||
|
||||
It is not allowed to write to this buffer from the start of the PxScene::simulate() call
|
||||
until PxScene::fetchResults() returns. Reading the data is allowed once all the PhysX tasks
|
||||
have finished, reading the data during a completion task is explicitly allowed. The
|
||||
simulation will read and write directly from/into this buffer.
|
||||
|
||||
It is the users' responsibility to initialize this buffer with the initial positions of
|
||||
the vertices of the collision mesh. See PxDeformableVolumeExt::allocateAndInitializeHostMirror(),
|
||||
PxDeformableVolumeExt::copyToDevice().
|
||||
|
||||
\return PxVec4* A pointer to a device buffer containing positions and inverse masses of
|
||||
the collision mesh.
|
||||
*/
|
||||
virtual PxVec4* getPositionInvMassBufferD() = 0;
|
||||
|
||||
/**
|
||||
\brief Gets a pointer to a device buffer containing rest positions of the collision mesh vertices.
|
||||
|
||||
This function returns a pointer to device memory for the rest positions of the deformable volume collision
|
||||
mesh. This buffer is used to initialize the rest positions of the collision mesh vertices.
|
||||
|
||||
\note It is mandatory to call PxDeformableVolume::markDirty() with PxDeformableVolumeDataFlag::eREST_POSITION when
|
||||
updating data in this buffer.
|
||||
|
||||
The simulation expects 4 floats per vertex, aligned to a 16B boundary. The first 3 specify the
|
||||
rest position. The last float is unused. The size of the buffer is the number of vertices in
|
||||
the collision mesh * sizeof(PxVec4). \see PxTetrahedronMesh::getNbVertices().
|
||||
|
||||
The device memory pointed to by this pointer is allocated when a shape is attached to the deformable volume.
|
||||
Calling PxDeformableVolume::detachShape() will deallocate the memory.
|
||||
|
||||
It is not allowed to write data into this buffer from the start of PxScene::simulate() until
|
||||
PxScene::fetchResults() returns.
|
||||
|
||||
It is the users' responsibility to initialize this buffer with the initial rest positions of the
|
||||
vertices of the collision mesh. See PxDeformableVolumeExt::allocateAndInitializeHostMirror(),
|
||||
PxDeformableVolumeExt::copyToDevice().
|
||||
|
||||
\return PxVec4* A pointer to a device buffer containing the rest positions of the collision mesh.
|
||||
*/
|
||||
virtual PxVec4* getRestPositionBufferD() = 0;
|
||||
|
||||
/**
|
||||
\brief Gets a pointer to a device buffer containing the vertex positions of the simulation mesh.
|
||||
|
||||
This function returns a pointer to device memory for the positions and inverse masses of the deformable volume
|
||||
simulation mesh. This buffer is used to both initialize/update the simulation mesh vertices
|
||||
of the deformable volume and read the simulation results.
|
||||
|
||||
\note It is mandatory to call PxDeformableVolume::markDirty() with PxDeformableVolumeDataFlag::eSIM_POSITION_INVMASS when
|
||||
updating data in this buffer.
|
||||
|
||||
The simulation expects 4 consecutive floats for each vertex, aligned to a 16B boundary. The
|
||||
first 3 floats specify the positions and the last float specifies the inverse mass of the vertex.
|
||||
The size of the buffer is the number of vertices of the simulation mesh * sizeof(PxVec4).
|
||||
\see PxTetrahedronMesh::getNbVertices().
|
||||
|
||||
The device memory pointed to by this pointer is allocated when a simulation mesh is attached to the
|
||||
deformable volume. Calling PxDeformableVolume::detachSimulationMesh() will deallocate the memory.
|
||||
|
||||
It is not allowed to write to this buffer from the start of the PxScene::simulate() call
|
||||
until PxScene::fetchResults() returns. Reading the data is allowed once all the PhysX tasks
|
||||
have finished, reading the data during a completion task is explicitly allowed. The
|
||||
simulation will read and write directly from/into this buffer.
|
||||
|
||||
It is the users' responsibility to initialize this buffer with the initial positions of
|
||||
the vertices of the simulation mesh. See PxDeformableVolumeExt::allocateAndInitializeHostMirror(),
|
||||
PxDeformableVolumeExt::copyToDevice().
|
||||
|
||||
\return PxVec4* A pointer to a device buffer containing the vertex positions of the simulation mesh.
|
||||
*/
|
||||
virtual PxVec4* getSimPositionInvMassBufferD() = 0;
|
||||
|
||||
/**
|
||||
\brief Gets a pointer to a device buffer containing the vertex velocities of the simulation mesh.
|
||||
|
||||
This function returns a pointer to device memory for the velocities of the deformable volume simulation mesh
|
||||
vertices. This buffer is used to both initialize/update the simulation mesh vertex velocities
|
||||
of the deformable volume and read the simulation results.
|
||||
|
||||
\note It is mandatory to call PxDeformableVolume::markDirty() with PxDeformableVolumeDataFlag::eSIM_VELOCITY when
|
||||
updating data in this buffer.
|
||||
|
||||
The simulation expects 4 consecutive floats for each vertex, aligned to a 16B boundary. The
|
||||
first 3 specify the velocities for each vertex. The final float is unused. The size of the
|
||||
buffer is the number of vertices of the simulation mesh * sizeof(PxVec4).
|
||||
\see PxTetrahedronMesh::getNbVertices().
|
||||
|
||||
The device memory pointed to by this pointer is allocated when a simulation mesh is attached to the
|
||||
deformable volume. Calling PxDeformableVolume::detachSimulationMesh() will deallocate the memory.
|
||||
|
||||
It is not allowed to write to this buffer from the start of the PxScene::simulate() call
|
||||
until PxScene::fetchResults() returns. Reading the data is allowed once all the PhysX tasks
|
||||
have finished, reading the data during a completion task is explicitly allowed. The
|
||||
simulation will read and write directly from/into this buffer.
|
||||
|
||||
It is the users' responsibility to initialize this buffer with the initial velocities of
|
||||
the vertices of the simulation mesh. See PxDeformableVolumeExt::allocateAndInitializeHostMirror(),
|
||||
PxDeformableVolumeExt::copyToDevice().
|
||||
|
||||
\return PxVec4* A pointer to a device buffer containing the vertex velocities of the simulation mesh.
|
||||
*/
|
||||
virtual PxVec4* getSimVelocityBufferD() = 0;
|
||||
|
||||
/**
|
||||
\brief Marks per-vertex simulation state and configuration buffers dirty to signal to the simulation
|
||||
that changes have been made.
|
||||
|
||||
Calling this function is mandatory to notify the simulation of changes made in the positionInvMass,
|
||||
simPositionInvMass, simVelocity and rest position buffers.
|
||||
|
||||
This function can be called multiple times, and dirty flags are accumulated internally until
|
||||
PxScene::simulate() is called.
|
||||
|
||||
\see getPositionInvMassBufferD, getSimVelocityBufferD, getRestPositionBufferD, getSimPositionInvMassBufferD
|
||||
|
||||
\param flags The buffers that have been updated.
|
||||
*/
|
||||
virtual void markDirty(PxDeformableVolumeDataFlags flags) = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the device buffer containing the kinematic targets for this deformable volume.
|
||||
|
||||
This function sets the kinematic targets for a deformable volume to a user-provided device buffer. This buffer is
|
||||
read by the simulation to obtain the target position for each vertex of the simulation mesh.
|
||||
|
||||
The simulation expects 4 consecutive float for each vertex, aligned to a 16B boundary. The first 3
|
||||
floats specify the target positions. The last float determines (together with the flag argument)
|
||||
if the target is active or not.
|
||||
For a deformable volume with the flag PxDeformableBodyFlag::eKINEMATIC raised, all target positions are considered
|
||||
valid. In case a deformable volume has the PxDeformableVolumeFlag::ePARTIALLY_KINEMATIC raised, only target
|
||||
positions whose corresponding last float has been set to 0.f are considered valid target positions.
|
||||
\see PxConfigureDeformableVolumeKinematicTarget
|
||||
Setting the kinematic targets has no effect if neither PxDeformableBodyFlag::eKINEMATIC nor
|
||||
PxDeformableVolumeFlag::ePARTIALLY_KINEMATIC is set.
|
||||
|
||||
The size of the buffer is the number of vertices of the simulation mesh * sizeof(PxVec4).
|
||||
\see PxTetrahedronMesh::getNbVertices().
|
||||
|
||||
It is the users responsibility to manage the memory pointed to by the input to this function,
|
||||
as well as guaranteeing the integrity of the input data. In particular, this means that it is
|
||||
not allowed to write this data from from the start of PxScene::simulate() until PxScene::fetchResults()
|
||||
returns. The memory is not allowed to be deallocated until PxScene::fetchResults() returns.
|
||||
|
||||
Calling this function with a null pointer for the positions will clear the input and resume normal
|
||||
simulation. PxDeformableBodyFlag::eKINEMATIC or PxDeformableVolumeFlag::ePARTIALLY_KINEMATIC are ignored
|
||||
if no targets are set.
|
||||
|
||||
This call is persistent across calls to PxScene::simulate(). Once this function is called, the
|
||||
simulation will look up the target positions from the same buffer for every call to PxScene::simulate().
|
||||
The user is allowed to update the target positions without calling this function again, provided that
|
||||
the synchronization requirements are adhered to (no changes between start of PxScene::simulate() until
|
||||
PxScene::fetchResults() returns).
|
||||
|
||||
\param positions A pointer to a device buffer containing the kinematic targets for this deformable volume.
|
||||
*/
|
||||
virtual void setKinematicTargetBufferD(const PxVec4* positions) = 0;
|
||||
|
||||
/**
|
||||
\brief Deprecated: Sets the device buffer containing the kinematic targets for this deformable volume.
|
||||
|
||||
This function sets the kinematic targets for a deformable volume to a user-provided device buffer. This buffer is
|
||||
read by the simulation to obtain the target position for each vertex of the simulation mesh.
|
||||
|
||||
The simulation expects 4 consecutive float for each vertex, aligned to a 16B boundary. The first 3
|
||||
floats specify the target positions. The last float determines (together with the flag argument)
|
||||
if the target is active or not.
|
||||
For a deformable volume with the flag PxDeformableVolumeFlag::eKINEMATIC raised, all target positions are considered
|
||||
valid. In case a deformable volume has the PxDeformableVolumeFlag::ePARTIALLY_KINEMATIC raised, only target
|
||||
positions whose corresponding last float has been set to 0.f are considered valid target positions.
|
||||
\see PxConfigureDeformableVolumeKinematicTarget
|
||||
|
||||
The size of the buffer is the number of vertices of the simulation mesh * sizeof(PxVec4).
|
||||
\see PxTetrahedronMesh::getNbVertices().
|
||||
|
||||
It is the users responsibility to manage the memory pointed to by the input to this function,
|
||||
as well as guaranteeing the integrity of the input data. In particular, this means that it is
|
||||
not allowed to write this data from from the start of PxScene::simulate() until PxScene::fetchResults()
|
||||
returns. The memory is not allowed to be deallocated until PxScene::fetchResults() returns.
|
||||
|
||||
Calling this function with a null pointer for the positions will clear the input and resume normal
|
||||
simulation. This will also clear both the PxDeformableVolumeFlag::eKINEMATIC and PxDeformableVolumeFlag::ePARTIALLY_KINEMATIC
|
||||
flags of the deformable volume.
|
||||
|
||||
This call is persistent across calls to PxScene::simulate(). Once this function is called, the
|
||||
simulation will look up the target positions from the same buffer for every call to PxScene::simulate().
|
||||
The user is allowed to update the target positions without calling this function again, provided that
|
||||
the synchronization requirements are adhered to (no changes between start of PxScene::simulate() until
|
||||
PxScene::fetchResults() returns).
|
||||
|
||||
\param positions A pointer to a device buffer containing the kinematic targets for this deformable volume.
|
||||
\param flags Flags specifying the type of kinematic deformable volume: this function ignores all flags except PxDeformableVolumeFlag::eKINEMATIC and PxDeformableVolumeFlag::ePARTIALLY_KINEMATIC.
|
||||
*/
|
||||
PX_DEPRECATED virtual void setKinematicTargetBufferD(const PxVec4* positions, PxDeformableVolumeFlags flags) = 0;
|
||||
|
||||
/**
|
||||
\brief Attaches a simulation mesh
|
||||
|
||||
Attaches the simulation mesh (geometry) and a state containing inverse mass, rest pose
|
||||
etc. required to compute the deformation.
|
||||
|
||||
\param[in] simulationMesh The tetrahedral mesh used to compute the deformable's deformation
|
||||
\param[in] deformableVolumeAuxData A state that contain a mapping from simulation to collision mesh, volume information etc.
|
||||
|
||||
\return Returns true if the operation was successful
|
||||
\see detachSimulationMesh, PxDeformableBody.attachShape
|
||||
*/
|
||||
virtual bool attachSimulationMesh(PxTetrahedronMesh& simulationMesh, PxDeformableVolumeAuxData& deformableVolumeAuxData) = 0;
|
||||
|
||||
/**
|
||||
\brief Detaches the simulation mesh
|
||||
|
||||
Detaches the simulation mesh and simulation state used to compute the deformation.
|
||||
|
||||
\see attachSimulationMesh, PxDeformableBody.detachShape
|
||||
*/
|
||||
virtual void detachSimulationMesh() = 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 Const version of getSimulationMesh()
|
||||
virtual const PxTetrahedronMesh* getSimulationMesh() const = 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 Const version of getCollisionMesh()
|
||||
virtual const PxTetrahedronMesh* getCollisionMesh() const = 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 PxDeformableVolumeAuxData* getDeformableVolumeAuxData() = 0;
|
||||
|
||||
//! \brief const version of getDeformableVolumeAuxData()
|
||||
virtual const PxDeformableVolumeAuxData*
|
||||
getDeformableVolumeAuxData() const = 0;
|
||||
|
||||
/**
|
||||
\brief Returns the GPU deformable volume index.
|
||||
|
||||
\return The GPU index, or 0xFFFFFFFF if the deformable volume is not in a scene.
|
||||
*/
|
||||
virtual PxU32 getGpuDeformableVolumeIndex() = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the concrete type name.
|
||||
\return The name of the concrete type.
|
||||
*/
|
||||
virtual const char* getConcreteTypeName() const PX_OVERRIDE PX_FINAL { return "PxDeformableVolume"; }
|
||||
|
||||
/**
|
||||
\brief Deprecated
|
||||
\see setDeformableVolumeFlag
|
||||
*/
|
||||
PX_DEPRECATED PX_FORCE_INLINE void setSoftBodyFlag(PxDeformableVolumeFlag::Enum flag, bool val) { return setDeformableVolumeFlag(flag, val); }
|
||||
|
||||
/**
|
||||
\brief Deprecated
|
||||
\see setDeformableVolumeFlags
|
||||
*/
|
||||
PX_DEPRECATED PX_FORCE_INLINE void setSoftBodyFlags(PxDeformableVolumeFlags flags) { return setDeformableVolumeFlags(flags); }
|
||||
|
||||
/**
|
||||
\brief Deprecated
|
||||
\see getDeformableVolumeFlags
|
||||
*/
|
||||
PX_DEPRECATED PX_FORCE_INLINE PxDeformableVolumeFlags getSoftBodyFlag() const { return getDeformableVolumeFlags(); }
|
||||
|
||||
/**
|
||||
\brief Deprecated
|
||||
\see getDeformableVolumeAuxData
|
||||
*/
|
||||
PX_DEPRECATED PX_FORCE_INLINE PxDeformableVolumeAuxData* getSoftBodyAuxData() { return getDeformableVolumeAuxData(); }
|
||||
|
||||
/**
|
||||
\brief Deprecated
|
||||
\see getDeformableVolumeAuxData
|
||||
*/
|
||||
PX_DEPRECATED PX_FORCE_INLINE const PxDeformableVolumeAuxData* getSoftBodyAuxData() const { return getDeformableVolumeAuxData(); }
|
||||
|
||||
/**
|
||||
\brief Deprecated
|
||||
<b>Default:</b> 4 position iterations, 1 velocity iteration
|
||||
\param[in] minPositionIters Minimal number of position iterations the solver should perform for this body. <b>Range:</b> [1,255]
|
||||
\param[in] minVelocityIters Minimal number of velocity iterations the solver should perform for this body. <b>Range:</b> [1,255]
|
||||
\see PxDeformableBody.setSolverIterationCounts()
|
||||
*/
|
||||
PX_DEPRECATED virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) = 0;
|
||||
|
||||
/**
|
||||
\brief Deprecated
|
||||
\see PxDeformableBody.setSolverIterationCount()
|
||||
*/
|
||||
PX_DEPRECATED virtual void getSolverIterationCounts(PxU32& minPositionIters, PxU32& minVelocityIters) const = 0;
|
||||
|
||||
/**
|
||||
\brief Creates a collision filter between a particle and a tetrahedron in the deformable volume'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 deformable volume are filtered.
|
||||
\param[in] tetId The tetradedron in the deformable volume that is filtered. If tetId is PX_MAX_NB_DEFORMABLE_VOLUME_TET, this particle will filter against all tetrahedra in this deformable volume.
|
||||
*/
|
||||
PX_DEPRECATED 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 deformable volume'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 deformable volume are filtered.
|
||||
\param[in] tetId The tetrahedron in the deformable volume is filtered.
|
||||
*/
|
||||
PX_DEPRECATED virtual void removeParticleFilter(PxPBDParticleSystem* particlesystem, const PxParticleBuffer* buffer, PxU32 particleId, PxU32 tetId) = 0;
|
||||
|
||||
/**
|
||||
\brief Creates an attachment between a particle and a deformable volume.
|
||||
Be aware that destroying the particle system before destroying the attachment is illegal and may cause a crash.
|
||||
The deformable volume 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 deformable volume's collision mesh.
|
||||
\param[in] tetId The tetrahedron in the deformable volume'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
|
||||
*/
|
||||
PX_DEPRECATED 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 deformable volume.
|
||||
Be aware that destroying the particle system before destroying the attachment is illegal and may cause a crash.
|
||||
The deformable volume 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
|
||||
*/
|
||||
PX_DEPRECATED virtual void removeParticleAttachment(PxPBDParticleSystem* particlesystem, PxU32 handle) = 0;
|
||||
|
||||
/**
|
||||
\brief Creates a collision filter between a vertex in a deformable volume 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 deformable volume's collision mesh whose collisions with the rigid body are filtered.
|
||||
*/
|
||||
PX_DEPRECATED virtual void addRigidFilter(PxRigidActor* actor, PxU32 vertId) = 0;
|
||||
|
||||
/**
|
||||
\brief Removes a collision filter between a vertex in a deformable volume 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 deformable volume's collision mesh whose collisions with the rigid body are filtered.
|
||||
*/
|
||||
PX_DEPRECATED virtual void removeRigidFilter(PxRigidActor* actor, PxU32 vertId) = 0;
|
||||
|
||||
/**
|
||||
\brief Creates a rigid attachment between a deformable volume and a rigid body.
|
||||
Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash.
|
||||
The deformable volume keeps track of these attachments but the rigid body does not.
|
||||
|
||||
This method attaches a vertex on the deformable volume 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 deformable volume'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 deformable volume and rigid body.
|
||||
\return Returns a handle that identifies the attachment created. This handle can be used to relese the attachment later
|
||||
*/
|
||||
PX_DEPRECATED virtual PxU32 addRigidAttachment(PxRigidActor* actor, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint = NULL) = 0;
|
||||
|
||||
/**
|
||||
\brief Releases a rigid attachment between a deformable volume and a rigid body.
|
||||
Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash.
|
||||
The deformable volume keeps track of these attachments but the rigid body does not.
|
||||
|
||||
This method removes a previously-created attachment between a vertex of the deformable volume 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
|
||||
*/
|
||||
PX_DEPRECATED virtual void removeRigidAttachment(PxRigidActor* actor, PxU32 handle) = 0;
|
||||
|
||||
/**
|
||||
\brief Creates collision filter between a tetrahedron in a deformable volume 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 deformable volume's collision mesh whose collisions with the rigid body is filtered.
|
||||
*/
|
||||
PX_DEPRECATED virtual void addTetRigidFilter(PxRigidActor* actor, PxU32 tetIdx) = 0;
|
||||
|
||||
/**
|
||||
\brief Removes collision filter between a tetrahedron in a deformable volume 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 deformable volume's collision mesh whose collisions with the rigid body is filtered.
|
||||
*/
|
||||
PX_DEPRECATED virtual void removeTetRigidFilter(PxRigidActor* actor, PxU32 tetIdx) = 0;
|
||||
|
||||
/**
|
||||
\brief Creates a rigid attachment between a deformable volume and a rigid body.
|
||||
Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash.
|
||||
The deformable volume 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 deformable volume'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
|
||||
*/
|
||||
PX_DEPRECATED 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 deformable volume and a tetrahedron in another deformable volume.
|
||||
|
||||
\param[in] otherDeformableVolume The other deformable volume actor used for collision filter
|
||||
\param[in] otherTetIdx The index of the tetrahedron in the other deformable volume's collision mesh to be filtered.
|
||||
\param[in] tetIdx1 The index of the tetrahedron in the deformable volume's collision mesh to be filtered. If tetId1 is PX_MAX_NB_DEFORMABLE_VOLUME_TET, the tetrahedron with index `otherTetIdx' in the other deformable volume will filter against all tetrahedra in this deformable volume.
|
||||
*/
|
||||
PX_DEPRECATED virtual void addSoftBodyFilter(PxDeformableVolume* otherDeformableVolume, PxU32 otherTetIdx, PxU32 tetIdx1) = 0;
|
||||
|
||||
/**
|
||||
\brief Removes collision filter between a tetrahedron in a deformable volume and a tetrahedron in other deformable volume.
|
||||
|
||||
\param[in] otherDeformableVolume The other deformable volume actor used for collision filter
|
||||
\param[in] otherTetIdx The index of the other tetrahedron in the other deformable volume's collision mesh whose collision with the tetrahedron with the deformable volume is filtered.
|
||||
\param[in] tetIdx1 The index of the tetrahedron in the deformable volume's collision mesh whose collision with the other tetrahedron with the other deformable volume is filtered.
|
||||
*/
|
||||
PX_DEPRECATED virtual void removeSoftBodyFilter(PxDeformableVolume* otherDeformableVolume, PxU32 otherTetIdx, PxU32 tetIdx1) = 0;
|
||||
|
||||
/**
|
||||
\brief Creates collision filters between a tetrahedron in a deformable volume with another deformable volume.
|
||||
|
||||
\param[in] otherDeformableVolume The other deformable volume actor used for collision filter
|
||||
\param[in] otherTetIndices The indices of the tetrahedron in the other deformable volume's collision mesh to be filtered.
|
||||
\param[in] tetIndices The indices of the tetrahedron of the deformable volume's collision mesh to be filtered.
|
||||
\param[in] tetIndicesSize The size of tetIndices.
|
||||
*/
|
||||
PX_DEPRECATED virtual void addSoftBodyFilters(PxDeformableVolume* otherDeformableVolume, PxU32* otherTetIndices, PxU32* tetIndices, PxU32 tetIndicesSize) = 0;
|
||||
|
||||
/**
|
||||
\brief Removes collision filters between a tetrahedron in a deformable volume with another deformable volume.
|
||||
|
||||
\param[in] otherDeformableVolume The other deformable volume actor used for collision filter
|
||||
\param[in] otherTetIndices The indices of the tetrahedron in the other deformable volume's collision mesh to be filtered.
|
||||
\param[in] tetIndices The indices of the tetrahedron of the deformable volume's collision mesh to be filtered.
|
||||
\param[in] tetIndicesSize The size of tetIndices.
|
||||
*/
|
||||
PX_DEPRECATED virtual void removeSoftBodyFilters(PxDeformableVolume* otherDeformableVolume, PxU32* otherTetIndices, PxU32* tetIndices, PxU32 tetIndicesSize) = 0;
|
||||
|
||||
/**
|
||||
\brief Creates an attachment between two deformable volumes.
|
||||
|
||||
This method attaches a point inside a tetrahedron of the collision mesh to a point in another deformable volume's tetrahedron collision mesh.
|
||||
|
||||
\param[in] deformableVolume0 The deformable volume actor used for the attachment
|
||||
\param[in] tetIdx0 The index of a tetrahedron in the other deformable volume that contains the point to be attached to the deformable volume
|
||||
\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 deformable volume's collision mesh that contains the point to be attached to the deformableVolume0
|
||||
\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.
|
||||
\param[in] constraintOffset Offsets the cone and distance limit constraint along its axis, in order to specify the location of the cone tip.
|
||||
\return Returns a handle that identifies the attachment created. This handle can be used to release the attachment later
|
||||
*/
|
||||
PX_DEPRECATED virtual PxU32 addSoftBodyAttachment(PxDeformableVolume* deformableVolume0, PxU32 tetIdx0, const PxVec4& tetBarycentric0, PxU32 tetIdx1, const PxVec4& tetBarycentric1,
|
||||
PxConeLimitedConstraint* constraint = NULL, PxReal constraintOffset = 0.0f) = 0;
|
||||
|
||||
/**
|
||||
\brief Releases an attachment between a deformable volume and the other deformable volume.
|
||||
Be aware that destroying the deformable volume 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 deformable volume's tetrahedron collision mesh.
|
||||
|
||||
\param[in] deformableVolume0 The deformable volume 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.
|
||||
*/
|
||||
PX_DEPRECATED virtual void removeSoftBodyAttachment(PxDeformableVolume* deformableVolume0, PxU32 handle) = 0;
|
||||
|
||||
/**
|
||||
\brief Deprecated
|
||||
\see getGpuDeformableVolumeIndex
|
||||
*/
|
||||
PX_DEPRECATED PX_FORCE_INLINE PxU32 getGpuSoftBodyIndex() { return getGpuDeformableVolumeIndex(); }
|
||||
|
||||
protected:
|
||||
PX_INLINE PxDeformableVolume(PxType concreteType, PxBaseFlags baseFlags) : PxDeformableBody(concreteType, baseFlags) {}
|
||||
PX_INLINE PxDeformableVolume(PxBaseFlags baseFlags) : PxDeformableBody(baseFlags) {}
|
||||
virtual ~PxDeformableVolume() {}
|
||||
virtual bool isKindOf(const char* name) const PX_OVERRIDE { PX_IS_KIND_OF(name, "PxDeformableVolume", PxDeformableBody); }
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Adjusts a deformable volume kinematic target such that it is properly set as active or inactive. Inactive targets will not affect vertex position, they are ignored by the solver.
|
||||
|
||||
\param[in] target The kinematic target
|
||||
\param[in] isActive A boolean indicating if the returned target should be marked as active or not
|
||||
\return The target with adjusted w component
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec4 PxConfigureDeformableVolumeKinematicTarget(const PxVec4& target, bool isActive)
|
||||
{
|
||||
PxVec4 result = target;
|
||||
if (isActive)
|
||||
result.w = 0.0f;
|
||||
else
|
||||
{
|
||||
//Any non-zero value will mark the target as inactive
|
||||
if (result.w == 0.0f)
|
||||
result.w = 1.0f;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Sets up a deformable volume kinematic target such that it is properly set as active or inactive. Inactive targets will not affect vertex position, they are ignored by the solver.
|
||||
|
||||
\param[in] target The kinematic target
|
||||
\param[in] isActive A boolean indicating if the returned target should be marked as active or not
|
||||
\return The target with configured w component
|
||||
*/
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec4 PxConfigureDeformableVolumeKinematicTarget(const PxVec3& target, bool isActive)
|
||||
{
|
||||
return PxConfigureDeformableVolumeKinematicTarget(PxVec4(target, 0.0f), isActive);
|
||||
}
|
||||
|
||||
#if PX_VC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif // PX_DEFORMABLE_VOLUME_H
|
||||
84
engine/third_party/physx/include/PxDeformableVolumeFlag.h
vendored
Normal file
84
engine/third_party/physx/include/PxDeformableVolumeFlag.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PX_DEFORMABLE_VOLUME_FLAGS_H
|
||||
#define PX_DEFORMABLE_VOLUME_FLAGS_H
|
||||
|
||||
#include "PxPhysXConfig.h"
|
||||
#include "foundation/PxFlags.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
\brief Flags to enable or disable special modes of a PxDeformableVolume instance
|
||||
*/
|
||||
struct PxDeformableVolumeFlag
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eCOMPUTE_STRESS_TENSOR = 1 << 0, //!< Enables computation of a Cauchy stress tensor for every tetrahedron in the simulation mesh. The tensors can be accessed through the deformable volume direct API
|
||||
ePARTIALLY_KINEMATIC = 1 << 1, //!< Enables partially kinematic motion of the collision and simulation mesh.
|
||||
eDISPLAY_SIM_MESH PX_DEPRECATED = 1 << 2, //!< Deprecated
|
||||
eDISABLE_SELF_COLLISION PX_DEPRECATED = 1 << 3, //!< Deprecated, use PxDeformableBodyFlag::eDISABLE_SELF_COLLISION instead
|
||||
eENABLE_CCD PX_DEPRECATED = 1 << 4, //!< Deprecated, use PxDeformableBodyFlag::eENABLE_SPECULATIVE_CCD
|
||||
eKINEMATIC PX_DEPRECATED = 1 << 5 //!< Deprecated, use PxDeformableBodyFlag::eKINEMATIC instead
|
||||
};
|
||||
};
|
||||
|
||||
typedef PxFlags<PxDeformableVolumeFlag::Enum, PxU16> PxDeformableVolumeFlags;
|
||||
|
||||
/**
|
||||
\brief Identifies the buffers of a PxDeformableVolume instance.
|
||||
|
||||
\see PxDeformableVolume::markDirty()
|
||||
*/
|
||||
struct PxDeformableVolumeDataFlag
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eNONE = 0,
|
||||
|
||||
ePOSITION_INVMASS = 1 << 0, //!< The collision mesh's positions
|
||||
eSIM_POSITION_INVMASS = 1 << 1, //!< The simulation mesh's positions and inverse masses
|
||||
eSIM_VELOCITY = 1 << 2, //!< The simulation mesh's velocities
|
||||
eREST_POSITION_INVMASS = 1 << 3, //!< The collision mesh's rest positions
|
||||
|
||||
eALL = ePOSITION_INVMASS | eSIM_POSITION_INVMASS | eSIM_VELOCITY | eREST_POSITION_INVMASS
|
||||
};
|
||||
};
|
||||
|
||||
typedef PxFlags<PxDeformableVolumeDataFlag::Enum, PxU32> PxDeformableVolumeDataFlags;
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // PX_DEFORMABLE_VOLUME_FLAGS_H
|
||||
136
engine/third_party/physx/include/PxDeformableVolumeMaterial.h
vendored
Normal file
136
engine/third_party/physx/include/PxDeformableVolumeMaterial.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PX_DEFORMABLE_VOLUME_MATERIAL_H
|
||||
#define PX_DEFORMABLE_VOLUME_MATERIAL_H
|
||||
|
||||
#include "PxDeformableMaterial.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
struct PxDeformableVolumeMaterialModel
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eCO_ROTATIONAL, //!< Default model. Well suited for high stiffness. Does need tetrahedra with good shapes (no extreme slivers) in the rest pose.
|
||||
eNEO_HOOKEAN //!< Well suited for lower stiffness. Robust to any tetrahedron shape.
|
||||
};
|
||||
};
|
||||
|
||||
class PxScene;
|
||||
/**
|
||||
\brief Material class to represent a set of deformable volume material properties.
|
||||
|
||||
\see PxPhysics.createDeformableVolumeMaterial
|
||||
*/
|
||||
class PxDeformableVolumeMaterial : public PxDeformableMaterial
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
\brief Sets material velocity damping term
|
||||
|
||||
\deprecated Use setElasticityDamping instead.
|
||||
|
||||
\param[in] damping Material velocity damping term. <b>Range:</b> [0, PX_MAX_F32)<br>
|
||||
|
||||
\see getDamping
|
||||
*/
|
||||
PX_DEPRECATED virtual void setDamping(PxReal damping) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves velocity damping
|
||||
|
||||
\deprecated Use getElasticityDamping instead.
|
||||
|
||||
\return The velocity damping.
|
||||
|
||||
\see setDamping()
|
||||
*/
|
||||
PX_DEPRECATED 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.
|
||||
|
||||
\deprecated Damping scale is deprecated.
|
||||
|
||||
\param[in] scale Damping scale term. <b>Default:</b> 1 <b>Range:</b> [0, 1]
|
||||
|
||||
\see getDampingScale
|
||||
*/
|
||||
PX_DEPRECATED virtual void setDampingScale(PxReal scale) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves material damping scale.
|
||||
|
||||
\deprecated Damping scale is deprecated.
|
||||
|
||||
\return The damping scale term.
|
||||
|
||||
\see setDamping()
|
||||
*/
|
||||
PX_DEPRECATED virtual PxReal getDampingScale() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the material model.
|
||||
|
||||
\param[in] model The material model
|
||||
|
||||
\see getMaterialModel
|
||||
*/
|
||||
virtual void setMaterialModel(PxDeformableVolumeMaterialModel::Enum model) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves the material model.
|
||||
\return The material model.
|
||||
|
||||
\see setMaterialModel()
|
||||
*/
|
||||
virtual PxDeformableVolumeMaterialModel::Enum getMaterialModel() const = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the concrete type name.
|
||||
\return The name of the concrete type.
|
||||
*/
|
||||
virtual const char* getConcreteTypeName() const PX_OVERRIDE PX_FINAL { return "PxDeformableVolumeMaterial"; }
|
||||
|
||||
protected:
|
||||
PX_INLINE PxDeformableVolumeMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxDeformableMaterial(concreteType, baseFlags) {}
|
||||
PX_INLINE PxDeformableVolumeMaterial(PxBaseFlags baseFlags) : PxDeformableMaterial(baseFlags) {}
|
||||
virtual ~PxDeformableVolumeMaterial() {}
|
||||
virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxDeformableVolumeMaterial", PxDeformableMaterial); }
|
||||
};
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif // PX_DEFORMABLE_VOLUME_MATERIAL_H
|
||||
100
engine/third_party/physx/include/PxDeletionListener.h
vendored
Normal file
100
engine/third_party/physx/include/PxDeletionListener.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
#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<PxDeletionEventFlag::Enum,PxU8> 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
|
||||
470
engine/third_party/physx/include/PxDirectGPUAPI.h
vendored
Normal file
470
engine/third_party/physx/include/PxDirectGPUAPI.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PX_DIRECT_GPU_API_H
|
||||
#define PX_DIRECT_GPU_API_H
|
||||
|
||||
#include "cudamanager/PxCudaTypes.h"
|
||||
#include "foundation/PxVec4.h"
|
||||
#include "foundation/PxSimpleTypes.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
\brief This flag specifies the type of data to get when calling PxDirectGPUAPI::getRigidDynamicData().
|
||||
*/
|
||||
class PxRigidDynamicGPUAPIReadType
|
||||
{
|
||||
public:
|
||||
enum Enum
|
||||
{
|
||||
eGLOBAL_POSE = 0, //!< Get the global poses. Type: 1 PxTransform per PxRigidDynamic.
|
||||
eLINEAR_VELOCITY, //!< Get the linear velocities. Type: 1 PxVec3 per PxRigidDynamic.
|
||||
eANGULAR_VELOCITY, //!< Get the angular velocities. Type: 1 PxVec3 per PxRigidDynamic.
|
||||
// eLINEAR_ACCELERATION and eANGULAR_ACCELERATION are only available if PxSceneFlag::eENABLE_BODY_ACCELERATIONS is enabled.
|
||||
eLINEAR_ACCELERATION, //!< Get the linear accelerations. Type: 1 PxVec3 per PxRigidDynamic.
|
||||
eANGULAR_ACCELERATION //!< Get the angular accelerations. Type: 1 PxVec3 per PxRigidDynamic.
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief This flag specifies the type of data to set when calling PxDirectGPUAPI::setRigidDynamicData().
|
||||
*/
|
||||
class PxRigidDynamicGPUAPIWriteType
|
||||
{
|
||||
public:
|
||||
enum Enum
|
||||
{
|
||||
eGLOBAL_POSE = 0, //!< Set the global poses. Type: 1 PxTransform per PxRigidDynamic.
|
||||
eLINEAR_VELOCITY, //!< Set the linear velocities. Type: 1 PxVec3 per PxRigidDynamic.
|
||||
eANGULAR_VELOCITY, //!< Set the angular velocities. Type: 1 PxVec3 per PxRigidDynamic.
|
||||
eFORCE, //!< Set the forces. Will be applied at the center of gravity of the bodies. Type: 1 PxVec3 per PxRigidDynamic.
|
||||
eTORQUE //!< Set the torques. Will be applied at the center of gravity of the bodies. Type: 1 PxVec3 per PxRigidDynamic.
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief This flag specifies the type of data to get when calling PxDirectGPUAPI::getArticulationData().
|
||||
*/
|
||||
class PxArticulationGPUAPIReadType
|
||||
{
|
||||
public:
|
||||
enum Enum
|
||||
{
|
||||
eJOINT_POSITION = 0, //!< The joint positions. 1 PxReal per dof. Block size per articulation: maxDofs.
|
||||
eJOINT_VELOCITY, //!< The joint velocities. 1 PxReal per dof. Block size per articulation: maxDofs.
|
||||
eJOINT_ACCELERATION, //!< The joint accelerations. 1 PxReal per dof. Block size per articulation: maxDofs.
|
||||
eJOINT_FORCE, //!< The joint forces or torques applied using setArticulationData. 1 PxReal per dof. Block size per articulation: maxDofs. Not updated by the simulation, will return the values set by PxDirectGPUAPI::setArticulationData().
|
||||
eJOINT_TARGET_VELOCITY, //!< The velocity targets applied using setArticulationData. 1 PxReal per dof. Block size per articulation: maxDofs. Not updated by the simulation, will return the values set by PxDirectGPUAPI::setArticulationData().
|
||||
eJOINT_TARGET_POSITION, //!< The position targets applied using setArticulationData. 1 PxReal per dof. Block size per articulation: maxDofs. Not updated by the simulation, will return the values set by PxDirectGPUAPI::setArticulationData().
|
||||
eROOT_GLOBAL_POSE, //!< The root link global pose. 1 PxTransform per articulation. Block size per articulation: 1.
|
||||
eROOT_LINEAR_VELOCITY, //!< The root link linear velocity. 1 PxVec3 per articulation. Block size per articulation: 1.
|
||||
eROOT_ANGULAR_VELOCITY, //!< The root link angular velocity. 1 PxVec3 per articulation. Block size per articulation: 1.
|
||||
eLINK_GLOBAL_POSE, //!< The link global pose including root link. 1 PxTransform per link. Block size per articulation: maxLinks.
|
||||
eLINK_LINEAR_VELOCITY, //!< The link linear velocities including root link. 1 PxVec3 per link. Block size per articulation: maxLinks.
|
||||
eLINK_ANGULAR_VELOCITY, //!< The link angular velocities including root link. 1 PxVec3 per link. Block size per articulation: maxLinks.
|
||||
eLINK_LINEAR_ACCELERATION, //!< The link linear accelerations including root link. 1 PxVec3 per link. Block size per articulation: maxLinks.
|
||||
eLINK_ANGULAR_ACCELERATION, //!< The link angular accelerations including root link. 1 PxVec3 per link. Block size per articulation: maxLinks.
|
||||
eLINK_INCOMING_JOINT_FORCE, //!< The link incoming joint forces including root link. The force is reported in the child joint frame of the link's incoming joint. 2 PxVec3 per link. The first PxVec3 contains the force, and the second PxVec3 contains the torque. Block size per articulation: maxLinks.
|
||||
eFIXED_TENDON, //!< Fixed tendon data. 1 PxGpuFixedTendonData per fixed tendon. Block size per articulation: maxFixedTendons. Not updated by the simulation, will return the values set by PxDirectGPUAPI::setArticulationData().
|
||||
eFIXED_TENDON_JOINT, //!< Fixed tendon joint data. 1 PxGpuTendonJointCoefficientData per fixed tendon joint. Block size per articulation: maxFixedTendons * maxFixedTendonJoints. Not updated by the simulation, will return the values set by PxDirectGPUAPI::setArticulationData().
|
||||
eSPATIAL_TENDON, //!< Spatial tendon data. 1 PxGpuSpatialTendonData per spatial tendon. Block size per articulation: maxSpatialTendons. Not updated by the simulation, will return the values set by PxDirectGPUAPI::setArticulationData().
|
||||
eSPATIAL_TENDON_ATTACHMENT //!< Spatial tendon attachment data. 1 PxGpuTendonAttachmentData per spatial tendon attachment. Block size per articulation: maxSpatialTendons * maxSpatialTendonAttachments. Not updated by the simulation, will return the values set by PxDirectGPUAPI::setArticulationData().
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief This flag specifies the type of data to set when calling PxDirectGPUAPI::setArticulationData().
|
||||
*/
|
||||
class PxArticulationGPUAPIWriteType
|
||||
{
|
||||
public:
|
||||
enum Enum
|
||||
{
|
||||
eJOINT_POSITION = 0, //!< The joint positions. 1 PxReal per dof. Block size per articulation: maxDofs.
|
||||
eJOINT_VELOCITY, //!< The joint velocities. 1 PxReal per dof. Block size per articulation: maxDofs.
|
||||
eJOINT_FORCE, //!< The applied joint forces or torques. 1 PxReal per dof. Block size per articulation: maxDofs.
|
||||
eJOINT_TARGET_VELOCITY, //!< The velocity targets for the joint drives. 1 PxReal per dof. Block size per articulation: maxDofs.
|
||||
eJOINT_TARGET_POSITION, //!< The position targets for the joint drives. 1 PxReal per dof. Block size per articulation: maxDofs.
|
||||
eROOT_GLOBAL_POSE, //!< The root link transform. 1 PxTransform per articulation. Block size per articulation: 1.
|
||||
eROOT_LINEAR_VELOCITY, //!< The root link linear velocity. 1 PxVec3 per articulation. Block size per articulation: 1.
|
||||
eROOT_ANGULAR_VELOCITY, //!< The root link angular velocity. 1 PxVec3 per articulation. Block size per articulation: 1.
|
||||
eLINK_FORCE, //!< The forces to apply to links. 1 PxVec3 per link. Block size per articulation: maxLinks.
|
||||
eLINK_TORQUE, //!< The torques to apply to links. 1 PxVec3 per link. Block size per articulation: maxLinks.
|
||||
eFIXED_TENDON, //!< Fixed tendon data. 1 PxGpuFixedTendonData per fixed tendon. Block size per articulation: maxFixedTendons.
|
||||
eFIXED_TENDON_JOINT, //!< Fixed tendon joint data. 1 PxGpuTendonJointCoefficientData per fixed tendon joint. Block size per articulation: maxFixedTendons * maxFixedTendonJoints.
|
||||
eSPATIAL_TENDON, //!< Spatial tendon data. 1 PxGpuSpatialTendonData per spatial tendon. Block size per articulation: maxSpatialTendons.
|
||||
eSPATIAL_TENDON_ATTACHMENT //!< Spatial tendon attachment data. 1 PxGpuTendonAttachmentData per spatial tendon attachment. Block size per articulation: maxSpatialTendons * maxSpatialTendonAttachments.
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief This flag specifies the type of operation to perform when calling PxDirectGPUAPI::computeArticulationData.
|
||||
*/
|
||||
class PxArticulationGPUAPIComputeType
|
||||
{
|
||||
public:
|
||||
enum Enum
|
||||
{
|
||||
eUPDATE_KINEMATIC = 0, //!< Updates the link state for all the articulations specified in the index list. This operation can be performed
|
||||
//!< by the user to propagate changes made to root transform/root velocities/joint positions/joint velocities to
|
||||
//!< be reflected in the link transforms/velocities. Performing this operation will clear output values calculated by
|
||||
//!< the simulation, specifically link accelerations, link incoming joint forces, and joint accelerations. Note
|
||||
//!< that this is only necessary if the user wants to query link state, otherwise it will be performed automatically
|
||||
//!< at the start of the next call to simulate(). The data input parameter will be ignored and can be set to NULL for
|
||||
//!< this operation.
|
||||
eDENSE_JACOBIANS, //!< Computes the dense Jacobian for the articulation in world space, including the dofs of a potentially floating base.
|
||||
//!< This is the batched, direct-GPU equivalent of PxArticulationReducedCoordinate::computeDenseJacobian. The output data
|
||||
//!< buffer is laid out into sequential blocks per articulation, where each block has the size
|
||||
//!< (6 + maxDofs) * (6 + (maxLinks - 1) * 6) * sizeof(float). maxLinks and maxDofs are the maximum link and dof counts
|
||||
//!< across all the articulations in the scene, and can be queried by calling PxDirectGPUAPI::getArticulationGPUAPIMaxCounts().
|
||||
//!< The size of the jacobian can vary by articulation, and will be determined using these formulas:
|
||||
//!< nCols = (fixedBase ? 0 : 6) + dofCount, nRows = (fixedBase ? 0 : 6) + (linkCount - 1) * 6. The matrix is indexed [nCols * row + column].
|
||||
eGENERALIZED_MASS_MATRICES PX_DEPRECATED, //!< Deprecated, use PxArticulationGPUAPIComputeType::eMASS_MATRICES instead.
|
||||
//!< Computes the joint-space inertia matrices that maps joint accelerations to joint forces: forces = M * accelerations on the GPU.
|
||||
//!< This is the batched, direct-GPU equivalent of PxArticulationReducedCoordinate::computeGeneralizedMassMatrix().
|
||||
//!< The output buffer is laid out into sequential blocks per articulation, where each block has the size maxDofs * maxDofs * sizeof(float).
|
||||
//!< maxDofs is the maximum dof count across all the articulations in the scene, and can be queried by calling
|
||||
//!< PxDirectGPUAPI::getArticulationGPUAPIMaxCounts(). The size of the matrix can vary by articulation, and will be dofCount * dofCount.
|
||||
//!< The dof indices will be according to the low-level indexing, we refer to the documentation of PxArticulationCache for an explanation.
|
||||
eGENERALIZED_GRAVITY_FORCES PX_DEPRECATED, //!< Deprecated, use PxArticulationGPUAPIComputeType::eGRAVITY_COMPENSATION instead.
|
||||
//!< Computes the joint dof forces required to counteract gravitational forces for the given articulation pose. This is the
|
||||
//!< batched, direct-GPU equivalent of PxArticulationReducedCoordinate::computeGeneralizedGravityForce(). The output data
|
||||
//!< buffer is laid out into sequential blocks per articulation, where each block has the size maxDofs * sizeof(float). maxDofs
|
||||
//!< is the maximum dof count across all the articulations in the scene, and can be queried by calling
|
||||
//!< PxDirectGPUAPI::getArticulationGPUAPIMaxCounts(). The data layout within each block follows the PxArticulationCache layout,
|
||||
//!< for which we refer to the user guide. There will be 1 PxReal per articulation dof.
|
||||
eCORIOLIS_AND_CENTRIFUGAL_FORCES PX_DEPRECATED, //!< Deprecated, use PxArticulationGPUAPIComputeType::eCORIOLIS_AND_CENTRIFUGAL_COMPENSATION instead.
|
||||
//!< Computes the joint dof forces required to counteract Coriolis and centrifugal forces for the given articulation pose.
|
||||
//!< This is the batched, direct-GPU equivalent to PxArticulationReducedCoordinate::computeCoriolisAndCentrifugalForce(). The output data
|
||||
//!< buffer is laid out into sequential blocks per articulation, where each block has the size maxDofs * sizeof(float). maxDofs
|
||||
//!< is the maximum dof count across all the articulations in the scene, and can be queried by calling
|
||||
//!< PxDirectGPUAPI::getArticulationGPUAPIMaxCounts(). The data layout within each block follows the PxArticulationCache layout,
|
||||
//!< for which we refer to the user guide. There will be 1 PxReal per articulation dof.
|
||||
eMASS_MATRICES, //!< Computes the mass matrices that maps accelerations to forces: forces = M * accelerations on the GPU.
|
||||
//!< This is the batched, direct-GPU equivalent of PxArticulationReducedCoordinate::computeMassMatrix(). The output buffer is laid
|
||||
//!< out into sequential blocks per articulation, where each block has the size (maxDofs + 6) * (maxDofs + 6) * sizeof(float).
|
||||
//!< maxDofs is the maximum dof count across all the articulations in the scene, and can be queried by calling
|
||||
//!< PxDirectGPUAPI::getArticulationGPUAPIMaxCounts(), The size of the matrix can vary by articulation, and will be dofCount * dofCount
|
||||
//!< for fixed-base articulations and (dofCount + 6) * (dofCount + 6) for floating-base articulations.
|
||||
//!< We refer to the documentation of PxArticulationCache and PxArticulationReducedCoordinate::computeMassMatrix() for a more detailed explanation.
|
||||
eCORIOLIS_AND_CENTRIFUGAL_COMPENSATION, //!< Computes the joint dof forces (and root force) required to counteract Coriolis and centrifugal forces for the given articulation pose.
|
||||
//!< This is the batched, direct-GPU equivalent to PxArticulationReducedCoordinate::computeCoriolisCompensation(). The output data
|
||||
//!< buffer is laid out into sequential blocks per articulation, where each block has the size (maxDofs + 6) * sizeof(float). maxDofs
|
||||
//!< is the maximum dof count across all the articulations in the scene, and can be queried by calling
|
||||
//!< PxDirectGPUAPI::getArticulationGPUAPIMaxCounts(). The size of the output can vary by articulation, and will be dofCount
|
||||
//!< for fixed-base articulations and (dofCount + 6) for floating-base articulations. We refer to the documentation of
|
||||
//!< PxArticulationCache and PxArticulationReducedCoordinate::computeCoriolisCompensation() for a more detailed explanation.
|
||||
eGRAVITY_COMPENSATION, //!< Computes the forces required to counteract gravitational forces for the given articulation pose. This is the batched,
|
||||
//!< direct-GPU equivalent of PxArticulationReducedCoordinate::computeGravityCompensation(). The output data buffer is laid out
|
||||
//!< into sequential blocks per articulation, where each block has the size (maxDofs + 6) * sizeof(float). maxDofs
|
||||
//!< is the maximum dof count across all the articulations in the scene, and can be queried by calling
|
||||
//!< PxDirectGPUAPI::getArticulationGPUAPIMaxCounts(). The size of the output can vary by articulation, and will be dofCount
|
||||
//!< for fixed-base articulations and (dofCount + 6) for floating-base articulations. We refer to the documentation of
|
||||
//!< PxArticulationCache and PxArticulationReducedCoordinate::computeGravityCompensation() for a more detailed explanation.
|
||||
eARTICULATION_COMS_WORLD_FRAME, //!< Computes the articulation's center of mass in the world frame for the given articulation pose.
|
||||
//!< This is the batched, direct-GPU equivalent to PxArticulationReducedCoordinate::computeArticulationCOM(). The output data
|
||||
//!< buffer is laid out into sequential blocks per articulation, where each block has the size sizeof(float) * 3.
|
||||
eARTICULATION_COMS_ROOT_FRAME, //!< Computes the articulation's center of mass in the root frame for the given articulation pose.
|
||||
//!< This is the batched, direct-GPU equivalent to PxArticulationReducedCoordinate::computeArticulationCOM(). The output data
|
||||
//!< buffer is laid out into sequential blocks per articulation, where each block has the size sizeof(float) * 3.
|
||||
eCENTROIDAL_MOMENTUM_MATRICES //!< Computes the centroidal momentum matrix and bias force for a floating-base articulation.
|
||||
//!< This is the batched, direct-GPU equivalent to PxArticulationReducedCoordinate::computeCentroidalMomentumMatrix(). The data buffer is laid
|
||||
//!< out into four main blocks. The two first blocks correspond to the input (mass matrix, Coriolis and Centrifugal compensation force),
|
||||
//!< and the two last blocks correspond to the output (centroidal momentum matrix, bias force). Each block must be organized into sequential
|
||||
//!< subblocks per articulation. The size of the subblock is (maxDofs + 6) * (maxDofs + 6) * sizeof(float) for the mass matrix,
|
||||
//!< (maxDofs + 6) * sizeof(float) for the Coriolis and Centrifugal compensation force, 6 * (maxDofs + 6) * sizeof(float) for the centroidal
|
||||
//!< momentum matrix, and 6 * sizeof(float) for the bias force. maxDofs is the maximum dof count across all the articulations in the scene,
|
||||
//!< and can be queried by calling PxDirectGPUAPI::getArticulationGPUAPIMaxCounts(). The size of the actual data in each subblock can vary by
|
||||
//!< articulation, and will depend on the value of dofCount. The dof indices will be according to the low-level indexing, we refer to
|
||||
//!< the documentation of PxArticulationCache for an explanation.
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Container to hold the results of PxDirectGPUAPI::getArticulationGPUAPIMaxCounts(). All the quantities are the maximum values
|
||||
for the PxScene associated with this instance of PxDirectGPUAPI.
|
||||
*/
|
||||
struct PxArticulationGPUAPIMaxCounts
|
||||
{
|
||||
PxU32 maxDofs;
|
||||
PxU32 maxLinks;
|
||||
PxU32 maxFixedTendons;
|
||||
PxU32 maxFixedTendonJoints;
|
||||
PxU32 maxSpatialTendons;
|
||||
PxU32 maxSpatialTendonAttachments;
|
||||
|
||||
PxArticulationGPUAPIMaxCounts() :
|
||||
maxDofs(0),
|
||||
maxLinks(0),
|
||||
maxFixedTendons(0),
|
||||
maxFixedTendonJoints(0),
|
||||
maxSpatialTendons(0),
|
||||
maxSpatialTendonAttachments(0)
|
||||
{ }
|
||||
};
|
||||
|
||||
/**
|
||||
\brief This flag specifies the type of data to get when calling #PxDirectGPUAPI::getD6JointData().
|
||||
*/
|
||||
class PxD6JointGPUAPIReadType
|
||||
{
|
||||
public:
|
||||
enum Enum
|
||||
{
|
||||
/**
|
||||
\brief The joint forces applied by the solver.
|
||||
|
||||
The forces are in world space. 1 PxVec3 per joint.
|
||||
|
||||
\note Replaces calls to PxConstraint::getForce() which will not work properly anymore if direct GPU API is used.
|
||||
*/
|
||||
eJOINT_FORCE,
|
||||
|
||||
/**
|
||||
\brief The joint torques applied by the solver.
|
||||
|
||||
The torques are in world space. 1 PxVec3 per joint.
|
||||
|
||||
\note Replaces calls to PxConstraint::getForce() which will not work properly anymore if direct GPU API is used.
|
||||
*/
|
||||
eJOINT_TORQUE
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief PxDirectGPUAPI exposes an API that enables batched direct access to GPU data for a PxScene.
|
||||
|
||||
The functions in this class allow batched direct access to GPU data for PxRigidDynamic, PxArticulationReducedCoordinate,
|
||||
PxShape and PxD6Joint types. This allows interoperation with GPU post- and preprocessing for users and allows the user
|
||||
to implement more efficient CPU-GPU data copies based on the specific needs of the application.
|
||||
|
||||
Using this direct-API will disable the existing CPU-based API for all the data exposed in the direct-API. For any API function
|
||||
that does not have a counterpart in this direct-API, the existing API will continue to work.
|
||||
|
||||
To use this API, PxSceneFlag::eENABLE_DIRECT_GPU_API needs to be raised, in combination with PxSceneFlag::eENABLE_GPU_DYNAMICS
|
||||
and PxBroadphaseType::eGPU. Note that these options are immutable and cannot be changed after the scene has been created.
|
||||
|
||||
Due to the internal architecture of the GPU-accelerated parts of PhysX, using this API comes with caveats:
|
||||
|
||||
1) All GPU-CPU copies for data exposed in this API will be disabled. This means that the existing CPU-based API will
|
||||
return outdated data, and any setters for data exposed in the interface will not work. On the other hand, significant
|
||||
speedups can be achieved because of the reduced amount of GPU-CPU memory copies.
|
||||
|
||||
2) Due to the internal architecture of the GPU-accelerated PhysX, this API will only work after a first simulation step has been
|
||||
taken. The reason for this is that the PxScene first needs to know all the actors it will have to simulate, and setup the
|
||||
sizes of the GPU-based structures. For setup, the existing CPU API should be used.
|
||||
|
||||
\note Due to the fact that this API is exposing low-level data, we do reserve the right to change this API without deprecation
|
||||
in case of changes in the internal implementations.
|
||||
*/
|
||||
|
||||
class PxDirectGPUAPI
|
||||
{
|
||||
protected:
|
||||
PxDirectGPUAPI() {}
|
||||
virtual ~PxDirectGPUAPI() {}
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
\brief Copies the simulation state for a set of PxRigidDynamic actors into a user-provided GPU data buffer.
|
||||
|
||||
\param[out] data User-provided GPU data buffer which has size nbElements * sizeof(type). For the types, see the dataType options in PxRigidDynamicGPUAPIReadType.
|
||||
\param[in] gpuIndices User-provided GPU index buffer containing elements of PxRigidDynamicGPUIndex. This buffer contains the GPU indices of the PxRigidDynamic objects that are part of this get operation. See #PxRigidDynamic::getGPUIndex(). The size of this buffer needs to be nbElements * sizeof(PxRigidDynamicGPUIndex). The data requested for the PxRigidDynamic with its GPU index at position x in the gpuIndices array will be located at position x in the data array.
|
||||
\param[in] dataType The type of data to get. See #PxRigidDynamicGPUAPIReadType.
|
||||
\param[in] nbElements The number of rigid bodies to be copied.
|
||||
\param[in] startEvent User-provided CUDA event that is awaited at the start of this function. Defaults to NULL which means the function will dispatch the copy immediately.
|
||||
\param[in] finishEvent User-provided CUDA event that is recorded at the end of this function. Defaults to NULL which means the function will wait for the copy to finish before returning.
|
||||
|
||||
\return bool Whether the operation was successful. Note that this might not include asynchronous CUDA errors.
|
||||
|
||||
*/
|
||||
virtual bool getRigidDynamicData(void* data, const PxRigidDynamicGPUIndex* gpuIndices, PxRigidDynamicGPUAPIReadType::Enum dataType, PxU32 nbElements, CUevent startEvent = NULL, CUevent finishEvent = NULL) const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the simulation state for a set of PxRigidDynamic actors from a user-provided GPU data buffer.
|
||||
|
||||
\param[in] data User-provided GPU data buffer which has size nbElements * sizeof(type). For the types, see the dataType options in PxRigidDynamicGPUAPIWriteType.
|
||||
\param[in] gpuIndices User-provided GPU index buffer containing elements of PxRigidDynamicGPUIndex. This buffer contains the GPU indices of the PxRigidDynamic objects that are part of this set operation. See #PxRigidDynamic::getGPUIndex(). The size of this buffer needs to be nbElements * sizeof(PxRigidDynamicGPUIndex). The data for the PxRigidDynamic with its GPU index at position x in the gpuIndices array needs to be located at position x in the data array.
|
||||
\param[in] dataType The type of data to set. See #PxRigidDynamicGPUAPIWriteType.
|
||||
\param[in] nbElements The number of rigid bodies to be set.
|
||||
\param[in] startEvent User-provided CUDA event that is awaited at the start of this function. Defaults to NULL which means the function will dispatch the copy immediately.
|
||||
\param[in] finishEvent User-provided CUDA event that is recorded at the end of this function. Defaults to NULL which means the function will wait for the copy to finish before returning.
|
||||
|
||||
\return bool Whether the operation was successful. Note that this might not include asynchronous CUDA errors.
|
||||
*/
|
||||
virtual bool setRigidDynamicData(const void* data, const PxRigidDynamicGPUIndex* gpuIndices, PxRigidDynamicGPUAPIWriteType::Enum dataType, PxU32 nbElements, CUevent startEvent = NULL, CUevent finishEvent = NULL) = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the simulation state for a set of articulations, i.e. PxArticulationReducedCoordinate objects and copies into a user-provided GPU data buffer.
|
||||
|
||||
\param[out] data User-provided GPU data buffer that is appropriately sized for the data being requested. The sizing is explained in detail below.
|
||||
\param[in] gpuIndices User-provided GPU index buffer containing elements of PxArticulationGPUIndex. This buffer contains the GPU indices of the PxArticulationReducedCoordinate objects that are part of this get operation. See #PxArticulationReducedCoordinate::getGPUIndex(). The size of this buffer needs to be nbElements * sizeof(PxArticulationGPUIndex). The data for the PxArticulationReducedCoordinate with its GPU index at position x in the gpuIndices array will have its data block located at position x in the data array.
|
||||
\param[in] dataType The type of data to get. See #PxArticulationGPUAPIReadType.
|
||||
\param[in] nbElements The number of articulations to copy data from.
|
||||
\param[in] startEvent User-provided CUDA event that is awaited at the start of this function. Defaults to NULL which means the function will dispatch the copy immediately.
|
||||
\param[in] finishEvent User-provided CUDA event that is recorded at the end of this function. Defaults to NULL which means the function will wait for the copy to finish before returning.
|
||||
|
||||
\return bool Whether the operation was successful. Note that this might not include asynchronous CUDA errors.
|
||||
|
||||
The data buffer must be sized according to the maximum component counts across all articulations in the PxScene, as summarised in PxArticulationGPUAPIMaxCounts. The data buffer is split into sequential
|
||||
blocks that are of equal size and can hold the data for all components of an articulation. For example, for a link-centric data type (PxArticulationGPUAPIReadType::eLINK_GLOBAL_POSE, for example)
|
||||
each of these blocks has to be maxLinks * sizeof(dataType). The size of the complete buffer would then be nbElements * maxLinks * sizeof(dataType). For a dof-centric data type,
|
||||
the block size would be maxDofs * sizeof(dataType). The specific layout for each dataType is detailed in the API documentation of PxArticulationGPUAPIReadType.
|
||||
The max counts for a scene can be obtained by calling PxDirectGPUAPI::getArticulationGPUAPIMaxCounts().
|
||||
|
||||
The link and dof indexing of these blocks then follows the same pattern as the PxArticulationCache API. We refer to the user guide for an explanation.
|
||||
*/
|
||||
virtual bool getArticulationData(void* data, const PxArticulationGPUIndex* gpuIndices, PxArticulationGPUAPIReadType::Enum dataType, PxU32 nbElements, CUevent startEvent = NULL, CUevent finishEvent = NULL) const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the simulation state for a set of articulations, i.e. PxArticulationReducedCoordinate objects from a user-provided GPU data buffer.
|
||||
|
||||
\param[in] data User-provided GPU data buffer that is appropriately sized for the data to be set. The sizing is explained in detail below.
|
||||
\param[in] gpuIndices User-provided GPU index buffer containing elements of PxArticulationGPUIndex. This buffer contains the GPU indices of the PxArticulationReducedCoordinate objects that are part of this set operation. See #PxArticulationReducedCoordinate::getGPUIndex(). The size of this buffer needs to be nbElements * sizeof(PxArticulationGPUIndex). The data for the PxArticulationReducedCoordinate with its GPU index at position x in the gpuIndices array needs to have its data block located at position x in the data array.
|
||||
\param[in] dataType The type of data to set. See #PxArticulationGPUAPIWriteType.
|
||||
\param[in] nbElements The number of articulations to set data for.
|
||||
\param[in] startEvent User-provided CUDA event that is awaited at the start of this function. Defaults to NULL which means the function will dispatch the copy immediately.
|
||||
\param[in] finishEvent User-provided CUDA event that is recorded at the end of this function. Defaults to NULL which means the function will wait for the copy to finish before returning.
|
||||
|
||||
\return bool Whether the operation was successful. Note that this might not include asynchronous CUDA errors.
|
||||
|
||||
The data buffer must be sized according to the maximum component counts across all articulations in the PxScene, as summarised in PxArticulationGPUAPIMaxCounts. The data buffer is split into sequential
|
||||
blocks that are of equal size and can hold the data for all components of an articulation. For example, for a link-centric data type (PxArticulationGPUAPIWriteType::eLINK_FORCE, for example)
|
||||
each of these blocks has to be maxLinks * sizeof(dataType). The size of the complete buffer would then be nbElements * maxLinks * sizeof(dataType). For a dof-centric data type,
|
||||
the block size would be maxDofs * sizeof(dataType). The specific layout for each dataType is detailed in the API documentation of PxArticulationGPUAPIWriteType.
|
||||
The max counts for a scene can be obtained by calling PxDirectGPUAPI::getArticulationGPUAPIMaxCounts().
|
||||
|
||||
The internal indexing of these blocks then follows the same pattern as the PxArticulationCache API. We refer to the user guide for an explanation.
|
||||
*/
|
||||
virtual bool setArticulationData(const void* data, const PxArticulationGPUIndex* gpuIndices, PxArticulationGPUAPIWriteType::Enum dataType, PxU32 nbElements, CUevent startEvent = NULL, CUevent finishEvent = NULL) = 0;
|
||||
|
||||
/**
|
||||
\brief performs a compute operation on a set of articulations, i.e. PxArticulationReducedCoordinate objects.
|
||||
|
||||
\param[in,out] data User-provided GPU data buffer that is appropriately sized for the operation to be performed. Depending on the operation, can be input or output data.
|
||||
\param[in] gpuIndices User-provided GPU index buffer containing elements of PxArticulationGPUIndex. This buffer contains the GPU indices of the PxArticulationReducedCoordinate objects that are part of this compute operation. See #PxArticulationReducedCoordinate::getGPUIndex(). The size of this buffer needs to be nbElements * sizeof(PxArticulationGPUIndex).
|
||||
\param[in] operation The operation to perform. See PxArticulationGPUAPIComputeType::Enum.
|
||||
\param[in] nbElements The number of articulations to perform this compute operation on.
|
||||
\param[in] startEvent User-provided CUDA event that is awaited at the start of this function. Defaults to NULL which means the function will dispatch the computation immediately.
|
||||
\param[in] finishEvent User-provided CUDA event that is recorded at the end of this function. Defaults to NULL which means the function will wait for the computation to finish before returning.
|
||||
|
||||
\return bool Whether the operation was successful. Note that this might not include asynchronous CUDA errors.
|
||||
|
||||
The appropriate sizing of the data buffer as well as the data layout is documented alongside the compute operations in the API documentation of PxArticulationGPUAPIComputeType.
|
||||
*/
|
||||
virtual bool computeArticulationData(void* data, const PxArticulationGPUIndex* gpuIndices, PxArticulationGPUAPIComputeType::Enum operation, PxU32 nbElements, CUevent startEvent = NULL, CUevent finishEvent = NULL) = 0;
|
||||
|
||||
/**
|
||||
\brief Copy rigid body (PxRigidBody) and articulation (PxArticulationReducedCoordinate) contact data to a user-provided GPU data buffer.
|
||||
|
||||
\note This function only reports contact data for actor pairs where both actors are either rigid bodies or articulations.
|
||||
\note The contact data contains pointers to internal state and is only valid until the next call to simulate().
|
||||
|
||||
\param[out] data User-provided GPU data buffer, which should be the size of PxGpuContactPair * maxPairs
|
||||
\param[out] nbContactPairs User-provided GPU data buffer of 1 * sizeof(PxU32) that contains the actual number of pairs that was written.
|
||||
\param[in] maxPairs The maximum number of pairs that the buffer can contain.
|
||||
\param[in] startEvent User-provided CUDA event that is awaited at the start of this function. Defaults to NULL which means the function will dispatch the copy immediately.
|
||||
\param[in] finishEvent User-provided CUDA event that is recorded at the end of this function. Defaults to NULL which means the function will wait for the copy to finish before returning.
|
||||
|
||||
\return bool Whether the operation was successful. Note that this might not include asynchronous CUDA errors.
|
||||
*/
|
||||
virtual bool copyContactData(void* data, PxU32* nbContactPairs, PxU32 maxPairs, CUevent startEvent = NULL, CUevent finishEvent = NULL) const = 0;
|
||||
|
||||
/**
|
||||
\brief Evaluate sample point distances and gradients on SDF shapes in local space. Local space is the space in which the mesh's raw vertex positions are represented.
|
||||
\param[out] localGradientAndSignedDistanceConcatenated User-provided GPU buffer where the evaluated gradients and distances in SDF local space get stored. It has the same structure as localSamplePointsConcatenated. The PxVec4 elements contain the gradient and the distance (gradX, gradY, gradZ, distance).
|
||||
\param[in] shapeIndices User-provided GPU index buffer containing elements of PxShapeGPUIndex. This buffer contains the GPU indices of the PxShape objects that are part of this operation. See #PxShape::getGPUIndex(). The size of this buffer (in bytes) needs to be nbElements * sizeof(PxShapeGPUIndex). The shapes must be triangle mesh shapes with SDFs.
|
||||
\param[in] localSamplePointsConcatenated User-provided GPU buffer containing the sample point locations for every shape in the shapes' local space. The buffer stride is maxPointCount.
|
||||
\param[in] samplePointCountPerShape User-provided GPU buffer containing the number of sample points for every shape.
|
||||
\param[in] nbElements The number of shapes to be queried.
|
||||
\param[in] maxPointCount The maximum value in the array samplePointCountPerShape. Note that the arrays localGradientAndSignedDistanceConcatenated and localSamplePointsConcatenated must have the size (in bytes) nbElements * maxPointCount * sizeof(PxVec4).
|
||||
\param[in] startEvent User-provided CUDA event that is awaited at the start of this function. Defaults to NULL which means the function will dispatch the computation immediately.
|
||||
\param[in] finishEvent User-provided CUDA event that is recorded at the end of this function. Defaults to NULL which means the function will wait for the computation to finish before returning.
|
||||
|
||||
Example: Ten shapes are part of the simulation. Three of them have an SDF (shapeIndices of the SDF meshes are 2, 4 and 6). For the first shape, the SDF distance of 10 sample points should be queried. 20 sample
|
||||
points for the second mesh and 30 sample points for the third mesh. The slice size (=maxPointCount) is the maximum of sample points required for any shape participating in the query, 30 = max(10, 20, 30) for this example.
|
||||
The buffers required for the method evaluateSDFDistances are constructed as follows (not including optional parameters):
|
||||
* localGradientAndSignedDistanceConcatenated[length: 3 * 30]:
|
||||
* No initialization needed. It will hold the result after the finishEvent occurred. It has the same structure as localSamplePointsConcatenated, see below.
|
||||
* The format of the written PxVec4 is as follows (gradX, gradY, gradZ, sdfDistance)
|
||||
* shapeIndices[length: 3]
|
||||
* The content is {2, 4, 6} which are the shape indices for this example
|
||||
* localSamplePointsConcatenated[length: 3 * 30]:
|
||||
* Slice 0...29 has only the first 10 elements set to local sample points (w component is unused) with respect to the coordinate frame of the first shape to be queried
|
||||
* Slice 30...59 has only the first 20 elements set to local sample points (w component is unused) with respect to the coordinate frame of the second shape to be queried
|
||||
* Slice 60...89 has all 30 elements set to local sample points (w component is unused) with respect to the coordinate frame of the third shape to be queried
|
||||
* samplePointCountPerShape[length: 3]
|
||||
* The content is {10, 20, 30} which are the number of samples to evaluate per shape used in this example. Note that the slice size (=maxPointCount) is the maximum value in this list.
|
||||
* nbElements: 3 for this example since 3 shapes are participating in the query
|
||||
* maxPointCount: 30 for this example since 30 is the slice size (= maxPointCount = 30 = max(10, 20, 30))
|
||||
|
||||
\return bool Whether the operation was successful. Note that this might not include asynchronous CUDA errors.
|
||||
*/
|
||||
virtual bool evaluateSDFDistances(PxVec4* localGradientAndSignedDistanceConcatenated, const PxShapeGPUIndex* shapeIndices, const PxVec4* localSamplePointsConcatenated, const PxU32* samplePointCountPerShape, PxU32 nbElements, PxU32 maxPointCount, CUevent startEvent = NULL, CUevent finishEvent = NULL) const = 0;
|
||||
|
||||
/**
|
||||
\brief Get the maximal articulation index and component counts for a PxScene.
|
||||
|
||||
Get the maximal articulation index and component counts for a PxScene. This is a helper function to ease the derivation of the correct data layout
|
||||
for the articulation functions in PxDirectGPUAPI. Specifically, this function will return maxLinks, maxDofs, maxFixedTendons, maxFixedTendonJoints,
|
||||
maxSpatialTendons and maxSpatialTendonAttachments for a scene. See #PxArticulationGPUAPIMaxCounts.
|
||||
|
||||
\see PxDirectGPUAPI::getArticulationData, PxDirectGPUAPI::setArticulationData, PxDirectGPUAPI::computeArticulationData
|
||||
|
||||
\return PxArticulationGPUAPIMaxCounts the max counts across the scene for all articulation indices and components.
|
||||
*/
|
||||
virtual PxArticulationGPUAPIMaxCounts getArticulationGPUAPIMaxCounts() const = 0;
|
||||
|
||||
/**
|
||||
\brief Copies the simulation state for a set of PxD6Joint instances into a user-provided GPU data buffer.
|
||||
|
||||
\param[out] data User-provided GPU data buffer which has size nbElements * sizeof(type). For the types, see the options in #PxD6JointGPUAPIReadType.
|
||||
\param[in] gpuIndices User-provided GPU index buffer containing elements of PxD6JointGPUIndex. This buffer contains the GPU indices of the PxD6Joint objects that are part of this get operation
|
||||
(see #PxD6Joint::getGPUIndex()). The size of this buffer needs to be nbElements * sizeof(PxD6JointGPUIndex). The data requested for the PxD6Joint with its GPU index at position x in the
|
||||
gpuIndices array will be located at position x in the data array.
|
||||
\param[in] dataType The type of data to get (see #PxD6JointGPUAPIReadType).
|
||||
\param[in] nbElements The number of provided GPU indices and as such the number of data entries that will be written to the provided GPU data buffer.
|
||||
\param[in] startEvent User-provided CUDA event that is awaited at the start of this function. Defaults to NULL which means the function will dispatch the copy immediately.
|
||||
\param[in] finishEvent User-provided CUDA event that is recorded at the end of this function. Defaults to NULL which means the function will wait for the copy to finish before returning.
|
||||
|
||||
\return bool Whether the operation was successful. Note that this might not include asynchronous CUDA errors.
|
||||
|
||||
*/
|
||||
virtual bool getD6JointData(void* data, const PxD6JointGPUIndex* gpuIndices, PxD6JointGPUAPIReadType::Enum dataType, PxU32 nbElements, CUevent startEvent = NULL, CUevent finishEvent = NULL) const = 0;
|
||||
};
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
49
engine/third_party/physx/include/PxFEMMaterial.h
vendored
Normal file
49
engine/third_party/physx/include/PxFEMMaterial.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
#include "PxDeformableMaterial.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
\brief Deprecated
|
||||
\see PxDeformableMaterial
|
||||
*/
|
||||
typedef PX_DEPRECATED PxDeformableMaterial PxFEMMaterial;
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif // PX_FEM_MATERIAL_H
|
||||
102
engine/third_party/physx/include/PxFEMParameter.h
vendored
Normal file
102
engine/third_party/physx/include/PxFEMParameter.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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 Deprecated. Set of parameters to control the sleeping and collision behavior of FEM based objects
|
||||
\deprecated See methods of PxDeformableBody.
|
||||
*/
|
||||
struct PX_DEPRECATED PxFEMParameters
|
||||
{
|
||||
public:
|
||||
/**
|
||||
\brief Velocity damping value. After every timestep the velocity is reduced while the magnitude of the reduction depends on velocityDamping
|
||||
<b>Default:</b> 0.05
|
||||
\deprecated See PxDeformableBody.setLinearDamping
|
||||
*/
|
||||
PX_DEPRECATED 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
|
||||
<b>Default:</b> 0.1
|
||||
\deprecated See PxDeformableBody.setSettlingThreshold
|
||||
*/
|
||||
PX_DEPRECATED 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
|
||||
<b>Default:</b> 0.05
|
||||
\deprecated See PxDeformableBody.setSleepThreshold
|
||||
*/
|
||||
PX_DEPRECATED PxReal sleepThreshold;
|
||||
/**
|
||||
\brief Damping value that damps the motion of bodies that move slow enough to be candidates for sleeping (see settlingThreshold)
|
||||
<b>Default:</b> 10
|
||||
\deprecated See PxDeformableBody.setSettlingDamping
|
||||
*/
|
||||
PX_DEPRECATED 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.
|
||||
<b>Default:</b> 0.1
|
||||
\deprecated See PxDeformableBody.setSelfCollisionFilterDistance
|
||||
*/
|
||||
PX_DEPRECATED PxReal selfCollisionFilterDistance;
|
||||
/**
|
||||
\brief Stress threshold to deactivate collision contacts in case the tetrahedron's stress magnitude exceeds the threshold
|
||||
<b>Default:</b> 0.9
|
||||
\deprecated See PxDeformableVolume.setSelfCollisionStressTolerance
|
||||
*/
|
||||
PX_DEPRECATED PxReal selfCollisionStressTolerance;
|
||||
|
||||
#if !PX_CUDA_COMPILER
|
||||
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
|
||||
56
engine/third_party/physx/include/PxFEMSoftBodyMaterial.h
vendored
Normal file
56
engine/third_party/physx/include/PxFEMSoftBodyMaterial.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
#include "PxDeformableVolumeMaterial.h"
|
||||
#include "PxFEMMaterial.h" // deprecated
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
\brief Deprecated
|
||||
\see PxDeformableVolumeMaterialModel
|
||||
*/
|
||||
typedef PX_DEPRECATED PxDeformableVolumeMaterialModel PxFEMSoftBodyMaterialModel;
|
||||
|
||||
/**
|
||||
\brief Deprecated
|
||||
\see PxDeformableVolumeMaterial
|
||||
*/
|
||||
typedef PX_DEPRECATED PxDeformableVolumeMaterial PxFEMSoftBodyMaterial;
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif // PX_FEM_SOFT_BODY_MATERIAL_H
|
||||
778
engine/third_party/physx/include/PxFiltering.h
vendored
Normal file
778
engine/third_party/physx/include/PxFiltering.h
vendored
Normal file
@@ -0,0 +1,778 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. 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
|
||||
|
||||
#include "PxPhysXConfig.h"
|
||||
#include "foundation/PxFlags.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
class PxActor;
|
||||
class PxShape;
|
||||
|
||||
/**
|
||||
\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
|
||||
|
||||
\note Only works with PGS solver, and only on CPU.
|
||||
|
||||
\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
|
||||
|
||||
\note Only works with PGS solver, and only on CPU.
|
||||
|
||||
\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
|
||||
|
||||
\note Only works with PGS solver, and only on CPU.
|
||||
|
||||
\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<PxPairFlag::Enum, PxU16> 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<PxFilterFlag::Enum, PxU16> 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
|
||||
{
|
||||
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 deformable surface
|
||||
\see PxDeformableSurface
|
||||
*/
|
||||
eDEFORMABLE_SURFACE,
|
||||
|
||||
/**
|
||||
\brief A deformable volume
|
||||
\see PxDeformableVolume
|
||||
*/
|
||||
eDEFORMABLE_VOLUME,
|
||||
|
||||
eSOFTBODY PX_DEPRECATED = eDEFORMABLE_VOLUME, //!< \deprecated
|
||||
|
||||
/**
|
||||
\brief A particle system
|
||||
\see PxParticleSystem
|
||||
*/
|
||||
ePARTICLESYSTEM,
|
||||
|
||||
//! \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),
|
||||
eCUSTOM_GEOMETRY = (1 << 6),
|
||||
|
||||
eNEXT_FREE = (1<<7) // Used internally
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
\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( PxU64 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( PxU64 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(PxU64& 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 = eSUPPRESS
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Struct for storing a particle/vertex - rigid filter pair with comparison operators
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
*/
|
||||
struct PX_DEPRECATED PxParticleRigidFilterPair
|
||||
{
|
||||
PX_CUDA_CALLABLE PxParticleRigidFilterPair() {}
|
||||
|
||||
PX_CUDA_CALLABLE PxParticleRigidFilterPair(const PxU64 id0, const PxU64 id1): mID0(id0), mID1(id1) {}
|
||||
|
||||
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
|
||||
60
engine/third_party/physx/include/PxForceMode.h
vendored
Normal file
60
engine/third_party/physx/include/PxForceMode.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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"
|
||||
|
||||
|
||||
#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
|
||||
740
engine/third_party/physx/include/PxImmediateMode.h
vendored
Normal file
740
engine/third_party/physx/include/PxImmediateMode.h
vendored
Normal file
@@ -0,0 +1,740 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. 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
|
||||
|
||||
#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, PxU32 nbContacts, 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 Deprecated, no longer used. Any value (including NULL) can be passed.
|
||||
\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 Deprecated, no longer used. Any value (including NULL) can be passed.
|
||||
\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,out] solverBody The bodies' linear and angular velocities
|
||||
\param [in,out] linearMotionVelocity The bodies' linear motion velocity array
|
||||
\param [in,out] 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, PxVec3* linearMotionVelocity, 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);
|
||||
|
||||
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[PxArticulationAxis::eCOUNT];
|
||||
PxArticulationJointType::Enum type;
|
||||
|
||||
void initData()
|
||||
{
|
||||
parentPose = PxTransform(PxIdentity);
|
||||
childPose = PxTransform(PxIdentity);
|
||||
frictionCoefficient = 0.05f;
|
||||
type = PxArticulationJointType::eUNDEFINED; // For root
|
||||
|
||||
for(PxU32 i=0;i<PxArticulationAxis::eCOUNT;i++)
|
||||
{
|
||||
motion[i] = PxArticulationMotion::eLOCKED;
|
||||
limits[i] = PxArticulationLimit(0.0f, 0.0f);
|
||||
drives[i] = PxArticulationDrive(0.0f, 0.0f, 0.0f);
|
||||
armature[i] = 0.0f;
|
||||
jointPos[i] = 0.0f;
|
||||
jointVel[i] = 0.0f;
|
||||
maxJointVelocity[i] = 100.0f;
|
||||
}
|
||||
PxMemSet(targetPos, 0xff, sizeof(PxReal)*PxArticulationAxis::eCOUNT);
|
||||
PxMemSet(targetVel, 0xff, sizeof(PxReal)*PxArticulationAxis::eCOUNT);
|
||||
}
|
||||
};
|
||||
|
||||
struct PxArticulationDataRC
|
||||
{
|
||||
PxArticulationFlags flags;
|
||||
};
|
||||
|
||||
struct PxArticulationLinkMutableDataRC
|
||||
{
|
||||
PxVec3 inverseInertia;
|
||||
float inverseMass;
|
||||
float linearDamping;
|
||||
float angularDamping;
|
||||
float maxLinearVelocitySq;
|
||||
float maxAngularVelocitySq;
|
||||
float cfmScale;
|
||||
bool disableGravity;
|
||||
|
||||
void initData()
|
||||
{
|
||||
inverseInertia = PxVec3(1.0f);
|
||||
inverseMass = 1.0f;
|
||||
linearDamping = 0.05f;
|
||||
angularDamping = 0.05f;
|
||||
maxLinearVelocitySq = 100.0f * 100.0f;
|
||||
maxAngularVelocitySq = 50.0f * 50.0f;
|
||||
cfmScale = 0.025f;
|
||||
disableGravity = false;
|
||||
}
|
||||
};
|
||||
|
||||
struct PxArticulationLinkDerivedDataRC
|
||||
{
|
||||
PxTransform pose;
|
||||
PxVec3 linearVelocity;
|
||||
PxVec3 angularVelocity;
|
||||
};
|
||||
|
||||
struct PxArticulationLinkDataRC : PxArticulationLinkMutableDataRC
|
||||
{
|
||||
PxArticulationLinkDataRC() { PxArticulationLinkDataRC::initData(); }
|
||||
|
||||
void initData()
|
||||
{
|
||||
pose = PxTransform(PxIdentity);
|
||||
|
||||
PxArticulationLinkMutableDataRC::initData();
|
||||
inboundJoint.initData();
|
||||
}
|
||||
|
||||
PxArticulationJointDataRC inboundJoint;
|
||||
PxTransform pose;
|
||||
};
|
||||
|
||||
typedef void* PxArticulationCookie;
|
||||
|
||||
struct PxArticulationLinkCookie
|
||||
{
|
||||
PxArticulationCookie articulation;
|
||||
PxU32 linkId;
|
||||
};
|
||||
|
||||
struct PxCreateArticulationLinkCookie : PxArticulationLinkCookie
|
||||
{
|
||||
PX_FORCE_INLINE PxCreateArticulationLinkCookie(PxArticulationCookie art=NULL, PxU32 id=0xffffffff)
|
||||
{
|
||||
articulation = art;
|
||||
linkId = id;
|
||||
}
|
||||
};
|
||||
|
||||
struct PxArticulationLinkHandle
|
||||
{
|
||||
PX_FORCE_INLINE PxArticulationLinkHandle(PxArticulationHandle art=NULL, PxU32 id=0xffffffff) : articulation(art), linkId(id) {}
|
||||
|
||||
PxArticulationHandle articulation;
|
||||
PxU32 linkId;
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Begin creation of an immediate-mode reduced-coordinate articulation.
|
||||
|
||||
Returned cookie must be used to add links to the articulation, and to complete creating the articulation.
|
||||
|
||||
The cookie is a temporary ID for the articulation, only valid until PxEndCreateArticulationRC is called.
|
||||
|
||||
\param [in] data Articulation data
|
||||
|
||||
\return Articulation cookie
|
||||
|
||||
\see PxAddArticulationLink PxEndCreateArticulationRC
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API PxArticulationCookie PxBeginCreateArticulationRC(const PxArticulationDataRC& data);
|
||||
|
||||
/**
|
||||
\brief Add a link to the articulation.
|
||||
|
||||
All links must be added before the articulation is completed. It is not possible to add a new link at runtime.
|
||||
|
||||
Returned cookie is a temporary ID for the link, only valid until PxEndCreateArticulationRC is called.
|
||||
|
||||
\param [in] articulation Cookie value returned by PxBeginCreateArticulationRC
|
||||
\param [in] parent Parent for the new link, or NULL if this is the root link
|
||||
\param [in] data Link data
|
||||
|
||||
\return Link cookie
|
||||
|
||||
\see PxBeginCreateArticulationRC PxEndCreateArticulationRC
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API PxArticulationLinkCookie PxAddArticulationLink(PxArticulationCookie articulation, const PxArticulationLinkCookie* parent, const PxArticulationLinkDataRC& data);
|
||||
|
||||
/**
|
||||
\brief End creation of an immediate-mode reduced-coordinate articulation.
|
||||
|
||||
This call completes the creation of the articulation. All involved cookies become unsafe to use after that point.
|
||||
|
||||
The links are actually created in this function, and it returns the actual link handles to users. The given buffer should be large enough
|
||||
to contain as many links as created between the PxBeginCreateArticulationRC & PxEndCreateArticulationRC calls, i.e.
|
||||
if N calls were made to PxAddArticulationLink, the buffer should be large enough to contain N handles.
|
||||
|
||||
\param [in] articulation Cookie value returned by PxBeginCreateArticulationRC
|
||||
\param [out] linkHandles Articulation link handles of all created articulation links
|
||||
\param [in] bufferSize Size of linkHandles buffer. Must match internal expected number of articulation links.
|
||||
|
||||
\return Articulation handle, or NULL if creation failed
|
||||
|
||||
\see PxAddArticulationLink PxEndCreateArticulationRC
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API PxArticulationHandle PxEndCreateArticulationRC(PxArticulationCookie articulation, PxArticulationLinkHandle* linkHandles, PxU32 bufferSize);
|
||||
|
||||
/**
|
||||
\brief Releases an immediate-mode reduced-coordinate articulation.
|
||||
\param [in] articulation Articulation handle
|
||||
|
||||
\see PxCreateFeatherstoneArticulation
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API void PxReleaseArticulation(PxArticulationHandle articulation);
|
||||
|
||||
/**
|
||||
\brief Creates an articulation cache.
|
||||
\param [in] articulation Articulation handle
|
||||
\return Articulation cache
|
||||
|
||||
\see PxReleaseArticulationCache
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API PxArticulationCache* PxCreateArticulationCache(PxArticulationHandle articulation);
|
||||
|
||||
/**
|
||||
\brief Copy the internal data of the articulation to the cache
|
||||
\param[in] articulation Articulation handle.
|
||||
\param[in] cache Articulation data
|
||||
\param[in] flag Indicates which values of the articulation system are copied to the cache
|
||||
|
||||
\see createCache PxApplyArticulationCache
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API void PxCopyInternalStateToArticulationCache(PxArticulationHandle articulation, PxArticulationCache& cache, PxArticulationCacheFlags flag);
|
||||
|
||||
/**
|
||||
\brief Apply the user defined data in the cache to the articulation system
|
||||
\param[in] articulation Articulation handle.
|
||||
\param[in] cache Articulation data.
|
||||
\param[in] flag Defines which values in the cache will be applied to the articulation
|
||||
|
||||
\see createCache PxCopyInternalStateToArticulationCache
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API void PxApplyArticulationCache(PxArticulationHandle articulation, PxArticulationCache& cache, PxArticulationCacheFlags flag);
|
||||
|
||||
/**
|
||||
\brief Release an articulation cache
|
||||
|
||||
\param[in] cache The cache to release
|
||||
|
||||
\see PxCreateArticulationCache PxCopyInternalStateToArticulationCache PxCopyInternalStateToArticulationCache
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API void PxReleaseArticulationCache(PxArticulationCache& cache);
|
||||
|
||||
/**
|
||||
\brief Retrieves non-mutable link data from a link handle.
|
||||
The data here is computed by the articulation code but cannot be directly changed by users.
|
||||
\param [in] link Link handle
|
||||
\param [out] data Link data
|
||||
\return True if success
|
||||
|
||||
\see PxGetAllLinkData
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API bool PxGetLinkData(const PxArticulationLinkHandle& link, PxArticulationLinkDerivedDataRC& data);
|
||||
|
||||
/**
|
||||
\brief Retrieves non-mutable link data from an articulation handle (all links).
|
||||
The data here is computed by the articulation code but cannot be directly changed by users.
|
||||
\param [in] articulation Articulation handle
|
||||
\param [out] data Link data for N links, or NULL to just retrieve the number of links.
|
||||
\return Number of links in the articulation = number of link data structure written to the data array.
|
||||
|
||||
\see PxGetLinkData
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API PxU32 PxGetAllLinkData(const PxArticulationHandle articulation, PxArticulationLinkDerivedDataRC* data);
|
||||
|
||||
/**
|
||||
\brief Retrieves mutable link data from a link handle.
|
||||
\param [in] link Link handle
|
||||
\param [out] data Data for this link
|
||||
\return True if success
|
||||
|
||||
\see PxSetMutableLinkData
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API bool PxGetMutableLinkData(const PxArticulationLinkHandle& link, PxArticulationLinkMutableDataRC& data);
|
||||
|
||||
/**
|
||||
\brief Sets mutable link data for given link.
|
||||
\param [in] link Link handle
|
||||
\param [in] data Data for this link
|
||||
\return True if success
|
||||
|
||||
\see PxGetMutableLinkData
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API bool PxSetMutableLinkData(const PxArticulationLinkHandle& link, const PxArticulationLinkMutableDataRC& data);
|
||||
|
||||
/**
|
||||
\brief Retrieves joint data from a link handle.
|
||||
\param [in] link Link handle
|
||||
\param [out] data Joint data for this link
|
||||
\return True if success
|
||||
|
||||
\see PxSetJointData
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API bool PxGetJointData(const PxArticulationLinkHandle& link, PxArticulationJointDataRC& data);
|
||||
|
||||
/**
|
||||
\brief Sets joint data for given link.
|
||||
\param [in] link Link handle
|
||||
\param [in] data Joint data for this link
|
||||
\return True if success
|
||||
|
||||
\see PxGetJointData
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API bool PxSetJointData(const PxArticulationLinkHandle& link, const PxArticulationJointDataRC& data);
|
||||
|
||||
/**
|
||||
\brief Computes unconstrained velocities for a given articulation.
|
||||
\param [in] articulation Articulation handle
|
||||
\param [in] gravity Gravity vector
|
||||
\param [in] dt Timestep
|
||||
\param [in] invLengthScale 1/lengthScale from PxTolerancesScale.
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API void PxComputeUnconstrainedVelocities(PxArticulationHandle articulation, const PxVec3& gravity, PxReal dt, PxReal invLengthScale);
|
||||
|
||||
/**
|
||||
\brief Updates bodies for a given articulation.
|
||||
\param [in] articulation Articulation handle
|
||||
\param [in] dt Timestep
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API void PxUpdateArticulationBodies(PxArticulationHandle articulation, PxReal dt);
|
||||
|
||||
/**
|
||||
\brief Computes unconstrained velocities for a given articulation.
|
||||
\param [in] articulation Articulation handle
|
||||
\param [in] gravity Gravity vector
|
||||
\param [in] dt Timestep/numPosIterations
|
||||
\param [in] totalDt Timestep
|
||||
\param [in] invDt 1/(Timestep/numPosIterations)
|
||||
\param [in] invTotalDt 1/Timestep
|
||||
\param [in] invLengthScale 1/lengthScale from PxTolerancesScale.
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API void PxComputeUnconstrainedVelocitiesTGS( PxArticulationHandle articulation, const PxVec3& gravity, PxReal dt,
|
||||
PxReal totalDt, PxReal invDt, PxReal invTotalDt, PxReal invLengthScale);
|
||||
|
||||
/**
|
||||
\brief Updates bodies for a given articulation.
|
||||
\param [in] articulation Articulation handle
|
||||
\param [in] dt Timestep
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API void PxUpdateArticulationBodiesTGS(PxArticulationHandle articulation, PxReal dt);
|
||||
|
||||
/**
|
||||
\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] outSolverBodyVel The array of PxTGSSolverBodyVel structures produced to represent these bodies
|
||||
\param [out] outSolverBodyTxInertia The array of PxTGSSolverBodyTxInertia produced to represent these bodies
|
||||
\param [out] outSolverBodyData The array of PxTGSolverBodyData 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 PxConstructSolverBodiesTGS(const PxRigidBodyData* inRigidData, PxTGSSolverBodyVel* outSolverBodyVel, PxTGSSolverBodyTxInertia* outSolverBodyTxInertia, PxTGSSolverBodyData* 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] solverBodyVel The velocity component of this body (will be zero)
|
||||
\param [out] solverBodyTxInertia The intertia and transform delta component of this body (will be zero)
|
||||
\param [out] solverBodyData The solver body representation of this static actor
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API void PxConstructStaticSolverBodyTGS(const PxTransform& globalPose, PxTGSSolverBodyVel& solverBodyVel, PxTGSSolverBodyTxInertia& solverBodyTxInertia, PxTGSSolverBodyData& 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 PxBatchConstraintsTGS( const PxSolverConstraintDesc* solverConstraintDescs, PxU32 nbConstraints, PxTGSSolverBodyVel* 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/nbPositionIterations
|
||||
\param [in] invTotalDt The inverse time-step
|
||||
\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.
|
||||
|
||||
\return a boolean to define if this method was successful or not.
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API bool PxCreateContactConstraintsTGS( PxConstraintBatchHeader* batchHeaders, PxU32 nbHeaders, PxTGSSolverContactDesc* contactDescs,
|
||||
PxConstraintAllocator& allocator, PxReal invDt, PxReal invTotalDt, PxReal bounceThreshold,
|
||||
PxReal frictionOffsetThreshold, PxReal correlationDistance);
|
||||
|
||||
/**
|
||||
\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 total time-step/nbPositionIterations
|
||||
\param [in] totalDt The total time-step
|
||||
\param [in] invDt The inverse (timestep/nbPositionIterations)
|
||||
\param [in] invTotalDt The inverse total time-step
|
||||
\param [in] lengthScale PxToleranceScale::length, i.e. a meter in simulation units
|
||||
\return a boolean indicating if this method was successful or not.
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API bool PxCreateJointConstraintsTGS( PxConstraintBatchHeader* batchHeaders, PxU32 nbHeaders,
|
||||
PxTGSSolverConstraintPrepDesc* jointDescs, PxConstraintAllocator& allocator, PxReal dt, PxReal totalDt, PxReal invDt,
|
||||
PxReal invTotalDt, PxReal lengthScale);
|
||||
|
||||
/**
|
||||
\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 total time-step/nbPositionIterations
|
||||
\param [in] totalDt The total time-step
|
||||
\param [in] invDt The inverse (timestep/nbPositionIterations)
|
||||
\param [in] invTotalDt The inverse total time-step
|
||||
\param [in] lengthScale PxToleranceScale::length, i.e. a meter in simulation units
|
||||
\return a boolean indicating if this method was successful or not.
|
||||
\see PxCreateJointConstraints
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API bool PxCreateJointConstraintsWithShadersTGS( PxConstraintBatchHeader* batchHeaders, PxU32 nbBatchHeaders, PxConstraint** constraints, PxTGSSolverConstraintPrepDesc* jointDescs, PxConstraintAllocator& allocator,
|
||||
PxReal dt, PxReal totalDt, PxReal invDt, PxReal invTotalDt, PxReal lengthScale);
|
||||
|
||||
/**
|
||||
\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 total time-step/nbPositionIterations
|
||||
\param [in] totalDt The total time-step
|
||||
\param [in] invDt The inverse (timestep/nbPositionIterations)
|
||||
\param [in] invTotalDt The inverse total time-step
|
||||
\param [in] lengthScale PxToleranceScale::length, i.e. a meter in simulation units
|
||||
\return a boolean indicating if this method was successful or not.
|
||||
\see PxCreateJointConstraints
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API bool PxCreateJointConstraintsWithImmediateShadersTGS(PxConstraintBatchHeader* batchHeaders, PxU32 nbBatchHeaders, PxImmediateConstraint* constraints, PxTGSSolverConstraintPrepDesc* jointDescs,
|
||||
PxConstraintAllocator& allocator, PxReal dt, PxReal totalDt, PxReal invDt, PxReal invTotalDt, PxReal lengthScale);
|
||||
|
||||
/**
|
||||
\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 [in,out] txInertias The set of solver body TxInertias the bodies reference
|
||||
\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 time-step/nbPositionIterations
|
||||
\param [in] invDt 1/(time-step/nbPositionIterations)
|
||||
\param [in] nbSolverArticulations Number of articulations to solve constraints for.
|
||||
\param [in] solverArticulations Array of articulations to solve constraints for.
|
||||
\param [out] Z Deprecated, no longer used. Any value (including NULL) can be passed.
|
||||
\param [out] deltaV Temporary buffer for velocity change (only if articulations are used, size should be at least as large as the maximum number of links in any articulations being simulated)
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API void PxSolveConstraintsTGS( const PxConstraintBatchHeader* batchHeaders, PxU32 nbBatchHeaders, const PxSolverConstraintDesc* solverConstraintDescs,
|
||||
PxTGSSolverBodyVel* solverBodies, PxTGSSolverBodyTxInertia* txInertias, PxU32 nbSolverBodies, PxU32 nbPositionIterations, PxU32 nbVelocityIterations,
|
||||
float dt, float invDt, 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, solverBody stores all the body's velocity data.
|
||||
|
||||
\param [in,out] solverBody The array of solver bodies to be integrated
|
||||
\param [in] txInertia The delta pose and inertia terms
|
||||
\param [in,out] poses The original poses of the bodies. Updated to be the new poses of the bodies
|
||||
\param [in] nbBodiesToIntegrate The total number of bodies to integrate
|
||||
\param [in] dt The timestep
|
||||
*/
|
||||
PX_C_EXPORT PX_PHYSX_CORE_API void PxIntegrateSolverBodiesTGS(PxTGSSolverBodyVel* solverBody, const PxTGSSolverBodyTxInertia* txInertia, PxTransform* poses, PxU32 nbBodiesToIntegrate, PxReal dt);
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
348
engine/third_party/physx/include/PxIsosurfaceExtraction.h
vendored
Normal file
348
engine/third_party/physx/include/PxIsosurfaceExtraction.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PX_ISOSURFACE_EXTRACTION_H
|
||||
#define PX_ISOSURFACE_EXTRACTION_H
|
||||
|
||||
|
||||
#include "cudamanager/PxCudaContext.h"
|
||||
#include "cudamanager/PxCudaContextManager.h"
|
||||
|
||||
#include "foundation/PxSimpleTypes.h"
|
||||
#include "foundation/PxVec4.h"
|
||||
#include "PxParticleSystem.h"
|
||||
|
||||
#include "PxSparseGridParams.h"
|
||||
|
||||
#include "foundation/PxArray.h"
|
||||
#include "PxParticleGpu.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
#if PX_SUPPORT_GPU_PHYSX
|
||||
|
||||
/**
|
||||
\brief Identifies filter type to be applied on the isosurface grid.
|
||||
*/
|
||||
struct PxIsosurfaceGridFilteringType
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eNONE = 0, //!< No filtering
|
||||
eSMOOTH = 1, //!< Gaussian-blur-like filtering
|
||||
eGROW = 2, //!< A dilate/erode operation will be applied that makes the fluid grow approximately one cell size
|
||||
eSHRINK = 3 //!< A dilate/erode operation will be applied that makes the fluid shrink approximately one cell size
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Parameters to define the isosurface extraction settings like isosurface level, filtering etc.
|
||||
*/
|
||||
struct PxIsosurfaceParams
|
||||
{
|
||||
/**
|
||||
\brief Default constructor.
|
||||
*/
|
||||
PX_INLINE PxIsosurfaceParams()
|
||||
{
|
||||
particleCenterToIsosurfaceDistance = 0.2f;
|
||||
numMeshSmoothingPasses = 4;
|
||||
numMeshNormalSmoothingPasses = 4;
|
||||
gridFilteringFlags = 0;
|
||||
gridSmoothingRadius = 0.2f;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Clears the filtering operations
|
||||
*/
|
||||
PX_INLINE void clearFilteringPasses()
|
||||
{
|
||||
gridFilteringFlags = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Adds a smoothing pass after the existing ones
|
||||
|
||||
At most 32 smoothing passes can be defined. Every pass can repeat itself up to 4 times.
|
||||
|
||||
\param[in] operation The smoothing operation to add
|
||||
\return The index of the smoothing pass that was added
|
||||
*/
|
||||
PX_INLINE PxU64 addGridFilteringPass(PxIsosurfaceGridFilteringType::Enum operation)
|
||||
{
|
||||
for (PxU32 i = 0; i < 32; ++i)
|
||||
{
|
||||
PxIsosurfaceGridFilteringType::Enum o;
|
||||
if (!getGridFilteringPass(i, o))
|
||||
{
|
||||
setGridFilteringPass(i, operation);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0xFFFFFFFFFFFFFFFF;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Sets the operation of a smoothing pass
|
||||
|
||||
\param[in] passIndex The index of the smoothing pass whose operation should be set <b>Range:</b> [0, 31]
|
||||
\param[in] operation The operation the modified smoothing will perform
|
||||
*/
|
||||
PX_INLINE void setGridFilteringPass(PxU32 passIndex, PxIsosurfaceGridFilteringType::Enum operation)
|
||||
{
|
||||
PX_ASSERT(passIndex < 32u);
|
||||
PxU32 shift = passIndex * 2;
|
||||
gridFilteringFlags &= ~(PxU64(3) << shift);
|
||||
gridFilteringFlags |= PxU64(operation) << shift;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Returns the operation of a smoothing pass
|
||||
|
||||
\param[in] passIndex The index of the smoothing pass whose operation is requested <b>Range:</b> [0, 31]
|
||||
\param[out] operation The operation the requested smoothing pass will perform
|
||||
\return true if the requested pass performs an operation
|
||||
*/
|
||||
PX_INLINE bool getGridFilteringPass(PxU32 passIndex, PxIsosurfaceGridFilteringType::Enum& operation) const
|
||||
{
|
||||
PxU32 shift = passIndex * 2;
|
||||
PxU64 v = gridFilteringFlags >> shift;
|
||||
v &= 3; //Extract last 2 bits
|
||||
operation = PxIsosurfaceGridFilteringType::Enum(v);
|
||||
return operation != PxIsosurfaceGridFilteringType::eNONE;
|
||||
}
|
||||
|
||||
PxReal particleCenterToIsosurfaceDistance; //!< Distance form a particle center to the isosurface
|
||||
PxU32 numMeshSmoothingPasses; //!< Number of Taubin mesh postprocessing smoothing passes. Using an even number of passes lead to less shrinking.
|
||||
PxU32 numMeshNormalSmoothingPasses; //!< Number of mesh normal postprocessing smoothing passes.
|
||||
PxU64 gridFilteringFlags; //!< Encodes the smoothing steps to apply on the sparse grid. Use setGridSmoothingPass method to set up.
|
||||
PxReal gridSmoothingRadius; //!< Gaussian blur smoothing kernel radius used for smoothing operations on the grid
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Base class for isosurface extractors. Allows to register the data arrays for the isosurface and to obtain the number vertices/triangles in use.
|
||||
*/
|
||||
class PxIsosurfaceExtractor
|
||||
{
|
||||
public:
|
||||
/**
|
||||
\brief Returns the isosurface parameters.
|
||||
|
||||
\return The isosurfacesettings used for the isosurface extraction
|
||||
*/
|
||||
virtual PxIsosurfaceParams getIsosurfaceParams() const = 0;
|
||||
|
||||
/**
|
||||
\brief Set the isosurface extraction parameters
|
||||
|
||||
Allows to configure the isosurface extraction by controlling threshold value, smoothing options etc.
|
||||
|
||||
\param[in] params A collection of settings to control the isosurface extraction
|
||||
*/
|
||||
virtual void setIsosurfaceParams(const PxIsosurfaceParams& params) = 0;
|
||||
|
||||
/**
|
||||
\brief Returns the number of vertices that the current isosurface triangle mesh uses
|
||||
|
||||
\return The number of vertices currently in use
|
||||
*/
|
||||
virtual PxU32 getNumVertices() const = 0;
|
||||
|
||||
/**
|
||||
\brief Returns the number of triangles that the current isosurface triangle mesh uses
|
||||
|
||||
\return The number of triangles currently in use
|
||||
*/
|
||||
virtual PxU32 getNumTriangles() const = 0;
|
||||
|
||||
/**
|
||||
\brief Returns the maximum number of vertices that the isosurface triangle mesh can contain
|
||||
|
||||
\return The maximum number of vertices that can be genrated
|
||||
*/
|
||||
virtual PxU32 getMaxVertices() const = 0;
|
||||
|
||||
/**
|
||||
\brief Returns the maximum number of triangles that the isosurface triangle mesh can contain
|
||||
|
||||
\return The maximum number of triangles that can be generated
|
||||
*/
|
||||
virtual PxU32 getMaxTriangles() const = 0;
|
||||
|
||||
/**
|
||||
\brief Resizes the internal triangle mesh buffers.
|
||||
|
||||
If the output buffers are device buffers, nothing will get resized but new output buffers can be set using setResultBufferDevice.
|
||||
For host side output buffers, temporary buffers will get resized. The new host side result buffers with the same size must be set using setResultBufferHost.
|
||||
|
||||
\param[in] maxNumVertices The maximum number of vertices the output buffer can hold
|
||||
\param[in] maxNumTriangles The maximum number of triangles the ouput buffer can hold
|
||||
*/
|
||||
virtual void setMaxVerticesAndTriangles(PxU32 maxNumVertices, PxU32 maxNumTriangles) = 0;
|
||||
|
||||
/**
|
||||
\brief The maximal number of particles the isosurface extractor can process
|
||||
|
||||
\return The maximal number of particles
|
||||
*/
|
||||
virtual PxU32 getMaxParticles() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the maximal number of particles the isosurface extractor can process
|
||||
|
||||
\param[in] maxParticles The maximal number of particles
|
||||
*/
|
||||
virtual void setMaxParticles(PxU32 maxParticles) = 0;
|
||||
|
||||
/**
|
||||
\brief Releases the isosurface extractor instance and its data
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
|
||||
/**
|
||||
\brief Triggers the compuation of a new isosurface based on the specified particle locations
|
||||
|
||||
\param[in] deviceParticlePos A gpu pointer pointing to the start of the particle array
|
||||
\param[in] numParticles The number of particles
|
||||
\param[in] stream The stream on which all the gpu work will be performed
|
||||
\param[in] phases A phase value per particle
|
||||
\param[in] validPhaseMask A mask that specifies which phases should contribute to the isosurface. If the binary and operation
|
||||
between this mask and the particle phase is non zero, then the particle will contribute to the isosurface
|
||||
\param[in] activeIndices Optional array with indices of all active particles
|
||||
\param[in] anisotropy1 Optional anisotropy information, x axis direction (xyz) and scale in w component
|
||||
\param[in] anisotropy2 Optional anisotropy information, y axis direction (xyz) and scale in w component
|
||||
\param[in] anisotropy3 Optional anisotropy information, z axis direction (xyz) and scale in w component
|
||||
\param[in] anisotropyFactor A factor to multiply with the anisotropy scale
|
||||
*/
|
||||
virtual void extractIsosurface(PxVec4* deviceParticlePos, const PxU32 numParticles, CUstream stream, PxU32* phases = NULL, PxU32 validPhaseMask = PxParticlePhaseFlag::eParticlePhaseFluid,
|
||||
PxU32* activeIndices = NULL, PxVec4* anisotropy1 = NULL, PxVec4* anisotropy2 = NULL, PxVec4* anisotropy3 = NULL, PxReal anisotropyFactor = 1.0f) = 0;
|
||||
|
||||
/**
|
||||
\brief Allows to register the host buffers into which the final isosurface triangle mesh will get stored
|
||||
|
||||
\param[in] vertices A host buffer to store the vertices of the isosurface mesh
|
||||
\param[in] triIndices A host buffer to store the triangles of the isosurface mesh
|
||||
\param[in] normals A host buffer to store the normals of the isosurface mesh
|
||||
*/
|
||||
virtual void setResultBufferHost(PxVec4* vertices, PxU32* triIndices, PxVec4* normals = NULL) = 0;
|
||||
|
||||
/**
|
||||
\brief Allows to register the host buffers into which the final isosurface triangle mesh will get stored
|
||||
|
||||
\param[in] vertices A device buffer to store the vertices of the isosurface mesh
|
||||
\param[in] triIndices A device buffer to store the triangles of the isosurface mesh
|
||||
\param[in] normals A device buffer to store the normals of the isosurface mesh
|
||||
*/
|
||||
virtual void setResultBufferDevice(PxVec4* vertices, PxU32* triIndices, PxVec4* normals) = 0;
|
||||
|
||||
/**
|
||||
\brief Enables or disables the isosurface extractor
|
||||
|
||||
\param[in] enabled The boolean to set the extractor to enabled or disabled
|
||||
*/
|
||||
virtual void setEnabled(bool enabled) = 0;
|
||||
|
||||
/**
|
||||
\brief Allows to query if the isosurface extractor is enabled
|
||||
|
||||
\return True if enabled, false otherwise
|
||||
*/
|
||||
virtual bool isEnabled() const = 0;
|
||||
|
||||
/**
|
||||
\brief Destructor
|
||||
*/
|
||||
virtual ~PxIsosurfaceExtractor() {}
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Base class for sparse grid based isosurface extractors. Allows to register the data arrays for the isosurface and to obtain the number vertices/triangles in use.
|
||||
*/
|
||||
class PxSparseGridIsosurfaceExtractor : public PxIsosurfaceExtractor
|
||||
{
|
||||
/**
|
||||
\brief Returns the sparse grid parameters.
|
||||
|
||||
\return The sparse grid settings used for the isosurface extraction
|
||||
*/
|
||||
virtual PxSparseGridParams getSparseGridParams() const = 0;
|
||||
|
||||
/**
|
||||
\brief Set the sparse grid parameters
|
||||
|
||||
Allows to configure cell size, number of subgrids etc.
|
||||
|
||||
\param[in] params A collection of settings to control the isosurface grid
|
||||
*/
|
||||
virtual void setSparseGridParams(const PxSparseGridParams& params) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Default implementation of a particle system callback to trigger the isosurface extraction. A call to fetchResultsParticleSystem() on the
|
||||
PxScene will synchronize the work such that the caller knows that the post solve task completed.
|
||||
*/
|
||||
class PxIsosurfaceCallback : public PxParticleSystemCallback
|
||||
{
|
||||
public:
|
||||
/**
|
||||
\brief Initializes the isosurface callback
|
||||
|
||||
\param[in] isosurfaceExtractor The isosurface extractor
|
||||
\param[in] validPhaseMask The valid phase mask marking the phase bits that particles must have set in order to contribute to the isosurface
|
||||
*/
|
||||
void initialize(PxIsosurfaceExtractor* isosurfaceExtractor, PxU32 validPhaseMask = PxParticlePhaseFlag::eParticlePhaseFluid)
|
||||
{
|
||||
mIsosurfaceExtractor = isosurfaceExtractor;
|
||||
mValidPhaseMask = validPhaseMask;
|
||||
}
|
||||
|
||||
virtual void onPostSolve(const PxGpuMirroredPointer<PxGpuParticleSystem>& gpuParticleSystem, CUstream stream)
|
||||
{
|
||||
mIsosurfaceExtractor->extractIsosurface(reinterpret_cast<PxVec4*>(gpuParticleSystem.mHostPtr->mUnsortedPositions_InvMass),
|
||||
gpuParticleSystem.mHostPtr->mCommonData.mMaxParticles, stream, gpuParticleSystem.mHostPtr->mUnsortedPhaseArray, mValidPhaseMask);
|
||||
}
|
||||
|
||||
virtual void onBegin(const PxGpuMirroredPointer<PxGpuParticleSystem>& /*gpuParticleSystem*/, CUstream /*stream*/) { }
|
||||
|
||||
virtual void onAdvance(const PxGpuMirroredPointer<PxGpuParticleSystem>& /*gpuParticleSystem*/, CUstream /*stream*/) { }
|
||||
|
||||
private:
|
||||
PxIsosurfaceExtractor* mIsosurfaceExtractor;
|
||||
PxU32 mValidPhaseMask;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
87
engine/third_party/physx/include/PxLockedData.h
vendored
Normal file
87
engine/third_party/physx/include/PxLockedData.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PX_LOCKED_DATA_H
|
||||
#define PX_LOCKED_DATA_H
|
||||
|
||||
#include "PxPhysXConfig.h"
|
||||
#include "foundation/PxFlags.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
struct PxDataAccessFlag
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eREADABLE = (1 << 0),
|
||||
eWRITABLE = (1 << 1),
|
||||
eDEVICE = (1 << 2)
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief collection of set bits defined in PxDataAccessFlag.
|
||||
|
||||
\see PxDataAccessFlag
|
||||
*/
|
||||
typedef PxFlags<PxDataAccessFlag::Enum,PxU8> 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
|
||||
372
engine/third_party/physx/include/PxMaterial.h
vendored
Normal file
372
engine/third_party/physx/include/PxMaterial.h
vendored
Normal file
@@ -0,0 +1,372 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. 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
|
||||
|
||||
#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 If this flag is raised in combination with negative restitution, the computed spring-damper output will be interpreted as
|
||||
acceleration instead of force targets, analog to acceleration spring constraints.
|
||||
The flag has no effect for non-compliant contacts (i.e., if restitution is nonnegative).
|
||||
In an interaction between a compliant-force and a compliant-acceleration body the latter will dominate.
|
||||
\see PxMaterial.setRestitution, PxMaterial.setDamping
|
||||
\see Px1DConstraintFlag.eACCELERATION_SPRING
|
||||
*/
|
||||
eCOMPLIANT_ACCELERATION_SPRING = 1 << 4
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief collection of set bits defined in PxMaterialFlag.
|
||||
|
||||
\see PxMaterialFlag
|
||||
*/
|
||||
typedef PxFlags<PxMaterialFlag::Enum,PxU16> 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).
|
||||
|
||||
Notes that the restitution coefficient is overloaded if it is negative and represents a spring stiffness for compliant contacts. In the compliant contact case, the following rules apply:
|
||||
* If a compliant (restitution < 0) material interacts with a rigid (restitution >= 0) material, the compliant behavior will be chosen independent
|
||||
of combine mode. In all other cases (i.e., also for compliant-compliant interactions) the combine mode is used.
|
||||
* For a compliant-compliant interaction with eMULTIPLY combine mode, we multiply the values but keep the sign negative.
|
||||
* The material damping follows the same logic, i.e., for the compliant vs non-compliant case, we take the damping value of the compliant material. Otherwise the combine mode is respected.
|
||||
* In an interaction between a compliant-force and a compliant-acceleration body the latter will dominate and exclusively determine the collision behavior with its parameters.
|
||||
|
||||
\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.
|
||||
|
||||
<b>Sleeping:</b> Does <b>NOT</b> wake any actors which may be affected.
|
||||
|
||||
\param[in] coef Coefficient of dynamic friction. <b>Range:</b> [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)
|
||||
|
||||
<b>Sleeping:</b> Does <b>NOT</b> wake any actors which may be affected.
|
||||
|
||||
\param[in] coef Coefficient of static friction. <b>Range:</b> [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 or the spring stiffness for compliant contact
|
||||
|
||||
A coefficient of 0 makes the object bounce as little as possible, higher values up to 1.0 result in more bounce.
|
||||
If a negative value is provided it is interpreted as stiffness term 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.
|
||||
|
||||
<b>Sleeping:</b> Does <b>NOT</b> wake any actors which may be affected.
|
||||
|
||||
\param[in] rest Coefficient of restitution / negative spring stiffness <b>Range:</b> (-INF,1]
|
||||
|
||||
\see getRestitution() setDamping()
|
||||
*/
|
||||
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 compliant contact mode is enabled, i.e., a negative restitution value is set.
|
||||
Damping works together with spring stiffness. Spring stiffness corrects positional error while
|
||||
damping resists relative velocity. Setting a high damping coefficient can produce spongy contacts.
|
||||
|
||||
<b>Sleeping:</b> Does <b>NOT</b> wake any actors which may be affected.
|
||||
|
||||
\param[in] damping Coefficient of damping. <b>Range:</b> [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
|
||||
|
||||
<b>Default:</b> No flag raised.
|
||||
|
||||
<b>Sleeping:</b> Does <b>NOT</b> 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
|
||||
|
||||
<b>Default:</b> No flag raised.
|
||||
|
||||
<b>Sleeping:</b> Does <b>NOT</b> 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 .
|
||||
|
||||
<b>Default:</b> PxCombineMode::eAVERAGE
|
||||
|
||||
<b>Sleeping:</b> Does <b>NOT</b> 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 .
|
||||
|
||||
<b>Default:</b> PxCombineMode::eAVERAGE
|
||||
|
||||
<b>Sleeping:</b> Does <b>NOT</b> 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;
|
||||
|
||||
/**
|
||||
\brief Sets the damping combine mode.
|
||||
|
||||
See the enum ::PxCombineMode .
|
||||
|
||||
<b>Default:</b> PxCombineMode::eAVERAGE
|
||||
|
||||
<b>Sleeping:</b> Does <b>NOT</b> wake any actors which may be affected.
|
||||
|
||||
\param[in] combMode Damping combine mode for this material. See #PxCombineMode.
|
||||
|
||||
\see PxCombineMode getDampingCombineMode() setDamping()
|
||||
*/
|
||||
virtual void setDampingCombineMode(PxCombineMode::Enum combMode) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves the damping combine mode.
|
||||
|
||||
\return The damping combine mode for this material.
|
||||
|
||||
\see PxCombineMode setDampingCombineMode() getDamping()
|
||||
*/
|
||||
virtual PxCombineMode::Enum getDampingCombineMode() const = 0;
|
||||
|
||||
// PxBase
|
||||
virtual const char* getConcreteTypeName() const PX_OVERRIDE PX_FINAL { 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 { PX_IS_KIND_OF(name, "PxMaterial", PxBaseMaterial); }
|
||||
};
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
102
engine/third_party/physx/include/PxNodeIndex.h
vendored
Normal file
102
engine/third_party/physx/include/PxNodeIndex.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
{
|
||||
struct IDs
|
||||
{
|
||||
PxU32 mID;
|
||||
PxU32 mLinkID;
|
||||
};
|
||||
|
||||
union
|
||||
{
|
||||
IDs mIDs;
|
||||
PxU64 mInd;
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxNodeIndex(PxU32 id, PxU32 articLinkId)
|
||||
{
|
||||
setIndices(id, articLinkId);
|
||||
}
|
||||
|
||||
explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxNodeIndex(PxU32 id = PX_INVALID_NODE)
|
||||
{
|
||||
setIndices(id);
|
||||
}
|
||||
|
||||
explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxNodeIndex(PxU64 ind)
|
||||
{
|
||||
mInd = ind;
|
||||
}
|
||||
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 index() const { return mIDs.mID; }
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 articulationLinkId() const { return mIDs.mLinkID >> 1; }
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 isArticulation() const { return mIDs.mLinkID & 1; }
|
||||
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isStaticBody() const { return mIDs.mID == PX_INVALID_NODE; }
|
||||
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isValid() const { return mIDs.mID != PX_INVALID_NODE; }
|
||||
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE void setIndices(PxU32 index, PxU32 articLinkId) { mIDs.mID = index; mIDs.mLinkID = (articLinkId << 1) | 1; }
|
||||
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE void setIndices(PxU32 index) { mIDs.mID = index; mIDs.mLinkID = 0; }
|
||||
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE PxU64 getInd() const { return mInd; }
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator < (const PxNodeIndex& other) const { return getInd() < other.getInd(); }
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator <= (const PxNodeIndex& other) const { return getInd() <= other.getInd(); }
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator == (const PxNodeIndex& other) const { return getInd() == other.getInd(); }
|
||||
};
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
318
engine/third_party/physx/include/PxPBDMaterial.h
vendored
Normal file
318
engine/third_party/physx/include/PxPBDMaterial.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
#include "PxBaseMaterial.h"
|
||||
#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 PxPBDMaterial : public PxBaseMaterial
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
\brief Sets friction
|
||||
|
||||
\param[in] friction Friction. <b>Range:</b> [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. <b>Range:</b> [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. <b>Range:</b> [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. <b>Range:</b> (-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. <b>Range:</b> [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;
|
||||
|
||||
/**
|
||||
\brief Sets viscosity
|
||||
|
||||
\param[in] viscosity Viscosity. <b>Range:</b> [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. <b>Range:</b> [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. <b>Range:</b> [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. <b>Range:</b> [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
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
|
||||
\param[in] lift Material lift coefficient. <b>Range:</b> [0, PX_MAX_F32)
|
||||
|
||||
\see #getLift()
|
||||
*/
|
||||
PX_DEPRECATED virtual void setLift(PxReal lift) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves the lift coefficient.
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
|
||||
\return The lift coefficient.
|
||||
|
||||
\see #setLift()
|
||||
*/
|
||||
PX_DEPRECATED virtual PxReal getLift() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets material drag coefficient
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
|
||||
\param[in] drag Material drag coefficient. <b>Range:</b> [0, PX_MAX_F32)
|
||||
|
||||
\see #getDrag()
|
||||
*/
|
||||
PX_DEPRECATED virtual void setDrag(PxReal drag) = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves the drag coefficient.
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
|
||||
\return The drag coefficient.
|
||||
|
||||
\see #setDrag()
|
||||
*/
|
||||
PX_DEPRECATED virtual PxReal getDrag() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the CFL coefficient. Limits the relative motion between two approaching fluid particles.
|
||||
|
||||
The distance to which the motion is clamped is defined by CFLcoefficient*particleContactOffset*2.
|
||||
A value of 0.5 will thus limit the appoaching motion to a distance of particleContactOffset.
|
||||
A value much larger than one will typically not limit the motion of the particles.
|
||||
|
||||
\param[in] coefficient CFL coefficient. <b>Range:</b> [0, PX_MAX_F32), <b>Default:</b> 1.0
|
||||
|
||||
\see #getCFLCoefficient()
|
||||
*/
|
||||
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. <b>Range:</b> [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. <b>Range:</b> [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 PX_OVERRIDE PX_FINAL { return "PxPBDMaterial"; }
|
||||
|
||||
protected:
|
||||
PX_INLINE PxPBDMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxBaseMaterial(concreteType, baseFlags) {}
|
||||
PX_INLINE PxPBDMaterial(PxBaseFlags baseFlags) : PxBaseMaterial(baseFlags) {}
|
||||
virtual ~PxPBDMaterial() {}
|
||||
virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxPBDMaterial", PxBaseMaterial); }
|
||||
};
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
652
engine/third_party/physx/include/PxPBDParticleSystem.h
vendored
Normal file
652
engine/third_party/physx/include/PxPBDParticleSystem.h
vendored
Normal file
@@ -0,0 +1,652 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. 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
|
||||
|
||||
#include "foundation/PxSimpleTypes.h"
|
||||
#include "foundation/PxVec3.h"
|
||||
#include "foundation/PxArray.h"
|
||||
#include "cudamanager/PxCudaTypes.h"
|
||||
#include "PxParticleSystemFlag.h"
|
||||
#include "PxFiltering.h"
|
||||
#include "PxActor.h"
|
||||
#include "PxParticleSystem.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;
|
||||
|
||||
/**
|
||||
\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 <typename Type>
|
||||
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<PxGpuParticleSystem>& 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<PxGpuParticleSystem>& 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<PxGpuParticleSystem>& gpuParticleSystem, CUstream stream) = 0;
|
||||
|
||||
/**
|
||||
\brief Destructor
|
||||
*/
|
||||
virtual ~PxParticleSystemCallback() {}
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Special callback that forwards calls to arbitrarily many sub-callbacks
|
||||
*/
|
||||
class PxMultiCallback : public PxParticleSystemCallback
|
||||
{
|
||||
private:
|
||||
PxArray<PxParticleSystemCallback*> mCallbacks;
|
||||
|
||||
public:
|
||||
PxMultiCallback() : mCallbacks(0) {}
|
||||
|
||||
virtual void onPostSolve(const PxGpuMirroredPointer<PxGpuParticleSystem>& gpuParticleSystem, CUstream stream) PX_OVERRIDE
|
||||
{
|
||||
for (PxU32 i = 0; i < mCallbacks.size(); ++i)
|
||||
mCallbacks[i]->onPostSolve(gpuParticleSystem, stream);
|
||||
}
|
||||
|
||||
virtual void onBegin(const PxGpuMirroredPointer<PxGpuParticleSystem>& gpuParticleSystem, CUstream stream) PX_OVERRIDE
|
||||
{
|
||||
for (PxU32 i = 0; i < mCallbacks.size(); ++i)
|
||||
mCallbacks[i]->onBegin(gpuParticleSystem, stream);
|
||||
}
|
||||
|
||||
virtual void onAdvance(const PxGpuMirroredPointer<PxGpuParticleSystem>& gpuParticleSystem, CUstream stream) PX_OVERRIDE
|
||||
{
|
||||
for (PxU32 i = 0; i < mCallbacks.size(); ++i)
|
||||
mCallbacks[i]->onAdvance(gpuParticleSystem, stream);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Adds a callback
|
||||
|
||||
\param[in] callback The callback to add
|
||||
\return True if the callback was added
|
||||
*/
|
||||
bool addCallback(PxParticleSystemCallback* callback)
|
||||
{
|
||||
if (mCallbacks.find(callback) != mCallbacks.end())
|
||||
return false;
|
||||
mCallbacks.pushBack(callback);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Removes a callback
|
||||
|
||||
\param[in] callback The callback to remove
|
||||
\return True if the callback was removed
|
||||
*/
|
||||
bool removeCallback(const PxParticleSystemCallback* callback)
|
||||
{
|
||||
for (PxU32 i = 0; i < mCallbacks.size(); ++i)
|
||||
{
|
||||
if (mCallbacks[i] == callback)
|
||||
{
|
||||
mCallbacks.remove(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Flags which control the behaviour of a particle system.
|
||||
|
||||
See #PxPBDParticleSystem::setParticleFlag(), #PxPBDParticleSystem::setParticleFlags(), #PxPBDParticleSystem::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).
|
||||
eENABLE_SPECULATIVE_CCD = 1 << 3 //!< Enables speculative CCD for particle-rigid body collision. \see PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD.
|
||||
};
|
||||
};
|
||||
|
||||
typedef PxFlags<PxParticleFlag::Enum, PxU32> PxParticleFlags;
|
||||
|
||||
/**
|
||||
\brief Collection of flags providing a mechanism to lock motion along a specific axis.
|
||||
|
||||
\see PxParticleSystem.setParticleLockFlag(), PxParticleSystem.getParticleLockFlags()
|
||||
*/
|
||||
struct PxParticleLockFlag
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eLOCK_X = (1 << 0),
|
||||
eLOCK_Y = (1 << 1),
|
||||
eLOCK_Z = (1 << 2)
|
||||
};
|
||||
};
|
||||
|
||||
typedef PxFlags<PxParticleLockFlag::Enum, PxU8> PxParticleLockFlags;
|
||||
PX_FLAGS_OPERATORS(PxParticleLockFlag::Enum, PxU8)
|
||||
|
||||
/**
|
||||
\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 PxActor
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~PxPBDParticleSystem() {}
|
||||
|
||||
/**
|
||||
\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.
|
||||
|
||||
<b>Default:</b> 4 position iterations, 1 velocity iteration
|
||||
|
||||
\param[in] minPositionIters Number of position iterations the solver should perform for this body. <b>Range:</b> [1,255]
|
||||
\param[in] minVelocityIters Number of velocity iterations the solver should perform for this body. <b>Range:</b> [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() const = 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() const = 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 deformable bodies.
|
||||
|
||||
A particle and a rigid or deformable body will come to rest at a distance equal to the sum of their restOffset values.
|
||||
|
||||
\param[in] restOffset <b>Range:</b> (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 deformable below the distance equal to the sum of their contacOffset values.
|
||||
|
||||
\param[in] contactOffset <b>Range:</b> (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 <b>Range:</b> (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 <b>Range:</b> (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.
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
|
||||
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
|
||||
*/
|
||||
PX_DEPRECATED virtual void addRigidAttachment(PxRigidActor* actor) = 0;
|
||||
|
||||
/**
|
||||
\brief Removes a rigid attachment between a particle and a rigid body.
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
|
||||
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
|
||||
*/
|
||||
PX_DEPRECATED virtual void removeRigidAttachment(PxRigidActor* actor) = 0;
|
||||
|
||||
|
||||
/**
|
||||
\brief Enable continuous collision detection for particles
|
||||
|
||||
\deprecated Replaced by particle flag, \see PxParticleFlag::eENABLE_SPECULATIVE_CCD.
|
||||
|
||||
\param[in] enable Boolean indicates whether continuous collision detection is enabled.
|
||||
*/
|
||||
PX_DEPRECATED virtual void enableCCD(bool enable) = 0;
|
||||
|
||||
|
||||
/**
|
||||
\brief Reads the particle lock flags.
|
||||
|
||||
See the list of flags #PxParticleLockFlag
|
||||
|
||||
\return The values of the particle lock flags.
|
||||
|
||||
\see PxParticleLockFlag setParticleLockFlag()
|
||||
*/
|
||||
virtual PxParticleLockFlags getParticleLockFlags() const = 0;
|
||||
|
||||
/**
|
||||
\brief Raises or clears a particular particle lock flag.
|
||||
|
||||
See the list of flags #PxParticleLockFlag
|
||||
|
||||
<b>Default:</b> no flags are set
|
||||
|
||||
|
||||
\param[in] flag The PxParticleLockFlag to raise(set) or clear.
|
||||
\param[in] value The new boolean value for the flag.
|
||||
|
||||
\see PxParticleLockFlag getParticleLockFlags()
|
||||
*/
|
||||
virtual void setParticleLockFlag(PxParticleLockFlag::Enum flag, bool value) = 0;
|
||||
|
||||
/**
|
||||
\brief Set all particle lock flags.
|
||||
\see setParticleLockFlag()
|
||||
*/
|
||||
virtual void setParticleLockFlags(PxParticleLockFlags flags) = 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(PxPBDMaterial* material, PxParticlePhaseFlags flags) = 0;
|
||||
|
||||
|
||||
/**
|
||||
\brief Returns number of particle materials referenced by particle phases
|
||||
\return The number of particle materials
|
||||
*/
|
||||
virtual PxU32 getNbParticleMaterials() const = 0;
|
||||
|
||||
/**
|
||||
\brief Returns particle materials referenced by particle phases
|
||||
\return The particle materials
|
||||
*/
|
||||
virtual PxU32 getParticleMaterials(PxPBDMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) 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 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::eENABLE_DIRECT_GPU_API is set, or 0xFFFFFFFF otherwise.
|
||||
*/
|
||||
virtual PxU32 getGpuParticleSystemIndex() = 0;
|
||||
|
||||
/**
|
||||
\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 <b>Range:</b> (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 <b>Range:</b> (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 Get the particle system grid size x dimension
|
||||
\return[in] the x dimension in the particle grid
|
||||
|
||||
See #setGridSizeX()
|
||||
*/
|
||||
virtual PxU32 getGridSizeX() const = 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 Get the particle system grid size y dimension
|
||||
\return[in] the y dimension in the particle grid
|
||||
|
||||
See #setGridSizeY()
|
||||
*/
|
||||
virtual PxU32 getGridSizeY() const = 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;
|
||||
|
||||
/**
|
||||
\brief Get the particle system grid size z dimension
|
||||
\return[in] the z dimension in the particle grid
|
||||
|
||||
See #setGridSizeZ()
|
||||
*/
|
||||
virtual PxU32 getGridSizeZ() const = 0;
|
||||
|
||||
|
||||
virtual const char* getConcreteTypeName() const PX_OVERRIDE PX_FINAL { return "PxPBDParticleSystem"; }
|
||||
|
||||
protected:
|
||||
PX_INLINE PxPBDParticleSystem(PxType concreteType, PxBaseFlags baseFlags) : PxActor(concreteType, baseFlags) {}
|
||||
PX_INLINE PxPBDParticleSystem(PxBaseFlags baseFlags) : PxActor(baseFlags) {}
|
||||
virtual bool isKindOf(const char* name) const PX_OVERRIDE { PX_IS_KIND_OF(name, "PxPBDParticleSystem", PxActor); }
|
||||
};
|
||||
|
||||
#if PX_VC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
626
engine/third_party/physx/include/PxParticleBuffer.h
vendored
Normal file
626
engine/third_party/physx/include/PxParticleBuffer.h
vendored
Normal file
@@ -0,0 +1,626 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2025 NVIDIA Corporation. 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
|
||||
|
||||
#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.
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
*/
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct PX_DEPRECATED 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 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 #PxParticlePhaseFlag
|
||||
|
||||
\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.
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
See #PxParticleVolume
|
||||
|
||||
\return A pointer to a device buffer containing the #PxParticleVolume s for this particle buffer.
|
||||
*/
|
||||
PX_DEPRECATED 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.
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
\return The number of #PxParticleVolume s for this particle buffer.
|
||||
*/
|
||||
PX_DEPRECATED virtual PxU32 getNbParticleVolumes() const = 0;
|
||||
|
||||
/**
|
||||
\brief Set the number of #PxParticleVolume s for this particle buffer.
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
\param[in] nbParticleVolumes The number of particle volumes in this particle buffer.
|
||||
*/
|
||||
PX_DEPRECATED virtual void setNbParticleVolumes(PxU32 nbParticleVolumes) = 0;
|
||||
|
||||
/**
|
||||
\brief Get the maximum number of particle volumes this particle buffer can hold.
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
|
||||
See #PxParticleVolume.
|
||||
|
||||
\return The maximum number of particle volumes this particle buffer can hold.
|
||||
*/
|
||||
PX_DEPRECATED virtual PxU32 getMaxParticleVolumes() const = 0;
|
||||
|
||||
/**
|
||||
\brief Set the #PxParticleRigidFilterPair s for collision filtering of particles in this buffer with rigid bodies.
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
See #PxParticleRigidFilterPair
|
||||
|
||||
\param[in] filters A device buffer containing #PxParticleRigidFilterPair s.
|
||||
\param[in] nbFilters The number of particle-rigid body collision filtering pairs.
|
||||
*/
|
||||
PX_DEPRECATED virtual void setRigidFilters(PxParticleRigidFilterPair* filters, PxU32 nbFilters) = 0;
|
||||
|
||||
/**
|
||||
\brief Set the particle-rigid body attachments for particles in this particle buffer.
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
|
||||
See #PxParticleRigidAttachment
|
||||
|
||||
\param[in] attachments A device buffer containing #PxParticleRigidAttachment s.
|
||||
\param[in] nbAttachments The number of particle-rigid body attachments.
|
||||
*/
|
||||
PX_DEPRECATED 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;
|
||||
|
||||
/**
|
||||
\deprecated Will be removed in a future version, use getUniqueId() instead.
|
||||
\brief Unique index that does not change over the lifetime of a PxParticleBuffer.
|
||||
*/
|
||||
PX_DEPRECATED PxU32 bufferUniqueId;
|
||||
|
||||
/**
|
||||
\brief Retrieve unique index that does not change over the lifetime of a PxParticleBuffer.
|
||||
*/
|
||||
virtual PxU32 getUniqueId() const = 0;
|
||||
|
||||
//public variables:
|
||||
void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object.
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~PxParticleBuffer() { }
|
||||
PX_INLINE PxParticleBuffer(PxType type) : PxBase(type, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), bufferUniqueId(PX_INVALID_U32), userData(NULL) {}
|
||||
|
||||
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 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 a device buffer of velocities for the diffuse particles.
|
||||
\return A device buffer containing velocities of diffuse particles.
|
||||
*/
|
||||
virtual PxVec4* getDiffuseVelocities() 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(PxType type) : PxParticleBuffer(type){}
|
||||
|
||||
private:
|
||||
PX_NOCOPY(PxParticleAndDiffuseBuffer)
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Holds all the information for a spring constraint between two particles. Used for particle cloth simulation.
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
*/
|
||||
struct PX_DEPRECATED 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.
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
*/
|
||||
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.
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
*/
|
||||
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.
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
|
||||
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.
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
|
||||
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(PxType type) : PxParticleBuffer(type) {}
|
||||
|
||||
private:
|
||||
PX_NOCOPY(PxParticleClothBuffer)
|
||||
};
|
||||
|
||||
/**
|
||||
\brief A particle buffer used to simulate rigid bodies using shape matching with particles.
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
|
||||
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(PxType type) : PxParticleBuffer(type) {}
|
||||
|
||||
private:
|
||||
PX_NOCOPY(PxParticleRigidBuffer)
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Preprocessor to prepare particle cloths for simulation.
|
||||
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
|
||||
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 #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.
|
||||
\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated.
|
||||
\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
|
||||
188
engine/third_party/physx/include/PxParticleGpu.h
vendored
Normal file
188
engine/third_party/physx/include/PxParticleGpu.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
#include "foundation/PxSimpleTypes.h"
|
||||
#include "foundation/PxVec3.h"
|
||||
|
||||
#include "PxParticleSystem.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
\brief Common material properties for particles. See #PxPBDMaterial.
|
||||
|
||||
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
|
||||
{
|
||||
PxReal mGridCellWidth; //!< Grid cell width, derived from particle contact offset * neighborhood scale
|
||||
PxU32 mGridSizeX; //!< Size of the x-dimension of the background simulation grid. Translates to an absolute size of mGridSizeX * mGridCellWidth.
|
||||
PxU32 mGridSizeY; //!< Size of the y-dimension of the background simulation grid. Translates to an absolute size of mGridSizeY * mGridCellWidth.
|
||||
PxU32 mGridSizeZ; //!< Size of the z-dimension of the background simulation grid. Translates to an absolute size of mGridSizeZ * mGridCellWidth.
|
||||
|
||||
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 #PxPBDParticleSystem, #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 #PxParticlePhaseFlag.
|
||||
|
||||
/* 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
|
||||
|
||||
47
engine/third_party/physx/include/PxParticleMaterial.h
vendored
Normal file
47
engine/third_party/physx/include/PxParticleMaterial.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
#include "foundation/PxPreprocessor.h"
|
||||
#include "PxPBDMaterial.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
|
||||
/**
|
||||
\deprecated This typedef only serves for deprecation and will be removed in a future version.
|
||||
*/
|
||||
typedef PX_DEPRECATED PxPBDMaterial PxParticleMaterial;
|
||||
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
130
engine/third_party/physx/include/PxParticleNeighborhoodProvider.h
vendored
Normal file
130
engine/third_party/physx/include/PxParticleNeighborhoodProvider.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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_NEIGHBORHOOD_PROVIDER_H
|
||||
#define PX_PARTICLE_NEIGHBORHOOD_PROVIDER_H
|
||||
|
||||
|
||||
#include "cudamanager/PxCudaContext.h"
|
||||
#include "cudamanager/PxCudaContextManager.h"
|
||||
|
||||
#include "foundation/PxSimpleTypes.h"
|
||||
#include "foundation/PxVec4.h"
|
||||
#include "PxParticleSystem.h"
|
||||
|
||||
#include "foundation/PxArray.h"
|
||||
#include "PxParticleGpu.h"
|
||||
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
#if PX_SUPPORT_GPU_PHYSX
|
||||
|
||||
/**
|
||||
\brief Computes neighborhood information for a point cloud
|
||||
*/
|
||||
class PxParticleNeighborhoodProvider
|
||||
{
|
||||
public:
|
||||
/**
|
||||
\brief Schedules the compuation of neighborhood information on the specified cuda stream
|
||||
|
||||
\param[in] deviceParticlePos A gpu pointer containing the particle positions
|
||||
\param[in] numParticles The number of particles
|
||||
\param[in] stream The stream on which the cuda call gets scheduled
|
||||
\param[in] devicePhases An optional gpu pointer with particle phases
|
||||
\param[in] validPhaseMask An optional phase mask to define which particles should be included into the neighborhood computation
|
||||
\param[in] deviceActiveIndices An optional device pointer containing all indices of particles that are currently active
|
||||
*/
|
||||
virtual void buildNeighborhood(PxVec4* deviceParticlePos, const PxU32 numParticles, CUstream stream, PxU32* devicePhases = NULL,
|
||||
PxU32 validPhaseMask = PxParticlePhaseFlag::eParticlePhaseFluid, const PxU32* deviceActiveIndices = NULL) = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the maximal number of particles
|
||||
|
||||
\return The maximal number of particles
|
||||
*/
|
||||
virtual PxU32 getMaxParticles() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the maximal number of particles
|
||||
|
||||
\param[in] maxParticles The maximal number of particles
|
||||
*/
|
||||
virtual void setMaxParticles(PxU32 maxParticles) = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the maximal number of grid cells
|
||||
|
||||
\return The maximal number of grid cells
|
||||
*/
|
||||
virtual PxU32 getMaxGridCells() const = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the cell size
|
||||
|
||||
\return The cell size
|
||||
*/
|
||||
virtual PxReal getCellSize() const = 0;
|
||||
|
||||
/**
|
||||
\brief Gets the number of grid cells in use
|
||||
|
||||
\return The number of grid cells in use
|
||||
*/
|
||||
virtual PxU32 getNumGridCellsInUse() const = 0;
|
||||
|
||||
/**
|
||||
\brief Sets the maximal number of particles
|
||||
|
||||
\param[in] maxGridCells The maximal number of grid cells
|
||||
\param[in] cellSize The cell size. Should be equal to 2*contactOffset for PBD particle systems.
|
||||
*/
|
||||
virtual void setCellProperties(PxU32 maxGridCells, PxReal cellSize) = 0;
|
||||
|
||||
/**
|
||||
\brief Releases the instance and its data
|
||||
*/
|
||||
virtual void release() = 0;
|
||||
|
||||
/**
|
||||
\brief Destructor
|
||||
*/
|
||||
virtual ~PxParticleNeighborhoodProvider() {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
66
engine/third_party/physx/include/PxParticleSolverType.h
vendored
Normal file
66
engine/third_party/physx/include/PxParticleSolverType.h
vendored
Normal file
@@ -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-2025 NVIDIA Corporation. 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
|
||||
|
||||
#include "foundation/PxPreprocessor.h"
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
namespace physx
|
||||
{
|
||||
#endif
|
||||
|
||||
#if PX_VC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4435)
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
\deprecated The solver type will be removed in a future version without replacement.
|
||||
\brief Identifies the solver to use for a particle system.
|
||||
*/
|
||||
struct PX_DEPRECATED PxParticleSolverType
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
ePBD = 1 << 0 //!< The position based dynamics solver that can handle fluid, granular material, cloth, inflatables etc. See #PxPBDParticleSystem.
|
||||
};
|
||||
};
|
||||
|
||||
#if PX_VC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
#if !PX_DOXYGEN
|
||||
} // namespace physx
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user