diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cf7dcd8..172a4c2d 100644 --- a/CMakeLists.txt +++ b/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 + $ + $/$ + ) + 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" diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt index 4f04c75c..aa1b739e 100644 --- a/editor/CMakeLists.txt +++ b/editor/CMakeLists.txt @@ -175,3 +175,7 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD ${XCENGINE_ASSIMP_DLL} $/assimp-vc143-mt.dll ) + +if(WIN32 AND XCENGINE_ENABLE_PHYSX) + xcengine_copy_physx_runtime_dlls(${PROJECT_NAME}) +endif() diff --git a/engine/third_party/physx/.gitignore b/engine/third_party/physx/.gitignore new file mode 100644 index 00000000..52667b49 --- /dev/null +++ b/engine/third_party/physx/.gitignore @@ -0,0 +1,3 @@ +compiler/linux-* +compiler/vc* +include/PxConfig.h diff --git a/engine/third_party/physx/CHANGELOG.md b/engine/third_party/physx/CHANGELOG.md new file mode 100644 index 00000000..b9e6d39e --- /dev/null +++ b/engine/third_party/physx/CHANGELOG.md @@ -0,0 +1,5587 @@ +# v5.6.1-107.3 + +## General + +### Fixed + +* PxHashSet would crash after adding ~300 million entries to the set due to internal PxU32 overflows. This has been fixed. +* The documentation build tool had a regression that made the search not find terms properly. + +### Added + +* Update NVCC compiler options to generate SASS for Blackwell. + +## Articulations + +### Deprecated + +* Deprecated PxArticulationFlag::eDRIVE_LIMITS_ARE_FORCES. Joint dofs configured to use PxPerformanceEnvelope will already ignore the flag and assume they are configured for forces/torques. + +### Added + +* A new motor model for clamping total joint effort (force or torque). The total joint effort is comprised of drive effort and joint effort applied through articulation cache by the user. Please see PxPerformanceEnvelope for clamping details. +* New direct GPU API getters for PxArticulationGPUAPIReadType::eFIXED_TENDON, PxArticulationGPUAPIReadType::eFIXED_TENDON_JOINT, PxArticulationGPUAPIReadType::eSPATIAL_TENDON, and PxArticulationGPUAPIReadType::eSPATIAL_TENDON_ATTACHMENT. +* PxArticulationFixedTendon, PxArticulationTendonJoint, PxArticulationSpatialTendon, and PxArticulationAttachment's parameter getters now report errors if called when PxSceneFlag::eENABLE_DIRECT_GPU_API is enabled. + +### Fixed + +* When running on GPU, the link incoming joint force was not being reported correctly in certain scenarios (PxArticulationCacheFlag::eLINK_INCOMING_JOINT_FORCE, PxArticulationGPUAPIReadType::eLINK_INCOMING_JOINT_FORCE). + +## Joints + +### Deprecated + +* PxD6Drive::eSWING has been deprecated. Furthermore, the angular joint drive precedence system (PxD6Drive::eSLERP taking precedence over PxD6Drive::eSWING/eTWIST) has been deprecated too. The recommended approach is now to first define the desired angular drive model before setting any drive parameters. The new API PxD6Joint::setAngularDriveConfig() can be used for this purpose. The recommended workflow is as follows: + * To use PxD6Drive::eSLERP, first call PxD6Joint::setAngularDriveConfig(PxD6AngularDriveConfig::eSLERP) (PxD6Drive::eSWING/eTWIST/eSWING1/eSWING2 can not be used in this config). + * To use PxD6Drive::eTWIST/eSWING1/eSWING2, first call PxD6Joint::setAngularDriveConfig(PxD6AngularDriveConfig::eSWING_TWIST) (PxD6Drive::eSWING/eSLERP can not be used in this config). + * PxD6Drive::eSWING should not be used anymore. The configuration of the previous bullet point can be used instead together with setting identical drive parameters for PxD6Drive::eSWING1/eSWING2. + +### Added + +* PxD6Joint::setAngularDriveConfig() has been added to configure whether angular drives should use the slerp model or twist/swing1/swing2. +* It is now possible to set different parameters for drives along the swing1 and swing2 axes (see new entries PxD6Drive::eSWING1 and PxD6Drive::eSWING2). Note that it is necessary to configure the D6 joint via PxD6Joint::setAngularDriveConfig(PxD6AngularDriveConfig::eSWING_TWIST) to enable this functionality. + +### Fixed + +* When running with Direct GPU API enabled (PxSceneFlag::eENABLE_DIRECT_GPU_API), D6 joints were not able to break if the force exceeded the break threshold. The joints do break now but there is a potential performance penalty if the scene has breakable D6 joints. + +## Deformable Body + +### Fixed + +* Deformable Volume collision filter deallocation resulted in memory leaks. +* Deformable-rigid dynamic friction resolution has received wrong rigid dynamic friction values. + +## Rigid Body + +### Fixed + +* A rare crash in PxConvexCoreGeometry contact generation in Gu::FaceClipper::makePlanes() function has been fixed. +* A bug when PxPhysics::createMaterial() allowed to create materials with invalid restitution values. The accepted values now are [0, 1] for restitution and (-PX_MAX_REAL, 0) if it's the compliant contact stiffness. +* Pairs of triangle mesh colliders (where both have no SDF) are filtered out from the collision pipeline, avoiding a crash when e.g. kinematic triangle meshes collide. +* A regression in the GPU geometry code that could cause ghost contacts between a sphere and a triangle mesh has been fixed. + +## Scene Queries + +### Added + +* `PxConvexCoreGeometry` is now supported as the query geometry in `sweep()` and `overlap()` scene queries. + +# v5.6.0-107.0 + +## Supported Platforms + +### Runtime + +* Linux (tested on Ubuntu LTS versions 20.04, 22.04, and 24.04 using their respective default GCC and Clang compilers). +* Microsoft Windows 10 or later (64 bit) +* GPU acceleration: display driver supporting CUDA toolkit 12.8 and Volta GPU or above + +### Development + +* [Linux Platform Readme](documentation/platformreadme/linux/README_LINUX.md) +* [Windows Platform Readme](documentation/platformreadme/windows/README_WINDOWS.md) +* Upgrade to CUDA toolkit 12 from CUDA toolkit 11 + +## General + +### Removed + +* The deprecated flag Px1DConstraintFlag::eDEPRECATED_DRIVE_ROW has been removed. +* The deprecated old Direct-GPU API has been removed along with all the types that were used exlusively by that API. This includes the following functions: PxScene::copyBodyData, PxScene::applyActorData, PxScene::copyArticulationData, PxScene::applyArticulationData, PxScene::updateArticulationsKinematic, PxScene::computeDenseJacobians, PxScene::computeGeneralizedMassMatrices, PxScene::computeGeneralizedGravityForces, PxScene::computeCoriolisAndCentrifugalForces, PxScene::copyContactData and PxScene::evaluateSDFDistances. Their replacements are located in PxDirectGPUAPI. PxIndexDataPair, PxActorCacheFlag, PxGpuActorPair, PxGpuBodyData and PxArticulationGpuDataType have been removed. +* The deprecated flag PxConvexFlag::eGPU_COMPATIBLE has been removed. +* The deprecated flag PxMaterialFlag::eCOMPLIANT_CONTACT has been removed. + +### Deprecated + +* Deprecated the PxStridedData and PxTypedStridedData. Use PxBoundedData and PxTypedBoundedData instead. + +### Added + +* Added a default implementation of the PxProfilerCallback in PhysXExtensions to record profiling data, called PxDefaultProfiler. +* Added SnippetProfilerConverter to convert profiler data to a file format that can be viewed in Chrome. +* The task system now supports high-priority tasks, which are used by the CPU broadphase (PxBroadPhaseType::ePABP). This can sometimes give small performance gains and smoother performance profiles. If not using the default PhysX CPU dispatcher, support for high-priority tasks should be replicated in user-provided CPU dispatchers to take advantage of this change. +* Added setName/getName functions to PxArticulationJointReducedCoordinate class. +* The PxGpuBroadPhaseDesc structure has been added, to let users tweak the GPU broadphase data. This is mostly useful when using environment IDs in colocated reinforcement learning cases. + +## Rigid Body + +### Fixed + +* A bug leading to a potential performance issue in the PxBroadPhaseType::ePABP broadphase has been fixed. A pair buffer was constantly resizing each frame for no reason. +* The GPU broadphase could overflow internal 32bit counters with large colocated environments (reinforcement learning cases). This has been fixed. +* Switching dynamic/kinematic at runtime when direct GPU API was in use was causing errors and was disabled for that reason in 106.5. The bug was fixed and the feature is enabled again. + +### Removed + +* The deprecated friction types PxFrictionType::eONE_DIRECTIONAL and ::eTWO_DIRECTIONAL have been removed. Please use PxFrictionType::ePATCH instead (or rather avoid setting the friction type altogether since PxFrictionType::ePATCH is the only supported type left). +* The deprecated material flag PxMaterialFlag::eIMPROVED_PATCH_FRICTION has been removed and PhysX friction behavior is now always as if this flag had been set. +* The deprecated kinematic articulation drive modes PxArticulationDriveType::eTARGET and PxArticulationDriveType::eVELOCITY have been removed. + +### Deprecated + +* The friction type PxFrictionType and the corresponding parameter PxSceneDesc::frictionType have been marked as deprecated. The patch friction model is the only supported type and the option is now obsolete. + +## Collision + +### Added +* Collision detection support for PxConvexCoreGeometry-PxDeformableSurface contacts. + +## Joints + +### Removed + +* PxContactJoint and PxJacobianRow were marked as deprecated and have now been removed. + +### Added + +* PxDirectGPUAPI::getD6JointData() has been added to access the D6 joint forces/torques from GPU memory directly if the direct GPU API is enabled. +* PxD6Joint::getGPUIndex() has been added to get the indices needed for direct GPU API operations (see bullet point above). + +## Articulations + +### Added + +* A new friction model has been implemented for articulation joints. To utilize this new model please use PxArticulationJointReducedCoordinate::setFrictionParams() to set parameters for joint axes and PxArticulationJointReducedCoordinate::getFrictionParams() to retrieve current parameters. +* Support of per-axis maxJointVelocity. + +### Removed + +* The deprecated functions PxArticulationReducedCoordinate::setMaxCOMLinearVelocity(), PxArticulationReducedCoordinate::getMaxCOMLinearVelocity(), PxArticulationReducedCoordinate::setMaxCOMAngularVelocity() and PxArticulationReducedCoordinate::getMaxCOMAngularVelocity() have been removed. + +### Fixed + +* The maximum joint velocity was not properly enforced when no other internal constraints were present (drive, joint limit, joint friction). This is now fixed. + +### Deprecated + +* Deprecated PxArticulationJointReducedCoordinate::setFrictionCoefficient() and PxArticulationJointReducedCoordinate::getFrictionCoefficient(). Please use PxArticulationJointReducedCoordinate::setFrictionParams() and PxArticulationJointReducedCoordinate::getFrictionParams() instead. +* Deprecated PxArticulationJointReducedCoordinate::setMaxJointVelocity(PxReal maxJointV) and PxArticulationJointReducedCoordinate::getMaxJointVelocity(). Please use PxArticulationJointReducedCoordinate::setMaxJointVelocity(PxArticulationAxis::Enum axis, PxReal maxJointV) and PxArticulationJointReducedCoordinate::getMaxJointVelocity(PxArticulationAxis::Enum axis) instead. + +## Scene queries + +### Removed + +* The deprecated flag PxHitFlag::eMESH_ANY has been removed. Please use PxHitFlag::eANY_HIT instead. + +### Changed + +* The specialized PxMeshQuery::findOverlapTriangleMesh function for mesh-vs-mesh overlap has a new API using PxGeomIndexClosePair structures instead of PxGeomIndexPair previously. The previous function has been deprecated. The new function now returns additional distance data when non-zero tolerance values are used. + +## Vehicles + +### Deprecated + +* With the removal of the old deprecated vehicle API (see further below), the following changes will take place in a future version of PhysX: + * The folder of the public header files will change from include/vehicle2 to include/vehicle. + * The library will be renamed from PhysXVehicle2... to PhysXVehicle... + * The namespace vehicle2 will be removed. + +### Removed + +* The old deprecated vehicle API has been removed. Please use the new vehicle API instead (see the PhysX 4.0 to 5.1 migration guide as well as the vehicle related chapter in the guide). Furthermore, two related PxConstraintExtIDs have been removed (eVEHICLE_SUSP_LIMIT_DEPRECATED and eVEHICLE_STICKY_TYRE_DEPRECATED). + +### Changed + +* All the vehicle snippets have been renamed from SnippetVehicle2... to SnippetVehicle... + +## Deformable Body + +### Changed + +* Changed PxDeformableBodyFlags from PxU16 to PxU8. +* Implemented PxActorFlag::eDISABLE_GRAVITY for both PxDeformableSurface and PxDeformableVolume. +* Deprecated PxDeformableBody::setMaxVelocity, PxDeformableBody::getMaxVelocity +* Added PxDeformableBody::setMaxLinearVelocity, getMaxLinearVelocity and implemented functionality for PxDeformableVolume +* Implemented PxDeformableBody::setMaxDepenetrationVelocity, getMaxDepenetrationVelocity (currently limited to deformable-rigid iteractions) + +## Serialization + +* Binary data conversion and binary meta data have been removed. + * PxBinaryConverter + * PxConverterReportMode + * PxGetPhysicsBinaryMetaData() + * PxSerialization::serializeCollectionToBinaryDeterministic() + * PxSerialization::dumpBinaryMetaData() + * PxSerialization::createBinaryConverter() + * PxBinaryMetaDataCallback + * PxSerializationRegistry::registerBinaryMetaDataCallback() + +# v5.5.1-106.5 + +## Collision + +### Fixed + +* A bug when colliding a static rigid body with PxConvexCoreGeometry against PxDeformableVolume led to a crash. +* A hanging issue in PxConvexCoreGeometry collision. + +## Joints + +### Fixed + +* When running on GPU, PxConstraint::getForce() might not have returned the correct forces if a scene contained both, joints that did connect to articulation links and joints that did not. + +## Pvd + +### Changed + +* Fixed a potential bug in recording of Direct GPU API set operations followed by a removal of either a rigiddynamic or an articulation. + +# v5.5.0-106.4 + +## Supported Platforms + +### Runtime + +* Linux (tested on Ubuntu LTS versions 20.04, 22.04, and 24.04 using their respective default GCC and Clang compilers). +* Microsoft Windows 10 or later (64 bit) +* GPU acceleration: display driver supporting CUDA toolkit 11.8 and Volta GPU or above + +### Development + +* [Linux Platform Readme](documentation/platformreadme/linux/README_LINUX.md) +* [Windows Platform Readme](documentation/platformreadme/windows/README_WINDOWS.md) + +## General + +### Added + +* cmake files has been updated to require a minimum cmake version of 3.16. +* Support for environment IDs has been added to actors (PxActor) and aggregates (PxAggregate). These new IDs are used for a built-in filtering mechanism in the GPU broadphase. +* Added a PX_PROFILE_VALUE macro to display integers and floating point data in the profiler. +* Added two recordData functions to the PxProfilerCallback that can be implemented to send data to a profiler for plotting. +* Added a recordFrame function to the PxProfilerCallback that can be implemented to receive frame marker callbacks. +* Added a new type of geometry - PxConvexCoreGeometry - that can be used to create different, GPU accelerated convex shapes, including cylinders and cones. + +### Deprecated + +* The single-threaded helper function PxBroadPhase::update(PxBroadPhaseResults& results, const PxBroadPhaseUpdateData& updateData) has been deprecated, replaced with PxBroadPhase::updateAndFetchResults(PxBroadPhaseResults& results, const PxBroadPhaseUpdateData& updateData). This is to avoid confusion between the two overloaded update() functions. A similar change previously happened in the PxAABBManager class. +* Some functions in PxMathUtils.h (all functions inside the struct Interpolation plus the free function computeBarycentric) are now deprecated and got replaced by free functions in the same file that properly use the Px prefix. + +### Removed + +* PxHairSystem - a feature under construction - and all associated APIs have been removed +* PxLineStripSkinning used for skinning graphics meshes to hair systems has been removed +* CUDA ARCH 6.0 (Pascal GPU) is not supported anymore +* PxPhysicsGPU::estimateSceneCreationGpuMemoryRequirements has been removed. PxPhysics::createScene() will return a null pointer if scene creation fails due to low GPU memory availability. +* The file "foundation/Px.h" has been removed. This file contained forward declarations for a subset of classes and structures declared in the PhysX foundation layer. It is recommended to replace any include of "Px.h" with either a forward declaration of the PhysX foundation type required, a #include of the PhysX foundation type required or to include all public headers of PhysX using #include "PxPhysicsAPI.h". The file "foundation/Px.h" also included "stdlib.h" and "string.h" so these might need to be explicitly included as a replacement for "Px.h". + +### Changed + +* The PxTypedStridedData type no longer holds constant data by default. To maintain full backwards compatibility, use PxTypedStridedData. Previously, the const qualifier on the template argument was not required. + +### Fixed + +* It was possible that the cpu fallback crashed for contact between a primitive (sphere, plane, box, capsule) and a PxConvexMesh that was not gpu compatible. This will have affected very thin meshes or meshes with 64 or more vertices, 64 or more polygons, 32 or more vertices on any polygon. The crash has been fixed. +* Compilation warnings treated as errors for Clang 18 and GCC 13. + + +## Rigid Body + +### Added + +* SDF-based colliders are now also supported on CPU, enabling the use of dynamic triangle mesh actors with CPU dynamics. + +### Changed + +* Momentum conservation is enforced for rigid body joint and contact constraints. + +### Fixed + +* Direct GPU API: Velocities were not zeroed when RB was set to kinematic. This was fixed and consistent behavior between cpu, cpu/gpu and direct GPU code paths was ensured. +* PxConvexCoreGeometry: NaNs in actor's transform could lead to a crash in collision detection code. + +## Articulations + +### Added + +* A function PxArticulationReducedCoordinate::computeArticulationCOM has been added that returns the articulation's center of mass in either the world frame or root frame using its current pose. Similarly, two enums PxArticulationGPUAPIComputeType::eARTICULATION_COMS_WORLD_FRAME and PxArticulationGPUAPIComputeType::eARTICULATION_COMS_ROOT_FRAME have been added that can be used as input to the function PxDirectGPUAPI::computeArticulationData in order to get the articulation's center of mass with the direct GPU API. +* A function PxArticulationReducedCoordinate::computeCentroidalMomentumMatrix has been added that returns the articulation's centroidal momentum matrix and force bias. Similarly, an enum PxArticulationGPUAPIComputeType::eCENTROIDAL_MOMENTUM_MATRICES has been added that can be used as input to the function PxDirectGPUAPI::computeArticulationData in order to get the articulation's centroidal momentum matrices and force bias with the direct GPU API. These methods are only implemented for floating-base articulations. + +### Deprecated + +* The inverse dynamics function PxArticulationReducedCoordinate::computeGeneralizedMassMatrix has been deprecated, replaced with PxArticulationReducedCoordinate::computeMassMatrix. Similarly, the enum PxArticulationGPUAPIComputeType::eGENERALIZED_MASS_MATRICES input of the function PxDirectGPUAPI::computeArticulationData has been deprecated, replaced with the enum PxArticulationGPUAPIComputeType::eMASS_MATRICES. The new methods incorporate extra terms in the mass matrix of floating-base articulations in order to allow the user to set both the joint accelerations and the acceleration of the articulation root. For fixed-base articulations, the new methods are identical to the old ones. +* The inverse dynamics function PxArticulationReducedCoordinate::computeCoriolisAndCentrifugalForce has been deprecated, replaced with PxArticulationReducedCoordinate::computeCoriolisCompensation. Similarly, the enum PxArticulationGPUAPIComputeType::eCORIOLIS_AND_CENTRIFUGAL_FORCES input of the function PxDirectGPUAPI::computeArticulationData has been deprecated, replaced with the enum PxArticulationGPUAPIComputeType::eCORIOLIS_AND_CENTRIFUGAL_COMPENSATION. The new methods incorporate extra terms for floating-base articulations corresponding to the root. This will help the user to set both the joint accelerations and the acceleration of the articulation root when used with the mass matrix and the gravity compensation forces. For fixed-base articulations, the new methods are identical to the old ones. +* The inverse dynamics function PxArticulationReducedCoordinate::computeGeneralizedGravityForce has been deprecated, replaced with PxArticulationReducedCoordinate::computeGravityCompensation. Similarly, the enum PxArticulationGPUAPIComputeType::eGENERALIZED_GRAVITY_FORCES input of the function PxDirectGPUAPI::computeArticulationData has been deprecated, replaced with the enum PxArticulationGPUAPIComputeType::eGRAVITY_COMPENSATION. The new methods incorporate extra terms for floating-base articulations corresponding to the root. This will help the user to set both the joint accelerations and the acceleration of the articulation root when used with the mass matrix and the Coriolis and Centrifugal compensation forces. For fixed-base articulations, the new methods are identical to the old ones. + +### Changed + +* Scales used in impulse averaging and propagation steps have been modified for momentum conservation. +* Joint and contact impulses are propagated immediately after constraint enforcement. +* Mimic joints now support compliance through two parameters that specify the natural frequency and damping ratio of a mimic joint. The default behaviour is for mimic joints to behave as hard constraints, which matches their historic behavior. A full description of mimic joint compliance is provided in the Mimic Joints section in the User Guide. +* In the cpu codepath, constraints involving the root link of a fixed-base articulation are now resolved simultaneously with constraints that couple pairs of dynamic rigid bodies and/or articulation links. As a consequence of this change, the cpu and gpu codepaths now resolve constraints and contacts involving the root link of an articulation in the same order. This historic inconsistency, which has now been resolved, may have caused a difference in behavior between CPU and GPU. +* When using the Direct GPU API, calling computeArticulationData with the PxArticulationGPUAPIComputeType::eDENSE_JACOBIANS enum was providing the dense Jacobians in the output buffer following the articulation indices, while other inverse dynamics functions provides their outputs following the GPU indices. This is now fixed and the dense Jacobians are now provided following the GPU indices. This may reduce the size of the required buffer. + + +### Fixed + +* When using the Direct GPU API, calling computeArticulationData with the PxArticulationGPUAPIComputeType::eCORIOLIS_AND_CENTRIFUGAL_FORCES enum had the undesired consequence to change link accelerations. This is now fixed. Note that the same behavior is still present for floating-base articulations with the deprecated PxArticulationGPUAPIComputeType::eGENERALIZED_GRAVITY_FORCES enum. In that case, users are encouraged to use the new PxArticulationGPUAPIComputeType::eGRAVITY_COMPENSATION enum. +* On GPU, collision impulses might not have been applied to articulations if the scene contained other articulations with self-collision enabled. + +## Joints + +### Added + +* The flag PxD6JointDriveFlag::eOUTPUT_FORCE has been introduced to include D6 joint drive forces/torques in the force/torque total that gets reported in PxConstraint::getForce(). + +### Fixed + +* When running on GPU, releasing/removing/disabling D6 joints could have potentially caused some other joints to not get simulated for one frame. + +## Scene queries + +### Fixed + +* The mesh-vs-mesh overlap test from PxMeshQuery::findOverlapTriangleMesh() was ignoring the PxMeshMeshQueryFlag::eDISCARD_COPLANAR flag when tolerance was not zero. + +## Deformable Body + +### Added + +* Added PxDeformableSurface feature for simulating e.g. cloth or sheets. + * PxDeformableSurface, PxPhysics::createDeformableSurface, PxScene::getNbDeformableSurfaces, PxScene::getDeformableSurfaces. + * PxDeformableSurfaceFlag, PxDeformableSurfaceFlags + * PxDeformableSurfaceDataFlag, PxDeformableSurfaceDataFlags + * PxDeformableSurfaceMaterial, PxPhysics::createDeformableSurfaceMaterial, PxPhysics::getNbDeformableSurfaceMaterials, PxPhysics::getDeformableSurfaceMaterials +* Added PxDeformableBody base class for deformable features, as well as common flags (PxDeformableBodyFlag, PxDeformableBodyFlags). +* Added a feature to embed vertices into a deformable body. This helps to deform high resolution visual meshes according to the motion of the deformable body. + * PxTriangleMeshEmbeddingInfo, PxTetrahedronMeshEmbeddingInfo, PxTetmeshSkinningGpuData, PxTrimeshSkinningGpuData + * PxDeformableSkinningExt::initializeInterpolatedVertices for setting PxTriangleMeshEmbeddingInfo and PxTetrahedronMeshEmbeddingInfo + * PxDeformableSkinning::computeNormalVectors, PxDeformableSkinning::evaluateVerticesEmbeddedIntoSurface, evaluateVerticesEmbeddedIntoVolume + * PxScene::setDeformableSurfaceGpuPostSolveCallback, PxScene::setDeformableVolumeGpuPostSolveCallback +* Contacts between deformable bodies and rigid bodies now take friction value that is a combination of the two materials in contact + +### Removed +* Removed PxDeformableVolumeExt::commit, use PxDeformableVolumeExt::copyToDevice instead. + +### Changed +* Replaced PxFEMMaterialTableIndex with PxDeformableMaterialTableIndex + +### Deprecated +* PxSoftBody types. + * PxSoftBody, use PxDeformableVolume instead + * PxSoftBodyFlag and PxSoftBodyFlags, use PxDeformableVolumeFlag and PxDeformableVolumeFlags instead + * PxSoftBodyDataFlag and PxSoftBodyDataFlags, use PxDeformableVolumeDataFlag and PxDeformableVolumeDataFlags instead + * PxFEMSoftBodyMaterial, use PxDeformableVolumeMaterial instead + * PxSoftBodyMesh, use PxDeformableVolumeMesh instead + * PxSoftBodyAuxData, use PxDeformableVolumeAuxData instead +* PxFEMMaterial, use PxDeformableMaterial instead. +* PxFEMParameters, common deformable parameters. + * velocityDamping, use PxDeformableBody::setLinearDamping instead + * settlingThreshold, use PxDeformableBody::setSettlingThreshold instead + * sleepThreshold, use PxDeformableBody::setSleepThreshold instead + * sleepDamping, use PxDeformableBody::setSettlingDamping instead + * selfCollisionFilterDistance, use PxDeformableBody::setSelfCollisionFilterDistance instead + * selfCollisionStressTolerance, use PxDeformableVolume::setSelfCollisionStressTolerance instead +* PxSoftBodyFlag::eDISABLE_SELF_COLLISION, use PxDeformableBodyFlag::eDISABLE_SELF_COLLISION instead +* PxSoftBodyFlag::eENABLE_CCD, use PxDeformableBodyFlag::eENABLE_SPECULATIVE_CCD instead +* PxSoftBodyFlag::eKINEMATIC, use PxDeformableBodyFlag::eKINEMATIC instead +* PxSoftBody::setKinematicTargetBufferD(const PxVec4* positions, PxDeformableVolumeFlags flags), use setKinematicTargetBufferD(const PxVec4* positions) instead +* PxSoftBodyExt, use PxDeformableVolumeExt instead. +* DampingScale (get and set) in PxDeformableMaterial. +* Damping (get and set) in PxDeformableMaterial, use ElasticityDamping instead. + +## Attachments + +### Added + +* New deformable attachment and element filtering APIs. The new APIs replace the old attachment and filtering APIs which have been deprecated. + - PxDeformableAttachment* PxPhysics::createDeformableAttachment() + - PxDeformableElementFilter* PxPhysics::createDeformableElementFilter() + +### Removed + +* Removed deprecated attachment/filter methods related to PxFEMCloth from PxFEMCloth and PxSoftBody + +## Pvd + +### Added + +* A RECORD_MESSAGE command was added to the Omni PVD API so error messages can be recorded and viewed when debugging. Miscellaneous messaging and tagging can be added now. +* OVD Direct GPU API (PxDirectGPUAPI) recording for functions setRigidDynamicData and setArticulationData + * PxRigidBody has two additional attributes : force and torque + * PxArticulationJointReducedCoordinate has an additional attribute : jointForce + * Excluded : tendon data +* Streaming of PxConvexCoreGeometry as well as the following core types + * PxConvexCorePoint + * PxConvexCoreSegment + * PxConvexCoreBox + * PxConvexCoreEllipsoid + * PxConvexCoreCylinder + * PxConvexCoreCone + * Increases the OVD integration version to 1.8 + +### Changed + +* Simulation data is now separated into pre-simulation and post-simulation frame states + * The pre-simulation frame state contains all changes on objects before each simulation step starts + * The post-simulation frame state constains all changes on objects affected by the simulation step + * The OVD integration major.minor versions due to this change are 1.6 +# v5.4.2-106.1 + +## Articulations + +### Fixed + +* A bug in the GPU pipeline where setting the maximum joint velocity to zero resulted in a crash. + +### Changed + +* In the CPU codepath, constraints involving the root link of a fixed-base articulation are now resolved simultaneously with constraints that couple pairs of dynamic rigid bodies and/or articulation links. As a consequence of this change, the CPU and GPU codepaths now resolve constraints and contacts involving the root link of an articulation in the same order. This historic inconsistency, which has now been resolved, may have caused a difference in behavior between CPU and GPU simulation. + +## Rigid Body + +### Fixed + +* In cases where TGS was used with a non-zero number of velocity iterations on CPU, an incorrect timestep was used in part of the rigid-body and articulation solver pipeline. +* A bug in collision resolution where a sphere could fall through a flat triangle mesh when it landed precisely on a mesh vertex. +* Acceleration computation for rigid bodies was incorrect for both CPU and GPU APIs if velocities were updated by the user in-between simulation steps. This is fixed now. Affected API: PxRigidBody::getLinearAcceleration(), PxRigidBody::getAngularAcceleration(), PxDirectGPUAPI::getRigidDynamicData(). +* The CPU-side computations of accelerations (controlled with eENABLE_BODY_ACCELERATIONS) have been disabled when eENABLE_DIRECT_GPU_API is enabled. Previously both the CPU and GPU computations happened, which was redundant. + + +# v5.4.1-106.0 + +## General + +### Added + +* Debug visualization of contact friction was added, controlled by the following visualization parameter flags: PxVisualizationParameter::eFRICTION_POINT, PxVisualizationParameter::eFRICTION_NORMAL, and PxVisualizationParameter::eFRICTION_IMPULSE. +* PxVisualizationParameter::eCONTACT_IMPULSE flag was added to replace PxVisualizationParameter::eCONTACT_FORCE. + +### Deprecated + +* PxVisualizationParameter::eCONTACT_FORCE was deprecated. Use PxVisualizationParameter::eCONTACT_IMPULSE instead. + +### Fixed + +* A bug in Debug Visualization where collision contact points are misaligned with collision geometry. +* A bug in the GPU broadphase that resulted in a crash when overflowing the preallocated number of lost and found pairs. + +## Articulations + +### Added + +* Possibility to apply a force or a torque to an articulation link through articulation cache with the flags PxArticulationCacheFlag::eLINK_FORCE and PxArticulationCacheFlag::eLINK_TORQUE. + +### Fixed + +* Runtime changes to PxArticulationJointReducedCoordinate::setMaxJointVelocity() were not working for the GPU pipeline. +* Runtime changes to PxArticulationJointReducedCoordinate::setFrictionCoefficient() were not working for the GPU pipeline. +* A bug when adding articulations to a scene that already contained other articulations. +* Corrected the calculation of the first tangent vector used in the friction patch model of articulations. This may have increased the probability of artifacts in the friction calculation. + +## PVD + +### Fixed + +* Missing OVD object creation calls in deserializations of PxCollection and PxAggregate with regards to articulations. + +# v5.4.0-106.0 + +## Supported Platforms + +### Runtime + +* Linux (tested on Ubuntu 20.04 and 22.04) +* Microsoft Windows 10 or later (64 bit) +* GPU acceleration: display driver supporting CUDA toolkit 11.8 and Pascal GPU or above + +### Development + +* [Linux Platform Readme](documentation/platformreadme/linux/README_LINUX.md) +* [Windows Platform Readme](documentation/platformreadme/windows/README_WINDOWS.md) + +## General + +### Added + +* PxSceneFlag::eENABLE_EXTERNAL_FORCES_EVERY_ITERATION_TGS enabling better TGS solver convergence. +* PxSimulationStatistics contains a new struct PxGpuDynamicsMemoryConfigStatistics, which reports the actual values of the parameters in PxGpuDynamicsMemoryConfig for a simulation with GPU dynamics/broadphase. These statistics can be used to fine-tune the input parameters for subsequent runs. +* Added 64 bit versions of PxLowestSetBit and PxHighestSetBit. +* Friction patch information in the PxGpuContactPair structure. +* A "lightweight abort" mechanism was added to the GPU dynamics pipeline in order to avoid crashing the GPU context in case of insufficient GPU memory. See the guide section about GPU Rigid Bodies for more information. +* A possibility to query solver residuals (remaining error after position and/or velocity iterations) on the PxScene, PxConstraint and on PxArticulationReducedCoordinate. The scene flag PxSceneFlag::eENABLE_SOLVER_RESIDUAL_REPORTING must be raised to enable residual reporting. +* Added the ability to select the CUDA device in PxCudaContextManagerDesc. A CUDA device ordinal starts from 0 for the first CUDA capable device and so on. A CUDA device ordinal of -1 will use the CUDA device selected in the Nvidia Control Panel. + +### Changed + +* Rename PxgDynamicsMemoryConfig to PxGpuDynamicsMemoryConfig +* The signature for PxIntegrateSolverBodies() has changed. It will now return the updated linearMotionVelocity and angularMotionState values, which facilitates implementing the PhysX sleeping algorithm for immediate mode. +* PxGpuDynamicsMemoryConfig::tempBufferCapacity has been changed to PxU64. +* An error message was added when attempting to add any PxConstraint other than a D6 joint to a scene with direct-GPU API. Before it did not work silently. + +### Fixed + +* Race condition when adding a material while a scene starts simulating at the same time. +* Race condition where multiple links of larger articulations would accidentally write into the same memory on the GPU. +* A crash that happened when a pair of actors had lots of colliding shapes was fixed. [Issue #222](https://github.com/NVIDIA-Omniverse/PhysX/issues/222) +* A crash that happened when PxSceneDesc::maxNbContactDataBlocks was exceeded. [Issue #226](https://github.com/NVIDIA-Omniverse/PhysX/issues/226) +* A crash that happened when PxGpuDynamicsMemoryConfig::totalAggregatePairsCapacity was exceeded. +* A crash in the GPU island manager has been fixed. +* A crash that happened when doing contact modification while simulation on GPU [Issue #240](https://github.com/NVIDIA-Omniverse/PhysX/issues/240) +* PxsKernelWranglerManager is now instanced per PxCudaContextManager to enable running kernels on multiple GPUs. +* A rare crash due to memory corruption when articulations, normal joints and contacts (between rigid bodies and articulations) are present in a scene. + +### Deprecated + +* PxCudaContextManager::allocDeviceBuffer, PxCudaContextManager::freeDeviceBuffer, PxCudaContextManager::allocPinnedHostBuffer, PxCudaContextManager::freePinnedHostBuffer, PxCudaContextManager::clearDeviceBufferAsync, PxCudaContextManager::copyDtoH, PxCudaContextManager::copyHtoD, PxCudaContextManager::copyDToHAsync, PxCudaContextManager::copyHtoDAsync, PxCudaContextManager::copyDtoDAsync, PxCudaContextManager::memsetAsync and the macros using them have been deprecated. The replacement is to either use the direct functions in PxCudaContext, or the helpers provided in PxCudaHelpersExt.h as part of PhysXExtensions. +* PxPhysicsGPU::estimateSceneCreationGpuMemoryRequirements has been deprecated. PxPhysics::createScene() will return a null pointer if scene creation fails due to low GPU memory availability. +* Particle-cloth, -rigids, -attachments and -volumes (see Particle section for more details) +* PxSoftBody and PxFEMCloth attachment and filter methods. The functionality will be replaced with a new set of methods on PxScene. +* The single-threaded helper function PxAABBManager::update(PxBroadPhaseResults& results) has been deprecated, replaced with PxAABBManager::updateAndFetchResults(PxBroadPhaseResults& results). This is to avoid confusion between the two overloaded update() functions. +* PxScene::copyBodyData, PxScene::applyActorData, PxScene::copyArticulationData, PxScene::applyArticulationData, PxScene::updateArticulationsKinematic, PxScene::computeDenseJacobians, PxScene::computeGeneralizedMassMatrices, PxScene::computeGeneralizedGravityForces, PxScene::computeCoriolisAndCentrifugalForces, PxScene::copyContactData and PxScene::evaluateSDFDistances have been deprecated. Their replacements are located in PxDirectGPUAPI.h. Note that the function signatures have been updated to be more consistent, and the data layout of the GPU buffer has been changed. We refer to the API doc and the migration guide for detailed documentation. +* PxScene::applyParticleBufferData, PxScene::applySoftBodyData and PxScene::copySoftBodyData have been deprecated. There are no direct replacements, because most of the data exposed by these functions is already exposed directly on GPU in the regular PxParticleBuffer and PxSoftbody APIs. + +### Removed + +* Experimental FLIP and MPM Particle Systems (e.g. PxFLIPParticleSystem, PxFLIPMaterial, PxMPMParticleSystem, PxMPMMaterial). + +## Articulations + +### Added + +* A new mimic joint feature has been added to the sdk. A mimic joint attempts to enforce a linear relationship between the joint positions of two joint dofs of the same articulation instance. A mimic joint instance is created with the function PxArticulationReducedCoordinate::createMimicJoint() and may be destroyed with the function PxArticulationMimicJoint::release(). Releasing a PxArticulationReducedCoordinate instance will automatically release all mimic joints associated with the articulation. Mimic joints may only be created and released while the owner articulation is not in a PxScene instance. The linear relationship may be edited while the articulation is in a scene but not during the duration of a simulation step. The snippet SnippetMimicJoint demonstrates the features of a mimic joint. +* DirectGPUAPIArticulation snippet, showcasing the direct GPU API usage for articulation. + + +### Fixed + +* Root links reported an acceleration that accounted only for acceleration arising from gravity and external forces but did not account for the acceleration arising from contact impulses. This affected only articulations with non-fixed roots when querying link acceleration with PxArticulationReducedCoordinate::getLinkAcceleration() and PxArticulationCache::linkAcceleration. +* A bug in the PGS articulation self-collision contact code on GPU was fixed that caused velocity iterations to incorrectly take the position bias into account, leading to incorrect velocity updates. +* A bug in the TGS articulation multithreaded CPU codepath was fixed where contact writeback was incorrectly skipped if zero velocity iterations were performed. This previously led to incorrect values supplied to contact reports. +* A bug that caused instability for articulations with more than 64 links has been fixed. +* Root links reported an acceleration that accounted only for acceleration arising from gravity and external forces but did not account for the acceleration arising from contact impulses. This affected only articulations with non-fixed roots when querying link acceleration with PxArticulationReducedCoordinate::getLinkAcceleration() and PxArticulationCache::linkAcceleration. +* TGS articulation drive reported velocity that was inconsistent with joint movement when using a high stiffness. This was fixed by adjusting the target position during the substep iteration. +* A force or torque applied to an articulation link after the first simulation step was ignored in the subsequent simulation step; relevant for CPU API and GPU simulation. +* Some inverse dynamics functions (computeGeneralizedMassMatrix, computeGeneralizedGravityForce, computeDenseJacobian) were not using the most up to date joint positions and velocities when using the Direct GPU API. +* PxArticulationReducedCoordinate::getLinkAcceleration(linkId) reported an error when linkId was greater than 64. This limit is no longer a feature of PhysX articulations so the error was false and would have prevented queries of the acceleration of links with id > 64. This has been fixed. +* The root velocity of an articulation was not reliably propagated to GPU after an update using PxArticulationReducedCoordinate::applyCache() with the autowake argument set true and when the wake counter (see PxArticulationReducedCoordinate::setWakeCounter()) of the articulation was greater than PxPxSceneDesc::wakeCounterResetValue. This has been fixed. + +### Deprecated + +* Deprecated the kinematic articulation drive modes PxArticulationDriveType::eTARGET and PxArticulationDriveType::eVELOCITY. Use stiffness = 1e+25f and damping = 0.f to obtain eTARGET behavior, and stiffness = 0.f and damping = 1e+25f to obtain eVELOCITY behavior. +* Deprecated PxArticulationReducedCoordinate::addLoopJoint, PxArticulationReducedCoordinate::removeLoopJoint, PxArticulationReducedCoordinate::getNbLoopJoints, PxArticulationReducedCoordinate::getLoopJoints, which will be removed together with PxContactJoint. + +### Removed + +* PxArticulationSensor has been removed. Related API and flags are removed as well: PxArticulationReducedCoordinate::createSensor, getSensors, getNbSensors; PxArticulationCache::sensorForces, PxArticulationCacheFlag::eSENSOR_FORCES, PxArticulationGpuDataType::eSENSOR_FORCE; and PxArticulationSensorFlag. The replacement is PxArticulationCache::linkIncomingJointForces. +* PxArticulationCache::jointSolverForces has been removed together with the corresponding PxArticulationCacheFlag::eJOINT_SOLVER_FORCES, PxArticulationGpuDataType::eJOINT_SOLVER_FORCE, and PxArticulationFlag::eCOMPUTE_JOINT_FORCES. The replacement is PxArticulationCache::linkIncomingJointForces. + +## Rigid Body + +### Added + +* PxMaterial::setDampingCombineMode has been added to allow choosing between different material combination modes for compliant contact damping. +* Dynamic rigid bodies with an SDF now utilize a specialized CUDA kernel to calculate contact points with a particle system. +* Rigid bodies contact reporting now has friction impulse information. +* PxSceneFlag::eENABLE_BODY_ACCELERATIONS has been added to enable computations of per-actor accelerations. They can be retrieved using the new PxRigidBody::getLinearAcceleration() and PxRigidBody::getAngularAcceleration() functions. +* RBDirectGPUAPI snippet, showcasing the direct GPU API usage for rigid body simulation. + +### Changed + +* For two rigids with compliant contact interactions, the combined compliance is now calculated according to the material combine mode rules. Previously, always the stiffer material was chosen. To recover the old behavior, choose the MIN material combine mode. +* For two rigids with compliant contact interactions, the combined damping is now calculated according to the material combine mode rules. Previously, always the higher damping was chosen. To recover the old behavior, choose the MAX material combine mode. +* The PGS solver no longer multiplies a positive geometric bias for collisions with the ERP factor. Previously, doing so could have resulted in contact forces acting at a distance even if the bodies were not due to collide in the current frame. The old behavior caused bodies to only approach each other asymptotically with repelling forces potentially acting as soon as the contact distance is undercut. + +### Fixed + +* Using PxMaterialFlag::eCOMPLIANT_CONTACT but then specifying a positive restitution value on materials could lead to different behavior on CPU vs. GPU. +* A bug in the convex-vs-convex PCM function has been fixed. +* A bug in the contact preparation code caused compliant contacts to produce repulsive damping forces even when shapes were separated. This is now fixed such that the damping effect only becomes active if the contact separation is negative at the beginning of the step or is expected to become negative during the step. + +### Deprecated + +* The PxMaterialFlag::eCOMPLIANT_CONTACT has been deprecated. Compliant contact behavior is now active whenever a negative restitution value is set. +* PxMaterialFlag::eIMPROVED_PATCH_FRICTION has been deprecated. At a future point, the PhysX SDK will always behave as if this flag was set and no longer support the legacy behavior (triggered by not raising the flag). At that point, this flag will be removed. Until then, it is highly recommended to always set this flag to adapt to the corresponding friction behavior (note that this flag is currently raised by default when creating a rigid body material, thus action needs only be taken if the flag was cleared explicitly). +* PxFrictionType::eTWO_DIRECTIONAL has been deprecated and will be removed in the future. Please use PxFrictionType::ePATCH instead. + +## Joints + +### Fixed + +* Px1DConstraint joint drive did not produce the same force magnitude for drives with velocity biases that were equally positive and negative. This was true of the CPU and GPU solver pipelines. This has been fixed. +* Px1DConstraint joint drive produced unphysically large forces when run in combination with PxSolverType::eTGS and non-zero velocity iteration count. This was true of the CPU and GPU solver pipelines. This has been fixed by no longer updating joint drive force during velocity iterations with PxSolverType::eTGS. The expectation is that there are sufficient position iterations such that the drive force that accumulated over the position iterations is an accurate force. This avoids numerical discrepancies arising from the difference in effective simulation timestep employed by the position and velocity iterations. This discrepancy was particularly acute with a large number of velocity iterations. +* Px1DConstraint joint drive suffered from an unphysical damping term with all combinations of PxSolverType::eTGS/PxSolverType::ePGS/PxSceneFlag::eENABLE_GPU_DYNAMICS. This has been fixed. +* Px1DConstraint (and as such joints) was not respecting the bounce threshold velocity for restitution if an articulation link was involved and when running on GPU. +* Px1DConstraint was using an inconsistent impulse multiplier (Baumgarte Term) for resolving the geometric error of a hard constraint when running on CPU with PxSolverType::ePGS and articulations being involved. As a result, the geometric error might not have been fully resolved. +* Px1DConstraintFlag::eKEEPBIAS was ignored when running on GPU and when an articulation was involved. +* D6 and other maximal-coordinate joints constraining articulation links sometimes did not constrain all degrees of freedom that were supposed to be locked. This has been fixed. +* Px1DConstraint with PxConstraintSolveHint::eINEQUALITY set was processed inconsistently on GPU when an articulation link was involved. This might have resulted in geometric error not being resolved to the expected degree. +* PxJoint::getRelativeLinearVelocity() and ::getRelativeAngularVelocity() did not provide the velocity as documented (wrong frame was used). This affects PxPrismaticJoint::getVelocity() and PxRevoluteJoint::getVelocity() too since those were using the broken methods internally. +* Joints configured with a limit and a non-zero restitution potentially behaved as though the limit had been breached even though it had not been breached. This has been fixed so that the limit is properly observed. + +## Cooking + +### Changed + +* PxSDFBuilder::buildSDF() and PxSDFBuilder::buildSparseSDF() now return a boolean that indicates whether SDF creation succeeded. + +## Particles + +### Added + +* PxSceneFlag::eENABLE_EXTERNAL_FORCES_EVERY_ITERATION_TGS enabling better TGS solver convergence. Enabling the flag greatly reduces boiling. Currently just implemented for particles. +* PxParticleLockFlags, PxParticleSystem::setParticleLockFlag, getParticleLockFlags. Allows restricting particle motion to specified coordinate axis. + +* createPBDParticleSystem takes an additional optional parameter neighborhoodScale, which can be increased to help stability. +* PxParticleBuffer::userData +* PxParticleSystem::getGridSizeX, getGridSizeY, getGridSizeZ +* Basic Omni PVD support. Streaming and visualizing particle positions and PxPBDParticleSystem, PxPBDMaterial and PxParticleBuffer properties. + +### Deprecated + +* PxParticleSystem::enableCCD is deprecated, use PxParticleFlag::eENABLE_SPECULATIVE_CCD instead. + +### Fixed + +* Improved CFL clamping for PxPBDParticleSystem. Motion is only limited for particles approaching each other. PxPBDMaterial::setCFLCoefficient(): Legal value range has been extended to [0, PX_MAX_F32). +* Fixed impulse mix-up when applying impulses to rigid bodies based on interactions with particles, softbodies and cloth. + +### Removed + +* Experimental FLIP and MPM Particle Systems (e.g. PxFLIPParticleSystem, PxFLIPMaterial, PxMPMParticleSystem, PxMPMMaterial). +* PxParticleBuffer::bufferIndex, setInternalData(), onParticleSystemDestroy(), removed internals leaking into the API. + +### Deprecated + +* PxParticleSystem (particle system base class obsolete after removing PxFLIPParticleSystem and PxMPMParticleSystem). Typedef PxParticleSystem as PxPBDParticleSystem. +* PxParticleMaterial (particle material base class obsolete after removing PxFLIPMaterial and PxMPMMaterial). Typedef PxParticleMaterial as PxPBDMaterial. +* PxParticleSolverType, PxScene::getNbParticleSystems, PxScene::getParticleSystems (use PxScene::getNbPBDParticleSystems, PxScene::getPBDParticleSystems instead.) +* PxParticleSystem::enableCCD(), replaced by PxParticleFlag::eENABLE_SPECULATIVE_CCD +* PxParticleBuffer::bufferUniqueId, replaced by PxParticleBuffer::getUniqueId() +* Particle Cloth (please use PxFEMCloth instead) + * PxParticleSpring, PxParticleCloth, PxParticleClothDesc, PxPartitionedParticleCloth, PxParticleClothBuffer + * PxParticleClothBufferHelper, PxCreateParticleClothBufferHelper, PxCreateAndPopulateParticleClothBuffer + * PxParticleClothConstraint, PxParticleClothCooker, PxCreateParticleClothCooker + * PxPBDMaterial::setLift, getLift, getDrag, setDrag. +* Particle Rigids (please use standard rigid bodies instead) + * PxParticleRigidBuffer, PxParticleRigidBufferHelper, PxCreateParticleRigidBufferHelper, PxCreateAndPopulateParticleRigidBuffer. +* Particle Attachments and Filters + * PxParticleRigidFilterPair, PxParticleRigidAttachment + * PxParticleAttachmentBuffer, PxCreateParticleAttachmentBuffer + * PxPBDParticleSystem::addRigidAttachment, removeRigidAttachment. + * PxParticleBuffer::setRigidFilters, setRigidAttachments +* Particle Volumes + * PxParticleVolume, PxParticleVolumeMesh, PxParticleVolumeBufferHelper, PxCreateParticleVolumeBufferHelper + * PxParticleBuffer::getParticleVolumes, getNbParticleVolumes, setNbParticleVolumes, getMaxParticleVolumes + +## Extensions + +### Fixed + +* A bug in PxGjkQueryExt::ConvexMeshSupport::supportLocal() function. Worked incorrectly with scaled convex meshes. +* A bug in PxCustomGeometryExt::BaseConvexCallbacks::raycast() function. Wasn't setting hit flags correctly. +* A bug in PxSoftBodyExt::createSoftBodyMesh function. Wasn't generating proper voxel meshes. + +## Soft Body + +### Changed: + +* Soft body convergence is improved for corotational model (PxFEMSoftBodyMaterialModel::eCO_ROTATIONAL). Behavior changes are expected. +* Soft body collisions against rigid bodies now make use of the SDF data if it is present on the rigid. Behavior changes are expected. +* A Poisson's ratio value of 0.5 is supported. + +### Fixed: + +* Fixed impulse mix-up when applying impulses to rigid bodies based on interactions with particles, softbodies and cloth. +* Fixed a problem when TGS with the option "external forces per substep" was active leading to softbodies losing their stiffness. + +### Deprecated + +* Deprecated PX_MAX_TETID and replaced with PX_MAX_NB_SOFTBODY_TET (maximum number of tetrahedron supported in a softbody mesh), and added PX_MAX_NB_SOFTBODY (maximum number of softbody actors supported in a scene). Use PX_MAX_NB_SOFTBODY_TET instead of PX_MAX_TETID to filter against all tetrahedron in a softbody. + +## Pvd + +### Added + +* A new OmniPvd stream class called PxOmniPvdMetaData, which contains the PhysX version (major, minor, patch) as well as an OVD integration version +* A new PxGpuDynamicsMemoryConfig serialization class referenced by PxScene. +* OmniPVdWriter::getStatus() which returns an unsigned 32 bit integer flag bit mask. +* A new structure OmniPvdWriterStatusFlag describing the flag mask mentioned above. +* OmniPVdWriter::clearStatus() which clears the status of the OmniPvdWriter object. +* A new define OMNI_PVD_INVALID_HANDLE used by the OmniPVDWriter for returning invalid handles. Value is still 0 for the invalid handle. +* Now also supports OVD recording when PxScene is set to use the Direct GPU API. +* PxArticulationReducedCoordinate properly exports the global sleep state. +* The Direct GPU API has support for recording the post simulation state into OVD, after each simulation frame. The support covers rigid bodies, articulations and collision data. +* Added support for particles : PxPBDParticleSystem, PxParticleBuffer, PxDiffuseParticleParams and PxParticleAndDiffuseBuffer. +* Added support fort PxArticulationMimicJoint. + +### Fixed + +* Each call to OmniPvdReader::getNextCommand, now re-sets the gettable command parameters to 0 or OMNI_PVD_INVALID_HANDLE if the parameter is a handle. This prevents "leaking" of cached command parameters from a call of getNextCommand to another. +* Fixed a crash bug for recording OVD data into a stream that was not possible to open. +* SnippetOmniPvd now checks for the return value of the startSampling function and return an error message if not able to record into OVD. + +### Changed: + +* OVD streams of classes deriving from PxRigidActor serialize their rotation and translation attributes into a single globalPose transform +* PxArticulationLink objects only stream the globalPose transform. Previously the rotation and translation attributes contained the local transform. +* PxShape no longer streams rotation and translation separately but instead serializes that into a single attribute called localPose (4 floats quaternion, 3 float translation). +* Every startFrame call made by the PhysX SDK to the OmniPVD API, now sets the PxScene pointer as context. Increases the OVD integration versions to 1.4. + +# v5.3.1-105.1 + +## General + +### Changed + +* PxgDynamicsMemoryConfig::tempBufferCapacity will now be interpreted as a user-provided initial size, and will resize automatically if more memory is needed. + +### Fixed + +* A bug that led to phantom collisions for convex-heightfield interactions on GPU has been fixed. +* A bug that caused velocity and impulse updates of the GPU articulation solver (PGS and TGS) not to be propagated to subsequent iterations, causing slower convergence and potentially unstable collision responses between rigids and articulations. +* Fixed binary serialization for GPU enabled triangle meshes and meshes with SDF support. +* Several bugs with GPU aggregates have been fixed that could have led to missed and phantom collisions. The issues were mostly related to additions/removals of aggregate contents. +* Gpu accelerated SDF cooking is now deterministic. +* SDF snippet shows how to optionally store cooked data into files. +* Small improvements to SDF collisions, especially when objects with wildly different size collide. +* Creating objects from a PxInputData containing invalid data could lead to a confusing (and incorrect) error message about a "double deletion". This has been fixed. +* Bugs in island management related to actors other than rigid bodies. +* A bug that could lead to a crash when calling the PxTetMaker::validateTriangleMesh function with a mesh referencing more vertices than passed into the function. That defect is now reported as eTRIANGLE_INDEX_OUT_OF_RANGE. +* A crash bug that appeared when releasing actors with externally-provided forces and torques has been fixed. [Issue #211](https://github.com/NVIDIA-Omniverse/PhysX/issues/211) +* A bug that caused a memory corruption in the GPU solver when using D6 joints with rigid bodies and articulations has been fixed. + +## Rigid Body + +### Added + +* The extraction of an isosurface from a SDF can now use multiple CPU cores. + +### Fixed + +* A crash happening when using contact report thresholds with point-friction (PxFrictionType::eONE_DIRECTIONAL / PxFrictionType::eTWO_DIRECTIONAL) has been fixed. +* A "fear of the wireframe" issue in Sphere vs TriangleMesh collision when simulating on GPU is fixed. + +## Articulations + +### Fixed + +* Articulation joint velocity limits are respected when articulation joint drives are configured to push past the limit. +* Spherical articulation joints could sometimes flip their position by 2 pi causing problems with joint limits. This has been fixed. + +## Joints + +### Fixed + +* The PxConstraintFlag::eENABLE_EXTENDED_LIMITS flag now works properly for D6 based revolute joints when the GPU pipeline with the TGS solver is active. + +## Character controller + +### Fixed + +* You can now only create one PxCreateControllerManager per PxScene. This avoids filtering-related issues when multiple controller managers are created for the same PxScene. + +## Particles + +### Added + +* PxParticleSystem::getParticleMaterials() to query materials that have been registered with phases. + +### Fixed + +* PxParticleSystem::getNbParticleMaterials() always returned 1, instead of the materials referenced by phases. +* Particle - Convex Shape collisions failing with spread out particles. +* Particle phase references to PxPBDMaterial were broken when releasing (an unreferenced) PxPBDMaterial. + +## Pvd + +### Added + +* A way to get a thread safe OmniPvd writer from the PxOmniPvd interface through using acquireExclusiveWriterAccess() and releaseExclusiveWriterAccess(). + +### Fixed + +* OmniPVD no longer breaks when running and recording multiple scenes in parallel. +* Corrected mirroring of the inbountJoinDOF attribute of PxArticulationLink + +## Extensions + +### Fixed + +* A bug in custom cone/cylinder collision with triangle meshes. There was a gap between a cone/cylinder and a mesh, noticeable for centimeter-scale shapes. Note that the last position argument of e.g.: PxCustomGeometryExt::CylinderCallbacks::useSubstituteGeometry was removed from the API. + +# v5.3.0-105.1 + +## Supported Platforms + +### Runtime + +* Linux (tested on Ubuntu 20.04) +* Microsoft Windows 10 or later (GPU acceleration: display driver and GPU supporting CUDA 11 / CUDA ARCH 3.0) + +### Development + +* Microsoft Windows 10 or later +* Microsoft Visual Studio 2017, 2019, 2022 + +## General + +### Changed + +* The method PxLineStripSkinning::evaluateInterpolatedVertices changed the transform argument from `PxReal*` to ` PxMat44*` to be more explicit about the underlying data that is expected. +* The apply* and copy* functions in PxScene changed their event arguments from `void*` to `CUevent` to fix misunderstandings about the type of those arguments. This also fixes a bug where pointers to events where passed but not dereferenced when recording/awaiting them. +* The TGS solver on CPU and GPU now computes the number of position and velocity iteration according to the requested numbers by the actors in each island, matching the behavior of the PGS solver. Previously TGS velocity iterations in excess of 4 were silently converted to position iterations. To preserve the old behavior any actor requesting more than 4 velocity iterations should convert excess velocity iteration counts to position iteration counts, e.g., formerly 10 position and 10 velocity iterations should become 16 position and 4 velocity iterations. +* The `acquire()` and `release()` functions in `PxCudaContextManager` that manage the PhysX CUDA context now use push/pop semantics. This fixes bug that led to a wrong context being bound after `release()` when sharing an existing CUDA context with PhysX. +* Calling `setCMassLocalPose()` on a rigid body when using the direct-GPU API is now allowed. Note that calling `updateArticulationsKinematic()` after updating CMassLocalPose but before the next call to `simulate()` will still use the old CMassLocalPose. + +### Fixed + +* A memory leak has been fixed in the actor pairs management code. +* A race condition was fixed that led to nondeterministic contact reports in some scenarios. +* Fix FEM cloth attachment filtering bug +* Fix FEM narrow phase collision crash +* Sphere-Trianglemesh collision bug is fixed +* A bug that led to aggregated shapes being processed as part of the regular broadphase when changing transforms using the direct-GPU API has been fixed. +* A bug that led to missed collisions and phantom collisions when changing transforms using the direct-GPU API has been fixed. +* A bug that led to incorrect and nondeterministic behaviour for convex-trianglemesh, convex-heightfield, sphere-trianglemesh, capsule-trianglemesh, sphere-heightfield and capsule-heightfield collisions on GPU has been fixed. +* A bug that led to contact target velocities spilling over from one contact to other contacts in the same solver batch. +* A bug that led to incorrect and nondeterministic behaviour for trianglemesh-trianglemesh collisions on GPU has been fixed. +* A bug that led to incorrect materials being used for convex-convex collisions on GPU has been fixed. + +### Removed + +* Context creation for CUDA/Graphics interoperability has been deprecated. interopMode has been removed from PxCudaContextManagerDesc. +* PxSceneFlag::eFORCE_READBACK has been removed. There is no replacement. +* PxSceneFlag::eSUPPRESS_READBACK was deprecated and has been removed. Use PxSceneFlag::eENABLE_DIRECT_GPU_API instead. + +## Rigid Body + +### Added + +* Possibility to use the GPU to cook an SDF making the process a lot faster. +* Option to launch CUDA kernels synchronously when creating the CUDA Context Manager. This option is required to accurately determine the correct kernel that returns a CUDA error. + +### Fixed + +* The torsional patch radius parameter (see PxShape::setTorsionalPatchRadius()) was potentially ignored when running the simulation on GPU. +* Potential race condition related to activating/deactivating trigger pairs. +* A small misalignment of SDFs with the triangle mesh. +* A small error in the gradient calculation of SDFs. +* A sphere could tunnel through the edge between two triangles in a triangle mesh. +* Race condition in SDF computation cuda kernel is fixed. +* Fixed invalid access problem when selecting the SDF contact handler. + +### Deprecated + +* PxFrictionType::eONE_DIRECTIONAL has been deprecated and will be removed in the future. Please use ePATCH or eTWO_DIRECTIONAL instead. + +## Articulations + +### Changed + +* `PxScene::copyArticulationData()` and `PxScene::applyArticulationData()` do not allow reading write-only and writing read-only data anymore. Read/write properties are specified in the API doc of `PxArticulationGpuDataType`. + +### Fixed + +* A bug that led to wrong joint targets being set when using the direct-GPU API has been fixed. +* A bug that led to link constraint-force-mixing scale not being included in collision constraints when using GPU dynamics has been fixed. +* Articulation drive did not produce the same force magnitude for drives with velocity biases that were equally positive and negative. This was true of the CPU and GPU solver pipelines. This has been fixed. +* Articulation drive produced unphysically large forces when run in combination with PxSolverType::eTGS and non-zero velocity iteration count. This was true of the CPU and GPU solver pipelines. This has been fixed by no longer updating joint drive force during velocity iterations with PxSolverType::eTGS. The expectation is that there are sufficient position iterations such that the drive force that accumulated over the position iterations is an accurate force. This avoids numerical discrepancies arising from the difference in effective simulation timestep employed by the position and velocity iterations. This discrepancy was particularly acute with a large number of velocity iterations. +* Articulation drive suffered from an unphysical damping term with all combinations of PxSolverType::eTGS/PxSolverType::ePGS/PxSceneFlag::eENABLE_GPU_DYNAMICS. This has been fixed. +* Potential crashes due to reading uninitialized memory were fixed. +* The function PxArticulationReducedCoordinate::setMaxCOMAngularVelocity() had no effect if called after the 1st sim step with PxSceneFlag::eENABLE_GPU_DYNAMICS raised. This has been fixed. +* The function PxArticulationReducedCoordinate::setMaxCOMLinearVelocity() had no effect if called after the 1st sim step with PxSceneFlag::eENABLE_GPU_DYNAMICS raised. This has been fixed. +* Raising or lowering PxArticulationFlag::eFIX_BASE had no effect if modified after the 1st sim step with PxSceneFlag::eENABLE_GPU_DYNAMICS raised. This has been fixed. +* The root link acceleration was reported as {0} even when the root link was not fixed. This affected GPU only. The fix has been applied to PxArticulationReducedCoordinate::copyInternalStateToCache(), PxArticulationReducedCoordinate::getLinkAcceleration() and PxScene::copyArticulationData(). +* Only half the expected friction force was applied in certain scenarios when using PxSolverType::eTGS, PxFrictionType::ePATCH, PxMaterialFlag::eIMPROVED_PATCH_FRICTION and running on CPU. + +### Deprecated + +* The functions PxArticulationReducedCoordinate::setMaxCOMLinearVelocity(), PxArticulationReducedCoordinate::getMaxCOMLinearVelocity(), PxArticulationReducedCoordinate::setMaxCOMAngularVelocity(), PxArticulationReducedCoordinate::getMaxCOMAngularVelocity() have all been marked as deprecated and will be removed in a future release. + +## Joints + +### Deprecated + +* Px1DConstraintFlag::eDRIVE_ROW has been marked as deprecated and will be removed in a later release. It has been renamed to Px1DConstraintFlag::eDEPRECATED_DRIVE_ROW to signal the intention to remove this flag in a later release. + +## Vehicles2 + +### Added + +* A new snippet that shows an example of using a custom tire model has been added (see SnippetVehicle2CustomTire). + +### Changed + +* The snippet SnippetVehicle2Customization has been renamed to SnippetVehicle2CustomSuspension. +* PxVehicleCommandNonLinearResponseParams::nbSpeedRenponsesPerCommandValue was misspelled and now renamed to nbSpeedResponsesPerCommandValue. +* More parameters get recorded by OmniPVD. As a consequence, PxVehiclePVDComponent and some other PVD related vehicle APIs changed. +* It is now legal to set entries in PxVehicleTankDriveDifferentialParams::nbWheelsPerTrack to 0 or 1. +* The APIs of some methods use more specific input parameters now to decrease dependency on certain data structures. See the migration guide for more details. This applies to the methods: PxVehicleTireDirsUpdate(), PxVehicleTireCamberAnglesUpdate() and PxVehicleTireGripUpdate(). + +### Fixed + +* Nonlinear command responses were broken for negative steer command values. Now they are treated symmetrically as intended. +* PxVehiclePhysXActorDestroy() triggered a warning if the articulation link was not a leaf link. + +### Removed + +* PxVehicleTankDriveDifferentialParams::nbWheelsInTracks has been removed. The entries in ::nbWheelsPerTrack can be summed up to compute that value instead. + +## Cooking + +### Added + +* PxTriangleMeshCookingResult::eEMPTY_MESH has been added. This cooking result is output when the mesh cleaning process removes all the triangles of a mesh. +* PxCookingParams::meshAreaMinLimit has been added. This is used in the mesh cleaning process to remove triangles whose area is too small. +* PxCookingParams::meshEdgeLengthMaxLimit has been added. + +### Changed + +* The requirements for convex meshes being GPU compatible have been tightened. Overly oblong meshes are now rejected by the cooking with an error message. Collision +detection will fall back to CPU for these meshes. + +### Fixed +* Fixed out of memory crash when cooking a convex hull of a very high resolution mesh. + +## Soft Body + +### Added + +* Support for voxel meshes with 5 tetrahedra per voxel to counteract anisotropy in the mesh. + +### Changed: + +* Defaults of PxConeLimitedConstraint::mLowLimit, mHighLimit have been changed to -1.0 indicating no limit. +* Soft body sleep damping is improved to minimize an effect that looks like a soft body would lower its stiffness before it goes to sleep. + +### Fixed +* Overflow of the soft body contact buffer will result in a warning. + +## Extensions + +### Added + +* CCD support for PxCustomGeometryExt::CylinderCallbacks and PxCustomGeometryExt::ConeCallbacks. + +### Changed + +* PxCustomGeometryExt::CylinderCallbacks and PxCustomGeometryExt::ConeCallbacks classes have their public member variables (height, radius, axis and margin) replaced with setter and getter member functions. + +## Pvd + +### Fixed + +* Better coverage in OVD of attribute mirroring for : PxActor, PxRigidActor, PxRigidBody, PxRigidStatic and PxRigidDynamic, specifically for initial values, user set functions and post simulation updates. + +# v5.2.0 & v5.2.1 + +## Supported Platforms + +### Runtime + +* Linux (tested on Ubuntu 20.04) +* Microsoft Windows 10 or later (GPU acceleration: display driver and GPU supporting CUDA 11 / CUDA ARCH 3.0) + +### Development + +* Microsoft Windows 10 or later +* Microsoft Visual Studio 2017, 2019, 2022 + +## General + +* PhysX GPU binaries built with CUDA toolkit 11.8. + * Added compute capability 8.9 (Ada) and 9.0 (Hopper) + * Removed compute capability 5.0 (Maxwell) + * Enabled multi-threaded cuda kernel compilation + +### Changed: + +* INVALID_FILTER_PAIR_INDEX has been moved out of the public API. It was incorrectly exposed to users. +* The API for the filter callback changed slightly. The pairID parameter in PxSimulationFilterCallback::pairFound(), PxSimulationFilterCallback::pairLost() and PxSimulationFilterCallback::statusChange() is now a PxU64 instead of a PxU32. The filter callback will now be called from multiple threads. +* Minimum required Windows OS version was changed from Windows XP to Windows 7 +* Replaced all calls to `select` with calls to `poll` in the socket implementations +* PxSceneFlag::eENABLE_DIRECT_GPU_API and its predecessor PxSceneFlag::eSUPPRESS_READBACK are now immutable. +* CmakeModules is no longer an external dependency. It's now included in PhysX source. + +### Fixed + +* A bug that produced duplicate broadphase pairs and led to rapidly increasing GPU memory consumption was fixed. +* An immediate mode bug has been fixed. It was happening in the contact generation code, using persistent contacts, and could produce jittering. +* An indexing error was corrected that caused the CPU PGS solver with point friction to skip velocity and impulse writebacks in some scenarios. +* A thread synchronization issue was addressed that may have caused nondeterministic behavior in the CPU PGS solver. +* A crash that appeared when overflowing the maximum amount of aggregate pairs in the GPU broadphase has been fixed. +* A bug that generated broadphase pairs for removed shapes has been fixed. +* A crash that occurred when using excessively small contact buffers and/or patch buffers on the GPU. Now, contacts that don't fit into the buffer are dropped, and an error is reported. +* A bug when running generate_projects.bat if one of the parent directories contain a space. + +### Deprecated + +* PxSceneFlag::eFORCE_READBACK is deprecated. There is no replacement. +* PxSceneFlag::eSUPPRESS_READBACK is deprecated. The replacement is PxSceneFlag::eENABLE_DIRECT_GPU_API. + +### Removed + +* PxBVHStructure has been removed. Use PxBVH. +* PxBVHStructureDesc has been removed. Use PxBVHDesc. +* PxPhysics::getBVHStructures() has been removed. Use PxPhysics::getBVHs() +* PxGetAssertHandler() and PxSetAssertHandler() have been removed. +* PxMassModificationProps has been removed. Use PxConstraintInvMassScale instead. +* PxRegisterImmediateArticulations, PxRegisterArticulationsReducedCoordinate, PxRegisterHeightFields, PxCreateBasePhysics have been removed. Articulations and heightfields are now always enabled. +* PxBuffer has been removed. There is no replacement. The soft body interface now exposes direct access to GPU buffers. +* GpuExtension library has been removed. +* The deprecated PxPhysicsInsertionCallback has been removed. Please use PxInsertionCallback instead. +* The deprecated PxTaskType::Enum entries TT_CPU, TT_NOT_PRESENT and TT_COMPLETED have been removed. These entries were replaced with eCPU, eNOT_PRESENT and eCOMPLETED. +* These deprecated immediate-mode types have been removed: PxFeatherstoneArticulationJointData, PxFeatherstoneArticulationLinkData, PxFeatherstoneArticulationData, PxMutableLinkData, PxLinkData. +* The deprecated PxPhysics::createBVHStructure() and PxPhysics::getNbBVHStructures() functions have been removed. +* A deprecated PxPhysics::createAggregate() function has been removed. +* Deprecated passthrough functions in PxShape such as `getGeometryType()` and the specialized `getGeometry()` were removed. Calls to these functions should be replaced by the accessing the underlying geometry directly with `getGeometry()`. +* Context creation for CUDA/Graphics interoperability has been deprecated. interopMode has been removed from PxCudaContextManagerDesc. +* No more Support for Microsoft Visual Studio 2013 and 2015. +* All 32 bits presets are removed. + +## Rigid Body + +### Fixed + +* A crash involving static or kinematic aggregates used in combination with PxPairFilteringMode::eKILL has been fixed. +* PxRigidDynamicLockFlags (especially the linear lock flags) did not work properly with PGS. This has been fixed. +* A rare bug involving GPU aggregates, in which newly created actors could freely move through existing actors, has been fixed. +* A crash with invalid setups, where multiple materials were set on a shape referencing a triangle mesh that had no per-triangle material indices, has been fixed. Additionally this invalid setup will now trigger an error message. +* The convex-vs-mesh PCM contact generation is now more robust (CPU/GPU). Some jittering cases have been fixed. +* The capsule-vs-mesh PCM contact generation is now more robust (GPU). Some jittering cases have been fixed. +* A bug that produced jittering when contact modification was used has been fixed. It happened mainly for primitives-vs-mesh contacts, in cases where multiple contact patches were involved. +* A bug in GPU box-box contact generation that caused memory overflows and nondeterministic behavior as a result. +* A bug in the constraint solver that was using wrong indices to solve friction constraints. +* A crash in the GPU broadphase with empty aggregates has been fixed. +* Limited the maximum amount of memory that the SDF debug visualizer uses to avoid out-of-memory errors on high-resolution SDFs. +* A sufficiently large number of contacts is now generated for a dynamic object with an SDF collider lying on a single, large static triangle represented by a triangle mesh collider. +* Improved robustness to imperfect input when cooking SDFs; for example, duplicate triangles with opposite winding now produce a correct SDF. +* Fixed a rare case where the SDF contact generation algorithm could get stuck on SDF singularities and produce incorrect contacts. +* Resolved a crash that occurred when a sphere primitive collider comes into contact with an SDF collider. + +## Articulations + +### Added + +* A new feature that computes and reports the force applied by a joint to a child link has been added. The reported force is in the joint's child frame. A more detailed specification of the reported force may be found in the doxy for the newly added array PxArticulationCacheFlag::eLINK_INCOMING_JOINT_FORCES. The force may be queried on CPU using the newly added flag PxArticulationCacheFlag::eLINK_INCOMING_JOINT_FORCES in conjunction with the newly added array PxArticulationCache::linkIncomingJointForce and the pre-existing function PxArticulationReducedCoordinate::copyInternalStateToCache(). The equivalent with the direct GPU API is to use the newly added enumeration PxArticulationGpuDataType::eLINK_INCOMING_JOINT_FORCE in conjunction with the pre-existing function PxScene::copyArticulationData(). + +### Fixed + +* A rare bug involving articulations in aggregates has been fixed. An internal counter was not correctly updated, and could lead to internal asserts and potential crashes. +* Setting root link transforms or joint positions with the PxScene GPU API could result in incorrect collision behavior if an articulation contained links with no shapes. +* Incorrect values for link acceleration were reported with PxSceneFlag::eENABLE_GPU_DYNAMICS raised and lowered and with PxSceneFlag::eSUPPRESS_READBACK raised and lowered. This affected PxArticulationReducedCoordinate::getLinkAcceleration(), PxArticulationCache::linkAcceleration and PxScene::copyArticulationData(). This bug has been fixed. +* Incorrect values for joint acceleration were reported when PxSceneFlag::eENABLE_GPU_DYNAMICS was raised. This affected PxArticulationGpuDataType::eJOINT_ACCELERATION/PxScene::copyArticulationData() with PxSceneFlag::eSUPPRESS_READBACK raised and PxArticulationCacheFlag::eACCELERATION/PxArticulationReducedCoordinate::copyInternalStateToCache()/PxArticulationCache::jointAcceleration with PxSceneFlag::eSUPPRESS_READBACK lowered. This bug has been fixed. +* Setting a target velocity on a modifiable contact of an articulation link was not working properly. This has been fixed. +* A crash that appeared when adding an articulation was added and removed from a scene without running a sim step in-between has been fixed. +* Articulation links with extremely large mass in excess of approximately 1e+7 mass units had a tendency to fall through the ground due to internal threshold guards. This affected all solver types running on CPU. This has been fixed. +* A floating-point precision issue resulting in slower-than-expected moving prismatic joints under certain simulation conditions with the TGS solver on GPU has been fixed. + +### Deprecated + +* PxArticulationSensor has been deprecated. Related API and flags are deprecated as well: PxArticulationReducedCoordinate::createSensor, getSensors, getNbSensors; PxArticulationCache::sensorForces, PxArticulationCacheFlag::eSENSOR_FORCES, PxArticulationGpuDataType::eSENSOR_FORCE; and PxArticulationSensorFlag. +* PxArticulationCache::jointSolverForces has been deprecated together with the corresponding PxArticulationCacheFlag::eJOINT_SOLVER_FORCES, PxArticulationGpuDataType::eJOINT_SOLVER_FORCE, and PxArticulationFlag::eCOMPUTE_JOINT_FORCES. The replacement is PxArticulationCache::linkIncomingJointForces. + +### Removed + +* Deprecated PxArticulationJointReducedCoordinate::setLimit and PxArticulationJointReducedCoordinate::getLimit were removed. Use PxArticulationJointReducedCoordinate::setLimitParams and PxArticulationJointReducedCoordinate::getLimitParams instead. +* Deprecated PxArticulationJointReducedCoordinate::setDrive and PxArticulationJointReducedCoordinate::getDrive were removed. Use PxArticulationJointReducedCoordinate::setDriveParams and PxArticulationJointReducedCoordinate::getDriveParams instead. + +### Changed + +* Debug visualization of articulation links (body mass axes) will now show their sleeping state (similar to rigid bodies). + +## Joints + +### Changed + +* The debug visualization color of active limits has changed from red to yellow. + +### Removed + +* Joint projection has been removed. +* The joint's "contact distance" parameter has been removed. The limits are now always active. + +### Fixed + +* The D6 joint's twist drive was using the wrong actor's axis (B instead of A). This has been fixed, and it could affect joint setups in existing scenes. To fix this in existing content it might be enough to flip the joint frames of involved actors, but this may not be possible depending on which other features (joint limits, etc) have been setup for the same joint. In the worst case it might be necessary to re-tune these joints. +* D6 joints configured to act as fixed joints (i.e. all motions locked) between static actors or world and a floating articulation base link did not constrain the rotational degrees of freedom. + +### Deprecated + +* PxContactJoint, PxJacobianRow and PxContactJointCreate() have all been marked as deprecated and will be removed in a later release. + +## Scene queries + +### Removed + +* Deprecated PxBVH::raycast(), PxBVH::sweep() and PxBVH::overlap() functions have been removed. Use the new versions with callbacks. +* A deprecated PxQueryFilterCallback::postFilter() function has been removed. Use the similar function with a different signature. +* The deprecated PxGeometryQuery::getWorldBounds() function has been removed. Please use PxGeometryQuery::computeGeomBounds() instead. +* A deprecated PxGeometryQuery::raycast() function has been removed. Please use the other function with the same name but a different signature. + +### Fixed + +* Overlap queries could still return a non-zero number of hits when all hits got filtered in the post-filter callback (e.g. using PxQueryHitType::eNONE). This has been fixed. + +### Added + +* PxScene::evaluateSDFDistances() to evaluate sdf distances and gradients at given sample points for a batch of shapes + +## Cooking + +### Removed + +* The deprecated PxCooking class has been removed. Use the standalone "immediate cooking" functions instead (e.g. PxCookBVH, PxCreateBVH...) +* PxCooking::cookBVHStructure() has been removed. Use PxCooking::cookBVH() +* PxCooking::createBVHStructure() has been removed. Use PxCooking::createBVH() + +### Deprecated + +* PxConvexFlag::eGPU_COMPATIBLE has been deprecated. Set PxCookingParams::buildGPUData to true to cook convex meshes that need to be GPU compatible. + +### Fixed + +* When convex hull cooking hit the polygon limit, the coplanar faces merge step was not run. + +## Serialization + +### Changed: + +* Version mismatch checks etc. when deserializing binary data are now applied in profile and release build configurations too. PxSerialization::createCollectionFromBinary() will return NULL if the checks fail and error messages will get sent. + +### Fixed: + +* When deserializing materials (any PxBaseMaterial-derived), their userData member was wrongly re-initialized to zero, overwriting the serialized value. + +## Pvd + +### Changed: + +* The OmniPVD API has been reworked to be more consistent and provide less room for confusion. Among the various changes are: + * The "Set" attribute type has been renamed to "UniqueList". As a consequence, the OmniPvdWriter methods registerSetAttribute, addToSetAttribute.., removeFromSetAttribute.. have been renamed to registerUniqueListAttribute, addToUniqueListAttribute, removeFromUniqueListAttribute. The enum values eOmniPvdRegisterSetAttribute, eOmniPvdAddToSetAttribute, eOmniPvdRemoveFromSetAttribute have been renamed to eREGISTER_UNIQUE_LIST_ATTRIBUTE, eADD_TO_UNIQUE_LIST_ATTRIBUTE, eREMOVE_FROM_UNIQUE_LIST_ATTRIBUTE. + * OmniPvdCommandEnum has been renamed to OmniPvdCommand and all enum values have been renamed too. + * OmniPvdDataTypeEnum has been renamed to OmniPvdDataType + * OmniPvdAttributeDataType has been removed and its usage in the API methods replaced with OmniPvdDataType::Enum + * The OmniPvdWriter methods setAttributeShallow, addToSetAttributeShallow, removeFromSetAttributeShallow have been renamed to setAttribute, addToUniqueListAttribute, removeFromUniqueListAttribute and can be dinstinguished from the more generic versions with the same name by the argument list. + * The order of the handleDepth and attributeHandles params has flipped in the OmniPvdWriter methods setAttribute, addToUniqueListAttribute, removeFromUniqueListAttribute (formerly called addToSetAttribute, removeFromSetAttribute) methods. + * The order of the enumClassHandle and attributeName parameters has flipped in the OmniPvdWriter::registerFlagsAttribute() method. + * OmniPvdReader::getCommandType() has been removed. The information is already available as part of the OmniPvdReader::getNextCommand() method. + * The parameters in OmniPvdReader::startReading() have turned from pointers to references. + * The stream parameters in OmniPvdWriter::setWriteStream() and OmniPvdReader::setReadStream() have turned from pointers to references. + * The input parameters for the following functions have turned from pointers to references: destroyOmniPvdReaderFp, destroyOmniPvdWriterFp, destroyOmniPvdFileReadStreamFp, destroyOmniPvdFileWriteStreamFp, destroyOmniPvdMemoryStreamFp + * Various input parameters in the methods of OmniPvdWriter, OmniPvdReadStream, OmniPvdWriteStream have changed from const to non-const. + * The returned data pointers of the methods getClassName(), getAttributeName(), getObjectName(), getAttributeDataPointer() of OmniPvdReader are now const. +* The OmniPVD snippet now aborts in release build configuration since PVD is not available in release. +* Unit tests can now export single or series of automatically time stamped files, when the omnipvdfile command line parameter is set to a directory +* Crash bugs in the contact reports fixed +* OmniPVD now uses the OmniPVD API derived class support to stream debug data + * Removes attribute duplication for shared base classes + * Removed ambiguity about which class a certain object is part of + * No need to have a class type attribute in streamed debug objects, the class is the type + * As a consequece greatly simplifies object and class handling in the OmniPVD extension + +## Vehicles2 + +### Fixed: + +* When using sweeps for vehicle wheel vs. ground collision detection, PxVehiclePhysXRoadGeometryQueryUpdate() wrongly treated the case of an exactly zero hit distance (wheel touching ground with suspension being exactly at max compression) as no hit. +* Undesired sleep/wake cycle for vehicles that are not moving while engines are revving. Applying throttle will keep vehicles awake now. +* Negative suspension jounce (and an assert) could result in certain scenarios where PxVehicleSuspensionStateCalculationParams::limitSuspensionExpansionVelocity was set to true and gravity was pointing in the opposite direction of the suspension travel direction. +* Various PVD related bugs. +* If the wheel IDs in PxVehicleAxleDescription::wheelIdsInAxleOrder were shuffled, the wrong road geometry velocity information was used to compute the tire slip speeds. +* When driving backwards, the thresholdForwardSpeedForWheelAngleIntegration parameter (see PxVehicleSimulationContext) was ignored. + +### Changed: + +* PxVehiclePhysXRoadGeometryQueryParams has been adjusted to allow for wheel specific filter data. As a consequence, the method PxVehiclePhysXRoadGeometryQueryUpdate() has been adjusted too. See the migration guide for more details. +* Only the engine drivetrain or direct drivetrain properties are recorded in PVD now (and not both for the same vehicle). +* All the methods in PxVehiclePvdFunctions.h and PxVehiclePvdHelpers.h have been adjusted to use references to OmniPvdWriter, PxVehiclePvdObjectHandles or PxVehiclePvdAttributeHandles objects instead of pointers to make it even clearer that these parameters are required. +* The PxVehiclePvdAttributeHandles parameter of the PxVehiclePvdObjectRelease() method has been removed. +* The PxVehiclePvdAttributeHandles and OmniPvdWriter parameter of the PxVehiclePvdObjectCreate() method have been removed. +* The OmniPvdWriter parameter of the PxVehiclePvdAttributesRelease() method has been removed. + + +## Soft Body + +### Added: + +* Kinematic soft body feature + * PxSoftBodyFlag::eKINEMATIC and PxSoftBodyFlag::ePARTIALLY_KINEMATIC. + * PxSoftBody::setKinematicTargetBufferD function to set kinematic targets based on a device buffer. + * PxConfigureSoftBodyKinematicTarget function to prepare kinematic targets for PxSoftBody::setKinematicTargetBufferD. + * PxSoftBodyExt::relaxSoftBodyMesh function to repose a tetrahedral mesh from one configuration into another. + * Optional outputVertexToInputTriangle, removeDisconnectedPatches parameters for PxTetMaker::simplifyTriangleMesh. + * PxTetrahedronMeshExt::createPointsToTetrahedronMap function to associate points to their closest tetrahedon. + * A snippet that shows how to set up and use a kinematic soft body. +* constraintOffset parameter to PxSoftBody::addSoftBodyAttachment and PxSoftBody::addClothAttachment to specify an offset of the PxConeLimitedConstraint with respect to the PxConeLimitedConstraint::mAxis. + +### Removed: + +* PxBuffer has been removed. Writing and reading the softbody simulation state is now done directly in GPU buffers. For examples, see SnippetSoftBody. + +### Deprecated: + +* PxSoftBodyExt::commit() has been deprecated. The replacement is PxSoftBodyExt::copyToDevice(). + +### Changed: + +* Renamed PxFEMSoftBodyMaterialModel::CO_ROTATIONAL, NEO_HOOKEAN to PxFEMSoftBodyMaterialModel::eCO_ROTATIONAL, eNEO_HOOKEAN. +* PxSoftBodyDataFlag has been renamed to PxSoftBodyGpuDataFlag. +* Default constructor of PxConeLimitedConstraint initializes PxConeLimitedConstraint::mAngle to -1.0 since 0.0f now indicates a 0.0 cone opening angle. +* Soft body flags used to copy stress computation were changed. The stress computation can now be performed via the intermediate data that can be copied from the internal buffers. + +### Fixed: + +* A bug that resulted in changes to PxSoftBodyFlags not being picked up has been fixed. +* Fixed a case where particles colliding with soft bodies could lead to a crash. +* Fixed a corner case where the mass of an internal node could become negative. +* An index bug when rendering tetrahedra in the snippets. + +## Particles + +### Changed: + +* Renamed PxParticleRigidAttachment::mParams to mConeLimitParams +* Added PxParticleRigidAttachment constructor to initialize with PxConeLimitedConstraint and localPose0. +* Added PxConeLimitParams constructor to initialize with PxConeLimitedConstraint. +* Added PxParticleRigidFilterPair constructor to initialize with rigid node ID and particle ID. + +### Fixed: + +* A crash when using a large number of particles has been fixed. +* A bug that resulted in changes to PxParticleFlag not being picked up has been fixed. + +# v5.1.3 + +## General + +### Added: + +* Support for Microsoft Visual Studio 2022 for Windows builds. + +### Fixed + +* Changing the materials of a shape did not work when using GPU dynamics. +* Fixed exclusive shape binary serialization. + +### Deprecated + +* RepX/Xml serialization has been deprecated. + +## Rigid Body + +### Fixed + +* A rare bug involving GPU aggregates, in which newly created actors could freely move through existing actors, has been fixed. + +## Joints + +### Fixed + +* The D6 joint's twist drive was using the wrong actor's axis (B instead of A). This has been fixed, and it could affect joint setups in existing scenes. To fix this in existing content it might be enough to flip the joint frames of involved actors, but this may not be possible depending on which other features (joint limits, etc) have been setup for the same joint. In the worst case it might be necessary to re-tune these joints. + +## Soft Body + +### Fixed + +* Rendering for tetmeshes in snippets had some tet faces inverted. This has been fixed. +* The voxel tetmesher won't crash anymore when called with zero elements as input. +* A bug in collision computation between a soft body and a scaled triangle mesh has been fixed. + +## Particles + +### Fixed + +* The Poisson Sampler will not cause number overflows and crashes anymore when called with parameters that lead to too many samples. +* PxParticleClothCooker fixes to support shearing and bending constraints. This will change the behavior of newly cooked cloth assets. + +## Pvd + +### Fixed + +* Fixed a potential crash bug when contact points are recorded through OmniPVD. + + +# v5.1.2 + +## General + +### Fixed: + +* Binary serialization of materials' userData. +* Fixed precision issue in index computation in Gu::HeightField::computeCellCoordinates [Issue #52](https://github.com/NVIDIA-Omniverse/PhysX/issues/52) +* Performance for SnippetCustomGeometry is now much better, particularly on Linux +* Compiler errors on Linux - [Issue #25](https://github.com/NVIDIA-Omniverse/PhysX/issues/25) + +## Cooking + +### Fixed + +* A bug that generated non-GPU compatible convex meshes even though GPU compatibility was requested. + + +# v5.1.1 + +## General + +### Changed: + +* Be aware that due to reorganization of some virtual functions in the public interface the binary data layout has changed from v5.1.0. Linking code that includes the headers of v5.1.1 against binaries that have been built with an older version will likely cause problems. + +### Added: + +* Support for spatial and fixed tendon serialization. + +### Fixed: + +* Binary serialization of articulations had a bug, which got fixed. +* Includes [PR #8: Download bootstrap packages using TLS](https://github.com/NVIDIA-Omniverse/PhysX/pull/8/) + +## Rigid Body + +### Fixed + +* A crash when colliding an SDF mesh against a sphere + +## Particle Systems + +### Fixed + +* Particle systems now support is<> type conversion. + +### Removed + +* The PxParticlePhase class has been removed. It was unused. + +## Vehicles2 + +### Changed: + +* SnippetVehicle2Multithreading is now using custom profiling code to provide timings in release builds too. + + +# v5.1.0 + +## Supported Platforms + +### Runtime + +* Linux (tested on Ubuntu 20.04) +* Microsoft Windows 10 or later (GPU acceleration: display driver and GPU supporting CUDA 11 / CUDA ARCH 3.0) + +### Development + +* Microsoft Windows 10 or later +* Microsoft Visual Studio 2017, 2019 + +## Overview + +* New SDF collisions! +* New custom geometry! +* New custom scene query system! +* New GJK queries API! +* New soft bodies! +* New mesh-vs-mesh overlap queries! +* New Vehicle SDK with customizable components and functionality! +* New gyroscopic forces! +* New gear joint and rack-and-pinion joint! + +## General + +### Added: + +* A new function PxSetMutexProtocol() has been added exclusively for Linux OS. This function affects the way in which shdfnd::Mutex sets flags that affect OS strategies to avoid thread priority inversion. The behavior was hard-coded to PTHREAD_PRIO_INHERIT but now can be set to any of PTHREAD_PRIO_INHERIT, PTHREAD_PRIO_PROTECT, PTHREAD_PRIO_NONE. A choice of PTHREAD_PRIO_NONE can lead to significant performance improvements with large thread counts but requires care to avoid priority inversion, a phenomena that occurs when a low priority thread holds a lock contended by higher priority threads. +* A flag PxVisualizationParameter::eSIMULATION_MESH has been added to render the simulation mesh instead of the collision mesh for tetmeshes. +* A flag PxVisualizationParameter::eSDF has been added to render the SDF of a mesh instead of the collision mesh for triangle meshes with SDFs. +* PxPhysics has new functions related to the creation and retrieval of tetrahedral meshes. + +### Deprecated: + +* PxPhysicsInsertionCallback is deprecated. Please use PxInsertionCallback instead. +* The PxFlags::set() function has been removed. Please now use PxFlags::raise() to set a single flag, or operator= to set all flags. +* The enum values of PxTaskType have been renamed for consistency reasons. See the corresponding API documentation for details. +* The PxRegisterHeightFields, PxRegisterArticulationsReducedCoordinate and PxCreateBasePhysics functions are deprecated. +* Binary data conversion and binary meta data have been deprecated. + * PxBinaryConverter + * PxConverterReportMode + * PxGetPhysicsBinaryMetaData() + * PxSerialization::serializeCollectionToBinaryDeterministic() + * PxSerialization::dumpBinaryMetaData() + * PxSerialization::createBinaryConverter() + * PxBinaryMetaDataCallback + * PxSerializationRegistry::registerBinaryMetaDataCallback() + +### Fixed: + +* PxPhysics::getFoundation() and PxScene::getPhysics() did not return the correct references in scenarios where two or more dynamic libraries are built with static PhysX libraries. In such a scenario, PxPhysics or PxScene objects from dynamic library A would return the wrong references when queried inside dynamic library B. +* Collision edges (PxVisualizationParameter::eCOLLISION_EDGES) were not properly rendered when PxMeshPreprocessingFlag::eDISABLE_ACTIVE_EDGES_PRECOMPUTE is used. Using this flag means that all edges are active, but none of them were rendered. The correct thing to do is to render all of them. +* PxActorFlag::eVISUALIZATION was not properly used. Shapes of actors whose visualization flag is disabled will now get skipped as well. +* Removed duplicate closing cross-thread event for Basic.narrowPhase event. +* Replaced all custom offsetof expressions that appear to dereference a null pointer with the PX_OFFSET_OF_RT macro - implementing Github PR 396. +* Debug visualization of face normals was incorrect for triangle meshes with negative scales. This has been fixed. + +### Removed: + +* Scene double buffering has been completely removed. This means it is now illegal to call API write commands that make changes to the scene or to any actor or shape in a scene while the scene is simulating; that is, in-between PxScene::simulate() and PxScene::fetchResults(). Examples include PxRigidDynamic::setLinearVelocity() and PxScene::addActor(). Another example is PxShape::setLocalPose() for any shape attached to an actor that is in a scene currently being simulated. Removal of scene double buffering has similar consequences for API read commands: it is now illegal to read any property that will be modified during a simulation step. Examples include PxRigidActor::getGlobalPose() and PxConstraint::getForce(). Split simulation is slightly less restrictive in that some reads are allowed during PxScene::collide() and some writes allowed after PxScene::fetchCollision() but before PxScene::advance(). Examples include PxRigidActor::getWorldBounds() and PxArticulation::setWakeCounter(). However, it is important to note that the rules that apply to PxScene::simulate() apply equally to PxScene::advance(). In all build configs, any corresponding illegal API read or write will result in an error being issued to PxErrorStream and the illegal API call immediately returning without executing the function. A final comment is that API read operations in event callbacks remain legal. +* PxVisualizationParameter::eDEPRECATED_COLLISION_PAIRS has been removed. +* PxBroadPhaseCaps::maxNbObjects has been removed. It was unused. +* PxSceneFlag::eADAPTIVE_FORCE has been removed. +* The semi-advanced PhysX "Samples" are no longer provided. The "Snippets" continue to provide simple example code to illustrate how to use certain PhysX features. The physics demos in NVIDIA Omniverse offer more advanced samples now. +* The deprecated PxScene::setFrictionType() method has been removed. Simply set the desired friction type in PxSceneDesc. + +### Changed: + +* The Foundation types PxVec2, PxVec3, PxVec4, PxQuat, PxMat33, PxMat34, PxMat44 and PxTransform now have higher-accuracy implementations that use double instead of float. These are not currently used directly in the PhysX SDK but can be used by clients of the SDK if needed. +* The previous snippet SnippetRaycastCCD has been replaced with SnippetCCD. This snippet illustrates how to use different types of CCD methods, including regular, raycast and speculative CCD. +* PxDefaultCpuDispatcherCreate() has been modified to support different strategies to combat wasteful thread usage when there is no work to perform. +* The PxSimulationEventCallback functions onTrigger(), onContact() and onConstraintBreak() have slightly different behavior in that api queries to the physx actors referenced by the callbacks now return the state of the actor after the simulate step rather than the state of the actor at the detection event. At the risk of a performance penalty, the flags PxPairFlag::ePRE_SOLVER_VELOCITY and PxPairFlag::eCONTACT_EVENT_POSE may be used to retrieve the poses and velocities of the actors prior to the simulation step in the implemented onContact() function. These poses and velocities represent the state of the actors when the contact was first detected during the simulation step. +* PxCapsuleGeometry with halfHeight=0.0 are now legal. +* PxNodeIndex is now a 64-bit index, with the upper 32-bits representing the rigid body/actor ID and the lower 31-bits representing the articulation link ID and 1 bit to indicate if this is an articulation link or a rigid body. However, due to GPU memory constraints, an articulation can only support a maximum of 65536 links. +* Various PxScene::addXXX() functions now return a bool status (previously void) to detect errors more easily. +* TGS solver is now the default, PGS can still be used by setting the scene flags accordingly. +* The PxScene::addActor(), ::addActors(), ::addAggregate(), addCollection(), ::resetFiltering(), ::simulate(), ::advance(), ::collide() methods now return a boolean to denote success or failure. +* Several immediate-mode structs have been renamed from FeatherStoneArticulation to ArticulationRC (the last letters are an acronym for reduced-coordinate) + +## Rigid body + +### Added: + +* A new flag PxConstraintFlag::eALWAYS_UPDATE has been added for constraints that should always be updated, i.e. the corresponding PxConstraintConnector::prepareData() function is called each frame automatically. +* A new flag PxConstraintFlag::eDISABLE_CONSTRAINT has been added. The solver prep functions are not called when this flag is set, effectively disabling the constraint. +* A userData parameter has been added to PxAggregate. +* A userData parameter has been added to PxConstraint. +* The PxPhysics::createAggregate() function has a new parameter. A deprecated wrapper for the previous function signature has been added. +* A new flag PxRigidBodyFlag::eENABLE_GYROSCOPIC_FORCES has been added. This introduces gyroscopic forces to rigid bodies to simulate effects like the Dzhanibekov Effect. +* A new class PxCustomGeometry has been added. User can now create custom collision shapes by implementing a set of callback functions. +* Two pre-made custom geometry implementations added in PxCustomGeometryExt extension - Cylinder and Cone. +* A new set of API functions PxGjkQuery have been added. This is intended for spatial queries on custom shapes represented by their GJK Support Mapping. +* PxMeshGeometryFlag::eTIGHT_BOUNDS has been added. This is similar to PxConvexMeshGeometryFlag::eTIGHT_BOUNDS, but for triangle meshes. +* A new broadphase has been added (PxBroadPhaseType::ePABP). +* A standalone broadphase interface has been added (see PxCreateBroadPhase and PxCreateAABBManager). +* A compliant contact model has been added. Users can now customize spring-stiffness and damping for a soft contact response. +* Triangle mesh colliders are now supported on dynamic rigid bodies if a SDF (Signed Distance Field) gets generated during cooking. +* PxSceneDesc::frictionCorrelationDistance allows to configure the distance for merging contact points into a single anchor point. +* PxSceneDesc::contactPairSlabSize can be used to define the size of the contact pool slabs. + +### Removed: +* PxSceneDesc::solverOffsetSlop has been removed and can now be set per rigid body (see PxRigidBody::setContactSlopCoefficient()). + +### Changed: + +* PxShape::getGeometry() now returns a PxGeometry reference instead of a PxGeometryHolder. See the migration guide to 5.1 for details. The PxShape::getGeometryType() and PxShape::getXXXGeometry() functions have been deprecated as a result. +* PxMaterialFlag::eIMPROVED_PATCH_FRICTION is now enabled by default. +* PxRigidBody::setLinearVelocity() was removed and replaced with PxRigidDynamic::setLinearVelocity() +* PxRigidBody::setAngularVelocity() was removed and replaced with PxRigidDynamic::setAngularVelocity() +* PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD and PxRigidBodyFlag::eENABLE_CCD can now be enabled at the same time on a given body. In this hybrid CCD mode the linear part of the motion is handled by sweeps, and the angular part of the motion is handled by speculative contacts. + +### Fixed: + +* Removing a shape from a sleeping dynamic rigid actor woke the actor up if it was touching a shape of a static rigid actor. +* Removing a shape from a dynamic rigid actor, did not necessarily wake up touching actors even though wakeOnLostTouch was set to true in PxRigidActor::detachShape(). +* A performance problem in PxScene::getActors() has been fixed. +* Missing support for maxContactForces in the TGS solver has been added. +* A rare crash due to reading past the boundaries of a memory pool has been fixed. +* Deformable meshes using the BVH34 midphase structure did not handle collision edge flags correctly. This has been fixed. +* Collision edge flags were sometimes incorrect for negative-scaled meshes, giving birth to invalid or missed contacts. This has been fixed. +* The sphere-vs-mesh PCM contact generation had a bug that sometimes made the sphere go through the mesh due to a missed vertex contact. This has been fixed. +* Performance and stability issues when simulating convexes colliding against many triangles in complex PxTriangleMesh geometries has been improved. +* Attempting to apply a force to a kinematic rigid body will no longer lead to a crash in profile or release builds. +* Triangle mesh negative scale support for GPU code path. +* Switching a constrained dynamic body to kinematic no longer triggers an assert in debug mode. + +## Joints + +### Added: + +* New PxGearJoint and PxRackAndPinionJoint have been added. + +### Fixed: + +* PxJoint::setActors() had a bug when called at runtime, that left an internal structure referencing the previous actors. As a result PxConstraintFlag::eCOLLISION_ENABLED was not properly handled between jointed actors. + +### Deprecated: + +* PxJointLimitParameters::contactDistance is deprecated. +* Joint projection is deprecated. + +## Scene queries + +### Removed: + +* Batched query support has been removed from the PhysX SDK. The deprecated structs/classes/callbacks PxBatchQuery, PxBatchQueryDesc, PxBatchQueryResult, PxRaycastQueryResult, PxSweepQueryResult, PxOverlapQueryResult, PxBatchQueryPreFilterShader and PxBatchQueryPostFilterShader have all been removed from the SDK. The deprecated function PxScene::createBatchQuery has also been removed. In place of PxBatchQuery, a new class PxBatchQueryExt has been added to the extensions library. This acts as a wrapper for the functions PxScene::raycast(), PxScene::sweep() and PxScene::overlap() and aims to preserve the core functionality of PxBatchQuery. PxBatchQueryExt instances are instantiated with the function PxCreateBatchQueryExt(). + +### Added: + +* PxSceneDesc can now take an optional PxSceneQuerySystem parameter. If defined, all PxScene scene-query related calls will be re-routed to this interface. This allows users to potentially customize the implementation of all scene-query operations. An external implementation of this interface is available in the PxExtensions library, and can be created with the PxCreateExternalSceneQuerySystem function. +* It is possible to further customize the scene-query system, e.g. using more than the two built-in pruning structures in PhysX. See PxCreateCustomSceneQuerySystem and SnippetMultiPruners. +* The function PxCreateBatchQueryExt() has been added to the extension library. The purpose of this function is to instantiate a new class PxBatchQueryExt. This class acts as a replacement for the PxBatchQuery class of previous releases which has now been removed. PxBatchQueryExt allows queries to be added to a queue and then executed on command. +* The flag PxQueryFlag::eBATCH_QUERY_LEGACY_BEHAVIOUR has been added to support PxBatchQueryExt and/or any other user replacement for PxBatchQuery. When this flag is raised, the PhysX SDK ignores an internal filter equation and guarantees that the PxQueryHitType returned by the corresponding PxQueryFilterCallback instance is used directly without any other logic being applied. +* The function PxBatchQueryStatus::getStatus() has been added to the extensions library to determine if an overflow occurred during the execution of a batch with PxBatchQueryExt::execute(). Overflows occur when the touch buffer is insufficiently large to return all touches for all queries. +* The function PxScene::overlap() now has an optional PxQueryCache pointer as function argument. This follows the pattern of the complementary raycast() and sweep() functions of the PxScene class. +* The function PxGeometryQuery::pointDistance() now supports meshes when the PxMeshMidPhase::eBVH34 data structure is used. It has a new parameter to return the closest triangle index for meshes. +* SnippetPointDistanceQuery, SnippetGeometryQuery, SnippetStandaloneBVH and SnippetPathTracing have been added. +* The PxScene::raycast(), PxScene::overlap() and PxScene::sweep() functions have a new PxGeometryQueryFlags parameter. +* The PxGeometryQuery::raycast(), PxGeometryQuery::overlap(), PxGeometryQuery::sweep(), PxGeometryQuery::computePenetration(), PxGeometryQuery::pointDistance() functions have a new PxGeometryQueryFlags parameter. +* The PxMeshQuery::findOverlapTriangleMesh(), PxMeshQuery::findOverlapHeightField() and PxMeshQuery::sweep() functions have a new PxGeometryQueryFlags parameter. +* PxBVH now has a culling function (PxBVH::cull()) that can be used to implement view-frustum culling. See SnippetFrustumQuery for an example. +* PxBVH now has refit functions (PxBVH::refit(), PxBVH::partialRefit()) that can be used for dynamic trees. See SnippetStandaloneBVH for an example. +* PxBVH now has a generic traversal function (PxBVH::traverse()) that can be used for arbitrary purposes, like e.g. debug-visualizing the tree bounds. See SnippetStandaloneBVH for an example. +* There is a new PxFindOverlap function to find overlaps between two PxBVH objects. +* The PxRigidActorExt::createBVHFromActor() helper function has been added. +* PxSceneDesc::dynamicTreeSecondaryPruner has been added. The new PxDynamicTreeSecondaryPruner enum lets users choose which implementation to use in dynamic trees. +* PxSceneDesc::staticBVHBuildStrategy and PxSceneDesc::dynamicBVHBuildStrategy have been added. This lets users control the build strategy of the static & dynamic pruning structures. +* PxSceneDesc::staticNbObjectsPerNode and PxSceneDesc::dynamicNbObjectsPerNode have been added. This lets users control the number of objects per node for the static & dynamic pruning structures. +* PxHitFlag::eANY_HIT has been added. It is similar to the previous PxHitFlag::eMESH_ANY flag, but this time for any geometry that contains multiple primitives - for example a PxCustomGeometry. +* PxGeometryQuery::raycast, PxGeometryQuery::overlap and PxGeometryQuery::sweep now take an optional context parameter that is passed to the low-level functions, and in particular to the PxCustomGeometry callbacks. +* PxGeometryQuery::overlap now supports triangle mesh vs triangle mesh. +* A new PxMeshQuery::findOverlapTriangleMesh function has been added to compute triangle overlaps between two triangle meshes. + +### Fixed: + +* The build code for BVH34 trees had an issue that could produce degenerate trees, leading to rare performance problems and even stack overflow during traversal. This has been fixed, but it made the build code slightly slower, which could be a problem for users cooking at runtime. Since the problem was rare, the previous/faster build code has been kept, available in PxBVH34BuildStrategy::eFAST. It is not enabled by default. +* The scene query system was sometimes incorrectly updated for PxBVH structures. This has been fixed. +* A crash has been fixed when doing a query against an empty scene while using PxPruningStructureType::eNONE for the dynamic structure. +* The BVH34 codepath had a bug in the raycast-vs-mesh-with-multiple-hits case, where returned hits could be further away than defined max hit distance. This has been fixed. +* A rare crash involving the compound pruner and the PxActorFlag::eDISABLE_SIMULATION flag has been fixed. +* Fixed a rare scene-query issue happening with stabilization enabled (the SQ structures could miss updates, leading to incorrect SQ results). +* In rare cases, PxTriangleMesh::refitBVH() could return an incorrect bounding box when using PxMeshMidPhase::eBVH34. This has been fixed. +* In very rare cases, sweep tests using the eMTD flag and exactly touching a shape (impact distance == 0) could return an incorrect impact normal. This has been fixed. +* The capsule-vs-heightfield overlap query (PxGeometryQuery::overlap) was not reporting hits in some cases. This has been fixed. +* The convex-vs-heightfield overlap query (PxGeometryQuery::overlap) had a bug when using scaled convexes. This has been fixed. +* The sphere-vs-mesh and capsule-vs-mesh sweeps sometimes returned slightly incorrect impact distances (especially with long sweeps), which resulted in swept shapes penetrating the meshes when moved to the impact positions. This has been fixed. +* In rare cases the sphere-vs-mesh and capsule-vs-mesh sweeps could miss triangles entirely. This has been fixed. + +### Changed: + +* The PxQueryHit struct does not contain touched actor & shape pointers anymore. They have been moved higher up to the PxRaycastHit, PxOverlapHit and PxSweepHit structs. Explicit padding has also been dropped for these classes. +* The PxQueryFilterCallback::postfilter() function has changed. The hit actor and hit shape are now passed as extra arguments to the function. +* PxGeometryQuery::raycast() now operates on PxGeomRaycastHit structures and takes an extra stride parameter. Similarly PxGeometryQuery::sweep() now uses a PxGeomSweepHit structure. + +### Deprecated: + +* PxGeometryQuery::getWorldBounds() has been deprecated. Please use PxGeometryQuery::computeGeomBounds() instead. +* PxHitFlag::eMESH_ANY has been deprecated. Please use PxHitFlag::eANY_HIT instead. +* PxBVHStructure has been renamed to PxBVH. PxBVHStructureDesc has been renamed to PxBVHDesc. +* The PxBVHStructure scene query functions have changed. The old API is deprecated, a new API has been added. + +## Character controller + +### Added: + +* A PxClientID parameter has been added to PxControllerDesc, to let users setup the owner client before the kinematic actor is added to the scene. + +### Fixed: + +* The vertical displacement vector in the down pass was sometimes incorrect (larger than it should have been). This has been fixed. +* Releasing an articulation link while a character was standing on it produced a crash. This has been fixed. + +## Vehicles2 + +### Added: + +* The Vehicle SDK has been refactored into a completely new form to allow rapid customization and prototyping. SnippetVehicle2Customization, SnippetVehicle2DirectDrive, SnippetVehicle2FourWheelDrive etc. demonstrate use of the new Vehicle SDK. The public API for the new Vehicle SDK may be found under "physxRoot/include/vehicle2". All functions, structs and classes in the new Vehicle SDK are inside the physx::vehicle2 namespace. A migration guide may be found in the PhysX 5.1 SDK Guide under the subsection "Migrating From PhysX SDK 4.0 to 5.1/Vehicles". + +## Vehicles + +### Deprecated: + +* All structs, classes and functions of the old Vehicle SDK have been marked as deprecated and will be removed in a later release. + +### Changed: + +* Concurrent calls to PxVehicleUpdateSingleVehicleAndStoreTelemetryData() are now permitted if the additional parameter vehicleConcurrentUpdates is used. +* The functions PxVehicleSuspensionSweeps() and PxVehicleSuspensionRaycasts() have been modified to accommodate the removal of PxBatchQuery and the addition of PxBatchQueryExt. The arguments of both functions have been modified with a PxBatchQueryExt pointer directly replacing a PxBatchQuery pointer. New functionality in PxBachQueryExt has allowed PxRaycastQueryResult/PxSweepQueryResult to be removed from the argument list of PxVehicleSuspensionRaycasts()/PxVehicleSuspensionSweeps(). This change much simplifies calls to PxVehicleSuspensionRaycasts() and PxVehicleSuspensionSweeps() and requires less user management of the various arrays involved. + +### Added: + +* PxVehicleWheelsDynData::getConstraints() and PxVehicleWheelsDynData::getNbConstraints() have been added to potentially have vehicles use immediate mode for solving the vehicle rigid body constraints. +* New method PxVehicleGraph::getRawData() to extract raw telemetry data. +* New PxVehicleSteerFilter class, used in PxVehicleDrive4WSmoothDigitalRawInputsAndSetAnalogInputs & PxVehicleDrive4WSmoothAnalogRawInputsAndSetAnalogInputs to smooth the vehicle's steering angle when going from air to ground. +* A new function PxVehicleWheelsDynData::setTireContacts() has been added to the PhysX Vehicle SDK. This function allows users to directly set tire contact plane and friction for all tires on the vehicle as an alternative to using PxVehicleSuspensionSweeps() or PxVehicleSuspensionRaycasts(). +* A new function PxVehicleDrivableSurfaceToTireFrictionPairs::getSurfaceType(const PxMateria& surfaceMaterial), which returns the surface type associated with a PxMaterial instance. +* A new function PxVehicleDrivableSurfaceToTireFrictionPairs::getTypePairFriction(const PxMaterial& surfaceMaterial, const PxU32 tireType), which returns the friction value associated with a specified combination of PxMaterial instance and tire type. +* New complementary functions PxVehicleDrivableSurfaceToTireFrictionPairs::serializeToBinary() and PxVehicleDrivableSurfaceToTireFrictionPairs::deserializeFromBinary(), which allow friction tables to be serialized and deserialized. +* A new structure PxVehicleContext has been introduced to allow, for example, to have a set of common settings for vehicles in scene A and a different set for vehicles in scene B. PxVehicleUpdates() is one of the methods where there is now the option to use this new structure. +* The flag PxVehicleWheelsSimFlag::eDISABLE_SPRUNG_MASS_SUM_CHECK has been introduced to allow setting suspension sprung mass values that do not sum up to the mass of the vehicle rigid body. + +### Fixed: + +* Vehicle wheel suspension sweeps used the wrong scale for the sweep geometry if the wheel shapes used PxConvexMeshGeometry with scale factors other than 1. + +## Cooking + +### Deprecated: + +* The PxCooking object is deprecated. Please use the new standalone cooking functions instead (in the cooking library) or the low-level cooking functions (in the GeomUtils library). +* PxCooking::cookBVHStructure() is deprecated. Please use PxCookBVH() instead. + +### Added: + +* Added PxBVH34BuildStrategy enum to PxBVH34MidphaseDesc. Users can now select a SAH-based build strategy for BVH34 trees. +* BVH34 trees can now be quantized or not depending on PxBVH34MidphaseDesc::quantized. +* Added remeshing and mesh simplification to preprocess meshes such that they can be used for softbody simulation. New API functions are PxTetMaker::simplifyTriangleMesh()/remeshTriangleMesh()/createTreeBasedTetrahedralMesh() +* Added low-level cooking functions (GeomUtils), that can be used to cook objects without using the cooking library. See SnippetStandaloneQuerySystem for an example. The cooking library is still here though for backward compatibility. +* Triangle mesh cooking supports the generation of a SDF (Signed Distance Field) to allow triangle mesh colliders on dynamic actors. + +### Fixed: + +* Serialization of uncompressed BVH34 trees was broken (both for regular cooked files and binary serialization). This has been fixed. +* PxMeshPreprocessingFlag::eDISABLE_ACTIVE_EDGES_PRECOMPUTE was not taken into account when PxCookingParams::buildTriangleAdjacencies was used. + +### Changed: + +* PxMeshMidPhase::eBVH34 is now the default midphase structure. PxMeshMidPhase::eBVH33 has been deprecated. + +## Pvd + +### Added: + +* Adds the OmniPVD API - an object oriented serialization and deserialization library for debug data. The project is called PvdRuntime. + * Adds the OmniPVDWriter exposing serialization through OmniPVDWriteStream, OmniPVDFileWriteStream. + * Adds the OmniPVDReader exposing de-serialization through OmniPVReadStream, OmniPVDFileReadStream. +* Adds an OmniPVD API user in the PhysX SDK, exposed through PxOmniPVD, which streams PhysX debug data into an OmniPVD API write stream. + * PxOmniPVD is now an optional argument to the PxCreatePhysics() function, allowing for the parallel inclusion of both PVD and OVD debug streams. + * Adds PxPhysics::getOmniPvd() which returns the PxOmnipVD instance used in the call to PxCreatePhysics() + * Exports : Rigid Static, Rigid Dynamic, Joints, Articulations, Contacts and more into the OmniPVD stream. +* Possibility to serialize and save out, as well as read and parse OVD files (through the usage of OmniPVD API), which constain an OmniPVD command stream of PhysX debug data. +* Comes with a viewer in Omniverse Create, in the form of an extension called omni.physx.pvd also known as the OmniPVD extension. + * Adds the ability to import and inspect OVD files using the USD interface + +### Changed: + +* The file source/pvd/include/PxPvdRenderBuffer.h has been removed along with the structs it declared: pvdsdk::PvdDebugPoint, pvdsdk::PvdDebugLine, pvdsdk::PvdDebugTriangle and pvdsdk::PvdDebugText. Usage of these structs may be directly replaced with PxDebugPoint, PxDebugLine, PxDebugTriangle and PxDebugText, which are all declared in common/PxRenderBuffer.h. + +## Articulations + +### Deprecated: + +* PxArticulationJointReducedCoordinate::setLimit()/getLimit()/setDrive()/getDrive() functions are deprecated. New API has been added + +### Added: + +* Armature was added to the articulation joints. This adds additional inertia to the joint degrees of freedom. +* PxArticulationJointReducedCoordinate::dofScale was added. This scales the projection of a child's inertia onto the joint degrees of freedom, resulting in an implicit resistance to motion around the joint. This can improve simulation stability. +* Sensors were added to PxArticulationReducedCoordinate to report forces and torques acting on links in articulations. +* Fixed tendon support was added to articulations. +* Spatial tendon support was added to articulations. +* PxArticulationJointReducedCoordinate::setJointPosition/PxArticulationJointReducedCoordinate::getJointPosition was added. +* PxArticulationJointReducedCoordinate::setJointVelocity/PxArticulationJointReducedCoordinate::getJointVelocity was added. +* PxArticulationReducedCoordinate::getRootGlobalPose() was added. +* PxArticulationReducedCoordinate::setRootLinearVelocity()/getRootLinearVelocity() was added. +* PxArticulationReducedCoordinate::setRootAngularVelocity()/getRootAngularVelocity() was added. +* PxArticulationReducedCoordinate::setMaxCOMLinearVelocity()/getMaxCOMLinearVelocity() was added. +* PxArticulationReducedCoordinate::setMaxCOMAngularVelocity()/getMaxCOMAngularVelocity() was added. +* PxArticulationReducedCoordinate::setStabilizationThreshold()/getStabilizationThreshold() was added. +* PxArticulationReducedCoordinate::isSleeping()/wakeUp()/putToSleep() was added. +* PxArticulationReducedCoordinate::setSleepThreshold()/getSleepThreshold() was added. +* PxArticulationReducedCoordinate::setSolverIterationCounts()/getSolverIterationCounts() was added. +* PxArticulationReducedCoordinate::setWakeCounter()/getWakeCounter() was added. +* PxArticulationReducedCoordinate::updateKinematic() and corresponding PxArticulationKinematicFlags were added. The method allows updating link states after changing joint and root state through the respective PxArticulationReducedCoordinate and PxArticulationJointReducedCoordinate API calls. +* PxArticulationLink::setCfmScale()/getCfmScale() was added. +* Articulations in a GPU simulation may be updated/read directly from/to user-provided device buffers, see notes in GPU Rigid Bodies->Added. +* PxArticulationReducedCoordinate::setLimitParams/getLimitParams/setDriveParams()/getDriveParams() was added. +* Articulation system supports up to 65536 links per articulation. +* PxScene::computeGeneralizedMassMatrices() was added for batch computation of articulations' mass matrices on GPU. + +### Changed: + +* It is no longer possible to change the articulation structure while it is in a scene. However, the articulation retains its state through removal and re-adding to the scene, even when its configuration changes, so the application can remove the articulation from the scene, change its structure and re-add it to the scene in a straightforward way. Specifically, the following is no longer possible when an articulation is in a scene: + * Adding or removing links, tendons, or sensors + * Changing sensor flags and local poses + * Changing joint type or motion configuration +* PxArticulationReducedCoordinate::getCoefficientMatrixSize returns element size (i.e. number of PxReals) instead of Byte size, and returns 0xFFFFFFFF instead of 0 in case the articulation is not in a scene. +* Removed PxArticulationReducedCoordinate::releaseCache function and introduced a release method with the PxArticulationCache. +* Removed PxArticulationReducedCoordinate::releaseSpatialTendon function and introduced a release method with PxArticulationTendon. +* Removed PxArticulationReducedCoordinate::releaseFixedTendon function and introduced a release method with PxArticulationTendon. +* Removed PxArticulationSpatialTendon::releaseAttachment function and introduced a release method with PxArticulationAttachment. +* Removed PxArticulationFixedTendon::releaseTendonJoint function and introduced a release method with PxArticulationTendonJoint. +* Replaced PxArticulationFixedTendon::teleportRootLink function with PxArticulationReducedCoordinate::setRootGlobalPose. +* Both PxArticulationReducedCoordinate::getDofs and PxArticulationReducedCoordinate::getCacheDataSize return 0xFFFFFFFF instead of 0 in case the articulation is not in a scene. + +### Fixed: + +* Velocity drives on prismatic joints now consistent with rigid body prismatic joints. +* Numerical integration has been improved to better conserve momentum. + +### Removed: + +* The maximal coordinate articulations have been removed with the equivalent functionality exposed through the newer reduced coordinate articulations. +* It is no longer possible to set a global pose on an articulation link. +* It is no longer possible to set the linear velocity on an articulation link. +* It is no longer possible to set the angular velocity on an articulation link. +* PxArticulationReducedCoordinate::getLinkVelocity. Use PxArticulationLink::getLinearVelocity/getAngularVelocity or PxArticulationCache to read link velocities. + +## GPU Rigid Bodies + +### Added: + +* Support for GPU-accelerated aggregate broad phase collision detection has been added. +* PxSceneFlag::eSUPPRESS_READBACK flag was added. This suppresses state readback from GPU to the CPU (e.g. rigid body transforms, velocities, articulation state), which significantly improves performance. However, in order to access or set state on rigid bodies/articulations, the application must use the new copy/apply GPU API to access this state, providing device buffers to read from/write to. +* PxSceneFlag::eFORCE_READBACK flag was added to force GPU readback of articulation data even if PxSceneFlag::eSUPPRESS_READBACK is set. +* PxScene::copyArticulationData was added to copy the state of a set of articulations from the internal buffers inside PhysX to a user-provided device buffer. +* PxScene::applyArticulationData was added to apply the state of a set of articulations from a user-provided device buffer to the internal buffers inside PhysX. +* PxScene::copyActorData was added to copy the PxRigidDynamic/PxRigidActor data from the internal buffers inside PhysX to a user-provided device buffer. +* PxScene::applyActorData was added to apply the state of a set of PxRigidDynamic/PxRigidActor from a user-provided device buffer to the internal buffers inside PhysX. +* PxScene::copySoftBodyData was added to copy the state of a set of soft bodies from the internal buffers inside PhysX to a user-provided device buffer. +* PxScene::applySoftBodyData was added to apply the state of a set of soft bodies from a user-provided device buffer to the internal buffers inside PhysX. +* PxScene::copyContactData was added to copy the contact data from the internal buffers inside PhysX to a user-provided device buffer. + +### Changed: + +* Reworked PxgDynamicsMemoryConfig to simplify configuring GPU memory usage. This change can also significantly reduce GPU memory usage compared to PhysX 4. + +### Fixed: + +* Speculative CCD support was added to GPU rigid bodies. + +## Particle System + +### Added: + +* A PBD (Position Based Dynamics) particle system capable of simulating fluids and granular materials +* Interacts with all other supported actors (rigid bodies, soft bodies etc). +* User buffer architecture to store particles. It simplifies adding and removing particles at runtime and eliminates the need to specify a maximal number of particles when setting up a particle system. +* Supports multiple materials. Each particle can reference its own or a shared material. + +## Softbodies + +### Added: + +* FEM (Finite Element Method) based softbodies. +* Interact with all other supported actors (rigid bodies, particles etc). +* Generation of tetmeshes to create a softbody out of a triangle mesh. Different kinds of tetmeshes are supported to match different use cases (conforming and voxel based tetmeshes). +* Per-tetrahedra materials support. +* Attachment support including soft body vs soft body and soft body vs rigid body. + + +# v4.1.2 +April 2021 + +## General + +### Added: + +* Added SnippetTriggers to show how to emulate triggers using regular non-trigger shapes. This supports trigger-trigger notifications and CCD. +* Added Android 64 bits target: + + * Added build preset for Android arm64-v8a architecture. + * Using ANDROID ABI as part of the Android output folder to avoid name collisions between 32 and 64 bit binaries. + * Ignoring strict-aliasing warning on Android. + * Fixed compilation error on Android debug armv8: Not inlining computeDriveInertia function to fix "conditional branch out of range" error. + +* Added support to build iOS with dynamic libraries: + + * The changes are copied from macOS makefiles, now iOS makefiles are in line with macOS ones. + * Update toolchain cmake file to only generate 64 bits target on iOS (as its preset suggests because it's called "ios64"). + +* Added support to build Android with dynamic libraries. + + * The changes are copied from iOS makefiles, now Android makefiles are in line with iOS ones. + +* Modified cmake files of PhysXCharacterKinematic and PhysXExtension projects for Mac/iOS/Android so they add the suffix "_static" like the other platforms. + +### Fixed + +* Some profile zones did not properly setup the "context" parameter. This has been fixed. +* Removed duplicate closing cross-thread event for Basic.narrowPhase event. +* Fixed buffer over-read in CmPool.h +* Replaced all custom offsetof expressions that seem to dereference a null pointer with the PX_OFFSET_OF_RT macro. +* Replaced run-time assert on sizeof(PxHeightFieldSample::height) with compile-time assert in physx::Gu::HeightFieldUtil constructor. +* Various minor issues (doc typos, const correctness, compilation warnings, etc) reported on GitHub have been fixed. + + + +## Rigid body + +### Changed: + +* PxScene::setFrictionType() has been marked as deprecated due to its strong limitations. Simply set the desired friction type in PxSceneDesc. +* It is now legal to set the number of velocity iterations to zero. In some difficult configurations involving large mass ratios, the TGS solver's convergence can be negatively impacted by velocity iterations. + +### Fixed + +* The PxContactSet::ignore() function was not working properly and has been fixed. This may have caused issues in PxVehicleModifyWheelContacts. +* The debug visualization code could crash when using PxVisualizationParameter::eCOLLISION_COMPOUNDS. This has been fixed. +* Fixed a crash in the reduced-coordinates articulation system when the application removes the articulation from the scene and reinserts it back into the scene. +* Improved stacking quality with TGS solver simulating stacks of articulations. +* Fixed TGS solver stability issue constraining a rigid body to a kinematic actor. +* Fixed typo with ang dominance in CPU block solver. +* Fixed rare crash destroying a contact manager during CCD. +* Fixed buffer over-write when simulating a convex mesh with more than 64 vertices in a single face. + +### Added + +* PxRigidBodyFlag::eFORCE_KINE_KINE_NOTIFICATIONS and PxRigidBodyFlag::eFORCE_STATIC_KINE_NOTIFICATIONS have been added. + + + +## Cooking + +### Fixed: + +* The number of bytes allocated for vertices by the convex hull builder was incorrect. This has been fixed. + + + +## Serialization + +### Fixed: + +* A performance problem in PxBinaryConverter when converting large collections has been fixed. + + + +## Vehicles + +### Added: + +* PxVehicleWheelsDynData::getConstraints() and PxVehicleWheelsDynData::getNbConstraints() have been added to potentially have vehicles use immediate mode for solving the vehicle rigid body constraints. +* New method PxVehicleGraph::getRawData() to extract raw telemetry data. +* An inflation parameter has been added to PxVehicleSuspensionSweeps. +* New flags PxVehicleWheelsSimFlag::eDISABLE_INTERNAL_CYLINDER_PLANE_INTERSECTION_TEST and PxVehicleWheelsSimFlag::eDISABLE_SUSPENSION_FORCE_PROJECTION have been added. + +### Changed: + +* Concurrent calls to PxVehicleUpdateSingleVehicleAndStoreTelemetryData() are now permitted if the additional parameter vehicleConcurrentUpdates is used. + +### Fixed: + +* A null pointer dereference bug has been fixed. The bug occurred if the vehicle's rigid body actor was asleep and the vehicle relied on cached tire contact planes rather than the results of a fresh suspension query. + + + +## Character controller + +### Fixed: + +* The prefilter & postfilters callback were called all the time, ignoring the PxQueryFlag::ePREFILTER and PxQueryFlag::ePOSTFILTER flags. This has been fixed. + + + +## Scene queries + +### Fixed: + +* The BVH34 codepath had a bug in the raycast-vs-mesh-with-multiple-hits case, where returned hits could be further away than defined max hit distance. This has been fixed. + + + + + +# v4.1.1 +August 2019 + +## General + +### Added: + +* Support for Visual Studio 2019 has been added, cmake 3.14 is required. + +### Changed: + +* Android binary output directory name contains Android ABI string. + + + +## Vehicles + +### Added: + +* PxVehicleWheelsSimFlags and corresponding set/get methods have been added to PxVehicleWheelsSimData. The flag eLIMIT_SUSPENSION_EXPANSION_VELOCITY can be used to avoid suspension forces being applied if the suspension can not expand fast enough to push the wheel onto the ground in a simulation step. This helps to reduce artifacts like the vehicle sticking to the ground if extreme damping ratios are chosen. + +### Fixed: + +* The PxVehicleDrive::setToRestState() was not clearing all cached data, which could sometimes make vehicles misbehave after calls to this function. + + + +## Cooking + +### Added: + +* Added error message when not at least four valid vertices exist after vertices cleanup. + + + +## Serialization + +### Fixed: + +* Binary serialization of kinematic rigid dynamic actors was failing unless they were part of a scene. + + + +## Rigid body + +### Fixed + +* Out of shared memory failure with GPU articulations. +* Inconsistent results when setting joint drive targets with GPU articulations compared to CPU articulations. +* Assert when simulating a scene with > 64k rigid bodies and joints. +* Error in PxActor::getConnectors() method when there are multiple connector types. +* Setting joint positions on articulations did not update world-space link poses and velocities. +* Improved TGS articulation joint drive solver. +* Improved robustness of articulation spherical joints. +* Joint forces/positions/velocities set through the PxArticulationCache are correctly applied when using GPU articulations. +* Fixed rare crash in MBP when the system contains out-of-bounds objects. +* Fixed a crash in the reduced-coordinates articulation system when the application removes the articulation from the scene and reinserts it back into the scene. + + + + + +# v4.1.0 +March 2019 + +## Overview + +### Immediate mode support for reduced-coordinates articulations and the temporal Gauss Seidel solver. +### GPU acceleration for reduced-coordinates articulations. + + +## General + +### Added: + +* Added support for UWP, note that cmake 3.13.4 is required for uwp arm64. + +### Fixed: + +* PhysXGpu DLLs are now standalone, so they will now work with both static and dynamic PhysX libraries. +* PhysX delay loading code is disabled for the static library configuration. + +### Changed: + +* Removed PxGpuDispatcher class. Instead of querying the GPU dispatcher with PxCudaContextManager::getGpuDispatcher() and providing it to the PxScene with PxSceneDesc::gpuDispatcher, please provide the CUDA context manager directly using PxSceneDesc::cudaContextManager. +* PxCreateCudaContextManager does have an additional parameter PxProfilerCallback, that is required in order to get profiling events from the GPU dll. +* FastXml project is now compiled as OBJECT on win platforms and is linked into PhysXExtensions library. +* Removed PxArticulationBase::getType(), PxArticulationBase::eReducedCoordinate, PxArticulationBase::eMaximumCoordinate and added PxConcreteType::eARTICULATION_REDUCED_COORDINATE, PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE. + + + +## Rigid Bodies + +### Added: + +* Immediate mode API for reduced-coordinates articulations. +* Immediate mode API for the temporal Gauss Seidel (TGS) solver . +* Compute dense Jacobian matrix for the reduced-coordinates articulations. +* GPU acceleration for reduced-coordinates articulations with PGS solver. +* GPU acceleration for reduced-coordinates articulations with TGS solver (experimental). + +### Changed: + +* PxSimulationStatistics::nbDynamicBodies does not include kinematics any longer. Instead they are covered in new nbKinematicBodies counter. + +### Fixed: + +* Fixed speculative CCD optimization with sleeping bodies. +* Fixed the overlap termination condition in the GJK code for sphere primitive. +* Fixed a bug in the face selection algorithm for paper thin box overlapped with capsule. +* Fixed a contact recycling issue with PCM contact gen. +* Fixed an issue with articulation when removing and adding links to the articulation. + + + +## Serialization + +### Added: + +* PxSerialization::serializeCollectionToBinaryDeterministic, convenience function to post-process binary output with PxBinaryConverter for determinism. For achieving determinism, the checked build needs to be used. +* Support for binary and xml serialization for PxArticulationReducedCoordinate. + +### Fixed: + +* PxBinaryConverter can now produce deterministic output, independent of the runtime environment the objects have been serialized in. For achieving determinism, the checked build needs to be used for serializing collections. + +### Changed: + +* PX_BINARY_SERIAL_VERSION has been changed to a global unique identifier string. PX_PHYSICS_VERSION is no longer part of binary data versioning. + + + + + +# v4.0.0.25635910 +January 2019 + +## General + +### Fixed: + +* Fixed issue in PxBinaryConverter::convert that could corrupt platform re-targeting of convex meshes with more than 127 vertices. +* GenerateProject scripts should now also work when not called from PhysX directory. +* GenerateProject script will now create correct compiler/ directory on Linux based systems. +* Removed /Wall from MSVC compilers. +* Fixed CMake install, added missing cudacontextmanager files. +* Fixed binary serialization of actors in aggregates without serialization of the containing aggregate. + +### Removed: + +* CharacterKinematic API export/import macros have been removed. + +### Added: + +* Support for Linux samples has been added. +* PxConfig.h include file will be generated during generate projects script. Including this file in your project will ensure that required defines (like PX_PHYSX_STATIC_LIB) are set. + +### Changed: + +* PX_FOUNDATION_API was moved to PhysX and uses PX_PHYSX_STATIC_LIB define as the rest of the SDK. +* PxAssertHandler moved from PxShared to PhysX and marked as deprecated. +* PxShared does use PX_SHARED_ASSERT instead of PX_ASSERT which is used just in the PhysX SDK and uses PxAssertHandler. + + + + + +# v4.0 +December 2018 + +## Supported Platforms + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Runtime + Development
+ Apple iOS (tested on 12.1) + Xcode (tested with 10.1)
+ Apple macOS (tested on 10.13) + Xcode (tested with 10.1)
+ Google Android ARM (tested with API Level 19 - KITKAT) + NDK r13b
+ Linux (tested on Ubuntu 16.04), GPU acceleration: display driver and GPU supporting CUDA 10 / CUDA ARCH 3.0 + Clang (tested with 3.8)
+ Microsoft Windows, GPU acceleration: display driver and GPU supporting CUDA 10 / CUDA ARCH 3.0 + Microsoft Visual Studio 2013, 2015, 2017
+ Microsoft XBox One* +
+ Nintendo Switch* +
+ Sony Playstation 4* +
+ +\* Console code subject to platform NDA not available on GitHub. Developers licensed by respective platform owners please contact NVIDIA for access. + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + + + +## General + +### Added: + +* New Temporal Gauss Seidel (TGS) solver offering a new level of simulation accuracy. +* New Reduced Coordinate Articulation feature with no relative positional error and realistic actuation. +* New automatic multi-broadphase (ABP) providing better out of the box performance for many use cases. +* New BVH structure supporting better performance for actors with many shapes. + +### Removed: + +* PhysX Particle feature. +* PhysX Cloth feature. +* The deprecated active transforms feature has been removed. Please use active actors instead. +* The deprecated multi client behavior feature has been removed. +* The deprecated legacy heightfields have been removed. + +### Changed: + +* The PhysX SDK build system is now based on CMake generated build configuration files. For more details, please refer to the PhysX SDK 4.0 Migration Guide. +* The Linux build has been changed to produce static as opposed to shared libraries. The compiler was switched from GCC to Clang. +* The PxShared library contains functionality shared beyond the PhysX SDK. It has been streamlined to a minimal set of headers. The PxFoundation singleton has been moved back to the PhysX SDK, as well as the task manager, CUDA context manager and PhysX Visual Debugger (PVD) functionality. +* PhysXDelayLoadHook and PhysXGpuLoadHook have been simplified, and PxFoundationDelayLoadHook has been removed. + + + +## Rigid Bodies + +### Added: + +* A new broadphase implementation has been added. See PxBroadPhaseType::eABP for details. This is now the default broadphase implementation. +* TGS: A new rigid body solver, which can produce improved convergence compared to the default rigid body solver. +* Optional torsional friction model to simulate rotational friction when there is just a single point of contact. +* A flag to enable friction constraints to be processed every frame has been added +* PxContactJoint added to represent contacts in inverse dynamics. Not intended for use in simulation. +* A missing PxShape::getReferenceCount() function has been added. +* A new flag has been added to PxMaterial to improve friction accuracy. The flag is disabled by default to maintain legacy behavior. + +### Removed: + +* PxVisualizationParameter::eDEPRECATED_BODY_JOINT_GROUPS has been removed. +* PxSceneDesc::maxNbObjectsPerRegion has been removed. +* PxRigidActor::createShape() has been removed. Please use PxPhysics::createShape() or PxRigidActorExt::createExclusiveShape() instead +* The deprecated mass parameter in PxTolerancesScale has been removed. +* PxSceneFlag::eDEPRECATED_TRIGGER_TRIGGER_REPORTS has been removed. + +### Changed: + +* Aggregates can now contain more than 128 actors. +* Switching a kinematic object to dynamic does not automatically wake up the object anymore. Explicit calls to PxRigidDynamic::wakeUp() are now needed. +* Switching a kinematic object to dynamic re-inserts the object into the broadphase, producing PxPairFlag::eNOTIFY_TOUCH_FOUND events instead of PxPairFlag::eNOTIFY_TOUCH_PERSISTS events. +* PxConvexMeshGeometryFlag::eTIGHT_BOUNDS is now enabled by default for PxConvexMeshGeometry. +* The default max angular velocity for rigid bodies has been changed, from 7 to 100. + + + + + +## Extensions + +### Added: + +* PxD6Joint now supports per-axis linear limit pairs. +* Added PxSphericalJoint::getSwingYAngle and PxSphericalJoint::getSwingZAngle. +* Added PxD6Joint distance limit debug visualization. +* Added PxD6JointCreate.h file with helper functions to setup the D6 joint in various common configurations. +* Added pyramidal swing limits to the D6 joint. + + +### Removed: + +* PxComputeHeightFieldPenetration has a new signature. +* PxComputeMeshPenetration has been removed. Use PxComputeTriangleMeshPenetration instead. + + +### Changed: + +* PxRevoluteJoint now properly supports a -PI*2 to +PI*2 range for its limits, and the accuracy of limits has been improved. In order to use extended limit ranges, PxConstraintFlag::eENABLE_EXTENDED_LIMITS must be raised on the constraint. +* PxD6Joint now properly supports a -PI*2 to +PI*2 range for its twist limit, and the accuracy of the twist limit has been improved. In order to use extended limit ranges, PxConstraintFlag::eENABLE_EXTENDED_LIMITS must be raised on the constraint. +* The accuracy of the D6 joint swing limits has been improved. +* PxDistanceJoint does now always insert constraint row, this change does increase the limit precision. +* PxDistanceJoint::getDistance does not anymore return squared distance. +* PxD6Joint::setDriveVelocity, PxD6Joint::setDrivePosition and PxRevoluteJoint::setDriveVelocity have now additional parameter autowake, which will wake the joint rigids up if true (default behavior). +* Joint shaders now take a bool to define whether to use extended joint limits or not. +* Joint shaders must now provide the cA2w and cB2w vectors, defining the world-space location of the joint anchors for both bodies. + + +### Deprecated: + +* PxD6Joint::getTwist() has been deprecated. Please use PxD6Joint::getTwistAngle() now. +* The previous PxD6Joint::setLinearLimit() and PxD6Joint::getLinearLimit() functions (supporting a single linear limit value) have been deprecated. Please use PxD6Joint::setDistanceLimit() and PxD6Joint::getDistanceLimit() instead. Or you can also use the new PxD6Joint::setLinearLimit() and PxD6Joint::getLinearLimit() functions, which now support pairs of linear limit values. + + + +## Articulations + +### Added: + +* New reduced coordinate articulation implementation, supporting a wider range of joint types, more accurate drive model, inverse dynamics and joint torque control. +* PxArticulationJoint::getParentArticulationLink and PxArticulationJoint::getChildArticulationLink has been added. + + + +## Scene queries + +### Removed: + +* PxHitFlag::eDISTANCE has been removed. +* The PxVolumeCache feature has been removed. +* The PxSpatialIndex feature has been removed. +* The deprecated PxSceneFlag::eSUPPRESS_EAGER_SCENE_QUERY_REFIT has been removed. + + + +## Cooking + +### Added: + +* PxBVHStructure added, it computes and stores BVH structure for given bounds. The structure can be used for actors with large amount of shapes to perform scene queries actor centric rather than shape centric. For more information please see guide or snippets. + +### Removed: + +* PxPlatform enum has been removed. PhysX supported platforms all share the same endianness +* The deprecated PxCookingParams::meshCookingHint and PxCookingParams::meshSizePerformanceTradeOff parameters have been removed. +* The deprecated PxGetGaussMapVertexLimitForPlatform has been removed, use PxCookingParams::gaussMapLimit instead. +* The deprecated PxConvexMeshCookingType::eINFLATION_INCREMENTAL_HULL and PxCookingParams::skinWidth have been removed. +* PxBVH34MidphaseDesc::numTrisPerLeaf has been renamed to PxBVH34MidphaseDesc::numPrimsPerLeaf + + + + +# v3.4.2.25354359 +December 2018 + +## General + +### Changed: + +* Changed GitHub distribution to BSD license. + + + +## Supported Platforms + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Runtime + Development
+ Apple iOS (tested on 12.1) + Xcode (tested with 10.1)
+ Apple macOS (tested on 10.13) + Xcode (tested with 10.1)
+ Google Android ARM (tested with API Level 16, Android 4.1 - JELLY_BEAN) + NDK r13b-win32
+ Linux (tested on Ubuntu 16.04, GPU acceleration: NVIDIA Driver version R361+ and CUDA ARCH 3.0) + GCC (tested with 4.8)
+ Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) + Microsoft Visual Studio 2012, 2013, 2015
+ Microsoft XBox One* +
+ Nintendo Switch* +
+ Sony Playstation 4* +
+ +\* Console code subject to platform NDA not available on GitHub. Developers licensed by respective platform owners please contact NVIDIA for access. + + + +# v3.4.2.25256367 +November 2018 + +## General + +### Changed: + +* A couple of serialization write functions have been optimized. +* Rtree cooking has been slightly optimized. +* Renamed PxSerializer::requires to PxSerializer::requiresObjects due to an erroneous clash with C++20 keyword with apple-clang. + +### Fixed: +### Moved external vector math includes out of PhysX namespaces. + + + +## Rigid Bodies + +### Fixed: + +* Fixed an incorrect trigger behavior when a trigger was removed and inserted within the same frame. + + + +## Scene query + +### Fixed: + +* Fixed a bug in BVH34. Raycasts could fail on binary deserialized BVH34 triangle meshes. + + + + + +# v3.4.2.24990349 +September 2018 + +## General + +### Fixed: + +* PxMeshQuery::getTriangle adjacency information for heightfield geometry fixed. +* Removed PxSetPhysXGpuDelayLoadHook from API. Delay loaded dynamically linked library names are now provided through PxSetPhysXDelayLoadHook. +* Fixed a source of non-determinism with GPU rigid bodies. + + + +## Rigid Bodies + +### Fixed: + +* Fixed a divide by zero bug when gjk is trying to calculate the barycentric coordinate for two identical/nearly identical points. +* Fixed an incorrect mesh index reported in contact buffer when stabilization flag was used. + + + + + +# v3.4.2.24698370 +August 2018 + +## Rigid Bodies + +### Fixed: + +* Fixed a crash bug when EPA's edge buffer overflow. +* GPU rigid bodies fixed for Volta GPUs. + +### Added: + +* Aggregate broad phase now runs in parallel + + + +## Cooking + +### Fixed: + +### Added: + +* PxHeightField::getSample has been added. + + + +## Character controller + +### Fixed: + +* Capsule controller with a very small height could degenerate to spheres (with a height of exactly zero) far away from the origin, which would then triggers errors in Debug/Checked builds. This has been fixed. +* The triangle array growing strategy has been changed again to prevent performance issues when tessellation is used. Memory usage may increase in these cases. +* Some internal debug visualization code has been disabled and a crash in it has been fixed. + + + +## Scene query + +### Fixed: + +* Fixed possible buffer overrun when PxPruningStructure was used. +* Raycasts against a heightfield may have missed if a large distance was used. +* Sq raycasts against heightfield or triangle mesh could return a mildly negative values, this has been fixed. + + + + + +# v3.4.2.24214033 +May 2018 + +## General + +### Fixed: + +* Fixed clang 7 unionCast issues. +* Fixed the binary meta data in PhysX_3.4/Tools/BinaryMetaData for conversion of vehicles. + + + +## Rigid Bodies + +### Deprecated: + +* PxSceneFlag::eENABLE_KINEMATIC_STATIC_PAIRS and PxSceneDesc::eENABLE_KINEMATIC_PAIRS have been deprecated. Use the new PxPairFilteringMode parameters in PxSceneDesc instead. + +### Fixed: + +* A sequence of shape->setFlag(PxShapeFlag::eSIMULATION_SHAPE, false) / shape->setFlag(PxShapeFlag::eSIMULATION_SHAPE, true) without simulation calls in-between could produce errors in the broadphase. This has been fixed. +* Fixed a bug in the broadphase (SAP) that got recently introduced in SDK 3.4.1.23933511. It should only have generated a few false positives (more overlaps than strictly necessary). +* Fixed a bug in PxShape::checkMaterialSetup. +* Fixed intermittent crash with GPU rigid bodies when materials were destroyed. +* Fixed bug where setting maxImpulse to 0 on CCD contact modification meant contact was not reported in the frame's contact reports. + + + +## Cooking + +### Fixed: + +* Big convex mesh serialization used together with insertion callback stored incorrect memory for big convex data. This has been fixed. + + + +## Scene query + +### Fixed: + +* Fixed a bug in extended bucket pruner, when a pruning structure was added and immediatelly released. + + + + + +# v3.4.1.23933511 +April 2018 + +## General + +### Added: + +* Added snippet for deformable meshes, added section in the guide for them. + + + +## Rigid Bodies + +### Fixed: + +* PxTriangleMesh::refitBVH() was crashing with PxMeshPreprocessingFlag::eDISABLE_ACTIVE_EDGES_PRECOMPUTE. This has been fixed. +* SQ-only shapes contained in aggregates could result in crashes or memory corruption when removed from the aggregate. This has been fixed. +* Assert no longer fired if a dynamic body contacting a static is converted to kinematic with kinematic-static pairs enabled. +* Assert reporting broad phase as being "inconsistent" could fire when using speculative CCD when sleeping objects were activated. + + + +## Cooking + +### Fixed: + +* Convex hull cooking could have produced hulls with vertices too far from convex hull planes, this has been fixed. + +### Changed: + +* PxCooking::createTriangleMesh does now take additional output parameter PxTriangleMeshCookingResult::Enum. +* PxCooking::createConvexMesh does now take additional output parameter PxConvexMeshCookingResult::Enum. + + + +## Scene query + +### Changed: + +* PxSceneFlag::eSUPPRESS_EAGER_SCENE_QUERY_REFIT has been marked as deprecated. Was replaced with PxSceneQueryUpdateMode enum, if this new enum is set the flag gets ignored. + +### Added: + +* PxSceneQueryUpdateMode was added to control work done during fetchResults. +* PxScene::sceneQueriesUpdate, PxScene::checkQueries and PxScene::fetchQueries were added to run separate scene query update, see manual for more details. + + + + + +# v3.4.1.23584284 +February 2018 + +## General + +### Fixed: + +* PhysX sometimes froze in a spinlock after certain sequences of read & write locks. This has been fixed. + + + +## Scene queries + +### Fixed: + +* Raycasts against heightfields were sometimes missing hits for vertical rays were located exactly at the heightfield's boundaries. This has been fixed. + + + +## Rigid Bodies + +### Fixed: + +* Avoid edge-face collisions on boundary edges when eNO_BOUNDARY_EDGES flag is raised on heightfield when using PCM and unified HF collision. + + + + + +# v3.4.1.23472123 +January 2018 + +## General + +### Added: + +* Visual Studio 2017 15.5.1 and newer is now supported. Samples are currently not supported with Visual Studio 2017. + + +### Removed: + +* Visual Studio 2012 support is discontinued. + + + +## Cooking + +### Fixed: + +* Cooked mesh structures contained a mix of little-endian and big-endian data (the midphase structures were always saved as big-endian). This made loading of cooked files slower than necessary. This has been fixed. + + + +## Scene queries + +### Fixed: + +* Buffered moves were sometimes not properly taken into account by scene queries, leading to invalid results for one frame. This has been fixed. +* Pruning structure failed to build when actor had more shapes. This has been fixed. + + + + + +# v3.4.1.23173160 +November 2017 + +## Extensions + +### Fixed: + +* An issue with CCD sweeps against meshes that could potentially lead to the earliest impact not being detected has been fixed. + + + + + +# v3.4.1.23131702 +November 2017 + +## General + +### Fixed: + +* A bug in the management of internal interaction objects has been fixed. + + + +## Extensions + +### Fixed: + +* A regression in prismatic constraint stability introduced in PhysX 3.4.1 has been fixed. +* PxRevoluteJoint::getAngle(), PxD6Joint::getTwist(), PxD6Joint::getSwingYAngle() and PxD6Joint::getSwingZAngle() did not always return the correct angle. This problem has been fixed. +* The "double cone" case of the D6 joint had errors both in the debug visualization and the code dealing with limits. This has been fixed. +* The debug visualization of the D6 joint in the twist case did not properly color-code the angular limits. This has been fixed. +* The debug visualization of distance joints has been fixed. +* The debug visualization of prismatic joints has been fixed. +* The debug visualization of revolute joints has been fixed. It now renders active limits properly (in red when the limit is active, grey otherwise). +* Proper visualization flags are now passed to the PxConstraintVisualize function. Previously all available flags were active, even if PxVisualizationParameter::eJOINT_LOCAL_FRAMES and/or PxVisualizationParameter::eJOINT_LIMITS were set to zero. +* PxRevoluteJoint::getVelocity has been fixed. + + + +## Scene queries + +### Fixed: + +* Sweep queries using the eMTD flag could generate incorrect normals in sphere/sphere, sphere/capsule or capsule/capsule cases, when the objects were exactly overlapping each-other. This has been fixed. +* Sweep convex mesh vs heightfield queries using the eMTD flag did not fill correctly returned faceIndex. This has been fixed. + + + + + +# v3.4.1 +September 2017 + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + + + +## General + +### Deprecated: + +* The PhysX cloth feature has been deprecated. + +### Changed: + +* The meaning of PxVisualizationParameter::eCULL_BOX has changed. It is now used to visualize the current culling box, while it was previously used to enable or disable the feature. Please simply use PxScene::setVisualizationCullingBox() to enable the feature from now on. +* PxVisualizationParameter::eBODY_JOINT_GROUPS has been deprecated. +* Performance of setCMassLocalPose function has been improved. + +### Added: + +* PhysXGpu: Added warnings for the case when the dynamic gpu library fails to load. + + + +## Rigid Bodies + +### Fixed: + +* A potential crash when calling detachShape has been fixed. +* Fixed assert that fired if application switched a body from dynamic to kinematic, then queried kinematic target without setting one. This assert only fired if the modifications overlapped simulation so were buffered. +* PxArticulation::getStabilizationThreshold() and PxArticulation::setStabilizationThreshold() were accessing the sleep threshold instead of the stabilization threshold. This has been fixed. +* Fixed an internal edge bug in PCM sphere vs mesh code +* Make sure sphere vs sphere and sphere vs box in PCM contact gen generate contacts consistently on the second body when the sphere center is contained in the other shape + +### Changed: + +* Improved convex vs mesh contact generation when using GPU rigid bodies. Requires the mesh to be recooked. +* Improved convex vs convex contact generation when using GPU rigid bodies. +* Reduced memory footprint of GPU triangle meshes significantly. Requires the mesh to be recooked. + +### Added: + +* Support for modifying friction and restitution coefficients has been added to contact modification. +* Added PxRigidBodyFlag::eENABLE_CCD_MAX_CONTACT_IMPULSE to enable maxContactImpulse member of PxRigidBody to be used in CCD. This is disabled by default. It is useful in some circumstances, e.g. shooting a small ball through a plate glass window and triggering it to break, but it can also result in behavioral artifacts so it is disabled by default. +* Added PxSceneDesc::solverOffsetSlop. This is defaulted to a value of 0. A positive, non-zero value defines a tolerance used in the solver below which a contacts' offset from the COM of the body is negligible and therefore snapped to zero. This clamping occurs in a space tangential to the contact or friction direction. This is aimed at pool or golf simulations, where small numerical imprecision in either contact points or normals can lead to balls curving slightly when there are relatively high angular velocities involved. +* Added PxConvexMeshGeometry::maxMargin. This allows the application to tune the maximum amount by which PCM collision detection will shrink convex shapes in contact generation. This shrinking approach leads to some noticeable clipping around edges and vertices, but should not lead to clipping with face collisions. By default, the mesh is shrunk by an amount that is automatically computed based on the shape's properties. This allows you to limit by how much the shape will be shrunk. If the maxMargin is set to 0, then the original shape will be used for collision detection. + + + + +## Scene queries + +### Fixed: + +* A rare invalid memory read that could lead to incorrect sweep results in case of an initial overlap has been fixed. + + + +## Serialization + +### Fixed: + +* Binary serialization didn't preserve PxConstraintFlags, e.g. projection flags. +* Xml serialization failed if a shape referencing a PxTriangleMesh was added to another (dependent) collection. + + + +# v3.4.0.22387197 +June 2017 + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + + + +## Cooking + +### Fixed: + +* Fixed issue when PxConvexFlag::e16_BIT_INDICES was used together with PxConvexFlag::eCOMPUTE_CONVEX. +* Fixed issue in convex hull cooking when postHullMerge was not executed. +* Fixed crash in CCD when using bodies with 0 mass. + + + +## Rigid Bodies + +### Fixed: + +* Fixed behavioral differences when comparing the results of a given scene to the results when simulating a subset of the islands in that scene. In order for this case to be deterministic, it is necessary to raise PxSceneFlag::eENABLE_ENHANCED_DETERMINISM. + + +### Added: + +* Introduced maxBiasCoefficient in PxSceneDesc to be able to limit the coefficient used to scale error to produce the bias used in the constraint solver to correct geometric error. The default value is PX_MAX_F32 and, therefore, a value of 1/dt will be used. This value can be useful to reduce/remove jitter in scenes with variable or very small time-steps. + +# v3.4.0.22121272 +May + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + + + +## Rigid Bodies + +### Fixed: + +* Fixed a bug in convex vs convex PCM contact gen code. There were cases in which full contact gen should have been triggered but was not. +* Fixed a jittering bug on both GPU/CPU codepath in PCM contact gen code. This is due to the contact recycling condition not considering the toleranceLength. +* Fixed a bug causing simulation to behave incorrectly when greater than 65536 bodies were simulated. + + + +## Scene queries + +### Fixed: + +* A rare crash that could happen with sphere overlap calls has been fixed. +* Fixed a stack corruption in CCD contact modification callback. +* Fixed a bug where external forces were not cleared correctly with PxArticulations. + + + +## Cooking + +### Changed: + +* Convex hull cooking now reuses edge information, perf optimization. +* PxCooking API is now const if possible. + + +# v3.4.0.22017166 +April 2017 + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + + + +## General + +### Added: + +* PxConvexMeshGeometry::maxMargin has been added. This will let the application limit how much the shape is shrunk in GJK when using by PCM contact gen + + + +## Rigid Bodies + +### Fixed: + +* Fixed a bug with joint breaking where sometimes joints would not break as expected. +* Fix a race condition between cloth/particle/trigger interactions and the parallel filtering of rigid body interaction. +* GPU rigid body feature now issues a performance warning in checked build if feature is enabled but PCM contact gen is not. +* Fixed a bug with applying external force/torque to a body in buffered insertion stage. +* Fixed a bug with CCD involving rotated static mesh actors. +* Fixed a memory leak in CCD. + +### Changed: + +* Optimizations for GPU rigid body feature, including reduced memory footprint and improvements to performance spikes when many objects are woken in a single frame. + + + +## Midphase + +### Fixed: + +* Fix Crash in BV4 code (serialization bug). + + + +## Cooking + +### Fixed: + +* Fix endless loop in convex hull cooking. + + +# v3.4.0.21821222 +March 2017 + +## Supported Platforms + +## Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android ARM (version 2.2 or later required for SDK, 2.3 or later required for snippets) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) +* Microsoft XBox One +* Nintendo Switch +* Sony Playstation 4 + +## Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2012, 2013, 2015 +* Xcode 8.2 + + +## Known Issues + + + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + + + +## General + +### Fixed: + +* A rare crash happening in the debug visualization code has been fixed. + + + +## Rigid Bodies + +### Fixed: + +* Fixed a bug in PCM capsule vs plane contact gen. +* A crash happening with more than 64K interactions has been fixed. +* Fixed an island management issue in CCD when using multiple CCD passes. +* Fixed a bug with GPU rigid bodies with non-simulation scene query-only shapes. +* Fixed a bug in convex vs convex PCM contact gen code. There were cases in which full contact gen should have been triggered but was not. +* Fixed a jittering bug on both GPU/CPU codepath in PCM contact gen code. This is due to the contact recycling condition not considering the toleranceLength. + +### Added: + +* getFrozenActors has been added to allow application queries the frozen actors +* PxRigidDynamic::setKinematicSurfaceVelocity has been added, permitting the user to set a persistent velocity on a kinematic actor which behaves like a conveyor belt +* PxSceneDesc::solverOffsetSlop added. This defines a threshold distance from a body's COM under which a contact will be snapped to the COM of the body inside the solver along any principal component axis + + + +## Scene queries + +### Fixed: + +* A bug in the BVH34 overlap code sometimes made PxMeshOverlapUtil::findOverlap assert (reporting an incorrect buffer overflow). This has been fixed. +* Fix a bug in the case of two primitives just touching in sweep with eMTD flag on. + + + +# v3.4 +February 2017 + +## Supported Platforms + +## Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android ARM (version 2.2 or later required for SDK, 2.3 or later required for snippets) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) +* Microsoft XBox One +* Nintendo Switch +* Sony Playstation 4 + +## Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2012, 2013, 2015 +* Xcode 8.2 + + +## Known Issues + + + +## Changes and Resolved Issues +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + +## General + +* Added: + + * nbAggregates, nbArticulations, nbDiscreteContactPairsTotal, nbDiscreteContactPairsWithCacheHits and nbDiscreteContactPairsWithContacts have been added to PxSimulationStatistics. + * PxSceneLimits::maxNbBroadPhaseOverlaps has been added. + * A new midphase has been added. See PxMeshMidPhase enum for details. + * Midphase descriptor has been added. See PxMidphaseDesc for details. + * PxHeightField::getTimestamp() has been added + * PxCloneShape has been added to enable cloning of shapes. + * acquireReference() has been added to increment the reference count of shapes, materials, triangle meshes, convex meshes heightfields and cloth fabrics. + * The global filter shader data block can now be set through PxScene::setFilterShaderData(). + * PxGpuLoadHook and PxSetPhysXGpuLoadHook has been added to support loading of GPU dll with a different name than the default. + * A new profile zone has been added for debug visualization. + +* Changed: + + * PxMathUtils.h has moved from include/common to include/foundation + * GPU support requires SM2.x (Fermi architecture, GeForce 400 series) or later hardware. SM1.x is no longer supported. + * Windows XP 64-bit and Windows Vista no longer support GPU acceleration. Windows XP 32-bit still supports GPU acceleration. + * PxTaskManager::createTaskManager requires error callback and does not accept SPU task manager. + * PxCreatePhysics and PxCreateBasePhysics now take an optional pointer to an physx::PxPvd instance. + * PxConstraintConnector::updatePvdProperties now takes an optional pointer to an physx::pvdsdk::PvdDataStream instance. + * PxInitExtensions now takes an optional pointer to an physx::PxPvd instance. + * Shared objects (triangle mesh, convex mesh, heightfield, material, shape, cloth fabric) no longer issue an eUSER_RELEASE event when their release() method is called + * PxBase::isReleasable() is now a property only of the type of an object, not the object state. In particular, isReleasable() returns true for PxShape objects whose only counted reference belongs to their owning actor. + * PxCollection::releaseObjects() now calls release() even on shapes whose only counted reference belongs to their owning actor. An optional parameter releaseExclusiveShapes, which defaults to true, has been added to this method to assist with common scenarios in which all shapes are created with the deprecated method PxRigidActor::createShape() or its replacement PxRigidActorExt::createExclusiveShape() + * Negative mesh scale is now supported for PxTriangleMeshGeometry. Negative scale corresponds to reflection and scale along the corresponding axis. In addition to reflection PhysX will flip the triangle normals. + * PxDelayLoadHook is now inherited from PxFoundationDelayLoadHook. PxFoundation dll and PxPvdSDK dll are now delay loaded inside the SDK, their names can be provided through the delay load hook. + +* Removed: + + * Sony Playstation 3 is not supported any longer. Any related APIs have been removed. + * Microsoft XBox 360 is not supported any longer. Any related APIs have been removed. + * Nintendo Wii U is not supported any longer. Any related APIs have been removed. + * Sony Playstation Vita is not supported any longer. Any related APIs have been removed. + * Visual Studio 2010 is not supported any longer. + * Microsoft Windows RT is not supported any longer. + * Google Android X86 is not supported any longer. + * PhysX Samples are not supported anymore except on Microsoft Windows. + * Linux 32-bit no longer support GPU acceleration. Linux 64-bit still supports GPU acceleration. + +* Fixed: + + * PxScene::setFlag() does now properly send error messages in CHECKED builds if a non-mutable scene flag gets passed in. + * Fixed a bug in force threshold based contact reports, which caused events to be lost. + * Fixed a bug in aggregates that led to a crash when rigid bodies are added to an aggregate after removing all rigid bodies from an aggregate. This only occurred with aggregates that were added to the scene and with rigid bodies that had shapes attached. + * Fixed a bug where non-breakable joints could break, leading to a crash. + * Fixed RepX load of kinematic rigid bodies with mesh shapes. + * Fixed a divide by zero bug in SIMD distanceSegmentTriangle function. + * Debug visualization for compound bounds (PxVisualizationParameter::eCOLLISION_COMPOUNDS) now works even when all the compounds' shapes have their debug viz flag (PxShapeFlag::eVISUALIZATION) disabled. + * Double-buffering now works properly for the debug visualization culling box. + * The default debug visualization culling box now works correctly with heightfields. + * Rare crashes in PxShape::setGeometry() and PxShape::getMaterials() have been fixed. + * A crash happening when doing an origin shift on a scene containing an empty aggregate has been fixed. + +* Deprecated: + + * PxSceneLimits::maxNbObjectsPerRegion has been deprecated. It is currently not used. + * PxComputeHeightFieldPenetration has a new signature, and the old one has been deprecated + * PxComputeMeshPenetration has been deprecated. Use PxComputeTriangleMeshPenetration. + * The PhysX particle feature has been deprecated. + * PxTolerancesScale::mass has been deprecated. It is currently not used. + * PxActorClientBehaviorFlag has been marked as deprecated and will be removed in future releases. + +* Removed deprecated API: + + * PxPairFlag::eCCD_LINEAR removed. Use PxPairFlag::eDETECT_CCD_CONTACT | PxPairFlag::eSOLVE_CONTACT instead. + * PxPairFlag::eRESOLVE_CONTACTS removed. Use PxPairFlag::eDETECT_DISCRETE_CONTACT | PxPairFlag::eSOLVE_CONTACT instead. + * PxTriangleMeshFlag::eHAS_16BIT_TRIANGLE_INDICE removed. Use PxTriangleMeshFlag::e16_BIT_INDICES instead. + * PxTriangleMeshFlag::eHAS_ADJACENCY_INFO removed. Use PxTriangleMeshFlag::eADJACENCY_INFO instead. + * PxTriangleMeshDesc::convexEdgeThreshold removed. + * PxSceneQueryFlag renamed to PxHitFlag. + * PxHitFlag::eDIRECT_SWEEP renamed to PxHitFlag::ePRECISE_SWEEP. + * PxHitFlag::eIMPACT renamed to PxHitFlag::ePOSITION. + * PxSceneQueryHitType renamed to PxQueryHitType. + * PxSceneQueryCache renamed to PxQueryCache. + * PxSceneQueryFilterFlag renamed to PxQueryFlag. + * PxSceneQueryFilterFlags renamed to PxQueryFlags. + * PxSceneQueryFilterData renamed to PxQueryFilterData. + * PxSceneQueryFilterCallback renamed to PxQueryFilterCallback. + * PxScene::raycastAll,PxScene::raycastSingle,PxScene::raycastAny replaced by PxScene::raycast. + * PxScene::overlapAll,PxScene::overlapAny replaced by PxScene::overlap. + * PxScene::sweepAll,PxScene::sweepSingle,PxScene::sweepAny replaced by PxScene::sweep. + * PxQuat, PxTranform, PxMat33, PxMat44 createIdentity and createZero removed. Use PxIdentity, PxZero in constructor. + * PxJointType::Enum, PxJoint::getType() removed. Use PxJointConcreteType instead. + * PxVisualDebugger removed. Use PxPvd instead. + * PxControllerFlag renamed to PxControllerCollisionFlag. + * PxCCTHit renamed to PxControllerHit. + * PxCCTNonWalkableMode renamed to PxControllerNonWalkableMode. + * PxControllerNonWalkableMode::eFORCE_SLIDING changed to PxControllerNonWalkableMode::ePREVENT_CLIMBING_AND_FORCE_SLIDING. + * PxControllerDesc::interactionMode, groupsBitmask, callback removed. + * PxController::setInteraction, getInteraction, setGroupsBitmask, getGroupsBitmask removed. + * PxControllerManager::createController no longer needs PxPhysics and PxScene. + * PxControllerFilters::mActiveGroups replaced with PxControllerFilters::mCCTFilterCallback. + * PxSerialization::createBinaryConverter(PxSerializationRegistry&) changed to PxSerialization::createBinaryConverter(). + * PxConstraintDominance renamed to PxDominanceGroupPair. + * PxScene::flush renamed to PxScene::flushSimulation. + * PxClothFabric::getPhaseType removed. + * PxCollection::addRequired removed. + * PxRigidActor::createShape discontinued support for initial transform. + * PxShape::resetFiltering removed. + * PxParticleBase::resetFiltering removed. + * PxSceneDesc::meshContactMargin removed. + * PxSceneDesc::contactCorrelationDistance removed. + * Indexing operators taking signed integers in PxVec3, PxVec4, PxMat33, PxMat44, PxStrideIterator have been removed. + * PxHitFlag::ePOSITION, PxHitFlag::eDISTANCE and PxHitFlag::eNORMAL are now supported in PxMeshQuery::sweep function. + * PxClothFlag::eGPU renamed to PxClothFlag::eCUDA. + * PxActorTypeSelectionFlag/PxActorTypeSelectionFlags. Use PxActorTypeFlag/PxActorTypeFlags instead. + * PxConstraintFlag::eDEPRECATED_32_COMPATIBILITY flag removed. + + + +## PxShared + +APEX 1.4 can now be used independently of PhysX. In order to achieve that a new shared code base was created called "PxShared". PhysX functionality such as common types, PxFoundation, the task infrastructure are now part of PxShared. + + +## Rigid Bodies + +* Added: + + * An alternative simulation API has been introduced. This makes use of the following new functions: PsScene:collide(), PxScene::fetchCollision() and PxScene::advance(). Expected usage of these functions is illustrated in a new snippet SnippetSplitSim. This feature is also described in the manual in Section Simulation->SplitSim. + * PxSceneFlag::eDEPRECATED_TRIGGER_TRIGGER_REPORTS has been introduced to re-enable the legacy behavior of trigger shape pairs sending reports. This flag and the corresponding legacy behavior will be removed in version 4. + * The active actors feature has been added. See PxSceneFlag::eENABLE_ACTIVE_ACTORS. + * Functionality to compute and manipulate mass, inertia tensor and center of mass of objects has been exposed in the new class PxMassProperties. + * The option to exclude kinematics from the active actors/transforms list has been added. See PxSceneFlag::eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS for details. + * The integrated pose of dynamic rigid bodies can be accessed earlier in the pipeline through a new callback (see the API documentation for PxSimulationEventCallback::onAdvance() and PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW for details). + * PxConvexMeshGeometryFlag::eTIGHT_BOUNDS has been added. See the user manual for details. + * New split fetchResults methods introduced, see PxScene::fetchResultsBegin(), PxScene::fetchResultsFinish() and PxScene::processCallbacks(). This is intended to permit the application to parallelize the event notification callbacks. + * New flag introduced to suppress updating scene query pruner trees inside fetchResults, see PxSceneFlag::eSUPPRESS_EAGER_SCENE_QUERY_REFIT. Instead, pruners will be updated during the next query. + * Introduced GPU rigid body simulation support, see PxSceneFlag::eENABLE_GPU_DYNAMICS. GPU rigid body support requires SM3.0 or later. + * Introduced a new GPU-accelerated broad phase. See PxBroadPhaseType::eGPU. GPU broad phase support requires SM3.0 or later. + * Introduced a new enhanced determinism mode. See PxSceneFlag::eENABLE_ENHANCED_DETERMINISM. This provides additional levels of rigid body simulation determinism at the cost of some performance. + * Introduced a new speculative contacts CCD approach. See PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD. This is a slightly cheaper, less robust solution to PxRigidBodyFlag::eENABLE_CCD. There is no need to turn CCD on the scene using PxSceneFlag::eENABLE_CCD or enable PxPairFlag::eDETECT_CCD_CONTACT with this CCD mode as it functions as an extension to the discrete time-stepping scheme. This form of CCD can be enabled on kinematic actors. + * New "immediate mode" API has been added. This exposes access to the low-level contact generation and constraint solver, which allows the application to use these PhysX low-level components to perform its own simulations without needing to populate and simulate a PxScene. + * RigidDynamic lock flags added which permit the application to disallow rotation/translation of PxRigidDynamics around specific axes. + +* Changed: + + * PxRigidStatic objects can now have zero shapes while being part of a scene. + * PxContactPairFlag::eINTERNAL_HAS_FACE_INDICES is obsolete and has been removed. + * PxConstraintFlag::eDEPRECATED_32_COMPATIBILITY was previously only implemented for spring constraints. It is now correctly implemented for equality constraints. + * PxSceneFlag::eENABLE_PCM is enabled by default. This means PhysX uses PCM distance-based collision detection by default. + * Calls to PxRigidDynamic::setWakeCounter() following PxScene::collide() do now explicitly get taken into account in the subsequent call to PxScene::advance(). + * Calls to contact modification callbacks can be made from multiple threads simultaneously. Therefore, modification callbacks should must be thread-safe. + * Unified heightfield contact generation is now the default heightfield contact generation approach. This approach offers similar performance and behavior to contact generation with triangle meshes. Unified heightfields have no thickness because contact generation operates on triangles so objects may tunnel if CCD is not enabled. + * When unified heightfield contact generation is in use, the bounds of heightfield shapes are no longer extruded by "thickness". + * PxArticulationJoint::setTwistLimit and PxArticulationJoint::getTwistLimit were incorrectly documented with zLimit and yLimit in the wrong order. The behavior of both functions remains unchanged but now they are correctly documented with zLimit and yLimit in the correct order. This is simply a clarification of the existing function behavior. + +* Removed: + + * The deprecated class PxFindOverlapTriangleMeshUtil has been removed. Please use PxMeshOverlapUtil instead. + * The deprecated flag PxConstraintFlag::eREPORTING has been removed. Force reports are now always generated. + * The following deprecated simulation event flags have been removed: PxContactPairHeaderFlag::eDELETED_ACTOR_0, ::eDELETED_ACTOR_1, PxContactPairFlag::eDELETED_SHAPE_0, ::eDELETED_SHAPE_1, PxTriggerPairFlag::eDELETED_SHAPE_TRIGGER, ::eDELETED_SHAPE_OTHER. Please use the following flags instead: PxContactPairHeaderFlag::eREMOVED_ACTOR_0, ::eREMOVED_ACTOR_1, PxContactPairFlag::eREMOVED_SHAPE_0, ::eREMOVED_SHAPE_1, PxTriggerPairFlag::eREMOVED_SHAPE_TRIGGER, ::REMOVED_SHAPE_OTHER. + * The deprecated method PxPhysics::createHeightField(const PxHeightFieldDesc&) has been removed. Please use PxCooking::createHeightField(const PxHeightFieldDesc&, PxPhysicsInsertionCallback&) instead. The insertion callback can be obtained through PxPhysics::getPhysicsInsertionCallback(). + +* Deprecated: + + * PxRigidActor::createShape() has been deprecated in favor of PxRigidActorExt::createExclusiveShape() + * Trigger notification events for trigger-trigger pairs have been deprecated and will be omitted by default. See the 3.4 migration guide for more information. + * The active transforms feature (PxSceneFlag::eENABLE_ACTIVETRANSFORMS) has been deprecated. Please use PxSceneFlag::eENABLE_ACTIVE_ACTORS instead. + * PxRegisterHeightFields has been modified to register unified heightfields, which are now the default implementation. PxRegisterLegacyHeightFields() has been added to register the legacy (deprecated) heightfield contact gen approach. + * PxHeightFieldDesc::thickness has been deprecated, as the new unified height field (see PxRegisterUnifiedHeightFields()) does not support thickness any longer. + +* Fixed: + + * The capsule-vs-heightfield contact generation had a rare bug where a vertical capsule standing exactly on a shared edge could fall through a mesh. This has been fixed. + * The bounding box of a shape was not always properly updated when the contact offset changed. + * Fixed a bug in the GJK sweep caused by lost precision in the math + * Calls to PxScene::shiftOrigin() can crash when PxRigidDynamic actors with PxActorFlag::eDISABLE_SIMULATION are present. + * Fixed a bug when PxShape::setMaterials was called with less materials than shape had before. + * Fixed a bug in CCD that could lead to a hang in the simulation. + * Fixed a bug in PCM mesh edge-edge check for the parallel case. + * Fixed a bug in CCD where contact modify callbacks could be called when the CCD did not detect a contact. + * Fixed a bug with applying external force/torque to a body in buffered insertion stage. + * A rare capsule-vs-mesh contact generation bug has been fixed. + * A rare crash due to an invalid assert in the MBP broad-phase has been fixed. This error only affected debug & checked builds; release & profile builds were unaffected. + + + +## Particles + +* Gpu: Maxwell Optimizations +* The PhysX particle feature has been deprecated. +* Fixed particle collision issue with PxParticleBaseFlag::ePER_PARTICLE_COLLISION_CACHE_HINT (on by default). When particles collided against very dense triangle mesh areas an assert would be triggered or particles would leak through the triangle mesh. A workaround was to disable PxParticleBaseFlag::ePER_PARTICLE_COLLISION_CACHE_HINT. + + +## Cloth + +* Continuous collision (PxClothFlag::eSWEPT_CONTACT) behavior has been optimized to reduce cloth sticking to collision shape. +* Added air resistance feature (see PxCloth::setWindVelocity(PxVec3), PxCloth::setWindDrag(PxReal), PxCloth::setWindLift(PxReal), PxClothFabricDesc::nbTriangles, PxClothFabricDesc::triangles. + + +## Serialization + +* Fixed: + + * PxTriangleMesh instances with adjacency information were not correctly initialized when created with cooking.createTriangleMesh. This caused a crash when converting the binary serialized triangle mesh data. + + + +## Character controller + +* Added: + + * Profile zones have been added for the character controller. + * Added PxControllerDesc::registerDeletionListener boolean defining if deletion listener for CCT should be registered. + +* Fixed: + + * Character controllers cannot stand on dynamic triggers anymore. + * Fixed: the capsule-vs-sphere sweep now returns a normal in the correct direction. + * Fixed a bug where CCT shapes initially overlapping static geometry would be moved down by an incorrect amount (the length of the step offset). + * The overlap recovery module now works against kinematic objects. + + + +## Vehicles + +* Added: + + * Anti-roll suspension has been added. The class PxVehicleAntiRollBar and the functions PxVehicleWheelsSimData::setAntiRollBar, PxVehicleWheelsSimData::getAntiRollBar, PxVehicleWheelsSimData::getNbAntiRollBars allow anti-roll bars to be configured and queried. + + * A new function PxVehicleSuspensionSweeps has been introduced. This sweeps the PxShape that represents the wheel along the suspension direction. The hit planes resulting from the sweep are used as driving surfaces similar to those found by PxVehicleSuspensionRaycasts. + + * A new snippet SnippetVehicleContactMod has been added. This snippet demonstrates how to use sweeps and contact modification to allow the wheel's volume to fully interact with the environment. + + * A new function PxVehicleModifyWheelContacts has been introduced. This function analyses contact in the contact modification callback and rejects contact points that represent drivable surfaces. + * A new function PxVehicleSetMaxHitActorAcceleration has been introduced. This function sets the maximum acceleration experienced by a PxRigidDynamic that finds itself under the wheel of a vehicle. + +* Changed: + + * In checked build the functions PxVehicleDrive4W::allocate, PxVehicleDriveNW::allocate, PxVehicleDriveTank::allocate, PxVehicleNoDrive::allocate all return NULL and issue a warning if called before PxInitVehicleSDK. + + * Tire width is no longer accounted for when computing the suspension compression from raycasts (PxVehicleSuspensionRaycasts). Instead, tire width is incorporated into the suspension compression arising from swept wheels (PxVehicleSuspensionSweeps). It is recommended to use PxVehicleSuspensionSweeps if there is a strict requirement that the inside and outside of the wheel don't visibly penetrate geometry. + +* Fixed: + + * Suspension force calculation now applies an extra force perpendicular to the spring travel direction. This force is calculated to satisfy the constraint that the sprung mass only has motion along the spring travel direction. This change mostly affects vehicles with suspension travel directions that are not vertical. + * PxVehicleWheelsSimData::mThresholdLongitudinalSpeed and PxVehicleWheelsSimData::mMinLongSlipDenominator are now given default values that reflect the length scale set in PxTolerancesScale. + * Unphysically large constraint forces were generated to resolve the suspension compression beyond its limit when the suspension direction and the hit normal under the wheel approach perpendicularity. This has been fixed so that the constraint force approaches zero as the angle between the hit normal and suspension direction approaches a right angle. + + + +## Scene queries + +* Added: + + * PxPruningStructure was introduced as an optimization structure to accelerate scene queries against large sets of newly added actors. + * PxScene::addActors(PxPruningStructure& ) has been added. + * PxMeshQuery::sweep now supports PxHitFlag::eMESH_ANY. + * PxHitFlag::eFACE_INDEX was introduced to reduce the perf cost for convex hull face index computation. In order to receive face index for sweeps against a convex hull, the flag PxHitFlag::eFACE_INDEX has to be set. Note that the face index can also be computed externally using the newly introduced method PxFindFaceIndex from the extensions library. + * PxGeometryQuery::isValid was added to check provided geometry validity. + +* Changed: + + * Raycasts against triangle meshes with PxHitFlag::eMESH_MULTIPLE flag now return all hits, code for discarding hits close to each other has been removed. + * PxPruningStructure enum has been renamed to PxPruningStructureType + +* Deprecated: + + * PxHitFlag::eDISTANCE has been deprecated. + * The batched query feature has been deprecated. + * Volume cache feature has been deprecated. + * Spatial index feature has been deprecated. + +* Fixed: + + * PxScene::sweep now properly implements PxHitFlag::eMESH_BOTH_SIDES (returned normal follows the same convention as for raycasts). + * Raycasts against heightfields now correctly return multiple hits when PxHitFlag::eMESH_MULTIPLE flag is used. + * PxSweepHit.faceIndex was computed incorrectly for sweep tests initially overlapping convex objects. The face index is now set to 0xffffffff in these cases. + * Convex vs convex sweeps in PxGeometryQuery::sweep() do now correctly return the face index of the convex mesh that gets passed in as parameter geom1 (and not the one from geom0). + * PxMeshQuery::sweep now supports PxHitFlag::eMESH_ANY. + * Deprecated definition PxSceneQueryHit has been removed. Please use PxQueryHit instead. + * PxGeometryQuery::computePenetration with convex geometries. + * On Android platforms, the eDYNAMIC_AABB_TREE pruning structure could pass already released objects into the scene query filter callback. + + + + +## Cooking + +* Added: + + * PxTriangleMeshCookingResult added, cookTriangleMesh now does return additional PxTriangleMeshCookingResult. Please see the manual for more information. + * New convex hull generator added. It is now possible to switch between a new quickhull implementation and the legacy inflation based hull. Quickhull is the default algorithm. + * Convex hulls can now be directly inserted in PxPhysics as triangle meshes and height fields. + * A separate convex hull validation function has been added, it is now possible to create hulls without validation. + * Convex hull generator vertex limit has two different algorithms - plane shifting and OBB slicing. + * PxConvexFlag::eFAST_INERTIA_COMPUTATION added. When enabled, the inertia tensor is computed faster but with less precision. + * PxConvexFlag::eGPU_COMPATIBLE added. When enabled convex hulls are created with vertex limit set to 64 and vertex limit per face is 32. + * PxConvexFlag::eSHIFT_VERTICES added. When enabled input points are shifted to be around origin to improve computation stability. + * PxCookingParams::gaussMapLimit has been added. The limit can now be fully user-defined. Please refer to the migration guide and best practices sections of the manual. + +* Changed: + + * The performance of convex creation from polygons has been improved. + +* Deprecated: + + * The PxPlatform enum and the PxGetGaussMapVertexLimitForPlatform function have been deprecated. + +* Removed: + + * The deprecated flags PxMeshPreprocessingFlag::eREMOVE_UNREFERENCED_VERTICES and ::eREMOVE_DUPLICATED_TRIANGLES have been removed. Meshes get cleaned up by default unless PxMeshPreprocessingFlag::eDISABLE_CLEAN_MESH is set. + +* Fixed: + + * Mesh cooking was sometimes crashing for meshes with less than 4 triangles. This has been fixed. + * Cooking convex mesh from a flat input mesh produced incorrect large mesh. + + + +## Extensions + +* Added: + + * PxRaycastCCD has been added, to improve the visibility of the raycast-based CCD solution, which was previously only available in the Sample framework. This is a simpler and potentially cheaper alternative to the SDK's built-in continuous collision detection algorithm. + * PxFindFaceIndex has been added. The function computes the closest polygon on a convex mesh from a given hit point and direction. + +* Changed: + + * Memory churn of PxDefaultMemoryOutputStream has been reduced. + * The signatures for the PxComputeMeshPenetration and PxComputeHeightFieldPenetration functions have changed. + + + +## Profiling + +* Changed: + + * Profiling information is now available only in debug, checked and profile configuration. + * PxProfileZoneManager::createProfileZoneManager now takes PxAllocatorCallback as input parameter instead of PxFoundation. + + + +## Physx Visual Debugger + +* PhysXVisualDebuggerSDK, PvdRuntime projects replaced with PxPvdSDK. +* PxPvdSceneClient::drawPoints now takes physx::pvdsdk::PvdDebugPoint as input parameter instead of PxDebugPoint. drawLines, drawTriangles, drawText and so on. +* The SDK's Debug visualization data is not sent to PVD anymore in ePROFILE mode. +* PxPvdSceneFlag::eTRANSMIT_CONTACTS (instead of PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS) was sometimes incorrectly used to control the transmission of constraint-related data. This has been fixed. In addition, the PxPvdSceneFlag flags are now consistently ignored when PxPvdInstrumentationFlag::eDEBUG is not set. + + +## Aggregates + + +## Snippets + +* Snippet profile zone has been removed. + + +# v3.3.4 +October 2015 + +## Supported Platforms + +## Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android ARM & x86 (version 2.2 or later required for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) +* Microsoft Windows RT (formerly known as Windows on ARM) (SDK only, no samples yet) +* Microsoft XBox One (SDK only, no samples) +* Microsoft XBox 360 +* Nintendo Wii U +* Sony Playstation 3 +* Sony Playstation 4 (SDK only, no samples) +* Sony Playstation Vita + +## Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2012, 2013 and 2015 +* Xcode 6.3 + + +## Changes and Resolved Issues + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + +## General + +* Added support for Microsoft Visual Studio 2015 for Windows builds. Note that the GPU features are not currently supported with Visual Studio 2015. +* Removed support for Microsoft Visual Studio 2010 +* Added support for Android platform API Level 16 and removed support for platform API Level 8 and 9. +* Fixed: + + * Fixed a bug in aggregates that led to a crash when rigid bodies are added to an aggregate after removing all rigid bodies from an aggregate. This only occurred with aggregates that were added to the scene and with rigid bodies that had shapes attached. + + + +## Rigid Bodies + +* Fixed: + + * Creating a PxConstraint or using PxConstraint::setActors() could cause a crash in situations where one of the two newly connected actors was part of a previously simulated graph of connected constraints (with some of them having projection enabled, i.e., PxConstraintFlag::ePROJECT_TO_ACTOR0 or ::ePROJECT_TO_ACTOR1 set). + * PxD6Joint::getTwist(), getSwingY(), getSwingZ() returned incorrect angle values when the corresponding components of the quaternion were negative + * The thickness of a heightfield was incorrectly applied when the heightfield transform had a non-identity quaternion. + * PxD6Joint angular projection now functions correctly when there is one free axis and it is not the twist axis. + * The bounding box of a shape was not always properly updated when the contact offset changed. + * Fixed an edge case bug in PCM contact gen that could result in a QNAN reported as the contact point. + * Fixed an uninitialized variable bug in the GJK algorithm resulting in uninitialized closest points reported. + * Fixed an edge case in which the constraint solver could access invalid memory in constraint partitioning. + * Fixed a bug in capsule vs heightfield contact generation that could produce incorrect penetration depths. + * Fixed a bug in Unified MTD code path which transformed the normal twice for the polygon index calculation. + * Fixed a crash in height fields when a capsule collided with an edge whose shared triangles had a hole material. + + + +## Serialization + +* Fixed: + + * PxTriangleMesh instances with adjacency information were not correctly initialized when created with cooking.createTriangleMesh. This caused a crash when converting the binary serialized triangle mesh data. + + + +## Scene Queries + +* Fixed: + + * Sweeps against scaled meshes. + + + +## Cooking + +* Fixed: + + * Mesh cooking was sometimes crashing for meshes with less than 4 triangles. This has been fixed. + + + + +# v3.3.3 +January 2015 + +## Supported Platforms + +## Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android ARM & x86 (version 2.2 or later required for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) +* Microsoft Windows RT (formerly known as Windows on ARM) (SDK only, no samples yet) +* Microsoft XBox One (SDK only, no samples) +* Microsoft XBox 360 +* Nintendo Wii U +* Sony Playstation 3 +* Sony Playstation 4 (SDK only, no samples) +* Sony Playstation Vita + +## Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2010, 2012 and 2013 +* Xcode 6.2 + + +## Known Issues + + +* The combination of releasing an actor and reassigning the actors of any affected joint so that the joint no longer references the released actor will lead to a crash if these operations are performed as buffered calls ie after simulate but before fetchResults. + + +## Changes and Resolved Issues + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + +## General + +* Added support for Microsoft Visual Studio 2013 and removed support for Microsoft Visual Studio 2008. +* Where applicable, mutexes on Unix flavored platforms now inherit priority to avoid priority inversion. This is a default behavior of Windows mutexes. +* Added arm64 support for the iOS version of the PhysX SDK. +* Removed samples from the iOS version of the PhysX SDK. +* Fixed: + + * x64 samples running on Windows 8. + * Concurrent calls to PxPhysics::(un)registerDeletionListener() and PxPhysics::(un)registerDeletionListenerObjects() were not safe. + * PxGeometryQuery::pointDistance() could sometimes read uninitialized memory. This has been fixed. + * The SDK will not crash anymore if an object is involved in more than 65535 interactions. Instead, it will emit an error message and the additional interactions will be ignored. + * The PxPhysics::getMaterials() function did not work with a non-zero 'startIndex' parameter. This has been fixed. + * The following static Android libs are now packed into a single library called PhysX3: LowLevel, LowLevelCloth, PhysX3, PhysXProfileSDK, PhysXVisualDebuggerSDK, PvdRuntime, PxTask, SceneQuery and SimulationController. This fixes cyclic dependencies between these libraries. + * FSqrt(0), V4Sqrt(0), V4Length(0) and V3Length(0) will return 0 instead of QNan in Android and iOS. + + + +## Rigid Bodies + +* Fixed: + + * The Prismatic joint limit now acts correctly when its frame is not the identity. + * Calling PxRigidDynamic::setGlobalPose() with the autowake parameter set to true could result in an assert when the rigid body got released and had the PxActorFlag::eDISABLE_SIMULATION flag set. + * Added errors on misuse of PxRegister[Unified]Heightfields() function, and documented it. + * PxConstraint has a eDISABLE_PREPROCESSING flag and minResponseThreshold attribute to assist in stabilizing stiffness caused by infinite inertias or mass modification. + * Island manager performance in the presence of large numbers of kinematic actors has been improved. + * Using PxConstraint::setActors() or PxJoint::setActors() could cause a crash if the new actors resulted in the constraint/joint being removed from the scene. + * The functions PxRigidActor::setGlobalPose and PxShape::setLocalPose failed to update cached contact data internal to PhysX. This led to contacts being generated with transforms that were no longer valid. Similarly, contacts could be missed due to transforms being invalid. This defect affected the classes PxRigidStatic and PxRigidDynamic, though it was more immediately noticeable with the PxRigidStatic class. + * The sphere-vs-mesh contact generation code has been improved. It could previously generate wrong contacts. This has been fixed. + * The capsule-vs-convex contact generation had a bug that could lead to rare invalid contacts. This has been fixed. + * The mesh contact generation had a bug on PS3 that could lead to invalid contacts. This has been fixed. + * The PxRigidBody::clearForce() and PxRigidBody::clearTorque() were not properly decoupled - they both cleared the force and the torque. This has been fixed. + * Repeatedly calling PxRigidActor::attachShape and PxRigidActor::detachShape in between calls to simulate resulted in a memory leak. This has been fixed. + +* Added: + + * Enabling CCD on kinematic actors is now disallowed. When the kinematic flags are raised on a CCD-enabled actor, CCD is automatically disabled. + + + +## Particles + +* Fixed: + + * Consistency between GPU and CPU particles has been improved in the case of a spatial date structure overflow. The positions and velocities of particles that have the PxParticleFlag::eSPATIAL_DATA_STRUCTURE_OVERFLOW set are now updated also for CPU particles. + * Fixed potential deadlocks from occurring in the GPU particle kernels running on GM204 and above GPUs. + * Fixed fluid simulation crash on Titan X. + + + +## Cloth + +* Fixed: + + * A bug related to hitting the sphere or plane limit while world collision is enabled has been fixed. + * PxCloth::getParticleAccelerations() implementation was fixed for GPU cloth. + + + +## Character controller + +* Fixed: + + * Character controllers cannot stand on dynamic triggers anymore. + +* Added: + + * added lockingEnabled parameter to PxCreateControllerManager(), to support thread-safe release of objects while the character controller's move() routine is executing. + + + +## Scene Queries + +* Fixed: + + * Raycasts against triangle meshes with large scales potentially failed to register a hit. + * Overlaps against height field meshes with the flag eNO_BOUNDARY_EDGES potentially failed to register a hit. + * Sweeps using shapes modelled around a space significantly offset from their geometric center could fail to register a hit. + + + +## Vehicles + +* Fixed: + + * Sticky tire friction was unreliable with more than one substep but is now fixed. This defect led to vehicles sliding down slopes where the sticky friction should have held firm. + * An error in the jounce speed calculation that led to lift force at high forward speeds has been fixed. This defect led to instabilities at high speed. + * Improved documentation for PxVehicleSuspsensionData::mSprungMass. + + + +## Cooking + +* Fixed: + + * Convex meshes generated from PhysX 3.2 were not able to load inside PhysX 3.3. + +# v3.3.2 +September 2014 + +## Supported Platforms + +### Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android ARM & x86 (version 2.2 or later required for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) +* Microsoft Windows RT (formerly known as Windows on ARM) (SDK only, no samples yet) +* Microsoft XBox One (SDK only, no samples) +* Microsoft XBox 360 +* Nintendo Wii U +* Sony Playstation 3 +* Sony Playstation 4 (SDK only, no samples) +* Sony Playstation Vita + +### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010, 2012 (Windows RT only) +* Xcode 4.6|5.0|5.0.1 + + +## Known Issues + + +* The combination of releasing an actor and reassigning the actors of any affected joint so that the joint no longer references the released actor will lead to a crash if these operations are performed as buffered calls ie after simulate but before fetchResults. + + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + +### General + +#### Added: + +* The PhysXCommon/64.dll, nvcuda.dll and PhysXUpdateLoader/64.dll are loaded and checked for the NVIDIA Corporation digital signature. The signature is expected on all NVIDIA Corporation provided dlls. The application will exit if the signature check fails. +* Added the PxDefaultBufferedProfiler extension for simplified SDK profile events extraction. +* PxSceneDesc::sanityBounds allows a bounding box to be set for validating the position coordinates of inserted or updated rigid actors and articulations. +* Linux: Now supports GPU PhysX. +* Added set/getRunProfiled() for PxDefaultCpuDispatcher to control profiling at task level. +* Android: Support for x86 based devices was added. +* PxProfileEventHandler::durationToNanoseconds() added. Translates event duration in timestamp (cycles) into nanoseconds. +* Added SnippetProfileZone to show how to retrieve profiling information. +* Added SnippetCustomJoint to better illustrate custom joint implementation, and removed SnippetExtension. +* Added SnippetStepper to demonstrate kinematic updates while substepping with tasks. + +#### Fixed: + +* PxTask::runProfiled() now takes threadId as a parameter. +* The static pruner now issues a performance warning in debug and checked configurations when a tree rebuild occurs and the tree is not empty. +* PxSceneDesc::staticStructure now defaults to PxPruningStructure::eDYNAMIC_AABB_TREE. +* Linux: Switched to shared libraries. +* Profile zone event names changed to match function calls. +* Overlapping read/write errors will now issue a PxErrorCode::eINVALID_OPERATION rather than PxErrorCode::eDEBUG_INFO. +* Improved SnippetToleranceScale to better demonstrate the intended use case. +* Increased 126 characters limit for warnings on unix platforms, 1k limit on all platforms. +* PhysXCommon dll load within PhysX dll now respects dll name. Please see the manual's PhysXCommon DLL load section. +* Significant revision of the user's guide. Both structure and most content have been modified. +* Fixed search function of user's guide. +* Foundation math classes now have in-place arithmetic operators (+= etc). +* PxScene::checkResults() no longer counts as a read API method. Hence it is now possible to call this method in blocking mode without causing all writes to block until it returns. + +#### Deprecated: + +* Indexing operators taking signed integers in PxVec3, PxVec4, PxMat33, PxMat44, PxStrideIterator have been deprecated. + + + +### Rigid Bodies + +#### Fixed: + +* A minor bug in contact generation between capsules and triangle meshes has been fixed, reducing the amount of tunneling cases when CCD is not used. +* Discrete contact reports are no longer produced for pairs without PxPairFlag::eDETECT_DISCRETE_CONTACT raised in the filter shader. Previously, discrete contact generation would always have been performed regardless of the presence of the PxPairFlag::eDETECT_DISCRETE_CONTACT flag. This change potentially improves performance when using specific shapes for CCD-only collision, which would have previously generated discrtete contacts and then ignored them in the solver. +* Trigger reports are no longer produced for pairs without PxPairFlag::eDETECT_DISCRETE_CONTACT raised in the filter shader. PxPairFlag::eTRIGGER_DEFAULT has been modified to include the PxPairFlag::eDETECT_DISCRETE_CONTACT flag. +* An incorrect PX_DEPRECATED annotation on the default constructor for PxD6JointDrive has been removed. +* PxRigidDynamic::getKinematicTarget() returned a wrong transform if the actor center of mass pose was different from the actor global pose. +* Switching a PxRigidDynamic from dynamic to kinematic did not properly suppress existing pairs which turned into kinematic-kinematic or kinematic-static pairs. +* PxRigidDynamic::isSleeping() did not return the correct value on the frame the object got inserted if PxScene::addActors() was used and if the object was awake. +* PxSceneFlag::eDISABLE_CONTACT_CACHE now correctly works on PS3/SPU. +* If an object was added to the scene, put asleep and had overlap with another sleeping object then contact points for that pair might not have been reported once the object woke up. +* Potential crash when calling PxScene::resetFiltering() multiple times for the same actor while the simulation was running has been fixed. +* Potential crash when using PxScene::resetFiltering() with shapes that were just added while the simulation was running has been fixed. +* A crash in MBP when deleting an object that just went out of broad-phase bounds has been fixed. +* A new drive mode has been added to drive articulation joints using rotation vectors. +* In contact and trigger reports, the shape references in PxTriggerPair and PxContactPair might not have been properly marked as removed shapes if the removal took place while the simulation was running. +* PxPairFlag::eSOLVE_CONTACT is now properly observed if the flag is not set on a contacting pair. A consequence of this fix is that sleeping actors will no longer be woken up due to contact or lost contact with awake actors if PxPairFlag::eSOLVE_CONTACT is not set for the pair. This also affects kinematic-kinematic pairs if one kinematic of the pair moves out of contact with the other. Behaviour is unaffected for any pair that has PxPairFlag::eSOLVE_CONTACT set. +* A memory leak with buffered shape and actor removal has been fixed. The memory leak occurred when the release of an actor's shapes was followed by the release of the actor, all in-between simulate() and fetchResults(). +* A bug was fixed which caused incorrect force reports to sometimes be reported. +* Fixed a bug where incorrect normals were reported when using PCM contact gen. +* Fixed some issues with scaled convex hulls in the PCM contact gen code path. +* The accuracy of capsule collision code has been improved. +* An isValid() method has been added to constraints, that is satisfied if and only if at least one actor is a dynamic body or articulation link +* A check has been added to prevent constraint construction or modification that would leave the constraint invalid. +* In checked builds the PxScene methods addActor(), addActors(), addAggregate() and addCollection() will warn and return if an invalid constraint would be added to the scene + +#### Deprecated: + +* The following flags have been renamed and deprecated because the name did not properly reflect the root cause. + +* PxContactPairHeaderFlag + + * eDELETED_ACTOR_0 (use eREMOVED_ACTOR_0 instead) + * eDELETED_ACTOR_1 (use eREMOVED_ACTOR_1 instead) + +* PxContactPairFlag + + * eDELETED_SHAPE_0 (use eREMOVED_SHAPE_0 instead) + * eDELETED_SHAPE_1 (use eREMOVED_SHAPE_1 instead) + +* PxTriggerPairFlag + + * eDELETED_SHAPE_TRIGGER (use eREMOVED_SHAPE_TRIGGER instead) + * eDELETED_SHAPE_OTHER (use eREMOVED_SHAPE_OTHER instead) + + + + + +### Vehicles + +#### Added: + +* In profile config the functions PxVehicleUpdates, PxVehiclePostUpdates and PxVehicleSuspensionRaycasts are now tracked with profile events (provided that a PxProfileZoneManager instance was passed to PxCreatePhysics). These profile events can be viewed in profile view in pvd, where the names of the profile events match the names of the tracked vehicle functions. + +#### Fixed: + +* In checked config PxVehicleDriveTank::allocate enforces the rule that only tanks with even numbers of wheels are legal and warns when this rule is broken. +* In checked config PxVehicleDrive4W::allocate enforces the rule that only vehicles with 4 wheels or more are legal and warns when this rule is broken. +* PxWheelQueryResult::localPose was incorrectly only set when the vehicle had a corresponding PxShape, as described by PxVehicleWheelsSimData::setWheelShapeMapping. The localPose is now properly set independent of the mapping between wheel and shape. +* Wheels resting on moving actors now properly observe the relative speed of the two actors when their relative speed is small. This fixes a bug where at small relative speeds the velocity of the other actor was assumed to be zero. +* Repx serialization failed to serialize PxVehicleWheelsSimData::setMinLongSlipDenominator, PxVehicleWheelsSimData::setSubStepCount, PxVehicleWheelsSimData::disableWheel, PxVehicleWheelsSimData::enableWheel and the number of entries in the engine torque curve. These have now been fixed. +* PxVehicleConcreteType used for vehicle serialization is now in the public API and has been moved to PxVehicleSDK.h. +* Very small longitudinal and lateral slip angles could lead to numerical instabilities in some circumstances. A threshold has been introduced to reject very small slip angles by setting them to zero when they are below the threshold. +* Vehicles now account for rigid bodies that have been given a zero inertia component in order to lock rotation around the corresponding axis. +* Fixed a bug where the sticky wheel constraints sometimes didn't function correctly. + + + +### Cloth + +#### Fixed: + +* The version number written to the fabric stream changed from PX_PHYSICS_VERSION to 1. A fabric can be created from streams written with version 3.3.0 and later until the stream format changes. Previously, the version of the producer and the consumer of the stream needed to match. +* GPU cloth friction against convexes has been fixed. +* A crash resulting from deleting a shape in proximity of a cloth with scene collision enabled has been fixed. + + + +### Scene Queries + +#### Fixed: + +* PxMeshQuery::sweep now respects PxHitFlag::eMESH_BOTH_SIDES, and supports double-sided input triangles. +* PxRigidBodyExt::linearSweepSingle and PxRigidBodyExt::linearSweepMultiple now correctly use query filter data instead of simulation filter data if filter data is not provided. +* The spec for raycasts whose origin is located inside a solid object (sphere, box, capsule, convex) has changed back to what it was in 3.3.0. It was accidentally changed in 3.3.1. See the manual for details. +* Convex sweeps against heightfields worked only when the heightfield had the identity transform. This has now been fixed to support arbitrary transforms again. + + + +### Cooking + +#### Added: + +* Using PxMeshPreprocessingFlag::eFORCE_32BIT_INDICES will always cook meshes with 32-bit triangle indices. + +#### Fixed: + +* Convex hull cooking fix. Some input points could be ignored during cooking, fixed. +* Inserted triangle meshes now respect 16 bit indices flag. + + + + + +### Geometry + +#### Fixed: + +* PxHeightFieldDesc::thickness is now limited to [-PX_MAX_BOUNDS_EXTENTS, PX_MAX_BOUNDS_EXTENTS range]. (Previously unbounded). + + + +### Particles + +#### Fixed: + +* Setting PxParticleReadDataFlag::eREST_OFFSET_BUFFER on a PxParticleBase instance that was not created with the per particle rest offset option (see PxPhysics::createParticleSystem, PxPhysics::createParticleFluid and PxParticleBaseFlag::ePER_PARTICLE_REST_OFFSET) is not supported. The unsupported configuration may have resulted in crashes. The SDK now rejects this configuration on calling PxParticleBase::setParticleBaseFlag and issues an appropriate warning to the error stream. +* Performance improvements on Kepler and above GPUs running SPH. +* In rare cases particle systems could access released memory when all interactions with a rigid body shape were lost. + + + +### Serialization + +#### Fixed: + +* PxBinaryConverter::convert potentially failed in checked mode with allocators that don't set 0xcd pattern. This has been fixed now. + + + + + + + + + + +# v3.3.1 +December 2013 + +## Supported Platforms + +### Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android (version 2.2 or later for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) +* Microsoft Windows RT (formerly known as Windows on ARM) (SDK only, no samples yet) +* Microsoft XBox One +* Microsoft XBox 360 +* Nintendo Wii U +* Sony Playstation 3 +* Sony Playstation 4 (SDK only, no samples) +* Sony Playstation Vita + +### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010, 2012 (Windows RT only) +* Xcode 4.6|5.0|5.0.1 + + +## Known Issues + + + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + +### General + +#### Added: + +* The friction model can now be changed after scene instantiation with PxScene::setFrictionType. The friction model can also be queried with PxScene::getFrictionType. + +#### Changed: + +* PxDefaultSimulationFilterShader now supports particles and cloth as well. +* PxSimulationFilterCallback: the provided actor and shape pointers are now defined as const. Note: this is no behavior change, it was never allowed to write to those objects from within the callback. +* The PxTriangleMeshFlag::eHAS_16BIT_TRIANGLE_INDICES and PxTriangleMeshFlag::eHAS_ADJACENCY_INFO enums have been deprecated. Please use PxTriangleMeshFlag::e16_BIT_INDICES and PxTriangleMeshFlag::eADJACENCY_INFO instead. +* Removed following functions from the API for platforms which do not support CUDA: PxGetSuggestedCudaDeviceOrdinal, PxCreateCudaContextManager, PxLoadPhysxGPUModule. + +#### Fixed: + +* Fixed concurrency issue on windows. Calling PxScene::simulate on multiple scenes concurrently may have caused a deadlock. This only happened if the scenes shared a single PxCpuDispatcher and the dispatcher was configured to use one worker thread only. + + + +### Rigid Bodies + +#### Added: + +* The projection direction for constraints can now be specified through the flags PxConstraintFlag::ePROJECT_TO_ACTOR0, ::ePROJECT_TO_ACTOR1. +* A parameter has been added to PxRigidBodyExt::updateMassAndInertia() and ::setMassAndUpdateInertia() to optionally take non-simulation shapes into account for computing the mass and the inertia tensor of a rigid body. +* It is now possible to retrieve additional information in contact reports. See the API documentation of PxContactPairHeader.extraDataStream, PxPairFlag::ePRE_SOLVER_VELOCITY, ::ePOST_SOLVER_VELOCITY, ::eCONTACT_EVENT_POSE for details. +* The contact report system has been extended to support multiple notification events if the same two objects collide multiple times in multipass CCD scenarios. See the API documentation of PxPairFlag::eNOTIFY_TOUCH_CCD for details. + + +#### Changed: + +* If touching objects were added to the scene asleep and one of them got woken up, then all contact pairs of the touching objects which contained a static rigid body were resolved with a delay of one simulation step. Now these pairs get resolved without delay in the next simulation step. +* If touching objects were added to the scene asleep, eNOTIFY_TOUCH_FOUND contact reports were sent out for pairs of dynamic rigid bodies if requested. These reports will not be sent at the end of the simulation step after insertion anymore but rather at the end of the simulation step after the touching objects have been woken up. +* Rigid bodies now permit zeroes in passed to setMass and setMassSpaceInertiaTensor. Zeroes are interpreted to indicate infinite mass or infinite moment of inertia around a given principal axis of inertia. Previously, zeroes were illegal values to these methods. Note that zeroes are still illegal for instances of PxArticulationLink. + + +#### Fixed: + +* Reading back the kinematic target in the PxSimulationEventCallback::onContact() callback through PxRigidDynamic::getKinematicTarget() will now work. +* Contact reports are no longer generated for contact pairs involving two sleeping kinematic actors or for pairs involving a sleeping kinematic actor in contact with a static actor. This fixes a bug that was introduced in 3.3.0. +* No PxPairFlag::eNOTIFY_TOUCH_LOST event was sent in contact reports if a pair of sleeping rigid bodies got woken up after setting the pose on one of them (with autowake parameter set to false) and if the bounding boxes of the two objects still overlapped. +* No PxPairFlag::eNOTIFY_TOUCH_PERSISTS event was sent in contact reports during the first simulation step after a pair of sleeping rigid bodies got woken up. +* The inertia tensor computation for convex meshes has been adjusted to be more stable in certain cases where floating point precision issues arise. Furthermore, a fallback routine has been added to use an approximation if the diagonalized inertia tensor still ends up with invalid entries. +* PxRigidBody::clearForce() and ::clearTorque() did not properly clear the respective properties if used with force mode PxForceMode::eIMPULES or PxForceMode::eVELOCITY_CHANGE. +* Setting PxSceneFlag::eENABLE_KINEMATIC_STATIC_PAIRS also enabled PxSceneFlag::eENABLE_KINEMATIC_PAIRS internally and vice versa. +* Missing validation checks for some joint set() methods have been added. Similarly to other API calls, when validation fails in the checked build PhysX will report an error and return without updating the joint. +* Switching a kinematic rigid body to dynamic could lead to a crash in a subsequent simulation step, if the kinematic was moved and connected to another kinematic through a breakable PxConstraint/PxJoint. +* Deleting a breakable PxConstraint/PxJoint while the simulation is running could lead to a crash if the PxConstraint/PxJoint broke in the same simulation step. +* A bug in the PxScene::addBroadPhaseRegion() function, that could lead to a crash when using 'populateRegion=true', has been fixed. + + + +### Particles + +#### Added: + +* Added triangle mesh cache statistics for GPU particles. Triangle mesh cache statistics are also captured by PVD as part of simulation statistics. +* Added new option to query approximate particle velocities relative to colliding rigid actors. This can be used for debris rotation on moving objects. Enable with PxParticleReadDataFlag::eCOLLISION_VELOCITY_BUFFER and read from PxParticleReadData::collisionVelocityBuffer. + +#### Fixed: + +* Fixed a bug which might lead to GPU particle pipeline failures on low end GPUs. +* Enabled warning when a spatial data structure overflow occurred for GPU particles (see the guide for more information). + + + +### Cloth + +#### Fixed: + +* PxFilterFlag::eSUPPRESS was ignored for collision pairs that involved a PxCloth object. This does work now, however, please note that PxFilterFlag::eSUPPRESS is treated as PxFilterFlag::eKILL for pairs with a PxCloth object. + + + +### Serialization + +#### Added: + +* Support for binary compatibility between different sdk releases and patches has been added (PX_BINARY_SERIAL_VERSION). The current sdk version can load binary data of the older sdk versions listed in the documentation of PX_BINARY_SERIAL_VERSION. +* SnippetLoadCollection has been added. It illustrates loading repx or binary serialized collections and instantiating the objects in a scene. It only compiles and runs on authoring platforms (windows, osx and linux). +* SnippetConvert has been added. It illustrates how to convert PhysX 3 serialized binary files from one platform to another. It only compiles and runs on authoring platforms (windows, osx and linux). + +#### Deprecated: + +* Method PxCollection::addRequire is deprecated, use PxCollection::add and PxCollection::contains instead. +* Method PxCollection::createBinaryConverter(PxSerializationRegistry&) is deprecated, use PxCollection::createBinaryConverter() instead. + + + +### Character controller + +#### Added: + +* PxControllerManager::setPreventVerticalSlidingAgainstCeiling() has been added, to control the behaviour of characters against ceilings. + + + + +### Vehicles + +#### Added: + +* Vehicles may now be updated concurrently through the addition of a new function PxVehiclePostUpdates and passing a PxVehicleConcurrentUpdateData array to PxVehicleupdates. +* A new snippet SnippetVehicleMultiThreading has been added to show the operation of concurrent vehicle updates. +* PxVehicleDriveTankControl and PxVehicleDriveTankControlModel now have improved doxy comments. +* A new function PxVehicleUpdateCMassLocalPose has been added to help update a vehicle after the center of mass pose of the vehicle's actor has been modified. +* PxWheelQueryResult now records the local pose of the wheel. + +#### Changed: + +* PxVehcicleDrive4W::setup now tests that at least 4 wheels are specified and returns wtih an error message if numWheels < 4. It is only possible to create a PxVehicleDrive4W instance with less than 4 active wheels by disabling wheels after instantiating a 4-wheeled car. +* In debug and checked build configurations PxVehicleComputeSprungMasses now reports whether the sprung masses were successfully computed. Warnings are passed to the error stream in checked configuration if the function does not complete successfully. Apart from error checking the operation of the function is unchanged. + +#### Fixed: + +* The doxy comment describing the default setting for PxVehicleWheelsSimData::setWheelShapeMapping was incorrect. This now correctly documents the default mapping as PxVehicleWheelsSimData::setWheelShapeMapping(i,i). +* Suspensions raycasts that start inside geometry are ignored for all geometry types. Prior to this release this was true for all geometry types except for heightfields and triangle meshes. This inconsistency has now been fixed so that all geometry types obey the rule that suspension raycasts starting inside geometry are neglected. + + + +### Scene queries + +#### Added: + +* Added eMTD flag. If an initial overlap is detected, this flag triggers the sweep to compute the MTD (Minimum Translation Direction), which can be used to de-penetrate the query shape from the shape with which an initial overlap was found. In this case, the distance reported will be negative. This negative distance can be used to scale the reported normal to generate the translation vector required to de-penetrate the query shape. +* Added PxTriangle::pointFromUV. + +#### Fixed: + +* A rare ray-capsule intersection bug has been fixed, when the capsule's height is close to zero. +* A capsule-capsule distance bug has been fixed, when the tested capsules are large and parallel. +* Raycasts against heightfields now correctly return triangle UVs. + +#### Changed: + +* PxBatchQuery::raycast, overlap and sweep previously had an incorrect const modifier indicating that these methods were safe to call from multiple threads simultaneously. This has been removed. Multiple batch queries can still be executed (via PxBatchQuery::execute()) in parallel. + + + + +### Cooking + +#### Added: + +* PxCookingParams::meshSizePerformanceTradeOff parameter can be used to make the mesh smaller at the expense of reduced simulation and scene query performance (or the other way around). +* PxCookingParams::meshCookingHint parameter can be used to specify mesh hierarchy construction preference (cooking speed or simulation speed). +* PxMeshPreprocessingFlag::eDISABLE_CLEAN_MESH disables mesh clean process. Vertices duplicities are not searched, huge triangles test is not done. Vertices welding is not done. Does speed up the cooking. +* PxMeshPreprocessingFlag::eDISABLE_ACTIVE_EDGES_PRECOMPUTE disables vertex edge precomputation. Makes cooking faster but slow up contact generation. +* PxPhysicsInsertionCallback adds the support for inserting cooked triangle mesh or height field directly into PxPhysics without the stream serialization. +* PxCooking::createTriangleMesh creates triangle mesh and inserts it to PxPhysics without using the stream serialization. +* PxCooking::createHeightField creates height field and inserts it to PxPhysics without using the stream serialization. +* PxCooking::validateTriangleMesh validates mesh in separate function before it can be cooked without the mesh cleaning. +* PxConvexFlag::eCHECK_ZERO_AREA_TRIANGLES checks and removes almost zero-area triangles during the computation of the convex hull. +* PxCookingParams::areaTestEpsilon triangle area size was added. This epsilon is used for the zero-area test in the computation of the convex hull. + +#### Changed: + +* PxCooking::computeHullPolygons does now return also vertices used by the polygons. Redundant vertices are removed. +* PxCooking::cookConvexMesh now returns a PxConvexMeshCookingResult::Enum with additional error information. + + + +### Aggregates + +#### Added: + +* PxSceneLimits has a new member variable maxNbAggregates. Setting this value to a good approximation of the peak number of aggregates will avoid the need for internal run-time allocations that can occur when aggregates are added to the scene. + +#### Fixed: + +* PxScene::removeActor will auotmatically remove that actor from all PxAggregate instances that contain the removed actor. Likewise, PxScene::removeArticulation will automatically remove all articulation links from all relevant aggregates. This fix upholds the rule that all actors of an aggregate must be in same scene. +* The condition of an internal assert that triggered after calling PxScene::addAggregate has been corrected. This assert triggered when an aggregate was added to the scene after removal of all aggregates from the scene. The operation of the function PxScene::addAggregate is unchanged apart from the asserted condtition. + + + +### Samples + +#### Changed: + +* Starting with Release 302 drivers, application developers can direct the Optimus driver at runtime to use the High Performance Graphics to render any application - even those applications for which there is no existing application profile. The samples now make use of this feature to enable High Performance Graphics by default. + + + + + + + + +# v3.3 +September 2013 + +## Release Highlights + + +* Added PhysXDevice/64.dll to the PC packages. See the Windows readme for details. +* Added support for the NVIDIA Kepler GPU architecture. +* Added support for the Nintendo Wii U console. +* Added support for Windows 8 Modern UI applications (ARM and x86). +* Ported our SIMD library to the ARM NEON architecture. +* Multi Box Pruning (MBP) is offered as an alternative broad phase algorithm to Sweep And Prune (SAP). MBP shows improved performance when most objects are moving or when inserting large numbers of objects. SAP can be faster in scenarios with few moving (many sleeping) objects. +* Significant performance and stability optimizations for rigid body solver. +* New function to compute the minimum translational distance and direction to separate two overlapping geometry objects. +* New 'PCM' contact generation mode which is often faster and more robust than the still available legacy path. +* Improved performance of scene queries and contact reports. +* Improved behavior and performance of Continuous Collision Detection (CCD). +* Reduced memory footprint of rigid body classes. +* Added support for sharing shapes among rigid bodies. +* Significantly improved cloth behavior and GPU performance. +* Added support for cloth colliding against itself, other cloth instances, and scene geometry. +* Improved useability of binary and xml serialization. +* Memory can be saved for objects that do not participate in the simulation and are used for scene queries only. For details see the new flag PxActorFlag::eDISABLE_SIMULATION. + + + +## Supported Platforms + +### Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android (version 2.2 or later for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) +* Microsoft Windows RT (formerly known as Windows on ARM) (SDK only, no samples yet) +* Microsoft XBox One +* Microsoft XBox 360 +* Nintendo Wii U +* Sony Playstation 3 +* Sony Playstation 4 (SDK only, no samples yet) +* Sony Playstation Vita + +### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010, 2012 (Windows RT/PS4/XboxOne only) +* Xcode 4.6 + + + +## Known Issues + + +* PxSimulationOrder::eSOLVE_COLLIDE feature is not implemented in this release. Calls to PxScene::solve() and PxScene::collide() will be ignored with a warning added to the error stream +* Reading back the kinematic target through PxRigidDynamic::getKinematicTarget() in the PxSimulationEventCallback::onContact() callback will fail. +* Cloth self-collision without rest position is not supported on GPUs with SM capability lower than 2.0. + + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + +### General + +#### Added: + +* PxScene::setLimits: Hint to preallocate capacities of various data structures. See PxSceneLimits. +* Scalar constructors PxQuat(r), PxMat33(r), PxMat33(r). +* identity constructors for PxMat33, PxMat44, PxQuat, PxTransform - e.g. PxTransform(PxIdentity). +* zero constructors for PxMat33, PxMat44, PxVec3 - e.g. PxMat33(PxZero). +* PxTransform(x, y, z) constructor was added as a shortcut for PxTransform(PxVec3(x,y,z)). +* The GPU code uses CUDA version 5.0 and supports Kepler GPUs (SM version 3.0 and 3.5). +* Helper method PxContactPair::bufferContacts() has been added to copy the contact pair data stream into a user buffer. +* PxGeometryQuery::computePenetration() has been added, to compute the Minimum Translational Distance between geometry objects. +* Ability for APEX and other PhysX extensions to change the PhysX Visual Indicator. +* Reporting allocation names can now be enabled or disabled (see PxFoundation::setReportAllocationNames). When enabled, some platforms allocate memory through 'malloc'. +* The scene origin can now be shifted to better support big world scenarios. See PxScene::shiftOrigin() for details. +* PxAssertHandler got extended with a boolean parameter to support ignoring specific asserts. See windows implementation of DefaultAssertHandler. +* Added new PxPairFlags - PxPairFlag::eSOLVE_CONTACT and PxPairFlag::eDETECT_DISCRETE_CONTACT. + +#### Removed: + +* The obsolete PxConvexFlag::eUSE_UNCOMPRESSED_NORMALS flag has been removed. +* The PxSceneFlag::eDISABLE_SSE was obsolete, and has now been removed. +* The obsolte PxPtrArray has been removed + +#### Changed: + +* Mesh BVH construction was significantly improved for meshes with a mix of large and small triangles. Mesh sizes are now slightly increased, but traversals are substantially faster. As a side effect, cooked mesh format has changed. This requires meshes to be recooked! +* The specification for valid PxBounds3 representations has changed. See the API documentation for details (especially the newly introduced PxBounds3::isValid() method). +* PxBounds3::transform(), ::scale() and ::fatten() have been split into a fast and a safe version to avoid unnecessary checks and improve stability for empty bounds respectively. +* PxBounds3::setInfinite() has been renamed to PxBounds3::setMaximal() to better fit the actual behavior. +* PxTask: PVD profile events for tasks are now only emitted in profile builds (all platforms). +* Platform mutex implementations now verify that lock/unlock come from correct thread in debug builds. +* PxWindowsDelayLoadHook.h has been moved from Include/foundation/windows to Include/common/windows. +* API instances of 'Num' as in 'maxNum' and 'getNum' have changed uniformly to 'Nb'. +* The following classes have been renamed: + + * PxSceneQueryHit to PxQueryHit + * PxSceneQueryFlags to PxHitFlags + * PxSceneQueryHitType to PxQueryHitType + * PxSceneQueryFilterData to PxQueryFilterData + * PxSceneQueryFilterCallback to PxQueryFilterCallback + * PxSceneQueryFilterFlags to PxQueryFlags + * PxSceneQueryCache to PxQueryCache + * PxCCTNonWalkableMode to PxControllerNonWalkableMode + * PxControllerFlags to PxControllerCollisionFlags + * PxCCTHit to PxControllerHit + * PxConstraintDominance to PxDominanceGroupPair + * PxActorTypeSelectionFlags to PxActorTypeFlags + * PxFindOverlapTriangleMeshUtil to PxMeshOverlapUtil + +* The previous names have been retained for compatibility but are deprecated. + +* PX_SLEEP_INTERVAL has been replaced with the new parameter PxSceneDesc::wakeCounterResetValue to specify the wake counter value to set when wakeUp() gets called on dynamic objects. +* PxClientBehaviorBit has been renamed PxClientBehaviorFlag, PxActorClientBehaviorBit has been renamed PxActorClientBehaviorFlag. Names of related functions have also changed. +* queryClient parameter in raycast(), sweep(), overlap() functions was moved inside of PxQueryFilterData struct. +* The PxObserver/PxObservable system has been replaced by the PxDeletionListener API. The supported object types have been extended from PxActor to all core objects inheriting from PxBase. Furthermore, two kinds of deletion events are now distinguished: user release and memory release. Please read the API documentation for details. +* Deprecated PxPairFlag::eRESOLVE_CONTACT. Use PxPairFlag::eDETECT_DISCRETE_CONTACT and PxPairFlag::eSOLVE_CONTACT instead. +* Number of materials per shape is now PxU16 instead of PxU32, contact material information also now returns PxU16. +* Maximum number of touching hits in batched queries is now PxU16 instead of PxU32. +* SweepEpsilonDistance has been replaced by meshContactMargin and marked as deprecated. Please read the API documentation for details. +* PxShape::resetFiltering() and PxParticleBase::resetFiltering() have been deprecated. Please use one of the new overloaded methods PxScene::resetFiltering() instead. +* The pxtask namespace has been removed and it's types have been added to the physx namespace with a Px* prefix +* The delay load hook PxDelayLoadHook::setPhysXInstance has been renamed to PxSetPhysXDelayLoadHook and PxDelayLoadHook::setPhysXCookingInstance has been renamed to PxSetPhysXCookingDelayLoadHook + +#### Fixed: + +* Calling Thread::setAffinityMask() before the thread has been started is now supported. +* PxDefaultSimulationFilterShader ignored the value of the second filter constant in the collision filtering equation and used the value of the first filter constant instead. + +#### Deprecated: + +* The PxScene::flush() method has been deprecated, please use PxScene::flushSimulation(). +* PxRigidDynamicFlag has been deprecated and replaced with PxRigidBodyFlag to allow flags to be shared between PxArticulationLink and PxRigidDynamic. +* PxTransform::createIdentity(), PxQuat::createIdentity(), PxMat33::createIdentity(), PxMat44::createIdentity(), PxMat33::createZero(), PxMat44::createZero() + + + +### Character controller + +#### Added: + +* The PxControllerBehaviorFlag::eCCT_USER_DEFINED_RIDE flag has been added. +* A new helper function PxController::resize() has been added to facilitate character controller resizing. +* A new runtime tessellation feature has been added that can help reducing FPU accuracy issues in the sweep tests. +* PxControllerFilterCallback has been added to make CCT-vs-CCT filtering more flexible. +* An overlap recovery module has been added. See PxControllerManager::setOverlapRecoveryModule +* PxObstacle notifications has been added to handle touched obstacles. +* PxObstacleContext::getObstacleByHandle has been added. +* The origin of character controllers and obstacles can now be shifted to stay in sync when the origin of the underlying PxScene is shifted. See PxControllerManager::shiftOrigin() for details. + +#### Changed: + +* The PxControllerManager is now tightly coupled to a PxScene which has to be provided on creation. See PxCreateControllerManager(). +* The PxObstacleContext instances of a PxControllerManager will now get released automatically when the manager is released. +* PxController::reportSceneChanged() has been renamed to PxController::invalidateCache(). +* PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT is not the default behavior anymore. +* PxCCTNonWalkableMode::eFORCE_SLIDING has been renamed to PxCCTNonWalkableMode::ePREVENT_CLIMBING_AND_FORCE_SLIDING. +* PxCCTInteractionMode has been renamed PxControllerInteractionMode +* PxCCTNonWalkableMode has been renamed PxControllerNonWalkableMode +* PxCCTHit has been renamed PxControllerHit +* Touched PxObstacle has been replaced by touched ObstacleHandle. +* PxControllerInteractionMode and PxControllerFilters::mActiveGroups have been removed. Please use the new PxControllerFilterCallback instead. + +#### Fixed: + +* Bugs with respect to deleting shapes from a touching actor have been fixed. +* Touched actor's scene is checked in CCT::move before rideOnTouchedObject is called to ensure that the touched shape is valid. +* Touched shape's scene query flag is checked in CCT::move before rideOnTouchedObject is called to ensure that the touched shape is valid. +* Touched shape's user CCT filtering is triggered in CCT::move before rideOnTouchedObject is called to ensure that the touched shape is valid. +* The PxControllerBehaviorCallback was not called when a PxUserControllerHitReport was not defined. +* It is not possible anymore to create a CCT whose contact offset is zero. The doc has always said a non-zero value was expected, but corresponding check was missing. +* Box & capsule controllers' resize function now properly take the up direction into account + + + +### CCD + +#### Added: + +* Introduced PxRigidBodyFlag::eENABLE_CCD_FRICTION to control whether friction is applied inside CCD on a given body. This is disabled by default. In general, disabling friction in CCD improves the behavior of high-speed collisions. +* Introduced PxSceneDesc::ccdMaxPasses field, which controls the maximum number of CCD passes. Each CCD pass will advance each object to its next TOI. By default, we use 1 pass. Increasing the number of passes can reduced the likelihood of time being dropped inside the CCD system at the cost of extra CCD procesing overhead. +* Introduced per-body value to control how far past the initial time of impact the CCD advances the simulation. Advancing further can improve fluidity at the increased risk of tunneling. +* CCD now has limited support contact modification. It supports disabling response to contacts by setting max impulse to 0. It does not yet support target velocity, non-zero max impulse values or scaling mass or inertia. +* Introduced new PxPairFlag eDETECT_CCD_CONTACT. This flags is used to control whether CCD performs sweep tests for a give pair. Decision over whether any collisions are responded to is made by the presence of the flag eSOLVE_CONTACT. + +#### Removed: + +* CCD is now enabled per-body instead of per-shape. As a result, PxShapeFlag::eUSE_SWEPT_BOUNDS has been removed and replaced with PxRigidBodyFlag::eENABLE_CCD. + +#### Changed: + +* API attributes previously named SWEPT_INTEGRATION have now been renamed 'ccd': specifically PxSceneFlag::eENABLE_SWEPT_INTEGRATION, PxSceneFlag::eSWEPT_INTEGRATION_LINEAR, PxSceneDesc::sweptIntegrationLinearSpeedFactor, PxSceneDesc::sweptIntegrationAngularSpeedFactor, PxPairFlag::eENABLE_SWEPT_INTEGRATION +* PxPairFlag::eCCD_LINEAR has been deprecated. Use (PxPairFlag::eDETECT_CCD_CONTACT | PxPairFlag::eSOLVE_CONTACT) instead. + +#### Fixed: + +* Updated CCD algorithm which improves the fluidity of motion of the CCD system while reducing the processing overhead significantly. +* Contact notification is now reliable in CCD. CCD contacts are appended to the end of the contact list for a given pair so that both discrete and continuous contacts are reported +* CCD contact notification now reports applied forces. These contacts will be correctly filtered by force thresholds. + + + +### Serialization + +#### Added: + +* Added extension PxSerialization::isSerializable method to query whether a collection is serializable. +* Added extension PxSerialization::complete which allows to prepare a collection for serialization. +* Added extension PxSerialization::createNames which adds reference names to serializables. +* Added extension PxCollectionExt::remove which removes all serializables of a certain type and optionally adds them to another collection. +* Added extension function PxCollectionExt::releaseObjects to remove and release objects from a collection +* Added class PxSerializationRegistry for handling custom serializable types. +* Added PxSerialization::serializeCollectionToXml and PxSerialization::createCollectionFromXml +* Included pre-built binary meta data with SDK at [path to installed PhysX SDK]/Tools/BinaryMetaData +* Added class PxSerializer to provide serialization specific functionality to serializable classes. +* Added classes PxSerializationContext and PxDeserializationContext to provide functionality for serialization and deserialization operations. + +#### Removed: + +* Removed PxUserReferences class and PxPhysics::createUserReferences. +* Removed RepX.h and unified serialization interfaces for xml and binary serialization. + +#### Changed: + +* PxCollection was reworked to improve reference management rendering PxUserReferences obsolete. PxCollection was also decoupled more from Serialization/Deserialization functionality. Serialization of incomplete collections fails now early at serialization as opposed to late at deserialization. +* Replaced PxPhysics::createCollection with PxCreateCollection. +* Replaced RepXCollection with PxCollection, and unified corresponding interfaces. +* Replaced PxCollection::serialize with PxSerialization::serializeCollectionToBinary. +* Replaced PxCollection::deserialize with PxSerialization::createCollectionFromBinary. +* Replaced PxSerializable::collectForExport(PxCollection& c) with PxSerializer::requires. The new method works in a non-recursive way. +* Replaced PxDumpMetaData with PxSerialization::dumpMetaData. +* Replaced PxCollectForExportSDK with PxCollectionExt::createCollection(PxPhysics& sdk). +* Replaced PxCollectForExportScene with PxCollectionExt::createCollection(PxScene& scene). +* Moved PxCooking::createBinaryConverter to PxSerialization +* Changed PxShape release semantics for shapes. As a consequence deserialized shapes are never autmatically released, but need to be released by the application. Exception: PxPhysics::release. + + + +### Cloth + +#### Added: + +* Improved GPU cloth performance significantly with new parallel solver. +* Added tether constraints, which allow minimum amount of cloth stretching even for large gravity scales. See PxClothFabric. +* Added support for dynamic addition and deletion of collision primitives. See PxCloth::addCollision* and PxCloth::removeCollision*. +* Added triangle mesh collider support. See PxCloth::setCollisionTriangles. +* Added support for self collision and inter-cloth collision. See PxCloth::setSelfCollision*() and PxScene::setClothInterCollision*(). +* Added direct access to CUDA particle data for graphics interoperability, see PxCloth::lockParticleData() +* Added PxRegisterCloth to reduce binary size by stripping unused code on platforms where static linking is used. +* Added methods setWakeCounter/getWakeCounter() (see the corresponding API documentation for details). + + * It is illegal to call wakeUp/putToSleep/isSleeping() on a PxCloth that has not been added to a scene. + + +#### Changed: + +* Cloth solver does not use fibers any more. See PxClothFabric for changes in fabric API. +* Moved PxCooking.cookClothFabric() to extensions. See PxClothFabricCooker and PxClothFabricCreate. +* PxClothMeshDesc has been moved to extensions and now supports both triangle and quad representations. See PxClothMeshDesc. +* The scaling of damping and stiffness coefficients has been separated from the solver frequency and can now be set indepedently using PxCloth::setStiffnessFrequency(). +* PxCloth::setInertiaScale() has been split into linear, angular, and centrifugal components. See PxCloth::set*IntertiaScale. +* Drag coefficient has been split into linear and angular coefficient. See PxCloth::setLinearDragCoefficient and PxCloth::setAngularDragCoefficient. +* Renamed PxCloth::lockClothReadData() to lockParticleData(). Added support for update operations on the returned particle arrays (as an alternative to setParticles()). +* PxCloth::wakeUp() does not have a parameter anymore. Use setWakeCounter() instead to set a specific value. +* PxCloth::getNbCollisionSpherePairs() has been renamed to PxCloth::getNbCollisionCapsules() + +#### Fixed: + +* Fixed a crash bug in the clothing collision code appearing on iOS. + + + +### Rigid Bodies + +#### Added: + +* The contact distance parameter for a limit is automatically estimated if not supplied in the constructor for the limit structure. +* The new callback PxConstraintConnector::onOriginShift() has been introduced. It gets called for all constraints of a scene, when its origin is shifted. +* New helper function PxRigidBodyExt::computeVelocityDeltaFromImpulse has been added. +* Shapes may be declared as shared on creation, and then attached to multiple actors, see the user manual for restrictions. +* Since a shape is no longer necessarily associated with a unique actor, references to shapes in callbacks from the engine are accompanied by the a reference to the associated actor +* Joints and contact modification now support tuning relative mass and inertia for the bodies on a per-contact basis. Inertia and mass can be tuned independently. + +#### Removed: + +* PxShape::overlap(), PxShape::sweep() and PxShape::raycast() have been removed. Equivalent functionality is provided in PxGeometryQuery. + +#### Changed: + +* It is illegal to call resetFiltering() on a PxShape or PxParticleBase if they have not been added to a scene. +* It is illegal to call addForce/addTorque/clearForce/clearTorque() on a PxRigidBody that has not been added to a scene. +* The sleep behavior of dynamic rigid bodies has changed significantly (for details on the current behavior see the API documentation of isSleeping(), wakeUp(), putToSleep(), setKinematicTarget(), PxRigidBodyFlag::eKINEMATIC, ...). Among the changes are: + + * The methods setWakeCounter/getWakeCounter() have been added for PxRigidDynamic and PxArticulation objects (see the corresponding API documentation for details). + * The wakeUp() method of PxRigidDynamic and PxArticulation has lost the wake counter parameter. Use setWakeCounter() instead to set a specific value. + * It is illegal to call wakeUp/putToSleep/isSleeping() on a PxRigidDynamic or PxArticulation that has not been added to a scene. + * Putting a dynamic rigid actor to sleep will clear any pending force updates. + * Switching a dynamic actor to kinematic will put the actor to sleep immediately. + * Switching a kinematic actor back to dynamic will not affect the sleep state (previously the actor was woken up). + * Calling wakeUp/putToSleep() on a kinematically controlled dynamic actor is not valid any longer. The sleep state of a kinematic actor is solely defined based on whether a target pose has been set (see API documentation of isSleeping() for details). + * A call to PxRigidBody::setCMassLocalPose() does not wake up the actor anymore. Note: this also affects related methods in PhysXExtensions like PxRigidBodyExt::updateMassAndInertia() etc. + * If a non-zero velocity or force is set through PxRigidBody::setLinearVelocity(), ::setAngularVelocity(), ::addForce() or ::addTorque(), the actor will get woken up automatically even if the autowake parameter is false. + * PxRigidBody::clearForce() and ::clearTorque() do not have the autowake parameter, to optionally wake the actor up, anymore. These methods will not change the sleep state any longer. Call ::wakeUp() subsequently to get the old default behavior. + * Adding or removing a PxConstraint/PxJoint to/from the scene does not wake the connected actors up automatically anymore. + * It is now possible to avoid automatic wake up of previously touching objects on scene removal. See the additional parameter wakeOnLostTouch in PxScene::removeActor(), ::removeArticulation(), ::removeAggregte(), PxRigidActor::detachShape(). + + +* PxJointLimit and PxJointLimitPair are now PxJointLinearLimit, PxJointLinearLimitPair, PxJointAngularLimitPair, depending on whether the limit is linear or angular. +* Joints now solve for the entire position error rather than a ratio of 0.7 of it. The flag PxConstraintFlag::eDEPRECATED_32_COMPATIBILITY can be used to restore this behavior +* PxConstraintFlag::Type has been renamed to PxConstraintFlag::Enum +* +* The spring constant parameter in joints and articulations that was previously 'spring' is now 'stiffness'. +* The tangential spring constant parameter in articulations that was previously 'tangentialSpring' is now 'tangentialStiffness'. +* Constraints do not respect PxDominanceGroup settings. Use PxJoint::setInvMassScale and setInvInertiaScale +* Shapes are reference counted. PxShape::release() now decrements the reference count on a shape, and its use is deprecated for detaching a shape from its actor - use detachShape() instead. +* Shape creation methods do not take a local transform parameter anymore. Instead PxShapeFlags can be specified. Triangle meshes, height fields and plane geometry shapes cannot be combined with non-kinematic PxRigidDynmic actors if PxShapeFlag::eSIMULATION_SHAPE is specified. Corresponding calls to PxRigidActor::createShape() or PxRigidActor::attachShape() are not supported. +* PxShape::getActor() now returns a pointer, which is NULL if the shape is shareable. +* PxShape::getWorldBounds() has been replaced with PxShapeExt::getWorldBounds(). +* PxContactPoint has been renamed PxFeatureContact. +* The internal format for contact storage has been modified; applications directly accessing the internal contact representation rather than PxContactPair::extractContacts should be modified accordingly. +* Friction mode flags eENABLE_ONE_DIRECTIONAL_FRICTION and eENABLE_TWO_DIRECTIONAL_FRICTION have been replaced by PxFrictionType::Enum PxSceneDesc::frictionType. +* PxSceneDesc::contactCorrelationDistance has been deprecated. +* PxSceneDesc::contactCorrelationDistance no longer has an influence on how many friction anchors are created in a single frame, only on when they are removed in later frames. This may cause a very minor change in friction behavior. + +#### Fixed: + +* Rigid bodies now properly accumulate the forces/torques that are applied with addForce/addTorque while scene insertion is still pending. This affects bodies added to the scene while the scene is simulating and then given forces/torques with addForce/addTorque while the scene is simulating. These accumulated forces and torques are applied during the next simulate() call. Prior to this fix the forces/torques that accumulated while scene insertion was pending were lost and never applied. +* Its now possible to serialize collections with jointed actors without including the corresponding joints in the collection. The deserialized actors will not be jointed anymore. +* Joint drive force limits are actual force limits rather than impulse limits. Set the flag PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES to false to support legacy behavior +* Angular drive constraints for revolute joints were wrongly computed, resulting in a negative angular velocity when a positive drive target was set. +* Scene addActors will now correctly remove all actors that were passed to add, if some insert failed. +* Contact modification now enforces max impulse field correctly. Previously, it only enforced it if max impulse was set to 0. +* Contact modification now supports target velocity in all directions. Previously, it only enforced the target velocity components that were perpendicular to the contact normal. +* Jittering of small spheres & capsules on very large triangles has been fixed. +* Setting sleep threshold to 0 now guarantees that bodies won't fall asleep even if their kinetic energy reaches exactly 0. + +#### Deprecated: + +* PxShape::release() now decrements the reference count on a shape, and its use is deprecated for detaching a shape from its actor - use detachShape() instead. +* PxJoint::getType() is deprecated - use getConcreteType() instead. +* PxConstraintFlag::eREPORTING is deprecated - constraints always generate force reports +* PxConstraintDominance is deprecated - use PxDominanceGroupPair instead. + + + +### Scene queries + +#### Added: + +* PxVolumeCache, a volumetric cache for local collision geometry. +* Parameter inflation was added to some PxGeometryQuery functions. +* Flag eMESH_BOTH_SIDES can be now used to control triangle mesh culling for raycasts and sweeps. +* Added PxBatchQueryMemory as a part of PxBatchQueryDesc, to allow memory buffers to be set before execution. +* PxBatchQueryDesc() constructor now requires 3 parameters at initialization - see migration guide for more details. +* PxBatchQuery::raycast, sweep, overlap calls will now issue a warning and discard the query when over maximum allowed queries. +* There is a new flag to allow manually updating the scene query representation, see: PxSceneFlags::eENABLE_MANUAL_SQ_UPDATE and PxScene::flushQueryChanges(). +* Added PxScene::forceDynamicTreeRebuild() function to immediately rebuild the scene query structures. +* Added bool PxSweepHit::hadInitialOverlap() returning true if a sweep hit occurred early due to initial overlap at distance=0. + +#### Removed: + +* PxBatchQuery::linearCompoundGeometrySweepSingle and PxBatchQuery::linearCompoundGeometrySweepMultiple functions are no longer supported. +* Globals PxPS3ConfigParam::eSPU_OVERLAP, eSPU_RAYCAST, eSPU_SWEEP that were previous set via setSceneParamInt call are replaced with PxBatchQueryDesc::runOnSpu. See migration guide for more details. + +#### Changed: + +* Scene Query raycastAny/Single/Multiple APIs were merged into a single raycast() call (same for overlaps and sweeps). Please refer to user and migration guides for details. +* Scene Query raycast() API now uses a PxRaycastBuffer or a PxRaycastCallback parameter for reporting hits. Blocking hits are now reported separately from toching and PxRaycastCallback class supports reporting an unbounded number of results (same for overlaps and sweeps). +* A const templated PxRaycastBufferN object was added to allow convenient creation of fixed size scene query touch buffers. Same for overlaps and sweeps. +* Support for compound sweeps was moved out from core SDK to extensions. +* Support for compound sweeps was moved from PxScene to extensions (see PxRigidBodyExt::linearSweepSingle, PxRigidBodyExt::linearSweepMultiple). +* PxQueryFilterCallback::preFilter now passes an actor pointer as well as a shape pointer. +* PxSceneQueryFlag::eINITIAL_OVERLAP and PxSceneQueryFlag::eINITIAL_OVERLAP_KEEP have been replaced with PxHitFlag::eINITIAL_OVERLAP_DISABLE and PxLocationHit::hadInitialOverlap(). Note that checking for initial overlap is now the defaut for sweeps. +* Sweeps in 3.3 execute using a new faster code path, in some cases with reduced precision. If you encounter precision issues not previously experienced in earlier versions of PhysX, use ePRECISE_SWEEP flag to enable the backwards compatible more accurate sweep code. +* The default behavior for overlap queries with query filters returning eBLOCK has changed to only return one of eBLOCK hits. Please refer to the migration guide for details. + +#### Fixed: + +* Scene Query performance was significantly improved in a variety of scenarios. +* Fixed a bug in capsule/mesh overlap code that occasionally caused unreported and misreported faces. +* Fixed a crash in raycastMultiple when a convex was hit by the ray and eMESH_MULTIPLE flag was specified as a query flag. +* Fixed a rare crash in heightfield raycast code. +* Internal limit of 65536 results has been removed. +* Accuracy in sphere/capsule-vs-triangle overlap and sweep tests has been improved. + + + +### Cooking + +#### Added: + +* Added support for convex hull creation with limited output vertices count. +* Added support for convex hull creation directly from polygons rather than triangles. +* Added support function computeHullPolygons in cooking, that creates hull polygons from given vertices and triangles. The resulting polygons can be used to create the convex hull directly. + +#### Changed: + +* Changed convex hull volume integrals. +* PxCookingParams constructor requires now PxTolerancesScale as an additional parameter. This enables us to perform further checks on the triangles during cooking. A warning will be emitted to the error stream if too huge triangles were found. This will ensure better simulation stability. + +#### Fixed: + +* Optimized heightfield load code for no-endian conversion case. + + + +### Triangle meshes + +#### Added: + +* Added PxTriangleMeshFlag::eHAS_ADJACENCY_INFO flag for adjacency information checks. + +#### Removed: + +* Removed has16BitTriangleIndices(), replaced by triangleMesh->getTriangleMeshFlags() & PxTriangleMeshFlag::eHAS_16BIT_TRIANGLE_INDICES. + + + +### Particles + +#### Added: + +* Direct read access to CUDA particle data has been added for graphics interoperability, see PxParticleBase::lockParticleReadData(PxDataAccessFlags flags) and PxParticleFluid::lockParticleFluidReadData(PxDataAccessFlags flags) +* Added PxRegisterParticles to reduce binary size by stipping unused code on platforms where static linking is used. +* Added setExplicitCudaFlushCountHint to allow early flushing of the cuda push buffer. +* Added caching of triangle meshes. setTriangleMeshCacheSizeHint is supported on Kepler and above GPUs. + +#### Fixed: + +* Creating and immediately setting the position of particles failed and possibly crashed with GPU acceleration enabled. This would only happen after one or more simulation updates. +* Creating many spread out particles might have crashed the GPU pipeline. + + + +### Broad Phase + +#### Added: + +* The SDK now supports multiple broad-phase algorithms (SAP & MBP). See Release Highlights, PxBroadPhaseType and PxBroadPhaseDesc. +* PxVisualizationParameter::eMBP_REGIONS has been added to visualize MBP regions + +#### Fixed: + +* The sap broadphase now gracefully handles PxShape instances whose axis-aligned bounding boxes have min/max limits with value +/- PX_MAX_F32 or QNAN or INF. Such bounds values can occur if a PxShape is given a global transform that is either illegal or close to the upper limit of the floating point range. Prior to this release, the sap broadphase could crash when the axis-aligned bounds of shapes had values that weren't within the floating point range. This has now been fixed. The overlap pairs reported by the broadphase for bounds with such values is undefined. + + + +### Vehicles + +#### Added: + +* Vehicles now support serialization. A PxSerializationRegistry instance may be passed into PxInitVehicleSdk and PxCloseVehicleSdk in order to enable support. +* Vehicle telemetry graphs can now be queried per channel for the most recent value with the function PxVehicleGraph::getLatestValue. +* New vehicle PxVehicleDriveNW type has been introduced. This class makes use of a new differential type PxVehicleDifferentialNW, which allows specified wheels to be equally coupled to the differential, and allows all for some or all of the N wheels to be driven. +* Support for camber angles has been added to the PxVehicleSuspensionData class. +* Moment of inertia parameter has been added to the PxVehicleEngineData class. Prior to this a value of 1.0 was assumed internally. A default value of 1.0 has been used in the constructor for backwards compatability. +* Vehicle manual contains new section describing the conversion of default vehicle parameter values from SI units to any system of units with particular reference to the use of centimetres instead of metres . +* The SI units of each parameter in PxVehicleComponents.h has been documented. +* Vehicle manual contains updated troubleshooting section. +* The requirements for disabled wheels (PxVehicleWheelsSimData::disableWheel) have been documented to make it clear that disabled wheels must be no longer associated with a PxShape, must have zero rotation speed, and must be decoupled from the differential. This is also now discussed in the guide. +* Wheel raycasts documentation has been improved to clarify the start and end points of each raycast. +* Suspension line raycasts do not need to be performed for each vehicle prior to update with PxVehicleUpdates. This feature is implemented with a boolean array passed as an extra function argument to PxVehicleSuspensionRaycasts. This feature is useful for vehicles that require only low level of detail. +* The clutch model now supports two accuracy modes (PxVehicleClutchAccuracyMode::eESTIMATE and PxVehicleClutchAccuracyMode::eBEST_POSSIBLE). If the estimate mode is chosen the computational cost and accuracy of the clutch can be tuned with PxVehicleClutchData::mEstimateIterations. +* PxVehicleSuspensionData now has a function setMassAndPreserveNaturalFrequency. This modifies the mass and stiffness of the spring in a way that preserves the spring natural frequency. +* A new helper function PxVehicleCopyDynamicsData has been added that allows dynamics data such as engine rotation speed, wheel rotation speed, gear etc to be copied from one vehicle to another of the same type. This is particularly useful if a vehicle has a number of different versions where each represents a different level of detail. +* A new function PxVehicleWheelsSimData::copy has been added to allow per wheel dynamics data to be copied from one vehicle to another. +* The vehicle manual contains a new section "Level of Detail" describing the available options for vehicles that require only a low level of detail. +* PxVehicleTireLoadFilterData now requires that mMinNormalisedLoad is greater than or equal to zero. +* PxVehicleTireLoadFilterData now has a new member variable mMinFilteredNormalisedLoad. This value describes the filtered normalised load that occurs when the normalised is less than or equal to mMinNormalisedLoad. +* PxVehicleWheelsSimData now has a new function setMinLongSlipDenominator. This can be used to tune stability issues that can arise when the vehicle slows down in the absence of brake and drive torques. +* A new section "PxVehicleAutoBoxData" has been added to the vehicle tuning guide to describe operation of the automatic gearbox. +* A new section "The Vehicle Under-steers Then Over-steers" has been added to the vehicle troubleshooting guide to describe steps to avoid twitchy handling on bumpy surfaces. A new section "The Vehicle Never Goes Beyond First Gear" has been added to the vehicle troubleshooting guide to describe a common scenario that occurs when the automatic gearbox is given a latency time that is shorter than the time taken to complete a gear change. +* A new section "The Vehicle Slows Down Unnaturally" has been added to the vehicle troubleshooting guide to describe the steps that can be taken to help the vehicle slow down more smoothly. +* A number of vehicle snippets have been added. + +#### Changed: + +* Minor api change for consistency: PxVehicleDrive4WWheelOrder has been introduced to replace the enum beginning with PxVehicleDrive4W::eFRONT_LEFT_WHEEL. +* Minor api change for consistency: PxVehicleDrive4WControl has been introduced to replace the enum beginning with PxVehicleDrive4WControl::eANALOG_INPUT_ACCEL. +* Minor api change for consistency: PxVehicleDriveTankWheelOrder has been introduced to replace the enum beginning with PxVehicleDriveTankWheelOrder::eFRONT_LEFT. +* Minor api change for consistency: PxVehicleDriveTankControl has been introduced to replace the enum beginning with PxVehicleDriveTank::eANALOG_INPUT_ACCEL. +* Minor api change for consistency: PxVehicleDriveTankControlModel has been introduced to replace the enum beginning with PxVehicleDriveTank::eDRIVE_MODEL_STANDARD. +* Minor api change for consistency: PxVehicleTypes has been introduced to replace the enum beginning with eVEHICLE_TYPE_DRIVE4W. +* Minor api change for consistency: PxVehicleWheelGraphChannel has been introduced to replace the enum beginning with PxVehicleGraph::eCHANNEL_JOUNCE. +* Minor api change for consistency: PxVehicleDriveGraphChannel has been introduced to replace the enum beginning with PxVehicleGraph::eCHANNEL_ENGINE_REVS. +* Minor api change for consistency: PxVehicleGraphType has been introduced to replace the enum beginning with PxVehicleGraph::eGRAPH_TYPE_WHEEL. +* PxVehicleUpdates now checks in checked and debug config that the wheel positioning of the driven wheels in a PxVehicleDrive4W obey the wheel ordering specified in PxVehicleDrive4WWheelOrder. Vehicles that are back-to-front or right-to-left are also allowed. A warning is issued if the check fails. +* PxVehicleUpdates now checks in checked and debug config that the odd wheels of a PxVehicleDriveTank are either all to the left or all to the right of their even-wheeled complement, as specified in PxVehicleDriveTankWheelOrder. A warning is issued if the check fails. +* To improve api consistency the arguments of the function PxVehicleDriveDynData::setAnalogInput(const PxReal analogVal, const PxU32 type) have been swapped so that it is now of the form PxVehicleDriveDynData::setAnalogInput(const PxU32 type, const PxReal analogVal). +* Non-persistent wheel dynamics data (slip, friction, suspension force, hit data etc) has been moved out of the PxVehicleWheelsDynData class and is now recorded in a PxWheelQueryResult buffer that is passed as a function argument to the PxVehicleUpdates function. +* PxVehicleWheels::isInAir() has been replaced with PxVehicleIsInAir(const PxVehicleWheelQueryResult& vehWheelQueryResults) to reflect the change to non-persistent data storage. +* The origin of vehicles can now be shifted to stay in sync when the origin of the underlying PxScene is shifted. See PxVehicleShiftOrigin() for details. +* PxVehicleWheels::setWheelShapeMapping and PxVehicleWheels::getWheelShapeMapping have been moved to PxVehicleWheelsSimData::setWheelShapeMapping and PxVehicleWheelsSimData::getWheelShapeMapping +* PxVehicleWheels::setSceneQueryFilterData and PxVehicleWheels::getSceneQueryFilterData have been moved to PxVehicleWheelsSimData::setSceneQueryFilterData and PxVehicleWheelsSimData::getSceneQueryFilterData +* PxVehicle4WEnable3WTadpoleMode and PxVehicle4WEnable3WDeltaMode now take an extra function argument: a non-const reference to a PxVehicleWheelsDynData. +* The section "SI Units" in the vehicle guide has been updated to include the new functon PxVehicleWheelsSimData::setMinLongSlipDenominator. +* PxVehicleTireData::mCamberStiffness has been replaced with PxVehicleTireData::mCamberStiffnessPerUnitGravity. PxVehicleTireData::mCamberStiffnessPerUnitGravity should be set so that it is equivalent to the old value of PxVehicleTireData::mCamberStiffness divided by the magnitude of gravitational acceleration. +* PxVehicleComputeTireForceDefault has been removed from the public vehicle api. Custom tire shaders that call PxVehicleComputeTireForceDefault are best implemented by taking a copy of PxVehicleComputeTireForceDefault and calling the copy instead. + +#### Fixed: + +* Sticky tire friction is now activated in the tire's lateral direction at the tire force application point when the velocity at the base of the tire has low longitudinal and low lateral components. Longitudinal sticky tire friction is unaffected and is still activated when the vehicle has low forward speed. This fixes a minor bug where vehicles positioned on a slope perpendicular to the slope's downwards direction can slowly drift down the slope. +* Bugs in the suspension force and tire load computation have been fixed that affected handling when the car was upside down. +* The tire load passed to the tire force computation is now clamped so that it never falls below zero. +* A bug in the tank damping forces has now been fixed. Tanks now slow down more aggressively from engine and wheel damping forces. + + + + + + + + +# v3.2.4 + +April 2013 + +## What's New In NVIDIA PhysX 3.2.4 + + +#### General + +* Note: PS3 platform specific changes can be found in the PS3 readme file. +* Fixed a bug which caused actors to return wrong world bounds if the bounds minimum was above 10000 on any axis. +* Reporting allocation names can now be enabled or disabled (see PxFoundation::setReportAllocationNames). When enabled, some platforms allocate memory through 'malloc'. +* eEXCEPTION_ON_STARTUP is removed from PxErrorCode and it is no longer needed. +* Added boilerplate.txt to the Tools folder. SpuShaderDump.exe and clang.exe require it. +* PxWindowsDelayLoadHook.h has been moved from Include/foundation/windows to Include/common/windows. +* PxScene::saveToDesc now reports the bounceThresholdVelocity value. +* Fixed a bug in PxDefaultSimulationFilterShader: the value of the second filter constant in the collision filtering equation was ignored and instead the value of the first filter constant was used. +* Fixed a crash bug in PCM collision. + + + +#### Rigid Bodies + +* Forces applied to bodies (with PxRigidBody::addForce) that go to sleep in the subsequent update now have their applied forces cleared when the body is set to sleep to avoid them being applied in a later update when the body is once more awake. This bug broke the rule that forces applied with PxRigidBody::addForce do not persist beyond the next scene update. +* Jittering of small spheres & capsules on very large triangles has been fixed. + + +#### Cooking + +* PxCookingParams constructor is now marked as deprecated. PxToleranceScale is needed for PxCookingParams in order to perform additional triangle check during cooking. This triangle check will trigger warning if too huge triangles are used. This check will ensure better simulation stability. + + +#### Scene Queries + +* Added PxScene::forceDynamicTreeRebuild() function to immediately rebuild the scene query structures. +* Accuracy in sphere/capsule-vs-triangle overlap and sweep tests has been improved. + + +#### Broad Phase + +* Fixed assert in debug mode that wrongly asserted when an overlap pair was removed with perfect equality between the min of one bound and the max of the other along at least one axis. + + +#### Character controller + +* PxControllerFilterCallback has been added, to make CCT-vs-CCT filtering more flexible. +* Fixed a bug where PxControllerBehaviorCallback was not called when a PxUserControllerHitReport was not defined. +* PxObstacle notifications has been added to handle touched obstacles. +* Touched PxObstacle has been replaced by touched ObstacleHandle. +* PxObstacleContext::getObstacleByHandle has been added. +* Touched actors scene is checked before ride on shape, to ensure valid touched shape. +* Touched shape scene query flag is checked before ride on shape, to ensure valid touched shape. +* Touched shape user CCT filtering is triggered before ride on shape, to ensure valid touched shape. +* Box & capsule controllers' resize function now properly take the up direction into account + + +#### Vehicles + +* Documented potential problem with PxVehicleWheelsDynData::getTireDrivableSurfaceType() and PxVehicleWheelsDynData::getTireDrivableSurfaceShape() whereby the pointer returned may reference a PxShape or PxMaterial that has been released in-between storing the pointer in PxVehicleUpdates and any subsequent query. +* PxVehicleWheelsSimData::disableWheel has been documented in more detail. PxVehicleWheelsSimData::enableWheel has been added. +* Fixed a bug where the denominator of the longitudinal slip calculation didn't take into account the value of PxTolerancesScale::length. This will only have an impact if PxTolerancesScale::length != 1.0f. +* Fixed a bug where the engine torque would be incorrectly applied if PxTolerancesScale::length != 1.0f. This will only have an impact if PxTolerancesScale::length != 1.0f. + + +#### Particles + +* Creating and immediately setting the position of particles failed and possibly crashed with GPU acceleration enabled. This would only happen after one or more simulation updates. + + + + +## Supported Platforms + + +Unchanged from from 3.2.3 except: +#### Development + +* Upgraded to Xcode 4.6 + + + +## Known Issues And Limitations + + +Unchanged from from 3.2.3. + + + + + + + + + +# v3.2.3 + +November 2012 + +## What's New In NVIDIA PhysX 3.2.3 + + +#### General + +* Note: PS3 platform specific changes can be found in the PS3 readme file. +* Quaternions passed through the API are now considered valid if their magnitude is between 0.99 and 1.01. +* Fixed crash when running out of memory on creation of a triangle mesh. +* For applications using floating point exceptions, the SDK will now mask or avoid exceptions arising from invalid floating point operations (inexact and underflow exceptions may still be generated). +* Fixed a bug with recursive use of the PxScene read/write lock. +* Fixed a shutdown bug with very short lived threads on Linux platforms. +* PhysX version number in error messages now printed in hex for easier reading. +* Fixed memory barrier and prefetch implementation for all posix based platforms (android, ios, osx, linux). + + +#### Broad Phase + +* Fixed a broad phase crash bug that occurred when deleting shapes with bounds very far from the origin. + + + +#### Collision Detection + +* Documentation of limits of PxShape counts has been added for affected platforms. +* Made kinematics interact better with CCD. +* Adding support for disabled contact response in CCD by respecting the dominance setting. In this case, CCD will emit events but will not alter the motion of the bodies. +* Fixed potential crash in eENABLE_PCM codepath. + + + +#### Rigid Bodies + +* Fixed bug in force based contact reports. An assert could occur when PxPairFlag::eNOTIFY_THRESHOLD_FORCE_PERSISTS was set and PxPairFlag::eNOTIFY_THRESHOLD_FORCE_FOUND was not set. +* Twist Limit range is documented for revolute and D6 joints, and validated. +* Reduced the number of SDK allocations when using CCD. + + + +#### Scene Queries + +* Raycasts against heighfields now return correct actual mesh index, which can be used for getTriangle(). +* Fixed bug that caused scene queries to miss hits for static rigid bodies that got moved around (after having been added to the scene). +* Fixed rebuilding the dynamic structure properly when used for static rigid bodies. +* Fixed a rare crash in heightfield raycast code. + + +#### Character controller + +* A new runtime tessellation feature has been added, that can help reducing FPU accuracy issues in the sweep tests. + + +#### Convex hulls + +* Zero-sized convex hull data double delete detection fix. + + +#### Vehicles + +* Vehicles with rigid body actors that are asleep and also have no acceleration or steer inputs are treated as though they are asleep too; that is, they are bypassed completely in the PxVehicleUpdates function. Vehicles with sleeping rigid body actors but with non-zero acceleration or steer inputs are processed as normal in PxVehicleUpdates and will automatically have their rigid body actor woken up. +* New function PxVehicleSetUpdateMode to allow PxVehicleUpdates to select between applying accelerations to vehicle rigid bodies or immediate updating of their velocity. + + +#### Particles + +* Fixed a non-deterministic crash appearing with rigid bodies using CCD and gpu particles in the same scene. + + +#### Physx Visual Debugger + +* Material release events are now correctly sent to PVD. + + +#### RepX + +* Add more RepX class information in PhysXAPI document. + + + + +## Supported Platforms + + +#### Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android (version 2.2 or later for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver ver 295.73 or later is required for GPU acceleration) +* Microsoft Windows RT (formerly known as Windows on ARM) (SDK only, no samples yet) +* Microsoft XBox 360 +* Sony Playstation 3 + +#### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010 +* Xcode 4.5 + + + +## Known Issues And Limitations + + +Unchanged from from 3.2.2. + + + + + + + + + +# v3.2.2 + +October 2012 + +## What's New In NVIDIA PhysX 3.2.2 + + +#### General + +* Note: PS3 platform specific changes can be found in the PS3 readme file. + +* Added Microsoft Windows RT (formerly known as Windows on ARM) support. +* Suspended Sony Playstation Vita support. +* PxScene now exposes methods to make multithreaded sharing of scenes easier, see PxSceneFlags::eREQUIRE_RW_LOCK for details. +* Enabled Win64 DEBUG build to use SIMD enabled code path. +* Fixed bug in quaternion to axis/angle routine which failed on negative w values. +* Fixed crash when using ConvX on a PxCollection with external references. +* Fixed a spurious overlapping read/write error report when using simulation call backs in checked builds. +* The bounce threshold velocity can be set at run-time with PxScene::setBounceThresholdVelocity. Likewise, it can be queried with PxScene::getBounceThresholdVelocity +* Fixed return value of Ps::atomicExchange for POSIX based platforms: Linux, Android, IOS and OSX +* PxGeometryQuery::computePenetration() has been added, to compute the Minimum Translational Distance between geometry objects. + + +#### Broad Phase + +* Fixed a broad phase crash bug. + + +#### Collision Detection + +* Collision detection now more robust when confronted with ill-conditioned scenarios. +* Fixed crash when SDK is unable to create more contact pairs. Now a warning is emitted and the contacts are ignored. + + +#### Rigid Bodies + +* Improved the numerical stability of articulations. +* The target pose of a kinematically controlled dynamic actor can now get extracted through PxRigidDynamic::getKinematicTarget(). +* The new flag PxRigidDynamicFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES makes scene queries use the target pose of a kinematically controlled dynamic actor instead of the actual pose. +* Fixed PxConstraintFlag::eVISUALIZATION having no effect. +* Fixed bug that caused sleep/wake-up notification events to get lost. +* Fixed a bug where sleeping objects were not waking up properly. +* Fixed potential assert when switching a rigid body between kinematic and dynamic with contact reports enabled. +* Fixed a bug where CCD didn't consider the scaling transform for triangle meshes. +* Fixed a potential crash bug when PxConstraintFlag::ePROJECTION gets raised after a joint (that connects to other projecting joints) has been created. +* Fixed a bug that resulted in joint breakage being reported every frame for any broken joint +* Added PxArticulationDriveCache for applying an impulse to an entire articulation +* fixed various crash bugs when sleeping articulations were removed from the scene and re-added +* + + +#### GPU Physics + +* Fixed a possible out of bounds array access in GPU particle collision code. +* Updated the GPU PhysX Visual Indicator to allow APEX to hook into it. +* Fixed sample particles crash when there is a cuda kernel error. +* Upgraded GPU tech to CUDA 4.2. + + +#### Scene Queries + +* PxSceneQueryHit::faceIndex is now filled in for sweeps against convex meshes. +* Added support for sphere and capsule shaped heightfield overlap queries. +* Added an inflation parameter to all sweep queries in PxGeometryQuery, PxBatchQuery, and PxScene. This can be used to maintain a minimum distance between objects when moving them using sweeps. +* Made sure that raycast multiple will include the closest triangle in the results even if the output cannot hold all the triangles that are hit. +* Fixed swept sphere against capsule not properly testing for initial overlap. +* Fixed the normal vector returned from sweeps being sometimes negated. +* Fixed a scenario where raycasting could miss an actor after the user has moved it using setGlobalPose(). +* Fixed swept convex against plane sometimes reporting false hits +* Fixed swept/overlap/raycast with convexes that don't have identity scale rotation. +* Fixed a culling bug for box-triangle mesh sweep. + + +#### Convex hulls + +* Convex hull is rejected if it has less than 4 polygons. +* Additional convex hull check has been added to detect open volumes. + + +#### Triangle meshes + +* Added triangle mesh flags for 16bit indices and adjacency information. +* Fixed adjacency information order for getTriangle with triangle meshes to respect the vertex order. + + +#### HeightFields + +* Fixed bug where capsules would bounce as they roll across heightfield edges. +* Fixed bug where spheres would bounce as they roll across heightfield vertices. +* Added adjacency information for getTriangle with height fields. + + +#### Particles + +* Fixed triangle mesh shapes with ePARTICLE_DRAIN colliding with particles. +* Fixed crash with GPU particles when a lot of grid cells get occupied and vacated within one time step. + + +#### Character Controller + +* The PxControllerBehaviorFlag::eCCT_USER_DEFINED_RIDE flag has been added. +* Fixed character controller not walking up steps properly if they are not exactly 90 degrees vertical. +* Fixed a bug where the character controller was not able to move up slopes when using a small step offset setting. +* Fixed a bug where the character controller could rise off the ground when blocked by a step. +* Fixed a bug where the character controller could rise off the ground when hitting another character controller. +* Fixed a bug where releasing a shape of a touching actor and then releasing the character controller would crash. Releasing shapes of actors in touch may still lead to crashes in other situations. PxController::invalidateCache() can be used to work around these situations. + +#### CCD + +* Fixed culling bug in CCD sweeps with meshes with transforms that caused contacts to be missed + + +#### Vehicles + +* The vehicle sdk used to make the assumption that wheels 0 and 1 (the front wheels) of a PxVehicleDrive4W responded positively to the input steering wheel angle, while wheels 2 and 3 (the rear wheels) responded in the opposite direction to that of the input steering wheel angle. A consequence of this assumed behaviour was the restriction that PxVehicleWheelData::mMaxSteer was limited to positive values. This restriction has now been relaxed with the caveat that PxVehicleWheelData::mMaxSteer must be in range (-Pi/2, Pi/2). It is now possible to turn each wheel positively or negatively relative to the input steering wheel angle by choosing positive or negative values for PxVehicleWheelData::mMaxSteer. Ackermann steer correction might result in the front and rear wheels competing against each other if the rear and front all steer in the same direction relative to the input steering wheel angle. If this is the case it will be necessary to set the Ackermann accuracy to zero. +* It is now possible to set the engine rotation speed (PxVehicleDriveDynData::setEngineRotationSpeed), the rotation speed of each wheel (PxVehicleWheelsDynData::setWheelRotationSpeed) and the rotation angle of each wheel (PxVehicleWheelsDynData::setWheelRotationAngle). The default values for each of these properties remains zero. +* Wheel contact reporting has been improved with the addition of a number of query functions to the PxVehicleWheelsDynData class. These are getTireDrivableSurfaceContactPoint, getTireDrivableSurfaceContactNormal, getTireLongitudinalDir, getTireLateralDir, getSuspensionForce, getTireDrivableSurfaceShape. +* It is now possible to store a userData pointer per wheel. This allows, for example, each wheel to be associated with a game object. The relevant functions are PxVehicleWheelsDynData::setUserData and PxVehicleWheelsDynData::getUserData. +* The default behavior of PxVehicleWheels::setWheelShapeMapping has changed. Previously, default values were automatically assigned to each wheel at construction so that the ith wheel was mapped to the ith body shape. This, however, made the assumption that there was a wheel shape for each wheel, which is not always true. As a consequence, the default value is now -1, meaning any mapping between body shape and wheel has to be explictily made by calling setWheelShapeMapping. +* It is now possible to query the mapping between wheel and body shape with PxVehicleWheels::getWheelShapeMapping. +* It is now possible to query the tire shader data that has been applied to each wheel with PxVehicleWheelsDynData::getTireForceShaderData. +* The helper function PxVehicleComputeSprungMasses has been added to aid the setup of the suspension sprung masses from the rigid body centre of mass and wheel center coordinates. +* The scene query filter data applied to the suspension raycasts was previously taken from the filter data of the associated body shape. This makes the assumption of a body shape per wheel, which is not always true. As a consequence, the filter data must be explictly set per wheel by calling PxVehicleWheels::setSceneQueryFilterData. The filter data can be queried with PxVehicleWheels::getSceneQueryFilterData. +* Sub-stepping of the vehicle update can now be applied per vehicle with PxVehicleWheelsSimData::setSubStepCount. +* PxVehicleDrivableSurfaceToTireFrictionPairs has been modified so that the dictionary of material pointers can be updated without the necessity of further allocation. The create function has been replaced with separate allocate and setup functions. +* A new vehicle type PxVehicleNoDrive has been added to provide a close approximation to backwards compatibility with the api of the 2.8.x NxWheelShape. + + + +#### Visual Remote Debugger + +* Added PVD compatible profile zones for batched queries. +* Added the ability to capture and inspect scene queries in PVD. +* SDK will now flush the pvd connection stream immediately after cloth or cloth fabric is created or released. +* Fixed the PVD support for articulations. +* Fixed PVD rendering wrong constraint limits. + + + +#### Documentation + +* Wrong statement in PxRigidStatic::release() has been corrected. Static rigid bodies do wake up touching dynamic rigid bodies on release. +* Wrong statement in PxShape::setFlag() has been corrected. It is a valid operation to clear all flags. +* Retroactively added more detail about changes to 3.2.1 release notes below. + + + +## Supported Platforms + + +#### Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android (version 2.2 or later for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver ver 295.73 or later is required for GPU acceleration) +* Microsoft Windows RT (formerly known as Windows on ARM) (SDK only, no samples yet) +* Microsoft XBox 360 +* Sony Playstation 3 + +#### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010 +* Xcode 4.2 + + + + + + +## Known Issues And Limitations + + +#### General + +* Memory leaks might get reported when using the debug versions of malloc and free together with the debug version of PhysX on Microsoft Windows platforms with Visual Studio 2010. This is caused by a bug in the Visual Studio 2010 runtime libraries. If such a leak appears immediately after releasing PhysX and all its components, please contact us for information about workarounds. +* Use of articulations may require an increase of 64K in the stack size for threads making API calls and engine worker threads + + + +Please also see the previous lists from 3.2.1 and earlier. + + + + + + + + +# v3.2.1 + +June 2012 + +## What's New In NVIDIA PhysX 3.2.1 + + +#### General + +* Note: PS3 platform specific changes can be found in the PS3 readme file. +* Added GRB hooks for APEX 1.2.1. +* Some incorrect usages of __restrict have been fixed. +* A crash when the user's code had FPU exceptions enabled has been fixed. +* A rare crash on Win64 has been fixed. +* Removed no longer needed RapidXML library from distribution. +* Binary serialization can now save the names of actors and shapes. +* Removed a RepXUtility.h reinterpret_cast compile warning that happened on some platforms. +* Fixed a spurious overlapping read/write error report when using simulation call backs in checked builds. +* Fixed a bug in PxBinaryConverter when processing PxConvexMesh and PxMaterial assets. +* Fixed bug in implementations of array accessors (PxPhysics::getScenes(), GuMeshFactory::getTriangleMeshes(), GuMeshFactory::getConvexMeshes(), GuMeshFactory::getHeightFields(), PxAggregate::getActors(), PxScene::getAggregates(), PxScene::getArticulations(), PxScene::getConstraints() ) when startIndex > bufferSize. +* Reduced the number of libraries provided for game consoles. The following core libraries are included in the PhysX3 library and are not available separately anymore: LowLevel, LowLevelCloth, PhysX3Common, PhysXProfileSDK, PhysXVisualDebuggerSDK, PvdRuntime, PxTask, SceneQuery, SimulationController. + + +#### Documentation + +* Clarified documentation regarding use of eSEND_SLEEP_NOTIFIES flag. +* Clarified documentation regarding using different CRT libraries. +* Removed some confusing statements about meta data from the documentation. +* Updated PsPool, PsSort so they can use the user allocator. + + +#### Mesh Cooking + +* A warning message about negative volumes in the convex mesh cooker could cause a crash. +* Fixed failure to create valid convex hull in cooking when using PxConvexFlag::eINFLATE_CONVEX. +* The convex mesh cooking has been made more robust and properly outputs some error messages that were previously missing. +* Fixed crash bug in x64 version of ClothEdgeQuadifier. +* Adjacency information option for TriangleMeshes. This is controlled using the PxCookingParams::buildTriangleAdjacencies flag, and returned if available by PxMeshQuery::getTriangle(). + + +#### Broad Phase + +* The sdk gracefully handles the case of more than 65536 broadphase pairs and reports a warning that some contacts will be dropped in the event that this limit is exceeded. This affects all platforms except win32/win64/linux/linux64, which support a maximum number of 4294967296 pairs. + + +#### Collision Detection + +* Fixed a memory corruption bug in heightfield code. +* Fixed a bug in sphere vs mesh contact generation that could result in bad normals. +* Added a flag to enable or disable contact caching, to permit users to make a performance vs memory tradeoff. +* Fixed a crash bug in ContactReport cleanup code. + + +#### Rigid Bodies + +* The simultaneous raising of both the PxShapeFlag::eSIMULATION_SHAPE and PxShapeFlag::eTRIGGER_SHAPE flags is now explicitly forbidden by the sdk. If any of the two is raised then any attempt to raise the other is rejected by the sdk and an error is passed to the error stream. + + +#### Articulations + +* The API stubbed in 3.2.0 for applying an impulse to an entire articulation is now implemented. + + +#### GPU Physics + +* Much more specific error messages for CUDA compute capability related failures. +* Added SM35 support for GK110 GPUs. +* The CUDA contexts provided by the gpu dispatcher can now be shared across scenes. +* Fixed a possible out of bounds array access in GPU particle collision code. + + + +#### Scene Queries + +* Resolved poor GJK sweep convergence. +* Batched queries accept sphere geometry for sweeps. +* Optimized performance of raycasts. +* An internal limit of 65536 objects in the scene-query subsytem has been lifted. +* Fixed a bug where raycasts that sliced through two adjoining heightfields did not return correct results. +* Fixed a crash bug in PxFindOverlapTriangleMeshUtil when doing a sphere overlap query against a heightfield. + + + +#### Cloth + +* PxCloth::setMotionConstraints() now works with NULL parameter. + + +#### Character Controller + +* PhysX CCT code no longer sets PxShape::userData. +* Intersection of pairs of CCTs now uses the supplied filter data and the supplied callback prefilter. The callback postfilter is not yet hooked up. +* A bug has been fixed whereby the filterData was ignored in one of the scene queries initiated by the PhysX CCT code. +* Introduced a more automatic mechanism for invelidating the character controller's scene cache. As part of this, PxController::reportSceneChanged() was replaced with PxController::invalidateCache(). +* Added helper functions PxController::get/setFootPosition() to let user specify the bottom point of the character controller, rather than the center. +* A new helper function, PxController::resize(), has been added to facilitate character controller resizing. +* PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT is not the default behavior anymore. +* The slope limit is only observed when walking on static convex meshes, static triangle meshes, static boxes and static heightfields. The slope limit is not observed when walking on dynamic or kinematic rigid bodies or static capsules or static spheres. This partially fixes a bug where the slope limit was inadvertently considered for shapes attached to dynamic rigid bodies and inadvertently ignored for boxes attached to static shapes. + + +#### Vehicles + +* The vehicle sdk now reports an error to the error stream and exits from PxVehicleUpates if PxInitVehicleSdk has not been called in advance. This avoids a divide-by-zero error that can arise if the vehicle sdk has not been initialised correctly. + + +#### Visual Debugger + +* Releasing of cloth fabrics is reported to the VRD. +* Ext::Joint::setActors() call now reported to PVD. +* Fixed crash bug when removing an aggregate containing a PxArticulation, while PVD is running. + + + +## Supported Platforms + + +Unchanged from from 3.2. + + +## Known Issues And Limitations + + +Unchanged from from 3.2. + + + + + + + + +# v3.2 + +December 2011 + +## What's New In NVIDIA PhysX 3.2 + + +#### General + +* Three new sample applications: SampleCharacterCloth (character with cloth cape and cloth flags), SampleBridges (character controller walking on dynamic bridges and moving platforms), SampleCustomGravity (character controller with arbitrary up vector). +* On Windows, the PxFoundation instance is now a process wide singleton and part of the new PhysX3Common.dll library +* PxCreatePhysics() does not create a PxFoundation instance any longer. The PxFoundation instance has to be created in advance through PxCreateFoundation(). +* Calls to PxCreatePhysics() are not valid anymore if a PxPhysics instance already exists. +* If profiling information should be sent to the PhysX Visual Debugger, a PxProfileZoneManager instance has to be provided when creating the PxPhysics instance. +* The version number constant PX_PUBLIC_FOUNDATION_VERSION has been replaced with PX_PHYSICS_VERSION. Both PxFoundation and PxPhysics use the same version number now. +* The API now distinguishes between input and output stream types. +* Added mechanism to reduce code size by not linking optional components. See PxCreateBasePhysics() and the PxRegister*() functions. +* Added getConcreteTypeName() to API classes to provide run time type information. +* Added PxScene::getTimestamp() to retrieve the simulation counter. +* PxGetFoundation has been moved to PxGetFoundation.h +* Changed the functions PxPhysics::releaseUserReferences(), releaseCollection(), addCollection() and releaseCollected() to now take a reference rather than a pointer. +* The signature of PxCreatePhysics has changed: The Foundation SDK instance must be passed in explicitly. One can also hook profiling information by passing a PxProfileZoneManager. +* Platform conversion for serialized data has been moved from the ConvX command line tool to the PxBinaryConverter interface in the cooking library +* contact data block allocation now provides statistics on usage and max usage +* On all platforms except PS3, contact data blocks can be progressively allocated +* PxExtensionVisualDebugger has been renamed to PxVisualDebuggerExt, PxExtensionsConnectionType renamed to PxVisualDebuggerConnectionFlag +* Default implementations of memory and file streams added in PxDefaultStreams.h +* Renamed PxPhysics::getMetaData() to ::PxGetSDKMetaData(). +* Scene::simulate() now takes a memory block which is used for allocation of temporary data during simulation +* On Windows, CudaContextManagerDesc support appGUID now. It only works on release build. If your application employs PhysX modules that use CUDA you need to use a GUID so that patches for new architectures can be released for your game.You can obtain a GUID for your application from Nvidia. + + +#### Rigid Bodies + +* Introduced a new contact generation mode, see eENABLE_PCM. Note that this is an experimental feature that still shows simulation artifacts in some scenarios. +* Introduced two new friction simulation modes, see eENABLE_ONE_DIRECTIONAL_FRICTION and eENABLE_TWO_DIRECTIONAL_FRICTION. +* Introduced a new scene query flag PxSceneQueryFlag::eINITIAL_OVERLAP_KEEP to control how initial overhaps are treated in scene queries. +* Per-triangle materials have been implemented. +* Changes to material properties are automatically reflected in contact resolution. +* New helper methods to compute mass properties for a dynamic rigid body taking per shape density/mass values into account (see documentation on PxRigidBodyExt for details). +* A new set of methods for overlap, sweep and raycast tests based on PxGeometry objects has been introduced. See documentation on PxMeshQuery and PxGeometryQuery for details). +* The contact report API has changed (for details see the documentation on PxSimulationEventCallback::onContact()). Among the changes are: + + * Reports only get sent for shape pairs which request them. Previously, reports were sent for an actor pair even if the requested shape pair event was not triggered (for example because other shapes of the same actors started colliding etc.) + * The following PxPairFlags have been removed eNOTIFY_CONTACT_FORCES, eNOTIFY_CONTACT_FORCE_PER_POINT, eNOTIFY_CONTACT_FEATURE_INDICES_PER_POINT. Forces and feature indices are now always provided if applicable. + * It is much easier now to skip shape pairs or contact point information when traversing the contact report data. + * The memory footprint of contact reports has been reduced. + + +* The members featureIndex0/1 of PxContactPoint have been renamed to internalFaceIndex0/1 for consistency. +* For trigger reports, the eNOTIFY_TOUCH_PERSISTS event has been deprecated and will be removed in the next release. For performance and flexibility reasons it is recommended to use eNOTIFY_TOUCH_FOUND and eNOTIFY_TOUCH_LOST only and manage the persistent state separately. +* Added PxConstraintVisualizer interface and code to visualize joint frames and limits. +* Improved PxBatchQuery API. +* PxPhysics::getProfileZoneManager() now returns a pointer rather than a reference. +* PxRigidDynamic::moveKinematic() has been renamed to setKinematicTarget() to underline its precise semantics. +* Added new function PxShape::getGeometry and class PxGeometryHolder to improve Geometry APIs. +* PxCreatePlane now takes a PxPlane equation as a parameter. Note that the interpretation of the distance value is negated relative to 3.1 +* Added new actor creation helpers PxCloneStatic, PxCloneDynamic, PxScaleActor. +* Added new functions PxTransformFromSegment, PxTransformFromPlaneEquation to simplify creation of planes and capsules. +* added PxJoint::getConstraint() to access the underlying constraint object, from which the constraint force can be read +* Some methods of PxAggregate have been renamed for consistency or replaced for extended functionality. + + * getMaxSize() is now called getMaxNbActors(). + * getCurrentSize() is now called getNbActors(). + * getActor() has been replaced by getActors() which copies the actor pointers to a user buffer. + + +* Added support for kinematic triangle meshes, planes and heighfields. + + +#### Scene queries + +* Dynamic AABBTree has been set as the default dynamic pruning structure. + + +#### Particles + +* Removed descriptors from particle API: The properties maxParticles and PxParticleBaseFlag::ePER_PARTICLE_REST_OFFSET need to be specified when calling PxPhysics::createParticleSystem() and createParticleFluid(). All other properties can be adjusted after creation through set methods. + + +#### Cloth + +* Added convex collision shapes, see PxCloth::addCollisionConvex() +* Added friction support, see PxCloth::setFrictionCoefficient() +* Added angle based bending constraints, see PxClothPhaseSolverConfig::SolverType::eBENDING +* Added separation constraints, a spherical volume that particles should stay outside of, see PxCloth::setSeparationConstraints() +* Added drag, see PxCloth::setDragCoefficient() +* Added inertia scaling, controls how much movement due to PxCloth::setTargetPose() will affect the cloth +* Added support for setting particle previous positions, see PxCloth::setParticles() +* Added controls for scaling particle mass during collision, this can help reduce edge stretching around joints on characters, see PxCloth::setCollisionMassScale() +* Particle data is now copied asynchronously from the GPU after simulate (rather than on demand) +* Improved fabric layout, you can now share fabric data across multiple phases to reduce memory usage, see PxClothFabric +* Fixed bug in collision when capsules are tapered at a slope > 1 + + +#### Vehicles + +* Added PxVehicleDriveTank, a vehicle class that enables tank behaviors. +* Support for vehicles with more than 4 wheels, see PxVehicleDrive4W, PxVehicleDriveTank. +* Significant refactor of vehicle api to allow further types of vehicle to be added. +* Americal English spelling used in vehicle api. +* PxVehicle4W replaced with PxVehicleDrive4W, PxVehicle4WSimulationData replaced with PxVehicleDriveSimData4W. +* Removal of scene query helper functions and structs: PxVehicle4WSceneQueryData, PxVehicle4WSetUpSceneQuery, PxWheelRaycastPreFilter, PxSetupDrivableShapeQueryFilterData, PxSetupNonDrivableShapeQueryFilterData, PxSetupVehicleShapeQueryFilterData. See SampleVehicle_SceneQuery.h for their implementation in SampleVehicle. +* PxVehicle4WSimpleSetup and PxCreateVehicle4WSimulationData have been removed and replaced with default values in vehicle components, see PxVehicleComponents.h. +* PxVehicle4WTelemetryData has been replaced with PxVehicleTelemetryData, a class that supports vehicles with any number of wheels, see PxVehicleTelemetryData +* PxVehicleDrivableSurfaceType no longer stored in PxMaterial::userData. A hash table of PxMaterial pointers is instead used to associate each PxMaterial with a PxVehicleDrivableSurfaceType, see PxVehicleDrivableSurfaceToTireFrictionPairs. +* PxVehicleTyreData::mLongitudinalStiffness has been replaced with PxVehicleTireData::mLongitudinalStiffnessPerUnitGravity, see PxVehicleTireData. +* Tire forces now computed from a shader to allow user-specified tire force functions, see PxVehicleTireForceCalculator. +* Added helper functions to quickly configure 3-wheeled cars, see PxVehicle4WEnable3WTadpoleMode, PxVehicle4WEnable3WDeltaMode. + + +#### Serialization + +* Changed the functions PxPhysics::releaseUserReferences(), releaseCollection(), addCollection() and releaseCollected() to now take a reference rather than a pointer. +* Platform conversion for serialized data has been moved from the ConvX command line tool to the PxBinaryConverter interface in the cooking library. +* Changed some functions in RepXUtility.h and RepX.h to take a reference rather than a pointer. + + + +#### What we removed: + +* Deformables have been removed. Use the optimized solution for clothing simulation instead (see documentation on PxCloth for details). +* PxSweepCache was replaced with PxVolumeCache. +* PVD is no longer enabled in the release build. +* Removed anisotropic friction. +* Removed the CCD mode eSWEPT_CONTACT_PAIRS. +* PxActorDesc has been removed. +* The ConvX tool has been removed. +* Removed empty default implementations of functions in PxSimulationEventCallback for consistency and because it can create bugs in user code if function prototypes change between releases. Users must now supply (eventually blank) implementations for all functions. +* Octree and quadtree pruning structures have been removed. + + +#### Fixed Bugs + +* PxScene::getActors() might not work properly when the startIndex parameter is used. +* Improved the doc-comment of PxConvexMesh::getMassInformation(). +* RepX instantiation can lose all internal references when addOriginalIdsToObjectMap is false. +* PxSetGroup crashed when used on a compound. +* PhysXCommon.dll can be delay loaded. +* ContactReportStream can now handle huge report numbers and size (resize-able flag) can be set in PxSceneDesc.h. +* Fixed assert in sweep tests. +* Concurrent read/write operations during a PxScene::fetchResults() call were not detected properly and no warning message got sent in checked builds. Forbidden write operations during callbacks triggered by PxScene::fetchResults() (contact/trigger reports etc.) were not covered either. +* Fixed crash bug that occurred during collision detection when more than 16K of contact data was generated. Contacts that generate more than 16K of contact data are now fully supported. +* Fixed crash bug when PhysX Visual Debugger is connected and an object gets modified and then released while the simulation is running. + + + + +## Supported Platforms + + +#### Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android (version 2.2 or later for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver ver 295.73 or later is required for GPU acceleration) +* Microsoft XBox 360 +* Sony Playstation 3 +* Sony Playstation Vita + +#### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010 +* Xcode 4.2 + + + +## Known Issues And Limitations + + + +#### Binary Serialization + +* Meta data generation for PxParticleFluid and PxParticleSystem serializables currently fails. +* For collections that contain jointed rigid bodies all corresponding joints need to be added as well, otherwise deserialization will fail. + +#### Rigid Body Simulation + +* Capsules and spheres can struggle to come to rest on even perfectly flat surfaces. To ensure these objects come to rest, it is necessary to increase angular damping on rigid bodies made of these shapes. In addition, flagging the capsule/sphere's material with physx::PxMaterialFlag::eDISABLE_STRONG_FRICTION can help bring these shapes to rest. + +#### Character Cloth Sample + +* An NVIDIA GPU with Compute Capability 2.0 or higher is required for GPU accelerated simulation in the SampleCharacterCloth sample, if no such device is present then simulation will be performed on the CPU. +* Note that this is not a general SDK requirement, the clothing SDK supports cards with Compute Capability < 2.0 but with limitations on mesh size. + +#### Character Controller + +* Releasing shapes of actors that are in touch with a character controller may lead to crashes. Releasing whole actors doesn't lead to the same problems. PxController::invalidateCache() can be used to work around these issues. + + + + + +Please also see the previous lists from 3.1.1 and earlier. + + + + + + + + +# v3.1.2 + +December 2011 + +## What's New In NVIDIA PhysX 3.1.2 + + +#### General + +* Fixed wrong write/read clash checks. +* Removed some compiler warnings from public header files. +* Fixed PxScene::getActors() returning wrong actors when a start index is specified. + + + +#### Rigid Bodies + +* Fixed broken joint projection in connection with kinematics. +* Fixed inaccurate normals returned from height field scene queries. +* Fixed a crash when the geometry of a shape changes and then the actor gets removed from the scene while the simulation is running. +* Fixed a crash when re-adding scene-query shape actors to scene. + + + +#### Particles + +* Fixed crash bug in particle simulation code on GPU. + + + +#### Cloth + +* Fixed a crash when GPU fabrics are shared between cloths. +* Fixed a hang in cloth fiber cooker when handed non-manifold geometry. + + +#### Samples + +* Fixed SampleVehicles doing an invalid write. +* Fixed SampleVehicle jitter in profile build. + + + + +## Supported Platforms (available in separate packages) + + +Unchanged from from 3.1.1. + + +## Known Issues And Limitations + + +Unchanged from from 3.1. + + + + + + + + +# v3.1.1 + +November 2011 + +## What's New In NVIDIA PhysX 3.1.1 + + +#### General + +* Ported samples to Linux. +* Fixed crash bug in ConvX. +* Fixed crash bug in the allocator code of PXC_NP_MEM_BLOCK_EXTENSIBLE. +* Fixed crash bug when connected to PVD on various platforms. +* Fixed bogus asserts due to overly strict validation of quaternions. +* Fixed one frame lag in PVD scene statistics. +* Fixed a number of OSX PVD sockets issues. +* Fixed SampleSubmarine code that violated concurrent read/writes restriction. +* Added warnings about read/write hazards to the checked build. +* Fixed RepX not reading joint properties. +* Fixed support for concurrent scene queries. +* Fixed PhysX GPU Visual Indicator support. +* Made it more clear in documentation that simulate(0) is not allowed. + + +#### Rigid Bodies + +* eNOTIFY_TOUCH_LOST trigger events do now get reported if one of the objects in contact gets deleted (see documentation of PxTriggerPair for details). +* Dynamic rigid bodies with trigger shapes only do not wake up other touching bodies anymore. +* Added lost touch events for trigger reports when objects get deleted. +* Fixed dynamic triggers waking up actors they are triggered by. +* Removed an inapropriate assert from articulation code. +* Fixed problem with the angular momentum conservation of articulations. +* Fixed articulation sleep problems. +* Fixed a linear velocity related bug in CCD. +* Fixed crash bug CCD. +* Optimized performance of joint information being sent to PVD. + + + + +## Supported Platforms (available in separate packages) + + +#### Runtime + +* Microsoft Windows XP or later +* Microsoft XBox 360 +* Sony Playstation 3 +* Android 2.2 or later for SDK, 2.3 or later required for samples +* Linux (tested on Ubuntu) +* Mac OS X + +#### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010 +* Xcode 3 + + + +## Known Issues And Limitations + + +Unchanged from from 3.1. + + + + + + + + +# v3.1 + +September 2011 + +## What's New In NVIDIA PhysX 3.1 + + +#### General + +* VC10 support has been introduced. +* VC8 support has been discontinued. +* Namespaces cleaned up. +* Extensions, Character Controller and Vehicle source code made available in binary distribution. +* Added x86,x64 suffix to PxTaskCUDA.dll +* Removed boolean return value from PxScene::addActor(...), and similar API calls. +* Added MacOS, Android and Linux to the list of supported platforms. See Supported Platforms below for details. +* Upgraded GPU tech to CUDA 4. +* Cleaned up a large number of warnings at C++ warning level 4, and set SDK to compile with warnings as errors. +* Removed individual sample executables in favor of one Samples executable from PC and console builds. +* Fixed alpha blending in samples. +* Simplified some code in samples. +* Improved ambient lighting in samples. +* Made samples work with older graphics cards. +* Improved and added more content the user's guide. +* No longer passing NULL pointers to user allocator to deallocate. +* Various improvements to Foundation and classes shared with APEX. + +#### Rigid Bodies + +* Rigid Body: High performance alternative convex narrow phase code available to source licensees. See PERSISTENT_CONTACT_MANIFOLD in the code. +* Significant advancements in the continuous collision detection algorithm. +* Optimizations and robustness improvements for articulations. +* Added some helper code to the API. +* Added sleep code for articulations. +* Added support for vehicles with more than one chassis shape. +* Solver iteration count for articulations. +* Articulation limit padding configurable. +* The reference count of meshes does now take the application's reference into acount as well and thus has increased by 1 (it used to count the number of objects referencing the mesh only). Note that a mesh does only get destroyed and removed from the list of meshes once the reference count reaches 0. +* Fixed autowake parameter sometimes being ignored. +* Constraint solver optimizations. +* Improved behavior of character controller on steep slopes. +* Binary serialization now saves names. +* Removed some descriptors from API. +* Removed the angular velocity term in the joint positional drive error formula. +* Fixed bug in capsule sweep versus mesh. +* Fixed a crash bug in the tire model. +* Fixed crashing of single link articulations. +* Fixed bug related to removing elements of an aggregate. +* Fixed swapped wheel graphs in sample vehicle. +* Fixed some slow moving bodies falling asleep in midair. +* Fixed missing collisions after a call to resetFiltering. +* Fixed broken autowake option in setAngularVelocity. +* Fixed D6 joint linear limits being uninitialized. +* A large number of misc. bug fixes and optimizations. +* Improved documentation and error messages associated with running out of narrow phase buffer blocks. +* Added articulation documentation. +* Expanded manual sections on joints. +* Improved reference doc for PxSceneQueryHitType. +* Added reference doc for PxSerializable. + + +#### Particles + +* Particle index allocation removed from SDK. Added index allocation pool to extensions. +* Replaced GPU specific side band API PxPhysicsGpu and PxPhysics::getPhysicsGpu() with PxParticleGpu. +* Memory optimizations on all platforms and options to reduce memory usage according to use case with new per particle system flags: + + * PxParticleBaseFlag::eCOLLISION_WITH_DYNAMIC_ACTORS + * PxParticleBaseFlag::ePER_PARTICLE_COLLISION_CACHE_HINT + + +* Fixed rare crash appearing with multi-threaded non-GPU particle systems and rigid bodies. +* Fixed particles leaking through triangle mesh geometry on GPU. +* Fixed fast particles tunneling through scene geometry in some cases. +* Fixed erroneous collision of particles with teleporting rigid shapes (setGlobalPose). +* Fixed particle sample behavior with some older GPU models. +* Fixed a GPU particle crash bug. + + + +#### Cloth + +* A new solution for simulating cloth and clothing. + + + +#### Deformables + +* Deformables are deprecated and will be removed in the next release. There is a new optimized solution for clothing simulation (see documentation on PxCloth for details). + + + +## Supported Platforms (available in separate packages) + + +#### Runtime + +* Microsoft Windows XP or later +* Microsoft XBox 360 +* Sony Playstation 3 +* Android 2.2 or later for SDK, 2.3 or later required for samples +* Linux (SDK tested on Ubuntu, samples not yet ported) +* Mac OS X + +#### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010 +* Xcode 3 + + + +## Known Issues And Limitations + + +#### General + +* Under VC10, you may get warnings due to conflicting build configuration flags. Workaround: Clear the "Inherit from parent or project defaults" flag for all projects in Project->Properties->C/C++->Command Line. We plan to fix this for the 3.1 general availability release. + +#### Scene Query + +* Querying the scene (e.g. using raycastSingle()) from multiple threads simultaneously is not safe. + +#### Cloth + +* Even simple parameters of a PxCloth can not be set or accessed while the simulation is running. + +#### RepX + +* RepX fails to load elements of aggregate joint parameters (PxD6JointDrive etc.) + + + + +Please also see the previous lists from 3.0. + + + + + + + + +# v3.0 + +February 14th2011 + +## What's New In NVIDIA PhysX 3.0 + + +#### General + +This third major version of the SDK is a significant rewrite of the entire technology. We did away with a large amount of legacy clutter and replaced them with a wealth of new features and improvements. +Because even the API changes are so significant, it is easier to see it as a whole new product rather than a long list of changes. + +#### What we removed: + +* The dedicated NVIDIA PhysX PPU hardware is not supported any more. +* Scene compartments are not supported anymore. All created physical objects are now part of one and the same compartment. +* Force fields are not part of the NVIDIA PhysX SDK anymore. +* Splitting a simulation timestep into multiple substeps is not a functionality of the NVIDIA PhysX SDK any longer and has to be implemented above the SDK. + + +#### Key new features: + +* Articulations: A way to create very stiff joint assemblies. +* Serialization: Save objects in a binary format and load them back quickly! +* Broad Phase Clustering: Put objects that belong together into a single broadphase volume. +* Driverless Model: No need to worry about system software on PC anymore. +* Dynamic Character Controller: A character controller that can robustly walk on dynamic objects. +* Vehicle Library: A toolkit to make vehicles, including an all new tire model. +* Non-Simulation Objects: A staging are outside of the simulation from where you can add things into the simulation at high speed. +* Simulation Task Manager: Take control of the management of simulation tasks. +* Stable Depenetration: Large penetrations can be gracefully recovered from. +* Double Buffering: You can read from and write to the simulated objects while the simulation is running on another thread. +* Mesh Scaling: Create different nonuniformly scaled instances of your meshes and convexes without duplicating the memory. +* Distance Based Collision Detection: Have the simulation create contacts before objects touch, and do away with unsightly overlaps. +* Fast Continuous Collision Detection: Have small and high speed objects collide correctly without sacrificing performance. +* Significantly increased performance and memory footprint, especially on consoles. +* Unified solver for deformables and rigid bodies for great interaction. +* Triangle collision detection with deformables. +* Support for our new Physics Visual Debugger, including integrated profiling. + + + +#### Math classes + +* Matrix based transforms have been replaced by quaternions. +* All angles are now expressed in radians. IN PARTICULAR the PxQuat constructor from axis and angle as well as the getAngleAxis and fromAngleAxis methods now use radians rather than degrees. + + + +#### Rigid Bodies + +* Capsules are now defined to extend along the x rather than the y axis. +* Triangle meshes do not support heightfield functionality anymore. Use the dedicated PxHeightField class instead. +* Dynamic triangle mesh actors are not supported any longer. However, you can decompose your mesh into convex parts and create a dynamic actor consisting of these convex parts. +* The deprecated heightfield property NxHeightFieldDesc::verticalExtent is not supported any longer. Please use the PxHeightFieldDesc::thickness parameter instead. +* NxSpringAndDamperEffector is not supported anymore. Use PxDistanceJoint instead. +* Joints are now part of the PhysX extensions library (PhysXExtensions). +* Wheel shapes have been replaced by the more flexible entity PxWheel. A default wheel implementation, encapsulating most of the old wheel functionality, can be found in the PhysX extensions library (see PxDefaultWheel). +* The NxUtilLib library has been removed. Sweep/overlap/raycast tests and other helper methods can be found in the new GeomUtils library. +* Materials can no longer be accessed through indices. Per triangle material meshes need a material table which can be specified per shape (see PxShape::setMaterials() for details). +* The default material is not available anymore. + + +#### Particle Systems, Particle Fluids + +* The NxFluid class has been replaced with two classes for separation of functionality and ease of use. + + * PxParticleSystem: Particles colliding against the scene. + * PxParticleFluid: Particles simulating a fluid (sph). + + +* Simplified parameterization for particle systems. + + * Using absolute distances instead of relative multipliers to rest spacing + * Simplified sph parameters + * Unified collision parameters with deformable and rigid body features + + +* Creating and releasing particles is now fully controlled by the application. + + * Particle lifetime management isn't provided through the SDK anymore. + * Emitters have been removed from the SDK. + * Drain shapes don't cause particles to be deleted directly, but to be flagged instead. + * Initial particle creation from the particle system descriptor isn't supported anymore. + + +* Particle data buffer handling has been moved to the SDK. +* Per particle collision rest offset. +* GPU accelerated particle systems. + + * Application controllable mesh mirroring to device memory. + * Runtime switching between software and GPU accelerated implementation. + + + + + +## Supported Platforms (available in separate packages) + + +#### Runtime + +* Microsoft Windows XP or and later +* Microsoft XBox360 +* Sony Playstation 3 + +#### Development + +* Microsoft Windows XP or and later +* Microsoft Visual Studio 2008 + + + +## Known Issues And Limitations + + +#### Rigid Bodies + +* Adding or removing a PxAggregate object to the scene is not possible while the simulation is running. + +#### Particle Systems + +* Releasing the Physics SDK may result in a crash when using GPU accelerated particle systems. +* This can be avoided by doing the following before releasing the Physics SDK: + + * Releasing the PxScene objects that contain the GPU accelerated particle systems. + * Releasing application mirrored meshes by calling PxPhysicsGpu::releaseTriangleMeshMirror(...), PxPhysicsGpu::releaseHeightFieldMirror(...) or PxPhysicsGpu::releaseConvexMeshMirror(...). + + diff --git a/engine/third_party/physx/README.md b/engine/third_party/physx/README.md new file mode 100644 index 00000000..2feaa8fc --- /dev/null +++ b/engine/third_party/physx/README.md @@ -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
opengl-linux | +| Mesa 3-D graphics library | Brian Paul | opengl-linux | +| RapidJSON | THL A29 Limited, a Tencent company, and Milo Yip
Alexander Chemeris (msinttypes) | rapidjson | +| OpenGL Ext Wrangler Lib | Nigel Stewart, Milan Ikits, Marcelo E. Magallon, Lev Povalahev | [SDK_ROOT]/snippets/graphics | diff --git a/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PVDRuntime_64.dll b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PVDRuntime_64.dll new file mode 100644 index 00000000..216cb8aa Binary files /dev/null and b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PVDRuntime_64.dll differ diff --git a/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PVDRuntime_64.lib b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PVDRuntime_64.lib new file mode 100644 index 00000000..d80040d5 Binary files /dev/null and b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PVDRuntime_64.lib differ diff --git a/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCommon_64.dll b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCommon_64.dll new file mode 100644 index 00000000..411cb572 Binary files /dev/null and b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCommon_64.dll differ diff --git a/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCommon_64.lib b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCommon_64.lib new file mode 100644 index 00000000..1134dc5c Binary files /dev/null and b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCommon_64.lib differ diff --git a/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCooking_64.dll b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCooking_64.dll new file mode 100644 index 00000000..25617923 Binary files /dev/null and b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCooking_64.dll differ diff --git a/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCooking_64.lib b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCooking_64.lib new file mode 100644 index 00000000..02206453 Binary files /dev/null and b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXCooking_64.lib differ diff --git a/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXExtensions_static_64.lib b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXExtensions_static_64.lib new file mode 100644 index 00000000..c4402b84 Binary files /dev/null and b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXExtensions_static_64.lib differ diff --git a/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXFoundation_64.dll b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXFoundation_64.dll new file mode 100644 index 00000000..e2481018 Binary files /dev/null and b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXFoundation_64.dll differ diff --git a/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXFoundation_64.lib b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXFoundation_64.lib new file mode 100644 index 00000000..edcdccf5 Binary files /dev/null and b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXFoundation_64.lib differ diff --git a/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXPvdSDK_static_64.lib b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXPvdSDK_static_64.lib new file mode 100644 index 00000000..ed669243 Binary files /dev/null and b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXPvdSDK_static_64.lib differ diff --git a/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXTask_static_64.lib b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXTask_static_64.lib new file mode 100644 index 00000000..4ae50b90 Binary files /dev/null and b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysXTask_static_64.lib differ diff --git a/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysX_64.dll b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysX_64.dll new file mode 100644 index 00000000..33a3241e Binary files /dev/null and b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysX_64.dll differ diff --git a/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysX_64.lib b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysX_64.lib new file mode 100644 index 00000000..46fa8d3d Binary files /dev/null and b/engine/third_party/physx/bin/win.x86_64.vc143.md/debug/PhysX_64.lib differ diff --git a/engine/third_party/physx/buildtools/cmake_generate_projects.py b/engine/third_party/physx/buildtools/cmake_generate_projects.py new file mode 100644 index 00000000..6f6f6854 --- /dev/null +++ b/engine/third_party/physx/buildtools/cmake_generate_projects.py @@ -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() diff --git a/engine/third_party/physx/buildtools/packman/bootstrap/configure.bat b/engine/third_party/physx/buildtools/packman/bootstrap/configure.bat new file mode 100644 index 00000000..265f1e4a --- /dev/null +++ b/engine/third_party/physx/buildtools/packman/bootstrap/configure.bat @@ -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 diff --git a/engine/third_party/physx/buildtools/packman/bootstrap/download_file_from_url.ps1 b/engine/third_party/physx/buildtools/packman/bootstrap/download_file_from_url.ps1 new file mode 100644 index 00000000..df557456 --- /dev/null +++ b/engine/third_party/physx/buildtools/packman/bootstrap/download_file_from_url.ps1 @@ -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 \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd b/engine/third_party/physx/buildtools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd new file mode 100644 index 00000000..bf3a88d5 --- /dev/null +++ b/engine/third_party/physx/buildtools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd @@ -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 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 \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/packman/bootstrap/generate_temp_file_name.ps1 b/engine/third_party/physx/buildtools/packman/bootstrap/generate_temp_file_name.ps1 new file mode 100644 index 00000000..aa3f0048 --- /dev/null +++ b/engine/third_party/physx/buildtools/packman/bootstrap/generate_temp_file_name.ps1 @@ -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 diff --git a/engine/third_party/physx/buildtools/packman/bootstrap/generate_temp_folder.ps1 b/engine/third_party/physx/buildtools/packman/bootstrap/generate_temp_folder.ps1 new file mode 100644 index 00000000..d34fc9ca --- /dev/null +++ b/engine/third_party/physx/buildtools/packman/bootstrap/generate_temp_folder.ps1 @@ -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 diff --git a/engine/third_party/physx/buildtools/packman/bootstrap/install_package.py b/engine/third_party/physx/buildtools/packman/bootstrap/install_package.py new file mode 100644 index 00000000..4542c4be --- /dev/null +++ b/engine/third_party/physx/buildtools/packman/bootstrap/install_package.py @@ -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) diff --git a/engine/third_party/physx/buildtools/packman/config.packman.xml b/engine/third_party/physx/buildtools/packman/config.packman.xml new file mode 100644 index 00000000..a878a6dd --- /dev/null +++ b/engine/third_party/physx/buildtools/packman/config.packman.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/engine/third_party/physx/buildtools/packman/packman b/engine/third_party/physx/buildtools/packman/packman new file mode 100644 index 00000000..479f3bbb --- /dev/null +++ b/engine/third_party/physx/buildtools/packman/packman @@ -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 diff --git a/engine/third_party/physx/buildtools/packman/packman.cmd b/engine/third_party/physx/buildtools/packman/packman.cmd new file mode 100644 index 00000000..e55b2f0e --- /dev/null +++ b/engine/third_party/physx/buildtools/packman/packman.cmd @@ -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% diff --git a/engine/third_party/physx/buildtools/packman/python.bat b/engine/third_party/physx/buildtools/packman/python.bat new file mode 100644 index 00000000..87373153 --- /dev/null +++ b/engine/third_party/physx/buildtools/packman/python.bat @@ -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%" %* \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/packman/python.sh b/engine/third_party/physx/buildtools/packman/python.sh new file mode 100644 index 00000000..3d8e8d11 --- /dev/null +++ b/engine/third_party/physx/buildtools/packman/python.sh @@ -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}" "$@" diff --git a/engine/third_party/physx/buildtools/presets/public/linux-aarch64-clang-cpu-only.xml b/engine/third_party/physx/buildtools/presets/public/linux-aarch64-clang-cpu-only.xml new file mode 100644 index 00000000..be5527cc --- /dev/null +++ b/engine/third_party/physx/buildtools/presets/public/linux-aarch64-clang-cpu-only.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/presets/public/linux-aarch64-clang.xml b/engine/third_party/physx/buildtools/presets/public/linux-aarch64-clang.xml new file mode 100644 index 00000000..362d6287 --- /dev/null +++ b/engine/third_party/physx/buildtools/presets/public/linux-aarch64-clang.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/presets/public/linux-aarch64-gcc-cpu-only.xml b/engine/third_party/physx/buildtools/presets/public/linux-aarch64-gcc-cpu-only.xml new file mode 100644 index 00000000..773245b8 --- /dev/null +++ b/engine/third_party/physx/buildtools/presets/public/linux-aarch64-gcc-cpu-only.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/presets/public/linux-aarch64-gcc.xml b/engine/third_party/physx/buildtools/presets/public/linux-aarch64-gcc.xml new file mode 100644 index 00000000..a8713c51 --- /dev/null +++ b/engine/third_party/physx/buildtools/presets/public/linux-aarch64-gcc.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/presets/public/linux-clang-cpu-only.xml b/engine/third_party/physx/buildtools/presets/public/linux-clang-cpu-only.xml new file mode 100644 index 00000000..1987ffc2 --- /dev/null +++ b/engine/third_party/physx/buildtools/presets/public/linux-clang-cpu-only.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/presets/public/linux-clang.xml b/engine/third_party/physx/buildtools/presets/public/linux-clang.xml new file mode 100644 index 00000000..3a9f4a73 --- /dev/null +++ b/engine/third_party/physx/buildtools/presets/public/linux-clang.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/presets/public/linux-gcc-cpu-only.xml b/engine/third_party/physx/buildtools/presets/public/linux-gcc-cpu-only.xml new file mode 100644 index 00000000..e48edc3c --- /dev/null +++ b/engine/third_party/physx/buildtools/presets/public/linux-gcc-cpu-only.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/presets/public/linux-gcc.xml b/engine/third_party/physx/buildtools/presets/public/linux-gcc.xml new file mode 100644 index 00000000..1913e5fa --- /dev/null +++ b/engine/third_party/physx/buildtools/presets/public/linux-gcc.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/presets/public/vc16win64-cpu-only.xml b/engine/third_party/physx/buildtools/presets/public/vc16win64-cpu-only.xml new file mode 100644 index 00000000..f67b2afb --- /dev/null +++ b/engine/third_party/physx/buildtools/presets/public/vc16win64-cpu-only.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/presets/public/vc16win64.xml b/engine/third_party/physx/buildtools/presets/public/vc16win64.xml new file mode 100644 index 00000000..6ba69051 --- /dev/null +++ b/engine/third_party/physx/buildtools/presets/public/vc16win64.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/presets/public/vc17win64-cpu-only.xml b/engine/third_party/physx/buildtools/presets/public/vc17win64-cpu-only.xml new file mode 100644 index 00000000..2ac95ac6 --- /dev/null +++ b/engine/third_party/physx/buildtools/presets/public/vc17win64-cpu-only.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/presets/public/vc17win64.xml b/engine/third_party/physx/buildtools/presets/public/vc17win64.xml new file mode 100644 index 00000000..86693a2e --- /dev/null +++ b/engine/third_party/physx/buildtools/presets/public/vc17win64.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/presets/vc17win64-cpu-only.user.xml b/engine/third_party/physx/buildtools/presets/vc17win64-cpu-only.user.xml new file mode 100644 index 00000000..eb6942c6 --- /dev/null +++ b/engine/third_party/physx/buildtools/presets/vc17win64-cpu-only.user.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/engine/third_party/physx/buildtools/steps/build_linux.sh b/engine/third_party/physx/buildtools/steps/build_linux.sh new file mode 100644 index 00000000..ef1f09d8 --- /dev/null +++ b/engine/third_party/physx/buildtools/steps/build_linux.sh @@ -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 . 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 diff --git a/engine/third_party/physx/buildtools/steps/build_win_x86_64.bat b/engine/third_party/physx/buildtools/steps/build_win_x86_64.bat new file mode 100644 index 00000000..72323f13 --- /dev/null +++ b/engine/third_party/physx/buildtools/steps/build_win_x86_64.bat @@ -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 ) \ No newline at end of file diff --git a/engine/third_party/physx/buildtools/templates/PxIncludeTemplate.h b/engine/third_party/physx/buildtools/templates/PxIncludeTemplate.h new file mode 100644 index 00000000..4159d608 --- /dev/null +++ b/engine/third_party/physx/buildtools/templates/PxIncludeTemplate.h @@ -0,0 +1,8 @@ +${BOILERPLATE_CONTENT} + +#ifndef PX_${HEADER_GUARD_NAME} +#define PX_${HEADER_GUARD_NAME} + +${HEADER_CONTENT} + +#endif // PX_${HEADER_GUARD_NAME} diff --git a/engine/third_party/physx/buildtools/templates/boilerplate_bsd.txt b/engine/third_party/physx/buildtools/templates/boilerplate_bsd.txt new file mode 100644 index 00000000..624775b3 --- /dev/null +++ b/engine/third_party/physx/buildtools/templates/boilerplate_bsd.txt @@ -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. \ No newline at end of file diff --git a/engine/third_party/physx/dependencies.xml b/engine/third_party/physx/dependencies.xml new file mode 100644 index 00000000..94562036 --- /dev/null +++ b/engine/third_party/physx/dependencies.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/engine/third_party/physx/generate_projects.bat b/engine/third_party/physx/generate_projects.bat new file mode 100644 index 00000000..d46edb72 --- /dev/null +++ b/engine/third_party/physx/generate_projects.bat @@ -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=Sleeping: + Raising this flag will set all velocities and the wake counter to 0, clear all forces, clear the kinematic target, put the actor + to sleep and wake up all touching actors from the previous frame. + */ + eDISABLE_SIMULATION = (1<<3) + }; +}; + +/** +\brief collection of set bits defined in PxActorFlag. + +\see PxActorFlag +*/ +typedef PxFlags PxActorFlags; +PX_FLAGS_OPERATORS(PxActorFlag::Enum,PxU8) + +/** +\brief Identifies each type of actor. +\see PxActor +*/ +struct PxActorType +{ + enum Enum + { + /** + \brief A static rigid body + \see PxRigidStatic + */ + eRIGID_STATIC, + + /** + \brief A dynamic rigid body + \see PxRigidDynamic + */ + eRIGID_DYNAMIC, + + /** + \brief An articulation link + \see PxArticulationLink + */ + eARTICULATION_LINK, + + /** + \brief A 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. + + Default: NULL + + \see getName() + */ + virtual void setName(const char* name) = 0; + + /** + \brief Retrieves the name string set with setName(). + + \return Name string associated with object. + + \see setName() + */ + virtual const char* getName() const = 0; + + /** + \brief Retrieves the axis aligned bounding box enclosing the actor. + + \note It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + in PxContactModifyCallback or in contact report callbacks). + + \param[in] inflation Scale factor for computed world bounds. Box extents are multiplied by this value. + + \return The actor's bounding box. + + \see PxBounds3 + */ + virtual PxBounds3 getWorldBounds(float inflation=1.01f) const = 0; + + /** + \brief Raises or clears a particular actor flag. + + See the list of flags #PxActorFlag + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] flag The PxActor flag to raise(set) or clear. See #PxActorFlag. + \param[in] value The boolean value to assign to the flag. + + \see PxActorFlag getActorFlags() + */ + virtual void setActorFlag(PxActorFlag::Enum flag, bool value) = 0; + + /** + \brief Sets the actor flags. + + See the list of flags #PxActorFlag + \see PxActorFlag setActorFlag() + */ + virtual void setActorFlags( PxActorFlags inFlags ) = 0; + + /** + \brief Reads the PxActor flags. + + See the list of flags #PxActorFlag + + \return The values of the PxActor flags. + + \see PxActorFlag setActorFlag() + */ + virtual PxActorFlags getActorFlags() const = 0; + + /** + \brief Assigns dynamic actors a dominance group identifier. + + PxDominanceGroup is a 5 bit group identifier (legal range from 0 to 31). + + The PxScene::setDominanceGroupPair() lets you set certain behaviors for pairs of dominance groups. + By default every dynamic actor is created in group 0. + + Default: 0 + + Sleeping: Changing the dominance group does NOT wake the actor up automatically. + + \param[in] dominanceGroup The dominance group identifier. Range: [0..31] + + \see getDominanceGroup() PxDominanceGroup PxScene::setDominanceGroupPair() + */ + virtual void setDominanceGroup(PxDominanceGroup dominanceGroup) = 0; + + /** + \brief Retrieves the value set with setDominanceGroup(). + + \return The dominance group of this actor. + + \see setDominanceGroup() PxDominanceGroup PxScene::setDominanceGroupPair() + */ + virtual PxDominanceGroup getDominanceGroup() const = 0; + + /** + \brief Sets the owner client of an actor. + + This cannot be done once the actor has been placed into a scene. + + Default: PX_DEFAULT_CLIENT + + \see PxClientID PxScene::createClient() + */ + virtual void setOwnerClient( PxClientID inClient ) = 0; + + /** + \brief Returns the owner client that was specified at creation time. + + This value cannot be changed once the object is placed into the scene. + + \see PxClientID PxScene::createClient() + */ + virtual PxClientID getOwnerClient() const = 0; + + /** + \brief Retrieves the aggregate the actor might be a part of. + + \return The aggregate the actor is a part of, or NULL if the actor does not belong to an aggregate. + + \see PxAggregate + */ + virtual PxAggregate* getAggregate() const = 0; + +/************************************************************************************************/ +/** \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. + + Default: 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 diff --git a/engine/third_party/physx/include/PxAggregate.h b/engine/third_party/physx/include/PxAggregate.h new file mode 100644 index 00000000..1603de55 --- /dev/null +++ b/engine/third_party/physx/include/PxAggregate.h @@ -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. + + Default: 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 diff --git a/engine/third_party/physx/include/PxAnisotropy.h b/engine/third_party/physx/include/PxAnisotropy.h new file mode 100644 index 00000000..8baa3ff2 --- /dev/null +++ b/engine/third_party/physx/include/PxAnisotropy.h @@ -0,0 +1,218 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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& gpuParticleSystem, CUstream stream) + { + if (mAnistropyGenerator) + { + mAnistropyGenerator->generateAnisotropy(gpuParticleSystem.mDevicePtr, gpuParticleSystem.mHostPtr->mCommonData.mMaxParticles, stream); + } + } + + virtual void onBegin(const PxGpuMirroredPointer& /*gpuParticleSystem*/, CUstream /*stream*/) { } + + virtual void onAdvance(const PxGpuMirroredPointer& /*gpuParticleSystem*/, CUstream /*stream*/) { } + + private: + PxAnisotropyGenerator* mAnistropyGenerator; + }; + +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxArrayConverter.h b/engine/third_party/physx/include/PxArrayConverter.h new file mode 100644 index 00000000..37bd4ef4 --- /dev/null +++ b/engine/third_party/physx/include/PxArrayConverter.h @@ -0,0 +1,74 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 diff --git a/engine/third_party/physx/include/PxArticulationFlag.h b/engine/third_party/physx/include/PxArticulationFlag.h new file mode 100644 index 00000000..1fe6f3e2 --- /dev/null +++ b/engine/third_party/physx/include/PxArticulationFlag.h @@ -0,0 +1,74 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PxArticulationCacheFlags; + PX_FLAGS_OPERATORS(PxArticulationCacheFlag::Enum, PxU32) + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/engine/third_party/physx/include/PxArticulationJointReducedCoordinate.h b/engine/third_party/physx/include/PxArticulationJointReducedCoordinate.h new file mode 100644 index 00000000..4e594671 --- /dev/null +++ b/engine/third_party/physx/include/PxArticulationJointReducedCoordinate.h @@ -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. + Default: The identity transform. + + \note This call is not allowed while the simulation is running. + + \see getParentPose + */ + virtual void setParentPose(const PxTransform& pose) = 0; + + /** + \brief Gets the joint pose in the parent link actor frame. + + \return The joint pose. + + \see setParentPose + */ + virtual PxTransform getParentPose() const = 0; + + /** + \brief Gets the child articulation link of this joint. + + \return The child link. + */ + virtual PxArticulationLink& getChildArticulationLink() const = 0; + + /** + \brief Sets the joint pose in the child link actor frame. + + \param[in] pose The joint pose. + Default: The identity transform. + + \note This call is not allowed while the simulation is running. + + \see getChildPose + */ + virtual void setChildPose(const PxTransform& pose) = 0; + + /** + \brief Gets the joint pose in the child link actor frame. + + \return The joint pose. + + \see setChildPose + */ + virtual PxTransform getChildPose() const = 0; + + /** + \brief Sets the joint type (e.g. revolute). + + \param[in] jointType The joint type to set. + + \note Setting the joint type is not allowed while the articulation is in a scene. + In order to amend the joint type, remove and then re-add the articulation to the scene. + + Default: 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. + + Default: 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]. + + Default: (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 + + Default: 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 + + Default: 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 + + Default: 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 + + Default: 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 + + Default: 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. + + Default: 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 + + Default: 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() + + Default: 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 + + Default: 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 + + Default: 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. + + Default: NULL + + \see getName() + */ + virtual void setName(const char* name) = 0; + + /** + \brief Retrieves the name string set with setName(). + + \return Name string associated with object. + + \see setName() + */ + virtual const char* getName() const = 0; + + 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 diff --git a/engine/third_party/physx/include/PxArticulationLink.h b/engine/third_party/physx/include/PxArticulationLink.h new file mode 100644 index 00000000..f1b3c35a --- /dev/null +++ b/engine/third_party/physx/include/PxArticulationLink.h @@ -0,0 +1,208 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + + Default: 0.025 + Range: [0, 1] + + \note This call is not allowed while the simulation is running. + + \see getCfmScale + */ + virtual void setCfmScale(const PxReal cfm) = 0; + + /** + \brief Get the constraint-force-mixing scale term. + \return The constraint-force-mixing scale term. + + \see setCfmScale + */ + virtual PxReal getCfmScale() const = 0; + + /** + \brief Get the linear velocity of the link. + + - 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 diff --git a/engine/third_party/physx/include/PxArticulationMimicJoint.h b/engine/third_party/physx/include/PxArticulationMimicJoint.h new file mode 100644 index 00000000..109c72e6 --- /dev/null +++ b/engine/third_party/physx/include/PxArticulationMimicJoint.h @@ -0,0 +1,166 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 diff --git a/engine/third_party/physx/include/PxArticulationReducedCoordinate.h b/engine/third_party/physx/include/PxArticulationReducedCoordinate.h new file mode 100644 index 00000000..104ee714 --- /dev/null +++ b/engine/third_party/physx/include/PxArticulationReducedCoordinate.h @@ -0,0 +1,1546 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_RC_H +#define PX_ARTICULATION_RC_H + +#include "PxPhysXConfig.h" +#include "common/PxBase.h" +#include "foundation/PxVec3.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxTransform.h" +#include "solver/PxSolverDefs.h" +#include "PxArticulationFlag.h" +#include "PxArticulationTendon.h" +#include "PxResidual.h" +#include "PxArticulationMimicJoint.h" +#include "PxArticulationFlag.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + PX_ALIGN_PREFIX(16) + /** + \brief Data structure to represent spatial forces. + */ + struct PxSpatialForce + { + PxVec3 force; + PxReal pad0; + PxVec3 torque; + PxReal pad1; + } + PX_ALIGN_SUFFIX(16); + + PX_ALIGN_PREFIX(16) + /** + \brief Data structure to represent spatial velocities. + */ + struct PxSpatialVelocity + { + PxVec3 linear; + PxReal pad0; + PxVec3 angular; + PxReal pad1; + } + PX_ALIGN_SUFFIX(16); + + class PxConstraint; + class PxScene; + + /** + \brief Data structure used to access the root link state and acceleration. + + \see PxArticulationCache + */ + struct PxArticulationRootLinkData + { + PxTransform transform; //!< Actor transform + // The velocities and accelerations below are with respect to the center of mass (COM) of the root link. The COM and actor frame origin may not coincide. + PxVec3 worldLinVel; //!< Link linear velocity + PxVec3 worldAngVel; //!< Link angular velocity + PxVec3 worldLinAccel; //!< Link classical linear acceleration + PxVec3 worldAngAccel; //!< Link angular acceleration + }; + + /** + \brief Data structure used to read and write internal articulation data. + + \see PxArticulationCacheFlag, PxArticulationReducedCoordinate::createCache, PxArticulationReducedCoordinate::applyCache, + PxArticulationReducedCoordinate::copyInternalStateToCache + */ + class PxArticulationCache + { + public: + PxArticulationCache() : + externalForces (NULL), + denseJacobian (NULL), + massMatrix (NULL), + coriolisForce (NULL), + gravityCompensationForce (NULL), + centroidalMomentumMatrix (NULL), + centroidalMomentumBias (NULL), + jointVelocity (NULL), + jointAcceleration (NULL), + jointPosition (NULL), + jointForce (NULL), + jointTargetPositions (NULL), + jointTargetVelocities (NULL), + linkVelocity (NULL), + linkAcceleration (NULL), + linkIncomingJointForce (NULL), + linkForce (NULL), + linkTorque (NULL), + rootLinkData (NULL), + coefficientMatrix (NULL), + lambda (NULL), + scratchMemory (NULL), + scratchAllocator (NULL), + version (0) + {} + + /** + \brief Releases an articulation cache. + + \see PxArticulationReducedCoordinate::createCache, PxArticulationReducedCoordinate::applyCache, + PxArticulationReducedCoordinate::copyInternalStateToCache + */ + PX_PHYSX_CORE_API void release(); + + /** + \brief External forces acting on the articulation links for inverse dynamics computation. + + - N = getNbLinks(). + - Indexing follows the low-level link indices, see PxArticulationLink::getLinkIndex. + - The forces are with respect to the center of mass of the link. + - This field cannot be used to apply forces to links during the next PxScene::simulate() call. Use PxRigidBody::addForce and related functions instead. + + \see PxArticulationReducedCoordinate::computeGeneralizedExternalForce + */ + PxSpatialForce* externalForces; + + /** + \brief Dense Jacobian data. + + - N = nbRows * nbCols = (6 * getNbLinks()) * (6 + getDofs()) -> size includes possible floating-base DOFs regardless of PxArticulationFlag::eFIX_BASE flag. + - The links, i.e. rows are in order of the low-level link indices (minus one if PxArticulationFlag::eFIX_BASE is true), see PxArticulationLink::getLinkIndex. + The corresponding spatial velocities are stacked [vx; vy; vz; wx; wy; wz], where vx and wx refer to the linear and rotational velocity in world X. + - The DOFs, i.e. column indices correspond to the low-level DOF indices, see PxArticulationCache::jointVelocity. + + \see PxArticulationReducedCoordinate::computeDenseJacobian + */ + PxReal* denseJacobian; + + /** + \brief The generalized mass matrix used in inverse dynamics algorithms. + + - N = (getDofs() + 6) * (getDofs() + 6) -> size includes possible floating-base DOFs regardless of PxArticulationFlag::eFIX_BASE flag. + - If PxArticulationFlag::eFIX_BASE is true, the terms corresponding to the root DoFs are included in the top left block of the matrix. + For these terms, column indices correspond to linear acceleration first then angular acceleration, row indices correspond to force first then torque. + The bottom right block of the matrix corresponds to the joint DoFs terms, column indices correspond to joint acceleration, row indices correspond to joint force. + - If PxArticulationFlag::eFIX_BASE is false, only the terms corresponding to the joint DoFs are included, column indices correspond to joint acceleration, + row indices correspond to joint force. + - The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + - The mass matrix is indexed [nCols * row + column]. + + \see PxArticulationReducedCoordinate::computeMassMatrix, PxArticulationReducedCoordinate::computeGeneralizedMassMatrix + */ + PxReal* massMatrix; + + /** + \brief The Coriolis and centrifugal compensation forces used in inverse dynamics algorithms. + + - N = getDofs() + 6 -> size includes possible floating-base DOFs regardless of PxArticulationFlag::eFIX_BASE flag. + - If PxArticulationFlag::eFIX_BASE is true, the terms corresponding to the root DoFs are included at the start of + the array (force then torque), followed by the joint DoFs terms. + - If PxArticulationFlag::eFIX_BASE is false, only the terms corresponding to the joint DoFs are included. + - The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + + \see PxArticulationReducedCoordinate::computeCoriolisCompensation + */ + PxReal* coriolisForce; + + /** + \brief The gravity compensation forces used in inverse dynamics algorithms. + + - N = getDofs() + 6 -> size includes possible floating-base DOFs regardless of PxArticulationFlag::eFIX_BASE flag. + - If PxArticulationFlag::eFIX_BASE is true, the terms corresponding to the root DoFs are included at the start of + the array (force then torque), followed by the joint DoFs terms. + - If PxArticulationFlag::eFIX_BASE is false, only the terms corresponding to the joint DoFs are included. + - The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + + \see PxArticulationReducedCoordinate::computeGravityCompensation + */ + PxReal* gravityCompensationForce; + + /** + \brief The centroidal momentum matrix that maps velocities to centroidal momentum. + + - N = 6 * (getDofs() + 6). + - Each row includes first the term related to the DOF of the root (linear, then angular), then the joint DOF following the internal DOF index order, + see PxArticulationCache::jointVelocity. + - The centroidal momentum includes first the linear and then the angular contribution. + + \see PxArticulationReducedCoordinate::computeCentroidalMomentumMatrix + */ + PxReal* centroidalMomentumMatrix; + + /** + \brief The centroidal momentum bias force. This is a second-order term to calculate the derivative of the centroidal momentum. + + - N = 6. + - The centroidal momentum includes first the linear and then the angular contribution. + + \see PxArticulationReducedCoordinate::computeCentroidalMomentumMatrix + */ + PxReal* centroidalMomentumBias; + + /** + \brief The articulation joint DOF velocities. + + - N = getDofs(). + - Read/write using PxArticulationCacheFlag::eVELOCITY. + - The indexing follows the internal DOF index order. Therefore, the application should calculate the DOF data indices by summing the joint DOFs in the order of + the links' low-level indices (see the manual Section "Cache Indexing" for a snippet for this calculation): + \verbatim Low-level link index: | link 0 | link 1 | link 2 | link 3 | ... | <- PxArticulationLink::getLinkIndex() \endverbatim + \verbatim Link inbound joint DOF: | 0 | 1 | 2 | 1 | ... | <- PxArticulationLink::getInboundJointDof() \endverbatim + \verbatim Low-level DOF index: | - | 0 | 1, 2 | 3 | ... | \endverbatim + The root link always has low-level index 0 and always has zero inbound joint DOFs. The link DOF indexing follows the order in PxArticulationAxis::Enum. + For example, assume that low-level link 2 has an inbound spherical joint with two DOFs: eSWING1 and eSWING2. The corresponding low-level joint DOF indices + are therefore 1 for eSWING1 and 2 for eSWING2. + */ + PxReal* jointVelocity; + + /** + \brief The articulation joint DOF accelerations. + + - N = getDofs(). + - Read using PxArticulationCacheFlag::eACCELERATION. + - The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + - Delta joint DOF velocities can be computed from acceleration * dt. + */ + PxReal* jointAcceleration; + + /** + \brief The articulation joint DOF positions. + + - N = getDofs(). + - Read/write using PxArticulationCacheFlag::ePOSITION. + - The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + - For spherical joints, the joint position for each axis on the joint must be in range [-Pi, Pi]. + */ + PxReal* jointPosition; + + /** + \brief The articulation joint DOF forces. + + - N = getDofs(). + - Read/Write using PxArticulationCacheFlag::eFORCE. + - The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + - Applied joint forces persist and are applied each frame until changed. + */ + PxReal* jointForce; + + /** + \brief The articulation joint drive target positions. + + - N = getDofs(). + - Write using PxArticulationCacheFlag::eJOINT_TARGET_POSITIONS. + - The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + */ + PxReal* jointTargetPositions; + + /** + \brief The articulation joint drive target velocities. + + - N = getDofs(). + - Write using PxArticulationCacheFlag::eJOINT_TARGET_VELOCITIES. + - The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + */ + PxReal* jointTargetVelocities; + + /** + \brief Link spatial velocity. + + - N = getNbLinks(). + - Read using PxArticulationCacheFlag::eLINK_VELOCITY. + - The indexing follows the internal link indexing, see PxArticulationLink::getLinkIndex. + - The velocity is with respect to the link's center of mass but represented in world space. + + \see PxRigidBody::getCMassLocalPose + */ + PxSpatialVelocity* linkVelocity; + + /** + \brief Link classical acceleration. + + - N = getNbLinks(). + - Read using PxArticulationCacheFlag::eLINK_ACCELERATION. + - The indexing follows the internal link indexing, see PxArticulationLink::getLinkIndex. + - The acceleration is with respect to the link's center of mass. + + \see PxArticulationReducedCoordinate::getLinkAcceleration, PxRigidBody::getCMassLocalPose + */ + PxSpatialVelocity* linkAcceleration; + + /** + \brief Link incoming joint force, i.e. the total force transmitted from the parent link to this link. + + - N = getNbLinks(). + - Read using PxArticulationCacheFlag::eLINK_INCOMING_JOINT_FORCE. + - The indexing follows the internal link indexing, see PxArticulationLink::getLinkIndex. + - The force is reported in the child joint frame of the link's incoming joint. + + \see PxArticulationJointReducedCoordinate::getChildPose + \note The root link reports a zero spatial force. + */ + PxSpatialForce* linkIncomingJointForce; + + /** + \brief Link force, i.e. an external force applied to the link's center of mass. + + - N = getNbLinks(). + - Write using PxArticulationCacheFlag::eLINK_FORCE. + - The indexing follows the internal link indexing, see PxArticulationLink::getLinkIndex. + - The force is given in world space. + */ + PxVec3* linkForce; + + /** + \brief Link torque, i.e. an external torque applied to the link. + + - N = getNbLinks(). + - Write using PxArticulationCacheFlag::eLINK_TORQUE. + - The indexing follows the internal link indexing, see PxArticulationLink::getLinkIndex. + - The torque is given in world space. + */ + PxVec3* linkTorque; + + /** + \brief Root link transform, velocities, and accelerations. + + - N = 1. + - Read/write using PxArticulationCacheFlag::eROOT_TRANSFORM and PxArticulationCacheFlag::eROOT_VELOCITIES (accelerations are read-only). + + \see PxArticulationRootLinkData + */ + PxArticulationRootLinkData* rootLinkData; + + // Members and memory below here are not zeroed when zeroCache is called, and are not included in the size returned by PxArticulationReducedCoordinate::getCacheDataSize. + + /** + \deprecated The API related to loop joints will be removed in a future version once a replacement is made available. + + \brief Constraint coefficient matrix. + + - N = getCoefficentMatrixSize(). + - The user needs to allocate memory and set this member to the allocated memory. + + \see PxArticulationReducedCoordinate::computeCoefficientMatrix + */ + PX_DEPRECATED PxReal* coefficientMatrix; + + /** + \deprecated The API related to loop joints will be removed in a future version once a replacement is made available. + + \brief Constraint lambda values (impulses applied by the respective constraints). + + - N = getNbLoopJoints(). + - The user needs to allocate memory and set this member to the allocated memory. + + \see PxArticulationReducedCoordinate::computeLambda + */ + PX_DEPRECATED PxReal* lambda; + + void* scratchMemory; //!< The scratch memory is used for internal calculations. + void* scratchAllocator; //!< The scratch allocator is used for internal calculations. + PxU32 version; //!< The cache version used internally to check compatibility with the articulation, i.e. detect if the articulation configuration changed after the cache was created. + }; + + + /** + \brief Flag that configures articulation-state updates by PxArticulationReducedCoordinate::updateKinematic. + */ + struct PxArticulationKinematicFlag + { + enum Enum + { + ePOSITION = 1 << 0, //!< Raise after any changes to the articulation root or joint positions using non-cache API calls. Updates links' positions and velocities. + eVELOCITY = 1 << 1 //!< Raise after velocity-only changes to the articulation root or joints using non-cache API calls. Updates links' velocities. + }; + }; + + typedef physx::PxFlags PxArticulationKinematicFlags; + PX_FLAGS_OPERATORS(PxArticulationKinematicFlag::Enum, PxU8) + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4435) +#endif + + /** + \brief A tree structure of bodies connected by joints that is treated as a unit by the dynamics solver. Parametrized in reduced (joint) coordinates. + + \see PxArticulationJointReducedCoordinate, PxArticulationLink, PxPhysics::createArticulationReducedCoordinate + */ + class PxArticulationReducedCoordinate : public PxBase + { + public: + + /** + \brief Returns the scene which this articulation belongs to. + + \return Owner Scene. NULL if not part of a scene. + + \see PxScene + */ + virtual PxScene* getScene() const = 0; + + /** + \brief Sets the solver iteration counts for the articulation. + + The solver iteration count determines how accurately contacts, drives, and limits are resolved. + Setting a higher position iteration count may therefore help in scenarios where the articulation + is subject to many constraints; for example, a manipulator articulation with drives and joint limits + that is grasping objects, or several such articulations interacting through contacts. Other situations + where higher position iterations may improve simulation fidelity are: large mass ratios within the + articulation or between the articulation and an object in contact with it; or strong drives in the + articulation being used to manipulate a light object. + + If intersecting bodies are being depenetrated too violently, increase the number of velocity + iterations. More velocity iterations will drive the relative exit velocity of the intersecting + objects closer to the correct value given the restitution. + + \param[in] minPositionIters Number of position iterations the solver should perform for this articulation. Range: [1,255]. Default: 4. + \param[in] minVelocityIters Number of velocity iterations the solver should perform for this articulation. Range: [0,255]. Default: 1 + + \note This call may not be made during simulation. + + \see getSolverIterationCounts() + */ + virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) = 0; + + /** + \brief Returns the solver iteration counts. + + \see setSolverIterationCounts() + */ + virtual void getSolverIterationCounts(PxU32& minPositionIters, PxU32& minVelocityIters) const = 0; + + /** + \brief Returns true if this articulation is sleeping. + + When an actor does not move for a period of time, it is no longer simulated in order to reduce computational cost. This state + is called sleeping. However, because the object automatically wakes up when it is either touched by an awake object, + or a sleep-affecting property is changed by the user, the entire sleep mechanism should be transparent to the user. + + An articulation can only go to sleep if all links are ready for sleeping. An articulation is guaranteed to be awake + if at least one of the following holds: + + \li The wake counter of any link in the articulation is positive (see #setWakeCounter()). + \li The mass-normalized energy of any link in the articulation is above a threshold (see #setSleepThreshold()). + \li A non-zero force or torque has been applied to any joint or link. + + If an articulation is sleeping, the following state is guaranteed: + + \li The wake counter is zero. + \li The linear and angular velocity of all links is zero. + \li There is no force update pending. + + When an articulation gets inserted into a scene, it will be considered asleep if all the points above hold, else it will + be treated as awake. + + If an articulation is asleep after the call to #PxScene::fetchResults() returns, it is guaranteed that the poses of the + links were not changed. You can use this information to avoid updating the transforms of associated objects. + + \return True if the articulation is sleeping. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation, + except in a split simulation in-between #PxScene::fetchCollision and #PxScene::advance. + + \see wakeUp() putToSleep() getSleepThreshold() setSleepThreshold() + */ + virtual bool isSleeping() const = 0; + + /** + \brief Sets the mass-normalized energy threshold below which the articulation may go to sleep. + + The articulation will sleep if the energy of each link is below this threshold. + + \param[in] threshold Energy below which the articulation may go to sleep. Range: [0, PX_MAX_F32) + + \note This call may not be made during simulation. + + Default: 5e-5f * PxTolerancesScale::speed * PxTolerancesScale::speed; + + \see isSleeping() getSleepThreshold() wakeUp() putToSleep() + */ + virtual void setSleepThreshold(PxReal threshold) = 0; + + /** + \brief Returns the mass-normalized energy below which the articulation may go to sleep. + + \return The energy threshold for sleeping. + + \see isSleeping() wakeUp() putToSleep() setSleepThreshold() + */ + virtual PxReal getSleepThreshold() const = 0; + + /** + \brief Sets the mass-normalized kinetic energy threshold below which the articulation may participate in stabilization. + + Articulations whose kinetic energy divided by their mass is above this threshold will not participate in stabilization. + + This value has no effect if PxSceneFlag::eENABLE_STABILIZATION was not enabled on the PxSceneDesc. + + Default: 5e-6f * PxTolerancesScale::speed * PxTolerancesScale::speed + + \param[in] threshold Energy below which the articulation may participate in stabilization. Range: [0,inf) + + \note This call may not be made during simulation. + + \see getStabilizationThreshold() PxSceneFlag::eENABLE_STABILIZATION + */ + virtual void setStabilizationThreshold(PxReal threshold) = 0; + + /** + \brief Returns the mass-normalized kinetic energy below which the articulation may participate in stabilization. + + Articulations whose kinetic energy divided by their mass is above this threshold will not participate in stabilization. + + \return The energy threshold for participating in stabilization. + + \see setStabilizationThreshold() PxSceneFlag::eENABLE_STABILIZATION + */ + virtual PxReal getStabilizationThreshold() const = 0; + + /** + \brief Sets the wake counter for the articulation in seconds. + + - The wake counter value specifies a time threshold used to determine whether an articulation may be put to sleep. + - The articulation will be put to sleep if all links have experienced a mass-normalised energy less than a threshold for at least + a threshold time, as specified by the wake counter. + - Passing in a positive value will wake up the articulation automatically. + + Default: 0.4s (which corresponds to 20 frames for a time step of 0.02s) + + \param[in] wakeCounterValue Wake counter value in seconds. Range: [0, PX_MAX_F32) + + \note This call may not be made during simulation, except in a split simulation in-between #PxScene::fetchCollision and #PxScene::advance. + + \see isSleeping() getWakeCounter() + */ + virtual void setWakeCounter(PxReal wakeCounterValue) = 0; + + /** + \brief Returns the wake counter of the articulation in seconds. + + \return The wake counter of the articulation in seconds. + + \note This call may not be made during simulation, except in a split simulation in-between #PxScene::fetchCollision and #PxScene::advance. + + \see isSleeping() setWakeCounter() + */ + virtual PxReal getWakeCounter() const = 0; + + /** + \brief Wakes up the articulation if it is sleeping. + + - The articulation will be woken up and might cause other touching objects to wake up as well during the next simulation step. + - This will set the wake counter of the articulation to the value specified in #PxSceneDesc::wakeCounterResetValue. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation, + except in a split simulation in-between #PxScene::fetchCollision and #PxScene::advance. + + \see isSleeping() putToSleep() + */ + virtual void wakeUp() = 0; + + /** + \brief Forces the articulation to sleep. + + - The articulation will stay asleep during the next simulation step if not touched by another non-sleeping actor. + - This will set any applied force, the velocity, and the wake counter of all bodies in the articulation to zero. + + \note This call may not be made during simulation, and may only be made on articulations that are in a scene. + + \see isSleeping() wakeUp() + */ + virtual void putToSleep() = 0; + + /** + \brief Adds a link to the articulation with default attribute values. + + \param[in] parent The parent link in the articulation. Must be NULL if (and only if) this is the root link. + \param[in] pose The initial pose of the new link. Must be a valid transform. + + \return The new link, or NULL if the link cannot be created. + + \note Creating a link is not allowed while the articulation is in a scene. In order to add a link, + remove and then re-add the articulation to the scene. + + \note When the articulation is added to a scene, the root link adopts the specified pose. The pose of the + root link is propagated through the ensemble of links from parent to child after accounting for each child's + inbound joint frames and the joint positions set by PxArticulationJointReducedCoordinate::setJointPosition(). + As a consequence, the pose of each non-root link is automatically overwritten when adding the articulation to the scene. + + \see PxArticulationLink + */ + virtual PxArticulationLink* createLink(PxArticulationLink* parent, const PxTransform& pose) = 0; + + /** + \brief Releases the articulation, and all its links and corresponding joints. + + Attached mimic joints and tendons are released automatically when the articulation is released. + + \note This call may not be made during simulation. + + \note This call does not release any PxArticulationCache instance that has been instantiated using #createCache() + */ + virtual void release() = 0; + + /** + \brief Returns the number of links in the articulation. + + \return The number of links. + */ + virtual PxU32 getNbLinks() const = 0; + + /** + \brief Returns the set of links in the articulation in the order that they were added to the articulation using createLink. + + The order of the links may be different from the order in which the data is stored in the cache, see PxArticulationLink::getLinkIndex. + + \param[in] userBuffer Buffer into which to write the array of articulation link pointers. + \param[in] bufferSize The size of the buffer. If the buffer is not large enough to contain all the pointers to links, + only as many as will fit are written. + \param[in] startIndex Index of first link pointer to be retrieved. + + \return The number of links written into the buffer. + + \see PxArticulationLink + */ + virtual PxU32 getLinks(PxArticulationLink** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Returns the number of shapes in the articulation. + + \return The number of shapes. + */ + virtual PxU32 getNbShapes() const = 0; + + /** + \brief Sets a name string for the articulation that can be retrieved with getName(). + + This is for debugging and is not used by the SDK. The string is not copied by the SDK, + only the pointer is stored. + + \param[in] name A pointer to a char buffer used to specify the name of the articulation. + + \see getName() + */ + virtual void setName(const char* name) = 0; + + /** + \brief Returns the name string set with setName(). + + \return Name string associated with the articulation. + + \see setName() + */ + virtual const char* getName() const = 0; + + /** + \brief Returns the axis-aligned bounding box enclosing the articulation. + + \param[in] inflation Scale factor for computed world bounds. Box extents are multiplied by this value. + + \return The articulation's bounding box. + + \note It is not allowed to use this method while the simulation is running, except in a split simulation + during #PxScene::collide() and up to #PxScene::advance(), and in PxContactModifyCallback or in contact report callbacks. + + \see PxBounds3 + */ + virtual PxBounds3 getWorldBounds(float inflation = 1.01f) const = 0; + + /** + \brief Returns the aggregate associated with the articulation. + + \return The aggregate associated with the articulation or NULL if the articulation does not belong to an aggregate. + + \see PxAggregate + */ + virtual PxAggregate* getAggregate() const = 0; + + /** + \brief Sets flags on the articulation. + + \param[in] flags The articulation flags. + + \note This call may not be made during simulation. + + \see PxArticulationFlag + */ + virtual void setArticulationFlags(PxArticulationFlags flags) = 0; + + /** + \brief Raises or clears a flag on the articulation. + + \param[in] flag The articulation flag. + \param[in] value The value to set the flag to. + + \note This call may not be made during simulation. + + \see PxArticulationFlag + */ + virtual void setArticulationFlag(PxArticulationFlag::Enum flag, bool value) = 0; + + /** + \brief Returns the articulation's flags. + + \return The articulation's flags. + + \see PxArticulationFlag + */ + virtual PxArticulationFlags getArticulationFlags() const = 0; + + /** + \brief Returns the total number of joint degrees-of-freedom (DOFs) of the articulation. + + - The six DOFs of the base of a floating-base articulation are not included in this count. + - Example: Both a fixed-base and a floating-base double-pendulum with two revolute joints will have getDofs() == 2. + - The return value is only valid for articulations that are in a scene. + + \return The number of joint DOFs, or 0xFFFFFFFF if the articulation is not in a scene. + + */ + virtual PxU32 getDofs() const = 0; + + /** + \brief Creates an articulation cache that can be used to read and write internal articulation data. + + - When the structure of the articulation changes (e.g. adding a link) after the cache was created, + the cache needs to be released and recreated. + - Free the memory allocated for the cache by calling the release() method on the cache. + - Caches can only be created by articulations that are in a scene. + + \return The cache, or NULL if the articulation is not in a scene. + + \see applyCache, copyInternalStateToCache + */ + virtual PxArticulationCache* createCache() const = 0; + + /** + \brief Returns the size of the articulation cache in bytes. + + - The size does not include: the user-allocated memory for the coefficient matrix or lambda values; + the scratch-related memory/members; and the cache version. See comment in #PxArticulationCache. + - The return value is only valid for articulations that are in a scene. + + \return The byte size of the cache, or 0xFFFFFFFF if the articulation is not in a scene. + + \see PxArticulationCache + */ + virtual PxU32 getCacheDataSize() const = 0; + + /** + \brief Zeroes all data in the articulation cache, except user-provided and scratch memory, and cache version. + + \note This call may only be made on articulations that are in a scene. + + \see PxArticulationCache + */ + virtual void zeroCache(PxArticulationCache& cache) const = 0; + + /** + \brief Applies the data in the cache to the articulation. + + This call wakes the articulation if it is sleeping, and the autowake parameter is true (default) or: + - a nonzero joint velocity is applied or + - a nonzero joint force is applied or + - a nonzero root velocity is applied + + \param[in] cache The articulation data. + \param[in] flags Indicate which data in the cache to apply to the articulation. + \param[in] autowake If true, the call wakes up the articulation and increases the wake counter to #PxSceneDesc::wakeCounterResetValue + if the counter value is below the reset value. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + \note Calling applyCache(cache, PxArticulationCacheFlag::eROOT_TRANSFORM) has the same outcome as calling + PxArticulationReducedCoordinate::setRootGlobalPose() followed by PxArticulationReducedCoordinate::updateKinematic(PxArticulationKinematicFlag::ePOSITION). + Similarly, calling applyCache(cache, PxArticulationCacheFlag::eROOT_VELOCITIES) is the cache equivalent of calling + PxArticulationReducedCoordinate::setRootLinearVelocity() followed by PxArticulationReducedCoordinate::updateKinematic(PxArticulationKinematicFlag::eVELOCITY). + Joint positions follow a similar pattern with applyCache(cache, PxArticulationCacheFlag::ePOSITION) having the same outcome as callling + PxArticulationJointReducedCoordinate::setJointPosition() followed by PxArticulationReducedCoordinate::updateKinematic(PxArticulationKinematicFlag::ePOSITION). + Finally, joint velocities updated with applyCache(PxArticulationCacheFlag::eVELOCITY) will produce the same outcome as calling + PxArticulationJointReducedCoordinate::setJointVelocity() followed by PxArticulationReducedCoordinate::updateKinematic(PxArticulationKinematicFlag::eVELOCITY). + + \note This method should not be used if the direct GPU API is enabled. See #PxDirectGPUAPI for the details. + + \see PxArticulationCache, PxArticulationCacheFlags, createCache, copyInternalStateToCache, PxScene::applyArticulationData + */ + virtual void applyCache(PxArticulationCache& cache, const PxArticulationCacheFlags flags, bool autowake = true) = 0; + + /** + \brief Copies internal data of the articulation to the cache. + + \param[in] cache The articulation data. + \param[in] flags Indicate which data to copy from the articulation to the cache. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + \note This method should not be used if the direct GPU API is enabled. See #PxDirectGPUAPI for the details. + + \see PxArticulationCache, PxArticulationCacheFlags, createCache, applyCache + */ + virtual void copyInternalStateToCache(PxArticulationCache& cache, const PxArticulationCacheFlags flags) const = 0; + + + /** + \brief Converts maximal-coordinate joint DOF data to reduced coordinates. + + - Indexing into the maximal joint DOF data is via the link's low-level index minus 1 (the root link is not included). + - The reduced-coordinate data follows the cache indexing convention, see PxArticulationCache::jointVelocity. + + \param[in] maximum The maximal-coordinate joint DOF data with minimum array length N = (getNbLinks() - 1) * 6 + \param[out] reduced The reduced-coordinate joint DOF data with minimum array length N = getDofs() + + \note The articulation must be in a scene. + + \note This can be used as a helper function to prepare per joint cache data such as PxArticulationCache::jointVelocity. + + \see unpackJointData + */ + virtual void packJointData(const PxReal* maximum, PxReal* reduced) const = 0; + + /** + \brief Converts reduced-coordinate joint DOF data to maximal coordinates. + + - Indexing into the maximal joint DOF data is via the link's low-level index minus 1 (the root link is not included). + - The reduced-coordinate data follows the cache indexing convention, see PxArticulationCache::jointVelocity. + + \param[in] reduced The reduced-coordinate joint DOF data with minimum array length N = getDofs(). + \param[out] maximum The maximal-coordinate joint DOF data with minimum array length N = (getNbLinks() - 1) * 6. + + \note The articulation must be in a scene. + + \see packJointData + */ + virtual void unpackJointData(const PxReal* reduced, PxReal* maximum) const = 0; + + /** + \brief Prepares common articulation data based on articulation pose for inverse dynamics calculations. + + Usage: + -# Set articulation pose (joint positions and base transform) via articulation cache and applyCache(). + -# Call commonInit. + -# Call inverse dynamics computation method. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + \see computeGravityCompensation, computeCoriolisCompensation, computeGeneralizedExternalForce, computeJointAcceleration, + computeJointForce, computeDenseJacobian, computeMassMatrix + */ + virtual void commonInit() const = 0; + + /** + \deprecated Please use computeGravityCompensation instead. It provides a more complete gravity compensation force for floating-base articulations. + + \brief Computes the joint DOF forces required to counteract gravitational forces for the given articulation pose. + + - Inputs: Articulation pose (joint positions + base transform). + - Outputs: Joint forces to counteract gravity (in cache). + + - The joint forces returned are determined purely by gravity for the articulation in the current joint and base pose, and joints at rest; + i.e. external forces, joint velocities, and joint accelerations are set to zero. Joint drives are also not considered in the computation. + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[out] cache Out: PxArticulationCache::jointForce. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + \see commonInit + */ + virtual void computeGeneralizedGravityForce(PxArticulationCache& cache) const = 0; + + /** + \brief Computes the forces required to counteract gravitational forces for the given articulation pose. + + In the case of a fixed-base articulation, the gravity compensation force accounts for the gravity on all the links and provides + the force required to compensate the gravitational forces for all the joint DoFs. + The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + + In the case of a floating-base articulation, the gravity compensation force also accounts for the gravity on the root link and also provides + the force on the root required to compensate its gravitational force. The indexing is: + | Root force X | Root force Y | Root force Z | Root torque X | Root torque Y | Root torque Z | Force/Torque DOF 0 | ... | Force/Torque DOF N | + + - Inputs: Articulation pose (joint positions + base transform). + - Outputs: Forces to counteract gravity (in cache). + + - The joint forces returned are determined purely by gravity for the articulation in the current joint and base pose, and joints at rest; + i.e. external forces, joint velocities, and joint accelerations are set to zero. Joint drives are also not considered in the computation. + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[out] cache Out: PxArticulationCache::gravityCompensationForce. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + \see commonInit + */ + virtual void computeGravityCompensation(PxArticulationCache& cache) const = 0; + + /** + \deprecated Please use computeCoriolisCompensation instead. It provides a more complete Coriolis and centrifugal compensation force for floating-base articulations. + + \brief Computes the joint DOF forces required to counteract Coriolis and centrifugal forces for the given articulation state. + + - Inputs: Articulation state (joint positions and velocities (in cache), and base transform and spatial velocity). + - Outputs: Joint forces to counteract Coriolis and centrifugal forces (in cache). + + - The joint forces returned are determined purely by the articulation's state; i.e. external forces, gravity, and joint accelerations are set to zero. + Joint drives and potential damping terms, such as link angular or linear damping, or joint friction, are also not considered in the computation. + - Prior to the computation, update/set the base spatial velocity with PxArticulationCache::rootLinkData and applyCache(). + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[in,out] cache In: PxArticulationCache::jointVelocity; Out: PxArticulationCache::jointForce. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + \see commonInit + */ + virtual void computeCoriolisAndCentrifugalForce(PxArticulationCache& cache) const = 0; + + /** + \brief Computes the joint DOF forces (and root force) required to counteract Coriolis and centrifugal forces for the given articulation state. + + In the case of a fixed-base articulation, the Coriolis and centrifugal compensation force accounts for forces resulting to the current + joint velocities. The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + + In the case of a floating-base articulation, the Coriolis and centrifugal compensation force also accounts for forces resulting to the current + root velocity. The indexing is: + | Root force X | Root force Y | Root force Z | Root torque X | Root torque Y | Root torque Z | Force/Torque DOF 0 | ... | Force/Torque DOF N | + + - Inputs: Articulation state (joint positions and velocities (in cache), and base transform and spatial velocity). + - Outputs: Joint forces (and root force) to counteract Coriolis and centrifugal forces (in cache). + + - The forces returned are determined purely by the articulation's state; i.e. external forces, gravity, and joint accelerations are set to zero. + Joint drives and potential damping terms, such as link angular or linear damping, or joint friction, are also not considered in the computation. + - Prior to the computation, update/set the base spatial velocity with PxArticulationCache::rootLinkData and applyCache(). + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[in,out] cache In: PxArticulationCache::jointVelocity and PxArticulationCache::linkVelocity; Out: PxArticulationCache::coriolisForce. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + \see commonInit + */ + virtual void computeCoriolisCompensation(PxArticulationCache& cache) const = 0; + + /** + \brief Computes the joint DOF forces required to counteract external spatial forces applied to articulation links. + + - Inputs: External forces on links (in cache), articulation pose (joint positions + base transform). + - Outputs: Joint forces to counteract the external forces (in cache). + + - Only the external spatial forces provided in the cache and the articulation pose are considered in the computation. + - The external spatial forces are with respect to the links' centers of mass, and not the actor's origin. + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[in,out] cache In: PxArticulationCache::externalForces; Out: PxArticulationCache::jointForce. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + \see commonInit + */ + virtual void computeGeneralizedExternalForce(PxArticulationCache& cache) const = 0; + + /** + \brief Computes the joint accelerations for the given articulation state and joint forces. + + - Inputs: Joint forces (in cache) and articulation state (joint positions and velocities (in cache), and base transform and spatial velocity). + - Outputs: Joint accelerations (in cache). + + - The computation includes Coriolis terms and gravity. However, joint drives, external forces, and potential damping (link damping, friction) terms + are not considered in the computation. + - Prior to the computation, update/set the base spatial velocity with PxArticulationCache::rootLinkData and applyCache(). + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[in,out] cache In: PxArticulationCache::jointForce and PxArticulationCache::jointVelocity; Out: PxArticulationCache::jointAcceleration. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + \see commonInit + */ + virtual void computeJointAcceleration(PxArticulationCache& cache) const = 0; + + /** + \brief Computes the joint forces for the given articulation pose and joint accelerations, not considering gravity and velocity. + + - Inputs: Joint accelerations (in cache). + - Outputs: Joint forces (in cache). + + - Gravity, Coriolis effects, joint drives and potential damping terms are not considered in the computation + (for example, linear link damping or joint friction). + - To compute the joint force for a different pose, the joint positions and root transform first need to be applied with applyCache() as this function ignores any values set to joint positions and root transform in the cache + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[in,out] cache In: PxArticulationCache::jointAcceleration; Out: PxArticulationCache::jointForce. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + \see commonInit + */ + virtual void computeJointForce(PxArticulationCache& cache) const = 0; + + /** + \brief Compute the dense Jacobian for the articulation in world space, including the DOFs of a potentially floating base. + + This computes the dense representation of an inherently sparse matrix. Multiplication with this matrix maps + joint space velocities to world-space linear and angular (i.e. spatial) velocities of the centers of mass of the links. + + \param[out] cache Sets cache.denseJacobian matrix. The matrix is indexed [nCols * row + column]. + \param[out] nRows Set to number of rows in matrix, which corresponds to nbLinks() * 6, minus 6 if PxArticulationFlag::eFIX_BASE is true. + \param[out] nCols Set to number of columns in matrix, which corresponds to the number of joint DOFs, plus 6 in the case PxArticulationFlag::eFIX_BASE is false. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + */ + virtual void computeDenseJacobian(PxArticulationCache& cache, PxU32& nRows, PxU32& nCols) const = 0; + + /** + \deprecated The API related to loop joints will be removed in a future version once a replacement is made available. + + \brief Computes the coefficient matrix for contact forces. + + - The matrix dimension is getCoefficientMatrixSize() = getDofs() * getNbLoopJoints(), and the DOF (column) indexing follows the internal DOF order, see PxArticulationCache::jointVelocity. + - Each column in the matrix is the joint forces effected by a contact based on impulse strength 1. + - The user must allocate memory for PxArticulationCache::coefficientMatrix where the required size of the PxReal array is equal to getCoefficientMatrixSize(). + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[out] cache Out: PxArticulationCache::coefficientMatrix. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + \see commonInit, getCoefficientMatrixSize + */ + virtual PX_DEPRECATED void computeCoefficientMatrix(PxArticulationCache& cache) const = 0; + + /** + \deprecated The API related to loop joints will be removed in a future version once a replacement is made available. + + \brief Computes the lambda values when the test impulse is 1. + + - The user must allocate memory for PxArticulationCache::lambda where the required size of the PxReal array is equal to getNbLoopJoints(). + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[out] cache Out: PxArticulationCache::lambda. + \param[in] initialState The initial state of the articulation system. + \param[in] jointTorque M(q)*qddot + C(q,qdot) + g(q) <- calculate by summing joint forces obtained with computeJointForce and computeGeneralizedGravityForce. + \param[in] maxIter Maximum number of solver iterations to run. If the system converges, fewer iterations may be used. + + \return True if convergence was achieved within maxIter; False if convergence was not achieved or the operation failed otherwise. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + \see commonInit, getNbLoopJoints + */ + virtual PX_DEPRECATED bool computeLambda(PxArticulationCache& cache, PxArticulationCache& initialState, const PxReal* const jointTorque, const PxU32 maxIter) const = 0; + + /** + \deprecated Please use computeMassMatrix instead. It provides a more complete mass matrix for floating-base articulations. + + \brief Compute the joint-space inertia matrix that maps joint accelerations to joint forces: forces = M * accelerations. + + - Inputs: Articulation pose (joint positions and base transform). + - Outputs: Mass matrix (in cache). + + commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[out] cache Out: PxArticulationCache::massMatrix. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + \see commonInit + */ + virtual PX_DEPRECATED void computeGeneralizedMassMatrix(PxArticulationCache& cache) const = 0; + + /** + \brief Compute the mass matrix M that maps accelerations to forces: forces = M * accelerations. + + In the case of a fixed-base articulation, the mass matrix maps joint accelerations to joint forces. + The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + + In the case of a floating-base articulation, the mass matrix also includes terms required to map root accelerations + to root forces. The mass matrix should be used with accelerations and forces that follows the indexing below: + | Root force X | | Root linear acceleration X | + | Root force Y | | Root linear acceleration Y | + | Root force Z | | Root linear acceleration Z | + | Root torque X | | Root angular acceleration X | + | Root torque Y | | Root angular acceleration Y | + | Root torque Z | = M | Root angular acceleration Z | + | Force/Torque DOF 0 | | Joint acceleration 0 | + | Force/Torque DOF 1 | | Joint acceleration 1 | + | ... | | ... | + | Force/Torque DOF N | | Joint acceleration N | + + - Inputs: Articulation pose (joint positions and base transform). + - Outputs: Mass matrix (in cache). + + commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[out] cache Out: PxArticulationCache::massMatrix. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + \note The mass matrix is indexed [nCols * row + column]. + + \see commonInit, PxArticulationCache::massMatrix + */ + virtual void computeMassMatrix(PxArticulationCache& cache) const = 0; + + /** + \brief Compute the articulation's center of mass. + + \return The articulation's center of mass given either in the world frame (rootFrame = false) or in the root frame + (rootFrame = true). PxVec3(0.0f) is returned if the articulation is not in a scene or the call is made during simulation. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + */ + virtual PxVec3 computeArticulationCOM(const bool rootFrame = false) const = 0; + + /** + \brief Compute the centroidal momentum matrix and corresponding bias force of an articulation. + + - Inputs: Articulation state (joint positions and velocities, and base transform and spatial velocity), + articulation mass matrix, Coriolis and Centrifugal compensation forces. + - Outputs: Centroidal momentum matrix and bias force (in cache). + + commonInit(), computeMassMatrix() and computeCoriolisCompensation() must be called before the computation, + and after setting the articulation pose and velocities via applyCache(). + + \param[out] cache Out: PxArticulationCache::centroidalMomentumMatrix and PxArticulationCache::centroidalMomentumBias. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + This call may also only be made for floating-base articulations. + + \see commonInit, computeMassMatrix, computeCoriolisCompensation + */ + virtual void computeCentroidalMomentumMatrix(PxArticulationCache& cache) const = 0; + + /** + \deprecated The API related to loop joints will be removed in a future version once a replacement is made available. + + \brief Adds a loop joint to the articulation system for inverse dynamics. + + \param[in] joint The joint to add. + + \note This call may not be made during simulation. + + \see PxFixedJoint, PxSphericalJoint, PxRevoluteJoint, PxPrismaticJoint, PxDistanceJoint, PxD6Joint + */ + virtual PX_DEPRECATED void addLoopJoint(PxConstraint* joint) = 0; + + /** + \deprecated The API related to loop joints will be removed in a future version once a replacement is made available. + + \brief Removes a loop joint from the articulation for inverse dynamics. + + \note This call may not be made during simulation. + + \param[in] joint The joint to remove. + */ + virtual PX_DEPRECATED void removeLoopJoint(PxConstraint* joint) = 0; + + /** + \deprecated The API related to loop joints will be removed in a future version once a replacement is made available. + + \brief Returns the number of loop joints in the articulation for inverse dynamics. + + \return The number of loop joints. + */ + virtual PX_DEPRECATED PxU32 getNbLoopJoints() const = 0; + + /** + \deprecated The API related to loop joints will be removed in a future version once a replacement is made available. + \brief Returns the set of loop constraints (i.e. joints) in the articulation. + + \param[in] userBuffer Target buffer for the constraint pointers. + \param[in] bufferSize The size of the buffer. If this is not large enough to contain all the pointers to the constraints, + only as many as will fit are written. Use getNbLoopJoints() to size the buffer for retrieving all constraints. + \param[in] startIndex Index of first constraint pointer to be retrieved. + + \return The number of constraints written into the buffer. + */ + virtual PX_DEPRECATED PxU32 getLoopJoints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \deprecated The API related to loop joints will be removed in a future version once a replacement is made available. + + \brief Returns the required size of the coefficient matrix in the articulation. + + \return Size of the coefficient matrix (equal to getDofs() * getNbLoopJoints()). + + \note This call may only be made on articulations that are in a scene. + + \see computeCoefficientMatrix + */ + virtual PX_DEPRECATED PxU32 getCoefficientMatrixSize() const = 0; + + /** + \brief Sets the root link transform in the world frame. + + - Use updateKinematic() after all state updates to the articulation via non-cache API such as this method, + in order to update link states for the next simulation frame or querying. + + \param[in] pose The new root link transform. + \param[in] autowake If true and the articulation is in a scene, the articulation will be woken up and the wake counter of + each link will be reset to #PxSceneDesc::wakeCounterResetValue. + + \note This call may not be made during simulation. + + \note PxArticulationCache::rootLinkData similarly allows the root link pose to be updated and potentially offers better performance + if the root link pose is to be updated along with other state variables. + + \note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details. + + \see getRootGlobalPose, updateKinematic, PxArticulationCache, applyCache + */ + virtual void setRootGlobalPose(const PxTransform& pose, bool autowake = true) = 0; + + /** + \brief Returns the root link transform (world to actor frame). + + \return The root link transform. + + \note This call is not allowed while the simulation is running except in a split simulation during #PxScene::collide() and up to #PxScene::advance(), + and in PxContactModifyCallback or in contact report callbacks. + + \note PxArticulationCache::rootLinkData similarly allows the root link pose to be queried and potentially offers better performance if the root + link pose is to be queried along with other state variables. + + \note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details. + + \see setRootGlobalPose, PxArticulationCache, copyInternalStateToCache + */ + virtual PxTransform getRootGlobalPose() const = 0; + + /** + \brief Sets the root link linear center-of-mass velocity. + + - The linear velocity is with respect to the link's center of mass and not the actor frame origin. + - The articulation is woken up if the input velocity is nonzero (ignoring autowake) and the articulation is in a scene. + - Use updateKinematic() after all state updates to the articulation via non-cache API such as this method, + in order to update link states for the next simulation frame or querying. + + \param[in] linearVelocity The new root link center-of-mass linear velocity. + \param[in] autowake If true and the articulation is in a scene, the call wakes up the articulation and increases the wake counter + to #PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value. + + \note This call may not be made during simulation, except in a split simulation in-between #PxScene::fetchCollision and #PxScene::advance. + + \note PxArticulationCache::rootLinkData similarly allows the root link linear velocity to be updated and potentially offers better performance + if the root link linear velocity is to be updated along with other state variables. + + \note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details. + + \see updateKinematic, getRootLinearVelocity, setRootAngularVelocity, getRootAngularVelocity, PxRigidBody::getCMassLocalPose, PxArticulationCache, applyCache + */ + virtual void setRootLinearVelocity(const PxVec3& linearVelocity, bool autowake = true) = 0; + + /** + \brief Gets the root link center-of-mass linear velocity. + + - The linear velocity is with respect to the link's center of mass and not the actor frame origin. + + \return The root link center-of-mass linear velocity. + + \note This call is not allowed while the simulation is running except in a split simulation during #PxScene::collide() and up to #PxScene::advance(), + and in PxContactModifyCallback or in contact report callbacks. + + \note PxArticulationCache::rootLinkData similarly allows the root link linear velocity to be queried and potentially offers better performance + if the root link linear velocity is to be queried along with other state variables. + + \note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details. + + \see setRootLinearVelocity, setRootAngularVelocity, getRootAngularVelocity, PxRigidBody::getCMassLocalPose, PxArticulationCache, applyCache + */ + virtual PxVec3 getRootLinearVelocity() const = 0; + + /** + \brief Sets the root link angular velocity. + + - The articulation is woken up if the input velocity is nonzero (ignoring autowake) and the articulation is in a scene. + - Use updateKinematic() after all state updates to the articulation via non-cache API such as this method, + in order to update link states for the next simulation frame or querying. + + \param[in] angularVelocity The new root link angular velocity. + \param[in] autowake If true and the articulation is in a scene, the call wakes up the articulation and increases the wake counter + to #PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value. + + \note This call may not be made during simulation, except in a split simulation in-between #PxScene::fetchCollision and #PxScene::advance. + + \note PxArticulationCache::rootLinkData similarly allows the root link angular velocity to be updated and potentially offers better performance + if the root link angular velocity is to be updated along with other state variables. + + \note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details. + + \see updateKinematic, getRootAngularVelocity, setRootLinearVelocity, getRootLinearVelocity, PxArticulationCache, applyCache + */ + virtual void setRootAngularVelocity(const PxVec3& angularVelocity, bool autowake = true) = 0; + + /** + \brief Gets the root link angular velocity. + + \return The root link angular velocity. + + \note This call is not allowed while the simulation is running except in a split simulation during #PxScene::collide() and up to #PxScene::advance(), + and in PxContactModifyCallback or in contact report callbacks. + + \note PxArticulationCache::rootLinkData similarly allows the root link angular velocity to be queried and potentially offers better performance + if the root link angular velocity is to be queried along with other state variables. + + \note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details. + + \see setRootAngularVelocity, setRootLinearVelocity, getRootLinearVelocity, PxArticulationCache, applyCache + */ + virtual PxVec3 getRootAngularVelocity() const = 0; + + /** + \brief Returns the (classical) link acceleration in world space for the given low-level link index. + + - The returned acceleration is not a spatial, but a classical, i.e. body-fixed acceleration (https://en.wikipedia.org/wiki/Spatial_acceleration). + - The (linear) acceleration is with respect to the link's center of mass and not the actor frame origin. + + \param[in] linkId The low-level link index, see PxArticulationLink::getLinkIndex. + + \return The link's center-of-mass classical acceleration, or 0 if the call is made before the articulation participated in a first simulation step. + + \note This call may only be made on articulations that are in a scene. It is not allowed to use this method while the simulation + is running. The exceptions to this rule are a split simulation during #PxScene::collide() and up to #PxScene::advance(); + in PxContactModifyCallback; and 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 PxArticulationLink::getLinkIndex, PxRigidBody::getCMassLocalPose + */ + virtual PxSpatialVelocity getLinkAcceleration(const PxU32 linkId) = 0; + + /** + \brief Returns the GPU articulation index. + + \return The GPU index, or 0xFFFFFFFF if the articulation is not in a scene. + */ + virtual PxArticulationGPUIndex getGPUIndex() const = 0; + + /** + \brief Creates a spatial tendon to attach to the articulation with default attribute values. + + \return The new spatial tendon. + + \note Creating a spatial tendon is not allowed while the articulation is in a scene. In order to + add the tendon, remove and then re-add the articulation to the scene. + + \note The spatial tendon is released with PxArticulationReducedCoordinate::release() + + \see PxArticulationSpatialTendon + */ + virtual PxArticulationSpatialTendon* createSpatialTendon() = 0; + + /** + \brief Creates a fixed tendon to attach to the articulation with default attribute values. + + \return The new fixed tendon. + + \note Creating a fixed tendon is not allowed while the articulation is in a scene. In order to + add the tendon, remove and then re-add the articulation to the scene. + + \note The fixed tendon is released with PxArticulationReducedCoordinate::release() + + \see PxArticulationFixedTendon + */ + virtual PxArticulationFixedTendon* createFixedTendon() = 0; + + /** + \brief Returns the spatial tendons attached to the articulation. + + The order of the tendons in the buffer is not necessarily identical to the order in which the tendons were added to the articulation. + + \param[in] userBuffer The buffer into which to write the array of pointers to the tendons. + \param[in] bufferSize The size of the buffer. If this is not large enough to contain all the pointers to tendons, + only as many as will fit are written. Use getNbSpatialTendons to size for all attached tendons. + \param[in] startIndex Index of first tendon pointer to be retrieved. + + \return The number of tendons written into the buffer. + + \see PxArticulationSpatialTendon, getNbSpatialTendons + */ + virtual PxU32 getSpatialTendons(PxArticulationSpatialTendon** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Returns the number of spatial tendons in the articulation. + + \return The number of tendons. + */ + virtual PxU32 getNbSpatialTendons() const = 0; + + /** + \brief Returns the fixed tendons attached to the articulation. + + The order of the tendons in the buffer is not necessarily identical to the order in which the tendons were added to the articulation. + + \param[in] userBuffer The buffer into which to write the array of pointers to the tendons. + \param[in] bufferSize The size of the buffer. If this is not large enough to contain all the pointers to tendons, + only as many as will fit are written. Use getNbFixedTendons to size for all attached tendons. + \param[in] startIndex Index of first tendon pointer to be retrieved. + + \return The number of tendons written into the buffer. + + \see PxArticulationFixedTendon, getNbFixedTendons + */ + virtual PxU32 getFixedTendons(PxArticulationFixedTendon** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Returns the number of fixed tendons in the articulation. + + \return The number of tendons. + */ + virtual PxU32 getNbFixedTendons() const = 0; + + /** + \brief Create a mimic joint that will enforce a relationship between two joints. + \param[in] jointA is the first joint of the joint pair controlled by the mimic joint. + \param[in] axisA specifies the degree of freedom of jointA that will be controlled by the mimic joint. + \param[in] jointB is the second joint of the joint pair controlled by the mimic joint. + \param[in] axisB specifies the degree of freedom of jointB that will be controlled by the mimic joint. + \param[in] gearRatio is the gearing ratio enforced by the mimic joint. + \param[in] naturalFrequency specifies the oscillation frequency of the mimic joint's compliance, specified in s^-1. + \param[in] dampingRatio specifies the damping ratio of the mimic joint's compliance. + \param[in] offset is the offset enforced by the mimic joint. + \note If naturalFrequency is less than or equal to zero it is assumed that the mimic joint has no compliance and is a hard constraint. + \note If dampingRatio is less than or equal to zero it is assumed that the mimic joint has no compliance and is a hard constraint. + \note In the absence of compliance, the mimic joint enforces the rule: qA + gearRatio*qB + offset = 0 with qA denoting the + joint position of the specified degree of freedom of jointA and qB denoting the joint position of the specified degree of freedom of jointB. + \note Larger values of naturalFrequency and dampingRatio will make the mimic joint stiffer and more akin to a hard constraint. + \note A damping ratio less than 1.0 is not recommended. + \note If dampingRatio is less than or equal to zero and naturalFrequency greater than zero, the mimic joint will behave as a hard constraint. + If dampingRatio is greater than zero and naturalFrequency less than or equal to zero, the mimic joint will also behave as a hard constraint. + */ + virtual PxArticulationMimicJoint* createMimicJoint( + const PxArticulationJointReducedCoordinate& jointA, PxArticulationAxis::Enum axisA, + const PxArticulationJointReducedCoordinate& jointB, PxArticulationAxis::Enum axisB, + PxReal gearRatio, PxReal offset, + PxReal naturalFrequency = 0.0f, PxReal dampingRatio = 0.0f) = 0; + + /** + \brief Returns the mimic joints added to the articulation. + + The order of the mimic joints in the buffer is not necessarily identical to the order in which the mimic joints were added to the articulation. + + \param[in] userBuffer The buffer into which to write the array of pointers to the mimic joints. + \param[in] bufferSize The size of the buffer. If this is not large enough to contain all the pointers to mimic joints, + only as many as will fit are written. Use getNbMimicJoints() to size for all attached mimic joints. + \param[in] startIndex Index of first mimic joints pointer to be retrieved. + + \return The number of mimic joints written into the buffer. + + \see PxArticulationMimicJoint, getNbMimicJoints + */ + virtual PxU32 getMimicJoints(PxArticulationMimicJoint** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Returns the number of mimic joints in the articulation. + \return The number of mimic joints. + */ + virtual PxU32 getNbMimicJoints() const = 0; + + + /** + \brief Update link velocities and/or positions in the articulation. + + An alternative that potentially offers better performance is to use the PxArticulationCache API. + + If the application updates the root state (position and velocity) or joint state via any combination of + the non-cache API calls + + - setRootGlobalPose(), setRootLinearVelocity(), setRootAngularVelocity() + - PxArticulationJointReducedCoordinate::setJointPosition(), PxArticulationJointReducedCoordinate::setJointVelocity() + + the application needs to call this method after the state setting in order to update the link states for + the next simulation frame or querying. + + Use + - PxArticulationKinematicFlag::ePOSITION after any changes to the articulation root or joint positions using non-cache API calls. Updates links' positions and velocities. + - PxArticulationKinematicFlag::eVELOCITY after velocity-only changes to the articulation root or joints using non-cache API calls. Updates links' velocities only. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + \see PxArticulationKinematicFlags, PxArticulationCache, applyCache + */ + virtual void updateKinematic(PxArticulationKinematicFlags flags) = 0; + + /** + \brief Returns the internal residual for this articulation (does not include collision or external joint residual values). + + 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 the articulation solver. + + \see PxArticulationResidual + */ + virtual PxArticulationResidual getSolverResidual() 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 "PxArticulationReducedCoordinate"; } + + virtual ~PxArticulationReducedCoordinate() {} + + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + + protected: + PX_INLINE PxArticulationReducedCoordinate(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxArticulationReducedCoordinate(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxArticulationReducedCoordinate", PxBase); } + }; + +#if PX_VC +#pragma warning(pop) +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxArticulationTendon.h b/engine/third_party/physx/include/PxArticulationTendon.h new file mode 100644 index 00000000..062d3f38 --- /dev/null +++ b/engine/third_party/physx/include/PxArticulationTendon.h @@ -0,0 +1,630 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + Default: 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. + Default: (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. + Default: 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. + Default: 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. + Default: 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. Default: 0 + \param[in] autowake If true and the articulation is in a scene, the call wakes up the articulation and increases the wake counter + to #PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value. + + \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 + diff --git a/engine/third_party/physx/include/PxArticulationTendonData.h b/engine/third_party/physx/include/PxArticulationTendonData.h new file mode 100644 index 00000000..7a00bcc9 --- /dev/null +++ b/engine/third_party/physx/include/PxArticulationTendonData.h @@ -0,0 +1,120 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 diff --git a/engine/third_party/physx/include/PxBaseMaterial.h b/engine/third_party/physx/include/PxBaseMaterial.h new file mode 100644 index 00000000..9534992b --- /dev/null +++ b/engine/third_party/physx/include/PxBaseMaterial.h @@ -0,0 +1,60 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 diff --git a/engine/third_party/physx/include/PxBroadPhase.h b/engine/third_party/physx/include/PxBroadPhase.h new file mode 100644 index 00000000..309e7080 --- /dev/null +++ b/engine/third_party/physx/include/PxBroadPhase.h @@ -0,0 +1,802 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 diff --git a/engine/third_party/physx/include/PxClient.h b/engine/third_party/physx/include/PxClient.h new file mode 100644 index 00000000..3a1f46ba --- /dev/null +++ b/engine/third_party/physx/include/PxClient.h @@ -0,0 +1,57 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 diff --git a/engine/third_party/physx/include/PxConeLimitedConstraint.h b/engine/third_party/physx/include/PxConeLimitedConstraint.h new file mode 100644 index 00000000..a2b2a81d --- /dev/null +++ b/engine/third_party/physx/include/PxConeLimitedConstraint.h @@ -0,0 +1,124 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 diff --git a/engine/third_party/physx/include/PxConstraint.h b/engine/third_party/physx/include/PxConstraint.h new file mode 100644 index 00000000..4d3b0f7d --- /dev/null +++ b/engine/third_party/physx/include/PxConstraint.h @@ -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 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 diff --git a/engine/third_party/physx/include/PxConstraintDesc.h b/engine/third_party/physx/include/PxConstraintDesc.h new file mode 100644 index 00000000..4ca1c173 --- /dev/null +++ b/engine/third_party/physx/include/PxConstraintDesc.h @@ -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 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 diff --git a/engine/third_party/physx/include/PxContact.h b/engine/third_party/physx/include/PxContact.h new file mode 100644 index 00000000..1a04e835 --- /dev/null +++ b/engine/third_party/physx/include/PxContact.h @@ -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(contactPatches); + + if(patches) + { + modify = (patches->internalFlags & PxContactPatch::eMODIFIABLE) != 0; + compressedModify = (patches->internalFlags & PxContactPatch::eCOMPRESSED_MODIFIED_CONTACT) != 0; + indices = (patches->internalFlags & PxContactPatch::eHAS_FACE_INDICES) != 0; + + patch = patches; + + contact = reinterpret_cast(contactPoints); + + faceIndice = contactFaceIndices; + + pointSize = compressedModify ? sizeof(PxExtendedContact) : modify ? sizeof(PxModifiableContact) : sizeof(PxContact); + + response = (patch->internalFlags & PxContactPatch::eFORCE_NO_RESPONSE) == 0; + } + + + mStreamFormat = compressedModify ? eCOMPRESSED_MODIFIABLE_STREAM : modify ? eMODIFIABLE_STREAM : eSIMPLE_STREAM; + hasFaceIndices = PxU32(indices); + forceNoResponse = PxU32(!response); + + contactPatchHeaderSize = patchHeaderSize; + contactPointSize = pointSize; + nextPatchIndex = 0; + nextContactIndex = 0; + totalContacts = nbContacts; + totalPatches = nbPatches; + + pointStepped = false; + } + + /** + \brief Returns whether there are more patches in this stream. + \return Whether there are more patches in this stream. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool hasNextPatch() const + { + return nextPatchIndex < totalPatches; + } + + /** + \brief Returns the total contact count. + \return Total contact count. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getTotalContactCount() const + { + return totalContacts; + } + + /** + \brief Returns the total patch count. + \return Total patch count. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getTotalPatchCount() const + { + return totalPatches; + } + + /** + \brief Advances iterator to next contact patch. + */ + PX_CUDA_CALLABLE PX_INLINE void nextPatch() + { + PX_ASSERT(nextPatchIndex < totalPatches); + if(nextPatchIndex) + { + if(nextContactIndex < patch->nbContacts) + { + PxU32 nbToStep = patch->nbContacts - this->nextContactIndex; + contact = reinterpret_cast(reinterpret_cast(contact) + contactPointSize * nbToStep); + } + patch = reinterpret_cast(reinterpret_cast(patch) + contactPatchHeaderSize); + } + nextPatchIndex++; + nextContactIndex = 0; + } + + /** + \brief Returns if the current patch has more contacts. + \return If there are more contacts in the current patch. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool hasNextContact() const + { + return nextContactIndex < (patch->nbContacts); + } + + /** + \brief Advances to the next contact in the patch. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void nextContact() + { + PX_ASSERT(nextContactIndex < patch->nbContacts); + if(pointStepped) + { + contact = reinterpret_cast(reinterpret_cast(contact) + contactPointSize); + faceIndice++; + } + nextContactIndex++; + pointStepped = true; + } + + /** + \brief Gets the current contact's normal + \return The current contact's normal. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& getContactNormal() const + { + return getContactPatch().normal; + } + + /** + \brief Gets the inverse mass scale for body 0. + \return The inverse mass scale for body 0. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getInvMassScale0() const + { + return patch->mMassModification.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(reinterpret_cast(contact) + contactPointSize * numToAdvance); + nextContactIndex += numToAdvance; + return true; + } + else + { + numToAdvance -= patchSize; + } + } + } + return false; + } + +private: + + /** + \brief Internal helper + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxContactPatch& getContactPatch() const + { + return *static_cast(patch); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxExtendedContact& getExtendedContact() const + { + PX_ASSERT(mStreamFormat == eMODIFIABLE_STREAM || mStreamFormat == eCOMPRESSED_MODIFIABLE_STREAM); + return *static_cast(contact); + } + +}; + +/** +\brief 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(contactPatches)), + mFrictionPatches(reinterpret_cast(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 diff --git a/engine/third_party/physx/include/PxContactModifyCallback.h b/engine/third_party/physx/include/PxContactModifyCallback.h new file mode 100644 index 00000000..6c52d42b --- /dev/null +++ b/engine/third_party/physx/include/PxContactModifyCallback.h @@ -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(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(reinterpret_cast(mContacts) - headerOffset); + } + + PxU32 mCount; //!< Number of contact points in the set + PxModifiableContact* mContacts; //!< The contact points of the set +}; + + + +/** +\brief An array of instances of this class is passed to PxContactModifyCallback::onContactModify(). + +\see PxContactModifyCallback +*/ + +class PxContactModifyPair +{ +public: + + /** + \brief The actors which make up the pair in contact. + + Note that these are the actors as seen by the simulation, and may have been deleted since the simulation step started. + */ + const PxRigidActor* actor[2]; + + /** + \brief The shapes which make up the pair in contact. + + Note that these are the shapes as seen by the simulation, and may have been deleted since the simulation step started. + */ + const PxShape* shape[2]; + + /** + \brief The shape to world transforms of the two shapes. + + These are the transforms as the simulation engine sees them, and may have been modified by the application + since the simulation step started. + */ + PxTransform transform[2]; + + /** + \brief An array of contact points between these two shapes. + */ + PxContactSet contacts; +}; + + +/** +\brief An interface class that the user can implement in order to modify contact constraints. + +Threading: It is necessary to make this class thread safe as it will be called in the context of the +simulation thread. It might also be necessary to make it reentrant, since some calls can be made by multi-threaded +parts of the physics engine. + +You can enable the use of this contact modification callback by raising the flag PxPairFlag::eMODIFY_CONTACTS in +the filter shader/callback (see #PxSimulationFilterShader) for a pair of rigid body objects. + +Please note: ++ Raising the contact modification flag will not wake the actors up automatically. ++ It is not possible to turn off the performance degradation by simply removing the callback from the scene, the + filter shader/callback has to be used to clear the contact modification flag. ++ The contacts will only be reported as long as the actors are awake. There will be no callbacks while the actors are sleeping. + +\see PxScene.setContactModifyCallback() PxScene.getContactModifyCallback() +*/ +class PxContactModifyCallback +{ +public: + + /** + \brief Passes modifiable arrays of contacts to the application. + + The initial contacts are regenerated from scratch each frame by collision detection. + + The number of contacts can not be changed, so you cannot add your own contacts. You may however + disable contacts using PxContactSet::ignore(). + + \param[in,out] pairs The contact pairs that may be modified + \param[in] count Number of contact pairs + + \see PxContactModifyPair + */ + virtual void onContactModify(PxContactModifyPair* const pairs, PxU32 count) = 0; + +protected: + virtual ~PxContactModifyCallback(){} +}; + +/** +\brief An interface class that the user can implement in order to modify CCD contact constraints. + +Threading: It is necessary to make this class thread safe as it will be called in the context of the +simulation thread. It might also be necessary to make it reentrant, since some calls can be made by multi-threaded +parts of the physics engine. + +You can enable the use of this contact modification callback by raising the flag PxPairFlag::eMODIFY_CONTACTS in +the filter shader/callback (see #PxSimulationFilterShader) for a pair of rigid body objects. + +Please note: ++ Raising the contact modification flag will not wake the actors up automatically. ++ It is not possible to turn off the performance degradation by simply removing the callback from the scene, the + filter shader/callback has to be used to clear the contact modification flag. ++ The contacts will only be reported as long as the actors are awake. There will be no callbacks while the actors are sleeping. + +\see PxScene.setContactModifyCallback() PxScene.getContactModifyCallback() +*/ +class PxCCDContactModifyCallback +{ +public: + + /** + \brief Passes modifiable arrays of contacts to the application. + + The initial contacts are regenerated from scratch each frame by collision detection. + + The number of contacts can not be changed, so you cannot add your own contacts. You may however + disable contacts using PxContactSet::ignore(). + + \param[in,out] pairs The contact pairs that may be modified + \param[in] count Number of contact pairs + */ + virtual void onCCDContactModify(PxContactModifyPair* const pairs, PxU32 count) = 0; + +protected: + virtual ~PxCCDContactModifyCallback(){} +}; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxDeformableAttachment.h b/engine/third_party/physx/include/PxDeformableAttachment.h new file mode 100644 index 00000000..6b910d53 --- /dev/null +++ b/engine/third_party/physx/include/PxDeformableAttachment.h @@ -0,0 +1,237 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 + + +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 + + +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 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 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 diff --git a/engine/third_party/physx/include/PxDeformableBody.h b/engine/third_party/physx/include/PxDeformableBody.h new file mode 100644 index 00000000..ceaa749f --- /dev/null +++ b/engine/third_party/physx/include/PxDeformableBody.h @@ -0,0 +1,396 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 + + Default: 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 + + Default: 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 + Default: 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 + Default: 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 + Default: 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 + Default: 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. + Default: 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. + Default: 4 position iterations, 1 velocity iteration + + \param[in] minPositionIters Number of position iterations the solver should perform for this deformable body. Range: [1,255] + \param[in] minVelocityIters Number of velocity iterations, currently ignored. Range: [1,255] + \see getSolverIterationCounts() + */ + virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) = 0; + + /** + \brief Retrieves the solver iteration counts. + + \see setSolverIterationCounts() + */ + virtual void getSolverIterationCounts(PxU32& minPositionIters, PxU32& minVelocityIters) const = 0; + + /** + \brief 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 + Default: 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. + Default: 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. + + Default: 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. + + Default: 0.4 (which corresponds to 20 frames for a time step of 0.02) + + \param[in] wakeCounterValue Wake counter value. Range: [0, PX_MAX_F32) + + \see isSleeping() getWakeCounter() + */ + virtual void setWakeCounter(PxReal wakeCounterValue) = 0; + + /** + \brief Returns the wake counter of the 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 diff --git a/engine/third_party/physx/include/PxDeformableBodyFlag.h b/engine/third_party/physx/include/PxDeformableBodyFlag.h new file mode 100644 index 00000000..2714e428 --- /dev/null +++ b/engine/third_party/physx/include/PxDeformableBodyFlag.h @@ -0,0 +1,59 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PxDeformableBodyFlags; + +#if !PX_DOXYGEN +} +#endif + +#endif // PX_DEFORMABLE_BODY_FLAGS_H diff --git a/engine/third_party/physx/include/PxDeformableElementFilter.h b/engine/third_party/physx/include/PxDeformableElementFilter.h new file mode 100644 index 00000000..b80fa854 --- /dev/null +++ b/engine/third_party/physx/include/PxDeformableElementFilter.h @@ -0,0 +1,169 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 groupElementCounts[2]; + + /** + \brief Element indices for all filter groups, per actor. + */ + PxTypedBoundedData 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 diff --git a/engine/third_party/physx/include/PxDeformableMaterial.h b/engine/third_party/physx/include/PxDeformableMaterial.h new file mode 100644 index 00000000..d1b476a8 --- /dev/null +++ b/engine/third_party/physx/include/PxDeformableMaterial.h @@ -0,0 +1,133 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 + + Default: 1.e6 + \param[in] young Young's modulus. Range: [0, PX_MAX_F32) + \see getYoungsModulus() + */ + virtual void setYoungsModulus(PxReal young) = 0; + + /** + \brief Retrieves the young's modulus value. + + \return The young's modulus value. + + \see setYoungsModulus() + */ + virtual PxReal getYoungsModulus() const = 0; + + /** + \brief Sets the Poisson's ratio which defines the body's volume preservation. + + Default: 0.45 + \param[in] poisson Poisson's ratio. Range: [0, 0.5] + + \see getPoissons() + */ + virtual void setPoissons(PxReal poisson) = 0; + + /** + \brief Retrieves the Poisson's ratio. + \return The Poisson's ratio. + + \see setPoissons() + */ + virtual PxReal getPoissons() const = 0; + + /** + \brief Sets the dynamic friction value which defines the strength of resistance when two objects slide relative to each other while in contact. + + Default: 0.0 + \param[in] dynamicFriction The dynamic friction value. Range: [0, PX_MAX_F32) + + \see getDynamicFriction() + */ + virtual void setDynamicFriction(PxReal dynamicFriction) = 0; + + /** + \brief Retrieves the dynamic friction value + \return The dynamic friction value + + \see setDynamicFriction() + */ + virtual PxReal getDynamicFriction() const = 0; + + /** + \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 diff --git a/engine/third_party/physx/include/PxDeformableSkinning.h b/engine/third_party/physx/include/PxDeformableSkinning.h new file mode 100644 index 00000000..61c3cc7e --- /dev/null +++ b/engine/third_party/physx/include/PxDeformableSkinning.h @@ -0,0 +1,224 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 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 skinnedVerticesD; + }; + + /** + \brief Structure for GPU data related to trimesh skinning. + */ + struct PxTrimeshSkinningGpuData + { + /** + \brief Pointer to guide vertices data on the GPU. + */ + PxTypedBoundedData guideVerticesD; + + /** + \brief Pointer to guide normals data on the GPU. + */ + PxTypedBoundedData 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 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 diff --git a/engine/third_party/physx/include/PxDeformableSurface.h b/engine/third_party/physx/include/PxDeformableSurface.h new file mode 100644 index 00000000..860be00b --- /dev/null +++ b/engine/third_party/physx/include/PxDeformableSurface.h @@ -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 + + Default: 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 + + Default: 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. + Default: 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 + Default: 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 + diff --git a/engine/third_party/physx/include/PxDeformableSurfaceFlag.h b/engine/third_party/physx/include/PxDeformableSurfaceFlag.h new file mode 100644 index 00000000..166f2d56 --- /dev/null +++ b/engine/third_party/physx/include/PxDeformableSurfaceFlag.h @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 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 PxDeformableSurfaceDataFlags; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif // PX_PHYSICS_DEFORMABLE_SURFACE_FLAGS_H diff --git a/engine/third_party/physx/include/PxDeformableSurfaceMaterial.h b/engine/third_party/physx/include/PxDeformableSurfaceMaterial.h new file mode 100644 index 00000000..2d348844 --- /dev/null +++ b/engine/third_party/physx/include/PxDeformableSurfaceMaterial.h @@ -0,0 +1,119 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 + + Default: 0.001 + \param[in] thickness Material thickness. + + \see getThickness() + */ + virtual void setThickness(PxReal thickness) = 0; + + /** + \brief Retrieves the material thickness. + + Default: 0.001 + \return thickness. + \see setThickness() + */ + virtual PxReal getThickness() const = 0; + + /** + \brief Sets material bending stiffness + + Default: 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 diff --git a/engine/third_party/physx/include/PxDeformableVolume.h b/engine/third_party/physx/include/PxDeformableVolume.h new file mode 100644 index 00000000..0c6d6fb8 --- /dev/null +++ b/engine/third_party/physx/include/PxDeformableVolume.h @@ -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 + + Default: 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 + + Default: 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. + Default: 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 + Default: 4 position iterations, 1 velocity iteration + \param[in] minPositionIters Minimal number of position iterations the solver should perform for this body. Range: [1,255] + \param[in] minVelocityIters Minimal number of velocity iterations the solver should perform for this body. Range: [1,255] + \see 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 diff --git a/engine/third_party/physx/include/PxDeformableVolumeFlag.h b/engine/third_party/physx/include/PxDeformableVolumeFlag.h new file mode 100644 index 00000000..56ab7d97 --- /dev/null +++ b/engine/third_party/physx/include/PxDeformableVolumeFlag.h @@ -0,0 +1,84 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 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 PxDeformableVolumeDataFlags; + +#if !PX_DOXYGEN +} +#endif + +#endif // PX_DEFORMABLE_VOLUME_FLAGS_H diff --git a/engine/third_party/physx/include/PxDeformableVolumeMaterial.h b/engine/third_party/physx/include/PxDeformableVolumeMaterial.h new file mode 100644 index 00000000..8b9adce0 --- /dev/null +++ b/engine/third_party/physx/include/PxDeformableVolumeMaterial.h @@ -0,0 +1,136 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. Range: [0, PX_MAX_F32)
+ + \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. Default: 1 Range: [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 diff --git a/engine/third_party/physx/include/PxDeletionListener.h b/engine/third_party/physx/include/PxDeletionListener.h new file mode 100644 index 00000000..f1792fdc --- /dev/null +++ b/engine/third_party/physx/include/PxDeletionListener.h @@ -0,0 +1,100 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PxDeletionEventFlags; +PX_FLAGS_OPERATORS(PxDeletionEventFlag::Enum,PxU8) + + +/** +\brief interface to get notification on object deletion + +*/ +class PxDeletionListener +{ +public: + /** + \brief Notification if an object or its memory gets released + + If release() gets called on a PxBase object, an eUSER_RELEASE event will get fired immediately. The object state can be queried in the callback but + it is not allowed to change the state. Furthermore, when reading from the object it is the user's responsibility to make sure that no other thread + is writing at the same time to the object (this includes the simulation itself, i.e., #PxScene::fetchResults() must not get called at the same time). + + Calling release() on a PxBase object does not necessarily trigger its destructor immediately. For example, the object can be shared and might still + be referenced by other objects or the simulation might still be running and accessing the object state. In such cases the destructor will be called + as soon as it is safe to do so. After the destruction of the object and its memory, an eMEMORY_RELEASE event will get fired. In this case it is not + allowed to dereference the object pointer in the callback. + + \param[in] observed The object for which the deletion event gets fired. + \param[in] userData The user data pointer of the object for which the deletion event gets fired. Not available for all object types in which case it will be set to 0. + \param[in] deletionEvent The type of deletion event. Do not dereference the object pointer argument if the event is eMEMORY_RELEASE. + + */ + virtual void onRelease(const PxBase* observed, void* userData, PxDeletionEventFlag::Enum deletionEvent) = 0; + +protected: + PxDeletionListener() {} + virtual ~PxDeletionListener() {} +}; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxDirectGPUAPI.h b/engine/third_party/physx/include/PxDirectGPUAPI.h new file mode 100644 index 00000000..b6ddd3b3 --- /dev/null +++ b/engine/third_party/physx/include/PxDirectGPUAPI.h @@ -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 diff --git a/engine/third_party/physx/include/PxFEMMaterial.h b/engine/third_party/physx/include/PxFEMMaterial.h new file mode 100644 index 00000000..303a341f --- /dev/null +++ b/engine/third_party/physx/include/PxFEMMaterial.h @@ -0,0 +1,49 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 diff --git a/engine/third_party/physx/include/PxFEMParameter.h b/engine/third_party/physx/include/PxFEMParameter.h new file mode 100644 index 00000000..31260f39 --- /dev/null +++ b/engine/third_party/physx/include/PxFEMParameter.h @@ -0,0 +1,102 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 + Default: 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 + Default: 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 + Default: 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) + Default: 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. + Default: 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 + Default: 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 diff --git a/engine/third_party/physx/include/PxFEMSoftBodyMaterial.h b/engine/third_party/physx/include/PxFEMSoftBodyMaterial.h new file mode 100644 index 00000000..b9ddcdd8 --- /dev/null +++ b/engine/third_party/physx/include/PxFEMSoftBodyMaterial.h @@ -0,0 +1,56 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 diff --git a/engine/third_party/physx/include/PxFiltering.h b/engine/third_party/physx/include/PxFiltering.h new file mode 100644 index 00000000..7a6f946c --- /dev/null +++ b/engine/third_party/physx/include/PxFiltering.h @@ -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 PxPairFlags; +PX_FLAGS_OPERATORS(PxPairFlag::Enum, PxU16) + + + +/** +\brief Collection of flags describing the filter actions to take for a collision pair. + +\see PxFilterFlags PxSimulationFilterShader PxSimulationFilterCallback +*/ +struct PxFilterFlag +{ + enum Enum + { + /** + \brief Ignore the collision pair as long as the bounding volumes of the pair objects overlap. + + Killed pairs will be ignored by the simulation and won't run through the filter again until one + of the following occurs: + + \li The bounding volumes of the two objects overlap again (after being separated) + \li The user enforces a re-filtering (see #PxScene::resetFiltering()) + + \see PxScene::resetFiltering() + */ + eKILL = (1<<0), + + /** + \brief Ignore the collision pair as long as the bounding volumes of the pair objects overlap or until filtering relevant data changes for one of the collision objects. + + Suppressed pairs will be ignored by the simulation and won't make another filter request until one + of the following occurs: + + \li Same conditions as for killed pairs (see #eKILL) + \li The filter data or the filter object attributes change for one of the collision objects + + \see PxFilterData PxFilterObjectAttributes + */ + eSUPPRESS = (1<<1), + + /** + \brief Invoke the filter callback (#PxSimulationFilterCallback::pairFound()) for this collision pair. + + \see PxSimulationFilterCallback + */ + eCALLBACK = (1<<2), + + /** + \brief Track this collision pair with the filter callback mechanism. + + When the bounding volumes of the collision pair lose contact, the filter callback #PxSimulationFilterCallback::pairLost() + will be invoked. Furthermore, the filter status of the collision pair can be adjusted through #PxSimulationFilterCallback::statusChange() + once per frame (until a pairLost() notification occurs). + + \see PxSimulationFilterCallback + */ + eNOTIFY = (1<<3) | eCALLBACK, + + /** + \brief Provided default to get standard behavior: + + The application configure the pair's collision properties once when bounding volume overlap is found and + doesn't get asked again about that pair until overlap status or filter properties changes, or re-filtering is requested. + + No notification is provided when bounding volume overlap is lost + + The pair will not be killed or suppressed, so collision detection will be processed + */ + + eDEFAULT = 0 + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxFilterFlag. + +\see PxFilterFlag +*/ +typedef PxFlags PxFilterFlags; +PX_FLAGS_OPERATORS(PxFilterFlag::Enum, PxU16) + + +/** +\brief PxFilterData is user-definable data which gets passed into the collision filtering shader and/or callback. + +\see PxShape.setSimulationFilterData() PxShape.getSimulationFilterData() PxSimulationFilterShader PxSimulationFilterCallback +*/ +struct PxFilterData +{ + 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 diff --git a/engine/third_party/physx/include/PxForceMode.h b/engine/third_party/physx/include/PxForceMode.h new file mode 100644 index 00000000..6e31256f --- /dev/null +++ b/engine/third_party/physx/include/PxForceMode.h @@ -0,0 +1,60 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 diff --git a/engine/third_party/physx/include/PxImmediateMode.h b/engine/third_party/physx/include/PxImmediateMode.h new file mode 100644 index 00000000..40ed8a9f --- /dev/null +++ b/engine/third_party/physx/include/PxImmediateMode.h @@ -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;iRange: [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 Range: [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& gpuParticleSystem, CUstream stream) + { + mIsosurfaceExtractor->extractIsosurface(reinterpret_cast(gpuParticleSystem.mHostPtr->mUnsortedPositions_InvMass), + gpuParticleSystem.mHostPtr->mCommonData.mMaxParticles, stream, gpuParticleSystem.mHostPtr->mUnsortedPhaseArray, mValidPhaseMask); + } + + virtual void onBegin(const PxGpuMirroredPointer& /*gpuParticleSystem*/, CUstream /*stream*/) { } + + virtual void onAdvance(const PxGpuMirroredPointer& /*gpuParticleSystem*/, CUstream /*stream*/) { } + + private: + PxIsosurfaceExtractor* mIsosurfaceExtractor; + PxU32 mValidPhaseMask; + }; + +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxLockedData.h b/engine/third_party/physx/include/PxLockedData.h new file mode 100644 index 00000000..c29e67bd --- /dev/null +++ b/engine/third_party/physx/include/PxLockedData.h @@ -0,0 +1,87 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PxDataAccessFlags; +PX_FLAGS_OPERATORS(PxDataAccessFlag::Enum,PxU8) + + +/** +\brief Parent class for bulk data that is shared between the SDK and the application. +*/ +class PxLockedData +{ +public: + + /** + \brief Any combination of PxDataAccessFlag::eREADABLE and PxDataAccessFlag::eWRITABLE + \see PxDataAccessFlag + */ + virtual PxDataAccessFlags getDataAccessFlags() = 0; + + /** + \brief Unlocks the bulk data. + */ + virtual void unlock() = 0; + + /** + \brief virtual destructor + */ + virtual ~PxLockedData() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxMaterial.h b/engine/third_party/physx/include/PxMaterial.h new file mode 100644 index 00000000..b4d86251 --- /dev/null +++ b/engine/third_party/physx/include/PxMaterial.h @@ -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 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. + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] coef Coefficient of dynamic friction. Range: [0, PX_MAX_F32) + + \see getDynamicFriction() + */ + virtual void setDynamicFriction(PxReal coef) = 0; + + /** + \brief Retrieves the DynamicFriction value. + + \return The coefficient of dynamic friction. + + \see setDynamicFriction + */ + virtual PxReal getDynamicFriction() const = 0; + + /** + \brief Sets the coefficient of static friction + + The coefficient of static friction should be in the range [0, PX_MAX_F32) + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] coef Coefficient of static friction. Range: [0, PX_MAX_F32) + + \see getStaticFriction() + */ + virtual void setStaticFriction(PxReal coef) = 0; + + /** + \brief Retrieves the coefficient of static friction. + \return The coefficient of static friction. + + \see setStaticFriction + */ + virtual PxReal getStaticFriction() const = 0; + + /** + \brief Sets the coefficient of restitution 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. + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] rest Coefficient of restitution / negative spring stiffness Range: (-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. + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] damping Coefficient of damping. Range: [0,INF) + + \see getDamping() + */ + virtual void setDamping(PxReal damping) = 0; + + /** + \brief Retrieves the coefficient of damping. + + See #setDamping. + + \return The coefficient of damping. + + \see setDamping() + */ + virtual PxReal getDamping() const = 0; + + /** + \brief Raises or clears a particular material flag. + + See the list of flags #PxMaterialFlag + + Default: No flag raised. + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] flag The PxMaterial flag to raise(set) or clear. + \param[in] b New state of the flag + + \see getFlags() setFlags() PxMaterialFlag + */ + virtual void setFlag(PxMaterialFlag::Enum flag, bool b) = 0; + + /** + \brief sets all the material flags. + + See the list of flags #PxMaterialFlag + + Default: No flag raised. + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] flags All PxMaterial flags + + \see getFlags() setFlag() PxMaterialFlag + */ + virtual void setFlags(PxMaterialFlags flags) = 0; + + /** + \brief Retrieves the flags. See #PxMaterialFlag. + + \return The material flags. + + \see PxMaterialFlag setFlags() + */ + virtual PxMaterialFlags getFlags() const = 0; + + /** + \brief Sets the friction combine mode. + + See the enum ::PxCombineMode . + + Default: PxCombineMode::eAVERAGE + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] combMode Friction combine mode to set for this material. See #PxCombineMode. + + \see PxCombineMode getFrictionCombineMode setStaticFriction() setDynamicFriction() + */ + virtual void setFrictionCombineMode(PxCombineMode::Enum combMode) = 0; + + /** + \brief Retrieves the friction combine mode. + + See #setFrictionCombineMode. + + \return The friction combine mode for this material. + + \see PxCombineMode setFrictionCombineMode() + */ + virtual PxCombineMode::Enum getFrictionCombineMode() const = 0; + + /** + \brief Sets the restitution combine mode. + + See the enum ::PxCombineMode . + + Default: PxCombineMode::eAVERAGE + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] combMode Restitution combine mode for this material. See #PxCombineMode. + + \see PxCombineMode getRestitutionCombineMode() setRestitution() + */ + virtual void setRestitutionCombineMode(PxCombineMode::Enum combMode) = 0; + + /** + \brief Retrieves the restitution combine mode. + + See #setRestitutionCombineMode. + + \return The coefficient of restitution combine mode for this material. + + \see PxCombineMode setRestitutionCombineMode getRestitution() + */ + virtual PxCombineMode::Enum getRestitutionCombineMode() const = 0; + + /** + \brief Sets the damping combine mode. + + See the enum ::PxCombineMode . + + Default: PxCombineMode::eAVERAGE + + Sleeping: Does NOT 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 diff --git a/engine/third_party/physx/include/PxNodeIndex.h b/engine/third_party/physx/include/PxNodeIndex.h new file mode 100644 index 00000000..c12cd317 --- /dev/null +++ b/engine/third_party/physx/include/PxNodeIndex.h @@ -0,0 +1,102 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 diff --git a/engine/third_party/physx/include/PxPBDMaterial.h b/engine/third_party/physx/include/PxPBDMaterial.h new file mode 100644 index 00000000..f642e51f --- /dev/null +++ b/engine/third_party/physx/include/PxPBDMaterial.h @@ -0,0 +1,318 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. Range: [0, PX_MAX_F32) + + \see #getFriction() + */ + virtual void setFriction(PxReal friction) = 0; + + /** + \brief Retrieves the friction value. + + \return The friction value. + + \see #setFriction() + */ + virtual PxReal getFriction() const = 0; + + /** + \brief Sets velocity damping term + + \param[in] damping Velocity damping term. Range: [0, PX_MAX_F32) + + \see #getDamping + */ + virtual void setDamping(PxReal damping) = 0; + + /** + \brief Retrieves the velocity damping term + \return The velocity damping term. + + \see #setDamping() + */ + virtual PxReal getDamping() const = 0; + + /** + \brief Sets adhesion term + + \param[in] adhesion adhesion coefficient. Range: [0, PX_MAX_F32) + + \see #getAdhesion + */ + virtual void setAdhesion(PxReal adhesion) = 0; + + /** + \brief Retrieves the adhesion term + \return The adhesion term. + + \see #setAdhesion() + */ + virtual PxReal getAdhesion() const = 0; + + /** + \brief Sets gravity scale term + + \param[in] scale gravity scale coefficient. Range: (-PX_MAX_F32, PX_MAX_F32) + + \see #getAdhesion + */ + virtual void setGravityScale(PxReal scale) = 0; + + /** + \brief Retrieves the gravity scale term + \return The gravity scale term. + + \see #setAdhesion() + */ + virtual PxReal getGravityScale() const = 0; + + /** + \brief Sets material adhesion radius scale. This is multiplied by the particle rest offset to compute the fall-off distance + at which point adhesion ceases to operate. + + \param[in] scale Material adhesion radius scale. Range: [0, PX_MAX_F32) + + \see #getAdhesionRadiusScale + */ + virtual void setAdhesionRadiusScale(PxReal scale) = 0; + + /** + \brief Retrieves the adhesion radius scale. + \return The adhesion radius scale. + + \see #setAdhesionRadiusScale() + */ + virtual PxReal getAdhesionRadiusScale() const = 0; + + /** + \brief Sets viscosity + + \param[in] viscosity Viscosity. Range: [0, PX_MAX_F32) + + \see #getViscosity() + */ + virtual void setViscosity(PxReal viscosity) = 0; + + /** + \brief Retrieves the viscosity value. + + \return The viscosity value. + + \see #setViscosity() + */ + virtual PxReal getViscosity() const = 0; + + /** + \brief Sets material vorticity confinement coefficient + + \param[in] vorticityConfinement Material vorticity confinement coefficient. Range: [0, PX_MAX_F32) + + \see #getVorticityConfinement() + */ + virtual void setVorticityConfinement(PxReal vorticityConfinement) = 0; + + /** + \brief Retrieves the vorticity confinement coefficient. + \return The vorticity confinement coefficient. + + \see #setVorticityConfinement() + */ + virtual PxReal getVorticityConfinement() const = 0; + + /** + \brief Sets material surface tension coefficient + + \param[in] surfaceTension Material surface tension coefficient. Range: [0, PX_MAX_F32) + + \see #getSurfaceTension() + */ + virtual void setSurfaceTension(PxReal surfaceTension) = 0; + + /** + \brief Retrieves the surface tension coefficient. + \return The surface tension coefficient. + + \see #setSurfaceTension() + */ + virtual PxReal getSurfaceTension() const = 0; + + /** + \brief Sets material cohesion coefficient + + \param[in] cohesion Material cohesion coefficient. Range: [0, PX_MAX_F32) + + \see #getCohesion() + */ + virtual void setCohesion(PxReal cohesion) = 0; + + /** + \brief Retrieves the cohesion coefficient. + \return The cohesion coefficient. + + \see #setCohesion() + */ + virtual PxReal getCohesion() const = 0; + + /** + \brief Sets material lift coefficient + + \deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated. + + \param[in] lift Material lift coefficient. Range: [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. Range: [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. Range: [0, PX_MAX_F32), Default: 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. Range: [0, PX_MAX_F32) + + \see #getParticleFrictionScale() + */ + virtual void setParticleFrictionScale(PxReal scale) = 0; + + /** + \brief Retrieves the particle friction scale. + \return The particle friction scale. + + \see #setParticleFrictionScale() + */ + virtual PxReal getParticleFrictionScale() const = 0; + + /** + \brief Sets material particle adhesion scale value. This is the adhesive value between particles defined as a scaled multiple of the adhesion parameter. + + \param[in] adhesion particle adhesion scale value. Range: [0, PX_MAX_F32) + + \see #getParticleAdhesionScale() + */ + virtual void setParticleAdhesionScale(PxReal adhesion) = 0; + + /** + \brief Retrieves the particle adhesion scale value. + \return The particle adhesion scale value. + + \see #setParticleAdhesionScale() + */ + virtual PxReal getParticleAdhesionScale() const = 0; + + virtual const char* getConcreteTypeName() const 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 diff --git a/engine/third_party/physx/include/PxPBDParticleSystem.h b/engine/third_party/physx/include/PxPBDParticleSystem.h new file mode 100644 index 00000000..7e653422 --- /dev/null +++ b/engine/third_party/physx/include/PxPBDParticleSystem.h @@ -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 +struct PxGpuMirroredPointer +{ + Type* mDevicePtr; + Type* mHostPtr; + + PxGpuMirroredPointer(Type* devicePtr, Type* hostPtr) : mDevicePtr(devicePtr), mHostPtr(hostPtr) { } +}; + +/** +\brief Particle system callback base class to schedule work that should be done before, while or after the particle system updates. +A call to fetchResultsParticleSystem() on the PxScene will synchronize the work such that the caller knows that all tasks of this callback completed. +*/ +class PxParticleSystemCallback +{ +public: + /** + \brief Method gets called when dirty data from the particle system is uploated to the gpu + + \param[in] gpuParticleSystem Pointers to the particle systems gpu data available as host accessible pointer and as gpu accessible pointer + \param[in] stream The stream on which all cuda kernel calls get scheduled for execution. A call to fetchResultsParticleSystem() on the + PxScene will synchronize the work such that the caller knows that the task completed. + */ + virtual void onBegin(const PxGpuMirroredPointer& gpuParticleSystem, CUstream stream) = 0; + + /** + \brief Method gets called when the simulation step of the particle system is performed + + \param[in] gpuParticleSystem Pointers to the particle systems gpu data available as host accessible pointer and as gpu accessible pointer + \param[in] stream The stream on which all cuda kernel calls get scheduled for execution. A call to fetchResultsParticleSystem() on the + PxScene will synchronize the work such that the caller knows that the task completed. + */ + virtual void onAdvance(const PxGpuMirroredPointer& gpuParticleSystem, CUstream stream) = 0; + + /** + \brief Method gets called after the particle system simulation step completed + + \param[in] gpuParticleSystem Pointers to the particle systems gpu data available as host accessible pointer and as gpu accessible pointer + \param[in] stream The stream on which all cuda kernel calls get scheduled for execution. A call to fetchResultsParticleSystem() on the + PxScene will synchronize the work such that the caller knows that the task completed. + */ + virtual void onPostSolve(const PxGpuMirroredPointer& gpuParticleSystem, CUstream stream) = 0; + + /** + \brief Destructor + */ + virtual ~PxParticleSystemCallback() {} +}; + +/** +\brief Special callback that forwards calls to arbitrarily many sub-callbacks +*/ +class PxMultiCallback : public PxParticleSystemCallback +{ +private: + PxArray mCallbacks; + +public: + PxMultiCallback() : mCallbacks(0) {} + + virtual void onPostSolve(const PxGpuMirroredPointer& gpuParticleSystem, CUstream stream) PX_OVERRIDE + { + for (PxU32 i = 0; i < mCallbacks.size(); ++i) + mCallbacks[i]->onPostSolve(gpuParticleSystem, stream); + } + + virtual void onBegin(const PxGpuMirroredPointer& gpuParticleSystem, CUstream stream) PX_OVERRIDE + { + for (PxU32 i = 0; i < mCallbacks.size(); ++i) + mCallbacks[i]->onBegin(gpuParticleSystem, stream); + } + + virtual void onAdvance(const PxGpuMirroredPointer& 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 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 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. + + Default: 4 position iterations, 1 velocity iteration + + \param[in] minPositionIters Number of position iterations the solver should perform for this body. Range: [1,255] + \param[in] minVelocityIters Number of velocity iterations the solver should perform for this body. Range: [1,255] + + See #getSolverIterationCounts() + */ + virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) = 0; + + /** + \brief Retrieves the solver iteration counts. + + See #setSolverIterationCounts() + */ + virtual void getSolverIterationCounts(PxU32& minPositionIters, PxU32& minVelocityIters) const = 0; + + /** + \brief Retrieves the collision filter settings. + + \return The filter data + */ + virtual PxFilterData getSimulationFilterData() const = 0; + + /** + \brief Set collision filter settings + + Allows to control with which objects the particle system collides + + \param[in] data The filter data + */ + virtual void setSimulationFilterData(const PxFilterData& data) = 0; + + /** + \brief Set particle flag + + Allows to control self collision etc. + + \param[in] flag The flag to set + \param[in] val The new value of the flag + */ + virtual void setParticleFlag(PxParticleFlag::Enum flag, bool val) = 0; + + /** + \brief Set particle flags + + Allows to control self collision etc. + + \param[in] flags The flags to set + */ + virtual void setParticleFlags(PxParticleFlags flags) = 0; + + /** + \brief Retrieves the particle flags. + + \return The particle flags + */ + virtual PxParticleFlags getParticleFlags() const = 0; + + /** + \brief Set the maximal depenetration velocity particles can reach + + Allows to limit the particles' maximal depenetration velocity to avoid that collision responses lead to very high particle velocities + + \param[in] maxDepenetrationVelocity The maximal depenetration velocity + */ + virtual void setMaxDepenetrationVelocity(PxReal maxDepenetrationVelocity) = 0; + + /** + \brief Retrieves maximal depenetration velocity a particle can have. + + \return The maximal depenetration velocity + */ + virtual PxReal getMaxDepenetrationVelocity() 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 Range: (0, contactOffset) + */ + virtual void setRestOffset(PxReal restOffset) = 0; + + /** + \brief Return the rest offset + \return the rest offset + + See #setRestOffset() + */ + virtual PxReal getRestOffset() const = 0; + + /** + \brief Set the contact offset for the collision between particles and rigids or soft bodies + + The contact offset needs to be larger than the rest offset. + Contact constraints are generated for a particle and a rigid or deformable below the distance equal to the sum of their contacOffset values. + + \param[in] contactOffset Range: (restOffset, PX_MAX_F32) + */ + virtual void setContactOffset(PxReal contactOffset) = 0; + + /** + \brief Return the contact offset + \return the contact offset + + See #setContactOffset() + */ + virtual PxReal getContactOffset() const = 0; + + /** + \brief Set the contact offset for the interactions between particles + + The particle contact offset needs to be larger than the fluid rest offset and larger than the solid rest offset. + Interactions for two particles are computed if their distance is below twice the particleContactOffset value. + + \param[in] particleContactOffset Range: (Max(solidRestOffset, fluidRestOffset), PX_MAX_F32) + */ + virtual void setParticleContactOffset(PxReal particleContactOffset) = 0; + + /** + \brief Return the particle contact offset + \return the particle contact offset + + See #setParticleContactOffset() + */ + virtual PxReal getParticleContactOffset() const = 0; + + /** + \brief Set the solid rest offset + + Two solid particles (or a solid and a fluid particle) will come to rest at a distance equal to twice the solidRestOffset value. + + \param[in] solidRestOffset Range: (0, particleContactOffset) + */ + virtual void setSolidRestOffset(PxReal solidRestOffset) = 0; + + /** + \brief Return the solid rest offset + \return the solid rest offset + + See #setSolidRestOffset() + */ + virtual PxReal getSolidRestOffset() const = 0; + + + /** + \brief Creates a rigid attachment between a particle and a rigid actor. + + \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 + + Default: 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 Range: (0.0, 1.0) + */ + virtual void setFluidBoundaryDensityScale(PxReal fluidBoundaryDensityScale) = 0; + + /** + \brief Return the fluid boundary density scale + \return the fluid boundary density scale + + See #setFluidBoundaryDensityScale() + */ + virtual PxReal getFluidBoundaryDensityScale() const = 0; + + /** + \brief Set the fluid rest offset + + Two fluid particles will come to rest at a distance equal to twice the fluidRestOffset value. + + \param[in] fluidRestOffset Range: (0, particleContactOffset) + */ + virtual void setFluidRestOffset(PxReal fluidRestOffset) = 0; + + /** + \brief Return the fluid rest offset + \return the fluid rest offset + + See #setFluidRestOffset() + */ + virtual PxReal getFluidRestOffset() const = 0; + + /** + \brief Set the particle system grid size x dimension + + \param[in] gridSizeX x dimension in the particle grid + */ + virtual void setGridSizeX(PxU32 gridSizeX) = 0; + + /** + \brief 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 diff --git a/engine/third_party/physx/include/PxParticleBuffer.h b/engine/third_party/physx/include/PxParticleBuffer.h new file mode 100644 index 00000000..0a8d8c2b --- /dev/null +++ b/engine/third_party/physx/include/PxParticleBuffer.h @@ -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 diff --git a/engine/third_party/physx/include/PxParticleGpu.h b/engine/third_party/physx/include/PxParticleGpu.h new file mode 100644 index 00000000..3c8a04bd --- /dev/null +++ b/engine/third_party/physx/include/PxParticleGpu.h @@ -0,0 +1,188 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 + diff --git a/engine/third_party/physx/include/PxParticleMaterial.h b/engine/third_party/physx/include/PxParticleMaterial.h new file mode 100644 index 00000000..b13113c2 --- /dev/null +++ b/engine/third_party/physx/include/PxParticleMaterial.h @@ -0,0 +1,47 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 diff --git a/engine/third_party/physx/include/PxParticleNeighborhoodProvider.h b/engine/third_party/physx/include/PxParticleNeighborhoodProvider.h new file mode 100644 index 00000000..a2182c37 --- /dev/null +++ b/engine/third_party/physx/include/PxParticleNeighborhoodProvider.h @@ -0,0 +1,130 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 diff --git a/engine/third_party/physx/include/PxParticleSolverType.h b/engine/third_party/physx/include/PxParticleSolverType.h new file mode 100644 index 00000000..8f9912ac --- /dev/null +++ b/engine/third_party/physx/include/PxParticleSolverType.h @@ -0,0 +1,66 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 diff --git a/engine/third_party/physx/include/PxParticleSystem.h b/engine/third_party/physx/include/PxParticleSystem.h new file mode 100644 index 00000000..b25745e0 --- /dev/null +++ b/engine/third_party/physx/include/PxParticleSystem.h @@ -0,0 +1,47 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SYSTEM_H +#define PX_PARTICLE_SYSTEM_H + +#include "foundation/PxPreprocessor.h" +#include "PxPBDParticleSystem.h" + +#if !PX_DOXYGEN +namespace physx +{ + +/** + \deprecated This typedef only serves for deprecation and will be removed in a future version. + */ +typedef PX_DEPRECATED PxPBDParticleSystem PxParticleSystem; + +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxParticleSystemFlag.h b/engine/third_party/physx/include/PxParticleSystemFlag.h new file mode 100644 index 00000000..f9df1e0a --- /dev/null +++ b/engine/third_party/physx/include/PxParticleSystemFlag.h @@ -0,0 +1,104 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SYSTEM_FLAG_H +#define PX_PARTICLE_SYSTEM_FLAG_H + +#include "foundation/PxFlags.h" +#include "foundation/PxPreprocessor.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Identifies dirty particle buffers that need to be updated in the particle system. + +This flag can be used mark the device user buffers that are dirty and need to be written to the particle system. +*/ +struct PxParticleBufferFlag +{ + enum Enum + { + eNONE = 0, //!< No data specified + + eUPDATE_POSITION = 1 << 0, //!< Specifies the position (first 3 floats) and inverse mass (last float) data (array of PxVec4 * number of particles) + eUPDATE_VELOCITY = 1 << 1, //!< Specifies the velocity (first 3 floats) data (array of PxVec4 * number of particles) + eUPDATE_PHASE = 1 << 2, //!< Specifies the per-particle phase flag data (array of PxU32 * number of particles) + eUPDATE_RESTPOSITION = 1 << 3, //!< Specifies the rest position (first 3 floats) data for cloth buffers + eUPDATE_CLOTH = 1 << 5, //!< Specifies the cloth buffer (see PxParticleClothBuffer) + eUPDATE_RIGID = 1 << 6, //!< Specifies the rigid buffer (see PxParticleRigidBuffer) + eUPDATE_DIFFUSE_PARAM = 1 << 7, //!< Specifies the diffuse particle parameter buffer (see PxDiffuseParticleParams) + eUPDATE_ATTACHMENTS = 1 << 8, //!< Specifies the attachments. + + eALL = + eUPDATE_POSITION | eUPDATE_VELOCITY | eUPDATE_PHASE | eUPDATE_RESTPOSITION | eUPDATE_CLOTH | eUPDATE_RIGID | eUPDATE_DIFFUSE_PARAM | eUPDATE_ATTACHMENTS + }; +}; + +typedef PxFlags PxParticleBufferFlags; + +/** +\brief A pair of particle buffer unique id and GPU particle system index. + +\see PxScene::applyParticleBufferData + +\deprecated There is no replacement. +*/ +PX_DEPRECATED struct PxGpuParticleBufferIndexPair +{ + PxU32 systemIndex; // gpu particle system index + PxU32 bufferIndex; // particle buffer unique id +}; + +/** +\brief Identifies per-particle behavior for a PxParticleSystem. + +See #PxPBDParticleSystem::createPhase(). +*/ +struct PxParticlePhaseFlag +{ + enum Enum + { + eParticlePhaseGroupMask = 0x000fffff, //!< Bits [ 0, 19] represent the particle group for controlling collisions + eParticlePhaseFlagsMask = 0xfff00000, //!< Bits [20, 23] hold flags about how the particle behave + + eParticlePhaseSelfCollide = 1 << 20, //!< If set this particle will interact with particles of the same group + eParticlePhaseSelfCollideFilter = 1 << 21, //!< If set this particle will ignore collisions with particles closer than the radius in the rest pose, this flag should not be specified unless valid rest positions have been specified using setRestParticles() + eParticlePhaseFluid = 1 << 22 //!< If set this particle will generate fluid density constraints for its overlapping neighbors + }; +}; + +typedef PxFlags PxParticlePhaseFlags; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxPhysXConfig.h b/engine/third_party/physx/include/PxPhysXConfig.h new file mode 100644 index 00000000..223b8bf5 --- /dev/null +++ b/engine/third_party/physx/include/PxPhysXConfig.h @@ -0,0 +1,46 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CONFIG_H +#define PX_PHYSICS_CONFIG_H + +/** Configuration include file for PhysX SDK */ + + +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxPhysics.h b/engine/third_party/physx/include/PxPhysics.h new file mode 100644 index 00000000..07162f34 --- /dev/null +++ b/engine/third_party/physx/include/PxPhysics.h @@ -0,0 +1,1129 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_H +#define PX_PHYSICS_H + +#include "PxPhysXConfig.h" +#include "PxDeletionListener.h" +#include "foundation/PxTransform.h" +#include "PxShape.h" +#include "PxAggregate.h" +#include "PxParticleSystem.h" +#include "PxDeformableSurface.h" +#include "PxDeformableAttachment.h" +#include "PxDeformableElementFilter.h" +#include "foundation/PxPreprocessor.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxScene; +class PxSceneDesc; +class PxTolerancesScale; +class PxPvd; +class PxOmniPvd; +class PxInsertionCallback; + +class PxRigidActor; +class PxConstraintConnector; +struct PxConstraintShaderTable; + +class PxGeometry; +class PxFoundation; + +class PxPruningStructure; +class PxBVH; + +class PxParticleClothBuffer; +class PxParticleRigidBuffer; + +class PxDeformableVolumeMesh; + +class PxInputStream; + +/** +\brief Abstract singleton factory class used for instancing objects in the Physics SDK. + +In addition you can use PxPhysics to set global parameters which will effect all scenes and create +objects that can be shared across multiple scenes. + +You can get an instance of this class by calling PxCreatePhysics(). + +\see PxCreatePhysics() PxScene +*/ +class PxPhysics +{ +public: + + /** \name Basics + */ + //\{ + + virtual ~PxPhysics() {} + + /** + \brief Destroys the instance it is called on. + + Use this release method to destroy an instance of this class. Be sure + to not keep a reference to this object after calling release. + Avoid release calls while a scene is simulating (in between simulate() and fetchResults() calls). + + Note that this must be called once for each prior call to PxCreatePhysics, as + there is a reference counter. Also note that you mustn't destroy the PxFoundation instance (holding the allocator, error callback etc.) + until after the reference count reaches 0 and the SDK is actually removed. + + Releasing an SDK will also release any objects created through it (scenes, triangle meshes, convex meshes, heightfields, shapes etc.), + provided the user hasn't already done so. + + \note Releasing the PxPhysics instance is a prerequisite to releasing the PxFoundation instance. + + \see PxCreatePhysics() PxFoundation + */ + virtual void release() = 0; + + /** + \brief Retrieves the Foundation instance. + \return A reference to the Foundation object. + */ + virtual PxFoundation& getFoundation() = 0; + + /** + \brief Gets PxPhysics object insertion interface. + + The insertion interface is needed for PxCreateTriangleMesh, PxCooking::createTriangleMesh etc., this allows runtime mesh creation. + + \see PxCreateTriangleMesh PxCreateHeightField PxCreateTetrahedronMesh PxCreateBVH + PxCooking::createTriangleMesh PxCooking::createHeightfield PxCooking::createTetrahedronMesh PxCooking::createBVH + */ + virtual PxInsertionCallback& getPhysicsInsertionCallback() = 0; + + /** + \brief Retrieves the PxOmniPvd instance if there is one registered with PxPhysics. + \return A pointer to a PxOmniPvd object. + */ + virtual PxOmniPvd* getOmniPvd() = 0; + + /** + \brief Returns the simulation tolerance parameters. + \return The current simulation tolerance parameters. + */ + virtual const PxTolerancesScale& getTolerancesScale() const = 0; + + //\} + /** \name Aggregates + */ + //\{ + + /** + \brief Creates an aggregate with the specified maximum size and filtering hint. + + The previous API used "bool enableSelfCollision" which should now silently evaluates + to a PxAggregateType::eGENERIC aggregate with its self-collision bit. + + Use PxAggregateType::eSTATIC or PxAggregateType::eKINEMATIC for aggregates that will + only contain static or kinematic actors. This provides faster filtering when used in + combination with PxPairFilteringMode. + + \param [in] maxActor The maximum number of actors that may be placed in the aggregate. + \param [in] maxShape The maximum number of shapes that may be placed in the aggregate. + \param [in] filterHint The aggregate's filtering hint. + \return The new aggregate. + + \see PxAggregate PxAggregateFilterHint PxAggregateType PxPairFilteringMode + */ + virtual PxAggregate* createAggregate(PxU32 maxActor, PxU32 maxShape, PxAggregateFilterHint filterHint) = 0; + + /** + \brief Return the number of aggregates that currently exist. + + \return Number of aggregates. + */ + virtual PxU32 getNbAggregates() const = 0; + + //\} + /** \name Triangle Meshes + */ + //\{ + + /** + \brief Creates a triangle mesh object. + + This can then be instanced into #PxShape objects. + + \param [in] stream The triangle mesh stream. + \return The new triangle mesh. + + \see PxTriangleMesh PxMeshPreprocessingFlag PxTriangleMesh.release() PxInputStream PxTriangleMeshFlag + */ + virtual PxTriangleMesh* createTriangleMesh(PxInputStream& stream) = 0; + + /** + \brief Return the number of triangle meshes that currently exist. + + \return Number of triangle meshes. + + \see getTriangleMeshes() + */ + virtual PxU32 getNbTriangleMeshes() const = 0; + + /** + \brief Writes the array of triangle mesh pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the triangle meshes in the array is not specified. + + \param [out] userBuffer The buffer to receive triangle mesh pointers. + \param [in] bufferSize The number of triangle mesh pointers which can be stored in the buffer. + \param [in] startIndex Index of first mesh pointer to be retrieved. + \return The number of triangle mesh pointers written to userBuffer, this should be less or equal to bufferSize. + + \see getNbTriangleMeshes() PxTriangleMesh + */ + virtual PxU32 getTriangleMeshes(PxTriangleMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + //\} + /** \name Tetrahedron Meshes + */ + //\{ + + /** + \brief Creates a tetrahedron mesh object. + + This can then be instanced into #PxShape objects. + + \param[in] stream The tetrahedron mesh stream. + \return The new tetrahedron mesh. + + \see PxTetrahedronMesh PxMeshPreprocessingFlag PxTetrahedronMesh.release() PxInputStream PxTriangleMeshFlag + */ + virtual PxTetrahedronMesh* createTetrahedronMesh(PxInputStream& stream) = 0; + + /** + \brief Return the number of tetrahedron meshes that currently exist. + + \return Number of tetrahedron meshes. + + \see getTetrahedronMeshes() + */ + virtual PxU32 getNbTetrahedronMeshes() const = 0; + + /** + \brief Writes the array of tetrahedron mesh pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the tetrahedron meshes in the array is not specified. + + \param[out] userBuffer The buffer to receive tetrahedron mesh pointers. + \param[in] bufferSize The number of tetrahedron mesh pointers which can be stored in the buffer. + \param[in] startIndex Index of first mesh pointer to be retrieved. + \return The number of tetrahedron mesh pointers written to userBuffer, this should be less or equal to bufferSize. + + \see getNbTetrahedronMeshes() PxTetrahedronMesh + */ + virtual PxU32 getTetrahedronMeshes(PxTetrahedronMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + //\} + /** \name Heightfields + */ + //\{ + + /** + \brief Creates a heightfield object from previously cooked stream. + + This can then be instanced into #PxShape objects. + + \param [in] stream The heightfield mesh stream. + \return The new heightfield. + + \see PxHeightField PxHeightField.release() PxInputStream + */ + virtual PxHeightField* createHeightField(PxInputStream& stream) = 0; + + /** + \brief Return the number of heightfields that currently exist. + + \return Number of heightfields. + + \see getHeightFields() + */ + virtual PxU32 getNbHeightFields() const = 0; + + /** + \brief Writes the array of heightfield pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the heightfields in the array is not specified. + + \param [out] userBuffer The buffer to receive heightfield pointers. + \param [in] bufferSize The number of heightfield pointers which can be stored in the buffer. + \param [in] startIndex Index of first heightfield pointer to be retrieved. + \return The number of heightfield pointers written to userBuffer, this should be less or equal to bufferSize. + + \see getNbHeightFields() PxHeightField + */ + virtual PxU32 getHeightFields(PxHeightField** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + //\} + /** \name Convex meshes + */ + //\{ + + /** + \brief Creates a convex mesh object. + + This can then be instanced into #PxShape objects. + + \param [in] stream The stream to load the convex mesh from. + \return The new convex mesh. + + \see PxConvexMesh PxConvexMesh.release() PxInputStream createTriangleMesh() PxConvexMeshGeometry PxShape + */ + virtual PxConvexMesh* createConvexMesh(PxInputStream& stream) = 0; + + /** + \brief Return the number of convex meshes that currently exist. + + \return Number of convex meshes. + + \see getConvexMeshes() + */ + virtual PxU32 getNbConvexMeshes() const = 0; + + /** + \brief Writes the array of convex mesh pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the convex meshes in the array is not specified. + + \param [out] userBuffer The buffer to receive convex mesh pointers. + \param [in] bufferSize The number of convex mesh pointers which can be stored in the buffer. + \param [in] startIndex Index of first convex mesh pointer to be retrieved. + \return The number of convex mesh pointers written to userBuffer, this should be less or equal to bufferSize. + + \see getNbConvexMeshes() PxConvexMesh + */ + virtual PxU32 getConvexMeshes(PxConvexMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + //\} + /** \name Deformable volume meshes + */ + //\{ + + /** + \brief Creates a deformable volume mesh object. + + \param[in] stream The deformable volume mesh stream. + \return The new deformable volume mesh. + + \see createTetrahedronMesh + */ + virtual PxDeformableVolumeMesh* createDeformableVolumeMesh(PxInputStream& stream) = 0; + + /** + \brief Deprecated + \see createDeformableVolumeMesh + */ + PX_DEPRECATED PX_FORCE_INLINE PxDeformableVolumeMesh* createSoftBodyMesh(PxInputStream& stream) + { + return createDeformableVolumeMesh(stream); + } + + //\} + /** \name BVHs + */ + //\{ + + /** + \brief Creates a bounding volume hierarchy. + + \param [in] stream The stream to load the BVH from. + \return The new BVH. + + \see PxBVH PxInputStream + */ + virtual PxBVH* createBVH(PxInputStream& stream) = 0; + + /** + \brief Return the number of bounding volume hierarchies that currently exist. + + \return Number of bounding volume hierarchies. + + \see PxBVH getBVHs() + */ + virtual PxU32 getNbBVHs() const = 0; + + /** + \brief Writes the array of bounding volume hierarchy pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the BVHs in the array is not specified. + + \param [out] userBuffer The buffer to receive BVH pointers. + \param [in] bufferSize The number of BVH pointers which can be stored in the buffer. + \param [in] startIndex Index of first BVH pointer to be retrieved. + \return The number of BVH pointers written to userBuffer, this should be less or equal to bufferSize. + + \see getNbBVHs() PxBVH + */ + virtual PxU32 getBVHs(PxBVH** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + //\} + /** \name Scenes + */ + //\{ + + /** + \brief Creates a scene. + + \note Every scene uses a Thread Local Storage slot. This imposes a platform specific limit on the + number of scenes that can be created. + + \param [in] sceneDesc Scene descriptor. See #PxSceneDesc + \return The new scene object. + + \see PxScene PxScene.release() PxSceneDesc + */ + virtual PxScene* createScene(const PxSceneDesc& sceneDesc) = 0; + + /** + \brief Gets number of created scenes. + + \return The number of scenes created. + + \see getScenes() + */ + virtual PxU32 getNbScenes() const = 0; + + /** + \brief Writes the array of scene pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the scene pointers in the array is not specified. + + \param [out] userBuffer The buffer to receive scene pointers. + \param [in] bufferSize The number of scene pointers which can be stored in the buffer. + \param [in] startIndex Index of first scene pointer to be retrieved. + \return The number of scene pointers written to userBuffer, this should be less or equal to bufferSize. + + \see getNbScenes() PxScene + */ + virtual PxU32 getScenes(PxScene** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + //\} + /** \name Actors + */ + //\{ + + /** + \brief Creates a static rigid actor with the specified pose and all other fields initialized + to their default values. + + \param [in] pose The initial pose of the actor. Must be a valid transform. + + \see PxRigidStatic + */ + virtual PxRigidStatic* createRigidStatic(const PxTransform& pose) = 0; + + /** + \brief Creates a dynamic rigid actor with the specified pose and all other fields initialized + to their default values. + + \param [in] pose The initial pose of the actor. Must be a valid transform. + + \see PxRigidDynamic + */ + virtual PxRigidDynamic* createRigidDynamic(const PxTransform& pose) = 0; + + /** + \brief Creates a pruning structure from actors. + + \note Every provided actor needs at least one shape with the eSCENE_QUERY_SHAPE flag set. + \note Both static and dynamic actors can be provided. + \note It is not allowed to pass in actors which are already part of a scene. + \note Articulation links cannot be provided. + + \param [in] actors Array of actors to add to the pruning structure. Must be non NULL. + \param [in] nbActors Number of actors in the array. Must be >0. + \return Pruning structure created from given actors, or NULL if any of the actors did not comply with the above requirements. + \see PxActor PxPruningStructure + */ + virtual PxPruningStructure* createPruningStructure(PxRigidActor*const* actors, PxU32 nbActors) = 0; + + //\} + /** \name Shapes + */ + //\{ + + /** + \brief Creates a shape which may be attached to multiple actors + + The shape will be created with a reference count of 1. + + \param [in] geometry The geometry for the shape + \param [in] material The material for the shape + \param [in] isExclusive Whether this shape is exclusive to a single actor or maybe be shared + \param [in] shapeFlags The PxShapeFlags to be set + \return The shape + + \note Shared shapes are not mutable when they are attached to an actor + + \see PxShape + */ + PX_FORCE_INLINE PxShape* createShape( const PxGeometry& geometry, + const PxMaterial& material, + bool isExclusive = false, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) + { + PxMaterial* materialPtr = const_cast(&material); + return createShape(geometry, &materialPtr, 1, isExclusive, shapeFlags); + } + + /** + \brief Creates a shape which may be attached to exactly one deformable volume actor + + The shape will be created with a reference count of 1. + + \param [in] geometry The geometry for the shape + \param [in] material The material for the shape + \param [in] isExclusive Whether this shape is exclusive to a single actor or maybe be shared + \param [in] shapeFlags The PxShapeFlags to be set + \return The shape + + \note Shared shapes are not mutable when they are attached to an actor + + \see PxShape + */ + PX_FORCE_INLINE PxShape* createShape( const PxGeometry& geometry, + const PxDeformableVolumeMaterial& material, + bool isExclusive = false, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) + { + PxDeformableVolumeMaterial* materialPtr = const_cast(&material); + return createShape(geometry, &materialPtr, 1, isExclusive, shapeFlags); + } + + /** + \brief Creates a shape which may be attached to exactly one deformable surface actor + + The shape will be created with a reference count of 1. + + \param [in] geometry The geometry for the shape + \param [in] material The material for the shape + \param [in] isExclusive Whether this shape is exclusive to a single actor or maybe be shared + \param [in] shapeFlags The PxShapeFlags to be set + \return The shape + + \note Shared shapes are not mutable when they are attached to an actor + + \see PxShape + */ + PX_FORCE_INLINE PxShape* createShape( const PxGeometry& geometry, + const PxDeformableSurfaceMaterial& material, + bool isExclusive = false, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) + { + PxDeformableSurfaceMaterial* materialPtr = const_cast(&material); + return createShape(geometry, &materialPtr, 1, isExclusive, shapeFlags); + } + + /** + \brief Creates a shape which may be attached to multiple actors + + The shape will be created with a reference count of 1. + + \param [in] geometry The geometry for the shape + \param [in] materials The materials for the shape + \param [in] materialCount The number of materials + \param [in] isExclusive Whether this shape is exclusive to a single actor or may be shared + \param [in] shapeFlags The PxShapeFlags to be set + \return The shape + + \note Shared shapes are not mutable when they are attached to an actor + \note Shapes created from *SDF* triangle-mesh geometries do not support more than one material. + + \see PxShape + */ + virtual PxShape* createShape( const PxGeometry& geometry, + PxMaterial*const * materials, + PxU16 materialCount, + bool isExclusive = false, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0; + + virtual PxShape* createShape( const PxGeometry& geometry, + PxDeformableSurfaceMaterial*const * materials, + PxU16 materialCount, + bool isExclusive = false, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0; + + virtual PxShape* createShape( const PxGeometry& geometry, + PxDeformableVolumeMaterial*const * materials, + PxU16 materialCount, + bool isExclusive = false, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0; + + /** + \brief Return the number of shapes that currently exist. + + \return Number of shapes. + + \see getShapes() + */ + virtual PxU32 getNbShapes() const = 0; + + /** + \brief Writes the array of shape pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the shapes in the array is not specified. + + \param [out] userBuffer The buffer to receive shape pointers. + \param [in] bufferSize The number of shape pointers which can be stored in the buffer. + \param [in] startIndex Index of first shape pointer to be retrieved + \return The number of shape pointers written to userBuffer, this should be less or equal to bufferSize. + + \see getNbShapes() PxShape + */ + virtual PxU32 getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + //\} + /** \name Constraints and Articulations + */ + //\{ + + /** + \brief Creates a constraint shader. + + \note A constraint shader will get added automatically to the scene the two linked actors belong to. Either, but not both, of actor0 and actor1 may + be NULL to denote attachment to the world. + + \param [in] actor0 The first actor + \param [in] actor1 The second actor + \param [in] connector The connector object, which the SDK uses to communicate with the infrastructure for the constraint + \param [in] shaders The shader functions for the constraint + \param [in] dataSize The size of the data block for the shader + + \return The new constraint shader. + + \see PxConstraint + */ + virtual PxConstraint* createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) = 0; + + /** + \brief Return the number of constraints that currently exist. + + \return Number of constraints. + */ + virtual PxU32 getNbConstraints() const = 0; + + /** + \brief Creates a reduced-coordinate articulation with all fields initialized to their default values. + + \return the new articulation + + \see PxArticulationReducedCoordinate + */ + virtual PxArticulationReducedCoordinate* createArticulationReducedCoordinate() = 0; + + /** + \brief Return the number of articulations that currently exist. + + \return Number of articulations. + */ + virtual PxU32 getNbArticulations() const = 0; + + //\} + /** \name Misc + */ + //\{ + + /** + \brief Creates an attachment between two actors, based on the provided PxDeformableAttachmentData. At least one of the actors must be a deformable. + + An attachment is a collection of one or more positional constraints between a point on one actor and a point on another actor. + Attachments between two rigid objects are not permitted, use joints instead. + + \note The attachment is only active when both actors are added to the same scene or one of the actors is NULL. + + \param[in] data Attachment data. + \return The PxDeformableAttachment created if successful, NULL otherwise. + \see PxDeformableAttachmentData, PxDeformableAttachment + */ + virtual PxDeformableAttachment* createDeformableAttachment(const PxDeformableAttachmentData& data) = 0; + + /** + \brief Creates an element-level collision filter between two actors, based on the provided PxDeformableElementFilterData. At least one of the actors must be a deformable. + + Element filters define how parts of deformable actors are excluded from collisions. + They are usually added to avoid conflicting attachment and contact constraints. + + \note The element filter is only active when both actors are added to the same scene or one of the actors is NULL. + + \param[in] data Element filter data. + \return The PxDeformableElementFilter created if successful, NULL otherwise. + \see PxDeformableElementFilterData, PxDeformableElementFilter + */ + virtual PxDeformableElementFilter* createDeformableElementFilter(const PxDeformableElementFilterData& data) = 0; + + /** + \brief Creates a deformable surface with all fields initialized to their default values. + + \param[in] cudaContextManager The PxCudaContextManager this instance is tied to. + \return the new deformable surface + + \see PxDeformableSurface + */ + virtual PxDeformableSurface* createDeformableSurface(PxCudaContextManager& cudaContextManager) = 0; + + /** + \brief Creates a FEM-based deformable volume with all fields initialized to their default values. + + \param[in] cudaContextManager The PxCudaContextManager this instance is tied to. + \return the new deformable volume + + \see PxDeformableVolume + */ + virtual PxDeformableVolume* createDeformableVolume(PxCudaContextManager& cudaContextManager) = 0; + + /** + \brief Deprecated + \see createDeformableVolume + */ + PX_DEPRECATED PX_FORCE_INLINE PxDeformableVolume* createSoftBody(PxCudaContextManager& cudaContextManager) + { + return createDeformableVolume(cudaContextManager); + } + + /** + \brief Creates a particle system with a position-based dynamics (PBD) solver. + + A PBD particle system can be used to simulate particle systems with fluid and granular particles. It also allows simulating cloth using + mass-spring constraints and rigid bodies by shape matching the bodies with particles. + + In order to accelerate neighborhood finding for particle-particle interactions (e.g.: for fluid density constraints) a regular grid is used. + This grid is built every time step but may provide inaccurate neighborhood information during the solver iterations. The neighborhood scale + parameter can be used to configure the grid such that it provides a more conservative neighborhood at the cost of run-time performance. + The grid cell width is defined as 2*particleContactOffset*neighborhoodScale. \see PxParticleSystem::setParticleContactOffset. + The neighborhood scale parameter should typically not be much larger than 1. + + The maxNeighborhood defines how many particles fit into the neighborhood, at the cost of memory. + + Both maxNeighborhood and neighborhoodScale should be set as low as possible for performance, but high enough to not cause any behavioral degredation. + + \param[in] cudaContextManager The PxCudaContextManager this instance is tied to. + \param[in] maxNeighborhood The maximum number of particles considered in neighborhood-based particle interaction calculations. + \param[in] neighborhoodScale Scale applied to the particle contact offset used to define the particle neighborhood size spatially. Range: (1.0, PX_MAX_F32) + \return the new particle system + + \see PxPBDParticleSystem + */ + virtual PxPBDParticleSystem* createPBDParticleSystem(PxCudaContextManager& cudaContextManager, PxU32 maxNeighborhood = 96, PxReal neighborhoodScale = 1.01f) = 0; + + /** + \brief Create particle buffer to simulate fluid/granular material. + + \param[in] maxParticles The maximum number of particles in this buffer. + \param[in] maxVolumes The maximum number of volumes in this buffer. See PxParticleVolume. + \param[in] cudaContextManager The PxCudaContextManager this buffer is tied to. + \return PxParticleBuffer instance + + \see PxParticleBuffer + */ + virtual PxParticleBuffer* createParticleBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxCudaContextManager* cudaContextManager) = 0; + + /** + \brief Create a particle buffer for fluid dynamics with diffuse particles. Diffuse particles are used to simulate fluid effects + such as foam, spray and bubbles. + + \param[in] maxParticles The maximum number of particles in this buffer. + \param[in] maxVolumes The maximum number of volumes in this buffer. See #PxParticleVolume. + \param[in] maxDiffuseParticles The max number of diffuse particles int this buffer. + \param[in] cudaContextManager The PxCudaContextManager this buffer is tied to. + \return PxParticleAndDiffuseBuffer instance + + \see PxParticleAndDiffuseBuffer, PxDiffuseParticleParams + */ + virtual PxParticleAndDiffuseBuffer* createParticleAndDiffuseBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxU32 maxDiffuseParticles, PxCudaContextManager* cudaContextManager) = 0; + + /** + \brief Create a particle buffer to simulate particle cloth. + + \param[in] maxParticles The maximum number of particles in this buffer. + \param[in] maxNumVolumes The maximum number of volumes in this buffer. See #PxParticleVolume. + \param[in] maxNumCloths The maximum number of cloths in this buffer. See #PxParticleCloth. + \param[in] maxNumTriangles The maximum number of triangles for aerodynamics. + \param[in] maxNumSprings The maximum number of springs to connect particles. See #PxParticleSpring. + \param[in] cudaContextManager The PxCudaContextManager this buffer is tied to. + \return PxParticleClothBuffer instance + + \see PxParticleClothBuffer + */ + virtual PxParticleClothBuffer* createParticleClothBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumCloths, PxU32 maxNumTriangles, PxU32 maxNumSprings, PxCudaContextManager* cudaContextManager) = 0; + + /** + \brief Create a particle buffer to simulate rigid bodies using shape matching with particles. + + \param[in] maxParticles The maximum number of particles in this buffer. + \param[in] maxNumVolumes The maximum number of volumes in this buffer. See #PxParticleVolume. + \param[in] maxNumRigids The maximum number of rigid bodies this buffer is used to simulate. + \param[in] cudaContextManager The PxCudaContextManager this buffer is tied to. + \return PxParticleRigidBuffer instance + + \see PxParticleRigidBuffer + */ + virtual PxParticleRigidBuffer* createParticleRigidBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumRigids, PxCudaContextManager* cudaContextManager) = 0; + + //\} + /** \name Materials + */ + //\{ + + /** + \brief Creates a new rigid body material with certain default properties. + + \return The new rigid body material. + + \param [in] staticFriction The coefficient of static friction + \param [in] dynamicFriction The coefficient of dynamic friction + \param [in] restitution The coefficient of restitution (if in range [0,1]) or the spring stiffness for compliant contact (if in range (-PX_MAX_REAL, 0)) + + \see PxMaterial + */ + virtual PxMaterial* createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution) = 0; + + /** + \brief Return the number of rigid body materials that currently exist. + + \return Number of rigid body materials. + + \see getMaterials() + */ + virtual PxU32 getNbMaterials() const = 0; + + /** + \brief Writes the array of rigid body material pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the materials in the array is not specified. + + \param [out] userBuffer The buffer to receive material pointers. + \param [in] bufferSize The number of material pointers which can be stored in the buffer. + \param [in] startIndex Index of first material pointer to be retrieved. + \return The number of material pointers written to userBuffer, this should be less or equal to bufferSize. + + \see getNbMaterials() PxMaterial + */ + virtual PxU32 getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Creates a new surface deformable material with certain default properties. + + \return The new surface deformable material. + + \param [in] youngs The young's modulus + \param [in] poissons The poissons's ratio + \param [in] dynamicFriction The dynamic friction coefficient + \param [in] thickness The thickness of the surface + \param [in] bendingStiffness The bending stiffness of the surface + \param [in] elasticityDamping The damping of the surface with respect to stretch and shear + \param [in] bendingDamping The damping of the surface with respect to bending + + \see PxDeformableSurfaceMaterial + */ + virtual PxDeformableSurfaceMaterial* createDeformableSurfaceMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction, + PxReal thickness = 0.001f, PxReal bendingStiffness = 0.0f, PxReal elasticityDamping = 0.0f, PxReal bendingDamping = 0.0f) = 0; + + /** + \brief Return the number of deformable surface materials that currently exist. + + \return Number of deformable surface materials. + + \see getDeformableSurfaceMaterials() + */ + virtual PxU32 getNbDeformableSurfaceMaterials() const = 0; + + /** + \brief Writes the array of deformable surface material pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the materials in the array is not specified. + + \param [out] userBuffer The buffer to receive material pointers. + \param [in] bufferSize The number of material pointers which can be stored in the buffer. + \param [in] startIndex Index of first material pointer to be retrieved. + \return The number of material pointers written to userBuffer, this should be less or equal to bufferSize. + + \see getNbDeformableSurfaceMaterials() PxDeformableSurfaceMaterial + */ + virtual PxU32 getDeformableSurfaceMaterials(PxDeformableSurfaceMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Creates a new deformable volume material with certain default properties. + + \return The new deformable volume material. + + \param [in] youngs The young's modulus + \param [in] poissons The poissons's ratio + \param [in] dynamicFriction The dynamic friction coefficient + \param [in] elasticityDamping The elasticity damping + + \see PxDeformableVolumeMaterial + */ + virtual PxDeformableVolumeMaterial* createDeformableVolumeMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction, PxReal elasticityDamping = 0.0f) = 0; + + /** + \brief Deprecated + \see createDeformableVolumeMaterial + */ + PX_DEPRECATED PX_FORCE_INLINE PxDeformableVolumeMaterial* createFEMSoftBodyMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) + { + return createDeformableVolumeMaterial(youngs, poissons, dynamicFriction); + } + + /** + \brief Return the number of deformable volume materials that currently exist. + + \return Number of materials. + + \see getDeformableVolumeMaterials() + */ + virtual PxU32 getNbDeformableVolumeMaterials() const = 0; + + /** + \brief Deprecated + \see getNbDeformableVolumeMaterials + */ + PX_DEPRECATED PX_FORCE_INLINE PxU32 getNbFEMSoftBodyMaterials() const + { + return getNbDeformableVolumeMaterials(); + } + + /** + \brief Writes the array of deformable volume material pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the materials in the array is not specified. + + \param [out] userBuffer The buffer to receive material pointers. + \param [in] bufferSize The number of material pointers which can be stored in the buffer. + \param [in] startIndex Index of first material pointer to be retrieved. + \return The number of material pointers written to userBuffer, this should be less or equal to bufferSize. + + \see getNbDeformableVolumeMaterials() PxDeformableVolumeMaterial + */ + virtual PxU32 getDeformableVolumeMaterials(PxDeformableVolumeMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Deprecated + \see getDeformableVolumeMaterials + */ + PX_DEPRECATED PX_FORCE_INLINE PxU32 getFEMSoftBodyMaterials(PxDeformableVolumeMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const + { + return getDeformableVolumeMaterials(userBuffer, bufferSize, startIndex); + } + + /** + \brief Creates a new PBD material with certain default properties. + + \param [in] friction The friction parameter + \param [in] damping The velocity damping parameter + \param [in] adhesion The adhesion parameter + \param [in] viscosity The viscosity parameter + \param [in] vorticityConfinement The vorticity confinement coefficient + \param [in] surfaceTension The surface tension coefficient + \param [in] cohesion The cohesion parameter + \param [in] lift The lift parameter + \param [in] drag The drag parameter + \param [in] cflCoefficient The Courant-Friedrichs-Lewy(cfl) coefficient + \param [in] gravityScale The gravity scale + \return The new PBD material. + + \see PxPBDMaterial + */ + virtual PxPBDMaterial* createPBDMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal vorticityConfinement, PxReal surfaceTension, PxReal cohesion, PxReal lift, PxReal drag, PxReal cflCoefficient = 1.f, PxReal gravityScale = 1.f) = 0; + + /** + \brief Return the number of PBD materials that currently exist. + + \return Number of PBD materials. + + \see getPBDMaterials() + */ + virtual PxU32 getNbPBDMaterials() const = 0; + + /** + \brief Writes the array of PBD material pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the materials in the array is not specified. + + \param [out] userBuffer The buffer to receive material pointers. + \param [in] bufferSize The number of material pointers which can be stored in the buffer. + \param [in] startIndex Index of first material pointer to be retrieved. + \return The number of material pointers written to userBuffer, this should be less or equal to bufferSize. + + \see getNbPBDMaterials() PxPBDMaterial + */ + virtual PxU32 getPBDMaterials(PxPBDMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + //\} + /** \name Deletion Listeners + */ + //\{ + + /** + \brief Register a deletion listener. Listeners will be called whenever an object is deleted. + + It is illegal to register or unregister a deletion listener while deletions are being processed. + + \note By default a registered listener will receive events from all objects. Set the restrictedObjectSet parameter to true on registration and use #registerDeletionListenerObjects to restrict the received events to specific objects. + + \note The deletion events are only supported on core PhysX objects. In general, objects in extension modules do not provide this functionality, however, in the case of PxJoint objects, the underlying PxConstraint will send the events. + + \param [in] observer Observer object to send notifications to. + \param [in] deletionEvents The deletion event types to get notified of. + \param [in] restrictedObjectSet If false, the deletion listener will get events from all objects, else the objects to receive events from have to be specified explicitly through #registerDeletionListenerObjects. + + \see PxDeletionListener unregisterDeletionListener + */ + virtual void registerDeletionListener(PxDeletionListener& observer, const PxDeletionEventFlags& deletionEvents, bool restrictedObjectSet = false) = 0; + + /** + \brief Unregister a deletion listener. + + It is illegal to register or unregister a deletion listener while deletions are being processed. + + \param [in] observer Observer object to stop sending notifications to. + + \see PxDeletionListener registerDeletionListener + */ + virtual void unregisterDeletionListener(PxDeletionListener& observer) = 0; + + /** + \brief Register specific objects for deletion events. + + This method allows for a deletion listener to limit deletion events to specific objects only. + + \note It is illegal to register or unregister objects while deletions are being processed. + + \note The deletion listener has to be registered through #registerDeletionListener() and configured to support restricted object sets prior to this method being used. + + \param [in] observer Observer object to send notifications to. + \param [in] observables List of objects for which to receive deletion events. Only PhysX core objects are supported. In the case of PxJoint objects, the underlying PxConstraint can be used to get the events. + \param [in] observableCount Size of the observables list. + + \see PxDeletionListener unregisterDeletionListenerObjects + */ + virtual void registerDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) = 0; + + /** + \brief Unregister specific objects for deletion events. + + This method allows to clear previously registered objects for a deletion listener (see #registerDeletionListenerObjects()). + + \note It is illegal to register or unregister objects while deletions are being processed. + + \note The deletion listener has to be registered through #registerDeletionListener() and configured to support restricted object sets prior to this method being used. + + \param [in] observer Observer object to stop sending notifications to. + \param [in] observables List of objects for which to not receive deletion events anymore. + \param [in] observableCount Size of the observables list. + + \see PxDeletionListener registerDeletionListenerObjects + */ + virtual void unregisterDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) = 0; + + //\} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** +\brief Creates an instance of the physics SDK. + +Creates an instance of this class. May not be a class member to avoid name mangling. +Pass the constant #PX_PHYSICS_VERSION as the argument. +There may be only one instance of this class per process. Calling this method after an instance +has been created already will result in an error message and NULL will be returned. + +\param version Version number we are expecting (should be #PX_PHYSICS_VERSION) +\param foundation Foundation instance (see PxFoundation) +\param scale values used to determine default tolerances for objects at creation time +\param trackOutstandingAllocations true if you want to track memory allocations + so a debugger connection partway through your physics simulation will get + an accurate map of everything that has been allocated so far. This could have a memory + and performance impact on your simulation hence it defaults to off. +\param pvd When pvd points to a valid PxPvd instance (PhysX Visual Debugger), a connection to the specified PxPvd instance is created. + If pvd is NULL no connection will be attempted. +\param omniPvd When omniPvd points to a valid PxOmniPvd instance PhysX will sample its internal structures to the defined OmniPvd output streams + set in the PxOmniPvd object. +\return PxPhysics instance on success, NULL if operation failed + +\see PxPhysics +*/ +PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysics* PxCreatePhysics(physx::PxU32 version, + physx::PxFoundation& foundation, + const physx::PxTolerancesScale& scale, + bool trackOutstandingAllocations = false, + physx::PxPvd* pvd = NULL, + physx::PxOmniPvd* omniPvd = NULL); + +/** +\brief Retrieves the Physics SDK after it has been created. + +Before using this function the user must call #PxCreatePhysics(). + +\note The behavior of this method is undefined if the Physics SDK instance has not been created already. +*/ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreturn-type-c-linkage" +#endif + +PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysics& PX_CALL_CONV PxGetPhysics(); + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#endif diff --git a/engine/third_party/physx/include/PxPhysicsAPI.h b/engine/third_party/physx/include/PxPhysicsAPI.h new file mode 100644 index 00000000..9a7f41f3 --- /dev/null +++ b/engine/third_party/physx/include/PxPhysicsAPI.h @@ -0,0 +1,225 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_API_H +#define PX_PHYSICS_API_H + +/** +This is the main include header for the Physics SDK, for users who +want to use a single #include file. + +Alternatively, one can instead directly #include a subset of the below files. +*/ + +// Foundation SDK +#include "foundation/PxAlignedMalloc.h" +#include "foundation/PxAlloca.h" +#include "foundation/PxAllocatorCallback.h" +#include "foundation/PxArray.h" +#include "foundation/PxAssert.h" +#include "foundation/PxAtomic.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxBitAndData.h" +#include "foundation/PxBitMap.h" +#include "foundation/PxBitUtils.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxBroadcast.h" +#include "foundation/PxConstructor.h" +#include "foundation/PxErrorCallback.h" +#include "foundation/PxErrors.h" +#include "foundation/PxFlags.h" +#include "foundation/PxFoundation.h" +#include "foundation/PxFoundationConfig.h" +#include "foundation/PxFPU.h" +#include "foundation/PxHash.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxHashSet.h" +#include "foundation/PxInlineAllocator.h" +#include "foundation/PxInlineArray.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxIO.h" +#include "foundation/PxMat33.h" +#include "foundation/PxMat44.h" +#include "foundation/PxMath.h" +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxMemory.h" +#include "foundation/PxMutex.h" +#include "foundation/PxPhysicsVersion.h" +#include "foundation/PxPlane.h" +#include "foundation/PxPool.h" +#include "foundation/PxPreprocessor.h" +#include "foundation/PxProfiler.h" +#include "foundation/PxQuat.h" +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxSList.h" +#include "foundation/PxSocket.h" +#include "foundation/PxSort.h" +#include "foundation/PxStrideIterator.h" +#include "foundation/PxString.h" +#include "foundation/PxSync.h" +#include "foundation/PxTempAllocator.h" +#include "foundation/PxThread.h" +#include "foundation/PxTime.h" +#include "foundation/PxTransform.h" +#include "foundation/PxUnionCast.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxUtilities.h" +#include "foundation/PxVec2.h" +#include "foundation/PxVec3.h" +#include "foundation/PxVec4.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxVecQuat.h" +#include "foundation/PxVecTransform.h" + + +//Not physics specific utilities and common code +#include "common/PxCoreUtilityTypes.h" +#include "common/PxPhysXCommonConfig.h" +#include "common/PxRenderBuffer.h" +#include "common/PxBase.h" +#include "common/PxTolerancesScale.h" +#include "common/PxTypeInfo.h" +#include "common/PxStringTable.h" +#include "common/PxSerializer.h" +#include "common/PxSerialFramework.h" +#include "common/PxInsertionCallback.h" + +//Task Manager +#include "task/PxTask.h" + +// Cuda Mananger +#if PX_SUPPORT_GPU_PHYSX +#include "gpu/PxGpu.h" +#endif + +//Geometry Library +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxBVH.h" +#include "geometry/PxBVHBuildStrategy.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxConvexMesh.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxGeometry.h" +#include "geometry/PxGeometryHelpers.h" +#include "geometry/PxGeometryQuery.h" +#include "geometry/PxHeightField.h" +#include "geometry/PxHeightFieldDesc.h" +#include "geometry/PxHeightFieldFlag.h" +#include "geometry/PxHeightFieldGeometry.h" +#include "geometry/PxHeightFieldSample.h" +#include "geometry/PxMeshQuery.h" +#include "geometry/PxMeshScale.h" +#include "geometry/PxPlaneGeometry.h" +#include "geometry/PxSimpleTriangleMesh.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxTriangle.h" +#include "geometry/PxTriangleMesh.h" +#include "geometry/PxTriangleMeshGeometry.h" +#include "geometry/PxTetrahedron.h" +#include "geometry/PxTetrahedronMesh.h" +#include "geometry/PxTetrahedronMeshGeometry.h" + +// PhysX Core SDK +#include "PxActor.h" +#include "PxAggregate.h" +#include "PxArticulationReducedCoordinate.h" +#include "PxArticulationJointReducedCoordinate.h" +#include "PxArticulationLink.h" +#include "PxClient.h" +#include "PxConeLimitedConstraint.h" +#include "PxConstraint.h" +#include "PxConstraintDesc.h" +#include "PxContact.h" +#include "PxContactModifyCallback.h" +#include "PxDeformableSurface.h" +#include "PxDeformableSurfaceMaterial.h" +#include "PxDeformableVolume.h" +#include "PxDeformableVolumeMaterial.h" +#include "PxDeletionListener.h" +#include "PxFEMSoftBodyMaterial.h" // deprecated, include PxDeformableVolumeMaterial.h +#include "PxFiltering.h" +#include "PxForceMode.h" +#include "PxLockedData.h" +#include "PxMaterial.h" +#include "PxParticleBuffer.h" +#include "PxParticleSystem.h" +#include "PxPBDParticleSystem.h" +#include "PxPBDMaterial.h" +#include "PxPhysics.h" +#include "PxPhysXConfig.h" +#include "PxQueryFiltering.h" +#include "PxQueryReport.h" +#include "PxRigidActor.h" +#include "PxRigidBody.h" +#include "PxRigidDynamic.h" +#include "PxRigidStatic.h" +#include "PxScene.h" +#include "PxSceneDesc.h" +#include "PxSceneLock.h" +#include "PxShape.h" +#include "PxSimulationEventCallback.h" +#include "PxSimulationStatistics.h" +#include "PxSoftBody.h" //deprecated, include PxDeformableVolume.h +#include "PxVisualizationParameter.h" +#include "PxPruningStructure.h" + +//Character Controller +#include "characterkinematic/PxBoxController.h" +#include "characterkinematic/PxCapsuleController.h" +#include "characterkinematic/PxController.h" +#include "characterkinematic/PxControllerBehavior.h" +#include "characterkinematic/PxControllerManager.h" +#include "characterkinematic/PxControllerObstacles.h" +#include "characterkinematic/PxExtended.h" + +//Cooking (data preprocessing) +#include "cooking/Pxc.h" +#include "cooking/PxConvexMeshDesc.h" +#include "cooking/PxCooking.h" +#include "cooking/PxTriangleMeshDesc.h" +#include "cooking/PxBVH33MidphaseDesc.h" +#include "cooking/PxBVH34MidphaseDesc.h" +#include "cooking/PxMidphaseDesc.h" + +//Extensions to the SDK +#include "extensions/PxDefaultStreams.h" +#include "extensions/PxExtensionsAPI.h" + +//Serialization +#include "extensions/PxSerialization.h" +#include "extensions/PxRepXSerializer.h" + +//Vehicle Simulation +#include "vehicle2/PxVehicleAPI.h" + +//Connecting the SDK to Visual Debugger +#include "pvd/PxPvdSceneClient.h" +#include "pvd/PxPvd.h" +#include "pvd/PxPvdTransport.h" +#endif diff --git a/engine/third_party/physx/include/PxPhysicsSerialization.h b/engine/third_party/physx/include/PxPhysicsSerialization.h new file mode 100644 index 00000000..ae623c0e --- /dev/null +++ b/engine/third_party/physx/include/PxPhysicsSerialization.h @@ -0,0 +1,67 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SERIALIZATION_H +#define PX_PHYSICS_SERIALIZATION_H + +#include "common/PxSerialFramework.h" +#include "PxPhysXConfig.h" + +#if !PX_DOXYGEN + +/** +\brief Registers physics classes for serialization. +This function is used to implement PxSerialization.createSerializationRegistry() and is not intended to be needed otherwise. +\see PxSerializationRegistry +*/ +PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterPhysicsSerializers(physx::PxSerializationRegistry& sr); + +/** +\brief Unregisters physics classes for serialization. +This function is used in the release implementation of PxSerializationRegistry and in not intended to be used otherwise. +\see PxSerializationRegistry +*/ +PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxUnregisterPhysicsSerializers(physx::PxSerializationRegistry& sr); + + +/** +\brief Adds collected objects to PxPhysics. + +This function adds all objects contained in the input collection to the PxPhysics instance. This is used after deserializing +the collection, to populate the physics with inplace deserialized objects. This function is used in the implementation of +PxSerialization.createCollectionFromBinary and is not intended to be needed otherwise. +\param[in] collection Objects to add to the PxPhysics instance. + +\see PxCollection, PxSerialization.createCollectionFromBinary +*/ +PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxAddCollectionToPhysics(const physx::PxCollection& collection); + +#endif // !PX_DOXYGEN + +#endif + diff --git a/engine/third_party/physx/include/PxPruningStructure.h b/engine/third_party/physx/include/PxPruningStructure.h new file mode 100644 index 00000000..b0a950fb --- /dev/null +++ b/engine/third_party/physx/include/PxPruningStructure.h @@ -0,0 +1,129 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_PRUNING_STRUCTURE_H +#define PX_PRUNING_STRUCTURE_H + +#include "PxPhysXConfig.h" +#include "common/PxBase.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + +/** +\brief A precomputed pruning structure to accelerate scene queries against newly added actors. + +The pruning structure can be provided to #PxScene:: addActors() in which case it will get merged +directly into the scene query optimization AABB tree, thus leading to improved performance when +doing queries against the newly added actors. This applies to both static and dynamic actors. + +\note PxPruningStructure objects can be added to a collection and get serialized. +\note Adding a PxPruningStructure object to a collection will also add the actors that were used to build the pruning structure. + +\note PxPruningStructure must be released before its rigid actors. +\note PxRigidBody objects can be in one PxPruningStructure only. +\note Changing the bounds of PxRigidBody objects assigned to a pruning structure that has not been added to a scene yet will +invalidate the pruning structure. Same happens if shape scene query flags change or shape gets removed from an actor. + +\see PxScene::addActors PxCollection +*/ +class PxPruningStructure : public PxBase +{ +public: + /** + \brief Release this object. + */ + virtual void release() = 0; + + /** + \brief Retrieve rigid actors in the pruning structure. + + You can retrieve the number of rigid actor pointers by calling #getNbRigidActors() + + \param[out] userBuffer The buffer to store the actor pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first actor pointer to be retrieved + \return Number of rigid actor pointers written to the buffer. + + \see PxRigidActor + */ + virtual PxU32 getRigidActors(PxRigidActor** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + /** + \brief Returns the number of rigid actors in the pruning structure. + + You can use #getRigidActors() to retrieve the rigid actor pointers. + + \return Number of rigid actors in the pruning structure. + + \see PxRigidActor + */ + virtual PxU32 getNbRigidActors() const = 0; + + /** + \brief Gets the merge data for static actors + + This is mainly called by the PxSceneQuerySystem::merge() function to merge a PxPruningStructure + with the internal data-structures of the scene-query system. + + \return Implementation-dependent merge data for static actors. + + \see PxSceneQuerySystem::merge() + */ + virtual const void* getStaticMergeData() const = 0; + + /** + \brief Gets the merge data for dynamic actors + + This is mainly called by the PxSceneQuerySystem::merge() function to merge a PxPruningStructure + with the internal data-structures of the scene-query system. + + \return Implementation-dependent merge data for dynamic actors. + + \see PxSceneQuerySystem::merge() + */ + virtual const void* getDynamicMergeData() const = 0; + + virtual const char* getConcreteTypeName() const PX_OVERRIDE PX_FINAL { return "PxPruningStructure"; } +protected: + PX_INLINE PxPruningStructure(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxPruningStructure(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + virtual ~PxPruningStructure() {} + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxPruningStructure", PxBase); } +}; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/PxQueryFiltering.h b/engine/third_party/physx/include/PxQueryFiltering.h new file mode 100644 index 00000000..97c200c3 --- /dev/null +++ b/engine/third_party/physx/include/PxQueryFiltering.h @@ -0,0 +1,208 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_QUERY_FILTERING_H +#define PX_QUERY_FILTERING_H + +#include "PxPhysXConfig.h" +#include "PxFiltering.h" +#include "PxQueryReport.h" +#include "PxClient.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxShape; +class PxRigidActor; +struct PxQueryHit; + +/** +\brief Filtering flags for scene queries. + +\see PxQueryFilterData.flags +*/ +struct PxQueryFlag +{ + enum Enum + { + eSTATIC = (1<<0), //!< Traverse static shapes + + eDYNAMIC = (1<<1), //!< Traverse dynamic shapes + + ePREFILTER = (1<<2), //!< Run the pre-intersection-test filter (see #PxQueryFilterCallback::preFilter()) + + ePOSTFILTER = (1<<3), //!< Run the post-intersection-test filter (see #PxQueryFilterCallback::postFilter()) + + eANY_HIT = (1<<4), //!< Abort traversal as soon as any hit is found and return it via callback.block. + //!< Helps query performance. Both eTOUCH and eBLOCK hitTypes are considered hits with this flag. + + eNO_BLOCK = (1<<5), //!< All hits are reported as touching. Overrides eBLOCK returned from user filters with eTOUCH. + //!< This is also an optimization hint that may improve query performance. + + eBATCH_QUERY_LEGACY_BEHAVIOUR = (1<<6), //!< Run with legacy batch query filter behavior. Raising this flag ensures that + //!< the hardcoded filter equation is neglected. This guarantees that any provided PxQueryFilterCallback + //!< will be utilised, as specified by the ePREFILTER and ePOSTFILTER flags. + + eDISABLE_HARDCODED_FILTER = (1<<6), //!< Same as eBATCH_QUERY_LEGACY_BEHAVIOUR, more explicit name making it clearer that this can also be used + //!< with regular/non-batched queries if needed. + + eRESERVED = (1<<15) //!< Reserved for internal use + }; +}; +PX_COMPILE_TIME_ASSERT(PxQueryFlag::eSTATIC==(1<<0)); +PX_COMPILE_TIME_ASSERT(PxQueryFlag::eDYNAMIC==(1<<1)); +PX_COMPILE_TIME_ASSERT(PxQueryFlag::eBATCH_QUERY_LEGACY_BEHAVIOUR==PxQueryFlag::eDISABLE_HARDCODED_FILTER); + +/** +\brief Flags typedef for the set of bits defined in PxQueryFlag. + +*/ +typedef PxFlags PxQueryFlags; +PX_FLAGS_OPERATORS(PxQueryFlag::Enum,PxU16) + +/** +\brief Classification of scene query hits (intersections). + + - eNONE: Returning this hit type means that the hit should not be reported. + - eBLOCK: For all raycast, sweep and overlap queries the nearest eBLOCK type hit will always be returned in PxHitCallback::block member. + - eTOUCH: Whenever a raycast, sweep or overlap query was called with non-zero PxHitCallback::nbTouches and PxHitCallback::touches + parameters, eTOUCH type hits that are closer or same distance (touchDistance <= blockDistance condition) + as the globally nearest eBLOCK type hit, will be reported. + - For example, to record all hits from a raycast query, always return eTOUCH. + +All hits in overlap() queries are treated as if the intersection distance were zero. +This means the hits are unsorted and all eTOUCH hits are recorded by the callback even if an eBLOCK overlap hit was encountered. +Even though all overlap() blocking hits have zero length, only one (arbitrary) eBLOCK overlap hit is recorded in PxHitCallback::block. +All overlap() eTOUCH type hits are reported (zero touchDistance <= zero blockDistance condition). + +For raycast/sweep/overlap calls with zero touch buffer or PxHitCallback::nbTouches member, +only the closest hit of type eBLOCK is returned. All eTOUCH hits are discarded. + +\see PxQueryFilterCallback.preFilter PxQueryFilterCallback.postFilter PxScene.raycast PxScene.sweep PxScene.overlap +*/ +struct PxQueryHitType +{ + enum Enum + { + eNONE = 0, //!< the query should ignore this shape + eTOUCH = 1, //!< a hit on the shape touches the intersection geometry of the query but does not block it + eBLOCK = 2 //!< a hit on the shape blocks the query (does not block overlap queries) + }; +}; + +/** +\brief Scene query filtering data. + +Whenever the scene query intersects a shape, filtering is performed in the following order: + +\li For non-batched queries only:
If the data field is non-zero, and the bitwise-AND value of data AND the shape's +queryFilterData is zero, the shape is skipped +\li If filter callbacks are enabled in flags field (see #PxQueryFlags) they will get invoked accordingly. +\li If neither #PxQueryFlag::ePREFILTER or #PxQueryFlag::ePOSTFILTER is set, the hit defaults +to type #PxQueryHitType::eBLOCK when the value of PxHitCallback::nbTouches provided with the query is zero and to type +#PxQueryHitType::eTOUCH when PxHitCallback::nbTouches is positive. + +\see PxScene.raycast PxScene.sweep PxScene.overlap PxQueryFlag::eANY_HIT +*/ +struct PxQueryFilterData +{ + /** \brief default constructor */ + explicit PX_INLINE PxQueryFilterData() : flags(PxQueryFlag::eDYNAMIC | PxQueryFlag::eSTATIC) {} + + /** \brief constructor to set both filter data and filter flags */ + explicit PX_INLINE PxQueryFilterData(const PxFilterData& fd, PxQueryFlags f) : data(fd), flags(f) {} + + /** \brief constructor to set filter flags only */ + explicit PX_INLINE PxQueryFilterData(PxQueryFlags f) : flags(f) {} + + PxFilterData data; //!< Filter data associated with the scene query + PxQueryFlags flags; //!< Filter flags (see #PxQueryFlags) +}; + +/** +\brief Scene query filtering callbacks. + +Custom filtering logic for scene query intersection candidates. If an intersection candidate object passes the data based filter +(see #PxQueryFilterData), filtering callbacks are executed if requested (see #PxQueryFilterData.flags) + +\li If #PxQueryFlag::ePREFILTER is set, the preFilter function runs before exact intersection tests. +If this function returns #PxQueryHitType::eTOUCH or #PxQueryHitType::eBLOCK, exact testing is performed to +determine the intersection location. + +The preFilter function may overwrite the copy of queryFlags it receives as an argument to specify any of #PxHitFlag::eMODIFIABLE_FLAGS +on a per-shape basis. Changes apply only to the shape being filtered, and changes to other flags are ignored. + +\li If #PxQueryFlag::ePREFILTER is not set, precise intersection testing is performed using the original query's filterData.flags. + +\li If #PxQueryFlag::ePOSTFILTER is set, the postFilter function is called for each intersection to determine the touch/block status. +This overrides any touch/block status previously returned from the preFilter function for this shape. + +Filtering calls are not guaranteed to be sorted along the ray or sweep direction. + +\see PxScene.raycast PxScene.sweep PxScene.overlap PxQueryFlags PxHitFlags +*/ +class PxQueryFilterCallback +{ +public: + + /** + \brief This filter callback is executed before the exact intersection test if PxQueryFlag::ePREFILTER flag was set. + + \param[in] filterData custom filter data specified as the query's filterData.data parameter. + \param[in] shape A shape that has not yet passed the exact intersection test. + \param[in] actor The shape's actor. + \param[in,out] queryFlags scene query flags from the query's function call (only flags from PxHitFlag::eMODIFIABLE_FLAGS bitmask can be modified) + \return the updated type for this hit (see #PxQueryHitType) + */ + virtual PxQueryHitType::Enum preFilter(const PxFilterData& filterData, const PxShape* shape, const PxRigidActor* actor, PxHitFlags& queryFlags) = 0; + + /** + \brief This filter callback is executed if the exact intersection test returned true and PxQueryFlag::ePOSTFILTER flag was set. + + \param[in] filterData custom filter data of the query + \param[in] hit Scene query hit information. faceIndex member is not valid for overlap queries. For sweep and raycast queries the hit information can be cast to #PxSweepHit and #PxRaycastHit respectively. + \param[in] shape Hit shape + \param[in] actor Hit actor + \return the updated hit type for this hit (see #PxQueryHitType) + */ + virtual PxQueryHitType::Enum postFilter(const PxFilterData& filterData, const PxQueryHit& hit, const PxShape* shape, const PxRigidActor* actor) = 0; + + /** + \brief virtual destructor + */ + virtual ~PxQueryFilterCallback() {} +}; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxQueryReport.h b/engine/third_party/physx/include/PxQueryReport.h new file mode 100644 index 00000000..06e66e6d --- /dev/null +++ b/engine/third_party/physx/include/PxQueryReport.h @@ -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_QUERY_REPORT_H +#define PX_QUERY_REPORT_H +#include "foundation/PxVec3.h" +#include "foundation/PxFlags.h" +#include "foundation/PxAssert.h" +#include "geometry/PxGeometryHit.h" +#include "geometry/PxGeometryQueryContext.h" +#include "PxPhysXConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxShape; +class PxRigidActor; + +/** +\brief Combines a shape pointer and the actor the shape belongs to into one memory location. + +Serves as a base class for PxQueryHit. + +\see PxQueryHit +*/ +struct PxActorShape +{ + PX_INLINE PxActorShape() : actor(NULL), shape(NULL) {} + PX_INLINE PxActorShape(PxRigidActor* a, PxShape* s) : actor(a), shape(s) {} + + PxRigidActor* actor; + PxShape* shape; +}; + +// Extends geom hits with Px object pointers +struct PxRaycastHit : PxGeomRaycastHit, PxActorShape {}; +struct PxOverlapHit : PxGeomOverlapHit, PxActorShape {}; +struct PxSweepHit : PxGeomSweepHit, PxActorShape {}; + +/** +\brief Describes query behavior after returning a partial query result via a callback. + +If callback returns true, traversal will continue and callback can be issued again. +If callback returns false, traversal will stop, callback will not be issued again. + +\see PxHitCallback +*/ +typedef bool PxAgain; + +/** +\brief This callback class facilitates reporting scene query hits (intersections) to the user. + +User overrides the virtual processTouches function to receive hits in (possibly multiple) fixed size blocks. + +\note PxHitBuffer derives from this class and is used to receive touching hits in a fixed size buffer. +\note Since the compiler doesn't look in template dependent base classes when looking for non-dependent names +\note with some compilers it will be necessary to use "this->hasBlock" notation to access a parent variable +\note in a child callback class. +\note Pre-made typedef shorthands, such as ::PxRaycastCallback can be used for raycast, overlap and sweep queries. + +\see PxHitBuffer PxRaycastHit PxSweepHit PxOverlapHit PxRaycastCallback PxOverlapCallback PxSweepCallback +*/ +template +struct PxHitCallback : PxQueryThreadContext +{ + HitType block; //!< Holds the closest blocking hit result for the query. Invalid if hasBlock is false. + bool hasBlock; //!< Set to true if there was a blocking hit during query. + + HitType* touches; //!< User specified buffer for touching hits. + + /** + \brief Size of the user specified touching hits buffer. + \note If set to 0 all hits will default to PxQueryHitType::eBLOCK, otherwise to PxQueryHitType::eTOUCH + \note Hit type returned from pre-filter overrides this default */ + PxU32 maxNbTouches; + + /** + \brief Number of touching hits returned by the query. Used with PxHitBuffer. + \note If true (PxAgain) is returned from the callback, nbTouches will be reset to 0. */ + PxU32 nbTouches; + + /** + \brief Initializes the class with user provided buffer. + + \param[in] aTouches Optional buffer for recording PxQueryHitType::eTOUCH type hits. + \param[in] aMaxNbTouches Size of touch buffer. + + \note if aTouches is NULL and aMaxNbTouches is 0, only the closest blocking hit will be recorded by the query. + \note If PxQueryFlag::eANY_HIT flag is used as a query parameter, hasBlock will be set to true and blockingHit will be used to receive the result. + \note Both eTOUCH and eBLOCK hits will be registered as hasBlock=true and stored in PxHitCallback.block when eANY_HIT flag is used. + + \see PxHitCallback.hasBlock PxHitCallback.block */ + PxHitCallback(HitType* aTouches, PxU32 aMaxNbTouches) + : hasBlock(false), touches(aTouches), maxNbTouches(aMaxNbTouches), nbTouches(0) + {} + + /** + \brief virtual callback function used to communicate query results to the user. + + This callback will always be invoked with #touches as a buffer if #touches was specified as non-NULL. + All reported touch hits are guaranteed to be closer than the closest blocking hit. + + \param[in] buffer Callback will report touch hits to the user in this buffer. This pointer will be the same as #touches. + \param[in] nbHits Number of touch hits reported in buffer. This number will not exceed #maxNbTouches. + + \note There is a significant performance penalty in case multiple touch callbacks are issued (up to 2x) + \note to avoid the penalty use a bigger buffer so that all touching hits can be reported in a single buffer. + \note If true (again) is returned from the callback, nbTouches will be reset to 0, + \note If false is returned, nbTouched will remain unchanged. + \note By the time processTouches is first called, the globally closest blocking hit is already determined, + \note values of hasBlock and block are final and all touch hits are guaranteed to be closer than the blocking hit. + \note touches and maxNbTouches can be modified inside of processTouches callback. + + \return true to continue receiving callbacks in case there are more hits or false to stop. + + \see PxAgain PxRaycastHit PxSweepHit PxOverlapHit */ + virtual PxAgain processTouches(const HitType* buffer, PxU32 nbHits) = 0; + + virtual void finalizeQuery() {} //!< Query finalization callback, called after the last processTouches callback. + + virtual ~PxHitCallback() {} + + /** \brief Returns true if any blocking or touching hits were encountered during a query. */ + PX_FORCE_INLINE bool hasAnyHits() { return (hasBlock || (nbTouches > 0)); } +}; + +/** +\brief Returns scene query hits (intersections) to the user in a preallocated buffer. + +Will clip touch hits to maximum buffer capacity. When clipped, an arbitrary subset of touching hits will be discarded. +Overflow does not trigger warnings or errors. block and hasBlock will be valid in finalizeQuery callback and after query completion. +Touching hits are guaranteed to have closer or same distance ( <= condition) as the globally nearest blocking hit at the time any processTouches() +callback is issued. + +\note Pre-made typedef shorthands, such as ::PxRaycastBuffer can be used for raycast, overlap and sweep queries. + +\see PxHitCallback +\see PxRaycastBuffer PxOverlapBuffer PxSweepBuffer PxRaycastBufferN PxOverlapBufferN PxSweepBufferN +*/ +template +struct PxHitBuffer : public PxHitCallback +{ + /** + \brief Initializes the buffer with user memory. + + The buffer is initialized with 0 touch hits by default => query will only report a single closest blocking hit. + Use PxQueryFlag::eANY_HIT to tell the query to abort and return any first hit encoutered as blocking. + + \param[in] aTouches Optional buffer for recording PxQueryHitType::eTOUCH type hits. + \param[in] aMaxNbTouches Size of touch buffer. + + \see PxHitCallback */ + PxHitBuffer(HitType* aTouches = NULL, PxU32 aMaxNbTouches = 0) : PxHitCallback(aTouches, aMaxNbTouches) {} + + /** \brief Computes the number of any hits in this result, blocking or touching. */ + PX_INLINE PxU32 getNbAnyHits() const { return getNbTouches() + PxU32(this->hasBlock); } + /** \brief Convenience iterator used to access any hits in this result, blocking or touching. */ + PX_INLINE const HitType& getAnyHit(const PxU32 index) const { PX_ASSERT(index < getNbTouches() + PxU32(this->hasBlock)); + return index < getNbTouches() ? getTouches()[index] : this->block; } + + PX_INLINE PxU32 getNbTouches() const { return this->nbTouches; } + PX_INLINE const HitType* getTouches() const { return this->touches; } + PX_INLINE const HitType& getTouch(const PxU32 index) const { PX_ASSERT(index < getNbTouches()); return getTouches()[index]; } + PX_INLINE PxU32 getMaxNbTouches() const { return this->maxNbTouches; } + + virtual ~PxHitBuffer() {} + +protected: + // stops after the first callback + virtual PxAgain processTouches(const HitType* buffer, PxU32 nbHits) { PX_UNUSED(buffer); PX_UNUSED(nbHits); return false; } +}; + +/** \brief Raycast query callback. */ +typedef PxHitCallback PxRaycastCallback; + +/** \brief Overlap query callback. */ +typedef PxHitCallback PxOverlapCallback; + +/** \brief Sweep query callback. */ +typedef PxHitCallback PxSweepCallback; + +/** \brief Raycast query buffer. */ +typedef PxHitBuffer PxRaycastBuffer; + +/** \brief Overlap query buffer. */ +typedef PxHitBuffer PxOverlapBuffer; + +/** \brief Sweep query buffer. */ +typedef PxHitBuffer PxSweepBuffer; + +/** \brief Returns touching raycast hits to the user in a fixed size array embedded in the buffer class. **/ +template +struct PxRaycastBufferN : public PxHitBuffer +{ + PxRaycastHit hits[N]; + PxRaycastBufferN() : PxHitBuffer(hits, N) {} +}; + +/** \brief Returns touching overlap hits to the user in a fixed size array embedded in the buffer class. **/ +template +struct PxOverlapBufferN : public PxHitBuffer +{ + PxOverlapHit hits[N]; + PxOverlapBufferN() : PxHitBuffer(hits, N) {} +}; + +/** \brief Returns touching sweep hits to the user in a fixed size array embedded in the buffer class. **/ +template +struct PxSweepBufferN : public PxHitBuffer +{ + PxSweepHit hits[N]; + PxSweepBufferN() : PxHitBuffer(hits, N) {} +}; + +/** +\brief single hit cache for scene queries. + +If a cache object is supplied to a scene query, the cached actor/shape pair is checked for intersection first. +\note Filters are not executed for the cached shape. +\note If intersection is found, the hit is treated as blocking. +\note Typically actor and shape from the last PxHitCallback.block query result is used as a cached actor/shape pair. +\note Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. +\note Cache is only used if no touch buffer was provided, for single nearest blocking hit queries and queries using eANY_HIT flag. +\note if non-zero touch buffer was provided, cache will be ignored + +\note It is the user's responsibility to ensure that the shape and actor are valid, so care must be taken +when deleting shapes to invalidate cached references. + +The faceIndex field is an additional hint for a mesh or height field which is not currently used. + +\see PxScene.raycast +*/ +struct PxQueryCache +{ + /** + \brief constructor sets to default + */ + PX_INLINE PxQueryCache() : shape(NULL), actor(NULL), faceIndex(0xffffffff) {} + + /** + \brief constructor to set properties + */ + PX_INLINE PxQueryCache(PxShape* s, PxU32 findex) : shape(s), actor(NULL), faceIndex(findex) {} + + PxShape* shape; //!< Shape to test for intersection first + PxRigidActor* actor; //!< Actor to which the shape belongs + PxU32 faceIndex; //!< Triangle index to test first - NOT CURRENTLY SUPPORTED +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxResidual.h b/engine/third_party/physx/include/PxResidual.h new file mode 100644 index 00000000..5041ab7a --- /dev/null +++ b/engine/third_party/physx/include/PxResidual.h @@ -0,0 +1,83 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_RESIDUAL_H +#define PX_RESIDUAL_H + +#include "PxPhysXConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Structure representing residual values. + + This struct holds residual values, typically used in physics simulations to measure error or discrepancy. + */ + struct PxResidual + { + PxReal rmsResidual; //!< Root mean square residual value. + PxReal maxResidual; //!< Maximum residual value. + + PxResidual() : rmsResidual(0.0f), maxResidual(0.0f) {} + }; + + /** + \brief Structure representing residual values + + This struct holds residual values for both position and velocity iterations. + */ + struct PxResiduals + { + PxResidual positionIterationResidual; //!< Residual values for position iteration. + PxResidual velocityIterationResidual; //!< Residual values for velocity iteration. + }; + + typedef PxResiduals PxArticulationResidual; + typedef PxResiduals PxSceneResidual; + + /** + \brief Structure representing residual values for a constraint. + + This struct holds residual values for both position and velocity iterations specific to a constraint. + */ + struct PxConstraintResidual + { + PxReal positionIterationResidual; //!< Residual value for position iteration. + PxReal velocityIterationResidual; //!< Residual value for velocity iteration. + + PxConstraintResidual() : positionIterationResidual(0.0f), velocityIterationResidual(0.0f) {} + }; + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/engine/third_party/physx/include/PxRigidActor.h b/engine/third_party/physx/include/PxRigidActor.h new file mode 100644 index 00000000..056b76ec --- /dev/null +++ b/engine/third_party/physx/include/PxRigidActor.h @@ -0,0 +1,238 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_RIGID_ACTOR_H +#define PX_RIGID_ACTOR_H + +#include "PxActor.h" +#include "PxShape.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxConstraint; + +/** +\brief PxRigidActor represents a base class shared between dynamic and static rigid bodies in the physics SDK. + +PxRigidActor objects specify the geometry of the object by defining a set of attached shapes (see #PxShape). + +\see PxActor +*/ +class PxRigidActor : public PxActor +{ +public: + /** + \brief Deletes the rigid actor object. + + Also releases any shapes associated with the actor. + + Releasing an actor will affect any objects that are connected to the actor (constraint shaders like joints etc.). + Such connected objects will be deleted upon scene deletion, or explicitly by the user by calling release() + on these objects. It is recommended to always remove all objects that reference actors before the actors + themselves are removed. It is not possible to retrieve list of dead connected objects. + + Sleeping: This call will awaken any sleeping actors contacting the deleted actor (directly or indirectly). + + Calls #PxActor::release() so you might want to check the documentation of that method as well. + + \see PxActor::release() + */ + virtual void release() = 0; + + /** + \brief Returns the internal actor index. + + \warning This is only defined for actors that have been added to a scene. + + \return The internal actor index, or 0xffffffff if the actor is not part of a scene. + */ + virtual PxU32 getInternalActorIndex() const = 0; + +/************************************************************************************************/ +/** \name Global Pose Manipulation +*/ + + /** + \brief Retrieves the actors world space transform. + + The getGlobalPose() method retrieves the actor's current actor space to world space transformation. + + \note It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + in PxContactModifyCallback or in contact report callbacks). + + \note If this actor is a PxRigidDynamic or PxArticulationLink, this method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details. + + \return Global pose of object. + + \see PxRigidDynamic.setGlobalPose() PxRigidStatic.setGlobalPose() + */ + virtual PxTransform getGlobalPose() const = 0; + + /** + \brief Method for setting an actor's pose in the world. + + This method instantaneously changes the actor space to world space transformation. + + This method is mainly for dynamic rigid bodies (see #PxRigidDynamic). Calling this method on static actors is + likely to result in a performance penalty, since internal optimization structures for static actors may need to be + recomputed. In addition, moving static actors will not interact correctly with dynamic actors or joints. + + To directly control an actor's position and have it correctly interact with dynamic bodies and joints, create a dynamic + body with the PxRigidBodyFlag::eKINEMATIC flag, then use the setKinematicTarget() commands to define its path. + + Even when moving dynamic actors, exercise restraint in making use of this method. Where possible, avoid: + + \li moving actors into other actors, thus causing overlap (an invalid physical state) + + \li moving an actor that is connected by a joint to another away from the other (thus causing joint error) + + \note It is not allowed to use this method if the actor is part of a #PxPruningStructure that has not been + added to a scene yet. + + \note If this actor is a PxRigidDynamic or PxArticulationLink, this method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details. + + Sleeping: This call wakes dynamic actors if they are sleeping and the autowake parameter is true (default). + + \param[in] pose Transformation from the actors local frame to the global frame. Range: rigid body transform. + \param[in] autowake whether to wake the object if it is dynamic. This parameter has no effect for static or kinematic actors. If true and the current wake counter value is smaller than #PxSceneDesc::wakeCounterResetValue it will get increased to the reset value. + + \see getGlobalPose() + */ + virtual void setGlobalPose(const PxTransform& pose, bool autowake = true) = 0; + +/************************************************************************************************/ +/** \name Shapes +*/ + + /** + \brief Attach a shape to an actor + + This call will increment the reference count of the shape. + + \note Mass properties of dynamic rigid actors will not automatically be recomputed + to reflect the new mass distribution implied by the shape. Follow this call with a call to + the PhysX extensions method #PxRigidBodyExt::updateMassAndInertia() to do that. + + Attaching a triangle mesh, heightfield or plane geometry shape configured as eSIMULATION_SHAPE is not supported for + non-kinematic PxRigidDynamic instances. + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] shape the shape to attach. + + \return True if success. + */ + virtual bool attachShape(PxShape& shape) = 0; + + /** + \brief Detach a shape from an actor. + + This will also decrement the reference count of the PxShape, and if the reference count is zero, will cause it to be deleted. + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] shape the shape to detach. + \param[in] wakeOnLostTouch Specifies whether touching objects from the previous frame should get woken up in the next frame. Only applies to PxArticulationReducedCoordinate and PxRigidActor types. + */ + virtual void detachShape(PxShape& shape, bool wakeOnLostTouch = true) = 0; + + /** + \brief Returns the number of shapes assigned to the actor. + + You can use #getShapes() to retrieve the shape pointers. + + \return Number of shapes associated with this actor. + + \see PxShape getShapes() + */ + virtual PxU32 getNbShapes() const = 0; + + /** + \brief Retrieve all the shape pointers belonging to the actor. + + These are the shapes used by the actor for collision detection. + + You can retrieve the number of shape pointers by calling #getNbShapes() + + Note: Removing shapes with #PxShape::release() will invalidate the pointer of the released shape. + + \param[out] userBuffer The buffer to store the shape pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first shape pointer to be retrieved + \return Number of shape pointers written to the buffer. + + \see PxShape getNbShapes() PxShape::release() + */ + virtual PxU32 getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + +/************************************************************************************************/ +/** \name Constraints +*/ + + /** + \brief Returns the number of constraint shaders attached to the actor. + + You can use #getConstraints() to retrieve the constraint shader pointers. + + \return Number of constraint shaders attached to this actor. + + \see PxConstraint getConstraints() + */ + virtual PxU32 getNbConstraints() const = 0; + + /** + \brief Retrieve all the constraint shader pointers belonging to the actor. + + You can retrieve the number of constraint shader pointers by calling #getNbConstraints() + + Note: Removing constraint shaders with #PxConstraint::release() will invalidate the pointer of the released constraint. + + \param[out] userBuffer The buffer to store the constraint shader pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first constraint pointer to be retrieved + \return Number of constraint shader pointers written to the buffer. + + \see PxConstraint getNbConstraints() PxConstraint::release() + */ + virtual PxU32 getConstraints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + +protected: + PX_INLINE PxRigidActor(PxType concreteType, PxBaseFlags baseFlags) : PxActor(concreteType, baseFlags) {} + PX_INLINE PxRigidActor(PxBaseFlags baseFlags) : PxActor(baseFlags) {} + virtual ~PxRigidActor() {} + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxRigidActor", PxActor); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxRigidBody.h b/engine/third_party/physx/include/PxRigidBody.h new file mode 100644 index 00000000..560f3a7c --- /dev/null +++ b/engine/third_party/physx/include/PxRigidBody.h @@ -0,0 +1,779 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_RIGID_BODY_H +#define PX_RIGID_BODY_H + +#include "PxRigidActor.h" +#include "PxForceMode.h" +#include "PxNodeIndex.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Collection of flags describing the behavior of a rigid body. + +\see PxRigidBody.setRigidBodyFlag(), PxRigidBody.getRigidBodyFlags() +*/ +struct PxRigidBodyFlag +{ + enum Enum + { + /** + \brief Enables kinematic mode for the actor. + + Kinematic actors are special dynamic actors that are not + influenced by forces (such as gravity), and have no momentum. They are considered to have infinite + mass and can be moved around the world using the setKinematicTarget() method. They will push + regular dynamic actors out of the way. Kinematics will not collide with static or other kinematic objects. + + Kinematic actors are great for moving platforms or characters, where direct motion control is desired. + + You can not connect Reduced joints to kinematic actors. Lagrange joints work ok if the platform + is moving with a relatively low, uniform velocity. + + Sleeping: + \li Setting this flag on a dynamic actor will put the actor to sleep and set the velocities to 0. + \li If this flag gets cleared, the current sleep state of the actor will be kept. + + \note kinematic actors are incompatible with CCD so raising this flag will automatically clear eENABLE_CCD + + \see PxRigidDynamic.setKinematicTarget() + */ + eKINEMATIC = (1<<0), //!< Enable kinematic mode for the body. + + /** + \brief Use the kinematic target transform for scene queries. + + If this flag is raised, then scene queries will treat the kinematic target transform as the current pose + of the body (instead of using the actual pose). Without this flag, the kinematic target will only take + effect with respect to scene queries after a simulation step. + + \see PxRigidDynamic.setKinematicTarget() + */ + eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES = (1<<1), + + /** + \brief Enables swept integration for the actor. + + If this flag is raised and CCD is enabled on the scene, then this body will be simulated by the CCD system to ensure that collisions are not missed due to + high-speed motion. Note individual shape pairs still need to enable PxPairFlag::eDETECT_CCD_CONTACT in the collision filtering to enable the CCD to respond to + individual interactions. + + \note kinematic actors are incompatible with CCD so this flag will be cleared automatically when raised on a kinematic actor + \note PxConvexCoreGeometry geometry type only supports eENABLE_SPECULATIVE_CCD at the moment. eENABLE_CCD will be ignored + */ + eENABLE_CCD = (1<<2), //!< Enable CCD for the body. + + /** + \brief Enabled CCD in swept integration for the actor. + + If this flag is raised and CCD is enabled, CCD interactions will simulate friction. By default, friction is disabled in CCD interactions because + CCD friction has been observed to introduce some simulation artifacts. CCD friction was enabled in previous versions of the SDK. Raising this flag will result in behavior + that is a closer match for previous versions of the SDK. + + \note This flag requires PxRigidBodyFlag::eENABLE_CCD to be raised to have any effect. + */ + eENABLE_CCD_FRICTION = (1<<3), + + /** + \brief Register a rigid body to dynamically adjust contact offset based on velocity. This can be used to achieve a CCD effect. + + If both eENABLE_CCD and eENABLE_SPECULATIVE_CCD are set on the same body, then angular motions are handled by speculative + contacts (eENABLE_SPECULATIVE_CCD) while linear motions are handled by sweeps (eENABLE_CCD). + */ + eENABLE_SPECULATIVE_CCD = (1<<4), + + /** + \brief Register a rigid body for reporting pose changes by the simulation at an early stage. + + Sometimes it might be advantageous to get access to the new pose of a rigid body as early as possible and + not wait until the call to fetchResults() returns. Setting this flag will schedule the rigid body to get reported + in #PxSimulationEventCallback::onAdvance(). Please refer to the documentation of that callback to understand + the behavior and limitations of this functionality. + + \see PxSimulationEventCallback::onAdvance() + */ + eENABLE_POSE_INTEGRATION_PREVIEW = (1<<5), + + /** + \brief Permit CCD to limit maxContactImpulse. This is useful for use-cases like a destruction system but can cause visual artefacts so is not enabled by default. + */ + eENABLE_CCD_MAX_CONTACT_IMPULSE = (1<<6), + + /** + \brief Carries over forces/torques between frames, rather than clearing them + + If this flag is raised, forces and torques will carry over between frames. Impulses applied with PxForceMode::eIMPULSE will not be retained. + + \note Clearing this flag will retain the accelerations for an additional frame before clearing them. To reset the forces immediately for the next frame, + a call to PxRigidBody::clearForce() / PxRigidBody::clearTorque() is needed. + + \see PxRigidBody::addForce(), PxRigidBody::AddTorque(), PxRigidBody::setForceAndTorque(), PxRigidBody::clearForce(), PxRigidBody::clearTorque() + */ + eRETAIN_ACCELERATIONS = (1<<7), + + /** + \brief Forces kinematic-kinematic pairs notifications for this actor. + + This flag overrides the global scene-level PxPairFilteringMode setting for kinematic actors. + This is equivalent to having PxPairFilteringMode::eKEEP for pairs involving this actor. + + A particular use case is when you have a large amount of kinematic actors, but you are only + interested in interactions between a few of them. In this case it is best to use + PxSceneDesc.kineKineFilteringMode = PxPairFilteringMode::eKILL, and then raise the + eFORCE_KINE_KINE_NOTIFICATIONS flag on the small set of kinematic actors that need + notifications. + + \note This has no effect if PxRigidBodyFlag::eKINEMATIC is not set. + + \warning Changing this flag at runtime will not have an effect until you remove and re-add the actor to the scene. + + \see PxPairFilteringMode PxSceneDesc.kineKineFilteringMode + */ + eFORCE_KINE_KINE_NOTIFICATIONS = (1<<8), + + /** + \brief Forces static-kinematic pairs notifications for this actor. + + Similar to eFORCE_KINE_KINE_NOTIFICATIONS, but for static-kinematic interactions. + + \note This has no effect if PxRigidBodyFlag::eKINEMATIC is not set. + + \warning Changing this flag at runtime will not have an effect until you remove and re-add the actor to the scene. + + \see PxPairFilteringMode PxSceneDesc.staticKineFilteringMode + */ + eFORCE_STATIC_KINE_NOTIFICATIONS = (1<<9), + + /** + \brief Enables computation of gyroscopic forces on the rigid body. + */ + eENABLE_GYROSCOPIC_FORCES = (1<<10), + + /** + \brief Reserved for internal usage + */ + eRESERVED = (1<<15) + }; +}; + +/** +\brief collection of set bits defined in PxRigidBodyFlag. + +\see PxRigidBodyFlag +*/ +typedef PxFlags PxRigidBodyFlags; +PX_FLAGS_OPERATORS(PxRigidBodyFlag::Enum,PxU16) + +/** +\brief PxRigidBody is a base class shared between dynamic rigid body objects. + +\see PxRigidActor +*/ + +class PxRigidBody : public PxRigidActor +{ +public: + // Runtime modifications + +/************************************************************************************************/ +/** \name Mass Manipulation +*/ + + /** + \brief Sets the pose of the center of mass relative to the actor. + + \note Changing this transform will not move the actor in the world! + + \note Setting an unrealistic center of mass which is a long way from the body can make it difficult for + the SDK to solve constraints. Perhaps leading to instability and jittering bodies. + + \note Changing this transform will not update the linear velocity reported by getLinearVelocity() to account + for the shift in center of mass. If the shift should be accounted for, the user should update the velocity + using setLinearVelocity(). + + Default: the identity transform + + \param[in] pose Mass frame offset transform relative to the actor frame. Range: rigid body transform. + + \see getCMassLocalPose() getLinearVelocity() + */ + virtual void setCMassLocalPose(const PxTransform& pose) = 0; + + /** + \brief Retrieves the center of mass pose relative to the actor frame. + + \return The center of mass pose relative to the actor frame. + + \see setCMassLocalPose() + */ + virtual PxTransform getCMassLocalPose() const = 0; + + /** + \brief Sets the mass of a dynamic actor. + + The mass must be non-negative. + + setMass() does not update the inertial properties of the body, to change the inertia tensor + use setMassSpaceInertiaTensor() or the PhysX extensions method #PxRigidBodyExt::updateMassAndInertia(). + + \note A value of 0 is interpreted as infinite mass. + \note Values of 0 are not permitted for instances of PxArticulationLink but are permitted for instances of PxRigidDynamic. + + Default: 1.0 + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] mass New mass value for the actor. Range: [0, PX_MAX_F32) + + \see getMass() setMassSpaceInertiaTensor() + */ + virtual void setMass(PxReal mass) = 0; + + /** + \brief Retrieves the mass of the actor. + + \note A value of 0 is interpreted as infinite mass. + + \return The mass of this actor. + + \see setMass() setMassSpaceInertiaTensor() + */ + virtual PxReal getMass() const = 0; + + /** + \brief Retrieves the inverse mass of the actor. + + \return The inverse mass of this actor. + + \see setMass() setMassSpaceInertiaTensor() + */ + virtual PxReal getInvMass() const = 0; + + /** + \brief Sets the inertia tensor, using a parameter specified in mass space coordinates. + + Note that such matrices are diagonal -- the passed vector is the diagonal. + + If you have a non diagonal world/actor space inertia tensor(3x3 matrix). Then you need to + diagonalize it and set an appropriate mass space transform. See #setCMassLocalPose(). + + The inertia tensor elements must be non-negative. + + \note A value of 0 in an element is interpreted as infinite inertia along that axis. + \note Values of 0 are not permitted for instances of PxArticulationLink but are permitted for instances of PxRigidDynamic. + + Default: (1.0, 1.0, 1.0) + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] m New mass space inertia tensor for the actor. + + \see getMassSpaceInertia() setMass() setCMassLocalPose() + */ + virtual void setMassSpaceInertiaTensor(const PxVec3& m) = 0; + + /** + \brief Retrieves the diagonal inertia tensor of the actor relative to the mass coordinate frame. + + This method retrieves a mass frame inertia vector. + + \return The mass space inertia tensor of this actor. + + \note A value of 0 in an element is interpreted as infinite inertia along that axis. + + \see setMassSpaceInertiaTensor() setMass() setCMassLocalPose() + */ + virtual PxVec3 getMassSpaceInertiaTensor() const = 0; + + /** + \brief Retrieves the diagonal inverse inertia tensor of the actor relative to the mass coordinate frame. + + This method retrieves a mass frame inverse inertia vector. + + \note A value of 0 in an element is interpreted as infinite inertia along that axis. + + \return The mass space inverse inertia tensor of this actor. + + \see setMassSpaceInertiaTensor() setMass() setCMassLocalPose() + */ + virtual PxVec3 getMassSpaceInvInertiaTensor() const = 0; + + /************************************************************************************************/ + /** \name Damping + */ + + /** + \brief Sets the linear damping coefficient. + + Zero represents no damping. The damping coefficient must be nonnegative. + + Default: 0.05 for PxArticulationLink, 0.0 for PxRigidDynamic + + \param[in] linDamp Linear damping coefficient. Range: [0, PX_MAX_F32) + + \see getLinearDamping() setAngularDamping() + */ + virtual void setLinearDamping(PxReal linDamp) = 0; + + /** + \brief Retrieves the linear damping coefficient. + + \return The linear damping coefficient associated with this actor. + + \see setLinearDamping() getAngularDamping() + */ + virtual PxReal getLinearDamping() const = 0; + + /** + \brief Sets the angular damping coefficient. + + Zero represents no damping. + + The angular damping coefficient must be nonnegative. + + Default: 0.05 + + \param[in] angDamp Angular damping coefficient. Range: [0, PX_MAX_F32) + + \see getAngularDamping() setLinearDamping() + */ + virtual void setAngularDamping(PxReal angDamp) = 0; + + /** + \brief Retrieves the angular damping coefficient. + + \return The angular damping coefficient associated with this actor. + + \see setAngularDamping() getLinearDamping() + */ + virtual PxReal getAngularDamping() const = 0; + + +/************************************************************************************************/ +/** \name Velocity +*/ + + /** + \brief Retrieves the linear velocity of an actor. + + \note It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + in PxContactModifyCallback or in contact report callbacks). + + \note The linear velocity is reported with respect to the rigid body's center of mass and not the actor frame origin. + + \return The linear velocity of the actor. + + \see PxRigidDynamic.setLinearVelocity() getAngularVelocity() + */ + virtual PxVec3 getLinearVelocity() const = 0; + + /** + \brief Retrieves the angular velocity of the actor. + + \note It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + in PxContactModifyCallback or in contact report callbacks). + + \return The angular velocity of the actor. + + \see PxRigidDynamic.setAngularVelocity() getLinearVelocity() + */ + virtual PxVec3 getAngularVelocity() const = 0; + + /** + \brief Lets you set the maximum linear velocity permitted for this actor. + + With this function, you can set the maximum linear velocity permitted for this rigid body. + Higher linear velocities are clamped to this value. + + Note: The linear velocity is clamped to the set value before the solver, which means that + the limit may still be momentarily exceeded. + + \note Enforcing the limit introduces momentum into the simulation, causing potentially unphysical behavior. + For articulation links, consider using joint damping and limits instead, which preserve momentum. + + Default: 100 * PxTolerancesScale::length /s for PxArticulationLink, 1e^16 lengthUnits/s for PxRigidDynamic + + \param[in] maxLinVel Max allowable linear velocity for actor. Range: [0, 1e^16) lengthUnits/s + + \see getMaxAngularVelocity() + */ + virtual void setMaxLinearVelocity(PxReal maxLinVel) = 0; + + /** + \brief Retrieves the maximum angular velocity permitted for this actor. + + \return The maximum allowed angular velocity for this actor. + + \see setMaxLinearVelocity + */ + virtual PxReal getMaxLinearVelocity() const = 0; + + /** + \brief Lets you set the maximum angular velocity permitted for this actor. + + For various internal computations, very quickly rotating actors introduce error + into the simulation, which leads to undesired results. + + With this function, you can set the maximum angular velocity permitted for this rigid body. + Higher angular velocities are clamped to this value. + + Note: The angular velocity is clamped to the set value before the solver, which means that + the limit may still be momentarily exceeded. + + \note Enforcing the limit introduces momentum into the simulation, causing potentially unphysical behavior. + For articulation links, consider using joint damping and limits instead, which preserve momentum. + + Default: 50.0 rad/s for PxArticulationLink, 100.0 rad/s for PxRigidDynamic + + Range: [0, 1e^16) rad/s + + \param[in] maxAngVel Max allowable angular velocity for actor. + + \see getMaxAngularVelocity() + */ + virtual void setMaxAngularVelocity(PxReal maxAngVel) = 0; + + /** + \brief Retrieves the maximum angular velocity permitted for this actor. + + \return The maximum allowed angular velocity for this actor. + + \see setMaxAngularVelocity + */ + virtual PxReal getMaxAngularVelocity() const = 0; + +/************************************************************************************************/ +/** \name Acceleration +*/ + + /** + \brief Retrieves the linear acceleration of an actor. + + For PxArticulationLink objects, this function is always available. + + For PxRigidDynamic actors, this function only returns valid results if PxSceneFlag::eENABLE_BODY_ACCELERATIONS is enabled. + If that flag is not enabled, the function returns zero for PxRigidDynamic actors. + + \return The linear acceleration of the actor, or zero if PxSceneFlag::eENABLE_BODY_ACCELERATIONS is disabled and the object is a PxRigidDynamic. + + \see PxRigidBody.getAngularAcceleration() PxSceneFlag::eENABLE_BODY_ACCELERATIONS + */ + virtual PxVec3 getLinearAcceleration() const = 0; + + /** + \brief Retrieves the angular acceleration of an actor. + + For PxArticulationLink objects, this function is always available. + + For PxRigidDynamic actors, this function only returns valid results if PxSceneFlag::eENABLE_BODY_ACCELERATIONS is enabled. + If that flag is not enabled, the function returns zero for PxRigidDynamic actors. + + \return The angular acceleration of the actor, or zero if PxSceneFlag::eENABLE_BODY_ACCELERATIONS is disabled and the object is a PxRigidDynamic. + + \see PxRigidBody.getLinearAcceleration() PxSceneFlag::eENABLE_BODY_ACCELERATIONS + */ + virtual PxVec3 getAngularAcceleration() const = 0; + +/************************************************************************************************/ +/** \name Forces +*/ + + /** + \brief Applies a force (or impulse) defined in the global coordinate frame to the actor at its center of mass. + + This will not induce a torque. + + ::PxForceMode determines if the force is to be conventional or impulsive. + + Each actor has an acceleration and a velocity change accumulator which are directly modified using the modes PxForceMode::eACCELERATION + and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE also modify these same + accumulators and are just short hand for multiplying the vector parameter by inverse mass and then using PxForceMode::eACCELERATION and + PxForceMode::eVELOCITY_CHANGE respectively. + + \note It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + + \note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details. + + \note The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + + \note if this is called on an articulation link, only the link is updated, not the entire articulation. + + \note see #PxRigidBodyExt::computeVelocityDeltaFromImpulse for details of how to compute the change in linear velocity that + will arise from the application of an impulsive force, where an impulsive force is applied force multiplied by a timestep. + + \note Forces will be cleared automatically after they are applied during the next simulation step. If the forces should be retained for + the following steps, PxRigidBodyFlag::eRETAIN_ACCELERATIONS should be raised. + + Sleeping: This call wakes the actor if it is sleeping, and the autowake parameter is true (default) or the force is non-zero. + + \param[in] force Force/Impulse to apply defined in the global frame. + \param[in] mode The mode to use when applying the force/impulse(see #PxForceMode) + \param[in] autowake Specify if the call should wake up the actor if it is currently asleep. If true and the current wake counter value + is smaller than #PxSceneDesc::wakeCounterResetValue it will get increased to the reset value. + + \see PxForceMode addTorque + */ + virtual void addForce(const PxVec3& force, PxForceMode::Enum mode = PxForceMode::eFORCE, bool autowake = true) = 0; + + /** + \brief Applies an impulsive torque defined in the global coordinate frame to the actor. + + ::PxForceMode determines if the torque is to be conventional or impulsive. + + Each actor has an angular acceleration and an angular velocity change accumulator which are directly modified using the modes + PxForceMode::eACCELERATION and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE + also modify these same accumulators and are just short hand for multiplying the vector parameter by inverse inertia and then + using PxForceMode::eACCELERATION and PxForceMode::eVELOCITY_CHANGE respectively. + + \note It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + + \note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details. + + \note The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + + \note if this called on an articulation link, only the link is updated, not the entire articulation. + + \note see #PxRigidBodyExt::computeVelocityDeltaFromImpulse for details of how to compute the change in angular velocity that + will arise from the application of an impulsive torque, where an impulsive torque is an applied torque multiplied by a timestep. + + \note Torques will be cleared after they are applied during the next simulation step. If the Torques should be retained for the following + steps, PxRigidBodyFlag::eRETAIN_ACCELERATIONS should be raised. + + Sleeping: This call wakes the actor if it is sleeping, and the autowake parameter is true (default) or the torque is non-zero. + + \param[in] torque Torque to apply defined in the global frame. Range: torque vector + \param[in] mode The mode to use when applying the force/impulse(see #PxForceMode). + \param[in] autowake Specify if the call should wake up the actor if it is currently asleep. If true and the current wake counter value + is smaller than #PxSceneDesc::wakeCounterResetValue it will get increased to the reset value. + + \see PxForceMode addForce() + */ + virtual void addTorque(const PxVec3& torque, PxForceMode::Enum mode = PxForceMode::eFORCE, bool autowake = true) = 0; + + /** + \brief Clears the accumulated forces (sets the accumulated force back to zero). + + Each actor has an acceleration and a velocity change accumulator which are directly modified using the modes PxForceMode::eACCELERATION + and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE also modify these same + accumulators (see PxRigidBody::addForce() for details); therefore the effect of calling clearForce(PxForceMode::eFORCE) is equivalent to calling + clearForce(PxForceMode::eACCELERATION), and the effect of calling clearForce(PxForceMode::eIMPULSE) is equivalent to calling + clearForce(PxForceMode::eVELOCITY_CHANGE). + + ::PxForceMode determines if the cleared force is to be conventional or impulsive. + + \note The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + + \note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details. + + \note It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + + \param[in] mode The mode to use when clearing the force/impulse(see #PxForceMode) + + \see PxForceMode addForce + */ + virtual void clearForce(PxForceMode::Enum mode = PxForceMode::eFORCE) = 0; + + /** + \brief Clears the impulsive torque defined in the global coordinate frame to the actor. + + ::PxForceMode determines if the cleared torque is to be conventional or impulsive. + + Each actor has an angular acceleration and a velocity change accumulator which are directly modified using the modes PxForceMode::eACCELERATION + and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE also modify these same + accumulators (see PxRigidBody::addTorque() for details); therefore the effect of calling clearTorque(PxForceMode::eFORCE) is equivalent to calling + clearTorque(PxForceMode::eACCELERATION), and the effect of calling clearTorque(PxForceMode::eIMPULSE) is equivalent to calling + clearTorque(PxForceMode::eVELOCITY_CHANGE). + + \note The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + + \note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details. + + \note It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + + \param[in] mode The mode to use when clearing the force/impulse(see #PxForceMode). + + \see PxForceMode addTorque + */ + virtual void clearTorque(PxForceMode::Enum mode = PxForceMode::eFORCE) = 0; + + /** + \brief Sets the impulsive force and torque defined in the global coordinate frame to the actor. + + ::PxForceMode determines if the cleared torque is to be conventional or impulsive. + + \note The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + + \note This method should not be used after the direct GPU API has been enabled and initialized. See #PxDirectGPUAPI for the details. + + \note It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + + \note Forces and torques will be cleared after they are applied during the next simulation step. If they should be retained for the following + steps, PxRigidBodyFlag::eRETAIN_ACCELERATIONS should be raised. + + \see PxForceMode addTorque + */ + virtual void setForceAndTorque(const PxVec3& force, const PxVec3& torque, PxForceMode::Enum mode = PxForceMode::eFORCE) = 0; + + /** + \brief Raises or clears a particular rigid body flag. + + See the list of flags #PxRigidBodyFlag + + Default: no flags are set + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] flag The PxRigidBody flag to raise(set) or clear. See #PxRigidBodyFlag. + \param[in] value The new boolean value for the flag. + + \see PxRigidBodyFlag getRigidBodyFlags() + */ + virtual void setRigidBodyFlag(PxRigidBodyFlag::Enum flag, bool value) = 0; + virtual void setRigidBodyFlags(PxRigidBodyFlags inFlags) = 0; + + /** + \brief Reads the PxRigidBody flags. + + See the list of flags #PxRigidBodyFlag + + \return The values of the PxRigidBody flags. + + \see PxRigidBodyFlag setRigidBodyFlag() + */ + virtual PxRigidBodyFlags getRigidBodyFlags() const = 0; + + /** + \brief Sets the CCD minimum advance coefficient. + + The CCD minimum advance coefficient is a value in the range [0, 1] that is used to control the minimum amount of time a body is integrated when + it has a CCD contact. The actual minimum amount of time that is integrated depends on various properties, including the relative speed and collision shapes + of the bodies involved in the contact. From these properties, a numeric value is calculated that determines the maximum distance (and therefore maximum time) + which these bodies could be integrated forwards that would ensure that these bodies did not pass through each-other. This value is then scaled by CCD minimum advance + coefficient to determine the amount of time that will be consumed in the CCD pass. + + Things to consider: + A large value (approaching 1) ensures that the objects will always advance some time. However, larger values increase the chances of objects gently drifting through each-other in + scenes which the constraint solver can't converge, e.g. scenes where an object is being dragged through a wall with a constraint. + A value of 0 ensures that the pair of objects stop at the exact time-of-impact and will not gently drift through each-other. However, with very small/thin objects initially in + contact, this can lead to a large amount of time being dropped and increases the chances of jamming. Jamming occurs when the an object is persistently in contact with an object + such that the time-of-impact is 0, which results in no time being advanced for those objects in that CCD pass. + + The chances of jamming can be reduced by increasing the number of CCD mass \see PxSceneDesc.ccdMaxPasses. However, increasing this number increases the CCD overhead. + + \param[in] advanceCoefficient The CCD min advance coefficient. Range: [0, 1] Default: 0.15 + */ + virtual void setMinCCDAdvanceCoefficient(PxReal advanceCoefficient) = 0; + + /** + \brief Gets the CCD minimum advance coefficient. + + \return The value of the CCD min advance coefficient. + + \see setMinCCDAdvanceCoefficient + */ + virtual PxReal getMinCCDAdvanceCoefficient() const = 0; + + /** + \brief Sets the maximum depenetration velocity permitted to be introduced by the solver. + This value controls how much velocity the solver can introduce to correct for penetrations in contacts. + \param[in] biasClamp The maximum velocity to de-penetrate by Range: (0, PX_MAX_F32]. + */ + virtual void setMaxDepenetrationVelocity(PxReal biasClamp) = 0; + + /** + \brief Returns the maximum depenetration velocity the solver is permitted to introduced. + This value controls how much velocity the solver can introduce to correct for penetrations in contacts. + \return The maximum penetration bias applied by the solver. + */ + virtual PxReal getMaxDepenetrationVelocity() const = 0; + + /** + \brief Sets a limit on the impulse that may be applied at a contact. The maximum impulse at a contact between two dynamic or kinematic + bodies will be the minimum of the two limit values. For a collision between a static and a dynamic body, the impulse is limited + by the value for the dynamic body. + + \param[in] maxImpulse the maximum contact impulse. Range: [0, PX_MAX_F32] Default: PX_MAX_F32 + + \see getMaxContactImpulse + */ + virtual void setMaxContactImpulse(PxReal maxImpulse) = 0; + + /** + \brief Returns the maximum impulse that may be applied at a contact. + + \return The maximum impulse that may be applied at a contact + + \see setMaxContactImpulse + */ + virtual PxReal getMaxContactImpulse() const = 0; + + /** + \brief Sets a distance scale whereby the angular influence of a contact on the normal constraint in a contact is + zeroed if normal.cross(offset) falls below this tolerance. Rather than acting as an absolute value, this tolerance + is scaled by the ratio rXn.dot(angVel)/normal.dot(linVel) such that contacts that have relatively larger angular velocity + than linear normal velocity (e.g. rolling wheels) achieve larger slop values as the angular velocity increases. + + \param[in] slopCoefficient the Slop coefficient. Range: [0, PX_MAX_F32] Default: 0 + + \see getContactSlopCoefficient + */ + virtual void setContactSlopCoefficient(PxReal slopCoefficient) = 0; + + /** + \brief Returns the contact slop coefficient. + + \return The contact slop coefficient. + + \see setContactSlopCoefficient + */ + virtual PxReal getContactSlopCoefficient() const = 0; + + /** + \brief Returns the island node index + + \return The island node index. + */ + virtual PxNodeIndex getInternalIslandNodeIndex() const = 0; + +protected: + PX_INLINE PxRigidBody(PxType concreteType, PxBaseFlags baseFlags) : PxRigidActor(concreteType, baseFlags) {} + PX_INLINE PxRigidBody(PxBaseFlags baseFlags) : PxRigidActor(baseFlags) {} + virtual ~PxRigidBody() {} + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxRigidBody", PxRigidActor); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxRigidDynamic.h b/engine/third_party/physx/include/PxRigidDynamic.h new file mode 100644 index 00000000..642de486 --- /dev/null +++ b/engine/third_party/physx/include/PxRigidDynamic.h @@ -0,0 +1,476 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_RIGID_DYNAMIC_H +#define PX_RIGID_DYNAMIC_H + +#include "PxRigidBody.h" +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Collection of flags providing a mechanism to lock motion along/around a specific axis. + +\see PxRigidDynamic.setRigidDynamicLockFlag(), PxRigidBody.getRigidDynamicLockFlags() +*/ +struct PxRigidDynamicLockFlag +{ + enum Enum + { + eLOCK_LINEAR_X = (1 << 0), + eLOCK_LINEAR_Y = (1 << 1), + eLOCK_LINEAR_Z = (1 << 2), + eLOCK_ANGULAR_X = (1 << 3), + eLOCK_ANGULAR_Y = (1 << 4), + eLOCK_ANGULAR_Z = (1 << 5) + }; +}; + +typedef PxFlags PxRigidDynamicLockFlags; +PX_FLAGS_OPERATORS(PxRigidDynamicLockFlag::Enum, PxU8) + +/** +\brief PxRigidDynamic represents a dynamic rigid simulation object in the physics SDK. + +

Creation

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

Visualizations

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

Creation

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

Visualizations

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

Visualizations

+\li PxVisualizationParameter::eCOLLISION_AABBS +\li PxVisualizationParameter::eCOLLISION_SHAPES +\li PxVisualizationParameter::eCOLLISION_AXES + +\see PxPhysics.createShape() PxRigidActor.createShape() PxBoxGeometry PxSphereGeometry PxCapsuleGeometry PxPlaneGeometry PxConvexMeshGeometry +PxTriangleMeshGeometry PxHeightFieldGeometry +*/ +class PxShape : public PxRefCounted +{ +public: + /** + \brief Adjust the geometry of the shape. + + \note The type of the passed in geometry must match the geometry type of the shape. + \note It is not allowed to change the geometry type of a shape. + \note This function does not guarantee correct/continuous behavior when objects are resting on top of old or new geometry. + + \param[in] geometry New geometry of the shape. + + \see PxGeometry PxGeometryType getGeometryType() + */ + virtual void setGeometry(const PxGeometry& geometry) = 0; + + /** + \brief Retrieve a reference to the shape's geometry. + + \warning The returned reference has the same lifetime as the PxShape it comes from. + + \return Reference to internal PxGeometry object. + + \see PxGeometry PxGeometryType getGeometryType() setGeometry() + */ + virtual const PxGeometry& getGeometry() const = 0; + + /** + \brief Retrieves the actor which this shape is associated with. + + \return The actor this shape is associated with, if it is an exclusive shape, else NULL + + \see PxRigidStatic, PxRigidDynamic, PxArticulationLink + */ + virtual PxRigidActor* getActor() const = 0; + +/************************************************************************************************/ + +/** \name Pose Manipulation +*/ +//\{ + + /** + \brief Sets the pose of the shape in actor space, i.e. relative to the actors to which they are attached. + + This transformation is identity by default. + + The local pose is an attribute of the shape, and so will apply to all actors to which the shape is attached. + + Sleeping: Does NOT wake the associated actor up automatically. + + Note: Does not automatically update the inertia properties of the owning actor (if applicable); use the + PhysX extensions method #PxRigidBodyExt::updateMassAndInertia() to do this. + + Default: the identity transform + + \param[in] pose The new transform from the actor frame to the shape frame. Range: rigid body transform + + \see getLocalPose() + */ + virtual void setLocalPose(const PxTransform& pose) = 0; + + /** + \brief Retrieves the pose of the shape in actor space, i.e. relative to the actor they are owned by. + + This transformation is identity by default. + + \return Pose of shape relative to the actor's frame. + + \see setLocalPose() + */ + virtual PxTransform getLocalPose() const = 0; + +//\} +/************************************************************************************************/ + +/** \name Collision Filtering +*/ +//\{ + + /** + \brief Sets the user definable collision filter data. + + Sleeping: Does wake up the actor if the filter data change causes a formerly suppressed + collision pair to be enabled. + + Default: (0,0,0,0) + + \see getSimulationFilterData() + */ + virtual void setSimulationFilterData(const PxFilterData& data) = 0; + + /** + \brief Retrieves the shape's collision filter data. + + \see setSimulationFilterData() + */ + virtual PxFilterData getSimulationFilterData() const = 0; + + /** + \brief Sets the user definable query filter data. + + Default: (0,0,0,0) + + \see getQueryFilterData() + */ + virtual void setQueryFilterData(const PxFilterData& data) = 0; + + /** + \brief Retrieves the shape's Query filter data. + + \see setQueryFilterData() + */ + virtual PxFilterData getQueryFilterData() const = 0; + +//\} +/************************************************************************************************/ + + /** + \brief Assigns material(s) to the shape. Will remove existing materials from the shape. + + Sleeping: Does NOT wake the associated actor up automatically. + + \param[in] materials List of material pointers to assign to the shape. See #PxMaterial + \param[in] materialCount The number of materials provided. + + \see PxPhysics.createMaterial() getMaterials() + */ + virtual void setMaterials(PxMaterial*const* materials, PxU16 materialCount) = 0; + + /** + \brief Assigns surface deformable material(s) to the shape. Will remove existing materials from the shape. + + Sleeping: Does NOT wake the associated actor up automatically. + + \param[in] materials List of material pointers to assign to the shape. See #PxDeformableSurfaceMaterial + \param[in] materialCount The number of materials provided. + + \see PxPhysics.createDeformableSurfaceMaterial() getDeformableSurfaceMaterials() + */ + virtual void setDeformableSurfaceMaterials(PxDeformableSurfaceMaterial*const* materials, PxU16 materialCount) = 0; + + /** + \brief Assigns deformable volume material(s) to the shape. Will remove existing materials from the shape. + + Sleeping: Does NOT wake the associated actor up automatically. + + \param[in] materials List of material pointers to assign to the shape. See #PxDeformableVolumeMaterial + \param[in] materialCount The number of materials provided. + + \see PxPhysics.createDeformableVolumeMaterial() getDeformableVolumeMaterials() + */ + virtual void setDeformableVolumeMaterials(PxDeformableVolumeMaterial* const* materials, PxU16 materialCount) = 0; + + /** + \brief Deprecated + \see setDeformableVolumeMaterials + */ + PX_DEPRECATED PX_FORCE_INLINE void setSoftBodyMaterials(PxDeformableVolumeMaterial* const* materials, PxU16 materialCount) + { + setDeformableVolumeMaterials(materials, materialCount); + } + + /** + \brief Returns the number of materials assigned to the shape. + + You can use #getMaterials() to retrieve the material pointers. + + \return Number of materials associated with this shape. + + \see PxMaterial getMaterials() + */ + virtual PxU16 getNbMaterials() const = 0; + + /** + \brief Retrieve all the material pointers associated with the shape. + + You can retrieve the number of material pointers by calling #getNbMaterials() + + Note: The returned data may contain invalid pointers if you release materials using #PxMaterial::release(). + + \param[out] userBuffer The buffer to store the material pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first material pointer to be retrieved + \return Number of material pointers written to the buffer. + + \see PxMaterial getNbMaterials() PxMaterial::release() + */ + virtual PxU32 getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + /** + \brief Retrieve all the surface deformable material pointers associated with the shape. + + You can retrieve the number of material pointers by calling #getNbMaterials() + + Note: The returned data may contain invalid pointers if you release materials using #PxMaterial::release(). + + \param[out] userBuffer The buffer to store the material pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first material pointer to be retrieved + \return Number of material pointers written to the buffer. + + \see PxDeformableSurfaceMaterial getNbMaterials() PxMaterial::release() + */ + virtual PxU32 getDeformableSurfaceMaterials(PxDeformableSurfaceMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Retrieve all the deformable volume material pointers associated with the shape. + + You can retrieve the number of material pointers by calling #getNbMaterials() + + Note: The returned data may contain invalid pointers if you release materials using #PxMaterial::release(). + + \param[out] userBuffer The buffer to store the material pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first material pointer to be retrieved + \return Number of material pointers written to the buffer. + + \see PxDeformableVolumeMaterial getNbMaterials() PxMaterial::release() + */ + virtual PxU32 getDeformableVolumeMaterials(PxDeformableVolumeMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Deprecated + \see getDeformableVolumeMaterials + */ + PX_DEPRECATED PX_FORCE_INLINE PxU32 getSoftBodyMaterials(PxDeformableVolumeMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const + { + return getDeformableVolumeMaterials(userBuffer, bufferSize, startIndex); + } + + /** + \brief Retrieve material from given triangle index. + + The input index is the internal triangle index as used inside the SDK. This is the index + returned to users by various SDK functions such as raycasts. + + This function is only useful for triangle meshes or heightfields, which have per-triangle + materials. For other shapes or SDF triangle meshes, the function returns the single material + associated with the shape, regardless of the index. + + \param[in] faceIndex The internal triangle index whose material you want to retrieve. + \return Material from input triangle + + \note If faceIndex value of 0xFFFFffff is passed as an input for mesh and heightfield shapes, this function will issue a warning and return NULL. + \note Scene queries set the value of PxQueryHit::faceIndex to 0xFFFFffff whenever it is undefined or does not apply. + + \see PxMaterial getNbMaterials() PxMaterial::release() + */ + virtual PxBaseMaterial* getMaterialFromInternalFaceIndex(PxU32 faceIndex) const = 0; + + /** + \brief Sets the contact offset. + + Shapes whose distance is less than the sum of their contactOffset values will generate contacts. The contact offset must be positive and + greater than the rest offset. Having a contactOffset greater than than the restOffset allows the collision detection system to + predictively enforce the contact constraint even when the objects are slightly separated. This prevents jitter that would occur + if the constraint were enforced only when shapes were within the rest distance. + + Default: 0.02f * PxTolerancesScale::length + + Sleeping: Does NOT wake the associated actor up automatically. + + \param[in] contactOffset Range: [maximum(0,restOffset), PX_MAX_F32) + + \see getContactOffset PxTolerancesScale setRestOffset + */ + virtual void setContactOffset(PxReal contactOffset) = 0; + + /** + \brief Retrieves the contact offset. + + \return The contact offset of the shape. + + \see setContactOffset() + */ + virtual PxReal getContactOffset() const = 0; + + /** + \brief Sets the rest offset. + + Two shapes will come to rest at a distance equal to the sum of their restOffset values. If the restOffset is 0, they should converge to touching + exactly. Having a restOffset greater than zero is useful to have objects slide smoothly, so that they do not get hung up on irregularities of + each others' surfaces. + + Default: 0.0f + + Sleeping: Does NOT wake the associated actor up automatically. + + \param[in] restOffset Range: (-PX_MAX_F32, contactOffset) + + \see getRestOffset setContactOffset + */ + virtual void setRestOffset(PxReal restOffset) = 0; + + /** + \brief Retrieves the rest offset. + + \return The rest offset of the shape. + + \see setRestOffset() + */ + virtual PxReal getRestOffset() const = 0; + + /** + \brief Sets the density used to interact with fluids. + + To be physically accurate, the density of a rigid body should be computed as its mass divided by its volume. To + simplify tuning the interaction of fluid and rigid bodies, the density for fluid can differ from the real density. This + allows to create floating bodies, even if they are supposed to sink with their mass and volume. + + Default: 800.0f + + \param[in] densityForFluid Range: (0, PX_MAX_F32) + + \see getDensityForFluid + */ + virtual void setDensityForFluid(PxReal densityForFluid) = 0; + + /** + \brief Retrieves the density used to interact with fluids. + + \return The density of the body when interacting with fluid. + + \see setDensityForFluid() + */ + virtual PxReal getDensityForFluid() const = 0; + + /** + \brief Sets torsional patch radius. + + This defines the radius of the contact patch used to apply torsional friction. If the radius is 0 (and minTorsionalPatchRadius + is 0 too, see #setMinTorsionalPatchRadius), no torsional friction will be applied. If the radius is > 0, some torsional friction + will be applied. This is proportional to the penetration depth so, if the shapes are separated or penetration is zero, no + torsional friction will be applied. It is used to approximate rotational friction introduced by the compression of contacting surfaces. + + \note Will only be active, if the friction patch has a single anchor point only. This is for example the case, if a contact patch + has a single contact point. + + \note Only supported in combination with solver type PxSolverType::eTGS. + + Default: 0.0 + + \param[in] radius Range: [0, PX_MAX_F32) + */ + virtual void setTorsionalPatchRadius(PxReal radius) = 0; + + /** + \brief Gets torsional patch radius. + + See #setTorsionalPatchRadius for more info. + + \return The torsional patch radius of the shape. + */ + virtual PxReal getTorsionalPatchRadius() const = 0; + + /** + \brief Sets minimum torsional patch radius. + + This defines the minimum radius of the contact patch used to apply torsional friction. If the radius is 0, the amount of torsional friction + that will be applied will be entirely dependent on the value of torsionalPatchRadius. + + If the radius is > 0, some torsional friction will be applied regardless of the value of torsionalPatchRadius or the amount of penetration. + + \note Will only be active in certain cases, see #setTorsionalPatchRadius for details. + + Default: 0.0 + + \param[in] radius Range: [0, PX_MAX_F32) + */ + virtual void setMinTorsionalPatchRadius(PxReal radius) = 0; + + /** + \brief Gets minimum torsional patch radius. + + See #setMinTorsionalPatchRadius for more info. + + \return The minimum torsional patch radius of the shape. + */ + virtual PxReal getMinTorsionalPatchRadius() const = 0; + + /** + \brief Returns the GPU shape index. + + \note This function only returns valid results if GPU dynamics is enabled. + + \return The GPU index, or 0xFFFFFFFF if the shape is not attached to a PxActor that is inserted into a PxScene. + + \see PxDirectGPUAPI::evaluateSDFDistances(). + */ + virtual PxShapeGPUIndex getGPUIndex() const = 0; + +/************************************************************************************************/ + + /** + \brief Sets shape flags + + Sleeping: Does NOT wake the associated actor up automatically. + + \param[in] flag The shape flag to enable/disable. See #PxShapeFlag. + \param[in] value True to set the flag. False to clear the flag specified in flag. + + Default: PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSIMULATION_SHAPE | PxShapeFlag::eSCENE_QUERY_SHAPE + + \see PxShapeFlag getFlags() + */ + virtual void setFlag(PxShapeFlag::Enum flag, bool value) = 0; + + /** + \brief Sets shape flags + + \see PxShapeFlag getFlags() + */ + virtual void setFlags(PxShapeFlags inFlags) = 0; + + /** + \brief Retrieves shape flags. + + \return The values of the shape flags. + + \see PxShapeFlag setFlag() + */ + virtual PxShapeFlags getFlags() const = 0; + + /** + \brief Returns true if the shape is exclusive to an actor. + + \see PxPhysics::createShape() + */ + virtual bool isExclusive() const = 0; + + /** + \brief Sets a name string for the object that can be retrieved with #getName(). + + This is for debugging and is not used by the SDK. + The string is not copied by the SDK, only the pointer is stored. + + Default: NULL + + \param[in] name The name string to set the objects name to. + + \see getName() + */ + virtual void setName(const char* name) = 0; + + /** + \brief retrieves the name string set with setName(). + \return The name associated with the shape. + + \see setName() + */ + virtual const char* getName() const = 0; + + + virtual const char* getConcreteTypeName() const PX_OVERRIDE PX_FINAL { return "PxShape"; } + +/************************************************************************************************/ + + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + +protected: + PX_INLINE PxShape(PxBaseFlags baseFlags) : PxRefCounted(baseFlags) {} + PX_INLINE PxShape(PxType concreteType, PxBaseFlags baseFlags) : PxRefCounted(concreteType, baseFlags), userData(NULL) {} + virtual ~PxShape() {} + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxShape", PxRefCounted); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxSimulationEventCallback.h b/engine/third_party/physx/include/PxSimulationEventCallback.h new file mode 100644 index 00000000..54f91e5f --- /dev/null +++ b/engine/third_party/physx/include/PxSimulationEventCallback.h @@ -0,0 +1,963 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SIMULATION_EVENT_CALLBACK_H +#define PX_SIMULATION_EVENT_CALLBACK_H + +#include "foundation/PxVec3.h" +#include "foundation/PxTransform.h" +#include "foundation/PxMemory.h" +#include "PxPhysXConfig.h" +#include "PxFiltering.h" +#include "PxContact.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxShape; +class PxActor; +class PxRigidActor; +class PxRigidBody; +class PxConstraint; + + +/** +\brief Extra data item types for contact pairs. + +\see PxContactPairExtraDataItem.type +*/ +struct PxContactPairExtraDataType +{ + enum Enum + { + ePRE_SOLVER_VELOCITY, //!< see #PxContactPairVelocity + ePOST_SOLVER_VELOCITY, //!< see #PxContactPairVelocity + eCONTACT_EVENT_POSE, //!< see #PxContactPairPose + eCONTACT_PAIR_INDEX //!< see #PxContactPairIndex + }; +}; + + +/** +\brief Base class for items in the extra data stream of contact pairs + +\see PxContactPairHeader.extraDataStream +*/ +struct PxContactPairExtraDataItem +{ +public: + PX_FORCE_INLINE PxContactPairExtraDataItem() {} + + /** + \brief The type of the extra data stream item + */ + PxU8 type; +}; + + +/** +\brief Velocities of the contact pair rigid bodies + +This struct is shared by multiple types of extra data items. The #type field allows to distinguish between them: +\li PxContactPairExtraDataType::ePRE_SOLVER_VELOCITY: see #PxPairFlag::ePRE_SOLVER_VELOCITY +\li PxContactPairExtraDataType::ePOST_SOLVER_VELOCITY: see #PxPairFlag::ePOST_SOLVER_VELOCITY + +\note For static rigid bodies, the velocities will be set to zero. + +\see PxContactPairHeader.extraDataStream +*/ +struct PxContactPairVelocity : public PxContactPairExtraDataItem +{ +public: + PX_FORCE_INLINE PxContactPairVelocity() {} + + /** + \brief The linear velocity of the rigid bodies + */ + PxVec3 linearVelocity[2]; + + /** + \brief The angular velocity of the rigid bodies + */ + PxVec3 angularVelocity[2]; +}; + + +/** +\brief World space actor poses of the contact pair rigid bodies + +\see PxContactPairHeader.extraDataStream PxPairFlag::eCONTACT_EVENT_POSE +*/ +struct PxContactPairPose : public PxContactPairExtraDataItem +{ +public: + PX_FORCE_INLINE PxContactPairPose() {} + + /** + \brief The world space pose of the rigid bodies + */ + PxTransform globalPose[2]; +}; + + +/** +\brief Marker for the beginning of a new item set in the extra data stream. + +If CCD with multiple passes is enabled, then a fast moving object might bounce on and off the same +object multiple times. Also, different shapes of the same actor might gain and lose contact with an other +object over multiple passes. This marker allows to separate the extra data items for each collision case, as well as +distinguish the shape pair reports of different CCD passes. + +Example: +Let us assume that an actor a0 with shapes s0_0 and s0_1 hits another actor a1 with shape s1. +First s0_0 will hit s1, then a0 will slightly rotate and s0_1 will hit s1 while s0_0 will lose contact with s1. +Furthermore, let us say that contact event pose information is requested as extra data. +The extra data stream will look like this: + +PxContactPairIndexA | PxContactPairPoseA | PxContactPairIndexB | PxContactPairPoseB + +The corresponding array of PxContactPair events (see #PxSimulationEventCallback.onContact()) will look like this: + +PxContactPair(touch_found: s0_0, s1) | PxContactPair(touch_lost: s0_0, s1) | PxContactPair(touch_found: s0_1, s1) + +The #index of PxContactPairIndexA will point to the first entry in the PxContactPair array, for PxContactPairIndexB, +#index will point to the third entry. + +\see PxContactPairHeader.extraDataStream +*/ +struct PxContactPairIndex : public PxContactPairExtraDataItem +{ +public: + PX_FORCE_INLINE PxContactPairIndex() {} + + /** + \brief The next item set in the extra data stream refers to the contact pairs starting at #index in the reported PxContactPair array. + */ + PxU16 index; +}; + + +/** +\brief A class to iterate over a contact pair extra data stream. + +\see PxContactPairHeader.extraDataStream +*/ +struct PxContactPairExtraDataIterator +{ + /** + \brief Constructor + \param[in] stream Pointer to the start of the stream. + \param[in] size Size of the stream in bytes. + */ + PX_FORCE_INLINE PxContactPairExtraDataIterator(const PxU8* stream, PxU32 size) + : currPtr(stream), endPtr(stream + size), contactPairIndex(0) + { + clearDataPtrs(); + } + + /** + \brief Advances the iterator to next set of extra data items. + + The contact pair extra data stream contains sets of items as requested by the corresponding #PxPairFlag flags + #PxPairFlag::ePRE_SOLVER_VELOCITY, #PxPairFlag::ePOST_SOLVER_VELOCITY, #PxPairFlag::eCONTACT_EVENT_POSE. A set can contain one + item of each plus the PxContactPairIndex item. This method parses the stream and points the iterator + member variables to the corresponding items of the current set, if they are available. If CCD is not enabled, + you should only get one set of items. If CCD with multiple passes is enabled, you might get more than one item + set. + + \note Even though contact pair extra data is requested per shape pair, you will not get an item set per shape pair + but one per actor pair. If, for example, an actor has two shapes and both collide with another actor, then + there will only be one item set (since it applies to both shape pairs). + + \return True if there was another set of extra data items in the stream, else false. + + \see PxContactPairVelocity PxContactPairPose PxContactPairIndex + */ + PX_INLINE bool nextItemSet() + { + clearDataPtrs(); + + bool foundEntry = false; + bool endOfItemSet = false; + while ((currPtr < endPtr) && (!endOfItemSet)) + { + const PxContactPairExtraDataItem* edItem = reinterpret_cast(currPtr); + PxU8 type = edItem->type; + + switch(type) + { + case PxContactPairExtraDataType::ePRE_SOLVER_VELOCITY: + { + PX_ASSERT(!preSolverVelocity); + preSolverVelocity = static_cast(edItem); + currPtr += sizeof(PxContactPairVelocity); + foundEntry = true; + } + break; + + case PxContactPairExtraDataType::ePOST_SOLVER_VELOCITY: + { + postSolverVelocity = static_cast(edItem); + currPtr += sizeof(PxContactPairVelocity); + foundEntry = true; + } + break; + + case PxContactPairExtraDataType::eCONTACT_EVENT_POSE: + { + eventPose = static_cast(edItem); + currPtr += sizeof(PxContactPairPose); + foundEntry = true; + } + break; + + case PxContactPairExtraDataType::eCONTACT_PAIR_INDEX: + { + if (!foundEntry) + { + contactPairIndex = static_cast(edItem)->index; + currPtr += sizeof(PxContactPairIndex); + foundEntry = true; + } + else + endOfItemSet = true; + } + break; + + default: + return foundEntry; + } + } + + return foundEntry; + } + +private: + /** + \brief Internal helper + */ + PX_FORCE_INLINE void clearDataPtrs() + { + preSolverVelocity = NULL; + postSolverVelocity = NULL; + eventPose = NULL; + } + +public: + /** + \brief Current pointer in the stream. + */ + const PxU8* currPtr; + + /** + \brief Pointer to the end of the stream. + */ + const PxU8* endPtr; + + /** + \brief Pointer to the current pre solver velocity item in the stream. NULL if there is none. + + \see PxContactPairVelocity + */ + const PxContactPairVelocity* preSolverVelocity; + + /** + \brief Pointer to the current post solver velocity item in the stream. NULL if there is none. + + \see PxContactPairVelocity + */ + const PxContactPairVelocity* postSolverVelocity; + + /** + \brief Pointer to the current contact event pose item in the stream. NULL if there is none. + + \see PxContactPairPose + */ + const PxContactPairPose* eventPose; + + /** + \brief The contact pair index of the current item set in the stream. + + \see PxContactPairIndex + */ + PxU32 contactPairIndex; +}; + + +/** +\brief Collection of flags providing information on contact report pairs. + +\see PxContactPairHeader +*/ +struct PxContactPairHeaderFlag +{ + enum Enum + { + eREMOVED_ACTOR_0 = (1<<0), //!< The actor with index 0 has been removed from the scene. + eREMOVED_ACTOR_1 = (1<<1) //!< The actor with index 1 has been removed from the scene. + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxContactPairHeaderFlag. + +\see PxContactPairHeaderFlag +*/ +typedef PxFlags PxContactPairHeaderFlags; +PX_FLAGS_OPERATORS(PxContactPairHeaderFlag::Enum, PxU16) + + +/** +\brief An Instance of this class is passed to PxSimulationEventCallback.onContact(). + +\see PxSimulationEventCallback.onContact() +*/ +struct PxContactPairHeader +{ + public: + PX_INLINE PxContactPairHeader() {} + + /** + \brief The two actors of the notification shape pairs. + + \note The actor pointers might reference deleted actors. This will be the case if PxPairFlag::eNOTIFY_TOUCH_LOST + or PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST events were requested for the pair and one of the involved actors + gets deleted or removed from the scene. Check the #flags member to see whether that is the case. + Do not dereference a pointer to a deleted actor. The pointer to a deleted actor is only provided + such that user data structures which might depend on the pointer value can be updated. + + \see PxActor + */ + PxActor* actors[2]; + + /** + \brief Stream containing extra data as requested in the PxPairFlag flags of the simulation filter. + + This pointer is only valid if any kind of extra data information has been requested for the contact report pair (see #PxPairFlag::ePOST_SOLVER_VELOCITY etc.), + else it will be NULL. + + \see PxPairFlag + */ + const PxU8* extraDataStream; + + /** + \brief Size of the extra data stream [bytes] + */ + PxU16 extraDataStreamSize; + + /** + \brief Additional information on the contact report pair. + + \see PxContactPairHeaderFlag + */ + PxContactPairHeaderFlags flags; + + /** + \brief pointer to the contact pairs + */ + const struct PxContactPair* pairs; + + /** + \brief number of contact pairs + */ + PxU32 nbPairs; +}; + + +/** +\brief Collection of flags providing information on contact report pairs. + +\see PxContactPair +*/ +struct PxContactPairFlag +{ + enum Enum + { + /** + \brief The shape with index 0 has been removed from the actor/scene. + */ + eREMOVED_SHAPE_0 = (1<<0), + + /** + \brief The shape with index 1 has been removed from the actor/scene. + */ + eREMOVED_SHAPE_1 = (1<<1), + + /** + \brief First actor pair contact. + + The provided shape pair marks the first contact between the two actors, no other shape pair has been touching prior to the current simulation frame. + + \note: This info is only available if #PxPairFlag::eNOTIFY_TOUCH_FOUND has been declared for the pair. + */ + eACTOR_PAIR_HAS_FIRST_TOUCH = (1<<2), + + /** + \brief All contact between the actor pair was lost. + + All contact between the two actors has been lost, no shape pairs remain touching after the current simulation frame. + */ + eACTOR_PAIR_LOST_TOUCH = (1<<3), + + /** + \brief Internal flag, used by #PxContactPair.extractContacts() + + The applied contact impulses are provided for every contact point. + This is the case if #PxPairFlag::eSOLVE_CONTACT has been set for the pair. + */ + eINTERNAL_HAS_IMPULSES = (1<<4), + + /** + \brief Internal flag, used by #PxContactPair.extractContacts() + + The provided contact point information is flipped with regards to the shapes of the contact pair. This mainly concerns the order of the internal triangle indices. + */ + eINTERNAL_CONTACTS_ARE_FLIPPED = (1<<5) + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxContactPairFlag. + +\see PxContactPairFlag +*/ +typedef PxFlags PxContactPairFlags; +PX_FLAGS_OPERATORS(PxContactPairFlag::Enum, PxU16) + + +/** +\brief A contact point as used by contact notification +*/ +struct PxContactPairPoint +{ + /** + \brief The position of the contact point between the shapes, in world space. + */ + PxVec3 position; + + /** + \brief The separation of the shapes at the contact point. A negative separation denotes a penetration. + */ + PxReal separation; + + /** + \brief The normal of the contacting surfaces at the contact point. The normal direction points from the second shape to the first shape. + */ + PxVec3 normal; + + /** + \brief The surface index of shape 0 at the contact point. This is used to identify the surface material. + */ + PxU32 internalFaceIndex0; + + /** + \brief The impulse applied at the contact point, in world space. Divide by the simulation time step to get a force value. + */ + PxVec3 impulse; + + /** + \brief The surface index of shape 1 at the contact point. This is used to identify the surface material. + */ + PxU32 internalFaceIndex1; +}; + +/** +\brief A friction anchor as used by contact notification +*/ +struct PxContactPairFrictionAnchor +{ + /** + \brief The position of the friction anchor in world space. + */ + PxVec3 position; + + /** + \brief The impulse applied at the friction anchor, in world space. Divide by the simulation time step to get a force value. + */ + PxVec3 impulse; +}; + +/** +\brief Contact report pair information. + +Instances of this class are passed to PxSimulationEventCallback.onContact(). If contact reports have been requested for a pair of shapes (see #PxPairFlag), +then the corresponding contact information will be provided through this structure. + +\see PxSimulationEventCallback.onContact() +*/ +struct PxContactPair +{ + public: + PX_INLINE PxContactPair() {} + + /** + \brief The two shapes that make up the pair. + + \note The shape pointers might reference deleted shapes. This will be the case if #PxPairFlag::eNOTIFY_TOUCH_LOST + or #PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST events were requested for the pair and one of the involved shapes + gets deleted. Check the #flags member to see whether that is the case. Do not dereference a pointer to a + deleted shape. The pointer to a deleted shape is only provided such that user data structures which might + depend on the pointer value can be updated. + + \see PxShape + */ + PxShape* shapes[2]; + + /** + \brief Pointer to first patch header in contact stream containing contact patch data + + This pointer is only valid if contact point information has been requested for the contact report pair (see #PxPairFlag::eNOTIFY_CONTACT_POINTS). + Use #extractContacts() as a reference for the data layout of the stream. + */ + const PxU8* contactPatches; + + /** + \brief Pointer to first contact point in contact stream containing contact data + + This pointer is only valid if contact point information has been requested for the contact report pair (see #PxPairFlag::eNOTIFY_CONTACT_POINTS). + Use #extractContacts() as a reference for the data layout of the stream. + */ + const PxU8* contactPoints; + + /** + \brief Buffer containing applied impulse data. + + This pointer is only valid if contact point information has been requested for the contact report pair (see #PxPairFlag::eNOTIFY_CONTACT_POINTS). + Use #extractContacts() as a reference for the data layout of the stream. + */ + const PxReal* contactImpulses; + + /** + \brief Buffer containing contact patches friction information. + */ + const PxU8* frictionPatches; + + /** + \brief Size of the contact stream [bytes] including force buffer + */ + PxU32 requiredBufferSize; + + /** + \brief Number of contact points stored in the contact stream + */ + PxU8 contactCount; + + /** + \brief Number of contact patches stored in the contact stream + */ + PxU8 patchCount; + + /** + \brief Size of the contact stream [bytes] not including force buffer + */ + PxU16 contactStreamSize; + + /** + \brief Additional information on the contact report pair. + + \see PxContactPairFlag + */ + PxContactPairFlags flags; + + /** + \brief Flags raised due to the contact. + + The events field is a combination of: + +
    +
  • PxPairFlag::eNOTIFY_TOUCH_FOUND,
  • +
  • PxPairFlag::eNOTIFY_TOUCH_PERSISTS,
  • +
  • PxPairFlag::eNOTIFY_TOUCH_LOST,
  • +
  • PxPairFlag::eNOTIFY_TOUCH_CCD,
  • +
  • PxPairFlag::eNOTIFY_THRESHOLD_FORCE_FOUND,
  • +
  • PxPairFlag::eNOTIFY_THRESHOLD_FORCE_PERSISTS,
  • +
  • PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST
  • +
+ + See the documentation of #PxPairFlag for an explanation of each. + + \note eNOTIFY_TOUCH_CCD can get raised even if the pair did not request this event. However, in such a case it will only get + raised in combination with one of the other flags to point out that the other event occured during a CCD pass. + + \see PxPairFlag + */ + PxPairFlags events; + + PxU32 internalData[2]; // For internal use only + + /** + \brief Extracts the contact points from the stream and stores them in a convenient format. + + \param[out] userBuffer Array of PxContactPairPoint structures to extract the contact points to. The number of contacts for a pair is defined by #contactCount + \param[in] bufferSize Number of PxContactPairPoint structures the provided buffer can store. + \return Number of contact points written to the buffer. + + \see PxContactPairPoint + */ + PX_INLINE PxU32 extractContacts(PxContactPairPoint* userBuffer, PxU32 bufferSize) const; + + /** + \brief Extracts the friction anchors from the stream and stores them in a convenient format. + + \param[out] userBuffer Array of PxContactPairFrictionAnchor structures to extract the friction anchors to. + \param[in] bufferSize Number of PxContactPairFrictionAnchor structures the provided buffer can store. + \return Number of friction anchors written to the buffer. + + \see PxContactPairFrictionAnchor + */ + PX_INLINE PxU32 extractFrictionAnchors(PxContactPairFrictionAnchor* userBuffer, PxU32 bufferSize) const; + + /** + \brief Helper method to clone the contact pair and copy the contact data stream into a user buffer. + + The contact data stream is only accessible during the contact report callback. This helper function provides copy functionality + to buffer the contact stream information such that it can get accessed at a later stage. + + \param[out] newPair The contact pair info will get copied to this instance. The contact data stream pointer of the copy will be redirected to the provided user buffer. Use NULL to skip the contact pair copy operation. + \param[out] bufferMemory Memory block to store the contact data stream to. At most #requiredBufferSize bytes will get written to the buffer. + */ + PX_INLINE void bufferContacts(PxContactPair* newPair, PxU8* bufferMemory) const; + + PX_INLINE const PxU32* getInternalFaceIndices() const; +}; + + +PX_INLINE PxU32 PxContactPair::extractContacts(PxContactPairPoint* userBuffer, PxU32 bufferSize) const +{ + PxU32 nbContacts = 0; + + if(contactCount && bufferSize) + { + PxContactStreamIterator iter(contactPatches, contactPoints, getInternalFaceIndices(), patchCount, contactCount); + + const PxReal* impulses = contactImpulses; + + const PxU32 flippedContacts = (flags & PxContactPairFlag::eINTERNAL_CONTACTS_ARE_FLIPPED); + const PxU32 hasImpulses = (flags & PxContactPairFlag::eINTERNAL_HAS_IMPULSES); + + while(iter.hasNextPatch()) + { + iter.nextPatch(); + while(iter.hasNextContact()) + { + iter.nextContact(); + PxContactPairPoint& dst = userBuffer[nbContacts]; + dst.position = iter.getContactPoint(); + dst.separation = iter.getSeparation(); + dst.normal = iter.getContactNormal(); + if(!flippedContacts) + { + dst.internalFaceIndex0 = iter.getFaceIndex0(); + dst.internalFaceIndex1 = iter.getFaceIndex1(); + } + else + { + dst.internalFaceIndex0 = iter.getFaceIndex1(); + dst.internalFaceIndex1 = iter.getFaceIndex0(); + } + + if(hasImpulses) + { + const PxReal impulse = impulses[nbContacts]; + dst.impulse = dst.normal * impulse; + } + else + dst.impulse = PxVec3(0.0f); + ++nbContacts; + if(nbContacts == bufferSize) + return nbContacts; + } + } + } + + return nbContacts; +} + +PX_INLINE PxU32 PxContactPair::extractFrictionAnchors(PxContactPairFrictionAnchor* userBuffer, PxU32 bufferSize) const +{ + PxU32 nbAnchors = 0; + + if(bufferSize) + { + PxFrictionAnchorStreamIterator iter(contactPatches, frictionPatches, patchCount); + + while(iter.hasNextPatch()) + { + iter.nextPatch(); + while(iter.hasNextFrictionAnchor()) + { + iter.nextFrictionAnchor(); + PxContactPairFrictionAnchor& dst = userBuffer[nbAnchors]; + + dst.position = iter.getPosition(); + dst.impulse = iter.getImpulse(); + + ++nbAnchors; + if(nbAnchors == bufferSize) + return nbAnchors; + } + } + } + + return nbAnchors; +} + + +PX_INLINE void PxContactPair::bufferContacts(PxContactPair* newPair, PxU8* bufferMemory) const +{ + PxU8* patches = bufferMemory; + PxU8* contacts = NULL; + if(patches) + { + contacts = bufferMemory + patchCount * sizeof(PxContactPatch); + PxMemCopy(patches, contactPatches, sizeof(PxContactPatch)*patchCount); + PxMemCopy(contacts, contactPoints, contactStreamSize - (sizeof(PxContactPatch)*patchCount)); + } + + if(contactImpulses) + { + PxMemCopy(bufferMemory + ((contactStreamSize + 15) & (~15)), contactImpulses, sizeof(PxReal) * contactCount); + } + + if (newPair) + { + *newPair = *this; + newPair->contactPatches = patches; + newPair->contactPoints = contacts; + } +} + + +PX_INLINE const PxU32* PxContactPair::getInternalFaceIndices() const +{ + return reinterpret_cast(contactImpulses + contactCount); +} + +/** +\brief Collection of flags providing information on trigger report pairs. + +\see PxTriggerPair +*/ +struct PxTriggerPairFlag +{ + enum Enum + { + eREMOVED_SHAPE_TRIGGER = (1<<0), //!< The trigger shape has been removed from the actor/scene. + eREMOVED_SHAPE_OTHER = (1<<1), //!< The shape causing the trigger event has been removed from the actor/scene. + eNEXT_FREE = (1<<2) //!< For internal use only. + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxTriggerPairFlag. + +\see PxTriggerPairFlag +*/ +typedef PxFlags PxTriggerPairFlags; +PX_FLAGS_OPERATORS(PxTriggerPairFlag::Enum, PxU8) + + +/** +\brief Descriptor for a trigger pair. + +An array of these structs gets passed to the PxSimulationEventCallback::onTrigger() report. + +\note The shape pointers might reference deleted shapes. This will be the case if #PxPairFlag::eNOTIFY_TOUCH_LOST + events were requested for the pair and one of the involved shapes gets deleted. Check the #flags member to see + whether that is the case. Do not dereference a pointer to a deleted shape. The pointer to a deleted shape is + only provided such that user data structures which might depend on the pointer value can be updated. + +\see PxSimulationEventCallback.onTrigger() +*/ +struct PxTriggerPair +{ + PX_INLINE PxTriggerPair() {} + + PxShape* triggerShape; //!< The shape that has been marked as a trigger. + PxActor* triggerActor; //!< The actor to which triggerShape is attached + PxShape* otherShape; //!< The shape causing the trigger event. \deprecated (see #PxSimulationEventCallback::onTrigger()) If collision between trigger shapes is enabled, then this member might point to a trigger shape as well. + PxActor* otherActor; //!< The actor to which otherShape is attached + PxPairFlag::Enum status; //!< Type of trigger event (eNOTIFY_TOUCH_FOUND or eNOTIFY_TOUCH_LOST). eNOTIFY_TOUCH_PERSISTS events are not supported. + PxTriggerPairFlags flags; //!< Additional information on the pair (see #PxTriggerPairFlag) +}; + + +/** +\brief Descriptor for a broken constraint. + +An array of these structs gets passed to the PxSimulationEventCallback::onConstraintBreak() report. + +\see PxConstraint PxSimulationEventCallback.onConstraintBreak() +*/ +struct PxConstraintInfo +{ + PX_INLINE PxConstraintInfo() {} + PX_INLINE PxConstraintInfo(PxConstraint* c, void* extRef, PxU32 t) : constraint(c), externalReference(extRef), type(t) {} + + PxConstraint* constraint; //!< The broken constraint. + void* externalReference; //!< The external object which owns the constraint (see #PxConstraintConnector::getExternalReference()) + PxU32 type; //!< Unique type ID of the external object. Allows to cast the provided external reference to the appropriate type +}; + + +/** +\brief An interface class that the user can implement in order to receive simulation events. + +With the exception of onAdvance(), the events get sent during the call to either #PxScene::fetchResults() or +#PxScene::flushSimulation() with sendPendingReports=true. onAdvance() gets called while the simulation +is running (that is between PxScene::simulate() or PxScene::advance() and PxScene::fetchResults()). + +\note SDK state should not be modified from within the callbacks. In particular objects should not +be created or destroyed. If state modification is needed then the changes should be stored to a buffer +and performed after the simulation step. + +Threading: With the exception of onAdvance(), it is not necessary to make these callbacks thread safe as +they will only be called in the context of the user thread. + +\see PxScene.setSimulationEventCallback() PxScene.getSimulationEventCallback() +*/ +class PxSimulationEventCallback + { + public: + /** + \brief This is called when a breakable constraint breaks. + + \note The user should not release the constraint shader inside this call! + + \note No event will get reported if the constraint breaks but gets deleted while the time step is still being simulated. + + \param[in] constraints - The constraints which have been broken. + \param[in] count - The number of constraints + + \see PxConstraint PxConstraintDesc.linearBreakForce PxConstraintDesc.angularBreakForce + */ + virtual void onConstraintBreak(PxConstraintInfo* constraints, PxU32 count) = 0; + + /** + \brief This is called with the actors which have just been woken up. + + \note Only supported by rigid bodies yet. + \note Only called on actors for which the PxActorFlag eSEND_SLEEP_NOTIFIES has been set. + \note Only the latest sleep state transition happening between fetchResults() of the previous frame and fetchResults() of the current frame + will get reported. For example, let us assume actor A is awake, then A->putToSleep() gets called, then later A->wakeUp() gets called. + At the next simulate/fetchResults() step only an onWake() event will get triggered because that was the last transition. + \note If an actor gets newly added to a scene with properties such that it is awake and the sleep state does not get changed by + the user or simulation, then an onWake() event will get sent at the next simulate/fetchResults() step. + + \param[in] actors - The actors which just woke up. + \param[in] count - The number of actors + + \see PxScene.setSimulationEventCallback() PxSceneDesc.simulationEventCallback PxActorFlag PxActor.setActorFlag() + */ + virtual void onWake(PxActor** actors, PxU32 count) = 0; + + /** + \brief This is called with the actors which have just been put to sleep. + + \note Only supported by rigid bodies yet. + \note Only called on actors for which the PxActorFlag eSEND_SLEEP_NOTIFIES has been set. + \note Only the latest sleep state transition happening between fetchResults() of the previous frame and fetchResults() of the current frame + will get reported. For example, let us assume actor A is asleep, then A->wakeUp() gets called, then later A->putToSleep() gets called. + At the next simulate/fetchResults() step only an onSleep() event will get triggered because that was the last transition (assuming the simulation + does not wake the actor up). + \note If an actor gets newly added to a scene with properties such that it is asleep and the sleep state does not get changed by + the user or simulation, then an onSleep() event will get sent at the next simulate/fetchResults() step. + + \param[in] actors - The actors which have just been put to sleep. + \param[in] count - The number of actors + + \see PxScene.setSimulationEventCallback() PxSceneDesc.simulationEventCallback PxActorFlag PxActor.setActorFlag() + */ + virtual void onSleep(PxActor** actors, PxU32 count) = 0; + + /** + \brief This is called when certain contact events occur. + + The method will be called for a pair of actors if one of the colliding shape pairs requested contact notification. + You request which events are reported using the filter shader/callback mechanism (see #PxSimulationFilterShader, + #PxSimulationFilterCallback, #PxPairFlag). + + Do not keep references to the passed objects, as they will be + invalid after this function returns. + + \param[in] pairHeader Information on the two actors whose shapes triggered a contact report. + \param[in] pairs The contact pairs of two actors for which contact reports have been requested. See #PxContactPair. + \param[in] nbPairs The number of provided contact pairs. + + \see PxScene.setSimulationEventCallback() PxSceneDesc.simulationEventCallback PxContactPair PxPairFlag PxSimulationFilterShader PxSimulationFilterCallback + */ + virtual void onContact(const PxContactPairHeader& pairHeader, const PxContactPair* pairs, PxU32 nbPairs) = 0; + + /** + \brief This is called with the current trigger pair events. + + Shapes which have been marked as triggers using PxShapeFlag::eTRIGGER_SHAPE will send events + according to the pair flag specification in the filter shader (see #PxPairFlag, #PxSimulationFilterShader). + + \note Trigger shapes will no longer send notification events for interactions with other trigger shapes. + + \param[in] pairs - The trigger pair events. + \param[in] count - The number of trigger pair events. + + \see PxScene.setSimulationEventCallback() PxSceneDesc.simulationEventCallback PxPairFlag PxSimulationFilterShader PxShapeFlag PxShape.setFlag() + */ + virtual void onTrigger(PxTriggerPair* pairs, PxU32 count) = 0; + + /** + \brief Provides early access to the new pose of moving rigid bodies. + + When this call occurs, rigid bodies having the #PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW + flag set, were moved by the simulation and their new poses can be accessed through the provided buffers. + + \note The provided buffers are valid and can be read until the next call to #PxScene::simulate() or #PxScene::collide(). + + \note This callback gets triggered while the simulation is running. If the provided rigid body references are used to + read properties of the object, then the callback has to guarantee no other thread is writing to the same body at the same + time. + + \note The code in this callback should be lightweight as it can block the simulation, that is, the + #PxScene::fetchResults() call. + + \param[in] bodyBuffer The rigid bodies that moved and requested early pose reporting. + \param[in] poseBuffer The integrated rigid body poses of the bodies listed in bodyBuffer. + \param[in] count The number of entries in the provided buffers. + + \see PxScene.setSimulationEventCallback() PxSceneDesc.simulationEventCallback PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW + */ + virtual void onAdvance(const PxRigidBody*const* bodyBuffer, const PxTransform* poseBuffer, const PxU32 count) = 0; + + virtual ~PxSimulationEventCallback() {} + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxSimulationStatistics.h b/engine/third_party/physx/include/PxSimulationStatistics.h new file mode 100644 index 00000000..6f39ca2a --- /dev/null +++ b/engine/third_party/physx/include/PxSimulationStatistics.h @@ -0,0 +1,499 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_SIMULATION_STATISTICS_H +#define PX_SIMULATION_STATISTICS_H + +#include "foundation/PxAssert.h" +#include "PxPhysXConfig.h" +#include "foundation/PxSimpleTypes.h" +#include "geometry/PxGeometry.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Structure used to retrieve actual sizes/counts for the configuration parameters provided in PxGpuDynamicsMemoryConfig. + +\note All the values in this structure are reported as the maximum over the lifetime of a PxScene. + +\see PxScene::getSimulationStatistics(), PxSimulationStatistics, PxSceneDesc::PxGpuDynamicsMemoryConfig +*/ +struct PxGpuDynamicsMemoryConfigStatistics +{ + PxU64 tempBufferCapacity; //!< actual size needed (bytes) for PxGpuDynamicsMemoryConfig::tempBufferCapacity. + PxU32 rigidContactCount; //!< actual number of rigid contacts needed - see PxGpuDynamicsMemoryConfig::maxRigidContactCount. + PxU32 rigidPatchCount; //!< actual number of rigid contact patches needed - see PxGpuDynamicsMemoryConfig::maxRigidPatchCount. + PxU32 foundLostPairs; //!< actual number of lost/found pairs needed - see PxGpuDynamicsMemoryConfig::foundLostPairsCapacity. + PxU32 foundLostAggregatePairs; //!< actual number of lost/found aggregate pairs needed - see PxGpuDynamicsMemoryConfig::foundLostAggregatePairsCapacity. + PxU32 totalAggregatePairs; //!< actual number of aggregate pairs needed - see PxGpuDynamicsMemoryConfig::totalAggregatePairsCapacity. + PxU32 deformableSurfaceContacts; //!< actual number of deformable surface contacts needed - see PxGpuDynamicsMemoryConfig::maxDeformableSurfaceContacts. + PxU32 deformableVolumeContacts; //!< actual number of deformable volume contact needed - see PxGpuDynamicsMemoryConfig::maxDeformableVolumeContacts. + PxU32 softbodyContacts; //!< deprecated, use deformableVolumeContacts. + PxU32 particleContacts; //!< actual number of particle contacts needed - see PxGpuDynamicsMemoryConfig::maxParticleContacts. + PxU32 collisionStackSize; //!< actual size (bytes) needed for the collision stack - see PxGpuDynamicsMemoryConfig::collisionStackSize. + + PxGpuDynamicsMemoryConfigStatistics() : + tempBufferCapacity (0), + rigidContactCount (0), + rigidPatchCount (0), + foundLostPairs (0), + foundLostAggregatePairs (0), + totalAggregatePairs (0), + deformableSurfaceContacts (0), + deformableVolumeContacts (0), + softbodyContacts (0), // deprecated + particleContacts (0), + collisionStackSize (0) + { } +}; + +/** +\brief Class used to retrieve statistics for a simulation step. + +\see PxScene::getSimulationStatistics() +*/ +class PxSimulationStatistics +{ +public: + + /** + \brief Different types of rigid body collision pair statistics. + \see getRbPairStats + */ + enum RbPairStatsType + { + /** + \brief Shape pairs processed as discrete contact pairs for the current simulation step. + */ + eDISCRETE_CONTACT_PAIRS, + + /** + \brief Shape pairs processed as swept integration pairs for the current simulation step. + + \note Counts the pairs for which special CCD (continuous collision detection) work was actually done and NOT the number of pairs which were configured for CCD. + Furthermore, there can be multiple CCD passes and all processed pairs of all passes are summed up, hence the number can be larger than the amount of pairs which have been configured for CCD. + + \see PxPairFlag::eDETECT_CCD_CONTACT, + */ + eCCD_PAIRS, + + /** + \brief Shape pairs processed with user contact modification enabled for the current simulation step. + + \see PxContactModifyCallback + */ + eMODIFIED_CONTACT_PAIRS, + + /** + \brief Trigger shape pairs processed for the current simulation step. + + \see PxShapeFlag::eTRIGGER_SHAPE + */ + eTRIGGER_PAIRS + }; + + +//objects: + /** + \brief Number of active PxConstraint objects (joints etc.) for the current simulation step. + */ + PxU32 nbActiveConstraints; + + /** + \brief Number of active dynamic bodies for the current simulation step. + + \note Does not include active kinematic bodies + */ + PxU32 nbActiveDynamicBodies; + + /** + \brief Number of active kinematic bodies for the current simulation step. + + \note Kinematic deactivation occurs at the end of the frame after the last call to PxRigidDynamic::setKinematicTarget() was called so kinematics that are + deactivated in a given frame will be included by this counter. + */ + PxU32 nbActiveKinematicBodies; + + /** + \brief Number of static bodies for the current simulation step. + */ + PxU32 nbStaticBodies; + + /** + \brief Number of dynamic bodies for the current simulation step. + + \note Includes inactive bodies and articulation links + \note Does not include kinematic bodies + */ + PxU32 nbDynamicBodies; + + /** + \brief Number of kinematic bodies for the current simulation step. + + \note Includes inactive bodies + */ + PxU32 nbKinematicBodies; + + /** + \brief Number of shapes of each geometry type. + */ + + PxU32 nbShapes[PxGeometryType::eGEOMETRY_COUNT]; + + /** + \brief Number of aggregates in the scene. + */ + PxU32 nbAggregates; + + /** + \brief Number of articulations in the scene. + */ + PxU32 nbArticulations; + +//solver: + /** + \brief The number of 1D axis constraints(joints+contact) present in the current simulation step. + */ + PxU32 nbAxisSolverConstraints; + + /** + \brief The size (in bytes) of the compressed contact stream in the current simulation step + */ + PxU32 compressedContactSize; + + /** + \brief The total required size (in bytes) of the contact constraints in the current simulation step + */ + PxU32 requiredContactConstraintMemory; + + /** + \brief The peak amount of memory (in bytes) that was allocated for constraints (this includes joints) in the current simulation step + */ + PxU32 peakConstraintMemory; + +//broadphase: + /** + \brief Get number of broadphase volumes added for the current simulation step. + + \return Number of broadphase volumes added. + */ + PX_FORCE_INLINE PxU32 getNbBroadPhaseAdds() const + { + return nbBroadPhaseAdds; + } + + /** + \brief Get number of broadphase volumes removed for the current simulation step. + + \return Number of broadphase volumes removed. + */ + PX_FORCE_INLINE PxU32 getNbBroadPhaseRemoves() const + { + return nbBroadPhaseRemoves; + } + +//collisions: + /** + \brief Get number of shape collision pairs of a certain type processed for the current simulation step. + + There is an entry for each geometry pair type. + + \note entry[i][j] = entry[j][i], hence, if you want the sum of all pair + types, you need to discard the symmetric entries + + \param[in] pairType The type of pair for which to get information + \param[in] g0 The geometry type of one pair object + \param[in] g1 The geometry type of the other pair object + \return Number of processed pairs of the specified geometry types. + */ + PxU32 getRbPairStats(RbPairStatsType pairType, PxGeometryType::Enum g0, PxGeometryType::Enum g1) const + { + PX_ASSERT_WITH_MESSAGE( (pairType >= eDISCRETE_CONTACT_PAIRS) && + (pairType <= eTRIGGER_PAIRS), + "Invalid pairType in PxSimulationStatistics::getRbPairStats"); + + if (g0 >= PxGeometryType::eGEOMETRY_COUNT || g1 >= PxGeometryType::eGEOMETRY_COUNT) + { + PX_ASSERT(false); + return 0; + } + + PxU32 nbPairs = 0; + switch(pairType) + { + case eDISCRETE_CONTACT_PAIRS: + nbPairs = nbDiscreteContactPairs[g0][g1]; + break; + case eCCD_PAIRS: + nbPairs = nbCCDPairs[g0][g1]; + break; + case eMODIFIED_CONTACT_PAIRS: + nbPairs = nbModifiedContactPairs[g0][g1]; + break; + case eTRIGGER_PAIRS: + nbPairs = nbTriggerPairs[g0][g1]; + break; + } + return nbPairs; + } + + /** + \brief Total number of (non CCD) pairs reaching narrow phase + */ + PxU32 nbDiscreteContactPairsTotal; + + /** + \brief Total number of (non CCD) pairs for which contacts are successfully cached (<=nbDiscreteContactPairsTotal) + \note This includes pairs for which no contacts are generated, it still counts as a cache hit. + */ + PxU32 nbDiscreteContactPairsWithCacheHits; + + /** + \brief Total number of (non CCD) pairs for which at least 1 contact was generated (<=nbDiscreteContactPairsTotal) + */ + PxU32 nbDiscreteContactPairsWithContacts; + + /** + \brief Number of new pairs found by BP this frame + */ + PxU32 nbNewPairs; + + /** + \brief Number of lost pairs from BP this frame + */ + PxU32 nbLostPairs; + + /** + \brief Number of new touches found by NP this frame + */ + PxU32 nbNewTouches; + + /** + \brief Number of lost touches from NP this frame + */ + PxU32 nbLostTouches; + + /** + \brief Number of partitions used by the solver this frame + */ + PxU32 nbPartitions; + + /** + \brief GPU device memory in bytes allocated for particle state accessible through API + */ + PxU64 gpuMemParticles; + + /** + \brief GPU device memory in bytes allocated for deformable surface state accessible through API + */ + PxU64 gpuMemDeformableSurfaces; + + /** + \brief GPU device memory in bytes allocated for deformable volume state accessible through API + */ + PxU64 gpuMemDeformableVolumes; + + /** + \brief Deprecated + \see gpuMemDeformableVolumes + */ + PX_DEPRECATED PxU64 gpuMemSoftBodies; + + /** + \brief GPU device memory in bytes allocated for internal heap allocation + */ + PxU64 gpuMemHeap; + + /** + \brief GPU device heap memory used for broad phase in bytes + */ + PxU64 gpuMemHeapBroadPhase; + + /** + \brief GPU device heap memory used for narrow phase in bytes + */ + PxU64 gpuMemHeapNarrowPhase; + + /** + \brief GPU device heap memory used for solver in bytes + */ + PxU64 gpuMemHeapSolver; + + /** + \brief GPU device heap memory used for articulations in bytes + */ + PxU64 gpuMemHeapArticulation; + + /** + \brief GPU device heap memory used for simulation pipeline in bytes + */ + PxU64 gpuMemHeapSimulation; + + /** + \brief GPU device heap memory used for articulations in the simulation pipeline in bytes + */ + PxU64 gpuMemHeapSimulationArticulation; + + /** + \brief GPU device heap memory used for particles in the simulation pipeline in bytes + */ + PxU64 gpuMemHeapSimulationParticles; + + /** + \brief GPU device heap memory used for deformable surfaces in the simulation pipeline in bytes + */ + PxU64 gpuMemHeapSimulationDeformableSurface; + + /** + \brief GPU device heap memory used for deformable volumes in the simulation pipeline in bytes + */ + PxU64 gpuMemHeapSimulationDeformableVolume; + + /** + \brief Deprecated + \see gpuMemHeapSimulationDeformableVolume + */ + PX_DEPRECATED PxU64 gpuMemHeapSimulationSoftBody; + + /** + \brief GPU device heap memory used for shared buffers in the particles pipeline in bytes + */ + PxU64 gpuMemHeapParticles; + + /** + \brief GPU device heap memory used for shared buffers in the deformable surface pipeline in bytes + */ + PxU64 gpuMemHeapDeformableSurfaces; + + /** + \brief GPU device heap memory used for shared buffers in the deformable volume pipeline in bytes + */ + PxU64 gpuMemHeapDeformableVolumes; + + /** + \brief Deprecated + \see gpuMemHeapDeformableVolumes + */ + PX_DEPRECATED PxU64 gpuMemHeapSoftBodies; + + /** + \brief GPU device heap memory not covered by other stats in bytes + */ + PxU64 gpuMemHeapOther; + + /** + \brief Structure containing statistics about actual count/sizes used for the configuration parameters in PxGpuDynamicsMemoryConfig + */ + PxGpuDynamicsMemoryConfigStatistics gpuDynamicsMemoryConfigStatistics; + + + PxSimulationStatistics() : + nbActiveConstraints (0), + nbActiveDynamicBodies (0), + nbActiveKinematicBodies (0), + nbStaticBodies (0), + nbDynamicBodies (0), + nbKinematicBodies (0), + nbAggregates (0), + nbArticulations (0), + nbAxisSolverConstraints (0), + compressedContactSize (0), + requiredContactConstraintMemory (0), + peakConstraintMemory (0), + nbDiscreteContactPairsTotal (0), + nbDiscreteContactPairsWithCacheHits (0), + nbDiscreteContactPairsWithContacts (0), + nbNewPairs (0), + nbLostPairs (0), + nbNewTouches (0), + nbLostTouches (0), + nbPartitions (0), + gpuMemParticles (0), + gpuMemDeformableSurfaces (0), + gpuMemDeformableVolumes (0), + gpuMemSoftBodies (0), // deprecated + gpuMemHeap (0), + gpuMemHeapBroadPhase (0), + gpuMemHeapNarrowPhase (0), + gpuMemHeapSolver (0), + gpuMemHeapArticulation (0), + gpuMemHeapSimulation (0), + gpuMemHeapSimulationArticulation (0), + gpuMemHeapSimulationParticles (0), + gpuMemHeapSimulationDeformableSurface (0), + gpuMemHeapSimulationDeformableVolume (0), + gpuMemHeapSimulationSoftBody (0), // deprecated + gpuMemHeapParticles (0), + gpuMemHeapDeformableSurfaces (0), + gpuMemHeapDeformableVolumes (0), + gpuMemHeapSoftBodies (0), // deprecated + gpuMemHeapOther (0) + { + nbBroadPhaseAdds = 0; + nbBroadPhaseRemoves = 0; + + for(PxU32 i=0; i < PxGeometryType::eGEOMETRY_COUNT; i++) + { + for(PxU32 j=0; j < PxGeometryType::eGEOMETRY_COUNT; j++) + { + nbDiscreteContactPairs[i][j] = 0; + nbModifiedContactPairs[i][j] = 0; + nbCCDPairs[i][j] = 0; + nbTriggerPairs[i][j] = 0; + } + } + + for(PxU32 i=0; i < PxGeometryType::eGEOMETRY_COUNT; i++) + { + nbShapes[i] = 0; + } + } + + + // + // We advise to not access these members directly. Use the provided accessor methods instead. + // +//broadphase: + PxU32 nbBroadPhaseAdds; + PxU32 nbBroadPhaseRemoves; + +//collisions: + PxU32 nbDiscreteContactPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; + PxU32 nbCCDPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; + PxU32 nbModifiedContactPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; + PxU32 nbTriggerPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxSmoothing.h b/engine/third_party/physx/include/PxSmoothing.h new file mode 100644 index 00000000..9f1acf06 --- /dev/null +++ b/engine/third_party/physx/include/PxSmoothing.h @@ -0,0 +1,186 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SMOOTHING_H +#define PX_SMOOTHING_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 Ccomputes smoothed positions for a particle system to improve rendering quality + */ + class PxSmoothedPositionGenerator + { + public: + /** + \brief Schedules the compuation of smoothed positions 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 generateSmoothedPositions(PxGpuParticleSystem* gpuParticleSystem, PxU32 numParticles, CUstream stream) = 0; + + /** + \brief Schedules the compuation of smoothed positions 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 generateSmoothedPositions(PxVec4* particlePositionsGpu, PxParticleNeighborhoodProvider& neighborhoodProvider, PxU32 numParticles, PxReal particleContactOffset, CUstream stream) = 0; + + /** + \brief Set a host buffer that holds the smoothed position data after the timestep completed + + \param[in] smoothedPositions A host buffer with memory for all particles already allocated + */ + virtual void setResultBufferHost(PxVec4* smoothedPositions) = 0; + + /** + \brief Set a device buffer that holds the smoothed position data after the timestep completed + + \param[in] smoothedPositions A device buffer with memory for all particles already allocated + */ + virtual void setResultBufferDevice(PxVec4* smoothedPositions) = 0; + + /** + \brief Sets the intensity of the position smoothing effect + + \param[in] smoothingStrenght The strength of the smoothing effect + */ + virtual void setSmoothing(float smoothingStrenght) = 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 smoothed positions. Only available after calling setResultBufferHost or setResultBufferDevice + + \return The device pointer for the smoothed positions + */ + virtual PxVec4* getSmoothedPositionsDevicePointer() const = 0; + + /** + \brief Enables or disables the smoothed position 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 smoothed position 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 ~PxSmoothedPositionGenerator() {} + }; + + /** + \brief Default implementation of a particle system callback to trigger smoothed position calculations. A call to fetchResultsParticleSystem() on the + PxScene will synchronize the work such that the caller knows that the post solve task completed. + */ + class PxSmoothedPositionCallback : public PxParticleSystemCallback + { + public: + /** + \brief Initializes the smoothing callback + + \param[in] smoothedPositionGenerator The smoothed position generator + */ + void initialize(PxSmoothedPositionGenerator* smoothedPositionGenerator) + { + mSmoothedPositionGenerator = smoothedPositionGenerator; + } + + virtual void onPostSolve(const PxGpuMirroredPointer& gpuParticleSystem, CUstream stream) + { + if (mSmoothedPositionGenerator) + { + mSmoothedPositionGenerator->generateSmoothedPositions(gpuParticleSystem.mDevicePtr, gpuParticleSystem.mHostPtr->mCommonData.mMaxParticles, stream); + } + } + + virtual void onBegin(const PxGpuMirroredPointer& /*gpuParticleSystem*/, CUstream /*stream*/) { } + + virtual void onAdvance(const PxGpuMirroredPointer& /*gpuParticleSystem*/, CUstream /*stream*/) { } + + private: + PxSmoothedPositionGenerator* mSmoothedPositionGenerator; + }; + +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxSoftBody.h b/engine/third_party/physx/include/PxSoftBody.h new file mode 100644 index 00000000..ed71d7fa --- /dev/null +++ b/engine/third_party/physx/include/PxSoftBody.h @@ -0,0 +1,105 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SOFT_BODY_H +#define PX_SOFT_BODY_H + +#include "PxDeformableVolume.h" +#include "PxDeformableVolumeFlag.h" +#include "PxFEMParameter.h" +#include "PxSoftBodyFlag.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4435) +#endif + + + /** + \brief Deprecated + \see PX_MAX_NB_DEFORMABLE_VOLUME_TET + */ + #define PX_MAX_NB_SOFTBODY_TET PX_MAX_NB_DEFORMABLE_VOLUME_TET + + /** + \brief Deprecated + \see PX_MAX_NB_DEFORMABLE_VOLUME + */ + #define PX_MAX_NB_SOFTBODY PX_MAX_NB_DEFORMABLE_VOLUME + + /** + \brief Deprecated + \see PxDeformableVolumeFlag + */ + typedef PX_DEPRECATED PxDeformableVolumeFlag PxSoftBodyFlag; + + /** + \brief Deprecated + \see PxDeformableVolumeFlags + */ + typedef PX_DEPRECATED PxDeformableVolumeFlags PxSoftBodyFlags; + + /** + \brief Deprecated + \see PxDeformableVolume + */ + typedef PX_DEPRECATED PxDeformableVolume PxSoftBody; + + /** + \brief Deprecated + \see PxConfigureDeformableVolumeKinematicTarget + */ + PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec4 PxConfigureSoftBodyKinematicTarget(const PxVec4& target, bool isActive) + { + return PxConfigureDeformableVolumeKinematicTarget(target, isActive); + } + + /** + \brief Deprecated + \see PxConfigureDeformableVolumeKinematicTarget + */ + PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec4 PxConfigureSoftBodyKinematicTarget(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 diff --git a/engine/third_party/physx/include/PxSoftBodyFlag.h b/engine/third_party/physx/include/PxSoftBodyFlag.h new file mode 100644 index 00000000..0bd96dda --- /dev/null +++ b/engine/third_party/physx/include/PxSoftBodyFlag.h @@ -0,0 +1,80 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SOFT_BODY_FLAG_H +#define PX_SOFT_BODY_FLAG_H + +#include "PxDeformableVolumeFlag.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Deprecated +\see PxDeformableVolumeDataFlag +*/ +typedef PX_DEPRECATED PxDeformableVolumeDataFlag PxSoftBodyDataFlag; + +/** +\brief Deprecated +\see PxDeformableVolumeDataFlags +*/ +typedef PX_DEPRECATED PxDeformableVolumeDataFlags PxSoftBodyDataFlags; + +/** +\brief These flags determine what data is read or written when using PxScene::copySoftBodyData() +or PxScene::applySoftBodyData. + +\see PxScene::copySoftBodyData, PxScene::applySoftBodyData + +\deprecated There is no direct replacement. The data is exposed in the PxSoftBody interface, accessible directly from GPU. +There is no replacement for eTET_REST_POSES, as the data is constant and can be derived from the input collision mesh. +*/ +PX_DEPRECATED class PxSoftBodyGpuDataFlag +{ +public: + enum Enum + { + eTET_INDICES = 0, //!< The collision mesh tetrahedron indices (quadruples of int32) + eTET_REST_POSES = 1, //!< The collision mesh tetrahedron rest poses (float 3x3 matrices) + eTET_ROTATIONS = 2, //!< The collision mesh tetrahedron orientations (quaternions, quadruples of float) + eTET_POSITION_INV_MASS = 3, //!< The collision mesh vertex positions and their inverted mass in the 4th component (quadruples of float) + eSIM_TET_INDICES = 4, //!< The simulation mesh tetrahedron indices (quadruples of int32) + eSIM_TET_ROTATIONS = 5, //!< The simulation mesh tetrahedron orientations (quaternions, quadruples of float) + eSIM_VELOCITY_INV_MASS = 6, //!< The simulation mesh vertex velocities and their inverted mass in the 4th component (quadruples of float) + eSIM_POSITION_INV_MASS = 7 //!< The simulation mesh vertex positions and their inverted mass in the 4th component (quadruples of float) + }; +}; + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/engine/third_party/physx/include/PxSparseGridParams.h b/engine/third_party/physx/include/PxSparseGridParams.h new file mode 100644 index 00000000..91597872 --- /dev/null +++ b/engine/third_party/physx/include/PxSparseGridParams.h @@ -0,0 +1,116 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SPARSE_GRID_PARAMS_H +#define PX_SPARSE_GRID_PARAMS_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxMath.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Parameters to define the sparse grid settings like grid spacing, maximal number of subgrids etc. + */ + struct PxSparseGridParams + { + /** + \brief Default constructor. + */ + PX_INLINE PxSparseGridParams() + { + maxNumSubgrids = 512; + subgridSizeX = 32; + subgridSizeY = 32; + subgridSizeZ = 32; + gridSpacing = 0.2f; + haloSize = 1; + } + + /** + \brief Copy constructor. + */ + PX_CUDA_CALLABLE PX_INLINE PxSparseGridParams(const PxSparseGridParams& params) + { + maxNumSubgrids = params.maxNumSubgrids; + subgridSizeX = params.subgridSizeX; + subgridSizeY = params.subgridSizeY; + subgridSizeZ = params.subgridSizeZ; + gridSpacing = params.gridSpacing; + haloSize = params.haloSize; + } + + PX_CUDA_CALLABLE PX_INLINE PxU32 getNumCellsPerSubgrid() const + { + return subgridSizeX * subgridSizeY * subgridSizeZ; + } + + PX_CUDA_CALLABLE PX_INLINE PxReal getSqrt3dx() const + { + return PxSqrt(3.0f) * gridSpacing; + } + + + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE void setToDefault() + { + *this = PxSparseGridParams(); + } + + /** + \brief Assignment operator + */ + PX_INLINE void operator = (const PxSparseGridParams& params) + { + maxNumSubgrids = params.maxNumSubgrids; + subgridSizeX = params.subgridSizeX; + subgridSizeY = params.subgridSizeY; + subgridSizeZ = params.subgridSizeZ; + gridSpacing = params.gridSpacing; + haloSize = params.haloSize; + } + + PxU32 maxNumSubgrids; //!< Maximum number of subgrids + PxReal gridSpacing; //!< Grid spacing for the grid + PxU16 subgridSizeX; //!< Subgrid resolution in x dimension (must be an even number) + PxU16 subgridSizeY; //!< Subgrid resolution in y dimension (must be an even number) + PxU16 subgridSizeZ; //!< Subgrid resolution in z dimension (must be an even number) + PxU16 haloSize; //!< Number of halo cell layers around every subgrid cell. Only 0 and 1 are valid values + }; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/PxVisualizationParameter.h b/engine/third_party/physx/include/PxVisualizationParameter.h new file mode 100644 index 00000000..92c86321 --- /dev/null +++ b/engine/third_party/physx/include/PxVisualizationParameter.h @@ -0,0 +1,271 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_VISUALIZATION_PARAMETER_H +#define PX_VISUALIZATION_PARAMETER_H + +#include "foundation/PxPreprocessor.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/* +NOTE: Parameters should NOT be conditionally compiled out. Even if a particular feature is not available. +Otherwise the parameter values get shifted about and the numeric values change per platform. This causes problems +when trying to serialize parameters. + +New parameters should also be added to the end of the list for this reason. Also make sure to update +eNUM_VALUES, which should be one higher than the maximum value in the enum. +*/ + +/** +\brief Debug visualization parameters. + +#PxVisualizationParameter::eSCALE is the master switch for enabling visualization, please read the corresponding documentation +for further details. + +\see PxScene.setVisualizationParameter() PxScene.getVisualizationParameter() PxScene.getRenderBuffer() +*/ +struct PxVisualizationParameter +{ + enum Enum + { + /* RigidBody-related parameters */ + + /** + \brief This overall visualization scale gets multiplied with the individual scales. Setting to zero ignores all visualizations. Default is 0. + + The below settings permit the debug visualization of various simulation properties. + The setting is either zero, in which case the property is not drawn. Otherwise it is a scaling factor + that determines the size of the visualization widgets. + + Only objects for which visualization is turned on using setFlag(eVISUALIZATION) are visualized (see #PxActorFlag::eVISUALIZATION, #PxShapeFlag::eVISUALIZATION, ...). + Default is 0. + + Notes: + - to see any visualization, you have to set PxVisualizationParameter::eSCALE to nonzero first. + - the scale factor has been introduced because it's difficult (if not impossible) to come up with a + good scale for 3D vectors. Normals are normalized and their length is always 1. But it doesn't mean + we should render a line of length 1. Depending on your objects/scene, this might be completely invisible + or extremely huge. That's why the scale factor is here, to let you tune the length until it's ok in + your scene. + - however, things like collision shapes aren't ambiguous. They are clearly defined for example by the + triangles & polygons themselves, and there's no point in scaling that. So the visualization widgets + are only scaled when it makes sense. + + Range: [0, PX_MAX_F32)
+ Default: 0 + */ + eSCALE, + + /** + \brief Visualize the world axes. + */ + eWORLD_AXES, + + /* Body visualizations */ + + /** + \brief Visualize a bodies axes. + + \see PxActor.globalPose PxActor + */ + eBODY_AXES, + + /** + \brief Visualize a body's mass axes. + + This visualization is also useful for visualizing the sleep state of bodies. Sleeping bodies are drawn in + black, while awake bodies are drawn in white. If the body is sleeping and part of a sleeping group, it is + drawn in red. + + \see PxBodyDesc.massLocalPose PxActor + */ + eBODY_MASS_AXES, + + /** + \brief Visualize the bodies linear velocity. + + \see PxBodyDesc.linearVelocity PxActor + */ + eBODY_LIN_VELOCITY, + + /** + \brief Visualize the bodies angular velocity. + + \see PxBodyDesc.angularVelocity PxActor + */ + eBODY_ANG_VELOCITY, + + /* Contact visualisations */ + + /** + \brief Visualize contact points. Will enable contact information. + */ + eCONTACT_POINT, + + /** + \brief Visualize contact normals. Will enable contact information. + */ + eCONTACT_NORMAL, + + /** + \brief Visualize contact errors. Will enable contact information. + */ + eCONTACT_ERROR, + + /** + \brief Visualize Contact impulses. Will enable contact information. + */ + eCONTACT_IMPULSE, + + /** + \brief Visualize Contact forces. Will enable contact information. + \deprecated Use eCONTACT_IMPULSE instead. + */ + eCONTACT_FORCE PX_DEPRECATED = eCONTACT_IMPULSE, + + /** + \brief Visualize friction points. Will enable contact information. + */ + eFRICTION_POINT, + + /** + \brief Visualize friction normals. Will enable contact information. + */ + eFRICTION_NORMAL, + + /** + \brief Visualize friction impulses. Will enable contact information. + */ + eFRICTION_IMPULSE, + + /** + \brief Visualize actor axes. + + \see PxRigidStatic PxRigidDynamic PxArticulationLink + */ + eACTOR_AXES, + + /** + \brief Visualize bounds (AABBs in world space) + */ + eCOLLISION_AABBS, + + /** + \brief Shape visualization + + \see PxShape + */ + eCOLLISION_SHAPES, + + /** + \brief Shape axis visualization + + \see PxShape + */ + eCOLLISION_AXES, + + /** + \brief Compound visualization (compound AABBs in world space) + */ + eCOLLISION_COMPOUNDS, + + /** + \brief Mesh & convex face normals + + \see PxTriangleMesh PxConvexMesh + */ + eCOLLISION_FNORMALS, + + /** + \brief Active edges for meshes + + \see PxTriangleMesh + */ + eCOLLISION_EDGES, + + /** + \brief Static pruning structures + */ + eCOLLISION_STATIC, + + /** + \brief Dynamic pruning structures + */ + eCOLLISION_DYNAMIC, + + /** + \brief Joint local axes + */ + eJOINT_LOCAL_FRAMES, + + /** + \brief Joint limits + */ + eJOINT_LIMITS, + + /** + \brief Visualize culling box + */ + eCULL_BOX, + + /** + \brief MBP regions + */ + eMBP_REGIONS, + + /** + \brief Renders the simulation mesh instead of the collision mesh (only available for tetmeshes) + + Deformable visualization is currently not supported. + */ + eSIMULATION_MESH, + + /** + \brief Renders the SDF of a mesh instead of the collision mesh (only available for triangle meshes with SDFs) + */ + eSDF, + + /** + \brief This is not a parameter, it just records the current number of parameters (as maximum(PxVisualizationParameter)+1) for use in loops. + */ + eNUM_VALUES, + + eFORCE_DWORD = 0x7fffffff + }; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/characterkinematic/PxBoxController.h b/engine/third_party/physx/include/characterkinematic/PxBoxController.h new file mode 100644 index 00000000..cb1cfdf1 --- /dev/null +++ b/engine/third_party/physx/include/characterkinematic/PxBoxController.h @@ -0,0 +1,223 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_BOX_CONTROLLER_H +#define PX_BOX_CONTROLLER_H + +#include "characterkinematic/PxController.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Descriptor for a box character controller. + +\see PxBoxController PxControllerDesc +*/ +class PxBoxControllerDesc : public PxControllerDesc +{ +public: + /** + \brief constructor sets to default. + */ + PX_INLINE PxBoxControllerDesc(); + PX_INLINE virtual ~PxBoxControllerDesc() {} + + /** + \brief copy constructor. + */ + PX_INLINE PxBoxControllerDesc(const PxBoxControllerDesc&); + + /** + \brief assignment operator. + */ + PX_INLINE PxBoxControllerDesc& operator=(const PxBoxControllerDesc&); + + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE virtual void setToDefault(); + + /** + \brief returns true if the current settings are valid + + \return True if the descriptor is valid. + */ + PX_INLINE virtual bool isValid() const; + + /** + \brief Half height + + Default: 1.0 + */ + PxF32 halfHeight; // Half-height in the "up" direction + + /** + \brief Half side extent + + Default: 0.5 + */ + PxF32 halfSideExtent; // Half-extent in the "side" direction + + /** + \brief Half forward extent + + Default: 0.5 + */ + PxF32 halfForwardExtent; // Half-extent in the "forward" direction + +protected: + PX_INLINE void copy(const PxBoxControllerDesc&); +}; + +PX_INLINE PxBoxControllerDesc::PxBoxControllerDesc() : + PxControllerDesc (PxControllerShapeType::eBOX), + halfHeight (1.0f), + halfSideExtent (0.5f), + halfForwardExtent (0.5f) +{ +} + +PX_INLINE PxBoxControllerDesc::PxBoxControllerDesc(const PxBoxControllerDesc& other) : PxControllerDesc(other) +{ + copy(other); +} + +PX_INLINE PxBoxControllerDesc& PxBoxControllerDesc::operator=(const PxBoxControllerDesc& other) +{ + PxControllerDesc::operator=(other); + copy(other); + return *this; +} + +PX_INLINE void PxBoxControllerDesc::copy(const PxBoxControllerDesc& other) +{ + halfHeight = other.halfHeight; + halfSideExtent = other.halfSideExtent; + halfForwardExtent = other.halfForwardExtent; +} + +PX_INLINE void PxBoxControllerDesc::setToDefault() +{ + *this = PxBoxControllerDesc(); +} + +PX_INLINE bool PxBoxControllerDesc::isValid() const +{ + if(!PxControllerDesc::isValid()) return false; + if(halfHeight<=0.0f) return false; + if(halfSideExtent<=0.0f) return false; + if(halfForwardExtent<=0.0f) return false; + if(stepOffset>2.0f*halfHeight) return false; // Prevents obvious mistakes + return true; +} + +/** +\brief Box character controller. + +\see PxBoxControllerDesc PxController +*/ +class PxBoxController : public PxController +{ +public: + + /** + \brief Gets controller's half height. + + \return The half height of the controller. + + \see PxBoxControllerDesc.halfHeight setHalfHeight() + */ + virtual PxF32 getHalfHeight() const = 0; + + /** + \brief Gets controller's half side extent. + + \return The half side extent of the controller. + + \see PxBoxControllerDesc.halfSideExtent setHalfSideExtent() + */ + virtual PxF32 getHalfSideExtent() const = 0; + + /** + \brief Gets controller's half forward extent. + + \return The half forward extent of the controller. + + \see PxBoxControllerDesc.halfForwardExtent setHalfForwardExtent() + */ + virtual PxF32 getHalfForwardExtent() const = 0; + + /** + \brief Sets controller's half height. + + \warning this doesn't check for collisions. + + \param[in] halfHeight The new half height for the controller. + \return Currently always true. + + \see PxBoxControllerDesc.halfHeight getHalfHeight() + */ + virtual bool setHalfHeight(PxF32 halfHeight) = 0; + + /** + \brief Sets controller's half side extent. + + \warning this doesn't check for collisions. + + \param[in] halfSideExtent The new half side extent for the controller. + \return Currently always true. + + \see PxBoxControllerDesc.halfSideExtent getHalfSideExtent() + */ + virtual bool setHalfSideExtent(PxF32 halfSideExtent) = 0; + + /** + \brief Sets controller's half forward extent. + + \warning this doesn't check for collisions. + + \param[in] halfForwardExtent The new half forward extent for the controller. + \return Currently always true. + + \see PxBoxControllerDesc.halfForwardExtent getHalfForwardExtent() + */ + virtual bool setHalfForwardExtent(PxF32 halfForwardExtent) = 0; + +protected: + PX_INLINE PxBoxController() {} + virtual ~PxBoxController() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/characterkinematic/PxCapsuleController.h b/engine/third_party/physx/include/characterkinematic/PxCapsuleController.h new file mode 100644 index 00000000..d8e624ec --- /dev/null +++ b/engine/third_party/physx/include/characterkinematic/PxCapsuleController.h @@ -0,0 +1,244 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CAPSULE_CONTROLLER_H +#define PX_CAPSULE_CONTROLLER_H + +#include "characterkinematic/PxController.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxCapsuleClimbingMode +{ + enum Enum + { + eEASY, //!< Standard mode, let the capsule climb over surfaces according to impact normal + eCONSTRAINED, //!< Constrained mode, try to limit climbing according to the step offset + + eLAST + }; +}; + +/** +\brief A descriptor for a capsule character controller. + +\see PxCapsuleController PxControllerDesc +*/ +class PxCapsuleControllerDesc : public PxControllerDesc +{ +public: + /** + \brief constructor sets to default. + */ + PX_INLINE PxCapsuleControllerDesc (); + PX_INLINE virtual ~PxCapsuleControllerDesc () {} + + /** + \brief copy constructor. + */ + PX_INLINE PxCapsuleControllerDesc(const PxCapsuleControllerDesc&); + + /** + \brief assignment operator. + */ + PX_INLINE PxCapsuleControllerDesc& operator=(const PxCapsuleControllerDesc&); + + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE virtual void setToDefault(); + /** + \brief returns true if the current settings are valid + + \return True if the descriptor is valid. + */ + PX_INLINE virtual bool isValid() const; + + /** + \brief The radius of the capsule + + Default: 0.0 + + \see PxCapsuleController + */ + PxF32 radius; + + /** + \brief The height of the controller + + Default: 0.0 + + \see PxCapsuleController + */ + PxF32 height; + + /** + \brief The climbing mode + + Default: PxCapsuleClimbingMode::eEASY + + \see PxCapsuleController + */ + PxCapsuleClimbingMode::Enum climbingMode; + +protected: + PX_INLINE void copy(const PxCapsuleControllerDesc&); +}; + +PX_INLINE PxCapsuleControllerDesc::PxCapsuleControllerDesc () : PxControllerDesc(PxControllerShapeType::eCAPSULE) +{ + radius = height = 0.0f; + climbingMode = PxCapsuleClimbingMode::eEASY; +} + +PX_INLINE PxCapsuleControllerDesc::PxCapsuleControllerDesc(const PxCapsuleControllerDesc& other) : PxControllerDesc(other) +{ + copy(other); +} + +PX_INLINE PxCapsuleControllerDesc& PxCapsuleControllerDesc::operator=(const PxCapsuleControllerDesc& other) +{ + PxControllerDesc::operator=(other); + copy(other); + return *this; +} + +PX_INLINE void PxCapsuleControllerDesc::copy(const PxCapsuleControllerDesc& other) +{ + radius = other.radius; + height = other.height; + climbingMode = other.climbingMode; +} + +PX_INLINE void PxCapsuleControllerDesc::setToDefault() +{ + *this = PxCapsuleControllerDesc(); +} + +PX_INLINE bool PxCapsuleControllerDesc::isValid() const +{ + if(!PxControllerDesc::isValid()) return false; + if(radius<=0.0f) return false; + if(height<=0.0f) return false; + if(stepOffset>height+radius*2.0f) return false; // Prevents obvious mistakes + return true; +} +/** +\brief A capsule character controller. + +The capsule is defined as a position, a vertical height, and a radius. +The height is the distance between the two sphere centers at the end of the capsule. +In other words: + +p = pos (returned by controller)
+h = height
+r = radius
+ +p = center of capsule
+top sphere center = p.y + h*0.5
+bottom sphere center = p.y - h*0.5
+top capsule point = p.y + h*0.5 + r
+bottom capsule point = p.y - h*0.5 - r
+*/ +class PxCapsuleController : public PxController +{ +public: + + /** + \brief Gets controller's radius. + + \return The radius of the controller. + + \see PxCapsuleControllerDesc.radius setRadius() + */ + virtual PxF32 getRadius() const = 0; + + /** + \brief Sets controller's radius. + + \warning this doesn't check for collisions. + + \param[in] radius The new radius for the controller. + \return Currently always true. + + \see PxCapsuleControllerDesc.radius getRadius() + */ + virtual bool setRadius(PxF32 radius) = 0; + + /** + \brief Gets controller's height. + + \return The height of the capsule controller. + + \see PxCapsuleControllerDesc.height setHeight() + */ + virtual PxF32 getHeight() const = 0; + + /** + \brief Resets controller's height. + + \warning this doesn't check for collisions. + + \param[in] height The new height for the controller. + \return Currently always true. + + \see PxCapsuleControllerDesc.height getHeight() + */ + virtual bool setHeight(PxF32 height) = 0; + + /** + \brief Gets controller's climbing mode. + + \return The capsule controller's climbing mode. + + \see PxCapsuleControllerDesc.climbingMode setClimbingMode() + */ + virtual PxCapsuleClimbingMode::Enum getClimbingMode() const = 0; + + /** + \brief Sets controller's climbing mode. + + \param[in] mode The capsule controller's climbing mode. + + \see PxCapsuleControllerDesc.climbingMode getClimbingMode() + */ + virtual bool setClimbingMode(PxCapsuleClimbingMode::Enum mode) = 0; + +protected: + PX_INLINE PxCapsuleController() {} + virtual ~PxCapsuleController() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/characterkinematic/PxController.h b/engine/third_party/physx/include/characterkinematic/PxController.h new file mode 100644 index 00000000..6eb2e45d --- /dev/null +++ b/engine/third_party/physx/include/characterkinematic/PxController.h @@ -0,0 +1,926 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_CONTROLLER_H +#define PX_CONTROLLER_H + +#include "characterkinematic/PxExtended.h" +#include "characterkinematic/PxControllerObstacles.h" +#include "PxQueryFiltering.h" +#include "foundation/PxErrorCallback.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief The type of controller, eg box, sphere or capsule. +*/ +struct PxControllerShapeType +{ + enum Enum + { + /** + \brief A box controller. + + \see PxBoxController PxBoxControllerDesc + */ + eBOX, + + /** + \brief A capsule controller + + \see PxCapsuleController PxCapsuleControllerDesc + */ + eCAPSULE, + + eFORCE_DWORD = 0x7fffffff + }; +}; + +class PxShape; +class PxScene; +class PxController; +class PxRigidDynamic; +class PxMaterial; +struct PxFilterData; +class PxQueryFilterCallback; +class PxControllerBehaviorCallback; +class PxObstacleContext; +class PxObstacle; + +/** +\brief specifies how a CCT interacts with non-walkable parts. + +This is only used when slopeLimit is non zero. It is currently enabled for static actors only, and not supported for spheres or capsules. +*/ +struct PxControllerNonWalkableMode +{ + enum Enum + { + ePREVENT_CLIMBING, //!< Stops character from climbing up non-walkable slopes, but doesn't move it otherwise + ePREVENT_CLIMBING_AND_FORCE_SLIDING //!< Stops character from climbing up non-walkable slopes, and forces it to slide down those slopes + }; +}; + +/** +\brief specifies which sides a character is colliding with. +*/ +struct PxControllerCollisionFlag +{ + enum Enum + { + eCOLLISION_SIDES = (1<<0), //!< Character is colliding to the sides. + eCOLLISION_UP = (1<<1), //!< Character has collision above. + eCOLLISION_DOWN = (1<<2) //!< Character has collision below. + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxControllerCollisionFlag. + +\see PxControllerCollisionFlag +*/ +typedef PxFlags PxControllerCollisionFlags; +PX_FLAGS_OPERATORS(PxControllerCollisionFlag::Enum, PxU8) + +/** +\brief Describes a controller's internal state. +*/ +struct PxControllerState +{ + PxVec3 deltaXP; //!< delta position vector for the object the CCT is standing/riding on. Not always match the CCT delta when variable timesteps are used. + PxShape* touchedShape; //!< Shape on which the CCT is standing + PxRigidActor* touchedActor; //!< Actor owning 'touchedShape' + PxObstacleHandle touchedObstacleHandle; // Obstacle on which the CCT is standing + PxU32 collisionFlags; //!< Last known collision flags (PxControllerCollisionFlag) + bool standOnAnotherCCT; //!< Are we standing on another CCT? + bool standOnObstacle; //!< Are we standing on a user-defined obstacle? + bool isMovingUp; //!< is CCT moving up or not? (i.e. explicit jumping) +}; + +/** +\brief Describes a controller's internal statistics. +*/ +struct PxControllerStats +{ + PxU16 nbIterations; + PxU16 nbFullUpdates; + PxU16 nbPartialUpdates; + PxU16 nbTessellation; +}; + +/** +\brief Describes a generic CCT hit. +*/ +struct PxControllerHit +{ + PxController* controller; //!< Current controller + PxExtendedVec3 worldPos; //!< Contact position in world space + PxVec3 worldNormal; //!< Contact normal in world space + PxVec3 dir; //!< Motion direction + PxF32 length; //!< Motion length +}; + +/** +\brief Describes a hit between a CCT and a shape. Passed to onShapeHit() + +\see PxUserControllerHitReport.onShapeHit() +*/ +struct PxControllerShapeHit : public PxControllerHit +{ + PxShape* shape; //!< Touched shape + PxRigidActor* actor; //!< Touched actor + PxU32 triangleIndex; //!< touched triangle index (only for meshes/heightfields) +}; + +/** +\brief Describes a hit between a CCT and another CCT. Passed to onControllerHit(). + +\see PxUserControllerHitReport.onControllerHit() +*/ +struct PxControllersHit : public PxControllerHit +{ + PxController* other; //!< Touched controller +}; + +/** +\brief Describes a hit between a CCT and a user-defined obstacle. Passed to onObstacleHit(). + +\see PxUserControllerHitReport.onObstacleHit() PxObstacleContext +*/ +struct PxControllerObstacleHit : public PxControllerHit +{ + const void* userData; +}; + +/** +\brief User callback class for character controller events. + +\note Character controller hit reports are only generated when move is called. + +\see PxControllerDesc.callback +*/ +class PxUserControllerHitReport +{ +public: + + /** + \brief Called when current controller hits a shape. + + This is called when the CCT moves and hits a shape. This will not be called when a moving shape hits a non-moving CCT. + + \param[in] hit Provides information about the hit. + + \see PxControllerShapeHit + */ + virtual void onShapeHit(const PxControllerShapeHit& hit) = 0; + + /** + \brief Called when current controller hits another controller. + + \param[in] hit Provides information about the hit. + + \see PxControllersHit + */ + virtual void onControllerHit(const PxControllersHit& hit) = 0; + + /** + \brief Called when current controller hits a user-defined obstacle. + + \param[in] hit Provides information about the hit. + + \see PxControllerObstacleHit PxObstacleContext + */ + virtual void onObstacleHit(const PxControllerObstacleHit& hit) = 0; + +protected: + virtual ~PxUserControllerHitReport(){} +}; + + +/** +\brief Dedicated filtering callback for CCT vs CCT. + +This controls collisions between CCTs (one CCT vs anoter CCT). + +To make each CCT collide against all other CCTs, just return true - or simply avoid defining a callback. +To make each CCT freely go through all other CCTs, just return false. +Otherwise create a custom filtering logic in this callback. + +\see PxControllerFilters +*/ +class PxControllerFilterCallback +{ +public: + virtual ~PxControllerFilterCallback(){} + + /** + \brief Filtering method for CCT-vs-CCT. + + \param[in] a First CCT + \param[in] b Second CCT + \return true to keep the pair, false to filter it out + */ + virtual bool filter(const PxController& a, const PxController& b) = 0; +}; + +/** +\brief Filtering data for "move" call. + +This class contains all filtering-related parameters for the PxController::move() call. + +Collisions between a CCT and the world are filtered using the mFilterData, mFilterCallback and mFilterFlags +members. These parameters are internally passed to PxScene::overlap() to find objects touched by the CCT. +Please refer to the PxScene::overlap() documentation for details. + +Collisions between a CCT and another CCT are filtered using the mCCTFilterCallback member. If this filter +callback is not defined, none of the CCT-vs-CCT collisions are filtered, and each CCT will collide against +all other CCTs. + +\note PxQueryFlag::eANY_HIT and PxQueryFlag::eNO_BLOCK are ignored in mFilterFlags. + +\see PxController.move() PxControllerFilterCallback +*/ +class PxControllerFilters +{ + public: + + PX_INLINE PxControllerFilters(const PxFilterData* filterData=NULL, PxQueryFilterCallback* cb=NULL, PxControllerFilterCallback* cctFilterCb=NULL) : + mFilterData (filterData), + mFilterCallback (cb), + mFilterFlags (PxQueryFlag::eSTATIC|PxQueryFlag::eDYNAMIC|PxQueryFlag::ePREFILTER), + mCCTFilterCallback (cctFilterCb) + {} + + // CCT-vs-shapes: + const PxFilterData* mFilterData; //!< Data for internal PxQueryFilterData structure. Passed to PxScene::overlap() call. + //!< This can be NULL, in which case a default PxFilterData is used. + PxQueryFilterCallback* mFilterCallback; //!< Custom filter logic (can be NULL). Passed to PxScene::overlap() call. + PxQueryFlags mFilterFlags; //!< Flags for internal PxQueryFilterData structure. Passed to PxScene::overlap() call. + // CCT-vs-CCT: + PxControllerFilterCallback* mCCTFilterCallback; //!< CCT-vs-CCT filter callback. If NULL, all CCT-vs-CCT collisions are kept. +}; + +/** +\brief Descriptor class for a character controller. + +\see PxBoxController PxCapsuleController +*/ +class PxControllerDesc +{ +public: + + /** + \brief returns true if the current settings are valid + + \return True if the descriptor is valid. + */ + PX_INLINE virtual bool isValid() const; + + /** + \brief Returns the character controller type + + \return The controllers type. + + \see PxControllerType PxCapsuleControllerDesc PxBoxControllerDesc + */ + PX_INLINE PxControllerShapeType::Enum getType() const { return mType; } + + /** + \brief The position of the character + + \note The character's initial position must be such that it does not overlap the static geometry. + + Default: Zero + */ + PxExtendedVec3 position; + + /** + \brief Specifies the 'up' direction + + In order to provide stepping functionality the SDK must be informed about the up direction. + + Default: (0, 1, 0) + + */ + PxVec3 upDirection; + + /** + \brief The maximum slope which the character can walk up. + + In general it is desirable to limit where the character can walk, in particular it is unrealistic + for the character to be able to climb arbitary slopes. + + The limit is expressed as the cosine of desired limit angle. A value of 0 disables this feature. + + \warning It is currently enabled for static actors only (not for dynamic/kinematic actors), and not supported for spheres or capsules. + + Default: 0.707 + + \see upDirection invisibleWallHeight maxJumpHeight + */ + PxF32 slopeLimit; + + /** + \brief Height of invisible walls created around non-walkable triangles + + The library can automatically create invisible walls around non-walkable triangles defined + by the 'slopeLimit' parameter. This defines the height of those walls. If it is 0.0, then + no extra triangles are created. + + Default: 0.0 + + \see upDirection slopeLimit maxJumpHeight + */ + PxF32 invisibleWallHeight; + + /** + \brief Maximum height a jumping character can reach + + This is only used if invisible walls are created ('invisibleWallHeight' is non zero). + + When a character jumps, the non-walkable triangles he might fly over are not found + by the collision queries (since the character's bounding volume does not touch them). + Thus those non-walkable triangles do not create invisible walls, and it is possible + for a jumping character to land on a non-walkable triangle, while he wouldn't have + reached that place by just walking. + + The 'maxJumpHeight' variable is used to extend the size of the collision volume + downward. This way, all the non-walkable triangles are properly found by the collision + queries and it becomes impossible to 'jump over' invisible walls. + + If the character in your game can not jump, it is safe to use 0.0 here. Otherwise it + is best to keep this value as small as possible, since a larger collision volume + means more triangles to process. + + Default: 0.0 + + \see upDirection slopeLimit invisibleWallHeight + */ + PxF32 maxJumpHeight; + + /** + \brief The contact offset used by the controller. + + Specifies a skin around the object within which contacts will be generated. + Use it to avoid numerical precision issues. + + This is dependant on the scale of the users world, but should be a small, positive + non zero value. + + Default: 0.1 + */ + PxF32 contactOffset; + + /** + \brief Defines the maximum height of an obstacle which the character can climb. + + A small value will mean that the character gets stuck and cannot walk up stairs etc, + a value which is too large will mean that the character can climb over unrealistically + high obstacles. + + Default: 0.5 + + \see upDirection + */ + PxF32 stepOffset; + + /** + \brief Density of underlying kinematic actor + + The CCT creates a PhysX's kinematic actor under the hood. This controls its density. + + Default: 10.0 + */ + PxF32 density; + + /** + \brief Scale coefficient for underlying kinematic actor + + The CCT creates a PhysX's kinematic actor under the hood. This controls its scale factor. + This should be a number a bit smaller than 1.0. + + This scale factor affects how the character interacts with dynamic rigid bodies around it (e.g. pushing them, etc). + + With a scale factor < 1, the underlying kinematic actor will not touch surrounding rigid bodies - they will + only interact with the character controller's shapes (capsules or boxes), and users will have full control + over the interactions (i.e. they will have to push the objects with explicit forces themselves). + + With a scale factor >=1, the underlying kinematic actor will touch and push surrounding rigid bodies based + on PhysX's computations, as if there would be no character controller involved. This works fine except + when you push objects into a wall. PhysX has no control over kinematic actors (since they are kinematic) + so they would freely push dynamic objects into walls, and make them tunnel / explode / behave badly. + + With a smaller kinematic actor however, the character controller's swept shape touches dynamic rigid bodies + first, and can apply forces to them to move them away (or not, depending on what the gameplay needs). + Meanwhile the character controller's swept shape itself is stopped by these dynamic bodies. + + Setting the scale factor to 1 could still work, but it is unreliable. Depending on FPU accuracy you could + end up with either the CCT's volume or the underlying kinematic actor touching the dynamic bodies first, + and this could change from one moment to the next. + + Default: 0.8 + */ + PxF32 scaleCoeff; + + /** + \brief Cached volume growth + + Amount of space around the controller we cache to improve performance. This is a scale factor + that should be higher than 1.0f but not too big, ideally lower than 2.0f. + + Default: 1.5 + */ + PxF32 volumeGrowth; + + /** + \brief Specifies a user report callback. + + This report callback is called when the character collides with shapes and other characters. + + Setting this to NULL disables the callback. + + Default: NULL + + \see PxUserControllerHitReport + */ + PxUserControllerHitReport* reportCallback; + + /** + \brief Specifies a user behavior callback. + + This behavior callback is called to customize the controller's behavior w.r.t. touched shapes. + + Setting this to NULL disables the callback. + + Default: NULL + + \see PxControllerBehaviorCallback + */ + PxControllerBehaviorCallback* behaviorCallback; + + /** + \brief The non-walkable mode controls if a character controller slides or not on a non-walkable part. + + This is only used when slopeLimit is non zero. + + Default: PxControllerNonWalkableMode::ePREVENT_CLIMBING + + \see PxControllerNonWalkableMode + */ + PxControllerNonWalkableMode::Enum nonWalkableMode; + + /** + \brief The material for the actor associated with the controller. + + The controller internally creates a rigid body actor. This parameter specifies the material of the actor. + + Default: NULL + + \see PxMaterial + */ + PxMaterial* material; + + /** + \brief Use a deletion listener to get informed about released objects and clear internal caches if needed. + + If a character controller registers a deletion listener, it will get informed about released objects. That allows the + controller to invalidate cached data that connects to a released object. If a deletion listener is not + registered, PxController::invalidateCache has to be called manually after objects have been released. + + \see PxController::invalidateCache + + Default: true + */ + bool registerDeletionListener; + + /** + \brief Client ID for associated actor. + + \see PxClientID PxActor::setOwnerClient + + Default: PX_DEFAULT_CLIENT + */ + PxClientID clientID; + + /** + \brief User specified data associated with the controller. + + Default: NULL + */ + void* userData; + +protected: + const PxControllerShapeType::Enum mType; //!< The type of the controller. This gets set by the derived class' ctor, the user should not have to change it. + + /** + \brief constructor sets to default. + */ + PX_INLINE PxControllerDesc(PxControllerShapeType::Enum); + PX_INLINE virtual ~PxControllerDesc(); + + /** + \brief copy constructor. + */ + PX_INLINE PxControllerDesc(const PxControllerDesc&); + + /** + \brief assignment operator. + */ + PX_INLINE PxControllerDesc& operator=(const PxControllerDesc&); + + PX_INLINE void copy(const PxControllerDesc&); +}; + +PX_INLINE PxControllerDesc::PxControllerDesc(PxControllerShapeType::Enum t) : + position (PxExtended(0.0), PxExtended(0.0), PxExtended(0.0)), + upDirection (0.0f, 1.0f, 0.0f), + slopeLimit (0.707f), + invisibleWallHeight (0.0f), + maxJumpHeight (0.0f), + contactOffset (0.1f), + stepOffset (0.5f), + density (10.0f), + scaleCoeff (0.8f), + volumeGrowth (1.5f), + reportCallback (NULL), + behaviorCallback (NULL), + nonWalkableMode (PxControllerNonWalkableMode::ePREVENT_CLIMBING), + material (NULL), + registerDeletionListener (true), + clientID (PX_DEFAULT_CLIENT), + userData (NULL), + mType (t) +{ +} + +PX_INLINE PxControllerDesc::PxControllerDesc(const PxControllerDesc& other) : mType(other.mType) +{ + copy(other); +} + +PX_INLINE PxControllerDesc& PxControllerDesc::operator=(const PxControllerDesc& other) +{ + copy(other); + return *this; +} + +PX_INLINE void PxControllerDesc::copy(const PxControllerDesc& other) +{ + upDirection = other.upDirection; + slopeLimit = other.slopeLimit; + contactOffset = other.contactOffset; + stepOffset = other.stepOffset; + density = other.density; + scaleCoeff = other.scaleCoeff; + volumeGrowth = other.volumeGrowth; + reportCallback = other.reportCallback; + behaviorCallback = other.behaviorCallback; + userData = other.userData; + nonWalkableMode = other.nonWalkableMode; + position.x = other.position.x; + position.y = other.position.y; + position.z = other.position.z; + material = other.material; + invisibleWallHeight = other.invisibleWallHeight; + maxJumpHeight = other.maxJumpHeight; + registerDeletionListener = other.registerDeletionListener; + clientID = other.clientID; +} + +PX_INLINE PxControllerDesc::~PxControllerDesc() +{ +} + +PX_INLINE bool PxControllerDesc::isValid() const +{ + if( mType!=PxControllerShapeType::eBOX + && mType!=PxControllerShapeType::eCAPSULE) + return false; + if(scaleCoeff<0.0f) + return false; + if(volumeGrowth<1.0f) + return false; + if(density<0.0f) + return false; + if(slopeLimit<0.0f) + return false; + if(stepOffset<0.0f) + return false; + if(contactOffset<=0.0f) + return false; + if(!material) + return false; + if(!toVec3(position).isFinite()) + return false; //the float version needs to be finite otherwise actor creation will fail. + + return true; +} + + +/** +\brief Base class for character controllers. + +\see PxCapsuleController PxBoxController +*/ +class PxController +{ +public: + /** + \brief Return the type of controller + + \see PxControllerType + */ + virtual PxControllerShapeType::Enum getType() const = 0; + + /** + \brief Releases the controller. + */ + virtual void release() = 0; + + /** + \brief Moves the character using a "collide-and-slide" algorithm. + + \param[in] disp Displacement vector + \param[in] minDist The minimum travelled distance to consider. If travelled distance is smaller, the character doesn't move. + This is used to stop the recursive motion algorithm when remaining distance to travel is small. + \param[in] elapsedTime Time elapsed since last call + \param[in] filters User-defined filters for this move + \param[in] obstacles Potential additional obstacles the CCT should collide with. + \return Collision flags, collection of ::PxControllerCollisionFlags + */ + virtual PxControllerCollisionFlags move(const PxVec3& disp, PxF32 minDist, PxF32 elapsedTime, const PxControllerFilters& filters, const PxObstacleContext* obstacles=NULL) = 0; + + /** + \brief Sets controller's position. + + The position controlled by this function is the center of the collision shape. + + \warning This is a 'teleport' function, it doesn't check for collisions. + \warning The character's position must be such that it does not overlap the static geometry. + + To move the character under normal conditions use the #move() function. + + \param[in] position The new (center) positon for the controller. + \return Currently always returns true. + + \see PxControllerDesc.position getPosition() getFootPosition() setFootPosition() move() + */ + virtual bool setPosition(const PxExtendedVec3& position) = 0; + + /** + \brief Retrieve the raw position of the controller. + + The position retrieved by this function is the center of the collision shape. To retrieve the bottom position of the shape, + a.k.a. the foot position, use the getFootPosition() function. + + The position is updated by calls to move(). Calling this method without calling + move() will return the last position or the initial position of the controller. + + \return The controller's center position + + \see PxControllerDesc.position setPosition() getFootPosition() setFootPosition() move() + */ + virtual const PxExtendedVec3& getPosition() const = 0; + + /** + \brief Set controller's foot position. + + The position controlled by this function is the bottom of the collision shape, a.k.a. the foot position. + + \note The foot position takes the contact offset into account + + \warning This is a 'teleport' function, it doesn't check for collisions. + + To move the character under normal conditions use the #move() function. + + \param[in] position The new (bottom) positon for the controller. + \return Currently always returns true. + + \see PxControllerDesc.position setPosition() getPosition() getFootPosition() move() + */ + virtual bool setFootPosition(const PxExtendedVec3& position) = 0; + + /** + \brief Retrieve the "foot" position of the controller, i.e. the position of the bottom of the CCT's shape. + + \note The foot position takes the contact offset into account + + \return The controller's foot position + + \see PxControllerDesc.position setPosition() getPosition() setFootPosition() move() + */ + virtual PxExtendedVec3 getFootPosition() const = 0; + + /** + \brief Get the rigid body actor associated with this controller (see PhysX documentation). + The behavior upon manually altering this actor is undefined, you should primarily + use it for reading const properties. + + \return the actor associated with the controller. + */ + virtual PxRigidDynamic* getActor() const = 0; + + /** + \brief The step height. + + \param[in] offset The new step offset for the controller. + + \see PxControllerDesc.stepOffset + */ + virtual void setStepOffset(const PxF32 offset) =0; + + /** + \brief Retrieve the step height. + + \return The step offset for the controller. + + \see setStepOffset() + */ + virtual PxF32 getStepOffset() const =0; + + /** + \brief Sets the non-walkable mode for the CCT. + + \param[in] flag The new value of the non-walkable mode. + + \see PxControllerNonWalkableMode + */ + virtual void setNonWalkableMode(PxControllerNonWalkableMode::Enum flag) = 0; + + /** + \brief Retrieves the non-walkable mode for the CCT. + + \return The current non-walkable mode. + + \see PxControllerNonWalkableMode + */ + virtual PxControllerNonWalkableMode::Enum getNonWalkableMode() const = 0; + + /** + \brief Retrieve the contact offset. + + \return The contact offset for the controller. + + \see PxControllerDesc.contactOffset + */ + virtual PxF32 getContactOffset() const =0; + + /** + \brief Sets the contact offset. + + \param[in] offset The contact offset for the controller. + + \see PxControllerDesc.contactOffset + */ + virtual void setContactOffset(PxF32 offset) =0; + + /** + \brief Retrieve the 'up' direction. + + \return The up direction for the controller. + + \see PxControllerDesc.upDirection + */ + virtual PxVec3 getUpDirection() const =0; + + /** + \brief Sets the 'up' direction. + + \param[in] up The up direction for the controller. + + \see PxControllerDesc.upDirection + */ + virtual void setUpDirection(const PxVec3& up) =0; + + /** + \brief Retrieve the slope limit. + + \return The slope limit for the controller. + + \see PxControllerDesc.slopeLimit + */ + virtual PxF32 getSlopeLimit() const =0; + + /** + \brief Sets the slope limit. + + \note This feature can not be enabled at runtime, i.e. if the slope limit is zero when creating the CCT + (which disables the feature) then changing the slope limit at runtime will not have any effect, and the call + will be ignored. + + \param[in] slopeLimit The slope limit for the controller. + + \see PxControllerDesc.slopeLimit + */ + virtual void setSlopeLimit(PxF32 slopeLimit) =0; + + /** + \brief Flushes internal geometry cache. + + The character controller uses caching in order to speed up collision testing. The cache is + automatically flushed when a change to static objects is detected in the scene. For example when a + static shape is added, updated, or removed from the scene, the cache is automatically invalidated. + + However there may be situations that cannot be automatically detected, and those require manual + invalidation of the cache. Currently the user must call this when the filtering behavior changes (the + PxControllerFilters parameter of the PxController::move call). While the controller in principle + could detect a change in these parameters, it cannot detect a change in the behavior of the filtering + function. + + \see PxController.move + */ + virtual void invalidateCache() = 0; + + /** + \brief Retrieve the scene associated with the controller. + + \return The physics scene + */ + virtual PxScene* getScene() = 0; + + /** + \brief Returns the user data associated with this controller. + + \return The user pointer associated with the controller. + + \see PxControllerDesc.userData + */ + virtual void* getUserData() const = 0; + + /** + \brief Sets the user data associated with this controller. + + \param[in] userData The user pointer associated with the controller. + + \see PxControllerDesc.userData + */ + virtual void setUserData(void* userData) = 0; + + /** + \brief Returns information about the controller's internal state. + + \param[out] state The controller's internal state + + \see PxControllerState + */ + virtual void getState(PxControllerState& state) const = 0; + + /** + \brief Returns the controller's internal statistics. + + \param[out] stats The controller's internal statistics + + \see PxControllerStats + */ + virtual void getStats(PxControllerStats& stats) const = 0; + + /** + \brief Resizes the controller. + + This function attempts to resize the controller to a given size, while making sure the bottom + position of the controller remains constant. In other words the function modifies both the + height and the (center) position of the controller. This is a helper function that can be used + to implement a 'crouch' functionality for example. + + \param[in] height Desired controller's height + */ + virtual void resize(PxReal height) = 0; + +protected: + PX_INLINE PxController() {} + virtual ~PxController() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/characterkinematic/PxControllerBehavior.h b/engine/third_party/physx/include/characterkinematic/PxControllerBehavior.h new file mode 100644 index 00000000..0bb3cd59 --- /dev/null +++ b/engine/third_party/physx/include/characterkinematic/PxControllerBehavior.h @@ -0,0 +1,125 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CONTROLLER_BEHAVIOR_H +#define PX_CONTROLLER_BEHAVIOR_H + +#include "PxFiltering.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxShape; + class PxObstacle; + class PxController; + + /** + \brief specifies controller behavior + */ + struct PxControllerBehaviorFlag + { + enum Enum + { + eCCT_CAN_RIDE_ON_OBJECT = (1<<0), //!< Controller can ride on touched object (i.e. when this touched object is moving horizontally). \note The CCT vs. CCT case is not supported. + eCCT_SLIDE = (1<<1), //!< Controller should slide on touched object + eCCT_USER_DEFINED_RIDE = (1<<2) //!< Disable all code dealing with controllers riding on objects, let users define it outside of the SDK. + }; + }; + + /** + \brief Bitfield that contains a set of raised flags defined in PxControllerBehaviorFlag. + + \see PxControllerBehaviorFlag + */ + typedef PxFlags PxControllerBehaviorFlags; + PX_FLAGS_OPERATORS(PxControllerBehaviorFlag::Enum, PxU8) + + /** + \brief User behavior callback. + + This behavior callback is called to customize the controller's behavior w.r.t. touched shapes. + */ + class PxControllerBehaviorCallback + { + public: + /** + \brief Retrieve behavior flags for a shape. + + When the CCT touches a shape, the CCT's behavior w.r.t. this shape can be customized by users. + This function retrieves the desired PxControllerBehaviorFlag flags capturing the desired behavior. + + \param[in] shape The shape the CCT is currently touching + \param[in] actor The actor owning the shape + + \return Desired behavior flags for the given shape + + \see PxControllerBehaviorFlag + */ + virtual PxControllerBehaviorFlags getBehaviorFlags(const PxShape& shape, const PxActor& actor) = 0; + + /** + \brief Retrieve behavior flags for a controller. + + When the CCT touches a controller, the CCT's behavior w.r.t. this controller can be customized by users. + This function retrieves the desired PxControllerBehaviorFlag flags capturing the desired behavior. + + \note The flag PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT is not supported. + + \param[in] controller The controller the CCT is currently touching + + \return Desired behavior flags for the given controller + + \see PxControllerBehaviorFlag + */ + virtual PxControllerBehaviorFlags getBehaviorFlags(const PxController& controller) = 0; + + /** + \brief Retrieve behavior flags for an obstacle. + + When the CCT touches an obstacle, the CCT's behavior w.r.t. this obstacle can be customized by users. + This function retrieves the desired PxControllerBehaviorFlag flags capturing the desired behavior. + + \param[in] obstacle The obstacle the CCT is currently touching + + \return Desired behavior flags for the given obstacle + + \see PxControllerBehaviorFlag + */ + virtual PxControllerBehaviorFlags getBehaviorFlags(const PxObstacle& obstacle) = 0; + + protected: + virtual ~PxControllerBehaviorCallback(){} + }; + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/engine/third_party/physx/include/characterkinematic/PxControllerManager.h b/engine/third_party/physx/include/characterkinematic/PxControllerManager.h new file mode 100644 index 00000000..70198bb6 --- /dev/null +++ b/engine/third_party/physx/include/characterkinematic/PxControllerManager.h @@ -0,0 +1,296 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CONTROLLER_MANAGER_H +#define PX_CONTROLLER_MANAGER_H + +#include "PxPhysXConfig.h" +#include "foundation/PxFlags.h" +#include "foundation/PxErrorCallback.h" +#include "common/PxRenderBuffer.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxPhysics; +class PxScene; +class PxController; +class PxControllerDesc; +class PxObstacleContext; +class PxControllerFilterCallback; + +/** +\brief specifies debug-rendering flags +*/ +struct PxControllerDebugRenderFlag +{ + enum Enum + { + eTEMPORAL_BV = (1<<0), //!< Temporal bounding volume around controllers + eCACHED_BV = (1<<1), //!< Cached bounding volume around controllers + eOBSTACLES = (1<<2), //!< User-defined obstacles + + eNONE = 0, + eALL = 0xffffffff + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxControllerDebugRenderFlag. + +\see PxControllerDebugRenderFlag +*/ +typedef PxFlags PxControllerDebugRenderFlags; +PX_FLAGS_OPERATORS(PxControllerDebugRenderFlag::Enum, PxU32) + + +/** +\brief Manages an array of character controllers. + +\see PxController PxBoxController PxCapsuleController +*/ +class PxControllerManager +{ +public: + /** + \brief Releases the controller manager. + + \note This will release all associated controllers and obstacle contexts. + + \note This function is required to be called to release foundation usage. + + */ + virtual void release() = 0; + + /** + \brief Returns the scene the manager is adding the controllers to. + + \return The associated physics scene. + */ + virtual PxScene& getScene() const = 0; + + /** + \brief Returns the number of controllers that are being managed. + + \return The number of controllers. + */ + virtual PxU32 getNbControllers() const = 0; + + /** + \brief Retrieve one of the controllers in the manager. + + \param index the index of the controller to return + \return The controller with the specified index. + */ + virtual PxController* getController(PxU32 index) = 0; + + /** + \brief Creates a new character controller. + + \param[in] desc The controllers descriptor + \return The new controller + + \see PxController PxController.release() PxControllerDesc + */ + virtual PxController* createController(const PxControllerDesc& desc) = 0; + + /** + \brief Releases all the controllers that are being managed. + */ + virtual void purgeControllers() = 0; + + /** + \brief Retrieves debug data. + + \return The render buffer filled with debug-render data + + \see PxControllerManager.setDebugRenderingFlags() + */ + virtual PxRenderBuffer& getRenderBuffer() = 0; + + /** + \brief Sets debug rendering flags + + \param[in] flags The debug rendering flags (combination of PxControllerDebugRenderFlags) + + \see PxControllerManager.getRenderBuffer() PxControllerDebugRenderFlags + */ + virtual void setDebugRenderingFlags(PxControllerDebugRenderFlags flags) = 0; + + /** + \brief Returns the number of obstacle contexts that are being managed. + + \return The number of obstacle contexts. + */ + virtual PxU32 getNbObstacleContexts() const = 0; + + /** + \brief Retrieve one of the obstacle contexts in the manager. + + \param index The index of the obstacle context to retrieve. + \return The obstacle context with the specified index. + */ + virtual PxObstacleContext* getObstacleContext(PxU32 index) = 0; + + /** + \brief Creates an obstacle context. + + \return New obstacle context + + \see PxObstacleContext + */ + virtual PxObstacleContext* createObstacleContext() = 0; + + /** + \brief Computes character-character interactions. + + This function is an optional helper to properly resolve interactions between characters, in case they overlap (which can happen for gameplay reasons, etc). + + You should call this once per frame, before your PxController::move() calls. The function will not move the characters directly, but it will + compute overlap information for each character that will be used in the next move() call. + + You need to provide a proper time value here so that interactions are resolved in a way that do not depend on the framerate. + + If you only have one character in the scene, or if you can guarantee your characters will never overlap, then you do not need to call this function. + + \note Releasing the manager will automatically release all the associated obstacle contexts. + + \param[in] elapsedTime Elapsed time since last call + \param[in] cctFilterCb Filtering callback for CCT-vs-CCT interactions + */ + virtual void computeInteractions(PxF32 elapsedTime, PxControllerFilterCallback* cctFilterCb=NULL) = 0; + + /** + \brief Enables or disables runtime tessellation. + + Large triangles can create accuracy issues in the sweep code, which in turn can lead to characters not sliding smoothly + against geometries, or even penetrating them. This feature allows one to reduce those issues by tessellating large + triangles at runtime, before performing sweeps against them. The amount of tessellation is controlled by the 'maxEdgeLength' parameter. + Any triangle with at least one edge length greater than the maxEdgeLength will get recursively tessellated, until resulting triangles are small enough. + + This features only applies to triangle meshes, convex meshes, heightfields and boxes. + + \param[in] flag True/false to enable/disable runtime tessellation. + \param[in] maxEdgeLength Max edge length allowed before tessellation kicks in. + */ + virtual void setTessellation(bool flag, float maxEdgeLength) = 0; + + /** + \brief Enables or disables the overlap recovery module. + + The overlap recovery module can be used to depenetrate CCTs from static objects when an overlap is detected. This can happen + in three main cases: + - when the CCT is directly spawned or teleported in another object + - when the CCT algorithm fails due to limited FPU accuracy + - when the "up vector" is modified, making the rotated CCT shape overlap surrounding objects + + When activated, the CCT module will automatically try to resolve the penetration, and move the CCT to a safe place where it does + not overlap other objects anymore. This only concerns static objects, dynamic objects are ignored by the recovery module. + + When the recovery module is not activated, it is possible for the CCTs to go through static objects. By default, the recovery + module is enabled. + + The recovery module currently works with all geometries except heightfields. + + \param[in] flag True/false to enable/disable overlap recovery module. + */ + virtual void setOverlapRecoveryModule(bool flag) = 0; + + /** + \brief Enables or disables the precise sweeps. + + Precise sweeps are more accurate, but also potentially slower than regular sweeps. + + By default, precise sweeps are enabled. + + \param[in] flag True/false to enable/disable precise sweeps. + */ + virtual void setPreciseSweeps(bool flag) = 0; + + /** + \brief Enables or disables vertical sliding against ceilings. + + Geometry is seen as "ceilings" when the following condition is met: + + dot product(contact normal, up direction)<0.0f + + This flag controls whether characters should slide vertically along the geometry in that case. + + By default, sliding is allowed. + + \param[in] flag True/false to enable/disable sliding. + */ + virtual void setPreventVerticalSlidingAgainstCeiling(bool flag) = 0; + + /** + \brief Shift the origin of the character controllers and obstacle objects by the specified vector. + + The positions of all character controllers, obstacle objects and the corresponding data structures will get adjusted to reflect the shifted origin location + (the shift vector will get subtracted from all character controller and obstacle object positions). + + \note It is the user's responsibility to keep track of the summed total origin shift and adjust all input/output to/from PhysXCharacterKinematic accordingly. + + \note This call will not automatically shift the PhysX scene and its objects. You need to call PxScene::shiftOrigin() separately to keep the systems in sync. + + \param[in] shift Translation vector to shift the origin by. + */ + virtual void shiftOrigin(const PxVec3& shift) = 0; + +protected: + PxControllerManager() {} + virtual ~PxControllerManager() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** + \brief Creates the controller manager. + + \param[in] scene PhysX scene. You can only create one PxControllerManager per scene. + \param[in] lockingEnabled Enables/disables internal locking. + + \return New controller manager, or NULL in case of failure (e.g. when a manager has already been created for that scene) + + The character controller is informed by #PxDeletionListener::onRelease() when actors or shapes are released, and updates its internal + caches accordingly. If character controller movement or a call to #PxControllerManager::shiftOrigin() may overlap with actor/shape releases, + internal data structures must be guarded against concurrent access. + + Locking guarantees thread safety in such scenarios. + + \note locking may result in significant slowdown for release of actors or shapes. + + By default, locking is disabled. + */ +PX_C_EXPORT physx::PxControllerManager* PX_CALL_CONV PxCreateControllerManager(physx::PxScene& scene, bool lockingEnabled = false); + +#endif + diff --git a/engine/third_party/physx/include/characterkinematic/PxControllerObstacles.h b/engine/third_party/physx/include/characterkinematic/PxControllerObstacles.h new file mode 100644 index 00000000..1095725f --- /dev/null +++ b/engine/third_party/physx/include/characterkinematic/PxControllerObstacles.h @@ -0,0 +1,186 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CONTROLLER_OBSTACLES_H +#define PX_CONTROLLER_OBSTACLES_H + +#include "characterkinematic/PxExtended.h" +#include "geometry/PxGeometry.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxControllerManager; + + #define PX_INVALID_OBSTACLE_HANDLE 0xffffffff + + /** + \brief Base class for obstacles. + + \see PxBoxObstacle PxCapsuleObstacle PxObstacleContext + */ + class PxObstacle + { + protected: + PxObstacle() : + mType (PxGeometryType::eINVALID), + mUserData (NULL), + mPos (0.0, 0.0, 0.0), + mRot (PxQuat(PxIdentity)) + {} + + PxGeometryType::Enum mType; + public: + + PX_FORCE_INLINE PxGeometryType::Enum getType() const { return mType; } + + void* mUserData; + PxExtendedVec3 mPos; + PxQuat mRot; + }; + + /** + \brief A box obstacle. + + \see PxObstacle PxCapsuleObstacle PxObstacleContext + */ + class PxBoxObstacle : public PxObstacle + { + public: + PxBoxObstacle() : + mHalfExtents(0.0f) + { mType = PxGeometryType::eBOX; } + + PxVec3 mHalfExtents; + }; + + /** + \brief A capsule obstacle. + + \see PxBoxObstacle PxObstacle PxObstacleContext + */ + class PxCapsuleObstacle : public PxObstacle + { + public: + PxCapsuleObstacle() : + mHalfHeight (0.0f), + mRadius (0.0f) + { mType = PxGeometryType::eCAPSULE; } + + PxReal mHalfHeight; + PxReal mRadius; + }; + + typedef PxU32 PxObstacleHandle; + + /** + \brief Context class for obstacles. + + An obstacle context class contains and manages a set of user-defined obstacles. + + \see PxBoxObstacle PxCapsuleObstacle PxObstacle + */ + class PxObstacleContext + { + public: + PxObstacleContext() {} + virtual ~PxObstacleContext() {} + + /** + \brief Releases the context. + */ + virtual void release() = 0; + + /** + \brief Retrieves the controller manager associated with this context. + + \return The associated controller manager + */ + virtual PxControllerManager& getControllerManager() const = 0; + + /** + \brief Adds an obstacle to the context. + + \param [in] obstacle Obstacle data for the new obstacle. The data gets copied. + + \return Handle for newly-added obstacle + */ + virtual PxObstacleHandle addObstacle(const PxObstacle& obstacle) = 0; + + /** + \brief Removes an obstacle from the context. + + \param [in] handle Handle for the obstacle object that needs to be removed. + + \return True if success + */ + virtual bool removeObstacle(PxObstacleHandle handle) = 0; + + /** + \brief Updates data for an existing obstacle. + + \param [in] handle Handle for the obstacle object that needs to be updated. + \param [in] obstacle New obstacle data + + \return True if success + */ + virtual bool updateObstacle(PxObstacleHandle handle, const PxObstacle& obstacle) = 0; + + /** + \brief Retrieves number of obstacles in the context. + + \return Number of obstacles in the context + */ + virtual PxU32 getNbObstacles() const = 0; + + /** + \brief Retrieves desired obstacle. + + \param [in] i Obstacle index + + \return Desired obstacle + */ + virtual const PxObstacle* getObstacle(PxU32 i) const = 0; + + /** + \brief Retrieves desired obstacle by given handle. + + \param [in] handle Obstacle handle + + \return Desired obstacle + */ + virtual const PxObstacle* getObstacleByHandle(PxObstacleHandle handle) const = 0; + }; + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/engine/third_party/physx/include/characterkinematic/PxExtended.h b/engine/third_party/physx/include/characterkinematic/PxExtended.h new file mode 100644 index 00000000..dc24107e --- /dev/null +++ b/engine/third_party/physx/include/characterkinematic/PxExtended.h @@ -0,0 +1,82 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_EXTENDED_H +#define PX_EXTENDED_H + +// This needs to be included in Foundation just for the debug renderer + +#include "PxPhysXConfig.h" +#include "foundation/PxTransform.h" +#include "foundation/PxAssert.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +// This has to be done here since it also changes the top-level "Px" and "Np" APIs +#define PX_BIG_WORLDS + +#ifdef PX_BIG_WORLDS + typedef PxVec3d PxExtendedVec3; + typedef double PxExtended; + #define PX_MAX_EXTENDED PX_MAX_F64 + + PX_FORCE_INLINE PxVec3 toVec3(const PxExtendedVec3& v) + { + return PxVec3(float(v.x), float(v.y), float(v.z)); + } + + // Computes the single-precision difference between two extended-precision points + PX_INLINE PxVec3 diff(const PxExtendedVec3& p1, const PxExtendedVec3& p0) + { + return PxVec3(float(p1.x - p0.x), float(p1.y - p0.y), float(p1.z - p0.z)); + } +#else + typedef PxVec3 PxExtendedVec3; + typedef float PxExtended; + #define PX_MAX_EXTENDED PX_MAX_F32 + + PX_FORCE_INLINE PxVec3 toVec3(const PxExtendedVec3& v) + { + return v; + } + + // Computes the single-precision difference between two extended-precision points + PX_INLINE PxVec3 diff(const PxExtendedVec3& p1, const PxExtendedVec3& p0) + { + return p1 - p0; + } +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/collision/PxCollisionDefs.h b/engine/third_party/physx/include/collision/PxCollisionDefs.h new file mode 100644 index 00000000..d2cfe71c --- /dev/null +++ b/engine/third_party/physx/include/collision/PxCollisionDefs.h @@ -0,0 +1,92 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_COLLISION_DEFS_H +#define PX_COLLISION_DEFS_H + +#include "PxPhysXConfig.h" +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief A callback class to allocate memory to cache information used in contact generation. +*/ +class PxCacheAllocator +{ +public: + /** + \brief Allocates cache data for contact generation. This data is stored inside PxCache objects. + The application can retain and provide this information for future contact generation passes + for a given pair to improve contact generation performance. It is the application's responsibility + to release this memory appropriately. If the memory is released, the application must ensure that + this memory is no longer referenced by any PxCache objects passed to PxGenerateContacts. + + \param byteSize [in] size of the allocation in bytes + + \return the newly-allocated memory. The returned address must be 16-byte aligned. + + \see PxCache, PxGenerateContacts + */ + virtual PxU8* allocateCacheData(const PxU32 byteSize) = 0; + + virtual ~PxCacheAllocator() {} +}; + +/** +\brief A structure to cache contact information produced by low-level contact generation functions. +*/ +struct PxCache +{ + PxU8* mCachedData; //!< Cached data pointer. Allocated via PxCacheAllocator + PxU16 mCachedSize; //!< The total size of the cached data + PxU8 mPairData; //!< Pair data information used and cached internally by some contact generation functions to accelerate performance. + PxU8 mManifoldFlags; //!< Manifold flags used to identify the format the cached data is stored in. + + PX_FORCE_INLINE PxCache() : mCachedData(NULL), mCachedSize(0), mPairData(0), mManifoldFlags(0) + { + } + + PX_FORCE_INLINE void reset() + { + mCachedData = NULL; + mCachedSize = 0; + mPairData = 0; + mManifoldFlags = 0; + } +}; + +#if !PX_DOXYGEN +} +#endif + +#endif + diff --git a/engine/third_party/physx/include/common/PxBase.h b/engine/third_party/physx/include/common/PxBase.h new file mode 100644 index 00000000..69f5c9a4 --- /dev/null +++ b/engine/third_party/physx/include/common/PxBase.h @@ -0,0 +1,236 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_H +#define PX_BASE_H + + +#include "foundation/PxFlags.h" +#include "foundation/PxString.h" +#include "foundation/PxFoundation.h" +#include "common/PxSerialFramework.h" +#include "common/PxCollection.h" +#include "common/PxTypeInfo.h" +#include "foundation/PxAssert.h" + +#define PX_IS_KIND_OF(query, classname, baseclass) \ + PX_ASSERT(query != NULL); \ + if(query == NULL) \ + { \ + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "isKindOf called with invalid string"); \ + return false; \ + } \ + return !Pxstrcmp(classname, query) || baseclass::isKindOf(query) + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +typedef PxU16 PxType; + +/** +\brief Flags for PxBase. +*/ +struct PxBaseFlag +{ + enum Enum + { + eOWNS_MEMORY = (1<<0), + eIS_RELEASABLE = (1<<1) + }; +}; + +typedef PxFlags PxBaseFlags; +PX_FLAGS_OPERATORS(PxBaseFlag::Enum, PxU16) + +/** +\brief Base class for objects that can be members of a PxCollection. + +All PxBase sub-classes can be serialized. + +\see PxCollection +*/ +class PxBase +{ +public: + /** + \brief Releases the PxBase instance, please check documentation of release in derived class. + */ + virtual void release() = 0; + + /** + \brief Returns string name of dynamic type. + \return Class name of most derived type of this object. + */ + virtual const char* getConcreteTypeName() const = 0; + + /* brief Implements dynamic cast functionality. + + Example use: + + if(actor->is()) {...} + + \return A pointer to the specified type if object matches, otherwise NULL + */ + template T* is() { return typeMatch() ? static_cast(this) : NULL; } + + /* brief Implements dynamic cast functionality for const objects. + + Example use: + + if(actor->is()) {...} + + \return A pointer to the specified type if object matches, otherwise NULL + */ + template const T* is() const { return typeMatch() ? static_cast(this) : NULL; } + + /** + \brief Returns concrete type of object. + \return PxConcreteType::Enum of serialized object + + \see PxConcreteType + */ + PX_FORCE_INLINE PxType getConcreteType() const { return mConcreteType; } + + /** + \brief Set PxBaseFlag + + \param[in] flag The flag to be set + \param[in] value The flags new value + */ + PX_FORCE_INLINE void setBaseFlag(PxBaseFlag::Enum flag, bool value) { mBaseFlags = value ? mBaseFlags|flag : mBaseFlags&~flag; } + + /** + \brief Set PxBaseFlags + + \param[in] inFlags The flags to be set + + \see PxBaseFlags + */ + PX_FORCE_INLINE void setBaseFlags(PxBaseFlags inFlags) { mBaseFlags = inFlags; } + + /** + \brief Returns PxBaseFlags + + \return PxBaseFlags + + \see PxBaseFlags + */ + PX_FORCE_INLINE PxBaseFlags getBaseFlags() const { return mBaseFlags; } + + /** + \brief Whether the object is subordinate. + + A class is subordinate, if it can only be instantiated in the context of another class. + + \return Whether the class is subordinate + + \see PxSerialization::isSerializable + */ + virtual bool isReleasable() const { return mBaseFlags & PxBaseFlag::eIS_RELEASABLE; } + +protected: + /** + \brief Constructor setting concrete type and base flags. + */ + PX_INLINE PxBase(PxType concreteType, PxBaseFlags baseFlags) + : mConcreteType(concreteType), mBaseFlags(baseFlags), mBuiltInRefCount(1) {} + + /** + \brief Deserialization constructor setting base flags. + */ + PX_INLINE PxBase(PxBaseFlags baseFlags) : mBaseFlags(baseFlags) + { + PX_ASSERT(mBuiltInRefCount == 1); + } + /** + \brief Destructor. + */ + virtual ~PxBase() {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* superClass) const { return !Pxstrcmp(superClass, "PxBase"); } + + template bool typeMatch() const + { + return PxU32(PxTypeInfo::eFastTypeId)!=PxU32(PxConcreteType::eUNDEFINED) ? + PxU32(getConcreteType()) == PxU32(PxTypeInfo::eFastTypeId) : isKindOf(PxTypeInfo::name()); + } + +protected: + PxType mConcreteType; // concrete type identifier - see PxConcreteType. + PxBaseFlags mBaseFlags; // internal flags + PxU32 mBuiltInRefCount; +}; + +/** +\brief Base class for ref-counted objects. +*/ +class PxRefCounted : public PxBase +{ +public: + + /** + \brief Decrements the reference count of the object and releases it if the new reference count is zero. + */ + virtual void release() = 0; + + /** + \brief Returns the reference count of the object. + + At creation, the reference count of the object is 1. Every other object referencing this object increments the + count by 1. When the reference count reaches 0, and only then, the object gets destroyed automatically. + + \return the current reference count. + */ + virtual PxU32 getReferenceCount() const = 0; + + /** + \brief Acquires a counted reference to this object. + + This method increases the reference count of the object by 1. Decrement the reference count by calling release() + */ + virtual void acquireReference() = 0; + +protected: + virtual void onRefCountZero() { delete this; } + + PX_INLINE PxRefCounted(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxRefCounted(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + virtual ~PxRefCounted() {} + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxRefCounted", PxBase); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/common/PxCollection.h b/engine/third_party/physx/include/common/PxCollection.h new file mode 100644 index 00000000..ebf28a7d --- /dev/null +++ b/engine/third_party/physx/include/common/PxCollection.h @@ -0,0 +1,273 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_COLLECTION_H +#define PX_COLLECTION_H + +#include "common/PxSerialFramework.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxBase; + +/** +\brief Collection class for serialization. + +A collection is a set of PxBase objects. PxBase objects can be added to the collection +regardless of other objects they depend on. Objects may be named using PxSerialObjectId values in order +to resolve dependencies between objects of different collections. + +Serialization and deserialization only work through collections. + +A scene is typically serialized using the following steps: + + -# create a serialization registry + -# create a collection for scene objects + -# complete the scene objects (adds all dependent objects, e.g. meshes) + -# serialize collection + -# release collection + -# release serialization registry + +For example the code may look like this: + +\code + PxPhysics* physics; // The physics + PxScene* scene; // The physics scene + SerialStream s; // The user-defined stream doing the actual write to disk + + PxSerializationRegistry* registry = PxSerialization::createSerializationRegistry(*physics); // step 1) + PxCollection* collection = PxSerialization::createCollection(*scene); // step 2) + PxSerialization::complete(*collection, *registry); // step 3) + PxSerialization::serializeCollectionToBinary(s, *collection, *registry); // step 4) + collection->release(); // step 5) + registry->release(); // step 6) +\endcode + +A scene is typically deserialized using the following steps: + + -# load a serialized collection into memory + -# create a serialization registry + -# create a collection by passing the serialized memory block + -# add collected objects to scene + -# release collection + -# release serialization registry + +For example the code may look like this: + +\code + PxPhysics* physics; // The physics + PxScene* scene; // The physics scene + void* memory128; // a 128-byte aligned buffer previously loaded from disk by the user - step 1) + + PxSerializationRegistry* registry = PxSerialization::createSerializationRegistry(*physics); // step 2) + PxCollection* collection = PxSerialization::createCollectionFromBinary(memory128, *registry); // step 3) + scene->addCollection(*collection); // step 4) + collection->release(); // step 5) + registry->release(); // step 6) +\endcode + +\see PxBase, PxCreateCollection() +*/ +class PxCollection +{ +public: + + /** + \brief Adds a PxBase object to the collection. + + Adds a PxBase object to the collection. Optionally a PxSerialObjectId can be provided + in order to resolve dependencies between collections. A PxSerialObjectId value of PX_SERIAL_OBJECT_ID_INVALID + means the object remains without id. Objects can be added regardless of other objects they require. If the object + is already in the collection, the ID will be set if it was PX_SERIAL_OBJECT_ID_INVALID previously, otherwise the + operation fails. + + + \param[in] object Object to be added to the collection + \param[in] id Optional PxSerialObjectId id + */ + virtual void add(PxBase& object, PxSerialObjectId id = PX_SERIAL_OBJECT_ID_INVALID) = 0; + + /** + \brief Removes a PxBase member object from the collection. + + Object needs to be contained by the collection. + + \param[in] object PxBase object to be removed + */ + virtual void remove(PxBase& object) = 0; + + /** + \brief Returns whether the collection contains a certain PxBase object. + + \param[in] object PxBase object + \return Whether object is contained. + */ + virtual bool contains(PxBase& object) const = 0; + + /** + \brief Adds an id to a member PxBase object. + + If the object is already associated with an id within the collection, the id is replaced. + May only be called for objects that are members of the collection. The id needs to be unique + within the collection. + + \param[in] object Member PxBase object + \param[in] id PxSerialObjectId id to be given to the object + */ + virtual void addId(PxBase& object, PxSerialObjectId id) = 0; + + /** + \brief Removes id from a contained PxBase object. + + May only be called for ids that are associated with an object in the collection. + + \param[in] id PxSerialObjectId value + */ + virtual void removeId(PxSerialObjectId id) = 0; + + /** + \brief Adds all PxBase objects and their ids of collection to this collection. + + PxBase objects already in this collection are ignored. Object ids need to be conflict + free, i.e. the same object may not have two different ids within the two collections. + + \param[in] collection Collection to be added + */ + virtual void add(PxCollection& collection) = 0; + + /** + \brief Removes all PxBase objects of collection from this collection. + + PxBase objects not present in this collection are ignored. Ids of objects + which are removed are also removed. + + \param[in] collection Collection to be removed + */ + virtual void remove(PxCollection& collection) = 0; + + /** + \brief Gets number of PxBase objects in this collection. + + \return Number of objects in this collection + */ + virtual PxU32 getNbObjects() const = 0; + + /** + \brief Gets the PxBase object of this collection given its index. + + \param[in] index PxBase index in [0, getNbObjects()) + \return PxBase object at index index + */ + virtual PxBase& getObject(PxU32 index) const = 0; + + /** + \brief Copies member PxBase pointers to a user specified buffer. + + \param[out] userBuffer Array of PxBase pointers + \param[in] bufferSize Capacity of userBuffer + \param[in] startIndex Offset into list of member PxBase objects + \return number of members PxBase objects that have been written to the userBuffer + */ + virtual PxU32 getObjects(PxBase** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + /** + \brief Looks for a PxBase object given a PxSerialObjectId value. + + If there is no PxBase object in the collection with the given id, NULL is returned. + + \param[in] id PxSerialObjectId value to look for + \return PxBase object with the given id value or NULL + */ + virtual PxBase* find(PxSerialObjectId id) const = 0; + + /** + \brief Gets number of PxSerialObjectId names in this collection. + + \return Number of PxSerialObjectId names in this collection + */ + virtual PxU32 getNbIds() const = 0; + + /** + \brief Copies member PxSerialObjectId values to a user specified buffer. + + \param[out] userBuffer Array of PxSerialObjectId values + \param[in] bufferSize Capacity of userBuffer + \param[in] startIndex Offset into list of member PxSerialObjectId values + \return number of members PxSerialObjectId values that have been written to the userBuffer + */ + virtual PxU32 getIds(PxSerialObjectId* userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + /** + \brief Gets the PxSerialObjectId name of a PxBase object within the collection. + + The PxBase object needs to be a member of the collection. + + \param[in] object PxBase object to get id for + \return PxSerialObjectId name of the object or PX_SERIAL_OBJECT_ID_INVALID if the object is unnamed + */ + virtual PxSerialObjectId getId(const PxBase& object) const = 0; + + /** + \brief Deletes a collection object. + + This function only deletes the collection object, i.e. the container class. It doesn't delete objects + that are part of the collection. + + \see PxCreateCollection() + */ + + virtual void release() = 0; + +protected: + PxCollection() {} + virtual ~PxCollection() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** +\brief Creates a collection object. + +Objects can only be serialized or deserialized through a collection. +For serialization, users must add objects to the collection and serialize the collection as a whole. +For deserialization, the system gives back a collection of deserialized objects to users. + +\return The new collection object. + +\see PxCollection, PxCollection::release() +*/ +PX_C_EXPORT PX_PHYSX_COMMON_API physx::PxCollection* PX_CALL_CONV PxCreateCollection(); + + +#endif diff --git a/engine/third_party/physx/include/common/PxCoreUtilityTypes.h b/engine/third_party/physx/include/common/PxCoreUtilityTypes.h new file mode 100644 index 00000000..91895701 --- /dev/null +++ b/engine/third_party/physx/include/common/PxCoreUtilityTypes.h @@ -0,0 +1,242 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CORE_UTILITY_TYPES_H +#define PX_CORE_UTILITY_TYPES_H + +#include "foundation/PxAssert.h" +#include "foundation/PxMemory.h" +#include "foundation/PxIO.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + +struct PxBoundedData +{ + /** + \brief The offset in bytes between consecutive samples in the data. + + Default: 0 + */ + const void* data; + PxU32 stride; + PxU32 count; + + PxBoundedData() : data( NULL ), stride(0), count(0) {} + + PxBoundedData(void* data_, PxU32 stride_ = 0, PxU32 count_ = 0) + : data(data_) + , stride(stride_) + , count(count_) + { + } + + template + PX_INLINE const TDataType& at( PxU32 idx ) const + { + PxU32 theStride( stride ); + if ( theStride == 0 ) + theStride = sizeof( TDataType ); + PxU32 offset( theStride * idx ); + return *(reinterpret_cast( reinterpret_cast< const PxU8* >( data ) + offset )); + } +}; + +typedef PX_DEPRECATED PxBoundedData PxStridedData; + +template +struct PxTypedBoundedData +{ + TDataType* data; + PxU32 stride; + PxU32 count; + + PxTypedBoundedData() + : data(NULL) + , stride(0) + , count(0) + { + } + + PxTypedBoundedData(TDataType* data_, PxU32 stride_ = 0, PxU32 count_ = 0) + : data(data_) + , stride(stride_) + , count(count_) + { + } + + PX_CUDA_CALLABLE PX_INLINE const TDataType& at(PxU32 idx) const + { + PxU32 theStride(stride); + if (theStride == 0) + theStride = sizeof(TDataType); + PxU32 offset(theStride * idx); + return *(reinterpret_cast(reinterpret_cast(data) + offset)); + } + + PX_CUDA_CALLABLE PX_INLINE TDataType& atRef(PxU32 idx) + { + PxU32 theStride(stride); + if (theStride == 0) + theStride = sizeof(TDataType); + PxU32 offset(theStride * idx); + return *(reinterpret_cast(reinterpret_cast(data) + offset)); + } +}; + +template +PX_DEPRECATED struct PxTypedStridedData : public PxTypedBoundedData +{ + PxTypedStridedData() : PxTypedBoundedData() + { + } + + PxTypedStridedData(TDataType* data_, PxU32 stride_ = 0) : PxTypedBoundedData(data_, stride_) + { + } +}; + +template +struct PxPadding +{ + PxU8 mPadding[TNumBytes]; + PxPadding() + { + for ( PxU8 idx =0; idx < TNumBytes; ++idx ) + mPadding[idx] = 0; + } +}; + +template class PxFixedSizeLookupTable +{ +public: + + PxFixedSizeLookupTable() + : mNbDataPairs(0) + { + } + + PxFixedSizeLookupTable(const PxEMPTY) {} + + PxFixedSizeLookupTable(const PxReal* dataPairs, const PxU32 numDataPairs) + { + PxMemCopy(mDataPairs,dataPairs,sizeof(PxReal)*2*numDataPairs); + mNbDataPairs=numDataPairs; + } + + PxFixedSizeLookupTable(const PxFixedSizeLookupTable& src) + { + PxMemCopy(mDataPairs,src.mDataPairs,sizeof(PxReal)*2*src.mNbDataPairs); + mNbDataPairs=src.mNbDataPairs; + } + + ~PxFixedSizeLookupTable() + { + } + + PxFixedSizeLookupTable& operator=(const PxFixedSizeLookupTable& src) + { + PxMemCopy(mDataPairs,src.mDataPairs,sizeof(PxReal)*2*src.mNbDataPairs); + mNbDataPairs=src.mNbDataPairs; + return *this; + } + + PX_FORCE_INLINE void addPair(const PxReal x, const PxReal y) + { + PX_ASSERT(mNbDataPairs=x0)&&(x=getX(mNbDataPairs-1)); + return getY(mNbDataPairs-1); + } + + PxU32 getNbDataPairs() const {return mNbDataPairs;} + + void clear() + { + PxMemSet(mDataPairs, 0, NB_ELEMENTS*2*sizeof(PxReal)); + mNbDataPairs = 0; + } + + PX_FORCE_INLINE PxReal getX(const PxU32 i) const + { + return mDataPairs[2*i]; + } + PX_FORCE_INLINE PxReal getY(const PxU32 i) const + { + return mDataPairs[2*i+1]; + } + + PxReal mDataPairs[2*NB_ELEMENTS]; + PxU32 mNbDataPairs; + PxU32 mPad[3]; + + +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/common/PxInsertionCallback.h b/engine/third_party/physx/include/common/PxInsertionCallback.h new file mode 100644 index 00000000..6effa512 --- /dev/null +++ b/engine/third_party/physx/include/common/PxInsertionCallback.h @@ -0,0 +1,75 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_INSERTION_CALLBACK_H +#define PX_INSERTION_CALLBACK_H + +#include "common/PxBase.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Callback interface that permits TriangleMesh, Heightfield, ConvexMesh or BVH to be used + directly without the need to store the cooking results into a stream. + + Using this is advised only if real-time cooking is required; using "offline" cooking and + streams is otherwise preferred. + + The default PxInsertionCallback implementations must be used. The PxPhysics + default callback can be obtained using the PxPhysics::getPhysicsInsertionCallback(). + The PxCooking default callback can be obtained using the PxCooking::getStandaloneInsertionCallback(). + + \see PxCooking PxPhysics + */ + class PxInsertionCallback + { + public: + PxInsertionCallback() {} + + /** + \brief Builds object (TriangleMesh, Heightfield, ConvexMesh or BVH) from given data in PxPhysics. + + \param type Object type to build. + \param data Object data + \return PxBase Created object in PxPhysics. + */ + virtual PxBase* buildObjectFromData(PxConcreteType::Enum type, void* data) = 0; + + protected: + virtual ~PxInsertionCallback() {} + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/common/PxPhysXCommonConfig.h b/engine/third_party/physx/include/common/PxPhysXCommonConfig.h new file mode 100644 index 00000000..30eefb20 --- /dev/null +++ b/engine/third_party/physx/include/common/PxPhysXCommonConfig.h @@ -0,0 +1,126 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_PHYSX_COMMON_CONFIG_H +#define PX_PHYSX_COMMON_CONFIG_H + +#include "foundation/PxSimpleTypes.h" + +//Fills almost all allocated (host and device memory) with 0xcdcdcdcd (=3452816845) +#define PX_STOMP_ALLOCATED_MEMORY 0 + +/*Disable support for VS2017 prior version 15.5.1 for windows platform, because of a compiler bug: +https://developercommunity.visualstudio.com/content/problem/66047/possible-compiler-bug.html +*/ +#if (PX_VC == 15) && PX_WINDOWS && (_MSC_FULL_VER < 191225830) +#error Visual studio 2017 prior to 15.5.1 is not supported because of a compiler bug. +#endif + +// define API function declaration (public API only needed because of extensions) +#if defined PX_PHYSX_STATIC_LIB + #define PX_PHYSX_CORE_API +#else + #if PX_WINDOWS_FAMILY + #if defined PX_PHYSX_CORE_EXPORTS + #define PX_PHYSX_CORE_API __declspec(dllexport) + #else + #define PX_PHYSX_CORE_API __declspec(dllimport) + #endif + #elif PX_UNIX_FAMILY + #define PX_PHYSX_CORE_API PX_UNIX_EXPORT + #else + #define PX_PHYSX_CORE_API + #endif +#endif + +#if PX_SUPPORT_GPU_PHYSX +// define API function declaration +#if defined PX_PHYSX_GPU_STATIC + #define PX_PHYSX_GPU_API +#else + #if PX_WINDOWS + #if defined PX_PHYSX_GPU_EXPORTS + #define PX_PHYSX_GPU_API __declspec(dllexport) + #else + #define PX_PHYSX_GPU_API __declspec(dllimport) + #endif + #elif PX_UNIX_FAMILY + #define PX_PHYSX_GPU_API PX_UNIX_EXPORT + #else + #define PX_PHYSX_GPU_API + #endif +#endif + +#else // PX_SUPPORT_GPU_PHYSX +#define PX_PHYSX_GPU_API +#endif // PX_SUPPORT_GPU_PHYSX + +#if defined PX_PHYSX_STATIC_LIB + #define PX_PHYSX_COMMON_API +#else + #if PX_WINDOWS_FAMILY && !PX_CUDA_COMPILER + #if defined PX_PHYSX_COMMON_EXPORTS + #define PX_PHYSX_COMMON_API __declspec(dllexport) + #else + #define PX_PHYSX_COMMON_API __declspec(dllimport) + #endif + #elif PX_UNIX_FAMILY + #define PX_PHYSX_COMMON_API PX_UNIX_EXPORT + #else + #define PX_PHYSX_COMMON_API + #endif +#endif + +// PT: typical "invalid" value in various CD algorithms +#define PX_INVALID_U32 0xffffffff +#define PX_INVALID_U16 0xffff + +// Changing these parameters requires recompilation of the SDK + +// Enable debug visualization +#define PX_ENABLE_DEBUG_VISUALIZATION 1 +#define PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION + +// Enable simulation statistics generation +#define PX_ENABLE_SIM_STATS 1 +#define PX_CATCH_UNDEFINED_ENABLE_SIM_STATS + +#if !PX_DOXYGEN +namespace physx +{ +#endif + typedef PxU32 PxTriangleID; + typedef PxU16 PxMaterialTableIndex; + typedef PxU16 PxDeformableMaterialTableIndex; + typedef PX_DEPRECATED PxU16 PxFEMMaterialTableIndex; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/common/PxProfileZone.h b/engine/third_party/physx/include/common/PxProfileZone.h new file mode 100644 index 00000000..a01e246d --- /dev/null +++ b/engine/third_party/physx/include/common/PxProfileZone.h @@ -0,0 +1,56 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILE_ZONE_H +#define PX_PROFILE_ZONE_H + +#include "foundation/PxProfiler.h" +#include "foundation/PxFoundation.h" + +#if PX_DEBUG || PX_CHECKED || PX_PROFILE + #define PX_PROFILE_ZONE(x, y) \ + physx::PxProfileScoped PX_CONCAT(_scoped, __LINE__)(PxGetProfilerCallback(), x, false, y) + #define PX_PROFILE_START_CROSSTHREAD(x, y) \ + if(PxGetProfilerCallback()) \ + PxGetProfilerCallback()->zoneStart(x, true, y) + #define PX_PROFILE_STOP_CROSSTHREAD(x, y) \ + if(PxGetProfilerCallback()) \ + PxGetProfilerCallback()->zoneEnd(NULL, x, true, y) + #define PX_PROFILE_VALUE(x, y, z) \ + if(PxGetProfilerCallback()) \ + PxGetProfilerCallback()->recordData(x, y, z) + #define PX_PROFILE_FRAME(x, y) \ + if(PxGetProfilerCallback()) \ + PxGetProfilerCallback()->recordFrame(x, y) +#else + #define PX_PROFILE_ZONE(x, y) + #define PX_PROFILE_START_CROSSTHREAD(x, y) + #define PX_PROFILE_STOP_CROSSTHREAD(x, y) + #define PX_PROFILE_VALUE(x, y, z) + #define PX_PROFILE_FRAME(x, y) +#endif + +#endif diff --git a/engine/third_party/physx/include/common/PxRenderBuffer.h b/engine/third_party/physx/include/common/PxRenderBuffer.h new file mode 100644 index 00000000..1ae2ef49 --- /dev/null +++ b/engine/third_party/physx/include/common/PxRenderBuffer.h @@ -0,0 +1,163 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_RENDER_BUFFER_H +#define PX_RENDER_BUFFER_H + + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVec3.h" +#include "foundation/PxMat33.h" +#include "foundation/PxBounds3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Default color values used for debug rendering. +*/ +struct PxDebugColor +{ + enum Enum + { + eARGB_BLACK = 0xff000000, + eARGB_RED = 0xffff0000, + eARGB_GREEN = 0xff00ff00, + eARGB_BLUE = 0xff0000ff, + eARGB_YELLOW = 0xffffff00, + eARGB_MAGENTA = 0xffff00ff, + eARGB_CYAN = 0xff00ffff, + eARGB_WHITE = 0xffffffff, + eARGB_GREY = 0xff808080, + eARGB_DARKRED = 0xff880000, + eARGB_DARKGREEN = 0xff008800, + eARGB_DARKBLUE = 0xff000088 + }; +}; + + +/** +\brief Used to store a single point and colour for debug rendering. +*/ +struct PxDebugPoint +{ + PxDebugPoint(const PxVec3& p, const PxU32& c) + : pos(p), color(c) {} + + PxVec3 pos; + PxU32 color; +}; + +/** +\brief Used to store a single line and colour for debug rendering. +*/ +struct PxDebugLine +{ + PxDebugLine(const PxVec3& p0, const PxVec3& p1, const PxU32& c) + : pos0(p0), color0(c), pos1(p1), color1(c) {} + + PxVec3 pos0; + PxU32 color0; + PxVec3 pos1; + PxU32 color1; +}; + +/** +\brief Used to store a single triangle and colour for debug rendering. +*/ +struct PxDebugTriangle +{ + PxDebugTriangle(const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, const PxU32& c) + : pos0(p0), color0(c), pos1(p1), color1(c), pos2(p2), color2(c) {} + + PxVec3 pos0; + PxU32 color0; + PxVec3 pos1; + PxU32 color1; + PxVec3 pos2; + PxU32 color2; +}; + +/** +\brief Used to store a text for debug rendering. Doesn't own 'string' array. +*/ +struct PxDebugText +{ + PxDebugText() : string(0) + { + } + + PxDebugText(const PxVec3& pos, const PxReal& sz, const PxU32& clr, const char* str) + : position(pos), size(sz), color(clr), string(str) + { + } + + PxVec3 position; + PxReal size; + PxU32 color; + const char* string; +}; + + +/** +\brief Interface for points, lines, triangles, and text buffer. +*/ +class PxRenderBuffer +{ +public: + virtual ~PxRenderBuffer() {} + + virtual PxU32 getNbPoints() const = 0; + virtual const PxDebugPoint* getPoints() const = 0; + virtual void addPoint(const PxDebugPoint& point) = 0; + + virtual PxU32 getNbLines() const = 0; + virtual const PxDebugLine* getLines() const = 0; + virtual void addLine(const PxDebugLine& line) = 0; + virtual PxDebugLine* reserveLines(const PxU32 nbLines) = 0; + virtual PxDebugPoint* reservePoints(const PxU32 nbLines) = 0; + + virtual PxU32 getNbTriangles() const = 0; + virtual const PxDebugTriangle* getTriangles() const = 0; + virtual void addTriangle(const PxDebugTriangle& triangle) = 0; + + virtual void append(const PxRenderBuffer& other) = 0; + virtual void clear() = 0; + + virtual void shift(const PxVec3& delta) = 0; + + virtual bool empty() const = 0; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/common/PxRenderOutput.h b/engine/third_party/physx/include/common/PxRenderOutput.h new file mode 100644 index 00000000..25d43599 --- /dev/null +++ b/engine/third_party/physx/include/common/PxRenderOutput.h @@ -0,0 +1,404 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_RENDER_OUTPUT_H +#define PX_RENDER_OUTPUT_H + +#include "foundation/PxMat44.h" +#include "foundation/PxBasicTemplates.h" +#include "PxRenderBuffer.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if PX_VC +#pragma warning(push) +#pragma warning( disable : 4251 ) // class needs to have dll-interface to be used by clients of class +#endif + + /** + Output stream to fill RenderBuffer + */ + class PxRenderOutput + { + public: + + enum Primitive + { + POINTS, + LINES, + LINESTRIP, + TRIANGLES, + TRIANGLESTRIP + }; + + PxRenderOutput(PxRenderBuffer& buffer) + : mPrim(POINTS), + mColor(0), + mVertex0(0.0f), + mVertex1(0.0f), + mVertexCount(0), + mTransform(PxIdentity), + mBuffer(buffer) + { + } + + PX_INLINE PxRenderOutput& operator<<(Primitive prim); + + PX_INLINE PxRenderOutput& operator<<(PxU32 color) ; + + PX_INLINE PxRenderOutput& operator<<(const PxMat44& transform); + + PX_INLINE PxRenderOutput& operator<<(const PxTransform& t); + + PX_INLINE PxRenderOutput& operator<<(const PxVec3& vertex); + + PX_INLINE PxDebugLine* reserveSegments(PxU32 nbSegments); + + PX_INLINE PxDebugPoint* reservePoints(PxU32 nbSegments); + + PX_INLINE void outputSegment(const PxVec3& v0, const PxVec3& v1); + + PX_INLINE PxRenderOutput& outputCapsule(PxF32 radius, PxF32 halfHeight, const PxMat44& absPose); + + private: + + PxRenderOutput& operator=(const PxRenderOutput&); + + Primitive mPrim; + PxU32 mColor; + PxVec3 mVertex0, mVertex1; + PxU32 mVertexCount; + PxMat44 mTransform; + PxRenderBuffer& mBuffer; + }; + + struct PxDebugBox + { + explicit PxDebugBox(const PxVec3& extents, bool wireframe_ = true) + : minimum(-extents), maximum(extents), wireframe(wireframe_) {} + + explicit PxDebugBox(const PxVec3& pos, const PxVec3& extents, bool wireframe_ = true) + : minimum(pos - extents), maximum(pos + extents), wireframe(wireframe_) {} + + explicit PxDebugBox(const PxBounds3& bounds, bool wireframe_ = true) + : minimum(bounds.minimum), maximum(bounds.maximum), wireframe(wireframe_) {} + + PxVec3 minimum, maximum; + bool wireframe; + }; + PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugBox& box) + { + if (box.wireframe) + { + out << PxRenderOutput::LINESTRIP; + out << PxVec3(box.minimum.x, box.minimum.y, box.minimum.z); + out << PxVec3(box.maximum.x, box.minimum.y, box.minimum.z); + out << PxVec3(box.maximum.x, box.maximum.y, box.minimum.z); + out << PxVec3(box.minimum.x, box.maximum.y, box.minimum.z); + out << PxVec3(box.minimum.x, box.minimum.y, box.minimum.z); + out << PxVec3(box.minimum.x, box.minimum.y, box.maximum.z); + out << PxVec3(box.maximum.x, box.minimum.y, box.maximum.z); + out << PxVec3(box.maximum.x, box.maximum.y, box.maximum.z); + out << PxVec3(box.minimum.x, box.maximum.y, box.maximum.z); + out << PxVec3(box.minimum.x, box.minimum.y, box.maximum.z); + out << PxRenderOutput::LINES; + out << PxVec3(box.maximum.x, box.minimum.y, box.minimum.z); + out << PxVec3(box.maximum.x, box.minimum.y, box.maximum.z); + out << PxVec3(box.maximum.x, box.maximum.y, box.minimum.z); + out << PxVec3(box.maximum.x, box.maximum.y, box.maximum.z); + out << PxVec3(box.minimum.x, box.maximum.y, box.minimum.z); + out << PxVec3(box.minimum.x, box.maximum.y, box.maximum.z); + } + else + { + out << PxRenderOutput::TRIANGLESTRIP; + out << PxVec3(box.minimum.x, box.minimum.y, box.minimum.z); // 0 + out << PxVec3(box.minimum.x, box.maximum.y, box.minimum.z); // 2 + out << PxVec3(box.maximum.x, box.minimum.y, box.minimum.z); // 1 + out << PxVec3(box.maximum.x, box.maximum.y, box.minimum.z); // 3 + out << PxVec3(box.maximum.x, box.maximum.y, box.maximum.z); // 7 + out << PxVec3(box.minimum.x, box.maximum.y, box.minimum.z); // 2 + out << PxVec3(box.minimum.x, box.maximum.y, box.maximum.z); // 6 + out << PxVec3(box.minimum.x, box.minimum.y, box.minimum.z); // 0 + out << PxVec3(box.minimum.x, box.minimum.y, box.maximum.z); // 4 + out << PxVec3(box.maximum.x, box.minimum.y, box.minimum.z); // 1 + out << PxVec3(box.maximum.x, box.minimum.y, box.maximum.z); // 5 + out << PxVec3(box.maximum.x, box.maximum.y, box.maximum.z); // 7 + out << PxVec3(box.minimum.x, box.minimum.y, box.maximum.z); // 4 + out << PxVec3(box.minimum.x, box.maximum.y, box.maximum.z); // 6 + } + return out; + } + + struct PxDebugArrow + { + PxDebugArrow(const PxVec3& pos, const PxVec3& vec) + : base(pos), tip(pos + vec), headLength(vec.magnitude()*0.15f) {} + + PxDebugArrow(const PxVec3& pos, const PxVec3& vec, PxReal headLength_) + : base(pos), tip(pos + vec), headLength(headLength_) {} + + PxVec3 base, tip; + PxReal headLength; + }; + PX_FORCE_INLINE void normalToTangents(const PxVec3& normal, PxVec3& tangent0, PxVec3& tangent1) + { + tangent0 = PxAbs(normal.x) < 0.70710678f ? PxVec3(0, -normal.z, normal.y) : PxVec3(-normal.y, normal.x, 0); + tangent0.normalize(); + tangent1 = normal.cross(tangent0); + } + PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugArrow& arrow) + { + PxVec3 t0 = arrow.tip - arrow.base, t1, t2; + + t0.normalize(); + normalToTangents(t0, t1, t2); + + const PxReal tipAngle = 0.25f; + t1 *= arrow.headLength * tipAngle; + t2 *= arrow.headLength * tipAngle * PxSqrt(3.0f); + PxVec3 headBase = arrow.tip - t0 * arrow.headLength; + + out << PxRenderOutput::LINES; + out << arrow.base << arrow.tip; + + out << PxRenderOutput::TRIANGLESTRIP; + out << arrow.tip; + out << headBase + t1 + t1; + out << headBase - t1 - t2; + out << headBase - t1 + t2; + out << arrow.tip; + out << headBase + t1 + t1; + return out; + } + + struct PxDebugBasis + { + PxDebugBasis(const PxVec3& ext, PxU32 cX = PxU32(PxDebugColor::eARGB_RED), + PxU32 cY = PxU32(PxDebugColor::eARGB_GREEN), PxU32 cZ = PxU32(PxDebugColor::eARGB_BLUE)) + : extends(ext), colorX(cX), colorY(cY), colorZ(cZ) {} + PxVec3 extends; + PxU32 colorX, colorY, colorZ; + }; + PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugBasis& basis) + { + const PxReal headLength = basis.extends.magnitude() * 0.15f; + out << basis.colorX << PxDebugArrow(PxVec3(0.0f), PxVec3(basis.extends.x, 0, 0), headLength); + out << basis.colorY << PxDebugArrow(PxVec3(0.0f), PxVec3(0, basis.extends.y, 0), headLength); + out << basis.colorZ << PxDebugArrow(PxVec3(0.0f), PxVec3(0, 0, basis.extends.z), headLength); + return out; + } + + struct PxDebugCircle + { + PxDebugCircle(PxU32 s, PxReal r) + : nSegments(s), radius(r) {} + PxU32 nSegments; + PxReal radius; + }; + PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugCircle& circle) + { + const PxF32 step = PxTwoPi / PxF32(circle.nSegments); + PxF32 angle = 0; + out << PxRenderOutput::LINESTRIP; + for (PxU32 i = 0; i < circle.nSegments; i++, angle += step) + out << PxVec3(circle.radius * PxSin(angle), circle.radius * PxCos(angle), 0); + out << PxVec3(0, circle.radius, 0); + return out; + } + + struct PxDebugArc + { + PxDebugArc(PxU32 s, PxReal r, PxReal minAng, PxReal maxAng) + : nSegments(s), radius(r), minAngle(minAng), maxAngle(maxAng) {} + PxU32 nSegments; + PxReal radius; + PxReal minAngle, maxAngle; + }; + PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugArc& arc) + { + const PxF32 step = (arc.maxAngle - arc.minAngle) / PxF32(arc.nSegments); + PxF32 angle = arc.minAngle; + out << PxRenderOutput::LINESTRIP; + for (PxU32 i = 0; i < arc.nSegments; i++, angle += step) + out << PxVec3(arc.radius * PxSin(angle), arc.radius * PxCos(angle), 0); + out << PxVec3(arc.radius * PxSin(arc.maxAngle), arc.radius * PxCos(arc.maxAngle), 0); + return out; + } + + PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(Primitive prim) + { + mPrim = prim; + mVertexCount = 0; + return *this; + } + + PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(PxU32 color) + { + mColor = color; + return *this; + } + + PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(const PxMat44& transform) + { + mTransform = transform; + return *this; + } + + PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(const PxTransform& t) + { + mTransform = PxMat44(t); + return *this; + } + + PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(const PxVec3& vertexIn) + { + // apply transformation + const PxVec3 vertex = mTransform.transform(vertexIn); + ++mVertexCount; + + // add primitive to render buffer + switch (mPrim) + { + case POINTS: + mBuffer.addPoint(PxDebugPoint(vertex, mColor)); break; + case LINES: + if (mVertexCount == 2) + { + mBuffer.addLine(PxDebugLine(mVertex0, vertex, mColor)); + mVertexCount = 0; + } + break; + case LINESTRIP: + if (mVertexCount >= 2) + mBuffer.addLine(PxDebugLine(mVertex0, vertex, mColor)); + break; + case TRIANGLES: + if (mVertexCount == 3) + { + mBuffer.addTriangle(PxDebugTriangle(mVertex1, mVertex0, vertex, mColor)); + mVertexCount = 0; + } + break; + case TRIANGLESTRIP: + if (mVertexCount >= 3) + mBuffer.addTriangle(PxDebugTriangle( + (mVertexCount & 0x1) ? mVertex0 : mVertex1, + (mVertexCount & 0x1) ? mVertex1 : mVertex0, vertex, mColor)); + break; + } + + // cache the last 2 vertices (for strips) + if (1 < mVertexCount) + { + mVertex1 = mVertex0; + mVertex0 = vertex; + } + else + { + mVertex0 = vertex; + } + return *this; + } + + PX_INLINE PxDebugLine* PxRenderOutput::reserveSegments(PxU32 nbSegments) + { + return mBuffer.reserveLines(nbSegments); + } + + PX_INLINE PxDebugPoint* PxRenderOutput::reservePoints(PxU32 nbPoints) + { + return mBuffer.reservePoints(nbPoints); + } + + // PT: using the operators is just too slow. + PX_INLINE void PxRenderOutput::outputSegment(const PxVec3& v0, const PxVec3& v1) + { + PxDebugLine* segment = mBuffer.reserveLines(1); + segment->pos0 = v0; + segment->pos1 = v1; + segment->color0 = segment->color1 = mColor; + } + + PX_INLINE PxRenderOutput& PxRenderOutput::outputCapsule(PxF32 radius, PxF32 halfHeight, const PxMat44& absPose) + { + PxRenderOutput& out = *this; + + const PxVec3 vleft2(-halfHeight, 0.0f, 0.0f); + PxMat44 left2 = absPose; + left2.column3 += PxVec4(left2.rotate(vleft2), 0.0f); + out << left2 << PxDebugArc(100, radius, PxPi, PxTwoPi); + + PxMat44 rotPose = left2; + PxSwap(rotPose.column1, rotPose.column2); + rotPose.column1 = -rotPose.column1; + out << rotPose << PxDebugArc(100, radius, PxPi, PxTwoPi); + + PxSwap(rotPose.column0, rotPose.column2); + rotPose.column0 = -rotPose.column0; + out << rotPose << PxDebugCircle(100, radius); + + const PxVec3 vright2(halfHeight, 0.0f, 0.0f); + PxMat44 right2 = absPose; + right2.column3 += PxVec4(right2.rotate(vright2), 0.0f); + out << right2 << PxDebugArc(100, radius, 0.0f, PxPi); + + rotPose = right2; + PxSwap(rotPose.column1, rotPose.column2); + rotPose.column1 = -rotPose.column1; + out << rotPose << PxDebugArc(100, radius, 0.0f, PxPi); + + PxSwap(rotPose.column0, rotPose.column2); + rotPose.column0 = -rotPose.column0; + out << rotPose << PxDebugCircle(100, radius); + + out << absPose; + out.outputSegment(absPose.transform(PxVec3(-halfHeight, radius, 0)), + absPose.transform(PxVec3(halfHeight, radius, 0))); + out.outputSegment(absPose.transform(PxVec3(-halfHeight, -radius, 0)), + absPose.transform(PxVec3(halfHeight, -radius, 0))); + out.outputSegment(absPose.transform(PxVec3(-halfHeight, 0, radius)), + absPose.transform(PxVec3(halfHeight, 0, radius))); + out.outputSegment(absPose.transform(PxVec3(-halfHeight, 0, -radius)), + absPose.transform(PxVec3(halfHeight, 0, -radius))); + + return *this; + } + +#if PX_VC +#pragma warning(pop) +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/common/PxSerialFramework.h b/engine/third_party/physx/include/common/PxSerialFramework.h new file mode 100644 index 00000000..1101a169 --- /dev/null +++ b/engine/third_party/physx/include/common/PxSerialFramework.h @@ -0,0 +1,385 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SERIAL_FRAMEWORK_H +#define PX_SERIAL_FRAMEWORK_H + + +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if !PX_DOXYGEN // need to exclude, confuses api doc build about duplicate declaration +typedef PxU16 PxType; +#endif + +class PxBase; +class PxSerializationContext; +class PxRepXSerializer; +class PxSerializer; +class PxPhysics; +class PxCollection; +class PxOutputStream; + +//! Default serialization alignment +#define PX_SERIAL_ALIGN 16 + +//! Serialized input data must be aligned to this value +#define PX_SERIAL_FILE_ALIGN 128 + +//! PxSerialObjectId value for objects that do not have an ID +#define PX_SERIAL_OBJECT_ID_INVALID 0 + +//! ID type for PxBase objects in a PxCollection +typedef PxU64 PxSerialObjectId; + +//! Bit to mark pointer type references, \see PxDeserializationContext +#define PX_SERIAL_REF_KIND_PTR_TYPE_BIT (1u<<31) + +//! Reference kind value for PxBase objects +#define PX_SERIAL_REF_KIND_PXBASE (0 | PX_SERIAL_REF_KIND_PTR_TYPE_BIT) + +//! Reference kind value for material indices +#define PX_SERIAL_REF_KIND_MATERIAL_IDX (1) + +//! Used to fix multi-byte characters warning from gcc for situations like: PxU32 foo = 'CCTS'; +#define PX_MAKE_FOURCC(a, b, c, d) ( (a) | ((b)<<8) | ((c)<<16) | ((d)<<24) ) + +/** +\brief Callback class used to process PxBase objects. + +\see PxSerializer::requires +*/ +class PxProcessPxBaseCallback +{ +public: + virtual ~PxProcessPxBaseCallback() {} + virtual void process(PxBase&) = 0; +}; + + +/** +\brief Binary serialization context class. + +This class is used to register reference values and write object +and object extra data during serialization. +It is mainly used by the serialization framework. Except for custom +serializable types, users should not have to worry about it. + +\see PxDeserializationContext +*/ +class PxSerializationContext +{ +public: + + /** + \brief Registers a reference value corresponding to a PxBase object. + + This method is assumed to be called in the implementation of PxSerializer::registerReferences for serialized + references that need to be resolved on deserialization. + + A reference needs to be associated with exactly one PxBase object in either the collection or the + external references collection. + + Different kinds of references are supported and need to be specified. In the most common case + (PX_SERIAL_REF_KIND_PXBASE) the PxBase object matches the reference value (which is the pointer + to the PxBase object). Integer references maybe registered as well (used for internal material + indices with PX_SERIAL_REF_KIND_MATERIAL_IDX). Other kinds could be added with the restriction that + for pointer types the kind value needs to be marked with the PX_SERIAL_REF_KIND_PTR_TYPE_BIT. + + \param[in] base PxBase object associated with the reference + \param[in] kind What kind of reference this is (PX_SERIAL_REF_KIND_PXBASE, PX_SERIAL_REF_KIND_MATERIAL_IDX or custom kind) + \param[in] reference Value of reference + + \see PxDeserializationContext::resolveReference, PX_SERIAL_REF_KIND_PXBASE, PX_SERIAL_REF_KIND_MATERIAL_IDX, PxSerializer::registerReferences + */ + virtual void registerReference(PxBase& base, PxU32 kind, size_t reference) = 0; + + /** + \brief Returns the collection that is being serialized. + */ + virtual const PxCollection& getCollection() const = 0; + + /** + \brief Serializes object data and object extra data. + + This function is assumed to be called within the implementation of PxSerializer::exportData and PxSerializer::exportExtraData. + + \see PxSerializer::exportData, PxSerializer::exportExtraData, PxSerializer::createObject, PxDeserializationContext::readExtraData + */ + virtual void writeData(const void* data, PxU32 size) = 0; + + /** + \brief Aligns the serialized data. + + This function is assumed to be called within the implementation of PxSerializer::exportData and PxSerializer::exportExtraData. + + \see PxSerializer::exportData, PxSerializer::exportExtraData, PxDeserializationContext::alignExtraData + */ + virtual void alignData(PxU32 alignment = PX_SERIAL_ALIGN) = 0; + + /** + \brief Helper function to write a name to the extraData if serialization is configured to save names. + + This function is assumed to be called within the implementation of PxSerializer::exportExtraData. + + \see PxSerialization::serializeCollectionToBinary, PxDeserializationContext::readName + */ + virtual void writeName(const char* name) = 0; + +protected: + + PxSerializationContext() {} + virtual ~PxSerializationContext() {} +}; + + +/** +\brief Binary deserialization context class. + +This class is used to resolve references and access extra data during deserialization. +It is mainly used by the serialization framework. Except for custom +serializable types, users should not have to worry about it. + +\see PxSerializationContext +*/ +class PxDeserializationContext +{ +public: + + /** + \brief Retrieves a pointer to a deserialized PxBase object given a corresponding deserialized reference value + + This method is assumed to be called in the implementation of PxSerializer::createObject in order + to update reference values on deserialization. + + To update a PxBase reference the corresponding deserialized pointer value needs to be provided in order to retrieve + the location of the corresponding deserialized PxBase object. (PxDeserializationContext::translatePxBase simplifies + this common case). + + For other kinds of references the reverence values need to be updated by deduction given the corresponding PxBase instance. + + \param[in] kind What kind of reference this is (PX_SERIAL_REF_KIND_PXBASE, PX_SERIAL_REF_KIND_MATERIAL_IDX or custom kind) + \param[in] reference Deserialized reference value + \return PxBase object associated with the reference value + + \see PxSerializationContext::registerReference, PX_SERIAL_REF_KIND_PXBASE, PX_SERIAL_REF_KIND_MATERIAL_IDX, translatePxBase + */ + virtual PxBase* resolveReference(PxU32 kind, size_t reference) const = 0; + + /** + \brief Helper function to update PxBase pointer on deserialization + + \see resolveReference, PX_SERIAL_REF_KIND_PXBASE + */ + template + void translatePxBase(T*& base) { if (base) { base = static_cast(resolveReference(PX_SERIAL_REF_KIND_PXBASE, size_t(base))); } } + + /** + \brief Helper function to read a name from the extra data during deserialization. + + This function is assumed to be called within the implementation of PxSerializer::createObject. + + \see PxSerializationContext::writeName + */ + PX_INLINE void readName(const char*& name) + { + PxU32 len = *reinterpret_cast(mExtraDataAddress); + mExtraDataAddress += sizeof(len); + name = len ? reinterpret_cast(mExtraDataAddress) : NULL; + mExtraDataAddress += len; + } + + /** + \brief Function to read extra data during deserialization. + + This function is assumed to be called within the implementation of PxSerializer::createObject. + + \see PxSerializationContext::writeData, PxSerializer::createObject + */ + template + PX_INLINE T* readExtraData(PxU32 count=1) + { + T* data = reinterpret_cast(mExtraDataAddress); + mExtraDataAddress += sizeof(T)*count; + return data; + } + + /** + \brief Function to read extra data during deserialization optionally aligning the extra data stream before reading. + + This function is assumed to be called within the implementation of PxSerializer::createObject. + + \see PxSerializationContext::writeData, PxDeserializationContext::alignExtraData, PxSerializer::createObject + */ + template + PX_INLINE T* readExtraData(PxU32 count=1) + { + alignExtraData(alignment); + return readExtraData(count); + } + + /** + \brief Function to align the extra data stream to a power of 2 alignment + + This function is assumed to be called within the implementation of PxSerializer::createObject. + + \see PxSerializationContext::alignData, PxSerializer::createObject + */ + PX_INLINE void alignExtraData(PxU32 alignment = PX_SERIAL_ALIGN) + { + size_t addr = size_t(mExtraDataAddress); + addr = (addr+alignment-1)&~size_t(alignment-1); + mExtraDataAddress = reinterpret_cast(addr); + } + +protected: + + PxDeserializationContext() {} + virtual ~PxDeserializationContext() {} + + PxU8* mExtraDataAddress; +}; + +/** +\brief Class serving as a registry for XML (RepX) and binary serializable types. + +In order to serialize and deserialize objects the application needs +to maintain an instance of this class. It can be created with +PxSerialization::createSerializationRegistry() and released with +PxSerializationRegistry::release(). + +\see PxSerialization::createSerializationRegistry +*/ +class PxSerializationRegistry +{ +public: + /************************************************************************************************/ + + /** \name Binary Serialization Functionality + */ + //\{ + + /** + \brief Register a serializer for a concrete type + + \param type PxConcreteType corresponding to the serializer + \param serializer The PxSerializer to be registered + + \see PxConcreteType, PxSerializer, PxSerializationRegistry::unregisterSerializer + */ + virtual void registerSerializer(PxType type, PxSerializer& serializer) = 0; + + /** + \brief Unregister a serializer for a concrete type, and retrieves the corresponding serializer object. + + \param type PxConcreteType for which the serializer should be unregistered + \return Unregistered serializer corresponding to type, NULL for types for which no serializer has been registered. + + \see PxConcreteType, PxSerializationRegistry::registerSerializer, PxSerializationRegistry::release + */ + virtual PxSerializer* unregisterSerializer(PxType type) = 0; + + /** + \brief Returns PxSerializer corresponding to type + + \param type PxConcreteType of the serializer requested. + \return Registered PxSerializer object corresponding to type + + \see PxConcreteType + */ + virtual const PxSerializer* getSerializer(PxType type) const = 0; + + //\} + /************************************************************************************************/ + + /** \name RepX (XML) Serialization Functionality + */ + //\{ + + /** + \brief Register a RepX serializer for a concrete type + + \deprecated Xml serialization is deprecated. An alternative serialization system is provided through USD Physics. + + \param type PxConcreteType corresponding to the RepX serializer + \param serializer The PxRepXSerializer to be registered + + \see PxConcreteType, PxRepXSerializer + */ + PX_DEPRECATED virtual void registerRepXSerializer(PxType type, PxRepXSerializer& serializer) = 0; + + /** + \brief Unregister a RepX serializer for a concrete type, and retrieves the corresponding serializer object. + + \deprecated Xml serialization is deprecated. An alternative serialization system is provided through USD Physics. + + \param type PxConcreteType for which the RepX serializer should be unregistered + \return Unregistered PxRepxSerializer corresponding to type, NULL for types for which no RepX serializer has been registered. + + \see PxConcreteType, PxSerializationRegistry::registerRepXSerializer, PxSerializationRegistry::release + */ + PX_DEPRECATED virtual PxRepXSerializer* unregisterRepXSerializer(PxType type) = 0; + + /** + \brief Returns RepX serializer given the corresponding type name + + \deprecated Xml serialization is deprecated. An alternative serialization system is provided through USD Physics. + + \param typeName Name of the type + \return Registered PxRepXSerializer object corresponding to type name + + \see PxRepXSerializer, PxTypeInfo, PX_DEFINE_TYPEINFO + */ + PX_DEPRECATED virtual PxRepXSerializer* getRepXSerializer(const char* typeName) const = 0; + + //\} + /************************************************************************************************/ + + /** + \brief Releases PxSerializationRegistry instance. + + This unregisters all PhysX and PhysXExtension serializers. Make sure to unregister all custom type + serializers before releasing the PxSerializationRegistry. + + \see PxSerializationRegistry::unregisterSerializer, PxSerializationRegistry::unregisterRepXSerializer + */ + virtual void release() = 0; + +protected: + virtual ~PxSerializationRegistry(){} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/common/PxSerializer.h b/engine/third_party/physx/include/common/PxSerializer.h new file mode 100644 index 00000000..988eeadd --- /dev/null +++ b/engine/third_party/physx/include/common/PxSerializer.h @@ -0,0 +1,259 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SERIALIZER_H +#define PX_SERIALIZER_H + +#include "foundation/PxAssert.h" +#include "foundation/PxAllocatorCallback.h" +#include "foundation/PxFoundation.h" +#include "common/PxSerialFramework.h" +#include "common/PxCollection.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** + \brief Serialization interface class. + + PxSerializer is used to extend serializable PxBase classes with serialization functionality. The + interface is structured such that per-class adapter instances can be used as opposed to per-object + adapter instances, avoiding per object allocations. Hence the methods take a reference to PxBase as a parameter. + + The PxSerializer interface needs to be implemented for binary or RepX serialization to work on custom + types. If only RepX serialization is needed, some methods can be left empty, as they are only needed + for binary serialization. + + A default implementation is available as a template adapter (PxSerializerDefaultAdapter). + + \see PxSerializerDefaultAdapter, PX_NEW_SERIALIZER_ADAPTER, PxSerializationRegistry::registerSerializer +*/ +class PxSerializer +{ +public: + + /**********************************************************************************************************************/ + + /** \name Basics needed for Binary- and RepX-Serialization + */ + //\{ + + /** + \brief Returns string name of dynamic type. + + \return Class name of most derived type of this object. + */ + virtual const char* getConcreteTypeName() const = 0; + + /** + \brief Adds required objects to the collection. + + This method does not add the required objects recursively, e.g. objects required by required objects. + + \see PxCollection, PxSerialization::complete + */ + virtual void requiresObjects(PxBase&, PxProcessPxBaseCallback&) const = 0; + + /** + \brief Whether the object is subordinate. + + A class is subordinate, if it can only be instantiated in the context of another class. + + \return Whether the class is subordinate + + \see PxSerialization::isSerializable + */ + virtual bool isSubordinate() const = 0; + + //\} + /**********************************************************************************************************************/ + + /**********************************************************************************************************************/ + + /** \name Functionality needed for Binary Serialization only + */ + //\{ + + /** + \brief Exports object's extra data to stream. + */ + virtual void exportExtraData(PxBase&, PxSerializationContext&) const = 0; + + /** + \brief Exports object's data to stream. + */ + virtual void exportData(PxBase&, PxSerializationContext&) const = 0; + + /** + \brief Register references that the object maintains to other objects. + */ + virtual void registerReferences(PxBase& obj, PxSerializationContext& s) const = 0; + + /** + \brief Returns size needed to create the class instance. + + \return sizeof class instance. + */ + virtual size_t getClassSize() const = 0; + + /** + \brief Create object at a given address, resolve references and import extra data. + + \param address Location at which object is created. Address is increased by the size of the created object. + \param context Context for reading external data and resolving references. + \return Created PxBase pointer (needs to be identical to address before increment). + */ + virtual PxBase* createObject(PxU8*& address, PxDeserializationContext& context) const = 0; + + //\} + /**********************************************************************************************************************/ + virtual ~PxSerializer() {} +}; + + +/** + \brief Default PxSerializer implementation. +*/ +template +class PxSerializerDefaultAdapter : public PxSerializer +{ +public: + + /************************************************************************************************/ + + /** \name Basics needed for Binary- and RepX-Serialization + */ + //\{ + + PxSerializerDefaultAdapter(const char* name) : mTypeName(name){} + + virtual const char* getConcreteTypeName() const + { + return mTypeName; + } + + virtual void requiresObjects(PxBase& obj, PxProcessPxBaseCallback& c) const + { + T& t = static_cast(obj); + t.requiresObjects(c); + } + + virtual bool isSubordinate() const + { + return false; + } + + //\} + /************************************************************************************************/ + + /** \name Functionality needed for Binary Serialization only + */ + //\{ + + // object methods + + virtual void exportExtraData(PxBase& obj, PxSerializationContext& s) const + { + T& t = static_cast(obj); + t.exportExtraData(s); + } + + virtual void exportData(PxBase& obj, PxSerializationContext& s) const + { + PxAllocatorCallback& allocator = *PxGetAllocatorCallback(); + T* copy = reinterpret_cast(allocator.allocate(sizeof(T), "TmpAllocExportData", PX_FL)); + PxMemCopy(copy, &obj, sizeof(T)); + copy->preExportDataReset(); + s.writeData(copy, sizeof(T)); + allocator.deallocate(copy); + } + + virtual void registerReferences(PxBase& obj, PxSerializationContext& s) const + { + T& t = static_cast(obj); + + s.registerReference(obj, PX_SERIAL_REF_KIND_PXBASE, size_t(&obj)); + + struct RequiresCallback : public PxProcessPxBaseCallback + { + RequiresCallback(PxSerializationContext& c) : context(c) {} + RequiresCallback& operator=(RequiresCallback&) { PX_ASSERT(0); return *this; } + void process(physx::PxBase& base) + { + context.registerReference(base, PX_SERIAL_REF_KIND_PXBASE, size_t(&base)); + } + PxSerializationContext& context; + }; + + RequiresCallback callback(s); + t.requiresObjects(callback); + } + + // class methods + + virtual size_t getClassSize() const + { + return sizeof(T); + } + + virtual PxBase* createObject(PxU8*& address, PxDeserializationContext& context) const + { + return T::createObject(address, context); + } + + + //\} + /************************************************************************************************/ + +private: + const char* mTypeName; +}; + +/** + \brief Preprocessor Macro to simplify adapter creation. + + Note: that the allocator used for creation needs to match with the one used in PX_DELETE_SERIALIZER_ADAPTER. +*/ +#define PX_NEW_SERIALIZER_ADAPTER(x) \ + *new( PxGetAllocatorCallback()->allocate(sizeof(PxSerializerDefaultAdapter), \ + "PxSerializerDefaultAdapter", PX_FL)) PxSerializerDefaultAdapter(#x) + +/** + \brief Preprocessor Macro to simplify adapter deletion. +*/ +#define PX_DELETE_SERIALIZER_ADAPTER(x) \ + { PxSerializer* s = x; if (s) { s->~PxSerializer(); PxGetAllocatorCallback()->deallocate(s); } } + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/common/PxStringTable.h b/engine/third_party/physx/include/common/PxStringTable.h new file mode 100644 index 00000000..f01766cf --- /dev/null +++ b/engine/third_party/physx/include/common/PxStringTable.h @@ -0,0 +1,67 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_STRING_TABLE_H +#define PX_STRING_TABLE_H + +#include "foundation/PxPreprocessor.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** + * \brief a table to manage strings. Strings allocated through this object are expected to be owned by this object. + */ +class PxStringTable +{ +protected: + virtual ~PxStringTable(){} +public: + /** + * \brief Allocate a new string. + * + * \param[in] inSrc Source string, null terminated or null. + * + * \return *Always* a valid null terminated string. "" is returned if "" or null is passed in. + */ + virtual const char* allocateStr( const char* inSrc ) = 0; + + /** + * Release the string table and all the strings associated with it. + */ + virtual void release() = 0; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/common/PxTolerancesScale.h b/engine/third_party/physx/include/common/PxTolerancesScale.h new file mode 100644 index 00000000..70bd5a8d --- /dev/null +++ b/engine/third_party/physx/include/common/PxTolerancesScale.h @@ -0,0 +1,103 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_TOLERANCES_SCALE_H +#define PX_TOLERANCES_SCALE_H + + +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Class to define the scale at which simulation runs. Most simulation tolerances are +calculated in terms of the values here. + +\note if you change the simulation scale, you will probably also wish to change the scene's +default value of gravity, and stable simulation will probably require changes to the scene's +bounceThreshold also. +*/ + +class PxTolerancesScale +{ +public: + + /** + \brief The approximate size of objects in the simulation. + + For simulating roughly human-sized in metric units, 1 is a good choice. + If simulation is done in centimetres, use 100 instead. This is used to + estimate certain length-related tolerances. + */ + PxReal length; + + /** + \brief The typical magnitude of velocities of objects in simulation. This is used to estimate + whether a contact should be treated as bouncing or resting based on its impact velocity, + and a kinetic energy threshold below which the simulation may put objects to sleep. + + For normal physical environments, a good choice is the approximate speed of an object falling + under gravity for one second. + */ + PxReal speed; + + /** + \brief constructor sets to default + + \param[in] defaultLength Default length + \param[in] defaultSpeed Default speed + */ + PX_INLINE explicit PxTolerancesScale(float defaultLength=1.0f, float defaultSpeed=10.0f); + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid (returns always true). + */ + PX_INLINE bool isValid() const; + +}; + +PX_INLINE PxTolerancesScale::PxTolerancesScale(float defaultLength, float defaultSpeed) : + length (defaultLength), + speed (defaultSpeed) + { + } + +PX_INLINE bool PxTolerancesScale::isValid() const +{ + return length>0.0f; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/common/PxTypeInfo.h b/engine/third_party/physx/include/common/PxTypeInfo.h new file mode 100644 index 00000000..59d615bd --- /dev/null +++ b/engine/third_party/physx/include/common/PxTypeInfo.h @@ -0,0 +1,156 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_TYPE_INFO_H +#define PX_TYPE_INFO_H + + +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief an enumeration of concrete classes inheriting from PxBase + +Enumeration space is reserved for future PhysX core types, PhysXExtensions, +PhysXVehicle and Custom application types. + +\see PxBase, PxTypeInfo +*/ + +struct PxConcreteType +{ + enum Enum + { + eUNDEFINED, + + eHEIGHTFIELD, + eCONVEX_MESH, + eTRIANGLE_MESH_BVH33 PX_DEPRECATED, //!< \deprecated Will be removed together with deprecated BVH33. + eTRIANGLE_MESH_BVH34, + eTETRAHEDRON_MESH, + eDEFORMABLE_VOLUME_MESH, + eSOFTBODY_MESH PX_DEPRECATED = eDEFORMABLE_VOLUME_MESH, //!< \deprecated + + eRIGID_DYNAMIC, + eRIGID_STATIC, + eSHAPE, + eMATERIAL, + eDEFORMABLE_SURFACE_MATERIAL, + eDEFORMABLE_VOLUME_MATERIAL, + eSOFTBODY_MATERIAL PX_DEPRECATED = eDEFORMABLE_VOLUME_MATERIAL, //!< \deprecated + ePBD_MATERIAL, + eCONSTRAINT, + eAGGREGATE, + eARTICULATION_REDUCED_COORDINATE, + eARTICULATION_LINK, + eARTICULATION_JOINT_REDUCED_COORDINATE, + eARTICULATION_SPATIAL_TENDON, + eARTICULATION_FIXED_TENDON, + eARTICULATION_ATTACHMENT, + eARTICULATION_TENDON_JOINT, + eARTICULATION_MIMIC_JOINT, + ePRUNING_STRUCTURE, + eBVH, + eDEFORMABLE_VOLUME, + eSOFT_BODY PX_DEPRECATED = eDEFORMABLE_VOLUME, //!< \deprecated + eDEFORMABLE_VOLUME_STATE, + eSOFT_BODY_STATE PX_DEPRECATED = eDEFORMABLE_VOLUME_STATE, //!< \deprecated + ePBD_PARTICLESYSTEM, + eDEFORMABLE_SURFACE, + eDEFORMABLE_ATTACHMENT, + eDEFORMABLE_ELEMENT_FILTER, + ePARTICLE_BUFFER, + ePARTICLE_DIFFUSE_BUFFER, + ePARTICLE_CLOTH_BUFFER, + ePARTICLE_RIGID_BUFFER, + + ePHYSX_CORE_COUNT, + eFIRST_PHYSX_EXTENSION = 256, + eFIRST_VEHICLE_EXTENSION = 512, + eFIRST_USER_EXTENSION = 1024 + }; +}; + +/** +\brief a structure containing per-type information for types inheriting from PxBase + +\see PxBase, PxConcreteType +*/ + +template struct PxTypeInfo {}; + +#define PX_DEFINE_TYPEINFO(_name, _fastType) \ + class _name; \ + template <> struct PxTypeInfo<_name> { static const char* name() { return #_name; } enum { eFastTypeId = _fastType }; }; + +/* the semantics of the fastType are as follows: an object A can be cast to a type B if B's fastType is defined, and A has the same fastType. + * This implies that B has no concrete subclasses or superclasses. + */ + +PX_DEFINE_TYPEINFO(PxBase, PxConcreteType::eUNDEFINED) +PX_DEFINE_TYPEINFO(PxMaterial, PxConcreteType::eMATERIAL) +PX_DEFINE_TYPEINFO(PxDeformableSurfaceMaterial, PxConcreteType::eDEFORMABLE_SURFACE_MATERIAL) +PX_DEFINE_TYPEINFO(PxDeformableVolumeMaterial, PxConcreteType::eDEFORMABLE_VOLUME_MATERIAL) +PX_DEFINE_TYPEINFO(PxPBDMaterial, PxConcreteType::ePBD_MATERIAL) +PX_DEFINE_TYPEINFO(PxConvexMesh, PxConcreteType::eCONVEX_MESH) +PX_DEFINE_TYPEINFO(PxTriangleMesh, PxConcreteType::eUNDEFINED) +PX_DEFINE_TYPEINFO(PxBVH33TriangleMesh, PxConcreteType::eTRIANGLE_MESH_BVH33) +PX_DEFINE_TYPEINFO(PxBVH34TriangleMesh, PxConcreteType::eTRIANGLE_MESH_BVH34) +PX_DEFINE_TYPEINFO(PxTetrahedronMesh, PxConcreteType::eTETRAHEDRON_MESH) +PX_DEFINE_TYPEINFO(PxHeightField, PxConcreteType::eHEIGHTFIELD) +PX_DEFINE_TYPEINFO(PxActor, PxConcreteType::eUNDEFINED) +PX_DEFINE_TYPEINFO(PxRigidActor, PxConcreteType::eUNDEFINED) +PX_DEFINE_TYPEINFO(PxRigidBody, PxConcreteType::eUNDEFINED) +PX_DEFINE_TYPEINFO(PxRigidDynamic, PxConcreteType::eRIGID_DYNAMIC) +PX_DEFINE_TYPEINFO(PxRigidStatic, PxConcreteType::eRIGID_STATIC) +PX_DEFINE_TYPEINFO(PxArticulationLink, PxConcreteType::eARTICULATION_LINK) +PX_DEFINE_TYPEINFO(PxArticulationJointReducedCoordinate, PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE) +PX_DEFINE_TYPEINFO(PxArticulationReducedCoordinate, PxConcreteType::eARTICULATION_REDUCED_COORDINATE) +PX_DEFINE_TYPEINFO(PxAggregate, PxConcreteType::eAGGREGATE) +PX_DEFINE_TYPEINFO(PxConstraint, PxConcreteType::eCONSTRAINT) +PX_DEFINE_TYPEINFO(PxShape, PxConcreteType::eSHAPE) +PX_DEFINE_TYPEINFO(PxPruningStructure, PxConcreteType::ePRUNING_STRUCTURE) +PX_DEFINE_TYPEINFO(PxPBDParticleSystem, PxConcreteType::ePBD_PARTICLESYSTEM) +PX_DEFINE_TYPEINFO(PxDeformableSurface, PxConcreteType::eDEFORMABLE_SURFACE) +PX_DEFINE_TYPEINFO(PxDeformableVolume, PxConcreteType::eDEFORMABLE_VOLUME) +PX_DEFINE_TYPEINFO(PxDeformableAttachment, PxConcreteType::eDEFORMABLE_ATTACHMENT) +PX_DEFINE_TYPEINFO(PxDeformableElementFilter, PxConcreteType::eDEFORMABLE_ELEMENT_FILTER) +PX_DEFINE_TYPEINFO(PxParticleBuffer, PxConcreteType::ePARTICLE_BUFFER) +PX_DEFINE_TYPEINFO(PxParticleAndDiffuseBuffer, PxConcreteType::ePARTICLE_DIFFUSE_BUFFER) +PX_DEFINE_TYPEINFO(PxParticleClothBuffer, PxConcreteType::ePARTICLE_CLOTH_BUFFER) +PX_DEFINE_TYPEINFO(PxParticleRigidBuffer, PxConcreteType::ePARTICLE_RIGID_BUFFER) + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/common/windows/PxWindowsDelayLoadHook.h b/engine/third_party/physx/include/common/windows/PxWindowsDelayLoadHook.h new file mode 100644 index 00000000..064e3779 --- /dev/null +++ b/engine/third_party/physx/include/common/windows/PxWindowsDelayLoadHook.h @@ -0,0 +1,96 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_WINDOWS_DELAY_LOAD_HOOK_H +#define PX_WINDOWS_DELAY_LOAD_HOOK_H + +#include "foundation/PxPreprocessor.h" +#include "common/PxPhysXCommonConfig.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + /** + \brief PxDelayLoadHook + + This is a helper class for delay loading the PhysXCommon dll and PhysXFoundation dll. + If a PhysXCommon dll or PhysXFoundation dll with a non-default file name needs to be loaded, + PxDelayLoadHook can be sub-classed to provide the custom filenames. + + Once the names are set, the instance must be set for use by PhysX.dll using PxSetPhysXDelayLoadHook(), + PhysXCooking.dll using PxSetPhysXCookingDelayLoadHook() or by PhysXCommon.dll using PxSetPhysXCommonDelayLoadHook(). + + \see PxSetPhysXDelayLoadHook(), PxSetPhysXCookingDelayLoadHook(), PxSetPhysXCommonDelayLoadHook() + */ + class PxDelayLoadHook + { + public: + PxDelayLoadHook() {} + virtual ~PxDelayLoadHook() {} + + virtual const char* getPhysXFoundationDllName() const = 0; + + virtual const char* getPhysXCommonDllName() const = 0; + + protected: + private: + }; + + /** + \brief Sets delay load hook instance for PhysX dll. + + \param[in] hook Delay load hook. + + \see PxDelayLoadHook + */ + PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxSetPhysXDelayLoadHook(const physx::PxDelayLoadHook* hook); + + /** + \brief Sets delay load hook instance for PhysXCooking dll. + + \param[in] hook Delay load hook. + + \see PxDelayLoadHook + */ + PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxSetPhysXCookingDelayLoadHook(const physx::PxDelayLoadHook* hook); + + /** + \brief Sets delay load hook instance for PhysXCommon dll. + + \param[in] hook Delay load hook. + + \see PxDelayLoadHook + */ + PX_C_EXPORT PX_PHYSX_COMMON_API void PX_CALL_CONV PxSetPhysXCommonDelayLoadHook(const physx::PxDelayLoadHook* hook); + +#if !PX_DOXYGEN +} // namespace physx +#endif +#endif diff --git a/engine/third_party/physx/include/cooking/PxBVH33MidphaseDesc.h b/engine/third_party/physx/include/cooking/PxBVH33MidphaseDesc.h new file mode 100644 index 00000000..26729fa0 --- /dev/null +++ b/engine/third_party/physx/include/cooking/PxBVH33MidphaseDesc.h @@ -0,0 +1,110 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_BVH_33_MIDPHASE_DESC_H +#define PX_BVH_33_MIDPHASE_DESC_H + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\deprecated This is only used for BVH33 which is deprecated and will be removed in a future version. Use BVH34 instead. + +\brief Enumeration for mesh cooking hints. +*/ +struct PX_DEPRECATED PxMeshCookingHint +{ + enum Enum + { + eSIM_PERFORMANCE = 0, //!< Default value. Favors higher quality hierarchy with higher runtime performance over cooking speed. + eCOOKING_PERFORMANCE = 1 //!< Enables fast cooking path at the expense of somewhat lower quality hierarchy construction. + }; +}; + +/** +\deprecated BVH33 is deprecated and will be removed in a future version. Use BVH34 instead. + +\brief Structure describing parameters affecting BVH33 midphase mesh structure. + +\see PxCookingParams, PxMidphaseDesc +*/ +struct PX_DEPRECATED PxBVH33MidphaseDesc +{ + /** + \brief Controls the trade-off between mesh size and runtime performance. + + Using a value of 1.0 will produce a larger cooked mesh with generally higher runtime performance, + using 0.0 will produce a smaller cooked mesh, with generally lower runtime performance. + + Values outside of [0,1] range will be clamped and cause a warning when any mesh gets cooked. + + Default value: 0.55 + Range: [0.0f, 1.0f] + */ + PxF32 meshSizePerformanceTradeOff; + + /** + \brief Mesh cooking hint. Used to specify mesh hierarchy construction preference. + + Default value: PxMeshCookingHint::eSIM_PERFORMANCE + */ + PxMeshCookingHint::Enum meshCookingHint; + + /** + \brief Desc initialization to default value. + */ + void setToDefault() + { + meshSizePerformanceTradeOff = 0.55f; + meshCookingHint = PxMeshCookingHint::eSIM_PERFORMANCE; + } + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid. + */ + bool isValid() const + { + if(meshSizePerformanceTradeOff < 0.0f || meshSizePerformanceTradeOff > 1.0f) + return false; + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + +#endif + diff --git a/engine/third_party/physx/include/cooking/PxBVH34MidphaseDesc.h b/engine/third_party/physx/include/cooking/PxBVH34MidphaseDesc.h new file mode 100644 index 00000000..7b5d96e2 --- /dev/null +++ b/engine/third_party/physx/include/cooking/PxBVH34MidphaseDesc.h @@ -0,0 +1,124 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_BVH_34_MIDPHASE_DESC_H +#define PX_BVH_34_MIDPHASE_DESC_H + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Desired build strategy for PxMeshMidPhase::eBVH34 +*/ +struct PxBVH34BuildStrategy +{ + enum Enum + { + eFAST = 0, //!< Fast build strategy. Fast build speed, good runtime performance in most cases. Recommended for runtime mesh cooking. + eDEFAULT = 1, //!< Default build strategy. Medium build speed, good runtime performance in all cases. + eSAH = 2, //!< SAH build strategy. Slower builds, slightly improved runtime performance in some cases. + + eLAST + }; +}; + + +/** + +\brief Structure describing parameters affecting BVH34 midphase mesh structure. + +\see PxCookingParams, PxMidphaseDesc +*/ +struct PxBVH34MidphaseDesc +{ + /** + \brief Mesh cooking hint for max primitives per leaf limit. + Less primitives per leaf produces larger meshes with better runtime performance + and worse cooking performance. More triangles per leaf results in faster cooking speed and + smaller mesh sizes, but with worse runtime performance. + + Default value: 4 + Range: <2, 15> + */ + PxU32 numPrimsPerLeaf; + + /** + \brief Desired build strategy for the BVH + + Default value: eDEFAULT + */ + PxBVH34BuildStrategy::Enum buildStrategy; + + /** + \brief Whether the tree should be quantized or not + + Quantized trees use up less memory, but the runtime dequantization (to retrieve the node bounds) might have + a measurable performance cost. In most cases the cost is too small to matter, and using less memory is more + important. Hence, the default is true. + + One important use case for non-quantized trees is deformable meshes. The refit function for the BVH is not + supported for quantized trees. + + Default value: true + */ + bool quantized; + + /** + \brief Desc initialization to default value. + */ + void setToDefault() + { + numPrimsPerLeaf = 4; + buildStrategy = PxBVH34BuildStrategy::eDEFAULT; + quantized = true; + } + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid. + */ + bool isValid() const + { + if(numPrimsPerLeaf < 2 || numPrimsPerLeaf > 15) + return false; + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + +#endif + diff --git a/engine/third_party/physx/include/cooking/PxBVHDesc.h b/engine/third_party/physx/include/cooking/PxBVHDesc.h new file mode 100644 index 00000000..236a2bfd --- /dev/null +++ b/engine/third_party/physx/include/cooking/PxBVHDesc.h @@ -0,0 +1,135 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_BVH_DESC_H +#define PX_BVH_DESC_H + +#include "common/PxCoreUtilityTypes.h" +#include "foundation/PxTransform.h" +#include "foundation/PxBounds3.h" +#include "geometry/PxBVHBuildStrategy.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Descriptor class for #PxBVH. + +\see PxBVH +*/ +class PxBVHDesc +{ +public: + PX_INLINE PxBVHDesc(); + + /** + \brief Pointer to first bounding box. + */ + PxBoundedData bounds; + + /** + \brief Bounds enlargement + + Passed bounds are slightly enlarged before creating the BVH. This is done to avoid numerical issues when + e.g. raycasts just graze the bounds. The performed operation is: + + extents = (bounds.maximum - bounds.minimum)/2 + enlagedBounds.minimum = passedBounds.minium - extents * enlargement + enlagedBounds.maximum = passedBounds.maxium + extents * enlargement + + Users can pass pre-enlarged bounds to the BVH builder, in which case just set the enlargement value to zero. + + Default value: 0.01 + */ + float enlargement; + + /** + \brief Max primitives per leaf limit. + + Range: [0, 16)
+ Default value: 4 + */ + PxU32 numPrimsPerLeaf; + + /** + \brief Desired build strategy for the BVH + + Default value: eDEFAULT + */ + PxBVHBuildStrategy::Enum buildStrategy; + + /** + \brief Initialize the BVH descriptor + */ + PX_INLINE void setToDefault(); + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid. + */ + PX_INLINE bool isValid() const; + +protected: +}; + +PX_INLINE PxBVHDesc::PxBVHDesc() : enlargement(0.01f), numPrimsPerLeaf(4), buildStrategy(PxBVHBuildStrategy::eDEFAULT) +{ +} + +PX_INLINE void PxBVHDesc::setToDefault() +{ + *this = PxBVHDesc(); +} + +PX_INLINE bool PxBVHDesc::isValid() const +{ + // Check BVH desc data + if(!bounds.data) + return false; + if(bounds.stride < sizeof(PxBounds3)) //should be at least one bounds' worth of data + return false; + + if(bounds.count == 0) + return false; + + if(enlargement<0.0f) + return false; + + if(numPrimsPerLeaf>=16) + return false; + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/cooking/PxConvexMeshDesc.h b/engine/third_party/physx/include/cooking/PxConvexMeshDesc.h new file mode 100644 index 00000000..8dfd2250 --- /dev/null +++ b/engine/third_party/physx/include/cooking/PxConvexMeshDesc.h @@ -0,0 +1,333 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CONVEX_MESH_DESC_H +#define PX_CONVEX_MESH_DESC_H + +#include "foundation/PxVec3.h" +#include "foundation/PxFlags.h" +#include "common/PxCoreUtilityTypes.h" +#include "geometry/PxConvexMesh.h" +#include "PxSDFDesc.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +/** +\brief Flags which describe the format and behavior of a convex mesh. +*/ +struct PxConvexFlag +{ + enum Enum + { + /** + Denotes the use of 16-bit vertex indices in PxConvexMeshDesc::triangles or PxConvexMeshDesc::polygons. + (otherwise, 32-bit indices are assumed) + \see #PxConvexMeshDesc.indices + */ + e16_BIT_INDICES = (1<<0), + + /** + Automatically recomputes the hull from the vertices. If this flag is not set, you must provide the entire geometry manually. + + \note For the specific algorithm used in hull computation, please see PxConvexMeshCookingType. + + \see PxConvexMeshCookingType + */ + eCOMPUTE_CONVEX = (1<<1), + + /** + \brief Checks and removes almost zero-area triangles during convex hull computation. + The rejected area size is specified in PxCookingParams::areaTestEpsilon + + \note This flag is only used in combination with eCOMPUTE_CONVEX. + + \see PxCookingParams PxCookingParams::areaTestEpsilon + */ + eCHECK_ZERO_AREA_TRIANGLES = (1<<2), + + /** + \brief Quantizes the input vertices using the k-means clustering + + \note The input vertices are quantized to PxConvexMeshDesc::quantizedCount + see http://en.wikipedia.org/wiki/K-means_clustering + + */ + eQUANTIZE_INPUT = (1 << 3), + + /** + \brief Disables the convex mesh validation to speed-up hull creation. Please use separate validation + function in checked/debug builds. Creating a convex mesh with invalid input data without prior validation + may result in undefined behavior. + + \see PxCooking::validateConvexMesh + */ + eDISABLE_MESH_VALIDATION = (1 << 4), + + /** + \brief Enables plane shifting vertex limit algorithm. + + Plane shifting is an alternative algorithm for the case when the computed hull has more vertices + than the specified vertex limit. + + The default algorithm computes the full hull, and an OBB around the input vertices. This OBB is then sliced + with the hull planes until the vertex limit is reached.The default algorithm requires the vertex limit + to be set to at least 8, and typically produces results that are much better quality than are produced + by plane shifting. + + When plane shifting is enabled, the hull computation stops when vertex limit is reached. The hull planes + are then shifted to contain all input vertices, and the new plane intersection points are then used to + generate the final hull with the given vertex limit.Plane shifting may produce sharp edges to vertices + very far away from the input cloud, and does not guarantee that all input vertices are inside the resulting + hull.However, it can be used with a vertex limit as low as 4. + */ + ePLANE_SHIFTING = (1 << 5), + + /** + \brief Inertia tensor computation is faster using SIMD code, but the precision is lower, which may result + in incorrect inertia for very thin hulls. + */ + eFAST_INERTIA_COMPUTATION = (1 << 6), + + /** + \brief Convex hull input vertices are shifted to be around origin to provide better computation stability. + It is recommended to provide input vertices around the origin, otherwise use this flag to improve + numerical stability. + \note Is used only with eCOMPUTE_CONVEX flag. + */ + eSHIFT_VERTICES = (1 << 8) + }; +}; + +/** +\brief collection of set bits defined in PxConvexFlag. + +\see PxConvexFlag +*/ +typedef PxFlags PxConvexFlags; +PX_FLAGS_OPERATORS(PxConvexFlag::Enum,PxU16) + +/** +\brief Descriptor class for #PxConvexMesh. +\note The number of vertices and the number of convex polygons in a cooked convex mesh is limited to 256. +\note The number of vertices and the number of convex polygons in a GPU compatible convex mesh is limited to 64, +and the number of faces per vertex is limited to 32. + +\see PxConvexMesh PxConvexMeshGeometry PxShape PxPhysics.createConvexMesh() + +*/ +class PxConvexMeshDesc +{ +public: + + /** + \brief Vertex positions data in PxBoundedData format. + + Default: NULL + */ + PxBoundedData points; + + /** + \brief Polygons data in PxBoundedData format. +

Pointer to first polygon.

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

Pointer to first index.

+ + Default: NULL + +

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

+ + \see PxHullPolygon PxConvexFlag::e16_BIT_INDICES + */ + PxBoundedData indices; + + /** + \brief Flags bits, combined from values of the enum ::PxConvexFlag + + Default: 0 + */ + PxConvexFlags flags; + + /** + \brief Limits the number of vertices of the result convex mesh. Hard maximum limit is 255 + and minimum limit is 4 if PxConvexFlag::ePLANE_SHIFTING is used, otherwise the minimum + limit is 8. + + \note The please see PxConvexFlag::ePLANE_SHIFTING for algorithm explanation + \note The maximum limit for GPU compatible convex meshes is 64. + + \see PxConvexFlag::ePLANE_SHIFTING + + Range: [4, 255]
+ Default: 255 + */ + PxU16 vertexLimit; + + /** + \brief Limits the number of polygons of the result convex mesh. Hard maximum limit is 255 + and minimum limit is 4. + + \note The maximum limit for GPU compatible convex meshes is 64. + + Range: [4, 255]
+ Default: 255 + */ + PxU16 polygonLimit; + + /** + \brief Maximum number of vertices after quantization. The quantization is done during the vertex cleaning phase. + The quantization is applied when PxConvexFlag::eQUANTIZE_INPUT is specified. + + \see PxConvexFlag::eQUANTIZE_INPUT + + Range: [4, 65535]
+ Default: 255 + */ + PxU16 quantizedCount; + + /** + \brief SDF descriptor. When this descriptor is set, signed distance field is calculated for this convex mesh. + + Default: NULL + */ + PxSDFDesc* sdfDesc; + + /** + \brief constructor sets to default. + */ + PX_INLINE PxConvexMeshDesc(); + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE void setToDefault(); + + + /** + \brief Returns true if the descriptor is valid. + + \return True if the current settings are valid + */ + PX_INLINE bool isValid() const; +}; + +PX_INLINE PxConvexMeshDesc::PxConvexMeshDesc() //constructor sets to default +: vertexLimit(255), polygonLimit(255), quantizedCount(255), sdfDesc(NULL) +{ + +} + +PX_INLINE void PxConvexMeshDesc::setToDefault() +{ + *this = PxConvexMeshDesc(); +} + +PX_INLINE bool PxConvexMeshDesc::isValid() const +{ + // Check geometry + if(points.count < 3 || //at least 1 trig's worth of points + (points.count > 0xffff && flags & PxConvexFlag::e16_BIT_INDICES)) + return false; + if(!points.data) + return false; + if(points.stride < sizeof(PxVec3)) //should be at least one point's worth of data + return false; + if (quantizedCount < 4) + return false; + + // Check topology + if(polygons.data) + { + if(polygons.count < 4) // we require 2 neighbors for each vertex - 4 polygons at least + return false; + + if(!indices.data) // indices must be provided together with polygons + return false; + + PxU32 limit = (flags & PxConvexFlag::e16_BIT_INDICES) ? sizeof(PxU16) : sizeof(PxU32); + if(indices.stride < limit) + return false; + + limit = sizeof(PxHullPolygon); + if(polygons.stride < limit) + return false; + } + else + { + // We can compute the hull from the vertices + if(!(flags & PxConvexFlag::eCOMPUTE_CONVEX)) + return false; // If the mesh is convex and we're not allowed to compute the hull, + // you have to provide it completely (geometry & topology). + } + + if((flags & PxConvexFlag::ePLANE_SHIFTING) && vertexLimit < 4) + { + return false; + } + + if (!(flags & PxConvexFlag::ePLANE_SHIFTING) && vertexLimit < 8) + { + return false; + } + + if(vertexLimit > 255) + { + return false; + } + + if (polygonLimit < 4) + { + return false; + } + + if (polygonLimit > 255) + { + return false; + } + + if (sdfDesc && !sdfDesc->isValid()) + { + return false; + } + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/cooking/PxCooking.h b/engine/third_party/physx/include/cooking/PxCooking.h new file mode 100644 index 00000000..4bfef7c9 --- /dev/null +++ b/engine/third_party/physx/include/cooking/PxCooking.h @@ -0,0 +1,908 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_COOKING_H +#define PX_COOKING_H +#include "common/PxPhysXCommonConfig.h" +#include "common/PxTolerancesScale.h" +#include "cooking/Pxc.h" + +#include "cooking/PxConvexMeshDesc.h" +#include "cooking/PxTriangleMeshDesc.h" +#include "cooking/PxTetrahedronMeshDesc.h" +#include "cooking/PxMidphaseDesc.h" +#include "cooking/PxBVHDesc.h" +#include "geometry/PxTriangleMesh.h" +#include "geometry/PxTetrahedronMesh.h" +#include "geometry/PxBVH.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxInsertionCallback; +class PxFoundation; +class PxAllocatorCallback; +class PxHeightFieldDesc; + +/** +\brief Result from convex cooking. +*/ +struct PxConvexMeshCookingResult +{ + enum Enum + { + /** + \brief Convex mesh cooking succeeded. + */ + eSUCCESS, + + /** + \brief Convex mesh cooking failed, algorithm couldn't find 4 initial vertices without a small triangle. + + \see PxCookingParams::areaTestEpsilon PxConvexFlag::eCHECK_ZERO_AREA_TRIANGLES + */ + eZERO_AREA_TEST_FAILED, + + /** + \brief Convex mesh cooking succeeded, but the algorithm has reached the 255 polygons limit. + The produced hull does not contain all input vertices. Try to simplify the input vertices + or try to use the eINFLATE_CONVEX or the eQUANTIZE_INPUT flags. + + \see PxConvexFlag::eINFLATE_CONVEX PxConvexFlag::eQUANTIZE_INPUT + */ + ePOLYGONS_LIMIT_REACHED, + + /** + \brief Something unrecoverable happened. Check the error stream to find out what. + */ + eFAILURE, + + /** + \brief Convex mesh cooking succeeded, but the algorithm could not make the mesh GPU compatible because the + in-sphere radius is more than 100x smaller than the largest extent. Collision detection for any pair involving + this convex mesh will fall back to CPU. + */ + eNON_GPU_COMPATIBLE + }; +}; + +/** \brief Enumeration for convex mesh cooking algorithms. */ +struct PxConvexMeshCookingType +{ + enum Enum + { + /** + \brief The Quickhull algorithm constructs the hull from the given input points. The resulting hull + will only contain a subset of the input points. + + */ + eQUICKHULL + }; +}; + +/** +\brief Result from triangle mesh cooking +*/ +struct PxTriangleMeshCookingResult +{ + enum Enum + { + /** + \brief Everything is A-OK. + */ + eSUCCESS = 0, + + /** + \brief A triangle is too large for well-conditioned results. Tessellate the mesh for better behavior, see the user guide section on cooking for more details. + */ + eLARGE_TRIANGLE, + + /** + \brief The mesh cleaning operation removed all triangles, resulting in an empty mesh. + */ + eEMPTY_MESH, + + /** + \brief Something unrecoverable happened. Check the error stream to find out what. + */ + eFAILURE + }; +}; + +/** +\brief Enum for the set of mesh pre-processing parameters. +*/ +struct PxMeshPreprocessingFlag +{ + enum Enum + { + /** + \brief When set, mesh welding is performed. See PxCookingParams::meshWeldTolerance. Mesh cleaning must be enabled. + */ + eWELD_VERTICES = 1 << 0, + + /** + \brief When set, mesh cleaning is disabled. This makes cooking faster. + + When mesh cleaning is disabled, mesh welding is also disabled. + + It is recommended to use only meshes that passed during validateTriangleMesh. + */ + eDISABLE_CLEAN_MESH = 1 << 1, + + /** + \brief When set, active edges are not computed and just enabled for all edges. This makes cooking faster but contact generation slower. + */ + eDISABLE_ACTIVE_EDGES_PRECOMPUTE = 1 << 2, + + /** + \brief When set, 32-bit indices will always be created regardless of triangle count. + + \note By default mesh will be created with 16-bit indices for triangle count <= 0xFFFF and 32-bit otherwise. + */ + eFORCE_32BIT_INDICES = 1 << 3, + + /** + \brief When set, a list of triangles will be created for each associated vertex in the mesh. + */ + eENABLE_VERT_MAPPING = 1 << 4, + + /** + \brief When set, inertia data is calculated for the mesh, assuming unit density. + */ + eENABLE_INERTIA = 1 << 5 + }; +}; + +typedef PxFlags PxMeshPreprocessingFlags; + +/** +\brief Structure describing parameters affecting mesh cooking. + +\see PxSetCookingParams() PxGetCookingParams() +*/ +struct PxCookingParams +{ + /** + \brief Zero-size area epsilon used in convex hull computation. + + If the area of a triangle of the hull is below this value, the triangle will be rejected. This test + is done only if PxConvexFlag::eCHECK_ZERO_AREA_TRIANGLES is used. + + \see PxConvexFlag::eCHECK_ZERO_AREA_TRIANGLES + + Default value: 0.06f*PxTolerancesScale.length*PxTolerancesScale.length + + Range: (0.0f, PX_MAX_F32) + */ + float areaTestEpsilon; + + /** + \brief Plane tolerance used in convex hull computation. + + The value is used during hull construction. When a new point is about to be added to the hull it + gets dropped when the point is closer to the hull than the planeTolerance. The planeTolerance + is increased according to the hull size. + + If 0.0f is set all points are accepted when the convex hull is created. This may lead to edge cases + where the new points may be merged into an existing polygon and the polygons plane equation might + slightly change therefore. This might lead to failures during polygon merging phase in the hull computation. + + It is recommended to use the default value, however if it is required that all points needs to be + accepted or huge thin convexes are created, it might be required to lower the default value. + + \note The plane tolerance is used only within PxConvexMeshCookingType::eQUICKHULL algorithm. + + Default value: 0.0007f + + Range: <0.0f, PX_MAX_F32) + */ + float planeTolerance; + + /** + \brief Convex hull creation algorithm. + + Default value: PxConvexMeshCookingType::eQUICKHULL + + \see PxConvexMeshCookingType + */ + PxConvexMeshCookingType::Enum convexMeshCookingType; + + /** + \brief When true, the face remap table is not created. This saves a significant amount of memory, but the SDK will + not be able to provide the remap information for internal mesh triangles returned by collisions, + sweeps or raycasts hits. + + Default value: false + */ + bool suppressTriangleMeshRemapTable; + + /** + \brief When true, the triangle adjacency information is created. You can get the adjacency triangles + for a given triangle from getTriangle. + + Default value: false + */ + bool buildTriangleAdjacencies; + + /** + \brief When true, additional information required for GPU-accelerated rigid body simulation is created. This can increase memory usage and cooking times for convex meshes and triangle meshes. + + Default value: false + */ + bool buildGPUData; + + /** + \brief Tolerance scale is used to check if cooked triangles are not too huge. This check will help with simulation stability. + + \note The PxTolerancesScale values have to match the values used when creating a PxPhysics or PxScene instance. + + \see PxTolerancesScale + */ + PxTolerancesScale scale; + + /** + \brief Mesh pre-processing parameters. Used to control options like whether the mesh cooking performs vertex welding before cooking. + + Default value: 0 + */ + PxMeshPreprocessingFlags meshPreprocessParams; + + /** + \brief Mesh weld tolerance. If mesh welding is enabled, this controls the distance at which vertices are welded. + If mesh welding is not enabled, this value defines the acceptance distance for mesh validation. Provided no two vertices are within this distance, the mesh is considered to be + clean. If not, a warning will be emitted. Having a clean, welded mesh is required to achieve the best possible performance. + + The default vertex welding uses a snap-to-grid approach. This approach effectively truncates each vertex to integer values using meshWeldTolerance. + Once these snapped vertices are produced, all vertices that snap to a given vertex on the grid are remapped to reference a single vertex. Following this, + all triangles' indices are remapped to reference this subset of clean vertices. It should be noted that the vertices that we do not alter the + position of the vertices; the snap-to-grid is only performed to identify nearby vertices. + + The mesh validation approach also uses the same snap-to-grid approach to identify nearby vertices. If more than one vertex snaps to a given grid coordinate, + we ensure that the distance between the vertices is at least meshWeldTolerance. If this is not the case, a warning is emitted. + + Default value: 0.0 + */ + PxReal meshWeldTolerance; + + /** + \brief "Zero-area" epsilon used in mesh cleaning. + + This is similar to areaTestEpsilon, but for the mesh cleaning operation. + + If the area of a triangle is below this value, the triangle will be removed. This is only done when mesh cleaning is enabled, + i.e. when PxMeshPreprocessingFlag::eDISABLE_CLEAN_MESH is not set. + + Default value is 0.0f to be consistent with previous PhysX versions, which only removed triangles whose area + was exactly zero. + + \see PxMeshPreprocessingFlag::eDISABLE_CLEAN_MESH + + Default value: 0.0f + + Range: (0.0f, PX_MAX_F32) + */ + PxReal meshAreaMinLimit; + + /** + \brief Maximum edge length. + + If an edge of a triangle is above this value, a warning is sent to the error stream. This is only a check, + corresponding triangles are not removed. + + This is only done when mesh cleaning is enabled, i.e. when PxMeshPreprocessingFlag::eDISABLE_CLEAN_MESH is not set. + + Default value is 500.0f to be consistent with previous PhysX versions. This value is internally multiplied by + PxTolerancesScale::length before being used. Use 0.0f to disable the checks. + + \see PxMeshPreprocessingFlag::eDISABLE_CLEAN_MESH + + Default value: 500.0f + + Range: (0.0f, PX_MAX_F32) + */ + PxReal meshEdgeLengthMaxLimit; + + /** + \brief Controls the desired midphase desc structure for triangle meshes. + + \see PxBVH33MidphaseDesc, PxBVH34MidphaseDesc, PxMidphaseDesc + + Default value: PxMeshMidPhase::eBVH34 + */ + PxMidphaseDesc midphaseDesc; + + /** + \brief Vertex limit beyond which additional acceleration structures are computed for each convex mesh. Increase that limit to reduce memory usage. + Computing the extra structures all the time does not guarantee optimal performance. There is a per-platform break-even point below which the + extra structures actually hurt performance. + + Default value: 32 + */ + PxU32 gaussMapLimit; + + /** + \brief Maximum mass ratio allowed on vertices touched by a single tet. If a any tetrahedron exceeds the mass ratio, the masses will get smoothed locally + until the maximum mass ratio is matched. Value should not be below 1. Smoothing might not fully converge for values <1.5. The smaller the maximum + allowed ratio, the better the stability during simulation. + + Default value: FLT_MAX + */ + PxReal maxWeightRatioInTet; + + PxCookingParams(const PxTolerancesScale& sc): + areaTestEpsilon (0.06f*sc.length*sc.length), + planeTolerance (0.0007f), + convexMeshCookingType (PxConvexMeshCookingType::eQUICKHULL), + suppressTriangleMeshRemapTable (false), + buildTriangleAdjacencies (false), + buildGPUData (false), + scale (sc), + meshPreprocessParams (0), + meshWeldTolerance (0.0f), + meshAreaMinLimit (0.0f), + meshEdgeLengthMaxLimit (500.0f), + gaussMapLimit (32), + maxWeightRatioInTet (FLT_MAX) + { + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +// Immediate cooking + +/** +\brief Gets standalone object insertion interface. + +This interface allows the creation of standalone objects that can exist without a PxPhysics or PxScene object. + +\see PxCreateTriangleMesh PxCreateHeightfield PxCreateTetrahedronMesh PxCreateBVH +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxInsertionCallback* PxGetStandaloneInsertionCallback(); + +// ==== BVH ==== + +/** +\brief Cooks a bounding volume hierarchy. The results are written to the stream. + +PxCookBVH() allows a BVH description to be cooked into a binary stream +suitable for loading and performing BVH detection at runtime. + +\param[in] desc The BVH descriptor. +\param[in] stream User stream to output the cooked data. +\return true on success. + +\see PxBVH PxRigidActorExt::getRigidActorShapeLocalBoundsList +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxCookBVH(const physx::PxBVHDesc& desc, physx::PxOutputStream& stream); + +/** +\brief Cooks and creates a bounding volume hierarchy without going through a stream. + +\note This method does the same as PxCookBVH, but the produced BVH is not stored +into a stream but is either directly inserted in PxPhysics, or created as a standalone +object. Use this method if you are unable to cook offline. + +\note PxInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback() +or PxGetStandaloneInsertionCallback(). + +\param[in] desc The BVH descriptor. +\param[in] insertionCallback The insertion interface. +\return PxBVH pointer on success + +\see PxCookBVH() PxInsertionCallback +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxBVH* PxCreateBVH(const physx::PxBVHDesc& desc, physx::PxInsertionCallback& insertionCallback); + +/** +\brief Cooks and creates a bounding volume hierarchy without going through a stream. Convenience function for standalone objects. + +\note This method does the same as PxCookBVH, but the produced BVH is not stored +into a stream but is either directly inserted in PxPhysics, or created as a standalone +object. Use this method if you are unable to cook offline. + +\param[in] desc The BVH descriptor. +\return PxBVH pointer on success + +\see PxCookBVH() PxInsertionCallback +*/ +PX_FORCE_INLINE physx::PxBVH* PxCreateBVH(const physx::PxBVHDesc& desc) +{ + return PxCreateBVH(desc, *PxGetStandaloneInsertionCallback()); +} + +// ==== Heightfield ==== + +/** +\brief Cooks a heightfield. The results are written to the stream. + +To create a heightfield object there is an option to precompute some of calculations done while loading the heightfield data. + +PxCookHeightField() allows a heightfield description to be cooked into a binary stream +suitable for loading and performing collision detection at runtime. + +\param[in] desc The heightfield descriptor to read the HF from. +\param[in] stream User stream to output the cooked data. +\return true on success + +\see PxPhysics.createHeightField() +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxCookHeightField(const physx::PxHeightFieldDesc& desc, physx::PxOutputStream& stream); + +/** +\brief Cooks and creates a heightfield mesh and inserts it into PxPhysics. + +\param[in] desc The heightfield descriptor to read the HF from. +\param[in] insertionCallback The insertion interface from PxPhysics. +\return PxHeightField pointer on success + +\see PxCookHeightField() PxPhysics.createHeightField() PxInsertionCallback +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxHeightField* PxCreateHeightField(const physx::PxHeightFieldDesc& desc, physx::PxInsertionCallback& insertionCallback); + +/** +\brief Cooks and creates a heightfield mesh and inserts it into PxPhysics. Convenience function for standalone objects. + +\param[in] desc The heightfield descriptor to read the HF from. +\return PxHeightField pointer on success + +\see PxCookHeightField() PxPhysics.createHeightField() PxInsertionCallback +*/ +PX_FORCE_INLINE physx::PxHeightField* PxCreateHeightField(const physx::PxHeightFieldDesc& desc) +{ + return PxCreateHeightField(desc, *PxGetStandaloneInsertionCallback()); +} + +// ==== Convex meshes ==== + +/** +\brief Cooks a convex mesh. The results are written to the stream. + +To create a triangle mesh object it is necessary to first 'cook' the mesh data into +a form which allows the SDK to perform efficient collision detection. + +PxCookConvexMesh() allows a mesh description to be cooked into a binary stream +suitable for loading and performing collision detection at runtime. + +\note The number of vertices and the number of convex polygons in a cooked convex mesh is limited to 255. +\note If those limits are exceeded in either the user-provided data or the final cooked mesh, an error is reported. + +\param[in] params The cooking parameters +\param[in] desc The convex mesh descriptor to read the mesh from. +\param[in] stream User stream to output the cooked data. +\param[out] condition Result from convex mesh cooking. +\return true on success. + +\see PxCookTriangleMesh() PxConvexMeshCookingResult::Enum +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxCookConvexMesh(const physx::PxCookingParams& params, const physx::PxConvexMeshDesc& desc, physx::PxOutputStream& stream, physx::PxConvexMeshCookingResult::Enum* condition=NULL); + +/** +\brief Cooks and creates a convex mesh without going through a stream. + +\note This method does the same as PxCookConvexMesh, but the produced mesh is not stored +into a stream but is either directly inserted in PxPhysics, or created as a standalone +object. Use this method if you are unable to cook offline. + +\note PxInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback() +or PxGetStandaloneInsertionCallback(). + +\param[in] params The cooking parameters +\param[in] desc The convex mesh descriptor to read the mesh from. +\param[in] insertionCallback The insertion interface from PxPhysics. +\param[out] condition Result from convex mesh cooking. +\return PxConvexMesh pointer on success + +\see PxCookConvexMesh() PxInsertionCallback +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxConvexMesh* PxCreateConvexMesh(const physx::PxCookingParams& params, const physx::PxConvexMeshDesc& desc, physx::PxInsertionCallback& insertionCallback, physx::PxConvexMeshCookingResult::Enum* condition=NULL); + +/** +\brief Cooks and creates a convex mesh without going through a stream. Convenience function for standalone objects. + +\note This method does the same as cookConvexMesh, but the produced mesh is not stored +into a stream but is either directly inserted in PxPhysics, or created as a standalone +object. Use this method if you are unable to cook offline. + +\param[in] params The cooking parameters +\param[in] desc The convex mesh descriptor to read the mesh from. +\return PxConvexMesh pointer on success + +\see PxCookConvexMesh() PxInsertionCallback +*/ +PX_FORCE_INLINE physx::PxConvexMesh* PxCreateConvexMesh(const physx::PxCookingParams& params, const physx::PxConvexMeshDesc& desc) +{ + return PxCreateConvexMesh(params, desc, *PxGetStandaloneInsertionCallback()); +} + +/** +\brief Verifies if the convex mesh is valid. Prints an error message for each inconsistency found. + +The convex mesh descriptor must contain an already created convex mesh - the vertices, indices and polygons must be provided. + +\note This function should be used if PxConvexFlag::eDISABLE_MESH_VALIDATION is planned to be used in release builds. + +\param[in] params The cooking parameters +\param[in] desc The convex mesh descriptor to read the mesh from. + +\return true if all the validity conditions hold, false otherwise. + +\see PxCookConvexMesh() +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxValidateConvexMesh(const physx::PxCookingParams& params, const physx::PxConvexMeshDesc& desc); + +/** +\brief Compute hull polygons from given vertices and triangles. Polygons are needed for PxConvexMeshDesc rather than triangles. + +Please note that the resulting polygons may have different number of vertices. Some vertices may be removed. +The output vertices, indices and polygons must be used to construct a hull. + +The provided PxAllocatorCallback does allocate the out arrays. It is the user responsibility to deallocated those arrays. + +\param[in] params The cooking parameters +\param[in] mesh Simple triangle mesh containing vertices and triangles used to compute polygons. +\param[in] inCallback Memory allocator for out array allocations. +\param[out] nbVerts Number of vertices used by polygons. +\param[out] vertices Vertices array used by polygons. +\param[out] nbIndices Number of indices used by polygons. +\param[out] indices Indices array used by polygons. +\param[out] nbPolygons Number of created polygons. +\param[out] hullPolygons Polygons array. +\return true on success + +\see PxCookConvexMesh() PxConvexFlags PxConvexMeshDesc PxSimpleTriangleMesh +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxComputeHullPolygons(const physx::PxCookingParams& params, const physx::PxSimpleTriangleMesh& mesh, physx::PxAllocatorCallback& inCallback, physx::PxU32& nbVerts, physx::PxVec3*& vertices, + physx::PxU32& nbIndices, physx::PxU32*& indices, physx::PxU32& nbPolygons, physx::PxHullPolygon*& hullPolygons); + +// ==== Triangle meshes ==== + +/** +\brief Verifies if the triangle mesh is valid. Prints an error message for each inconsistency found. + +The following conditions are true for a valid triangle mesh: +1. There are no duplicate vertices (within specified vertexWeldTolerance. See PxCookingParams::meshWeldTolerance) +2. There are no large triangles (within specified PxTolerancesScale.) + +\param[in] params The cooking parameters +\param[in] desc The triangle mesh descriptor to read the mesh from. + +\return true if all the validity conditions hold, false otherwise. + +\see PxCookTriangleMesh() +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxValidateTriangleMesh(const physx::PxCookingParams& params, const physx::PxTriangleMeshDesc& desc); + +/** +\brief Cooks a triangle mesh. The results are written to the stream. + +To create a triangle mesh object it is necessary to first 'cook' the mesh data into +a form which allows the SDK to perform efficient collision detection. + +PxCookTriangleMesh() allows a mesh description to be cooked into a binary stream +suitable for loading and performing collision detection at runtime. + +\param[in] params The cooking parameters +\param[in] desc The triangle mesh descriptor to read the mesh from. +\param[in] stream User stream to output the cooked data. +\param[out] condition Result from triangle mesh cooking. +\return true on success + +\see PxCookConvexMesh() PxPhysics.createTriangleMesh() PxTriangleMeshCookingResult::Enum +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxCookTriangleMesh(const physx::PxCookingParams& params, const physx::PxTriangleMeshDesc& desc, physx::PxOutputStream& stream, physx::PxTriangleMeshCookingResult::Enum* condition=NULL); + +/** +\brief Cooks and creates a triangle mesh without going through a stream. + +\note This method does the same as PxCookTriangleMesh, but the produced mesh is not stored +into a stream but is either directly inserted in PxPhysics, or created as a standalone +object. Use this method if you are unable to cook offline. + +\note PxInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback() +or PxGetStandaloneInsertionCallback(). + +\param[in] params The cooking parameters +\param[in] desc The triangle mesh descriptor to read the mesh from. +\param[in] insertionCallback The insertion interface from PxPhysics. +\param[out] condition Result from triangle mesh cooking. +\return PxTriangleMesh pointer on success. + +\see PxCookTriangleMesh() PxPhysics.createTriangleMesh() PxInsertionCallback +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxTriangleMesh* PxCreateTriangleMesh(const physx::PxCookingParams& params, const physx::PxTriangleMeshDesc& desc, physx::PxInsertionCallback& insertionCallback, physx::PxTriangleMeshCookingResult::Enum* condition=NULL); + +/** +\brief Cooks and creates a triangle mesh without going through a stream. Convenience function for standalone objects. + +\note This method does the same as cookTriangleMesh, but the produced mesh is not stored +into a stream but is either directly inserted in PxPhysics, or created as a standalone +object. Use this method if you are unable to cook offline. +\return PxTriangleMesh pointer on success. + +\param[in] params The cooking parameters +\param[in] desc The triangle mesh descriptor to read the mesh from. + +\see PxCookTriangleMesh() PxPhysics.createTriangleMesh() PxInsertionCallback +*/ +PX_FORCE_INLINE physx::PxTriangleMesh* PxCreateTriangleMesh(const physx::PxCookingParams& params, const physx::PxTriangleMeshDesc& desc) +{ + return PxCreateTriangleMesh(params, desc, *PxGetStandaloneInsertionCallback()); +} + +// ==== Tetrahedron & deformable volume meshes ==== + +/** +\brief Cooks a tetrahedron mesh. The results are written to the stream. + +To create a tetrahedron mesh object it is necessary to first 'cook' the mesh data into +a form which allows the SDK to perform efficient collision detection. + +PxCookTetrahedronMesh() allows a mesh description to be cooked into a binary stream +suitable for loading and performing collision detection at runtime. + +\param[in] params The cooking parameters +\param[in] meshDesc The tetrahedron mesh descriptor to read the mesh from. +\param[in] stream User stream to output the cooked data. +\return true on success + +\see PxCookConvexMesh() PxPhysics.createTetrahedronMesh() +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxCookTetrahedronMesh(const physx::PxCookingParams& params, const physx::PxTetrahedronMeshDesc& meshDesc, physx::PxOutputStream& stream); + +/** +\brief Cooks and creates a tetrahedron mesh without going through a stream. + +\note This method does the same as PxCookTetrahedronMesh, but the produced mesh is not stored +into a stream but is either directly inserted in PxPhysics, or created as a standalone +object. Use this method if you are unable to cook offline. + +\note PxInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback() +or PxGetStandaloneInsertionCallback(). + +\param[in] params The cooking parameters +\param[in] meshDesc The tetrahedron mesh descriptor to read the mesh from. +\param[in] insertionCallback The insertion interface from PxPhysics. +\return PxTetrahedronMesh pointer on success. + +\see PxCookTetrahedronMesh() PxInsertionCallback +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxTetrahedronMesh* PxCreateTetrahedronMesh(const physx::PxCookingParams& params, const physx::PxTetrahedronMeshDesc& meshDesc, physx::PxInsertionCallback& insertionCallback); + +/** +\brief Cooks and creates a tetrahedron mesh without going through a stream. Convenience function for standalone objects. + +\note This method does the same as PxCookTetrahedronMesh, but the produced mesh is not stored +into a stream but is either directly inserted in PxPhysics, or created as a standalone +object. Use this method if you are unable to cook offline. + +\param[in] params The cooking parameters +\param[in] meshDesc The tetrahedron mesh descriptor to read the mesh from. +\return PxTetrahedronMesh pointer on success. + +\see PxCookTetrahedronMesh() PxInsertionCallback +*/ +PX_FORCE_INLINE physx::PxTetrahedronMesh* PxCreateTetrahedronMesh(const physx::PxCookingParams& params, const physx::PxTetrahedronMeshDesc& meshDesc) +{ + return PxCreateTetrahedronMesh(params, meshDesc, *PxGetStandaloneInsertionCallback()); +} + +/** +\brief Cooks a deformable volume mesh. The results are written to the stream. + +To create a deformable volume mesh object it is necessary to first 'cook' the mesh data into +a form which allows the SDK to perform efficient collision detection and to store data +used during the FEM calculations. + +PxCookDeformableVolumeMesh() allows a mesh description to be cooked into a binary stream +suitable for loading and performing collision detection at runtime. + +\param[in] params The cooking parameters +\param[in] simulationMeshDesc The tetrahedron mesh descriptor to read the simulation mesh from. +\param[in] collisionMeshDesc The tetrahedron mesh descriptor to read the collision mesh from. +\param[in] simulationDataDesc The deformable volume data descriptor to read mapping information from. +\param[in] stream User stream to output the cooked data. +\return true on success + +\see PxCookConvexMesh() PxPhysics.createTriangleMesh() PxTriangleMeshCookingResult::Enum +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxCookDeformableVolumeMesh(const physx::PxCookingParams& params, + const physx::PxTetrahedronMeshDesc& simulationMeshDesc, const physx::PxTetrahedronMeshDesc& collisionMeshDesc, + const physx::PxDeformableVolumeSimulationDataDesc& simulationDataDesc, physx::PxOutputStream& stream); + +/** +\brief Deprecated +\see PxCookDeformableVolumeMesh +*/ +PX_DEPRECATED PX_FORCE_INLINE bool PxCookSoftBodyMesh(const physx::PxCookingParams& params, + const physx::PxTetrahedronMeshDesc& simulationMeshDesc, const physx::PxTetrahedronMeshDesc& collisionMeshDesc, + const physx::PxDeformableVolumeSimulationDataDesc& simulationDataDesc, physx::PxOutputStream& stream) +{ + return PxCookDeformableVolumeMesh(params, simulationMeshDesc, collisionMeshDesc, simulationDataDesc, stream); +} + +/** +\brief Cooks and creates a deformable volume mesh without going through a stream. + +\note This method does the same as PxCookDeformableVolumeMesh, but the produced mesh is not stored +into a stream but is either directly inserted in PxPhysics, or created as a standalone +object. Use this method if you are unable to cook offline. + +\note PxInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback() +or PxGetStandaloneInsertionCallback(). + +\param[in] params The cooking parameters +\param[in] simulationMeshDesc The tetrahedron mesh descriptor to read the simulation mesh from. +\param[in] collisionMeshDesc The tetrahedron mesh descriptor to read the collision mesh from. +\param[in] simulationDataDesc The deformable volume data descriptor to read mapping information from. +\param[in] insertionCallback The insertion interface from PxPhysics. +\return PxDeformableVolumeMesh pointer on success. + +\see PxCookTriangleMesh() PxPhysics.createTriangleMesh() PxInsertionCallback +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxDeformableVolumeMesh* PxCreateDeformableVolumeMesh(const physx::PxCookingParams& params, + const physx::PxTetrahedronMeshDesc& simulationMeshDesc, const physx::PxTetrahedronMeshDesc& collisionMeshDesc, + const physx::PxDeformableVolumeSimulationDataDesc& simulationDataDesc, physx::PxInsertionCallback& insertionCallback); + +/** +\brief Deprecated +\see PxCreateDeformableVolumeMesh +*/ +PX_DEPRECATED PX_FORCE_INLINE physx::PxDeformableVolumeMesh* PxCreateSoftBodyMesh(const physx::PxCookingParams& params, + const physx::PxTetrahedronMeshDesc& simulationMeshDesc, const physx::PxTetrahedronMeshDesc& collisionMeshDesc, + const physx::PxDeformableVolumeSimulationDataDesc& simulationDataDesc, physx::PxInsertionCallback& insertionCallback) +{ + return PxCreateDeformableVolumeMesh(params, simulationMeshDesc, collisionMeshDesc, simulationDataDesc, insertionCallback); +} + +/** +\brief Cooks and creates a deformable volume mesh without going through a stream. Convenience function for standalone objects. + +\note This method does the same as PxCreateDeformableVolumeMesh, but the produced mesh is not stored +into a stream but is either directly inserted in PxPhysics, or created as a standalone +object. Use this method if you are unable to cook offline. + +\param[in] params The cooking parameters +\param[in] simulationMeshDesc The tetrahedron mesh descriptor to read the simulation mesh from. +\param[in] collisionMeshDesc The tetrahedron mesh descriptor to read the collision mesh from. +\param[in] simulationDataDesc The deformable volume data descriptor to read mapping information from. +\return PxDeformableVolumeMesh pointer on success. + +\see PxCookTriangleMesh() PxPhysics.createTriangleMesh() PxInsertionCallback +*/ +PX_FORCE_INLINE physx::PxDeformableVolumeMesh* PxCreateDeformableVolumeMesh(const physx::PxCookingParams& params, + const physx::PxTetrahedronMeshDesc& simulationMeshDesc, const physx::PxTetrahedronMeshDesc& collisionMeshDesc, + const physx::PxDeformableVolumeSimulationDataDesc& simulationDataDesc) +{ + return PxCreateDeformableVolumeMesh(params, simulationMeshDesc, collisionMeshDesc, simulationDataDesc, *PxGetStandaloneInsertionCallback()); +} + +/** +\brief Deprecated +\see PxCreateDeformableVolumeMesh +*/ +PX_DEPRECATED PX_FORCE_INLINE physx::PxDeformableVolumeMesh* PxCreateSoftBodyMesh(const physx::PxCookingParams& params, + const physx::PxTetrahedronMeshDesc& simulationMeshDesc, const physx::PxTetrahedronMeshDesc& collisionMeshDesc, + const physx::PxDeformableVolumeSimulationDataDesc& simulationDataDesc) +{ + return PxCreateDeformableVolumeMesh(params, simulationMeshDesc, collisionMeshDesc, simulationDataDesc, *PxGetStandaloneInsertionCallback()); +} + +/** +\brief Computes the mapping between collision and simulation mesh + +The deformable volume deformation is computed on the simulation mesh. To deform the collision mesh accordingly +it needs to be specified how its vertices need to be placed and updated inside the deformation mesh. +This method computes that embedding information. + +\param[in] params The cooking parameters +\param[in] simulationMesh A tetrahedral mesh that defines the shape of the simulation mesh which is used to compute the body's deformation +\param[in] collisionMesh A tetrahedral mesh that defines the shape of the collision mesh which is used for collision detection +\param[in] collisionData A data container that contains acceleration structures and surface information of the collision mesh +\param[in] vertexToTet Optional indices (array of integers) that specifies the index of the tetrahedron in the simulation mesh that + contains a collision mesh vertex. If not provided, the embedding will be computed internally. If the simulation mesh is obtained from + PxTetMaker::createVoxelTetrahedronMesh, then the vertexToTet map createVoxelTetrahedronMesh returned should be used here. +\return PxCollisionMeshMappingData pointer that describes how the collision mesh is embedded into the simulation mesh + +\see PxTetMaker::createVoxelTetrahedronMesh +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxCollisionMeshMappingData* PxComputeModelsMapping(const physx::PxCookingParams& params, + physx::PxTetrahedronMeshData& simulationMesh, const physx::PxTetrahedronMeshData& collisionMesh, + const physx::PxDeformableVolumeCollisionData& collisionData, const physx::PxBoundedData* vertexToTet = NULL); + +/** +\brief Computes data to accelerate collision detection of tetrahedral meshes + +Computes data structures to speed up collision detection with tetrahedral meshes. + +\param[in] params The cooking parameters +\param[in] collisionMeshDesc Raw tetrahedral mesh descriptor which will be used for collision detection +\return PxCollisionTetrahedronMeshData pointer that describes the collision mesh +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxCollisionTetrahedronMeshData* PxComputeCollisionData(const physx::PxCookingParams& params, + const physx::PxTetrahedronMeshDesc& collisionMeshDesc); + +/** +\brief Computes data to accelerate collision detection of tetrahedral meshes + +Computes data to compute and store a deformable volume's deformation using FEM. + +\param[in] params The cooking parameters +\param[in] simulationMeshDesc Raw tetrahedral mesh descriptor which will be used for FEM simulation +\return PxSimulationTetrahedronMeshData pointer that describes the simulation mesh +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxSimulationTetrahedronMeshData* PxComputeSimulationData(const physx::PxCookingParams& params, + const physx::PxTetrahedronMeshDesc& simulationMeshDesc); + +/** +\brief Bundles all data required for deformable volume simulation + +Creates a container that provides everything to create a PxDeformableVolume + +\param[in] simulationMesh The geometry (tetrahedral mesh) to be used as simulation mesh +\param[in] simulationData Additional non-tetmesh data that contains mass information etc. for the simulation mesh +\param[in] collisionMesh The geometry (tetrahedral mesh) to be used for collision detection +\param[in] collisionData Additional non-tetmesh data that contains surface information, acceleration structures etc. for the simulation mesh +\param[in] mappingData Mapping that describes how the collision mesh's vertices are embedded into the simulation mesh +\param[in] insertionCallback The insertion interface from PxPhysics. +\return PxDeformableVolumeMesh pointer that represents a deformable volume mesh bundling all data (simulation mesh, collision mesh etc.) + +\see PxDeformableVolume createDeformableVolume() +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxDeformableVolumeMesh* PxAssembleDeformableVolumeMesh(physx::PxTetrahedronMeshData& simulationMesh, + physx::PxDeformableVolumeSimulationData& simulationData, physx::PxTetrahedronMeshData& collisionMesh, physx::PxDeformableVolumeCollisionData& collisionData, + physx::PxCollisionMeshMappingData& mappingData, physx::PxInsertionCallback& insertionCallback); + +/** +\brief Deprecated +\see PxAssembleDeformableVolumeMesh +*/ +PX_DEPRECATED PX_FORCE_INLINE physx::PxDeformableVolumeMesh* PxAssembleSoftBodyMesh(physx::PxTetrahedronMeshData& simulationMesh, + physx::PxDeformableVolumeSimulationData& simulationData, physx::PxTetrahedronMeshData& collisionMesh, physx::PxDeformableVolumeCollisionData& collisionData, + physx::PxCollisionMeshMappingData& mappingData, physx::PxInsertionCallback& insertionCallback) +{ + return PxAssembleDeformableVolumeMesh(simulationMesh, simulationData, collisionMesh, collisionData, mappingData, insertionCallback); +} + +/** +\brief Deprecated +\see PxAssembleDeformableVolumeMesh +*/ +PX_DEPRECATED PX_FORCE_INLINE physx::PxDeformableVolumeMesh* PxAssembleSoftBodyMesh_Sim(physx::PxSimulationTetrahedronMeshData& simulationMesh, + physx::PxCollisionTetrahedronMeshData& collisionMesh, physx::PxCollisionMeshMappingData& mappingData, physx::PxInsertionCallback& insertionCallback) +{ + return PxAssembleDeformableVolumeMesh(*simulationMesh.getMesh(), *simulationMesh.getData(), + *collisionMesh.getMesh(), *collisionMesh.getData(), mappingData, insertionCallback); +} + +#endif diff --git a/engine/third_party/physx/include/cooking/PxCookingInternal.h b/engine/third_party/physx/include/cooking/PxCookingInternal.h new file mode 100644 index 00000000..27c20ff7 --- /dev/null +++ b/engine/third_party/physx/include/cooking/PxCookingInternal.h @@ -0,0 +1,52 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_COOKING_INTERNAL_H +#define PX_COOKING_INTERNAL_H + +#include "cooking/PxCooking.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + struct PxTriangleMeshInternalData; + struct PxBVHInternalData; + class PxTriangleMesh; + class PxBVH; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxTriangleMesh* PX_CALL_CONV PxCreateTriangleMeshInternal(const physx::PxTriangleMeshInternalData& data); + + PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxBVH* PX_CALL_CONV PxCreateBVHInternal(const physx::PxBVHInternalData& data); + +#endif diff --git a/engine/third_party/physx/include/cooking/PxMidphaseDesc.h b/engine/third_party/physx/include/cooking/PxMidphaseDesc.h new file mode 100644 index 00000000..27741cfa --- /dev/null +++ b/engine/third_party/physx/include/cooking/PxMidphaseDesc.h @@ -0,0 +1,118 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_MIDPHASE_DESC_H +#define PX_MIDPHASE_DESC_H + +#include "geometry/PxTriangleMesh.h" +#include "cooking/PxBVH33MidphaseDesc.h" +#include "cooking/PxBVH34MidphaseDesc.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** + +\brief Structure describing parameters affecting midphase mesh structure. + +\see PxCookingParams, PxBVH33MidphaseDesc, PxBVH34MidphaseDesc +*/ +class PxMidphaseDesc +{ +public: + PX_FORCE_INLINE PxMidphaseDesc() { setToDefault(PxMeshMidPhase::eBVH34); } + + /** + \brief Returns type of midphase mesh structure. + \return PxMeshMidPhase::Enum + + \see PxMeshMidPhase::Enum + */ + PX_FORCE_INLINE PxMeshMidPhase::Enum getType() const { return mType; } + + /** + \brief Midphase descriptors union + + \see PxBV33MidphaseDesc, PxBV34MidphaseDesc + */ + union { + PxBVH33MidphaseDesc mBVH33Desc; + PxBVH34MidphaseDesc mBVH34Desc; + }; + + /** + \brief Initialize the midphase mesh structure descriptor + \param[in] type Midphase mesh structure descriptor + + \see PxBV33MidphaseDesc, PxBV34MidphaseDesc + */ + void setToDefault(PxMeshMidPhase::Enum type) + { + mType = type; + if(type==PxMeshMidPhase::eBVH33) + mBVH33Desc.setToDefault(); + else if(type==PxMeshMidPhase::eBVH34) + mBVH34Desc.setToDefault(); + } + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid. + */ + bool isValid() const + { + if(mType==PxMeshMidPhase::eBVH33) + return mBVH33Desc.isValid(); + else if(mType==PxMeshMidPhase::eBVH34) + return mBVH34Desc.isValid(); + return false; + } + + /** + \brief Assignment operator + \return this + */ + PX_FORCE_INLINE PxMidphaseDesc& operator=(PxMeshMidPhase::Enum descType) + { + setToDefault(descType); + return *this; + } + +protected: + PxMeshMidPhase::Enum mType; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + +#endif + diff --git a/engine/third_party/physx/include/cooking/PxSDFDesc.h b/engine/third_party/physx/include/cooking/PxSDFDesc.h new file mode 100644 index 00000000..36e0ce3d --- /dev/null +++ b/engine/third_party/physx/include/cooking/PxSDFDesc.h @@ -0,0 +1,207 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SDF_DESC_H +#define PX_SDF_DESC_H + +#include "PxPhysXConfig.h" +#include "geometry/PxSimpleTriangleMesh.h" +#include "foundation/PxBounds3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + class PxSDFBuilder; + + /** + \brief A helper structure to define dimensions in 3D + */ + struct PxDim3 + { + PxU32 x, y, z; + }; + + /** + \brief Defines the number of bits per subgrid pixel + */ + class PxSdfBitsPerSubgridPixel + { + public: + enum Enum + { + e8_BIT_PER_PIXEL = 1, //!< 8 bit per subgrid pixel (values will be stored as normalized integers) + e16_BIT_PER_PIXEL = 2, //!< 16 bit per subgrid pixel (values will be stored as normalized integers) + e32_BIT_PER_PIXEL = 4 //!< 32 bit per subgrid pixel (values will be stored as floats in world scale units) + }; + }; + + /** + \brief A structure describing signed distance fields (SDF) for triangle meshes. SDF colliders only work when the GPU solver is + used to run the simulation. The GPU solver is enabled by setting the flag PxSceneFlag::eENABLE_GPU_DYNAMICS in the scene description. + */ + class PxSDFDesc + { + public: + + /** + \brief Pointer to first sdf array element. + */ + PxBoundedData sdf; + + /** + \brief Dimensions of sdf + */ + PxDim3 dims; + + /** + \brief The Lower bound of the original mesh + */ + PxVec3 meshLower; + + /** + \brief The spacing of each sdf voxel + */ + PxReal spacing; + + + /** + \brief The number of cells in a sparse subgrid block (full block has subgridSize^3 cells and (subgridSize+1)^3 samples). If set to zero, this indicates that only a dense background grid SDF is used without sparse blocks + */ + PxU32 subgridSize; + + /** + \brief Enumeration that defines the number of bits per subgrid pixel (either 32, 16 or 8bits) + */ + PxSdfBitsPerSubgridPixel::Enum bitsPerSubgridPixel; + + /** + \brief Number of subgrid blocks in the 3d texture. The full texture dimension will be sdfSubgrids3DTexBlockDim*(subgridSize+1). + */ + PxDim3 sdfSubgrids3DTexBlockDim; + + /** + \brief The data to create the 3d texture containg the packed subgrid blocks. Stored as PxU8 to support multiple formats (8, 16 and 32 bits per pixel) + */ + PxBoundedData sdfSubgrids; + + /** + \brief Array with start indices into the subgrid texture for every subgrid block. 10bits for z coordinate, 10bits for y and 10bits for x. Encoding is as follows: slot = (z << 20) | (y << 10) | x + */ + PxBoundedData sdfStartSlots; + + /** + \brief The minimum value over all subgrid blocks. Used if normalized textures are used which is the case for 8 and 16bit formats + */ + PxReal subgridsMinSdfValue; + + /** + \brief The maximum value over all subgrid blocks. Used if normalized textures are used which is the case for 8 and 16bit formats + */ + PxReal subgridsMaxSdfValue; + + /** + \brief The bounds of the sdf. If left unassigned (empty), the bounds of the mesh will be used + */ + PxBounds3 sdfBounds; + + /** + \brief Narrow band thickness as a fraction of the bounds diagonal length. Every subgrid block that + overlaps with the narrow band around the mesh surface will be kept providing high resolution around the mesh surface. + The valid range of this parameter is (0, 1). The higher the value, the more subgrids will get created, the more memory will be required. + */ + PxReal narrowBandThicknessRelativeToSdfBoundsDiagonal; + + /** + \brief The number of threads that are launched to compute the signed distance field + */ + PxU32 numThreadsForSdfConstruction; + + /** + \brief Optional pointer to the geometry of the mesh that is used to compute the SDF. If it is not set, the geometry of the mesh, that this descriptor is passed to during cooking, will be taken. + The mesh data must only be available during cooking. It can be released once cooking completed. + */ + PxSimpleTriangleMesh baseMesh; + + /** + \brief Optional pointer to an instance of a SDF builder. This significantly speeds up the construction of the SDF since the default SDF builder will do almost all computations directly on the GPU. + The user must release the instance of the SDF builder once cooking completed. + */ + PxSDFBuilder* sdfBuilder; + + /** + \brief Constructor + */ + PX_INLINE PxSDFDesc(); + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid + */ + PX_INLINE bool isValid() const; + }; + + PX_INLINE PxSDFDesc::PxSDFDesc() + { + sdf.data = NULL; + dims.x = 0; + dims.y = 0; + dims.z = 0; + spacing = 0; + meshLower = PxVec3(PxZero); + subgridSize = 0; + subgridsMinSdfValue = 0.0f; + subgridsMaxSdfValue = 0.0f; + sdfBounds = PxBounds3::empty(); + bitsPerSubgridPixel = PxSdfBitsPerSubgridPixel::e16_BIT_PER_PIXEL; + narrowBandThicknessRelativeToSdfBoundsDiagonal = 0.01f; + numThreadsForSdfConstruction = 1; + sdfBuilder = NULL; + } + + PX_INLINE bool PxSDFDesc::isValid() const + { + // Check validity of user's input(if any) + if (sdf.data) + { + if (dims.x < 1 || dims.y < 1 || dims.z < 1) + return false; + if (!meshLower.isFinite()) + return false; + if (spacing <= 0) + return false; + } + + return true; + } + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/cooking/PxTetrahedronMeshDesc.h b/engine/third_party/physx/include/cooking/PxTetrahedronMeshDesc.h new file mode 100644 index 00000000..15a42602 --- /dev/null +++ b/engine/third_party/physx/include/cooking/PxTetrahedronMeshDesc.h @@ -0,0 +1,232 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_TETRAHEDRON_MESH_DESC_H +#define PX_TETRAHEDRON_MESH_DESC_H + +#include "PxPhysXConfig.h" +#include "foundation/PxVec3.h" +#include "foundation/PxFlags.h" +#include "common/PxCoreUtilityTypes.h" +#include "geometry/PxSimpleTriangleMesh.h" +#include "foundation/PxArray.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + /** + \brief Descriptor class for #PxTetrahedronMesh (contains only pure geometric data). + + \see PxTetrahedronMesh PxShape + */ + class PxTetrahedronMeshDesc + { + public: + + /** + \brief Defines the tetrahedron structure of a mesh. + */ + enum PxMeshFormat + { + eTET_MESH, //!< Normal tetmesh with arbitrary tetrahedra + eHEX_MESH //!< 5 or 6 tetrahedra in a row will form a hexahedron + }; + + + /** + Optional pointer to first material index, or NULL. There are PxTetrahedronMesh::numTriangles indices in total. + Caller may add materialIndexStride bytes to the pointer to access the next triangle. + + When a tetrahedron mesh collides with another object, a material is required at the collision point. + If materialIndices is NULL, then the material of the PxShape instance is used. + Otherwise, if the point of contact is on a tetrahedron with index i, then the material index is determined as: + PxDeformableMaterialTableIndex index = *(PxDeformableMaterialTableIndex *)(((PxU8*)materialIndices) + materialIndexStride * i); + + If the contact point falls on a vertex or an edge, a tetrahedron adjacent to the vertex or edge is selected, and its index + used to look up a material. The selection is arbitrary but consistent over time. + + Default: NULL + + \see materialIndexStride + */ + PxTypedBoundedData materialIndices; + + /** + \brief Pointer to first vertex point. + */ + PxBoundedData points; + + /** + \brief Pointer to first tetrahedron. + + Caller may add tetrhedronStrideBytes bytes to the pointer to access the next tetrahedron. + + These are quadruplets of 0 based indices: + vert0 vert1 vert2 vert3 + vert0 vert1 vert2 vert3 + vert0 vert1 vert2 vert3 + ... + + where vertex is either a 32 or 16 bit unsigned integer. There are numTetrahedrons*4 indices. + + This is declared as a void pointer because it is actually either an PxU16 or a PxU32 pointer. + */ + PxBoundedData tetrahedrons; + + + /** + \brief Flags bits, combined from values of the enum ::PxMeshFlag + */ + PxMeshFlags flags; + + /** + \brief Used for simulation meshes only. Defines if this tet mesh should be simulated as a tet mesh, + or if a set of tetrahedra should be used to represent another shape, e.g. a hexahedral mesh constructed + from 5 or 6 elements. + */ + PxU16 tetsPerElement; + + /** + \brief Constructor to build an empty tetmesh description + */ + PxTetrahedronMeshDesc() + { + points.count = 0; + points.stride = 0; + points.data = NULL; + + tetrahedrons.count = 0; + tetrahedrons.stride = 0; + tetrahedrons.data = NULL; + + tetsPerElement = 1; + } + + /** + \brief Constructor to build a tetmeshdescription that links to the vertices and indices provided + */ + PxTetrahedronMeshDesc(physx::PxArray& meshVertices, physx::PxArray& meshTetIndices, + const PxTetrahedronMeshDesc::PxMeshFormat meshFormat = eTET_MESH, PxU16 numberOfTetsPerHexElement = 5) + { + points.count = meshVertices.size(); + points.stride = sizeof(float) * 3; + points.data = meshVertices.begin(); + + tetrahedrons.count = meshTetIndices.size() / 4; + tetrahedrons.stride = sizeof(int) * 4; + tetrahedrons.data = meshTetIndices.begin(); + + if (meshFormat == eTET_MESH) + tetsPerElement = 1; + else + tetsPerElement = numberOfTetsPerHexElement; + } + + PX_INLINE bool isValid() const + { + // Check geometry of the collision mesh + if (points.count < 4) //at least 1 tetrahedron's worth of points + return false; + if ((!tetrahedrons.data) && (points.count % 4)) // Non-indexed mesh => we must ensure the geometry defines an implicit number of tetrahedrons // i.e. numVertices can't be divided by 4 + return false; + if (points.count > 0xffff && flags & PxMeshFlag::e16_BIT_INDICES) + return false; + if (!points.data) + return false; + if (points.stride < sizeof(PxVec3)) //should be at least one point's worth of data + return false; + + //add more validity checks here + if (materialIndices.data && materialIndices.stride < sizeof(PxDeformableMaterialTableIndex)) + return false; + + // The tetrahedrons pointer is not mandatory + if (tetrahedrons.data) + { + // Indexed collision mesh + PxU32 limit = (flags & PxMeshFlag::e16_BIT_INDICES) ? sizeof(PxU16) * 4 : sizeof(PxU32) * 4; + if (tetrahedrons.stride < limit) + return false; + } + + //The model can only be either a tetmesh (1 tet per element), or have 5 or 6 tets per hex element, otherwise invalid. + if (tetsPerElement != 1 && tetsPerElement != 5 && tetsPerElement != 6) + return false; + + return true; + } + }; + + /** + \brief Descriptor class for #PxDeformableVolumeMesh (contains only additional data used for deformable volume simulation). + + \see PxDeformableVolumeMesh PxShape + */ + class PxDeformableVolumeSimulationDataDesc + { + public: + /** + \brief Pointer to first index of tetrahedron that contains the vertex at the same location in the vertex buffer. + if left unassigned it will be computed automatically. If a point is inside multiple tetrahedra (ambiguous case), the frist one found will be taken. + */ + PxBoundedData vertexToTet; + + /** + \brief Constructor to build an empty simulation description + */ + PxDeformableVolumeSimulationDataDesc() + { + vertexToTet.count = 0; + vertexToTet.stride = 0; + vertexToTet.data = NULL; + } + + /** + \brief Constructor to build a simulation description with a defined vertex to tetrahedron mapping + */ + PxDeformableVolumeSimulationDataDesc(physx::PxArray& vertToTet) + { + vertexToTet.count = vertToTet.size(); + vertexToTet.stride = sizeof(PxI32); + vertexToTet.data = vertToTet.begin(); + } + + PX_INLINE bool isValid() const + { + return true; + } + }; + + typedef PX_DEPRECATED PxDeformableVolumeSimulationDataDesc PxSoftBodySimulationDataDesc; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/cooking/PxTriangleMeshDesc.h b/engine/third_party/physx/include/cooking/PxTriangleMeshDesc.h new file mode 100644 index 00000000..68beb7e7 --- /dev/null +++ b/engine/third_party/physx/include/cooking/PxTriangleMeshDesc.h @@ -0,0 +1,131 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_TRIANGLE_MESH_DESC_H +#define PX_TRIANGLE_MESH_DESC_H + +#include "PxPhysXConfig.h" +#include "geometry/PxSimpleTriangleMesh.h" +#include "PxSDFDesc.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + +/** +\brief Descriptor class for #PxTriangleMesh. + +Note that this class is derived from PxSimpleTriangleMesh which contains the members that describe the basic mesh. +The mesh data is *copied* when an PxTriangleMesh object is created from this descriptor. After the call the +user may discard the triangle data. + +\see PxTriangleMesh PxTriangleMeshGeometry PxShape +*/ +class PxTriangleMeshDesc : public PxSimpleTriangleMesh +{ +public: + + /** + Optional pointer to first material index, or NULL. There are PxSimpleTriangleMesh::numTriangles indices in total. + Caller may add materialIndexStride bytes to the pointer to access the next triangle. + + When a triangle mesh collides with another object, a material is required at the collision point. + If materialIndices is NULL, then the material of the PxShape instance is used. + Otherwise, if the point of contact is on a triangle with index i, then the material index is determined as: + PxMaterialTableIndex index = *(PxMaterialTableIndex *)(((PxU8*)materialIndices) + materialIndexStride * i); + + If the contact point falls on a vertex or an edge, a triangle adjacent to the vertex or edge is selected, and its index + used to look up a material. The selection is arbitrary but consistent over time. + + Default: NULL + + \see materialIndexStride + */ + PxTypedBoundedData materialIndices; + + /** + \brief SDF descriptor. When this descriptor is set, a signed distance field (SDF) is calculated. SDF collisions only + work when the GPU solver is used to run the simulation. The GPU solver is enabled by setting the flag PxSceneFlag::eENABLE_GPU_DYNAMICS in the scene description. + + Default: NULL + */ + PxSDFDesc* sdfDesc; + + /** + \brief Constructor sets to default. + */ + PX_INLINE PxTriangleMeshDesc(); + + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE void setToDefault(); + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid + */ + PX_INLINE bool isValid() const; +}; + + +PX_INLINE PxTriangleMeshDesc::PxTriangleMeshDesc() //constructor sets to default +{ + PxSimpleTriangleMesh::setToDefault(); + sdfDesc = NULL; +} + +PX_INLINE void PxTriangleMeshDesc::setToDefault() +{ + *this = PxTriangleMeshDesc(); +} + +PX_INLINE bool PxTriangleMeshDesc::isValid() const +{ + if(points.count < 3) //at least 1 trig's worth of points + return false; + if ((!triangles.data) && (points.count%3)) // Non-indexed mesh => we must ensure the geometry defines an implicit number of triangles // i.e. numVertices can't be divided by 3 + return false; + //add more validity checks here + if (materialIndices.data && materialIndices.stride < sizeof(PxMaterialTableIndex)) + return false; + + if (sdfDesc && !sdfDesc->isValid()) + return false; + + return PxSimpleTriangleMesh::isValid(); +} + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/cooking/Pxc.h b/engine/third_party/physx/include/cooking/Pxc.h new file mode 100644 index 00000000..d0866ca5 --- /dev/null +++ b/engine/third_party/physx/include/cooking/Pxc.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PXC_H +#define PXC_H + +#include "foundation/PxPreprocessor.h" + +// define API function declaration +#if !defined PX_PHYSX_STATIC_LIB + #if PX_WINDOWS_FAMILY + #if defined PX_PHYSX_COOKING_EXPORTS + #define PX_PHYSX_COOKING_API __declspec(dllexport) + #else + #define PX_PHYSX_COOKING_API __declspec(dllimport) + #endif + #elif PX_UNIX_FAMILY + #define PX_PHYSX_COOKING_API PX_UNIX_EXPORT + #endif +#endif + +#if !defined(PX_PHYSX_COOKING_API) + #define PX_PHYSX_COOKING_API +#endif + +#ifndef PX_C_EXPORT + #define PX_C_EXPORT extern "C" +#endif + +#endif diff --git a/engine/third_party/physx/include/cudamanager/PxCudaContext.h b/engine/third_party/physx/include/cudamanager/PxCudaContext.h new file mode 100644 index 00000000..fcceea44 --- /dev/null +++ b/engine/third_party/physx/include/cudamanager/PxCudaContext.h @@ -0,0 +1,192 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +#ifndef PX_CUDA_CONTEX_H +#define PX_CUDA_CONTEX_H + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "PxCudaTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + struct PxCudaKernelParam + { + void* data; + size_t size; + }; + + // workaround for not being able to forward declare enums in PxCudaTypes.h. + // provides different automatic casting depending on whether cuda.h was included beforehand or not. + template + struct PxCUenum + { + PxU32 value; + + PxCUenum(CUenum e) { value = PxU32(e); } + operator CUenum() const { return CUenum(value); } + }; + +#ifdef CUDA_VERSION + typedef PxCUenum PxCUjit_option; + typedef PxCUenum PxCUresult; +#else + typedef PxCUenum PxCUjit_option; + typedef PxCUenum PxCUresult; +#endif + +#define PX_CUDA_KERNEL_PARAM(X) { (void*)&X, sizeof(X) } +#define PX_CUDA_KERNEL_PARAM2(X) (void*)&X + + class PxDeviceAllocatorCallback; + /** + Cuda Context + */ + class PxCudaContext + { + protected: + virtual ~PxCudaContext() {} + + PxDeviceAllocatorCallback* mAllocatorCallback; + + public: + virtual void release() = 0; + + virtual PxCUresult memAlloc(CUdeviceptr *dptr, size_t bytesize) = 0; + + virtual PxCUresult memFree(CUdeviceptr dptr) = 0; + + virtual PxCUresult memHostAlloc(void **pp, size_t bytesize, unsigned int Flags) = 0; + + virtual PxCUresult memFreeHost(void *p) = 0; + + virtual PxCUresult memHostGetDevicePointer(CUdeviceptr *pdptr, void *p, unsigned int Flags) = 0; + + virtual PxCUresult moduleLoadDataEx(CUmodule *module, const void *image, unsigned int numOptions, PxCUjit_option *options, void **optionValues) = 0; + + virtual PxCUresult moduleGetFunction(CUfunction *hfunc, CUmodule hmod, const char *name) = 0; + + virtual PxCUresult moduleUnload(CUmodule hmod) = 0; + + virtual PxCUresult streamCreate(CUstream *phStream, unsigned int Flags) = 0; + + virtual PxCUresult streamCreateWithPriority(CUstream *phStream, unsigned int flags, int priority) = 0; + + virtual PxCUresult streamFlush(CUstream hStream) = 0; + + virtual PxCUresult streamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int Flags) = 0; + + virtual PxCUresult streamWaitEvent(CUstream hStream, CUevent hEvent) = 0; + + virtual PxCUresult streamDestroy(CUstream hStream) = 0; + + virtual PxCUresult streamSynchronize(CUstream hStream) = 0; + + virtual PxCUresult eventCreate(CUevent *phEvent, unsigned int Flags) = 0; + + virtual PxCUresult eventRecord(CUevent hEvent, CUstream hStream) = 0; + + virtual PxCUresult eventQuery(CUevent hEvent) = 0; + + virtual PxCUresult eventSynchronize(CUevent hEvent) = 0; + + virtual PxCUresult eventDestroy(CUevent hEvent) = 0; + + virtual PxCUresult launchKernel( + CUfunction f, + unsigned int gridDimX, + unsigned int gridDimY, + unsigned int gridDimZ, + unsigned int blockDimX, + unsigned int blockDimY, + unsigned int blockDimZ, + unsigned int sharedMemBytes, + CUstream hStream, + PxCudaKernelParam* kernelParams, + size_t kernelParamsSizeInBytes, + void** extra, + const char* file, + int line + ) = 0; + + // PT: same as above but without copying the kernel params to a local stack before the launch + // i.e. the kernelParams data is passed directly to the kernel. + virtual PxCUresult launchKernel( + CUfunction f, + PxU32 gridDimX, PxU32 gridDimY, PxU32 gridDimZ, + PxU32 blockDimX, PxU32 blockDimY, PxU32 blockDimZ, + PxU32 sharedMemBytes, + CUstream hStream, + void** kernelParams, + void** extra, + const char* file, + int line + ) = 0; + + virtual PxCUresult memcpyDtoH(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount) = 0; + + virtual PxCUresult memcpyDtoHAsync(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) = 0; + + virtual PxCUresult memcpyHtoD(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount) = 0; + + virtual PxCUresult memcpyHtoDAsync(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream) = 0; + + virtual PxCUresult memcpyDtoDAsync(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) = 0; + + virtual PxCUresult memcpyDtoD(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount) = 0; + + virtual PxCUresult memcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream) = 0; + + virtual PxCUresult memsetD32Async(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream) = 0; + + virtual PxCUresult memsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream) = 0; + + virtual PxCUresult memsetD32(CUdeviceptr dstDevice, unsigned int ui, size_t N) = 0; + + virtual PxCUresult memsetD16(CUdeviceptr dstDevice, unsigned short uh, size_t N) = 0; + + virtual PxCUresult memsetD8(CUdeviceptr dstDevice, unsigned char uc, size_t N) = 0; + + virtual PxCUresult getLastError() = 0; + + PxDeviceAllocatorCallback* getAllocatorCallback() { return mAllocatorCallback; } + + virtual void setAbortMode(bool abort) = 0; + + virtual bool isInAbortMode() = 0; + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif // PX_SUPPORT_GPU_PHYSX +#endif + diff --git a/engine/third_party/physx/include/cudamanager/PxCudaContextManager.h b/engine/third_party/physx/include/cudamanager/PxCudaContextManager.h new file mode 100644 index 00000000..90d7d70f --- /dev/null +++ b/engine/third_party/physx/include/cudamanager/PxCudaContextManager.h @@ -0,0 +1,554 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +#ifndef PX_CUDA_CONTEXT_MANAGER_H +#define PX_CUDA_CONTEXT_MANAGER_H + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxErrorCallback.h" +#include "foundation/PxFlags.h" + +#include "PxCudaTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxCudaContext; + +struct PxCudaInteropRegisterFlag +{ + enum Enum + { + eNONE = 0x00, + eREAD_ONLY = 0x01, + eWRITE_DISCARD = 0x02, + eSURFACE_LDST = 0x04, + eTEXTURE_GATHER = 0x08 + }; +}; + +/** +\brief An interface class that the user can implement in order for PhysX to use a user-defined device memory allocator. +*/ +class PxDeviceAllocatorCallback +{ +public: + + /** + \brief Allocated device memory. + \param[in] ptr Pointer to store the allocated address + \param[in] size The amount of memory required + \return A boolean indicates the operation succeed or fail + */ + virtual bool memAlloc(void** ptr, size_t size) = 0; + + /** + \brief Frees device memory. + \param[in] ptr The memory to free + \return A boolean indicates the operation succeed or fail + */ + virtual bool memFree(void* ptr) = 0; + +protected: + virtual ~PxDeviceAllocatorCallback() {} +}; +/** +\brief collection of set bits defined in NxCudaInteropRegisterFlag. + +\see NxCudaInteropRegisterFlag +*/ +typedef PxFlags PxCudaInteropRegisterFlags; +PX_FLAGS_OPERATORS(PxCudaInteropRegisterFlag::Enum, uint32_t) + +//! \brief Descriptor used to create a PxCudaContextManager +class PxCudaContextManagerDesc +{ +public: + /** + * \brief The CUDA context to manage + * + * If left NULL, the PxCudaContextManager will create a new context. If + * graphicsDevice is also not NULL, this new CUDA context will be bound to + * that graphics device, enabling the use of CUDA/Graphics interop features. + * + * If ctx is not NULL, the specified context must be applied to the thread + * that is allocating the PxCudaContextManager at creation time (aka, it + * cannot be popped). The PxCudaContextManager will take ownership of the + * context until the manager is released. All access to the context must be + * gated by lock acquisition. + * + * If the user provides a context for the PxCudaContextManager, the context + * _must_ have either been created on the GPU ordinal returned by + * PxGetSuggestedCudaDeviceOrdinal() or on your graphics device. + */ + CUcontext* ctx; + + /** + * \brief D3D device pointer or OpenGl context handle + * + * Only applicable when ctx is NULL, thus forcing a new context to be + * created. In that case, the created context will be bound to this + * graphics device. + */ + void* graphicsDevice; + + /** + * \brief CUDA device ordinal + * + * Only applicable when ctx is NULL, thus forcing a new context to be created based on the CUDA device ordinal. + * The first CUDA device will have an ordinal value of 0 and so on. + * If the CUDA device ordinal is -1, the device selected will be queried from the environment variable PHYSX_GPU_DEVICE. + * \note If the environment variable PHYSX_GPU_DEVICE is not found, the CUDA device ordinal will default to 0. + */ + PxI32 deviceOrdinal; + + /** + * \brief Application-specific GUID + * + * If your application employs PhysX modules that use CUDA you need to use a GUID + * so that patches for new architectures can be released for your game.You can obtain a GUID for your + * application from Nvidia. + */ + const char* appGUID; + + /** + * \brief Application-specific device memory allocator + * + * the application can implement an device memory allocator, which inherites PxDeviceAllocatorCallback, and + * pass that to the PxCudaContextManagerDesc. The SDK will use that allocator to allocate device memory instead of + * using the defaul CUDA device memory allocator. + */ + PxDeviceAllocatorCallback* deviceAllocator; + + PX_INLINE PxCudaContextManagerDesc() : + ctx (NULL), + graphicsDevice (NULL), + deviceOrdinal (-1), + appGUID (NULL), + deviceAllocator (NULL) + { + } +}; + +/** +\brief A cuda kernel index providing an index to the cuda module and the function name +*/ +struct PxKernelIndex +{ + PxU32 moduleIndex; + const char* functionName; +}; + +/** + * \brief Manages thread locks, and task scheduling for a CUDA context + * + * A PxCudaContextManager manages access to a single CUDA context, allowing it to + * be shared between multiple scenes. + * The context must be acquired from the manager before using any CUDA APIs unless stated differently. + * + * The PxCudaContextManager is based on the CUDA driver API and explicitly does not + * support the CUDA runtime API (aka, CUDART). + */ +class PxCudaContextManager +{ +public: + /** + * \brief Schedules clear operation for a device memory buffer on the specified stream + * + * The cuda context will get acquired automatically + * \deprecated The replacement is PxCudaHelpersExt::memsetAsync. + */ + template + PX_DEPRECATED void clearDeviceBufferAsync(T* deviceBuffer, PxU32 numElements, CUstream stream, PxI32 value = 0) + { + clearDeviceBufferAsyncInternal(deviceBuffer, numElements * sizeof(T), stream, value); + } + + /** + * \brief Copies a device buffer to the host + * + * The cuda context will get acquired automatically + * \deprecated The replacement is PxCudaHelpersExt::copyDToH. + */ + template + PX_DEPRECATED void copyDToH(T* hostBuffer, const T* deviceBuffer, PxU32 numElements) + { + copyDToHInternal(hostBuffer, deviceBuffer, numElements * sizeof(T)); + } + + /** + * \brief Copies a host buffer to the device + * + * The cuda context will get acquired automatically + * \deprecated The replacement is PxCudaHelpersExt::copyHtoD + */ + template + PX_DEPRECATED void copyHToD(T* deviceBuffer, const T* hostBuffer, PxU32 numElements) + { + copyHToDInternal(deviceBuffer, hostBuffer, numElements * sizeof(T)); + } + + /** + * \brief Schedules device to host copy operation on the specified stream + * + * The cuda context will get acquired automatically + * \deprecated Use PxCudaHelpersExt::copyDToHAsync instead. + */ + template + PX_DEPRECATED void copyDToHAsync(T* hostBuffer, const T* deviceBuffer, PxU32 numElements, CUstream stream) + { + copyDToHAsyncInternal(hostBuffer, deviceBuffer, numElements * sizeof(T), stream); + } + + /** + * \brief Schedules host to device copy operation on the specified stream + * + * The cuda context will get acquired automatically + * \deprecated Use PxCudaHelpersExt::copyHToDAsync instead. + */ + template + PX_DEPRECATED void copyHToDAsync(T* deviceBuffer, const T* hostBuffer, PxU32 numElements, CUstream stream) + { + copyHToDAsyncInternal(deviceBuffer, hostBuffer, numElements * sizeof(T), stream); + } + + /** + * \brief Schedules device to device copy operation on the specified stream + * + * The cuda context will get acquired automatically + * \deprecated Use PxCudaHelpersExt::copyDToDAsync instead. + */ + template + PX_DEPRECATED void copyDToDAsync(T* dstDeviceBuffer, const T* srcDeviceBuffer, PxU32 numElements, CUstream stream) + { + copyDToDAsyncInternal(dstDeviceBuffer, srcDeviceBuffer, numElements * sizeof(T), stream); + } + + /** + * \brief Schedules a memset operation on the device on the specified stream. Only supported for 1 byte or 4 byte data types. + * + * The cuda context will get acquired automatically + * \deprecated Use PxCudaHelpersExt::memsetAsync instead. + */ + template + PX_DEPRECATED void memsetAsync(T* dstDeviceBuffer, const T& value, PxU32 numElements, CUstream stream) + { + PX_COMPILE_TIME_ASSERT(sizeof(value) == sizeof(PxU32) || sizeof(value) == sizeof(PxU8)); + + if (sizeof(value) == sizeof(PxU32)) + memsetD32AsyncInternal(dstDeviceBuffer, reinterpret_cast(value), numElements, stream); + else + memsetD8AsyncInternal(dstDeviceBuffer, reinterpret_cast(value), numElements, stream); + } + + /** + * \brief Allocates a device buffer + * + * The cuda context will get acquired automatically + * \deprecated - use PxCudaHelpersExt::allocDeviceBuffer instead. + */ + template + PX_DEPRECATED void allocDeviceBuffer(T*& deviceBuffer, PxU32 numElements, const char* filename = __FILE__, PxI32 line = __LINE__) + { + void* ptr = allocDeviceBufferInternal(PxU64(numElements) * sizeof(T), filename, line); + deviceBuffer = reinterpret_cast(ptr); + } + + /** + * \brief Allocates a device buffer and returns the pointer to the memory + * + * The cuda context will get acquired automatically + * \deprecated - use PxCudaHelpersExt::allocDeviceBuffer instead. + */ + template + PX_DEPRECATED T* allocDeviceBuffer(PxU32 numElements, const char* filename = __FILE__, PxI32 line = __LINE__) + { + void* ptr = allocDeviceBufferInternal(PxU64(numElements) * sizeof(T), filename, line); + return reinterpret_cast(ptr); + } + + /** + * \brief Frees a device buffer + * + * The cuda context will get acquired automatically + * \deprecated - use PxCudaHelpersExt::freeDeviceBuffer instead. + */ + template + PX_DEPRECATED void freeDeviceBuffer(T*& deviceBuffer) + { + freeDeviceBufferInternal(deviceBuffer); + deviceBuffer = NULL; + } + + /** + * \brief Allocates a pinned host buffer + * + * A pinned host buffer can be used on the gpu after getting a mapped device pointer from the pinned host buffer pointer, see getMappedDevicePtr + * The cuda context will get acquired automatically + * \see getMappedDevicePtr + * \deprecated - use PxCudaHelpersExt::allocPinnedHostBuffer instead. + */ + template + PX_DEPRECATED void allocPinnedHostBuffer(T*& pinnedHostBuffer, PxU32 numElements, const char* filename = __FILE__, PxI32 line = __LINE__) + { + void* ptr = allocPinnedHostBufferInternal(PxU64(numElements) * sizeof(T), filename, line); + pinnedHostBuffer = reinterpret_cast(ptr); + } + + /** + * \brief Allocates a pinned host buffer and returns the pointer to the memory + * + * A pinned host buffer can be used on the gpu after getting a mapped device pointer from the pinned host buffer pointer, see getMappedDevicePtr + * The cuda context will get acquired automatically + * \deprecated - use PxCudaHelpersExt::allocPinnedHostBuffer instead. + * \see getMappedDevicePtr + */ + template + PX_DEPRECATED T* allocPinnedHostBuffer(PxU32 numElements, const char* filename = __FILE__, PxI32 line = __LINE__) + { + void* ptr = allocPinnedHostBufferInternal(PxU64(numElements) * sizeof(T), filename, line); + return reinterpret_cast(ptr); + } + + /** + * \brief Frees a pinned host buffer + * + * The cuda context will get acquired automatically + * \deprecated - use PxCudaHelpersExt::freePinnedHostBuffer instead. + */ + template + PX_DEPRECATED void freePinnedHostBuffer(T*& pinnedHostBuffer) + { + freePinnedHostBufferInternal(pinnedHostBuffer); + pinnedHostBuffer = NULL; + } + + /** + * \brief Gets a mapped pointer from a pinned host buffer that can be used in cuda kernels directly + * + * Data access performance with a mapped pinned host pointer will be slower than using a device pointer directly + * but the changes done in the kernel will be available on the host immediately. + * The cuda context will get acquired automatically + */ + virtual CUdeviceptr getMappedDevicePtr(void* pinnedHostBuffer) = 0; + + /** + * \brief Acquire the CUDA context for the current thread + * + * Acquisitions are allowed to be recursive within a single thread. + * You can acquire the context multiple times so long as you release + * it the same count. + * + * The context must be acquired before using most CUDA functions. + */ + virtual void acquireContext() = 0; + + /** + * \brief Acquire the CUDA context for the current thread + * + * Acquisitions are allowed to be recursive within a single thread. + * You can acquire the context multiple times so long as you release + * it the same count. + * + * The context must be acquired before using most CUDA functions. + * The function will return false if context aquisition fails for some reason + */ + virtual bool tryAcquireContext() = 0; + + /** + * \brief Release the CUDA context from the current thread + * + * The CUDA context should be released as soon as practically + * possible, to allow other CPU threads to work efficiently. + */ + virtual void releaseContext() = 0; + + /** + * \brief Return the CUcontext + */ + virtual CUcontext getContext() = 0; + + /** + * \brief Return the CudaContext + */ + virtual PxCudaContext* getCudaContext() = 0; + + /** + * \brief Context manager has a valid CUDA context + * + * This method should be called after creating a PxCudaContextManager, + * especially if the manager was responsible for allocating its own + * CUDA context (desc.ctx == NULL). + */ + virtual bool contextIsValid() const = 0; + + /* Query CUDA context and device properties, without acquiring context */ + + virtual bool supportsArchSM10() const = 0; //!< G80 + virtual bool supportsArchSM11() const = 0; //!< G92 + virtual bool supportsArchSM12() const = 0; //!< GT200 + virtual bool supportsArchSM13() const = 0; //!< GT260 + virtual bool supportsArchSM20() const = 0; //!< GF100 + virtual bool supportsArchSM30() const = 0; //!< GK100 + virtual bool supportsArchSM35() const = 0; //!< GK110 + virtual bool supportsArchSM50() const = 0; //!< GM100 + virtual bool supportsArchSM52() const = 0; //!< GM200 + virtual bool supportsArchSM60() const = 0; //!< GP100 + virtual bool isIntegrated() const = 0; //!< true if GPU is an integrated (MCP) part + virtual bool canMapHostMemory() const = 0; //!< true if GPU map host memory to GPU (0-copy) + virtual int getDriverVersion() const = 0; //!< returns cached value of cuGetDriverVersion() + virtual size_t getDeviceTotalMemBytes() const = 0; //!< returns cached value of device memory size + virtual int getMultiprocessorCount() const = 0; //!< returns cache value of SM unit count + virtual unsigned int getClockRate() const = 0; //!< returns cached value of SM clock frequency + virtual int getSharedMemPerBlock() const = 0; //!< returns total amount of shared memory available per block in bytes + virtual int getSharedMemPerMultiprocessor() const = 0; //!< returns total amount of shared memory available per multiprocessor in bytes + virtual unsigned int getMaxThreadsPerBlock() const = 0; //!< returns the maximum number of threads per block + virtual const char *getDeviceName() const = 0; //!< returns device name retrieved from driver + virtual CUdevice getDevice() const = 0; //!< returns device handle retrieved from driver + + virtual void setUsingConcurrentStreams(bool) = 0; //!< turn on/off using concurrent streams for GPU work + virtual bool getUsingConcurrentStreams() const = 0; //!< true if GPU work can run in concurrent streams + /* End query methods that don't require context to be acquired */ + + virtual void getDeviceMemoryInfo(size_t& free, size_t& total) const = 0; //!< get currently available and total memory + + /** + * \brief Get the cuda modules that have been loaded into this context on construction + * \return Pointer to the cuda modules + */ + virtual CUmodule* getCuModules() = 0; + + /** + * \brief Release the PxCudaContextManager + * + * If the PxCudaContextManager created the CUDA context it was + * responsible for, it also frees that context. + * + * Do not release the PxCudaContextManager if there are any scenes + * using it. Those scenes must be released first. + * + */ + virtual void release() = 0; + +protected: + + /** + * \brief protected destructor, use release() method + */ + virtual ~PxCudaContextManager() {} + + PX_DEPRECATED virtual void* allocDeviceBufferInternal(PxU64 numBytes, const char* filename = NULL, PxI32 line = -1) = 0; + PX_DEPRECATED virtual void* allocPinnedHostBufferInternal(PxU64 numBytes, const char* filename = NULL, PxI32 line = -1) = 0; + + PX_DEPRECATED virtual void freeDeviceBufferInternal(void* deviceBuffer) = 0; + PX_DEPRECATED virtual void freePinnedHostBufferInternal(void* pinnedHostBuffer) = 0; + + PX_DEPRECATED virtual void clearDeviceBufferAsyncInternal(void* deviceBuffer, PxU32 numBytes, CUstream stream, PxI32 value) = 0; + + PX_DEPRECATED virtual void copyDToHAsyncInternal(void* hostBuffer, const void* deviceBuffer, PxU32 numBytes, CUstream stream) = 0; + PX_DEPRECATED virtual void copyHToDAsyncInternal(void* deviceBuffer, const void* hostBuffer, PxU32 numBytes, CUstream stream) = 0; + PX_DEPRECATED virtual void copyDToDAsyncInternal(void* dstDeviceBuffer, const void* srcDeviceBuffer, PxU32 numBytes, CUstream stream) = 0; + + PX_DEPRECATED virtual void copyDToHInternal(void* hostBuffer, const void* deviceBuffer, PxU32 numBytes) = 0; + PX_DEPRECATED virtual void copyHToDInternal(void* deviceBuffer, const void* hostBuffer, PxU32 numBytes) = 0; + + PX_DEPRECATED virtual void memsetD8AsyncInternal(void* dstDeviceBuffer, const PxU8& value, PxU32 numBytes, CUstream stream) = 0; + PX_DEPRECATED virtual void memsetD32AsyncInternal(void* dstDeviceBuffer, const PxU32& value, PxU32 numIntegers, CUstream stream) = 0; +}; + +// These macros are deprecated. Please use the functions in extensions/PxCudaHelpersExt.h +/** + \deprecated Please use the functions in extensions/PxCudaHelpersExt.h + */ +#define PX_DEVICE_ALLOC(cudaContextManager, deviceBuffer, numElements) cudaContextManager->allocDeviceBuffer(deviceBuffer, numElements, PX_FL) + +/** + \deprecated Please use the functions in extensions/PxCudaHelpersExt.h + */ +#define PX_DEVICE_ALLOC_T(T, cudaContextManager, numElements) cudaContextManager->allocDeviceBuffer(numElements, PX_FL) + +/** + \deprecated Please use the functions in extensions/PxCudaHelpersExt.h + */ +#define PX_DEVICE_FREE(cudaContextManager, deviceBuffer) cudaContextManager->freeDeviceBuffer(deviceBuffer); + +/** + \deprecated Please use the functions in extensions/PxCudaHelpersExt.h + */ +#define PX_PINNED_HOST_ALLOC(cudaContextManager, pinnedHostBuffer, numElements) cudaContextManager->allocPinnedHostBuffer(pinnedHostBuffer, numElements, PX_FL) + +/** + \deprecated Please use the functions in extensions/PxCudaHelpersExt.h + */ +#define PX_PINNED_HOST_ALLOC_T(T, cudaContextManager, numElements) cudaContextManager->allocPinnedHostBuffer(numElements, PX_FL) + +/** + \deprecated Please use the functions in extensions/PxCudaHelpersExt.h + */ +#define PX_PINNED_HOST_FREE(cudaContextManager, pinnedHostBuffer) cudaContextManager->freePinnedHostBuffer(pinnedHostBuffer); + +/** + * \brief Convenience class for holding CUDA lock within a scope + */ +class PxScopedCudaLock +{ +public: + /** + * \brief ScopedCudaLock constructor + */ + PxScopedCudaLock(PxCudaContextManager& ctx) : mCtx(&ctx) + { + mCtx->acquireContext(); + } + + /** + * \brief ScopedCudaLock destructor + */ + ~PxScopedCudaLock() + { + mCtx->releaseContext(); + } + +protected: + + /** + * \brief CUDA context manager pointer (initialized in the constructor) + */ + PxCudaContextManager* mCtx; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif // PX_SUPPORT_GPU_PHYSX +#endif diff --git a/engine/third_party/physx/include/cudamanager/PxCudaTypes.h b/engine/third_party/physx/include/cudamanager/PxCudaTypes.h new file mode 100644 index 00000000..73959a31 --- /dev/null +++ b/engine/third_party/physx/include/cudamanager/PxCudaTypes.h @@ -0,0 +1,71 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +#ifndef PX_CUDA_TYPES_H +#define PX_CUDA_TYPES_H + +//type definitions to avoid forced inclusion of cuda.h +//if cuda.h is needed anyway, please include it before PxCudaContextManager.h, PxCudaContext.h or PxCudaTypes.h + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX +#ifndef CUDA_VERSION + +#include "foundation/PxSimpleTypes.h" + +#if PX_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wc++98-compat-pedantic" +#endif + +#if PX_P64_FAMILY +typedef unsigned long long CUdeviceptr; +#else +typedef unsigned int CUdeviceptr; +#endif + +#if PX_CLANG +#pragma clang diagnostic pop +#endif + +typedef int CUdevice; + +typedef struct CUctx_st* CUcontext; +typedef struct CUmod_st* CUmodule; +typedef struct CUfunc_st* CUfunction; +typedef struct CUstream_st* CUstream; +typedef struct CUevent_st* CUevent; +typedef struct CUgraphicsResource_st* CUgraphicsResource; + +#endif + +#else +typedef struct CUstream_st* CUstream; // We declare some callbacks taking CUstream as an argument even when building with PX_SUPPORT_GPU_PHYSX = 0. +typedef struct CUevent_st* CUevent; +#endif // PX_SUPPORT_GPU_PHYSX +#endif + diff --git a/engine/third_party/physx/include/extensions/PxBroadPhaseExt.h b/engine/third_party/physx/include/extensions/PxBroadPhaseExt.h new file mode 100644 index 00000000..82ad54a8 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxBroadPhaseExt.h @@ -0,0 +1,70 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_EXT_H +#define PX_BROAD_PHASE_EXT_H + +#include "PxPhysXConfig.h" +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +class PxBounds3; +#endif + +class PxBroadPhaseExt +{ +public: + + /** + \brief Creates regions for PxSceneDesc, from a global box. + + This helper simply subdivides the given global box into a 2D grid of smaller boxes. Each one of those smaller boxes + is a region of interest for the broadphase. There are nbSubdiv*nbSubdiv regions in the 2D grid. The function does not + subdivide along the given up axis. + + This is the simplest setup one can use with PxBroadPhaseType::eMBP. A more sophisticated setup would try to cover + the game world with a non-uniform set of regions (i.e. not just a grid). + + \param[out] regions Regions computed from the input global box + \param[in] globalBounds World-space box covering the game world + \param[in] nbSubdiv Grid subdivision level. The function will create nbSubdiv*nbSubdiv regions. + \param[in] upAxis Up axis (0 for X, 1 for Y, 2 for Z). + \return number of regions written out to the 'regions' array + + \see PxSceneDesc PxBroadPhaseType + */ + static PxU32 createRegionsFromWorldBounds(PxBounds3* regions, const PxBounds3& globalBounds, PxU32 nbSubdiv, PxU32 upAxis=1); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxCollectionExt.h b/engine/third_party/physx/include/extensions/PxCollectionExt.h new file mode 100644 index 00000000..e29140ab --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxCollectionExt.h @@ -0,0 +1,115 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_COLLECTION_EXT_H +#define PX_COLLECTION_EXT_H + +#include "PxPhysXConfig.h" +#include "common/PxCollection.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxCollection; + class PxScene; + + class PxCollectionExt + { + public: + /** + \brief Removes and releases all object from a collection. + + The Collection itself is not released. + + If the releaseExclusiveShapes flag is not set to true, release() will not be called on exclusive shapes. + + It is assumed that the application holds a reference to each of the objects in the collection, with the exception of objects that are not releasable + (PxBase::isReleasable()). In general, objects that violate this assumption need to be removed from the collection prior to calling releaseObjects. + + \note when a shape is created with PxRigidActorExt::createExclusiveShape(), the only counted reference is held by the actor. + If such a shape and its actor are present in the collection, the reference count will be decremented once when the actor is released, and once when the + shape is released, resulting in undefined behavior. Shape reference counts can be incremented with PxShape::acquireReference(). + + \param[in] collection to remove and release all object from. + \param[in] releaseExclusiveShapes if this parameter is set to false, release() will not be called on exclusive shapes. + */ + static void releaseObjects(PxCollection& collection, bool releaseExclusiveShapes = true); + + /** + \brief Removes objects of a given type from a collection, potentially adding them to another collection. + + \param[in,out] collection Collection from which objects are removed + \param[in] concreteType PxConcreteType of sdk objects that should be removed + \param[in,out] to Optional collection to which the removed objects are added + + \see PxCollection, PxConcreteType + */ + static void remove(PxCollection& collection, PxType concreteType, PxCollection* to = NULL); + + /** + \brief Collects all objects in PxPhysics that are shareable across multiple scenes. + + This function creates a new collection from all objects that are shareable across multiple + scenes. Instances of the following types are included: PxConvexMesh, PxTriangleMesh, + PxHeightField, PxShape and PxMaterial. + + This is a helper function to ease the creation of collections for serialization. + + \param[in] physics The physics SDK instance from which objects are collected. See #PxPhysics + \return Collection to which objects are added. See #PxCollection + + \see PxCollection, PxPhysics + */ + static PxCollection* createCollection(PxPhysics& physics); + + /** + \brief Collects all objects from a PxScene. + + This function creates a new collection from all objects that were added to the specified + PxScene. Instances of the following types are included: PxActor, PxAggregate, + PxArticulationReducedCoordinate and PxJoint (other PxConstraint types are not included). + + This is a helper function to ease the creation of collections for serialization. + The function PxSerialization.complete() can be used to complete the collection with required objects prior to + serialization. + + \param[in] scene The PxScene instance from which objects are collected. See #PxScene + \return Collection to which objects are added. See #PxCollection + + \see PxCollection, PxScene, PxSerialization.complete() + */ + static PxCollection* createCollection(PxScene& scene); + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxConstraintExt.h b/engine/third_party/physx/include/extensions/PxConstraintExt.h new file mode 100644 index 00000000..7a63a062 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxConstraintExt.h @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_EXT_H +#define PX_CONSTRAINT_EXT_H + +#include "foundation/PxPreprocessor.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Unique identifiers for extensions classes which implement a constraint based on PxConstraint. + +\note Users which want to create their own custom constraint types should choose an ID larger or equal to eNEXT_FREE_ID +and not eINVALID_ID. + +\see PxConstraint PxSimulationEventCallback.onConstraintBreak() +*/ +struct PxConstraintExtIDs +{ + enum Enum + { + eJOINT, + eVEHICLE_JOINT, + eNEXT_FREE_ID, + eINVALID_ID = 0x7fffffff + }; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxConvexCoreExt.h b/engine/third_party/physx/include/extensions/PxConvexCoreExt.h new file mode 100644 index 00000000..0b84e3cd --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxConvexCoreExt.h @@ -0,0 +1,76 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CONVEX_GEOMETRY_EXT_H +#define PX_CONVEX_GEOMETRY_EXT_H + +#include "foundation/PxMat33.h" +#include "foundation/PxTransform.h" +#include "geometry/PxConvexCoreGeometry.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxBounds3; +class PxRenderOutput; + +/** +\brief Convex geometry helpers +*/ +class PxConvexCoreExt +{ +public: + + /** + \brief Compute mass properties of the convex core geometry. + \param convex The convex geometry. + \param[out] density1Mass The mass of the geometry assuming unit density. + \param[out] inertiaTensor The inertia tensor of the geometry. + \param[out] centerOfMass The center of mass of the geometry. + */ + static void computeMassInfo(const PxConvexCoreGeometry& convex, PxReal& density1Mass, PxMat33& inertiaTensor, PxVec3& centerOfMass); + + /** + \brief Visualize the convex core geometry + \param convex The convex geometry. + \param pose The pose of the geometry in world space + \param drawCore If true, draw the core inside the full convex geometry including the margin + \param cullbox The culling box for visualization + \param out The render output object to use for visualization + */ + static void visualize(const PxConvexCoreGeometry& convex, const PxTransform& pose, bool drawCore, const PxBounds3& cullbox, PxRenderOutput& out); + +}; + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxConvexMeshExt.h b/engine/third_party/physx/include/extensions/PxConvexMeshExt.h new file mode 100644 index 00000000..907e1d9b --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxConvexMeshExt.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CONVEX_MESH_EXT_H +#define PX_CONVEX_MESH_EXT_H + +#include "PxPhysXConfig.h" +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxTransform.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxConvexMeshGeometry; + + /** + \brief Computes closest polygon of the convex hull geometry for a given impact point + and impact direction. When doing sweeps against a scene, one might want to delay + the rather expensive computation of the hit face index for convexes until it is clear + the information is really needed and then use this method to get the corresponding + face index. + + \param[in] convexGeom The convex mesh geometry. + \param[in] geomPose Pose for the geometry object. + \param[in] impactPos Impact position. + \param[in] unitDir Normalized impact direction. + + \return Closest face index of the convex geometry. + + \see PxTransform PxConvexMeshGeometry + */ + PxU32 PxFindFaceIndex(const PxConvexMeshGeometry& convexGeom, + const PxTransform& geomPose, + const PxVec3& impactPos, + const PxVec3& unitDir); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxCudaHelpersExt.h b/engine/third_party/physx/include/extensions/PxCudaHelpersExt.h new file mode 100644 index 00000000..03734be7 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxCudaHelpersExt.h @@ -0,0 +1,317 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CUDA_HELPERS_EXT_H +#define PX_CUDA_HELPERS_EXT_H + + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxAssert.h" +#include "foundation/PxFoundation.h" +#include "cudamanager/PxCudaContextManager.h" +#include "cudamanager/PxCudaContext.h" +#include "cudamanager/PxCudaTypes.h" + + +namespace physx +{ +namespace Ext +{ + +class PxCudaHelpersExt +{ +public: + +/** +* \brief Allocates a device buffer and returns the pointer to the memory +* +* The cuda context will get acquired automatically +* +* \param[in] cudaContextManager the PxCudaContextManager managing the CUDA context the allocation should be attributed to. +* \param[in] numElements the number of elements of type T to allocate. +* +* \return a pointer to the allocated memory. +*/ +template +static T* allocDeviceBuffer(PxCudaContextManager& cudaContextManager, PxU64 numElements) +{ + PxScopedCudaLock lock(cudaContextManager); + + CUdeviceptr ptr = 0; + PxCUresult result = cudaContextManager.getCudaContext()->memAlloc(&ptr, numElements * sizeof(T)); + if (result != 0) + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "allocDeviceBuffer failed with error code %i!\n", PxI32(result)); + + return reinterpret_cast(ptr); +} + +/** +* \brief Frees a device buffer +* +* The cuda context will get acquired automatically +* +* \param[in] cudaContextManager the PxCudaContextManager managing the CUDA context the device buffer is attributed to. +* \param[in] deviceBuffer reference to a pointer pointing to the device memory buffer. +*/ +template +static void freeDeviceBuffer(PxCudaContextManager& cudaContextManager, T*& deviceBuffer) +{ + if (deviceBuffer) + { + PxScopedCudaLock lock(cudaContextManager); + PxCUresult result = cudaContextManager.getCudaContext()->memFree(reinterpret_cast(deviceBuffer)); + if (result != 0) + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "freeDeviceBuffer failed with error code %i!\n", PxI32(result)); + + deviceBuffer = NULL; + } +} + +/** +* \brief Allocates a pinned host buffer and returns the pointer to the memory +* +* A pinned host buffer can be used on the gpu after getting a mapped device pointer from the pinned host buffer pointer, see getMappedDevicePtr +* The cuda context will get acquired automatically +* +* \param[in] cudaContextManager the PxCudaContextManager managing the CUDA context the allocation should be attributed to. +* \param[in] numElements the number of elements of type T to allocate. +* +* \return a pointer to the allocated memory. +*/ +template +static T* allocPinnedHostBuffer(PxCudaContextManager& cudaContextManager, PxU64 numElements) +{ + PxScopedCudaLock lock(cudaContextManager); + + void* ptr = NULL; + const unsigned int cuMemhostallocDevicemap = 0x02; + const unsigned int cuMemhostallocPortable = 0x01; + PxCUresult result = cudaContextManager.getCudaContext()->memHostAlloc(&ptr, numElements * sizeof(T), cuMemhostallocDevicemap | cuMemhostallocPortable); + if (result != 0) + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "allocPinnedHostBuffer failed with error code %i!\n", PxI32(result)); + + return reinterpret_cast(ptr); +} + +/** +* \brief Frees a pinned host buffer +* +* The cuda context will get acquired automatically +* +* \param[in] cudaContextManager the PxCudaContextManager managing the CUDA context the pinned memory buffer is attributed to. +* \param[in] pinnedHostBuffer reference to a pointer pointing to the pinned memory buffer. +*/ +template +static void freePinnedHostBuffer(PxCudaContextManager& cudaContextManager, T*& pinnedHostBuffer) +{ + if (pinnedHostBuffer) + { + PxScopedCudaLock lock(cudaContextManager); + PxCUresult result = cudaContextManager.getCudaContext()->memFreeHost(pinnedHostBuffer); + if (result != 0) + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "freePinnedHostBuffer failed with error code %i!\n", PxI32(result)); + + pinnedHostBuffer = NULL; + } +} + +/** +* \brief Copies a device buffer to the host +* +* The cuda context will get acquired automatically +* +* \param[in] cudaContextManager the PxCudaContextManager managing the CUDA context executing the operation. +* \param[in] hostBuffer pointer to the destination (pinned) host memory buffer. +* \param[in] deviceBuffer pointer to the source device buffer. +* \param[in] numElements the number of elements of type T to copy. +*/ +template +static void copyDToH(PxCudaContextManager& cudaContextManager, T* hostBuffer, const T* deviceBuffer, PxU64 numElements) +{ + if (!deviceBuffer || !hostBuffer) + return; + + PxScopedCudaLock lock(cudaContextManager); + PxU64 numBytes = numElements * sizeof(T); + + PxCUresult result = cudaContextManager.getCudaContext()->memcpyDtoH(hostBuffer, CUdeviceptr(deviceBuffer), numBytes); + if (result != 0) + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "copyDToH failed with error code %i!\n", PxI32(result)); +} + +/** +* \brief Copies a host buffer to the device +* +* The cuda context will get acquired automatically +* +* \param[in] cudaContextManager the PxCudaContextManager managing the CUDA context executing the operation. +* \param[in] deviceBuffer pointer to the destination device buffer. +* \param[in] hostBuffer pointer to the source (pinned) host memory buffer. +* \param[in] numElements the number of elements of type T to copy. +*/ +template +static void copyHToD(PxCudaContextManager& cudaContextManager, T* deviceBuffer, const T* hostBuffer, PxU64 numElements) +{ + if (!deviceBuffer || !hostBuffer) + return; + + PxScopedCudaLock lock(cudaContextManager); + PxU64 numBytes = numElements * sizeof(T); + + PxCUresult result = cudaContextManager.getCudaContext()->memcpyHtoD(CUdeviceptr(deviceBuffer), hostBuffer, numBytes); + if (result != 0) + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "copyHtoD failed with error code %i!\n", PxI32(result)); +} + +/** +* \brief Schedules device to host copy operation on the specified stream +* +* The cuda context will get acquired automatically +* +* \param[in] cudaContextManager the PxCudaContextManager managing the CUDA context executing the operation. +* \param[in] hostBuffer pointer to the destination (pinned) host memory buffer. +* \param[in] deviceBuffer pointer to the source device buffer. +* \param[in] numElements the number of elements of type T to copy. +* \param[in] stream the CUDA stream to perform the operation on. +*/ +template +static void copyDToHAsync(PxCudaContextManager& cudaContextManager, T* hostBuffer, const T* deviceBuffer, PxU64 numElements, CUstream stream) +{ + if (!deviceBuffer || !hostBuffer) + return; + + PxScopedCudaLock lock(cudaContextManager); + PxU64 numBytes = numElements * sizeof(T); + + PxCUresult result = cudaContextManager.getCudaContext()->memcpyDtoHAsync(hostBuffer, CUdeviceptr(deviceBuffer), numBytes, stream); + if (result != 0) + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "copyDtoHAsync failed with error code %i!\n", PxI32(result)); +} + +/** +* \brief Schedules host to device copy operation on the specified stream +* +* The cuda context will get acquired automatically +* +* \param[in] cudaContextManager the PxCudaContextManager managing the CUDA context executing the operation. +* \param[in] deviceBuffer pointer to the destination device buffer. +* \param[in] hostBuffer pointer to the source (pinned) host memory buffer. +* \param[in] numElements the number of elements of type T to copy. +* \param[in] stream the CUDA stream to perform the operation on. +*/ +template +static void copyHToDAsync(PxCudaContextManager& cudaContextManager, T* deviceBuffer, const T* hostBuffer, PxU64 numElements, CUstream stream) +{ + if (!deviceBuffer || !hostBuffer) + return; + + PxScopedCudaLock lock(cudaContextManager); + PxU64 numBytes = numElements * sizeof(T); + + PxCUresult result = cudaContextManager.getCudaContext()->memcpyHtoDAsync(CUdeviceptr(deviceBuffer), hostBuffer, numBytes, stream); + if (result != 0) + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "copyHtoDAsync failed with error code %i!\n", PxI32(result)); +} + +/** +* \brief Schedules device to device copy operation on the specified stream +* +* The cuda context will get acquired automatically +* +* \param[in] cudaContextManager the PxCudaContextManager managing the CUDA context executing the operation. +* \param[in] dstDeviceBuffer pointer to the destination device buffer. +* \param[in] srcDeviceBuffer pointer to the source device buffer. +* \param[in] numElements the number of elements of type T to copy. +* \param[in] stream the CUDA stream to perform the operation on. +*/ +template +static void copyDToDAsync(PxCudaContextManager& cudaContextManager, T* dstDeviceBuffer, const T* srcDeviceBuffer, PxU64 numElements, CUstream stream) +{ + if (!srcDeviceBuffer || !dstDeviceBuffer) + return; + + PxScopedCudaLock lock(cudaContextManager); + PxU64 numBytes = numElements * sizeof(T); + + PxCUresult result = cudaContextManager.getCudaContext()->memcpyDtoDAsync(CUdeviceptr(dstDeviceBuffer), CUdeviceptr(srcDeviceBuffer), numBytes, stream); + if (result != 0) + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "copyDtoDAsync failed with error code %i!\n", PxI32(result)); +} + +/** +* \brief Schedules a memset operation on the device on the specified stream. Only supported for 1 bytes or 4 byte data types. +* +* The cuda context will get acquired automatically +* +* \param[in] cudaContextManager the PxCudaContextManager managing the CUDA context executing the operation. +* \param[in] dstDeviceBuffer pointer to the destination device buffer. +* \param[in] value the value to set the memory to. +* \param[in] numElements the number of elements of type T to set. +* \param[in] stream the CUDA stream to perform the operation on. +*/ +template +static void memsetAsync(PxCudaContextManager& cudaContextManager, T* dstDeviceBuffer, const T& value, PxU64 numElements, CUstream stream) +{ + PX_COMPILE_TIME_ASSERT(sizeof(T) == sizeof(PxU32) || sizeof(T) == sizeof(PxU8)); + + if (!dstDeviceBuffer) + return; + + PxScopedCudaLock lock(cudaContextManager); + PxU64 numBytes = numElements * sizeof(T); + + if (sizeof(T) == sizeof(PxU32)) + { + PxCUresult result = cudaContextManager.getCudaContext()->memsetD32Async(CUdeviceptr(dstDeviceBuffer), reinterpret_cast(value), numBytes >> 2, stream); + if (result != 0) + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "memsetAsync failed with error code %i!\n", PxI32(result)); + } + else + { + PxCUresult result = cudaContextManager.getCudaContext()->memsetD8Async(CUdeviceptr(dstDeviceBuffer), reinterpret_cast(value), numBytes, stream); + if (result != 0) + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "memsetAsync failed with error code %i!\n", PxI32(result)); + } +} +}; + +#define PX_EXT_DEVICE_MEMORY_ALLOC(T, cudaContextManager, numElements) physx::Ext::PxCudaHelpersExt::allocDeviceBuffer(cudaContextManager, numElements) +#define PX_EXT_DEVICE_MEMORY_FREE(cudaContextManager, deviceBuffer) physx::Ext::PxCudaHelpersExt::freeDeviceBuffer(cudaContextManager, deviceBuffer); + +#define PX_EXT_PINNED_MEMORY_ALLOC(T, cudaContextManager, numElements) physx::Ext::PxCudaHelpersExt::allocPinnedHostBuffer(cudaContextManager, numElements) +#define PX_EXT_PINNED_MEMORY_FREE(cudaContextManager, pinnedHostBuffer) physx::Ext::PxCudaHelpersExt::freePinnedHostBuffer(cudaContextManager, pinnedHostBuffer); + +} +} + +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxCustomGeometryExt.h b/engine/third_party/physx/include/extensions/PxCustomGeometryExt.h new file mode 100644 index 00000000..0598c9ab --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxCustomGeometryExt.h @@ -0,0 +1,221 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CUSTOM_GEOMETRY_EXT_H +#define PX_CUSTOM_GEOMETRY_EXT_H + +#include "geometry/PxCustomGeometry.h" +#include "geometry/PxGjkQuery.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxGeometry; +class PxMassProperties; +class PxGeometryHolder; +struct PxContactPoint; + +/** +\brief Pre-made custom geometry callbacks implementations. +*/ +class PxCustomGeometryExt +{ +public: + + /// \cond PRIVATE + struct BaseConvexCallbacks : PxCustomGeometry::Callbacks, PxGjkQuery::Support + { + BaseConvexCallbacks(float _margin) : margin(_margin) {} + + // override PxCustomGeometry::Callbacks + virtual PxBounds3 getLocalBounds(const PxGeometry& geometry) const; + virtual bool generateContacts(const PxGeometry& geom0, const PxGeometry& geom1, const PxTransform& pose0, const PxTransform& pose1, + const PxReal contactDistance, const PxReal meshContactMargin, const PxReal toleranceLength, + PxContactBuffer& contactBuffer) const; + virtual PxU32 raycast(const PxVec3& origin, const PxVec3& unitDir, const PxGeometry& geom, const PxTransform& pose, + PxReal maxDist, PxHitFlags hitFlags, PxU32 maxHits, PxGeomRaycastHit* rayHits, PxU32 stride, PxRaycastThreadContext*) const; + virtual bool overlap(const PxGeometry& geom0, const PxTransform& pose0, const PxGeometry& geom1, const PxTransform& pose1, PxOverlapThreadContext*) const; + virtual bool sweep(const PxVec3& unitDir, const PxReal maxDist, + const PxGeometry& geom0, const PxTransform& pose0, const PxGeometry& geom1, const PxTransform& pose1, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation, PxSweepThreadContext*) const; + virtual bool usePersistentContactManifold(const PxGeometry& geometry, PxReal& breakingThreshold) const; + + // override PxGjkQuery::Support + virtual PxReal getMargin() const { return margin; } + // set margin + void setMargin(float m); + + protected: + + // Shape margin + float margin; + + // Substitute geometry + virtual bool useSubstituteGeometry(PxGeometryHolder& geom, PxTransform& preTransform, const PxContactPoint& p, const PxTransform& pose0) const = 0; + }; + /// \endcond + + /** + \brief Cylinder geometry callbacks + */ + struct CylinderCallbacks : BaseConvexCallbacks + { + /** + \brief Construct cylinder geometry callbacks object + + \param[in] height The cylinder height. + \param[in] radius The cylinder radius. + \param[in] axis The cylinder axis (0 - X, 1 - Y, 2 - Z). + \param[in] margin The cylinder margin. + */ + CylinderCallbacks(float height, float radius, int axis = 0, float margin = 0); + + /// \brief Set cylinder height + /// \param[in] h The cylinder height + void setHeight(float h); + /// \brief Get cylinder height + /// \return The cylinder height + float getHeight() const { return height; } + + /// \brief Set cylinder radius + /// \param[in] r The cylinder radius. + void setRadius(float r); + /// \brief Get cylinder radius + /// \return The cylinder radius + float getRadius() const { return radius; } + + /// \brief Set cylinder axis + /// \param[in] a The cylinder axis (0 - X, 1 - Y, 2 - Z). + void setAxis(int a); + /// \brief Get cylinder axis + /// \return The cylinder axis + int getAxis() const { return axis; } + + /// \cond PRIVATE + // override PxCustomGeometry::Callbacks + DECLARE_CUSTOM_GEOMETRY_TYPE + virtual void visualize(const PxGeometry&, PxRenderOutput&, const PxTransform&, const PxBounds3&) const; + virtual void computeMassProperties(const PxGeometry& geometry, PxMassProperties& massProperties) const; + + // override PxGjkQuery::Support + virtual PxVec3 supportLocal(const PxVec3& dir) const; + + protected: + + // Cylinder height + float height; + // Cylinder radius + float radius; + // Cylinder axis + int axis; + + // Substitute geometry + virtual bool useSubstituteGeometry(PxGeometryHolder& geom, PxTransform& preTransform, const PxContactPoint& p, const PxTransform& pose0) const; + + // Radius at height + float getRadiusAtHeight(float height) const; + /// \endcond + }; + + /** + \brief Cone geometry callbacks + */ + struct ConeCallbacks : BaseConvexCallbacks + { + /** + \brief Construct cone geometry callbacks object + + \param[in] height The cylinder height. + \param[in] radius The cylinder radius. + \param[in] axis The cylinder axis (0 - X, 1 - Y, 2 - Z). + \param[in] margin The cylinder margin. + */ + ConeCallbacks(float height, float radius, int axis = 0, float margin = 0); + + /// \brief Set cone height + /// \param[in] h The cone height + void setHeight(float h); + /// \brief Get cone height + /// \return The cone height + float getHeight() const { return height; } + + /// \brief Set cone radius + /// \param[in] r The cone radius + void setRadius(float r); + /// \brief Get cone radius + /// \return The cone radius + float getRadius() const { return radius; } + + /// \brief Set cone axis + /// \param[in] a The cone axis + void setAxis(int a); + /// \brief Get cone axis + /// \return The cone axis + int getAxis() const { return axis; } + + /// \cond PRIVATE + // override PxCustomGeometry::Callbacks + DECLARE_CUSTOM_GEOMETRY_TYPE + virtual void visualize(const PxGeometry&, PxRenderOutput&, const PxTransform&, const PxBounds3&) const; + virtual void computeMassProperties(const PxGeometry& geometry, PxMassProperties& massProperties) const; + + // override PxGjkQuery::Support + virtual PxVec3 supportLocal(const PxVec3& dir) const; + + protected: + + // Cone height + float height; + // Cone radius + float radius; + // Cone axis + int axis; + + // Substitute geometry + virtual bool useSubstituteGeometry(PxGeometryHolder& geom, PxTransform& preTransform, const PxContactPoint& p, const PxTransform& pose0) const; + + // Radius at height + float getRadiusAtHeight(float height) const; + /// \endcond + }; +}; + +/// \cond PRIVATE +// OmniPVD friendly aliases +typedef PxCustomGeometryExt::BaseConvexCallbacks PxCustomGeometryExtBaseConvexCallbacks; +typedef PxCustomGeometryExt::CylinderCallbacks PxCustomGeometryExtCylinderCallbacks; +typedef PxCustomGeometryExt::ConeCallbacks PxCustomGeometryExtConeCallbacks; +/// \endcond + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxCustomSceneQuerySystem.h b/engine/third_party/physx/include/extensions/PxCustomSceneQuerySystem.h new file mode 100644 index 00000000..77ef6fe8 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxCustomSceneQuerySystem.h @@ -0,0 +1,187 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_NEW_SCENE_QUERY_SYSTEM_H +#define PX_NEW_SCENE_QUERY_SYSTEM_H + +#include "PxSceneQuerySystem.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief A custom scene query system. + + This is an example of a custom scene query system. It augments the PxSceneQuerySystem API to support an arbitrary number + of "pruners", instead of the usual hardcoded two. + + It might not be possible to support the whole PxSceneQuerySystem API in this context. See the source code for details. + + \see PxSceneQuerySystem + */ + class PxCustomSceneQuerySystem : public PxSceneQuerySystem + { + public: + PxCustomSceneQuerySystem() {} + virtual ~PxCustomSceneQuerySystem() {} + + /** + \brief Adds a pruner to the system. + + The internal PhysX scene-query system uses two regular pruners (one for static shapes, one for dynamic shapes) and an optional + compound pruner. Our custom scene query system supports an arbitrary number of regular pruners. + + This can be useful to reduce the load on each pruner, in particular during updates, when internal trees are rebuilt in the + background. On the other hand this implementation simply iterates over all created pruners to perform queries, so their cost + might increase if a large number of pruners is used. + + In any case this serves as an example of how the PxSceneQuerySystem API can be used to customize scene queries. + + \param[in] primaryType Desired primary (main) type for the new pruner + \param[in] secondaryType Secondary type when primary type is PxPruningStructureType::eDYNAMIC_AABB_TREE. + \param[in] preallocated Optional number of preallocated shapes in the new pruner + + \return A pruner index + + \see PxCustomSceneQuerySystem PxSceneQueryUpdateMode PxCustomSceneQuerySystemAdapter PxSceneDesc::sceneQuerySystem + */ + virtual PxU32 addPruner(PxPruningStructureType::Enum primaryType, PxDynamicTreeSecondaryPruner::Enum secondaryType, PxU32 preallocated=0) = 0; + + /** + \brief Start custom build-steps for all pruners + + This function is used in combination with customBuildstep() and finishCustomBuildstep() to let users take control + of the pruners' build-step & commit calls - basically the pruners' update functions. These functions should be used + with the PxSceneQueryUpdateMode::eBUILD_DISABLED_COMMIT_DISABLED update mode, otherwise the build-steps will happen + automatically in fetchResults. For N pruners it can be more efficient to use these custom build-step functions to + perform the updates in parallel: + + - call startCustomBuildstep() first (one synchronous call) + - for each pruner, call customBuildstep() (asynchronous calls from multiple threads) + - once it is done, call finishCustomBuildstep() to finish the update (synchronous call) + + The multi-threaded update is more efficient here than what it is in PxScene, because the "flushShapes()" call is + also multi-threaded (while it is not in PxScene). + + Note that users are responsible for locks here, and these calls should not overlap with other SQ calls. In particular + one should not add new objects to the SQ system or perform queries while these calls are happening. + + \return The number of pruners in the system. + + \see customBuildstep finishCustomBuildstep PxSceneQueryUpdateMode + */ + virtual PxU32 startCustomBuildstep() = 0; + + /** + \brief Perform a custom build-step for a given pruner. + + \param[in] index Pruner index (should be between 0 and the number returned by startCustomBuildstep) + + \see startCustomBuildstep finishCustomBuildstep + */ + virtual void customBuildstep(PxU32 index) = 0; + + /** + \brief Finish custom build-steps + + Call this function once after all the customBuildstep() calls are done. + + \see startCustomBuildstep customBuildstep + */ + virtual void finishCustomBuildstep() = 0; + }; + + /** + \brief An adapter class to customize the object-to-pruner mapping. + + In the regular PhysX code static shapes went to the static pruner, and dynamic shapes went to the + dynamic pruner. + + This class is a replacement for this mapping when N user-defined pruners are involved. + */ + class PxCustomSceneQuerySystemAdapter + { + public: + PxCustomSceneQuerySystemAdapter() {} + virtual ~PxCustomSceneQuerySystemAdapter() {} + + /** + \brief Gets a pruner index for an actor/shape. + + This user-defined function tells the system in which pruner a given actor/shape should go. + + \note The returned index must be valid, i.e. it must have been previously returned to users by PxCustomSceneQuerySystem::addPruner. + + \param[in] actor The actor + \param[in] shape The shape + + \return A pruner index for this actor/shape. + + \see PxRigidActor PxShape PxCustomSceneQuerySystem::addPruner + */ + virtual PxU32 getPrunerIndex(const PxRigidActor& actor, const PxShape& shape) const = 0; + + /** + \brief Pruner filtering callback. + + This will be called for each query to validate whether it should process a given pruner. + + \param[in] prunerIndex The index of currently processed pruner + \param[in] context The query context + \param[in] filterData The query's filter data + \param[in] filterCall The query's filter callback + + \return True to process the pruner, false to skip it entirely + */ + virtual bool processPruner(PxU32 prunerIndex, const PxQueryThreadContext* context, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall) const = 0; + }; + + /** + \brief Creates a custom scene query system. + + This is similar to PxCreateExternalSceneQuerySystem, except this function creates a PxCustomSceneQuerySystem object. + It can be plugged to PxScene the same way, via PxSceneDesc::sceneQuerySystem. + + \param[in] sceneQueryUpdateMode Desired update mode + \param[in] contextID Context ID parameter, sent to the profiler + \param[in] adapter Adapter class implementing our extended API + \param[in] usesTreeOfPruners True to keep pruners themselves in a BVH, which might increase query performance if a lot of pruners are involved + + \return A custom SQ system instance + + \see PxCustomSceneQuerySystem PxSceneQueryUpdateMode PxCustomSceneQuerySystemAdapter PxSceneDesc::sceneQuerySystem + */ + PxCustomSceneQuerySystem* PxCreateCustomSceneQuerySystem(PxSceneQueryUpdateMode::Enum sceneQueryUpdateMode, PxU64 contextID, const PxCustomSceneQuerySystemAdapter& adapter, bool usesTreeOfPruners=false); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxD6Joint.h b/engine/third_party/physx/include/extensions/PxD6Joint.h new file mode 100644 index 00000000..12e7014b --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxD6Joint.h @@ -0,0 +1,632 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_D6_JOINT_H +#define PX_D6_JOINT_H + +#include "extensions/PxJoint.h" +#include "extensions/PxJointLimit.h" +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxD6Joint; + +/** +\brief Create a D6 joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + +\see PxD6Joint +*/ +PxD6Joint* PxD6JointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + +/** +\brief Used to specify one of the degrees of freedom of a D6 joint. + +\see PxD6Joint +*/ +struct PxD6Axis +{ + enum Enum + { + eX = 0, //!< motion along the X axis + eY = 1, //!< motion along the Y axis + eZ = 2, //!< motion along the Z axis + eTWIST = 3, //!< motion around the X axis + eSWING1 = 4, //!< motion around the Y axis + eSWING2 = 5, //!< motion around the Z axis + eCOUNT = 6 + }; +}; + + +/** +\brief Used to specify the range of motions allowed for a degree of freedom in a D6 joint. + +\see PxD6Joint +*/ +struct PxD6Motion +{ + enum Enum + { + eLOCKED, //!< The DOF is locked, it does not allow relative motion. + eLIMITED, //!< The DOF is limited, it only allows motion within a specific range. + eFREE //!< The DOF is free and has its full range of motion. + }; +}; + + +/** +\brief The configuration to use for driving to the angular component of a target pose or velocity. + +\see PxD6Joint::setAngularDriveConfig() PxD6Drive PxD6Joint::setDrive() +*/ +struct PxD6AngularDriveConfig +{ + enum Enum + { + /** + \brief The joint tries to reach the angular drive target by separately driving along each angular degree of freedom. + + Each angular degree of freedom can have its own set of drive parameters. The degrees of freedom are covered by a twist and two swing axes. + As a consequence, only the following options are available when setting the drive parameters: PxD6Drive::eSWING1, PxD6Drive::eSWING2, + PxD6Drive::eTWIST (see #PxD6Joint::setDrive()). + */ + eSWING_TWIST, + + /** + \brief The joint tries to reach the angular drive target by following a spherical linear interpolation (SLERP) based path. + + A single set of drive parameters will be used for all angular degrees of freedom and PxD6Drive::eSLERP is the only valid option to set + those parameters (see #PxD6Joint::setDrive()). + */ + eSLERP, + + /** + \deprecated + + \brief Legacy mode that uses a precedence system to either use the slerp or swing/twist angular drive model. + + \note In this config it is not possible to set separate drive parameters for the two swing axes. + + For compatibility with previous versions of PhysX, drive parameters for PxD6Drive::eTWIST, PxD6Drive::eSWING and PxD6Drive::eSLERP + can be set alltogether with ::eSLERP taking precedence (see #PxD6Joint::setDrive()). Use of PxD6Drive::eSWING1 and PxD6Drive::eSWING2 + is not allowed. + */ + eLEGACY PX_DEPRECATED + }; +}; + + +/** +\brief Used to specify which axes of a D6 joint are driven. + +Each drive is an implicit force-limited damped spring: + +force = spring * (target position - position) + damping * (targetVelocity - velocity) + +Alternatively, the spring may be configured to generate a specified acceleration instead of a force. + +A linear axis is affected by drive only if the corresponding drive flag is set. There are two possible models +for angular drive: swing/twist, which may be used to drive one or more angular degrees of freedom, or slerp, +which may only be used to drive all three angular degrees simultaneously. Please use #PxD6AngularDriveConfig +to configure the angular drive model. + +\see PxD6Joint PxD6AngularDriveConfig +*/ +struct PxD6Drive +{ + enum Enum + { + eX = 0, //!< drive along the X-axis + eY = 1, //!< drive along the Y-axis + eZ = 2, //!< drive along the Z-axis + + /** + \deprecated + + \brief rotational drive around the Y- and Z-axis + + \note Only allowed if the angular drive configuration is set to PxD6AngularDriveConfig::eLEGACY. + */ + eSWING PX_DEPRECATED = 3, + + /** + \brief rotational drive around the X-axis + + \note Only allowed if the angular drive configuration is set to PxD6AngularDriveConfig::eLEGACY or + PxD6AngularDriveConfig::eSWING_TWIST. + */ + eTWIST = 4, + + /** + \brief drive of all three angular degrees along a SLERP-path + + \note Only allowed if the angular drive configuration is set to PxD6AngularDriveConfig::eSLERP or + PxD6AngularDriveConfig::eLEGACY. + + \note If the angular drive configuration is set to PxD6AngularDriveConfig::eLEGACY, then eSLERP takes + precedence over eSWING/eTWIST + */ + eSLERP = 5, + + /** + \brief rotational drive around the Y-axis + + \note Only allowed if the angular drive configuration is set to PxD6AngularDriveConfig::eSWING_TWIST. + */ + eSWING1 = 6, + + /** + \brief rotational drive around the Z-axis + + \note Only allowed if the angular drive configuration is set to PxD6AngularDriveConfig::eSWING_TWIST. + */ + eSWING2 = 7, + + eCOUNT = 8 + }; +}; + +/** +\brief flags for configuring the drive model of a PxD6Joint + +\see PxD6JointDrive PxD6Joint +*/ +struct PxD6JointDriveFlag +{ + enum Enum + { + eACCELERATION = (1 << 0), //!< drive spring is for the acceleration at the joint (rather than the force) + + /** + \brief Add drive force/torque to the joint force/torque total. + + If this flag is raised, the force/torque value from this drive constraint will be accumulated + in the force/torque total that is reported for the underlying PxConstraint object. Note that + because the force/torque total changes, the joint break behavior will change too. + + Default: False + + \see PxConstraint::getForce() + */ + eOUTPUT_FORCE = (1 << 1) + }; +}; +typedef PxFlags PxD6JointDriveFlags; +PX_FLAGS_OPERATORS(PxD6JointDriveFlag::Enum, PxU32) + +/** +\brief parameters for configuring the drive model of a PxD6Joint + +\see PxD6Joint +*/ +class PxD6JointDrive : public PxSpring +{ +public: + PxReal forceLimit; //!< the force limit of the drive - may be an impulse or a force depending on PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES + PxD6JointDriveFlags flags; //!< the joint drive flags + + /** + \brief default constructor for PxD6JointDrive. + */ + PxD6JointDrive(): PxSpring(0,0), forceLimit(PX_MAX_F32), flags(0) {} + + /** + \brief constructor a PxD6JointDrive. + + \param[in] driveStiffness The stiffness of the drive spring. + \param[in] driveDamping The damping of the drive spring + \param[in] driveForceLimit The maximum impulse or force that can be exerted by the drive + \param[in] isAcceleration Whether the drive is an acceleration drive or a force drive + */ + PxD6JointDrive(PxReal driveStiffness, PxReal driveDamping, PxReal driveForceLimit, bool isAcceleration = false) + : PxSpring(driveStiffness, driveDamping) + , forceLimit(driveForceLimit) + , flags(isAcceleration?PxU32(PxD6JointDriveFlag::eACCELERATION) : 0) + {} + + /** + \brief returns true if the drive is valid + */ + bool isValid() const + { + return PxIsFinite(stiffness) && stiffness>=0 && + PxIsFinite(damping) && damping >=0 && + PxIsFinite(forceLimit) && forceLimit >=0; + } +}; + + +/** + \brief A D6 joint is a general constraint between two actors. + + It allows the application to individually define the linear and rotational degrees of freedom, + and also to configure a variety of limits and driven degrees of freedom. + + By default all degrees of freedom are locked. So to create a prismatic joint with free motion + along the x-axis: + + \code + ... + joint->setMotion(PxD6Axis::eX, PxD6JointMotion::eFREE); + ... + \endcode + + Or a Revolute joint with motion free allowed around the x-axis: + + \code + ... + joint->setMotion(PxD6Axis::eTWIST, PxD6JointMotion::eFREE); + ... + \endcode + + Degrees of freedom may also be set to limited instead of locked. + + There are two different kinds of linear limits available. The first kind is a single limit value + for all linear degrees of freedom, which may act as a linear, circular, or spherical limit depending + on which degrees of freedom are limited. This is similar to a distance limit. Then, the second kind + supports a pair of limit values for each linear axis, which can be used to implement a traditional + prismatic joint for example. + + If the twist degree of freedom is limited, is supports upper and lower limits. The two swing degrees + of freedom are limited with a cone limit. +\see PxD6JointCreate() PxJoint +*/ +class PxD6Joint : public PxJoint +{ +public: + + /** + \brief Set the motion type around the specified axis. + + Each axis may independently specify that the degree of freedom is locked (blocking relative movement + along or around this axis), limited by the corresponding limit, or free. + + \param[in] axis the axis around which motion is specified + \param[in] type the motion type around the specified axis + + Default: all degrees of freedom are locked + + \see getMotion() PxD6Axis PxD6Motion + */ + virtual void setMotion(PxD6Axis::Enum axis, PxD6Motion::Enum type) = 0; + + /** + \brief Get the motion type around the specified axis. + + \see setMotion() PxD6Axis PxD6Motion + + \param[in] axis the degree of freedom around which the motion type is specified + \return the motion type around the specified axis + */ + virtual PxD6Motion::Enum getMotion(PxD6Axis::Enum axis) const = 0; + + /** + \brief get the twist angle of the joint, in the range (-2*Pi, 2*Pi] + */ + virtual PxReal getTwistAngle() const = 0; + + /** + \brief get the twist angle of the joint + + \deprecated Use getTwistAngle instead. Deprecated since PhysX version 4.0 + */ + PX_DEPRECATED PX_FORCE_INLINE PxReal getTwist() const { return getTwistAngle(); } + + /** + \brief get the swing angle of the joint from the Y axis + */ + virtual PxReal getSwingYAngle() const = 0; + + /** + \brief get the swing angle of the joint from the Z axis + */ + virtual PxReal getSwingZAngle() const = 0; + + /** + \brief Set the distance limit for the joint. + + A single limit constraints all linear limited degrees of freedom, forming a linear, circular + or spherical constraint on motion depending on the number of limited degrees. This is similar + to a distance limit. + + \param[in] limit the distance limit structure + + \see getDistanceLimit() PxJointLinearLimit + */ + virtual void setDistanceLimit(const PxJointLinearLimit& limit) = 0; + + /** + \brief Get the distance limit for the joint. + + \return the distance limit structure + + \see setDistanceLimit() PxJointLinearLimit + */ + virtual PxJointLinearLimit getDistanceLimit() const = 0; + + /** + \deprecated Use setDistanceLimit instead. Deprecated since PhysX version 4.0 + */ + PX_DEPRECATED PX_FORCE_INLINE void setLinearLimit(const PxJointLinearLimit& limit) { setDistanceLimit(limit); } + + /** + \deprecated Use getDistanceLimit instead. Deprecated since PhysX version 4.0 + */ + PX_DEPRECATED PX_FORCE_INLINE PxJointLinearLimit getLinearLimit() const { return getDistanceLimit(); } + + /** + \brief Set the linear limit for a given linear axis. + + This function extends the previous setDistanceLimit call with the following features: + - there can be a different limit for each linear axis + - each limit is defined by two values, i.e. it can now be asymmetric + + This can be used to create prismatic joints similar to PxPrismaticJoint, or point-in-quad joints, + or point-in-box joints. + + \param[in] axis The limited linear axis (must be PxD6Axis::eX, PxD6Axis::eY or PxD6Axis::eZ) + \param[in] limit The linear limit pair structure + + \see getLinearLimit() + */ + virtual void setLinearLimit(PxD6Axis::Enum axis, const PxJointLinearLimitPair& limit) = 0; + + /** + \brief Get the linear limit for a given linear axis. + + \param[in] axis The limited linear axis (must be PxD6Axis::eX, PxD6Axis::eY or PxD6Axis::eZ) + + \return the linear limit pair structure from desired axis + + \see setLinearLimit() PxJointLinearLimit + */ + virtual PxJointLinearLimitPair getLinearLimit(PxD6Axis::Enum axis) const = 0; + + /** + \brief Set the twist limit for the joint. + + The twist limit controls the range of motion around the twist axis. + + The limit angle range is (-2*Pi, 2*Pi). + + \param[in] limit the twist limit structure + + \see getTwistLimit() PxJointAngularLimitPair + */ + virtual void setTwistLimit(const PxJointAngularLimitPair& limit) = 0; + + /** + \brief Get the twist limit for the joint. + + \return the twist limit structure + + \see setTwistLimit() PxJointAngularLimitPair + */ + virtual PxJointAngularLimitPair getTwistLimit() const = 0; + + /** + \brief Set the swing cone limit for the joint. + + The cone limit is used if either or both swing axes are limited. The extents are + symmetrical and measured in the frame of the parent. If only one swing degree of freedom + is limited, the corresponding value from the cone limit defines the limit range. + + \param[in] limit the cone limit structure + + \see getLimitCone() PxJointLimitCone + */ + virtual void setSwingLimit(const PxJointLimitCone& limit) = 0; + + /** + \brief Get the cone limit for the joint. + + \return the swing limit structure + + \see setLimitCone() PxJointLimitCone + */ + virtual PxJointLimitCone getSwingLimit() const = 0; + + /** + \brief Set a pyramidal swing limit for the joint. + + The pyramid limits will only be used in the following cases: + - both swing Y and Z are limited. The limit shape is then a pyramid. + - Y is limited and Z is locked, or vice versa. The limit shape is an asymmetric angular section, similar to + what is supported for the twist axis. + The remaining cases (Y limited and Z is free, or vice versa) are not supported. + + \param[in] limit the cone limit structure + + \see getLimitCone() PxJointLimitPyramid + */ + virtual void setPyramidSwingLimit(const PxJointLimitPyramid& limit) = 0; + + /** + \brief Get the pyramidal swing limit for the joint. + + \return the swing limit structure + + \see setLimitCone() PxJointLimitPyramid + */ + virtual PxJointLimitPyramid getPyramidSwingLimit() const = 0; + + /** + \brief Set the drive parameters for the specified drive type. + + \note The angular drive configuration (see #PxD6AngularDriveConfig) defines what type of + angular drives will be accepted. + + \param[in] index the type of drive being specified + \param[in] drive the drive parameters + + \see getDrive() PxD6JointDrive PxD6AngularDriveConfig + + Default The default drive spring and damping values are zero, the force limit is PX_MAX_F32, and no flags are set. + */ + virtual void setDrive(PxD6Drive::Enum index, const PxD6JointDrive& drive) = 0; + + /** + \brief Get the drive parameters for the specified drive type. + + \note The angular drive configuration (see #PxD6AngularDriveConfig) defines what type of + angular drives will be accepted. + + \param[in] index the specified drive type + + \see setDrive() PxD6JointDrive PxD6AngularDriveConfig + */ + virtual PxD6JointDrive getDrive(PxD6Drive::Enum index) const = 0; + + /** + \brief Set the drive goal pose + + The goal is relative to the constraint frame of actor[0] + + Default the identity transform + + \param[in] pose The goal drive pose if positional drive is in use. + \param[in] autowake If true and the attached actors are in a scene, this call wakes them up and increases their + wake counters to #PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value. + + \see setDrivePosition() + */ + virtual void setDrivePosition(const PxTransform& pose, bool autowake = true) = 0; + + /** + \brief Get the drive goal pose. + + \see getDrivePosition() + */ + virtual PxTransform getDrivePosition() const = 0; + + /** + \brief Set the target goal velocity for drive. + + The velocity is measured in the constraint frame of actor[0] + + \param[in] linear The goal velocity for linear drive + \param[in] angular The goal velocity for angular drive + \param[in] autowake If true and the attached actors are in a scene, this call wakes them up and increases their + wake counters to #PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value. + + \see getDriveVelocity() + */ + virtual void setDriveVelocity(const PxVec3& linear, const PxVec3& angular, bool autowake = true) = 0; + + /** + \brief Get the target goal velocity for joint drive. + + \param[in] linear The goal velocity for linear drive + \param[in] angular The goal velocity for angular drive + + \see setDriveVelocity() + */ + virtual void getDriveVelocity(PxVec3& linear, PxVec3& angular) const = 0; + + /** + \brief Returns string name of PxD6Joint, used for serialization + */ + virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxD6Joint"; } + +protected: + + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxD6Joint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxD6Joint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxD6Joint", PxJoint); } + + //~serialization + +public: + /** + \brief Returns the GPU D6 joint index. + + \note Only use in combination with enabled GPU dynamics and enabled direct GPU API + (see #PxSceneFlag::eENABLE_GPU_DYNAMICS, #PxSceneFlag::eENABLE_DIRECT_GPU_API, + #PxBroadPhaseType::eGPU) + + \return The GPU index, or PX_INVALID_D6_JOINT_GPU_INDEX if the joint is not part of a PxScene. + + \see PxDirectGPUAPI::getD6JointData() + */ + virtual PxD6JointGPUIndex getGPUIndex() const = 0; + + /** + \brief Set the angular drive model to apply. + + \note The configuration will limit the allowed set of angular drive types (see #PxD6Drive) to use + when calling #PxD6Joint::setDrive(). + + \note Changing the angular drive model, will reset all the parameters for the angular drives to + their default values (see #PxD6Joint::setDrive() for information on the default values). + + \param[in] config The angular drive model to apply. + + \see PxD6AngularDriveConfig getAngularDriveConfig() + + Default PxD6AngularDriveConfig::eLEGACY but will soon change to PxD6AngularDriveConfig::eSWING_TWIST + */ + virtual void setAngularDriveConfig(PxD6AngularDriveConfig::Enum config) = 0; + + /** + \brief Get the angular drive model to apply. + + \return The angular drive model to apply. + + \see PxD6AngularDriveConfig setAngularDriveConfig() + */ + virtual PxD6AngularDriveConfig::Enum getAngularDriveConfig() const = 0; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxD6JointCreate.h b/engine/third_party/physx/include/extensions/PxD6JointCreate.h new file mode 100644 index 00000000..0aa43d85 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxD6JointCreate.h @@ -0,0 +1,251 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_D6_JOINT_CREATE_H +#define PX_D6_JOINT_CREATE_H + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVec3.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxPhysics; +class PxRigidActor; +class PxJoint; + +/** + \brief Helper function to create a fixed joint, using either a PxD6Joint or PxFixedJoint. + + For fixed joints it is important that the joint frames have the same orientation. This helper function uses an identity rotation for both. + It is also important that the joint frames have an equivalent position in world space. The function does not check this, so it is up to users + to ensure that this is the case. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos0 The position of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos1 The position of the joint relative to actor1 + \param[in] useD6 True to use a PxD6Joint, false to use a PxFixedJoint; + + \return The created joint. + + \see PxD6Joint PxFixedJoint +*/ +PxJoint* PxD6JointCreate_Fixed(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, bool useD6); + +/** + \brief Helper function to create a distance joint, using either a PxD6Joint or PxDistanceJoint. + + This helper function only supports a maximum distance constraint, because PxD6Joint does not support a minimum distance constraint (contrary + to PxDistanceJoint). + + The distance is computed between the joint frames' world-space positions. The joint frames' orientations are irrelevant here so the function + sets them to identity. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos0 The position of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos1 The position of the joint relative to actor1 + \param[in] maxDist The maximum allowed distance + \param[in] useD6 True to use a PxD6Joint, false to use a PxDistanceJoint; + + \return The created joint. + + \see PxD6Joint PxDistanceJoint +*/ +PxJoint* PxD6JointCreate_Distance(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, float maxDist, bool useD6); + +/** + \brief Helper function to create a prismatic joint, using either a PxD6Joint or PxPrismaticJoint. + + This function enforces that the joint frames have the same orientation, which is a local frame whose X is the desired translation axis. + This orientation is computed by the function, so users only have to define the desired translation axis (typically 1;0;0 or 0;1;0 or 0;0;1). + + The translation can be limited. Limits are enforced if minLimitmaxLimit the + limits are not enforced and the axis is free. The limit values are computed relative to the position of actor0's joint frame. + + The function creates hard limits, and uses PhysX's default contact distance parameter. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos0 The position of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos1 The position of the joint relative to actor1 + \param[in] axis The axis along which objects are allowed to move, expressed in the actors' local space + \param[in] minLimit The minimum allowed position along the axis + \param[in] maxLimit The maximum allowed position along the axis + \param[in] useD6 True to use a PxD6Joint, false to use a PxPrismaticJoint; + + \return The created joint. + + \see PxD6Joint PxPrismaticJoint +*/ +PxJoint* PxD6JointCreate_Prismatic(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, const PxVec3& axis, float minLimit, float maxLimit, bool useD6); + +/** + \brief Helper function to create a revolute joint, using either a PxD6Joint or PxRevoluteJoint. + + This function enforces that the joint frames have the same orientation, which is a local frame whose X is the desired rotation axis. + This orientation is computed by the function, so users only have to define the desired rotation axis (typically 1;0;0 or 0;1;0 or 0;0;1). + + The rotation can be limited. Limits are enforced if minLimitmaxLimit the + limits are not enforced and the axis is free. The limit values are computed relative to the rotation of actor0's joint frame. + + The function creates hard limits, and uses PhysX's default contact distance parameter. + + Limits are expressed in radians. Allowed range is ]-2*PI;+2*PI[ + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos0 The position of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos1 The position of the joint relative to actor1 + \param[in] axis The axis around which objects are allowed to move, expressed in the actors' local space + \param[in] minLimit The minimum allowed rotation along the axis + \param[in] maxLimit The maximum allowed rotation along the axis + \param[in] useD6 True to use a PxD6Joint, false to use a PxRevoluteJoint; + + \return The created joint. + + \see PxD6Joint PxRevoluteJoint +*/ +PxJoint* PxD6JointCreate_Revolute(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, const PxVec3& axis, float minLimit, float maxLimit, bool useD6); + +/** + \brief Helper function to create a spherical joint, using either a PxD6Joint or PxSphericalJoint. + + This function supports a cone limit shape, defined by a cone axis and two angular limit values. + + This function enforces that the joint frames have the same orientation, which is a local frame whose X is the desired cone axis. + This orientation is computed by the function, so users only have to define the desired cone axis (typically 1;0;0 or 0;1;0 or 0;0;1). + + The rotations can be limited. Limits are enforced if limit1>0 and limit2>0. Otherwise the motion is free. The limit values define an ellipse, + which is the cross-section of the cone limit shape. + + The function creates hard limits, and uses PhysX's default contact distance parameter. + + Limits are expressed in radians. Allowed range is ]0;PI[. Limits are symmetric around the cone axis. + + The cone axis is equivalent to the twist axis for the D6 joint. The twist motion is not limited. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos0 The position of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos1 The position of the joint relative to actor1 + \param[in] axis The cone axis, expressed in the actors' local space + \param[in] limit1 Max angular limit for the ellipse along the joint frame's second axis (first axis = cone axis) + \param[in] limit2 Max angular limit for the ellipse along the joint frame's third axis (first axis = cone axis) + \param[in] useD6 True to use a PxD6Joint, false to use a PxSphericalJoint; + + \return The created joint. + + \see PxD6Joint PxSphericalJoint +*/ +PxJoint* PxD6JointCreate_Spherical(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, const PxVec3& axis, float limit1, float limit2, bool useD6); + +/** + \brief Helper function to create a spherical joint, using either a PxD6Joint or PxSphericalJoint. + + This function supports a cone limit shape, defined by two pairs of angular limit values. This can be used to create an asymmetric cone. If the + angular limit values are symmetric (i.e. minLimit1=-maxLimit1 and minLimit2=-maxLimit2) then the cone axis is the X axis in actor0's space. + If the limits are not symmetric, the function rotates the cone axis accordingly so that limits remain symmetric for PhysX. If this happens, + the initial joint frames will be different for both actors. By default minLimit1/maxLimit1 are limits around the joint's Y axis, and + minLimit2/maxLimit2 are limits around the joint's Z axis. + + The function creates hard limits, and uses PhysX's default contact distance parameter. + + Limits are expressed in radians. Allowed range is ]-PI;PI[. + + The cone axis is equivalent to the twist axis for the D6 joint. The twist motion is not limited. + + The returned apiroty and apirotz values can later be added to retrieved Y and Z swing angle values (from the joint), to remap + angle values to the given input range. + + \param[out] apiroty Amount of rotation around Y used to setup actor0's joint frame + \param[out] apirotz Amount of rotation around Z used to setup actor0's joint frame + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos0 The position of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos1 The position of the joint relative to actor1 + \param[in] minLimit1 Min angular limit along the joint frame's second axis (first axis = cone axis) + \param[in] maxLimit1 Max angular limit along the joint frame's second axis (first axis = cone axis) + \param[in] minLimit2 Min angular limit along the joint frame's third axis (first axis = cone axis) + \param[in] maxLimit2 Max angular limit along the joint frame's third axis (first axis = cone axis) + \param[in] useD6 True to use a PxD6Joint, false to use a PxSphericalJoint; + + \return The created joint. + + \see PxD6Joint PxSphericalJoint +*/ +PxJoint* PxD6JointCreate_GenericCone(float& apiroty, float& apirotz, PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, float minLimit1, float maxLimit1, float minLimit2, float maxLimit2, bool useD6); + + +/** + \brief Helper function to create a D6 joint with pyramidal swing limits. + + This function supports a pyramid limit shape, defined by two pairs of angular limit values. This can be used to create an asymmetric pyramid. If the + angular limit values are symmetric (i.e. minLimit1=-maxLimit1 and minLimit2=-maxLimit2) then the pyramid axis is the X axis in actor0's space. + By default minLimit1/maxLimit1 are limits around the joint's Y axis, and minLimit2/maxLimit2 are limits around the joint's Z axis. + + The function creates hard limits, and uses PhysX's default contact distance parameter. + + Limits are expressed in radians. Allowed range is ]-PI;PI[. + + The pyramid axis is equivalent to the twist axis for the D6 joint. The twist motion is not limited. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos0 The position of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos1 The position of the joint relative to actor1 + \param[in] axis The pyramid axis, expressed in the actors' local space + \param[in] minLimit1 Min angular limit along the joint frame's second axis (first axis = pyramid axis) + \param[in] maxLimit1 Max angular limit along the joint frame's second axis (first axis = pyramid axis) + \param[in] minLimit2 Min angular limit along the joint frame's third axis (first axis = pyramid axis) + \param[in] maxLimit2 Max angular limit along the joint frame's third axis (first axis = pyramid axis) + + \return The created joint. + + \see PxD6Joint +*/ +PxJoint* PxD6JointCreate_Pyramid(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, const PxVec3& axis, + float minLimit1, float maxLimit1, float minLimit2, float maxLimit2); + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxDefaultAllocator.h b/engine/third_party/physx/include/extensions/PxDefaultAllocator.h new file mode 100644 index 00000000..c3039c3c --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxDefaultAllocator.h @@ -0,0 +1,111 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_DEFAULT_ALLOCATOR_H +#define PX_DEFAULT_ALLOCATOR_H + +#include "foundation/PxAllocatorCallback.h" +#include "foundation/PxAssert.h" +#include "foundation/PxMemory.h" +#include "common/PxPhysXCommonConfig.h" + +#include + +#if PX_WINDOWS_FAMILY || PX_LINUX_FAMILY || PX_SWITCH +#include +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if PX_WINDOWS_FAMILY +// on win32 we only have 8-byte alignment guaranteed, but the CRT provides special aligned allocation fns +PX_FORCE_INLINE void* platformAlignedAlloc(size_t size) +{ + return _aligned_malloc(size, 16); +} + +PX_FORCE_INLINE void platformAlignedFree(void* ptr) +{ + _aligned_free(ptr); +} +#elif PX_LINUX_FAMILY || PX_SWITCH +PX_FORCE_INLINE void* platformAlignedAlloc(size_t size) +{ + return ::memalign(16, size); +} + +PX_FORCE_INLINE void platformAlignedFree(void* ptr) +{ + ::free(ptr); +} +#else +// on all other platforms we get 16-byte alignment by default +PX_FORCE_INLINE void* platformAlignedAlloc(size_t size) +{ + return ::malloc(size); +} + +PX_FORCE_INLINE void platformAlignedFree(void* ptr) +{ + ::free(ptr); +} +#endif + +/** +\brief default implementation of the allocator interface required by the SDK +*/ +class PxDefaultAllocator : public PxAllocatorCallback +{ +public: + virtual void* allocate(size_t size, const char*, const char*, int) + { + void* ptr = platformAlignedAlloc(size); + PX_ASSERT((size_t(ptr) & 15)==0); +#if PX_STOMP_ALLOCATED_MEMORY + if(ptr != NULL) + { + PxMemSet(ptr, PxI32(0xcd), PxU32(size)); + } +#endif + return ptr; + } + + virtual void deallocate(void* ptr) + { + platformAlignedFree(ptr); + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxDefaultCpuDispatcher.h b/engine/third_party/physx/include/extensions/PxDefaultCpuDispatcher.h new file mode 100644 index 00000000..966fa727 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxDefaultCpuDispatcher.h @@ -0,0 +1,119 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_DEFAULT_CPU_DISPATCHER_H +#define PX_DEFAULT_CPU_DISPATCHER_H + +#include "common/PxPhysXCommonConfig.h" +#include "task/PxCpuDispatcher.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief A default implementation for a CPU task dispatcher. + +\see PxDefaultCpuDispatcherCreate() PxCpuDispatcher +*/ +class PxDefaultCpuDispatcher : public PxCpuDispatcher +{ +public: + /** + \brief Deletes the dispatcher. + + Do not keep a reference to the deleted instance. + + \see PxDefaultCpuDispatcherCreate() + */ + virtual void release() = 0; + + /** + \brief Enables profiling at task level. + + \note By default enabled only in profiling builds. + + \param[in] runProfiled True if tasks should be profiled. + */ + virtual void setRunProfiled(bool runProfiled) = 0; + + /** + \brief Checks if profiling is enabled at task level. + + \return True if tasks should be profiled. + */ + virtual bool getRunProfiled() const = 0; +}; + + +/** +\brief If a thread ends up waiting for work it will find itself in a spin-wait loop until work becomes available. +Three strategies are available to limit wasted cycles. +The strategies are as follows: +a) wait until a work task signals the end of the spin-wait period. +b) yield the thread by providing a hint to reschedule thread execution, thereby allowing other threads to run. +c) yield the processor by informing it that it is waiting for work and requesting it to more efficiently use compute resources. +*/ +struct PxDefaultCpuDispatcherWaitForWorkMode +{ + enum Enum + { + eWAIT_FOR_WORK, + eYIELD_THREAD, + eYIELD_PROCESSOR + }; +}; + + +/** +\brief Create default dispatcher, extensions SDK needs to be initialized first. + +\param[in] numThreads Number of worker threads the dispatcher should use. +\param[in] affinityMasks Array with affinity mask for each thread. If not defined, default masks will be used. +\param[in] mode is the strategy employed when a busy-wait is encountered. +\param[in] yieldProcessorCount specifies the number of times a OS-specific yield processor command will be executed +during each cycle of a busy-wait in the event that the specified mode is eYIELD_PROCESSOR + +\note numThreads may be zero in which case no worker thread are initialized and +simulation tasks will be executed on the thread that calls PxScene::simulate() + +\note yieldProcessorCount must be greater than zero if eYIELD_PROCESSOR is the chosen mode and equal to zero for all other modes. + +\note eYIELD_THREAD and eYIELD_PROCESSOR modes will use compute resources even if the simulation is not running. +It is left to users to keep threads inactive, if so desired, when no simulation is running. + +\see PxDefaultCpuDispatcher +*/ +PxDefaultCpuDispatcher* PxDefaultCpuDispatcherCreate(PxU32 numThreads, PxU32* affinityMasks = NULL, PxDefaultCpuDispatcherWaitForWorkMode::Enum mode = PxDefaultCpuDispatcherWaitForWorkMode::eWAIT_FOR_WORK, PxU32 yieldProcessorCount = 0); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxDefaultErrorCallback.h b/engine/third_party/physx/include/extensions/PxDefaultErrorCallback.h new file mode 100644 index 00000000..10fa27c5 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxDefaultErrorCallback.h @@ -0,0 +1,61 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_DEFAULT_ERROR_CALLBACK_H +#define PX_DEFAULT_ERROR_CALLBACK_H + +#include "foundation/PxErrorCallback.h" +#include "PxPhysXConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief default implementation of the error callback + + This class is provided in order to enable the SDK to be started with the minimum of user code. Typically an application + will use its own error callback, and log the error to file or otherwise make it visible. Warnings and error messages from + the SDK are usually indicative that changes are required in order for PhysX to function correctly, and should not be ignored. + */ + + class PxDefaultErrorCallback : public PxErrorCallback + { + public: + PxDefaultErrorCallback(); + virtual ~PxDefaultErrorCallback(); + + virtual void reportError(PxErrorCode::Enum code, const char* message, const char* file, int line) PX_OVERRIDE; + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxDefaultProfiler.h b/engine/third_party/physx/include/extensions/PxDefaultProfiler.h new file mode 100644 index 00000000..89faab8c --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxDefaultProfiler.h @@ -0,0 +1,182 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_DEFAULT_PROFILER_H +#define PX_DEFAULT_PROFILER_H + +#include "foundation/PxProfiler.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + + + +/** +\brief The major and minor version of the current Default Profiler file format. +*/ +#define PX_PROFILER_VERSION_MAJOR 0 +#define PX_PROFILER_VERSION_MINOR 1 + + +/** +\brief The various profiler data types that describe what data follows in the stream. +*/ +struct PxDefaultProfilerDataType +{ + enum Enum : PxU64 + { + eTHREAD_BLOCK = 0, //!< A thread ID follows a thread tag. All data following a thread block are from this thread. + + /*! + A key, size and character string follows a name registration tag. Event names are only written once per thread. + + Ensure names are global or static so the character pointer is static and does not change. + Pointers values are used as keys to look up names. It is especially important for cross thread + zones so the zone names can be found across threads. + */ + eNAME_REGISTRATION, + + eZONE_START, //!< A PxProfilerCallback::zoneStart callback. A time tag, context and name key follows a zone start tag. + eZONE_END, //!< A PxProfilerCallback::zoneEnd callback. A time tag, context and name key follows a zone end tag. + eZONE_START_CROSS_THREAD, //!< A PxProfilerCallback::zoneStart callback with detached set to true indicating a cross thread zone. + eZONE_END_CROSS_THREAD, //!< A PxProfilerCallback::zoneEnd callback with detached set to true indicating a cross thread zone. + eVALUE_INT, //!< A PxProfilerCallback::recordData callback with an integer value. + eVALUE_FLOAT, //!< A PxProfilerCallback::recordData callback with a floating point value. + eFRAME //!< A PxProfilerCallback::recordFrame callback. Frames are simple markers that are identifable in the profiling tools. + }; +}; + +struct PxDefaultProfilerVersionInfo +{ + PxU32 major; //!< The major version of the current file format. + PxU32 minor; //!< The minor version of the current file format. +}; + +struct PxDefaultProfilerHeader +{ + PxDefaultProfilerDataType::Enum type; //!< The type of event or data that follows this header. See PxDefaultProfilerDataType. +}; + +struct PxDefaultProfilerThread +{ + PxU64 threadId; //!< The thread identifier for all of the data that follows. +}; + +struct PxDefaultProfilerName +{ + PxU64 key; //!< The key to the profiler name. Used to store the name in a map for quick look ups. It is also the pointer to the character string. + PxU32 size; //!< Byte size of the null terminated string that follows the PxDefaultProfilerName entry in the stream. Note that due to padding the size can be larger than the string size itself. + + /// @cond + PxU32 padding; + /// @endcond +}; + +struct PxDefaultProfilerEvent +{ + PxU64 time; //!< The time the event was received, in tens of nano seconds. + PxU64 contextId; //!< The context sent with the event. User controlled data to associate with the event. + PxU64 nameKey; //!< The key to look up the name at a later time so strings are not stored with every event. +}; + +struct PxDefaultProfilerValueEvent : public PxDefaultProfilerEvent +{ + union + { + PxI32 intValue; //!< Either integer or float data that is to be graphed. + PxF32 floatValue; //!< Either integer or float data that is to be graphed. + }; + + /// @cond + PxU32 padding; + /// @endcond +}; + +class PxOutputStream; + +/** + +\brief Default implementation of PxProfilerCallback to record profiling events. + +The profiling events are stored in a memory buffer which gets flushed to a user provided stream when the +buffer is full, or when flush or release is called. + +\see PxDefaultProfilerCreate() +*/ +class PxDefaultProfiler : public PxProfilerCallback +{ +public: + + /** + \brief Deletes the profiler. + + Do not keep a reference to the deleted instance. + + \see PxDefaultProfilerCreate() + */ + virtual void release() = 0; + + /** + \brief Write all of the collected profiling data to the output stream. + + This call is not thread safe, so it should only be called during a sync point or when all threads have yielded. + Calling this regularly, at appropriate times will prevent the buffers from filling up and forcing a write + to the stream at unexpected times because writes will affect performance. + */ + virtual void flush() = 0; +}; + +/** +\brief Create default profiler. + +\note The PhysXExtensions SDK needs to be initialized first before using this method (see #PxInitExtensions) + +\param[in] outputStream A PxOutputStream used to write all of the recorded +profiler events received. Writing to the stream occurs when the +buffer is full or when flush or release is called. +\param[in] numberOfBuffers The number of buffers to pre-allocate. One buffer is +used per thread, so a number larger than the anticipated number of threads is best. +If more buffers are needed, additional memory is allocated as needed, but this may +affect performance. +\param[in] bufferSize The number of bytes to allocate per thread for recording all +profiler events received on that thread. Once the buffer is full, the profiling data +is written to the stream, which will cause a slight delay. Use a larger buffer size +to prevent this, if memory permits. The minimum buffer size is 32,767 bytes, which is also +the default setting. +*/ +PxDefaultProfiler* PxDefaultProfilerCreate(PxOutputStream& outputStream, PxU32 numberOfBuffers = 16, PxU32 bufferSize = 32767); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxDefaultSimulationFilterShader.h b/engine/third_party/physx/include/extensions/PxDefaultSimulationFilterShader.h new file mode 100644 index 00000000..118543cc --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxDefaultSimulationFilterShader.h @@ -0,0 +1,265 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_DEFAULT_SIMULATION_FILTER_SHADER_H +#define PX_DEFAULT_SIMULATION_FILTER_SHADER_H + +#include "PxPhysXConfig.h" + +#include "PxFiltering.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxActor; + +/** +\brief 64-bit mask used for collision filtering. + +The collision filtering equation for 2 objects o0 and o1 is: + +
 (G0 op0 K0) op2 (G1 op1 K1) == b 
+ +with + +
    +
  • G0 = PxGroupsMask for object o0. See PxSetGroupsMask
  • +
  • G1 = PxGroupsMask for object o1. See PxSetGroupsMask
  • +
  • K0 = filtering constant 0. See PxSetFilterConstants
  • +
  • K1 = filtering constant 1. See PxSetFilterConstants
  • +
  • b = filtering boolean. See PxSetFilterBool
  • +
  • op0, op1, op2 = filtering operations. See PxSetFilterOps
  • +
+ +If the filtering equation is true, collision detection is enabled. + +\see PxSetFilterOps() +*/ +class PxGroupsMask +{ +public: + PX_INLINE PxGroupsMask():bits0(0),bits1(0),bits2(0),bits3(0) {} + PX_INLINE ~PxGroupsMask() {} + + PxU16 bits0, bits1, bits2, bits3; +}; + +/** +\brief Collision filtering operations. + +\see PxGroupsMask +*/ +struct PxFilterOp +{ + enum Enum + { + PX_FILTEROP_AND, + PX_FILTEROP_OR, + PX_FILTEROP_XOR, + PX_FILTEROP_NAND, + PX_FILTEROP_NOR, + PX_FILTEROP_NXOR, + PX_FILTEROP_SWAP_AND + }; +}; + +/** +\brief Implementation of a simple filter shader that emulates PhysX 2.8.x filtering + +This shader provides the following logic: +\li If one of the two filter objects is a trigger, the pair is acccepted and #PxPairFlag::eTRIGGER_DEFAULT will be used for trigger reports +\li Else, if the filter mask logic (see further below) discards the pair it will be suppressed (#PxFilterFlag::eSUPPRESS) +\li Else, the pair gets accepted and collision response gets enabled (#PxPairFlag::eCONTACT_DEFAULT) + +Filter mask logic: +Given the two #PxFilterData structures fd0 and fd1 of two collision objects, the pair passes the filter if the following +conditions are met: + + 1) Collision groups of the pair are enabled + 2) Collision filtering equation is satisfied + +Each actor can belong to a single collision group. Use PxSetGroup to set the group of an actor and PxGetGroup to retrieve the group of an actor. +A collision group is an integer value between 0 and 31 defining which group the actor belongs to. Because that value is written to an actor's +shapes internally (it is stored in the shapes' PxFilterData), this feature does not work with shared shapes, unless they all belong to actors +whose groups are similar. For example it would not work to share a shape between actors A and B, and then assign A to group 0 and B to group 1, +as they would both internally try to write different group values to the same shape. + +Once actors are assigned to groups, it is possible to define how groups collide with each-other using the PxSetGroupCollisionFlag function. +Use this function to set a simple boolean value per group pairs, defining if the corresponding groups should collide. If not, collisions between +actors of these non-colliding groups will be automatically disabled by the PxDefaultSimulationFilterShader. + +\see PxSimulationFilterShader PxGetGroupCollisionFlag PxSetGroupCollisionFlag PxGetGroup PxSetGroup +*/ +PxFilterFlags PxDefaultSimulationFilterShader( + PxFilterObjectAttributes attributes0, PxFilterData filterData0, + PxFilterObjectAttributes attributes1, PxFilterData filterData1, + PxPairFlags& pairFlags, + const void* constantBlock, PxU32 constantBlockSize); + +/** +\brief Determines if collision detection is performed between a pair of groups + +\note Collision group is an integer between 0 and 31. +\note PxGetGroupCollisionFlag(a, b) is the same as PxGetGroupCollisionFlag(b, a) + +\param[in] group1 First Group +\param[in] group2 Second Group + +\return True if the groups should collide + +\see PxSetGroupCollisionFlag +*/ +bool PxGetGroupCollisionFlag(const PxU16 group1, const PxU16 group2); + +/** +\brief Specifies if collision should be performed by a pair of groups + +\note Collision group is an integer between 0 and 31. +\note PxSetGroupCollisionFlag(a, b) is the same as PxSetGroupCollisionFlag(b, a) + +\param[in] group1 First Group +\param[in] group2 Second Group +\param[in] enable True to enable collision between the groups + +\see PxGetGroupCollisionFlag +*/ +void PxSetGroupCollisionFlag(const PxU16 group1, const PxU16 group2, const bool enable); + +/** +\brief Retrieves the value set with PxSetGroup() + +\note Collision group is an integer between 0 and 31. + +\param[in] actor The actor + +\return The collision group this actor belongs to + +\see PxSetGroup +*/ +PxU16 PxGetGroup(const PxActor& actor); + +/** +\brief Sets which collision group this actor is part of + +\note Collision group is an integer between 0 and 31. + +\param[in] actor The actor +\param[in] collisionGroup Collision group this actor belongs to + +\see PxGetGroup +*/ +void PxSetGroup(PxActor& actor, const PxU16 collisionGroup); + +/** +\brief Retrieves filtering operation. See comments for PxGroupsMask + +\param[out] op0 First filter operator. +\param[out] op1 Second filter operator. +\param[out] op2 Third filter operator. + +\see PxSetFilterOps PxSetFilterBool PxSetFilterConstants +*/ +void PxGetFilterOps(PxFilterOp::Enum& op0, PxFilterOp::Enum& op1, PxFilterOp::Enum& op2); + +/** +\brief Setups filtering operations. See comments for PxGroupsMask + +\param[in] op0 Filter op 0. +\param[in] op1 Filter op 1. +\param[in] op2 Filter op 2. + +\see PxSetFilterBool PxSetFilterConstants +*/ +void PxSetFilterOps(const PxFilterOp::Enum& op0, const PxFilterOp::Enum& op1, const PxFilterOp::Enum& op2); + +/** +\brief Retrieves filtering's boolean value. See comments for PxGroupsMask + +\return flag Boolean value for filter. + +\see PxSetFilterBool PxSetFilterConstants +*/ +bool PxGetFilterBool(); + +/** +\brief Setups filtering's boolean value. See comments for PxGroupsMask + +\param[in] enable Boolean value for filter. + +\see PxSetFilterOps PxSsetFilterConstants +*/ +void PxSetFilterBool(const bool enable); + +/** +\brief Gets filtering constant K0 and K1. See comments for PxGroupsMask + +\param[out] c0 the filtering constants, as a mask. See #PxGroupsMask. +\param[out] c1 the filtering constants, as a mask. See #PxGroupsMask. + +\see PxSetFilterOps PxSetFilterBool PxSetFilterConstants +*/ +void PxGetFilterConstants(PxGroupsMask& c0, PxGroupsMask& c1); + +/** +\brief Setups filtering's K0 and K1 value. See comments for PxGroupsMask + +\param[in] c0 The new group mask. See #PxGroupsMask. +\param[in] c1 The new group mask. See #PxGroupsMask. + +\see PxSetFilterOps PxSetFilterBool PxGetFilterConstants +*/ +void PxSetFilterConstants(const PxGroupsMask& c0, const PxGroupsMask& c1); + +/** +\brief Gets 64-bit mask used for collision filtering. See comments for PxGroupsMask + +\param[in] actor The actor + +\return The group mask for the actor. + +\see PxSetGroupsMask() +*/ +PxGroupsMask PxGetGroupsMask(const PxActor& actor); + +/** +\brief Sets 64-bit mask used for collision filtering. See comments for PxGroupsMask + +\param[in] actor The actor +\param[in] mask The group mask to set for the actor. + +\see PxGetGroupsMask() +*/ +void PxSetGroupsMask(PxActor& actor, const PxGroupsMask& mask); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxDefaultStreams.h b/engine/third_party/physx/include/extensions/PxDefaultStreams.h new file mode 100644 index 00000000..88ee4384 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxDefaultStreams.h @@ -0,0 +1,143 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_DEFAULT_STREAMS_H +#define PX_DEFAULT_STREAMS_H + +#include +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxIO.h" +#include "foundation/PxFoundation.h" + +typedef FILE* PxFileHandle; + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief default implementation of a memory write stream + +\see PxOutputStream +*/ + +class PxDefaultMemoryOutputStream: public PxOutputStream +{ +public: + PxDefaultMemoryOutputStream(PxAllocatorCallback &allocator = *PxGetAllocatorCallback()); + virtual ~PxDefaultMemoryOutputStream(); + + virtual PxU32 write(const void* src, PxU32 count); + + virtual PxU32 getSize() const { return mSize; } + virtual PxU8* getData() const { return mData; } + +private: + PxDefaultMemoryOutputStream(const PxDefaultMemoryOutputStream&); + PxDefaultMemoryOutputStream& operator=(const PxDefaultMemoryOutputStream&); + + PxAllocatorCallback& mAllocator; + PxU8* mData; + PxU32 mSize; + PxU32 mCapacity; +}; + +/** +\brief default implementation of a memory read stream + +\see PxInputData +*/ + +class PxDefaultMemoryInputData: public PxInputData +{ +public: + PxDefaultMemoryInputData(PxU8* data, PxU32 length); + + virtual PxU32 read(void* dest, PxU32 count); + virtual PxU32 getLength() const; + virtual void seek(PxU32 pos); + virtual PxU32 tell() const; + +private: + PxU32 mSize; + const PxU8* mData; + PxU32 mPos; +}; + + + +/** +\brief default implementation of a file write stream + +\see PxOutputStream +*/ + +class PxDefaultFileOutputStream: public PxOutputStream +{ +public: + PxDefaultFileOutputStream(const char* name); + virtual ~PxDefaultFileOutputStream(); + + virtual PxU32 write(const void* src, PxU32 count); + virtual bool isValid(); +private: + PxFileHandle mFile; +}; + + +/** +\brief default implementation of a file read stream + +\see PxInputData +*/ + +class PxDefaultFileInputData: public PxInputData +{ +public: + PxDefaultFileInputData(const char* name); + virtual ~PxDefaultFileInputData(); + + virtual PxU32 read(void* dest, PxU32 count); + virtual void seek(PxU32 pos); + virtual PxU32 tell() const; + virtual PxU32 getLength() const; + + bool isValid() const; +private: + PxFileHandle mFile; + PxU32 mLength; +}; + +#if !PX_DOXYGEN +} +#endif + + +#endif + diff --git a/engine/third_party/physx/include/extensions/PxDeformableSkinningExt.h b/engine/third_party/physx/include/extensions/PxDeformableSkinningExt.h new file mode 100644 index 00000000..7b268914 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxDeformableSkinningExt.h @@ -0,0 +1,99 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_EXT_H +#define PX_DEFORMABLE_SKINNING_EXT_H + +#include "PxDeformableSkinning.h" +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxCookingParams; +class PxSimpleTriangleMesh; +class PxInsertionCallback; + +/** +\brief Utility functions for deformable surface and volume skinning +*/ +class PxDeformableSkinningExt +{ +public: + + /** + \brief Initializes the interpolated vertices from guide vertices, normals, and triangles for deformable surface skinning + + This function calculates the skinning embedding information for a deformable surface mesh, + where each embedded vertex is interpolated based on the surrounding guide vertices and triangles. + + \param[out] embeddingInfo A pointer to a PxTriangleMeshEmbeddingInfo object that will store the calculated embedding information. Must be of length numEmbeddedVertices + \param[in] guideVertices A pointer to an array of guide vertices used for interpolation + \param[in] guideNormals A pointer to an array of guide normals corresponding to the guide vertices + \param[in] guideTriangles A pointer to an array of indices defining the guide triangles + \param[in] nbGuideTriangles The number of guide triangles + \param[in] embeddedVertices A pointer to an array of vertices that will be embedded and interpolated + \param[in] nbEmbeddedVertices The number of embedded vertices + + \see PxTriangleMeshEmbeddingInfo + */ + static void initializeInterpolatedVertices( + PxTriangleMeshEmbeddingInfo* embeddingInfo, + const PxVec3* guideVertices, const PxVec3* guideNormals, + const PxU32* guideTriangles, PxU32 nbGuideTriangles, const PxVec3* embeddedVertices, + PxU32 nbEmbeddedVertices); + + /** + \brief Initializes the interpolated vertices from guide vertices and tetrahedra for deformable volume skinning + + This function calculates the skinning embedding information for a deformable volume mesh, + where each embedded vertex is interpolated based on the surrounding guide vertices and tetrahedra. + + \param[out] embeddingInfo A pointer to a PxTetrahedronMeshEmbeddingInfo object that will store the calculated embedding information. Must be of length numEmbeddedVertices + \param[in] guideVertices A pointer to an array of guide vertices used for interpolation + \param[in] guideTetrahedra A pointer to an array of indices defining the guide tetrahedra + \param[in] nbGuideTetrahedra The number of guide tetrahedra + \param[in] embeddedVertices A pointer to an array of vertices that will be embedded and interpolated + \param[in] nbEmbeddedVertices The number of embedded vertices + + \see PxTetrahedronMeshEmbeddingInfo + */ + static void initializeInterpolatedVertices( + PxTetrahedronMeshEmbeddingInfo* embeddingInfo, + const PxVec3* guideVertices, + const PxU32* guideTetrahedra, PxU32 nbGuideTetrahedra, const PxVec3* embeddedVertices, + PxU32 nbEmbeddedVertices); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif // PX_DEFORMABLE_SKINNING_EXT_H diff --git a/engine/third_party/physx/include/extensions/PxDeformableSurfaceExt.h b/engine/third_party/physx/include/extensions/PxDeformableSurfaceExt.h new file mode 100644 index 00000000..64f47dd1 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxDeformableSurfaceExt.h @@ -0,0 +1,177 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_EXT_H +#define PX_DEFORMABLE_SURFACE_EXT_H + +#include "PxDeformableSurface.h" +#include "foundation/PxVec4.h" +#include "foundation/PxTransform.h" +#include "foundation/PxUserAllocated.h" +#include "cudamanager/PxCudaContextManager.h" +#include "cudamanager/PxCudaTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Utility functions for use with PxDeformableSurface +*/ +class PxDeformableSurfaceExt +{ +public: + /** + \brief Uploads prepared deformable surface data to the GPU. + + \param[in] deformableSurface The deformable surface to perform the data upload to. + \param[in] flags Specifies which buffers the data transfer should include. + \param[in] nbVertices The number of vertices in the surface deformable mesh. + \param[in] positionsPinned A pointer to a pinned host memory buffer containing position and inverse mass for each vertex. + \param[in] velocitiesPinned A pointer to a pinned host memory buffer containing the velocity for each vertex. + \param[in] restPositionsPinned A pointer to a pinned host memory buffer containing the rest position for each vertex. + \param[in] copyStream An optional cuda stream to schedule the copy on. + + \see PxDeformableSurface + */ + static void copyToDevice(PxDeformableSurface& deformableSurface, PxDeformableSurfaceDataFlags flags, PxU32 nbVertices, + PxVec4* positionsPinned, PxVec4* velocitiesPinned, PxVec4* restPositionsPinned, + CUstream copyStream = CUstream(0)); + + /** + \brief Distributes a list of triangles masses to vertices. + + The mass for each triangle will be distributed in equal parts to the vertices of said triangle. + + \param[in] deformableSurface The deformable surface to perform the operation on. + \param[in] triangleMasses A list of floats specifying the mass of each triangle. + \param[in] positionInvMassPinned A pointer to a pinned host memory buffer containing positions and inverse masses for each vertex. + + \see PxDeformableSurface + */ + static void distributeTriangleMassToVertices(PxDeformableSurface& deformableSurface, const PxReal* triangleMasses, + PxVec4* positionInvMassPinned); + + /** + \brief Distributes a uniform density to the vertices of a deformable surface. + + This method distributes mass based on a specified mass per unit area. The mass for each vertex is calculated + according to the area of the triangles connected to it, and the resulting mass is assigned to the vertex. + + \param[in] deformableSurface The deformable surface to perform the operation on. + \param[in] massPerVolume The mass per unit volume (=density) to be distributed across the vertices. + \param[in] clothThickness The cloth thickness to compute the mass + \param[in] positionInvMassPinned A pointer to a pinned host memory buffer containing positions and inverse masses for each vertex. + + \see PxDeformableSurface + */ + static void distributeDensityToVertices(PxDeformableSurface& deformableSurface, PxReal massPerVolume, PxReal clothThickness, + PxVec4* positionInvMassPinned); + + /** + \brief Distributes a total mass uniformly to the vertices of a deformable surface. + + This method calculates the total mass to be distributed across all vertices, and assigns a proportional mass to each + vertex based on the geometry of the surface. The mass is distributed equally to ensure the total mass of the surface + matches the specified value. + + \param[in] deformableSurface The deformable surface to perform the operation on. + \param[in] totalMass The total mass to be distributed across the vertices. + \param[in] positionInvMassPinned A pointer to a pinned host memory buffer containing positions and inverse masses for each vertex. + + \see PxDeformableSurface + */ + static void distributeMassToVertices(PxDeformableSurface& deformableSurface, PxReal totalMass, + PxVec4* positionInvMassPinned); + + /** + \brief Allocates and initializes a pinned host memory from a PxTriangleMesh attached to a PxDeformableSurface using a PxShape. + + \note The user is responsible for deallocation and lifetime management of the positionInvMassPinned, velocityPinned + and restPositionsPinned buffers. + + This method fails if the deformable surface does not have a shape attached to it. + + \param[in] deformableSurface The deformable surface to perform the operation on. + \param[in] positions The initial positions of the surface deformable vertices. + \param[in] velocities The initial velocities of the surface deformable vertices. + \param[in] restPositions The rest positions of the surface deformable vertices. + \param[in] mass The mass of the deformable surface, will be distributed equally among vertices. + \param[in] transform The world-space transform of the deformable surface. + \param[in] cudaContextManager The PxCudaContextManager of the scene this deformable surface will be simulated in. + \param[in] positionInvMassPinned A reference to a pointer for the return value of the positionInvMassPinned buffer, will be set by this function. + \param[in] velocityPinned A reference to a pointer for the return value of the velocityPinned buffer, will be set by this function. + \param[in] restPositionPinned A reference to a pointer for the return value of the restPositionPinned buffer, will be set by this function. + + \return The number of vertices in the surface deformable mesh. + + \see PxDeformableSurface + */ + static PxU32 allocateAndInitializeHostMirror(PxDeformableSurface& deformableSurface, const PxVec3* positions, + const PxVec3* velocities, const PxVec3* restPositions, float mass, + const PxTransform& transform, PxCudaContextManager* cudaContextManager, + PxVec4*& positionInvMassPinned, PxVec4*& velocityPinned, + PxVec4*& restPositionPinned); + + /** + \brief Allocates and initializes a pinned host memory from given positions, velocities, and rest positions. + + \note The user is responsible for deallocation and lifetime management of the positionInvMassPinned, velocityPinned + and restPositionsPinned buffers. + + If the input 'restPositions' is a null pointer, positions are used in place of restPositions. + If the input 'velocities' is a null pointer, zero velocities are assigned to velocityPinned. + + \param[in] positions The positions of the surface deformable vertices, will be used to assign positionInvMassPinned buffer. + \param[in] velocities The velocities of the surface deformable vertices, will be used to assign velocityPinned buffer. + \param[in] restPositions The rest positions of the surface deformable vertices, will be used to assign restPositionPinned buffer. + \param[in] nbVertices The number of vertices in the surface deformable mesh. + \param[in] mass The mass of the deformable surface, will be distributed equally among vertices. + \param[in] transform The world-space transform of the deformable surface. + \param[in] cudaContextManager The PxCudaContextManager of the scene this deformable surface will be simulated in. + \param[in] positionInvMassPinned A reference to a pointer for the return value of the positionInvMassPinned buffer, will be set by this function. + \param[in] velocityPinned A reference to a pointer for the return value of the velocityPinned buffer, will be set by this function. + \param[in] restPositionPinned A reference to a pointer for the return value of the restPositionPinned buffer, will be set by this function. + + \return The number of vertices in the surface deformable mesh. + + \see PxDeformableSurface + */ + static PxU32 allocateAndInitializeHostMirror(const PxVec3* positions, const PxVec3* velocities, + const PxVec3* restPositions, PxU32 nbVertices, float mass, + const PxTransform& transform, PxCudaContextManager* cudaContextManager, + PxVec4*& positionInvMassPinned, PxVec4*& velocityPinned, + PxVec4*& restPositionPinned); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif // PX_DEFORMABLE_SURFACE_EXT_H diff --git a/engine/third_party/physx/include/extensions/PxDeformableVolumeExt.h b/engine/third_party/physx/include/extensions/PxDeformableVolumeExt.h new file mode 100644 index 00000000..9f6c250f --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxDeformableVolumeExt.h @@ -0,0 +1,297 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_EXT_H +#define PX_DEFORMABLE_VOLUME_EXT_H + +#include "foundation/PxTransform.h" +#include "foundation/PxUserAllocated.h" +#include "PxDeformableVolume.h" +#include "PxDeformableVolumeFlag.h" +#include "cudamanager/PxCudaContextManager.h" +#include "cudamanager/PxCudaTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxCookingParams; +class PxSimpleTriangleMesh; +class PxInsertionCallback; +class PxDeformableVolumeMesh; + +/** +\brief Utility functions for use with PxDeformableVolume and subclasses +*/ +class PxDeformableVolumeExt +{ +public: + /** + \brief Computes the deformable volume's vertex masses from the provided density and the volume of the tetrahedra + + The buffers affected by this operation can be obtained from the deformable volume using the methods getSimPositionInvMassBufferD() and getSimVelocityBufferD() + + The inverse mass is stored in the 4th component (the first three components are x, y, z coordinates) of the simulation mesh's position buffer. + + \param[in] deformableVolume The deformable volume which will get its mass updated + \param[in] density The density to used to calculate the mass from the body's volume + \param[in] maxInvMassRatio Maximum allowed ratio defined as max(vertexMasses) / min(vertexMasses) where vertexMasses is a list of float values with a mass for every vertex in the simulation mesh + \param[in] simPositionsPinned A pointer to a pinned host memory buffer containing positions and inverse masses for each vertex of the simulation mesh. + + \see PxDeformableVolume PxDeformableVolume::getSimPositionInvMassBufferD() + */ + static void updateMass(PxDeformableVolume& deformableVolume, const PxReal density, const PxReal maxInvMassRatio, PxVec4* simPositionsPinned); + + /** + \brief Computes the deformable volume's vertex masses such that the sum of all masses is equal to the provided mass + + The buffers affected by this operation can be obtained from the deformable volume using the methods getSimPositionInvMassBufferD()) and getSimVelocityBufferD() + + The inverse mass is stored in the 4th component (the first three components are x, y, z coordinates) of the simulation mesh's position buffer. + + \param[in] deformableVolume The deformable volume which will get its mass updated + \param[in] mass The deformable volume's mass + \param[in] maxInvMassRatio Maximum allowed ratio defined as max(vertexMasses) / min(vertexMasses) where vertexMasses is a list of float values with a mass for every vertex in the simulation mesh + \param[in] simPositionsPinned A pointer to a pinned host memory buffer containing positions and inverse masses for each vertex of the simulation mesh. + + \see PxDeformableVolume PxDeformableVolume::getSimPositionInvMassBufferD() + */ + static void setMass(PxDeformableVolume& deformableVolume, const PxReal mass, const PxReal maxInvMassRatio, PxVec4* simPositionsPinned); + + /** + \brief Transforms a deformable volume + + The buffers affected by this operation can be obtained from the deformable volume using the methods getSimPositionInvMassBufferD() and getSimVelocityBufferD() + + Applies a transformation to the simulation mesh's positions an velocities. Velocities only get rotated and scaled (translation is not applicable to direction vectors). + It does not modify the body's mass. + If the method is called multiple times, the transformation will compound with the ones previously applied. + + \param[in] deformableVolume The deformable volume which is transformed + \param[in] transform The transform to apply + \param[in] scale A scaling factor + \param[in] simPositionsPinned A pointer to a pinned host memory buffer containing positions and inverse masses for each vertex of the simulation mesh. + \param[in] simVelocitiesPinned A pointer to a pinned host memory buffer containing velocities for each vertex of the simulation mesh. + \param[in] collPositionsPinned A pointer to a pinned host memory buffer containing positions and inverse masses for each vertex of the collision mesh. + \param[in] restPositionsPinned A pointer to a pinned host memory buffer containing rest positions of the collision mesh. + + \see PxDeformableVolume + */ + static void transform(PxDeformableVolume& deformableVolume, const PxTransform& transform, const PxReal scale, PxVec4* simPositionsPinned, PxVec4* simVelocitiesPinned, PxVec4* collPositionsPinned, PxVec4* restPositionsPinned); + + /** + \brief Updates the collision mesh's vertex positions to match the simulation mesh's transformation and scale. + + The buffer affected by this operation can be obtained from the deformable volume using the method getPositionInvMassBufferD() + + \param[in] deformableVolume The deformable volume which will get its collision mesh vertices updated + \param[in] simPositionsPinned A pointer to a pinned host memory buffer containing positions and inverse masses for each vertex of the simulation mesh. + \param[in] collPositionsPinned A pointer to a pinned host memory buffer containing positions and inverse masses for each vertex of the collision mesh. + + \see PxDeformableVolume + */ + static void updateEmbeddedCollisionMesh(PxDeformableVolume& deformableVolume, PxVec4* simPositionsPinned, PxVec4* collPositionsPinned); + + /** + \brief Uploads prepared deformable volume data to the GPU. It ensures that the embedded collision mesh matches the simulation mesh's transformation and scale. + + \param[in] deformableVolume The deformable volume which will perform the data upload + \param[in] flags Specifies which buffers the data transfer should include + \param[in] simPositionsPinned A pointer to a pinned host memory buffer containing positions and inverse masses for each vertex of the simulation mesh. + \param[in] simVelocitiesPinned A pointer to a pinned host memory buffer containing velocities for each vertex of the simulation mesh. + \param[in] collPositionsPinned A pointer to a pinned host memory buffer containing positions and inverse masses for each vertex of the collision mesh. + \param[in] restPositionsPinned A pointer to a pinned host memory buffer containing rest positions of the collision mesh. + \param[in] stream A cuda stream to perform the copies. + + \see PxDeformableVolume + */ + static void copyToDevice(PxDeformableVolume& deformableVolume, PxDeformableVolumeDataFlags flags, PxVec4* simPositionsPinned, PxVec4* simVelocitiesPinned, PxVec4* collPositionsPinned, PxVec4* restPositionsPinned, CUstream stream = CUstream(0)); + + /** + \brief Creates a full deformable volume mesh matching the shape given as input. Uses a voxel mesh for FEM simulation and a surface-matching mesh for collision detection. + + \param[in] params Cooking params instance required for mesh processing + \param[in] surfaceMesh Input triangle mesh that represents the surface of the deformable volume + \param[in] numVoxelsAlongLongestAABBAxis The number of voxels along the longest bounding box axis + \param[in] insertionCallback The insertion interface from PxPhysics + \param[in] validate If set to true the input triangle mesh will get analyzed to find possible deficiencies + \return Deformable volume mesh if cooking was successful, NULL otherwise + \see PxDeformableVolumeMesh + */ + static PxDeformableVolumeMesh* createDeformableVolumeMesh(const PxCookingParams& params, const PxSimpleTriangleMesh& surfaceMesh, PxU32 numVoxelsAlongLongestAABBAxis, PxInsertionCallback& insertionCallback, const bool validate = true); + + /** + \brief Deprecated + \see createDeformableVolumeMesh + */ + PX_DEPRECATED static PX_FORCE_INLINE PxDeformableVolumeMesh* createSoftBodyMesh(const PxCookingParams& params, const PxSimpleTriangleMesh& surfaceMesh, PxU32 numVoxelsAlongLongestAABBAxis, PxInsertionCallback& insertionCallback, const bool validate = true) + { + return createDeformableVolumeMesh(params, surfaceMesh, numVoxelsAlongLongestAABBAxis, insertionCallback, validate); + } + + /** + \brief Creates a full deformable volume mesh matching the shape given as input. Uses the same surface-matching mesh for collision detection and FEM simulation. + + \param[in] params Cooking params instance required for mesh processing + \param[in] surfaceMesh Input triangle mesh that represents the surface of the deformable volume + \param[in] insertionCallback The insertion interface from PxPhysics + \param[in] maxWeightRatioInTet Upper limit for the ratio of node weights that are adjacent to the same tetrahedron. The closer to one (while remaining larger than one), the more stable the simulation. + \param[in] validate If set to true the input triangle mesh will get analyzed to find possible deficiencies + \return Deformable volume mesh if cooking was successful, NULL otherwise + \see PxDeformableVolumeMesh + */ + static PxDeformableVolumeMesh* createDeformableVolumeMeshNoVoxels(const PxCookingParams& params, const PxSimpleTriangleMesh& surfaceMesh, + PxInsertionCallback& insertionCallback, PxReal maxWeightRatioInTet = 1.5f, const bool validate = true); + + /** + \brief Deprecated + \see createDeformableVolumeMeshNoVoxels + */ + PX_DEPRECATED static PX_FORCE_INLINE PxDeformableVolumeMesh* createSoftBodyMeshNoVoxels(const PxCookingParams& params, const PxSimpleTriangleMesh& surfaceMesh, + PxInsertionCallback& insertionCallback, PxReal maxWeightRatioInTet = 1.5f, const bool validate = true) + { + return createDeformableVolumeMeshNoVoxels(params, surfaceMesh, insertionCallback, maxWeightRatioInTet, validate); + } + + /** + \brief Creates a deformable volume instance from a deformable volume mesh + + \param[in] deformableVolumeMesh The deformable volume mesh + \param[in] transform The transform that defines initial position and orientation of the deformable volume + \param[in] material The material + \param[in] cudaContextManager A cuda context manager + \param[in] density The density used to compute the mass properties + \param[in] scale The scaling of the deformable volume + \return Deformable volume instance + \see PxDeformableVolumeMesh, PxDeformableVolume + */ + static PxDeformableVolume* createDeformableVolumeFromMesh(PxDeformableVolumeMesh* deformableVolumeMesh, const PxTransform& transform, + const PxDeformableVolumeMaterial& material, PxCudaContextManager& cudaContextManager, PxReal density = 100.0f, PxReal scale = 1.0f); + + /** + \brief Deprecated + \see createDeformableVolumeFromMesh + */ + PX_DEPRECATED static PX_FORCE_INLINE PxDeformableVolume* createSoftBodyFromMesh(PxDeformableVolumeMesh* deformableVolumeMesh, const PxTransform& transform, + const PxDeformableVolumeMaterial& material, PxCudaContextManager& cudaContextManager, PxReal density = 100.0f, PxU32 solverIterationCount = 30, + const PxFEMParameters& femParams = PxFEMParameters(), PxReal scale = 1.0f) + { + PxDeformableVolume* deformableVolume = createDeformableVolumeFromMesh(deformableVolumeMesh, transform, material, + cudaContextManager, density, scale); + deformableVolume->setParameter(femParams); + deformableVolume->setSolverIterationCounts(solverIterationCount); + return deformableVolume; + } + + /** + \brief Creates a deformable volume instance with a box shape + + \param[in] transform The transform that defines initial position and orientation of the deformable volume + \param[in] boxDimensions The dimensions (side lengths) of the box shape + \param[in] material The material + \param[in] cudaContextManager A cuda context manager + \param[in] maxEdgeLength The maximal length of a triangle edge. Subdivision will get applied until the edge length criteria is matched. -1 means no subdivision is applied. + \param[in] density The density used to compute the mass properties + \param[in] numVoxelsAlongLongestAABBAxis The number of voxels to use for the simulation mesh along the longest bounding box dimension + \param[in] scale The scaling of the deformable volume + \return Deformable volume instance + \see PxDeformableVolumeMesh, PxDeformableVolume + */ + static PxDeformableVolume* createDeformableVolumeBox(const PxTransform& transform, const PxVec3& boxDimensions, const PxDeformableVolumeMaterial& material, + PxCudaContextManager& cudaContextManager, PxReal maxEdgeLength = -1.0f, PxReal density = 100.0f, PxU32 numVoxelsAlongLongestAABBAxis = 10, PxReal scale = 1.0f); + + /** + \brief Deprecated + \see createDeformableVolumeBox + */ + PX_DEPRECATED static PX_FORCE_INLINE PxDeformableVolume* createSoftBodyBox(const PxTransform& transform, const PxVec3& boxDimensions, const PxDeformableVolumeMaterial& material, + PxCudaContextManager& cudaContextManager, PxReal maxEdgeLength = -1.0f, PxReal density = 100.0f, PxU32 solverIterationCount = 30, + const PxFEMParameters& femParams = PxFEMParameters(), PxU32 numVoxelsAlongLongestAABBAxis = 10, PxReal scale = 1.0f) + { + PxDeformableVolume* deformableVolume = createDeformableVolumeBox(transform, boxDimensions, material, cudaContextManager, maxEdgeLength, density, + numVoxelsAlongLongestAABBAxis, scale); + deformableVolume->setParameter(femParams); + deformableVolume->setSolverIterationCounts(solverIterationCount); + return deformableVolume; + } + + /** + \brief allocates and initializes pinned host memory buffers from an actor with shape. + + \param[in] deformableVolume A PxDeformableVolume that has a valid shape attached to it. + \param[in] cudaContextManager The PxCudaContextManager of the scene this deformable volume will be simulated in + \param[in] simPositionInvMassPinned A reference to a pointer for the return value of the simPositionInvMassPinned buffer, will be set by this function. + \param[in] simVelocityPinned A reference to a pointer for the return value of the simVelocityPinned buffer, will be set by this function. + \param[in] collPositionInvMassPinned A reference to a pointer for the return value of the collPositionInvMassPinned buffer, will be set by this function. + \param[in] restPositionPinned A reference to a pointer for the return value of the restPositionPinned buffer, will be set by this function. + + \see PxDeformableVolume + */ + static void allocateAndInitializeHostMirror(PxDeformableVolume& deformableVolume, PxCudaContextManager* cudaContextManager, PxVec4*& simPositionInvMassPinned, PxVec4*& simVelocityPinned, PxVec4*& collPositionInvMassPinned, PxVec4*& restPositionPinned); + + /** + \brief Given a set of points and a set of tetrahedra, it finds the equilibrium state of the deformable volume. Every input point is either fixed or can move freely. + + \param[in] verticesOriginal Mesh vertex positions in undeformed original state. + \param[in] verticesDeformed Mesh vertex positions in new deformed state. Only fixed vertices must have their final location, all other locations will get updated by the method. + \param[in] nbVertices The number of vertices. + \param[in] tetrahedra The tetrahedra. + \param[in] nbTetraheda The number of tetrahedra. + \param[in] vertexIsFixed Optional input that specifies which vertex is fixed and which one can move to relax the tension. If not provided, vertices from verticesOriginal which have a .w value of 0 will be considered fixed. + \param[in] numIterations The number of stress relaxation iterations to run. + */ + static void relaxDeformableVolumeMesh(const PxVec4* verticesOriginal, PxVec4* verticesDeformed, PxU32 nbVertices, + const PxU32* tetrahedra, PxU32 nbTetraheda, const bool* vertexIsFixed = NULL, PxU32 numIterations = 200); + + /** + \brief Deprecated + \see relaxDeformableVolumeMesh + */ + PX_DEPRECATED static PX_FORCE_INLINE void relaxSoftBodyMesh(const PxVec4* verticesOriginal, PxVec4* verticesDeformed, PxU32 nbVertices, const PxU32* tetrahedra, PxU32 nbTetraheda, const bool* vertexIsFixed = NULL, PxU32 numIterations = 200) + { + relaxDeformableVolumeMesh(verticesOriginal, verticesDeformed, nbVertices, tetrahedra, nbTetraheda, vertexIsFixed, numIterations); + } + + /** + \brief Converts the tet id and barycentric from the collision mesh to the tet id and barycentric of the simulation mesh. + + \param[in] deformableVolume The deformable volume to perform the operation on. + \param[in] tetId The tet id of the deformable volume's collision mesh. + \param[in] tetBarycentric The barycentric coordinates of the tetrahedron specified with tetId. + \param[out] outTetId The tet id of the deformable volume's simulation mesh. + \param[out] outTetBarycentric The barycentric coordinates of the tetrahedron specified with outTetId. + */ + static void convertCollisionToSimulationTet(PxDeformableVolume& deformableVolume, PxU32 tetId, const PxVec4& tetBarycentric, PxU32& outTetId, PxVec4& outTetBarycentric); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif // PX_DEFORMABLE_VOLUME_EXT_H diff --git a/engine/third_party/physx/include/extensions/PxDistanceJoint.h b/engine/third_party/physx/include/extensions/PxDistanceJoint.h new file mode 100644 index 00000000..6fc6025b --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxDistanceJoint.h @@ -0,0 +1,264 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_DISTANCE_JOINT_H +#define PX_DISTANCE_JOINT_H + +#include "extensions/PxJoint.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxDistanceJoint; + +/** +\brief Create a distance Joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + +\see PxDistanceJoint +*/ +PxDistanceJoint* PxDistanceJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + + +/** +\brief flags for configuring the drive of a PxDistanceJoint + +\see PxDistanceJoint +*/ +struct PxDistanceJointFlag +{ + enum Enum + { + eMAX_DISTANCE_ENABLED = 1<<1, + eMIN_DISTANCE_ENABLED = 1<<2, + eSPRING_ENABLED = 1<<3 + }; +}; + +typedef PxFlags PxDistanceJointFlags; +PX_FLAGS_OPERATORS(PxDistanceJointFlag::Enum, PxU16) + +/** +\brief a joint that maintains an upper or lower bound (or both) on the distance between two points on different objects + +\see PxDistanceJointCreate PxJoint +*/ +class PxDistanceJoint : public PxJoint +{ +public: + + /** + \brief Return the current distance of the joint + */ + virtual PxReal getDistance() const = 0; + + /** + \brief Set the allowed minimum distance for the joint. + + The minimum distance must be no more than the maximum distance + + Default 0.0f + Range [0, PX_MAX_F32) + + \param[in] distance the minimum distance + + \see PxDistanceJoint::minDistance, PxDistanceJointFlag::eMIN_DISTANCE_ENABLED getMinDistance() + */ + virtual void setMinDistance(PxReal distance) = 0; + + /** + \brief Get the allowed minimum distance for the joint. + + \return the allowed minimum distance + + \see PxDistanceJoint::minDistance, PxDistanceJointFlag::eMIN_DISTANCE_ENABLED setMinDistance() + */ + virtual PxReal getMinDistance() const = 0; + + /** + \brief Set the allowed maximum distance for the joint. + + The maximum distance must be no less than the minimum distance. + + Default 0.0f + Range [0, PX_MAX_F32) + + \param[in] distance the maximum distance + + \see PxDistanceJoint::maxDistance, PxDistanceJointFlag::eMAX_DISTANCE_ENABLED getMinDistance() + */ + virtual void setMaxDistance(PxReal distance) = 0; + + /** + \brief Get the allowed maximum distance for the joint. + + \return the allowed maximum distance + + \see PxDistanceJoint::maxDistance, PxDistanceJointFlag::eMAX_DISTANCE_ENABLED setMaxDistance() + */ + virtual PxReal getMaxDistance() const = 0; + + /** + \brief Set the error tolerance of the joint. + + \param[in] tolerance the distance beyond the allowed range at which the joint becomes active + + \see PxDistanceJoint::tolerance, getTolerance() + */ + virtual void setTolerance(PxReal tolerance) = 0; + + /** + \brief Get the error tolerance of the joint. + + the distance beyond the joint's [min, max] range before the joint becomes active. + + Default 0.25f * PxTolerancesScale::length + Range (0, PX_MAX_F32) + + This value should be used to ensure that if the minimum distance is zero and the + spring function is in use, the rest length of the spring is non-zero. + + \see PxDistanceJoint::tolerance, setTolerance() + */ + virtual PxReal getTolerance() const = 0; + + /** + \brief Set the strength of the joint spring. + + The spring is used if enabled, and the distance exceeds the range [min-error, max+error]. + + Default 0.0f + Range [0, PX_MAX_F32) + + \param[in] stiffness the spring strength of the joint + + \see PxDistanceJointFlag::eSPRING_ENABLED getStiffness() + */ + virtual void setStiffness(PxReal stiffness) = 0; + + /** + \brief Get the strength of the joint spring. + + \return stiffness the spring strength of the joint + + \see PxDistanceJointFlag::eSPRING_ENABLED setStiffness() + */ + virtual PxReal getStiffness() const = 0; + + /** + \brief Set the damping of the joint spring. + + The spring is used if enabled, and the distance exceeds the range [min-error, max+error]. + + Default 0.0f + Range [0, PX_MAX_F32) + + \param[in] damping the degree of damping of the joint spring of the joint + + \see PxDistanceJointFlag::eSPRING_ENABLED setDamping() + */ + virtual void setDamping(PxReal damping) = 0; + + /** + \brief Get the damping of the joint spring. + + \return the degree of damping of the joint spring of the joint + + \see PxDistanceJointFlag::eSPRING_ENABLED setDamping() + */ + virtual PxReal getDamping() const = 0; + + /** + \brief Set the flags specific to the Distance Joint. + + Default PxDistanceJointFlag::eMAX_DISTANCE_ENABLED + + \param[in] flags The joint flags. + + \see PxDistanceJointFlag setFlag() getFlags() + */ + virtual void setDistanceJointFlags(PxDistanceJointFlags flags) = 0; + + /** + \brief Set a single flag specific to a Distance Joint to true or false. + + \param[in] flag The flag to set or clear. + \param[in] value the value to which to set the flag + + \see PxDistanceJointFlag, getFlags() setFlags() + */ + virtual void setDistanceJointFlag(PxDistanceJointFlag::Enum flag, bool value) = 0; + + /** + \brief Get the flags specific to the Distance Joint. + + \return the joint flags + + \see PxDistanceJoint::flags, PxDistanceJointFlag setFlag() setFlags() + */ + virtual PxDistanceJointFlags getDistanceJointFlags() const = 0; + + /** + \brief Returns string name of PxDistanceJoint, used for serialization + */ + virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxDistanceJoint"; } + +protected: + + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxDistanceJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxDistanceJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxDistanceJoint", PxJoint); } + + //~serialization +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxExtensionsAPI.h b/engine/third_party/physx/include/extensions/PxExtensionsAPI.h new file mode 100644 index 00000000..99a2a2af --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxExtensionsAPI.h @@ -0,0 +1,89 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_EXTENSIONS_API_H +#define PX_EXTENSIONS_API_H + +#include "foundation/PxErrorCallback.h" +#include "extensions/PxDefaultAllocator.h" +#include "extensions/PxConstraintExt.h" +#include "extensions/PxDistanceJoint.h" +#include "extensions/PxFixedJoint.h" +#include "extensions/PxPrismaticJoint.h" +#include "extensions/PxRevoluteJoint.h" +#include "extensions/PxSphericalJoint.h" +#include "extensions/PxD6Joint.h" +#include "extensions/PxGearJoint.h" +#include "extensions/PxRackAndPinionJoint.h" +#include "extensions/PxDefaultSimulationFilterShader.h" +#include "extensions/PxDefaultErrorCallback.h" +#include "extensions/PxDefaultStreams.h" +#include "extensions/PxRigidActorExt.h" +#include "extensions/PxRigidBodyExt.h" +#include "extensions/PxShapeExt.h" +#include "extensions/PxTriangleMeshExt.h" +#include "extensions/PxSerialization.h" +#include "extensions/PxDefaultCpuDispatcher.h" +#include "extensions/PxSmoothNormals.h" +#include "extensions/PxSimpleFactory.h" +#include "extensions/PxStringTableExt.h" +#include "extensions/PxBroadPhaseExt.h" +#include "extensions/PxMassProperties.h" +#include "extensions/PxSceneQueryExt.h" +#include "extensions/PxSceneQuerySystemExt.h" +#include "extensions/PxCustomSceneQuerySystem.h" +#include "extensions/PxConvexMeshExt.h" +#include "extensions/PxSamplingExt.h" +#include "extensions/PxTetrahedronMeshExt.h" +#include "extensions/PxCustomGeometryExt.h" +#include "extensions/PxDeformableSurfaceExt.h" + +/** \brief Initialize the PhysXExtensions library. + +This should be called before calling any functions or methods in extensions which may require allocation. +\note This function does not need to be called before creating a PxDefaultAllocator object. + +\param physics a PxPhysics object +\param pvd an PxPvd (PhysX Visual Debugger) object + +\see PxCloseExtensions PxFoundation PxPhysics +*/ +PX_C_EXPORT bool PX_CALL_CONV PxInitExtensions(physx::PxPhysics& physics, physx::PxPvd* pvd); + +/** \brief Shut down the PhysXExtensions library. + +This function should be called to cleanly shut down the PhysXExtensions library before application exit. + +\note This function is required to be called to release foundation usage. + +\see PxInitExtensions +*/ +PX_C_EXPORT void PX_CALL_CONV PxCloseExtensions(); + +#endif + diff --git a/engine/third_party/physx/include/extensions/PxFixedJoint.h b/engine/third_party/physx/include/extensions/PxFixedJoint.h new file mode 100644 index 00000000..44de1b48 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxFixedJoint.h @@ -0,0 +1,96 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_FIXED_JOINT_H +#define PX_FIXED_JOINT_H + +#include "extensions/PxJoint.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxFixedJoint; + +/** +\brief Create a fixed joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + +\see PxFixedJoint +*/ +PxFixedJoint* PxFixedJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + +/** + \brief A fixed joint permits no relative movement between two bodies. ie the bodies are glued together. + + \image html fixedJoint.png + + \see PxFixedJointCreate() PxJoint +*/ +class PxFixedJoint : public PxJoint +{ +public: + + /** + \brief Returns string name of PxFixedJoint, used for serialization + */ + virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxFixedJoint"; } + +protected: + + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxFixedJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxFixedJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxFixedJoint", PxJoint); } + + //~serialization +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxGearJoint.h b/engine/third_party/physx/include/extensions/PxGearJoint.h new file mode 100644 index 00000000..f89230e5 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxGearJoint.h @@ -0,0 +1,125 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_GEAR_JOINT_H +#define PX_GEAR_JOINT_H + +#include "extensions/PxJoint.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxGearJoint; + + /** + \brief Create a gear Joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + + \see PxGearJoint + */ + PxGearJoint* PxGearJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + + /** + \brief A joint that connects two existing revolute joints and constrains their relative angular velocity with respect to each other. + + \see PxGearJointCreate PxJoint + */ + class PxGearJoint : public PxJoint + { + public: + + /** + \brief Set the hinge/revolute joints connected by the gear joint. + + The passed joints can be either PxRevoluteJoint, PxD6Joint or PxArticulationJointReducedCoordinate. + The joints must define degrees of freedom around the twist axis. + + Note that these joints are only used to compute the positional error correction term, + used to adjust potential drift between jointed actors. The gear joint can run without + calling this function, but in that case some visible overlap may develop over time between + the teeth of the gear meshes. + + \note Calling this function resets the internal positional error correction term. + + \param[in] hinge0 The first hinge joint + \param[in] hinge1 The second hinge joint + \return true if success + */ + virtual bool setHinges(const PxBase* hinge0, const PxBase* hinge1) = 0; + + /** + \brief Get the hinge/revolute joints connected by the gear joint. + + \param[out] hinge0 The first hinge joint + \param[out] hinge1 The second hinge joint + */ + virtual void getHinges(const PxBase*& hinge0, const PxBase*& hinge1) const = 0; + + /** + \brief Set the desired gear ratio. + + For two gears with n0 and n1 teeth respectively, the gear ratio is n0/n1. + + \note You may need to use a negative gear ratio if the joint frames of involved actors are not oriented in the same direction. + + \note Calling this function resets the internal positional error correction term. + + \param[in] ratio Desired ratio between the two hinges. + */ + virtual void setGearRatio(float ratio) = 0; + + /** + \brief Get the gear ratio. + + \return Current ratio + */ + virtual float getGearRatio() const = 0; + + virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxGearJoint"; } + + protected: + + PX_INLINE PxGearJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + PX_INLINE PxGearJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxGearJoint", PxJoint); } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxGjkQueryExt.h b/engine/third_party/physx/include/extensions/PxGjkQueryExt.h new file mode 100644 index 00000000..bdbca1bb --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxGjkQueryExt.h @@ -0,0 +1,234 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_GJK_QUERY_EXT_H +#define PX_GJK_QUERY_EXT_H + +#include "geometry/PxGjkQuery.h" +#include "geometry/PxGeometry.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxSphereGeometry; +class PxCapsuleGeometry; +class PxBoxGeometry; +class PxConvexCoreGeometry; +class PxConvexMeshGeometry; +class PxContactBuffer; +class PxConvexMesh; + +/** +\brief Pre-made support mapping for built-in convex geometry types. +*/ +class PxGjkQueryExt +{ +public: + /** + \brief Pre-made support mapping for a sphere + */ + struct SphereSupport : PxGjkQuery::Support + { + PxReal radius; + + /** + \brief Default constructor + */ + SphereSupport(); + /** + \brief Constructs a SphereSupport for a sphere radius + */ + SphereSupport(PxReal radius); + /** + \brief Constructs a SphereSupport for a PxSphereGeometry + */ + SphereSupport(const PxSphereGeometry& geom); + + virtual PxReal getMargin() const PX_OVERRIDE PX_FINAL; + virtual PxVec3 supportLocal(const PxVec3& dir) const PX_OVERRIDE PX_FINAL; + }; + + /** + \brief Pre-made support mapping for a capsule + */ + struct CapsuleSupport : PxGjkQuery::Support + { + PxReal radius, halfHeight; + + /** + \brief Default constructor + */ + CapsuleSupport(); + /** + \brief Constructs a CapsuleSupport for capsule radius and halfHeight + */ + CapsuleSupport(PxReal radius, PxReal halfHeight); + /** + \brief Constructs a CapsuleSupport for a PxCapsuleGeometry + */ + CapsuleSupport(const PxCapsuleGeometry& geom); + + virtual PxReal getMargin() const PX_OVERRIDE PX_FINAL; + virtual PxVec3 supportLocal(const PxVec3& dir) const PX_OVERRIDE PX_FINAL; + }; + + /** + \brief Pre-made support mapping for a box + */ + struct BoxSupport : PxGjkQuery::Support + { + PxVec3 halfExtents; + PxReal margin; + + /** + \brief Default constructor + */ + BoxSupport(); + /** + \brief Constructs a BoxSupport for a box halfExtents with optional margin + */ + BoxSupport(const PxVec3& halfExtents, PxReal margin = 0); + /** + \brief Constructs a BoxSupport for a PxBoxGeometry + */ + BoxSupport(const PxBoxGeometry& box, PxReal margin = 0); + + virtual PxReal getMargin() const PX_OVERRIDE PX_FINAL; + virtual PxVec3 supportLocal(const PxVec3& dir) const PX_OVERRIDE PX_FINAL; + }; + + /** + \brief Pre-made support mapping for a convex core + */ + struct ConvexCoreSupport : PxGjkQuery::Support + { + PxU64 shapeData[10]; + + /** + \brief Default constructor + */ + ConvexCoreSupport(); + /** + \brief Constructs a ConvexCoreSupport for a PxConvexCoreGeometry + */ + ConvexCoreSupport(const PxConvexCoreGeometry& geom, PxReal margin = 0); + + virtual PxReal getMargin() const PX_OVERRIDE PX_FINAL; + virtual PxVec3 supportLocal(const PxVec3& dir) const PX_OVERRIDE PX_FINAL; + }; + + /** + \brief Pre-made support mapping for a convex mesh + */ + struct ConvexMeshSupport : PxGjkQuery::Support + { + const PxConvexMesh* convexMesh; + PxVec3 scale; + PxQuat scaleRotation; + PxReal margin; + + /** + \brief Default constructor + */ + ConvexMeshSupport(); + /** + \brief Constructs a BoxSupport for a PxConvexMesh + */ + ConvexMeshSupport(const PxConvexMesh& convexMesh, const PxVec3& scale = PxVec3(1), const PxQuat& scaleRotation = PxQuat(PxIdentity), PxReal margin = 0); + /** + \brief Constructs a BoxSupport for a PxConvexMeshGeometry + */ + ConvexMeshSupport(const PxConvexMeshGeometry& convexMesh, PxReal margin = 0); + + virtual PxReal getMargin() const PX_OVERRIDE PX_FINAL; + virtual PxVec3 supportLocal(const PxVec3& dir) const PX_OVERRIDE PX_FINAL; + }; + + /** + \brief Pre-made support mapping for any PhysX's convex geometry (sphere, capsule, box, convex mesh) + */ + struct ConvexGeomSupport : PxGjkQuery::Support + { + /** + \brief Default constructor + */ + ConvexGeomSupport(); + /** + \brief Constructs a BoxSupport for a PxGeometry + */ + ConvexGeomSupport(const PxGeometry& geom, PxReal margin = 0); + /** + \brief Destructor + */ + ~ConvexGeomSupport(); + + /** + \brief Returns false if ConvexGeomSupport was constructed from non-convex geometry + */ + bool isValid() const; + + virtual PxReal getMargin() const PX_OVERRIDE PX_FINAL; + virtual PxVec3 supportLocal(const PxVec3& dir) const PX_OVERRIDE PX_FINAL; + + private: + PxGeometryType::Enum mType; + union { + void* alignment; + PxU8 sphere[sizeof(SphereSupport)]; + PxU8 capsule[sizeof(CapsuleSupport)]; + PxU8 box[sizeof(BoxSupport)]; + PxU8 convexCore[sizeof(ConvexCoreSupport)]; + PxU8 convexMesh[sizeof(ConvexMeshSupport)]; + } mSupport; + }; + + /** + \brief Generates a contact point between two shapes using GJK-EPA algorithm + + \param[in] a Shape A support mapping + \param[in] b Shape B support mapping + \param[in] poseA Shape A transformation + \param[in] poseB Shape B transformation + \param[in] contactDistance The distance at which contacts begin to be generated between the shapes + \param[in] toleranceLength The toleranceLength. Used for scaling distance-based thresholds internally to produce appropriate results given simulations in different units + \param[out] contactBuffer A buffer to store the contact + + \return True if there is a contact. + */ + static bool generateContacts(const PxGjkQuery::Support& a, const PxGjkQuery::Support& b, const PxTransform& poseA, const PxTransform& poseB, + PxReal contactDistance, PxReal toleranceLength, PxContactBuffer& contactBuffer); + +}; + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxJoint.h b/engine/third_party/physx/include/extensions/PxJoint.h new file mode 100644 index 00000000..5533a573 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxJoint.h @@ -0,0 +1,395 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_JOINT_H +#define PX_JOINT_H + +#include "foundation/PxTransform.h" +#include "PxRigidActor.h" +#include "PxConstraint.h" +#include "common/PxBase.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxRigidActor; +class PxScene; +class PxPhysics; +class PxConstraint; + +/** +\brief an enumeration of PhysX' built-in joint types + +\see PxJoint +*/ +struct PxJointConcreteType +{ + enum Enum + { + eSPHERICAL = PxConcreteType::eFIRST_PHYSX_EXTENSION, + eREVOLUTE, + ePRISMATIC, + eFIXED, + eDISTANCE, + eD6, + eGEAR, + eRACK_AND_PINION, + eLast + }; +}; + +PX_DEFINE_TYPEINFO(PxJoint, PxConcreteType::eUNDEFINED) +PX_DEFINE_TYPEINFO(PxRackAndPinionJoint, PxJointConcreteType::eRACK_AND_PINION) +PX_DEFINE_TYPEINFO(PxGearJoint, PxJointConcreteType::eGEAR) +PX_DEFINE_TYPEINFO(PxD6Joint, PxJointConcreteType::eD6) +PX_DEFINE_TYPEINFO(PxDistanceJoint, PxJointConcreteType::eDISTANCE) +PX_DEFINE_TYPEINFO(PxFixedJoint, PxJointConcreteType::eFIXED) +PX_DEFINE_TYPEINFO(PxPrismaticJoint, PxJointConcreteType::ePRISMATIC) +PX_DEFINE_TYPEINFO(PxRevoluteJoint, PxJointConcreteType::eREVOLUTE) +PX_DEFINE_TYPEINFO(PxSphericalJoint, PxJointConcreteType::eSPHERICAL) + + +/** +\brief an enumeration for specifying one or other of the actors referenced by a joint + +\see PxJoint +*/ + +struct PxJointActorIndex +{ + enum Enum + { + eACTOR0, + eACTOR1, + COUNT + }; +}; + +/** +\brief a base interface providing common functionality for PhysX joints +*/ + +class PxJoint : public PxBase +{ +public: + + /** + \brief Set the actors for this joint. + + An actor may be NULL to indicate the world frame. At most one of the actors may be NULL. + + \param[in] actor0 the first actor. + \param[in] actor1 the second actor + + \see getActors() + */ + virtual void setActors(PxRigidActor* actor0, PxRigidActor* actor1) = 0; + + /** + \brief Get the actors for this joint. + + \param[out] actor0 the first actor. + \param[out] actor1 the second actor + + \see setActors() + */ + virtual void getActors(PxRigidActor*& actor0, PxRigidActor*& actor1) const = 0; + + /** + \brief Set the joint local pose for an actor. + + This is the relative pose which locates the joint frame relative to the actor. + + \param[in] actor 0 for the first actor, 1 for the second actor. + \param[in] localPose the local pose for the actor this joint + + \see getLocalPose() + */ + virtual void setLocalPose(PxJointActorIndex::Enum actor, const PxTransform& localPose) = 0; + + /** + \brief get the joint local pose for an actor. + + \param[in] actor 0 for the first actor, 1 for the second actor. + + return the local pose for this joint + + \see setLocalPose() + */ + virtual PxTransform getLocalPose(PxJointActorIndex::Enum actor) const = 0; + + /** + \brief get the relative pose for this joint + + This function returns the pose of the joint frame of actor1 relative to actor0 + + */ + virtual PxTransform getRelativeTransform() const = 0; + + /** + \brief get the relative linear velocity of the joint + + This function returns the linear velocity of the origin of the constraint frame of actor1, relative to the origin of the constraint + frame of actor0. The value is returned in the constraint frame of actor0 + */ + virtual PxVec3 getRelativeLinearVelocity() const = 0; + + /** + \brief get the relative angular velocity of the joint + + This function returns the angular velocity of actor1 relative to actor0. The value is returned in the constraint frame of actor0 + */ + virtual PxVec3 getRelativeAngularVelocity() const = 0; + + /** + \brief set the break force for this joint. + + if the constraint force or torque on the joint exceeds the specified values, the joint will break, + at which point it will not constrain the two actors and the flag PxConstraintFlag::eBROKEN will be set. The + force and torque are measured in the joint frame of the first actor + + \param[in] force the maximum force the joint can apply before breaking + \param[in] torque the maximum torque the joint can apply before breaking + */ + virtual void setBreakForce(PxReal force, PxReal torque) = 0; + + /** + \brief get the break force for this joint. + + \param[out] force the maximum force the joint can apply before breaking + \param[out] torque the maximum torque the joint can apply before breaking + + \see setBreakForce() + */ + virtual void getBreakForce(PxReal& force, PxReal& torque) const = 0; + + /** + \brief set the constraint flags for this joint. + + \param[in] flags the constraint flags + + \see PxConstraintFlag + */ + virtual void setConstraintFlags(PxConstraintFlags flags) = 0; + + /** + \brief set a constraint flags for this joint to a specified value. + + \param[in] flag the constraint flag + \param[in] value the value to which to set the flag + + \see PxConstraintFlag + */ + virtual void setConstraintFlag(PxConstraintFlag::Enum flag, bool value) = 0; + + /** + \brief get the constraint flags for this joint. + + \return the constraint flags + + \see PxConstraintFlag + */ + virtual PxConstraintFlags getConstraintFlags() const = 0; + + /** + \brief set the inverse mass scale for actor0. + + \param[in] invMassScale the scale to apply to the inverse mass of actor 0 for resolving this constraint + + \see getInvMassScale0 + */ + virtual void setInvMassScale0(PxReal invMassScale) = 0; + + /** + \brief get the inverse mass scale for actor0. + + \return inverse mass scale for actor0 + + \see setInvMassScale0 + */ + virtual PxReal getInvMassScale0() const = 0; + + /** + \brief set the inverse inertia scale for actor0. + + \param[in] invInertiaScale the scale to apply to the inverse inertia of actor0 for resolving this constraint + + \see getInvMassScale0 + */ + virtual void setInvInertiaScale0(PxReal invInertiaScale) = 0; + + /** + \brief get the inverse inertia scale for actor0. + + \return inverse inertia scale for actor0 + + \see setInvInertiaScale0 + */ + virtual PxReal getInvInertiaScale0() const = 0; + + /** + \brief set the inverse mass scale for actor1. + + \param[in] invMassScale the scale to apply to the inverse mass of actor 1 for resolving this constraint + + \see getInvMassScale1 + */ + virtual void setInvMassScale1(PxReal invMassScale) = 0; + + /** + \brief get the inverse mass scale for actor1. + + \return inverse mass scale for actor1 + + \see setInvMassScale1 + */ + virtual PxReal getInvMassScale1() const = 0; + + /** + \brief set the inverse inertia scale for actor1. + + \param[in] invInertiaScale the scale to apply to the inverse inertia of actor1 for resolving this constraint + + \see getInvInertiaScale1 + */ + virtual void setInvInertiaScale1(PxReal invInertiaScale) = 0; + + /** + \brief get the inverse inertia scale for actor1. + + \return inverse inertia scale for actor1 + + \see setInvInertiaScale1 + */ + virtual PxReal getInvInertiaScale1() const = 0; + + /** + \brief Retrieves the PxConstraint corresponding to this joint. + + This can be used to determine, among other things, the force applied at the joint. + + \return the constraint + */ + virtual PxConstraint* getConstraint() const = 0; + + /** + \brief Sets a name string for the object that can be retrieved with getName(). + + This is for debugging and is not used by the SDK. The string is not copied by the SDK, + only the pointer is stored. + + \param[in] name String to set the objects name to. + + \see getName() + */ + virtual void setName(const char* name) = 0; + + /** + \brief Retrieves the name string set with setName(). + + \return Name string associated with object. + + \see setName() + */ + virtual const char* getName() const = 0; + + /** + \brief Deletes the joint. + + \note This call does not wake up the connected rigid bodies. + */ + virtual void release() = 0; + + /** + \brief Retrieves the scene which this joint belongs to. + + \return Owner Scene. NULL if not part of a scene. + + \see PxScene + */ + virtual PxScene* getScene() const = 0; + + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + +protected: + virtual ~PxJoint() {} + + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxJoint(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxJoint(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxJoint", PxBase); } + + //~serialization +}; + +class PxSpring +{ +public: + + PxReal stiffness; //!< the spring strength of the drive: that is, the force proportional to the position error + PxReal damping; //!< the damping strength of the drive: that is, the force proportional to the velocity error + + PxSpring(PxReal stiffness_, PxReal damping_): stiffness(stiffness_), damping(damping_) {} +}; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** \brief Helper function to setup a joint's global frame + + This replaces the following functions from previous SDK versions: + + void NxJointDesc::setGlobalAnchor(const NxVec3& wsAnchor); + void NxJointDesc::setGlobalAxis(const NxVec3& wsAxis); + + The function sets the joint's localPose using world-space input parameters. + + \param[in] wsAnchor Global frame anchor point. Range: position vector + \param[in] wsAxis Global frame axis. Range: direction vector + \param[in,out] joint Joint having its global frame set. +*/ + +PX_C_EXPORT void PX_CALL_CONV PxSetJointGlobalFrame(physx::PxJoint& joint, const physx::PxVec3* wsAnchor, const physx::PxVec3* wsAxis); + +#endif diff --git a/engine/third_party/physx/include/extensions/PxJointLimit.h b/engine/third_party/physx/include/extensions/PxJointLimit.h new file mode 100644 index 00000000..bb36b6a4 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxJointLimit.h @@ -0,0 +1,483 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_JOINT_LIMIT_H +#define PX_JOINT_LIMIT_H + +#include "foundation/PxMath.h" +#include "common/PxTolerancesScale.h" +#include "extensions/PxJoint.h" +#include "PxPhysXConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Describes the parameters for a joint limit. + +Limits are enabled or disabled by setting flags or other configuration parameters joints, see the +documentation for specific joint types for details. +*/ +class PxJointLimitParameters +{ +public: + /** + \brief Controls the amount of bounce when the joint hits a limit. + + A restitution value of 1.0 causes the joint to bounce back with the velocity which it hit the limit. + A value of zero causes the joint to stop dead. + + In situations where the joint has many locked DOFs (e.g. 5) the restitution may not be applied + correctly. This is due to a limitation in the solver which causes the restitution velocity to become zero + as the solver enforces constraints on the other DOFs. + + This limitation applies to both angular and linear limits, however it is generally most apparent with limited + angular DOFs. Disabling joint projection and increasing the solver iteration count may improve this behavior + to some extent. + + Also, combining soft joint limits with joint drives driving against those limits may affect stability. + + Range: [0,1]
+ Default: 0.0 + */ + PxReal restitution; + + /** + determines the minimum impact velocity which will cause the joint to bounce + */ + PxReal bounceThreshold; + + /** + \brief if greater than zero, the limit is soft, i.e. a spring pulls the joint back to the limit + + Range: [0, PX_MAX_F32)
+ Default: 0.0 + */ + PxReal stiffness; + + /** + \brief if spring is greater than zero, this is the damping of the limit spring + + Range: [0, PX_MAX_F32)
+ Default: 0.0 + */ + PxReal damping; + + PxJointLimitParameters() : + restitution (0.0f), + bounceThreshold (0.0f), + stiffness (0.0f), + damping (0.0f) + { + } + + PxJointLimitParameters(const PxJointLimitParameters& p) : + restitution (p.restitution), + bounceThreshold (p.bounceThreshold), + stiffness (p.stiffness), + damping (p.damping) + { + } + + /** + \brief Returns true if the current settings are valid. + + \return true if the current settings are valid + */ + PX_INLINE bool isValid() const + { + return PxIsFinite(restitution) && restitution >= 0 && restitution <= 1 && + PxIsFinite(stiffness) && stiffness >= 0 && + PxIsFinite(damping) && damping >= 0 && + PxIsFinite(bounceThreshold) && bounceThreshold >= 0; + } + + PX_INLINE bool isSoft() const + { + return damping>0 || stiffness>0; + } + +protected: + ~PxJointLimitParameters() {} +}; + + +/** +\brief Describes a one-sided linear limit. +*/ +class PxJointLinearLimit : public PxJointLimitParameters +{ +public: + /** + \brief the extent of the limit. + + Range: (0, PX_MAX_F32)
+ Default: PX_MAX_F32 + */ + PxReal value; + + /** + \brief construct a linear hard limit + + \param[in] extent The extent of the limit + + \see PxJointLimitParameters + */ + PxJointLinearLimit(PxReal extent) : value(extent) + { + } + + /** + \brief construct a linear soft limit + + \param[in] extent the extent of the limit + \param[in] spring the stiffness and damping parameters for the limit spring + + \see PxJointLimitParameters + */ + PxJointLinearLimit(PxReal extent, const PxSpring& spring) : value(extent) + { + stiffness = spring.stiffness; + damping = spring.damping; + } + + /** + \brief Returns true if the limit is valid + + \return true if the current settings are valid + */ + PX_INLINE bool isValid() const + { + return PxJointLimitParameters::isValid() && + PxIsFinite(value) && + value > 0.0f; + } +}; + + +/** +\brief Describes a two-sided limit. +*/ +class PxJointLinearLimitPair : public PxJointLimitParameters +{ +public: + /** + \brief the range of the limit. The upper limit must be no lower than the + lower limit, and if they are equal the limited degree of freedom will be treated as locked. + + Range: See the joint on which the limit is used for details
+ Default: lower = -PX_MAX_F32/3, upper = PX_MAX_F32/3 + */ + PxReal upper, lower; + + /** + \brief Construct a linear hard limit pair. The lower distance value must be less than the upper distance value. + + \param[in] scale A PxTolerancesScale struct. Should be the same as used when creating the PxPhysics object. + \param[in] lowerLimit The lower distance of the limit + \param[in] upperLimit The upper distance of the limit + + \see PxJointLimitParameters PxTolerancesScale + */ + PxJointLinearLimitPair(const PxTolerancesScale& scale, PxReal lowerLimit = -PX_MAX_F32/3.0f, PxReal upperLimit = PX_MAX_F32/3.0f) : + upper(upperLimit), + lower(lowerLimit) + { + bounceThreshold = 2.0f*scale.length; + } + + /** + \brief construct a linear soft limit pair + + \param[in] lowerLimit The lower distance of the limit + \param[in] upperLimit The upper distance of the limit + \param[in] spring The stiffness and damping parameters of the limit spring + + \see PxJointLimitParameters + */ + PxJointLinearLimitPair(PxReal lowerLimit, PxReal upperLimit, const PxSpring& spring) : + upper(upperLimit), + lower(lowerLimit) + { + stiffness = spring.stiffness; + damping = spring.damping; + } + + /** + \brief Returns true if the limit is valid. + + \return true if the current settings are valid + */ + PX_INLINE bool isValid() const + { + return PxJointLimitParameters::isValid() && + PxIsFinite(upper) && PxIsFinite(lower) && upper >= lower && + PxIsFinite(upper - lower); + } +}; + + +class PxJointAngularLimitPair : public PxJointLimitParameters +{ +public: + /** + \brief the range of the limit. The upper limit must be no lower than the lower limit. + + Unit: Angular: Radians + Range: See the joint on which the limit is used for details
+ Default: lower = -PI/2, upper = PI/2 + */ + PxReal upper, lower; + + /** + \brief construct an angular hard limit pair. + + The lower value must be less than the upper value. + + \param[in] lowerLimit The lower angle of the limit + \param[in] upperLimit The upper angle of the limit + + \see PxJointLimitParameters + */ + PxJointAngularLimitPair(PxReal lowerLimit, PxReal upperLimit) : + upper(upperLimit), + lower(lowerLimit) + { + bounceThreshold = 0.5f; + } + + /** + \brief construct an angular soft limit pair. + + The lower value must be less than the upper value. + + \param[in] lowerLimit The lower angle of the limit + \param[in] upperLimit The upper angle of the limit + \param[in] spring The stiffness and damping of the limit spring + + \see PxJointLimitParameters + */ + PxJointAngularLimitPair(PxReal lowerLimit, PxReal upperLimit, const PxSpring& spring) : + upper(upperLimit), + lower(lowerLimit) + { + stiffness = spring.stiffness; + damping = spring.damping; + } + + /** + \brief Returns true if the limit is valid. + + \return true if the current settings are valid + */ + PX_INLINE bool isValid() const + { + return PxJointLimitParameters::isValid() && + PxIsFinite(upper) && PxIsFinite(lower) && upper >= lower; + } +}; + +/** +\brief Describes an elliptical conical joint limit. Note that very small or highly elliptical limit cones may +result in jitter. + +\see PxD6Joint PxSphericalJoint +*/ +class PxJointLimitCone : public PxJointLimitParameters +{ +public: + /** + \brief the maximum angle from the Y axis of the constraint frame. + + Unit: Angular: Radians + Range: Angular: (0,PI)
+ Default: PI/2 + */ + PxReal yAngle; + + /** + \brief the maximum angle from the Z-axis of the constraint frame. + + Unit: Angular: Radians + Range: Angular: (0,PI)
+ Default: PI/2 + */ + PxReal zAngle; + + /** + \brief Construct a cone hard limit. + + \param[in] yLimitAngle The limit angle from the Y-axis of the constraint frame + \param[in] zLimitAngle The limit angle from the Z-axis of the constraint frame + + \see PxJointLimitParameters + */ + PxJointLimitCone(PxReal yLimitAngle, PxReal zLimitAngle) : + yAngle(yLimitAngle), + zAngle(zLimitAngle) + { + bounceThreshold = 0.5f; + } + + /** + \brief Construct a cone soft limit. + + \param[in] yLimitAngle The limit angle from the Y-axis of the constraint frame + \param[in] zLimitAngle The limit angle from the Z-axis of the constraint frame + \param[in] spring The stiffness and damping of the limit spring + + \see PxJointLimitParameters + */ + PxJointLimitCone(PxReal yLimitAngle, PxReal zLimitAngle, const PxSpring& spring) : + yAngle(yLimitAngle), + zAngle(zLimitAngle) + { + stiffness = spring.stiffness; + damping = spring.damping; + } + + /** + \brief Returns true if the limit is valid. + + \return true if the current settings are valid + */ + PX_INLINE bool isValid() const + { + return PxJointLimitParameters::isValid() && + PxIsFinite(yAngle) && yAngle>0 && yAngle0 && zAngleUnit: Angular: Radians + Range: Angular: (-PI,PI)
+ Default: -PI/2 + */ + PxReal yAngleMin; + + /** + \brief the maximum angle from the Y axis of the constraint frame. + + Unit: Angular: Radians + Range: Angular: (-PI,PI)
+ Default: PI/2 + */ + PxReal yAngleMax; + + /** + \brief the minimum angle from the Z-axis of the constraint frame. + + Unit: Angular: Radians + Range: Angular: (-PI,PI)
+ Default: -PI/2 + */ + PxReal zAngleMin; + + /** + \brief the maximum angle from the Z-axis of the constraint frame. + + Unit: Angular: Radians + Range: Angular: (-PI,PI)
+ Default: PI/2 + */ + PxReal zAngleMax; + + /** + \brief Construct a pyramid hard limit. + + \param[in] yLimitAngleMin The minimum limit angle from the Y-axis of the constraint frame + \param[in] yLimitAngleMax The maximum limit angle from the Y-axis of the constraint frame + \param[in] zLimitAngleMin The minimum limit angle from the Z-axis of the constraint frame + \param[in] zLimitAngleMax The maximum limit angle from the Z-axis of the constraint frame + + \see PxJointLimitParameters + */ + PxJointLimitPyramid(PxReal yLimitAngleMin, PxReal yLimitAngleMax, PxReal zLimitAngleMin, PxReal zLimitAngleMax) : + yAngleMin(yLimitAngleMin), + yAngleMax(yLimitAngleMax), + zAngleMin(zLimitAngleMin), + zAngleMax(zLimitAngleMax) + { + bounceThreshold = 0.5f; + } + + /** + \brief Construct a pyramid soft limit. + + \param[in] yLimitAngleMin The minimum limit angle from the Y-axis of the constraint frame + \param[in] yLimitAngleMax The maximum limit angle from the Y-axis of the constraint frame + \param[in] zLimitAngleMin The minimum limit angle from the Z-axis of the constraint frame + \param[in] zLimitAngleMax The maximum limit angle from the Z-axis of the constraint frame + \param[in] spring The stiffness and damping of the limit spring + + \see PxJointLimitParameters + */ + PxJointLimitPyramid(PxReal yLimitAngleMin, PxReal yLimitAngleMax, PxReal zLimitAngleMin, PxReal zLimitAngleMax, const PxSpring& spring) : + yAngleMin(yLimitAngleMin), + yAngleMax(yLimitAngleMax), + zAngleMin(zLimitAngleMin), + zAngleMax(zLimitAngleMax) + { + stiffness = spring.stiffness; + damping = spring.damping; + } + + /** + \brief Returns true if the limit is valid. + + \return true if the current settings are valid + */ + PX_INLINE bool isValid() const + { + return PxJointLimitParameters::isValid() && + PxIsFinite(yAngleMin) && yAngleMin>-PxPi && yAngleMin-PxPi && yAngleMax-PxPi && zAngleMin-PxPi && zAngleMax=yAngleMin && zAngleMax>=zAngleMin; + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxMassProperties.h b/engine/third_party/physx/include/extensions/PxMassProperties.h new file mode 100644 index 00000000..bd578e91 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxMassProperties.h @@ -0,0 +1,370 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_MASS_PROPERTIES_H +#define PX_MASS_PROPERTIES_H + +#include "PxPhysXConfig.h" +#include "foundation/PxMath.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxVec3.h" +#include "foundation/PxMat33.h" +#include "foundation/PxQuat.h" +#include "foundation/PxTransform.h" +#include "geometry/PxGeometry.h" +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxConvexMesh.h" +#include "geometry/PxCustomGeometry.h" +#include "geometry/PxConvexCoreGeometry.h" +#include "geometry/PxTriangleMeshGeometry.h" +#include "geometry/PxTriangleMesh.h" +#include "PxConvexCoreExt.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Utility class to compute and manipulate mass and inertia tensor properties. + +In most cases #PxRigidBodyExt::updateMassAndInertia(), #PxRigidBodyExt::setMassAndUpdateInertia() should be enough to +setup the mass properties of a rigid body. This utility class targets users that need to customize the mass properties +computation. +*/ +class PxMassProperties +{ +public: + /** + \brief Default constructor. + */ + PX_FORCE_INLINE PxMassProperties() : inertiaTensor(PxIdentity), centerOfMass(0.0f), mass(1.0f) {} + + /** + \brief Construct from individual elements. + */ + PX_FORCE_INLINE PxMassProperties(const PxReal m, const PxMat33& inertiaT, const PxVec3& com) : inertiaTensor(inertiaT), centerOfMass(com), mass(m) {} + + /** + \brief Compute mass properties based on a provided geometry structure. + + This constructor assumes the geometry has a density of 1. Mass and inertia tensor scale linearly with density. + + \param[in] geometry The geometry to compute the mass properties for. Supported geometry types are: sphere, box, capsule and convex mesh. + */ + PxMassProperties(const PxGeometry& geometry) + { + switch (geometry.getType()) + { + case PxGeometryType::eSPHERE: + { + const PxSphereGeometry& s = static_cast(geometry); + mass = (4.0f / 3.0f) * PxPi * s.radius * s.radius * s.radius; + inertiaTensor = PxMat33::createDiagonal(PxVec3(2.0f / 5.0f * mass * s.radius * s.radius)); + centerOfMass = PxVec3(0.0f); + } + break; + + case PxGeometryType::eBOX: + { + const PxBoxGeometry& b = static_cast(geometry); + mass = b.halfExtents.x * b.halfExtents.y * b.halfExtents.z * 8.0f; + PxVec3 d2 = b.halfExtents.multiply(b.halfExtents); + inertiaTensor = PxMat33::createDiagonal(PxVec3(d2.y + d2.z, d2.x + d2.z, d2.x + d2.y)) * (mass * 1.0f / 3.0f); + centerOfMass = PxVec3(0.0f); + } + break; + + case PxGeometryType::eCAPSULE: + { + const PxCapsuleGeometry& c = static_cast(geometry); + PxReal r = c.radius, h = c.halfHeight; + mass = ((4.0f / 3.0f) * r + 2 * c.halfHeight) * PxPi * r * r; + + PxReal a = r*r*r * (8.0f / 15.0f) + h*r*r * (3.0f / 2.0f) + h*h*r * (4.0f / 3.0f) + h*h*h * (2.0f / 3.0f); + PxReal b = r*r*r * (8.0f / 15.0f) + h*r*r; + inertiaTensor = PxMat33::createDiagonal(PxVec3(b, a, a) * PxPi * r * r); + centerOfMass = PxVec3(0.0f); + } + break; + + case PxGeometryType::eCONVEXCORE: + { + const PxConvexCoreGeometry& g = static_cast(geometry); + PxConvexCoreExt::computeMassInfo(g, mass, inertiaTensor, centerOfMass); + } + break; + + case PxGeometryType::eCONVEXMESH: + { + const PxConvexMeshGeometry& c = static_cast(geometry); + PxVec3 unscaledCoM; + PxMat33 unscaledInertiaTensorNonCOM; // inertia tensor of convex mesh in mesh local space + PxMat33 unscaledInertiaTensorCOM; + PxReal unscaledMass; + c.convexMesh->getMassInformation(unscaledMass, unscaledInertiaTensorNonCOM, unscaledCoM); + + // inertia tensor relative to center of mass + unscaledInertiaTensorCOM[0][0] = unscaledInertiaTensorNonCOM[0][0] - unscaledMass*PxReal((unscaledCoM.y*unscaledCoM.y+unscaledCoM.z*unscaledCoM.z)); + unscaledInertiaTensorCOM[1][1] = unscaledInertiaTensorNonCOM[1][1] - unscaledMass*PxReal((unscaledCoM.z*unscaledCoM.z+unscaledCoM.x*unscaledCoM.x)); + unscaledInertiaTensorCOM[2][2] = unscaledInertiaTensorNonCOM[2][2] - unscaledMass*PxReal((unscaledCoM.x*unscaledCoM.x+unscaledCoM.y*unscaledCoM.y)); + unscaledInertiaTensorCOM[0][1] = unscaledInertiaTensorCOM[1][0] = (unscaledInertiaTensorNonCOM[0][1] + unscaledMass*PxReal(unscaledCoM.x*unscaledCoM.y)); + unscaledInertiaTensorCOM[1][2] = unscaledInertiaTensorCOM[2][1] = (unscaledInertiaTensorNonCOM[1][2] + unscaledMass*PxReal(unscaledCoM.y*unscaledCoM.z)); + unscaledInertiaTensorCOM[0][2] = unscaledInertiaTensorCOM[2][0] = (unscaledInertiaTensorNonCOM[0][2] + unscaledMass*PxReal(unscaledCoM.z*unscaledCoM.x)); + + const PxMeshScale& s = c.scale; + mass = unscaledMass * s.scale.x * s.scale.y * s.scale.z; + centerOfMass = s.transform(unscaledCoM); + inertiaTensor = scaleInertia(unscaledInertiaTensorCOM, s.rotation, s.scale); + } + break; + + case PxGeometryType::eCUSTOM: + { + *this = PxMassProperties(); + static_cast(geometry).callbacks->computeMassProperties(geometry, *this); + } + break; + + case PxGeometryType::eTRIANGLEMESH: + { + const PxTriangleMeshGeometry& g = static_cast(geometry); + + PxVec3 unscaledCoM; + PxMat33 unscaledInertiaTensorNonCOM; // inertia tensor of convex mesh in mesh local space + PxMat33 unscaledInertiaTensorCOM; + PxReal unscaledMass; + g.triangleMesh->getMassInformation(unscaledMass, unscaledInertiaTensorNonCOM, unscaledCoM); + + // inertia tensor relative to center of mass + unscaledInertiaTensorCOM[0][0] = unscaledInertiaTensorNonCOM[0][0] - unscaledMass * PxReal((unscaledCoM.y*unscaledCoM.y + unscaledCoM.z*unscaledCoM.z)); + unscaledInertiaTensorCOM[1][1] = unscaledInertiaTensorNonCOM[1][1] - unscaledMass * PxReal((unscaledCoM.z*unscaledCoM.z + unscaledCoM.x*unscaledCoM.x)); + unscaledInertiaTensorCOM[2][2] = unscaledInertiaTensorNonCOM[2][2] - unscaledMass * PxReal((unscaledCoM.x*unscaledCoM.x + unscaledCoM.y*unscaledCoM.y)); + unscaledInertiaTensorCOM[0][1] = unscaledInertiaTensorCOM[1][0] = (unscaledInertiaTensorNonCOM[0][1] + unscaledMass * PxReal(unscaledCoM.x*unscaledCoM.y)); + unscaledInertiaTensorCOM[1][2] = unscaledInertiaTensorCOM[2][1] = (unscaledInertiaTensorNonCOM[1][2] + unscaledMass * PxReal(unscaledCoM.y*unscaledCoM.z)); + unscaledInertiaTensorCOM[0][2] = unscaledInertiaTensorCOM[2][0] = (unscaledInertiaTensorNonCOM[0][2] + unscaledMass * PxReal(unscaledCoM.z*unscaledCoM.x)); + + const PxMeshScale& s = g.scale; + mass = unscaledMass * s.scale.x * s.scale.y * s.scale.z; + centerOfMass = s.transform(unscaledCoM); + inertiaTensor = scaleInertia(unscaledInertiaTensorCOM, s.rotation, s.scale); + } + break; + + default: + { + *this = PxMassProperties(); + } + } + + PX_ASSERT(inertiaTensor.column0.isFinite() && inertiaTensor.column1.isFinite() && inertiaTensor.column2.isFinite()); + PX_ASSERT(centerOfMass.isFinite()); + PX_ASSERT(PxIsFinite(mass)); + } + + /** + \brief Scale mass properties. + + \param[in] scale The linear scaling factor to apply to the mass properties. + \return The scaled mass properties. + */ + PX_FORCE_INLINE PxMassProperties operator*(const PxReal scale) const + { + PX_ASSERT(PxIsFinite(scale)); + + return PxMassProperties(mass * scale, inertiaTensor * scale, centerOfMass); + } + + /** + \brief Translate the center of mass by a given vector and adjust the inertia tensor accordingly. + + \param[in] t The translation vector for the center of mass. + */ + PX_FORCE_INLINE void translate(const PxVec3& t) + { + PX_ASSERT(t.isFinite()); + + inertiaTensor = translateInertia(inertiaTensor, mass, t); + centerOfMass += t; + + PX_ASSERT(inertiaTensor.column0.isFinite() && inertiaTensor.column1.isFinite() && inertiaTensor.column2.isFinite()); + PX_ASSERT(centerOfMass.isFinite()); + } + + /** + \brief Get the entries of the diagonalized inertia tensor and the corresponding reference rotation. + + \param[in] inertia The inertia tensor to diagonalize. + \param[out] massFrame The frame the diagonalized tensor refers to. + \return The entries of the diagonalized inertia tensor. + */ + PX_FORCE_INLINE static PxVec3 getMassSpaceInertia(const PxMat33& inertia, PxQuat& massFrame) + { + PX_ASSERT(inertia.column0.isFinite() && inertia.column1.isFinite() && inertia.column2.isFinite()); + + PxVec3 diagT = PxDiagonalize(inertia, massFrame); + PX_ASSERT(diagT.isFinite()); + PX_ASSERT(massFrame.isFinite()); + return diagT; + } + + /** + \brief Translate an inertia tensor using the parallel axis theorem + + \param[in] inertia The inertia tensor to translate. + \param[in] mass The mass of the object. + \param[in] t The relative frame to translate the inertia tensor to. + \return The translated inertia tensor. + */ + PX_FORCE_INLINE static PxMat33 translateInertia(const PxMat33& inertia, const PxReal mass, const PxVec3& t) + { + PX_ASSERT(inertia.column0.isFinite() && inertia.column1.isFinite() && inertia.column2.isFinite()); + PX_ASSERT(PxIsFinite(mass)); + PX_ASSERT(t.isFinite()); + + PxMat33 s( PxVec3(0,t.z,-t.y), + PxVec3(-t.z,0,t.x), + PxVec3(t.y,-t.x,0) ); + + PxMat33 translatedIT = s.getTranspose() * s * mass + inertia; + PX_ASSERT(translatedIT.column0.isFinite() && translatedIT.column1.isFinite() && translatedIT.column2.isFinite()); + return translatedIT; + } + + /** + \brief Rotate an inertia tensor around the center of mass + + \param[in] inertia The inertia tensor to rotate. + \param[in] q The rotation from the new to the old coordinate frame, i.e. q.rotate(v) transforms + the coordinates of vector v from the old to the new coordinate frame. + \return The rotated inertia tensor. + */ + PX_FORCE_INLINE static PxMat33 rotateInertia(const PxMat33& inertia, const PxQuat& q) + { + PX_ASSERT(inertia.column0.isFinite() && inertia.column1.isFinite() && inertia.column2.isFinite()); + PX_ASSERT(q.isUnit()); + + PxMat33 m(q); + PxMat33 rotatedIT = m * inertia * m.getTranspose(); + PX_ASSERT(rotatedIT.column0.isFinite() && rotatedIT.column1.isFinite() && rotatedIT.column2.isFinite()); + return rotatedIT; + } + + /** + \brief Non-uniform scaling of the inertia tensor + + \param[in] inertia The inertia tensor to scale. + \param[in] scaleRotation The rotation from the scaling frame to the frame that inertia is expressed in. + I.e. scaleRotation.rotate(v) transforms the coordinates of vertex v from inertia's frame to the scaling-axes frame. + \param[in] scale The scaling factor for each axis (relative to the frame specified with scaleRotation). + \return The scaled inertia tensor. + */ + static PxMat33 scaleInertia(const PxMat33& inertia, const PxQuat& scaleRotation, const PxVec3& scale) + { + PX_ASSERT(inertia.column0.isFinite() && inertia.column1.isFinite() && inertia.column2.isFinite()); + PX_ASSERT(scaleRotation.isUnit()); + PX_ASSERT(scale.isFinite()); + + PxMat33 localInertiaT = rotateInertia(inertia, scaleRotation); // rotate inertia into scaling frame + PxVec3 diagonal(localInertiaT[0][0], localInertiaT[1][1], localInertiaT[2][2]); + + PxVec3 xyz2 = PxVec3(diagonal.dot(PxVec3(0.5f))) - diagonal; // original x^2, y^2, z^2 + PxVec3 scaledxyz2 = xyz2.multiply(scale).multiply(scale); + + PxReal xx = scaledxyz2.y + scaledxyz2.z, + yy = scaledxyz2.z + scaledxyz2.x, + zz = scaledxyz2.x + scaledxyz2.y; + + PxReal xy = localInertiaT[0][1] * scale.x * scale.y, + xz = localInertiaT[0][2] * scale.x * scale.z, + yz = localInertiaT[1][2] * scale.y * scale.z; + + PxMat33 scaledInertia( PxVec3(xx, xy, xz), + PxVec3(xy, yy, yz), + PxVec3(xz, yz, zz)); + + PxMat33 scaledIT = rotateInertia(scaledInertia * (scale.x * scale.y * scale.z), scaleRotation.getConjugate()); + PX_ASSERT(scaledIT.column0.isFinite() && scaledIT.column1.isFinite() && scaledIT.column2.isFinite()); + return scaledIT; + } + + /** + \brief Sum up individual mass properties. + + \param[in] props Array of mass properties to sum up. + \param[in] transforms Reference transforms for each mass properties entry. + \param[in] count The number of mass properties to sum up. + \return The summed up mass properties. + */ + static PxMassProperties sum(const PxMassProperties* props, const PxTransform* transforms, const PxU32 count) + { + PxReal combinedMass = 0.0f; + PxVec3 combinedCoM(0.0f); + PxMat33 combinedInertiaT = PxMat33(PxZero); + + for(PxU32 i = 0; i < count; i++) + { + PX_ASSERT(props[i].inertiaTensor.column0.isFinite() && props[i].inertiaTensor.column1.isFinite() && props[i].inertiaTensor.column2.isFinite()); + PX_ASSERT(props[i].centerOfMass.isFinite()); + PX_ASSERT(PxIsFinite(props[i].mass)); + + combinedMass += props[i].mass; + const PxVec3 comTm = transforms[i].transform(props[i].centerOfMass); + combinedCoM += comTm * props[i].mass; + } + + if(combinedMass > 0.f) + combinedCoM /= combinedMass; + + for(PxU32 i = 0; i < count; i++) + { + const PxVec3 comTm = transforms[i].transform(props[i].centerOfMass); + combinedInertiaT += translateInertia(rotateInertia(props[i].inertiaTensor, transforms[i].q), props[i].mass, combinedCoM - comTm); + } + + PX_ASSERT(combinedInertiaT.column0.isFinite() && combinedInertiaT.column1.isFinite() && combinedInertiaT.column2.isFinite()); + PX_ASSERT(combinedCoM.isFinite()); + PX_ASSERT(PxIsFinite(combinedMass)); + + return PxMassProperties(combinedMass, combinedInertiaT, combinedCoM); + } + + + PxMat33 inertiaTensor; //!< The inertia tensor of the object. + PxVec3 centerOfMass; //!< The center of mass of the object. + PxReal mass; //!< The mass of the object. +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxParticleClothCooker.h b/engine/third_party/physx/include/extensions/PxParticleClothCooker.h new file mode 100644 index 00000000..fe3eaa0b --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxParticleClothCooker.h @@ -0,0 +1,122 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CLOTH_COOKER_H +#define PX_PARTICLE_CLOTH_COOKER_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec4.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +namespace ExtGpu +{ + +/** +\brief Holds all the information for a particle cloth constraint used in the PxParticleClothCooker. + +\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated. +*/ +struct PX_DEPRECATED PxParticleClothConstraint +{ + enum + { + eTYPE_INVALID_CONSTRAINT = 0, + eTYPE_HORIZONTAL_CONSTRAINT = 1, + eTYPE_VERTICAL_CONSTRAINT = 2, + eTYPE_DIAGONAL_CONSTRAINT = 4, + eTYPE_BENDING_CONSTRAINT = 8, + eTYPE_DIAGONAL_BENDING_CONSTRAINT = 16, + eTYPE_ALL = eTYPE_HORIZONTAL_CONSTRAINT | eTYPE_VERTICAL_CONSTRAINT | eTYPE_DIAGONAL_CONSTRAINT | eTYPE_BENDING_CONSTRAINT | eTYPE_DIAGONAL_BENDING_CONSTRAINT + }; + PxU32 particleIndexA; //!< The first particle index of this constraint. + PxU32 particleIndexB; //!< The second particle index of this constraint. + PxReal length; //!< The distance between particle A and B. + PxU32 constraintType; //!< The type of constraint, see the constraint type enum. +}; + +/* +\brief Generates PxParticleClothConstraint constraints that connect the individual particles of a particle cloth. + +\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated. +*/ +class PX_DEPRECATED PxParticleClothCooker +{ +public: + virtual void release() = 0; + + /** + \brief Generate the constraint list and triangle index list. + + \param[in] constraints A pointer to an array of PxParticleClothConstraint constraints. If NULL, the cooker will generate all the constraints. Otherwise, the user-provided constraints will be added. + \param[in] numConstraints The number of user-provided PxParticleClothConstraint s. + */ + virtual void cookConstraints(const PxParticleClothConstraint* constraints = NULL, const PxU32 numConstraints = 0) = 0; + + virtual PxU32* getTriangleIndices() = 0; //!< \return A pointer to the triangle indices. + virtual PxU32 getTriangleIndicesCount() = 0; //!< \return The number of triangle indices. + virtual PxParticleClothConstraint* getConstraints() = 0; //!< \return A pointer to the PxParticleClothConstraint constraints. + virtual PxU32 getConstraintCount() = 0; //!< \return The number of constraints. + virtual void calculateMeshVolume() = 0; //!< Computes the volume of a closed mesh and the contraintScale. Expects vertices in local space - 'close' to origin. + virtual PxReal getMeshVolume() = 0; //!< \return The mesh volume calculated by PxParticleClothCooker::calculateMeshVolume. + +protected: + virtual ~PxParticleClothCooker() {} +}; + +} // namespace ExtGpu + +/** +\brief Creates a PxParticleClothCooker. + +\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated. + +\param[in] vertexCount The number of vertices of the particle cloth. +\param[in] inVertices The vertex positions of the particle cloth. +\param[in] triangleIndexCount The number of triangles of the cloth mesh. +\param[in] inTriangleIndices The triangle indices of the cloth mesh +\param[in] constraintTypeFlags The types of constraints to generate. See PxParticleClothConstraint. +\param[in] verticalDirection The vertical direction of the cloth mesh. This is needed to generate the correct horizontal and vertical constraints to model shear stiffness. +\param[in] bendingConstraintMaxAngle The maximum angle (in radians) considered in the bending constraints. + +\return A pointer to the new PxParticleClothCooker. +*/ +PX_DEPRECATED ExtGpu::PxParticleClothCooker* PxCreateParticleClothCooker(PxU32 vertexCount, physx::PxVec4* inVertices, PxU32 triangleIndexCount, PxU32* inTriangleIndices, + PxU32 constraintTypeFlags = ExtGpu::PxParticleClothConstraint::eTYPE_ALL, + PxVec3 verticalDirection = PxVec3(0.0f, 1.0f, 0.0f), PxReal bendingConstraintMaxAngle = 20.0f*PxTwoPi/360.0f +); + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxParticleExt.h b/engine/third_party/physx/include/extensions/PxParticleExt.h new file mode 100644 index 00000000..e3f335cd --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxParticleExt.h @@ -0,0 +1,410 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_EXT_H +#define PX_PARTICLE_EXT_H + +#include "PxPBDParticleSystem.h" +#include "PxParticleBuffer.h" +#include "foundation/PxArray.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxUserAllocated.h" +#include "PxDeformableAttachment.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +namespace ExtGpu +{ + +/** +\brief Structure to define user-defined particle state when constructing a new particle system. +*/ +struct PxParticleBufferDesc +{ + PxVec4* positions; + PxVec4* velocities; + PxU32* phases; + PxParticleVolume* volumes; + PxU32 numActiveParticles; + PxU32 maxParticles; + PxU32 numVolumes; + PxU32 maxVolumes; + + PxParticleBufferDesc() : positions(NULL), velocities(NULL), phases(NULL), volumes(NULL), numActiveParticles(0), maxParticles(0), numVolumes(0), maxVolumes(0) { } +}; + +/** +\brief Structure to define user-defined particle state when constructing a new particle system that includes diffuse particles. +*/ +struct PxParticleAndDiffuseBufferDesc : public PxParticleBufferDesc +{ + PxDiffuseParticleParams diffuseParams; + PxU32 maxDiffuseParticles; + PxU32 maxActiveDiffuseParticles; + + PxParticleAndDiffuseBufferDesc() : PxParticleBufferDesc() { } +}; + +/** +\brief Structure to define user-defined particle state when constructing a new particle system that includes shape-matched rigid bodies. +*/ +struct PxParticleRigidDesc +{ + PxParticleRigidDesc() : rigidOffsets(NULL), rigidCoefficients(NULL), rigidTranslations(NULL), rigidRotations(NULL), + rigidLocalPositions(NULL), rigidLocalNormals(NULL), maxRigids(0), numActiveRigids(0) { } + + PxU32* rigidOffsets; + PxReal* rigidCoefficients; + PxVec4* rigidTranslations; + PxQuat* rigidRotations; + PxVec4* rigidLocalPositions; + PxVec4* rigidLocalNormals; + PxU32 maxRigids; + PxU32 numActiveRigids; +}; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** +\brief Helper class to manage PxParticleClothDesc buffers used for communicating particle based cloths to PxParticleClothBuffer. + +\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated. +*/ +class PX_DEPRECATED PxParticleClothBufferHelper +{ +public: + virtual void release() = 0; + + virtual PxU32 getMaxCloths() const = 0; //!< \return The maximum number of cloths this PxParticleClothBufferHelper can hold. + virtual PxU32 getNumCloths() const = 0; //!< \return The current number of cloths in this PxParticleClothBufferHelper. + virtual PxU32 getMaxSprings() const = 0; //!< \return The maximum number of springs this PxParticleClothBufferHelper can hold. + virtual PxU32 getNumSprings() const = 0; //!< \return The current number of springs in this PxParticleClothBufferHelper. + virtual PxU32 getMaxTriangles() const = 0; //!< \return The maximum number of triangles this PxParticleClothBufferHelper can hold. + virtual PxU32 getNumTriangles() const = 0; //!< \return The current number of triangles in this PxParticleClothBufferHelper. + virtual PxU32 getMaxParticles() const = 0; //!< \return The maximum number of particles this PxParticleClothBufferHelper can hold. + virtual PxU32 getNumParticles() const = 0; //!< \return The current number of particles in this PxParticleClothBufferHelper. + + /** + \brief Adds a PxParticleCloth to this PxParticleClothBufferHelper instance. + + \param[in] particleCloth The PxParticleCloth to be added. + \param[in] triangles A pointer to the triangles + \param[in] numTriangles The number of triangles + \param[in] springs A pointer to the springs + \param[in] numSprings The number of springs + \param[in] restPositions A pointer to the particle rest positions + \param[in] numParticles The number of particles in this cloth + + \see PxParticleCloth PxParticleSpring + */ + virtual void addCloth(const PxParticleCloth& particleCloth, + const PxU32* triangles, const PxU32 numTriangles, + const PxParticleSpring* springs, const PxU32 numSprings, const PxVec4* restPositions, const PxU32 numParticles) = 0; + + /** + \brief Adds a cloth to this PxParticleClothBufferHelper instance. + + Adds a cloth to this PxParticleClothBufferHelper instance. With this method the relevant parameters for inflatable simulation + (restVolume, pressure) can be set directly. + + \param[in] blendScale This should be 1.f / (numPartitions + 1) if the springs are partitioned by the user. Otherwise this will be set during spring partitioning. + \param[in] restVolume The rest volume of the inflatable + \param[in] pressure The pressure of the inflatable. The target inflatable volume is defined as restVolume * pressure. Setting this to > 0.0 will enable inflatable simulation. + \param[in] triangles A pointer to the triangles + \param[in] numTriangles The number of triangles + \param[in] springs A pointer to the springs + \param[in] numSprings The number of springs + \param[in] restPositions A pointer to the particle rest positions + \param[in] numParticles The number of particles in this cloth + + \see PxParticleSpring + */ + virtual void addCloth(const PxReal blendScale, const PxReal restVolume, const PxReal pressure, + const PxU32* triangles, const PxU32 numTriangles, + const PxParticleSpring* springs, const PxU32 numSprings, + const PxVec4* restPositions, const PxU32 numParticles) = 0; + + /** + \brief Returns a PxParticleClothDesc for this PxParticleClothBufferHelper instance to be used for spring partitioning. + + \return the PxParticleClothDesc. + + \see PxCreateAndPopulateParticleClothBuffer, PxParticleClothPreProcessor::partitionSprings + */ + virtual PxParticleClothDesc& getParticleClothDesc() = 0; + +protected: + virtual ~PxParticleClothBufferHelper() {} +}; + + +/** +\brief Helper struct that holds information about a specific mesh in a PxParticleVolumeBufferHelper. + +\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated. +*/ +struct PX_DEPRECATED PxParticleVolumeMesh +{ + PxU32 startIndex; //!< The index of the first triangle of this mesh in the triangle array of the PxParticleVolumeBufferHelper instance. + PxU32 count; //!< The number of triangles of this mesh. +}; + +/** +\brief Helper class to manage communicating PxParticleVolumes data to PxParticleBuffer. + +\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated. +*/ +class PX_DEPRECATED PxParticleVolumeBufferHelper +{ +public: + virtual void release() = 0; + + virtual PxU32 getMaxVolumes() const = 0; //!< \return The maximum number of PxParticleVolume this PxParticleVolumeBufferHelper instance can hold. + virtual PxU32 getNumVolumes() const = 0; //!< \return The current number of PxParticleVolume in this PxParticleVolumeBufferHelper instance. + virtual PxU32 getMaxTriangles() const = 0; //!< \return The maximum number of triangles this PxParticleVolumeBufferHelper instance can hold. + virtual PxU32 getNumTriangles() const = 0; //!< \return The current number of triangles in this PxParticleVolumeBufferHelper instance. + + virtual PxParticleVolume* getParticleVolumes() = 0; //!< \return A pointer to the PxParticleVolume s of this PxParticleVolumeBufferHelper instance. + virtual PxParticleVolumeMesh* getParticleVolumeMeshes() = 0; //!< \return A pointer to the PxParticleVolumeMesh structs describing the PxParticleVolumes of this PxParticleVolumeBufferHelper instance. + virtual PxU32* getTriangles() = 0; //!< \return A pointer to the triangle indices in this PxParticleVolumeBufferHelper instance. + + /** + \brief Adds a PxParticleVolume with a PxParticleVolumeMesh + + \param[in] volume The PxParticleVolume to be added. + \param[in] volumeMesh A PxParticleVolumeMesh that describes the volumes to be added. startIndex is the index into the triangle list of the PxParticleVolumeBufferHelper instance. + \param[in] triangles A pointer to the triangle indices of the PxParticleVolume to be added. + \param[in] numTriangles The number of triangles of the PxParticleVolume to be added. + */ + virtual void addVolume(const PxParticleVolume& volume, const PxParticleVolumeMesh& volumeMesh, const PxU32* triangles, const PxU32 numTriangles) = 0; + + /** + \brief Adds a volume + + \param[in] particleOffset The index of the first particle of the cloth that maps to this volume in the PxParticleClothBufferHelper instance. + \param[in] numParticles The number of particles of the cloth that maps to this volume in the PxParticleClothBufferHelper instance. + \param[in] triangles A pointer to the triangle indices of this volume. + \param[in] numTriangles The number of triangles in this volume. + */ + virtual void addVolume(const PxU32 particleOffset, const PxU32 numParticles, const PxU32* triangles, const PxU32 numTriangles) = 0; + +protected: + virtual ~PxParticleVolumeBufferHelper() {} +}; + + +/** +\brief Helper class to manage PxParticleRigidDesc buffers used for communicating particle based rigids to PxPaticleSystem. + +\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated. +*/ +class PX_DEPRECATED PxParticleRigidBufferHelper +{ +public: + virtual void release() = 0; + + virtual PxU32 getMaxRigids() const = 0; //!< \return The maximum number of rigids this PxParticleRigidBufferHelper instance can hold. + virtual PxU32 getNumRigids() const = 0; //!< \return The current number of rigids in this PxParticleRigidBufferHelper instance. + virtual PxU32 getMaxParticles() const = 0; //!< \return The maximum number of particles this PxParticleRigidBufferHelper instance can hold. + virtual PxU32 getNumParticles() const = 0; //!< \return The current number of particles in this PxParticleRigidBufferHelper instance. + + /** + \brief Adds a rigid. + + \param[in] translation The world-space location of the rigid. + \param[in] rotation The world-space rotation of the rigid. + \param[in] coefficient The stiffness of the rigid. + \param[in] localPositions The particle positions in local space. + \param[in] localNormals The surface normal for all the particles in local space. Each PxVec4 has the normal in the first 3 components and the SDF in the last component. + \param[in] numParticles The number of particles in this rigid. + */ + virtual void addRigid(const PxVec3& translation, const PxQuat& rotation, const PxReal coefficient, + const PxVec4* localPositions, const PxVec4* localNormals, PxU32 numParticles) = 0; + + /** + \brief Get the PxParticleRigidDesc for this buffer. + + \returns A PxParticleRigidDesc. + */ + virtual PxParticleRigidDesc& getParticleRigidDesc() = 0; + +protected: + virtual ~PxParticleRigidBufferHelper() {} +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** +\brief Holds user-defined attachment data to attach particles to other bodies + +\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated. +*/ +class PX_DEPRECATED PxParticleAttachmentBuffer : public PxUserAllocated +{ + PxArray mAttachments; + PxArray mFilters; + PxHashMap mReferencedBodies; + PxArray mNewReferencedBodies; + PxArray mDestroyedRefrencedBodies; + + PxParticleBuffer& mParticleBuffer; + + PxParticleRigidAttachment* mDeviceAttachments; + PxParticleRigidFilterPair* mDeviceFilters; + PxU32 mNumDeviceAttachments; + PxU32 mNumDeviceFilters; + + PxCudaContextManager* mCudaContextManager; + + PxParticleSystem& mParticleSystem; + + bool mDirty; + + PX_NOCOPY(PxParticleAttachmentBuffer) + +public: + + PxParticleAttachmentBuffer(PxParticleBuffer& particleBuffer, PxPBDParticleSystem& particleSystem); + + ~PxParticleAttachmentBuffer(); + + // adds attachment to attachment buffer - localPose is in actor space for attachments to all types of rigids. + void addRigidAttachment(PxRigidActor* rigidBody, const PxU32 particleID, const PxVec3& localPose, PxConeLimitedConstraint* coneLimit = NULL); + bool removeRigidAttachment(PxRigidActor* rigidBody, const PxU32 particleID); + void addRigidFilter(PxRigidActor* rigidBody, const PxU32 particleID); + bool removeRigidFilter(PxRigidActor* rigidBody, const PxU32 particleID); + + void copyToDevice(CUstream stream = 0); +}; + +/** +\brief Creates a PxParticleRigidBufferHelper. + +\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated. + +\param[in] maxRigids The maximum number of rigids this PxParticleRigidsBuffers instance should hold. +\param[in] maxParticles The maximum number of particles this PxParticleRigidBufferHelper instance should hold. +\param[in] cudaContextManager A pointer to a PxCudaContextManager. + +\return A pointer to the new PxParticleRigidBufferHelper. +*/ +PX_DEPRECATED PxParticleRigidBufferHelper* PxCreateParticleRigidBufferHelper(PxU32 maxRigids, PxU32 maxParticles, PxCudaContextManager* cudaContextManager); + +/** +\brief Creates a PxParticleClothBufferHelper helper. + +\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated. + +\param[in] maxCloths The maximum number of cloths this PxParticleClothBufferHelper should hold. +\param[in] maxTriangles The maximum number of triangles this PxParticleClothBufferHelper should hold. +\param[in] maxSprings The maximum number of springs this PxParticleClothBufferHelper should hold. +\param[in] maxParticles The maximum number of particles this PxParticleClothBufferHelper should hold. +\param[in] cudaContextManager A pointer to a PxCudaContextManager. + +\return A pointer to the PxParticleClothBufferHelper that was created. +*/ +PX_DEPRECATED PxParticleClothBufferHelper* PxCreateParticleClothBufferHelper(const PxU32 maxCloths, const PxU32 maxTriangles, const PxU32 maxSprings, const PxU32 maxParticles, PxCudaContextManager* cudaContextManager); + +/** +\brief Creates a PxParticleVolumeBufferHelper. + +\param[in] maxVolumes The maximum number of PxParticleVolume s this PxParticleVolumeBufferHelper instance should hold. +\param[in] maxTriangles The maximum number of triangles this PxParticleVolumeBufferHelper instance should hold. +\param[in] cudaContextManager A pointer to a PxCudaContextManager. + +\return A pointer to the new PxParticleVolumeBufferHelper. +*/ +PX_DEPRECATED PxParticleVolumeBufferHelper* PxCreateParticleVolumeBufferHelper(PxU32 maxVolumes, PxU32 maxTriangles, PxCudaContextManager* cudaContextManager); + +/** +\brief Creates a particle attachment buffer + +\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated. + +\param[in] particleBuffer The particle buffer that contains particles that should get attached to something +\param[in] particleSystem The particle system that is used to simulate the userBuffer +\return An attachment buffer ready to use +*/ +PX_DEPRECATED PxParticleAttachmentBuffer* PxCreateParticleAttachmentBuffer(PxParticleBuffer& particleBuffer, PxParticleSystem& particleSystem); + +/** +\brief Creates and populates a particle buffer + +\param[in] desc The particle buffer descriptor +\param[in] cudaContextManager A cuda context manager +\return A fully populated particle buffer ready to use +*/ +PxParticleBuffer* PxCreateAndPopulateParticleBuffer(const ExtGpu::PxParticleBufferDesc& desc, PxCudaContextManager* cudaContextManager); + +/** +\brief Creates and populates a particle buffer that includes support for diffuse particles + +\param[in] desc The particle buffer descriptor +\param[in] cudaContextManager A cuda context manager +\return A fully populated particle buffer ready to use +*/ +PxParticleAndDiffuseBuffer* PxCreateAndPopulateParticleAndDiffuseBuffer(const ExtGpu::PxParticleAndDiffuseBufferDesc& desc, PxCudaContextManager* cudaContextManager); + +/** +\brief Creates and populates a particle cloth buffer + +\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated. + +\param[in] desc The particle buffer descriptor +\param[in] clothDesc The cloth descriptor +\param[out] output A cloth output object to further configure the behavior of the cloth +\param[in] cudaContextManager A cuda context manager +\return A fully populated particle cloth buffer ready to use +*/ +PX_DEPRECATED PxParticleClothBuffer* PxCreateAndPopulateParticleClothBuffer(const ExtGpu::PxParticleBufferDesc& desc, const PxParticleClothDesc& clothDesc, + PxPartitionedParticleCloth& output, PxCudaContextManager* cudaContextManager); + +/** +\brief Creates and populates a particle rigid buffer. Particle rigids are particles that try to keep their relative positions. They are a bit commpressible similar to softbodies. + +\deprecated Particle-cloth, -rigids, -attachments and -volumes have been deprecated. + +\param[in] desc The particle buffer descriptor +\param[in] rigidDesc The rigid descriptor +\param[in] cudaContextManager A cuda context manager +\return A fully populated particle rigid buffer ready to use +*/ +PX_DEPRECATED PxParticleRigidBuffer* PxCreateAndPopulateParticleRigidBuffer(const ExtGpu::PxParticleBufferDesc& desc, const ExtGpu::PxParticleRigidDesc& rigidDesc, + PxCudaContextManager* cudaContextManager); + +} // namespace ExtGpu + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/extensions/PxPrismaticJoint.h b/engine/third_party/physx/include/extensions/PxPrismaticJoint.h new file mode 100644 index 00000000..0e70daec --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxPrismaticJoint.h @@ -0,0 +1,174 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_PRISMATIC_JOINT_H +#define PX_PRISMATIC_JOINT_H + +#include "extensions/PxJoint.h" +#include "extensions/PxJointLimit.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxPrismaticJoint; + +/** +\brief Create a prismatic joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + +\see PxPrismaticJoint +*/ +PxPrismaticJoint* PxPrismaticJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + + +/** +\brief Flags specific to the prismatic joint. + +\see PxPrismaticJoint +*/ +struct PxPrismaticJointFlag +{ + enum Enum + { + eLIMIT_ENABLED = 1<<1 + }; +}; + +typedef PxFlags PxPrismaticJointFlags; +PX_FLAGS_OPERATORS(PxPrismaticJointFlag::Enum, PxU16) + +/** + \brief A prismatic joint permits relative translational movement between two bodies along + an axis, but no relative rotational movement. + + The axis on each body is defined as the line containing the origin of the joint frame and + extending along the x-axis of that frame. + + \image html prismJoint.png + + \see PxPrismaticJointCreate() PxJoint +*/ +class PxPrismaticJoint : public PxJoint +{ +public: + + /** + \brief returns the displacement of the joint along its axis. + */ + virtual PxReal getPosition() const = 0; + + /** + \brief returns the velocity of the joint along its axis + */ + virtual PxReal getVelocity() const = 0; + + /** + \brief sets the joint limit parameters. + + The limit range is [-PX_MAX_F32, PX_MAX_F32], but note that the width of the limit (upper-lower) must also be + a valid float. + + \see PxJointLinearLimitPair getLimit() + */ + virtual void setLimit(const PxJointLinearLimitPair&) = 0; + + /** + \brief gets the joint limit parameters. + + \see PxJointLinearLimit getLimit() + */ + virtual PxJointLinearLimitPair getLimit() const = 0; + + /** + \brief Set the flags specific to the Prismatic Joint. + + Default PxPrismaticJointFlags(0) + + \param[in] flags The joint flags. + + \see PxPrismaticJointFlag setFlag() getFlags() + */ + virtual void setPrismaticJointFlags(PxPrismaticJointFlags flags) = 0; + + /** + \brief Set a single flag specific to a Prismatic Joint to true or false. + + \param[in] flag The flag to set or clear. + \param[in] value The value to which to set the flag + + \see PxPrismaticJointFlag, getFlags() setFlags() + */ + virtual void setPrismaticJointFlag(PxPrismaticJointFlag::Enum flag, bool value) = 0; + + /** + \brief Get the flags specific to the Prismatic Joint. + + \return the joint flags + + \see PxPrismaticJoint::flags, PxPrismaticJointFlag setFlag() setFlags() + */ + virtual PxPrismaticJointFlags getPrismaticJointFlags() const = 0; + + /** + \brief Returns string name of PxPrismaticJoint, used for serialization + */ + virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxPrismaticJoint"; } + +protected: + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxPrismaticJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxPrismaticJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxPrismaticJoint", PxJoint); } + + //~serialization +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxRackAndPinionJoint.h b/engine/third_party/physx/include/extensions/PxRackAndPinionJoint.h new file mode 100644 index 00000000..c572aeaa --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxRackAndPinionJoint.h @@ -0,0 +1,140 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_RACK_AND_PINION_JOINT_H +#define PX_RACK_AND_PINION_JOINT_H + +#include "extensions/PxJoint.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxRackAndPinionJoint; + + /** + \brief Create a rack & pinion Joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + + \see PxRackAndPinionJoint + */ + PxRackAndPinionJoint* PxRackAndPinionJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + + /** + \brief A joint that connects an existing revolute joint to an existing prismatic joint, + and constrains their relative angular/linear velocity and position with respect to each other. + + \see PxRackAndPinionJointCreate PxJoint + */ + class PxRackAndPinionJoint : public PxJoint + { + public: + + /** + \brief Set the hinge & prismatic joints connected by the rack & pinion joint. + + The passed hinge joint can be either PxRevoluteJoint, PxD6Joint or PxArticulationJointReducedCoordinate. + The passed prismatic joint can be either PxPrismaticJoint or PxD6Joint. + + Note that these joints are only used to compute the positional error correction term, + used to adjust potential drift between jointed actors. The rack & pinion joint can run without + calling this function, but in that case some visible overlap may develop over time between + the teeth of the rack & pinion meshes. + + \note Calling this function resets the internal positional error correction term. + + \param[in] hinge The hinge joint (pinion) + \param[in] prismatic The prismatic joint (rack) + \return true if success + */ + virtual bool setJoints(const PxBase* hinge, const PxBase* prismatic) = 0; + + /** + \brief Get the hinge & prismatic joints connected by the rack & pinion joint. + + \param[out] hinge The hinge joint (pinion) + \param[out] prismatic The prismatic joint (rack) + */ + virtual void getJoints(const PxBase*& hinge, const PxBase*& prismatic) const = 0; + + /** + \brief Set the desired ratio directly. + + \note You may need to use a negative gear ratio if the joint frames of involved actors are not oriented in the same direction. + + \note Calling this function resets the internal positional error correction term. + + \param[in] ratio Desired ratio between the hinge and the prismatic. + */ + virtual void setRatio(float ratio) = 0; + + /** + \brief Get the ratio. + + \return Current ratio + */ + virtual float getRatio() const = 0; + + /** + \brief Set the desired ratio indirectly. + + This is a simple helper function that computes the ratio from passed data: + + ratio = (PI*2*nbRackTeeth)/(rackLength*nbPinionTeeth) + + \note Calling this function resets the internal positional error correction term. + + \param[in] nbRackTeeth Number of teeth on the rack (cannot be zero) + \param[in] nbPinionTeeth Number of teeth on the pinion (cannot be zero) + \param[in] rackLength Length of the rack + \return true if success + */ + virtual bool setData(PxU32 nbRackTeeth, PxU32 nbPinionTeeth, float rackLength) = 0; + + virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxRackAndPinionJoint"; } + + protected: + + PX_INLINE PxRackAndPinionJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + PX_INLINE PxRackAndPinionJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxRackAndPinionJoint", PxJoint); } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxRaycastCCD.h b/engine/third_party/physx/include/extensions/PxRaycastCCD.h new file mode 100644 index 00000000..d3dc93f2 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxRaycastCCD.h @@ -0,0 +1,105 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_RAYCAST_CCD_H +#define PX_RAYCAST_CCD_H + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxScene; + class PxShape; + class PxRigidDynamic; + class RaycastCCDManagerInternal; + + /** + \brief Raycast-CCD manager. + + Raycast-CCD is a simple and potentially cheaper alternative to the SDK's built-in continuous collision detection algorithm. + + This implementation has some limitations: + - it is only implemented for PxRigidDynamic objects (not for PxArticulationLink) + - it is only implemented for simple actors with 1 shape (not for "compounds") + + Also, since it is raycast-based, the solution is not perfect. In particular: + - small dynamic objects can still go through the static world if the ray goes through a crack between edges, or a small + hole in the world (like the keyhole from a door). + - dynamic-vs-dynamic CCD is very approximate. It only works well for fast-moving dynamic objects colliding against + slow-moving dynamic objects. + + Finally, since it is using the SDK's scene queries under the hood, it only works provided the simulation shapes also have + scene-query shapes associated with them. That is, if the objects in the scene only use PxShapeFlag::eSIMULATION_SHAPE + (and no PxShapeFlag::eSCENE_QUERY_SHAPE), then the raycast-CCD system will not work. + */ + class RaycastCCDManager + { + public: + RaycastCCDManager(PxScene* scene); + ~RaycastCCDManager(); + + /** + \brief Register dynamic object for raycast CCD. + + \param[in] actor object's actor + \param[in] shape object's shape + + \return True if success + */ + bool registerRaycastCCDObject(PxRigidDynamic* actor, PxShape* shape); + + /** + \brief Unregister dynamic object for raycast CCD. + + \param[in] actor object's actor + \param[in] shape object's shape + + \return True if success + */ + bool unregisterRaycastCCDObject(PxRigidDynamic* actor, PxShape* shape); + + /** + \brief Perform raycast CCD. Call this after your simulate/fetchResults calls. + + \param[in] doDynamicDynamicCCD True to enable dynamic-vs-dynamic CCD (more expensive, not always needed) + */ + void doRaycastCCD(bool doDynamicDynamicCCD); + + private: + RaycastCCDManagerInternal* mImpl; + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxRemeshingExt.h b/engine/third_party/physx/include/extensions/PxRemeshingExt.h new file mode 100644 index 00000000..43aa588c --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxRemeshingExt.h @@ -0,0 +1,87 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_REMESHING_EXT_H +#define PX_REMESHING_EXT_H + +#include "foundation/PxVec3.h" +#include "foundation/PxArray.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Provides methods to adjust the tessellation of meshes + */ + class PxRemeshingExt + { + public: + /** + \brief Processes a triangle mesh and makes sure that no triangle edge is longer than the maximal edge length specified + + To shorten edges that are too long, additional points get inserted at their center leading to a subdivision of the input mesh. + This process is executed repeatedly until the maximum edge length criterion is satisfied + + \param[in,out] triangles The triangles of the mesh where a maximum edge length should be enforced. They will be modified in place during the process. + \param[in,out] points The vertices of the mesh where a maximum edge length should be enforced. They will be modified in place during the process. + \param[in] maxEdgeLength The maximum edge length allowed after processing the input + \param[in] maxIterations The maximum number of subdivision iterations + \param[out] triangleMap An optional map that provides the index of the original triangle for every triangle after the subdivision + \param[in] triangleCountThreshold Optional limit to the number of triangles. Not guaranteed to match exactly, the algorithm will just stop as soon as possible after reaching the limit. + + \return True if any remeshing was applied + */ + static bool limitMaxEdgeLength(PxArray& triangles, PxArray& points, PxReal maxEdgeLength, + PxU32 maxIterations = 100, PxArray* triangleMap = NULL, PxU32 triangleCountThreshold = 0xFFFFFFFF); + + /** + \brief Processes a triangle mesh and makes sure that no triangle edge is longer than the maximal edge length specified + + To shorten edges that are too long, additional points get inserted at their center leading to a subdivision of the input mesh. + This process is executed repeatedly until the maximum edge length criterion is satisfied + + \param[in,out] triangles The triangles of the mesh where a maximum edge length should be enforced. They will be modified in place during the process. + \param[in,out] points The vertices of the mesh where a maximum edge length should be enforced. They will be modified in place during the process. + \param[in] maxEdgeLength The maximum edge length allowed after processing the input + \param[in] maxIterations The maximum number of subdivision iterations + \param[out] triangleMap An optional map that provides the index of the original triangle for every triangle after the subdivision + \param[in] triangleCountThreshold Optional limit to the number of triangles. Not guaranteed to match exactly, the algorithm will just stop as soon as possible after reaching the limit. + + \return True if any remeshing was applied + */ + static bool reduceSliverTriangles(PxArray& triangles, PxArray& points, PxReal maxEdgeLength, + PxU32 maxIterations = 3, PxArray* triangleMap = NULL, PxU32 triangleCountThreshold = 0xFFFFFFFF); + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxRepXSerializer.h b/engine/third_party/physx/include/extensions/PxRepXSerializer.h new file mode 100644 index 00000000..d8e74091 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxRepXSerializer.h @@ -0,0 +1,152 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_REPX_SERIALIZER_H +#define PX_REPX_SERIALIZER_H + +#include "common/PxBase.h" +#include "extensions/PxRepXSimpleType.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class XmlMemoryAllocator; + class XmlWriter; + class XmlReader; + class MemoryBuffer; + + /** + \brief Serializer interface for RepX (Xml) serialization. + + \deprecated Xml serialization is deprecated. An alternative serialization system is provided through USD Physics. + + In order to serialize a class to RepX both a PxSerializer and + a PxRepXSerializer implementation are needed. + + A repx Serializer provides the ability to capture a live + object to a descriptor or static state and the ability to + write that state out to a file. Objects allocated + by the Serializer using the allocator are freed when the + collection itself is freed. + SnRepXCoreSerializers.cpp implements a set of Serializers + for the core PhysX types. + + \note Implementing a PxRepXSerializer is currently not practical without including the internal PhysXExtension header "SnRepXSerializerImpl.h". + + \see PxSerializer, PX_NEW_REPX_SERIALIZER, PxSerializationRegistry::registerRepXSerializer + */ + class PX_DEPRECATED PxRepXSerializer + { + protected: + virtual ~PxRepXSerializer(){} + public: + + /** + \brief The type this Serializer is meant to operate on. + \see PxRepXObject::typeName + */ + virtual const char* getTypeName() = 0; + + /** + \brief Convert from a RepX object to a key-value pair hierarchy + + \param[in] inLiveObject The object to convert to the passed in descriptor. + \param[in] inCollection The collection to use to find ids of references of this object. + \param[in] inWriter Interface to write data to. + \param[in] inTempBuffer used to for temporary allocations. + \param[in] inArgs The arguments used in create resources and objects. + */ + virtual void objectToFile( const PxRepXObject& inLiveObject, PxCollection* inCollection, XmlWriter& inWriter, MemoryBuffer& inTempBuffer, PxRepXInstantiationArgs& inArgs ) = 0; + + /** + \brief Convert from a descriptor to a live object. Must be an object of this Serializer type. + + \param[in] inReader The inverse of the writer, a key-value pair database. + \param[in] inAllocator An allocator to use for temporary allocations. These will be freed after instantiation completes. + \param[in] inArgs The arguments used in create resources and objects. + \param[in] inCollection The collection used to find references. + + \return The new live object. It can be an invalid object if the instantiation cannot take place. + */ + virtual PxRepXObject fileToObject( XmlReader& inReader, XmlMemoryAllocator& inAllocator, PxRepXInstantiationArgs& inArgs, PxCollection* inCollection ) = 0; + + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** +\brief Inline helper template function to create PxRepXObject from TDataType type supporting PxTypeInfo::name. +\deprecated Xml serialization is deprecated. An alternative serialization system is provided through USD Physics. +*/ +template +PX_DEPRECATED PX_INLINE physx::PxRepXObject PxCreateRepXObject(const TDataType* inType, const physx::PxSerialObjectId inId) +{ + return physx::PxRepXObject(physx::PxTypeInfo::name(), inType, inId); +} + +/** +\brief Inline helper function to create PxRepXObject from a PxBase instance. +\deprecated Xml serialization is deprecated. An alternative serialization system is provided through USD Physics. +*/ +PX_DEPRECATED PX_INLINE physx::PxRepXObject PxCreateRepXObject(const physx::PxBase* inType, const physx::PxSerialObjectId inId) +{ + PX_ASSERT(inType); + return physx::PxRepXObject(inType->getConcreteTypeName(), inType, inId); +} + +/** +\brief Inline helper template function to create PxRepXObject form TDataType type using inType pointer as a PxSerialObjectId id. +\deprecated Xml serialization is deprecated. An alternative serialization system is provided through USD Physics. +*/ +template +PX_DEPRECATED PX_INLINE physx::PxRepXObject PxCreateRepXObject(const TDataType* inType) +{ + return PxCreateRepXObject(inType, static_cast(size_t(inType))); +} + +/** +\brief Preprocessor macro for RepX serializer creation. +\deprecated Xml serialization is deprecated. An alternative serialization system is provided through USD Physics. +*/ +#define PX_NEW_REPX_SERIALIZER(T) \ + *PX_PLACEMENT_NEW(PxGetAllocatorCallback()->allocate(sizeof(T), "PxRepXSerializer", PX_FL), T)(*PxGetAllocatorCallback()) + +/** +\brief Preprocessor Macro to simplify RepX serializer delete. +\deprecated Xml serialization is deprecated. An alternative serialization system is provided through USD Physics. +*/ +#define PX_DELETE_REPX_SERIALIZER(x) \ + { PxRepXSerializer* s = x; if (s) { PxGetAllocatorCallback()->deallocate(s); } } + + +#endif + diff --git a/engine/third_party/physx/include/extensions/PxRepXSimpleType.h b/engine/third_party/physx/include/extensions/PxRepXSimpleType.h new file mode 100644 index 00000000..48b77729 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxRepXSimpleType.h @@ -0,0 +1,103 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_REPX_SIMPLE_TYPE_H +#define PX_REPX_SIMPLE_TYPE_H + + +#include "foundation/PxSimpleTypes.h" +#include "cooking/PxCooking.h" +#include "common/PxStringTable.h" +#include "common/PxSerialFramework.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Helper class containing the mapping of id to object, and type name. + + \deprecated Xml serialization is deprecated. An alternative serialization system is provided through USD Physics. + */ + struct PX_DEPRECATED PxRepXObject + { + /** + \brief Identifies the extension meant to handle this object. + \see PxTypeInfo, PX_DEFINE_TYPEINFO, PxRepXSerializer + */ + const char* typeName; + + /** + \brief Pointer to the serializable this was created from + */ + const void* serializable; + + /** + \brief Id given to this object at some point + */ + PxSerialObjectId id; + PxRepXObject( const char* inTypeName = "", const void* inSerializable = NULL, const PxSerialObjectId inId = 0 ) + : typeName( inTypeName ) + , serializable( inSerializable ) + , id( inId ) + { + } + bool isValid() const { return serializable != NULL; } + }; + + /** + \brief Arguments required to instantiate a serializable object from RepX. + + \deprecated Xml serialization is deprecated. An alternative serialization system is provided through USD Physics. + + Extra arguments can be added to the object map under special ids. + + \see PxRepXSerializer::objectToFile, PxRepXSerializer::fileToObject + */ + struct PX_DEPRECATED PxRepXInstantiationArgs + { + PxPhysics& physics; + const PxCookingParams* cooker; + PxStringTable* stringTable; + PxRepXInstantiationArgs( PxPhysics& inPhysics, const PxCookingParams* inCooking = NULL , PxStringTable* inStringTable = NULL ) + : physics( inPhysics ) + , cooker( inCooking ) + , stringTable( inStringTable ) + { + } + + PxRepXInstantiationArgs& operator=(const PxRepXInstantiationArgs&); + }; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxRevoluteJoint.h b/engine/third_party/physx/include/extensions/PxRevoluteJoint.h new file mode 100644 index 00000000..dc9e9899 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxRevoluteJoint.h @@ -0,0 +1,265 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_REVOLUTE_JOINT_H +#define PX_REVOLUTE_JOINT_H + +#include "extensions/PxJoint.h" +#include "extensions/PxJointLimit.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxRevoluteJoint; + +/** +\brief Create a revolute joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + +\see PxRevoluteJoint +*/ +PxRevoluteJoint* PxRevoluteJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + +/** +\brief Flags specific to the Revolute Joint. + +\see PxRevoluteJoint +*/ +struct PxRevoluteJointFlag +{ + enum Enum + { + eLIMIT_ENABLED = 1<<0, //!< enable the limit + eDRIVE_ENABLED = 1<<1, //!< enable the drive + eDRIVE_FREESPIN = 1<<2 //!< if the existing velocity is beyond the drive velocity, do not add force + }; +}; + +typedef PxFlags PxRevoluteJointFlags; +PX_FLAGS_OPERATORS(PxRevoluteJointFlag::Enum, PxU16) + +/** + +\brief A joint which behaves in a similar way to a hinge or axle. + + A hinge joint removes all but a single rotational degree of freedom from two objects. + The axis along which the two bodies may rotate is specified with a point and a direction + vector. + + The position of the hinge on each body is specified by the origin of the body's joint frame. + The axis of the hinge is specified as the direction of the x-axis in the body's joint frame. + + \image html revoluteJoint.png + + A revolute joint can be given a motor, so that it can apply a force to rotate the attached actors. + It may also be given a limit, to restrict the revolute motion to within a certain range. + + Drive and limits are activated by setting the appropriate flags on the joint. + + \see PxRevoluteJointCreate() PxJoint +*/ +class PxRevoluteJoint : public PxJoint +{ +public: + + /** + \brief return the angle of the joint, in the range (-2*Pi, 2*Pi] + */ + virtual PxReal getAngle() const = 0; + + /** + \brief return the velocity of the joint + */ + virtual PxReal getVelocity() const = 0; + + /** + \brief set the joint limit parameters. + + The limit is activated using the flag PxRevoluteJointFlag::eLIMIT_ENABLED + + The limit angle range is (-2*Pi, 2*Pi). + + \param[in] limits The joint limit parameters. + + \see PxJointAngularLimitPair getLimit() + */ + virtual void setLimit(const PxJointAngularLimitPair& limits) = 0; + + /** + \brief get the joint limit parameters. + + \return the joint limit parameters + + \see PxJointAngularLimitPair setLimit() + */ + virtual PxJointAngularLimitPair getLimit() const = 0; + + /** + \brief set the target velocity for the drive model. + + The motor will only be able to reach this velocity if the maxForce is sufficiently large. + If the joint is spinning faster than this velocity, the motor will actually try to brake + (see PxRevoluteJointFlag::eDRIVE_FREESPIN.) + + The sign of this variable determines the rotation direction, with positive values going + the same way as positive joint angles. Setting a very large target velocity may cause + undesirable results. + + \param[in] velocity the drive target velocity + \param[in] autowake Whether to wake up the joint rigids if they are asleep. + + Range: (-PX_MAX_F32, PX_MAX_F32)
+ Default: 0.0 + + \see PxRevoluteFlags::eDRIVE_FREESPIN + */ + virtual void setDriveVelocity(PxReal velocity, bool autowake = true) = 0; + + /** + \brief gets the target velocity for the drive model. + + \return the drive target velocity + + \see setDriveVelocity() + */ + virtual PxReal getDriveVelocity() const = 0; + + /** + \brief sets the maximum torque the drive can exert. + + The value set here may be used either as an impulse limit or a force limit, depending on the flag PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES + + Range: [0, PX_MAX_F32)
+ Default: PX_MAX_F32 + + \see setDriveVelocity() + */ + virtual void setDriveForceLimit(PxReal limit) = 0; + + /** + \brief gets the maximum torque the drive can exert. + + \return the torque limit + + \see setDriveVelocity() + */ + virtual PxReal getDriveForceLimit() const = 0; + + /** + \brief sets the gear ratio for the drive. + + When setting up the drive constraint, the velocity of the first actor is scaled by this value, and its response to drive torque is scaled down. + So if the drive target velocity is zero, the second actor will be driven to the velocity of the first scaled by the gear ratio + + Range: [0, PX_MAX_F32)
+ Default: 1.0 + + \param[in] ratio the drive gear ratio + + \see getDriveGearRatio() + */ + virtual void setDriveGearRatio(PxReal ratio) = 0; + + /** + \brief gets the gear ratio. + + \return the drive gear ratio + + \see setDriveGearRatio() + */ + virtual PxReal getDriveGearRatio() const = 0; + + /** + \brief sets the flags specific to the Revolute Joint. + + Default PxRevoluteJointFlags(0) + + \param[in] flags The joint flags. + + \see PxRevoluteJointFlag setFlag() getFlags() + */ + virtual void setRevoluteJointFlags(PxRevoluteJointFlags flags) = 0; + + /** + \brief sets a single flag specific to a Revolute Joint. + + \param[in] flag The flag to set or clear. + \param[in] value the value to which to set the flag + + \see PxRevoluteJointFlag, getFlags() setFlags() + */ + virtual void setRevoluteJointFlag(PxRevoluteJointFlag::Enum flag, bool value) = 0; + + /** + \brief gets the flags specific to the Revolute Joint. + + \return the joint flags + + \see PxRevoluteJoint::flags, PxRevoluteJointFlag setFlag() setFlags() + */ + virtual PxRevoluteJointFlags getRevoluteJointFlags() const = 0; + + /** + \brief Returns string name of PxRevoluteJoint, used for serialization + */ + virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxRevoluteJoint"; } + +protected: + + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxRevoluteJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxRevoluteJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxRevoluteJoint", PxJoint); } + + //~serialization +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxRigidActorExt.h b/engine/third_party/physx/include/extensions/PxRigidActorExt.h new file mode 100644 index 00000000..df706529 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxRigidActorExt.h @@ -0,0 +1,162 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_RIGID_ACTOR_EXT_H +#define PX_RIGID_ACTOR_EXT_H + +#include "PxPhysXConfig.h" +#include "PxPhysics.h" +#include "PxRigidActor.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxBVH; + +/** +\brief utility functions for use with PxRigidActor and subclasses + +\see PxRigidActor PxRigidStatic PxRigidBody PxRigidDynamic PxArticulationLink +*/ + +class PxRigidActorExt +{ +public: + + /** + \brief Creates a new shape with default properties and a list of materials and adds it to the list of shapes of this actor. + + This is equivalent to the following + + PxShape* shape(...) = PxGetPhysics().createShape(...); // reference count is 1 + actor->attachShape(shape); // increments reference count + shape->release(); // releases user reference, leaving reference count at 1 + + As a consequence, detachShape() will result in the release of the last reference, and the shape will be deleted. + + \note The default shape flags to be set are: eVISUALIZATION, eSIMULATION_SHAPE, eSCENE_QUERY_SHAPE (see #PxShapeFlag). + Triangle mesh, heightfield or plane geometry shapes configured as eSIMULATION_SHAPE are not supported for + non-kinematic PxRigidDynamic instances. + + \note Creating compounds with a very large number of shapes may adversely affect performance and stability. + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] actor the actor to which to attach the shape + \param[in] geometry the geometry of the shape + \param[in] materials a pointer to an array of material pointers + \param[in] materialCount the count of materials + \param[in] shapeFlags optional PxShapeFlags + + \return The newly created shape. + + \see PxShape PxShape::release(), PxPhysics::createShape(), PxRigidActor::attachShape() + */ + static PxShape* createExclusiveShape(PxRigidActor& actor, const PxGeometry& geometry, PxMaterial*const* materials, PxU16 materialCount, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) + { + PxShape* shape = PxGetPhysics().createShape(geometry, materials, materialCount, true, shapeFlags); + if(shape) + { + bool status = actor.attachShape(*shape); // attach can fail, if e.g. we try and attach a trimesh simulation shape to a dynamic actor + shape->release(); // if attach fails, we hold the only counted reference, and so this cleans up properly + if(!status) + shape = NULL; + } + return shape; + } + + /** + \brief Creates a new shape with default properties and a single material adds it to the list of shapes of this actor. + + This is equivalent to the following + + PxShape* shape(...) = PxGetPhysics().createShape(...); // reference count is 1 + actor->attachShape(shape); // increments reference count + shape->release(); // releases user reference, leaving reference count at 1 + + As a consequence, detachShape() will result in the release of the last reference, and the shape will be deleted. + + \note The default shape flags to be set are: eVISUALIZATION, eSIMULATION_SHAPE, eSCENE_QUERY_SHAPE (see #PxShapeFlag). + Triangle mesh, heightfield or plane geometry shapes configured as eSIMULATION_SHAPE are not supported for + non-kinematic PxRigidDynamic instances. + + \note Creating compounds with a very large number of shapes may adversely affect performance and stability. + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] actor the actor to which to attach the shape + \param[in] geometry the geometry of the shape + \param[in] material the material for the shape + \param[in] shapeFlags optional PxShapeFlags + + \return The newly created shape. + + \see PxShape PxShape::release(), PxPhysics::createShape(), PxRigidActor::attachShape() + */ + static PX_FORCE_INLINE PxShape* createExclusiveShape(PxRigidActor& actor, const PxGeometry& geometry, const PxMaterial& material, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) + { + PxMaterial* materialPtr = const_cast(&material); + return createExclusiveShape(actor, geometry, &materialPtr, 1, shapeFlags); + } + + /** + \brief Gets a list of bounds based on shapes in rigid actor. This list can be used to cook/create + bounding volume hierarchy though PxCooking API. + + \param[in] actor The actor from which the bounds list is retrieved. + \param[out] numBounds Number of bounds in returned list. + + \see PxShape PxBVH PxCooking::createBVH PxCooking::cookBVH + */ + static PxBounds3* getRigidActorShapeLocalBoundsList(const PxRigidActor& actor, PxU32& numBounds); + + /** + \brief Convenience function to create a PxBVH object from a PxRigidActor. + + The computed PxBVH can then be used in PxScene::addActor() or PxAggregate::addActor(). + After adding the actor & BVH to the scene/aggregate, release the PxBVH object by calling PxBVH::release(). + + \param[in] physics The physics object. The function will retrieve the insertion callback from it. + \param[in] actor The actor to compute a PxBVH for. + + \return The PxBVH for this actor. + + \see PxBVH PxScene::addActor PxAggregate::addActor + */ + static PxBVH* createBVHFromActor(PxPhysics& physics, const PxRigidActor& actor); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxRigidBodyExt.h b/engine/third_party/physx/include/extensions/PxRigidBodyExt.h new file mode 100644 index 00000000..69f688c1 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxRigidBodyExt.h @@ -0,0 +1,444 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_RIGID_BODY_EXT_H +#define PX_RIGID_BODY_EXT_H + +#include "PxPhysXConfig.h" +#include "PxRigidBody.h" +#include "PxQueryReport.h" +#include "PxQueryFiltering.h" +#include "extensions/PxMassProperties.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxScene; +struct PxQueryCache; +class PxShape; + +/** +\brief utility functions for use with PxRigidBody and subclasses + +\see PxRigidBody PxRigidDynamic PxArticulationLink +*/ + +class PxRigidBodyExt +{ +public: + /** + \brief Computation of mass properties for a rigid body actor + + To simulate a dynamic rigid actor, the SDK needs a mass and an inertia tensor. + + This method offers functionality to compute the necessary mass and inertia properties based on the shapes declared in + the PxRigidBody descriptor and some additionally specified parameters. For each shape, the shape geometry, + the shape positioning within the actor and the specified shape density are used to compute the body's mass and + inertia properties. + +
    +
  • Shapes without PxShapeFlag::eSIMULATION_SHAPE set are ignored unless includeNonSimShapes is true.
  • +
  • Shapes with plane, triangle mesh or heightfield geometry and PxShapeFlag::eSIMULATION_SHAPE set are not allowed for PxRigidBody collision.
  • +
+ + This method will set the mass, center of mass, and inertia tensor + + if no collision shapes are found, the inertia tensor is set to (1,1,1) and the mass to 1 + + if massLocalPose is non-NULL, the rigid body's center of mass parameter will be set + to the user provided value (massLocalPose) and the inertia tensor will be resolved at that point. + + \note If all shapes of the actor have the same density then the overloaded method updateMassAndInertia() with a single density parameter can be used instead. + + \param[in,out] body The rigid body. + \param[in] shapeDensities The per shape densities. There must be one entry for each shape which has the PxShapeFlag::eSIMULATION_SHAPE set (or for all shapes if includeNonSimShapes is set to true). Other shapes are ignored. The density values must be greater than 0. + \param[in] shapeDensityCount The number of provided density values. + \param[in] massLocalPose The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed. + \param[in] includeNonSimShapes True if all kind of shapes (PxShapeFlag::eSCENE_QUERY_SHAPE, PxShapeFlag::eTRIGGER_SHAPE) should be taken into account. + \return Boolean. True on success else false. + + \see PxRigidBody::setMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass + */ + static bool updateMassAndInertia(PxRigidBody& body, const PxReal* shapeDensities, PxU32 shapeDensityCount, const PxVec3* massLocalPose = NULL, bool includeNonSimShapes = false); + + /** + \brief Computation of mass properties for a rigid body actor + + See previous method for details. + + \param[in,out] body The rigid body. + \param[in] density The density of the body. Used to compute the mass of the body. The density must be greater than 0. + \param[in] massLocalPose The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed. + \param[in] includeNonSimShapes True if all kind of shapes (PxShapeFlag::eSCENE_QUERY_SHAPE, PxShapeFlag::eTRIGGER_SHAPE) should be taken into account. + \return Boolean. True on success else false. + + \see PxRigidBody::setMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass + */ + static bool updateMassAndInertia(PxRigidBody& body, PxReal density, const PxVec3* massLocalPose = NULL, bool includeNonSimShapes = false); + + /** + \brief Computation of mass properties for a rigid body actor + + This method sets the mass, inertia and center of mass of a rigid body. The mass is set to the sum of all user-supplied + shape mass values, and the inertia and center of mass are computed according to the rigid body's shapes and the per shape mass input values. + + If no collision shapes are found, the inertia tensor is set to (1,1,1) + + \note If a single mass value should be used for the actor as a whole then the overloaded method setMassAndUpdateInertia() with a single mass parameter can be used instead. + + \see updateMassAndInertia for more details. + + \param[in,out] body The rigid body for which to set the mass and centre of mass local pose properties. + \param[in] shapeMasses The per shape mass values. There must be one entry for each shape which has the PxShapeFlag::eSIMULATION_SHAPE set. Other shapes are ignored. The mass values must be greater than 0. + \param[in] shapeMassCount The number of provided mass values. + \param[in] massLocalPose The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed. + \param[in] includeNonSimShapes True if all kind of shapes (PxShapeFlag::eSCENE_QUERY_SHAPE, PxShapeFlag::eTRIGGER_SHAPE) should be taken into account. + \return Boolean. True on success else false. + + \see PxRigidBody::setCMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass + */ + static bool setMassAndUpdateInertia(PxRigidBody& body, const PxReal* shapeMasses, PxU32 shapeMassCount, const PxVec3* massLocalPose = NULL, bool includeNonSimShapes = false); + + /** + \brief Computation of mass properties for a rigid body actor + + This method sets the mass, inertia and center of mass of a rigid body. The mass is set to the user-supplied + value, and the inertia and center of mass are computed according to the rigid body's shapes and the input mass. + + If no collision shapes are found, the inertia tensor is set to (1,1,1) + + \see updateMassAndInertia for more details. + + \param[in,out] body The rigid body for which to set the mass and centre of mass local pose properties. + \param[in] mass The mass of the body. Must be greater than 0. + \param[in] massLocalPose The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed. + \param[in] includeNonSimShapes True if all kind of shapes (PxShapeFlag::eSCENE_QUERY_SHAPE, PxShapeFlag::eTRIGGER_SHAPE) should be taken into account. + \return Boolean. True on success else false. + + \see PxRigidBody::setCMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass + */ + static bool setMassAndUpdateInertia(PxRigidBody& body, PxReal mass, const PxVec3* massLocalPose = NULL, bool includeNonSimShapes = false); + + /** + \brief Compute the mass, inertia tensor and center of mass from a list of shapes. + + \param[in] shapes The shapes to compute the mass properties from. + \param[in] shapeCount The number of provided shapes. + \return The mass properties from the combined shapes. + + \see PxRigidBody::setCMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass + */ + static PxMassProperties computeMassPropertiesFromShapes(const PxShape* const* shapes, PxU32 shapeCount); + + /** + \brief Applies a force (or impulse) defined in the global coordinate frame, acting at a particular + point in global coordinates, to the actor. + + Note that if the force does not act along the center of mass of the actor, this + will also add the corresponding torque. Because forces are reset at the end of every timestep, + you can maintain a total external force on an object by calling this once every frame. + + \note if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire + articulation + + ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the + force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a + given point. + + Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default). + + \param[in] body The rigid body to apply the force to. + \param[in] force Force/impulse to add, defined in the global frame. Range: force vector + \param[in] pos Position in the global frame to add the force at. Range: position vector + \param[in] mode The mode to use when applying the force/impulse(see #PxForceMode). + \param[in] wakeup Specify if the call should wake up the actor. + + \see PxForceMode + \see addForceAtLocalPos() addLocalForceAtPos() addLocalForceAtLocalPos() + */ + static void addForceAtPos(PxRigidBody& body, const PxVec3& force, const PxVec3& pos, PxForceMode::Enum mode = PxForceMode::eFORCE, bool wakeup = true); + + /** + \brief Applies a force (or impulse) defined in the global coordinate frame, acting at a particular + point in local coordinates, to the actor. + + Note that if the force does not act along the center of mass of the actor, this + will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a + total external force on an object by calling this once every frame. + + \note if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire + articulation + + ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the + force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a + given point. + + Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default). + + \param[in] body The rigid body to apply the force to. + \param[in] force Force/impulse to add, defined in the global frame. Range: force vector + \param[in] pos Position in the local frame to add the force at. Range: position vector + \param[in] mode The mode to use when applying the force/impulse(see #PxForceMode). + \param[in] wakeup Specify if the call should wake up the actor. + + \see PxForceMode + \see addForceAtPos() addLocalForceAtPos() addLocalForceAtLocalPos() + */ + static void addForceAtLocalPos(PxRigidBody& body, const PxVec3& force, const PxVec3& pos, PxForceMode::Enum mode = PxForceMode::eFORCE, bool wakeup = true); + + /** + \brief Applies a force (or impulse) defined in the actor local coordinate frame, acting at a + particular point in global coordinates, to the actor. + + Note that if the force does not act along the center of mass of the actor, this + will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a + total external force on an object by calling this once every frame. + + \note if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire + articulation + + ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the + force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a + given point. + + Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default). + + \param[in] body The rigid body to apply the force to. + \param[in] force Force/impulse to add, defined in the local frame. Range: force vector + \param[in] pos Position in the global frame to add the force at. Range: position vector + \param[in] mode The mode to use when applying the force/impulse(see #PxForceMode). + \param[in] wakeup Specify if the call should wake up the actor. + + \see PxForceMode + \see addForceAtPos() addForceAtLocalPos() addLocalForceAtLocalPos() + */ + static void addLocalForceAtPos(PxRigidBody& body, const PxVec3& force, const PxVec3& pos, PxForceMode::Enum mode = PxForceMode::eFORCE, bool wakeup = true); + + /** + \brief Applies a force (or impulse) defined in the actor local coordinate frame, acting at a + particular point in local coordinates, to the actor. + + Note that if the force does not act along the center of mass of the actor, this + will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a + total external force on an object by calling this once every frame. + + \note if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire + articulation + + ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the + force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a + given point. + + Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default). + + \param[in] body The rigid body to apply the force to. + \param[in] force Force/impulse to add, defined in the local frame. Range: force vector + \param[in] pos Position in the local frame to add the force at. Range: position vector + \param[in] mode The mode to use when applying the force/impulse(see #PxForceMode). + \param[in] wakeup Specify if the call should wake up the actor. + + \see PxForceMode + \see addForceAtPos() addForceAtLocalPos() addLocalForceAtPos() + */ + static void addLocalForceAtLocalPos(PxRigidBody& body, const PxVec3& force, const PxVec3& pos, PxForceMode::Enum mode = PxForceMode::eFORCE, bool wakeup = true); + + /** + \brief Computes the velocity of a point given in world coordinates if it were attached to the + specified body and moving with it. + + \param[in] body The rigid body the point is attached to. + \param[in] pos Position we wish to determine the velocity for, defined in the global frame. Range: position vector + \return The velocity of point in the global frame. + + \see getLocalPointVelocity() + */ + static PxVec3 getVelocityAtPos(const PxRigidBody& body, const PxVec3& pos); + + /** + \brief Computes the velocity of a point given in local coordinates if it were attached to the + specified body and moving with it. + + \param[in] body The rigid body the point is attached to. + \param[in] pos Position we wish to determine the velocity for, defined in the local frame. Range: position vector + \return The velocity of point in the local frame. + + \see getLocalPointVelocity() + */ + static PxVec3 getLocalVelocityAtLocalPos(const PxRigidBody& body, const PxVec3& pos); + + /** + \brief Computes the velocity of a point (offset from the origin of the body) given in world coordinates if it were attached to the + specified body and moving with it. + + \param[in] body The rigid body the point is attached to. + \param[in] pos Position (offset from the origin of the body) we wish to determine the velocity for, defined in the global frame. Range: position vector + \return The velocity of point (offset from the origin of the body) in the global frame. + + \see getLocalPointVelocity() + */ + static PxVec3 getVelocityAtOffset(const PxRigidBody& body, const PxVec3& pos); + + /** + \brief Compute the change to linear and angular velocity that would occur if an impulsive force and torque were to be applied to a specified rigid body. + + The rigid body is left unaffected unless a subsequent independent call is executed that actually applies the computed changes to velocity and angular velocity. + + \note if this call is used to determine the velocity delta for an articulation link, only the mass properties of the link are taken into account. + + \see PxRigidBody::getLinearVelocity, PxRigidBody::setLinearVelocity, PxRigidBody::getAngularVelocity, PxRigidBody::setAngularVelocity + + \param[in] body The body under consideration. + \param[in] impulsiveForce The impulsive force that would be applied to the specified rigid body. + \param[in] impulsiveTorque The impulsive torque that would be applied to the specified rigid body. + \param[out] deltaLinearVelocity The change in linear velocity that would arise if impulsiveForce was to be applied to the specified rigid body. + \param[out] deltaAngularVelocity The change in angular velocity that would arise if impulsiveTorque was to be applied to the specified rigid body. + */ + static void computeVelocityDeltaFromImpulse(const PxRigidBody& body, const PxVec3& impulsiveForce, const PxVec3& impulsiveTorque, PxVec3& deltaLinearVelocity, PxVec3& deltaAngularVelocity); + + /** + \brief Computes the linear and angular velocity change vectors for a given impulse at a world space position taking a mass and inertia scale into account + + This function is useful for extracting the respective linear and angular velocity changes from a contact or joint when the mass/inertia ratios have been adjusted. + + \note if this call is used to determine the velocity delta for an articulation link, only the mass properties of the link are taken into account. + + \param[in] body The rigid body + \param[in] globalPose The body's world space transform + \param[in] point The point in world space where the impulse is applied + \param[in] impulse The impulse vector in world space + \param[in] invMassScale The inverse mass scale + \param[in] invInertiaScale The inverse inertia scale + \param[out] deltaLinearVelocity The linear velocity change + \param[out] deltaAngularVelocity The angular velocity change + */ + static void computeVelocityDeltaFromImpulse(const PxRigidBody& body, const PxTransform& globalPose, const PxVec3& point, const PxVec3& impulse, const PxReal invMassScale, + const PxReal invInertiaScale, PxVec3& deltaLinearVelocity, PxVec3& deltaAngularVelocity); + + /** + \brief Computes the linear and angular impulse vectors for a given impulse at a world space position taking a mass and inertia scale into account + + This function is useful for extracting the respective linear and angular impulses from a contact or joint when the mass/inertia ratios have been adjusted. + + \param[in] body The rigid body + \param[in] globalPose The body's world space transform + \param[in] point The point in world space where the impulse is applied + \param[in] impulse The impulse vector in world space + \param[in] invMassScale The inverse mass scale + \param[in] invInertiaScale The inverse inertia scale + \param[out] linearImpulse The linear impulse + \param[out] angularImpulse The angular impulse + */ + static void computeLinearAngularImpulse(const PxRigidBody& body, const PxTransform& globalPose, const PxVec3& point, const PxVec3& impulse, const PxReal invMassScale, + const PxReal invInertiaScale, PxVec3& linearImpulse, PxVec3& angularImpulse); + + /** + \brief Performs a linear sweep through space with the body's geometry objects. + + \note Supported geometries are: box, sphere, capsule, convex. Other geometry types will be ignored. + \note If eTOUCH is returned from the filter callback, it will trigger an error and the hit will be discarded. + + The function sweeps all shapes attached to a given rigid body through space and reports the nearest + object in the scene which intersects any of of the shapes swept paths. + Information about the closest intersection is written to a #PxSweepHit structure. + + \param[in] body The rigid body to sweep. + \param[in] scene The scene object to process the query. + \param[in] unitDir Normalized direction of the sweep. + \param[in] distance Sweep distance. Needs to be larger than 0. + \param[in] outputFlags Specifies which properties should be written to the hit information. + \param[out] closestHit Closest hit result. + \param[out] shapeIndex Index of the body shape that caused the closest hit. + \param[in] filterData If any word in filterData.data is non-zero then filterData.data will be used for filtering, + otherwise shape->getQueryFilterData() will be used instead. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxQueryFlag flags are set. If NULL, all hits are assumed to be blocking. + \param[in] cache Cached hit shape (optional). Ray is tested against cached shape first then against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. + + \return True if a blocking hit was found. + + \see PxScene PxQueryFlags PxFilterData PxSweepHit + */ + static bool linearSweepSingle( + PxRigidBody& body, PxScene& scene, const PxVec3& unitDir, const PxReal distance, + PxHitFlags outputFlags, + PxSweepHit& closestHit, PxU32& shapeIndex, + const PxQueryFilterData& filterData = PxQueryFilterData(), + PxQueryFilterCallback* filterCall = NULL, + const PxQueryCache* cache = NULL, + const PxReal inflation=0.0f); + + /** + \brief Performs a linear sweep through space with the body's geometry objects, returning all overlaps. + + \note Supported geometries are: box, sphere, capsule, convex. Other geometry types will be ignored. + + This function sweeps all shapes attached to a given rigid body through space and reports all + objects in the scene that intersect any of the shapes' swept paths until there are no more objects to report + or a blocking hit is encountered. + + \param[in] body The rigid body to sweep. + \param[in] scene The scene object to process the query. + \param[in] unitDir Normalized direction of the sweep. + \param[in] distance Sweep distance. Needs to be larger than 0. + \param[in] outputFlags Specifies which properties should be written to the hit information. + \param[out] touchHitBuffer Raycast hit information buffer. If the buffer overflows, an arbitrary subset of touch hits + is returned (typically the query should be restarted with a larger buffer). + \param[out] touchHitShapeIndices After the query is completed, touchHitShapeIndices[i] will contain the body index that caused the hit stored in hitBuffer[i] + \param[in] touchHitBufferSize Size of both touch hit buffers in elements. + \param[out] block Closest blocking hit is returned via this reference. + \param[out] blockingShapeIndex Set to -1 if if a blocking hit was not found, otherwise set to closest blocking hit shape index. The touching hits are reported separately in hitBuffer. + \param[out] overflow Set to true if touchHitBuffer didn't have enough space for all results. Touch hits will be incomplete if overflow occurred. Possible solution is to restart the query with a larger buffer. + \param[in] filterData If any word in filterData.data is non-zero then filterData.data will be used for filtering, + otherwise shape->getQueryFilterData() will be used instead. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxQueryFlag flags are set. If NULL, all hits are assumed to be blocking. + \param[in] cache Cached hit shape (optional). Ray is tested against cached shape first then against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. + + \return the number of touching hits. If overflow is set to true, the results are incomplete. In case of overflow there are also no guarantees that all touching hits returned are closer than the blocking hit. + + \see PxScene PxQueryFlags PxFilterData PxSweepHit + */ + static PxU32 linearSweepMultiple( + PxRigidBody& body, PxScene& scene, const PxVec3& unitDir, const PxReal distance, + PxHitFlags outputFlags, + PxSweepHit* touchHitBuffer, PxU32* touchHitShapeIndices, PxU32 touchHitBufferSize, + PxSweepHit& block, PxI32& blockingShapeIndex, bool& overflow, + const PxQueryFilterData& filterData = PxQueryFilterData(), + PxQueryFilterCallback* filterCall = NULL, + const PxQueryCache* cache = NULL, const PxReal inflation = 0.0f); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxSamplingExt.h b/engine/third_party/physx/include/extensions/PxSamplingExt.h new file mode 100644 index 00000000..e1b456d8 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxSamplingExt.h @@ -0,0 +1,183 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SAMPLING_EXT_H +#define PX_SAMPLING_EXT_H + +#include "foundation/PxTransform.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxArray.h" +#include "geometry/PxGeometry.h" +#include "foundation/PxUserAllocated.h" +#include "geometry/PxSimpleTriangleMesh.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief utility functions to sample vertices on or inside a triangle mesh or other geometries +*/ +class PxSamplingExt +{ +public: + /** Computes samples on a triangle mesh's surface that are not closer to each other than a given distance. Optionally the mesh's interior can be filled with samples as well. + + \param[in] mesh The triangle mesh + \param[in] r The closest distance two surface samples are allowed to have + \param[out] result Equally distributed samples on and if specified inside the triangle mesh + \param[in] rVolume The average distance of samples inside the mesh. If set to zero, samples will only be placed on the mesh's surface + \param[out] triangleIds Optional output containing the index of the triangle for all samples on the mesh's surface. The array will contain less entries than output vertices if volume samples are active since volume samples are not on the surface. + \param[out] barycentricCoordinates Optional output containing the barycentric coordinates for all samples on the mesh's surface. The array will contain less entries than output vertices if volume samples are active since volume samples are not on the surface. + \param[in] axisAlignedBox A box that limits the space where samples can get created + \param[in] boxOrientation The orientation of the box that limits the space where samples can get created + \param[in] maxNumSamples If larger than zero, the sampler will stop when the sample count reaches maxNumSamples + \param[in] numSampleAttemptsAroundPoint Number of repetitions the underlying algorithm performs to find a new valid sample that matches all criteria like minimal distance to existing samples etc. + \return Returns true if the sampling was successful and false if there was a problem. Usually an internal overflow is the problem for very big meshes or very small sampling radii. + */ + static bool poissonSample(const PxSimpleTriangleMesh& mesh, PxReal r, PxArray& result, PxReal rVolume = 0.0f, PxArray* triangleIds = NULL, PxArray* barycentricCoordinates = NULL, + const PxBounds3* axisAlignedBox = NULL, const PxQuat* boxOrientation = NULL, PxU32 maxNumSamples = 0, PxU32 numSampleAttemptsAroundPoint = 30); + + /** Computes samples on a geometry's surface that are not closer to each other than a given distance. + + \param[in] geometry The geometry that defines the surface on which the samples get created + \param[in] transform The geometry's global pose + \param[in] worldBounds The geometry's bounding box + \param[in] r The closest distance two surface samples are allowed to have + \param[out] result Equally distributed samples on and if specified inside the triangle mesh + \param[in] rVolume The average distance of samples inside the mesh. If set to zero, samples will only be placed on the mesh's surface + \param[in] axisAlignedBox A box that limits the space where samples can get created + \param[in] boxOrientation The orientation of the box that limits the space where samples can get created + \param[in] maxNumSamples If larger than zero, the sampler will stop when the sample count reaches maxNumSamples + \param[in] numSampleAttemptsAroundPoint Number of repetitions the underlying algorithm performs to find a new valid sample that matches all criteria like minimal distance to existing samples etc. + \return Returns true if the sampling was successful and false if there was a problem. Usually an internal overflow is the problem for very big meshes or very small sampling radii. + */ + static bool poissonSample(const PxGeometry& geometry, const PxTransform& transform, const PxBounds3& worldBounds, PxReal r, PxArray& result, PxReal rVolume = 0.0f, + const PxBounds3* axisAlignedBox = NULL, const PxQuat* boxOrientation = NULL, PxU32 maxNumSamples = 0, PxU32 numSampleAttemptsAroundPoint = 30); +}; + +/** +\brief Sampler to generate Poisson Samples locally on a triangle mesh or a shape. For every local addition of new samples, an individual sampling density can be used. +*/ +class PxPoissonSampler : public PxUserAllocated +{ +public: + /** Sets the sampling radius + \param[in] samplingRadius The closest distance two surface samples are allowed to have. Changing the sampling radius is a bit an expensive operation. + \return Returns true if the sampling was successful and false if there was a problem. Usually an internal overflow is the problem for very big meshes or very small sampling radii. + */ + virtual bool setSamplingRadius(PxReal samplingRadius) = 0; + + /** Adds samples + \param[in] samples The samples to add. Adding samples is a bit an expensive operation. + */ + virtual void addSamples(const PxArray& samples) = 0; + + /** Adds samples + \param[in] samples The samples to remove. Removing samples is a bit an expensive operation. + \return Returns the number of removed samples. If some samples were not found, then the number of actually removed samples will be smaller than the number of samples requested to remove + */ + virtual PxU32 removeSamples(const PxArray& samples) = 0; + + /** Adds new Poisson Samples inside the sphere specified + \param[in] sphereCenter The sphere's center. Used to define the region where new samples get added. + \param[in] sphereRadius The sphere's radius. Used to define the region where new samples get added. + \param[in] createVolumeSamples If set to true, samples will also get generated inside of the mesh, not just on its surface. + */ + virtual void addSamplesInSphere(const PxVec3& sphereCenter, PxReal sphereRadius, bool createVolumeSamples = false) = 0; + + /** Adds new Poisson Samples inside the box specified + \param[in] axisAlignedBox The axis aligned bounding box. Used to define the region where new samples get added. + \param[in] boxOrientation The orientation making an oriented bounding box out of the axis aligned one. Used to define the region where new samples get added. + \param[in] createVolumeSamples If set to true, samples will also get generated inside of the mesh, not just on its surface. + */ + virtual void addSamplesInBox(const PxBounds3& axisAlignedBox, const PxQuat& boxOrientation, bool createVolumeSamples = false) = 0; + + /** Gets the Poisson Samples + \return Returns the generated Poisson Samples + */ + virtual const PxArray& getSamples() const = 0; + + virtual ~PxPoissonSampler() { } +}; + + +/** Creates a shape sampler +\param[in] geometry The shape that defines the surface on which the samples get created +\param[in] transform The shape's global pose +\param[in] worldBounds The shapes bounding box +\param[in] initialSamplingRadius The closest distance two surface samples are allowed to have +\param[in] numSampleAttemptsAroundPoint Number of repetitions the underlying algorithm performs to find a new valid sample that matches all criteria like minimal distance to existing samples etc. +\return Returns the sampler +*/ +PxPoissonSampler* PxCreateShapeSampler(const PxGeometry& geometry, const PxTransform& transform, const PxBounds3& worldBounds, PxReal initialSamplingRadius, PxI32 numSampleAttemptsAroundPoint = 30); + + +/** +\brief Sampler to generate Poisson Samples on a triangle mesh. +*/ +class PxTriangleMeshPoissonSampler : public virtual PxPoissonSampler +{ +public: + /** Gets the Poisson Samples' triangle indices + \return Returns the generated Poisson Samples' triangle indices + */ + virtual const PxArray& getSampleTriangleIds() const = 0; + + /** Gets the Poisson Samples' barycentric coordinates + \return Returns the generated Poisson Samples' barycentric coordinates + */ + virtual const PxArray& getSampleBarycentrics() const = 0; + + /** Checks whether a point is inside the triangle mesh + \return Returns true if the point is inside the triangle mesh + */ + virtual bool isPointInTriangleMesh(const PxVec3& p) = 0; + + virtual ~PxTriangleMeshPoissonSampler() { } +}; + + +/** Creates a triangle mesh sampler +\param[in] triangles The triangle indices of the mesh +\param[in] numTriangles The total number of triangles +\param[in] vertices The vertices of the mesh +\param[in] numVertices The total number of vertices +\param[in] initialSamplingRadius The closest distance two surface samples are allowed to have +\param[in] numSampleAttemptsAroundPoint Number of repetitions the underlying algorithm performs to find a new valid sample that matches all criteria like minimal distance to existing samples etc. +\return Returns the sampler +*/ +PxTriangleMeshPoissonSampler* PxCreateTriangleMeshSampler(const PxU32* triangles, PxU32 numTriangles, const PxVec3* vertices, PxU32 numVertices, PxReal initialSamplingRadius, PxI32 numSampleAttemptsAroundPoint = 30); + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxSceneQueryExt.h b/engine/third_party/physx/include/extensions/PxSceneQueryExt.h new file mode 100644 index 00000000..442e8028 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxSceneQueryExt.h @@ -0,0 +1,504 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SCENE_QUERY_EXT_H +#define PX_SCENE_QUERY_EXT_H + +#include "PxPhysXConfig.h" + +#include "PxScene.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +// These types have been deprecated (removed) in PhysX 3.4. We typedef them to the new types here for easy migration from 3.3 to 3.4. +// We will not remove these aliases for convenience. +typedef PxQueryHit PxSceneQueryHit; +typedef PxQueryFilterData PxSceneQueryFilterData; +typedef PxQueryFilterCallback PxSceneQueryFilterCallback; +typedef PxQueryCache PxSceneQueryCache; +typedef PxHitFlag PxSceneQueryFlag; +typedef PxHitFlags PxSceneQueryFlags; + +/** +\brief Utility functions for use with PxScene, related to scene queries. + +Some of these functions have been deprecated (removed) in PhysX 3.4. We re-implement them here for easy migration from 3.3 to 3.4. +We will not remove them for convenience. +*/ +class PxSceneQueryExt +{ +public: + + /** + \brief Raycast returning any blocking hit, not necessarily the closest. + + Returns whether any rigid actor is hit along the ray. + + \note Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in article SceneQuery. User can ignore such objects by using one of the provided filter mechanisms. + + \param[in] scene The scene + \param[in] origin Origin of the ray. + \param[in] unitDir Normalized direction of the ray. + \param[in] distance Length of the ray. Needs to be larger than 0. + \param[out] hit Raycast hit information. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to be blocking. + \param[in] cache Cached hit shape (optional). Ray is tested against cached shape first. If no hit is found the ray gets queried against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \return True if a blocking hit was found. + + \see PxSceneQueryFilterData PxSceneQueryFilterCallback PxSceneQueryCache PxSceneQueryHit + */ + static bool raycastAny( const PxScene& scene, + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryHit& hit, const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL, const PxSceneQueryCache* cache = NULL); + + /** + \brief Raycast returning a single result. + + Returns the first rigid actor that is hit along the ray. Data for a blocking hit will be returned as specified by the outputFlags field. Touching hits will be ignored. + + \note Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in article SceneQuery. User can ignore such objects by using one of the provided filter mechanisms. + + \param[in] scene The scene + \param[in] origin Origin of the ray. + \param[in] unitDir Normalized direction of the ray. + \param[in] distance Length of the ray. Needs to be larger than 0. + \param[in] outputFlags Specifies which properties should be written to the hit information + \param[out] hit Raycast hit information. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to be blocking. + \param[in] cache Cached hit shape (optional). Ray is tested against cached shape first then against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \return True if a blocking hit was found. + + \see PxSceneQueryFlags PxRaycastHit PxSceneQueryFilterData PxSceneQueryFilterCallback PxSceneQueryCache + */ + static bool raycastSingle( const PxScene& scene, + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags outputFlags, PxRaycastHit& hit, + const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL, const PxSceneQueryCache* cache = NULL); + + /** + \brief Raycast returning multiple results. + + Find all rigid actors that get hit along the ray. Each result contains data as specified by the outputFlags field. + + \note Touching hits are not ordered. + + \note Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in article SceneQuery. User can ignore such objects by using one of the provided filter mechanisms. + + \param[in] scene The scene + \param[in] origin Origin of the ray. + \param[in] unitDir Normalized direction of the ray. + \param[in] distance Length of the ray. Needs to be larger than 0. + \param[in] outputFlags Specifies which properties should be written to the hit information + \param[out] hitBuffer Raycast hit information buffer. If the buffer overflows, the blocking hit is returned as the last entry together with an arbitrary subset + of the nearer touching hits (typically the query should be restarted with a larger buffer). + \param[in] hitBufferSize Size of the hit buffer. + \param[out] blockingHit True if a blocking hit was found. If found, it is the last in the buffer, preceded by any touching hits which are closer. Otherwise the touching hits are listed. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to be touching. + \param[in] cache Cached hit shape (optional). Ray is tested against cached shape first then against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \return Number of hits in the buffer, or -1 if the buffer overflowed. + + \see PxSceneQueryFlags PxRaycastHit PxSceneQueryFilterData PxSceneQueryFilterCallback PxSceneQueryCache + */ + static PxI32 raycastMultiple( const PxScene& scene, + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags outputFlags, + PxRaycastHit* hitBuffer, PxU32 hitBufferSize, bool& blockingHit, + const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL, const PxSceneQueryCache* cache = NULL); + + /** + \brief Sweep returning any blocking hit, not necessarily the closest. + + Returns whether any rigid actor is hit along the sweep path. + + \note If a shape from the scene is already overlapping with the query shape in its starting position, behavior is controlled by the PxSceneQueryFlag::eINITIAL_OVERLAP flag. + + \param[in] scene The scene + \param[in] geometry Geometry of object to sweep (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the sweep object. + \param[in] unitDir Normalized direction of the sweep. + \param[in] distance Sweep distance. Needs to be larger than 0. Will be clamped to PX_MAX_SWEEP_DISTANCE. + \param[in] queryFlags Combination of PxSceneQueryFlag defining the query behavior + \param[out] hit Sweep hit information. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to be blocking. + \param[in] cache Cached hit shape (optional). Sweep is performed against cached shape first. If no hit is found the sweep gets queried against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. + \return True if a blocking hit was found. + + \see PxSceneQueryFilterData PxSceneQueryFilterCallback PxSceneQueryHit PxSceneQueryCache + */ + static bool sweepAny( const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags queryFlags, + PxSceneQueryHit& hit, + const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL, + const PxSceneQueryCache* cache = NULL, + PxReal inflation = 0.0f); + + /** + \brief Sweep returning a single result. + + Returns the first rigid actor that is hit along the ray. Data for a blocking hit will be returned as specified by the outputFlags field. Touching hits will be ignored. + + \note If a shape from the scene is already overlapping with the query shape in its starting position, behavior is controlled by the PxSceneQueryFlag::eINITIAL_OVERLAP flag. + + \param[in] scene The scene + \param[in] geometry Geometry of object to sweep (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the sweep object. + \param[in] unitDir Normalized direction of the sweep. + \param[in] distance Sweep distance. Needs to be larger than 0. Will be clamped to PX_MAX_SWEEP_DISTANCE. + \param[in] outputFlags Specifies which properties should be written to the hit information. + \param[out] hit Sweep hit information. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to be blocking. + \param[in] cache Cached hit shape (optional). Sweep is performed against cached shape first then against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. + \return True if a blocking hit was found. + + \see PxSceneQueryFlags PxSweepHit PxSceneQueryFilterData PxSceneQueryFilterCallback PxSceneQueryCache + */ + static bool sweepSingle(const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags outputFlags, + PxSweepHit& hit, + const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL, + const PxSceneQueryCache* cache = NULL, + PxReal inflation=0.0f); + + /** + \brief Sweep returning multiple results. + + Find all rigid actors that get hit along the sweep. Each result contains data as specified by the outputFlags field. + + \note Touching hits are not ordered. + + \note If a shape from the scene is already overlapping with the query shape in its starting position, behavior is controlled by the PxSceneQueryFlag::eINITIAL_OVERLAP flag. + + \param[in] scene The scene + \param[in] geometry Geometry of object to sweep (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the sweep object. + \param[in] unitDir Normalized direction of the sweep. + \param[in] distance Sweep distance. Needs to be larger than 0. Will be clamped to PX_MAX_SWEEP_DISTANCE. + \param[in] outputFlags Specifies which properties should be written to the hit information. + \param[out] hitBuffer Sweep hit information buffer. If the buffer overflows, the blocking hit is returned as the last entry together with an arbitrary subset + of the nearer touching hits (typically the query should be restarted with a larger buffer). + \param[in] hitBufferSize Size of the hit buffer. + \param[out] blockingHit True if a blocking hit was found. If found, it is the last in the buffer, preceded by any touching hits which are closer. Otherwise the touching hits are listed. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to be touching. + \param[in] cache Cached hit shape (optional). Sweep is performed against cached shape first then against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. + \return Number of hits in the buffer, or -1 if the buffer overflowed. + + \see PxSceneQueryFlags PxSweepHit PxSceneQueryFilterData PxSceneQueryFilterCallback PxSceneQueryCache + */ + static PxI32 sweepMultiple( const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags outputFlags, PxSweepHit* hitBuffer, PxU32 hitBufferSize, bool& blockingHit, + const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL, const PxSceneQueryCache* cache = NULL, + PxReal inflation = 0.0f); + + /** + \brief Test overlap between a geometry and objects in the scene. + + \note Filtering: Overlap tests do not distinguish between touching and blocking hit types. Both get written to the hit buffer. + + \note PxHitFlag::eMESH_MULTIPLE and PxHitFlag::eMESH_BOTH_SIDES have no effect in this case + + \param[in] scene The scene + \param[in] geometry Geometry of object to check for overlap (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the object. + \param[out] hitBuffer Buffer to store the overlapping objects to. If the buffer overflows, an arbitrary subset of overlapping objects is stored (typically the query should be restarted with a larger buffer). + \param[in] hitBufferSize Size of the hit buffer. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to overlap. + \return Number of hits in the buffer, or -1 if the buffer overflowed. + + \see PxSceneQueryFlags PxSceneQueryFilterData PxSceneQueryFilterCallback + */ + static PxI32 overlapMultiple( const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, + PxOverlapHit* hitBuffer, PxU32 hitBufferSize, + const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL); + + /** + \brief Test returning, for a given geometry, any overlapping object in the scene. + + \note Filtering: Overlap tests do not distinguish between touching and blocking hit types. Both trigger a hit. + + \note PxHitFlag::eMESH_MULTIPLE and PxHitFlag::eMESH_BOTH_SIDES have no effect in this case + + \param[in] scene The scene + \param[in] geometry Geometry of object to check for overlap (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the object. + \param[out] hit Pointer to store the overlapping object to. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to overlap. + \return True if an overlap was found. + + \see PxSceneQueryFlags PxSceneQueryFilterData PxSceneQueryFilterCallback + */ + static bool overlapAny( const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, + PxOverlapHit& hit, + const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL); +}; + +struct PxBatchQueryStatus +{ + enum Enum + { + /** + \brief This is the initial state before a query starts. + */ + ePENDING = 0, + + /** + \brief The query is finished; results have been written into the result and hit buffers. + */ + eSUCCESS, + + /** + \brief The query results were incomplete due to touch hit buffer overflow. Blocking hit is still correct. + */ + eOVERFLOW + }; + + static PX_FORCE_INLINE Enum getStatus(const PxRaycastBuffer& r) + { + return (0xffffffff == r.nbTouches) ? ePENDING : (0xffffffff == r.maxNbTouches ? eOVERFLOW : eSUCCESS); + } + static PX_FORCE_INLINE Enum getStatus(const PxSweepBuffer& r) + { + return (0xffffffff == r.nbTouches) ? ePENDING : (0xffffffff == r.maxNbTouches ? eOVERFLOW : eSUCCESS); + } + static PX_FORCE_INLINE Enum getStatus(const PxOverlapBuffer& r) + { + return (0xffffffff == r.nbTouches) ? ePENDING : (0xffffffff == r.maxNbTouches ? eOVERFLOW : eSUCCESS); + } +}; + +class PxBatchQueryExt +{ +public: + + virtual void release() = 0; + + /** + \brief Performs a raycast against objects in the scene. + + \note Touching hits are not ordered. + \note Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in article SceneQuery. User can ignore such objects by using one of the provided filter mechanisms. + + \param[in] origin Origin of the ray. + \param[in] unitDir Normalized direction of the ray. + \param[in] distance Length of the ray. Needs to be larger than 0. + \param[in] maxNbTouches Maximum number of hits to record in the touch buffer for this query. Default=0 reports a single blocking hit. If maxTouchHits is set to 0 all hits are treated as blocking by default. + \param[in] hitFlags Specifies which properties per hit should be computed and returned in hit array and blocking hit. + \param[in] filterData Filtering data passed to the filter shader. See #PxQueryFilterData #PxQueryFilterCallback + \param[in] cache Cached hit shape (optional). Query is tested against cached shape first. If no hit is found the ray gets queried against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + + \note This query call writes to a list associated with the query object and is NOT thread safe (for performance reasons there is no lock + and overlapping writes from different threads may result in undefined behavior). + + \return Returns a PxRaycastBuffer pointer that will store the result of the query after execute() is completed. + This will point either to an element of the buffer allocated on construction or to a user buffer passed to the constructor. + \see PxCreateBatchQueryExt + + \see PxQueryFilterData PxQueryFilterCallback PxRaycastHit PxScene::raycast + */ + virtual PxRaycastBuffer* raycast( + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + const PxU16 maxNbTouches = 0, + PxHitFlags hitFlags = PxHitFlags(PxHitFlag::eDEFAULT), + const PxQueryFilterData& filterData = PxQueryFilterData(), + const PxQueryCache* cache = NULL) = 0; + + /** + \brief Performs a sweep test against objects in the scene. + + \note Touching hits are not ordered. + \note If a shape from the scene is already overlapping with the query shape in its starting position, + the hit is returned unless eASSUME_NO_INITIAL_OVERLAP was specified. + + \param[in] geometry Geometry of object to sweep (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the sweep object. + \param[in] unitDir Normalized direction of the sweep. + \param[in] distance Sweep distance. Needs to be larger than 0. Will be clamped to PX_MAX_SWEEP_DISTANCE. + \param[in] maxNbTouches Maximum number of hits to record in the touch buffer for this query. Default=0 reports a single blocking hit. If maxTouchHits is set to 0 all hits are treated as blocking by default. + \param[in] hitFlags Specifies which properties per hit should be computed and returned in hit array and blocking hit. + \param[in] filterData Filtering data and simple logic. See #PxQueryFilterData #PxQueryFilterCallback + \param[in] cache Cached hit shape (optional). Query is tested against cached shape first. If no hit is found the ray gets queried against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. + Note: ePRECISE_SWEEP doesn't support inflation. Therefore the sweep will be performed with zero inflation. + + \note This query call writes to a list associated with the query object and is NOT thread safe (for performance reasons there is no lock + and overlapping writes from different threads may result in undefined behavior). + + \return Returns a PxSweepBuffer pointer that will store the result of the query after execute() is completed. + This will point either to an element of the buffer allocated on construction or to a user buffer passed to the constructor. + \see PxCreateBatchQueryExt + + \see PxHitFlags PxQueryFilterData PxBatchQueryPreFilterShader PxBatchQueryPostFilterShader PxSweepHit + */ + virtual PxSweepBuffer* sweep( + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + const PxU16 maxNbTouches = 0, + PxHitFlags hitFlags = PxHitFlags(PxHitFlag::eDEFAULT), + const PxQueryFilterData& filterData = PxQueryFilterData(), + const PxQueryCache* cache = NULL, + const PxReal inflation = 0.0f) = 0; + + + /** + \brief Performs an overlap test of a given geometry against objects in the scene. + + \note Filtering: returning eBLOCK from user filter for overlap queries will cause a warning (see #PxQueryHitType). + + \param[in] geometry Geometry of object to check for overlap (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the object. + \param[in] maxNbTouches Maximum number of hits to record in the touch buffer for this query. Default=0 reports a single blocking hit. If maxTouchHits is set to 0 all hits are treated as blocking by default. + \param[in] filterData Filtering data and simple logic. See #PxQueryFilterData #PxQueryFilterCallback + \param[in] cache Cached hit shape (optional). Query is tested against cached shape first. If no hit is found the ray gets queried against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + + \note eBLOCK should not be returned from user filters for overlap(). Doing so will result in undefined behavior, and a warning will be issued. + \note If the PxQueryFlag::eNO_BLOCK flag is set, the eBLOCK will instead be automatically converted to an eTOUCH and the warning suppressed. + \note This query call writes to a list associated with the query object and is NOT thread safe (for performance reasons there is no lock + and overlapping writes from different threads may result in undefined behavior). + + \return Returns a PxOverlapBuffer pointer that will store the result of the query after execute() is completed. + This will point either to an element of the buffer allocated on construction or to a user buffer passed to the constructor. + \see PxCreateBatchQueryExt + + \see PxQueryFilterData PxQueryFilterCallback + */ + virtual PxOverlapBuffer* overlap( + const PxGeometry& geometry, const PxTransform& pose, + PxU16 maxNbTouches = 0, + const PxQueryFilterData& filterData = PxQueryFilterData(), + const PxQueryCache* cache = NULL) = 0; + + virtual void execute() = 0; + +protected: + + virtual ~PxBatchQueryExt() {} +}; + +/** +\brief Create a PxBatchQueryExt without the need for pre-allocated result or touch buffers. + +\param[in] scene Queries will be performed against objects in the specified PxScene +\param[in] queryFilterCallback Filtering for all queries is performed using queryFilterCallback. A null pointer results in all shapes being considered. + +\param[in] maxNbRaycasts A result buffer will be allocated that is large enough to accommodate maxNbRaycasts calls to PxBatchQueryExt::raycast() +\param[in] maxNbRaycastTouches A touch buffer will be allocated that is large enough to accommodate maxNbRaycastTouches touches for all raycasts in the batch. + +\param[in] maxNbSweeps A result buffer will be allocated that is large enough to accommodate maxNbSweeps calls to PxBatchQueryExt::sweep() +\param[in] maxNbSweepTouches A touch buffer will be allocated that is large enough to accommodate maxNbSweepTouches touches for all sweeps in the batch. + +\param[in] maxNbOverlaps A result buffer will be allocated that is large enough to accommodate maxNbOverlaps calls to PxBatchQueryExt::overlap() +\param[in] maxNbOverlapTouches A touch buffer will be allocated that is large enough to accommodate maxNbOverlapTouches touches for all overlaps in the batch. + +\return Returns a PxBatchQueryExt instance. A NULL pointer will be returned if the subsequent allocations fail or if any of the arguments are illegal. +In the event that a NULL pointer is returned a corresponding error will be issued to the error stream. +*/ +PxBatchQueryExt* PxCreateBatchQueryExt( + const PxScene& scene, PxQueryFilterCallback* queryFilterCallback, + const PxU32 maxNbRaycasts, const PxU32 maxNbRaycastTouches, + const PxU32 maxNbSweeps, const PxU32 maxNbSweepTouches, + const PxU32 maxNbOverlaps, const PxU32 maxNbOverlapTouches); + + +/** +\brief Create a PxBatchQueryExt with user-supplied result and touch buffers. + +\param[in] scene Queries will be performed against objects in the specified PxScene +\param[in] queryFilterCallback Filtering for all queries is performed using queryFilterCallback. A null pointer results in all shapes being considered. + +\param[in] raycastBuffers This is the array that will be used to store the results of each raycast in a batch. +\param[in] maxNbRaycasts This is the length of the raycastBuffers array. +\param[in] raycastTouches This is the array that will be used to store the touches generated by all raycasts in a batch. +\param[in] maxNbRaycastTouches This is the length of the raycastTouches array. + +\param[in] sweepBuffers This is the array that will be used to store the results of each sweep in a batch. +\param[in] maxNbSweeps This is the length of the sweepBuffers array. +\param[in] sweepTouches This is the array that will be used to store the touches generated by all sweeps in a batch. +\param[in] maxNbSweepTouches This is the length of the sweepTouches array. + +\param[in] overlapBuffers This is the array that will be used to store the results of each overlap in a batch. +\param[in] maxNbOverlaps This is the length of the overlapBuffers array. +\param[in] overlapTouches This is the array that will be used to store the touches generated by all overlaps in a batch. +\param[in] maxNbOverlapTouches This is the length of the overlapTouches array. + +\return Returns a PxBatchQueryExt instance. A NULL pointer will be returned if the subsequent allocations fail or if any of the arguments are illegal. +In the event that a NULL pointer is returned a corresponding error will be issued to the error stream. +*/ +PxBatchQueryExt* PxCreateBatchQueryExt( + const PxScene& scene, PxQueryFilterCallback* queryFilterCallback, + PxRaycastBuffer* raycastBuffers, const PxU32 maxNbRaycasts, PxRaycastHit* raycastTouches, const PxU32 maxNbRaycastTouches, + PxSweepBuffer* sweepBuffers, const PxU32 maxNbSweeps, PxSweepHit* sweepTouches, const PxU32 maxNbSweepTouches, + PxOverlapBuffer* overlapBuffers, const PxU32 maxNbOverlaps, PxOverlapHit* overlapTouches, const PxU32 maxNbOverlapTouches); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxSceneQuerySystemExt.h b/engine/third_party/physx/include/extensions/PxSceneQuerySystemExt.h new file mode 100644 index 00000000..53aa6fc5 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxSceneQuerySystemExt.h @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SCENE_QUERY_SYSTEM_EXT_H +#define PX_SCENE_QUERY_SYSTEM_EXT_H + +#include "PxSceneQuerySystem.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Creates an external scene query system. + + An external SQ system is the part of a PxScene that deals with scene queries (SQ). This is usually taken care of + by an internal implementation inside PxScene, but it is also possible to re-route all SQ calls to an external + implementation, potentially opening the door to some customizations in behavior and features for advanced users. + + The following external SQ system is an example of how an implementation would look like. It re-uses much of the + same code as the internal version, but it could be re-implemented in a completely different way to match users' + specific needs. + + \param[in] desc Scene query descriptor + \param[in] contextID Context ID parameter, sent to the profiler + + \return An external SQ system instance + + \see PxSceneQuerySystem PxSceneQueryDesc + */ + PxSceneQuerySystem* PxCreateExternalSceneQuerySystem(const PxSceneQueryDesc& desc, PxU64 contextID); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxSerialization.h b/engine/third_party/physx/include/extensions/PxSerialization.h new file mode 100644 index 00000000..03d0c2b7 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxSerialization.h @@ -0,0 +1,251 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SERIALIZATION_H +#define PX_SERIALIZATION_H + +#include "PxPhysXConfig.h" +#include "common/PxBase.h" +#include "cooking/PxCooking.h" +#include "foundation/PxIO.h" +#include "common/PxTolerancesScale.h" +#include "common/PxTypeInfo.h" +#include "common/PxStringTable.h" + +/** +PX_BINARY_SERIAL_VERSION is used to version the PhysX binary data and meta data. The global unique identifier of the PhysX SDK needs to match +the one in the data and meta data, otherwise they are considered incompatible. A 32 character wide GUID can be generated with https://www.guidgenerator.com/ for example. +*/ +#define PX_BINARY_SERIAL_VERSION "49FB7605F83144B6825C2673CF3840C9" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Utility functions for serialization + +\see PxCollection, PxSerializationRegistry +*/ +class PxSerialization +{ +public: + /** + \brief Additional PxScene and PxPhysics options stored in XML serialized data. + + \deprecated Xml serialization is deprecated. An alternative serialization system is provided through USD Physics. + + The PxXmlMiscParameter parameter can be serialized and deserialized along with PxCollection instances (XML only). + This is for application use only and has no impact on how objects are serialized or deserialized. + + \see PxSerialization::createCollectionFromXml, PxSerialization::serializeCollectionToXml + */ + struct PX_DEPRECATED PxXmlMiscParameter + { + /** + \brief Up vector for the scene reference coordinate system. + */ + PxVec3 upVector; + + /** + \brief Tolerances scale to be used for the scene. + */ + PxTolerancesScale scale; + + PxXmlMiscParameter() : upVector(0) {} + PxXmlMiscParameter(PxVec3& inUpVector, PxTolerancesScale inScale) : upVector(inUpVector), scale(inScale) {} + }; + + /** + \brief Returns whether the collection is serializable with the externalReferences collection. + + Some definitions to explain whether a collection can be serialized or not: + + For definitions of requires and complete see #PxSerialization::complete + + A serializable object is subordinate if it cannot be serialized on its own + The following objects are subordinate: + - articulation links + - articulation joints + - joints + + A collection C can be serialized with external references collection D iff + - C is complete relative to D (no dangling references) + - Every object in D required by an object in C has a valid ID (no unnamed references) + - Every subordinate object in C is required by another object in C (no orphans) + + \param[in] collection Collection to be checked + \param[in] sr PxSerializationRegistry instance with information about registered classes. + \param[in] externalReferences the external References collection + \return Whether the collection is serializable + \see PxSerialization::complete, PxSerialization::serializeCollectionToBinary, PxSerialization::serializeCollectionToXml, PxSerializationRegistry + */ + static bool isSerializable(PxCollection& collection, PxSerializationRegistry& sr, const PxCollection* externalReferences = NULL); + + /** + \brief Adds to a collection all objects such that it can be successfully serialized. + + A collection C is complete relative to an other collection D if every object required by C is either in C or D. + This function adds objects to a collection, such that it becomes complete with respect to the exceptFor collection. + Completeness is needed for serialization. See #PxSerialization::serializeCollectionToBinary, + #PxSerialization::serializeCollectionToXml. + + Sdk objects require other sdk object according to the following rules: + - joints require their actors and constraint + - rigid actors require their shapes + - shapes require their material(s) and mesh (triangle mesh, convex mesh or height field), if any + - articulations require their links and joints + - aggregates require their actors + + If followJoints is specified another rule is added: + - actors require their joints + + Specifying followJoints will make whole jointed actor chains being added to the collection. Following chains + is interrupted whenever a object in exceptFor is encountered. + + \param[in,out] collection Collection which is completed + \param[in] sr PxSerializationRegistry instance with information about registered classes. + \param[in] exceptFor Optional exemption collection + \param[in] followJoints Specifies whether joints should be added for jointed actors + \see PxCollection, PxSerialization::serializeCollectionToBinary, PxSerialization::serializeCollectionToXml, PxSerializationRegistry + */ + static void complete(PxCollection& collection, PxSerializationRegistry& sr, const PxCollection* exceptFor = NULL, bool followJoints = false); + + /** + \brief Creates PxSerialObjectId values for unnamed objects in a collection. + + Creates PxSerialObjectId names for unnamed objects in a collection starting at a base value and incrementing, + skipping values that are already assigned to objects in the collection. + + \param[in,out] collection Collection for which names are created + \param[in] base Start address for PxSerialObjectId names + \see PxCollection + */ + static void createSerialObjectIds(PxCollection& collection, const PxSerialObjectId base); + + /** + \brief Creates a PxCollection from XML data. + + \deprecated Xml serialization is deprecated. An alternative serialization system is provided through USD Physics. + + \param inputData The input data containing the XML collection. + \param params Cooking parameters used for sdk object instantiation. + \param sr PxSerializationRegistry instance with information about registered classes. + \param externalRefs PxCollection used to resolve external references. + \param stringTable PxStringTable instance used for storing object names. + \param outArgs Optional parameters of physics and scene deserialized from XML. See #PxSerialization::PxXmlMiscParameter + \return a pointer to a PxCollection if successful or NULL if it failed. + + \see PxCollection, PxSerializationRegistry, PxInputData, PxStringTable, PxCooking, PxSerialization::PxXmlMiscParameter + */ + PX_DEPRECATED static PxCollection* createCollectionFromXml(PxInputData& inputData, const PxCookingParams& params, PxSerializationRegistry& sr, const PxCollection* externalRefs = NULL, PxStringTable* stringTable = NULL, PxXmlMiscParameter* outArgs = NULL); + + /** + \brief Deserializes a PxCollection from memory. + + Creates a collection from memory. If the collection has external dependencies another collection + can be provided to resolve these. + + The memory block provided has to be 128 bytes aligned and contain a contiguous serialized collection as written + by PxSerialization::serializeCollectionToBinary. The contained binary data needs to be compatible with the current binary format version + which is defined by "PX_PHYSICS_VERSION_MAJOR.PX_PHYSICS_VERSION_MINOR.PX_PHYSICS_VERSION_BUGFIX-PX_BINARY_SERIAL_VERSION". + For a list of compatible sdk releases refer to the documentation of PX_BINARY_SERIAL_VERSION. + + \param[in] memBlock Pointer to memory block containing the serialized collection + \param[in] sr PxSerializationRegistry instance with information about registered classes. + \param[in] externalRefs Collection to resolve external dependencies + + \see PxCollection, PxSerialization::complete, PxSerialization::serializeCollectionToBinary, PxSerializationRegistry, PX_BINARY_SERIAL_VERSION + */ + static PxCollection* createCollectionFromBinary(void* memBlock, PxSerializationRegistry& sr, const PxCollection* externalRefs = NULL); + + /** + \brief Serializes a physics collection to an XML output stream. + + \deprecated Xml serialization is deprecated. An alternative serialization system is provided through USD Physics. + + The collection to be serialized needs to be complete \see PxSerialization.complete. + Optionally the XML may contain meshes in binary cooked format for fast loading. It does this when providing a valid non-null PxCooking pointer. + + \note Serialization of objects in a scene that is simultaneously being simulated is not supported and leads to undefined behavior. + + \param outputStream Stream to save collection to. + \param collection PxCollection instance which is serialized. The collection needs to be complete with respect to the externalRefs collection. + \param sr PxSerializationRegistry instance with information about registered classes. + \param params Optional pointer to cooking params. If provided, cooked mesh data is cached for fast loading. + \param externalRefs Collection containing external references. + \param inArgs Optional parameters of physics and scene serialized to XML along with the collection. See #PxSerialization::PxXmlMiscParameter + \return true if the collection is successfully serialized. + + \see PxCollection, PxOutputStream, PxSerializationRegistry, PxCooking, PxSerialization::PxXmlMiscParameter + */ + PX_DEPRECATED static bool serializeCollectionToXml(PxOutputStream& outputStream, PxCollection& collection, PxSerializationRegistry& sr, const PxCookingParams* params = NULL, const PxCollection* externalRefs = NULL, PxXmlMiscParameter* inArgs = NULL); + + /** + \brief Serializes a collection to a binary stream. + + Serializes a collection to a stream. In order to resolve external dependencies the externalReferences collection has to be provided. + Optionally names of objects that where set for example with #PxActor::setName are serialized along with the objects. + + The collection can be successfully serialized if isSerializable(collection) returns true. See #isSerializable. + + The implementation of the output stream needs to fulfill the requirements on the memory block input taken by + PxSerialization::createCollectionFromBinary. + + \note Serialization of objects in a scene that is simultaneously being simulated is not supported and leads to undefined behavior. + + \param[out] outputStream into which the collection is serialized + \param[in] collection Collection to be serialized + \param[in] sr PxSerializationRegistry instance with information about registered classes. + \param[in] externalRefs Collection used to resolve external dependencies + \param[in] exportNames Specifies whether object names are serialized + \return Whether serialization was successful + + \see PxCollection, PxOutputStream, PxSerialization::complete, PxSerialization::createCollectionFromBinary, PxSerializationRegistry + */ + static bool serializeCollectionToBinary(PxOutputStream& outputStream, PxCollection& collection, PxSerializationRegistry& sr, const PxCollection* externalRefs = NULL, bool exportNames = false ); + + /** + \brief Creates an application managed registry for serialization. + + \param[in] physics Physics SDK to generate create serialization registry + + \return PxSerializationRegistry instance. + + \see PxSerializationRegistry + */ + static PxSerializationRegistry* createSerializationRegistry(PxPhysics& physics); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxShapeExt.h b/engine/third_party/physx/include/extensions/PxShapeExt.h new file mode 100644 index 00000000..f6de3bd9 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxShapeExt.h @@ -0,0 +1,155 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SHAPE_EXT_H +#define PX_SHAPE_EXT_H + +#include "PxPhysXConfig.h" + +#include "PxShape.h" +#include "PxRigidActor.h" +#include "geometry/PxGeometryQuery.h" +#include "PxQueryReport.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief utility functions for use with PxShape + +\see PxShape +*/ + +class PxShapeExt +{ +public: + /** + \brief Retrieves the world space pose of the shape. + + \param[in] shape The shape for which to get the global pose. + \param[in] actor The actor to which the shape is attached + + \return Global pose of shape. + */ + static PX_INLINE PxTransform getGlobalPose(const PxShape& shape, const PxRigidActor& actor) + { + // PT:: tag: scalar transform*transform + return actor.getGlobalPose() * shape.getLocalPose(); + } + + /** + \brief Raycast test against the shape. + + \param[in] shape the shape + \param[in] actor the actor to which the shape is attached + \param[in] rayOrigin The origin of the ray to test the geometry object against + \param[in] rayDir The direction of the ray to test the geometry object against + \param[in] maxDist Maximum ray length + \param[in] hitFlags Specify which properties per hit should be computed and written to result hit array. Combination of #PxHitFlag flags + \param[in] maxHits max number of returned hits = size of 'rayHits' buffer + \param[out] rayHits Raycast hits information + \return Number of hits between the ray and the shape + + \see PxRaycastHit PxTransform + */ + static PX_INLINE PxU32 raycast(const PxShape& shape, const PxRigidActor& actor, + const PxVec3& rayOrigin, const PxVec3& rayDir, PxReal maxDist, PxHitFlags hitFlags, + PxU32 maxHits, PxRaycastHit* rayHits) + { + return PxGeometryQuery::raycast( + rayOrigin, rayDir, shape.getGeometry(), getGlobalPose(shape, actor), maxDist, hitFlags, maxHits, rayHits); + } + + /** + \brief Test overlap between the shape and a geometry object + + \param[in] shape the shape + \param[in] actor the actor to which the shape is attached + \param[in] otherGeom The other geometry object to test overlap with + \param[in] otherGeomPose Pose of the other geometry object + \return True if the shape overlaps the geometry object + + \see PxGeometry PxTransform + */ + static PX_INLINE bool overlap(const PxShape& shape, const PxRigidActor& actor, + const PxGeometry& otherGeom, const PxTransform& otherGeomPose) + { + return PxGeometryQuery::overlap(shape.getGeometry(), getGlobalPose(shape, actor), otherGeom, otherGeomPose); + } + + /** + \brief Sweep a geometry object against the shape. + + Currently only box, sphere, capsule and convex mesh shapes are supported, i.e. the swept geometry object must be one of those types. + + \param[in] shape the shape + \param[in] actor the actor to which the shape is attached + \param[in] unitDir Normalized direction along which the geometry object should be swept. + \param[in] distance Sweep distance. Needs to be larger than 0. + \param[in] otherGeom The geometry object to sweep against the shape + \param[in] otherGeomPose Pose of the geometry object + \param[out] sweepHit The sweep hit information. Only valid if this method returns true. + \param[in] hitFlags Specify which properties per hit should be computed and written to result hit array. Combination of #PxHitFlag flags + \return True if the swept geometry object hits the shape + + \see PxGeometry PxTransform PxSweepHit + */ + static PX_INLINE bool sweep(const PxShape& shape, const PxRigidActor& actor, + const PxVec3& unitDir, const PxReal distance, const PxGeometry& otherGeom, const PxTransform& otherGeomPose, + PxSweepHit& sweepHit, PxHitFlags hitFlags) + { + return PxGeometryQuery::sweep(unitDir, distance, otherGeom, otherGeomPose, shape.getGeometry(), getGlobalPose(shape, actor), sweepHit, hitFlags); + } + + /** + \brief Retrieves the axis aligned bounding box enclosing the shape. + + \return The shape's bounding box. + + \param[in] shape the shape + \param[in] actor the actor to which the shape is attached + \param[in] inflation Scale factor for computed world bounds. Box extents are multiplied by this value. + + \see PxBounds3 + */ + static PX_INLINE PxBounds3 getWorldBounds(const PxShape& shape, const PxRigidActor& actor, float inflation=1.01f) + { + PxBounds3 bounds; + PxGeometryQuery::computeGeomBounds(bounds, shape.getGeometry(), getGlobalPose(shape, actor), 0.0f, inflation); + return bounds; + } + +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxSimpleFactory.h b/engine/third_party/physx/include/extensions/PxSimpleFactory.h new file mode 100644 index 00000000..113ad1b7 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxSimpleFactory.h @@ -0,0 +1,293 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_SIMPLE_FACTORY_H +#define PX_SIMPLE_FACTORY_H + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxTransform.h" +#include "foundation/PxPlane.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxPhysics; + class PxMaterial; + class PxRigidActor; + class PxRigidDynamic; + class PxRigidStatic; + class PxGeometry; + class PxShape; + +/** \brief simple method to create a PxRigidDynamic actor with a single PxShape. + + \param[in] sdk the PxPhysics object + \param[in] transform the global pose of the new object + \param[in] geometry the geometry of the new object's shape, which must be a sphere, capsule, box or convex + \param[in] material the material for the new object's shape + \param[in] density the density of the new object. Must be greater than zero. + \param[in] shapeOffset an optional offset for the new shape, defaults to identity + + \return a new dynamic actor with the PxRigidBodyFlag, or NULL if it could + not be constructed + + \see PxRigidDynamic PxShapeFlag +*/ +PxRigidDynamic* PxCreateDynamic(PxPhysics& sdk, + const PxTransform& transform, + const PxGeometry& geometry, + PxMaterial& material, + PxReal density, + const PxTransform& shapeOffset = PxTransform(PxIdentity)); + +/** \brief simple method to create a PxRigidDynamic actor with a single PxShape. + + \param[in] sdk the PxPhysics object + \param[in] transform the transform of the new object + \param[in] shape the shape of the new object + \param[in] density the density of the new object. Must be greater than zero. + + \return a new dynamic actor with the PxRigidBodyFlag, or NULL if it could + not be constructed + + \see PxRigidDynamic PxShapeFlag +*/ +PxRigidDynamic* PxCreateDynamic(PxPhysics& sdk, + const PxTransform& transform, + PxShape& shape, + PxReal density); + +/** \brief simple method to create a kinematic PxRigidDynamic actor with a single PxShape. + + \param[in] sdk the PxPhysics object + \param[in] transform the global pose of the new object + \param[in] geometry the geometry of the new object's shape + \param[in] material the material for the new object's shape + \param[in] density the density of the new object. Must be greater than zero if the object is to participate in simulation. + \param[in] shapeOffset an optional offset for the new shape, defaults to identity + + \note unlike PxCreateDynamic, the geometry is not restricted to box, capsule, sphere or convex. However, + kinematics of other geometry types may not participate in simulation collision and may be used only for + triggers or scene queries of moving objects under animation control. In this case the density parameter + will be ignored and the created shape will be set up as a scene query only shape (see #PxShapeFlag::eSCENE_QUERY_SHAPE) + + \return a new dynamic actor with the PxRigidBodyFlag::eKINEMATIC set, or NULL if it could + not be constructed + + \see PxRigidDynamic PxShapeFlag +*/ +PxRigidDynamic* PxCreateKinematic(PxPhysics& sdk, + const PxTransform& transform, + const PxGeometry& geometry, + PxMaterial& material, + PxReal density, + const PxTransform& shapeOffset = PxTransform(PxIdentity)); + +/** \brief simple method to create a kinematic PxRigidDynamic actor with a single PxShape. + + \param[in] sdk the PxPhysics object + \param[in] transform the global pose of the new object + \param[in] density the density of the new object. Must be greater than zero if the object is to participate in simulation. + \param[in] shape the shape of the new object + + \note unlike PxCreateDynamic, the geometry is not restricted to box, capsule, sphere or convex. However, + kinematics of other geometry types may not participate in simulation collision and may be used only for + triggers or scene queries of moving objects under animation control. In this case the density parameter + will be ignored and the created shape will be set up as a scene query only shape (see #PxShapeFlag::eSCENE_QUERY_SHAPE) + + \return a new dynamic actor with the PxRigidBodyFlag::eKINEMATIC set, or NULL if it could + not be constructed + + \see PxRigidDynamic PxShapeFlag +*/ +PxRigidDynamic* PxCreateKinematic(PxPhysics& sdk, + const PxTransform& transform, + PxShape& shape, + PxReal density); + +/** \brief simple method to create a PxRigidStatic actor with a single PxShape. + + \param[in] sdk the PxPhysics object + \param[in] transform the global pose of the new object + \param[in] geometry the geometry of the new object's shape + \param[in] material the material for the new object's shape + \param[in] shapeOffset an optional offset for the new shape, defaults to identity + + \return a new static actor, or NULL if it could not be constructed + + \see PxRigidStatic +*/ +PxRigidStatic* PxCreateStatic(PxPhysics& sdk, + const PxTransform& transform, + const PxGeometry& geometry, + PxMaterial& material, + const PxTransform& shapeOffset = PxTransform(PxIdentity)); + +/** \brief simple method to create a PxRigidStatic actor with a single PxShape. + + \param[in] sdk the PxPhysics object + \param[in] transform the global pose of the new object + \param[in] shape the new object's shape + + \return a new static actor, or NULL if it could not be constructed + + \see PxRigidStatic +*/ +PxRigidStatic* PxCreateStatic(PxPhysics& sdk, + const PxTransform& transform, + PxShape& shape); + +/** +\brief create a shape by copying attributes from another shape + +The function clones a PxShape. The following properties are copied: +- geometry +- flags +- materials +- actor-local pose +- contact offset +- rest offset +- simulation filter data +- query filter data +- torsional patch radius +- minimum torsional patch radius + +The following are not copied and retain their default values: +- name +- user data + +\param[in] physicsSDK - the physics SDK used to allocate the shape +\param[in] shape the shape from which to take the attributes. +\param[in] isExclusive whether the new shape should be an exclusive or shared shape. + +\return the newly-created rigid static +*/ +PxShape* PxCloneShape(PxPhysics& physicsSDK, + const PxShape& shape, + bool isExclusive); + +/** +\brief create a static body by copying attributes from another rigid actor + +The function clones a PxRigidDynamic or PxRigidStatic as a PxRigidStatic. A uniform scale is applied. The following properties are copied: +- shapes +- actor flags +- owner client and client behavior bits +- dominance group + +The following are not copied and retain their default values: +- name +- joints or observers +- aggregate or scene membership +- user data + +\note Transforms are not copied with bit-exact accuracy. + +\param[in] physicsSDK - the physics SDK used to allocate the rigid static +\param[in] actor the rigid actor from which to take the attributes. +\param[in] transform the transform of the new static. + +\return the newly-created rigid static +*/ +PxRigidStatic* PxCloneStatic(PxPhysics& physicsSDK, + const PxTransform& transform, + const PxRigidActor& actor); + +/** +\brief create a dynamic body by copying attributes from an existing body + +The following properties are copied: +- shapes +- actor flags, rigidDynamic flags and rigidDynamic lock flags +- mass, moment of inertia, and center of mass frame +- linear and angular velocity +- linear and angular damping +- maximum linear velocity +- maximum angular velocity +- position and velocity solver iterations +- maximum depenetration velocity +- sleep threshold +- contact report threshold +- dominance group +- owner client and client behavior bits +- name pointer +- kinematic target + +The following are not copied and retain their default values: +- name +- joints or observers +- aggregate or scene membership +- sleep timer +- user data + +\note Transforms are not copied with bit-exact accuracy. + +\param[in] physicsSDK PxPhysics - the physics SDK used to allocate the rigid static +\param[in] body the rigid dynamic to clone. +\param[in] transform the transform of the new dynamic + +\return the newly-created rigid static +*/ +PxRigidDynamic* PxCloneDynamic(PxPhysics& physicsSDK, + const PxTransform& transform, + const PxRigidDynamic& body); + +/** \brief create a plane actor. The plane equation is n.x + d = 0 + + \param[in] sdk the PxPhysics object + \param[in] plane a plane of the form n.x + d = 0 + \param[in] material the material for the new object's shape + + \return a new static actor, or NULL if it could not be constructed + + \see PxRigidStatic +*/ +PxRigidStatic* PxCreatePlane(PxPhysics& sdk, + const PxPlane& plane, + PxMaterial& material); + +/** +\brief scale a rigid actor by a uniform scale + +The geometry and relative positions of the actor are multiplied by the given scale value. If the actor is a rigid body or an +articulation link and the scaleMassProps value is true, the mass properties are scaled assuming the density is constant: the +center of mass is linearly scaled, the mass is multiplied by the cube of the scale, and the inertia tensor by the fifth power of the scale. + +\param[in] actor a rigid actor +\param[in] scale the scale by which to multiply the actor. Must be >0. +\param[in] scaleMassProps whether to scale the mass properties +*/ +void PxScaleRigidActor(PxRigidActor& actor, PxReal scale, bool scaleMassProps = true); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxSmoothNormals.h b/engine/third_party/physx/include/extensions/PxSmoothNormals.h new file mode 100644 index 00000000..11a8e646 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxSmoothNormals.h @@ -0,0 +1,56 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SMOOTH_NORMALS_H +#define PX_SMOOTH_NORMALS_H + +#include "foundation/PxVec3.h" +#include "common/PxPhysXCommonConfig.h" + +/** +\brief Builds smooth vertex normals over a mesh. + +- "smooth" because smoothing groups are not supported here +- takes angles into account for correct cube normals computation + +To use 32bit indices pass a pointer in dFaces and set wFaces to zero. Alternatively pass a pointer to +wFaces and set dFaces to zero. + +\param[in] nbTris Number of triangles +\param[in] nbVerts Number of vertices +\param[in] verts Array of vertices +\param[in] dFaces Array of dword triangle indices, or null +\param[in] wFaces Array of word triangle indices, or null +\param[out] normals Array of computed normals (assumes nbVerts vectors) +\param[in] flip Flips the normals or not +\return True on success. +*/ +PX_C_EXPORT bool PX_CALL_CONV PxBuildSmoothNormals(physx::PxU32 nbTris, physx::PxU32 nbVerts, const physx::PxVec3* verts, + const physx::PxU32* dFaces, const physx::PxU16* wFaces, physx::PxVec3* normals, bool flip); + +#endif diff --git a/engine/third_party/physx/include/extensions/PxSoftBodyExt.h b/engine/third_party/physx/include/extensions/PxSoftBodyExt.h new file mode 100644 index 00000000..514a20d9 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxSoftBodyExt.h @@ -0,0 +1,49 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SOFT_BODY_EXT_H +#define PX_SOFT_BODY_EXT_H + +#include "PxDeformableVolumeExt.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Deprecated +\see PxDeformableVolumeExt +*/ +typedef PX_DEPRECATED PxDeformableVolumeExt PxSoftBodyExt; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxSphericalJoint.h b/engine/third_party/physx/include/extensions/PxSphericalJoint.h new file mode 100644 index 00000000..66762c93 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxSphericalJoint.h @@ -0,0 +1,180 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SPHERICAL_JOINT_H +#define PX_SPHERICAL_JOINT_H + +#include "extensions/PxJoint.h" +#include "extensions/PxJointLimit.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxSphericalJoint; + +/** +\brief Create a spherical joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + +\see PxSphericalJoint +*/ +PxSphericalJoint* PxSphericalJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + + +/** +\brief Flags specific to the spherical joint. + +\see PxSphericalJoint +*/ +struct PxSphericalJointFlag +{ + enum Enum + { + eLIMIT_ENABLED = 1<<1 //!< the cone limit for the spherical joint is enabled + }; +}; +typedef PxFlags PxSphericalJointFlags; +PX_FLAGS_OPERATORS(PxSphericalJointFlag::Enum, PxU16) + +/** +\brief A joint which behaves in a similar way to a ball and socket. + + A spherical joint removes all linear degrees of freedom from two objects. + + The position of the joint on each actor is specified by the origin of the body's joint frame. + + A spherical joint may have a cone limit, to restrict the motion to within a certain range. + + Dirve and limits are activated by setting the appropriate flags on the joint. + + \see PxRevoluteJointCreate() PxJoint +*/ +class PxSphericalJoint : public PxJoint +{ +public: + + /** + \brief Set the limit cone. + + If enabled, the limit cone will constrain the angular movement of the joint to lie + within an elliptical cone. + + \return the limit cone + + \see PxJointLimitCone setLimit() + */ + virtual PxJointLimitCone getLimitCone() const = 0; + + /** + \brief Get the limit cone. + + \param[in] limit the limit cone + + \see PxJointLimitCone getLimit() + */ + virtual void setLimitCone(const PxJointLimitCone& limit) = 0; + + /** + \brief get the swing angle of the joint from the Y axis + */ + virtual PxReal getSwingYAngle() const = 0; + + /** + \brief get the swing angle of the joint from the Z axis + */ + virtual PxReal getSwingZAngle() const = 0; + + /** + \brief Set the flags specific to the Spherical Joint. + + Default PxSphericalJointFlags(0) + + \param[in] flags The joint flags. + + \see PxSphericalJointFlag setFlag() getFlags() + */ + virtual void setSphericalJointFlags(PxSphericalJointFlags flags) = 0; + + /** + \brief Set a single flag specific to a Spherical Joint to true or false. + + \param[in] flag The flag to set or clear. + \param[in] value the value to which to set the flag + + \see PxSphericalJointFlag, getFlags() setFlags() + */ + virtual void setSphericalJointFlag(PxSphericalJointFlag::Enum flag, bool value) = 0; + + /** + \brief Get the flags specific to the Spherical Joint. + + \return the joint flags + + \see PxSphericalJoint::flags, PxSphericalJointFlag setFlag() setFlags() + */ + virtual PxSphericalJointFlags getSphericalJointFlags() const = 0; + + /** + \brief Returns string name of PxSphericalJoint, used for serialization + */ + virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxSphericalJoint"; } + +protected: + + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxSphericalJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxSphericalJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxSphericalJoint", PxJoint); } + + //~serialization +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxStringTableExt.h b/engine/third_party/physx/include/extensions/PxStringTableExt.h new file mode 100644 index 00000000..924b0588 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxStringTableExt.h @@ -0,0 +1,56 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_STRING_TABLE_EXT_H +#define PX_STRING_TABLE_EXT_H + +#include "foundation/PxAllocatorCallback.h" +#include "common/PxStringTable.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief a factory class for creating PxStringTable with a specific allocator. + +\see PxStringTable +*/ + +class PxStringTableExt +{ +public: + static PxStringTable& createStringTable( physx::PxAllocatorCallback& inAllocator ); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxTetMakerExt.h b/engine/third_party/physx/include/extensions/PxTetMakerExt.h new file mode 100644 index 00000000..958be6ff --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxTetMakerExt.h @@ -0,0 +1,221 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_TETMAKER_EXT_H +#define PX_TETMAKER_EXT_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec3.h" +#include "common/PxCoreUtilityTypes.h" +#include "foundation/PxArray.h" +#include "PxTriangleMeshAnalysisResult.h" +#include "PxTetrahedronMeshAnalysisResult.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxTriangleMesh; +class PxTetrahedronMeshDesc; +class PxDeformableVolumeSimulationDataDesc; +struct PxTetMakerData; +class PxSimpleTriangleMesh; + +/** +\brief Provides functionality to create a tetrahedral mesh from a triangle mesh. +*/ +class PxTetMaker +{ +public: + + /** + \brief Create conforming tetrahedron mesh using TetMaker + + \param[in] triangleMesh The description of the triangle mesh including vertices and indices + \param[out] outVertices The vertices to store the conforming tetrahedral mesh + \param[out] outTetIndices The indices to store the conforming tetrahedral mesh + \param[in] validate If set to true the input triangle mesh will get analyzed to find possible deficiencies + \param[in] volumeThreshold Tetrahedra with a volume smaller than the specified threshold will be removed from the mesh + \return True if success + */ + static bool createConformingTetrahedronMesh(const PxSimpleTriangleMesh& triangleMesh, physx::PxArray& outVertices, physx::PxArray& outTetIndices, + const bool validate = true, PxReal volumeThreshold = 0.0f); + + /** + \brief Create voxel-based tetrahedron mesh using TetMaker + + \param[in] tetMesh The description of the tetrahedral mesh including vertices and indices + \param[in] numVoxelsAlongLongestBoundingBoxAxis The number of voxels along the longest bounding box axis + \param[out] outVertices The vertices to store the voxel-based tetrahedral mesh + \param[out] outTetIndices The indices to store the voxel-based tetrahedral mesh + \param[out] inputPointToOutputTetIndex Buffer with the size of nbTetVerts that contains the tetrahedron index containing the input point with the same index + \param[in] anchorNodeIndices Some input vertices may not be referenced by any tetrahedron. They can be mapped to another input vertex that is used by a tetrahedron to support embedding of additional points. + \param[in] numTetsPerVoxel The number of tetrahedra used to fill a voxel. Only a value of 5 or 6 is supported. 5 is recommended because it mostly avoids mesh anisotropy. + \return True if success + */ + static bool createVoxelTetrahedronMesh(const PxTetrahedronMeshDesc& tetMesh, const PxU32 numVoxelsAlongLongestBoundingBoxAxis, + physx::PxArray& outVertices, physx::PxArray& outTetIndices, PxI32* inputPointToOutputTetIndex = NULL, const PxU32* anchorNodeIndices = NULL, PxU32 numTetsPerVoxel = 5); + + /** + \brief Create voxel-based tetrahedron mesh using TetMaker + + \param[in] tetMesh The description of the tetrahedral mesh including vertices and indices + \param[in] voxelEdgeLength The edge length of a voxel.Can be adjusted slightly such that a multiple of it matches the input points' bounding box size + \param[out] outVertices The vertices to store the voxel-based tetrahedral mesh + \param[out] outTetIndices The indices to store the voxel-based tetrahedral mesh + \param[out] inputPointToOutputTetIndex Buffer with the size of nbTetVerts that contains the tetrahedron index containing the input point with the same index + \param[in] anchorNodeIndices Some input vertices may not be referenced by any tetrahedron. They can be mapped to another input vertex that is used by a tetrahedron to support embedding of additional points. + \param[in] numTetsPerVoxel The number of tetrahedra used to fill a voxel. Only a value of 5 or 6 is supported. 5 is recommended because it mostly avoids mesh anisotropy. + \return True if success + */ + static bool createVoxelTetrahedronMeshFromEdgeLength(const PxTetrahedronMeshDesc& tetMesh, const PxReal voxelEdgeLength, + physx::PxArray& outVertices, physx::PxArray& outTetIndices, PxI32* inputPointToOutputTetIndex = NULL, const PxU32* anchorNodeIndices = NULL, PxU32 numTetsPerVoxel = 5); + + /** + \brief Analyzes the triangle mesh to get a report about deficiencies. Some deficiencies can be handled by the tetmesher, others cannot. + + \param[in] triangleMesh The description of the triangle mesh including vertices and indices + \param[in] minVolumeThreshold Minimum volume the mesh must have such that no volume warning is generated + \param[in] minTriangleAngleRadians Minimum angle allowed for triangles such that no angle warning is generated + \return Flags that describe the triangle mesh's deficiencies + */ + static PxTriangleMeshAnalysisResults validateTriangleMesh(const PxSimpleTriangleMesh& triangleMesh, const PxReal minVolumeThreshold = 1e-6f, const PxReal minTriangleAngleRadians = 10.0f*3.1415926535898f / 180.0f); + + /** + \brief Analyzes the tetrahedron mesh to get a report about deficiencies. Some deficiencies can be handled by the deformable volume cooker, others cannot. + + \param[in] points The mesh's points + \param[in] tetrahedra The mesh's tetrahedra (index buffer) + \param[in] minTetVolumeThreshold Minimum volume every tetrahedron in the mesh must have such that no volume warning is generated + \return Flags that describe the tetrahedron mesh's deficiencies + */ + static PxTetrahedronMeshAnalysisResults validateTetrahedronMesh(const PxBoundedData& points, const PxBoundedData& tetrahedra, const PxReal minTetVolumeThreshold = 1e-8f); + + /** + \brief Simplifies (decimates) a triangle mesh using quadric simplification. + + \param[in] inputVertices The vertices of the input triangle mesh + \param[in] inputIndices The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[in] targetTriangleCount Desired number of triangles in the output mesh + \param[in] maximalEdgeLength Edges below this length will not be collapsed. A value of zero means there is no limit. + \param[out] outputVertices The vertices of the output (decimated) triangle mesh + \param[out] outputIndices The indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[out] vertexMap Optional parameter which returns the mapping from input to output vertices. Note that multiple input vertices are typically collapsed into the same output vertex. + \param[in] edgeLengthCostWeight Factor to scale influence of edge length when prioritizing edge collapses. Has no effect if set to zero. + \param[in] flatnessDetectionThreshold Threshold used to detect edges in flat regions and to improve the placement of the collapsed point. If set to a large value it will have no effect. + \param[in] projectSimplifiedPointsOnInputMeshSurface If set to true, the simplified points will lie exactly on the original surface. + \param[out] outputVertexToInputTriangle Optional indices providing the triangle index per resulting vertex. Only available when projectSimplifiedPointsOnInputMeshSurface is set to true + \param[in] removeDisconnectedPatches Enables the optional removal of disconnected triangles in the mesh. Only the largest connected set/patch will be kept + */ + static void simplifyTriangleMesh(const PxArray& inputVertices, const PxArray&inputIndices, int targetTriangleCount, PxF32 maximalEdgeLength, + PxArray& outputVertices, PxArray& outputIndices, + PxArray *vertexMap = NULL, PxReal edgeLengthCostWeight = 0.1f, PxReal flatnessDetectionThreshold = 0.01f, + bool projectSimplifiedPointsOnInputMeshSurface = false, PxArray* outputVertexToInputTriangle = NULL, bool removeDisconnectedPatches = false); + + /** + \brief Creates a new mesh from a given mesh. The input mesh is first voxelized. The new surface is created from the voxel surface and subsequent projection to the original mesh. + + \param[in] inputVertices The vertices of the input triangle mesh + \param[in] inputIndices The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[in] gridResolution Size of the voxel grid (number of voxels along the longest dimension) + \param[out] outputVertices The vertices of the output (decimated) triangle mesh + \param[out] outputIndices The indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[out] vertexMap Optional parameter which returns a mapping from input to output vertices. Since the meshes are independent, the mapping returns an output vertex that is topologically close to the input vertex. + */ + static void remeshTriangleMesh(const PxArray& inputVertices, const PxArray&inputIndices, PxU32 gridResolution, + PxArray& outputVertices, PxArray& outputIndices, PxArray *vertexMap = NULL); + + /** + \brief Creates a new mesh from a given mesh. The input mesh is first voxelized. The new surface is created from the voxel surface and subsequent projection to the original mesh. + + \param[in] inputVertices The vertices of the input triangle mesh + \param[in] nbVertices The number of vertices of the input triangle mesh + \param[in] inputIndices The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[in] nbIndices The number of indices of the input triangle mesh (equal to three times the number of triangles) + \param[in] gridResolution Size of the voxel grid (number of voxels along the longest dimension) + \param[out] outputVertices The vertices of the output (decimated) triangle mesh + \param[out] outputIndices The indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[out] vertexMap Optional parameter which returns a mapping from input to output vertices. Since the meshes are independent, the mapping returns an output vertex that is topologically close to the input vertex. + */ + static void remeshTriangleMesh(const PxVec3* inputVertices, PxU32 nbVertices, const PxU32* inputIndices, PxU32 nbIndices, PxU32 gridResolution, + PxArray& outputVertices, PxArray& outputIndices, PxArray *vertexMap = NULL); + + /** + \brief Creates a tetrahedral mesh using an octree. + + \param[in] inputVertices The vertices of the input triangle mesh + \param[in] inputIndices The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[in] useTreeNodes Using the nodes of the octree as tetrahedral vertices + \param[out] outputVertices The vertices of the output tetrahedral mesh + \param[out] outputIndices The indices of the output tetrahedral mesh of the form (id0, id1, id2, id3), (id0, id1, id2, id3), .. + \param[in] volumeThreshold Tetrahedra with a volume smaller than the specified threshold will be removed from the mesh + */ + static void createTreeBasedTetrahedralMesh(const PxArray& inputVertices, const PxArray&inputIndices, + bool useTreeNodes, PxArray& outputVertices, PxArray& outputIndices, PxReal volumeThreshold = 0.0f); + + /** + \brief Creates a tetrahedral mesh by relaxing a voxel mesh around the input mesh + + \param[in] inputVertices The vertices of the input triangle mesh + \param[in] inputIndices The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[out] outputVertices The vertices of the output tetrahedral mesh + \param[out] outputIndices The indices of the output tetrahedral mesh of the form (id0, id1, id2, id3), (id0, id1, id2, id3), .. + \param[in] resolution The grid spacing is computed as the diagonal of the bounding box of the input mesh divided by the resolution. + \param[in] numRelaxationIterations Number of iterations to pull the tetrahedral mesh towards the input mesh + \param[in] relMinTetVolume Constrains the volumes of the tetrahedra to stay abobe relMinTetvolume times the tetrahedron's rest volume. + */ + static void createRelaxedVoxelTetrahedralMesh(const PxArray& inputVertices, const PxArray&inputIndices, + PxArray& outputVertices, PxArray& outputIndices, + PxI32 resolution, PxI32 numRelaxationIterations = 5, PxF32 relMinTetVolume = 0.05f); + + /** + \brief Creates a tetrahedral mesh by relaxing a voxel mesh around the input mesh + + \param[in] triangles The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[in] numTriangles The number of triangles + \param[out] islandIndexPerTriangle Every triangle gets an island index assigned. Triangles with the same island index belong to the same patch of connected triangles. + */ + static void detectTriangleIslands(const PxI32* triangles, PxU32 numTriangles, PxArray& islandIndexPerTriangle); + + /** + \brief Creates a tetrahedral mesh by relaxing a voxel mesh around the input mesh + + \param[in] islandIndexPerTriangle An island marker per triangles. All triangles with the same marker belong to an island. Can becomputed using the method detectTriangleIslands. + \param[in] numTriangles The number of triangles + \return The marker value of the island that contains the most triangles + */ + static PxU32 findLargestIslandId(const PxU32* islandIndexPerTriangle, PxU32 numTriangles); +}; + +#if !PX_DOXYGEN +} +#endif + +#endif + diff --git a/engine/third_party/physx/include/extensions/PxTetrahedronMeshAnalysisResult.h b/engine/third_party/physx/include/extensions/PxTetrahedronMeshAnalysisResult.h new file mode 100644 index 00000000..4e4f7cc2 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxTetrahedronMeshAnalysisResult.h @@ -0,0 +1,61 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +#ifndef PX_TETRAHEDRON_MESH_ANALYSIS_RESULT_H +#define PX_TETRAHEDRON_MESH_ANALYSIS_RESULT_H + + +#include "PxPhysXConfig.h" +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief These flags indicate what kind of deficiencies a tetrahedron mesh has and describe if the mesh is considered ok, problematic or invalid for deformable volume cooking + */ + class PxTetrahedronMeshAnalysisResult + { + public: + enum Enum + { + eVALID = 0, + eDEGENERATE_TETRAHEDRON = (1 << 0), //!< At least one tetrahedron has zero or negative volume. This can happen when the input triangle mesh contains triangles that are very elongated, e. g. one edge is a lot shorther than the other two. + + eMESH_IS_PROBLEMATIC = (1 << 1), //!< flag is set if the mesh is categorized as problematic + eMESH_IS_INVALID = (1 << 2) //!< flag is set if the mesh is categorized as invalid + }; + }; + typedef PxFlags PxTetrahedronMeshAnalysisResults; + PX_FLAGS_OPERATORS(PxTetrahedronMeshAnalysisResult::Enum, PxU32) + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxTetrahedronMeshExt.h b/engine/third_party/physx/include/extensions/PxTetrahedronMeshExt.h new file mode 100644 index 00000000..f9b3b0c9 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxTetrahedronMeshExt.h @@ -0,0 +1,108 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_TETRAHEDRON_MESH_EXT_H +#define PX_TETRAHEDRON_MESH_EXT_H + +#include "foundation/PxVec3.h" +#include "foundation/PxVec4.h" +#include "foundation/PxArray.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + class PxTetrahedronMesh; + + /** + \brief utility functions for use with PxTetrahedronMesh and subclasses + */ + class PxTetrahedronMeshExt + { + public: + /** Returns the index of the tetrahedron that contains a point + + \param[in] mesh The tetmesh + \param[in] point The point to find the enclosing tetrahedron for + \param[in] bary The barycentric coordinates of the point inside the enclosing tetrahedron + \param[in] tolerance Tolerance value used classify points as inside if they lie exactly a tetrahedron's surface + \return The index of the tetrahedron containing the point, -1 if not tetrahedron contains the opoint + */ + static PxI32 findTetrahedronContainingPoint(const PxTetrahedronMesh* mesh, const PxVec3& point, PxVec4& bary, PxReal tolerance = 1e-6f); + + /** Returns the index of the tetrahedron closest to a point + + \param[in] mesh The tetmesh + \param[in] point The point to find the closest tetrahedron for + \param[out] bary The barycentric coordinates of the point in the tetrahedron + \return The index of the tetrahedron closest to the point + */ + static PxI32 findTetrahedronClosestToPoint(const PxTetrahedronMesh* mesh, const PxVec3& point, PxVec4& bary); + + /** Associates points with closest tetrahedra from input tetrahedral mesh. If the tetmesh does not have any tetrahedra + or points, a warning will be generated and the result arrays will be empty, even if there are query points passed into the method. + + \param[in] tetMeshVertices The tetrahedral mesh vertices + \param[in] tetMeshIndices The tetraheral mesh indices + \param[in] pointsToEmbed The points for which the embedding should be created + \param[in] barycentricCoordinates The output barycentric coordinates for each input point relative to its closest tetrahedron + \param[in] tetLinks The output indices of the closest tetrahedron for each input point + */ + static void createPointsToTetrahedronMap(const PxArray& tetMeshVertices, const PxArray& tetMeshIndices, const PxArray& pointsToEmbed, PxArray& barycentricCoordinates, PxArray& tetLinks); + + /** Extracts the surface triangles of a tetmesh + + The extracted triangle's vertex indices point to the vertex buffer of the tetmesh. + + \param[in] tetrahedra The tetrahedra indices + \param[in] numTetrahedra The number of tetrahedra + \param[in] sixteenBitIndices If set to true, the tetrahedra indices are read as 16bit integers, otherwise 32bit integers are used + \param[in] surfaceTriangles The resulting surface triangles + \param[in] surfaceTriangleToTet Optional array to get the index of a tetrahedron that is adjacent to the surface triangle with the corresponding index + \param[in] flipTriangleOrientation Reverses the orientation of the ouput triangles + */ + static void extractTetMeshSurface(const void* tetrahedra, PxU32 numTetrahedra, bool sixteenBitIndices, PxArray& surfaceTriangles, PxArray* surfaceTriangleToTet = NULL, bool flipTriangleOrientation = false); + + /** Extracts the surface triangles of a tetmesh + + The extracted triangle's vertex indices point to the vertex buffer of the tetmesh. + + \param[in] mesh The mesh from which the surface shall be computed + \param[in] surfaceTriangles The resulting surface triangles + \param[in] surfaceTriangleToTet Optional array to get the index of a tetrahedron that is adjacent to the surface triangle with the corresponding index + \param[in] flipTriangleOrientation Reverses the orientation of the ouput triangles + */ + static void extractTetMeshSurface(const PxTetrahedronMesh* mesh, PxArray& surfaceTriangles, PxArray* surfaceTriangleToTet = NULL, bool flipTriangleOrientation = false); + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxTriangleMeshAnalysisResult.h b/engine/third_party/physx/include/extensions/PxTriangleMeshAnalysisResult.h new file mode 100644 index 00000000..1a635ef4 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxTriangleMeshAnalysisResult.h @@ -0,0 +1,70 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +#ifndef PX_TRIANGLE_MESH_ANALYSIS_RESULT_H +#define PX_TRIANGLE_MESH_ANALYSIS_RESULT_H + + +#include "PxPhysXConfig.h" +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief These flags indicate what kind of deficiencies a triangle mesh has and describe if the mesh is considered ok, problematic or invalid for tetmeshing + */ + class PxTriangleMeshAnalysisResult + { + public: + enum Enum + { + eVALID = 0, + eZERO_VOLUME = (1 << 0), //!< invalid: Flat mesh without meaningful amount of volume - cannot be meshed since a tetmesh is volumetric + eOPEN_BOUNDARIES = (1 << 1), //!< problematic: Open boundary means that the mesh is not watertight and that there are holes. The mesher can fill holes but the surface might have an unexpected shape where the hole was. + eSELF_INTERSECTIONS = (1 << 2), //!< problematic: The surface of the resulting mesh won't match exactly at locations of self-intersections. The tetmesh might be connected at self-intersections even if the input triangle mesh is not + eINCONSISTENT_TRIANGLE_ORIENTATION = (1 << 3), //!< invalid: It is not possible to distinguish what is inside and outside of the mesh. If there are no self-intersections and not edges shared by more than two triangles, a call to makeTriOrientationConsistent can fix this. Without fixing it, the output from the tetmesher will be incorrect + eCONTAINS_ACUTE_ANGLED_TRIANGLES = (1 << 4), //!< problematic: An ideal mesh for a volume deformable has triangles with similar angles and evenly distributed vertices. Acute angles can be handled but might lead to a poor quality tetmesh. + eEDGE_SHARED_BY_MORE_THAN_TWO_TRIANGLES = (1 << 5), //!< problematic: Border case of a self-intersecting mesh. The tetmesh might not match the surace exactly near such edges. + eCONTAINS_DUPLICATE_POINTS = (1 << 6), //!< ok: Duplicate points can be handled by the mesher without problems. The resulting tetmesh will only make use of first unique point that is found, duplicate points will get mapped to that unique point in the tetmesh. Therefore the tetmesh can contain points that are not accessed by a tet. + eCONTAINS_INVALID_POINTS = (1 << 7), //!< invalid: Points contain NAN, infinity or similar values that will lead to an invalid mesh + eREQUIRES_32BIT_INDEX_BUFFER = (1 << 8), //!< invalid: Mesh contains more indices than a 16bit index buffer can address + eTRIANGLE_INDEX_OUT_OF_RANGE = (1 << 9), //!< invalid: A mesh triangle index is negative or lager than the size of the vertex buffer + + eMESH_IS_PROBLEMATIC = (1 << 10), //!< flag is set if the mesh is categorized as problematic + eMESH_IS_INVALID = (1 << 11) //!< flag is set if the mesh is categorized as invalid + }; + }; + typedef PxFlags PxTriangleMeshAnalysisResults; + PX_FLAGS_OPERATORS(PxTriangleMeshAnalysisResult::Enum, PxU32) + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/engine/third_party/physx/include/extensions/PxTriangleMeshExt.h b/engine/third_party/physx/include/extensions/PxTriangleMeshExt.h new file mode 100644 index 00000000..f62057c0 --- /dev/null +++ b/engine/third_party/physx/include/extensions/PxTriangleMeshExt.h @@ -0,0 +1,194 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_TRIANGLE_MESH_EXT_H +#define PX_TRIANGLE_MESH_EXT_H + +#include "PxPhysXConfig.h" +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxArray.h" +#include "foundation/PxTransform.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxGeometry; +class PxTriangleMesh; +class PxTriangleMeshGeometry; +class PxHeightFieldGeometry; + + /** + \brief Utility class to find mesh triangles touched by a specified geometry object. + + This class is a helper calling PxMeshQuery::findOverlapTriangleMesh or PxMeshQuery::findOverlapHeightField under the hood, + while taking care of necessary memory management issues. + + PxMeshQuery::findOverlapTriangleMesh and PxMeshQuery::findOverlapHeightField are the "raw" functions operating on user-provided fixed-size + buffers. These functions abort with an error code in case of buffer overflow. PxMeshOverlapUtil is a convenient helper function checking + this error code, and resizing buffers appropriately, until the desired call succeeds. + + Returned triangle indices are stored within the class, and can be used with PxMeshQuery::getTriangle() to retrieve the triangle properties. + */ + class PxMeshOverlapUtil + { + public: + PxMeshOverlapUtil(); + ~PxMeshOverlapUtil(); + /** + \brief Find the mesh triangles which touch the specified geometry object. + + \param[in] geom The geometry object to test for mesh triangle overlaps. Supported geometries are #PxSphereGeometry, #PxCapsuleGeometry and #PxBoxGeometry + \param[in] geomPose Pose of the geometry object + \param[in] meshGeom The triangle mesh geometry to check overlap against + \param[in] meshPose Pose of the triangle mesh + \return Number of overlaps found. Triangle indices can then be accessed through the #getResults() function. + + \see PxGeometry PxTransform PxTriangleMeshGeometry PxMeshQuery::findOverlapTriangleMesh + */ + PxU32 findOverlap(const PxGeometry& geom, const PxTransform& geomPose, const PxTriangleMeshGeometry& meshGeom, const PxTransform& meshPose); + + /** + \brief Find the height field triangles which touch the specified geometry object. + + \param[in] geom The geometry object to test for height field overlaps. Supported geometries are #PxSphereGeometry, #PxCapsuleGeometry and #PxBoxGeometry. The sphere and capsule queries are currently conservative estimates. + \param[in] geomPose Pose of the geometry object + \param[in] hfGeom The height field geometry to check overlap against + \param[in] hfPose Pose of the height field + \return Number of overlaps found. Triangle indices can then be accessed through the #getResults() function. + + \see PxGeometry PxTransform PxHeightFieldGeometry PxMeshQuery::findOverlapHeightField + */ + PxU32 findOverlap(const PxGeometry& geom, const PxTransform& geomPose, const PxHeightFieldGeometry& hfGeom, const PxTransform& hfPose); + + /** + \brief Retrieves array of triangle indices after a findOverlap call. + \return Indices of touched triangles + */ + PX_FORCE_INLINE const PxU32* getResults() const { return mResultsMemory; } + + /** + \brief Retrieves number of triangle indices after a findOverlap call. + \return Number of touched triangles + */ + PX_FORCE_INLINE PxU32 getNbResults() const { return mNbResults; } + + private: + PxU32* mResultsMemory; + PxU32 mResults[256]; + PxU32 mNbResults; + PxU32 mMaxNbResults; + }; + + /** + \brief Computes an approximate minimum translational distance (MTD) between a geometry object and a mesh. + + This iterative function computes an approximate vector that can be used to depenetrate a geom object + from a triangle mesh. Returned depenetration vector should be applied to 'geom', to get out of the mesh. + + The function works best when the amount of overlap between the geom object and the mesh is small. If the + geom object's center goes inside the mesh, backface culling usually kicks in, no overlap is detected, + and the function does not compute an MTD vector. + + The function early exits if no overlap is detected after a depenetration attempt. This means that if + maxIter = N, the code will attempt at most N iterations but it might exit earlier if depenetration has + been successful. Usually N = 4 gives good results. + + \param[out] direction Computed MTD unit direction + \param[out] depth Penetration depth. Always positive or zero. + \param[in] geom The geometry object + \param[in] geomPose Pose for the geometry object + \param[in] meshGeom The mesh geometry + \param[in] meshPose Pose for the mesh + \param[in] maxIter Max number of iterations before returning. + \param[out] usedIter Number of depenetrations attempts performed during the call. Will not be returned if the pointer is NULL. + + \return True if the MTD has successfully been computed, i.e. if objects do overlap. + + \see PxGeometry PxTransform PxTriangleMeshGeometry + */ + bool PxComputeTriangleMeshPenetration(PxVec3& direction, + PxReal& depth, + const PxGeometry& geom, + const PxTransform& geomPose, + const PxTriangleMeshGeometry& meshGeom, + const PxTransform& meshPose, + PxU32 maxIter, + PxU32* usedIter = NULL); + + /** + \brief Computes an approximate minimum translational distance (MTD) between a geometry object and a heightfield. + + This iterative function computes an approximate vector that can be used to depenetrate a geom object + from a heightfield. Returned depenetration vector should be applied to 'geom', to get out of the heightfield. + + The function works best when the amount of overlap between the geom object and the mesh is small. If the + geom object's center goes inside the heightfield, backface culling usually kicks in, no overlap is detected, + and the function does not compute an MTD vector. + + The function early exits if no overlap is detected after a depenetration attempt. This means that if + maxIter = N, the code will attempt at most N iterations but it might exit earlier if depenetration has + been successful. Usually N = 4 gives good results. + + \param[out] direction Computed MTD unit direction + \param[out] depth Penetration depth. Always positive or zero. + \param[in] geom The geometry object + \param[in] geomPose Pose for the geometry object + \param[in] heightFieldGeom The heightfield geometry + \param[in] heightFieldPose Pose for the heightfield + \param[in] maxIter Max number of iterations before returning. + \param[out] usedIter Number of depenetrations attempts performed during the call. Will not be returned if the pointer is NULL. + + \return True if the MTD has successfully been computed, i.e. if objects do overlap. + + \see PxGeometry PxTransform PxHeightFieldGeometry + */ + bool PxComputeHeightFieldPenetration(PxVec3& direction, + PxReal& depth, + const PxGeometry& geom, + const PxTransform& geomPose, + const PxHeightFieldGeometry& heightFieldGeom, + const PxTransform& heightFieldPose, + PxU32 maxIter, + PxU32* usedIter = NULL); + + /** + \brief Extracts an isosurface from the SDF of a mesh if it the SDF is available. + + \param[in] triangleMesh The triangle mesh + \param[out] isosurfaceVertices The vertices of the extracted isosurface + \param[out] isosurfaceTriangleIndices The triangles of the extracted isosurface + */ + bool PxExtractIsosurfaceFromSDF(const PxTriangleMesh& triangleMesh, PxArray& isosurfaceVertices, PxArray& isosurfaceTriangleIndices); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/filebuf/PxFileBuf.h b/engine/third_party/physx/include/filebuf/PxFileBuf.h new file mode 100644 index 00000000..a9ede6e0 --- /dev/null +++ b/engine/third_party/physx/include/filebuf/PxFileBuf.h @@ -0,0 +1,335 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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 PSFILEBUFFER_PXFILEBUF_H +#define PSFILEBUFFER_PXFILEBUF_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxAllocator.h" + + +#if !PX_DOXYGEN +namespace physx +{ + +namespace general_PxIOStream2 +{ +#endif + +PX_PUSH_PACK_DEFAULT + +/** +\brief Callback class for data serialization. + +The user needs to supply an PxFileBuf implementation to a number of methods to allow the SDK to read or write +chunks of binary data. This allows flexibility for the source/destination of the data. For example the PxFileBuf +could store data in a file, memory buffer or custom file format. + +\note It is the users responsibility to ensure that the data is written to the appropriate offset. + +*/ +class PxFileBuf +{ +public: + + enum EndianMode + { + ENDIAN_NONE = 0, // do no conversion for endian mode + ENDIAN_BIG = 1, // always read/write data as natively big endian (Power PC, etc.) + ENDIAN_LITTLE = 2 // always read/write data as natively little endian (Intel, etc.) Default Behavior! + }; + + PxFileBuf(EndianMode mode=ENDIAN_LITTLE) + { + setEndianMode(mode); + } + + virtual ~PxFileBuf() + { + + } + + /** + \brief Declares a constant to seek to the end of the stream. + * + * Does not support streams longer than 32 bits + */ + static const uint32_t STREAM_SEEK_END=0xFFFFFFFF; + + enum OpenMode + { + OPEN_FILE_NOT_FOUND, + OPEN_READ_ONLY, // open file buffer stream for read only access + OPEN_WRITE_ONLY, // open file buffer stream for write only access + OPEN_READ_WRITE_NEW, // open a new file for both read/write access + OPEN_READ_WRITE_EXISTING // open an existing file for both read/write access + }; + + virtual OpenMode getOpenMode() const = 0; + + bool isOpen() const + { + return getOpenMode()!=OPEN_FILE_NOT_FOUND; + } + + enum SeekType + { + SEEKABLE_NO = 0, + SEEKABLE_READ = 0x1, + SEEKABLE_WRITE = 0x2, + SEEKABLE_READWRITE = 0x3 + }; + + virtual SeekType isSeekable() const = 0; + + void setEndianMode(EndianMode e) + { + mEndianMode = e; + if ( (e==ENDIAN_BIG && !isBigEndian() ) || + (e==ENDIAN_LITTLE && isBigEndian() ) ) + { + mEndianSwap = true; + } + else + { + mEndianSwap = false; + } + } + + EndianMode getEndianMode() const + { + return mEndianMode; + } + + virtual uint32_t getFileLength() const = 0; + + /** + \brief Seeks the stream to a particular location for reading + * + * If the location passed exceeds the length of the stream, then it will seek to the end. + * Returns the location it ended up at (useful if you seek to the end) to get the file position + */ + virtual uint32_t seekRead(uint32_t loc) = 0; + + /** + \brief Seeks the stream to a particular location for writing + * + * If the location passed exceeds the length of the stream, then it will seek to the end. + * Returns the location it ended up at (useful if you seek to the end) to get the file position + */ + virtual uint32_t seekWrite(uint32_t loc) = 0; + + /** + \brief Reads from the stream into a buffer. + + \param[out] mem The buffer to read the stream into. + \param[in] len The number of bytes to stream into the buffer + + \return Returns the actual number of bytes read. If not equal to the length requested, then reached end of stream. + */ + virtual uint32_t read(void *mem,uint32_t len) = 0; + + + /** + \brief Reads from the stream into a buffer but does not advance the read location. + + \param[out] mem The buffer to read the stream into. + \param[in] len The number of bytes to stream into the buffer + + \return Returns the actual number of bytes read. If not equal to the length requested, then reached end of stream. + */ + virtual uint32_t peek(void *mem,uint32_t len) = 0; + + /** + \brief Writes a buffer of memory to the stream + + \param[in] mem The address of a buffer of memory to send to the stream. + \param[in] len The number of bytes to send to the stream. + + \return Returns the actual number of bytes sent to the stream. If not equal to the length specific, then the stream is full or unable to write for some reason. + */ + virtual uint32_t write(const void *mem,uint32_t len) = 0; + + /** + \brief Reports the current stream location read aqccess. + + \return Returns the current stream read location. + */ + virtual uint32_t tellRead() const = 0; + + /** + \brief Reports the current stream location for write access. + + \return Returns the current stream write location. + */ + virtual uint32_t tellWrite() const = 0; + + /** + \brief Causes any temporarily cached data to be flushed to the stream. + */ + virtual void flush() = 0; + + /** + \brief Close the stream. + */ + virtual void close() {} + + void release() + { + PX_DELETE_THIS; + } + + static PX_INLINE bool isBigEndian() + { + int32_t i = 1; + return *(reinterpret_cast(&i))==0; + } + + PX_INLINE void swap2Bytes(void* _data) const + { + char *data = static_cast(_data); + char one_byte; + one_byte = data[0]; data[0] = data[1]; data[1] = one_byte; + } + + PX_INLINE void swap4Bytes(void* _data) const + { + char *data = static_cast(_data); + char one_byte; + one_byte = data[0]; data[0] = data[3]; data[3] = one_byte; + one_byte = data[1]; data[1] = data[2]; data[2] = one_byte; + } + + PX_INLINE void swap8Bytes(void *_data) const + { + char *data = static_cast(_data); + char one_byte; + one_byte = data[0]; data[0] = data[7]; data[7] = one_byte; + one_byte = data[1]; data[1] = data[6]; data[6] = one_byte; + one_byte = data[2]; data[2] = data[5]; data[5] = one_byte; + one_byte = data[3]; data[3] = data[4]; data[4] = one_byte; + } + + + PX_INLINE void storeDword(uint32_t v) + { + if ( mEndianSwap ) + swap4Bytes(&v); + + write(&v,sizeof(v)); + } + + PX_INLINE void storeFloat(float v) + { + if ( mEndianSwap ) + swap4Bytes(&v); + write(&v,sizeof(v)); + } + + PX_INLINE void storeDouble(double v) + { + if ( mEndianSwap ) + swap8Bytes(&v); + write(&v,sizeof(v)); + } + + PX_INLINE void storeByte(uint8_t b) + { + write(&b,sizeof(b)); + } + + PX_INLINE void storeWord(uint16_t w) + { + if ( mEndianSwap ) + swap2Bytes(&w); + write(&w,sizeof(w)); + } + + uint8_t readByte() + { + uint8_t v=0; + read(&v,sizeof(v)); + return v; + } + + uint16_t readWord() + { + uint16_t v=0; + read(&v,sizeof(v)); + if ( mEndianSwap ) + swap2Bytes(&v); + return v; + } + + uint32_t readDword() + { + uint32_t v=0; + read(&v,sizeof(v)); + if ( mEndianSwap ) + swap4Bytes(&v); + return v; + } + + float readFloat() + { + float v=0; + read(&v,sizeof(v)); + if ( mEndianSwap ) + swap4Bytes(&v); + return v; + } + + double readDouble() + { + double v=0; + read(&v,sizeof(v)); + if ( mEndianSwap ) + swap8Bytes(&v); + return v; + } + +private: + bool mEndianSwap; // whether or not the endian should be swapped on the current platform + EndianMode mEndianMode; // the current endian mode behavior for the stream +}; + +PX_POP_PACK + +#if !PX_DOXYGEN +} // end of namespace + +using namespace general_PxIOStream2; + +namespace general_PxIOStream = general_PxIOStream2; + +} // end of namespace +#endif + + +#endif // PSFILEBUFFER_PXFILEBUF_H diff --git a/engine/third_party/physx/include/foundation/PxAlignedMalloc.h b/engine/third_party/physx/include/foundation/PxAlignedMalloc.h new file mode 100644 index 00000000..001ebeda --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxAlignedMalloc.h @@ -0,0 +1,94 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_ALIGNED_MALLOC_H +#define PX_ALIGNED_MALLOC_H + +#include "PxUserAllocated.h" + +/*! +Allocate aligned memory. +Alignment must be a power of 2! +-- should be templated by a base allocator +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif + /** + Allocator, which is used to access the global PxAllocatorCallback instance + (used for dynamic data types template instantiation), which can align memory + */ + + // SCS: AlignedMalloc with 3 params not found, seems not used on PC either + // disabled for now to avoid GCC error + + template + class PxAlignedAllocator : public BaseAllocator + { + public: + PxAlignedAllocator(const BaseAllocator& base = BaseAllocator()) : BaseAllocator(base) + { + } + + void* allocate(size_t size, const char* file, int line, uint32_t* cookie=NULL) + { + PX_UNUSED(cookie); + + size_t pad = N - 1 + sizeof(size_t); // store offset for delete. + uint8_t* base = reinterpret_cast(BaseAllocator::allocate(size + pad, file, line)); + if (!base) + return NULL; + + uint8_t* ptr = reinterpret_cast(size_t(base + pad) & ~(size_t(N) - 1)); // aligned pointer, ensuring N + // is a size_t + // wide mask + reinterpret_cast(ptr)[-1] = size_t(ptr - base); // store offset + + return ptr; + } + + void deallocate(void* ptr, uint32_t* cookie=NULL) + { + PX_UNUSED(cookie); + + if (ptr == NULL) + return; + + uint8_t* base = reinterpret_cast(ptr) - reinterpret_cast(ptr)[-1]; + BaseAllocator::deallocate(base); + } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxAlloca.h b/engine/third_party/physx/include/foundation/PxAlloca.h new file mode 100644 index 00000000..44d7f817 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxAlloca.h @@ -0,0 +1,90 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_ALLOCA_H +#define PX_ALLOCA_H + +#include "foundation/PxTempAllocator.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +template +class PxScopedPointer : private Alloc +{ + public: + ~PxScopedPointer() + { + if(mOwned) + Alloc::deallocate(mPointer); + } + + operator T*() const + { + return mPointer; + } + + T* mPointer; + bool mOwned; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + // Don't use inline for alloca !!! +#if PX_WINDOWS_FAMILY + #include + #define PxAlloca(x) _alloca(x) +#elif PX_LINUX + #include + #define PxAlloca(x) alloca(x) +#elif PX_APPLE_FAMILY + #include + #define PxAlloca(x) alloca(x) +#elif PX_SWITCH + #include + #define PxAlloca(x) alloca(x) +#endif + +#define PxAllocaAligned(x, alignment) ((size_t(PxAlloca(x + alignment)) + (alignment - 1)) & ~size_t(alignment - 1)) + +/*! Stack allocation for \c count instances of \c type. Falling back to temp allocator if using more than 4kB. */ +#define PX_ALLOCA(var, type, count) \ + physx::PxScopedPointer var; \ + { \ + const uint32_t size = sizeof(type) * (count); \ + var.mOwned = size > 4096; \ + if(var.mOwned) \ + var.mPointer = reinterpret_cast(physx::PxTempAllocator().allocate(size, PX_FL)); \ + else \ + var.mPointer = reinterpret_cast(PxAlloca(size)); \ + } +#endif + diff --git a/engine/third_party/physx/include/foundation/PxAllocator.h b/engine/third_party/physx/include/foundation/PxAllocator.h new file mode 100644 index 00000000..3c7eb555 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxAllocator.h @@ -0,0 +1,257 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_ALLOCATOR_H +#define PX_ALLOCATOR_H + +#include "foundation/PxAllocatorCallback.h" +#include "foundation/PxAssert.h" +#include "foundation/PxFoundation.h" +#include "foundation/PxIO.h" +#include + +#if PX_VC + #pragma warning(push) + #pragma warning(disable : 4577) +#endif + +#if PX_WINDOWS_FAMILY +#if(_MSC_VER >= 1923) + #include +#else + #include +#endif +#endif + +#if(PX_APPLE_FAMILY) + #include +#endif + +#include + +#if PX_VC + #pragma warning(pop) +#endif + +// PT: the rules are simple: +// - PX_ALLOC/PX_ALLOCATE/PX_FREE is similar to malloc/free. Use that for POD/anything that doesn't need ctor/dtor. +// - PX_NEW/PX_DELETE is similar to new/delete. Use that for anything that needs a ctor/dtor. +// - Everything goes through the user allocator. +// - Inherit from PxUserAllocated to PX_NEW something. Do it even on small classes, it's free. +// - You cannot PX_NEW a POD. Use PX_ALLOC. + +#define PX_ALLOC(n, name) physx::PxAllocator().allocate(n, PX_FL) + +// PT: use this one to reduce the amount of visible reinterpret_cast +#define PX_ALLOCATE(type, count, name) reinterpret_cast(PX_ALLOC(count*sizeof(type), name)) + +#define PX_FREE(x) \ + if(x) \ + { \ + physx::PxAllocator().deallocate(x); \ + x = NULL; \ + } + +#define PX_FREE_THIS physx::PxAllocator().deallocate(this) + +// PT: placement new is only needed when you control where the object is created (i.e. you already have an address for it before creating the object). +// So there are basically 2 legitimate placement new usages in PhysX: +// - binary deserialization +// - arrays/pools +// If you end up writing "PX_PLACEMENT_NEW(PX_ALLOC(sizeof(X), "X")", consider deriving X from PxUserAllocated and using PX_NEW instead. +#define PX_PLACEMENT_NEW(p, T) new (p) T +#define PX_NEW(T) new (physx::PxReflectionAllocator(), PX_FL) T +#define PX_DELETE_THIS delete this +#define PX_DELETE(x) if(x) { delete x; x = NULL; } +#define PX_DELETE_ARRAY(x) if(x) { delete []x; x = NULL; } +#define PX_RELEASE(x) if(x) { x->release(); x = NULL; } + +#if !PX_DOXYGEN +namespace physx +{ +#endif + /** + \brief Allocator used to access the global PxAllocatorCallback instance without providing additional information. + */ + class PxAllocator + { + public: + PX_FORCE_INLINE PxAllocator(const char* = NULL){} + + static PX_FORCE_INLINE void* allocate(size_t size, const char* file, int line, uint32_t* cookie=NULL) + { + PX_UNUSED(cookie); + return size ? PxGetBroadcastAllocator()->allocate(size, "", file, line) : NULL; + } + + static PX_FORCE_INLINE void deallocate(void* ptr, uint32_t* cookie=NULL) + { + PX_UNUSED(cookie); + if(ptr) + PxGetBroadcastAllocator()->deallocate(ptr); + } + }; + + /** + * \brief Bootstrap allocator using malloc/free. + * Don't use unless your objects get allocated before foundation is initialized. + */ + class PxRawAllocator + { + public: + PxRawAllocator(const char* = 0) {} + + static PX_FORCE_INLINE void* allocate(size_t size, const char*, int, uint32_t* cookie=NULL) + { + PX_UNUSED(cookie); + // malloc returns valid pointer for size==0, no need to check + return ::malloc(size); + } + + static PX_FORCE_INLINE void deallocate(void* ptr, uint32_t* cookie=NULL) + { + PX_UNUSED(cookie); + // free(0) is guaranteed to have no side effect, no need to check + ::free(ptr); + } + }; + + /** + \brief Virtual allocator callback used to provide run-time defined allocators to foundation types like Array or Bitmap. + This is used by VirtualAllocator + */ + class PxVirtualAllocatorCallback + { + public: + PxVirtualAllocatorCallback() {} + virtual ~PxVirtualAllocatorCallback() {} + + virtual void* allocate(size_t size, int group, const char* file, int line) = 0; + virtual void deallocate(void* ptr) = 0; + }; + + /** + \brief Virtual allocator to be used by foundation types to provide run-time defined allocators. + Due to the fact that Array extends its allocator, rather than contains a reference/pointer to it, the VirtualAllocator must + be a concrete type containing a pointer to a virtual callback. The callback may not be available at instantiation time, + therefore methods are provided to set the callback later. + */ + class PxVirtualAllocator + { + public: + PxVirtualAllocator(PxVirtualAllocatorCallback* callback = NULL, int group = 0) : mCallback(callback), mGroup(group) {} + + PX_FORCE_INLINE void* allocate(size_t size, const char* file, int line, uint32_t* cookie=NULL) + { + PX_UNUSED(cookie); + PX_ASSERT(mCallback); + if (size) + return mCallback->allocate(size, mGroup, file, line); + return NULL; + } + + PX_FORCE_INLINE void deallocate(void* ptr, uint32_t* cookie=NULL) + { + PX_UNUSED(cookie); + PX_ASSERT(mCallback); + if (ptr) + mCallback->deallocate(ptr); + } + + PX_FORCE_INLINE void setCallback(PxVirtualAllocatorCallback* callback) + { + mCallback = callback; + } + + PX_FORCE_INLINE PxVirtualAllocatorCallback* getCallback() + { + return mCallback; + } + + private: + PxVirtualAllocatorCallback* mCallback; + const int mGroup; + PxVirtualAllocator& operator=(const PxVirtualAllocator&); + }; + + /** + \brief Allocator used to access the global PxAllocatorCallback instance using a static name derived from T. + */ + template + class PxReflectionAllocator + { + static const char* getName(bool reportAllocationNames) + { + if(!reportAllocationNames) + return ""; +#if PX_GCC_FAMILY + return __PRETTY_FUNCTION__; +#else + // name() calls malloc(), raw_name() wouldn't + return typeid(T).name(); +#endif + } + + public: + PxReflectionAllocator(const PxEMPTY) {} + PxReflectionAllocator(const char* = 0) {} + + inline PxReflectionAllocator(const PxReflectionAllocator&) {} + + static PX_FORCE_INLINE void* allocate(size_t size, const char* filename, int line, uint32_t* cookie=NULL) + { + PX_UNUSED(cookie); + if(!size) + return NULL; + + bool reportAllocationNames; + PxAllocatorCallback* cb = PxGetBroadcastAllocator(&reportAllocationNames); + + return cb->allocate(size, getName(reportAllocationNames), filename, line); + } + + static PX_FORCE_INLINE void deallocate(void* ptr, uint32_t* cookie=NULL) + { + PX_UNUSED(cookie); + if(ptr) + PxGetBroadcastAllocator()->deallocate(ptr); + } + }; + + template + struct PxAllocatorTraits + { + typedef PxReflectionAllocator Type; + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxAllocatorCallback.h b/engine/third_party/physx/include/foundation/PxAllocatorCallback.h new file mode 100644 index 00000000..9c6f37a2 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxAllocatorCallback.h @@ -0,0 +1,90 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_ALLOCATOR_CALLBACK_H +#define PX_ALLOCATOR_CALLBACK_H + + +#include "foundation/PxFoundationConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Abstract base class for an application defined memory allocator that can be used by the Nv library. + +\note The SDK state should not be modified from within any allocation/free function. + +Threading: All methods of this class should be thread safe as it can be called from the user thread +or the physics processing thread(s). +*/ + +class PxAllocatorCallback +{ + public: + + virtual ~PxAllocatorCallback() + { + } + + /** + \brief Allocates size bytes of memory, which must be 16-byte aligned. + + This method should never return NULL. If you run out of memory, then + you should terminate the app or take some other appropriate action. + + Threading: This function should be thread safe as it can be called in the context of the user thread + and physics processing thread(s). + + \param size Number of bytes to allocate. + \param typeName Name of the datatype that is being allocated + \param filename The source file which allocated the memory + \param line The source line which allocated the memory + \return The allocated block of memory. + */ + virtual void* allocate(size_t size, const char* typeName, const char* filename, int line) = 0; + + /** + \brief Frees memory previously allocated by allocate(). + + Threading: This function should be thread safe as it can be called in the context of the user thread + and physics processing thread(s). + + \param ptr Memory to free. + */ + virtual void deallocate(void* ptr) = 0; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxAoS.h b/engine/third_party/physx/include/foundation/PxAoS.h new file mode 100644 index 00000000..a42f63e5 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxAoS.h @@ -0,0 +1,41 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_AOS_H +#define PX_AOS_H + + +#if PX_WINDOWS && !PX_NEON +#include "windows/PxWindowsAoS.h" +#elif(PX_UNIX_FAMILY || PX_SWITCH) +#include "unix/PxUnixAoS.h" +#else +#error "Platform not supported!" +#endif + +#endif diff --git a/engine/third_party/physx/include/foundation/PxArray.h b/engine/third_party/physx/include/foundation/PxArray.h new file mode 100644 index 00000000..fe89f332 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxArray.h @@ -0,0 +1,724 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_H +#define PX_ARRAY_H + +#include "foundation/PxAssert.h" +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxMemory.h" +#include "foundation/PxIO.h" + +namespace physx +{ + +/*! +An array is a sequential container. + +Implementation note +* entries between 0 and size are valid objects +* we use inheritance to build this because the array is included inline in a lot + of objects and we want the allocator to take no space if it's not stateful, which + aggregation doesn't allow. Also, we want the metadata at the front for the inline + case where the allocator contains some inline storage space +*/ +template ::Type> +class PxArray : protected Alloc +{ + public: + typedef T* Iterator; + typedef const T* ConstIterator; + + explicit PxArray(const PxEMPTY v) : Alloc(v) + { + if(mData) + mCapacity |= PX_SIGN_BITMASK; + } + + /*! + Default array constructor. Initialize an empty array + */ + PX_INLINE explicit PxArray(const Alloc& alloc = Alloc()) : Alloc(alloc), mData(0), mSize(0), mCapacity(0) + { + } + + /*! + Initialize array with given capacity + */ + PX_INLINE explicit PxArray(uint32_t size, const T& a = T(), const Alloc& alloc = Alloc()) + : Alloc(alloc), mData(0), mSize(0), mCapacity(0) + { + resize(size, a); + } + + /*! + Copy-constructor. Copy all entries from other array + */ + template + PX_INLINE explicit PxArray(const PxArray& other, const Alloc& alloc = Alloc()) + : Alloc(alloc) + { + copy(other); + } + + // This is necessary else the basic default copy constructor is used in the case of both arrays being of the same + // template instance + // The C++ standard clearly states that a template constructor is never a copy constructor [2]. In other words, + // the presence of a template constructor does not suppress the implicit declaration of the copy constructor. + // Also never make a copy constructor explicit, or copy-initialization* will no longer work. This is because + // 'binding an rvalue to a const reference requires an accessible copy constructor' (http://gcc.gnu.org/bugs/) + // *http://stackoverflow.com/questions/1051379/is-there-a-difference-in-c-between-copy-initialization-and-assignment-initializ + PX_INLINE PxArray(const PxArray& other, const Alloc& alloc = Alloc()) : Alloc(alloc) + { + copy(other); + } + + /*! + Initialize array with given length + */ + PX_INLINE explicit PxArray(const T* first, const T* last, const Alloc& alloc = Alloc()) + : Alloc(alloc), mSize(last < first ? 0 : uint32_t(last - first)), mCapacity(mSize) + { + mData = allocate(mSize); + copy(mData, mData + mSize, first); + } + + /*! + Destructor + */ + PX_INLINE ~PxArray() + { + destroy(mData, mData + mSize); + + if(capacity() && !isInUserMemory()) + deallocate(mData); + } + + /*! + Assignment operator. Copy content (deep-copy) + */ + template + PX_INLINE PxArray& operator=(const PxArray& rhs) + { + if(&rhs == this) + return *this; + + clear(); + reserve(rhs.mSize); + copy(mData, mData + rhs.mSize, rhs.mData); + + mSize = rhs.mSize; + return *this; + } + + PX_INLINE PxArray& operator=(const PxArray& t) // Needs to be declared, see comment at copy-constructor + { + return operator=(t); + } + + /*! + Array indexing operator. + \param i + The index of the element that will be returned. + \return + The element i in the array. + */ + PX_FORCE_INLINE const T& operator[](uint32_t i) const + { + PX_ASSERT(i < mSize); + return mData[i]; + } + + /*! + Array indexing operator. + \param i + The index of the element that will be returned. + \return + The element i in the array. + */ + PX_FORCE_INLINE T& operator[](uint32_t i) + { + PX_ASSERT(i < mSize); + return mData[i]; + } + + /*! + Returns a pointer to the initial element of the array. + \return + a pointer to the initial element of the array. + */ + PX_FORCE_INLINE ConstIterator begin() const + { + return mData; + } + + PX_FORCE_INLINE Iterator begin() + { + return mData; + } + + /*! + Returns an iterator beyond the last element of the array. Do not dereference. + \return + a pointer to the element beyond the last element of the array. + */ + + PX_FORCE_INLINE ConstIterator end() const + { + return mData + mSize; + } + + PX_FORCE_INLINE Iterator end() + { + return mData + mSize; + } + + /*! + Returns a reference to the first element of the array. Undefined if the array is empty. + \return a reference to the first element of the array + */ + + PX_FORCE_INLINE const T& front() const + { + PX_ASSERT(mSize); + return mData[0]; + } + + PX_FORCE_INLINE T& front() + { + PX_ASSERT(mSize); + return mData[0]; + } + + /*! + Returns a reference to the last element of the array. Undefined if the array is empty + \return a reference to the last element of the array + */ + + PX_FORCE_INLINE const T& back() const + { + PX_ASSERT(mSize); + return mData[mSize - 1]; + } + + PX_FORCE_INLINE T& back() + { + PX_ASSERT(mSize); + return mData[mSize - 1]; + } + + /*! + Returns the number of entries in the array. This can, and probably will, + differ from the array capacity. + \return + The number of of entries in the array. + */ + PX_FORCE_INLINE uint32_t size() const + { + return mSize; + } + + /*! + Clears the array. + */ + PX_INLINE void clear() + { + destroy(mData, mData + mSize); + mSize = 0; + } + + /*! + Returns whether the array is empty (i.e. whether its size is 0). + \return + true if the array is empty + */ + PX_FORCE_INLINE bool empty() const + { + return mSize == 0; + } + + /*! + Finds the first occurrence of an element in the array. + \param a + The element to find. + */ + + PX_INLINE Iterator find(const T& a) + { + uint32_t index; + for(index = 0; index < mSize && mData[index] != a; index++) + ; + return mData + index; + } + + PX_INLINE ConstIterator find(const T& a) const + { + uint32_t index; + for(index = 0; index < mSize && mData[index] != a; index++) + ; + return mData + index; + } + + ///////////////////////////////////////////////////////////////////////// + /*! + Adds one element to the end of the array. Operation is O(1). + \param a + The element that will be added to this array. + */ + ///////////////////////////////////////////////////////////////////////// + + PX_FORCE_INLINE T& pushBack(const T& a) + { + if(capacity() <= mSize) + return growAndPushBack(a); + + PX_PLACEMENT_NEW(reinterpret_cast(mData + mSize), T)(a); + + return mData[mSize++]; + } + + ///////////////////////////////////////////////////////////////////////// + /*! + Returns the element at the end of the array. Only legal if the array is non-empty. + */ + ///////////////////////////////////////////////////////////////////////// + PX_INLINE T popBack() + { + PX_ASSERT(mSize); + T t = mData[mSize - 1]; + + mData[--mSize].~T(); + + return t; + } + + ///////////////////////////////////////////////////////////////////////// + /*! + Construct one element at the end of the array. Operation is O(1). + */ + ///////////////////////////////////////////////////////////////////////// + PX_INLINE T& insert() + { + if(capacity() <= mSize) + grow(capacityIncrement()); + + T* ptr = mData + mSize++; + PX_PLACEMENT_NEW(ptr, T); // not 'T()' because PODs should not get default-initialized. + return *ptr; + } + + ///////////////////////////////////////////////////////////////////////// + /*! + Subtracts the element on position i from the array and replace it with + the last element. + Operation is O(1) + \param i + The position of the element that will be subtracted from this array. + */ + ///////////////////////////////////////////////////////////////////////// + PX_INLINE void replaceWithLast(uint32_t i) + { + PX_ASSERT(i < mSize); + mData[i] = mData[--mSize]; + + mData[mSize].~T(); + } + + PX_INLINE void replaceWithLast(Iterator i) + { + replaceWithLast(static_cast(i - mData)); + } + + ///////////////////////////////////////////////////////////////////////// + /*! + Replaces the first occurrence of the element a with the last element + Operation is O(n) + \param a + The position of the element that will be subtracted from this array. + \return true if the element has been removed. + */ + ///////////////////////////////////////////////////////////////////////// + + PX_INLINE bool findAndReplaceWithLast(const T& a) + { + uint32_t index = 0; + while(index < mSize && mData[index] != a) + ++index; + if(index == mSize) + return false; + replaceWithLast(index); + return true; + } + + ///////////////////////////////////////////////////////////////////////// + /*! + Subtracts the element on position i from the array. Shift the entire + array one step. + Operation is O(n) + \param i + The position of the element that will be subtracted from this array. + */ + ///////////////////////////////////////////////////////////////////////// + PX_INLINE void remove(uint32_t i) + { + PX_ASSERT(i < mSize); + + T* it = mData + i; + it->~T(); + while (++i < mSize) + { + PX_PLACEMENT_NEW(it, T(mData[i])); + ++it; + it->~T(); + } + --mSize; + } + + ///////////////////////////////////////////////////////////////////////// + /*! + Removes a range from the array. Shifts the array so order is maintained. + Operation is O(n) + \param begin + The starting position of the element that will be subtracted from this array. + \param count + The number of elments that will be subtracted from this array. + */ + ///////////////////////////////////////////////////////////////////////// + PX_INLINE void removeRange(uint32_t begin, uint32_t count) + { + PX_ASSERT(begin < mSize); + PX_ASSERT((begin + count) <= mSize); + + for(uint32_t i = 0; i < count; i++) + mData[begin + i].~T(); // call the destructor on the ones being removed first. + + T* dest = &mData[begin]; // location we are copying the tail end objects to + T* src = &mData[begin + count]; // start of tail objects + uint32_t move_count = mSize - (begin + count); // compute remainder that needs to be copied down + + for(uint32_t i = 0; i < move_count; i++) + { + PX_PLACEMENT_NEW(dest, T(*src)); // copy the old one to the new location + src->~T(); // call the destructor on the old location + dest++; + src++; + } + mSize -= count; + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Resize array + */ + ////////////////////////////////////////////////////////////////////////// + PX_NOINLINE void resize(const uint32_t size, const T& a = T()); + + PX_NOINLINE void resizeUninitialized(const uint32_t size); + + ////////////////////////////////////////////////////////////////////////// + /*! + Resize array such that only as much memory is allocated to hold the + existing elements + */ + ////////////////////////////////////////////////////////////////////////// + PX_INLINE void shrink() + { + recreate(mSize); + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Deletes all array elements and frees memory. + */ + ////////////////////////////////////////////////////////////////////////// + PX_INLINE void reset() + { + resize(0); + shrink(); + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Resets or clears the array depending on occupancy. + */ + ////////////////////////////////////////////////////////////////////////// + PX_INLINE void resetOrClear() + { + const PxU32 c = capacity(); + const PxU32 s = size(); + if(s>=c/2) + clear(); + else + reset(); + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Ensure that the array has at least size capacity. + */ + ////////////////////////////////////////////////////////////////////////// + PX_INLINE void reserve(const uint32_t capacity) + { + if(capacity > this->capacity()) + grow(capacity); + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Query the capacity(allocated mem) for the array. + */ + ////////////////////////////////////////////////////////////////////////// + PX_FORCE_INLINE uint32_t capacity() const + { + return mCapacity & ~PX_SIGN_BITMASK; + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Unsafe function to force the size of the array + */ + ////////////////////////////////////////////////////////////////////////// + PX_FORCE_INLINE void forceSize_Unsafe(uint32_t size) + { + PX_ASSERT(size <= mCapacity); + mSize = size; + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Swap contents of an array without allocating temporary storage + */ + ////////////////////////////////////////////////////////////////////////// + PX_INLINE void swap(PxArray& other) + { + PxSwap(mData, other.mData); + PxSwap(mSize, other.mSize); + PxSwap(mCapacity, other.mCapacity); + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Assign a range of values to this vector (resizes to length of range) + */ + ////////////////////////////////////////////////////////////////////////// + PX_INLINE void assign(const T* first, const T* last) + { + resizeUninitialized(uint32_t(last - first)); + copy(begin(), end(), first); + } + + // We need one bit to mark arrays that have been deserialized from a user-provided memory block. + // For alignment & memory saving purpose we store that bit in the rarely used capacity member. + PX_FORCE_INLINE uint32_t isInUserMemory() const + { + return mCapacity & PX_SIGN_BITMASK; + } + + /// return reference to allocator + PX_INLINE Alloc& getAllocator() + { + return *this; + } + + protected: + // constructor for where we don't own the memory + PxArray(T* memory, uint32_t size, uint32_t capacity, const Alloc& alloc = Alloc()) + : Alloc(alloc), mData(memory), mSize(size), mCapacity(capacity | PX_SIGN_BITMASK) + { + } + + template + PX_NOINLINE void copy(const PxArray& other); + + PX_INLINE T* allocate(uint32_t size, uint32_t* cookie=NULL) + { + if(size > 0) + { + T* p = reinterpret_cast(Alloc::allocate(sizeof(T) * size, PX_FL, cookie)); + PxMarkSerializedMemory(p, sizeof(T) * size); + return p; + } + return NULL; + } + + PX_INLINE void deallocate(void* mem, uint32_t* cookie=NULL) + { + Alloc::deallocate(mem, cookie); + } + + static PX_INLINE void create(T* first, T* last, const T& a) + { + for(; first < last; ++first) + ::PX_PLACEMENT_NEW(first, T(a)); + } + + static PX_INLINE void copy(T* first, T* last, const T* src) + { + if(last <= first) + return; + + for(; first < last; ++first, ++src) + ::PX_PLACEMENT_NEW(first, T(*src)); + } + + static PX_INLINE void destroy(T* first, T* last) + { + for(; first < last; ++first) + first->~T(); + } + + /*! + Called when pushBack() needs to grow the array. + \param a The element that will be added to this array. + */ + PX_NOINLINE T& growAndPushBack(const T& a); + + /*! + Resizes the available memory for the array. + + \param capacity + The number of entries that the set should be able to hold. + */ + PX_INLINE void grow(uint32_t capacity) + { + PX_ASSERT(this->capacity() < capacity); + recreate(capacity); + } + + /*! + Creates a new memory block, copies all entries to the new block and destroys old entries. + + \param capacity + The number of entries that the set should be able to hold. + */ + PX_NOINLINE void recreate(uint32_t capacity); + + // The idea here is to prevent accidental bugs with pushBack or insert. Unfortunately + // it interacts badly with InlineArrays with smaller inline allocations. + // TODO(dsequeira): policy template arg, this is exactly what they're for. + PX_INLINE uint32_t capacityIncrement() const + { + const uint32_t capacity = this->capacity(); + return capacity == 0 ? 1 : capacity * 2; + } + + T* mData; + uint32_t mSize; + uint32_t mCapacity; +}; + +template +PX_NOINLINE void PxArray::resize(const uint32_t size, const T& a) +{ + reserve(size); + create(mData + mSize, mData + size, a); + destroy(mData + size, mData + mSize); + mSize = size; +} + +template +template +PX_NOINLINE void PxArray::copy(const PxArray& other) +{ + if(!other.empty()) + { + mData = allocate(mSize = mCapacity = other.size()); + copy(mData, mData + mSize, other.begin()); + } + else + { + mData = NULL; + mSize = 0; + mCapacity = 0; + } + + // mData = allocate(other.mSize); + // mSize = other.mSize; + // mCapacity = other.mSize; + // copy(mData, mData + mSize, other.mData); +} + +template +PX_NOINLINE void PxArray::resizeUninitialized(const uint32_t size) +{ + reserve(size); + mSize = size; +} + +template +PX_NOINLINE T& PxArray::growAndPushBack(const T& a) +{ + const uint32_t capacity = capacityIncrement(); + + uint32_t cookie; + T* newData = allocate(capacity, &cookie); + PX_ASSERT((!capacity) || (newData && (newData != mData))); + copy(newData, newData + mSize, mData); + + // inserting element before destroying old array + // avoids referencing destroyed object when duplicating array element. + PX_PLACEMENT_NEW(reinterpret_cast(newData + mSize), T)(a); + + destroy(mData, mData + mSize); + if(!isInUserMemory()) + deallocate(mData, &cookie); + + mData = newData; + mCapacity = capacity; + + return mData[mSize++]; +} + +template +PX_NOINLINE void PxArray::recreate(uint32_t capacity) +{ + uint32_t cookie; + T* newData = allocate(capacity, &cookie); + PX_ASSERT((!capacity) || (newData && (newData != mData))); + + copy(newData, newData + mSize, mData); + destroy(mData, mData + mSize); + if(!isInUserMemory()) + deallocate(mData, &cookie); + + mData = newData; + mCapacity = capacity; +} + +template +PX_INLINE void swap(PxArray& x, PxArray& y) +{ + x.swap(y); +} + +} // namespace physx + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxAssert.h b/engine/third_party/physx/include/foundation/PxAssert.h new file mode 100644 index 00000000..465ce491 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxAssert.h @@ -0,0 +1,85 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_ASSERT_H +#define PX_ASSERT_H + +#include +#include "foundation/PxFoundationConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** + * \brief Built-in assert function + */ +PX_FOUNDATION_API void PxAssert(const char* exp, const char* file, int line, bool& ignore); + +#if !PX_ENABLE_ASSERTS + #define PX_ASSERT(exp) ((void)0) + #define PX_ALWAYS_ASSERT_MESSAGE(exp) ((void)0) + #define PX_ASSERT_WITH_MESSAGE(condition, message) ((void)0) +#else +#if PX_VC + #define PX_CODE_ANALYSIS_ASSUME(exp) \ + __analysis_assume(!!(exp)) // This macro will be used to get rid of analysis warning messages if a PX_ASSERT is used + // to "guard" illegal mem access, for example. +#else + #define PX_CODE_ANALYSIS_ASSUME(exp) +#endif + #define PX_ASSERT(exp) \ + { \ + static bool _ignore = false; \ + ((void)((!!(exp)) || (!_ignore && (physx::PxAssert(#exp, PX_FL, _ignore), false)))); \ + PX_CODE_ANALYSIS_ASSUME(exp); \ + } + #define PX_ALWAYS_ASSERT_MESSAGE(exp) \ + { \ + static bool _ignore = false; \ + if(!_ignore) \ + physx::PxAssert(exp, PX_FL, _ignore); \ + } + #define PX_ASSERT_WITH_MESSAGE(exp, message) \ + { \ + static bool _ignore = false; \ + ((void)((!!(exp)) || (!_ignore && (physx::PxAssert(message, PX_FL, _ignore), false)))); \ + PX_CODE_ANALYSIS_ASSUME(exp); \ + } +#endif // !PX_ENABLE_ASSERTS + +#define PX_ALWAYS_ASSERT() PX_ASSERT(0) + +#if !PX_DOXYGEN +} // namespace physx +#endif + + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxAtomic.h b/engine/third_party/physx/include/foundation/PxAtomic.h new file mode 100644 index 00000000..6254ffb9 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxAtomic.h @@ -0,0 +1,79 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_ATOMIC_H +#define PX_ATOMIC_H + +#include "foundation/PxFoundationConfig.h" +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +/* set *dest equal to val. Return the old value of *dest */ +PX_FOUNDATION_API PxI32 PxAtomicExchange(volatile PxI32* dest, PxI32 val); +PX_FOUNDATION_API PxI64 PxAtomicExchange(volatile PxI64* dest, PxI64 val); + +/* if *dest == comp, replace with exch. Return original value of *dest */ +PX_FOUNDATION_API PxI32 PxAtomicCompareExchange(volatile PxI32* dest, PxI32 exch, PxI32 comp); +PX_FOUNDATION_API PxI64 PxAtomicCompareExchange(volatile PxI64* dest, PxI64 exch, PxI64 comp); + +/* if *dest == comp, replace with exch. Return original value of *dest */ +PX_FOUNDATION_API void* PxAtomicCompareExchangePointer(volatile void** dest, void* exch, void* comp); + +/* increment the specified location. Return the incremented value */ +PX_FOUNDATION_API PxI32 PxAtomicIncrement(volatile PxI32* val); +PX_FOUNDATION_API PxI64 PxAtomicIncrement(volatile PxI64* val); + +/* decrement the specified location. Return the decremented value */ +PX_FOUNDATION_API PxI32 PxAtomicDecrement(volatile PxI32* val); +PX_FOUNDATION_API PxI64 PxAtomicDecrement(volatile PxI64* val); + +/* add delta to *val. Return the new value */ +PX_FOUNDATION_API PxI32 PxAtomicAdd(volatile PxI32* val, PxI32 delta); +PX_FOUNDATION_API PxI64 PxAtomicAdd(volatile PxI64* val, PxI64 delta); + +/* compute the maximum of dest and val. Return the new value */ +PX_FOUNDATION_API PxI32 PxAtomicMax(volatile PxI32* val, PxI32 val2); +PX_FOUNDATION_API PxI64 PxAtomicMax(volatile PxI64* val, PxI64 val2); + +/* or mask to *val. Return the new value */ +PX_FOUNDATION_API PxI32 PxAtomicOr(volatile PxI32* val, PxI32 mask); +PX_FOUNDATION_API PxI64 PxAtomicOr(volatile PxI64* val, PxI64 mask); + +/* and mask to *val. Return the new value */ +PX_FOUNDATION_API PxI32 PxAtomicAnd(volatile PxI32* val, PxI32 mask); +PX_FOUNDATION_API PxI64 PxAtomicAnd(volatile PxI64* val, PxI64 mask); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxBasicTemplates.h b/engine/third_party/physx/include/foundation/PxBasicTemplates.h new file mode 100644 index 00000000..c8a895d2 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxBasicTemplates.h @@ -0,0 +1,145 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_BASIC_TEMPLATES_H +#define PX_BASIC_TEMPLATES_H + +#include "foundation/PxPreprocessor.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + template + struct PxEqual + { + bool operator()(const A& a, const A& b) const + { + return a == b; + } + }; + + template + struct PxLess + { + bool operator()(const A& a, const A& b) const + { + return a < b; + } + }; + + template + struct PxGreater + { + bool operator()(const A& a, const A& b) const + { + return a > b; + } + }; + + template + class PxPair + { + public: + F first; + S second; + PX_CUDA_CALLABLE PX_INLINE PxPair() : first(F()), second(S()) + { + } + PX_CUDA_CALLABLE PX_INLINE PxPair(const F& f, const S& s) : first(f), second(s) + { + } + PX_CUDA_CALLABLE PX_INLINE PxPair(const PxPair& p) : first(p.first), second(p.second) + { + } + PX_CUDA_CALLABLE PX_INLINE PxPair& operator=(const PxPair& p) + { + first = p.first; + second = p.second; + return *this; + } + PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxPair& p) const + { + return first == p.first && second == p.second; + } + PX_CUDA_CALLABLE PX_INLINE bool operator<(const PxPair& p) const + { + if (first < p.first) + return true; + else + return !(p.first < first) && (second < p.second); + } + }; + + template + struct PxLogTwo + { + static const unsigned int value = PxLogTwo<(A >> 1)>::value + 1; + }; + template <> + struct PxLogTwo<1> + { + static const unsigned int value = 0; + }; + + template + struct PxUnConst + { + typedef T Type; + }; + template + struct PxUnConst + { + typedef T Type; + }; + + template + T PxPointerOffset(void* p, ptrdiff_t offset) + { + return reinterpret_cast(reinterpret_cast(p) + offset); + } + template + T PxPointerOffset(const void* p, ptrdiff_t offset) + { + return reinterpret_cast(reinterpret_cast(p) + offset); + } + + template + PX_CUDA_CALLABLE PX_INLINE void PxSwap(T& x, T& y) + { + const T tmp = x; + x = y; + y = tmp; + } + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxBitAndData.h b/engine/third_party/physx/include/foundation/PxBitAndData.h new file mode 100644 index 00000000..a7cea4fb --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxBitAndData.h @@ -0,0 +1,84 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_BIT_AND_DATA_H +#define PX_BIT_AND_DATA_H + +#include "foundation/PxIO.h" +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +template +class PxBitAndDataT +{ + public: + PX_FORCE_INLINE PxBitAndDataT(const PxEMPTY) + { + } + PX_FORCE_INLINE PxBitAndDataT() : mData(0) + { + } + PX_FORCE_INLINE PxBitAndDataT(storageType data, bool bit = false) + { + mData = bit ? storageType(data | bitMask) : data; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE operator storageType() const + { + return storageType(mData & ~bitMask); + } + PX_CUDA_CALLABLE PX_FORCE_INLINE void setBit() + { + mData |= bitMask; + } + PX_CUDA_CALLABLE PX_FORCE_INLINE void clearBit() + { + mData &= ~bitMask; + } + PX_CUDA_CALLABLE PX_FORCE_INLINE storageType isBitSet() const + { + return storageType(mData & bitMask); + } + + protected: + storageType mData; +}; +typedef PxBitAndDataT PxBitAndByte; +typedef PxBitAndDataT PxBitAndWord; +typedef PxBitAndDataT PxBitAndDword; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxBitMap.h b/engine/third_party/physx/include/foundation/PxBitMap.h new file mode 100644 index 00000000..ce4b1c86 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxBitMap.h @@ -0,0 +1,511 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_BITMAP_H +#define PX_BITMAP_H + +#include "foundation/PxAssert.h" +#include "foundation/PxMath.h" +#include "foundation/PxMemory.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxBitUtils.h" +#include "foundation/PxConstructor.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + /*! + Hold a bitmap with operations to set,reset or test given bit. + + We inhibit copy to prevent unintentional copies. If a copy is desired copy() should be used or + alternatively a copy constructor implemented. + */ + template + class PxBitMapBase : public PxUserAllocated + { + PX_NOCOPY(PxBitMapBase) + + public: + + // PX_SERIALIZATION + /* todo: explicit */ PxBitMapBase(const PxEMPTY) + { + if(mMap) + mWordCount |= PX_SIGN_BITMASK; + } + //~PX_SERIALIZATION + + PX_INLINE PxBitMapBase(const PxAllocator& allocator) : mMap(0), mWordCount(0), mAllocator(allocator) {} + + PX_INLINE PxBitMapBase() : mMap(0), mWordCount(0) {} + + PX_INLINE ~PxBitMapBase() + { + release(); + } + + PX_INLINE void release() + { + if(mMap && !isInUserMemory()) + mAllocator.deallocate(mMap); + mMap = NULL; + } + + PX_FORCE_INLINE PxAllocator& getAllocator() { return mAllocator; } + + PX_INLINE void growAndSet(PxU32 index) + { + extend(index + 1); + mMap[index >> 5] |= 1 << (index & 31); + } + + PX_INLINE void growAndReset(PxU32 index) + { + extend(index + 1); + mMap[index >> 5] &= ~(1 << (index & 31)); + } + + PX_INLINE PxIntBool boundedTest(PxU32 index) const + { + return PxIntBool(index >> 5 >= getWordCount() ? PxIntFalse : (mMap[index >> 5] & (1 << (index & 31)))); + } + + PX_INLINE void boundedReset(PxU32 index) + { + if((index >> 5) < getWordCount()) + mMap[index >> 5] &= ~(1 << (index & 31)); + } + + // Special optimized versions, when you _know_ your index is in range + PX_INLINE void set(PxU32 index) + { + PX_ASSERT(index> 5] |= 1 << (index & 31); + } + + PX_INLINE void reset(PxU32 index) + { + PX_ASSERT(index> 5] &= ~(1 << (index & 31)); + } + + PX_INLINE PxIntBool test(PxU32 index) const + { + PX_ASSERT(index> 5] & (1 << (index & 31))); + } + + // nibble == 4 bits + PX_INLINE PxU32 getNibbleFast(PxU32 nibIndex) const + { + const PxU32 bitIndex = nibIndex << 2; + PX_ASSERT(bitIndex < getWordCount() * 32); + return (mMap[bitIndex >> 5] >> (bitIndex & 31)) & 0xf; + } + + PX_INLINE void andNibbleFast(PxU32 nibIndex, PxU32 mask) + { + //TODO: there has to be a faster way... + const PxU32 bitIndex = nibIndex << 2; + const PxU32 shift = (bitIndex & 31); + const PxU32 nibMask = (0xfu << shift); + + PX_ASSERT(bitIndex < getWordCount() * 32); + + mMap[bitIndex >> 5] &= ((mask << shift) | ~nibMask); + } + + PX_INLINE void orNibbleFast(PxU32 nibIndex, PxU32 mask) + { + PX_ASSERT(!(mask & ~0xfu)); //check extra bits are not set + + const PxU32 bitIndex = nibIndex << 2; + const PxU32 shift = bitIndex & 31; + + PX_ASSERT(bitIndex < getWordCount() * 32); + + mMap[bitIndex >> 5] |= (mask << shift); + } + + void clear() + { + PxMemSet(mMap, 0, getWordCount() * sizeof(PxU32)); + } + + void resizeAndClear(PxU32 newBitCount) + { + extendUninitialized(newBitCount); + PxMemSet(mMap, 0, getWordCount() * sizeof(PxU32)); + } + + void setEmpty() + { + mMap = NULL; + mWordCount = 0; + } + + void setWords(PxU32* map, PxU32 wordCount) + { + mMap = map; + mWordCount = wordCount | PX_SIGN_BITMASK; + } + + // !!! only sets /last/ bit to value + void resize(PxU32 newBitCount, bool value = false) + { + PX_ASSERT(!value); // only new class supports this + PX_UNUSED(value); + extend(newBitCount); + } + + PX_FORCE_INLINE PxU32 size() const { return getWordCount() * 32; } + + void copy(const PxBitMapBase& a) + { + extendUninitialized(a.getWordCount() << 5); + PxMemCopy(mMap, a.mMap, a.getWordCount() * sizeof(PxU32)); + if(getWordCount() > a.getWordCount()) + PxMemSet(mMap + a.getWordCount(), 0, (getWordCount() - a.getWordCount()) * sizeof(PxU32)); + } + + PX_INLINE PxU32 count() const + { + // NOTE: we can probably do this faster, since the last steps in PxBitCount can be defered to + // the end of the seq. + 64/128bits at a time + native bit counting instructions(360 is fast non micro code). + PxU32 count = 0; + const PxU32 wordCount = getWordCount(); + for(PxU32 i = 0; i 0;) + { + if(mMap[i]) + return (i << 5) + PxHighestSetBit(mMap[i]); + } + return PxU32(0); + } + + bool hasAnyBitSet() const + { + const PxU32 wordCount = getWordCount(); + for(PxU32 i = 0; i + PX_INLINE void combineInPlace(const PxBitMapBase<_>& b) + { + combine1(b.mMap, b.getWordCount()); + } + + template + PX_INLINE void combine(const PxBitMapBase<_1>& a, const PxBitMapBase<_2>& b) + { + combine2(a.mMap, a.getWordCount(), b.mMap, b.getWordCount()); + } + + PX_FORCE_INLINE const PxU32* getWords() const { return mMap; } + PX_FORCE_INLINE PxU32* getWords() { return mMap; } + + // PX_SERIALIZATION + PX_FORCE_INLINE PxU32 getWordCount() const { return mWordCount & ~PX_SIGN_BITMASK; } + + // We need one bit to mark arrays that have been deserialized from a user-provided memory block. + PX_FORCE_INLINE PxU32 isInUserMemory() const { return mWordCount & PX_SIGN_BITMASK; } + //~PX_SERIALIZATION + + /*! + Iterate over indices in a bitmap + + This iterator is good because it finds the set bit without looping over the cached bits upto 31 times. + However it does require a variable shift. + */ + class Iterator + { + public: + static const PxU32 DONE = 0xffffffff; + + PX_INLINE Iterator(const PxBitMapBase &map) : mBitMap(map) + { + reset(); + } + + PX_INLINE Iterator& operator=(const Iterator& other) + { + PX_ASSERT(&mBitMap == &other.mBitMap); + mBlock = other.mBlock; + mIndex = other.mIndex; + return *this; + } + + PX_INLINE PxU32 getNext() + { + if(mBlock) + { + PxU32 block = mBlock; + PxU32 index = mIndex; + + const PxU32 bitIndex = index << 5 | PxLowestSetBit(block); + block &= block - 1; + PxU32 wordCount = mBitMap.getWordCount(); + while(!block && ++index < wordCount) + block = mBitMap.mMap[index]; + + mBlock = block; + mIndex = index; + + return bitIndex; + } + return DONE; + } + + PX_INLINE void reset() + { + PxU32 index = 0; + PxU32 block = 0; + + PxU32 wordCount = mBitMap.getWordCount(); + while(index < wordCount && ((block = mBitMap.mMap[index]) == 0)) + ++index; + + mBlock = block; + mIndex = index; + } + private: + PxU32 mBlock, mIndex; + const PxBitMapBase& mBitMap; + }; + + // DS: faster but less general: hasBits() must be true or getNext() is illegal so it is the calling code's responsibility to ensure that getNext() is not called illegally. + class PxLoopIterator + { + PX_NOCOPY(PxLoopIterator) + + public: + PX_FORCE_INLINE PxLoopIterator(const PxBitMapBase &map) : mMap(map.getWords()), mBlock(0), mIndex(-1), mWordCount(PxI32(map.getWordCount())) {} + + PX_FORCE_INLINE bool hasBits() + { + PX_ASSERT(mIndex> 5; + if (newWordCount > getWordCount()) + { + PxU32* newMap = reinterpret_cast(mAllocator.allocate(newWordCount * sizeof(PxU32), PX_FL)); + if (mMap) + { + PxMemCopy(newMap, mMap, getWordCount() * sizeof(PxU32)); + if (!isInUserMemory()) + mAllocator.deallocate(mMap); + } + PxMemSet(newMap + getWordCount(), 0, (newWordCount - getWordCount()) * sizeof(PxU32)); + mMap = newMap; + // also resets the isInUserMemory bit + mWordCount = newWordCount; + } + } + + void extendUninitialized(PxU32 size) + { + PxU32 newWordCount = (size + 31) >> 5; + if (newWordCount > getWordCount()) + { + if (mMap && !isInUserMemory()) + mAllocator.deallocate(mMap); + // also resets the isInUserMemory bit + mWordCount = newWordCount; + mMap = reinterpret_cast(mAllocator.allocate(mWordCount * sizeof(PxU32), PX_FL)); + } + } + + template + void combine1(const PxU32* words, PxU32 length) + { + extend(length << 5); + PxU32 combineLength = PxMin(getWordCount(), length); + for (PxU32 i = 0; i + void combine2(const PxU32* words1, PxU32 length1, + const PxU32* words2, PxU32 length2) + { + extendUninitialized(PxMax(length1, length2) << 5); + + PxU32 commonSize = PxMin(length1, length2); + + for (PxU32 i = 0; i PxBitMap; + typedef PxBitMapBase PxBitMapPinned; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/foundation/PxBitUtils.h b/engine/third_party/physx/include/foundation/PxBitUtils.h new file mode 100644 index 00000000..4f5ea119 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxBitUtils.h @@ -0,0 +1,128 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_BIT_UTILS_H +#define PX_BIT_UTILS_H + +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxAssert.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxMathIntrinsics.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +PX_INLINE uint32_t PxBitCount(uint32_t v) +{ + // from http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel + uint32_t const w = v - ((v >> 1) & 0x55555555); + uint32_t const x = (w & 0x33333333) + ((w >> 2) & 0x33333333); + return (((x + (x >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; +} + +PX_INLINE bool PxIsPowerOfTwo(uint32_t x) +{ + return x != 0 && (x & (x - 1)) == 0; +} + +// "Next Largest Power of 2 +// Given a binary integer value x, the next largest power of 2 can be computed by a SWAR algorithm +// that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with +// the same most significant 1 as x, but all 1's below it. Adding 1 to that value yields the next +// largest power of 2. For a 32-bit value:" +PX_INLINE uint32_t PxNextPowerOfTwo(uint32_t x) +{ + x |= (x >> 1); + x |= (x >> 2); + x |= (x >> 4); + x |= (x >> 8); + x |= (x >> 16); + return x + 1; +} + +/*! +Return the index of the highest set bit. Not valid for zero arg. +*/ + +PX_INLINE uint32_t PxLowestSetBit(uint32_t x) +{ + PX_ASSERT(x); + return PxLowestSetBitUnsafe(x); +} + +/*! +Return the index of the highest set bit. Not valid for zero arg. +*/ + +PX_INLINE uint32_t PxLowestSetBit(uint64_t x) +{ + PX_ASSERT(x); + return PxLowestSetBitUnsafe(x); +} + +/*! +Return the index of the highest set bit. Not valid for zero arg. +*/ + +PX_INLINE uint32_t PxHighestSetBit(uint32_t x) +{ + PX_ASSERT(x); + return PxHighestSetBitUnsafe(x); +} + +/*! +Return the index of the highest set bit. Not valid for zero arg. +*/ +PX_INLINE uint32_t PxHighestSetBit(uint64_t x) +{ + PX_ASSERT(x); + return PxHighestSetBitUnsafe(x); +} + +// Helper function to approximate log2 of an integer value +// assumes that the input is actually power of two. +PX_INLINE uint32_t PxILog2(uint32_t num) +{ + for(uint32_t i = 0; i < 32; i++) + { + num >>= 1; + if(num == 0) + return i; + } + + PX_ASSERT(0); + return uint32_t(-1); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxBounds3.h b/engine/third_party/physx/include/foundation/PxBounds3.h new file mode 100644 index 00000000..8ccd5817 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxBounds3.h @@ -0,0 +1,496 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_BOUNDS3_H +#define PX_BOUNDS3_H + +#include "foundation/PxTransform.h" +#include "foundation/PxMat33.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +// maximum extents defined such that floating point exceptions are avoided for standard use cases +#define PX_MAX_BOUNDS_EXTENTS (PX_MAX_REAL * 0.25f) + +/** +\brief Class representing 3D range or axis aligned bounding box. + +Stored as minimum and maximum extent corners. Alternate representation +would be center and dimensions. +May be empty or nonempty. For nonempty bounds, minimum <= maximum has to hold for all axes. +Empty bounds have to be represented as minimum = PX_MAX_BOUNDS_EXTENTS and maximum = -PX_MAX_BOUNDS_EXTENTS for all +axes. +All other representations are invalid and the behavior is undefined. +*/ +class PxBounds3 +{ + public: + /** + \brief Default constructor, not performing any initialization for performance reason. + \remark Use empty() function below to construct empty bounds. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3() + { + } + + /** + \brief Construct from two bounding points + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3(const PxVec3& minimum, const PxVec3& maximum); + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator=(const PxBounds3& other) + { + minimum = other.minimum; + maximum = other.maximum; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3(const PxBounds3& other) + { + minimum = other.minimum; + maximum = other.maximum; + } + + /** + \brief Return empty bounds. + */ + static PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 empty(); + + /** + \brief returns the AABB containing v0 and v1. + \param v0 first point included in the AABB. + \param v1 second point included in the AABB. + */ + static PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 boundsOfPoints(const PxVec3& v0, const PxVec3& v1); + + /** + \brief returns the AABB from center and extents vectors. + \param center Center vector + \param extent Extents vector + */ + static PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 centerExtents(const PxVec3& center, const PxVec3& extent); + + /** + \brief Construct from center, extent, and (not necessarily orthogonal) basis + */ + static PX_CUDA_CALLABLE PX_INLINE PxBounds3 basisExtent(const PxVec3& center, const PxMat33& basis, const PxVec3& extent); + + /** + \brief Construct from pose and extent + */ + static PX_CUDA_CALLABLE PX_INLINE PxBounds3 poseExtent(const PxTransform& pose, const PxVec3& extent); + + /** + \brief gets the transformed bounds of the passed AABB (resulting in a bigger AABB). + + This version is safe to call for empty bounds. + + \param[in] matrix Transform to apply, can contain scaling as well + \param[in] bounds The bounds to transform. + */ + static PX_CUDA_CALLABLE PX_INLINE PxBounds3 transformSafe(const PxMat33& matrix, const PxBounds3& bounds); + + /** + \brief gets the transformed bounds of the passed AABB (resulting in a bigger AABB). + + Calling this method for empty bounds leads to undefined behavior. Use #transformSafe() instead. + + \param[in] matrix Transform to apply, can contain scaling as well + \param[in] bounds The bounds to transform. + */ + static PX_CUDA_CALLABLE PX_INLINE PxBounds3 transformFast(const PxMat33& matrix, const PxBounds3& bounds); + + /** + \brief gets the transformed bounds of the passed AABB (resulting in a bigger AABB). + + This version is safe to call for empty bounds. + + \param[in] transform Transform to apply, can contain scaling as well + \param[in] bounds The bounds to transform. + */ + static PX_CUDA_CALLABLE PX_INLINE PxBounds3 transformSafe(const PxTransform& transform, const PxBounds3& bounds); + + /** + \brief gets the transformed bounds of the passed AABB (resulting in a bigger AABB). + + Calling this method for empty bounds leads to undefined behavior. Use #transformSafe() instead. + + \param[in] transform Transform to apply, can contain scaling as well + \param[in] bounds The bounds to transform. + */ + static PX_CUDA_CALLABLE PX_INLINE PxBounds3 transformFast(const PxTransform& transform, const PxBounds3& bounds); + + /** + \brief Sets empty to true + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void setEmpty(); + + /** + \brief Sets the bounds to maximum size [-PX_MAX_BOUNDS_EXTENTS, PX_MAX_BOUNDS_EXTENTS]. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void setMaximal(); + + /** + \brief expands the volume to include v + \param v Point to expand to. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void include(const PxVec3& v); + + /** + \brief expands the volume to include b. + \param b Bounds to perform union with. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void include(const PxBounds3& b); + + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isEmpty() const; + + /** + \brief indicates whether the intersection of this and b is empty or not. + \param b Bounds to test for intersection. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool intersects(const PxBounds3& b) const; + + /** + \brief computes the 1D-intersection between two AABBs, on a given axis. + \param a the other AABB + \param axis the axis (0, 1, 2) + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool intersects1D(const PxBounds3& a, uint32_t axis) const; + + /** + \brief indicates if these bounds contain v. + \param v Point to test against bounds. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool contains(const PxVec3& v) const; + + /** + \brief checks a box is inside another box. + \param box the other AABB + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isInside(const PxBounds3& box) const; + + /** + \brief returns the center of this axis aligned box. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getCenter() const; + + /** + \brief get component of the box's center along a given axis + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float getCenter(uint32_t axis) const; + + /** + \brief get component of the box's extents along a given axis + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float getExtents(uint32_t axis) const; + + /** + \brief returns the dimensions (width/height/depth) of this axis aligned box. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getDimensions() const; + + /** + \brief returns the extents, which are half of the width/height/depth. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getExtents() const; + + /** + \brief scales the AABB. + + This version is safe to call for empty bounds. + + \param scale Factor to scale AABB by. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void scaleSafe(float scale); + + /** + \brief scales the AABB. + + Calling this method for empty bounds leads to undefined behavior. Use #scaleSafe() instead. + + \param scale Factor to scale AABB by. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void scaleFast(float scale); + + /** + fattens the AABB in all 3 dimensions by the given distance. + + This version is safe to call for empty bounds. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void fattenSafe(float distance); + + /** + fattens the AABB in all 3 dimensions by the given distance. + + Calling this method for empty bounds leads to undefined behavior. Use #fattenSafe() instead. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void fattenFast(float distance); + + /** + checks that the AABB values are not NaN + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite() const; + + /** + checks that the AABB values describe a valid configuration. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isValid() const; + + /** + Finds the closest point in the box to the point p. If p is contained, this will be p, otherwise it + will be the closest point on the surface of the box. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 closestPoint(const PxVec3& p) const; + + PxVec3 minimum, maximum; +}; + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3::PxBounds3(const PxVec3& minimum_, const PxVec3& maximum_) +: minimum(minimum_), maximum(maximum_) +{ +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 PxBounds3::empty() +{ + return PxBounds3(PxVec3(PX_MAX_BOUNDS_EXTENTS), PxVec3(-PX_MAX_BOUNDS_EXTENTS)); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::isFinite() const +{ + return minimum.isFinite() && maximum.isFinite(); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 PxBounds3::boundsOfPoints(const PxVec3& v0, const PxVec3& v1) +{ + return PxBounds3(v0.minimum(v1), v0.maximum(v1)); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 PxBounds3::centerExtents(const PxVec3& center, const PxVec3& extent) +{ + return PxBounds3(center - extent, center + extent); +} + +PX_CUDA_CALLABLE PX_INLINE PxBounds3 +PxBounds3::basisExtent(const PxVec3& center, const PxMat33& basis, const PxVec3& extent) +{ + // extended basis vectors + const PxVec3 c0 = basis.column0 * extent.x; + const PxVec3 c1 = basis.column1 * extent.y; + const PxVec3 c2 = basis.column2 * extent.z; + + // find combination of base vectors that produces max. distance for each component = sum of abs() + const PxVec3 w( PxAbs(c0.x) + PxAbs(c1.x) + PxAbs(c2.x), + PxAbs(c0.y) + PxAbs(c1.y) + PxAbs(c2.y), + PxAbs(c0.z) + PxAbs(c1.z) + PxAbs(c2.z)); + + return PxBounds3(center - w, center + w); +} + +PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::poseExtent(const PxTransform& pose, const PxVec3& extent) +{ + return basisExtent(pose.p, PxMat33(pose.q), extent); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::setEmpty() +{ + minimum = PxVec3(PX_MAX_BOUNDS_EXTENTS); + maximum = PxVec3(-PX_MAX_BOUNDS_EXTENTS); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::setMaximal() +{ + minimum = PxVec3(-PX_MAX_BOUNDS_EXTENTS); + maximum = PxVec3(PX_MAX_BOUNDS_EXTENTS); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::include(const PxVec3& v) +{ + PX_ASSERT(isValid()); + minimum = minimum.minimum(v); + maximum = maximum.maximum(v); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::include(const PxBounds3& b) +{ + PX_ASSERT(isValid()); + minimum = minimum.minimum(b.minimum); + maximum = maximum.maximum(b.maximum); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::isEmpty() const +{ + PX_ASSERT(isValid()); + return minimum.x > maximum.x; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::intersects(const PxBounds3& b) const +{ + PX_ASSERT(isValid() && b.isValid()); + return !(b.minimum.x > maximum.x || minimum.x > b.maximum.x || b.minimum.y > maximum.y || minimum.y > b.maximum.y || + b.minimum.z > maximum.z || minimum.z > b.maximum.z); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::intersects1D(const PxBounds3& a, uint32_t axis) const +{ + PX_ASSERT(isValid() && a.isValid()); + return maximum[axis] >= a.minimum[axis] && a.maximum[axis] >= minimum[axis]; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::contains(const PxVec3& v) const +{ + PX_ASSERT(isValid()); + + return !(v.x < minimum.x || v.x > maximum.x || v.y < minimum.y || v.y > maximum.y || v.z < minimum.z || + v.z > maximum.z); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::isInside(const PxBounds3& box) const +{ + PX_ASSERT(isValid() && box.isValid()); + if(box.minimum.x > minimum.x) + return false; + if(box.minimum.y > minimum.y) + return false; + if(box.minimum.z > minimum.z) + return false; + if(box.maximum.x < maximum.x) + return false; + if(box.maximum.y < maximum.y) + return false; + if(box.maximum.z < maximum.z) + return false; + return true; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxBounds3::getCenter() const +{ + PX_ASSERT(isValid()); + return (minimum + maximum) * 0.5f; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxBounds3::getCenter(uint32_t axis) const +{ + PX_ASSERT(isValid()); + return (minimum[axis] + maximum[axis]) * 0.5f; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxBounds3::getExtents(uint32_t axis) const +{ + PX_ASSERT(isValid()); + return (maximum[axis] - minimum[axis]) * 0.5f; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxBounds3::getDimensions() const +{ + PX_ASSERT(isValid()); + return maximum - minimum; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxBounds3::getExtents() const +{ + PX_ASSERT(isValid()); + return getDimensions() * 0.5f; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::scaleSafe(float scale) +{ + PX_ASSERT(isValid()); + if(!isEmpty()) + scaleFast(scale); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::scaleFast(float scale) +{ + PX_ASSERT(isValid()); + *this = centerExtents(getCenter(), getExtents() * scale); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::fattenSafe(float distance) +{ + PX_ASSERT(isValid()); + if(!isEmpty()) + fattenFast(distance); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::fattenFast(float distance) +{ + PX_ASSERT(isValid()); + minimum.x -= distance; + minimum.y -= distance; + minimum.z -= distance; + + maximum.x += distance; + maximum.y += distance; + maximum.z += distance; +} + +PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformSafe(const PxMat33& matrix, const PxBounds3& bounds) +{ + PX_ASSERT(bounds.isValid()); + return !bounds.isEmpty() ? transformFast(matrix, bounds) : bounds; +} + +PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformFast(const PxMat33& matrix, const PxBounds3& bounds) +{ + PX_ASSERT(bounds.isValid()); + return PxBounds3::basisExtent(matrix * bounds.getCenter(), matrix, bounds.getExtents()); +} + +PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformSafe(const PxTransform& transform, const PxBounds3& bounds) +{ + PX_ASSERT(bounds.isValid()); + return !bounds.isEmpty() ? transformFast(transform, bounds) : bounds; +} + +PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformFast(const PxTransform& transform, const PxBounds3& bounds) +{ + PX_ASSERT(bounds.isValid()); + return PxBounds3::basisExtent(transform.transform(bounds.getCenter()), PxMat33(transform.q), bounds.getExtents()); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::isValid() const +{ + return (isFinite() && (((minimum.x <= maximum.x) && (minimum.y <= maximum.y) && (minimum.z <= maximum.z)) || + ((minimum.x == PX_MAX_BOUNDS_EXTENTS) && (minimum.y == PX_MAX_BOUNDS_EXTENTS) && + (minimum.z == PX_MAX_BOUNDS_EXTENTS) && (maximum.x == -PX_MAX_BOUNDS_EXTENTS) && + (maximum.y == -PX_MAX_BOUNDS_EXTENTS) && (maximum.z == -PX_MAX_BOUNDS_EXTENTS)))); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxBounds3::closestPoint(const PxVec3& p) const +{ + return minimum.maximum(maximum.minimum(p)); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxBroadcast.h b/engine/third_party/physx/include/foundation/PxBroadcast.h new file mode 100644 index 00000000..989dd9fd --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxBroadcast.h @@ -0,0 +1,276 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_BROADCAST_H +#define PX_BROADCAST_H + +#include "foundation/PxInlineArray.h" +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxErrorCallback.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Abstract listener class that listens to allocation and deallocation events from the + foundation memory system. + +Threading: All methods of this class should be thread safe as it can be called from the user thread +or the physics processing thread(s). +*/ +class PxAllocationListener +{ + public: + /** + \brief callback when memory is allocated. + \param size Size of the allocation in bytes. + \param typeName Type this data is being allocated for. + \param filename File the allocation came from. + \param line the allocation came from. + \param allocatedMemory memory that will be returned from the allocation. + */ + virtual void onAllocation(size_t size, const char* typeName, const char* filename, int line, + void* allocatedMemory) = 0; + + /** + \brief callback when memory is deallocated. + \param allocatedMemory memory just before allocation. + */ + virtual void onDeallocation(void* allocatedMemory) = 0; + + protected: + virtual ~PxAllocationListener() + { + } +}; + +/** +\brief Broadcast class implementation, registering listeners. + +Threading: All methods of this class should be thread safe as it can be called from the user thread +or the physics processing thread(s). There is not internal locking +*/ +template +class PxBroadcast : public Base +{ + public: + static const uint32_t MAX_NB_LISTENERS = 16; + + /** + \brief The default constructor. + */ + PxBroadcast() + { + } + + /** + \brief Register new listener. + + \note It is NOT SAFE to register and deregister listeners while allocations may be taking place. + moreover, there is no thread safety to registration/deregistration. + + \param listener Listener to register. + */ + void registerListener(Listener& listener) + { + if(mListeners.size() < MAX_NB_LISTENERS) + mListeners.pushBack(&listener); + } + + /** + \brief Deregister an existing listener. + + \note It is NOT SAFE to register and deregister listeners while allocations may be taking place. + moreover, there is no thread safety to registration/deregistration. + + \param listener Listener to deregister. + */ + void deregisterListener(Listener& listener) + { + mListeners.findAndReplaceWithLast(&listener); + } + + /** + \brief Get number of registered listeners. + + \return Number of listeners. + */ + uint32_t getNbListeners() const + { + return mListeners.size(); + } + + /** + \brief Get an existing listener from given index. + + \param index Index of the listener. + \return Listener on given index. + */ + Listener& getListener(uint32_t index) + { + PX_ASSERT(index <= mListeners.size()); + return *mListeners[index]; + } + + protected: + virtual ~PxBroadcast() + { + } + + physx::PxInlineArray mListeners; +}; + +/** +\brief Abstract base class for an application defined memory allocator that allows an external listener +to audit the memory allocations. +*/ +class PxBroadcastingAllocator : public PxBroadcast +{ + PX_NOCOPY(PxBroadcastingAllocator) + + public: + /** + \brief The default constructor. + */ + PxBroadcastingAllocator(PxAllocatorCallback& allocator, PxErrorCallback& error) : mAllocator(allocator), mError(error) + { + mListeners.clear(); + } + + /** + \brief The default constructor. + */ + virtual ~PxBroadcastingAllocator() + { + mListeners.clear(); + } + + /** + \brief Allocates size bytes of memory, which must be 16-byte aligned. + + This method should never return NULL. If you run out of memory, then + you should terminate the app or take some other appropriate action. + + Threading: This function should be thread safe as it can be called in the context of the user thread + and physics processing thread(s). + + \param size Number of bytes to allocate. + \param typeName Name of the datatype that is being allocated + \param filename The source file which allocated the memory + \param line The source line which allocated the memory + \return The allocated block of memory. + */ + void* allocate(size_t size, const char* typeName, const char* filename, int line) + { + void* mem = mAllocator.allocate(size, typeName, filename, line); + + if(!mem) + { + mError.reportError(PxErrorCode::eABORT, "User allocator returned NULL.", filename, line); + return NULL; + } + + if((size_t(mem) & 15)) + { + mError.reportError(PxErrorCode::eABORT, "Allocations must be 16-byte aligned.", filename, line); + return NULL; + } + + for(uint32_t i = 0; i < mListeners.size(); i++) + mListeners[i]->onAllocation(size, typeName, filename, line, mem); + + return mem; + } + + /** + \brief Frees memory previously allocated by allocate(). + + Threading: This function should be thread safe as it can be called in the context of the user thread + and physics processing thread(s). + + \param ptr Memory to free. + */ + void deallocate(void* ptr) + { + for(uint32_t i = 0; i < mListeners.size(); i++) + { + mListeners[i]->onDeallocation(ptr); + } + mAllocator.deallocate(ptr); + } + + private: + PxAllocatorCallback& mAllocator; + PxErrorCallback& mError; +}; + +/** +\brief Abstract base class for an application defined error callback that allows an external listener +to report errors. +*/ +class PxBroadcastingErrorCallback : public PxBroadcast +{ + PX_NOCOPY(PxBroadcastingErrorCallback) + public: + /** + \brief The default constructor. + */ + PxBroadcastingErrorCallback(PxErrorCallback& errorCallback) + { + registerListener(errorCallback); + } + + /** + \brief The default destructor. + */ + virtual ~PxBroadcastingErrorCallback() + { + mListeners.clear(); + } + + /** + \brief Reports an error code. + \param code Error code, see #PxErrorCode + \param message Message to display. + \param file File error occured in. + \param line Line number error occured on. + */ + void reportError(PxErrorCode::Enum code, const char* message, const char* file, int line) + { + for(uint32_t i = 0; i < mListeners.size(); i++) + mListeners[i]->reportError(code, message, file, line); + } +}; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxConstructor.h b/engine/third_party/physx/include/foundation/PxConstructor.h new file mode 100644 index 00000000..7855ac9b --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxConstructor.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CONSTRUCTOR_H +#define PX_CONSTRUCTOR_H + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + +/** enum for zero constructor tag for vectors and matrices */ +enum PxZERO +{ + PxZero +}; + +/** enum for identity constructor flag for quaternions, transforms, and matrices */ +enum PxIDENTITY +{ + PxIdentity +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif //PX_CONSTRUCTOR_H + diff --git a/engine/third_party/physx/include/foundation/PxErrorCallback.h b/engine/third_party/physx/include/foundation/PxErrorCallback.h new file mode 100644 index 00000000..5fb24742 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxErrorCallback.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_ERROR_CALLBACK_H +#define PX_ERROR_CALLBACK_H + + +#include "foundation/PxErrors.h" +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief User defined interface class. Used by the library to emit debug information. + +\note The SDK state should not be modified from within any error reporting functions. + +Threading: The SDK sequences its calls to the output stream using a mutex, so the class need not +be implemented in a thread-safe manner if the SDK is the only client. +*/ +class PxErrorCallback +{ + public: + virtual ~PxErrorCallback() + { + } + + /** + \brief Reports an error code. + \param code Error code, see #PxErrorCode + \param message Message to display. + \param file File error occured in. + \param line Line number error occured on. + */ + virtual void reportError(PxErrorCode::Enum code, const char* message, const char* file, int line) = 0; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxErrors.h b/engine/third_party/physx/include/foundation/PxErrors.h new file mode 100644 index 00000000..eabd2433 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxErrors.h @@ -0,0 +1,128 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_ERRORS_H +#define PX_ERRORS_H + +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Error codes + +These error codes are passed to #PxErrorCallback + +\see PxErrorCallback +*/ +struct PxErrorCode +{ + enum Enum + { + eNO_ERROR = 0, + + //! \brief An informational message. + eDEBUG_INFO = 1, + + //! \brief a warning message for the user to help with debugging + eDEBUG_WARNING = 2, + + //! \brief method called with invalid parameter(s) + eINVALID_PARAMETER = 4, + + //! \brief method was called at a time when an operation is not possible + eINVALID_OPERATION = 8, + + //! \brief method failed to allocate some memory + eOUT_OF_MEMORY = 16, + + /** \brief The library failed for some reason. + Possibly you have passed invalid values like NaNs, which are not checked for. + */ + eINTERNAL_ERROR = 32, + + //! \brief An unrecoverable error, execution should be halted and log output flushed + eABORT = 64, + + //! \brief The SDK has determined that an operation may result in poor performance. + ePERF_WARNING = 128, + + //! \brief A bit mask for including all errors + eMASK_ALL = -1 + }; +}; + +#if PX_CHECKED + #define PX_CHECK_MSG(exp, msg) (!!(exp) || (PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, PX_FL, msg), 0) ) + #define PX_CHECK_AND_RETURN(exp, msg) { if(!(exp)) { PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, PX_FL, msg); return; } } + #define PX_CHECK_AND_RETURN_NULL(exp, msg) { if(!(exp)) { PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, PX_FL, msg); return 0; } } + #define PX_CHECK_AND_RETURN_VAL(exp, msg, r) { if(!(exp)) { PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, PX_FL, msg); return r; } } +#else + #define PX_CHECK_MSG(exp, msg) + #define PX_CHECK_AND_RETURN(exp, msg) + #define PX_CHECK_AND_RETURN_NULL(exp, msg) + #define PX_CHECK_AND_RETURN_VAL(exp, msg, r) +#endif + +// shortcut macros: +// usage: PxGetFoundation().error(PX_WARN, "static friction %f is is lower than dynamic friction %d", sfr, dfr); +#define PX_WARN ::physx::PxErrorCode::eDEBUG_WARNING, PX_FL +#define PX_INFO ::physx::PxErrorCode::eDEBUG_INFO, PX_FL + +#if PX_DEBUG || PX_CHECKED + #define PX_WARN_ONCE(string) \ + { \ + static PxU32 timestamp = 0; \ + const PxU32 ts = PxGetWarnOnceTimeStamp(); \ + if(timestamp != ts) \ + { \ + timestamp = ts; \ + PxGetFoundation().error(PX_WARN, string); \ + } \ + } + #define PX_WARN_ONCE_IF(condition, string) \ + { \ + if(condition) \ + { \ + PX_WARN_ONCE(string) \ + } \ + } +#else + #define PX_WARN_ONCE(string) ((void)0) + #define PX_WARN_ONCE_IF(condition, string) ((void)0) +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxFPU.h b/engine/third_party/physx/include/foundation/PxFPU.h new file mode 100644 index 00000000..4529adac --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxFPU.h @@ -0,0 +1,100 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_FPU_H +#define PX_FPU_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxAssert.h" +#include "foundation/PxFoundationConfig.h" + +#define PX_IR(x) ((PxU32&)(x)) // integer representation of a floating-point value. +#define PX_SIR(x) ((PxI32&)(x)) // signed integer representation of a floating-point value. +#define PX_FR(x) ((PxReal&)(x)) // floating-point representation of a integer value. + +#define PX_FPU_GUARD PxFPUGuard scopedFpGuard; +#define PX_SIMD_GUARD PxSIMDGuard scopedFpGuard; +#define PX_SIMD_GUARD_CNDT(x) PxSIMDGuard scopedFpGuard(x); + +#if !PX_DOXYGEN +namespace physx +{ +#endif +// sets the default SDK state for scalar and SIMD units +class PX_FOUNDATION_API PxFPUGuard +{ + public: + PxFPUGuard(); // set fpu control word for PhysX + ~PxFPUGuard(); // restore fpu control word + private: + PxU32 mControlWords[8]; +}; + +// sets default SDK state for simd unit only, lighter weight than FPUGuard +class PxSIMDGuard +{ + public: + PX_INLINE PxSIMDGuard(bool enable = true); // set simd control word for PhysX + PX_INLINE ~PxSIMDGuard(); // restore simd control word + private: +#if !(PX_LINUX || PX_OSX) || (!PX_EMSCRIPTEN && PX_INTEL_FAMILY) + PxU32 mControlWord; + bool mEnabled; +#endif +}; + +/** +\brief Enables floating point exceptions for the scalar and SIMD unit +*/ +PX_FOUNDATION_API void PxEnableFPExceptions(); + +/** +\brief Disables floating point exceptions for the scalar and SIMD unit +*/ +PX_FOUNDATION_API void PxDisableFPExceptions(); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#if PX_WINDOWS_FAMILY +#include "foundation/windows/PxWindowsFPU.h" +#elif (PX_LINUX && PX_SSE2) || PX_OSX +#include "foundation/unix/PxUnixFPU.h" +#else +PX_INLINE physx::PxSIMDGuard::PxSIMDGuard(bool) +{ +} +PX_INLINE physx::PxSIMDGuard::~PxSIMDGuard() +{ +} +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxFlags.h b/engine/third_party/physx/include/foundation/PxFlags.h new file mode 100644 index 00000000..22527f7b --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxFlags.h @@ -0,0 +1,381 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_FLAGS_H +#define PX_FLAGS_H + + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxPreprocessor.h" +#include "foundation/PxIO.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +/** +\brief Container for bitfield flag variables associated with a specific enum type. + +This allows for type safe manipulation for bitfields. + +

Example

+ // enum that defines each bit... + struct MyEnum + { + enum Enum + { + eMAN = 1, + eBEAR = 2, + ePIG = 4, + }; + }; + + // implements some convenient global operators. + PX_FLAGS_OPERATORS(MyEnum::Enum, PxU8); + + PxFlags myFlags; + myFlags |= MyEnum::eMAN; + myFlags |= MyEnum::eBEAR | MyEnum::ePIG; + if(myFlags & MyEnum::eBEAR) + { + doSomething(); + } +*/ + +template +class PxFlags +{ + public: + typedef storagetype InternalType; + + PX_CUDA_CALLABLE PX_INLINE explicit PxFlags(const PxEMPTY) + { + } + PX_CUDA_CALLABLE PX_INLINE PxFlags(); + PX_CUDA_CALLABLE PX_INLINE PxFlags(enumtype e); + PX_CUDA_CALLABLE PX_INLINE PxFlags(const PxFlags& f); + PX_CUDA_CALLABLE PX_INLINE explicit PxFlags(storagetype b); + + PX_CUDA_CALLABLE PX_INLINE bool operator==(enumtype e) const; + PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxFlags& f) const; + PX_CUDA_CALLABLE PX_INLINE bool operator==(bool b) const; + PX_CUDA_CALLABLE PX_INLINE bool operator!=(enumtype e) const; + PX_CUDA_CALLABLE PX_INLINE bool operator!=(const PxFlags& f) const; + + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator=(const PxFlags& f); + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator=(enumtype e); + + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator|=(enumtype e); + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator|=(const PxFlags& f); + PX_CUDA_CALLABLE PX_INLINE PxFlags operator|(enumtype e) const; + PX_CUDA_CALLABLE PX_INLINE PxFlags operator|(const PxFlags& f) const; + + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator&=(enumtype e); + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator&=(const PxFlags& f); + PX_CUDA_CALLABLE PX_INLINE PxFlags operator&(enumtype e) const; + PX_CUDA_CALLABLE PX_INLINE PxFlags operator&(const PxFlags& f) const; + + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator^=(enumtype e); + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator^=(const PxFlags& f); + PX_CUDA_CALLABLE PX_INLINE PxFlags operator^(enumtype e) const; + PX_CUDA_CALLABLE PX_INLINE PxFlags operator^(const PxFlags& f) const; + + PX_CUDA_CALLABLE PX_INLINE PxFlags operator~() const; + + PX_CUDA_CALLABLE PX_INLINE operator bool() const; + PX_CUDA_CALLABLE PX_INLINE operator PxU8() const; + PX_CUDA_CALLABLE PX_INLINE operator PxU16() const; + PX_CUDA_CALLABLE PX_INLINE operator PxU32() const; + + PX_CUDA_CALLABLE PX_INLINE void clear(enumtype e); + PX_CUDA_CALLABLE PX_INLINE void raise(enumtype e); + PX_CUDA_CALLABLE PX_INLINE bool isSet(enumtype e) const; + PX_CUDA_CALLABLE PX_INLINE PxFlags& setAll(enumtype e); + + public: + friend PX_INLINE PxFlags operator&(enumtype a, PxFlags& b) + { + PxFlags out; + out.mBits = a & b.mBits; + return out; + } + + private: + storagetype mBits; +}; + +#if !PX_DOXYGEN + +#define PX_FLAGS_OPERATORS(enumtype, storagetype) \ + PX_CUDA_CALLABLE PX_INLINE PxFlags operator|(enumtype a, enumtype b) \ + { \ + PxFlags r(a); \ + r |= b; \ + return r; \ + } \ + PX_CUDA_CALLABLE PX_INLINE PxFlags operator&(enumtype a, enumtype b) \ + { \ + PxFlags r(a); \ + r &= b; \ + return r; \ + } \ + PX_CUDA_CALLABLE PX_INLINE PxFlags operator~(enumtype a) \ + { \ + return ~PxFlags(a); \ + } + +#define PX_FLAGS_TYPEDEF(x, y) \ + typedef PxFlags x##s; \ + PX_FLAGS_OPERATORS(x::Enum, y) + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::PxFlags() +{ + mBits = 0; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::PxFlags(enumtype e) +{ + mBits = static_cast(e); +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::PxFlags(const PxFlags& f) +{ + mBits = f.mBits; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::PxFlags(storagetype b) +{ + mBits = b; +} + +template +PX_CUDA_CALLABLE PX_INLINE bool PxFlags::operator==(enumtype e) const +{ + return mBits == static_cast(e); +} + +template +PX_CUDA_CALLABLE PX_INLINE bool PxFlags::operator==(const PxFlags& f) const +{ + return mBits == f.mBits; +} + +template +PX_CUDA_CALLABLE PX_INLINE bool PxFlags::operator==(bool b) const +{ + return bool(*this) == b; +} + +template +PX_CUDA_CALLABLE PX_INLINE bool PxFlags::operator!=(enumtype e) const +{ + return mBits != static_cast(e); +} + +template +PX_CUDA_CALLABLE PX_INLINE bool PxFlags::operator!=(const PxFlags& f) const +{ + return mBits != f.mBits; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags::operator=(enumtype e) +{ + mBits = static_cast(e); + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags::operator=(const PxFlags& f) +{ + mBits = f.mBits; + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags::operator|=(enumtype e) +{ + mBits |= static_cast(e); + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags:: +operator|=(const PxFlags& f) +{ + mBits |= f.mBits; + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags PxFlags::operator|(enumtype e) const +{ + PxFlags out(*this); + out |= e; + return out; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags PxFlags:: +operator|(const PxFlags& f) const +{ + PxFlags out(*this); + out |= f; + return out; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags::operator&=(enumtype e) +{ + mBits &= static_cast(e); + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags:: +operator&=(const PxFlags& f) +{ + mBits &= f.mBits; + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags PxFlags::operator&(enumtype e) const +{ + PxFlags out = *this; + out.mBits &= static_cast(e); + return out; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags PxFlags:: +operator&(const PxFlags& f) const +{ + PxFlags out = *this; + out.mBits &= f.mBits; + return out; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags::operator^=(enumtype e) +{ + mBits ^= static_cast(e); + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags:: +operator^=(const PxFlags& f) +{ + mBits ^= f.mBits; + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags PxFlags::operator^(enumtype e) const +{ + PxFlags out = *this; + out.mBits ^= static_cast(e); + return out; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags PxFlags:: +operator^(const PxFlags& f) const +{ + PxFlags out = *this; + out.mBits ^= f.mBits; + return out; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags PxFlags::operator~() const +{ + PxFlags out; + out.mBits = storagetype(~mBits); + return out; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::operator bool() const +{ + return mBits ? true : false; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::operator PxU8() const +{ + return static_cast(mBits); +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::operator PxU16() const +{ + return static_cast(mBits); +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::operator PxU32() const +{ + return static_cast(mBits); +} + +template +PX_CUDA_CALLABLE PX_INLINE void PxFlags::clear(enumtype e) +{ + mBits &= ~static_cast(e); +} + +template +PX_CUDA_CALLABLE PX_INLINE void PxFlags::raise(enumtype e) +{ + mBits |= static_cast(e); +} + +template +PX_CUDA_CALLABLE PX_INLINE bool PxFlags::isSet(enumtype e) const +{ + return (mBits & static_cast(e)) == static_cast(e); +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags::setAll(enumtype e) +{ + mBits = static_cast(e); + return *this; +} + +} // namespace physx +#endif //!PX_DOXYGEN + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxFoundation.h b/engine/third_party/physx/include/foundation/PxFoundation.h new file mode 100644 index 00000000..39fa32d9 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxFoundation.h @@ -0,0 +1,233 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_FOUNDATION_H +#define PX_FOUNDATION_H + + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxErrors.h" +#include "foundation/PxFoundationConfig.h" + +#include + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxAllocationListener; +class PxErrorCallback; +class PxAllocatorCallback; + +/** +\brief Foundation SDK singleton class. + +You need to have an instance of this class to instance the higher level SDKs. +*/ +class PX_FOUNDATION_API PxFoundation +{ + public: + /** + \brief Destroys the instance it is called on. + + The operation will fail, if there are still modules referencing the foundation object. Release all dependent modules + prior to calling this method. + + \see PxCreateFoundation() + */ + virtual void release() = 0; + + /** + retrieves error callback + */ + virtual PxErrorCallback& getErrorCallback() = 0; + + /** + Sets mask of errors to report. + */ + virtual void setErrorLevel(PxErrorCode::Enum mask = PxErrorCode::eMASK_ALL) = 0; + + /** + Retrieves mask of errors to be reported. + */ + virtual PxErrorCode::Enum getErrorLevel() const = 0; + + /** + Retrieves the allocator this object was created with. + */ + virtual PxAllocatorCallback& getAllocatorCallback() = 0; + + /** + Retrieves if allocation names are being passed to allocator callback. + */ + virtual bool getReportAllocationNames() const = 0; + + /** + Set if allocation names are being passed to allocator callback. + \details Enabled by default in debug and checked build, disabled by default in profile and release build. + */ + virtual void setReportAllocationNames(bool value) = 0; + + virtual void registerAllocationListener(PxAllocationListener& listener) = 0; + + virtual void deregisterAllocationListener(PxAllocationListener& listener) = 0; + + virtual void registerErrorCallback(PxErrorCallback& callback) = 0; + + virtual void deregisterErrorCallback(PxErrorCallback& callback) = 0; + + virtual bool error(PxErrorCode::Enum c, const char* file, int line, const char* messageFmt, ...) = 0; + + virtual bool error(PxErrorCode::Enum, const char* file, int line, const char* messageFmt, va_list) = 0; + + protected: + virtual ~PxFoundation() + { + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +// PT: use this to make generated code shorter (e.g. from 52 to 24 bytes of assembly (10 to 4 instructions)) +// We must use a macro here to let __FILE__ expand to the proper filename (it doesn't work with an inlined function). +#define PX_IMPLEMENT_OUTPUT_ERROR \ +template \ +static PX_NOINLINE bool outputError(int line, const char* message) \ +{ \ + return PxGetFoundation().error(PxErrorCode::Enum(errorCode), __FILE__, line, message); \ +} + +/** +\brief Creates an instance of the foundation class + +The foundation class is needed to initialize higher level SDKs. There may be only one instance per process. +Calling this method after an instance has been created already will result in an error message and NULL will be +returned. + +\param version Version number we are expecting (should be #PX_PHYSICS_VERSION) +\param allocator User supplied interface for allocating memory(see #PxAllocatorCallback) +\param errorCallback User supplied interface for reporting errors and displaying messages(see #PxErrorCallback) +\return Foundation instance on success, NULL if operation failed + +\see PxFoundation +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxFoundation* PX_CALL_CONV PxCreateFoundation(physx::PxU32 version, physx::PxAllocatorCallback& allocator, physx::PxErrorCallback& errorCallback); + + +PX_C_EXPORT PX_FOUNDATION_API void PX_CALL_CONV PxSetFoundationInstance(physx::PxFoundation& foundation); + + +/** +\brief Retrieves the Foundation SDK after it has been created. + +\note The behavior of this method is undefined if the foundation instance has not been created already. + +\see PxCreateFoundation(), PxIsFoundationValid() +*/ +#if PX_CLANG +#if PX_LINUX +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreturn-type-c-linkage" +#endif // PX_LINUX +#endif // PX_CLANG +PX_C_EXPORT PX_FOUNDATION_API physx::PxFoundation& PX_CALL_CONV PxGetFoundation(); +#if PX_CLANG +#if PX_LINUX +#pragma clang diagnostic pop +#endif // PX_LINUX +#endif // PX_CLANG + +/** +\brief Similar to PxGetFoundation() except it handles the case if the foundation was not created already. +\return Pointer to the foundation if an instance is currently available, otherwise null. + +\see PxCreateFoundation(), PxGetFoundation() +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxFoundation* PX_CALL_CONV PxIsFoundationValid(); + +#if !PX_DOXYGEN +namespace physx +{ +#endif +class PxProfilerCallback; +class PxAllocatorCallback; +class PxErrorCallback; +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** +\brief Get the callback that will be used for all profiling. +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxProfilerCallback* PX_CALL_CONV PxGetProfilerCallback(); + +/** +\brief Set the callback that will be used for all profiling. +*/ +PX_C_EXPORT PX_FOUNDATION_API void PX_CALL_CONV PxSetProfilerCallback(physx::PxProfilerCallback* profiler); + +/** +\brief Get the allocator callback +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxAllocatorCallback* PX_CALL_CONV PxGetAllocatorCallback(); + +/** +\brief Get the broadcasting allocator callback +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxAllocatorCallback* PX_CALL_CONV PxGetBroadcastAllocator(bool* reportAllocationNames = NULL); + +/** +\brief Get the error callback +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxErrorCallback* PX_CALL_CONV PxGetErrorCallback(); + +/** +\brief Get the broadcasting error callback +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxErrorCallback* PX_CALL_CONV PxGetBroadcastError(); + +/** +\brief Get the warn once timestamp +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxU32 PX_CALL_CONV PxGetWarnOnceTimeStamp(); + +/** +\brief Decrement the ref count of PxFoundation +*/ +PX_C_EXPORT PX_FOUNDATION_API void PX_CALL_CONV PxDecFoundationRefCount(); + +/** +\brief Increment the ref count of PxFoundation +*/ +PX_C_EXPORT PX_FOUNDATION_API void PX_CALL_CONV PxIncFoundationRefCount(); + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxFoundationConfig.h b/engine/third_party/physx/include/foundation/PxFoundationConfig.h new file mode 100644 index 00000000..89237c99 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxFoundationConfig.h @@ -0,0 +1,52 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_FOUNDATION_CONFIG_H +#define PX_FOUNDATION_CONFIG_H + +#include "foundation/PxPreprocessor.h" + + +#if defined PX_PHYSX_STATIC_LIB + #define PX_FOUNDATION_API +#else + #if PX_WINDOWS_FAMILY && !PX_CUDA_COMPILER + #if defined PX_PHYSX_FOUNDATION_EXPORTS + #define PX_FOUNDATION_API __declspec(dllexport) + #else + #define PX_FOUNDATION_API __declspec(dllimport) + #endif + #elif PX_UNIX_FAMILY + #define PX_FOUNDATION_API PX_UNIX_EXPORT + #else + #define PX_FOUNDATION_API + #endif +#endif + + +#endif diff --git a/engine/third_party/physx/include/foundation/PxHash.h b/engine/third_party/physx/include/foundation/PxHash.h new file mode 100644 index 00000000..9db92366 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxHash.h @@ -0,0 +1,163 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_HASH_H +#define PX_HASH_H + +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxString.h" + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4302) +#endif + +#if PX_LINUX +#include "foundation/PxSimpleTypes.h" +#endif + +/*! +Central definition of hash functions +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif +// Hash functions + +// Thomas Wang's 32 bit mix +// http://www.cris.com/~Ttwang/tech/inthash.htm +PX_FORCE_INLINE uint32_t PxComputeHash(const uint32_t key) +{ + uint32_t k = key; + k += ~(k << 15); + k ^= (k >> 10); + k += (k << 3); + k ^= (k >> 6); + k += ~(k << 11); + k ^= (k >> 16); + return uint32_t(k); +} + +PX_FORCE_INLINE uint32_t PxComputeHash(const int32_t key) +{ + return PxComputeHash(uint32_t(key)); +} + +// Thomas Wang's 64 bit mix +// http://www.cris.com/~Ttwang/tech/inthash.htm +PX_FORCE_INLINE uint32_t PxComputeHash(const uint64_t key) +{ + uint64_t k = key; + k += ~(k << 32); + k ^= (k >> 22); + k += ~(k << 13); + k ^= (k >> 8); + k += (k << 3); + k ^= (k >> 15); + k += ~(k << 27); + k ^= (k >> 31); + return uint32_t(UINT32_MAX & k); +} + +#if PX_APPLE_FAMILY +// hash for size_t, to make gcc happy +PX_INLINE uint32_t PxComputeHash(const size_t key) +{ +#if PX_P64_FAMILY + return PxComputeHash(uint64_t(key)); +#else + return PxComputeHash(uint32_t(key)); +#endif +} +#endif + +// Hash function for pointers +PX_INLINE uint32_t PxComputeHash(const void* ptr) +{ +#if PX_P64_FAMILY + return PxComputeHash(uint64_t(ptr)); +#else + return PxComputeHash(uint32_t(UINT32_MAX & size_t(ptr))); +#endif +} + +// Hash function for pairs +template +PX_INLINE uint32_t PxComputeHash(const PxPair& p) +{ + uint32_t seed = 0x876543; + uint32_t m = 1000007; + return PxComputeHash(p.second) ^ (m * (PxComputeHash(p.first) ^ (m * seed))); +} + +// hash object for hash map template parameter +template +struct PxHash +{ + uint32_t operator()(const Key& k) const + { + return PxComputeHash(k); + } + bool equal(const Key& k0, const Key& k1) const + { + return k0 == k1; + } +}; + +// specialization for strings +template <> +struct PxHash +{ + public: + uint32_t operator()(const char* _string) const + { + // "DJB" string hash + const uint8_t* string = reinterpret_cast(_string); + uint32_t h = 5381; + for(const uint8_t* ptr = string; *ptr; ptr++) + h = ((h << 5) + h) ^ uint32_t(*ptr); + return h; + } + bool equal(const char* string0, const char* string1) const + { + return !Pxstrcmp(string0, string1); + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#if PX_VC +#pragma warning(pop) +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxHashInternals.h b/engine/third_party/physx/include/foundation/PxHashInternals.h new file mode 100644 index 00000000..d31a9153 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxHashInternals.h @@ -0,0 +1,791 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_HASH_INTERNALS_H +#define PX_HASH_INTERNALS_H + +#include "foundation/PxAllocator.h" +#include "foundation/PxBitUtils.h" +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxHash.h" + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4127) // conditional expression is constant +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +template +class PxHashBase : private PxAllocator +{ + void init(uint32_t initialTableSize, float loadFactor) + { + mBuffer = NULL; + mEntries = NULL; + mEntriesNext = NULL; + mHash = NULL; + mEntriesCapacity = 0; + mHashSize = 0; + mLoadFactor = loadFactor; + mFreeList = uint32_t(EOL); + mTimestamp = 0; + mEntriesCount = 0; + + if(initialTableSize) + reserveInternal(initialTableSize); + } + + public: + typedef Entry EntryType; + + PxHashBase(uint32_t initialTableSize = 64, float loadFactor = 0.75f) : PxAllocator("hashBase") + { + init(initialTableSize, loadFactor); + } + + PxHashBase(uint32_t initialTableSize, float loadFactor, const PxAllocator& alloc) : PxAllocator(alloc) + { + init(initialTableSize, loadFactor); + } + + PxHashBase(const PxAllocator& alloc) : PxAllocator(alloc) + { + init(64, 0.75f); + } + + ~PxHashBase() + { + destroy(); // No need to clear() + + if(mBuffer) + PxAllocator::deallocate(mBuffer); + } + + static const uint32_t EOL = 0xffffffff; + + PX_INLINE Entry* create(const Key& k, bool& exists) + { + uint32_t h = 0; + if(mHashSize) + { + h = hash(k); + uint32_t index = mHash[h]; + while(index != EOL && !HashFn().equal(GetKey()(mEntries[index]), k)) + index = mEntriesNext[index]; + exists = index != EOL; + if(exists) + return mEntries + index; + } + else + exists = false; + + if(freeListEmpty()) + { + grow(); + h = hash(k); + } + + uint32_t entryIndex = freeListGetNext(); + + mEntriesNext[entryIndex] = mHash[h]; + mHash[h] = entryIndex; + + mEntriesCount++; + mTimestamp++; + + return mEntries + entryIndex; + } + + PX_INLINE const Entry* find(const Key& k) const + { + if(!mEntriesCount) + return NULL; + + const uint32_t h = hash(k); + uint32_t index = mHash[h]; + while(index != EOL && !HashFn().equal(GetKey()(mEntries[index]), k)) + index = mEntriesNext[index]; + return index != EOL ? mEntries + index : NULL; + } + + PX_INLINE bool erase(const Key& k, Entry& e) + { + if(!mEntriesCount) + return false; + + const uint32_t h = hash(k); + uint32_t* ptr = mHash + h; + while(*ptr != EOL && !HashFn().equal(GetKey()(mEntries[*ptr]), k)) + ptr = mEntriesNext + *ptr; + + if(*ptr == EOL) + return false; + + PX_PLACEMENT_NEW(&e, Entry)(mEntries[*ptr]); + + return eraseInternal(ptr); + } + + PX_INLINE bool erase(const Key& k) + { + if(!mEntriesCount) + return false; + + const uint32_t h = hash(k); + uint32_t* ptr = mHash + h; + while(*ptr != EOL && !HashFn().equal(GetKey()(mEntries[*ptr]), k)) + ptr = mEntriesNext + *ptr; + + if(*ptr == EOL) + return false; + + return eraseInternal(ptr); + } + + PX_INLINE uint32_t size() const + { + return mEntriesCount; + } + + PX_INLINE uint32_t capacity() const + { + return mHashSize; + } + + void clear() + { + if(!mHashSize || mEntriesCount == 0) + return; + + destroy(); + + intrinsics::memSet(mHash, EOL, mHashSize * sizeof(uint32_t)); + + const uint32_t sizeMinus1 = mEntriesCapacity - 1; + for(uint32_t i = 0; i < sizeMinus1; i++) + { + PxPrefetchLine(mEntriesNext + i, 128); + mEntriesNext[i] = i + 1; + } + mEntriesNext[mEntriesCapacity - 1] = uint32_t(EOL); + mFreeList = 0; + mEntriesCount = 0; + } + + void reserve(uint32_t size) + { + if(size > mHashSize) + reserveInternal(size); + } + + PX_INLINE const Entry* getEntries() const + { + return mEntries; + } + + PX_INLINE Entry* insertUnique(const Key& k) + { + PX_ASSERT(find(k) == NULL); + uint32_t h = hash(k); + + uint32_t entryIndex = freeListGetNext(); + + mEntriesNext[entryIndex] = mHash[h]; + mHash[h] = entryIndex; + + mEntriesCount++; + mTimestamp++; + + return mEntries + entryIndex; + } + + private: + void destroy() + { + for(uint32_t i = 0; i < mHashSize; i++) + { + for(uint32_t j = mHash[i]; j != EOL; j = mEntriesNext[j]) + mEntries[j].~Entry(); + } + } + + template + PX_NOINLINE void copy(const PxHashBase& other); + + // free list management - if we're coalescing, then we use mFreeList to hold + // the top of the free list and it should always be equal to size(). Otherwise, + // we build a free list in the next() pointers. + + PX_INLINE void freeListAdd(uint32_t index) + { + if(compacting) + { + mFreeList--; + PX_ASSERT(mFreeList == mEntriesCount); + } + else + { + mEntriesNext[index] = mFreeList; + mFreeList = index; + } + } + + PX_INLINE void freeListAdd(uint32_t start, uint32_t end) + { + if(!compacting) + { + for(uint32_t i = start; i < end - 1; i++) // add the new entries to the free list + mEntriesNext[i] = i + 1; + + // link in old free list + mEntriesNext[end - 1] = mFreeList; + PX_ASSERT(mFreeList != end - 1); + mFreeList = start; + } + else if(mFreeList == EOL) // don't reset the free ptr for the compacting hash unless it's empty + mFreeList = start; + } + + PX_INLINE uint32_t freeListGetNext() + { + PX_ASSERT(!freeListEmpty()); + if(compacting) + { + PX_ASSERT(mFreeList == mEntriesCount); + return mFreeList++; + } + else + { + uint32_t entryIndex = mFreeList; + mFreeList = mEntriesNext[mFreeList]; + return entryIndex; + } + } + + PX_INLINE bool freeListEmpty() const + { + if(compacting) + return mEntriesCount == mEntriesCapacity; + else + return mFreeList == EOL; + } + + PX_INLINE void replaceWithLast(uint32_t index) + { + PX_PLACEMENT_NEW(mEntries + index, Entry)(mEntries[mEntriesCount]); + mEntries[mEntriesCount].~Entry(); + mEntriesNext[index] = mEntriesNext[mEntriesCount]; + + uint32_t h = hash(GetKey()(mEntries[index])); + uint32_t* ptr; + for(ptr = mHash + h; *ptr != mEntriesCount; ptr = mEntriesNext + *ptr) + PX_ASSERT(*ptr != EOL); + *ptr = index; + } + + PX_INLINE uint32_t hash(const Key& k, uint32_t hashSize) const + { + return HashFn()(k) & (hashSize - 1); + } + + PX_INLINE uint32_t hash(const Key& k) const + { + return hash(k, mHashSize); + } + + PX_INLINE bool eraseInternal(uint32_t* ptr) + { + const uint32_t index = *ptr; + + *ptr = mEntriesNext[index]; + + mEntries[index].~Entry(); + + mEntriesCount--; + mTimestamp++; + + if (compacting && index != mEntriesCount) + replaceWithLast(index); + + freeListAdd(index); + return true; + } + + PX_NOINLINE void reserveInternal(uint32_t size) + { + if(!PxIsPowerOfTwo(size)) + size = PxNextPowerOfTwo(size); + + PX_ASSERT(!(size & (size - 1))); + + // decide whether iteration can be done on the entries directly + bool resizeCompact = compacting || freeListEmpty(); + + // define new table sizes + uint32_t oldEntriesCapacity = mEntriesCapacity; + uint32_t newEntriesCapacity = uint32_t(float(size) * mLoadFactor); + uint32_t newHashSize = size; + + // allocate new common buffer and setup pointers to new tables + uint8_t* newBuffer; + uint32_t* newHash; + uint32_t* newEntriesNext; + Entry* newEntries; + { + const uint64_t newEntriesNextBytesOffset = newHashSize * sizeof(uint32_t); + uint64_t newEntriesByteOffset = newEntriesNextBytesOffset + newEntriesCapacity * sizeof(uint32_t); + newEntriesByteOffset += (16 - (newEntriesByteOffset & 15)) & 15; + const uint64_t newBufferByteSize = newEntriesByteOffset + newEntriesCapacity * sizeof(Entry); + + newBuffer = reinterpret_cast(PxAllocator::allocate(newBufferByteSize, PX_FL)); + PX_ASSERT(newBuffer); + + newHash = reinterpret_cast(newBuffer); + newEntriesNext = reinterpret_cast(newBuffer + newEntriesNextBytesOffset); + newEntries = reinterpret_cast(newBuffer + newEntriesByteOffset); + } + + // initialize new hash table + intrinsics::memSet(newHash, int32_t(EOL), newHashSize * sizeof(uint32_t)); + + // iterate over old entries, re-hash and create new entries + if(resizeCompact) + { + // check that old free list is empty - we don't need to copy the next entries + PX_ASSERT(compacting || mFreeList == EOL); + + for(uint32_t index = 0; index < mEntriesCount; ++index) + { + uint32_t h = hash(GetKey()(mEntries[index]), newHashSize); + newEntriesNext[index] = newHash[h]; + newHash[h] = index; + + PX_PLACEMENT_NEW(newEntries + index, Entry)(mEntries[index]); + mEntries[index].~Entry(); + } + } + else + { + // copy old free list, only required for non compact resizing + intrinsics::memCopy(newEntriesNext, mEntriesNext, mEntriesCapacity * sizeof(uint32_t)); + + for(uint32_t bucket = 0; bucket < mHashSize; bucket++) + { + uint32_t index = mHash[bucket]; + while(index != EOL) + { + uint32_t h = hash(GetKey()(mEntries[index]), newHashSize); + newEntriesNext[index] = newHash[h]; + PX_ASSERT(index != newHash[h]); + + newHash[h] = index; + + PX_PLACEMENT_NEW(newEntries + index, Entry)(mEntries[index]); + mEntries[index].~Entry(); + + index = mEntriesNext[index]; + } + } + } + + // swap buffer and pointers + PxAllocator::deallocate(mBuffer); + mBuffer = newBuffer; + mHash = newHash; + mHashSize = newHashSize; + mEntriesNext = newEntriesNext; + mEntries = newEntries; + mEntriesCapacity = newEntriesCapacity; + + freeListAdd(oldEntriesCapacity, newEntriesCapacity); + } + + void grow() + { + PX_ASSERT((mFreeList == EOL) || (compacting && (mEntriesCount == mEntriesCapacity))); + + uint32_t size = mHashSize == 0 ? 16 : mHashSize * 2; + reserve(size); + } + + uint8_t* mBuffer; + Entry* mEntries; + uint32_t* mEntriesNext; // same size as mEntries + uint32_t* mHash; + uint32_t mEntriesCapacity; + uint32_t mHashSize; + float mLoadFactor; + uint32_t mFreeList; + uint32_t mTimestamp; + uint32_t mEntriesCount; // number of entries + + public: + class Iter + { + public: + PX_INLINE Iter(PxHashBase& b) : mBucket(0), mEntry(uint32_t(b.EOL)), mTimestamp(b.mTimestamp), mBase(b) + { + if(mBase.mEntriesCapacity > 0) + { + mEntry = mBase.mHash[0]; + skip(); + } + } + + PX_INLINE void check() const + { + PX_ASSERT(mTimestamp == mBase.mTimestamp); + } + PX_INLINE const Entry& operator*() const + { + check(); + return mBase.mEntries[mEntry]; + } + PX_INLINE Entry& operator*() + { + check(); + return mBase.mEntries[mEntry]; + } + PX_INLINE const Entry* operator->() const + { + check(); + return mBase.mEntries + mEntry; + } + PX_INLINE Entry* operator->() + { + check(); + return mBase.mEntries + mEntry; + } + PX_INLINE Iter operator++() + { + check(); + advance(); + return *this; + } + PX_INLINE Iter operator++(int) + { + check(); + Iter i = *this; + advance(); + return i; + } + PX_INLINE bool done() const + { + check(); + return mEntry == mBase.EOL; + } + + private: + PX_INLINE void advance() + { + mEntry = mBase.mEntriesNext[mEntry]; + skip(); + } + PX_INLINE void skip() + { + while(mEntry == mBase.EOL) + { + if(++mBucket == mBase.mHashSize) + break; + mEntry = mBase.mHash[mBucket]; + } + } + + Iter& operator=(const Iter&); + + uint32_t mBucket; + uint32_t mEntry; + uint32_t mTimestamp; + PxHashBase& mBase; + }; + + /*! + Iterate over entries in a hash base and allow entry erase while iterating + */ + class PxEraseIterator + { + public: + PX_INLINE PxEraseIterator(PxHashBase& b): mBase(b) + { + reset(); + } + + PX_INLINE Entry* eraseCurrentGetNext(bool eraseCurrent) + { + if(eraseCurrent && mCurrentEntryIndexPtr) + { + mBase.eraseInternal(mCurrentEntryIndexPtr); + // if next was valid return the same ptr, if next was EOL search new hash entry + if(*mCurrentEntryIndexPtr != mBase.EOL) + return mBase.mEntries + *mCurrentEntryIndexPtr; + else + return traverseHashEntries(); + } + + // traverse mHash to find next entry + if(mCurrentEntryIndexPtr == NULL) + return traverseHashEntries(); + + const uint32_t index = *mCurrentEntryIndexPtr; + if(mBase.mEntriesNext[index] == mBase.EOL) + { + return traverseHashEntries(); + } + else + { + mCurrentEntryIndexPtr = mBase.mEntriesNext + index; + return mBase.mEntries + *mCurrentEntryIndexPtr; + } + } + + PX_INLINE void reset() + { + mCurrentHashIndex = 0; + mCurrentEntryIndexPtr = NULL; + } + + private: + PX_INLINE Entry* traverseHashEntries() + { + mCurrentEntryIndexPtr = NULL; + while (mCurrentEntryIndexPtr == NULL && mCurrentHashIndex < mBase.mHashSize) + { + if (mBase.mHash[mCurrentHashIndex] != mBase.EOL) + { + mCurrentEntryIndexPtr = mBase.mHash + mCurrentHashIndex; + mCurrentHashIndex++; + return mBase.mEntries + *mCurrentEntryIndexPtr; + } + else + { + mCurrentHashIndex++; + } + } + return NULL; + } + + PxEraseIterator& operator=(const PxEraseIterator&); + private: + uint32_t* mCurrentEntryIndexPtr; + uint32_t mCurrentHashIndex; + PxHashBase& mBase; + }; +}; + +template +template +PX_NOINLINE void +PxHashBase::copy(const PxHashBase& other) +{ + reserve(other.mEntriesCount); + + for(uint32_t i = 0; i < other.mEntriesCount; i++) + { + for(uint32_t j = other.mHash[i]; j != EOL; j = other.mEntriesNext[j]) + { + const Entry& otherEntry = other.mEntries[j]; + + bool exists; + Entry* newEntry = create(GK()(otherEntry), exists); + PX_ASSERT(!exists); + + PX_PLACEMENT_NEW(newEntry, Entry)(otherEntry); + } + } +} + +template ::Type, bool Coalesced = false> +class PxHashSetBase +{ + PX_NOCOPY(PxHashSetBase) + public: + struct GetKey + { + PX_INLINE const Key& operator()(const Key& e) + { + return e; + } + }; + + typedef PxHashBase BaseMap; + typedef typename BaseMap::Iter Iterator; + + PxHashSetBase(uint32_t initialTableSize, float loadFactor, const PxAllocator& alloc) + : mBase(initialTableSize, loadFactor, alloc) + { + } + + PxHashSetBase(const PxAllocator& alloc) : mBase(64, 0.75f, alloc) + { + } + + PxHashSetBase(uint32_t initialTableSize = 64, float loadFactor = 0.75f) : mBase(initialTableSize, loadFactor) + { + } + + bool insert(const Key& k) + { + bool exists; + Key* e = mBase.create(k, exists); + if(!exists) + PX_PLACEMENT_NEW(e, Key)(k); + return !exists; + } + + PX_INLINE bool contains(const Key& k) const + { + return mBase.find(k) != 0; + } + PX_INLINE bool erase(const Key& k) + { + return mBase.erase(k); + } + PX_INLINE uint32_t size() const + { + return mBase.size(); + } + PX_INLINE uint32_t capacity() const + { + return mBase.capacity(); + } + PX_INLINE void reserve(uint32_t size) + { + mBase.reserve(size); + } + PX_INLINE void clear() + { + mBase.clear(); + } + + protected: + BaseMap mBase; +}; + +template >::Type> +class PxHashMapBase +{ + PX_NOCOPY(PxHashMapBase) + public: + typedef PxPair Entry; + + struct GetKey + { + PX_INLINE const Key& operator()(const Entry& e) + { + return e.first; + } + }; + + typedef PxHashBase BaseMap; + typedef typename BaseMap::Iter Iterator; + typedef typename BaseMap::PxEraseIterator EraseIterator; + + PxHashMapBase(uint32_t initialTableSize, float loadFactor, const PxAllocator& alloc) + : mBase(initialTableSize, loadFactor, alloc) + { + } + + PxHashMapBase(const PxAllocator& alloc) : mBase(64, 0.75f, alloc) + { + } + + PxHashMapBase(uint32_t initialTableSize = 64, float loadFactor = 0.75f) : mBase(initialTableSize, loadFactor) + { + } + + bool insert(const Key /*&*/ k, const Value /*&*/ v) + { + bool exists; + Entry* e = mBase.create(k, exists); + if(!exists) + PX_PLACEMENT_NEW(e, Entry)(k, v); + return !exists; + } + + Value& operator[](const Key& k) + { + bool exists; + Entry* e = mBase.create(k, exists); + if(!exists) + PX_PLACEMENT_NEW(e, Entry)(k, Value()); + + return e->second; + } + + PX_INLINE const Entry* find(const Key& k) const + { + return mBase.find(k); + } + PX_INLINE bool erase(const Key& k) + { + return mBase.erase(k); + } + PX_INLINE bool erase(const Key& k, Entry& e) + { + return mBase.erase(k, e); + } + PX_INLINE uint32_t size() const + { + return mBase.size(); + } + PX_INLINE uint32_t capacity() const + { + return mBase.capacity(); + } + PX_INLINE Iterator getIterator() + { + return Iterator(mBase); + } + PX_INLINE EraseIterator getEraseIterator() + { + return EraseIterator(mBase); + } + PX_INLINE void reserve(uint32_t size) + { + mBase.reserve(size); + } + PX_INLINE void clear() + { + mBase.clear(); + } + + protected: + BaseMap mBase; +}; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#if PX_VC +#pragma warning(pop) +#endif +#endif diff --git a/engine/third_party/physx/include/foundation/PxHashMap.h b/engine/third_party/physx/include/foundation/PxHashMap.h new file mode 100644 index 00000000..47670071 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxHashMap.h @@ -0,0 +1,119 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_HASHMAP_H +#define PX_HASHMAP_H + +#include "foundation/PxHashInternals.h" + +// TODO: make this doxy-format +// +// This header defines two hash maps. Hash maps +// * support custom initial table sizes (rounded up internally to power-of-2) +// * support custom static allocator objects +// * auto-resize, based on a load factor (i.e. a 64-entry .75 load factor hash will resize +// when the 49th element is inserted) +// * are based on open hashing +// * have O(1) contains, erase +// +// Maps have STL-like copying semantics, and properly initialize and destruct copies of objects +// +// There are two forms of map: coalesced and uncoalesced. Coalesced maps keep the entries in the +// initial segment of an array, so are fast to iterate over; however deletion is approximately +// twice as expensive. +// +// HashMap: +// bool insert(const Key& k, const Value& v) O(1) amortized (exponential resize policy) +// Value & operator[](const Key& k) O(1) for existing objects, else O(1) amortized +// const Entry * find(const Key& k); O(1) +// bool erase(const T& k); O(1) +// uint32_t size(); constant +// void reserve(uint32_t size); O(MAX(currentOccupancy,size)) +// void clear(); O(currentOccupancy) (with zero constant for objects +// without +// destructors) +// Iterator getIterator(); +// +// operator[] creates an entry if one does not exist, initializing with the default constructor. +// CoalescedHashMap does not support getIterator, but instead supports +// const Key *getEntries(); +// +// Use of iterators: +// +// for(HashMap::Iterator iter = test.getIterator(); !iter.done(); ++iter) +// myFunction(iter->first, iter->second); + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +template , class Allocator = PxAllocator> +class PxHashMap : public physx::PxHashMapBase +{ + public: + typedef physx::PxHashMapBase HashMapBase; + typedef typename HashMapBase::Iterator Iterator; + + PxHashMap(uint32_t initialTableSize = 64, float loadFactor = 0.75f) : HashMapBase(initialTableSize, loadFactor) + { + } + PxHashMap(uint32_t initialTableSize, float loadFactor, const Allocator& alloc) + : HashMapBase(initialTableSize, loadFactor, alloc) + { + } + PxHashMap(const Allocator& alloc) : HashMapBase(64, 0.75f, alloc) + { + } + Iterator getIterator() + { + return Iterator(HashMapBase::mBase); + } +}; + +template , class Allocator = PxAllocator> +class PxCoalescedHashMap : public physx::PxHashMapBase +{ + public: + typedef physx::PxHashMapBase HashMapBase; + + PxCoalescedHashMap(uint32_t initialTableSize = 64, float loadFactor = 0.75f) + : HashMapBase(initialTableSize, loadFactor) + { + } + const PxPair* getEntries() const + { + return HashMapBase::mBase.getEntries(); + } +}; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxHashSet.h b/engine/third_party/physx/include/foundation/PxHashSet.h new file mode 100644 index 00000000..fa4c650a --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxHashSet.h @@ -0,0 +1,128 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_HASHSET_H +#define PX_HASHSET_H + +#include "foundation/PxHashInternals.h" + +// TODO: make this doxy-format + +// This header defines two hash sets. Hash sets +// * support custom initial table sizes (rounded up internally to power-of-2) +// * support custom static allocator objects +// * auto-resize, based on a load factor (i.e. a 64-entry .75 load factor hash will resize +// when the 49th element is inserted) +// * are based on open hashing +// +// Sets have STL-like copying semantics, and properly initialize and destruct copies of objects +// +// There are two forms of set: coalesced and uncoalesced. Coalesced sets keep the entries in the +// initial segment of an array, so are fast to iterate over; however deletion is approximately +// twice as expensive. +// +// HashSet: +// bool insert(const T& k) amortized O(1) (exponential resize policy) +// bool contains(const T& k) const; O(1) +// bool erase(const T& k); O(1) +// uint32_t size() const; constant +// void reserve(uint32_t size); O(MAX(size, currentOccupancy)) +// void clear(); O(currentOccupancy) (with zero constant for objects without +// destructors) +// Iterator getIterator(); +// +// Use of iterators: +// +// for(HashSet::Iterator iter = test.getIterator(); !iter.done(); ++iter) +// myFunction(*iter); +// +// CoalescedHashSet does not support getIterator, but instead supports +// const Key *getEntries(); +// +// insertion into a set already containing the element fails returning false, as does +// erasure of an element not in the set +// + +#if !PX_DOXYGEN +namespace physx +{ +#endif +template , class Allocator = PxAllocator> +class PxHashSet : public physx::PxHashSetBase +{ + public: + typedef physx::PxHashSetBase HashSetBase; + typedef typename HashSetBase::Iterator Iterator; + + PxHashSet(uint32_t initialTableSize = 64, float loadFactor = 0.75f) : HashSetBase(initialTableSize, loadFactor) + { + } + PxHashSet(uint32_t initialTableSize, float loadFactor, const Allocator& alloc) + : HashSetBase(initialTableSize, loadFactor, alloc) + { + } + PxHashSet(const Allocator& alloc) : HashSetBase(64, 0.75f, alloc) + { + } + Iterator getIterator() + { + return Iterator(HashSetBase::mBase); + } +}; + +template , class Allocator = PxAllocator> +class PxCoalescedHashSet : public physx::PxHashSetBase +{ + public: + typedef typename physx::PxHashSetBase HashSetBase; + + PxCoalescedHashSet(uint32_t initialTableSize = 64, float loadFactor = 0.75f) + : HashSetBase(initialTableSize, loadFactor) + { + } + + PxCoalescedHashSet(uint32_t initialTableSize, float loadFactor, const Allocator& alloc) + : HashSetBase(initialTableSize, loadFactor, alloc) + { + } + PxCoalescedHashSet(const Allocator& alloc) : HashSetBase(64, 0.75f, alloc) + { + } + + const Key* getEntries() const + { + return HashSetBase::mBase.getEntries(); + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxIO.h b/engine/third_party/physx/include/foundation/PxIO.h new file mode 100644 index 00000000..177d4776 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxIO.h @@ -0,0 +1,140 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_IO_H +#define PX_IO_H + + +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** enum for empty constructor tag*/ +enum PxEMPTY +{ + PxEmpty +}; + +/** +\brief Input stream class for I/O. + +The user needs to supply a PxInputStream implementation to a number of methods to allow the SDK to read data. +*/ + +class PxInputStream +{ + public: + /** + \brief read from the stream. The number of bytes read may be less than the number requested. + + \param[in] dest the destination address to which the data will be read + \param[in] count the number of bytes requested + + \return the number of bytes read from the stream. + */ + + virtual uint32_t read(void* dest, uint32_t count) = 0; + + virtual ~PxInputStream() + { + } +}; + +/** +\brief Input data class for I/O which provides random read access. + +The user needs to supply a PxInputData implementation to a number of methods to allow the SDK to read data. +*/ + +class PxInputData : public PxInputStream +{ + public: + /** + \brief return the length of the input data + + \return size in bytes of the input data + */ + + virtual uint32_t getLength() const = 0; + + /** + \brief seek to the given offset from the start of the data. + + \param[in] offset the offset to seek to. If greater than the length of the data, this call is equivalent to + seek(length); + */ + + virtual void seek(uint32_t offset) = 0; + + /** + \brief return the current offset from the start of the data + + \return the offset to seek to. + */ + + virtual uint32_t tell() const = 0; + + virtual ~PxInputData() + { + } +}; + +/** +\brief Output stream class for I/O. + +The user needs to supply a PxOutputStream implementation to a number of methods to allow the SDK to write data. +*/ + +class PxOutputStream +{ + public: + /** + \brief write to the stream. The number of bytes written may be less than the number sent. + + \param[in] src the destination address from which the data will be written + \param[in] count the number of bytes to be written + + \return the number of bytes written to the stream by this call. + */ + + virtual uint32_t write(const void* src, uint32_t count) = 0; + + virtual ~PxOutputStream() + { + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxInlineAllocator.h b/engine/third_party/physx/include/foundation/PxInlineAllocator.h new file mode 100644 index 00000000..3084e00e --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxInlineAllocator.h @@ -0,0 +1,94 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_INLINE_ALLOCATOR_H +#define PX_INLINE_ALLOCATOR_H + +#include "foundation/PxUserAllocated.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +// this is used by the array class to allocate some space for a small number +// of objects along with the metadata +template +class PxInlineAllocator : private BaseAllocator +{ + public: + PxInlineAllocator(const PxEMPTY v) : BaseAllocator(v) + { + } + + PxInlineAllocator(const BaseAllocator& alloc = BaseAllocator()) : BaseAllocator(alloc), mBufferUsed(false) + { + } + + PxInlineAllocator(const PxInlineAllocator& aloc) : BaseAllocator(aloc), mBufferUsed(false) + { + } + + void* allocate(PxU32 size, const char* filename, PxI32 line, uint32_t* cookie=NULL) + { + PX_UNUSED(cookie); + if(!mBufferUsed && size <= N) + { + mBufferUsed = true; + return mBuffer; + } + return BaseAllocator::allocate(size, filename, line); + } + + void deallocate(void* ptr, uint32_t* cookie=NULL) + { + PX_UNUSED(cookie); + if(ptr == mBuffer) + mBufferUsed = false; + else + BaseAllocator::deallocate(ptr); + } + + PX_FORCE_INLINE PxU8* getInlineBuffer() + { + return mBuffer; + } + PX_FORCE_INLINE bool isBufferUsed() const + { + return mBufferUsed; + } + + protected: + PxU8 mBuffer[N]; + bool mBufferUsed; +}; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxInlineAoS.h b/engine/third_party/physx/include/foundation/PxInlineAoS.h new file mode 100644 index 00000000..5d7c0ceb --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxInlineAoS.h @@ -0,0 +1,45 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_INLINE_AOS_H +#define PX_INLINE_AOS_H + +#include "foundation/PxPreprocessor.h" + +#if PX_WINDOWS +#include "windows/PxWindowsTrigConstants.h" +#include "windows/PxWindowsInlineAoS.h" +#elif(PX_UNIX_FAMILY || PX_SWITCH) +#include "unix/PxUnixTrigConstants.h" +#include "unix/PxUnixInlineAoS.h" +#else +#error "Platform not supported!" +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxInlineArray.h b/engine/third_party/physx/include/foundation/PxInlineArray.h new file mode 100644 index 00000000..88314fbb --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxInlineArray.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_INLINE_ARRAY_H +#define PX_INLINE_ARRAY_H + +#include "foundation/PxArray.h" +#include "foundation/PxInlineAllocator.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +// array that pre-allocates for N elements +template ::Type> +class PxInlineArray : public PxArray > +{ + typedef PxInlineAllocator Allocator; + + public: + PxInlineArray(const PxEMPTY v) : PxArray(v) + { + if(isInlined()) + this->mData = reinterpret_cast(PxArray::getInlineBuffer()); + } + + PX_INLINE bool isInlined() const + { + return Allocator::isBufferUsed(); + } + + PX_INLINE explicit PxInlineArray(const Alloc& alloc = Alloc()) : PxArray(alloc) + { + this->mData = this->allocate(N); + this->mCapacity = N; + } +}; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxIntrinsics.h b/engine/third_party/physx/include/foundation/PxIntrinsics.h new file mode 100644 index 00000000..a60eca75 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxIntrinsics.h @@ -0,0 +1,44 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_INTRINSICS_H +#define PX_INTRINSICS_H + +#include "foundation/PxPreprocessor.h" +#if PX_WINDOWS_FAMILY +#include "windows/PxWindowsIntrinsics.h" +#elif(PX_LINUX || PX_APPLE_FAMILY) +#include "unix/PxUnixIntrinsics.h" +#elif PX_SWITCH +#include "switch/PxSwitchIntrinsics.h" +#else +#error "Platform not supported!" +#endif + + +#endif // #ifndef PX_INTRINSICS_H diff --git a/engine/third_party/physx/include/foundation/PxMat33.h b/engine/third_party/physx/include/foundation/PxMat33.h new file mode 100644 index 00000000..4aac4f91 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxMat33.h @@ -0,0 +1,508 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_MAT33_H +#define PX_MAT33_H + +#include "foundation/PxVec3.h" +#include "foundation/PxQuat.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +/*! +\brief 3x3 matrix class + +Some clarifications, as there have been much confusion about matrix formats etc in the past. + +Short: +- Matrix have base vectors in columns (vectors are column matrices, 3x1 matrices). +- Matrix is physically stored in column major format +- Matrices are concaternated from left + +Long: +Given three base vectors a, b and c the matrix is stored as + +|a.x b.x c.x| +|a.y b.y c.y| +|a.z b.z c.z| + +Vectors are treated as columns, so the vector v is + +|x| +|y| +|z| + +And matrices are applied _before_ the vector (pre-multiplication) +v' = M*v + +|x'| |a.x b.x c.x| |x| |a.x*x + b.x*y + c.x*z| +|y'| = |a.y b.y c.y| * |y| = |a.y*x + b.y*y + c.y*z| +|z'| |a.z b.z c.z| |z| |a.z*x + b.z*y + c.z*z| + + +Physical storage and indexing: +To be compatible with popular 3d rendering APIs (read D3d and OpenGL) +the physical indexing is + +|0 3 6| +|1 4 7| +|2 5 8| + +index = column*3 + row + +which in C++ translates to M[column][row] + +The mathematical indexing is M_row,column and this is what is used for _-notation +so _12 is 1st row, second column and operator(row, column)! +*/ + +template +class PxMat33T +{ + public: + //! Default constructor + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33T() + { + } + + //! identity constructor + PX_CUDA_CALLABLE PX_INLINE PxMat33T(PxIDENTITY) : + column0(Type(1.0), Type(0.0), Type(0.0)), + column1(Type(0.0), Type(1.0), Type(0.0)), + column2(Type(0.0), Type(0.0), Type(1.0)) + { + } + + //! zero constructor + PX_CUDA_CALLABLE PX_INLINE PxMat33T(PxZERO) : + column0(Type(0.0)), + column1(Type(0.0)), + column2(Type(0.0)) + { + } + + //! Construct from three base vectors + PX_CUDA_CALLABLE PxMat33T(const PxVec3T& col0, const PxVec3T& col1, const PxVec3T& col2) : + column0(col0), + column1(col1), + column2(col2) + { + } + + //! constructor from a scalar, which generates a multiple of the identity matrix + explicit PX_CUDA_CALLABLE PX_INLINE PxMat33T(Type r) : + column0(r, Type(0.0), Type(0.0)), + column1(Type(0.0), r, Type(0.0)), + column2(Type(0.0), Type(0.0), r) + { + } + + //! Construct from Type[9] + explicit PX_CUDA_CALLABLE PX_INLINE PxMat33T(Type values[]) : + column0(values[0], values[1], values[2]), + column1(values[3], values[4], values[5]), + column2(values[6], values[7], values[8]) + { + } + + //! Construct from a quaternion + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33T(const PxQuatT& q) + { + // PT: TODO: PX-566 + const Type x = q.x; + const Type y = q.y; + const Type z = q.z; + const Type w = q.w; + + const Type x2 = x + x; + const Type y2 = y + y; + const Type z2 = z + z; + + const Type xx = x2 * x; + const Type yy = y2 * y; + const Type zz = z2 * z; + + const Type xy = x2 * y; + const Type xz = x2 * z; + const Type xw = x2 * w; + + const Type yz = y2 * z; + const Type yw = y2 * w; + const Type zw = z2 * w; + + column0 = PxVec3T(Type(1.0) - yy - zz, xy + zw, xz - yw); + column1 = PxVec3T(xy - zw, Type(1.0) - xx - zz, yz + xw); + column2 = PxVec3T(xz + yw, yz - xw, Type(1.0) - xx - yy); + } + + //! Copy constructor + PX_CUDA_CALLABLE PX_INLINE PxMat33T(const PxMat33T& other) : + column0(other.column0), + column1(other.column1), + column2(other.column2) + { + } + + //! Assignment operator + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33T& operator=(const PxMat33T& other) + { + column0 = other.column0; + column1 = other.column1; + column2 = other.column2; + return *this; + } + + //! Construct from diagonal, off-diagonals are zero. + PX_CUDA_CALLABLE PX_INLINE static const PxMat33T createDiagonal(const PxVec3T& d) + { + return PxMat33T(PxVec3T(d.x, Type(0.0), Type(0.0)), + PxVec3T(Type(0.0), d.y, Type(0.0)), + PxVec3T(Type(0.0), Type(0.0), d.z)); + } + + //! Computes the outer product of two vectors + PX_CUDA_CALLABLE PX_INLINE static const PxMat33T outer(const PxVec3T& a, const PxVec3T& b) + { + return PxMat33T(a * b.x, a * b.y, a * b.z); + } + + /** + \brief returns true if the two matrices are exactly equal + */ + PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxMat33T& m) const + { + return column0 == m.column0 && column1 == m.column1 && column2 == m.column2; + } + + //! Get transposed matrix + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxMat33T getTranspose() const + { + const PxVec3T v0(column0.x, column1.x, column2.x); + const PxVec3T v1(column0.y, column1.y, column2.y); + const PxVec3T v2(column0.z, column1.z, column2.z); + + return PxMat33T(v0, v1, v2); + } + + //! Get the real inverse + PX_CUDA_CALLABLE PX_INLINE const PxMat33T getInverse() const + { + const Type det = getDeterminant(); + PxMat33T inverse; + + if(det != Type(0.0)) + { + const Type invDet = Type(1.0) / det; + + inverse.column0.x = invDet * (column1.y * column2.z - column2.y * column1.z); + inverse.column0.y = invDet * -(column0.y * column2.z - column2.y * column0.z); + inverse.column0.z = invDet * (column0.y * column1.z - column0.z * column1.y); + + inverse.column1.x = invDet * -(column1.x * column2.z - column1.z * column2.x); + inverse.column1.y = invDet * (column0.x * column2.z - column0.z * column2.x); + inverse.column1.z = invDet * -(column0.x * column1.z - column0.z * column1.x); + + inverse.column2.x = invDet * (column1.x * column2.y - column1.y * column2.x); + inverse.column2.y = invDet * -(column0.x * column2.y - column0.y * column2.x); + inverse.column2.z = invDet * (column0.x * column1.y - column1.x * column0.y); + + return inverse; + } + else + { + return PxMat33T(PxIdentity); + } + } + + //! Get determinant + PX_CUDA_CALLABLE PX_INLINE Type getDeterminant() const + { + return column0.dot(column1.cross(column2)); + } + + //! Unary minus + PX_CUDA_CALLABLE PX_INLINE const PxMat33T operator-() const + { + return PxMat33T(-column0, -column1, -column2); + } + + //! Add + PX_CUDA_CALLABLE PX_INLINE const PxMat33T operator+(const PxMat33T& other) const + { + return PxMat33T(column0 + other.column0, column1 + other.column1, column2 + other.column2); + } + + //! Subtract + PX_CUDA_CALLABLE PX_INLINE const PxMat33T operator-(const PxMat33T& other) const + { + return PxMat33T(column0 - other.column0, column1 - other.column1, column2 - other.column2); + } + + //! Scalar multiplication + PX_CUDA_CALLABLE PX_INLINE const PxMat33T operator*(Type scalar) const + { + return PxMat33T(column0 * scalar, column1 * scalar, column2 * scalar); + } + + template + PX_CUDA_CALLABLE PX_INLINE friend PxMat33T operator*(Type2, const PxMat33T&); + + //! Matrix vector multiplication (returns 'this->transform(vec)') + PX_CUDA_CALLABLE PX_INLINE const PxVec3T operator*(const PxVec3T& vec) const + { + return transform(vec); + } + + // a = b operators + + //! Matrix multiplication + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxMat33T operator*(const PxMat33T& other) const + { + // Rows from this columns from other + // column0 = transform(other.column0) etc + return PxMat33T(transform(other.column0), + transform(other.column1), + transform(other.column2)); + } + + //! Equals-add + PX_CUDA_CALLABLE PX_INLINE PxMat33T& operator+=(const PxMat33T& other) + { + column0 += other.column0; + column1 += other.column1; + column2 += other.column2; + return *this; + } + + //! Equals-sub + PX_CUDA_CALLABLE PX_INLINE PxMat33T& operator-=(const PxMat33T& other) + { + column0 -= other.column0; + column1 -= other.column1; + column2 -= other.column2; + return *this; + } + + //! Equals scalar multiplication + PX_CUDA_CALLABLE PX_INLINE PxMat33T& operator*=(Type scalar) + { + column0 *= scalar; + column1 *= scalar; + column2 *= scalar; + return *this; + } + + //! Equals matrix multiplication + PX_CUDA_CALLABLE PX_INLINE PxMat33T& operator*=(const PxMat33T& other) + { + *this = *this * other; + return *this; + } + + //! Element access, mathematical way! + PX_CUDA_CALLABLE PX_FORCE_INLINE Type operator()(PxU32 row, PxU32 col) const + { + return (*this)[col][row]; + } + + //! Element access, mathematical way! + PX_CUDA_CALLABLE PX_FORCE_INLINE Type& operator()(PxU32 row, PxU32 col) + { + return (*this)[col][row]; + } + + // Transform etc + + //! Transform vector by matrix, equal to v' = M*v + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3T transform(const PxVec3T& other) const + { + return column0 * other.x + column1 * other.y + column2 * other.z; + } + + //! Transform vector by matrix transpose, v' = M^t*v + PX_CUDA_CALLABLE PX_INLINE const PxVec3T transformTranspose(const PxVec3T& other) const + { + return PxVec3T(column0.dot(other), column1.dot(other), column2.dot(other)); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE const Type* front() const + { + return &column0.x; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T& operator[](PxU32 num) + { + return (&column0)[num]; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3T& operator[](PxU32 num) const + { + return (&column0)[num]; + } + + // Data, see above for format! + + PxVec3T column0, column1, column2; // the three base vectors +}; + +template +PX_CUDA_CALLABLE PX_INLINE PxMat33T operator*(Type scalar, const PxMat33T& m) +{ + return PxMat33T(scalar * m.column0, scalar * m.column1, scalar * m.column2); +} + +// implementation from PxQuat.h +template +PX_CUDA_CALLABLE PX_INLINE PxQuatT::PxQuatT(const PxMat33T& m) +{ + if(m.column2.z < Type(0)) + { + if(m.column0.x > m.column1.y) + { + const Type t = Type(1.0) + m.column0.x - m.column1.y - m.column2.z; + *this = PxQuatT(t, m.column0.y + m.column1.x, m.column2.x + m.column0.z, m.column1.z - m.column2.y) * (Type(0.5) / PxSqrt(t)); + } + else + { + const Type t = Type(1.0) - m.column0.x + m.column1.y - m.column2.z; + *this = PxQuatT(m.column0.y + m.column1.x, t, m.column1.z + m.column2.y, m.column2.x - m.column0.z) * (Type(0.5) / PxSqrt(t)); + } + } + else + { + if(m.column0.x < -m.column1.y) + { + const Type t = Type(1.0) - m.column0.x - m.column1.y + m.column2.z; + *this = PxQuatT(m.column2.x + m.column0.z, m.column1.z + m.column2.y, t, m.column0.y - m.column1.x) * (Type(0.5) / PxSqrt(t)); + } + else + { + const Type t = Type(1.0) + m.column0.x + m.column1.y + m.column2.z; + *this = PxQuatT(m.column1.z - m.column2.y, m.column2.x - m.column0.z, m.column0.y - m.column1.x, t) * (Type(0.5) / PxSqrt(t)); + } + } +} + +typedef PxMat33T PxMat33; +typedef PxMat33T PxMat33d; + + /** + \brief Sets a rotation matrix around the X axis. + \param m [out] output rotation matrix + \param angle [in] desired angle + */ + PX_INLINE void PxSetRotX(PxMat33& m, PxReal angle) + { + m = PxMat33(PxIdentity); + + PxReal sin, cos; + PxSinCos(angle, sin, cos); + + m[1][1] = m[2][2] = cos; + m[1][2] = sin; + m[2][1] = -sin; + } + + /** + \brief Sets a rotation matrix around the Y axis. + \param m [out] output rotation matrix + \param angle [in] desired angle + */ + PX_INLINE void PxSetRotY(PxMat33& m, PxReal angle) + { + m = PxMat33(PxIdentity); + + PxReal sin, cos; + PxSinCos(angle, sin, cos); + + m[0][0] = m[2][2] = cos; + m[0][2] = -sin; + m[2][0] = sin; + } + + /** + \brief Sets a rotation matrix around the Z axis. + \param m [out] output rotation matrix + \param angle [in] desired angle + */ + PX_INLINE void PxSetRotZ(PxMat33& m, PxReal angle) + { + m = PxMat33(PxIdentity); + + PxReal sin, cos; + PxSinCos(angle, sin, cos); + + m[0][0] = m[1][1] = cos; + m[0][1] = sin; + m[1][0] = -sin; + } + + /** + \brief Returns a rotation quaternion around the X axis. + \param angle [in] desired angle + \return Quaternion that rotates around the desired axis + */ + PX_INLINE PxQuat PxGetRotXQuat(float angle) + { + PxMat33 m; + PxSetRotX(m, angle); + return PxQuat(m); + } + + /** + \brief Returns a rotation quaternion around the Y axis. + \param angle [in] desired angle + \return Quaternion that rotates around the desired axis + */ + PX_INLINE PxQuat PxGetRotYQuat(float angle) + { + PxMat33 m; + PxSetRotY(m, angle); + return PxQuat(m); + } + + /** + \brief Returns a rotation quaternion around the Z axis. + \param angle [in] desired angle + \return Quaternion that rotates around the desired axis + */ + PX_INLINE PxQuat PxGetRotZQuat(float angle) + { + PxMat33 m; + PxSetRotZ(m, angle); + return PxQuat(m); + } + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxMat34.h b/engine/third_party/physx/include/foundation/PxMat34.h new file mode 100644 index 00000000..3b8f0cec --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxMat34.h @@ -0,0 +1,273 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_MAT34_H +#define PX_MAT34_H + +#include "foundation/PxTransform.h" +#include "foundation/PxMat33.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +/*! +Basic mathematical 3x4 matrix, implemented as a 3x3 rotation matrix and a translation + +See PxMat33 for the format of the rotation matrix. +*/ + +template +class PxMat34T +{ + public: + //! Default constructor + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T() + { + } + + //! Construct from four base vectors + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T(const PxVec3T& b0, const PxVec3T& b1, const PxVec3T& b2, const PxVec3T& b3) + : m(b0, b1, b2), p(b3) + { + } + + //! Construct from Type[12] + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T(Type values[]) : + m(values), p(values[9], values[10], values[11]) + { + } + + //! Construct from a 3x3 matrix + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T(const PxMat33T& other) + : m(other), p(PxZero) + { + } + + //! Construct from a 3x3 matrix and a translation vector + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T(const PxMat33T& other, const PxVec3T& t) + : m(other), p(t) + { + } + + //! Construct from a PxTransformT + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T(const PxTransformT& other) + : m(other.q), p(other.p) + { + } + + //! Copy constructor + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T(const PxMat34T& other) : m(other.m), p(other.p) + { + } + + //! Assignment operator + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxMat34T& operator=(const PxMat34T& other) + { + m = other.m; + p = other.p; + return *this; + } + + //! Set to identity matrix + PX_CUDA_CALLABLE PX_FORCE_INLINE void setIdentity() + { + m = PxMat33T(PxIdentity); + p = PxVec3T(0); + } + + // Simpler operators + //! Equality operator + PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator==(const PxMat34T& other) const + { + return m == other.m && p == other.p; + } + + //! Inequality operator + PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator!=(const PxMat34T& other) const + { + return !operator==(other); + } + + //! Unary minus + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T operator-() const + { + return PxMat34T(-m, -p); + } + + //! Add + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T operator+(const PxMat34T& other) const + { + return PxMat34T(m + other.m, p + other.p); + } + + //! Subtract + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T operator-(const PxMat34T& other) const + { + return PxMat34T(m - other.m, p - other.p); + } + + //! Scalar multiplication + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T operator*(Type scalar) const + { + return PxMat34T(m*scalar, p*scalar); + } + + //! Matrix multiplication + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T operator*(const PxMat34T& other) const + { + //Rows from this columns from other + //base0 = rotate(other.m.column0) etc + return PxMat34T(m*other.m, m*other.p + p); + } + + //! Matrix multiplication, extend the second matrix + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T operator*(const PxMat33T& other) const + { + //Rows from this columns from other + //base0 = transform(other.m.column0) etc + return PxMat34T(m*other, p); + } + + template + friend PxMat34T operator*(const PxMat33T& a, const PxMat34T& b); + + // a = b operators + + //! Equals-add + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T& operator+=(const PxMat34T& other) + { + m += other.m; + p += other.p; + return *this; + } + + //! Equals-sub + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T& operator-=(const PxMat34T& other) + { + m -= other.m; + p -= other.p; + return *this; + } + + //! Equals scalar multiplication + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T& operator*=(Type scalar) + { + m *= scalar; + p *= scalar; + return *this; + } + + //! Element access, mathematical way! + PX_CUDA_CALLABLE PX_FORCE_INLINE Type operator()(PxU32 row, PxU32 col) const + { + return (*this)[col][row]; + } + + //! Element access, mathematical way! + PX_CUDA_CALLABLE PX_FORCE_INLINE Type& operator()(PxU32 row, PxU32 col) + { + return (*this)[col][row]; + } + + // Transform etc + + //! Transform vector by matrix, equal to v' = M*v + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T rotate(const PxVec3T& other) const + { + return m*other; + } + + //! Transform vector by transpose of matrix, equal to v' = M^t*v + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T rotateTranspose(const PxVec3T& other) const + { + return m.transformTranspose(other); + } + + //! Transform point by matrix + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T transform(const PxVec3T& other) const + { + return m*other + p; + } + + //! Transform point by transposed matrix + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T transformTranspose(const PxVec3T& other) const + { + return m.transformTranspose(other - p); + } + + //! Transform point by transposed matrix + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T transformTranspose(const PxMat34T& other) const + { + return PxMat34T(m.transformTranspose(other.m.column0), + m.transformTranspose(other.m.column1), + m.transformTranspose(other.m.column2), + m.transformTranspose(other.p - p)); + } + + //! Invert matrix treating it as a rotation+translation matrix only + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34T getInverseRT() const + { + return PxMat34T(m.getTranspose(), m.transformTranspose(-p)); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T& operator[](PxU32 num) { return (&m.column0)[num]; } + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3T& operator[](PxU32 num) const { return (&m.column0)[num]; } + + //Data, see above for format! + + PxMat33T m; + PxVec3T p; +}; + +//! Multiply a*b, a is extended +template +PX_INLINE PxMat34T operator*(const PxMat33T& a, const PxMat34T& b) +{ + return PxMat34T(a * b.m, a * b.p); +} + +typedef PxMat34T PxMat34; +typedef PxMat34T PxMat34d; + +//! A padded version of PxMat34, to safely load its data using SIMD +class PxMat34Padded : public PxMat34 +{ + public: + PX_FORCE_INLINE PxMat34Padded(const PxMat34& src) : PxMat34(src) {} + PX_FORCE_INLINE PxMat34Padded() {} + PX_FORCE_INLINE ~PxMat34Padded() {} + PxU32 padding; +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxMat34Padded)==16)); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/foundation/PxMat44.h b/engine/third_party/physx/include/foundation/PxMat44.h new file mode 100644 index 00000000..85161d42 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxMat44.h @@ -0,0 +1,387 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_MAT44_H +#define PX_MAT44_H + +#include "foundation/PxQuat.h" +#include "foundation/PxVec4.h" +#include "foundation/PxMat33.h" +#include "foundation/PxTransform.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/*! +\brief 4x4 matrix class + +This class is layout-compatible with D3D and OpenGL matrices. More notes on layout are given in the PxMat33 + +\see PxMat33 PxTransform +*/ + +template +class PxMat44T +{ + public: + //! Default constructor + PX_CUDA_CALLABLE PX_INLINE PxMat44T() + { + } + + //! identity constructor + PX_CUDA_CALLABLE PX_INLINE PxMat44T(PxIDENTITY) : + column0(Type(1.0), Type(0.0), Type(0.0), Type(0.0)), + column1(Type(0.0), Type(1.0), Type(0.0), Type(0.0)), + column2(Type(0.0), Type(0.0), Type(1.0), Type(0.0)), + column3(Type(0.0), Type(0.0), Type(0.0), Type(1.0)) + { + } + + //! zero constructor + PX_CUDA_CALLABLE PX_INLINE PxMat44T(PxZERO) : column0(PxZero), column1(PxZero), column2(PxZero), column3(PxZero) + { + } + + //! Construct from four 4-vectors + PX_CUDA_CALLABLE PxMat44T(const PxVec4T& col0, const PxVec4T& col1, const PxVec4T& col2, const PxVec4T& col3) : + column0(col0), + column1(col1), + column2(col2), + column3(col3) + { + } + + //! constructor that generates a multiple of the identity matrix + explicit PX_CUDA_CALLABLE PX_INLINE PxMat44T(Type r) : + column0(r, Type(0.0), Type(0.0), Type(0.0)), + column1(Type(0.0), r, Type(0.0), Type(0.0)), + column2(Type(0.0), Type(0.0), r, Type(0.0)), + column3(Type(0.0), Type(0.0), Type(0.0), r) + { + } + + //! Construct from three base vectors and a translation + PX_CUDA_CALLABLE PxMat44T(const PxVec3T& col0, const PxVec3T& col1, const PxVec3T& col2, const PxVec3T& col3) : + column0(col0, Type(0.0)), + column1(col1, Type(0.0)), + column2(col2, Type(0.0)), + column3(col3, Type(1.0)) + { + } + + //! Construct from Type[16] + explicit PX_CUDA_CALLABLE PX_INLINE PxMat44T(Type values[]) : + column0(values[0], values[1], values[2], values[3]), + column1(values[4], values[5], values[6], values[7]), + column2(values[8], values[9], values[10], values[11]), + column3(values[12], values[13], values[14], values[15]) + { + } + + //! Construct from a quaternion + explicit PX_CUDA_CALLABLE PX_INLINE PxMat44T(const PxQuatT& q) + { + // PT: TODO: PX-566 + const Type x = q.x; + const Type y = q.y; + const Type z = q.z; + const Type w = q.w; + + const Type x2 = x + x; + const Type y2 = y + y; + const Type z2 = z + z; + + const Type xx = x2 * x; + const Type yy = y2 * y; + const Type zz = z2 * z; + + const Type xy = x2 * y; + const Type xz = x2 * z; + const Type xw = x2 * w; + + const Type yz = y2 * z; + const Type yw = y2 * w; + const Type zw = z2 * w; + + column0 = PxVec4T(Type(1.0) - yy - zz, xy + zw, xz - yw, Type(0.0)); + column1 = PxVec4T(xy - zw, Type(1.0) - xx - zz, yz + xw, Type(0.0)); + column2 = PxVec4T(xz + yw, yz - xw, Type(1.0) - xx - yy, Type(0.0)); + column3 = PxVec4T(Type(0.0), Type(0.0), Type(0.0), Type(1.0)); + } + + //! Construct from a diagonal vector + explicit PX_CUDA_CALLABLE PX_INLINE PxMat44T(const PxVec4T& diagonal) : + column0(diagonal.x, Type(0.0), Type(0.0), Type(0.0)), + column1(Type(0.0), diagonal.y, Type(0.0), Type(0.0)), + column2(Type(0.0), Type(0.0), diagonal.z, Type(0.0)), + column3(Type(0.0), Type(0.0), Type(0.0), diagonal.w) + { + } + + //! Construct from Mat33 and a translation + PX_CUDA_CALLABLE PxMat44T(const PxMat33T& axes, const PxVec3T& position) : + column0(axes.column0, Type(0.0)), + column1(axes.column1, Type(0.0)), + column2(axes.column2, Type(0.0)), + column3(position, Type(1.0)) + { + } + + PX_CUDA_CALLABLE PxMat44T(const PxTransform& t) + { + *this = PxMat44T(PxMat33T(t.q), t.p); + } + + /** + \brief returns true if the two matrices are exactly equal + */ + PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxMat44T& m) const + { + return column0 == m.column0 && column1 == m.column1 && column2 == m.column2 && column3 == m.column3; + } + + //! Copy constructor + PX_CUDA_CALLABLE PX_INLINE PxMat44T(const PxMat44T& other) : + column0(other.column0), + column1(other.column1), + column2(other.column2), + column3(other.column3) + { + } + + //! Assignment operator + PX_CUDA_CALLABLE PX_INLINE PxMat44T& operator=(const PxMat44T& other) + { + column0 = other.column0; + column1 = other.column1; + column2 = other.column2; + column3 = other.column3; + return *this; + } + + //! Get transposed matrix + PX_CUDA_CALLABLE PX_INLINE const PxMat44T getTranspose() const + { + return PxMat44T( + PxVec4T(column0.x, column1.x, column2.x, column3.x), PxVec4T(column0.y, column1.y, column2.y, column3.y), + PxVec4T(column0.z, column1.z, column2.z, column3.z), PxVec4T(column0.w, column1.w, column2.w, column3.w)); + } + + //! Unary minus + PX_CUDA_CALLABLE PX_INLINE const PxMat44T operator-() const + { + return PxMat44T(-column0, -column1, -column2, -column3); + } + + //! Add + PX_CUDA_CALLABLE PX_INLINE const PxMat44T operator+(const PxMat44T& other) const + { + return PxMat44T(column0 + other.column0, column1 + other.column1, column2 + other.column2, column3 + other.column3); + } + + //! Subtract + PX_CUDA_CALLABLE PX_INLINE const PxMat44T operator-(const PxMat44T& other) const + { + return PxMat44T(column0 - other.column0, column1 - other.column1, column2 - other.column2, column3 - other.column3); + } + + //! Scalar multiplication + PX_CUDA_CALLABLE PX_INLINE const PxMat44T operator*(Type scalar) const + { + return PxMat44T(column0 * scalar, column1 * scalar, column2 * scalar, column3 * scalar); + } + + template + friend PxMat44T operator*(Type2, const PxMat44T&); + + //! Matrix multiplication + PX_CUDA_CALLABLE PX_INLINE const PxMat44T operator*(const PxMat44T& other) const + { + // Rows from this columns from other + // column0 = transform(other.column0) etc + return PxMat44T(transform(other.column0), transform(other.column1), transform(other.column2), transform(other.column3)); + } + + // a = b operators + + //! Equals-add + PX_CUDA_CALLABLE PX_INLINE PxMat44T& operator+=(const PxMat44T& other) + { + column0 += other.column0; + column1 += other.column1; + column2 += other.column2; + column3 += other.column3; + return *this; + } + + //! Equals-sub + PX_CUDA_CALLABLE PX_INLINE PxMat44T& operator-=(const PxMat44T& other) + { + column0 -= other.column0; + column1 -= other.column1; + column2 -= other.column2; + column3 -= other.column3; + return *this; + } + + //! Equals scalar multiplication + PX_CUDA_CALLABLE PX_INLINE PxMat44T& operator*=(Type scalar) + { + column0 *= scalar; + column1 *= scalar; + column2 *= scalar; + column3 *= scalar; + return *this; + } + + //! Equals matrix multiplication + PX_CUDA_CALLABLE PX_INLINE PxMat44T& operator*=(const PxMat44T& other) + { + *this = *this * other; + return *this; + } + + //! Element access, mathematical way! + PX_CUDA_CALLABLE PX_FORCE_INLINE Type operator()(PxU32 row, PxU32 col) const + { + return (*this)[col][row]; + } + + //! Element access, mathematical way! + PX_CUDA_CALLABLE PX_FORCE_INLINE Type& operator()(PxU32 row, PxU32 col) + { + return (*this)[col][row]; + } + + //! Transform vector by matrix, equal to v' = M*v + PX_CUDA_CALLABLE PX_INLINE const PxVec4T transform(const PxVec4T& other) const + { + return column0 * other.x + column1 * other.y + column2 * other.z + column3 * other.w; + } + + //! Transform vector by matrix, equal to v' = M*v + PX_CUDA_CALLABLE PX_INLINE const PxVec3T transform(const PxVec3T& other) const + { + return transform(PxVec4T(other, Type(1.0))).getXYZ(); + } + + //! Rotate vector by matrix, equal to v' = M*v + PX_CUDA_CALLABLE PX_INLINE const PxVec4T rotate(const PxVec4T& other) const + { + return column0 * other.x + column1 * other.y + column2 * other.z; // + column3*0; + } + + //! Rotate vector by matrix, equal to v' = M*v + PX_CUDA_CALLABLE PX_INLINE const PxVec3T rotate(const PxVec3T& other) const + { + return rotate(PxVec4T(other, Type(1.0))).getXYZ(); + } + + PX_CUDA_CALLABLE PX_INLINE const PxVec3T getBasis(PxU32 num) const + { + PX_ASSERT(num < 3); + return (&column0)[num].getXYZ(); + } + + PX_CUDA_CALLABLE PX_INLINE const PxVec3T getPosition() const + { + return column3.getXYZ(); + } + + PX_CUDA_CALLABLE PX_INLINE void setPosition(const PxVec3T& position) + { + column3.x = position.x; + column3.y = position.y; + column3.z = position.z; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE const Type* front() const + { + return &column0.x; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec4T& operator[](PxU32 num) + { + return (&column0)[num]; + } + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec4T& operator[](PxU32 num) const + { + return (&column0)[num]; + } + + PX_CUDA_CALLABLE PX_INLINE void scale(const PxVec4T& p) + { + column0 *= p.x; + column1 *= p.y; + column2 *= p.z; + column3 *= p.w; + } + + PX_CUDA_CALLABLE PX_INLINE const PxMat44T inverseRT() const + { + const PxVec3T r0(column0.x, column1.x, column2.x); + const PxVec3T r1(column0.y, column1.y, column2.y); + const PxVec3T r2(column0.z, column1.z, column2.z); + + return PxMat44T(r0, r1, r2, -(r0 * column3.x + r1 * column3.y + r2 * column3.z)); + } + + PX_CUDA_CALLABLE PX_INLINE bool isFinite() const + { + return column0.isFinite() && column1.isFinite() && column2.isFinite() && column3.isFinite(); + } + + // Data, see above for format! + + PxVec4T column0, column1, column2, column3; // the four base vectors +}; + +// implementation from PxTransform.h +template +PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransformT::PxTransformT(const PxMat44T& m) +{ + const PxVec3T column0(m.column0.x, m.column0.y, m.column0.z); + const PxVec3T column1(m.column1.x, m.column1.y, m.column1.z); + const PxVec3T column2(m.column2.x, m.column2.y, m.column2.z); + + q = PxQuatT(PxMat33T(column0, column1, column2)); + p = PxVec3T(m.column3.x, m.column3.y, m.column3.z); +} + +typedef PxMat44T PxMat44; +typedef PxMat44T PxMat44d; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxMath.h b/engine/third_party/physx/include/foundation/PxMath.h new file mode 100644 index 00000000..b2866f48 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxMath.h @@ -0,0 +1,380 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_MATH_H +#define PX_MATH_H + + +#include "foundation/PxPreprocessor.h" + + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4985) // 'symbol name': attributes not present on previous declaration +#endif +#include +#if PX_VC +#pragma warning(pop) +#endif + +#if (PX_LINUX_FAMILY && !PX_ARM_FAMILY) +// Force linking against nothing newer than glibc v2.17 to remain compatible with platforms with older glibc versions +__asm__(".symver expf,expf@GLIBC_2.2.5"); +__asm__(".symver powf,powf@GLIBC_2.2.5"); +#endif + +#include +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxAssert.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +// constants +static constexpr float PxPi = float(3.141592653589793); +static constexpr float PxHalfPi = float(1.57079632679489661923); +static constexpr float PxTwoPi = float(6.28318530717958647692); +static constexpr float PxInvPi = float(0.31830988618379067154); +static constexpr float PxInvTwoPi = float(0.15915494309189533577); +static constexpr float PxPiDivTwo = float(1.57079632679489661923); +static constexpr float PxPiDivFour = float(0.78539816339744830962); +static constexpr float PxSqrt2 = float(1.4142135623730951); +static constexpr float PxInvSqrt2 = float(0.7071067811865476); + +/** +\brief The return value is the greater of the two specified values. +*/ +template +PX_CUDA_CALLABLE PX_FORCE_INLINE T PxMax(T a, T b) +{ + return a < b ? b : a; +} + +//! overload for float to use fsel on xbox +template <> +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxMax(float a, float b) +{ + return intrinsics::selectMax(a, b); +} + +/** +\brief The return value is the lesser of the two specified values. +*/ +template +PX_CUDA_CALLABLE PX_FORCE_INLINE T PxMin(T a, T b) +{ + return a < b ? a : b; +} + +template <> +//! overload for float to use fsel on xbox +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxMin(float a, float b) +{ + return intrinsics::selectMin(a, b); +} + +/* +Many of these are just implemented as PX_CUDA_CALLABLE PX_FORCE_INLINE calls to the C lib right now, +but later we could replace some of them with some approximations or more +clever stuff. +*/ + +/** +\brief abs returns the absolute value of its argument. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAbs(float a) +{ + return intrinsics::abs(a); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxEquals(float a, float b, float eps) +{ + return (PxAbs(a - b) < eps); +} + +/** +\brief abs returns the absolute value of its argument. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxAbs(double a) +{ + return ::fabs(a); +} + +/** +\brief abs returns the absolute value of its argument. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE int32_t PxAbs(int32_t a) +{ + return ::abs(a); +} + +/** +\brief Clamps v to the range [hi,lo] +*/ +template +PX_CUDA_CALLABLE PX_FORCE_INLINE T PxClamp(T v, T lo, T hi) +{ + PX_ASSERT(lo <= hi); + return PxMin(hi, PxMax(lo, v)); +} + +//! \brief Square root. +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxSqrt(float a) +{ + return intrinsics::sqrt(a); +} + +//! \brief Square root. +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxSqrt(double a) +{ + return ::sqrt(a); +} + +//! \brief reciprocal square root. +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxRecipSqrt(float a) +{ + return intrinsics::recipSqrt(a); +} + +//! \brief reciprocal square root. +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxRecipSqrt(double a) +{ + return 1 / ::sqrt(a); +} + +//! \brief square of the argument +PX_CUDA_CALLABLE PX_FORCE_INLINE PxF32 PxSqr(const PxF32 a) +{ + return a * a; +} + +//! trigonometry -- all angles are in radians. + +//! \brief Sine of an angle ( Unit: Radians ) +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxSin(float a) +{ + return intrinsics::sin(a); +} + +//! \brief Sine of an angle ( Unit: Radians ) +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxSin(double a) +{ + return ::sin(a); +} + +//! \brief Cosine of an angle (Unit: Radians) +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxCos(float a) +{ + return intrinsics::cos(a); +} + +//! \brief Cosine of an angle (Unit: Radians) +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxCos(double a) +{ + return ::cos(a); +} + +//! \brief compute sine and cosine at the same time +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxSinCos(const PxF32 a, PxF32& sin, PxF32& cos) +{ +#if PX_CUDA_COMPILER && __CUDA_ARCH__ >= 350 + __sincosf(a, &sin, &cos); +#else + sin = PxSin(a); + cos = PxCos(a); +#endif +} + +//! \brief compute sine and cosine at the same time +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxSinCos(const double a, double& sin, double& cos) +{ + sin = PxSin(a); + cos = PxCos(a); +} + +/** +\brief Tangent of an angle. +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxTan(float a) +{ + return ::tanf(a); +} + +/** +\brief Tangent of an angle. +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxTan(double a) +{ + return ::tan(a); +} + +/** +\brief Arcsine. +Returns angle between -PI/2 and PI/2 in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAsin(float f) +{ + return ::asinf(PxClamp(f, -1.0f, 1.0f)); +} + +/** +\brief Arcsine. +Returns angle between -PI/2 and PI/2 in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxAsin(double f) +{ + return ::asin(PxClamp(f, -1.0, 1.0)); +} + +/** +\brief Arccosine. +Returns angle between 0 and PI in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAcos(float f) +{ + return ::acosf(PxClamp(f, -1.0f, 1.0f)); +} + +/** +\brief Arccosine. +Returns angle between 0 and PI in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxAcos(double f) +{ + return ::acos(PxClamp(f, -1.0, 1.0)); +} + +/** +\brief ArcTangent. +Returns angle between -PI/2 and PI/2 in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAtan(float a) +{ + return ::atanf(a); +} + +/** +\brief ArcTangent. +Returns angle between -PI/2 and PI/2 in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxAtan(double a) +{ + return ::atan(a); +} + +/** +\brief Arctangent of (x/y) with correct sign. +Returns angle between -PI and PI in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAtan2(float x, float y) +{ + return ::atan2f(x, y); +} + +/** +\brief Arctangent of (x/y) with correct sign. +Returns angle between -PI and PI in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxAtan2(double x, double y) +{ + return ::atan2(x, y); +} + +/** +\brief Converts degrees to radians. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE PxF32 PxDegToRad(const PxF32 a) +{ + return 0.01745329251994329547f * a; +} + +//! \brief returns true if the passed number is a finite floating point number as opposed to INF, NAN, etc. +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxIsFinite(float f) +{ + return intrinsics::isFinite(f); +} + +//! \brief returns true if the passed number is a finite floating point number as opposed to INF, NAN, etc. +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxIsFinite(double f) +{ + return intrinsics::isFinite(f); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxFloor(float a) +{ + return ::floorf(a); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxExp(float a) +{ + return ::expf(a); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxCeil(float a) +{ + return ::ceilf(a); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxSign(float a) +{ + return physx::intrinsics::sign(a); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxSign2(float a, float eps = FLT_EPSILON) +{ + return (a < -eps) ? -1.0f : (a > eps) ? 1.0f : 0.0f; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxPow(float x, float y) +{ + return ::powf(x, y); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxLog(float x) +{ + return ::logf(x); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxMathIntrinsics.h b/engine/third_party/physx/include/foundation/PxMathIntrinsics.h new file mode 100644 index 00000000..b17555a1 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxMathIntrinsics.h @@ -0,0 +1,54 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_MATH_INTRINSICS_H +#define PX_MATH_INTRINSICS_H + +#include +#include "foundation/PxPreprocessor.h" +#include "foundation/PxSimpleTypes.h" + +#if PX_WINDOWS_FAMILY +#include "foundation/windows/PxWindowsMathIntrinsics.h" +#elif(PX_LINUX || PX_APPLE_FAMILY) +#include "foundation/unix/PxUnixMathIntrinsics.h" +#elif PX_SWITCH +#include "foundation/switch/PxSwitchMathIntrinsics.h" +#else +#error "Platform not supported!" +#endif + +/** +Platform specific defines +*/ +#if PX_WINDOWS_FAMILY +#pragma intrinsic(abs) +#pragma intrinsic(labs) +#endif + +#endif diff --git a/engine/third_party/physx/include/foundation/PxMathUtils.h b/engine/third_party/physx/include/foundation/PxMathUtils.h new file mode 100644 index 00000000..3871d756 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxMathUtils.h @@ -0,0 +1,785 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_MATH_UTILS_H +#define PX_MATH_UTILS_H + + +#include "foundation/PxFoundationConfig.h" +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec4.h" +#include "foundation/PxAssert.h" +#include "foundation/PxPlane.h" +#include "foundation/PxMat33.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief finds the shortest rotation between two vectors. + +\param[in] from the vector to start from +\param[in] target the vector to rotate to +\return a rotation about an axis normal to the two vectors which takes one to the other via the shortest path +*/ +PX_FOUNDATION_API PxQuat PxShortestRotation(const PxVec3& from, const PxVec3& target); + +/* \brief diagonalizes a 3x3 symmetric matrix y + +The returned matrix satisfies M = R * D * R', where R is the rotation matrix for the output quaternion, R' its +transpose, and D the diagonal matrix + +If the matrix is not symmetric, the result is undefined. + +\param[in] m the matrix to diagonalize +\param[out] axes a quaternion rotation which diagonalizes the matrix +\return the vector diagonal of the diagonalized matrix. +*/ +PX_FOUNDATION_API PxVec3 PxDiagonalize(const PxMat33& m, PxQuat& axes); + +/** \brief creates a transform from the endpoints of a segment, suitable for an actor transform for a PxCapsuleGeometry + +\param[in] p0 one end of major axis of the capsule +\param[in] p1 the other end of the axis of the capsule +\param[out] halfHeight the halfHeight of the capsule. This parameter is optional. +\return A PxTransform which will transform the vector (1,0,0) to the capsule axis shrunk by the halfHeight +*/ +PX_FOUNDATION_API PxTransform PxTransformFromSegment(const PxVec3& p0, const PxVec3& p1, PxReal* halfHeight = NULL); + +/** \brief creates a transform from a plane equation, suitable for an actor transform for a PxPlaneGeometry + +\param[in] plane the desired plane equation +\return a PxTransform which will transform the plane PxPlane(1,0,0,0) to the specified plane +*/ +PX_FOUNDATION_API PxTransform PxTransformFromPlaneEquation(const PxPlane& plane); + +/** \brief creates a plane equation from a transform, such as the actor transform for a PxPlaneGeometry + +\param[in] pose the transform +\return the plane +*/ +PX_INLINE PxPlane PxPlaneEquationFromTransform(const PxTransform& pose) +{ + return PxPlane(1.0f, 0.0f, 0.0f, 0.0f).transform(pose); +} + +/** +\brief Spherical linear interpolation of two quaternions. +\param[in] t is the interpolation parameter in range (0, 1) +\param[in] left is the start of the interpolation +\param[in] right is the end of the interpolation +\return Returns left when t=0, right when t=1 and a linear interpolation of left and right when 0 < t < 1. +Returns angle between -PI and PI in radians +*/ +PX_CUDA_CALLABLE PX_INLINE PxQuat PxSlerp(const PxReal t, const PxQuat& left, const PxQuat& right) +{ + const PxReal quatEpsilon = (PxReal(1.0e-8f)); + + PxReal cosine = left.dot(right); + PxReal sign = PxReal(1); + if (cosine < 0) + { + cosine = -cosine; + sign = PxReal(-1); + } + + PxReal sine = PxReal(1) - cosine * cosine; + + if (sine >= quatEpsilon * quatEpsilon) + { + sine = PxSqrt(sine); + const PxReal angle = PxAtan2(sine, cosine); + const PxReal i_sin_angle = PxReal(1) / sine; + + const PxReal leftw = PxSin(angle * (PxReal(1) - t)) * i_sin_angle; + const PxReal rightw = PxSin(angle * t) * i_sin_angle * sign; + + return left * leftw + right * rightw; + } + + return left; +} + +/** +\brief integrate transform. +\param[in] curTrans The current transform +\param[in] linvel Linear velocity +\param[in] angvel Angular velocity +\param[in] timeStep The time-step for integration +\param[out] result The integrated transform +*/ +PX_FOUNDATION_API void PxIntegrateTransform(const PxTransform& curTrans, const PxVec3& linvel, const PxVec3& angvel, + PxReal timeStep, PxTransform& result); + +//! \brief Compute the exponent of a PxVec3 +PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat PxExp(const PxVec3& v) +{ + const PxReal m = v.magnitudeSquared(); + return m < 1e-24f ? PxQuat(PxIdentity) : PxQuat(PxSqrt(m), v * PxRecipSqrt(m)); +} + +/** +\brief computes a oriented bounding box around the scaled basis. +\param basis Input = skewed basis, Output = (normalized) orthogonal basis. +\return Bounding box extent. +*/ +PX_FOUNDATION_API PxVec3 PxOptimizeBoundingBox(PxMat33& basis); + +/** +\brief return Returns the log of a PxQuat +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxLog(const PxQuat& q) +{ + const PxReal s = q.getImaginaryPart().magnitude(); + if (s < 1e-12f) + return PxVec3(0.0f); + // force the half-angle to have magnitude <= pi/2 + PxReal halfAngle = q.w < 0 ? PxAtan2(-s, -q.w) : PxAtan2(s, q.w); + PX_ASSERT(halfAngle >= -PxPi / 2 && halfAngle <= PxPi / 2); + + return q.getImaginaryPart().getNormalized() * 2.f * halfAngle; +} + +/** +\brief return Returns 0 if v.x is largest element of v, 1 if v.y is largest element, 2 if v.z is largest element. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 PxLargestAxis(const PxVec3& v) +{ + PxU32 m = PxU32(v.y > v.x ? 1 : 0); + return v.z > v[m] ? 2 : m; +} + +/** +\brief Compute tan(theta/2) given sin(theta) and cos(theta) as inputs. +\param[in] sin has value sin(theta) +\param[in] cos has value cos(theta) +\return Returns tan(theta/2) +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal PxTanHalf(PxReal sin, PxReal cos) +{ + // PT: avoids divide by zero for singularity. We return sqrt(FLT_MAX) instead of FLT_MAX + // to make sure the calling code doesn't generate INF values when manipulating the returned value + // (some joints multiply it by 4, etc). + if (cos == -1.0f) + return sin < 0.0f ? -sqrtf(FLT_MAX) : sqrtf(FLT_MAX); + + // PT: half-angle formula: tan(a/2) = sin(a)/(1+cos(a)) + return sin / (1.0f + cos); +} + +/** +\brief Compute the closest point on an 2d ellipse to a given 2d point. +\param[in] point is a 2d point in the y-z plane represented by (point.y, point.z) +\param[in] radii are the radii of the ellipse (radii.y and radii.z) in the y-z plane. +\return Returns the 2d position on the surface of the ellipse that is closest to point. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxEllipseClamp(const PxVec3& point, const PxVec3& radii) +{ + // lagrange multiplier method with Newton/Halley hybrid root-finder. + // see http://www.geometrictools.com/Documentation/DistancePointToEllipse2.pdf + // for proof of Newton step robustness and initial estimate. + // Halley converges much faster but sometimes overshoots - when that happens we take + // a newton step instead + + // converges in 1-2 iterations where D&C works well, and it's good with 4 iterations + // with any ellipse that isn't completely crazy + + const PxU32 MAX_ITERATIONS = 20; + const PxReal convergenceThreshold = 1e-4f; + + // iteration requires first quadrant but we recover generality later + + PxVec3 q(0, PxAbs(point.y), PxAbs(point.z)); + const PxReal tinyEps = 1e-6f; // very close to minor axis is numerically problematic but trivial + if (radii.y >= radii.z) + { + if (q.z < tinyEps) + return PxVec3(0, point.y > 0 ? radii.y : -radii.y, 0); + } + else + { + if (q.y < tinyEps) + return PxVec3(0, 0, point.z > 0 ? radii.z : -radii.z); + } + + PxVec3 denom, e2 = radii.multiply(radii), eq = radii.multiply(q); + + // we can use any initial guess which is > maximum(-e.y^2,-e.z^2) and for which f(t) is > 0. + // this guess works well near the axes, but is weak along the diagonals. + + PxReal t = PxMax(eq.y - e2.y, eq.z - e2.z); + + for (PxU32 i = 0; i < MAX_ITERATIONS; i++) + { + denom = PxVec3(0, 1 / (t + e2.y), 1 / (t + e2.z)); + PxVec3 denom2 = eq.multiply(denom); + + PxVec3 fv = denom2.multiply(denom2); + PxReal f = fv.y + fv.z - 1; + + // although in exact arithmetic we are guaranteed f>0, we can get here + // on the first iteration via catastrophic cancellation if the point is + // very close to the origin. In that case we just behave as if f=0 + + if (f < convergenceThreshold) + return e2.multiply(point).multiply(denom); + + PxReal df = fv.dot(denom) * -2.0f; + t = t - f / df; + } + + // we didn't converge, so clamp what we have + PxVec3 r = e2.multiply(point).multiply(denom); + return r * PxRecipSqrt(PxSqr(r.y / radii.y) + PxSqr(r.z / radii.z)); +} + +/** +\brief Compute from an input quaternion q a pair of quaternions (swing, twist) such that +q = swing * twist +with the caveats that swing.x = twist.y = twist.z = 0. +\param[in] q is the quaternion to be decomposed into swing and twist quaternions. +\param[out] swing is the swing component of the quaternion decomposition. +\param[out] twist is the twist component of the quaternion decomposition. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxSeparateSwingTwist(const PxQuat& q, PxQuat& swing, PxQuat& twist) +{ + twist = q.x != 0.0f ? PxQuat(q.x, 0, 0, q.w).getNormalized() : PxQuat(PxIdentity); + swing = q * twist.getConjugate(); +} + +/** +\brief Compute the angle between two non-unit vectors +\param[in] v0 is one of the non-unit vectors +\param[in] v1 is the other of the two non-unit vectors +\return Returns the angle (in radians) between the two vector v0 and v1. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE PxF32 PxComputeAngle(const PxVec3& v0, const PxVec3& v1) +{ + const PxF32 cos = v0.dot(v1); // |v0|*|v1|*Cos(Angle) + const PxF32 sin = (v0.cross(v1)).magnitude(); // |v0|*|v1|*Sin(Angle) + return PxAtan2(sin, cos); +} + +/** +\brief Compute two normalized vectors (right and up) that are perpendicular to an input normalized vector (dir). +\param[in] dir is a normalized vector that is used to compute the perpendicular vectors. +\param[out] right is the first of the two vectors perpendicular to dir +\param[out] up is the second of the two vectors perpendicular to dir +*/ +PX_CUDA_CALLABLE PX_INLINE void PxComputeBasisVectors(const PxVec3& dir, PxVec3& right, PxVec3& up) +{ + // Derive two remaining vectors + if (PxAbs(dir.y) <= 0.9999f) + { + right = PxVec3(dir.z, 0.0f, -dir.x); + right.normalize(); + + // PT: normalize not needed for 'up' because dir & right are unit vectors, + // and by construction the angle between them is 90 degrees (i.e. sin(angle)=1) + up = PxVec3(dir.y * right.z, dir.z * right.x - dir.x * right.z, -dir.y * right.x); + } + else + { + right = PxVec3(1.0f, 0.0f, 0.0f); + + up = PxVec3(0.0f, dir.z, -dir.y); + up.normalize(); + } +} + +/** +\brief Compute three normalized vectors (dir, right and up) that are parallel to (dir) and perpendicular to (right, up) the +normalized direction vector (p1 - p0)/||p1 - p0||. +\param[in] p0 is used to compute the normalized vector dir = (p1 - p0)/||p1 - p0||. +\param[in] p1 is used to compute the normalized vector dir = (p1 - p0)/||p1 - p0||. +\param[out] dir is the normalized vector (p1 - p0)/||p1 - p0||. +\param[out] right is the first of the two normalized vectors perpendicular to dir +\param[out] up is the second of the two normalized vectors perpendicular to dir +*/ +PX_INLINE void PxComputeBasisVectors(const PxVec3& p0, const PxVec3& p1, PxVec3& dir, PxVec3& right, PxVec3& up) +{ + // Compute the new direction vector + dir = p1 - p0; + dir.normalize(); + + // Derive two remaining vectors + PxComputeBasisVectors(dir, right, up); +} + + +/** +\brief Compute (i+1)%3 +*/ +PX_INLINE PxU32 PxGetNextIndex3(PxU32 i) +{ + return (i + 1 + (i >> 1)) & 3; +} + +/** +\brief Computes the barycentric coordinates for a point inside a tetrahedron. + +This function calculates the barycentric coordinates of a point p with respect to a tetrahedron defined by vertices a, b, c, and d. + +\param[in] a Vertex A of the tetrahedron +\param[in] b Vertex B of the tetrahedron +\param[in] c Vertex C of the tetrahedron +\param[in] d Vertex D of the tetrahedron +\param[in] p The point for which to compute the barycentric coordinates +\param[out] bary The resulting barycentric coordinates as a PxVec4 +*/ +PX_INLINE PX_CUDA_CALLABLE void PxComputeBarycentric(const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& d, const PxVec3& p, PxVec4& bary) +{ + const PxVec3 ba = b - a; + const PxVec3 ca = c - a; + const PxVec3 da = d - a; + const PxVec3 pa = p - a; + + const PxReal detBcd = ba.dot(ca.cross(da)); + const PxReal detPcd = pa.dot(ca.cross(da)); + + bary.y = detPcd / detBcd; + + const PxReal detBpd = ba.dot(pa.cross(da)); + bary.z = detBpd / detBcd; + + const PxReal detBcp = ba.dot(ca.cross(pa)); + + bary.w = detBcp / detBcd; + bary.x = 1 - bary.y - bary.z - bary.w; +} + +/** +\brief Computes the barycentric coordinates for a point inside a triangle. + +This function calculates the barycentric coordinates of a point p with respect to a triangle defined by vertices a, b, and c. + +\param[in] a Vertex A of the triangle +\param[in] b Vertex B of the triangle +\param[in] c Vertex C of the triangle +\param[in] p The point for which to compute the barycentric coordinates +\param[out] bary The resulting barycentric coordinates as a PxVec4 +*/ +PX_INLINE PX_CUDA_CALLABLE void PxComputeBarycentric(const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& p, PxVec4& bary) +{ + const PxVec3 v0 = b - a; + const PxVec3 v1 = c - a; + const PxVec3 v2 = p - a; + + const float d00 = v0.dot(v0); + const float d01 = v0.dot(v1); + const float d11 = v1.dot(v1); + const float d20 = v2.dot(v0); + const float d21 = v2.dot(v1); + + const float denom = d00 * d11 - d01 * d01; + const float v = (d11 * d20 - d01 * d21) / denom; + const float w = (d00 * d21 - d01 * d20) / denom; + const float u = 1.f - v - w; + + bary.x = u; bary.y = v; bary.z = w; + bary.w = 0.f; +} + +/** +\brief Computes the barycentric coordinates for a point inside a triangle (deprecated). + +This function is deprecated. Use PxComputeBarycentric instead. + +\param[in] a Vertex A of the triangle +\param[in] b Vertex B of the triangle +\param[in] c Vertex C of the triangle +\param[in] p The point for which to compute the barycentric coordinates +\param[out] bary The resulting barycentric coordinates as a PxVec4 + +\see PxComputeBarycentric +*/ +PX_INLINE PX_CUDA_CALLABLE PX_DEPRECATED void computeBarycentric(const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& p, PxVec4& bary) +{ + PxComputeBarycentric(a, b, c, p, bary); +} + +/** +\brief Computes the barycentric coordinates for a point inside a tetrahedron (deprecated). + +This function is deprecated. Use PxComputeBarycentric instead. + +\param[in] a Vertex A of the tetrahedron +\param[in] b Vertex B of the tetrahedron +\param[in] c Vertex C of the tetrahedron +\param[in] d Vertex D of the tetrahedron +\param[in] p The point for which to compute the barycentric coordinates +\param[out] bary The resulting barycentric coordinates as a PxVec4 + +\see PxComputeBarycentric +*/ +PX_INLINE PX_CUDA_CALLABLE PX_DEPRECATED void computeBarycentric(const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& d, const PxVec3& p, PxVec4& bary) +{ + PxComputeBarycentric(a, b, c, d, p, bary); +} + + +/** +\brief Performs linear interpolation between two values. + +\param[in] a The start value +\param[in] b The end value +\param[in] t The interpolation parameter in the range [0, 1] +\return The interpolated value +*/ +PX_INLINE PX_CUDA_CALLABLE static float PxLerp(float a, float b, float t) +{ + return a + t * (b - a); +} + +/** +\brief Performs bilinear interpolation. + +\param[in] f00 The value at (0, 0) +\param[in] f10 The value at (1, 0) +\param[in] f01 The value at (0, 1) +\param[in] f11 The value at (1, 1) +\param[in] tx The interpolation parameter along the x-axis +\param[in] ty The interpolation parameter along the y-axis +\return The interpolated value + +\see PxLerp +*/ +PX_INLINE PX_CUDA_CALLABLE static PxReal PxBiLerp( + const PxReal f00, + const PxReal f10, + const PxReal f01, + const PxReal f11, + const PxReal tx, const PxReal ty) +{ + return PxLerp( + PxLerp(f00, f10, tx), + PxLerp(f01, f11, tx), + ty); +} + +/** +\brief Performs trilinear interpolation. + +\param[in] f000 The value at (0, 0, 0) +\param[in] f100 The value at (1, 0, 0) +\param[in] f010 The value at (0, 1, 0) +\param[in] f110 The value at (1, 1, 0) +\param[in] f001 The value at (0, 0, 1) +\param[in] f101 The value at (1, 0, 1) +\param[in] f011 The value at (0, 1, 1) +\param[in] f111 The value at (1, 1, 1) +\param[in] tx The interpolation parameter along the x-axis +\param[in] ty The interpolation parameter along the y-axis +\param[in] tz The interpolation parameter along the z-axis +\return The interpolated value + +\see PxLerp PxBiLerp +*/ +PX_INLINE PX_CUDA_CALLABLE static PxReal PxTriLerp( + const PxReal f000, + const PxReal f100, + const PxReal f010, + const PxReal f110, + const PxReal f001, + const PxReal f101, + const PxReal f011, + const PxReal f111, + const PxReal tx, + const PxReal ty, + const PxReal tz) +{ + return PxLerp( + PxBiLerp(f000, f100, f010, f110, tx, ty), + PxBiLerp(f001, f101, f011, f111, tx, ty), + tz); +} + +/** +\brief Computes the 1D index for a 3D grid point. + +\param[in] i The x-coordinate index +\param[in] j The y-coordinate index +\param[in] k The z-coordinate index +\param[in] nbX The number of grid points along the x-axis +\param[in] nbY The number of grid points along the y-axis +\return The 1D index corresponding to the 3D grid point +*/ +PX_INLINE PX_CUDA_CALLABLE static PxU32 PxSDFIdx(PxU32 i, PxU32 j, PxU32 k, PxU32 nbX, PxU32 nbY) +{ + return i + j * nbX + k * nbX*nbY; +} + +/** +\brief Samples the signed distance field (SDF) at a given local position. + +This function samples the SDF at a given local position within the defined box bounds and calculates the interpolated distance value. It handles grid clamping and ensures that the sampled value is within the tolerance limit. + +\param[in] sdf A pointer to the SDF data +\param[in] localPos The local position to sample the SDF +\param[in] sdfBoxLower The lower bound of the SDF box +\param[in] sdfBoxHigher The upper bound of the SDF box +\param[in] sdfDx The spacing between grid points in the SDF +\param[in] invSdfDx The inverse of the grid spacing +\param[in] dimX The number of grid points along the x-axis +\param[in] dimY The number of grid points along the y-axis +\param[in] dimZ The number of grid points along the z-axis +\param[in] tolerance The tolerance for clamping the grid points +\return The sampled SDF value + +\see PxTriLerp PxSDFIdx +*/ +PX_INLINE PX_CUDA_CALLABLE static PxReal PxSDFSample(const PxReal* PX_RESTRICT sdf, const PxVec3& localPos, const PxVec3& sdfBoxLower, + const PxVec3& sdfBoxHigher, const PxReal sdfDx, const PxReal invSdfDx, const PxU32 dimX, const PxU32 dimY, const PxU32 dimZ, PxReal tolerance) +{ + PxVec3 clampedGridPt = localPos.maximum(sdfBoxLower).minimum(sdfBoxHigher); + + const PxVec3 diff = (localPos - clampedGridPt); + + if (diff.magnitudeSquared() > tolerance*tolerance) + return PX_MAX_F32; + + PxVec3 f = (clampedGridPt - sdfBoxLower) * invSdfDx; + + PxU32 i = PxU32(f.x); + PxU32 j = PxU32(f.y); + PxU32 k = PxU32(f.z); + + f -= PxVec3(PxReal(i), PxReal(j), PxReal(k)); + + if (i >= (dimX - 1)) + { + i = dimX - 2; + clampedGridPt.x -= f.x * sdfDx; + f.x = 1.f; + } + if (j >= (dimY - 1)) + { + j = dimY - 2; + clampedGridPt.y -= f.y * sdfDx; + f.y = 1.f; + } + if (k >= (dimZ - 1)) + { + k = dimZ - 2; + clampedGridPt.z -= f.z * sdfDx; + f.z = 1.f; + } + + const PxReal s000 = sdf[PxSDFIdx(i, j, k, dimX, dimY)]; + const PxReal s100 = sdf[PxSDFIdx(i + 1, j, k, dimX, dimY)]; + const PxReal s010 = sdf[PxSDFIdx(i, j + 1, k, dimX, dimY)]; + const PxReal s110 = sdf[PxSDFIdx(i + 1, j + 1, k, dimX, dimY)]; + const PxReal s001 = sdf[PxSDFIdx(i, j, k + 1, dimX, dimY)]; + const PxReal s101 = sdf[PxSDFIdx(i + 1, j, k + 1, dimX, dimY)]; + const PxReal s011 = sdf[PxSDFIdx(i, j + 1, k + 1, dimX, dimY)]; + const PxReal s111 = sdf[PxSDFIdx(i + 1, j + 1, k + 1, dimX, dimY)]; + + PxReal dist = PxTriLerp( + s000, + s100, + s010, + s110, + s001, + s101, + s011, + s111, + f.x, f.y, f.z); + + dist += diff.magnitude(); + + return dist; +} + +#if !PX_DOXYGEN // remove due to failing references + +PX_DEPRECATED struct Interpolation +{ + /** + \brief Performs linear interpolation between two values. + + \param[in] a The start value + \param[in] b The end value + \param[in] t The interpolation parameter in the range [0, 1] + \return The interpolated value + + \deprecated Please use corresponding freestanding function outside of Interpolation scope. + */ + PX_DEPRECATED PX_INLINE PX_CUDA_CALLABLE static float PxLerp(float a, float b, float t) + { + return ::physx::PxLerp(a, b, t); + } + + /** + \brief Performs bilinear interpolation. + + \param[in] f00 The value at (0, 0) + \param[in] f10 The value at (1, 0) + \param[in] f01 The value at (0, 1) + \param[in] f11 The value at (1, 1) + \param[in] tx The interpolation parameter along the x-axis + \param[in] ty The interpolation parameter along the y-axis + \return The interpolated value + + \deprecated Please use corresponding freestanding function outside of Interpolation scope. + */ + PX_DEPRECATED PX_INLINE PX_CUDA_CALLABLE static PxReal PxBiLerp( + const PxReal f00, + const PxReal f10, + const PxReal f01, + const PxReal f11, + const PxReal tx, const PxReal ty) + { + return ::physx::PxBiLerp(f00, f10, f01, f11, tx, ty); + } + + /** + \brief Performs trilinear interpolation. + + \param[in] f000 The value at (0, 0, 0) + \param[in] f100 The value at (1, 0, 0) + \param[in] f010 The value at (0, 1, 0) + \param[in] f110 The value at (1, 1, 0) + \param[in] f001 The value at (0, 0, 1) + \param[in] f101 The value at (1, 0, 1) + \param[in] f011 The value at (0, 1, 1) + \param[in] f111 The value at (1, 1, 1) + \param[in] tx The interpolation parameter along the x-axis + \param[in] ty The interpolation parameter along the y-axis + \param[in] tz The interpolation parameter along the z-axis + \return The interpolated value + + \deprecated Please use corresponding freestanding function outside of Interpolation scope. + */ + PX_DEPRECATED PX_INLINE PX_CUDA_CALLABLE static PxReal PxTriLerp( + const PxReal f000, + const PxReal f100, + const PxReal f010, + const PxReal f110, + const PxReal f001, + const PxReal f101, + const PxReal f011, + const PxReal f111, + const PxReal tx, + const PxReal ty, + const PxReal tz) + { + return ::physx::PxTriLerp(f000, f100, f010, f110, f001, f101, f011, f111, tx, ty, tz); + } + + /** + \brief Computes the 1D index for a 3D grid point. + + \param[in] i The x-coordinate index + \param[in] j The y-coordinate index + \param[in] k The z-coordinate index + \param[in] nbX The number of grid points along the x-axis + \param[in] nbY The number of grid points along the y-axis + \return The 1D index corresponding to the 3D grid point + + \deprecated Please use corresponding freestanding function outside of Interpolation scope. + */ + PX_DEPRECATED PX_INLINE PX_CUDA_CALLABLE static PxU32 PxSDFIdx(PxU32 i, PxU32 j, PxU32 k, PxU32 nbX, PxU32 nbY) + { + return ::physx::PxSDFIdx(i, j, k, nbX, nbY); + } + + /** + \brief Samples the signed distance field (SDF) at a given local position. + + This function samples the SDF at a given local position within the defined box bounds and calculates the interpolated distance value. It handles grid clamping and ensures that the sampled value is within the tolerance limit. + + \param[in] sdf A pointer to the SDF data + \param[in] localPos The local position to sample the SDF + \param[in] sdfBoxLower The lower bound of the SDF box + \param[in] sdfBoxHigher The upper bound of the SDF box + \param[in] sdfDx The spacing between grid points in the SDF + \param[in] invSdfDx The inverse of the grid spacing + \param[in] dimX The number of grid points along the x-axis + \param[in] dimY The number of grid points along the y-axis + \param[in] dimZ The number of grid points along the z-axis + \param[in] tolerance The tolerance for clamping the grid points + \return The sampled SDF value + + \deprecated Please use corresponding freestanding function outside of Interpolation scope. + */ + PX_DEPRECATED PX_INLINE PX_CUDA_CALLABLE static PxReal PxSDFSampleImpl(const PxReal* PX_RESTRICT sdf, const PxVec3& localPos, const PxVec3& sdfBoxLower, + const PxVec3& sdfBoxHigher, const PxReal sdfDx, const PxReal invSdfDx, const PxU32 dimX, const PxU32 dimY, const PxU32 dimZ, PxReal tolerance) + { + return ::physx::PxSDFSample(sdf, localPos, sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance); + } +}; +#endif // !PX_DOXYGEN // remove due to failing references + +/** +\brief Samples the signed distance field (SDF) at a given local position with gradient computation (deprecated). + +\param[in] sdf A pointer to the SDF data +\param[in] localPos The local position to sample the SDF +\param[in] sdfBoxLower The lower bound of the SDF box +\param[in] sdfBoxHigher The upper bound of the SDF box +\param[in] sdfDx The spacing between grid points in the SDF +\param[in] invSdfDx The inverse of the grid spacing +\param[in] dimX The number of grid points along the x-axis +\param[in] dimY The number of grid points along the y-axis +\param[in] dimZ The number of grid points along the z-axis +\param[out] gradient The resulting gradient vector +\param[in] tolerance The tolerance for clamping the grid points (default is PX_MAX_F32) +\return The sampled SDF value +\deprecated Please use PxSDFSample. +*/ +PX_DEPRECATED PX_INLINE PX_CUDA_CALLABLE PxReal PxSdfSample(const PxReal* PX_RESTRICT sdf, const PxVec3& localPos, const PxVec3& sdfBoxLower, + const PxVec3& sdfBoxHigher, const PxReal sdfDx, const PxReal invSdfDx, const PxU32 dimX, const PxU32 dimY, const PxU32 dimZ, PxVec3& gradient, PxReal tolerance = PX_MAX_F32) +{ + PxReal dist = PxSDFSample(sdf, localPos, sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance); + + if (dist < tolerance) + { + + PxVec3 grad; + grad.x = PxSDFSample(sdf, localPos + PxVec3(sdfDx, 0.f, 0.f), sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance) - + PxSDFSample(sdf, localPos - PxVec3(sdfDx, 0.f, 0.f), sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance); + grad.y = PxSDFSample(sdf, localPos + PxVec3(0.f, sdfDx, 0.f), sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance) - + PxSDFSample(sdf, localPos - PxVec3(0.f, sdfDx, 0.f), sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance); + grad.z = PxSDFSample(sdf, localPos + PxVec3(0.f, 0.f, sdfDx), sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance) - + PxSDFSample(sdf, localPos - PxVec3(0.f, 0.f, sdfDx), sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance); + + gradient = grad; + + } + + return dist; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/foundation/PxMemory.h b/engine/third_party/physx/include/foundation/PxMemory.h new file mode 100644 index 00000000..9f4f9b6a --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxMemory.h @@ -0,0 +1,126 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_MEMORY_H +#define PX_MEMORY_H + + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Sets the bytes of the provided buffer to zero. + + \param dest [out] Pointer to block of memory to set zero. + \param count [in] Number of bytes to set to zero. + + \return Pointer to memory block (same as input) + */ + PX_FORCE_INLINE void* PxMemZero(void* dest, PxU32 count) + { + // This is to avoid undefined behavior + return (count != 0) ? physx::intrinsics::memZero(dest, count) : NULL; + } + + /** + \brief Sets the bytes of the provided buffer to the specified value. + + \param dest [out] Pointer to block of memory to set to the specified value. + \param c [in] Value to set the bytes of the block of memory to. + \param count [in] Number of bytes to set to the specified value. + + \return Pointer to memory block (same as input) + */ + PX_FORCE_INLINE void* PxMemSet(void* dest, PxI32 c, PxU32 count) + { + // This is to avoid undefined behavior + return (count != 0) ? physx::intrinsics::memSet(dest, c, count) : NULL; + } + + /** + \brief Copies the bytes of one memory block to another. The memory blocks must not overlap. + + \note Use #PxMemMove if memory blocks overlap. + + \param dest [out] Pointer to block of memory to copy to. + \param src [in] Pointer to block of memory to copy from. + \param count [in] Number of bytes to copy. + + \return Pointer to destination memory block + */ + PX_FORCE_INLINE void* PxMemCopy(void* dest, const void* src, PxU32 count) + { + // This is to avoid undefined behavior + return (count != 0) ? physx::intrinsics::memCopy(dest, src, count) : NULL; + } + + /** + \brief Copies the bytes of one memory block to another. The memory blocks can overlap. + + \note Use #PxMemCopy if memory blocks do not overlap. + + \param dest [out] Pointer to block of memory to copy to. + \param src [in] Pointer to block of memory to copy from. + \param count [in] Number of bytes to copy. + + \return Pointer to destination memory block + */ + PX_FORCE_INLINE void* PxMemMove(void* dest, const void* src, PxU32 count) + { + return physx::intrinsics::memMove(dest, src, count); + } + + /** + Mark a specified amount of memory with 0xcd pattern. This is used to check that the meta data + definition for serialized classes is complete in checked builds. + + \param ptr [out] Pointer to block of memory to initialize. + \param byteSize [in] Number of bytes to initialize. + */ + PX_INLINE void PxMarkSerializedMemory(void* ptr, PxU32 byteSize) + { +#if PX_CHECKED + PxMemSet(ptr, 0xcd, byteSize); +#else + PX_UNUSED(ptr); + PX_UNUSED(byteSize); +#endif + } + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxMutex.h b/engine/third_party/physx/include/foundation/PxMutex.h new file mode 100644 index 00000000..ec2eca09 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxMutex.h @@ -0,0 +1,183 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_MUTEX_H +#define PX_MUTEX_H + +#include "foundation/PxAllocator.h" + +/* + * This inclusion is a best known fix for gcc 4.4.1 error: + * Creating object file for apex/src/PsAllocator.cpp ... + * In file included from apex/include/PsFoundation.h:30, + * from apex/src/PsAllocator.cpp:26: + * apex/include/PsMutex.h: In constructor 'physx::PxMutexT::MutexT(const Alloc&)': + * apex/include/PsMutex.h:92: error: no matching function for call to 'operator new(unsigned int, + * physx::PxMutexImpl*&)' + * :0: note: candidates are: void* operator new(unsigned int) + */ +#include + +#if !PX_DOXYGEN +namespace physx +{ +#endif +class PX_FOUNDATION_API PxMutexImpl +{ + public: + /** + The constructor for Mutex creates a mutex. It is initially unlocked. + */ + PxMutexImpl(); + + /** + The destructor for Mutex deletes the mutex. + */ + ~PxMutexImpl(); + + /** + Acquire (lock) the mutex. If the mutex is already locked + by another thread, this method blocks until the mutex is + unlocked. + */ + void lock(); + + /** + Acquire (lock) the mutex. If the mutex is already locked + by another thread, this method returns false without blocking. + */ + bool trylock(); + + /** + Release (unlock) the mutex. + */ + void unlock(); + + /** + Size of this class. + */ + static uint32_t getSize(); +}; + +template > +class PxMutexT : protected Alloc +{ + PX_NOCOPY(PxMutexT) + public: + class ScopedLock + { + PxMutexT& mMutex; + PX_NOCOPY(ScopedLock) + public: + PX_INLINE ScopedLock(PxMutexT& mutex) : mMutex(mutex) + { + mMutex.lock(); + } + PX_INLINE ~ScopedLock() + { + mMutex.unlock(); + } + }; + + /** + The constructor for Mutex creates a mutex. It is initially unlocked. + */ + PxMutexT(const Alloc& alloc = Alloc()) : Alloc(alloc) + { + mImpl = reinterpret_cast(Alloc::allocate(PxMutexImpl::getSize(), PX_FL)); + PX_PLACEMENT_NEW(mImpl, PxMutexImpl)(); + } + + /** + The destructor for Mutex deletes the mutex. + */ + ~PxMutexT() + { + mImpl->~PxMutexImpl(); + Alloc::deallocate(mImpl); + } + + /** + Acquire (lock) the mutex. If the mutex is already locked + by another thread, this method blocks until the mutex is + unlocked. + */ + PX_FORCE_INLINE void lock() const + { + mImpl->lock(); + } + + /** + Acquire (lock) the mutex. If the mutex is already locked + by another thread, this method returns false without blocking, + returns true if lock is successfully acquired + */ + PX_FORCE_INLINE bool trylock() const + { + return mImpl->trylock(); + } + + /** + Release (unlock) the mutex, the calling thread must have + previously called lock() or method will error + */ + PX_FORCE_INLINE void unlock() const + { + mImpl->unlock(); + } + + private: + PxMutexImpl* mImpl; +}; + +class PX_FOUNDATION_API PxReadWriteLock +{ + PX_NOCOPY(PxReadWriteLock) + public: + PxReadWriteLock(); + ~PxReadWriteLock(); + + // "takeLock" can only be false if the thread already holds the mutex, e.g. if it already acquired the write lock + void lockReader(bool takeLock); + void lockWriter(); + + void unlockReader(); + void unlockWriter(); + + private: + class ReadWriteLockImpl* mImpl; +}; + +typedef PxMutexT<> PxMutex; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxPhysicsVersion.h b/engine/third_party/physx/include/foundation/PxPhysicsVersion.h new file mode 100644 index 00000000..48d87973 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxPhysicsVersion.h @@ -0,0 +1,59 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_VERSION_H +#define PX_PHYSICS_VERSION_H + +/* +VersionNumbers: The combination of these +numbers uniquely identifies the API, and should +be incremented when the SDK API changes. This may +include changes to file formats. + +This header is included in the main SDK header files +so that the entire SDK and everything that builds on it +is completely rebuilt when this file changes. Thus, +this file is not to include a frequently changing +build number. See BuildNumber.h for that. + +Each of these three values should stay below 255 because +sometimes they are stored in a byte. +*/ + +#define PX_PHYSICS_VERSION_MAJOR 5 +#define PX_PHYSICS_VERSION_MINOR 6 +#define PX_PHYSICS_VERSION_BUGFIX 1 + +/** +The constant PX_PHYSICS_VERSION is used when creating certain PhysX module objects. +This is to ensure that the application is using the same header version as the library was built with. +*/ +#define PX_PHYSICS_VERSION ((PX_PHYSICS_VERSION_MAJOR<<24) + (PX_PHYSICS_VERSION_MINOR<<16) + (PX_PHYSICS_VERSION_BUGFIX<<8) + 0) + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxPinnedArray.h b/engine/third_party/physx/include/foundation/PxPinnedArray.h new file mode 100644 index 00000000..5a3f3f9b --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxPinnedArray.h @@ -0,0 +1,147 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_PINNED_ARRAY_H +#define PX_PINNED_ARRAY_H + +#include "foundation/PxArray.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxBounds3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + // PT: the default pinned-memory arrays are defined as PxPinnedArray = PxArray. + // The PxVirtualAllocator ultimately uses cuMemHostAlloc via PxgCudaHostMemoryAllocatorCallback / PxgPinnedMemoryAllocate. + // We use the CU_MEMHOSTALLOC_DEVICEMAP flag there so cuMemHostGetDevicePointer() can later be used on returned ptr. + // + // The new pinned-memory arrays are defined as PxPinnedArraySafe = PxArray >. This uses a new + // allocator that allocates either from cuMemHostAlloc, *or* fallbacks to regular allocs when we run out of pinned memory. + // The issue is that in the second case cuMemHostGetDevicePointer() will fail, so we cannot use this everywhere. + // + // I think this exposes issues in PxArray itself, for example in the swap function (we don't swap the allocator data there, + // so when using a PxVirtualAllocator with PxArray the PxVirtualAllocator members are not swapped). + + // PT: this class uses the fact that PxArray inherits from the allocator to add new members to the array class. In particular + // PxPinnedAllocator::mPinned describes where PxArray::mData has been allocated. The class is mostly designed to be used in + // conjunction with PxArray, not as a standalone allocator. + template + class PxPinnedAllocator + { + public: + PxPinnedAllocator(PxVirtualAllocatorCallback* callback = NULL, int group = 0) : mCallback(callback), mGroup(group), mPinned(0) {} + + PX_INLINE void* allocate(size_t size, const char* file, int line, uint32_t* cookie=NULL) + { + PX_ASSERT(mCallback); + // PT: returns *previous* pinned value. It will be passed back to the deallocate function. + if(cookie) + *cookie = mPinned; + + if(!size) + { + mPinned = 0xffffffff; + return NULL; + } + + // PT: first, try with the pinned-memory allocator + void* ptr = mCallback->allocate(size, mGroup, file, line); + if(ptr) + { + mPinned = 1; + return ptr; + } + + // PT: if it fails, fallback to regular allocator + mPinned = 0; + return PxReflectionAllocator::allocate(size, file, line); + } + + PX_INLINE void deallocate(void* ptr, uint32_t* cookie=NULL) + { + PX_ASSERT(mCallback); + if(ptr) + { + // PT: by default use the internal value, except if we're given an explicit cookie + const uint32_t pinned = cookie ? *cookie : mPinned; + if(pinned==1) + mCallback->deallocate(ptr); + else + PxReflectionAllocator::deallocate(ptr); + } + } + + PX_FORCE_INLINE void setCallback(PxVirtualAllocatorCallback* callback) + { + mCallback = callback; + } + + PX_FORCE_INLINE PxVirtualAllocatorCallback* getCallback() + { + return mCallback; + } + + private: + PxVirtualAllocatorCallback* mCallback; + const int mGroup; + uint32_t mPinned; + PxPinnedAllocator& operator=(const PxPinnedAllocator&); + }; + + struct PxsCachedTransform; + + // PT: default versions: + template + using PxPinnedArray = PxArray; + + typedef PxArray PxCachedTransformArrayPinned; + typedef PxArray PxBoundsArrayPinned; + typedef PxArray PxFloatArrayPinned; + typedef PxArray PxInt32ArrayPinned; + typedef PxArray PxInt16ArrayPinned; + typedef PxArray PxInt8ArrayPinned; + + // PT: new versions + template + using PxPinnedArraySafe = PxArray >; + + typedef PxArray > PxCachedTransformArrayPinnedSafe; + typedef PxArray > PxBoundsArrayPinnedSafe; + typedef PxArray > PxFloatArrayPinnedSafe; + typedef PxArray > PxInt32ArrayPinnedSafe; + typedef PxArray > PxInt16ArrayPinnedSafe; + typedef PxArray > PxInt8ArrayPinnedSafe; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxPlane.h b/engine/third_party/physx/include/foundation/PxPlane.h new file mode 100644 index 00000000..06f1cf74 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxPlane.h @@ -0,0 +1,158 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_PLANE_H +#define PX_PLANE_H + + +#include "foundation/PxTransform.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Representation of a plane. + + Plane equation used: n.dot(v) + d = 0 +*/ +class PxPlane +{ + public: + /** + \brief Constructor + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxPlane() + { + } + + /** + \brief Constructor from a normal and a distance + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxPlane(float nx, float ny, float nz, float distance) : n(nx, ny, nz), d(distance) + { + } + + /** + \brief Constructor from a normal and a distance + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxPlane(const PxVec3& normal, float distance) : n(normal), d(distance) + { + } + + /** + \brief Constructor from a point on the plane and a normal + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxPlane(const PxVec3& point, const PxVec3& normal) + : n(normal), d(-point.dot(n)) // p satisfies normal.dot(p) + d = 0 + { + } + + /** + \brief Constructor from three points + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxPlane(const PxVec3& p0, const PxVec3& p1, const PxVec3& p2) + { + n = (p1 - p0).cross(p2 - p0).getNormalized(); + d = -p0.dot(n); + } + + /** + \brief returns true if the two planes are exactly equal + */ + PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxPlane& p) const + { + return n == p.n && d == p.d; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE float distance(const PxVec3& p) const + { + return p.dot(n) + d; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE bool contains(const PxVec3& p) const + { + return PxAbs(distance(p)) < (1.0e-7f); + } + + /** + \brief projects p into the plane + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 project(const PxVec3& p) const + { + return p - n * distance(p); + } + + /** + \brief find an arbitrary point in the plane + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 pointInPlane() const + { + return -n * d; + } + + /** + \brief equivalent plane with unit normal + */ + + PX_CUDA_CALLABLE PX_FORCE_INLINE void normalize() + { + float denom = 1.0f / n.magnitude(); + n *= denom; + d *= denom; + } + + /** + \brief transform plane + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxPlane transform(const PxTransform& pose) const + { + const PxVec3 transformedNormal = pose.rotate(n); + return PxPlane(transformedNormal, d - pose.p.dot(transformedNormal)); + } + + /** + \brief inverse-transform plane + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxPlane inverseTransform(const PxTransform& pose) const + { + const PxVec3 transformedNormal = pose.rotateInv(n); + return PxPlane(transformedNormal, d + pose.p.dot(n)); + } + + PxVec3 n; //!< The normal to the plane + float d; //!< The distance from the origin +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxPool.h b/engine/third_party/physx/include/foundation/PxPool.h new file mode 100644 index 00000000..27107f07 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxPool.h @@ -0,0 +1,265 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_POOL_H +#define PX_POOL_H + +#include "foundation/PxArray.h" +#include "foundation/PxSort.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxInlineArray.h" +#include "foundation/PxMemory.h" + +namespace physx +{ + +/*! +Simple allocation pool +*/ +template ::Type> +class PxPoolBase : public PxUserAllocated, public Alloc +{ + PX_NOCOPY(PxPoolBase) + protected: + PxPoolBase(const Alloc& alloc, uint32_t elementsPerSlab, uint32_t slabSize) + : Alloc(alloc), mSlabs(alloc), mElementsPerSlab(elementsPerSlab), mUsed(0), mSlabSize(slabSize), mFreeElement(0) + { + mSlabs.reserve(64); + PX_COMPILE_TIME_ASSERT(sizeof(T) >= sizeof(size_t)); + } + + public: + ~PxPoolBase() + { + if(mUsed) + disposeElements(); + + for(void** slabIt = mSlabs.begin(), *slabEnd = mSlabs.end(); slabIt != slabEnd; ++slabIt) + Alloc::deallocate(*slabIt); + } + + // Allocate space for single object + PX_INLINE T* allocate() + { + if(mFreeElement == 0) + allocateSlab(); + T* p = reinterpret_cast(mFreeElement); + mFreeElement = mFreeElement->mNext; + mUsed++; + + PxMarkSerializedMemory(p, sizeof(T)); + return p; + } + + // Put space for a single element back in the lists + PX_INLINE void deallocate(T* p) + { + if(p) + { + PX_ASSERT(mUsed); + mUsed--; + push(reinterpret_cast(p)); + } + } + + PX_INLINE T* construct() + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T()) : NULL; + } + + template + PX_INLINE T* construct(A1& a) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c)) : NULL; + } + + template + PX_INLINE T* construct(A1* a, A2& b, A3& c) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c, A4& d) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c, d)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c, A4& d, A5& e) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c, d, e)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c, A4& d, A5& e, A6& f) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c, d, e, f)) : NULL; + } + + template + PX_INLINE T* construct(const A1& a, A2& b, const A3& c, A4& d, A5& e, A6& f) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c, d, e, f)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c, A4& d, A5& e, A6& f, A7& g) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c, d, e, f, g)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c, A4& d, A5& e, A6& f, A7& g, A8& h) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c, d, e, f, g, h)) : NULL; + } + + PX_INLINE void destroy(T* const p) + { + if(p) + { + p->~T(); + deallocate(p); + } + } + + protected: + struct FreeList + { + FreeList* mNext; + }; + + // All the allocated slabs, sorted by pointer + PxArray mSlabs; + + const uint32_t mElementsPerSlab; + uint32_t mUsed; + const uint32_t mSlabSize; + + FreeList* mFreeElement; // Head of free-list + + // Helper function to get bitmap of allocated elements + + void push(FreeList* p) + { + p->mNext = mFreeElement; + mFreeElement = p; + } + + // Allocate a slab and segregate it into the freelist + void allocateSlab() + { + T* slab = reinterpret_cast(Alloc::allocate(mSlabSize, PX_FL)); + + mSlabs.pushBack(slab); + + // Build a chain of nodes for the freelist + T* it = slab + mElementsPerSlab; + while(--it >= slab) + push(reinterpret_cast(it)); + } + + /* + Cleanup method. Go through all active slabs and call destructor for live objects, + then free their memory + */ + void disposeElements() + { + PxArray freeNodes(*this); + while(mFreeElement) + { + freeNodes.pushBack(mFreeElement); + mFreeElement = mFreeElement->mNext; + } + Alloc& alloc(*this); + PxSort(freeNodes.begin(), freeNodes.size(), PxLess(), alloc); + PxSort(mSlabs.begin(), mSlabs.size(), PxLess(), alloc); + + typename PxArray::Iterator slabIt = mSlabs.begin(), slabEnd = mSlabs.end(); + for(typename PxArray::Iterator freeIt = freeNodes.begin(); slabIt != slabEnd; ++slabIt) + { + for(T* tIt = reinterpret_cast(*slabIt), *tEnd = tIt + mElementsPerSlab; tIt != tEnd; ++tIt) + { + if(freeIt != freeNodes.end() && *freeIt == tIt) + ++freeIt; + else + tIt->~T(); + } + } + } +}; + +// original pool implementation +template ::Type> +class PxPool : public PxPoolBase +{ + public: + PxPool(const Alloc& alloc = Alloc(), uint32_t elementsPerSlab = 32) + : PxPoolBase(alloc, elementsPerSlab, elementsPerSlab * sizeof(T)) + { + } +}; + +// allows specification of the slab size instead of the occupancy +template ::Type> +class PxPool2 : public PxPoolBase +{ + public: + PxPool2(const Alloc& alloc = Alloc()) : PxPoolBase(alloc, slabSize / sizeof(T), slabSize) + { + PX_COMPILE_TIME_ASSERT(slabSize > sizeof(T)); + } +}; + +} // namespace physx + +#endif diff --git a/engine/third_party/physx/include/foundation/PxPreprocessor.h b/engine/third_party/physx/include/foundation/PxPreprocessor.h new file mode 100644 index 00000000..4ae2456a --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxPreprocessor.h @@ -0,0 +1,536 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_PREPROCESSOR_H +#define PX_PREPROCESSOR_H + +#include + + +#define PX_STRINGIZE_HELPER(X) #X +#define PX_STRINGIZE(X) PX_STRINGIZE_HELPER(X) + +#define PX_CONCAT_HELPER(X, Y) X##Y +#define PX_CONCAT(X, Y) PX_CONCAT_HELPER(X, Y) + +/* +The following preprocessor identifiers specify compiler, OS, and architecture. +All definitions have a value of 1 or 0, use '#if' instead of '#ifdef'. +*/ + +/** +Compiler defines, see http://sourceforge.net/p/predef/wiki/Compilers/ +*/ +#if defined(_MSC_VER) +#if _MSC_VER >= 1920 + #define PX_VC 16 +#elif _MSC_VER >= 1910 + #define PX_VC 15 +#elif _MSC_VER >= 1900 + #define PX_VC 14 +#elif _MSC_VER >= 1800 + #define PX_VC 12 +#elif _MSC_VER >= 1700 + #define PX_VC 11 +#elif _MSC_VER >= 1600 + #define PX_VC 10 +#elif _MSC_VER >= 1500 + #define PX_VC 9 +#else + #error "Unknown VC version" +#endif +#elif defined(__clang__) +#define PX_CLANG 1 + #if defined (__clang_major__) + #define PX_CLANG_MAJOR __clang_major__ + #elif defined (_clang_major) + #define PX_CLANG_MAJOR _clang_major + #else + #define PX_CLANG_MAJOR 0 + #endif +#elif defined(__GNUC__) // note: __clang__ implies __GNUC__ + #define PX_GCC 1 +#else + #error "Unknown compiler" +#endif + +// not treated as its own compiler because clang, for example, can, in theory, compile CUDA code too +#if defined(__CUDACC__) + #define PX_CUDA_COMPILER 1 +#else + #define PX_CUDA_COMPILER 0 +#endif + +/** +Operating system defines, see http://sourceforge.net/p/predef/wiki/OperatingSystems/ +*/ +#if defined(_WIN64) + #define PX_WIN64 1 +#elif defined(_WIN32) // note: _M_PPC implies _WIN32 + #define PX_WIN32 1 +#elif defined(__linux__) || defined (__EMSCRIPTEN__) + #define PX_LINUX 1 +#elif defined(__APPLE__) + #define PX_OSX 1 +#elif defined(__NX__) + #define PX_SWITCH 1 +#else + #error "Unknown operating system" +#endif + +/** +Architecture defines, see http://sourceforge.net/p/predef/wiki/Architectures/ +*/ +#if defined(__x86_64__) || defined(_M_X64) + #define PX_X64 1 +#elif defined(__i386__) || defined(_M_IX86) || defined (__EMSCRIPTEN__) + #define PX_X86 1 +#elif defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) + #define PX_A64 1 +#elif defined(__arm__) || defined(_M_ARM) + #define PX_ARM 1 +#elif defined(__ppc__) || defined(_M_PPC) || defined(__CELLOS_LV2__) + #define PX_PPC 1 +#else + #error "Unknown architecture" +#endif + +/** +SIMD defines +*/ +#if !defined(PX_SIMD_DISABLED) + #if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) || (defined (__EMSCRIPTEN__) && defined(__SSE2__)) + #define PX_SSE2 1 + #endif + #if defined(_M_ARM) || defined(__ARM_NEON__) || defined(__ARM_NEON) + #define PX_NEON 1 + #endif + #if defined(_M_PPC) || defined(__CELLOS_LV2__) + #define PX_VMX 1 + #endif +#endif + +/** +define anything not defined on this platform to 0 +*/ +#ifndef PX_VC + #define PX_VC 0 +#endif +#ifndef PX_CLANG + #define PX_CLANG 0 +#endif +#ifndef PX_GCC + #define PX_GCC 0 +#endif +#ifndef PX_WIN64 + #define PX_WIN64 0 +#endif +#ifndef PX_WIN32 + #define PX_WIN32 0 +#endif +#ifndef PX_LINUX + #define PX_LINUX 0 +#endif +#ifndef PX_OSX + #define PX_OSX 0 +#endif +#ifndef PX_SWITCH + #define PX_SWITCH 0 +#endif +#ifndef PX_X64 + #define PX_X64 0 +#endif +#ifndef PX_X86 + #define PX_X86 0 +#endif +#ifndef PX_A64 + #define PX_A64 0 +#endif +#ifndef PX_ARM + #define PX_ARM 0 +#endif +#ifndef PX_PPC + #define PX_PPC 0 +#endif +#ifndef PX_SSE2 + #define PX_SSE2 0 +#endif +#ifndef PX_NEON + #define PX_NEON 0 +#endif +#ifndef PX_VMX + #define PX_VMX 0 +#endif + +/* +define anything not defined through the command line to 0 +*/ +#ifndef PX_DEBUG + #define PX_DEBUG 0 +#endif +#ifndef PX_CHECKED + #define PX_CHECKED 0 +#endif +#ifndef PX_PROFILE + #define PX_PROFILE 0 +#endif +#ifndef PX_DEBUG_CRT + #define PX_DEBUG_CRT 0 +#endif +#ifndef PX_NVTX + #define PX_NVTX 0 +#endif +#ifndef PX_DOXYGEN + #define PX_DOXYGEN 0 +#endif + +/** +family shortcuts +*/ +// compiler +#define PX_GCC_FAMILY (PX_CLANG || PX_GCC) +// os +#define PX_WINDOWS_FAMILY (PX_WIN32 || PX_WIN64) +#define PX_LINUX_FAMILY PX_LINUX +#define PX_APPLE_FAMILY PX_OSX // equivalent to #if __APPLE__ +#define PX_UNIX_FAMILY (PX_LINUX_FAMILY || PX_APPLE_FAMILY) // shortcut for unix/posix platforms +#if defined(__EMSCRIPTEN__) + #define PX_EMSCRIPTEN 1 +#else + #define PX_EMSCRIPTEN 0 +#endif +// architecture +#define PX_INTEL_FAMILY (PX_X64 || PX_X86) +#define PX_ARM_FAMILY (PX_ARM || PX_A64) +#define PX_P64_FAMILY (PX_X64 || PX_A64) // shortcut for 64-bit architectures + +/** +C++ standard library defines +*/ +#if defined(_LIBCPP_VERSION) || PX_WIN64 || PX_WIN32 || PX_EMSCRIPTEN + #define PX_LIBCPP 1 +#else + #define PX_LIBCPP 0 +#endif + +// legacy define for PhysX +#define PX_WINDOWS (PX_WINDOWS_FAMILY && !PX_ARM_FAMILY) + +/** +Assert macro +*/ +#ifndef PX_ENABLE_ASSERTS + #if PX_DEBUG && !PX_CUDA_COMPILER + #define PX_ENABLE_ASSERTS 1 + #else + #define PX_ENABLE_ASSERTS 0 + #endif +#endif + +/** +DLL export macros +*/ +#ifndef PX_C_EXPORT + #if PX_WINDOWS_FAMILY || PX_LINUX + #define PX_C_EXPORT extern "C" + #else + #define PX_C_EXPORT + #endif +#endif + +#if PX_UNIX_FAMILY&& __GNUC__ >= 4 + #define PX_UNIX_EXPORT __attribute__((visibility("default"))) +#else + #define PX_UNIX_EXPORT +#endif + +#if PX_WINDOWS_FAMILY + #define PX_DLL_EXPORT __declspec(dllexport) + #define PX_DLL_IMPORT __declspec(dllimport) +#else + #define PX_DLL_EXPORT PX_UNIX_EXPORT + #define PX_DLL_IMPORT +#endif + +/** +Calling convention +*/ +#ifndef PX_CALL_CONV + #if PX_WINDOWS_FAMILY + #define PX_CALL_CONV __cdecl + #else + #define PX_CALL_CONV + #endif +#endif + +/** +Pack macros - disabled on SPU because they are not supported +*/ +#if PX_VC + #define PX_PUSH_PACK_DEFAULT __pragma(pack(push, 8)) + #define PX_POP_PACK __pragma(pack(pop)) +#elif PX_GCC_FAMILY + #define PX_PUSH_PACK_DEFAULT _Pragma("pack(push, 8)") + #define PX_POP_PACK _Pragma("pack(pop)") +#else + #define PX_PUSH_PACK_DEFAULT + #define PX_POP_PACK +#endif + +/** +Inline macro +*/ +#define PX_INLINE inline +#if PX_WINDOWS_FAMILY + #pragma inline_depth(255) +#endif + +/** +Force inline macro +*/ +#if PX_VC + #define PX_FORCE_INLINE __forceinline +#elif PX_CUDA_COMPILER + #define PX_FORCE_INLINE __forceinline__ +#elif PX_GCC_FAMILY + #define PX_FORCE_INLINE inline __attribute__((always_inline)) +#else + #define PX_FORCE_INLINE inline +#endif + +/** +Noinline macro +*/ +#if PX_WINDOWS_FAMILY + #define PX_NOINLINE __declspec(noinline) +#elif PX_GCC_FAMILY + #define PX_NOINLINE __attribute__((noinline)) +#else + #define PX_NOINLINE +#endif + +/** +Restrict macro +*/ +#if PX_CUDA_COMPILER + #define PX_RESTRICT __restrict__ +#else + #define PX_RESTRICT __restrict +#endif + +/** +Noalias macro +*/ +#if PX_WINDOWS_FAMILY + #define PX_NOALIAS __declspec(noalias) +#else + #define PX_NOALIAS +#endif + +/** +Override macro +*/ +#define PX_OVERRIDE override + +/** +Final macro + */ +#define PX_FINAL final + +/** +Unused attribute macro. Only on GCC for now. + */ +#if PX_GCC_FAMILY + #define PX_UNUSED_ATTRIBUTE __attribute__((unused)) +#else + #define PX_UNUSED_ATTRIBUTE +#endif + +/** +Alignment macros + +PX_ALIGN_PREFIX and PX_ALIGN_SUFFIX can be used for type alignment instead of aligning individual variables as follows: +PX_ALIGN_PREFIX(16) +struct A { +... +} PX_ALIGN_SUFFIX(16); +This declaration style is parsed correctly by Visual Assist. +*/ +#ifndef PX_ALIGN + #if PX_WINDOWS_FAMILY + #define PX_ALIGN(alignment, decl) __declspec(align(alignment)) decl + #define PX_ALIGN_PREFIX(alignment) __declspec(align(alignment)) + #define PX_ALIGN_SUFFIX(alignment) + #elif PX_GCC_FAMILY + #define PX_ALIGN(alignment, decl) decl __attribute__((aligned(alignment))) + #define PX_ALIGN_PREFIX(alignment) + #define PX_ALIGN_SUFFIX(alignment) __attribute__((aligned(alignment))) + #elif PX_CUDA_COMPILER + #define PX_ALIGN(alignment, decl) __align__(alignment) decl + #define PX_ALIGN_PREFIX(alignment) + #define PX_ALIGN_SUFFIX(alignment) __align__(alignment)) + #else + #define PX_ALIGN(alignment, decl) + #define PX_ALIGN_PREFIX(alignment) + #define PX_ALIGN_SUFFIX(alignment) + #endif +#endif + +/** +Deprecated macro +- To deprecate a function: Place PX_DEPRECATED at the start of the function header (leftmost word). +- To deprecate a 'typedef', a 'struct' or a 'class': Place PX_DEPRECATED directly after the keywords ('typedef', +'struct', 'class'). + +Use these macro definitions to create warnings for deprecated functions +\#define PX_DEPRECATED __declspec(deprecated) // Microsoft +\#define PX_DEPRECATED __attribute__((deprecated())) // GCC +*/ +#define PX_DEPRECATED + +/** +General defines +*/ + + +#if PX_LINUX && PX_CLANG && !PX_CUDA_COMPILER +#define PX_COMPILE_TIME_ASSERT(exp) \ +_Pragma(" clang diagnostic push") \ +_Pragma(" clang diagnostic ignored \"-Wc++98-compat\"") \ +static_assert(exp, "") \ +_Pragma(" clang diagnostic pop") +#else +#define PX_COMPILE_TIME_ASSERT(exp) static_assert(exp, "") +#endif + +#if PX_GCC_FAMILY + #define PX_OFFSET_OF(X, Y) __builtin_offsetof(X, Y) +#else + #define PX_OFFSET_OF(X, Y) offsetof(X, Y) +#endif + +#define PX_OFFSETOF_BASE 0x100 // casting the null ptr takes a special-case code path, which we don't want +#define PX_OFFSET_OF_RT(Class, Member) (reinterpret_cast(&reinterpret_cast(PX_OFFSETOF_BASE)->Member) - size_t(PX_OFFSETOF_BASE)) + + +#if PX_WINDOWS_FAMILY + // check that exactly one of NDEBUG and _DEBUG is defined + #if !defined(NDEBUG) ^ defined(_DEBUG) + #error Exactly one of NDEBUG and _DEBUG needs to be defined! + #endif +#endif + +// make sure PX_CHECKED is defined in all _DEBUG configurations as well +#if !PX_CHECKED && PX_DEBUG + #error PX_CHECKED must be defined when PX_DEBUG is defined +#endif + +#if PX_CUDA_COMPILER + #define PX_CUDA_CALLABLE __host__ __device__ +#else + #define PX_CUDA_CALLABLE +#endif + +// avoid unreferenced parameter warning +// preferred solution: omit the parameter's name from the declaration +template +PX_CUDA_CALLABLE PX_INLINE void PX_UNUSED(T const&) +{ +} + +// Ensure that the application hasn't tweaked the pack value to less than 8, which would break +// matching between the API headers and the binaries +// This assert works on win32/win64, but may need further specialization on other platforms. +// Some GCC compilers need the compiler flag -malign-double to be set. +// Apparently the apple-clang-llvm compiler doesn't support malign-double. +#if PX_APPLE_FAMILY || (PX_CLANG && !PX_ARM) + struct PxPackValidation + { + char _; + long a; + }; +#elif PX_CLANG && PX_ARM + struct PxPackValidation + { + char _; + double a; + }; +#else + struct PxPackValidation + { + char _; + long long a; + }; +#endif +// clang (as of version 3.9) cannot align doubles on 8 byte boundary when compiling for Intel 32 bit target +#if !PX_APPLE_FAMILY && !PX_EMSCRIPTEN && !(PX_CLANG && PX_X86) + PX_COMPILE_TIME_ASSERT(PX_OFFSET_OF(PxPackValidation, a) == 8); +#endif + +// use in a cpp file to suppress LNK4221 +#if PX_VC + #define PX_DUMMY_SYMBOL \ + namespace \ + { \ + char PxDummySymbol; \ + } +#else + #define PX_DUMMY_SYMBOL +#endif + +#if PX_GCC_FAMILY + #define PX_WEAK_SYMBOL __attribute__((weak)) // this is to support SIMD constant merging in template specialization +#else + #define PX_WEAK_SYMBOL +#endif + +// Macro for avoiding default assignment and copy, because doing this by inheritance can increase class size on some +// platforms. +#define PX_NOCOPY(Class) \ +protected: \ + Class(const Class&); \ + Class& operator=(const Class&); + +//#define DISABLE_CUDA_PHYSX +#ifndef DISABLE_CUDA_PHYSX + //CUDA is currently supported on x86_64 windows and linux, and ARM_64 linux + #define PX_SUPPORT_GPU_PHYSX ((PX_X64 && (PX_WINDOWS_FAMILY || PX_LINUX)) || (PX_A64 && PX_LINUX)) +#else + #define PX_SUPPORT_GPU_PHYSX 0 +#endif + +#ifndef PX_SUPPORT_EXTERN_TEMPLATE + #define PX_SUPPORT_EXTERN_TEMPLATE (PX_VC != 11) +#else + #define PX_SUPPORT_EXTERN_TEMPLATE 0 +#endif + +#define PX_FL __FILE__, __LINE__ + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxProfiler.h b/engine/third_party/physx/include/foundation/PxProfiler.h new file mode 100644 index 00000000..01570f1b --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxProfiler.h @@ -0,0 +1,143 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILER_H +#define PX_PROFILER_H + +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief The pure virtual callback interface for general purpose instrumentation and profiling of GameWorks modules as +well as applications +*/ +class PxProfilerCallback +{ +protected: + virtual ~PxProfilerCallback() {} + +public: + /************************************************************************************************************************** + Instrumented profiling events + ***************************************************************************************************************************/ + + /** + \brief Mark the beginning of a nested profile block + \param[in] eventName Event name. Must be a persistent const char* that is the same pointer passed to zoneEnd such that the pointer can be used to pair the calls. + \param[in] detached True for cross thread events + \param[in] contextId the context id of this zone. Zones with the same id belong to the same group. 0 is used for no specific group. + \return Returns implementation-specific profiler data for this event + */ + virtual void* zoneStart(const char* eventName, bool detached, uint64_t contextId) = 0; + + /** + \brief Mark the end of a nested profile block + \param[in] profilerData The data returned by the corresponding zoneStart call (or NULL if not available) + \param[in] eventName Event name. Must be a persistent const char* that is the same pointer passed to zoneStart such that the pointer can be used to pair the calls. + \param[in] detached True for cross thread events. Should match the value passed to zoneStart. + \param[in] contextId The context of this zone. Should match the value passed to zoneStart. + + \note eventName plus contextId can be used to uniquely match up start and end of a zone. + */ + virtual void zoneEnd(void* profilerData, const char* eventName, bool detached, uint64_t contextId) = 0; + + /** + \brief Record integer data to be displayed in the profiler. + \param[in] value The integer data point to be recorded. + \param[in] valueName The name of the data being recorded. Must be a persistent const char * + \param[in] contextId The context of this data. + */ + virtual void recordData(int32_t value, const char* valueName, uint64_t contextId) + { + PX_UNUSED(value); + PX_UNUSED(valueName); + PX_UNUSED(contextId); + } + + /** + \brief Record float data to be displayed in the profiler. + \param[in] value The floating point data to be recorded. + \param[in] valueName The name of the data being recorded. Must be a persistent const char * + \param[in] contextId The context of this data. + */ + virtual void recordData(float value, const char* valueName, uint64_t contextId) + { + PX_UNUSED(value); + PX_UNUSED(valueName); + PX_UNUSED(contextId); + } + + /** + \brief Record a frame marker to be displayed in the profiler. + + Markers that have identical names will be displayed in the profiler + along with the time between each of the markers. A frame counter will display the frame marker count. + \param[in] name The name of the frame. Must be a persistent const char * + \param[in] contextId The context of the frame. + */ + virtual void recordFrame(const char* name, uint64_t contextId) + { + PX_UNUSED(name); + PX_UNUSED(contextId); + } +}; + +class PxProfileScoped +{ + public: + PX_FORCE_INLINE PxProfileScoped(PxProfilerCallback* callback, const char* eventName, bool detached, uint64_t contextId) : mCallback(callback), mProfilerData(NULL) + { + if(mCallback) + { + mEventName = eventName; + mContextId = contextId; + mDetached = detached; + mProfilerData = mCallback->zoneStart(eventName, detached, contextId); + } + } + + PX_FORCE_INLINE ~PxProfileScoped() + { + if(mCallback) + mCallback->zoneEnd(mProfilerData, mEventName, mDetached, mContextId); + } + PxProfilerCallback* mCallback; + const char* mEventName; + void* mProfilerData; + uint64_t mContextId; + bool mDetached; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxQuat.h b/engine/third_party/physx/include/foundation/PxQuat.h new file mode 100644 index 00000000..0b7dfbc4 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxQuat.h @@ -0,0 +1,428 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_QUAT_H +#define PX_QUAT_H + + +#include "foundation/PxVec3.h" +#if !PX_DOXYGEN +namespace physx +{ +#endif + +template class PxMat33T; + +/** +\brief This is a quaternion class. For more information on quaternion mathematics +consult a mathematics source on complex numbers. +*/ + +template +class PxQuatT +{ + public: + + /** + \brief Default constructor, does not do any initialization. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT() + { + } + + //! identity constructor + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT(PxIDENTITY) : x(Type(0.0)), y(Type(0.0)), z(Type(0.0)), w(Type(1.0)) + { + } + + /** + \brief Constructor from a scalar: sets the real part w to the scalar value, and the imaginary parts (x,y,z) to zero + */ + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT(Type r) : x(Type(0.0)), y(Type(0.0)), z(Type(0.0)), w(r) + { + } + + /** + \brief Constructor. Take note of the order of the elements! + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT(Type nx, Type ny, Type nz, Type nw) : x(nx), y(ny), z(nz), w(nw) + { + } + + /** + \brief Creates from angle-axis representation. + + Axis must be normalized! + + Angle is in radians! + + Unit: Radians + */ + PX_CUDA_CALLABLE PX_INLINE PxQuatT(Type angleRadians, const PxVec3T& unitAxis) + { + PX_ASSERT(PxAbs(Type(1.0) - unitAxis.magnitude()) < Type(1e-3)); + const Type a = angleRadians * Type(0.5); + + Type s; + PxSinCos(a, s, w); + x = unitAxis.x * s; + y = unitAxis.y * s; + z = unitAxis.z * s; + } + + /** + \brief Copy ctor. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT(const PxQuatT& v) : x(v.x), y(v.y), z(v.z), w(v.w) + { + } + + /** + \brief Creates from orientation matrix. + + \param[in] m Rotation matrix to extract quaternion from. + */ + PX_CUDA_CALLABLE PX_INLINE explicit PxQuatT(const PxMat33T& m); /* defined in PxMat33.h */ + + /** + \brief returns true if quat is identity + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isIdentity() const + { + return x==Type(0.0) && y==Type(0.0) && z==Type(0.0) && w==Type(1.0); + } + + /** + \brief returns true if all elements are finite (not NAN or INF, etc.) + */ + PX_CUDA_CALLABLE bool isFinite() const + { + return PxIsFinite(x) && PxIsFinite(y) && PxIsFinite(z) && PxIsFinite(w); + } + + /** + \brief returns true if finite and magnitude is close to unit + */ + PX_CUDA_CALLABLE bool isUnit() const + { + const Type unitTolerance = Type(1e-3); + return isFinite() && PxAbs(magnitude() - Type(1.0)) < unitTolerance; + } + + /** + \brief returns true if finite and magnitude is reasonably close to unit to allow for some accumulation of error vs + isValid + */ + PX_CUDA_CALLABLE bool isSane() const + { + const Type unitTolerance = Type(1e-2); + return isFinite() && PxAbs(magnitude() - Type(1.0)) < unitTolerance; + } + + /** + \brief returns true if the two quaternions are exactly equal + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator==(const PxQuatT& q) const + { + return x == q.x && y == q.y && z == q.z && w == q.w; + } + + /** + \brief converts this quaternion to angle-axis representation + */ + PX_CUDA_CALLABLE PX_INLINE void toRadiansAndUnitAxis(Type& angle, PxVec3T& axis) const + { + const Type quatEpsilon = Type(1.0e-8); + const Type s2 = x * x + y * y + z * z; + if(s2 < quatEpsilon * quatEpsilon) // can't extract a sensible axis + { + angle = Type(0.0); + axis = PxVec3T(Type(1.0), Type(0.0), Type(0.0)); + } + else + { + const Type s = PxRecipSqrt(s2); + axis = PxVec3T(x, y, z) * s; + angle = PxAbs(w) < quatEpsilon ? Type(PxPi) : PxAtan2(s2 * s, w) * Type(2.0); + } + } + + /** + \brief Gets the angle between this quat and the identity quaternion. + + Unit: Radians + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type getAngle() const + { + return PxAcos(w) * Type(2.0); + } + + /** + \brief Gets the angle between this quat and the argument + + Unit: Radians + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type getAngle(const PxQuatT& q) const + { + return PxAcos(dot(q)) * Type(2.0); + } + + /** + \brief This is the squared 4D vector length, should be 1 for unit quaternions. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type magnitudeSquared() const + { + return x * x + y * y + z * z + w * w; + } + + /** + \brief returns the scalar product of this and other. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type dot(const PxQuatT& v) const + { + return x * v.x + y * v.y + z * v.z + w * v.w; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT getNormalized() const + { + const Type s = Type(1.0) / magnitude(); + return PxQuatT(x * s, y * s, z * s, w * s); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE Type magnitude() const + { + return PxSqrt(magnitudeSquared()); + } + + // modifiers: + /** + \brief maps to the closest unit quaternion. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type normalize() // convert this PxQuatT to a unit quaternion + { + const Type mag = magnitude(); + if(mag != Type(0.0)) + { + const Type imag = Type(1.0) / mag; + + x *= imag; + y *= imag; + z *= imag; + w *= imag; + } + return mag; + } + + /* + \brief returns the conjugate. + + \note for unit quaternions, this is the inverse. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT getConjugate() const + { + return PxQuatT(-x, -y, -z, w); + } + + /* + \brief returns imaginary part. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T getImaginaryPart() const + { + return PxVec3T(x, y, z); + } + + /** brief computes rotation of x-axis */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T getBasisVector0() const + { + const Type x2 = x * Type(2.0); + const Type w2 = w * Type(2.0); + return PxVec3T((w * w2) - Type(1.0) + x * x2, (z * w2) + y * x2, (-y * w2) + z * x2); + } + + /** brief computes rotation of y-axis */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T getBasisVector1() const + { + const Type y2 = y * Type(2.0); + const Type w2 = w * Type(2.0); + return PxVec3T((-z * w2) + x * y2, (w * w2) - Type(1.0) + y * y2, (x * w2) + z * y2); + } + + /** brief computes rotation of z-axis */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T getBasisVector2() const + { + const Type z2 = z * Type(2.0); + const Type w2 = w * Type(2.0); + return PxVec3T((y * w2) + x * z2, (-x * w2) + y * z2, (w * w2) - Type(1.0) + z * z2); + } + + /** + rotates passed vec by this (assumed unitary) + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3T rotate(const PxVec3T& v) const + { + const Type vx = Type(2.0) * v.x; + const Type vy = Type(2.0) * v.y; + const Type vz = Type(2.0) * v.z; + const Type w2 = w * w - Type(0.5); + const Type dot2 = (x * vx + y * vy + z * vz); + return PxVec3T((vx * w2 + (y * vz - z * vy) * w + x * dot2), (vy * w2 + (z * vx - x * vz) * w + y * dot2), + (vz * w2 + (x * vy - y * vx) * w + z * dot2)); + } + + /** \brief computes inverse rotation of x-axis */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T getInvBasisVector0() const + { + const Type x2 = x * Type(2.0); + const Type w2 = w * Type(2.0); + return PxVec3T((w * w2) - Type(1.0) + x * x2, (-z * w2) + y * x2, (y * w2) + z * x2); + } + + /** \brief computes the inverse rotation of the y-axis */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T getInvBasisVector1() const + { + const Type y2 = y * Type(2.0); + const Type w2 = w * Type(2.0); + return PxVec3T((z * w2) + x * y2, (w * w2) - Type(1.0) + y * y2, (-x * w2) + z * y2); + } + + /** \brief computes the inverse rotation of the z-axis */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T getInvBasisVector2() const + { + const Type z2 = z * Type(2.0); + const Type w2 = w * Type(2.0); + return PxVec3T((-y * w2) + x * z2, (x * w2) + y * z2, (w * w2) - Type(1.0) + z * z2); + } + + /** + inverse rotates passed vec by this (assumed unitary) + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3T rotateInv(const PxVec3T& v) const + { + const Type vx = Type(2.0) * v.x; + const Type vy = Type(2.0) * v.y; + const Type vz = Type(2.0) * v.z; + const Type w2 = w * w - Type(0.5); + const Type dot2 = (x * vx + y * vy + z * vz); + return PxVec3T((vx * w2 - (y * vz - z * vy) * w + x * dot2), (vy * w2 - (z * vx - x * vz) * w + y * dot2), + (vz * w2 - (x * vy - y * vx) * w + z * dot2)); + } + + /** + \brief Assignment operator + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT& operator=(const PxQuatT& p) + { + x = p.x; + y = p.y; + z = p.z; + w = p.w; + return *this; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT& operator*=(const PxQuatT& q) + { + const Type tx = w * q.x + q.w * x + y * q.z - q.y * z; + const Type ty = w * q.y + q.w * y + z * q.x - q.z * x; + const Type tz = w * q.z + q.w * z + x * q.y - q.x * y; + + w = w * q.w - q.x * x - y * q.y - q.z * z; + x = tx; + y = ty; + z = tz; + return *this; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT& operator+=(const PxQuatT& q) + { + x += q.x; + y += q.y; + z += q.z; + w += q.w; + return *this; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT& operator-=(const PxQuatT& q) + { + x -= q.x; + y -= q.y; + z -= q.z; + w -= q.w; + return *this; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT& operator*=(const Type s) + { + x *= s; + y *= s; + z *= s; + w *= s; + return *this; + } + + /** quaternion multiplication */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT operator*(const PxQuatT& q) const + { + return PxQuatT(w * q.x + q.w * x + y * q.z - q.y * z, w * q.y + q.w * y + z * q.x - q.z * x, + w * q.z + q.w * z + x * q.y - q.x * y, w * q.w - x * q.x - y * q.y - z * q.z); + } + + /** quaternion addition */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT operator+(const PxQuatT& q) const + { + return PxQuatT(x + q.x, y + q.y, z + q.z, w + q.w); + } + + /** quaternion subtraction */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT operator-() const + { + return PxQuatT(-x, -y, -z, -w); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT operator-(const PxQuatT& q) const + { + return PxQuatT(x - q.x, y - q.y, z - q.z, w - q.w); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatT operator*(Type r) const + { + return PxQuatT(x * r, y * r, z * r, w * r); + } + + /** the quaternion elements */ + Type x, y, z, w; +}; + +typedef PxQuatT PxQuat; +typedef PxQuatT PxQuatd; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxSIMDHelpers.h b/engine/third_party/physx/include/foundation/PxSIMDHelpers.h new file mode 100644 index 00000000..8d29cc2f --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxSIMDHelpers.h @@ -0,0 +1,134 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SIMD_HELPERS_H +#define PX_SIMD_HELPERS_H + +#include "foundation/PxMat33.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxTransform.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + //! A padded version of PxMat33, to safely load its data using SIMD + class PxMat33Padded : public PxMat33 + { + public: + explicit PX_FORCE_INLINE PxMat33Padded(const PxQuat& q) + { + using namespace aos; + const QuatV qV = V4LoadU(&q.x); + Vec3V column0V, column1V, column2V; + QuatGetMat33V(qV, column0V, column1V, column2V); +#if defined(PX_SIMD_DISABLED) || (PX_LINUX && (PX_ARM || PX_A64)) + V3StoreU(column0V, column0); + V3StoreU(column1V, column1); + V3StoreU(column2V, column2); +#else + V4StoreU(column0V, &column0.x); + V4StoreU(column1V, &column1.x); + V4StoreU(column2V, &column2.x); +#endif + } + PX_FORCE_INLINE ~PxMat33Padded() {} + PX_FORCE_INLINE void operator=(const PxMat33& other) + { + column0 = other.column0; + column1 = other.column1; + column2 = other.column2; + } + PxU32 padding; + }; + +#if !PX_DOXYGEN +namespace aos +{ +#endif + + PX_FORCE_INLINE void transformKernelVec4( const FloatVArg wa, const Vec4VArg va, const Vec4VArg pa, + const FloatVArg wb, const Vec4VArg vb, const Vec4VArg pb, + FloatV& wo, Vec4V& vo, Vec4V& po) + { + wo = FSub(FMul(wa, wb), V4Dot3(va, vb)); + vo = V4ScaleAdd(va, wb, V4ScaleAdd(vb, wa, V4Cross(va, vb))); + + const Vec4V t1 = V4Scale(pb, FScaleAdd(wa, wa, FLoad(-0.5f))); + const Vec4V t2 = V4ScaleAdd(V4Cross(va, pb), wa, t1); + const Vec4V t3 = V4ScaleAdd(va, V4Dot3(va, pb), t2); + + po = V4ScaleAdd(t3, FLoad(2.0f), pa); + } + + // PT: out = a * b + template + PX_FORCE_INLINE void transformMultiply(PxTransform& out, const PxTransform& a, const PxTransform& b) + { + PX_ASSERT(!alignedInput || (size_t(&a)&15) == 0); + PX_ASSERT(!alignedInput || (size_t(&b)&15) == 0); + + const Vec4V aPos = alignedInput ? V4LoadA(&a.p.x) : V4LoadU(&a.p.x); + const Vec4V aRot = alignedInput ? V4LoadA(&a.q.x) : V4LoadU(&a.q.x); + + const Vec4V bPos = alignedInput ? V4LoadA(&b.p.x) : V4LoadU(&b.p.x); + const Vec4V bRot = alignedInput ? V4LoadA(&b.q.x) : V4LoadU(&b.q.x); + + Vec4V v, p; + FloatV w; + transformKernelVec4(V4GetW(aRot), aRot, aPos, V4GetW(bRot), bRot, bPos, w, v, p); + + if(alignedOutput) + { + PX_ASSERT((size_t(&out)&15) == 0); + V4StoreA(p, &out.p.x); + V4StoreA(V4SetW(v,w), &out.q.x); + } + else + { + V4StoreU(p, &out.p.x); + V4StoreU(V4SetW(v,w), &out.q.x); + } + } + + // PT: out = a * b + PX_FORCE_INLINE void transformMultiply(PxTransform32& out, const PxTransform32& a, const PxTransform32& b) + { + transformMultiply(out, a, b); + } + +#if !PX_DOXYGEN +} // namespace aos +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/foundation/PxSList.h b/engine/third_party/physx/include/foundation/PxSList.h new file mode 100644 index 00000000..a8a5894f --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxSList.h @@ -0,0 +1,132 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SLIST_H +#define PX_SLIST_H + +#include "foundation/PxAssert.h" +#include "foundation/PxAlignedMalloc.h" + +#if PX_P64_FAMILY + #define PX_SLIST_ALIGNMENT 16 +#else + #define PX_SLIST_ALIGNMENT 8 +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +#if PX_VC + #pragma warning(push) + #pragma warning(disable : 4324) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + +PX_ALIGN_PREFIX(PX_SLIST_ALIGNMENT) +class PxSListEntry +{ + friend struct PxSListImpl; + + public: + PxSListEntry() : mNext(NULL) + { + PX_ASSERT((size_t(this) & (PX_SLIST_ALIGNMENT - 1)) == 0); + } + + // Only use on elements returned by SList::flush() + // because the operation is not atomic. + PxSListEntry* next() + { + return mNext; + } + + private: + PxSListEntry* mNext; +}PX_ALIGN_SUFFIX(PX_SLIST_ALIGNMENT); + +#if PX_VC + #pragma warning(pop) +#endif + +// template-less implementation +struct PX_FOUNDATION_API PxSListImpl +{ + PxSListImpl(); + ~PxSListImpl(); + void push(PxSListEntry* entry); + PxSListEntry* pop(); + PxSListEntry* flush(); + static uint32_t getSize(); +}; + +template > +class PxSListT : protected Alloc +{ + public: + PxSListT(const Alloc& alloc = Alloc()) : Alloc(alloc) + { + mImpl = reinterpret_cast(Alloc::allocate(PxSListImpl::getSize(), PX_FL)); + PX_ASSERT((size_t(mImpl) & (PX_SLIST_ALIGNMENT - 1)) == 0); + PX_PLACEMENT_NEW(mImpl, PxSListImpl)(); + } + ~PxSListT() + { + mImpl->~PxSListImpl(); + Alloc::deallocate(mImpl); + } + + // pushes a new element to the list + void push(PxSListEntry& entry) + { + mImpl->push(&entry); + } + + // pops an element from the list + PxSListEntry* pop() + { + return mImpl->pop(); + } + + // removes all items from list, returns pointer to first element + PxSListEntry* flush() + { + return mImpl->flush(); + } + + private: + PxSListImpl* mImpl; +}; + +typedef PxSListT<> PxSList; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxSimpleTypes.h b/engine/third_party/physx/include/foundation/PxSimpleTypes.h new file mode 100644 index 00000000..d9c87f96 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxSimpleTypes.h @@ -0,0 +1,120 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SIMPLE_TYPES_H +#define PX_SIMPLE_TYPES_H + + +// Platform specific types: +// Design note: Its OK to use int for general loop variables and temps. + +#include "foundation/PxPreprocessor.h" +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4668) // suppressing warning generated by Microsoft Visual Studio when including this standard +// header +#endif + +#include +#if PX_VC +#pragma warning(pop) +#endif + +#if PX_VC // we could use inttypes.h starting with VC12 +#define PX_PRIu64 "I64u" +#else +#include +#define PX_PRIu64 PRIu64 +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +typedef int64_t PxI64; +typedef uint64_t PxU64; +typedef int32_t PxI32; +typedef uint32_t PxU32; +typedef int16_t PxI16; +typedef uint16_t PxU16; +typedef int8_t PxI8; +typedef uint8_t PxU8; +typedef float PxF32; +typedef double PxF64; +typedef float PxReal; +// Int-as-bool type - has some uses for efficiency and with SIMD +typedef PxI32 PxIntBool; +static const PxIntBool PxIntFalse = 0; +static const PxIntBool PxIntTrue = 1; + +// types for direct-GPU API +typedef PxU32 PxArticulationGPUIndex; +typedef PxU32 PxRigidDynamicGPUIndex; +typedef PxU32 PxShapeGPUIndex; + +typedef PxU32 PxConstraintGPUIndex; +#define PX_INVALID_CONSTRAINT_GPU_INDEX 0xffffFFFF + +typedef PxConstraintGPUIndex PxD6JointGPUIndex; +#define PX_INVALID_D6_JOINT_GPU_INDEX PX_INVALID_CONSTRAINT_GPU_INDEX + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#define PX_SIGN_BITMASK 0x80000000 + +// Type ranges + +#define PX_MAX_F32 3.4028234663852885981170418348452e+38F +// maximum possible float value +#define PX_MAX_F64 DBL_MAX // maximum possible double value + +#define PX_EPS_F32 FLT_EPSILON // maximum relative error of float rounding +#define PX_EPS_F64 DBL_EPSILON // maximum relative error of double rounding + +#define PX_MAX_REAL PX_MAX_F32 +#define PX_EPS_REAL PX_EPS_F32 +#define PX_NORMALIZATION_EPSILON float(1e-20f) + +// Legacy type ranges used by PhysX +#define PX_MAX_I8 INT8_MAX +#define PX_MIN_I8 INT8_MIN +#define PX_MAX_U8 UINT8_MAX +#define PX_MIN_U8 UINT8_MIN +#define PX_MAX_I16 INT16_MAX +#define PX_MIN_I16 INT16_MIN +#define PX_MAX_U16 UINT16_MAX +#define PX_MIN_U16 UINT16_MIN +#define PX_MAX_I32 INT32_MAX +#define PX_MIN_I32 INT32_MIN +#define PX_MAX_U32 UINT32_MAX +#define PX_MIN_U32 UINT32_MIN + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxSocket.h b/engine/third_party/physx/include/foundation/PxSocket.h new file mode 100644 index 00000000..25187926 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxSocket.h @@ -0,0 +1,187 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SOCKET_H +#define PX_SOCKET_H + +#include "foundation/PxUserAllocated.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +/** +Socket abstraction API +*/ + +class PX_FOUNDATION_API PxSocket : public PxUserAllocated +{ + public: + static const uint32_t DEFAULT_BUFFER_SIZE; + + PxSocket(bool inEnableBuffering = true, bool blocking = true); + + virtual ~PxSocket(); + + /*! + Opens a network socket for input and/or output + + \param host + Name of the host to connect to. This can be an IP, URL, etc + + \param port + The port to connect to on the remote host + + \param timeout + Timeout in ms until the connection must be established. + + \return + True if the connection was successful, false otherwise + */ + bool connect(const char* host, uint16_t port, uint32_t timeout = 1000); + + /*! + Opens a network socket for input and/or output as a server. Put the connection in listening mode + + \param port + The port on which the socket listens + */ + bool listen(uint16_t port); + + /*! + Accept a connection on a socket that is in listening mode + + \note + This method only supports a single connection client. Additional clients + that connect to the listening port will overwrite the existing socket handle. + + \param block + whether or not the call should block + + \return whether a connection was established + */ + bool accept(bool block); + + /*! + Disconnects an open socket + */ + void disconnect(); + + /*! + Returns whether the socket is currently open (connected) or not. + + \return + True if the socket is connected, false otherwise + */ + bool isConnected() const; + + /*! + Returns the name of the connected host. This is the same as the string + that was supplied to the connect call. + + \return + The name of the connected host + */ + const char* getHost() const; + + /*! + Returns the port of the connected host. This is the same as the port + that was supplied to the connect call. + + \return + The port of the connected host + */ + uint16_t getPort() const; + + /*! + Flushes the output stream. Until the stream is flushed, there is no + guarantee that the written data has actually reached the destination + storage. Flush forces all buffered data to be sent to the output. + + \note flush always blocks. If the socket is in non-blocking mode, this will result + the thread spinning. + + \return + True if the flush was successful, false otherwise + */ + bool flush(); + + /*! + Writes data to the output stream. + + \param data + Pointer to a block of data to write to the stream + + \param length + Amount of data to write, in bytes + + \return + Number of bytes actually written. This could be lower than length if the socket is non-blocking. + */ + + uint32_t write(const uint8_t* data, uint32_t length); + + /*! + Reads data from the output stream. + + \param data + Pointer to a buffer where the read data will be stored. + + \param length + Amount of data to read, in bytes. + + \return + Number of bytes actually read. This could be lower than length if the stream end is + encountered or the socket is non-blocking. + */ + uint32_t read(uint8_t* data, uint32_t length); + + /*! + Sets blocking mode of the socket. + Socket must be connected, otherwise calling this method won't take any effect. + */ + void setBlocking(bool blocking); + + /*! + Returns whether read/write/flush calls to the socket are blocking. + + \return + True if the socket is blocking. + */ + bool isBlocking() const; + + private: + class SocketImpl* mImpl; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxSort.h b/engine/third_party/physx/include/foundation/PxSort.h new file mode 100644 index 00000000..f8925683 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxSort.h @@ -0,0 +1,127 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SORT_H +#define PX_SORT_H + + +#include "foundation/PxSortInternals.h" +#include "foundation/PxAlloca.h" + +#define PX_SORT_PARANOIA PX_DEBUG + +/** +\brief Sorts an array of objects in ascending order, assuming +that the predicate implements the < operator: + +\see PxLess, PxGreater +*/ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4706) // disable the warning that we did an assignment within a conditional expression, as +// this was intentional. +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +template +void PxSort(T* elements, uint32_t count, const Predicate& compare, const PxAllocator& inAllocator, + const uint32_t initialStackSize = 32) +{ + static const uint32_t SMALL_SORT_CUTOFF = 5; // must be >= 3 since we need 3 for median + + PX_ALLOCA(stackMem, int32_t, initialStackSize); + PxStack stack(stackMem, initialStackSize, inAllocator); + + int32_t first = 0, last = int32_t(count - 1); + if(last > first) + { + for(;;) + { + while(last > first) + { + PX_ASSERT(first >= 0 && last < int32_t(count)); + if(uint32_t(last - first) < SMALL_SORT_CUTOFF) + { + PxSmallSort(elements, first, last, compare); + break; + } + else + { + const int32_t partIndex = PxPartition(elements, first, last, compare); + + // push smaller sublist to minimize stack usage + if((partIndex - first) < (last - partIndex)) + { + stack.push(first, partIndex - 1); + first = partIndex + 1; + } + else + { + stack.push(partIndex + 1, last); + last = partIndex - 1; + } + } + } + + if(stack.empty()) + break; + + stack.pop(first, last); + } + } +#if PX_SORT_PARANOIA + for(uint32_t i = 1; i < count; i++) + PX_ASSERT(!compare(elements[i], elements[i - 1])); +#endif +} + +template +void PxSort(T* elements, uint32_t count, const Predicate& compare) +{ + PxSort(elements, count, compare, typename PxAllocatorTraits::Type()); +} + +template +void PxSort(T* elements, uint32_t count) +{ + PxSort(elements, count, PxLess(), typename PxAllocatorTraits::Type()); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#if PX_VC +#pragma warning(pop) +#endif +#endif + diff --git a/engine/third_party/physx/include/foundation/PxSortInternals.h b/engine/third_party/physx/include/foundation/PxSortInternals.h new file mode 100644 index 00000000..4b37e5cf --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxSortInternals.h @@ -0,0 +1,182 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SORT_INTERNALS_H +#define PX_SORT_INTERNALS_H + + +#include "foundation/PxAssert.h" +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxUserAllocated.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +template +PX_INLINE void PxMedian3(T* elements, int32_t first, int32_t last, Predicate& compare) +{ + /* + This creates sentinels because we know there is an element at the start minimum(or equal) + than the pivot and an element at the end greater(or equal) than the pivot. Plus the + median of 3 reduces the chance of degenerate behavour. + */ + + int32_t mid = (first + last) / 2; + + if(compare(elements[mid], elements[first])) + PxSwap(elements[first], elements[mid]); + + if(compare(elements[last], elements[first])) + PxSwap(elements[first], elements[last]); + + if(compare(elements[last], elements[mid])) + PxSwap(elements[mid], elements[last]); + + // keep the pivot at last-1 + PxSwap(elements[mid], elements[last - 1]); +} + +template +PX_INLINE int32_t PxPartition(T* elements, int32_t first, int32_t last, Predicate& compare) +{ + PxMedian3(elements, first, last, compare); + + /* + WARNING: using the line: + + T partValue = elements[last-1]; + + and changing the scan loops to: + + while(comparator.greater(partValue, elements[++i])); + while(comparator.greater(elements[--j], partValue); + + triggers a compiler optimizer bug on xenon where it stores a double to the stack for partValue + then loads it as a single...:-( + */ + + int32_t i = first; // we know first is less than pivot(but i gets pre incremented) + int32_t j = last - 1; // pivot is in last-1 (but j gets pre decremented) + + for(;;) + { + while(compare(elements[++i], elements[last - 1])) + ; + while(compare(elements[last - 1], elements[--j])) + ; + + if(i >= j) + break; + + PX_ASSERT(i <= last && j >= first); + PxSwap(elements[i], elements[j]); + } + // put the pivot in place + + PX_ASSERT(i <= last && first <= (last - 1)); + PxSwap(elements[i], elements[last - 1]); + + return i; +} + +template +PX_INLINE void PxSmallSort(T* elements, int32_t first, int32_t last, Predicate& compare) +{ + // selection sort - could reduce to fsel on 360 with floats. + + for(int32_t i = first; i < last; i++) + { + int32_t m = i; + for(int32_t j = i + 1; j <= last; j++) + if(compare(elements[j], elements[m])) + m = j; + + if(m != i) + PxSwap(elements[m], elements[i]); + } +} + +template +class PxStack +{ + PxAllocator mAllocator; + uint32_t mSize, mCapacity; + int32_t* mMemory; + bool mRealloc; + + public: + PxStack(int32_t* memory, uint32_t capacity, const PxAllocator& inAllocator) + : mAllocator(inAllocator), mSize(0), mCapacity(capacity), mMemory(memory), mRealloc(false) + { + } + ~PxStack() + { + if(mRealloc) + mAllocator.deallocate(mMemory); + } + + void grow() + { + mCapacity *= 2; + int32_t* newMem = + reinterpret_cast(mAllocator.allocate(sizeof(int32_t) * mCapacity, PX_FL)); + intrinsics::memCopy(newMem, mMemory, mSize * sizeof(int32_t)); + if(mRealloc) + mAllocator.deallocate(mMemory); + mRealloc = true; + mMemory = newMem; + } + + PX_INLINE void push(int32_t start, int32_t end) + { + if(mSize >= mCapacity - 1) + grow(); + mMemory[mSize++] = start; + mMemory[mSize++] = end; + } + + PX_INLINE void pop(int32_t& start, int32_t& end) + { + PX_ASSERT(!empty()); + end = mMemory[--mSize]; + start = mMemory[--mSize]; + } + + PX_INLINE bool empty() + { + return mSize == 0; + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif +#endif + diff --git a/engine/third_party/physx/include/foundation/PxStrideIterator.h b/engine/third_party/physx/include/foundation/PxStrideIterator.h new file mode 100644 index 00000000..933e338f --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxStrideIterator.h @@ -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_STRIDE_ITERATOR_H +#define PX_STRIDE_ITERATOR_H + +#include "foundation/PxAssert.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Iterator class for iterating over arrays of data that may be interleaved with other data. + +This class is used for iterating over arrays of elements that may have a larger element to element +offset, called the stride, than the size of the element itself (non-contiguous). + +The template parameter T denotes the type of the element accessed. The stride itself +is stored as a member field so multiple instances of a PxStrideIterator class can have +different strides. This is useful for cases were the stride depends on runtime configuration. + +The stride iterator can be used for index based access, e.g.: +\code + PxStrideIterator strideArray(...); + for (unsigned i = 0; i < 10; ++i) + { + PxVec3& vec = strideArray[i]; + ... + } +\endcode +or iteration by increment, e.g.: +\code + PxStrideIterator strideBegin(...); + PxStrideIterator strideEnd(strideBegin + 10); + for (PxStrideIterator it = strideBegin; it < strideEnd; ++it) + { + PxVec3& vec = *it; + ... + } +\endcode + +Two special cases: +- A stride of sizeof(T) represents a regular c array of type T. +- A stride of 0 can be used to describe re-occurrence of the same element multiple times. + +*/ +template +class PxStrideIterator +{ + +#if !PX_DOXYGEN + template + struct StripConst + { + typedef X Type; + }; + + template + struct StripConst + { + typedef X Type; + }; +#endif + + public: + /** + \brief Constructor. + + Optionally takes a pointer to an element and a stride. + + \param[in] ptr pointer to element, defaults to NULL. + \param[in] stride stride for accessing consecutive elements, defaults to the size of one element. + */ + explicit PX_INLINE PxStrideIterator(T* ptr = NULL, PxU32 stride = sizeof(T)) : mPtr(ptr), mStride(stride) + { + PX_ASSERT(mStride == 0 || sizeof(T) <= mStride); + } + + /** + \brief Copy constructor. + + \param[in] strideIterator PxStrideIterator to be copied. + */ + PX_INLINE PxStrideIterator(const PxStrideIterator::Type>& strideIterator) + : mPtr(strideIterator.ptr()), mStride(strideIterator.stride()) + { + PX_ASSERT(mStride == 0 || sizeof(T) <= mStride); + } + + /** + \brief Get pointer to element. + */ + PX_INLINE T* ptr() const + { + return mPtr; + } + + /** + \brief Get stride. + */ + PX_INLINE PxU32 stride() const + { + return mStride; + } + + /** + \brief Indirection operator. + */ + PX_INLINE T& operator*() const + { + return *mPtr; + } + + /** + \brief Dereferencing operator. + */ + PX_INLINE T* operator->() const + { + return mPtr; + } + + /** + \brief Indexing operator. + */ + PX_INLINE T& operator[](unsigned int i) const + { + return *byteAdd(mPtr, i * stride()); + } + + /** + \brief Pre-increment operator. + */ + PX_INLINE PxStrideIterator& operator++() + { + mPtr = byteAdd(mPtr, stride()); + return *this; + } + + /** + \brief Post-increment operator. + */ + PX_INLINE PxStrideIterator operator++(int) + { + PxStrideIterator tmp = *this; + mPtr = byteAdd(mPtr, stride()); + return tmp; + } + + /** + \brief Pre-decrement operator. + */ + PX_INLINE PxStrideIterator& operator--() + { + mPtr = byteSub(mPtr, stride()); + return *this; + } + + /** + \brief Post-decrement operator. + */ + PX_INLINE PxStrideIterator operator--(int) + { + PxStrideIterator tmp = *this; + mPtr = byteSub(mPtr, stride()); + return tmp; + } + + /** + \brief Addition operator. + */ + PX_INLINE PxStrideIterator operator+(unsigned int i) const + { + return PxStrideIterator(byteAdd(mPtr, i * stride()), stride()); + } + + /** + \brief Subtraction operator. + */ + PX_INLINE PxStrideIterator operator-(unsigned int i) const + { + return PxStrideIterator(byteSub(mPtr, i * stride()), stride()); + } + + /** + \brief Addition compound assignment operator. + */ + PX_INLINE PxStrideIterator& operator+=(unsigned int i) + { + mPtr = byteAdd(mPtr, i * stride()); + return *this; + } + + /** + \brief Subtraction compound assignment operator. + */ + PX_INLINE PxStrideIterator& operator-=(unsigned int i) + { + mPtr = byteSub(mPtr, i * stride()); + return *this; + } + + /** + \brief Iterator difference. + */ + PX_INLINE int operator-(const PxStrideIterator& other) const + { + PX_ASSERT(isCompatible(other)); + int byteDiff = static_cast(reinterpret_cast(mPtr) - reinterpret_cast(other.mPtr)); + return byteDiff / static_cast(stride()); + } + + /** + \brief Equality operator. + */ + PX_INLINE bool operator==(const PxStrideIterator& other) const + { + PX_ASSERT(isCompatible(other)); + return mPtr == other.mPtr; + } + + /** + \brief Inequality operator. + */ + PX_INLINE bool operator!=(const PxStrideIterator& other) const + { + PX_ASSERT(isCompatible(other)); + return mPtr != other.mPtr; + } + + /** + \brief Less than operator. + */ + PX_INLINE bool operator<(const PxStrideIterator& other) const + { + PX_ASSERT(isCompatible(other)); + return mPtr < other.mPtr; + } + + /** + \brief Greater than operator. + */ + PX_INLINE bool operator>(const PxStrideIterator& other) const + { + PX_ASSERT(isCompatible(other)); + return mPtr > other.mPtr; + } + + /** + \brief Less or equal than operator. + */ + PX_INLINE bool operator<=(const PxStrideIterator& other) const + { + PX_ASSERT(isCompatible(other)); + return mPtr <= other.mPtr; + } + + /** + \brief Greater or equal than operator. + */ + PX_INLINE bool operator>=(const PxStrideIterator& other) const + { + PX_ASSERT(isCompatible(other)); + return mPtr >= other.mPtr; + } + + private: + PX_INLINE static T* byteAdd(T* ptr, PxU32 bytes) + { + return const_cast(reinterpret_cast(reinterpret_cast(ptr) + bytes)); + } + + PX_INLINE static T* byteSub(T* ptr, PxU32 bytes) + { + return const_cast(reinterpret_cast(reinterpret_cast(ptr) - bytes)); + } + + PX_INLINE bool isCompatible(const PxStrideIterator& other) const + { + int byteDiff = static_cast(reinterpret_cast(mPtr) - reinterpret_cast(other.mPtr)); + return (stride() == other.stride()) && (abs(byteDiff) % stride() == 0); + } + + T* mPtr; + PxU32 mStride; +}; + +/** +\brief Addition operator. +*/ +template +PX_INLINE PxStrideIterator operator+(int i, PxStrideIterator it) +{ + it += i; + return it; +} + +/** +\brief Stride iterator factory function which infers the iterator type. +*/ +template +PX_INLINE PxStrideIterator PxMakeIterator(T* ptr, PxU32 stride = sizeof(T)) +{ + return PxStrideIterator(ptr, stride); +} + +/** +\brief Stride iterator factory function which infers the iterator type. +*/ +template +PX_INLINE PxStrideIterator PxMakeIterator(const T* ptr, PxU32 stride = sizeof(T)) +{ + return PxStrideIterator(ptr, stride); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxString.h b/engine/third_party/physx/include/foundation/PxString.h new file mode 100644 index 00000000..916bf3a2 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxString.h @@ -0,0 +1,79 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_STRING_H +#define PX_STRING_H + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxFoundationConfig.h" +#include + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +// the following functions have C99 semantics. Note that C99 requires for snprintf and vsnprintf: +// * the resulting string is always NULL-terminated regardless of truncation. +// * in the case of truncation the return value is the number of characters that would have been created. + +PX_FOUNDATION_API int32_t Pxsscanf(const char* buffer, const char* format, ...); +PX_FOUNDATION_API int32_t Pxstrcmp(const char* str1, const char* str2); +PX_FOUNDATION_API int32_t Pxstrncmp(const char* str1, const char* str2, size_t count); +PX_FOUNDATION_API int32_t Pxsnprintf(char* dst, size_t dstSize, const char* format, ...); +PX_FOUNDATION_API int32_t Pxvsnprintf(char* dst, size_t dstSize, const char* src, va_list arg); + +// strlcat and strlcpy have BSD semantics: +// * dstSize is always the size of the destination buffer +// * the resulting string is always NULL-terminated regardless of truncation +// * in the case of truncation the return value is the length of the string that would have been created + +PX_FOUNDATION_API size_t Pxstrlcat(char* dst, size_t dstSize, const char* src); +PX_FOUNDATION_API size_t Pxstrlcpy(char* dst, size_t dstSize, const char* src); + +// case-insensitive string comparison +PX_FOUNDATION_API int32_t Pxstricmp(const char* str1, const char* str2); +PX_FOUNDATION_API int32_t Pxstrnicmp(const char* str1, const char* str2, size_t count); + +// in-place string case conversion +PX_FOUNDATION_API void Pxstrlwr(char* str); +PX_FOUNDATION_API void Pxstrupr(char* str); + + +/** +\brief Prints the string literally (does not consume % specifier), trying to make sure it's visible to the app +programmer +*/ +PX_FOUNDATION_API void PxPrintString(const char*); + +#if !PX_DOXYGEN +} // namespace physx +#endif +#endif + diff --git a/engine/third_party/physx/include/foundation/PxSync.h b/engine/third_party/physx/include/foundation/PxSync.h new file mode 100644 index 00000000..4c7fe9fc --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxSync.h @@ -0,0 +1,139 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SYNC_H +#define PX_SYNC_H + +#include "foundation/PxAllocator.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +/*! +Implementation notes: +* - Calling set() on an already signaled Sync does not change its state. +* - Calling reset() on an already reset Sync does not change its state. +* - Calling set() on a reset Sync wakes all waiting threads (potential for thread contention). +* - Calling wait() on an already signaled Sync will return true immediately. +* - NOTE: be careful when pulsing an event with set() followed by reset(), because a +* thread that is not waiting on the event will miss the signal. +*/ +class PX_FOUNDATION_API PxSyncImpl +{ + public: + static const uint32_t waitForever = 0xffffffff; + + PxSyncImpl(); + + ~PxSyncImpl(); + + /** Wait on the object for at most the given number of ms. Returns + * true if the object is signaled. Sync::waitForever will block forever + * or until the object is signaled. + */ + + bool wait(uint32_t milliseconds = waitForever); + + /** Signal the synchronization object, waking all threads waiting on it */ + + void set(); + + /** Reset the synchronization object */ + + void reset(); + + /** + Size of this class. + */ + static uint32_t getSize(); +}; + +/*! +Implementation notes: +* - Calling set() on an already signaled Sync does not change its state. +* - Calling reset() on an already reset Sync does not change its state. +* - Calling set() on a reset Sync wakes all waiting threads (potential for thread contention). +* - Calling wait() on an already signaled Sync will return true immediately. +* - NOTE: be careful when pulsing an event with set() followed by reset(), because a +* thread that is not waiting on the event will miss the signal. +*/ +template > +class PxSyncT : protected Alloc +{ + public: + static const uint32_t waitForever = PxSyncImpl::waitForever; + + PxSyncT(const Alloc& alloc = Alloc()) : Alloc(alloc) + { + mImpl = reinterpret_cast(Alloc::allocate(PxSyncImpl::getSize(), PX_FL)); + PX_PLACEMENT_NEW(mImpl, PxSyncImpl)(); + } + + ~PxSyncT() + { + mImpl->~PxSyncImpl(); + Alloc::deallocate(mImpl); + } + + /** Wait on the object for at most the given number of ms. Returns + * true if the object is signaled. Sync::waitForever will block forever + * or until the object is signaled. + */ + + bool wait(uint32_t milliseconds = PxSyncImpl::waitForever) + { + return mImpl->wait(milliseconds); + } + + /** Signal the synchronization object, waking all threads waiting on it */ + + void set() + { + mImpl->set(); + } + + /** Reset the synchronization object */ + + void reset() + { + mImpl->reset(); + } + + private: + class PxSyncImpl* mImpl; +}; + +typedef PxSyncT<> PxSync; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxTempAllocator.h b/engine/third_party/physx/include/foundation/PxTempAllocator.h new file mode 100644 index 00000000..1744191f --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxTempAllocator.h @@ -0,0 +1,54 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_TEMP_ALLOCATOR_H +#define PX_TEMP_ALLOCATOR_H + +#include "foundation/PxAllocator.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxTempAllocator +{ + public: + PX_FORCE_INLINE PxTempAllocator(const char* = 0) + { + } + PX_FOUNDATION_API void* allocate(size_t size, const char* file, PxI32 line); + PX_FOUNDATION_API void deallocate(void* ptr); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxThread.h b/engine/third_party/physx/include/foundation/PxThread.h new file mode 100644 index 00000000..eaca9fce --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxThread.h @@ -0,0 +1,369 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_THREAD_H +#define PX_THREAD_H + +#include "foundation/PxUserAllocated.h" + +// todo: these need to go somewhere else +// PT: looks like this is still used on some platforms + +#if PX_WINDOWS_FAMILY +#define PxSpinLockPause() __asm pause +#elif PX_LINUX || PX_APPLE_FAMILY || PX_SWITCH +#define PxSpinLockPause() asm("nop") +#else +#error "Platform not supported!" +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxThreadPriority +{ + enum Enum + { + eHIGH = 0, //!< High priority + eABOVE_NORMAL = 1, //!< Above Normal priority + eNORMAL = 2, //!< Normal/default priority + eBELOW_NORMAL = 3, //!< Below Normal priority + eLOW = 4, //!< Low priority. + eFORCE_DWORD = 0xffFFffFF + }; +}; + +class PxRunnable +{ + public: + PxRunnable() {} + virtual ~PxRunnable() {} + virtual void execute() {} +}; + +class PX_FOUNDATION_API PxThreadImpl +{ + public: + typedef size_t Id; // space for a pointer or an integer + typedef void* (*ExecuteFn)(void*); + + static PxU32 getDefaultStackSize(); + static Id getId(); + + /** + Construct (but do not start) the thread object. The OS thread object will not be created + until start() is called. Executes in the context + of the spawning thread. + */ + + PxThreadImpl(); + + /** + Construct and start the the thread, passing the given arg to the given fn. (pthread style) + */ + + PxThreadImpl(ExecuteFn fn, void* arg, const char* name); + + /** + Deallocate all resources associated with the thread. Should be called in the + context of the spawning thread. + */ + + ~PxThreadImpl(); + + /** + Create the OS thread and start it running. Called in the context of the spawning thread. + If an affinity mask has previously been set then it will be applied after the + thread has been created. + */ + + void start(PxU32 stackSize, PxRunnable* r); + + /** + Violently kill the current thread. Blunt instrument, not recommended since + it can leave all kinds of things unreleased (stack, memory, mutexes...) Should + be called in the context of the spawning thread. + */ + + void kill(); + + /** + Stop the thread. Signals the spawned thread that it should stop, so the + thread should check regularly + */ + + void signalQuit(); + + /** + Wait for a thread to stop. Should be called in the context of the spawning + thread. Returns false if the thread has not been started. + */ + + bool waitForQuit(); + + /** + check whether the thread is signalled to quit. Called in the context of the + spawned thread. + */ + + bool quitIsSignalled(); + + /** + Cleanly shut down this thread. Called in the context of the spawned thread. + */ + void quit(); + + /** + Change the affinity mask for this thread. The mask is a platform + specific value. + + On Windows, Linux, and Switch platforms, each set mask bit represents + the index of a logical processor that the OS may schedule thread execution on. + Bits outside the range of valid logical processors may be ignored or cause + the function to return an error. + + On Apple platforms, this function has no effect. + + If the thread has not yet been started then the mask is stored + and applied when the thread is started. + + If the thread has already been started then this method returns the + previous affinity mask on success, otherwise it returns zero. + */ + PxU32 setAffinityMask(PxU32 mask); + + static PxThreadPriority::Enum getPriority(Id threadId); + + /** Set thread priority. */ + void setPriority(PxThreadPriority::Enum prio); + + /** set the thread's name */ + void setName(const char* name); + + /** Put the current thread to sleep for the given number of milliseconds */ + static void sleep(PxU32 ms); + + /** Yield the current thread's slot on the CPU */ + static void yield(); + + /** Inform the processor that we're in a busy wait to give it a chance to do something clever. + yield() yields the thread, while yieldProcessor() aims to yield the processor */ + static void yieldProcessor(); + + /** Return the number of physical cores (does not include hyper-threaded cores), returns 0 on failure */ + static PxU32 getNbPhysicalCores(); + + /** + Size of this class. + */ + static PxU32 getSize(); +}; + +/** +Thread abstraction API +*/ +template > +class PxThreadT : protected Alloc, public PxUserAllocated, public PxRunnable +{ + public: + typedef PxThreadImpl::Id Id; // space for a pointer or an integer + + /** + Construct (but do not start) the thread object. Executes in the context + of the spawning thread + */ + PxThreadT(const Alloc& alloc = Alloc()) : Alloc(alloc) + { + mImpl = reinterpret_cast(Alloc::allocate(PxThreadImpl::getSize(), PX_FL)); + PX_PLACEMENT_NEW(mImpl, PxThreadImpl)(); + } + + /** + Construct and start the the thread, passing the given arg to the given fn. (pthread style) + */ + PxThreadT(PxThreadImpl::ExecuteFn fn, void* arg, const char* name, const Alloc& alloc = Alloc()) : Alloc(alloc) + { + mImpl = reinterpret_cast(Alloc::allocate(PxThreadImpl::getSize(), PX_FL)); + PX_PLACEMENT_NEW(mImpl, PxThreadImpl)(fn, arg, name); + } + + /** + Deallocate all resources associated with the thread. Should be called in the + context of the spawning thread. + */ + virtual ~PxThreadT() + { + mImpl->~PxThreadImpl(); + Alloc::deallocate(mImpl); + } + + /** + start the thread running. Called in the context of the spawning thread. + */ + + void start(PxU32 stackSize = PxThreadImpl::getDefaultStackSize()) + { + mImpl->start(stackSize, this); + } + + /** + Violently kill the current thread. Blunt instrument, not recommended since + it can leave all kinds of things unreleased (stack, memory, mutexes...) Should + be called in the context of the spawning thread. + */ + + void kill() + { + mImpl->kill(); + } + + /** + The virtual execute() method is the user defined function that will + run in the new thread. Called in the context of the spawned thread. + */ + + virtual void execute() + { + } + + /** + stop the thread. Signals the spawned thread that it should stop, so the + thread should check regularly + */ + + void signalQuit() + { + mImpl->signalQuit(); + } + + /** + Wait for a thread to stop. Should be called in the context of the spawning + thread. Returns false if the thread has not been started. + */ + + bool waitForQuit() + { + return mImpl->waitForQuit(); + } + + /** + check whether the thread is signalled to quit. Called in the context of the + spawned thread. + */ + + bool quitIsSignalled() + { + return mImpl->quitIsSignalled(); + } + + /** + Cleanly shut down this thread. Called in the context of the spawned thread. + */ + void quit() + { + mImpl->quit(); + } + + PxU32 setAffinityMask(PxU32 mask) + { + return mImpl->setAffinityMask(mask); + } + + static PxThreadPriority::Enum getPriority(PxThreadImpl::Id threadId) + { + return PxThreadImpl::getPriority(threadId); + } + + /** Set thread priority. */ + void setPriority(PxThreadPriority::Enum prio) + { + mImpl->setPriority(prio); + } + + /** set the thread's name */ + void setName(const char* name) + { + mImpl->setName(name); + } + + /** Put the current thread to sleep for the given number of milliseconds */ + static void sleep(PxU32 ms) + { + PxThreadImpl::sleep(ms); + } + + /** Yield the current thread's slot on the CPU */ + static void yield() + { + PxThreadImpl::yield(); + } + + /** Inform the processor that we're in a busy wait to give it a chance to do something clever + yield() yields the thread, while yieldProcessor() aims to yield the processor */ + static void yieldProcesor() + { + PxThreadImpl::yieldProcessor(); + } + + static PxU32 getDefaultStackSize() + { + return PxThreadImpl::getDefaultStackSize(); + } + + static PxThreadImpl::Id getId() + { + return PxThreadImpl::getId(); + } + + static PxU32 getNbPhysicalCores() + { + return PxThreadImpl::getNbPhysicalCores(); + } + + private: + class PxThreadImpl* mImpl; +}; + +typedef PxThreadT<> PxThread; + +PX_FOUNDATION_API PxU32 PxTlsAlloc(); +PX_FOUNDATION_API void PxTlsFree(PxU32 index); +PX_FOUNDATION_API void* PxTlsGet(PxU32 index); +PX_FOUNDATION_API size_t PxTlsGetValue(PxU32 index); +PX_FOUNDATION_API PxU32 PxTlsSet(PxU32 index, void* value); +PX_FOUNDATION_API PxU32 PxTlsSetValue(PxU32 index, size_t value); + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxTime.h b/engine/third_party/physx/include/foundation/PxTime.h new file mode 100644 index 00000000..7a94a4e7 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxTime.h @@ -0,0 +1,97 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_TIME_H +#define PX_TIME_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxFoundationConfig.h" + +#if PX_LINUX +#include +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxCounterFrequencyToTensOfNanos +{ + PxU64 mNumerator; + PxU64 mDenominator; + PxCounterFrequencyToTensOfNanos(PxU64 inNum, PxU64 inDenom) : mNumerator(inNum), mDenominator(inDenom) + { + } + + // quite slow. + PxU64 toTensOfNanos(PxU64 inCounter) const + { + return (inCounter * mNumerator) / mDenominator; + } +}; + +class PX_FOUNDATION_API PxTime +{ + public: + typedef PxF64 Second; + static const PxU64 sNumTensOfNanoSecondsInASecond = 100000000; + // This is supposedly guaranteed to not change after system boot + // regardless of processors, speedstep, etc. + static const PxCounterFrequencyToTensOfNanos& getBootCounterFrequency(); + + static PxCounterFrequencyToTensOfNanos getCounterFrequency(); + + static PxU64 getCurrentCounterValue(); + + // SLOW!! + // Thar be a 64 bit divide in thar! + static PxU64 getCurrentTimeInTensOfNanoSeconds() + { + PxU64 ticks = getCurrentCounterValue(); + return getBootCounterFrequency().toTensOfNanos(ticks); + } + + PxTime(); + Second getElapsedSeconds(); + Second peekElapsedSeconds(); + Second getLastTime() const; + + private: +#if PX_LINUX || PX_APPLE_FAMILY + Second mLastTime; +#else + PxI64 mTickCount; +#endif +}; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxTransform.h b/engine/third_party/physx/include/foundation/PxTransform.h new file mode 100644 index 00000000..3abc05ed --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxTransform.h @@ -0,0 +1,261 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_TRANSFORM_H +#define PX_TRANSFORM_H + +#include "foundation/PxQuat.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + +template class PxMat44T; + +/*! +\brief class representing a rigid euclidean transform as a quaternion and a vector +*/ + +template +class PxTransformT +{ + public: + PxQuatT q; + PxVec3T p; + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransformT() + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE explicit PxTransformT(PxIDENTITY) : q(PxIdentity), p(PxZero) + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE explicit PxTransformT(const PxVec3T& position) : q(PxIdentity), p(position) + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE explicit PxTransformT(const PxQuatT& orientation) : q(orientation), p(Type(0)) + { + PX_ASSERT(orientation.isSane()); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransformT(Type x, Type y, Type z, PxQuatT aQ = PxQuatT(PxIdentity)) : q(aQ), p(x, y, z) + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransformT(const PxVec3T& p0, const PxQuatT& q0) : q(q0), p(p0) + { + PX_ASSERT(q0.isSane()); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE explicit PxTransformT(const PxMat44T& m); // defined in PxMat44.h + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransformT(const PxTransformT& other) + { + p = other.p; + q = other.q; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator=(const PxTransformT& other) + { + p = other.p; + q = other.q; + } + + /** + \brief returns true if the two transforms are exactly equal + */ + PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxTransformT& t) const + { + return p == t.p && q == t.q; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransformT operator*(const PxTransformT& x) const + { + PX_ASSERT(x.isSane()); + return transform(x); + } + + //! Equals matrix multiplication + PX_CUDA_CALLABLE PX_INLINE PxTransformT& operator*=(const PxTransformT& other) + { + *this = *this * other; + return *this; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransformT getInverse() const + { + PX_ASSERT(isFinite()); + return PxTransformT(q.rotateInv(-p), q.getConjugate()); + } + + /** + \brief return a normalized transform (i.e. one in which the quaternion has unit magnitude) + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransformT getNormalized() const + { + return PxTransformT(p, q.getNormalized()); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T transform(const PxVec3T& input) const + { + PX_ASSERT(isFinite()); + return q.rotate(input) + p; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T transformInv(const PxVec3T& input) const + { + PX_ASSERT(isFinite()); + return q.rotateInv(input - p); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T rotate(const PxVec3T& input) const + { + PX_ASSERT(isFinite()); + return q.rotate(input); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T rotateInv(const PxVec3T& input) const + { + PX_ASSERT(isFinite()); + return q.rotateInv(input); + } + + //! Transform transform to parent (returns compound transform: first src, then *this) + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransformT transform(const PxTransformT& src) const + { + PX_ASSERT(src.isSane()); + PX_ASSERT(isSane()); + // src = [srct, srcr] -> [r*srct + t, r*srcr] + return PxTransformT(q.rotate(src.p) + p, q * src.q); + } + + //! Transform transform from parent (returns compound transform: first src, then this->inverse) + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransformT transformInv(const PxTransformT& src) const + { + PX_ASSERT(src.isSane()); + PX_ASSERT(isFinite()); + // src = [srct, srcr] -> [r^-1*(srct-t), r^-1*srcr] + const PxQuatT qinv = q.getConjugate(); + return PxTransformT(qinv.rotate(src.p - p), qinv * src.q); + } + + /** + \brief returns true if finite and q is a unit quaternion + */ + PX_CUDA_CALLABLE bool isValid() const + { + return p.isFinite() && q.isFinite() && q.isUnit(); + } + + /** + \brief returns true if finite and quat magnitude is reasonably close to unit to allow for some accumulation of error + vs isValid + */ + PX_CUDA_CALLABLE bool isSane() const + { + return isFinite() && q.isSane(); + } + + /** + \brief returns true if all elems are finite (not NAN or INF, etc.) + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite() const + { + return p.isFinite() && q.isFinite(); + } +}; + +typedef PxTransformT PxTransform; +typedef PxTransformT PxTransformd; + +/*! +\brief A generic padded & aligned transform class. + +This can be used for safe faster loads & stores, and faster address computations +(the default PxTransformT often generating imuls for this otherwise). Padding bytes +can be reused to store useful data if needed. +*/ +struct PX_ALIGN_PREFIX(16) PxTransformPadded : PxTransform +{ + PX_FORCE_INLINE PxTransformPadded() + { + } + + PX_FORCE_INLINE PxTransformPadded(const PxTransformPadded& other) : PxTransform(other) + { + } + + PX_FORCE_INLINE explicit PxTransformPadded(const PxTransform& other) : PxTransform(other) + { + } + + PX_FORCE_INLINE explicit PxTransformPadded(PxIDENTITY) : PxTransform(PxIdentity) + { + } + + PX_FORCE_INLINE explicit PxTransformPadded(const PxVec3& position) : PxTransform(position) + { + } + + PX_FORCE_INLINE explicit PxTransformPadded(const PxQuat& orientation) : PxTransform(orientation) + { + } + + PX_FORCE_INLINE PxTransformPadded(const PxVec3& p0, const PxQuat& q0) : PxTransform(p0, q0) + { + } + + PX_FORCE_INLINE void operator=(const PxTransformPadded& other) + { + p = other.p; + q = other.q; + } + + PX_FORCE_INLINE void operator=(const PxTransform& other) + { + p = other.p; + q = other.q; + } + + PxU32 padding; +} +PX_ALIGN_SUFFIX(16); +PX_COMPILE_TIME_ASSERT(sizeof(PxTransformPadded)==32); + +typedef PxTransformPadded PxTransform32; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxUnionCast.h b/engine/third_party/physx/include/foundation/PxUnionCast.h new file mode 100644 index 00000000..50d041fd --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxUnionCast.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_UNION_CAST_H +#define PX_UNION_CAST_H + +#include "foundation/PxPreprocessor.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +// Needed for clang 7 +#if PX_CLANG && PX_CLANG_MAJOR >= 7 + #define USE_VOLATILE_UNION volatile +#else + #define USE_VOLATILE_UNION +#endif + +template +PX_FORCE_INLINE A PxUnionCast(B b) +{ + union AB + { + AB(B bb) : _b(bb) + { + } + B _b; + A _a; + } USE_VOLATILE_UNION u(b); + return u._a; +} + +#undef USE_VOLATILE_UNION + +#if !PX_DOXYGEN +} // namespace physx +#endif + + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxUserAllocated.h b/engine/third_party/physx/include/foundation/PxUserAllocated.h new file mode 100644 index 00000000..41e416b9 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxUserAllocated.h @@ -0,0 +1,116 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_USER_ALLOCATED_H +#define PX_USER_ALLOCATED_H + +#include "PxAllocator.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + /** + Provides new and delete using a UserAllocator. + Guarantees that 'delete x;' uses the UserAllocator too. + */ + class PxUserAllocated + { + public: + // PX_SERIALIZATION + PX_INLINE void* operator new(size_t, void* address) + { + return address; + } + + //~PX_SERIALIZATION + // Matching operator delete to the above operator new. Don't ask me + // how this makes any sense - Nuernberger. + PX_INLINE void operator delete(void*, void*) + { + } + + template + PX_INLINE void* operator new(size_t size, Alloc alloc, const char* fileName, int line) + { + return alloc.allocate(size, fileName, line); + } + + template + PX_INLINE void* operator new(size_t size, size_t /*align*/, Alloc alloc, const char* fileName, int line) + { + // align is not respected, we have 16bit aligned allocator + return alloc.allocate(size, fileName, line); + } + + template + PX_INLINE void* operator new [](size_t size, Alloc alloc, const char* fileName, int line) + { + return alloc.allocate(size, fileName, line); + } + + template + PX_INLINE void* operator new [](size_t size, size_t /*align*/, Alloc alloc, const char* fileName, int line) + { + // align is not respected, we have 16bit aligned allocator + return alloc.allocate(size, fileName, line); + } + + // placement delete + template + PX_INLINE void operator delete(void* ptr, Alloc alloc, const char* fileName, int line) + { + PX_UNUSED(fileName); + PX_UNUSED(line); + alloc.deallocate(ptr); + } + + template + PX_INLINE void operator delete [](void* ptr, Alloc alloc, const char* fileName, int line) + { + PX_UNUSED(fileName); + PX_UNUSED(line); + alloc.deallocate(ptr); + } + + PX_INLINE void operator delete(void* ptr) + { + PxAllocator().deallocate(ptr); + } + + PX_INLINE void operator delete [](void* ptr) + { + PxAllocator().deallocate(ptr); + } + }; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxUtilities.h b/engine/third_party/physx/include/foundation/PxUtilities.h new file mode 100644 index 00000000..5d3d7f1e --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxUtilities.h @@ -0,0 +1,151 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_UTILITIES_H +#define PX_UTILITIES_H + +#include "foundation/PxVec3.h" +#include "foundation/PxAssert.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxBasicTemplates.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +PX_INLINE char PxLittleEndian() +{ + int i = 1; + return *(reinterpret_cast(&i)); +} + +// PT: checked casts +PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 PxTo32(PxU64 value) +{ + PX_ASSERT(value <= 0xffffffff); + return PxU32(value); +} +PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 PxToU32(PxI32 value) +{ + PX_ASSERT(value >= 0); + return PxU32(value); +} +PX_CUDA_CALLABLE PX_FORCE_INLINE PxU16 PxTo16(PxU32 value) +{ + PX_ASSERT(value <= 0xffff); + return PxU16(value); +} +PX_CUDA_CALLABLE PX_FORCE_INLINE PxU8 PxTo8(PxU16 value) +{ + PX_ASSERT(value <= 0xff); + return PxU8(value); +} +PX_CUDA_CALLABLE PX_FORCE_INLINE PxU8 PxTo8(PxU32 value) +{ + PX_ASSERT(value <= 0xff); + return PxU8(value); +} +PX_CUDA_CALLABLE PX_FORCE_INLINE PxU8 PxTo8(PxI32 value) +{ + PX_ASSERT(value <= 0xff); + PX_ASSERT(value >= 0); + return PxU8(value); +} +PX_CUDA_CALLABLE PX_FORCE_INLINE PxI8 PxToI8(PxU32 value) +{ + PX_ASSERT(value <= 0x7f); + return PxI8(value); +} + +//! \cond +/*! +Get number of elements in array +*/ +template +char (&PxArraySizeHelper(T (&array)[N]))[N]; +#define PX_ARRAY_SIZE(_array) (sizeof(physx::PxArraySizeHelper(_array))) +//! \endcond + +/*! +Sort two elements using operator< + +On return x will be the smaller of the two +*/ +template +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxOrder(T& x, T& y) +{ + if(y < x) + PxSwap(x, y); +} + +// most architectures can do predication on real comparisons, and on VMX, it matters + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxOrder(PxReal& x, PxReal& y) +{ + PxReal newX = PxMin(x, y); + PxReal newY = PxMax(x, y); + x = newX; + y = newY; +} + +/*! +Sort two elements using operator< and also keep order +of any extra data +*/ +template +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxOrder(T& x, T& y, E1& xe1, E1& ye1) +{ + if(y < x) + { + swap(x, y); + swap(xe1, ye1); + } +} + +#if PX_GCC_FAMILY && !PX_EMSCRIPTEN +__attribute__((noreturn)) +#endif + PX_INLINE void PxDebugBreak() +{ +#if PX_WINDOWS + __debugbreak(); +#elif PX_LINUX + __builtin_trap(); +#elif PX_GCC_FAMILY + __builtin_trap(); +#else + PX_ASSERT(false); +#endif +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxVec2.h b/engine/third_party/physx/include/foundation/PxVec2.h new file mode 100644 index 00000000..e7185fb7 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxVec2.h @@ -0,0 +1,347 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_VEC2_H +#define PX_VEC2_H + + +#include "foundation/PxMath.h" +#include "foundation/PxConstructor.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief 2 Element vector class. + +This is a 2-dimensional vector class with public data members. +*/ +template +class PxVec2T +{ + public: + /** + \brief default constructor leaves data uninitialized. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T() + { + } + + /** + \brief zero constructor. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T(PxZERO) : x(Type(0.0)), y(Type(0.0)) + { + } + + /** + \brief Assigns scalar parameter to all elements. + + Useful to initialize to zero or one. + + \param[in] a Value to assign to elements. + */ + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T(Type a) : x(a), y(a) + { + } + + /** + \brief Initializes from 2 scalar parameters. + + \param[in] nx Value to initialize X component. + \param[in] ny Value to initialize Y component. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T(Type nx, Type ny) : x(nx), y(ny) + { + } + + /** + \brief Copy ctor. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T(const PxVec2T& v) : x(v.x), y(v.y) + { + } + + // Operators + + /** + \brief Assignment operator + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T& operator=(const PxVec2T& p) + { + x = p.x; + y = p.y; + return *this; + } + + /** + \brief element access + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type& operator[](unsigned int index) + { + PX_ASSERT(index <= 1); + return reinterpret_cast(this)[index]; + } + + /** + \brief element access + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE const Type& operator[](unsigned int index) const + { + PX_ASSERT(index <= 1); + return reinterpret_cast(this)[index]; + } + + /** + \brief returns true if the two vectors are exactly equal. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator==(const PxVec2T& v) const + { + return x == v.x && y == v.y; + } + + /** + \brief returns true if the two vectors are not exactly equal. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator!=(const PxVec2T& v) const + { + return x != v.x || y != v.y; + } + + /** + \brief tests for exact zero vector + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isZero() const + { + return x == Type(0.0) && y == Type(0.0); + } + + /** + \brief returns true if all 2 elems of the vector are finite (not NAN or INF, etc.) + */ + PX_CUDA_CALLABLE PX_INLINE bool isFinite() const + { + return PxIsFinite(x) && PxIsFinite(y); + } + + /** + \brief is normalized - used by API parameter validation + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isNormalized() const + { + const Type unitTolerance = Type(1e-4); + return isFinite() && PxAbs(magnitude() - Type(1.0)) < unitTolerance; + } + + /** + \brief returns the squared magnitude + + Avoids calling PxSqrt()! + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type magnitudeSquared() const + { + return x * x + y * y; + } + + /** + \brief returns the magnitude + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type magnitude() const + { + return PxSqrt(magnitudeSquared()); + } + + /** + \brief negation + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T operator-() const + { + return PxVec2T(-x, -y); + } + + /** + \brief vector addition + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T operator+(const PxVec2T& v) const + { + return PxVec2T(x + v.x, y + v.y); + } + + /** + \brief vector difference + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T operator-(const PxVec2T& v) const + { + return PxVec2T(x - v.x, y - v.y); + } + + /** + \brief scalar post-multiplication + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T operator*(Type f) const + { + return PxVec2T(x * f, y * f); + } + + /** + \brief scalar division + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T operator/(Type f) const + { + f = Type(1.0) / f; + return PxVec2T(x * f, y * f); + } + + /** + \brief vector addition + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T& operator+=(const PxVec2T& v) + { + x += v.x; + y += v.y; + return *this; + } + + /** + \brief vector difference + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T& operator-=(const PxVec2T& v) + { + x -= v.x; + y -= v.y; + return *this; + } + + /** + \brief scalar multiplication + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T& operator*=(Type f) + { + x *= f; + y *= f; + return *this; + } + + /** + \brief scalar division + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T& operator/=(Type f) + { + f = Type(1.0) / f; + x *= f; + y *= f; + return *this; + } + + /** + \brief returns the scalar product of this and other. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type dot(const PxVec2T& v) const + { + return x * v.x + y * v.y; + } + + /** returns a unit vector */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T getNormalized() const + { + const Type m = magnitudeSquared(); + return m > Type(0.0) ? *this * PxRecipSqrt(m) : PxVec2T(Type(0)); + } + + /** + \brief normalizes the vector in place + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type normalize() + { + const Type m = magnitude(); + if(m > Type(0.0)) + *this /= m; + return m; + } + + /** + \brief a[i] * b[i], for all i. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T multiply(const PxVec2T& a) const + { + return PxVec2T(x * a.x, y * a.y); + } + + /** + \brief element-wise minimum + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T minimum(const PxVec2T& v) const + { + return PxVec2T(PxMin(x, v.x), PxMin(y, v.y)); + } + + /** + \brief returns MIN(x, y); + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type minElement() const + { + return PxMin(x, y); + } + + /** + \brief element-wise maximum + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T maximum(const PxVec2T& v) const + { + return PxVec2T(PxMax(x, v.x), PxMax(y, v.y)); + } + + /** + \brief returns MAX(x, y); + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type maxElement() const + { + return PxMax(x, y); + } + + Type x, y; +}; + +template +PX_CUDA_CALLABLE static PX_FORCE_INLINE PxVec2T operator*(Type f, const PxVec2T& v) +{ + return PxVec2T(f * v.x, f * v.y); +} + +typedef PxVec2T PxVec2; +typedef PxVec2T PxVec2d; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxVec3.h b/engine/third_party/physx/include/foundation/PxVec3.h new file mode 100644 index 00000000..ef2abad3 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxVec3.h @@ -0,0 +1,420 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_VEC3_H +#define PX_VEC3_H + + +#include "foundation/PxMath.h" +#include "foundation/PxConstructor.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief 3 Element vector class. + +This is a 3-dimensional vector class with public data members. +*/ +template +class PxVec3T +{ + public: + + /** + \brief default constructor leaves data uninitialized. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T() + { + } + + /** + \brief zero constructor. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T(PxZERO) : x(Type(0.0)), y(Type(0.0)), z(Type(0.0)) + { + } + + /** + \brief Assigns scalar parameter to all elements. + + Useful to initialize to zero or one. + + \param[in] a Value to assign to elements. + */ + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T(Type a) : x(a), y(a), z(a) + { + } + + /** + \brief Initializes from 3 scalar parameters. + + \param[in] nx Value to initialize X component. + \param[in] ny Value to initialize Y component. + \param[in] nz Value to initialize Z component. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T(Type nx, Type ny, Type nz) : x(nx), y(ny), z(nz) + { + } + + /** + \brief Copy ctor. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T(const PxVec3T& v) : x(v.x), y(v.y), z(v.z) + { + } + + // Operators + + /** + \brief Assignment operator + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T& operator=(const PxVec3T& p) + { + x = p.x; + y = p.y; + z = p.z; + return *this; + } + + /** + \brief element access + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type& operator[](unsigned int index) + { + PX_ASSERT(index <= 2); + return reinterpret_cast(this)[index]; + } + + /** + \brief element access + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE const Type& operator[](unsigned int index) const + { + PX_ASSERT(index <= 2); + return reinterpret_cast(this)[index]; + } + + /** + \brief returns true if the two vectors are exactly equal. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator==(const PxVec3T& v) const + { + return x == v.x && y == v.y && z == v.z; + } + + /** + \brief returns true if the two vectors are not exactly equal. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator!=(const PxVec3T& v) const + { + return x != v.x || y != v.y || z != v.z; + } + + /** + \brief tests for exact zero vector + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isZero() const + { + return x == Type(0.0) && y == Type(0.0) && z == Type(0.0); + } + + /** + \brief returns true if all 3 elems of the vector are finite (not NAN or INF, etc.) + */ + PX_CUDA_CALLABLE PX_INLINE bool isFinite() const + { + return PxIsFinite(x) && PxIsFinite(y) && PxIsFinite(z); + } + + /** + \brief is normalized - used by API parameter validation + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isNormalized() const + { + const float unitTolerance = Type(1e-4); // PT: do we need a different epsilon for float & double? + return isFinite() && PxAbs(magnitude() - Type(1.0)) < unitTolerance; + } + + /** + \brief returns the squared magnitude + + Avoids calling PxSqrt()! + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type magnitudeSquared() const + { + return x * x + y * y + z * z; + } + + /** + \brief returns the magnitude + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type magnitude() const + { + return PxSqrt(magnitudeSquared()); + } + + /** + \brief negation + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T operator-() const + { + return PxVec3T(-x, -y, -z); + } + + /** + \brief vector addition + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T operator+(const PxVec3T& v) const + { + return PxVec3T(x + v.x, y + v.y, z + v.z); + } + + /** + \brief vector difference + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T operator-(const PxVec3T& v) const + { + return PxVec3T(x - v.x, y - v.y, z - v.z); + } + + /** + \brief scalar post-multiplication + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T operator*(Type f) const + { + return PxVec3T(x * f, y * f, z * f); + } + + /** + \brief scalar division + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T operator/(Type f) const + { + f = Type(1.0) / f; + return PxVec3T(x * f, y * f, z * f); + } + + /** + \brief vector addition + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T& operator+=(const PxVec3T& v) + { + x += v.x; + y += v.y; + z += v.z; + return *this; + } + + /** + \brief vector difference + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T& operator-=(const PxVec3T& v) + { + x -= v.x; + y -= v.y; + z -= v.z; + return *this; + } + + /** + \brief scalar multiplication + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T& operator*=(Type f) + { + x *= f; + y *= f; + z *= f; + return *this; + } + /** + \brief scalar division + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T& operator/=(Type f) + { + f = Type(1.0) / f; + x *= f; + y *= f; + z *= f; + return *this; + } + + /** + \brief returns the scalar product of this and other. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type dot(const PxVec3T& v) const + { + return x * v.x + y * v.y + z * v.z; + } + + /** + \brief cross product + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T cross(const PxVec3T& v) const + { + return PxVec3T(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x); + } + + /** returns a unit vector */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T getNormalized() const + { + const Type m = magnitudeSquared(); + return m > Type(0.0) ? *this * PxRecipSqrt(m) : PxVec3T(Type(0)); + } + + /** + \brief normalizes the vector in place + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type normalize() + { + const Type m = magnitude(); + if(m > Type(0.0)) + *this /= m; + return m; + } + + /** + \brief normalizes the vector in place. Does nothing if vector magnitude is under PX_NORMALIZATION_EPSILON. + Returns vector magnitude if >= PX_NORMALIZATION_EPSILON and 0.0f otherwise. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type normalizeSafe() + { + const Type mag = magnitude(); + if(mag < PX_NORMALIZATION_EPSILON) // PT: do we need a different epsilon for float & double? + return Type(0.0); + *this *= Type(1.0) / mag; + return mag; + } + + /** + \brief normalizes the vector in place. Asserts if vector magnitude is under PX_NORMALIZATION_EPSILON. + returns vector magnitude. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type normalizeFast() + { + const Type mag = magnitude(); + PX_ASSERT(mag >= PX_NORMALIZATION_EPSILON); // PT: do we need a different epsilon for float & double? + *this *= Type(1.0) / mag; + return mag; + } + + /** + \brief a[i] * b[i], for all i. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T multiply(const PxVec3T& a) const + { + return PxVec3T(x * a.x, y * a.y, z * a.z); + } + + /** + \brief element-wise minimum + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T minimum(const PxVec3T& v) const + { + return PxVec3T(PxMin(x, v.x), PxMin(y, v.y), PxMin(z, v.z)); + } + + /** + \brief returns MIN(x, y, z); + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type minElement() const + { + return PxMin(x, PxMin(y, z)); + } + + /** + \brief element-wise maximum + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T maximum(const PxVec3T& v) const + { + return PxVec3T(PxMax(x, v.x), PxMax(y, v.y), PxMax(z, v.z)); + } + + /** + \brief returns MAX(x, y, z); + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE Type maxElement() const + { + return PxMax(x, PxMax(y, z)); + } + + /** + \brief returns absolute values of components; + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T abs() const + { + return PxVec3T(PxAbs(x), PxAbs(y), PxAbs(z)); + } + + Type x, y, z; +}; + +template +PX_CUDA_CALLABLE static PX_FORCE_INLINE PxVec3T operator*(Type f, const PxVec3T& v) +{ + return PxVec3T(f * v.x, f * v.y, f * v.z); +} + +typedef PxVec3T PxVec3; +typedef PxVec3T PxVec3d; + +//! A padded version of PxVec3, to safely load its data using SIMD +class PxVec3Padded : public PxVec3 +{ + public: + PX_FORCE_INLINE PxVec3Padded() {} + PX_FORCE_INLINE ~PxVec3Padded() {} + PX_FORCE_INLINE PxVec3Padded(const PxVec3& p) : PxVec3(p) {} + PX_FORCE_INLINE PxVec3Padded(float f) : PxVec3(f) {} + + /** + \brief Assignment operator. + To fix this: + error: definition of implicit copy assignment operator for 'PxVec3Padded' is deprecated because it has a user-declared destructor [-Werror,-Wdeprecated] + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3Padded& operator=(const PxVec3Padded& p) + { + x = p.x; + y = p.y; + z = p.z; + return *this; + } + + PxU32 padding; +}; +PX_COMPILE_TIME_ASSERT(sizeof(PxVec3Padded) == 16); + +typedef PxVec3Padded PxVec3p; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/foundation/PxVec4.h b/engine/third_party/physx/include/foundation/PxVec4.h new file mode 100644 index 00000000..4c26a735 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxVec4.h @@ -0,0 +1,364 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_VEC4_H +#define PX_VEC4_H + +#include "foundation/PxMath.h" +#include "foundation/PxVec3.h" + +/** +\brief 4 Element vector class. + +This is a 4-dimensional vector class with public data members. +*/ +#if !PX_DOXYGEN +namespace physx +{ +#endif + +template +class PxVec4T +{ + public: + /** + \brief default constructor leaves data uninitialized. + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T() + { + } + + /** + \brief zero constructor. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec4T(PxZERO) : x(Type(0.0)), y(Type(0.0)), z(Type(0.0)), w(Type(0.0)) + { + } + + /** + \brief Assigns scalar parameter to all elements. + + Useful to initialize to zero or one. + + \param[in] a Value to assign to elements. + */ + explicit PX_CUDA_CALLABLE PX_INLINE PxVec4T(Type a) : x(a), y(a), z(a), w(a) + { + } + + /** + \brief Initializes from 3 scalar parameters. + + \param[in] nx Value to initialize X component. + \param[in] ny Value to initialize Y component. + \param[in] nz Value to initialize Z component. + \param[in] nw Value to initialize W component. + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T(Type nx, Type ny, Type nz, Type nw) : x(nx), y(ny), z(nz), w(nw) + { + } + + /** + \brief Initializes from 3 scalar parameters. + + \param[in] v Value to initialize the X, Y, and Z components. + \param[in] nw Value to initialize W component. + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T(const PxVec3T& v, Type nw) : x(v.x), y(v.y), z(v.z), w(nw) + { + } + + /** + \brief Initializes from an array of scalar parameters. + + \param[in] v Value to initialize with. + */ + explicit PX_CUDA_CALLABLE PX_INLINE PxVec4T(const Type v[]) : x(v[0]), y(v[1]), z(v[2]), w(v[3]) + { + } + + /** + \brief Copy ctor. + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T(const PxVec4T& v) : x(v.x), y(v.y), z(v.z), w(v.w) + { + } + + // Operators + + /** + \brief Assignment operator + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T& operator=(const PxVec4T& p) + { + x = p.x; + y = p.y; + z = p.z; + w = p.w; + return *this; + } + + /** + \brief element access + */ + PX_CUDA_CALLABLE PX_INLINE Type& operator[](unsigned int index) + { + PX_ASSERT(index <= 3); + return reinterpret_cast(this)[index]; + } + + /** + \brief element access + */ + PX_CUDA_CALLABLE PX_INLINE const Type& operator[](unsigned int index) const + { + PX_ASSERT(index <= 3); + return reinterpret_cast(this)[index]; + } + + /** + \brief returns true if the two vectors are exactly equal. + */ + PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxVec4T& v) const + { + return x == v.x && y == v.y && z == v.z && w == v.w; + } + + /** + \brief returns true if the two vectors are not exactly equal. + */ + PX_CUDA_CALLABLE PX_INLINE bool operator!=(const PxVec4T& v) const + { + return x != v.x || y != v.y || z != v.z || w != v.w; + } + + /** + \brief tests for exact zero vector + */ + PX_CUDA_CALLABLE PX_INLINE bool isZero() const + { + return x == Type(0) && y == Type(0) && z == Type(0) && w == Type(0); + } + + /** + \brief returns true if all 3 elems of the vector are finite (not NAN or INF, etc.) + */ + PX_CUDA_CALLABLE PX_INLINE bool isFinite() const + { + return PxIsFinite(x) && PxIsFinite(y) && PxIsFinite(z) && PxIsFinite(w); + } + + /** + \brief is normalized - used by API parameter validation + */ + PX_CUDA_CALLABLE PX_INLINE bool isNormalized() const + { + const Type unitTolerance = Type(1e-4); + return isFinite() && PxAbs(magnitude() - Type(1.0)) < unitTolerance; + } + + /** + \brief returns the squared magnitude + + Avoids calling PxSqrt()! + */ + PX_CUDA_CALLABLE PX_INLINE Type magnitudeSquared() const + { + return x * x + y * y + z * z + w * w; + } + + /** + \brief returns the magnitude + */ + PX_CUDA_CALLABLE PX_INLINE Type magnitude() const + { + return PxSqrt(magnitudeSquared()); + } + + /** + \brief negation + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T operator-() const + { + return PxVec4T(-x, -y, -z, -w); + } + + /** + \brief vector addition + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T operator+(const PxVec4T& v) const + { + return PxVec4T(x + v.x, y + v.y, z + v.z, w + v.w); + } + + /** + \brief vector difference + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T operator-(const PxVec4T& v) const + { + return PxVec4T(x - v.x, y - v.y, z - v.z, w - v.w); + } + + /** + \brief scalar post-multiplication + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T operator*(Type f) const + { + return PxVec4T(x * f, y * f, z * f, w * f); + } + + /** + \brief scalar division + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T operator/(Type f) const + { + f = Type(1.0) / f; + return PxVec4T(x * f, y * f, z * f, w * f); + } + + /** + \brief vector addition + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T& operator+=(const PxVec4T& v) + { + x += v.x; + y += v.y; + z += v.z; + w += v.w; + return *this; + } + + /** + \brief vector difference + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T& operator-=(const PxVec4T& v) + { + x -= v.x; + y -= v.y; + z -= v.z; + w -= v.w; + return *this; + } + + /** + \brief scalar multiplication + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T& operator*=(Type f) + { + x *= f; + y *= f; + z *= f; + w *= f; + return *this; + } + /** + \brief scalar division + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T& operator/=(Type f) + { + f = Type(1.0) / f; + x *= f; + y *= f; + z *= f; + w *= f; + return *this; + } + + /** + \brief returns the scalar product of this and other. + */ + PX_CUDA_CALLABLE PX_INLINE Type dot(const PxVec4T& v) const + { + return x * v.x + y * v.y + z * v.z + w * v.w; + } + + /** returns a unit vector */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T getNormalized() const + { + const Type m = magnitudeSquared(); + return m > Type(0.0) ? *this * PxRecipSqrt(m) : PxVec4T(Type(0)); + } + + /** + \brief normalizes the vector in place + */ + PX_CUDA_CALLABLE PX_INLINE Type normalize() + { + const Type m = magnitude(); + if(m > Type(0.0)) + *this /= m; + return m; + } + + /** + \brief a[i] * b[i], for all i. + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T multiply(const PxVec4T& a) const + { + return PxVec4T(x * a.x, y * a.y, z * a.z, w * a.w); + } + + /** + \brief element-wise minimum + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T minimum(const PxVec4T& v) const + { + return PxVec4T(PxMin(x, v.x), PxMin(y, v.y), PxMin(z, v.z), PxMin(w, v.w)); + } + + /** + \brief element-wise maximum + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4T maximum(const PxVec4T& v) const + { + return PxVec4T(PxMax(x, v.x), PxMax(y, v.y), PxMax(z, v.z), PxMax(w, v.w)); + } + + PX_CUDA_CALLABLE PX_INLINE PxVec3T getXYZ() const + { + return PxVec3T(x, y, z); + } + + Type x, y, z, w; +}; + +template +PX_CUDA_CALLABLE static PX_INLINE PxVec4T operator*(Type f, const PxVec4T& v) +{ + return PxVec4T(f * v.x, f * v.y, f * v.z, f * v.w); +} + +typedef PxVec4T PxVec4; +typedef PxVec4T PxVec4d; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxVecMath.h b/engine/third_party/physx/include/foundation/PxVecMath.h new file mode 100644 index 00000000..183cb91b --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxVecMath.h @@ -0,0 +1,1355 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_VEC_MATH_H +#define PX_VEC_MATH_H + +#include "foundation/PxIntrinsics.h" +#include "foundation/PxVec3.h" +#include "foundation/PxVec4.h" +#include "foundation/PxMat33.h" +#include "foundation/PxUnionCast.h" + +// We can opt to use the scalar version of vectorised functions. +// This can catch type safety issues and might even work out more optimal on pc. +// It will also be useful for benchmarking and testing. +// NEVER submit with vector intrinsics deactivated without good reason. +// AM: deactivating SIMD for debug win64 just so autobuild will also exercise +// non-SIMD path, until a dedicated non-SIMD platform sich as Arm comes online. +// TODO: dima: reference all platforms with SIMD support here, +// all unknown/experimental cases should better default to NO SIMD. + +// enable/disable SIMD +#if !defined(PX_SIMD_DISABLED) +#if PX_INTEL_FAMILY && (!defined(__EMSCRIPTEN__) || defined(__SSE2__)) + #define COMPILE_VECTOR_INTRINSICS 1 +#elif PX_SWITCH + #define COMPILE_VECTOR_INTRINSICS 1 +#else + #define COMPILE_VECTOR_INTRINSICS 0 +#endif +#else + #define COMPILE_VECTOR_INTRINSICS 0 +#endif + +#if COMPILE_VECTOR_INTRINSICS && PX_INTEL_FAMILY && PX_UNIX_FAMILY +// only SSE2 compatible platforms should reach this +#if PX_EMSCRIPTEN + #include +#endif + #include +#endif + +#if COMPILE_VECTOR_INTRINSICS + #include "PxAoS.h" +#else + #include "PxVecMathAoSScalar.h" +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +namespace aos +{ + +// Basic AoS types are +// FloatV - 16-byte aligned representation of float. +// Vec3V - 16-byte aligned representation of PxVec3 stored as (x y z 0). +// Vec4V - 16-byte aligned representation of vector of 4 floats stored as (x y z w). +// BoolV - 16-byte aligned representation of vector of 4 bools stored as (x y z w). +// VecU32V - 16-byte aligned representation of 4 unsigned ints stored as (x y z w). +// VecI32V - 16-byte aligned representation of 4 signed ints stored as (x y z w). +// Mat33V - 16-byte aligned representation of any 3x3 matrix. +// Mat34V - 16-byte aligned representation of transformation matrix (rotation in col1,col2,col3 and translation in +// col4). +// Mat44V - 16-byte aligned representation of any 4x4 matrix. + +////////////////////////////////////////// +// Construct a simd type from a scalar type +////////////////////////////////////////// + +// FloatV +//(f,f,f,f) +PX_FORCE_INLINE FloatV FLoad(const PxF32 f); + +// Vec3V +//(f,f,f,0) +PX_FORCE_INLINE Vec3V V3Load(const PxF32 f); +//(f.x,f.y,f.z,0) +PX_FORCE_INLINE Vec3V V3LoadU(const PxVec3& f); +//(f.x,f.y,f.z,0), f must be 16-byte aligned +PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f); +//(f.x,f.y,f.z,w_undefined), f must be 16-byte aligned +PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f); +//(f.x,f.y,f.z,0) +PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* f); +//(f.x,f.y,f.z,0), f must be 16-byte aligned +PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* f); + +// Vec4V +//(f,f,f,f) +PX_FORCE_INLINE Vec4V V4Load(const PxF32 f); +//(f[0],f[1],f[2],f[3]) +PX_FORCE_INLINE Vec4V V4LoadU(const PxF32* const f); +//(f[0],f[1],f[2],f[3]), f must be 16-byte aligned +PX_FORCE_INLINE Vec4V V4LoadA(const PxF32* const f); +//(x,y,z,w) +PX_FORCE_INLINE Vec4V V4LoadXYZW(const PxF32& x, const PxF32& y, const PxF32& z, const PxF32& w); + +// BoolV +//(f,f,f,f) +PX_FORCE_INLINE BoolV BLoad(const bool f); +//(f[0],f[1],f[2],f[3]) +PX_FORCE_INLINE BoolV BLoad(const bool* const f); + +// VecU32V +//(f,f,f,f) +PX_FORCE_INLINE VecU32V U4Load(const PxU32 f); +//(f[0],f[1],f[2],f[3]) +PX_FORCE_INLINE VecU32V U4LoadU(const PxU32* f); +//(f[0],f[1],f[2],f[3]), f must be 16-byte aligned +PX_FORCE_INLINE VecU32V U4LoadA(const PxU32* f); +//((U32)x, (U32)y, (U32)z, (U32)w) +PX_FORCE_INLINE VecU32V U4LoadXYZW(PxU32 x, PxU32 y, PxU32 z, PxU32 w); + +// VecI32V +//(i,i,i,i) +PX_FORCE_INLINE VecI32V I4Load(const PxI32 i); +//(i,i,i,i) +PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i); +//(i,i,i,i) +PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i); + +// QuatV +//(x = v[0], y=v[1], z=v[2], w=v3[3]) and array don't need to aligned +PX_FORCE_INLINE QuatV QuatVLoadU(const PxF32* v); +//(x = v[0], y=v[1], z=v[2], w=v3[3]) and array need to aligned, fast load +PX_FORCE_INLINE QuatV QuatVLoadA(const PxF32* v); +//(x, y, z, w) +PX_FORCE_INLINE QuatV QuatVLoadXYZW(const PxF32 x, const PxF32 y, const PxF32 z, const PxF32 w); + +// not added to public api +Vec4V Vec4V_From_PxVec3_WUndefined(const PxVec3& v); + +/////////////////////////////////////////////////// +// Construct a simd type from a different simd type +/////////////////////////////////////////////////// + +// Vec3V +//(v.x,v.y,v.z,0) +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V(Vec4V v); +//(v.x,v.y,v.z,undefined) - be very careful with w!=0 because many functions require w==0 for correct operation eg V3Dot, V3Length, V3Cross etc etc. +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V_WUndefined(const Vec4V v); + +// Vec4V +//(f.x,f.y,f.z,f.w) +PX_FORCE_INLINE Vec4V Vec4V_From_Vec3V(Vec3V f); +//((PxF32)f.x, (PxF32)f.y, (PxF32)f.z, (PxF32)f.w) +PX_FORCE_INLINE Vec4V Vec4V_From_VecU32V(VecU32V a); +//((PxF32)f.x, (PxF32)f.y, (PxF32)f.z, (PxF32)f.w) +PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V a); +//(*(reinterpret_cast(&f.x), (reinterpret_cast(&f.y), (reinterpret_cast(&f.z), +//(reinterpret_cast(&f.w)) +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a); +//(*(reinterpret_cast(&f.x), (reinterpret_cast(&f.y), (reinterpret_cast(&f.z), +//(reinterpret_cast(&f.w)) +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a); + +// VecU32V +//(*(reinterpret_cast(&f.x), (reinterpret_cast(&f.y), (reinterpret_cast(&f.z), +//(reinterpret_cast(&f.w)) +PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a); +//(b[0], b[1], b[2], b[3]) +PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg b); + +// VecI32V +//(*(reinterpret_cast(&f.x), (reinterpret_cast(&f.y), (reinterpret_cast(&f.z), +//(reinterpret_cast(&f.w)) +PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a); +//((I32)a.x, (I32)a.y, (I32)a.z, (I32)a.w) +PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a); +//((I32)b.x, (I32)b.y, (I32)b.z, (I32)b.w) +PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg b); + +/////////////////////////////////////////////////// +// Convert from a simd type back to a scalar type +/////////////////////////////////////////////////// + +// FloatV +// a.x +PX_FORCE_INLINE void FStore(const FloatV a, PxF32* PX_RESTRICT f); + +// Vec3V +//(a.x,a.y,a.z) +PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f); +//(a.x,a.y,a.z) +PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f); + +// Vec4V +PX_FORCE_INLINE void V4StoreA(const Vec4V a, PxF32* f); +PX_FORCE_INLINE void V4StoreU(const Vec4V a, PxF32* f); + +// BoolV +PX_FORCE_INLINE void BStoreA(const BoolV b, PxU32* f); + +// VecU32V +PX_FORCE_INLINE void U4StoreA(const VecU32V uv, PxU32* u); + +// VecI32V +PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i); + +////////////////////////////////////////////////////////////////// +// Test that simd types have elements in the floating point range +////////////////////////////////////////////////////////////////// + +// check for each component is valid ie in floating point range +PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a); +// check for each component is valid ie in floating point range +PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a); +// check for each component is valid ie in floating point range +PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a); + +// Check that w-component is zero. +PX_FORCE_INLINE bool isValidVec3V(const Vec3V a); + +////////////////////////////////////////////////////////////////// +// Tests that all elements of two 16-byte types are completely equivalent. +// Use these tests for unit testing and asserts only. +////////////////////////////////////////////////////////////////// + +namespace vecMathTests +{ +PX_FORCE_INLINE Vec3V getInvalidVec3V(); +PX_FORCE_INLINE bool allElementsEqualFloatV(const FloatV a, const FloatV b); +PX_FORCE_INLINE bool allElementsEqualVec3V(const Vec3V a, const Vec3V b); +PX_FORCE_INLINE bool allElementsEqualVec4V(const Vec4V a, const Vec4V b); +PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b); +PX_FORCE_INLINE bool allElementsEqualVecU32V(const VecU32V a, const VecU32V b); +PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b); + +PX_FORCE_INLINE bool allElementsEqualMat33V(const Mat33V& a, const Mat33V& b) +{ + return (allElementsEqualVec3V(a.col0, b.col0) && allElementsEqualVec3V(a.col1, b.col1) && + allElementsEqualVec3V(a.col2, b.col2)); +} +PX_FORCE_INLINE bool allElementsEqualMat34V(const Mat34V& a, const Mat34V& b) +{ + return (allElementsEqualVec3V(a.col0, b.col0) && allElementsEqualVec3V(a.col1, b.col1) && + allElementsEqualVec3V(a.col2, b.col2) && allElementsEqualVec3V(a.col3, b.col3)); +} +PX_FORCE_INLINE bool allElementsEqualMat44V(const Mat44V& a, const Mat44V& b) +{ + return (allElementsEqualVec4V(a.col0, b.col0) && allElementsEqualVec4V(a.col1, b.col1) && + allElementsEqualVec4V(a.col2, b.col2) && allElementsEqualVec4V(a.col3, b.col3)); +} + +PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b); +PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b); +PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b); +PX_FORCE_INLINE bool allElementsNearEqualMat33V(const Mat33V& a, const Mat33V& b) +{ + return (allElementsNearEqualVec3V(a.col0, b.col0) && allElementsNearEqualVec3V(a.col1, b.col1) && + allElementsNearEqualVec3V(a.col2, b.col2)); +} +PX_FORCE_INLINE bool allElementsNearEqualMat34V(const Mat34V& a, const Mat34V& b) +{ + return (allElementsNearEqualVec3V(a.col0, b.col0) && allElementsNearEqualVec3V(a.col1, b.col1) && + allElementsNearEqualVec3V(a.col2, b.col2) && allElementsNearEqualVec3V(a.col3, b.col3)); +} +PX_FORCE_INLINE bool allElementsNearEqualMat44V(const Mat44V& a, const Mat44V& b) +{ + return (allElementsNearEqualVec4V(a.col0, b.col0) && allElementsNearEqualVec4V(a.col1, b.col1) && + allElementsNearEqualVec4V(a.col2, b.col2) && allElementsNearEqualVec4V(a.col3, b.col3)); +} +} + +////////////////////////////////////////////////////////////////// +// Math operations on FloatV +////////////////////////////////////////////////////////////////// + +//(0,0,0,0) +PX_FORCE_INLINE FloatV FZero(); +//(1,1,1,1) +PX_FORCE_INLINE FloatV FOne(); +//(0.5,0.5,0.5,0.5) +PX_FORCE_INLINE FloatV FHalf(); +//(PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL) +PX_FORCE_INLINE FloatV FEps(); +//! \cond +//(PX_MAX_REAL, PX_MAX_REAL, PX_MAX_REAL PX_MAX_REAL) +PX_FORCE_INLINE FloatV FMax(); +//! \endcond +//(-PX_MAX_REAL, -PX_MAX_REAL, -PX_MAX_REAL -PX_MAX_REAL) +PX_FORCE_INLINE FloatV FNegMax(); +//(1e-6f, 1e-6f, 1e-6f, 1e-6f) +PX_FORCE_INLINE FloatV FEps6(); +//((PxF32*)&1, (PxF32*)&1, (PxF32*)&1, (PxF32*)&1) + +//-f (per component) +PX_FORCE_INLINE FloatV FNeg(const FloatV f); +// a+b (per component) +PX_FORCE_INLINE FloatV FAdd(const FloatV a, const FloatV b); +// a-b (per component) +PX_FORCE_INLINE FloatV FSub(const FloatV a, const FloatV b); +// a*b (per component) +PX_FORCE_INLINE FloatV FMul(const FloatV a, const FloatV b); +// a/b (per component) +PX_FORCE_INLINE FloatV FDiv(const FloatV a, const FloatV b); +// a/b (per component) +PX_FORCE_INLINE FloatV FDivFast(const FloatV a, const FloatV b); +// 1.0f/a +PX_FORCE_INLINE FloatV FRecip(const FloatV a); +// 1.0f/a +PX_FORCE_INLINE FloatV FRecipFast(const FloatV a); +// 1.0f/sqrt(a) +PX_FORCE_INLINE FloatV FRsqrt(const FloatV a); +// 1.0f/sqrt(a) +PX_FORCE_INLINE FloatV FRsqrtFast(const FloatV a); +// sqrt(a) +PX_FORCE_INLINE FloatV FSqrt(const FloatV a); +// a*b+c +PX_FORCE_INLINE FloatV FScaleAdd(const FloatV a, const FloatV b, const FloatV c); +// c-a*b +PX_FORCE_INLINE FloatV FNegScaleSub(const FloatV a, const FloatV b, const FloatV c); +// fabs(a) +PX_FORCE_INLINE FloatV FAbs(const FloatV a); +// c ? a : b (per component) +PX_FORCE_INLINE FloatV FSel(const BoolV c, const FloatV a, const FloatV b); +// a>b (per component) +PX_FORCE_INLINE BoolV FIsGrtr(const FloatV a, const FloatV b); +// a>=b (per component) +PX_FORCE_INLINE BoolV FIsGrtrOrEq(const FloatV a, const FloatV b); +// a==b (per component) +PX_FORCE_INLINE BoolV FIsEq(const FloatV a, const FloatV b); +// Max(a,b) (per component) +PX_FORCE_INLINE FloatV FMax(const FloatV a, const FloatV b); +// Min(a,b) (per component) +PX_FORCE_INLINE FloatV FMin(const FloatV a, const FloatV b); +// Clamp(a,b) (per component) +PX_FORCE_INLINE FloatV FClamp(const FloatV a, const FloatV minV, const FloatV maxV); + +// a.x>b.x +PX_FORCE_INLINE PxU32 FAllGrtr(const FloatV a, const FloatV b); +// a.x>=b.x +PX_FORCE_INLINE PxU32 FAllGrtrOrEq(const FloatV a, const FloatV b); +// a.x==b.x +PX_FORCE_INLINE PxU32 FAllEq(const FloatV a, const FloatV b); +// amax +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV min, const FloatV max); +// a>=min && a<=max +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV min, const FloatV max); +// a<-bounds || a>bounds +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV bounds); +// a>=-bounds && a<=bounds +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV bounds); + +// round float a to the near int +PX_FORCE_INLINE FloatV FRound(const FloatV a); +// calculate the sin of float a +PX_FORCE_INLINE FloatV FSin(const FloatV a); +// calculate the cos of float b +PX_FORCE_INLINE FloatV FCos(const FloatV a); + +////////////////////////////////////////////////////////////////// +// Math operations on Vec3V +////////////////////////////////////////////////////////////////// + +//(f,f,f,f) +PX_FORCE_INLINE Vec3V V3Splat(const FloatV f); + +//(x,y,z) +PX_FORCE_INLINE Vec3V V3Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z); + +//(1,0,0,0) +PX_FORCE_INLINE Vec3V V3UnitX(); +//(0,1,0,0) +PX_FORCE_INLINE Vec3V V3UnitY(); +//(0,0,1,0) +PX_FORCE_INLINE Vec3V V3UnitZ(); + +//(f.x,f.x,f.x,f.x) +PX_FORCE_INLINE FloatV V3GetX(const Vec3V f); +//(f.y,f.y,f.y,f.y) +PX_FORCE_INLINE FloatV V3GetY(const Vec3V f); +//(f.z,f.z,f.z,f.z) +PX_FORCE_INLINE FloatV V3GetZ(const Vec3V f); + +//(f,v.y,v.z,v.w) +PX_FORCE_INLINE Vec3V V3SetX(const Vec3V v, const FloatV f); +//(v.x,f,v.z,v.w) +PX_FORCE_INLINE Vec3V V3SetY(const Vec3V v, const FloatV f); +//(v.x,v.y,f,v.w) +PX_FORCE_INLINE Vec3V V3SetZ(const Vec3V v, const FloatV f); + +// v.x=f +PX_FORCE_INLINE void V3WriteX(Vec3V& v, const PxF32 f); +// v.y=f +PX_FORCE_INLINE void V3WriteY(Vec3V& v, const PxF32 f); +// v.z=f +PX_FORCE_INLINE void V3WriteZ(Vec3V& v, const PxF32 f); +// v.x=f.x, v.y=f.y, v.z=f.z +PX_FORCE_INLINE void V3WriteXYZ(Vec3V& v, const PxVec3& f); +// return v.x +PX_FORCE_INLINE PxF32 V3ReadX(const Vec3V& v); +// return v.y +PX_FORCE_INLINE PxF32 V3ReadY(const Vec3V& v); +// return v.y +PX_FORCE_INLINE PxF32 V3ReadZ(const Vec3V& v); +// return (v.x,v.y,v.z) +PX_FORCE_INLINE const PxVec3& V3ReadXYZ(const Vec3V& v); + +//(a.x, b.x, c.x) +PX_FORCE_INLINE Vec3V V3ColX(const Vec3V a, const Vec3V b, const Vec3V c); +//(a.y, b.y, c.y) +PX_FORCE_INLINE Vec3V V3ColY(const Vec3V a, const Vec3V b, const Vec3V c); +//(a.z, b.z, c.z) +PX_FORCE_INLINE Vec3V V3ColZ(const Vec3V a, const Vec3V b, const Vec3V c); + +//(0,0,0,0) +PX_FORCE_INLINE Vec3V V3Zero(); +//(1,1,1,1) +PX_FORCE_INLINE Vec3V V3One(); +//(PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL) +PX_FORCE_INLINE Vec3V V3Eps(); +//-c (per component) +PX_FORCE_INLINE Vec3V V3Neg(const Vec3V c); +// a+b (per component) +PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const Vec3V b); +// a-b (per component) +PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const Vec3V b); +// a*b (per component) +PX_FORCE_INLINE Vec3V V3Scale(const Vec3V a, const FloatV b); +// a*b (per component) +PX_FORCE_INLINE Vec3V V3Mul(const Vec3V a, const Vec3V b); +// a/b (per component) +PX_FORCE_INLINE Vec3V V3ScaleInv(const Vec3V a, const FloatV b); +// a/b (per component) +PX_FORCE_INLINE Vec3V V3Div(const Vec3V a, const Vec3V b); +// a/b (per component) +PX_FORCE_INLINE Vec3V V3ScaleInvFast(const Vec3V a, const FloatV b); +// a/b (per component) +PX_FORCE_INLINE Vec3V V3DivFast(const Vec3V a, const Vec3V b); +// 1.0f/a +PX_FORCE_INLINE Vec3V V3Recip(const Vec3V a); +// 1.0f/a +PX_FORCE_INLINE Vec3V V3RecipFast(const Vec3V a); +// 1.0f/sqrt(a) +PX_FORCE_INLINE Vec3V V3Rsqrt(const Vec3V a); +// 1.0f/sqrt(a) +PX_FORCE_INLINE Vec3V V3RsqrtFast(const Vec3V a); +// a*b+c +PX_FORCE_INLINE Vec3V V3ScaleAdd(const Vec3V a, const FloatV b, const Vec3V c); +// c-a*b +PX_FORCE_INLINE Vec3V V3NegScaleSub(const Vec3V a, const FloatV b, const Vec3V c); +// a*b+c +PX_FORCE_INLINE Vec3V V3MulAdd(const Vec3V a, const Vec3V b, const Vec3V c); +// c-a*b +PX_FORCE_INLINE Vec3V V3NegMulSub(const Vec3V a, const Vec3V b, const Vec3V c); +// fabs(a) +PX_FORCE_INLINE Vec3V V3Abs(const Vec3V a); + +// a.b +// Note: a.w and b.w must have value zero +PX_FORCE_INLINE FloatV V3Dot(const Vec3V a, const Vec3V b); +// aXb +// Note: a.w and b.w must have value zero +PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const Vec3V b); +// |a.a|^1/2 +// Note: a.w must have value zero +PX_FORCE_INLINE FloatV V3Length(const Vec3V a); +// a.a +// Note: a.w must have value zero +PX_FORCE_INLINE FloatV V3LengthSq(const Vec3V a); +// a*|a.a|^-1/2 +// Note: a.w must have value zero +PX_FORCE_INLINE Vec3V V3Normalize(const Vec3V a); +// a.a>0 ? a*|a.a|^-1/2 : (0,0,0,0) +// Note: a.w must have value zero +PX_FORCE_INLINE FloatV V3Length(const Vec3V a); +// a.a>0 ? a*|a.a|^-1/2 : unsafeReturnValue +// Note: a.w must have value zero +PX_FORCE_INLINE Vec3V V3NormalizeSafe(const Vec3V a, const Vec3V unsafeReturnValue); +// a.x + a.y + a.z +// Note: a.w must have value zero +PX_FORCE_INLINE FloatV V3SumElems(const Vec3V a); + +// c ? a : b (per component) +PX_FORCE_INLINE Vec3V V3Sel(const BoolV c, const Vec3V a, const Vec3V b); +// a>b (per component) +PX_FORCE_INLINE BoolV V3IsGrtr(const Vec3V a, const Vec3V b); +// a>=b (per component) +PX_FORCE_INLINE BoolV V3IsGrtrOrEq(const Vec3V a, const Vec3V b); +// a==b (per component) +PX_FORCE_INLINE BoolV V3IsEq(const Vec3V a, const Vec3V b); +// Max(a,b) (per component) +PX_FORCE_INLINE Vec3V V3Max(const Vec3V a, const Vec3V b); +// Min(a,b) (per component) +PX_FORCE_INLINE Vec3V V3Min(const Vec3V a, const Vec3V b); + +// Extract the maximum value from a +// Note: a.w must have value zero +PX_FORCE_INLINE FloatV V3ExtractMax(const Vec3V a); + +// Extract the minimum value from a +// Note: a.w must have value zero +PX_FORCE_INLINE FloatV V3ExtractMin(const Vec3V a); + +// Clamp(a,b) (per component) +PX_FORCE_INLINE Vec3V V3Clamp(const Vec3V a, const Vec3V minV, const Vec3V maxV); + +// Extract the sign for each component +PX_FORCE_INLINE Vec3V V3Sign(const Vec3V a); + +// Test all components. +// (a.x>b.x && a.y>b.y && a.z>b.z) +// Note: a.w and b.w must have value zero +PX_FORCE_INLINE PxU32 V3AllGrtr(const Vec3V a, const Vec3V b); +// (a.x>=b.x && a.y>=b.y && a.z>=b.z) +// Note: a.w and b.w must have value zero +PX_FORCE_INLINE PxU32 V3AllGrtrOrEq(const Vec3V a, const Vec3V b); +// (a.x==b.x && a.y==b.y && a.z==b.z) +// Note: a.w and b.w must have value zero +PX_FORCE_INLINE PxU32 V3AllEq(const Vec3V a, const Vec3V b); +// a.xmax.x || a.y>max.y || a.z>max.z +// Note: a.w and min.w and max.w must have value zero +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V min, const Vec3V max); +// a.x>=min.x && a.y>=min.y && a.z>=min.z && a.x<=max.x && a.y<=max.y && a.z<=max.z +// Note: a.w and min.w and max.w must have value zero +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V min, const Vec3V max); +// a.x<-bounds.x || a.y<=-bounds.y || a.zbounds.x || a.y>bounds.y || a.z>bounds.z +// Note: a.w and bounds.w must have value zero +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V bounds); +// a.x>=-bounds.x && a.y>=-bounds.y && a.z>=-bounds.z && a.x<=bounds.x && a.y<=bounds.y && a.z<=bounds.z +// Note: a.w and bounds.w must have value zero +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V bounds); + +//(floor(a.x + 0.5f), floor(a.y + 0.5f), floor(a.z + 0.5f)) +PX_FORCE_INLINE Vec3V V3Round(const Vec3V a); + +//(sinf(a.x), sinf(a.y), sinf(a.z)) +PX_FORCE_INLINE Vec3V V3Sin(const Vec3V a); +//(cosf(a.x), cosf(a.y), cosf(a.z)) +PX_FORCE_INLINE Vec3V V3Cos(const Vec3V a); + +//(a.y,a.z,a.z) +PX_FORCE_INLINE Vec3V V3PermYZZ(const Vec3V a); +//(a.x,a.y,a.x) +PX_FORCE_INLINE Vec3V V3PermXYX(const Vec3V a); +//(a.y,a.z,a.x) +PX_FORCE_INLINE Vec3V V3PermYZX(const Vec3V a); +//(a.z, a.x, a.y) +PX_FORCE_INLINE Vec3V V3PermZXY(const Vec3V a); +//(a.z,a.z,a.y) +PX_FORCE_INLINE Vec3V V3PermZZY(const Vec3V a); +//(a.y,a.x,a.x) +PX_FORCE_INLINE Vec3V V3PermYXX(const Vec3V a); +//(0, v1.z, v0.y) +PX_FORCE_INLINE Vec3V V3Perm_Zero_1Z_0Y(const Vec3V v0, const Vec3V v1); +//(v0.z, 0, v1.x) +PX_FORCE_INLINE Vec3V V3Perm_0Z_Zero_1X(const Vec3V v0, const Vec3V v1); +//(v1.y, v0.x, 0) +PX_FORCE_INLINE Vec3V V3Perm_1Y_0X_Zero(const Vec3V v0, const Vec3V v1); + +// Transpose 3 Vec3Vs inplace. Sets the w component to zero +// [ x0, y0, z0, w0] [ x1, y1, z1, w1] [ x2, y2, z2, w2] -> [x0 x1 x2 0] [y0 y1 y2 0] [z0 z1 z2 0] +PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2); + +////////////////////////////////////////////////////////////////// +// Math operations on Vec4V +////////////////////////////////////////////////////////////////// + +//(f,f,f,f) +PX_FORCE_INLINE Vec4V V4Splat(const FloatV f); + +//(f[0],f[1],f[2],f[3]) +PX_FORCE_INLINE Vec4V V4Merge(const FloatV* const f); +//(x,y,z,w) +PX_FORCE_INLINE Vec4V V4Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w); +//(x.w, y.w, z.w, w.w) +PX_FORCE_INLINE Vec4V V4MergeW(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w); +//(x.z, y.z, z.z, w.z) +PX_FORCE_INLINE Vec4V V4MergeZ(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w); +//(x.y, y.y, z.y, w.y) +PX_FORCE_INLINE Vec4V V4MergeY(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w); +//(x.x, y.x, z.x, w.x) +PX_FORCE_INLINE Vec4V V4MergeX(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w); + +//(a.x, b.x, a.y, b.y) +PX_FORCE_INLINE Vec4V V4UnpackXY(const Vec4VArg a, const Vec4VArg b); +//(a.z, b.z, a.w, b.w) +PX_FORCE_INLINE Vec4V V4UnpackZW(const Vec4VArg a, const Vec4VArg b); + +//(1,0,0,0) +PX_FORCE_INLINE Vec4V V4UnitW(); +//(0,1,0,0) +PX_FORCE_INLINE Vec4V V4UnitY(); +//(0,0,1,0) +PX_FORCE_INLINE Vec4V V4UnitZ(); +//(0,0,0,1) +PX_FORCE_INLINE Vec4V V4UnitW(); + +//(f.x,f.x,f.x,f.x) +PX_FORCE_INLINE FloatV V4GetX(const Vec4V f); +//(f.y,f.y,f.y,f.y) +PX_FORCE_INLINE FloatV V4GetY(const Vec4V f); +//(f.z,f.z,f.z,f.z) +PX_FORCE_INLINE FloatV V4GetZ(const Vec4V f); +//(f.w,f.w,f.w,f.w) +PX_FORCE_INLINE FloatV V4GetW(const Vec4V f); + +//(f,v.y,v.z,v.w) +PX_FORCE_INLINE Vec4V V4SetX(const Vec4V v, const FloatV f); +//(v.x,f,v.z,v.w) +PX_FORCE_INLINE Vec4V V4SetY(const Vec4V v, const FloatV f); +//(v.x,v.y,f,v.w) +PX_FORCE_INLINE Vec4V V4SetZ(const Vec4V v, const FloatV f); +//(v.x,v.y,v.z,f) +PX_FORCE_INLINE Vec4V V4SetW(const Vec4V v, const FloatV f); + +//(v.x,v.y,v.z,0) +PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v); + +//(a[elementIndex], a[elementIndex], a[elementIndex], a[elementIndex]) +template +PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a); + +// v.x=f +PX_FORCE_INLINE void V4WriteX(Vec4V& v, const PxF32 f); +// v.y=f +PX_FORCE_INLINE void V4WriteY(Vec4V& v, const PxF32 f); +// v.z=f +PX_FORCE_INLINE void V4WriteZ(Vec4V& v, const PxF32 f); +// v.w=f +PX_FORCE_INLINE void V4WriteW(Vec4V& v, const PxF32 f); +// v.x=f.x, v.y=f.y, v.z=f.z +PX_FORCE_INLINE void V4WriteXYZ(Vec4V& v, const PxVec3& f); +// return v.x +PX_FORCE_INLINE PxF32 V4ReadX(const Vec4V& v); +// return v.y +PX_FORCE_INLINE PxF32 V4ReadY(const Vec4V& v); +// return v.z +PX_FORCE_INLINE PxF32 V4ReadZ(const Vec4V& v); +// return v.w +PX_FORCE_INLINE PxF32 V4ReadW(const Vec4V& v); +// return (v.x,v.y,v.z) +PX_FORCE_INLINE const PxVec3& V4ReadXYZ(const Vec4V& v); + +//(0,0,0,0) +PX_FORCE_INLINE Vec4V V4Zero(); +//(1,1,1,1) +PX_FORCE_INLINE Vec4V V4One(); +//(PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL) +PX_FORCE_INLINE Vec4V V4Eps(); + +//-c (per component) +PX_FORCE_INLINE Vec4V V4Neg(const Vec4V c); +// a+b (per component) +PX_FORCE_INLINE Vec4V V4Add(const Vec4V a, const Vec4V b); +// a-b (per component) +PX_FORCE_INLINE Vec4V V4Sub(const Vec4V a, const Vec4V b); +// a*b (per component) +PX_FORCE_INLINE Vec4V V4Scale(const Vec4V a, const FloatV b); +// a*b (per component) +PX_FORCE_INLINE Vec4V V4Mul(const Vec4V a, const Vec4V b); +// a/b (per component) +PX_FORCE_INLINE Vec4V V4ScaleInv(const Vec4V a, const FloatV b); +// a/b (per component) +PX_FORCE_INLINE Vec4V V4Div(const Vec4V a, const Vec4V b); +// a/b (per component) +PX_FORCE_INLINE Vec4V V4ScaleInvFast(const Vec4V a, const FloatV b); +// a/b (per component) +PX_FORCE_INLINE Vec4V V4DivFast(const Vec4V a, const Vec4V b); +// 1.0f/a +PX_FORCE_INLINE Vec4V V4Recip(const Vec4V a); +// 1.0f/a +PX_FORCE_INLINE Vec4V V4RecipFast(const Vec4V a); +// 1.0f/sqrt(a) +PX_FORCE_INLINE Vec4V V4Rsqrt(const Vec4V a); +// 1.0f/sqrt(a) +PX_FORCE_INLINE Vec4V V4RsqrtFast(const Vec4V a); +// a*b+c +PX_FORCE_INLINE Vec4V V4ScaleAdd(const Vec4V a, const FloatV b, const Vec4V c); +// c-a*b +PX_FORCE_INLINE Vec4V V4NegScaleSub(const Vec4V a, const FloatV b, const Vec4V c); +// a*b+c +PX_FORCE_INLINE Vec4V V4MulAdd(const Vec4V a, const Vec4V b, const Vec4V c); +// c-a*b +PX_FORCE_INLINE Vec4V V4NegMulSub(const Vec4V a, const Vec4V b, const Vec4V c); + +// fabs(a) +PX_FORCE_INLINE Vec4V V4Abs(const Vec4V a); +// bitwise a & ~b +PX_FORCE_INLINE Vec4V V4Andc(const Vec4V a, const VecU32V b); + +// a.b (W is taken into account) +PX_FORCE_INLINE FloatV V4Dot(const Vec4V a, const Vec4V b); +// a.b (same computation as V3Dot. W is ignored in input) +PX_FORCE_INLINE FloatV V4Dot3(const Vec4V a, const Vec4V b); +// aXb (same computation as V3Cross. W is ignored in input and undefined in output) +PX_FORCE_INLINE Vec4V V4Cross(const Vec4V a, const Vec4V b); + +//|a.a|^1/2 +PX_FORCE_INLINE FloatV V4Length(const Vec4V a); +// a.a +PX_FORCE_INLINE FloatV V4LengthSq(const Vec4V a); + +// a*|a.a|^-1/2 +PX_FORCE_INLINE Vec4V V4Normalize(const Vec4V a); +// a.a>0 ? a*|a.a|^-1/2 : unsafeReturnValue +PX_FORCE_INLINE Vec4V V4NormalizeSafe(const Vec4V a, const Vec4V unsafeReturnValue); +// a*|a.a|^-1/2 +PX_FORCE_INLINE Vec4V V4NormalizeFast(const Vec4V a); + +// c ? a : b (per component) +PX_FORCE_INLINE Vec4V V4Sel(const BoolV c, const Vec4V a, const Vec4V b); +// a>b (per component) +PX_FORCE_INLINE BoolV V4IsGrtr(const Vec4V a, const Vec4V b); +// a>=b (per component) +PX_FORCE_INLINE BoolV V4IsGrtrOrEq(const Vec4V a, const Vec4V b); +// a==b (per component) +PX_FORCE_INLINE BoolV V4IsEq(const Vec4V a, const Vec4V b); +// Max(a,b) (per component) +PX_FORCE_INLINE Vec4V V4Max(const Vec4V a, const Vec4V b); +// Min(a,b) (per component) +PX_FORCE_INLINE Vec4V V4Min(const Vec4V a, const Vec4V b); +// Get the maximum component from a +PX_FORCE_INLINE FloatV V4ExtractMax(const Vec4V a); +// Get the minimum component from a +PX_FORCE_INLINE FloatV V4ExtractMin(const Vec4V a); + +// Clamp(a,b) (per component) +PX_FORCE_INLINE Vec4V V4Clamp(const Vec4V a, const Vec4V minV, const Vec4V maxV); + +// return 1 if all components of a are greater than all components of b. +PX_FORCE_INLINE PxU32 V4AllGrtr(const Vec4V a, const Vec4V b); +// return 1 if all components of a are greater than or equal to all components of b +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq(const Vec4V a, const Vec4V b); +// return 1 if XYZ components of a are greater than or equal to XYZ components of b. W is ignored. +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq3(const Vec4V a, const Vec4V b); +// return 1 if all components of a are equal to all components of b +PX_FORCE_INLINE PxU32 V4AllEq(const Vec4V a, const Vec4V b); +// return 1 if any XYZ component of a is greater than the corresponding component of b. W is ignored. +PX_FORCE_INLINE PxU32 V4AnyGrtr3(const Vec4V a, const Vec4V b); + +// round(a)(per component) +PX_FORCE_INLINE Vec4V V4Round(const Vec4V a); +// sin(a) (per component) +PX_FORCE_INLINE Vec4V V4Sin(const Vec4V a); +// cos(a) (per component) +PX_FORCE_INLINE Vec4V V4Cos(const Vec4V a); + +// Permute v into a new vec4v with YXWZ format +PX_FORCE_INLINE Vec4V V4PermYXWZ(const Vec4V v); +// Permute v into a new vec4v with XZXZ format +PX_FORCE_INLINE Vec4V V4PermXZXZ(const Vec4V v); +// Permute v into a new vec4v with YWYW format +PX_FORCE_INLINE Vec4V V4PermYWYW(const Vec4V v); +// Permute v into a new vec4v with YZXW format +PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V v); +// Permute v into a new vec4v with ZWXY format - equivalent to a swap of the two 64bit parts of the vector +PX_FORCE_INLINE Vec4V V4PermZWXY(const Vec4V a); + +// Permute v into a new vec4v with format {a[x], a[y], a[z], a[w]} +// V4Perm<1,3,1,3> is equal to V4PermYWYW +// V4Perm<0,2,0,2> is equal to V4PermXZXZ +// V3Perm<1,0,3,2> is equal to V4PermYXWZ +template +PX_FORCE_INLINE Vec4V V4Perm(const Vec4V a); + +// Transpose 4 Vec4Vs inplace. +// [ x0, y0, z0, w0] [ x1, y1, z1, w1] [ x2, y2, z2, w2] [ x3, y3, z3, w3] -> +// [ x0, x1, x2, x3] [ y0, y1, y2, y3] [ z0, z1, z2, z3] [ w0, w1, w2, w3] +PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2); + +// q = cos(a/2) + u*sin(a/2) +PX_FORCE_INLINE QuatV QuatV_From_RotationAxisAngle(const Vec3V u, const FloatV a); +// convert q to a unit quaternion +PX_FORCE_INLINE QuatV QuatNormalize(const QuatV q); +//|q.q|^1/2 +PX_FORCE_INLINE FloatV QuatLength(const QuatV q); +// q.q +PX_FORCE_INLINE FloatV QuatLengthSq(const QuatV q); +// a.b +PX_FORCE_INLINE FloatV QuatDot(const QuatV a, const QuatV b); +//(-q.x, -q.y, -q.z, q.w) +PX_FORCE_INLINE QuatV QuatConjugate(const QuatV q); +//(q.x, q.y, q.z) +PX_FORCE_INLINE Vec3V QuatGetImaginaryPart(const QuatV q); +// convert quaternion to matrix 33 +PX_FORCE_INLINE Mat33V QuatGetMat33V(const QuatVArg q); +// convert quaternion to matrix 33 +PX_FORCE_INLINE void QuatGetMat33V(const QuatVArg q, Vec3V& column0, Vec3V& column1, Vec3V& column2); +// convert matrix 33 to quaternion +PX_FORCE_INLINE QuatV Mat33GetQuatV(const Mat33V& a); +// brief computes rotation of x-axis +PX_FORCE_INLINE Vec3V QuatGetBasisVector0(const QuatV q); +// brief computes rotation of y-axis +PX_FORCE_INLINE Vec3V QuatGetBasisVector1(const QuatV q); +// brief computes rotation of z-axis +PX_FORCE_INLINE Vec3V QuatGetBasisVector2(const QuatV q); +// calculate the rotation vector from q and v +PX_FORCE_INLINE Vec3V QuatRotate(const QuatV q, const Vec3V v); +// calculate the rotation vector from the conjugate quaternion and v +PX_FORCE_INLINE Vec3V QuatRotateInv(const QuatV q, const Vec3V v); +// quaternion multiplication +PX_FORCE_INLINE QuatV QuatMul(const QuatV a, const QuatV b); +// quaternion add +PX_FORCE_INLINE QuatV QuatAdd(const QuatV a, const QuatV b); +// (-q.x, -q.y, -q.z, -q.w) +PX_FORCE_INLINE QuatV QuatNeg(const QuatV q); +// (a.x - b.x, a.y-b.y, a.z-b.z, a.w-b.w ) +PX_FORCE_INLINE QuatV QuatSub(const QuatV a, const QuatV b); +// (a.x*b, a.y*b, a.z*b, a.w*b) +PX_FORCE_INLINE QuatV QuatScale(const QuatV a, const FloatV b); +// (x = v[0], y = v[1], z = v[2], w =v[3]) +PX_FORCE_INLINE QuatV QuatMerge(const FloatV* const v); +// (x = v[0], y = v[1], z = v[2], w =v[3]) +PX_FORCE_INLINE QuatV QuatMerge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w); +// (x = 0.f, y = 0.f, z = 0.f, w = 1.f) +PX_FORCE_INLINE QuatV QuatIdentity(); +// check for each component is valid +PX_FORCE_INLINE bool isFiniteQuatV(const QuatV q); +// check for each component is valid +PX_FORCE_INLINE bool isValidQuatV(const QuatV q); +// check for each component is valid +PX_FORCE_INLINE bool isSaneQuatV(const QuatV q); + +// Math operations on 16-byte aligned booleans. +// x=false y=false z=false w=false +PX_FORCE_INLINE BoolV BFFFF(); +// x=false y=false z=false w=true +PX_FORCE_INLINE BoolV BFFFT(); +// x=false y=false z=true w=false +PX_FORCE_INLINE BoolV BFFTF(); +// x=false y=false z=true w=true +PX_FORCE_INLINE BoolV BFFTT(); +// x=false y=true z=false w=false +PX_FORCE_INLINE BoolV BFTFF(); +// x=false y=true z=false w=true +PX_FORCE_INLINE BoolV BFTFT(); +// x=false y=true z=true w=false +PX_FORCE_INLINE BoolV BFTTF(); +// x=false y=true z=true w=true +PX_FORCE_INLINE BoolV BFTTT(); +// x=true y=false z=false w=false +PX_FORCE_INLINE BoolV BTFFF(); +// x=true y=false z=false w=true +PX_FORCE_INLINE BoolV BTFFT(); +// x=true y=false z=true w=false +PX_FORCE_INLINE BoolV BTFTF(); +// x=true y=false z=true w=true +PX_FORCE_INLINE BoolV BTFTT(); +// x=true y=true z=false w=false +PX_FORCE_INLINE BoolV BTTFF(); +// x=true y=true z=false w=true +PX_FORCE_INLINE BoolV BTTFT(); +// x=true y=true z=true w=false +PX_FORCE_INLINE BoolV BTTTF(); +// x=true y=true z=true w=true +PX_FORCE_INLINE BoolV BTTTT(); + +// x=false y=false z=false w=true +PX_FORCE_INLINE BoolV BWMask(); +// x=true y=false z=false w=false +PX_FORCE_INLINE BoolV BXMask(); +// x=false y=true z=false w=false +PX_FORCE_INLINE BoolV BYMask(); +// x=false y=false z=true w=false +PX_FORCE_INLINE BoolV BZMask(); + +// get x component +PX_FORCE_INLINE BoolV BGetX(const BoolV f); +// get y component +PX_FORCE_INLINE BoolV BGetY(const BoolV f); +// get z component +PX_FORCE_INLINE BoolV BGetZ(const BoolV f); +// get w component +PX_FORCE_INLINE BoolV BGetW(const BoolV f); + +// Use elementIndex to splat xxxx or yyyy or zzzz or wwww +template +PX_FORCE_INLINE BoolV BSplatElement(Vec4V a); + +// component-wise && (AND) +PX_FORCE_INLINE BoolV BAnd(const BoolV a, const BoolV b); +// component-wise || (OR) +PX_FORCE_INLINE BoolV BOr(const BoolV a, const BoolV b); +// component-wise not +PX_FORCE_INLINE BoolV BNot(const BoolV a); + +// if all four components are true, return true, otherwise return false +PX_FORCE_INLINE BoolV BAllTrue4(const BoolV a); + +// if any four components is true, return true, otherwise return false +PX_FORCE_INLINE BoolV BAnyTrue4(const BoolV a); + +// if all three(0, 1, 2) components are true, return true, otherwise return false +PX_FORCE_INLINE BoolV BAllTrue3(const BoolV a); + +// if any three (0, 1, 2) components is true, return true, otherwise return false +PX_FORCE_INLINE BoolV BAnyTrue3(const BoolV a); + +// Return 1 if all components equal, zero otherwise. +PX_FORCE_INLINE PxU32 BAllEq(const BoolV a, const BoolV b); + +// Specialized/faster BAllEq function for b==TTTT +PX_FORCE_INLINE PxU32 BAllEqTTTT(const BoolV a); +// Specialized/faster BAllEq function for b==FFFF +PX_FORCE_INLINE PxU32 BAllEqFFFF(const BoolV a); + +/// Get BoolV as bits set in an PxU32. A bit in the output is set if the element is 'true' in the input. +/// There is a bit for each element in a, with element 0s value held in bit0, element 1 in bit 1s and so forth. +/// If nothing is true in the input it will return 0, and if all are true if will return 0xf. +/// NOTE! That performance of the function varies considerably by platform, thus it is recommended to use +/// where your algorithm really needs a BoolV in an integer variable. +PX_FORCE_INLINE PxU32 BGetBitMask(const BoolV a); + +// VecI32V stuff + +PX_FORCE_INLINE VecI32V VecI32V_Zero(); + +PX_FORCE_INLINE VecI32V VecI32V_One(); + +PX_FORCE_INLINE VecI32V VecI32V_Two(); + +PX_FORCE_INLINE VecI32V VecI32V_MinusOne(); + +// Compute a shift parameter for VecI32V_LeftShift and VecI32V_RightShift +// Each element of shift must be identical ie the vector must have form {count, count, count, count} with count>=0 +PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift); + +// Shift each element of a leftwards by the same amount +// Compute shift with VecI32V_PrepareShift +//{a.x<>shift[0], a.y>>shift[0], a.z>>shift[0], a.w>>shift[0]} +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg shift); + +PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b); + +PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b); + +PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg a); + +PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg a); + +PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg a); + +PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg a); + +PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b); + +PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b); + +PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b); + +PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b); + +// VecU32V stuff + +PX_FORCE_INLINE VecU32V U4Zero(); + +PX_FORCE_INLINE VecU32V U4One(); + +PX_FORCE_INLINE VecU32V U4Two(); + +PX_FORCE_INLINE BoolV V4IsEqU32(const VecU32V a, const VecU32V b); + +PX_FORCE_INLINE VecU32V V4U32Sel(const BoolV c, const VecU32V a, const VecU32V b); + +PX_FORCE_INLINE VecU32V V4U32or(VecU32V a, VecU32V b); + +PX_FORCE_INLINE VecU32V V4U32xor(VecU32V a, VecU32V b); + +PX_FORCE_INLINE VecU32V V4U32and(VecU32V a, VecU32V b); + +PX_FORCE_INLINE VecU32V V4U32Andc(VecU32V a, VecU32V b); + +// VecU32 - why does this not return a bool? +PX_FORCE_INLINE VecU32V V4IsGrtrV32u(const Vec4V a, const Vec4V b); + +// Math operations on 16-byte aligned Mat33s (represents any 3x3 matrix) +PX_FORCE_INLINE Mat33V M33Load(const PxMat33& m) +{ + return Mat33V(Vec3V_From_Vec4V(V4LoadU(&m.column0.x)), + Vec3V_From_Vec4V(V4LoadU(&m.column1.x)), V3LoadU(m.column2)); +} +// a*b +PX_FORCE_INLINE Vec3V M33MulV3(const Mat33V& a, const Vec3V b); +// A*x + b +PX_FORCE_INLINE Vec3V M33MulV3AddV3(const Mat33V& A, const Vec3V b, const Vec3V c); +// transpose(a) * b +PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b); +// a*b +PX_FORCE_INLINE Mat33V M33MulM33(const Mat33V& a, const Mat33V& b); +// a+b +PX_FORCE_INLINE Mat33V M33Add(const Mat33V& a, const Mat33V& b); +// a+b +PX_FORCE_INLINE Mat33V M33Sub(const Mat33V& a, const Mat33V& b); +//-a +PX_FORCE_INLINE Mat33V M33Neg(const Mat33V& a); +// absolute value of the matrix +PX_FORCE_INLINE Mat33V M33Abs(const Mat33V& a); +// inverse mat +PX_FORCE_INLINE Mat33V M33Inverse(const Mat33V& a); +// transpose(a) +PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a); +// create an identity matrix +PX_FORCE_INLINE Mat33V M33Identity(); + +// create a vec3 to store the diagonal element of the M33 +PX_FORCE_INLINE Mat33V M33Diagonal(const Vec3VArg); + +// Not implemented +// return 1 if all components of a are equal to all components of b +// PX_FORCE_INLINE PxU32 V4U32AllEq(const VecU32V a, const VecU32V b); +// v.w=f +// PX_FORCE_INLINE void V3WriteW(Vec3V& v, const PxF32 f); +// PX_FORCE_INLINE PxF32 V3ReadW(const Vec3V& v); + +// Not used +// PX_FORCE_INLINE Vec4V V4LoadAligned(Vec4V* addr); +// PX_FORCE_INLINE Vec4V V4LoadUnaligned(Vec4V* addr); +// floor(a)(per component) +// PX_FORCE_INLINE Vec4V V4Floor(Vec4V a); +// ceil(a) (per component) +// PX_FORCE_INLINE Vec4V V4Ceil(Vec4V a); +// PX_FORCE_INLINE VecU32V V4ConvertToU32VSaturate(const Vec4V a, PxU32 power); + +// Math operations on 16-byte aligned Mat34s (represents transformation matrix - rotation and translation). +// namespace _Mat34V +//{ +// //a*b +// PX_FORCE_INLINE Vec3V multiplyV(const Mat34V& a, const Vec3V b); +// //a_rotation * b +// PX_FORCE_INLINE Vec3V multiply3X3V(const Mat34V& a, const Vec3V b); +// //transpose(a_rotation)*b +// PX_FORCE_INLINE Vec3V multiplyTranspose3X3V(const Mat34V& a, const Vec3V b); +// //a*b +// PX_FORCE_INLINE Mat34V multiplyV(const Mat34V& a, const Mat34V& b); +// //a_rotation*b +// PX_FORCE_INLINE Mat33V multiply3X3V(const Mat34V& a, const Mat33V& b); +// //a_rotation*b_rotation +// PX_FORCE_INLINE Mat33V multiply3X3V(const Mat34V& a, const Mat34V& b); +// //a+b +// PX_FORCE_INLINE Mat34V addV(const Mat34V& a, const Mat34V& b); +// //a^-1 +// PX_FORCE_INLINE Mat34V getInverseV(const Mat34V& a); +// //transpose(a_rotation) +// PX_FORCE_INLINE Mat33V getTranspose3X3(const Mat34V& a); +//}; //namespace _Mat34V + +// a*b +//#define M34MulV3(a,b) (M34MulV3(a,b)) +////a_rotation * b +//#define M34Mul33V3(a,b) (M34Mul33V3(a,b)) +////transpose(a_rotation)*b +//#define M34TrnspsMul33V3(a,b) (M34TrnspsMul33V3(a,b)) +////a*b +//#define M34MulM34(a,b) (_Mat34V::multiplyV(a,b)) +// a_rotation*b +//#define M34MulM33(a,b) (M34MulM33(a,b)) +// a_rotation*b_rotation +//#define M34Mul33MM34(a,b) (M34MulM33(a,b)) +// a+b +//#define M34Add(a,b) (M34Add(a,b)) +////a^-1 +//#define M34Inverse(a,b) (M34Inverse(a)) +// transpose(a_rotation) +//#define M34Trnsps33(a) (M33Trnsps3X3(a)) + +// Math operations on 16-byte aligned Mat44s (represents any 4x4 matrix) +// namespace _Mat44V +//{ +// //a*b +// PX_FORCE_INLINE Vec4V multiplyV(const Mat44V& a, const Vec4V b); +// //transpose(a)*b +// PX_FORCE_INLINE Vec4V multiplyTransposeV(const Mat44V& a, const Vec4V b); +// //a*b +// PX_FORCE_INLINE Mat44V multiplyV(const Mat44V& a, const Mat44V& b); +// //a+b +// PX_FORCE_INLINE Mat44V addV(const Mat44V& a, const Mat44V& b); +// //a&-1 +// PX_FORCE_INLINE Mat44V getInverseV(const Mat44V& a); +// //transpose(a) +// PX_FORCE_INLINE Mat44V getTransposeV(const Mat44V& a); +//}; //namespace _Mat44V + +// namespace _VecU32V +//{ +// // pack 8 U32s to 8 U16s with saturation +// PX_FORCE_INLINE VecU16V pack2U32VToU16VSaturate(VecU32V a, VecU32V b); +// PX_FORCE_INLINE VecU32V orV(VecU32V a, VecU32V b); +// PX_FORCE_INLINE VecU32V andV(VecU32V a, VecU32V b); +// PX_FORCE_INLINE VecU32V andcV(VecU32V a, VecU32V b); +// // conversion from integer to float +// PX_FORCE_INLINE Vec4V convertToVec4V(VecU32V a); +// // splat a[elementIndex] into all fields of a +// template +// PX_FORCE_INLINE VecU32V splatElement(VecU32V a); +// PX_FORCE_INLINE void storeAligned(VecU32V a, VecU32V* address); +//}; + +// namespace _VecI32V +//{ +// template PX_FORCE_INLINE VecI32V splatI32(); +//}; +// +// namespace _VecU16V +//{ +// PX_FORCE_INLINE VecU16V orV(VecU16V a, VecU16V b); +// PX_FORCE_INLINE VecU16V andV(VecU16V a, VecU16V b); +// PX_FORCE_INLINE VecU16V andcV(VecU16V a, VecU16V b); +// PX_FORCE_INLINE void storeAligned(VecU16V val, VecU16V *address); +// PX_FORCE_INLINE VecU16V loadAligned(VecU16V* addr); +// PX_FORCE_INLINE VecU16V loadUnaligned(VecU16V* addr); +// PX_FORCE_INLINE VecU16V compareGt(VecU16V a, VecU16V b); +// template +// PX_FORCE_INLINE VecU16V splatElement(VecU16V a); +// PX_FORCE_INLINE VecU16V subtractModulo(VecU16V a, VecU16V b); +// PX_FORCE_INLINE VecU16V addModulo(VecU16V a, VecU16V b); +// PX_FORCE_INLINE VecU32V getLo16(VecU16V a); // [0,2,4,6] 16-bit values to [0,1,2,3] 32-bit vector +// PX_FORCE_INLINE VecU32V getHi16(VecU16V a); // [1,3,5,7] 16-bit values to [0,1,2,3] 32-bit vector +//}; +// +// namespace _VecI16V +//{ +// template PX_FORCE_INLINE VecI16V splatImmediate(); +//}; +// +// namespace _VecU8V +//{ +//}; + +// a*b +//#define M44MulV4(a,b) (M44MulV4(a,b)) +////transpose(a)*b +//#define M44TrnspsMulV4(a,b) (M44TrnspsMulV4(a,b)) +////a*b +//#define M44MulM44(a,b) (M44MulM44(a,b)) +////a+b +//#define M44Add(a,b) (M44Add(a,b)) +////a&-1 +//#define M44Inverse(a) (M44Inverse(a)) +////transpose(a) +//#define M44Trnsps(a) (M44Trnsps(a)) + +// dsequeira: these used to be assert'd out in SIMD builds, but they're necessary if +// we want to be able to write some scalar functions which run using SIMD data structures + +PX_FORCE_INLINE void V3WriteX(Vec3V& v, const PxF32 f) +{ + reinterpret_cast(v).x = f; +} + +PX_FORCE_INLINE void V3WriteY(Vec3V& v, const PxF32 f) +{ + reinterpret_cast(v).y = f; +} + +PX_FORCE_INLINE void V3WriteZ(Vec3V& v, const PxF32 f) +{ + reinterpret_cast(v).z = f; +} + +PX_FORCE_INLINE void V3WriteXYZ(Vec3V& v, const PxVec3& f) +{ + reinterpret_cast(v) = f; +} + +PX_FORCE_INLINE PxF32 V3ReadX(const Vec3V& v) +{ + return reinterpret_cast(v).x; +} + +PX_FORCE_INLINE PxF32 V3ReadY(const Vec3V& v) +{ + return reinterpret_cast(v).y; +} + +PX_FORCE_INLINE PxF32 V3ReadZ(const Vec3V& v) +{ + return reinterpret_cast(v).z; +} + +PX_FORCE_INLINE const PxVec3& V3ReadXYZ(const Vec3V& v) +{ + return reinterpret_cast(v); +} + +PX_FORCE_INLINE void V4WriteX(Vec4V& v, const PxF32 f) +{ + reinterpret_cast(v).x = f; +} + +PX_FORCE_INLINE void V4WriteY(Vec4V& v, const PxF32 f) +{ + reinterpret_cast(v).y = f; +} + +PX_FORCE_INLINE void V4WriteZ(Vec4V& v, const PxF32 f) +{ + reinterpret_cast(v).z = f; +} + +PX_FORCE_INLINE void V4WriteW(Vec4V& v, const PxF32 f) +{ + reinterpret_cast(v).w = f; +} + +PX_FORCE_INLINE void V4WriteXYZ(Vec4V& v, const PxVec3& f) +{ + reinterpret_cast(v) = f; +} + +PX_FORCE_INLINE PxF32 V4ReadX(const Vec4V& v) +{ + return reinterpret_cast(v).x; +} + +PX_FORCE_INLINE PxF32 V4ReadY(const Vec4V& v) +{ + return reinterpret_cast(v).y; +} + +PX_FORCE_INLINE PxF32 V4ReadZ(const Vec4V& v) +{ + return reinterpret_cast(v).z; +} + +PX_FORCE_INLINE PxF32 V4ReadW(const Vec4V& v) +{ + return reinterpret_cast(v).w; +} + +PX_FORCE_INLINE const PxVec3& V4ReadXYZ(const Vec4V& v) +{ + return reinterpret_cast(v); +} + +// this macro transposes 4 Vec4V into 3 Vec4V (assuming that the W component can be ignored +//inA: 1 2 3 4 +//inB: 5 6 7 8 +//inC: 9 10 11 12 +//inD: 13 14 15 16 +//outA: 1 5 9 13 +//outB: 2 6 10 14 +//outC: 3 7 11 15 +#define PX_TRANSPOSE_44_34(inA, inB, inC, inD, outA, outB, outC) \ +outA = V4UnpackXY(inA, inC); \ +inA = V4UnpackZW(inA, inC); \ +inC = V4UnpackXY(inB, inD); \ +inB = V4UnpackZW(inB, inD); \ +outB = V4UnpackZW(outA, inC); \ +outA = V4UnpackXY(outA, inC); \ +outC = V4UnpackXY(inA, inB); + +// this macro transposes 3 Vec4V into 4 Vec4V (with W components as garbage!) +//inA: 1 2 3 4 +//inB: 5 6 7 8 +//inC: 9 10 11 12 +//outA: 1 5 9 undefined +//outB: 2 6 10 undefined +//outC: 3 7 11 undefined +//outD: 4 8 12 undefined +#define PX_TRANSPOSE_34_44(inA, inB, inC, outA, outB, outC, outD) \ + outA = V4UnpackXY(inA, inC); \ + inA = V4UnpackZW(inA, inC); \ + outC = V4UnpackXY(inB, inB); \ + inC = V4UnpackZW(inB, inB); \ + outB = V4UnpackZW(outA, outC); \ + outA = V4UnpackXY(outA, outC); \ + outC = V4UnpackXY(inA, inC); \ + outD = V4UnpackZW(inA, inC); + +//inA: 1 2 3 4 +//inB: 5 6 7 8 +//inC: 9 10 11 12 +//inD: 13 14 15 16 +//outA: 1 5 9 13 +//outB: 2 6 10 14 +//outC: 3 7 11 15 +//outD: 4 8 12 16 +#define PX_TRANSPOSE_44(inA, inB, inC, inD, outA, outB, outC, outD) \ + outA = V4UnpackXY(inA, inC); \ + inA = V4UnpackZW(inA, inC); \ + inC = V4UnpackXY(inB, inD); \ + inB = V4UnpackZW(inB, inD); \ + outB = V4UnpackZW(outA, inC); \ + outA = V4UnpackXY(outA, inC); \ + outC = V4UnpackXY(inA, inB); \ + outD = V4UnpackZW(inA, inB); + +// This function returns a Vec4V, where each element is the dot product of one pair of Vec3Vs. On PC, each element in +// the result should be identical to the results if V3Dot was performed +// for each pair of Vec3V. +// However, on other platforms, the result might diverge by some small margin due to differences in FP rounding, e.g. if +// _mm_dp_ps was used or some other approximate dot product or fused madd operations +// were used. +// Where there does not exist a hw-accelerated dot-product operation, this approach should be the fastest way to compute +// the dot product of 4 vectors. +PX_FORCE_INLINE Vec4V V3Dot4(const Vec3VArg a0, const Vec3VArg b0, const Vec3VArg a1, const Vec3VArg b1, + const Vec3VArg a2, const Vec3VArg b2, const Vec3VArg a3, const Vec3VArg b3) +{ + Vec4V a0b0 = Vec4V_From_Vec3V(V3Mul(a0, b0)); + Vec4V a1b1 = Vec4V_From_Vec3V(V3Mul(a1, b1)); + Vec4V a2b2 = Vec4V_From_Vec3V(V3Mul(a2, b2)); + Vec4V a3b3 = Vec4V_From_Vec3V(V3Mul(a3, b3)); + + Vec4V aTrnsps, bTrnsps, cTrnsps; + + PX_TRANSPOSE_44_34(a0b0, a1b1, a2b2, a3b3, aTrnsps, bTrnsps, cTrnsps); + + return V4Add(V4Add(aTrnsps, bTrnsps), cTrnsps); +} + +//(f.x,f.y,f.z,0) - Alternative/faster V3LoadU implementation when it is safe to read "W", i.e. the 32bits after the PxVec3. +PX_FORCE_INLINE Vec3V V3LoadU_SafeReadW(const PxVec3& f) +{ + return Vec3V_From_Vec4V(V4LoadU(&f.x)); +} + +} // namespace aos +#if !PX_DOXYGEN +} // namespace physx +#endif + +// Now for the cross-platform implementations of the 16-byte aligned maths functions (win32/360/ppu/spu etc). +#if COMPILE_VECTOR_INTRINSICS +#include "PxInlineAoS.h" +#else // #if COMPILE_VECTOR_INTRINSICS +#include "PxVecMathAoSScalarInline.h" +#endif // #if !COMPILE_VECTOR_INTRINSICS +#include "PxVecQuat.h" + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxVecMathAoSScalar.h b/engine/third_party/physx/include/foundation/PxVecMathAoSScalar.h new file mode 100644 index 00000000..d2b96b1a --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxVecMathAoSScalar.h @@ -0,0 +1,251 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_VEC_MATH_AOS_SCALAR_H +#define PX_VEC_MATH_AOS_SCALAR_H + +#if COMPILE_VECTOR_INTRINSICS +#error Scalar version should not be included when using vector intrinsics. +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +namespace aos +{ + +struct VecI16V; +struct VecU16V; +struct VecI32V; +struct VecU32V; +struct Vec4V; +typedef Vec4V QuatV; + +PX_ALIGN_PREFIX(16) +struct FloatV +{ + PxF32 x; + PxF32 pad[3]; + FloatV() + { + } + FloatV(const PxF32 _x) : x(_x) + { + } +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Vec4V +{ + PxF32 x, y, z, w; + Vec4V() + { + } + Vec4V(const PxF32 _x, const PxF32 _y, const PxF32 _z, const PxF32 _w) : x(_x), y(_y), z(_z), w(_w) + { + } +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Vec3V +{ + PxF32 x, y, z; + PxF32 pad; + Vec3V() + { + } + Vec3V(const PxF32 _x, const PxF32 _y, const PxF32 _z) : x(_x), y(_y), z(_z), pad(0.0f) + { + } +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct BoolV +{ + PxU32 ux, uy, uz, uw; + BoolV() + { + } + BoolV(const PxU32 _x, const PxU32 _y, const PxU32 _z, const PxU32 _w) : ux(_x), uy(_y), uz(_z), uw(_w) + { + } +} PX_ALIGN_SUFFIX(16); + +struct Mat33V +{ + Mat33V() + { + } + Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec3V col0; + Vec3V col1; + Vec3V col2; +}; + +struct Mat34V +{ + Mat34V() + { + } + Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec3V col0; + Vec3V col1; + Vec3V col2; + Vec3V col3; +}; + +struct Mat43V +{ + Mat43V() + { + } + Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec4V col0; + Vec4V col1; + Vec4V col2; +}; + +struct Mat44V +{ + Mat44V() + { + } + Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec4V col0; + Vec4V col1; + Vec4V col2; + Vec4V col3; +}; + +PX_ALIGN_PREFIX(16) +struct VecU32V +{ + PxU32 u32[4]; + PX_FORCE_INLINE VecU32V() + { + } + PX_FORCE_INLINE VecU32V(PxU32 a, PxU32 b, PxU32 c, PxU32 d) + { + u32[0] = a; + u32[1] = b; + u32[2] = c; + u32[3] = d; + } +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct VecI32V +{ + PxI32 i32[4]; + PX_FORCE_INLINE VecI32V() + { + } + PX_FORCE_INLINE VecI32V(PxI32 a, PxI32 b, PxI32 c, PxI32 d) + { + i32[0] = a; + i32[1] = b; + i32[2] = c; + i32[3] = d; + } +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct VecI16V +{ + PxI16 i16[8]; + PX_FORCE_INLINE VecI16V() + { + } + PX_FORCE_INLINE VecI16V(PxI16 a, PxI16 b, PxI16 c, PxI16 d, PxI16 e, PxI16 f, PxI16 g, PxI16 h) + { + i16[0] = a; + i16[1] = b; + i16[2] = c; + i16[3] = d; + i16[4] = e; + i16[5] = f; + i16[6] = g; + i16[7] = h; + } +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct VecU16V +{ + union + { + PxU16 u16[8]; + PxI16 i16[8]; + }; + PX_FORCE_INLINE VecU16V() + { + } + PX_FORCE_INLINE VecU16V(PxU16 a, PxU16 b, PxU16 c, PxU16 d, PxU16 e, PxU16 f, PxU16 g, PxU16 h) + { + u16[0] = a; + u16[1] = b; + u16[2] = c; + u16[3] = d; + u16[4] = e; + u16[5] = f; + u16[6] = g; + u16[7] = h; + } +} PX_ALIGN_SUFFIX(16); + +#define FloatVArg FloatV & +#define Vec3VArg Vec3V & +#define Vec4VArg Vec4V & +#define BoolVArg BoolV & +#define VecU32VArg VecU32V & +#define VecI32VArg VecI32V & +#define VecU16VArg VecU16V & +#define VecI16VArg VecI16V & +#define QuatVArg QuatV & + +#define VecCrossV Vec3V + +typedef VecI32V VecShiftV; +#define VecShiftVArg VecShiftV & + +} // namespace aos +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxVecMathAoSScalarInline.h b/engine/third_party/physx/include/foundation/PxVecMathAoSScalarInline.h new file mode 100644 index 00000000..d5290294 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxVecMathAoSScalarInline.h @@ -0,0 +1,2301 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_VEC_MATH_AOS_SCALAR_INLINE_H +#define PX_VEC_MATH_AOS_SCALAR_INLINE_H + +#if COMPILE_VECTOR_INTRINSICS +#error Scalar version should not be included when using vector intrinsics. +#endif + +#if PX_GCC_FAMILY +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +namespace aos +{ + +#define BOOL_TO_U32(b) PxU32(- PxI32(b)) +#define TRUE_TO_U32 PxU32(-1) +#define FALSE_TO_U32 PxU32(0) + +#define BOOL_TO_U16(b) PxU16(- PxI32(b)) + +#define PX_VECMATH_ASSERT_ENABLED 0 + +#if PX_VECMATH_ASSERT_ENABLED +#define VECMATHAOS_ASSERT(x) { PX_ASSERT(x); } +#else +#define VECMATHAOS_ASSERT(x) +#endif + +///////////////////////////////////////////////////////////////////// +////INTERNAL USE ONLY AND TESTS +///////////////////////////////////////////////////////////////////// + +namespace internalScalarSimd +{ +PX_FORCE_INLINE PxF32 FStore(const FloatV a) +{ + return a.x; +} + +PX_FORCE_INLINE bool hasZeroElementInFloatV(const FloatV a) +{ + return (0 == a.x); +} + +PX_FORCE_INLINE bool hasZeroElementInVec3V(const Vec3V a) +{ + return (0 == a.x || 0 == a.y || 0 == a.z); +} + +PX_FORCE_INLINE bool hasZeroElementInVec4V(const Vec4V a) +{ + return (0 == a.x || 0 == a.y || 0 == a.z || 0 == a.w); +} +} + +namespace vecMathTests +{ +// PT: this function returns an invalid Vec3V (W!=0.0f) just for unit-testing 'isValidVec3V' +PX_FORCE_INLINE Vec3V getInvalidVec3V() +{ + Vec3V tmp; + tmp.x = tmp.y = tmp.z = 0.0f; + tmp.pad = 1.0f; + return tmp; +} + +PX_FORCE_INLINE bool allElementsEqualFloatV(const FloatV a, const FloatV b) +{ + return (a.x == b.x); +} + +PX_FORCE_INLINE bool allElementsEqualVec3V(const Vec3V a, const Vec3V b) +{ + return (a.x == b.x && a.y == b.y && a.z == b.z); +} + +PX_FORCE_INLINE bool allElementsEqualVec4V(const Vec4V a, const Vec4V b) +{ + return (a.x == b.x && a.y == b.y && a.z == b.z && a.w == b.w); +} + +PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b) +{ + return (a.ux == b.ux && a.uy == b.uy && a.uz == b.uz && a.uw == b.uw); +} + +PX_FORCE_INLINE bool allElementsEqualVecU32V(const VecU32V a, const VecU32V b) +{ + return (a.u32[0] == b.u32[0] && a.u32[1] == b.u32[1] && a.u32[2] == b.u32[2] && a.u32[3] == b.u32[3]); +} + +PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b) +{ + return (a.i32[0] == b.i32[0] && a.i32[1] == b.i32[1] && a.i32[2] == b.i32[2] && a.i32[3] == b.i32[3]); +} + +#define VECMATH_AOS_EPSILON (1e-3f) + +PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b) +{ + const PxF32 cx = a.x - b.x; + return (cx > -VECMATH_AOS_EPSILON && cx < VECMATH_AOS_EPSILON); +} + +PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b) +{ + const PxF32 cx = a.x - b.x; + const PxF32 cy = a.y - b.y; + const PxF32 cz = a.z - b.z; + return (cx > -VECMATH_AOS_EPSILON && cx < VECMATH_AOS_EPSILON && cy > -VECMATH_AOS_EPSILON && + cy < VECMATH_AOS_EPSILON && cz > -VECMATH_AOS_EPSILON && cz < VECMATH_AOS_EPSILON); +} + +PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b) +{ + const PxF32 cx = a.x - b.x; + const PxF32 cy = a.y - b.y; + const PxF32 cz = a.z - b.z; + const PxF32 cw = a.w - b.w; + return (cx > -VECMATH_AOS_EPSILON && cx < VECMATH_AOS_EPSILON && cy > -VECMATH_AOS_EPSILON && + cy < VECMATH_AOS_EPSILON && cz > -VECMATH_AOS_EPSILON && cz < VECMATH_AOS_EPSILON && + cw > -VECMATH_AOS_EPSILON && cw < VECMATH_AOS_EPSILON); +} +} + +/////////////////////////////////////////////////////// + +PX_FORCE_INLINE bool isValidVec3V(const Vec3V a) +{ + return a.pad == 0.f; +} + +PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a) +{ + return PxIsFinite(a.x); +} + +PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a) +{ + return PxIsFinite(a.x) && PxIsFinite(a.y) && PxIsFinite(a.z); +} + +PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a) +{ + return PxIsFinite(a.x) && PxIsFinite(a.y) && PxIsFinite(a.z) && PxIsFinite(a.w); +} + +///////////////////////////////////////////////////////////////////// +////VECTORISED FUNCTION IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE FloatV FLoad(const PxF32 f) +{ + return FloatV(f); +} + +PX_FORCE_INLINE Vec3V V3Load(const PxF32 f) +{ + return Vec3V(f, f, f); +} + +PX_FORCE_INLINE Vec4V V4Load(const PxF32 f) +{ + return Vec4V(f, f, f, f); +} + +PX_FORCE_INLINE BoolV BLoad(const bool f) +{ +#if PX_ARM + // SD: Android ARM builds fail if this is done with a cast. + // Might also fail because of something else but the select + // operator here seems to fix everything that failed in release builds. + return f ? BTTTT() : BFFFF(); +#else + return BoolV(BOOL_TO_U32(f), BOOL_TO_U32(f), BOOL_TO_U32(f), BOOL_TO_U32(f)); +#endif +} + +PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f) +{ + return Vec3V(f.x, f.y, f.z); +} + +PX_FORCE_INLINE Vec3V V3LoadU(const PxVec3& f) +{ + return Vec3V(f.x, f.y, f.z); +} + +PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f) +{ + return Vec3V(f.x, f.y, f.z); +} + +PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* const f) +{ + return Vec3V(f[0], f[1], f[2]); +} + +PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* const f) +{ + return Vec3V(f[0], f[1], f[2]); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V(Vec4V f) +{ + return Vec3V(f.x, f.y, f.z); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V_WUndefined(const Vec4V v) +{ + return Vec3V(v.x, v.y, v.z); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_Vec3V(Vec3V f) +{ + return Vec4V(f.x, f.y, f.z, 0.0f); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_FloatV(FloatV f) +{ + return Vec4V(f.x, f.x, f.x, f.x); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_FloatV(FloatV f) +{ + return Vec3V(f.x, f.x, f.x); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_FloatV_WUndefined(FloatV f) +{ + return Vec3V(f.x, f.x, f.x); +} + +PX_FORCE_INLINE Vec4V V4LoadA(const PxF32* const f) +{ + return Vec4V(f[0], f[1], f[2], f[3]); +} + +PX_FORCE_INLINE void V4StoreA(const Vec4V a, PxF32* f) +{ + *reinterpret_cast(f) = a; +} + +PX_FORCE_INLINE void V4StoreU(const Vec4V a, PxF32* f) +{ + *reinterpret_cast(f) = *reinterpret_cast(&a.x); +} + +PX_FORCE_INLINE void BStoreA(const BoolV a, PxU32* f) +{ + *reinterpret_cast(f) = a; +} + +PX_FORCE_INLINE void U4StoreA(const VecU32V uv, PxU32* u) +{ + *reinterpret_cast(u) = uv; +} + +PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i) +{ + *reinterpret_cast(i) = iv; +} + +PX_FORCE_INLINE Vec4V V4LoadU(const PxF32* const f) +{ + return Vec4V(f[0], f[1], f[2], f[3]); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_PxVec3_WUndefined(const PxVec3& f) +{ + return Vec4V(f[0], f[1], f[2], 0.0f); +} + +PX_FORCE_INLINE BoolV BLoad(const bool* const f) +{ + return BoolV(BOOL_TO_U32(f[0]), BOOL_TO_U32(f[1]), BOOL_TO_U32(f[2]), BOOL_TO_U32(f[3])); +} + +PX_FORCE_INLINE void FStore(const FloatV a, PxF32* PX_RESTRICT f) +{ + *f = a.x; +} + +PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f) +{ + f = PxVec3(a.x, a.y, a.z); +} + +PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f) +{ + f = PxVec3(a.x, a.y, a.z); +} + +PX_FORCE_INLINE void Store_From_BoolV(const BoolV b, PxU32* b2) +{ + *b2 = b.ux; +} + +////////////////////////// +// FLOATV +////////////////////////// + +PX_FORCE_INLINE FloatV FZero() +{ + return FLoad(0.0f); +} + +PX_FORCE_INLINE FloatV FOne() +{ + return FLoad(1.0f); +} + +PX_FORCE_INLINE FloatV FHalf() +{ + return FLoad(0.5f); +} + +PX_FORCE_INLINE FloatV FEps() +{ + return FLoad(PX_EPS_REAL); +} + +PX_FORCE_INLINE FloatV FEps6() +{ + return FLoad(1e-6f); +} + +//! \cond +PX_FORCE_INLINE FloatV FMax() +{ + return FLoad(PX_MAX_REAL); +} +//! \endcond + +PX_FORCE_INLINE FloatV FNegMax() +{ + return FLoad(-PX_MAX_REAL); +} + +PX_FORCE_INLINE FloatV FNeg(const FloatV f) +{ + return FloatV(-f.x); +} + +PX_FORCE_INLINE FloatV FAdd(const FloatV a, const FloatV b) +{ + return FloatV(a.x + b.x); +} + +PX_FORCE_INLINE FloatV FSub(const FloatV a, const FloatV b) +{ + return FloatV(a.x - b.x); +} + +PX_FORCE_INLINE FloatV FMul(const FloatV a, const FloatV b) +{ + return FloatV(a.x * b.x); +} + +PX_FORCE_INLINE FloatV FDiv(const FloatV a, const FloatV b) +{ + VECMATHAOS_ASSERT(b.x != 0.0f); + return FloatV(a.x / b.x); +} + +PX_FORCE_INLINE FloatV FDivFast(const FloatV a, const FloatV b) +{ + VECMATHAOS_ASSERT(b.x != 0.0f); + return FloatV(a.x / b.x); +} + +PX_FORCE_INLINE FloatV FRecip(const FloatV a) +{ + VECMATHAOS_ASSERT(a.x != 0.0f); + return 1.0f / a.x; +} + +PX_FORCE_INLINE FloatV FRecipFast(const FloatV a) +{ + VECMATHAOS_ASSERT(a.x != 0.0f); + return 1.0f / a.x; +} + +PX_FORCE_INLINE FloatV FRsqrt(const FloatV a) +{ + VECMATHAOS_ASSERT(a.x != 0.0f); + return PxRecipSqrt(a.x); +} + +PX_FORCE_INLINE FloatV FSqrt(const FloatV a) +{ + return PxSqrt(a.x); +} + +PX_FORCE_INLINE FloatV FRsqrtFast(const FloatV a) +{ + VECMATHAOS_ASSERT(a.x != 0.0f); + return PxRecipSqrt(a.x); +} + +PX_FORCE_INLINE FloatV FScaleAdd(const FloatV a, const FloatV b, const FloatV c) +{ + return FAdd(FMul(a, b), c); +} + +PX_FORCE_INLINE FloatV FNegScaleSub(const FloatV a, const FloatV b, const FloatV c) +{ + return FSub(c, FMul(a, b)); +} + +PX_FORCE_INLINE FloatV FAbs(const FloatV a) +{ + return FloatV(PxAbs(a.x)); +} + +PX_FORCE_INLINE FloatV FSel(const BoolV c, const FloatV a, const FloatV b) +{ + return FloatV(c.ux ? a.x : b.x); +} + +PX_FORCE_INLINE BoolV FIsGrtr(const FloatV a, const FloatV b) +{ + return BLoad(a.x > b.x); +} + +PX_FORCE_INLINE BoolV FIsGrtrOrEq(const FloatV a, const FloatV b) +{ + return BLoad(a.x >= b.x); +} + +PX_FORCE_INLINE BoolV FIsEq(const FloatV a, const FloatV b) +{ + return BLoad(a.x == b.x); +} + +PX_FORCE_INLINE FloatV FMax(const FloatV a, const FloatV b) +{ + return (a.x > b.x ? FloatV(a.x) : FloatV(b.x)); +} + +PX_FORCE_INLINE FloatV FMin(const FloatV a, const FloatV b) +{ + return (a.x > b.x ? FloatV(b.x) : FloatV(a.x)); +} + +PX_FORCE_INLINE FloatV FClamp(const FloatV a, const FloatV minV, const FloatV maxV) +{ + return FMax(FMin(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 FAllGrtr(const FloatV a, const FloatV b) +{ + return BOOL_TO_U32(a.x > b.x); +} + +PX_FORCE_INLINE PxU32 FAllGrtrOrEq(const FloatV a, const FloatV b) +{ + return BOOL_TO_U32(a.x >= b.x); +} +PX_FORCE_INLINE PxU32 FAllEq(const FloatV a, const FloatV b) +{ + return BOOL_TO_U32(a.x == b.x); +} + +PX_FORCE_INLINE FloatV FRound(const FloatV a) +{ + return floorf(a.x + 0.5f); +} + +PX_FORCE_INLINE FloatV FSin(const FloatV a) +{ + return sinf(a.x); +} + +PX_FORCE_INLINE FloatV FCos(const FloatV a) +{ + return cosf(a.x); +} + +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV min, const FloatV max) +{ + return BOOL_TO_U32(a.x > max.x || a.x < min.x); +} + +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV min, const FloatV max) +{ + return BOOL_TO_U32(a.x >= min.x && a.x <= max.x); +} + +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV bounds) +{ + return FOutOfBounds(a, FNeg(bounds), bounds); +} + +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV bounds) +{ + return FInBounds(a, FNeg(bounds), bounds); +} + +///////////////////// +// VEC3V +///////////////////// + +PX_FORCE_INLINE Vec3V V3Splat(const FloatV f) +{ + return Vec3V(f.x, f.x, f.x); +} + +PX_FORCE_INLINE Vec3V V3Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z) +{ + return Vec3V(x.x, y.x, z.x); +} + +PX_FORCE_INLINE Vec3V V3UnitX() +{ + return Vec3V(1.0f, 0.0f, 0.0f); +} + +PX_FORCE_INLINE Vec3V V3UnitY() +{ + return Vec3V(0.0f, 1.0f, 0.0f); +} + +PX_FORCE_INLINE Vec3V V3UnitZ() +{ + return Vec3V(0.0f, 0.0f, 1.0f); +} + +PX_FORCE_INLINE FloatV V3GetX(const Vec3V f) +{ + return FloatV(f.x); +} + +PX_FORCE_INLINE FloatV V3GetY(const Vec3V f) +{ + return FloatV(f.y); +} + +PX_FORCE_INLINE FloatV V3GetZ(const Vec3V f) +{ + return FloatV(f.z); +} + +PX_FORCE_INLINE Vec3V V3SetX(const Vec3V v, const FloatV f) +{ + return Vec3V(f.x, v.y, v.z); +} + +PX_FORCE_INLINE Vec3V V3SetY(const Vec3V v, const FloatV f) +{ + return Vec3V(v.x, f.x, v.z); +} + +PX_FORCE_INLINE Vec3V V3SetZ(const Vec3V v, const FloatV f) +{ + return Vec3V(v.x, v.y, f.x); +} + +PX_FORCE_INLINE Vec3V V3ColX(const Vec3V a, const Vec3V b, const Vec3V c) +{ + return Vec3V(a.x, b.x, c.x); +} + +PX_FORCE_INLINE Vec3V V3ColY(const Vec3V a, const Vec3V b, const Vec3V c) +{ + return Vec3V(a.y, b.y, c.y); +} + +PX_FORCE_INLINE Vec3V V3ColZ(const Vec3V a, const Vec3V b, const Vec3V c) +{ + return Vec3V(a.z, b.z, c.z); +} + +PX_FORCE_INLINE Vec3V V3Zero() +{ + return V3Load(0.0f); +} + +PX_FORCE_INLINE Vec3V V3One() +{ + return V3Load(1.0f); +} + +PX_FORCE_INLINE Vec3V V3Eps() +{ + return V3Load(PX_EPS_REAL); +} + +PX_FORCE_INLINE Vec3V V3Neg(const Vec3V c) +{ + return Vec3V(-c.x, -c.y, -c.z); +} + +PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.x + b.x, a.y + b.y, a.z + b.z); +} + +PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.x - b.x, a.y - b.y, a.z - b.z); +} + +PX_FORCE_INLINE Vec3V V3Scale(const Vec3V a, const FloatV b) +{ + return Vec3V(a.x * b.x, a.y * b.x, a.z * b.x); +} + +PX_FORCE_INLINE Vec3V V3Mul(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.x * b.x, a.y * b.y, a.z * b.z); +} + +PX_FORCE_INLINE Vec3V V3ScaleInv(const Vec3V a, const FloatV b) +{ + const PxF32 bInv = 1.0f / b.x; + return Vec3V(a.x * bInv, a.y * bInv, a.z * bInv); +} + +PX_FORCE_INLINE Vec3V V3Div(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.x / b.x, a.y / b.y, a.z / b.z); +} + +PX_FORCE_INLINE Vec3V V3ScaleInvFast(const Vec3V a, const FloatV b) +{ + const PxF32 bInv = 1.0f / b.x; + return Vec3V(a.x * bInv, a.y * bInv, a.z * bInv); +} + +PX_FORCE_INLINE Vec3V V3DivFast(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.x / b.x, a.y / b.y, a.z / b.z); +} + +PX_FORCE_INLINE Vec3V V3Recip(const Vec3V a) +{ + return Vec3V(1.0f / a.x, 1.0f / a.y, 1.0f / a.z); +} + +PX_FORCE_INLINE Vec3V V3RecipFast(const Vec3V a) +{ + return Vec3V(1.0f / a.x, 1.0f / a.y, 1.0f / a.z); +} + +PX_FORCE_INLINE Vec3V V3Rsqrt(const Vec3V a) +{ + return Vec3V(PxRecipSqrt(a.x), PxRecipSqrt(a.y), PxRecipSqrt(a.z)); +} + +PX_FORCE_INLINE Vec3V V3RsqrtFast(const Vec3V a) +{ + return Vec3V(PxRecipSqrt(a.x), PxRecipSqrt(a.y), PxRecipSqrt(a.z)); +} + +PX_FORCE_INLINE Vec3V V3ScaleAdd(const Vec3V a, const FloatV b, const Vec3V c) +{ + return V3Add(V3Scale(a, b), c); +} + +PX_FORCE_INLINE Vec3V V3NegScaleSub(const Vec3V a, const FloatV b, const Vec3V c) +{ + return V3Sub(c, V3Scale(a, b)); +} + +PX_FORCE_INLINE Vec3V V3MulAdd(const Vec3V a, const Vec3V b, const Vec3V c) +{ + return V3Add(V3Mul(a, b), c); +} + +PX_FORCE_INLINE Vec3V V3NegMulSub(const Vec3V a, const Vec3V b, const Vec3V c) +{ + return V3Sub(c, V3Mul(a, b)); +} + +PX_FORCE_INLINE FloatV V3Dot(const Vec3V a, const Vec3V b) +{ + return FloatV(a.x * b.x + a.y * b.y + a.z * b.z); +} + +PX_FORCE_INLINE VecCrossV V3PrepareCross(const Vec3VArg normal) +{ + return normal; +} + +PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); +} + +PX_FORCE_INLINE FloatV V3Length(const Vec3V a) +{ + return FloatV(PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z)); +} + +PX_FORCE_INLINE FloatV V3LengthSq(const Vec3V a) +{ + return FloatV(a.x * a.x + a.y * a.y + a.z * a.z); +} + +PX_FORCE_INLINE Vec3V V3Normalize(const Vec3V a) +{ + VECMATHAOS_ASSERT(a.x != 0 || a.y != 0 || a.z != 0); + const PxF32 lengthInv = 1.0f / PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z); + return Vec3V(a.x * lengthInv, a.y * lengthInv, a.z * lengthInv); +} + +PX_FORCE_INLINE Vec3V V3NormalizeSafe(const Vec3V a, const Vec3V unsafeReturnValue) +{ + const PxF32 length = PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z); + if(PX_EPS_REAL >= length) + { + return unsafeReturnValue; + } + else + { + const PxF32 lengthInv = 1.0f / length; + return Vec3V(a.x * lengthInv, a.y * lengthInv, a.z * lengthInv); + } +} + +PX_FORCE_INLINE Vec3V V3NormalizeFast(const Vec3V a) +{ + VECMATHAOS_ASSERT(a.x != 0 || a.y != 0 || a.z != 0); + const PxF32 lengthInv = 1.0f / PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z); + return Vec3V(a.x * lengthInv, a.y * lengthInv, a.z * lengthInv); +} + +PX_FORCE_INLINE Vec3V V3Sel(const BoolV c, const Vec3V a, const Vec3V b) +{ + return Vec3V(c.ux ? a.x : b.x, c.uy ? a.y : b.y, c.uz ? a.z : b.z); +} + +PX_FORCE_INLINE BoolV V3IsGrtr(const Vec3V a, const Vec3V b) +{ + return BoolV(BOOL_TO_U32(a.x > b.x), BOOL_TO_U32(a.y > b.y), BOOL_TO_U32(a.z > b.z), FALSE_TO_U32); +} + +PX_FORCE_INLINE BoolV V3IsGrtrOrEq(const Vec3V a, const Vec3V b) +{ + return BoolV(BOOL_TO_U32(a.x >= b.x), BOOL_TO_U32(a.y >= b.y), BOOL_TO_U32(a.z >= b.z), TRUE_TO_U32); +} + +PX_FORCE_INLINE BoolV V3IsEq(const Vec3V a, const Vec3V b) +{ + return BoolV(BOOL_TO_U32(a.x == b.x), BOOL_TO_U32(a.y == b.y), BOOL_TO_U32(a.z == b.z), TRUE_TO_U32); +} + +PX_FORCE_INLINE Vec3V V3Max(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.x > b.x ? a.x : b.x, a.y > b.y ? a.y : b.y, a.z > b.z ? a.z : b.z); +} + +PX_FORCE_INLINE Vec3V V3Min(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.x < b.x ? a.x : b.x, a.y < b.y ? a.y : b.y, a.z < b.z ? a.z : b.z); +} + +PX_FORCE_INLINE FloatV V3ExtractMax(const Vec3V a) +{ + const PxF32 t0 = (a.x >= a.y) ? a.x : a.y; + return t0 >= a.z ? t0 : a.z; +} + +PX_FORCE_INLINE FloatV V3ExtractMin(const Vec3V a) +{ + const PxF32 t0 = (a.x <= a.y) ? a.x : a.y; + return t0 <= a.z ? t0 : a.z; +} + +// return (a >= 0.0f) ? 1.0f : -1.0f; +PX_FORCE_INLINE Vec3V V3Sign(const Vec3V a) +{ + return Vec3V((a.x >= 0.f ? 1.f : -1.f), (a.y >= 0.f ? 1.f : -1.f), (a.z >= 0.f ? 1.f : -1.f)); +} + +PX_FORCE_INLINE Vec3V V3Clamp(const Vec3V a, const Vec3V minV, const Vec3V maxV) +{ + return V3Max(V3Min(a, maxV), minV); +} + +PX_FORCE_INLINE Vec3V V3Abs(const Vec3V a) +{ + return V3Max(a, V3Neg(a)); +} + +PX_FORCE_INLINE PxU32 V3AllGrtr(const Vec3V a, const Vec3V b) +{ + return BOOL_TO_U32((a.x > b.x) & (a.y > b.y) & (a.z > b.z)); +} + +PX_FORCE_INLINE PxU32 V3AllGrtrOrEq(const Vec3V a, const Vec3V b) +{ + return BOOL_TO_U32((a.x >= b.x) & (a.y >= b.y) & (a.z >= b.z)); +} + +PX_FORCE_INLINE PxU32 V3AllEq(const Vec3V a, const Vec3V b) +{ + return BOOL_TO_U32((a.x == b.x) & (a.y == b.y) & (a.z == b.z)); +} + +PX_FORCE_INLINE Vec3V V3Round(const Vec3V a) +{ + return Vec3V(floorf(a.x + 0.5f), floorf(a.y + 0.5f), floorf(a.z + 0.5f)); +} + +PX_FORCE_INLINE Vec3V V3Sin(const Vec3V a) +{ + return Vec3V(sinf(a.x), sinf(a.y), sinf(a.z)); +} + +PX_FORCE_INLINE Vec3V V3Cos(const Vec3V a) +{ + return Vec3V(cosf(a.x), cosf(a.y), cosf(a.z)); +} + +PX_FORCE_INLINE Vec3V V3PermYZZ(const Vec3V a) +{ + return Vec3V(a.y, a.z, a.z); +} + +PX_FORCE_INLINE Vec3V V3PermXYX(const Vec3V a) +{ + return Vec3V(a.x, a.y, a.x); +} + +PX_FORCE_INLINE Vec3V V3PermYZX(const Vec3V a) +{ + return Vec3V(a.y, a.z, a.x); +} + +PX_FORCE_INLINE Vec3V V3PermZXY(const Vec3V a) +{ + return Vec3V(a.z, a.x, a.y); +} + +PX_FORCE_INLINE Vec3V V3PermZZY(const Vec3V a) +{ + return Vec3V(a.z, a.z, a.y); +} + +PX_FORCE_INLINE Vec3V V3PermYXX(const Vec3V a) +{ + return Vec3V(a.y, a.x, a.x); +} + +PX_FORCE_INLINE Vec3V V3Perm_Zero_1Z_0Y(const Vec3V v0, const Vec3V v1) +{ + return Vec3V(0.0f, v1.z, v0.y); +} + +PX_FORCE_INLINE Vec3V V3Perm_0Z_Zero_1X(const Vec3V v0, const Vec3V v1) +{ + return Vec3V(v0.z, 0.0f, v1.x); +} + +PX_FORCE_INLINE Vec3V V3Perm_1Y_0X_Zero(const Vec3V v0, const Vec3V v1) +{ + return Vec3V(v1.y, v0.x, 0.0f); +} + +PX_FORCE_INLINE FloatV V3SumElems(const Vec3V a) +{ + return FloatV(a.x + a.y + a.z); +} + +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V min, const Vec3V max) +{ + return BOOL_TO_U32(a.x > max.x || a.y > max.y || a.z > max.z || a.x < min.x || a.y < min.y || a.z < min.z); +} + +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V min, const Vec3V max) +{ + return BOOL_TO_U32(a.x <= max.x && a.y <= max.y && a.z <= max.z && a.x >= min.x && a.y >= min.y && a.z >= min.z); +} + +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V bounds) +{ + return V3OutOfBounds(a, V3Neg(bounds), bounds); +} + +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V bounds) +{ + return V3InBounds(a, V3Neg(bounds), bounds); +} + +PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2) +{ + const PxF32 t01 = col0.y, t02 = col0.z, t12 = col1.z; + col0.y = col1.x; + col0.z = col2.x; + col1.z = col2.y; + col1.x = t01; + col2.x = t02; + col2.y = t12; +} + +///////////////////////// +// VEC4V +///////////////////////// + +PX_FORCE_INLINE Vec4V V4Splat(const FloatV f) +{ + return Vec4V(f.x, f.x, f.x, f.x); +} + +PX_FORCE_INLINE Vec4V V4Merge(const FloatV* const floatVArray) +{ + return Vec4V(floatVArray[0].x, floatVArray[1].x, floatVArray[2].x, floatVArray[3].x); +} + +PX_FORCE_INLINE Vec4V V4Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w) +{ + return Vec4V(x.x, y.x, z.x, w.x); +} + +PX_FORCE_INLINE Vec4V V4MergeW(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + return Vec4V(x.w, y.w, z.w, w.w); +} + +PX_FORCE_INLINE Vec4V V4MergeZ(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + return Vec4V(x.z, y.z, z.z, w.z); +} + +PX_FORCE_INLINE Vec4V V4MergeY(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + return Vec4V(x.y, y.y, z.y, w.y); +} + +PX_FORCE_INLINE Vec4V V4MergeX(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + return Vec4V(x.x, y.x, z.x, w.x); +} + +PX_FORCE_INLINE Vec4V V4UnpackXY(const Vec4VArg a, const Vec4VArg b) +{ + return Vec4V(a.x, b.x, a.y, b.y); +} + +PX_FORCE_INLINE Vec4V V4UnpackZW(const Vec4VArg a, const Vec4VArg b) +{ + return Vec4V(a.z, b.z, a.w, b.w); +} + +PX_FORCE_INLINE Vec4V V4UnitX() +{ + return Vec4V(1.0f, 0.0f, 0.0f, 0.0f); +} + +PX_FORCE_INLINE Vec4V V4UnitY() +{ + return Vec4V(0.0f, 1.0f, 0.0f, 0.0f); +} + +PX_FORCE_INLINE Vec4V V4UnitZ() +{ + return Vec4V(0.0f, 0.0f, 1.0f, 0.0f); +} + +PX_FORCE_INLINE Vec4V V4UnitW() +{ + return Vec4V(0.0f, 0.0f, 0.0f, 1.0f); +} + +PX_FORCE_INLINE FloatV V4GetX(const Vec4V f) +{ + return FloatV(f.x); +} + +PX_FORCE_INLINE FloatV V4GetY(const Vec4V f) +{ + return FloatV(f.y); +} + +PX_FORCE_INLINE FloatV V4GetZ(const Vec4V f) +{ + return FloatV(f.z); +} + +PX_FORCE_INLINE FloatV V4GetW(const Vec4V f) +{ + return FloatV(f.w); +} + +PX_FORCE_INLINE Vec4V V4SetX(const Vec4V v, const FloatV f) +{ + return Vec4V(f.x, v.y, v.z, v.w); +} + +PX_FORCE_INLINE Vec4V V4SetY(const Vec4V v, const FloatV f) +{ + return Vec4V(v.x, f.x, v.z, v.w); +} + +PX_FORCE_INLINE Vec4V V4SetZ(const Vec4V v, const FloatV f) +{ + return Vec4V(v.x, v.y, f.x, v.w); +} + +PX_FORCE_INLINE Vec4V V4SetW(const Vec4V v, const FloatV f) +{ + return Vec4V(v.x, v.y, v.z, f.x); +} + +PX_FORCE_INLINE Vec4V V4SetW(const Vec3V v, const FloatV f) +{ + return Vec4V(v.x, v.y, v.z, f.x); +} + +PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v) +{ + return Vec4V(v.x, v.y, v.z, 0.0f); +} + +PX_FORCE_INLINE Vec4V V4PermYXWZ(const Vec4V v) +{ + return Vec4V(v.y, v.x, v.w, v.z); +} + +PX_FORCE_INLINE Vec4V V4PermXZXZ(const Vec4V v) +{ + return Vec4V(v.x, v.z, v.x, v.z); +} + +PX_FORCE_INLINE Vec4V V4PermYWYW(const Vec4V v) +{ + return Vec4V(v.y, v.w, v.y, v.w); +} + +PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V v) +{ + return Vec4V(v.y, v.z, v.x, v.w); +} + +PX_FORCE_INLINE Vec4V V4PermZWXY(const Vec4V v) +{ + return Vec4V(v.z, v.w, v.x, v.y); +} + +template +PX_FORCE_INLINE Vec4V V4Perm(const Vec4V v) +{ + const PxF32 f[4] = { v.x, v.y, v.z, v.w }; + return Vec4V(f[_x], f[_y], f[_z], f[_w]); +} + +PX_FORCE_INLINE Vec4V V4Zero() +{ + return V4Load(0.0f); +} + +PX_FORCE_INLINE Vec4V V4One() +{ + return V4Load(1.0f); +} + +PX_FORCE_INLINE Vec4V V4Eps() +{ + return V4Load(PX_EPS_REAL); +} + +PX_FORCE_INLINE Vec4V V4Neg(const Vec4V c) +{ + return Vec4V(-c.x, -c.y, -c.z, -c.w); +} + +PX_FORCE_INLINE Vec4V V4Add(const Vec4V a, const Vec4V b) +{ + return Vec4V(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w); +} + +PX_FORCE_INLINE Vec4V V4Sub(const Vec4V a, const Vec4V b) +{ + return Vec4V(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w); +} + +PX_FORCE_INLINE Vec4V V4Scale(const Vec4V a, const FloatV b) +{ + return Vec4V(a.x * b.x, a.y * b.x, a.z * b.x, a.w * b.x); +} + +PX_FORCE_INLINE Vec4V V4Mul(const Vec4V a, const Vec4V b) +{ + return Vec4V(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w); +} + +PX_FORCE_INLINE Vec4V V4ScaleInv(const Vec4V a, const FloatV b) +{ + const PxF32 bInv = 1.0f / b.x; + return Vec4V(a.x * bInv, a.y * bInv, a.z * bInv, a.w * bInv); +} + +PX_FORCE_INLINE Vec4V V4Div(const Vec4V a, const Vec4V b) +{ + VECMATHAOS_ASSERT(b.x != 0 && b.y != 0 && b.z != 0 && b.w != 0); + return Vec4V(a.x / b.x, a.y / b.y, a.z / b.z, a.w / b.w); +} + +PX_FORCE_INLINE Vec4V V4ScaleInvFast(const Vec4V a, const FloatV b) +{ + const PxF32 bInv = 1.0f / b.x; + return Vec4V(a.x * bInv, a.y * bInv, a.z * bInv, a.w * bInv); +} + +PX_FORCE_INLINE Vec4V V4DivFast(const Vec4V a, const Vec4V b) +{ + return Vec4V(a.x / b.x, a.y / b.y, a.z / b.z, a.w / b.w); +} + +PX_FORCE_INLINE Vec4V V4Recip(const Vec4V a) +{ + return Vec4V(1.0f / a.x, 1.0f / a.y, 1.0f / a.z, 1.0f / a.w); +} + +PX_FORCE_INLINE Vec4V V4RecipFast(const Vec4V a) +{ + return Vec4V(1.0f / a.x, 1.0f / a.y, 1.0f / a.z, 1.0f / a.w); +} + +PX_FORCE_INLINE Vec4V V4Rsqrt(const Vec4V a) +{ + return Vec4V(PxRecipSqrt(a.x), PxRecipSqrt(a.y), PxRecipSqrt(a.z), PxRecipSqrt(a.w)); +} + +PX_FORCE_INLINE Vec4V V4RsqrtFast(const Vec4V a) +{ + return Vec4V(PxRecipSqrt(a.x), PxRecipSqrt(a.y), PxRecipSqrt(a.z), PxRecipSqrt(a.w)); +} + +PX_FORCE_INLINE Vec4V V4Sqrt(const Vec4V a) +{ + return Vec4V(PxSqrt(a.x), PxSqrt(a.y), PxSqrt(a.z), PxSqrt(a.w)); +} + +PX_FORCE_INLINE Vec4V V4ScaleAdd(const Vec4V a, const FloatV b, const Vec4V c) +{ + return V4Add(V4Scale(a, b), c); +} + +PX_FORCE_INLINE Vec4V V4NegScaleSub(const Vec4V a, const FloatV b, const Vec4V c) +{ + return V4Sub(c, V4Scale(a, b)); +} + +PX_FORCE_INLINE Vec4V V4MulAdd(const Vec4V a, const Vec4V b, const Vec4V c) +{ + return V4Add(V4Mul(a, b), c); +} + +PX_FORCE_INLINE Vec4V V4NegMulSub(const Vec4V a, const Vec4V b, const Vec4V c) +{ + return V4Sub(c, V4Mul(a, b)); +} + +PX_FORCE_INLINE FloatV V4SumElements(const Vec4V a) +{ + return FloatV(a.x + a.y + a.z + a.w); +} + +PX_FORCE_INLINE FloatV V4Dot(const Vec4V a, const Vec4V b) +{ + return FloatV(a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w); +} + +PX_FORCE_INLINE FloatV V4Dot3(const Vec4V a, const Vec4V b) +{ + return FloatV(a.x * b.x + a.y * b.y + a.z * b.z); +} + +PX_FORCE_INLINE Vec4V V4Cross(const Vec4V a, const Vec4V b) +{ + return Vec4V(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x, 0.0f); +} + +PX_FORCE_INLINE FloatV V4Length(const Vec4V a) +{ + return FloatV(PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z + a.w * a.w)); +} + +PX_FORCE_INLINE FloatV V4LengthSq(const Vec4V a) +{ + return V4Dot(a, a); +} + +PX_FORCE_INLINE Vec4V V4Normalize(const Vec4V a) +{ + VECMATHAOS_ASSERT(0 != a.x || 0 != a.y || 0 != a.z || 0 != a.w); + const FloatV length = FloatV(V4Length(a)); + return V4ScaleInv(a, length); +} + +PX_FORCE_INLINE Vec4V V4NormalizeSafe(const Vec4V a, const Vec4V unsafeReturnValue) +{ + const FloatV length = FloatV(V4Length(a)); + if(PX_EPS_REAL >= length.x) + { + return unsafeReturnValue; + } + else + { + return V4ScaleInv(a, length); + } +} +PX_FORCE_INLINE Vec4V V4NormalizeFast(const Vec4V a) +{ + VECMATHAOS_ASSERT(0 != a.x || 0 != a.y || 0 != a.z || 0 != a.w); + const FloatV length = FloatV(V4Length(a)); + return V4ScaleInv(a, length); +} + +PX_FORCE_INLINE Vec4V V4Sel(const BoolV c, const Vec4V a, const Vec4V b) +{ + return Vec4V(c.ux ? a.x : b.x, c.uy ? a.y : b.y, c.uz ? a.z : b.z, c.uw ? a.w : b.w); +} + +PX_FORCE_INLINE BoolV V4IsGrtr(const Vec4V a, const Vec4V b) +{ + return BoolV(BOOL_TO_U32(a.x > b.x), BOOL_TO_U32(a.y > b.y), BOOL_TO_U32(a.z > b.z), BOOL_TO_U32(a.w > b.w)); +} + +PX_FORCE_INLINE BoolV V4IsGrtrOrEq(const Vec4V a, const Vec4V b) +{ + return BoolV(BOOL_TO_U32(a.x >= b.x), BOOL_TO_U32(a.y >= b.y), BOOL_TO_U32(a.z >= b.z), BOOL_TO_U32(a.w >= b.w)); +} + +PX_FORCE_INLINE BoolV V4IsEq(const Vec4V a, const Vec4V b) +{ + return BoolV(BOOL_TO_U32(a.x == b.x), BOOL_TO_U32(a.y == b.y), BOOL_TO_U32(a.z == b.z), BOOL_TO_U32(a.w == b.w)); +} + +PX_FORCE_INLINE Vec4V V4Max(const Vec4V a, const Vec4V b) +{ + return Vec4V(a.x > b.x ? a.x : b.x, a.y > b.y ? a.y : b.y, a.z > b.z ? a.z : b.z, a.w > b.w ? a.w : b.w); +} + +PX_FORCE_INLINE Vec4V V4Min(const Vec4V a, const Vec4V b) +{ + return Vec4V(a.x < b.x ? a.x : b.x, a.y < b.y ? a.y : b.y, a.z < b.z ? a.z : b.z, a.w < b.w ? a.w : b.w); +} + +PX_FORCE_INLINE FloatV V4ExtractMax(const Vec4V a) +{ + const PxF32 t0 = (a.x >= a.y) ? a.x : a.y; + const PxF32 t1 = (a.z >= a.w) ? a.x : a.w; + return t0 >= t1 ? t0 : t1; +} + +PX_FORCE_INLINE FloatV V4ExtractMin(const Vec4V a) +{ + const PxF32 t0 = (a.x <= a.y) ? a.x : a.y; + const PxF32 t1 = (a.z <= a.w) ? a.x : a.w; + return t0 <= t1 ? t0 : t1; +} + +PX_FORCE_INLINE Vec4V V4Clamp(const Vec4V a, const Vec4V minV, const Vec4V maxV) +{ + return V4Max(V4Min(a, maxV), minV); +} + +PX_FORCE_INLINE Vec4V V4Round(const Vec4V a) +{ + return Vec4V(floorf(a.x + 0.5f), floorf(a.y + 0.5f), floorf(a.z + 0.5f), floorf(a.w + 0.5f)); +} + +PX_FORCE_INLINE Vec4V V4Sin(const Vec4V a) +{ + return Vec4V(sinf(a.x), sinf(a.y), sinf(a.z), sinf(a.w)); +} + +PX_FORCE_INLINE Vec4V V4Cos(const Vec4V a) +{ + return Vec4V(cosf(a.x), cosf(a.y), cosf(a.z), cosf(a.w)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtr(const Vec4V a, const Vec4V b) +{ + return BOOL_TO_U32((a.x > b.x) & (a.y > b.y) & (a.z > b.z) & (a.w > b.w)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq(const Vec4V a, const Vec4V b) +{ + return BOOL_TO_U32((a.x >= b.x) & (a.y >= b.y) & (a.z >= b.z) & (a.w >= b.w)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq3(const Vec4V a, const Vec4V b) +{ + return BOOL_TO_U32((a.x >= b.x) & (a.y >= b.y) & (a.z >= b.z)); +} + +PX_FORCE_INLINE PxU32 V4AllEq(const Vec4V a, const Vec4V b) +{ + return BOOL_TO_U32((a.x == b.x) & (a.y == b.y) & (a.z == b.z) & (a.w == b.w)); +} + +PX_FORCE_INLINE PxU32 V4AnyGrtr3(const Vec4V a, const Vec4V b) +{ + return BOOL_TO_U32((a.x > b.x) | (a.y > b.y) | (a.z > b.z)); +} + +PX_FORCE_INLINE void V4Transpose(Vec4V& col0, Vec4V& col1, Vec4V& col2, Vec4V& col3) +{ + const PxF32 t01 = col0.y, t02 = col0.z, t03 = col0.w; + const PxF32 t12 = col1.z, t13 = col1.w; + const PxF32 t23 = col2.w; + col0.y = col1.x; + col0.z = col2.x; + col0.w = col3.x; + col1.z = col2.y; + col1.w = col3.y; + col2.w = col3.z; + col1.x = t01; + col2.x = t02; + col3.x = t03; + col2.y = t12; + col3.y = t13; + col3.z = t23; +} + +PX_FORCE_INLINE BoolV BFFFF() +{ + return BoolV(FALSE_TO_U32, FALSE_TO_U32, FALSE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BFFFT() +{ + return BoolV(FALSE_TO_U32, FALSE_TO_U32, FALSE_TO_U32, TRUE_TO_U32); +} +PX_FORCE_INLINE BoolV BFFTF() +{ + return BoolV(FALSE_TO_U32, FALSE_TO_U32, TRUE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BFFTT() +{ + return BoolV(FALSE_TO_U32, FALSE_TO_U32, TRUE_TO_U32, TRUE_TO_U32); +} +PX_FORCE_INLINE BoolV BFTFF() +{ + return BoolV(FALSE_TO_U32, TRUE_TO_U32, FALSE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BFTFT() +{ + return BoolV(FALSE_TO_U32, TRUE_TO_U32, FALSE_TO_U32, TRUE_TO_U32); +} +PX_FORCE_INLINE BoolV BFTTF() +{ + return BoolV(FALSE_TO_U32, TRUE_TO_U32, TRUE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BFTTT() +{ + return BoolV(FALSE_TO_U32, TRUE_TO_U32, TRUE_TO_U32, TRUE_TO_U32); +} +PX_FORCE_INLINE BoolV BTFFF() +{ + return BoolV(TRUE_TO_U32, FALSE_TO_U32, FALSE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BTFFT() +{ + return BoolV(TRUE_TO_U32, FALSE_TO_U32, FALSE_TO_U32, TRUE_TO_U32); +} +PX_FORCE_INLINE BoolV BTFTF() +{ + return BoolV(TRUE_TO_U32, FALSE_TO_U32, TRUE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BTFTT() +{ + return BoolV(TRUE_TO_U32, FALSE_TO_U32, TRUE_TO_U32, TRUE_TO_U32); +} +PX_FORCE_INLINE BoolV BTTFF() +{ + return BoolV(TRUE_TO_U32, TRUE_TO_U32, FALSE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BTTFT() +{ + return BoolV(TRUE_TO_U32, TRUE_TO_U32, FALSE_TO_U32, TRUE_TO_U32); +} +PX_FORCE_INLINE BoolV BTTTF() +{ + return BoolV(TRUE_TO_U32, TRUE_TO_U32, TRUE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BTTTT() +{ + return BoolV(TRUE_TO_U32, TRUE_TO_U32, TRUE_TO_U32, TRUE_TO_U32); +} + +PX_FORCE_INLINE BoolV BXMask() +{ + return BTFFF(); +} +PX_FORCE_INLINE BoolV BYMask() +{ + return BFTFF(); +} +PX_FORCE_INLINE BoolV BZMask() +{ + return BFFTF(); +} +PX_FORCE_INLINE BoolV BWMask() +{ + return BFFFT(); +} + +PX_FORCE_INLINE BoolV BGetX(const BoolV a) +{ + return BoolV(a.ux, a.ux, a.ux, a.ux); +} + +PX_FORCE_INLINE BoolV BGetY(const BoolV a) +{ + return BoolV(a.uy, a.uy, a.uy, a.uy); +} + +PX_FORCE_INLINE BoolV BGetZ(const BoolV a) +{ + return BoolV(a.uz, a.uz, a.uz, a.uz); +} + +PX_FORCE_INLINE BoolV BGetW(const BoolV a) +{ + return BoolV(a.uw, a.uw, a.uw, a.uw); +} + +PX_FORCE_INLINE BoolV BSetX(const BoolV v, const BoolV f) +{ + return BoolV(f.ux, v.uy, v.uz, v.uw); +} + +PX_FORCE_INLINE BoolV BSetY(const BoolV v, const BoolV f) +{ + return BoolV(v.ux, f.uy, v.uz, v.uw); +} + +PX_FORCE_INLINE BoolV BSetZ(const BoolV v, const BoolV f) +{ + return BoolV(v.ux, v.uy, f.uz, v.uw); +} + +PX_FORCE_INLINE BoolV BSetW(const BoolV v, const BoolV f) +{ + return BoolV(v.ux, v.uy, v.uz, f.uw); +} + +template +BoolV BSplatElement(BoolV a) +{ + PxU32* b = reinterpret_cast(&a); + return BoolV(b[index], b[index], b[index], b[index]); +} + +PX_FORCE_INLINE BoolV BAnd(const BoolV a, const BoolV b) +{ + return BoolV(BOOL_TO_U32(a.ux && b.ux), BOOL_TO_U32(a.uy && b.uy), BOOL_TO_U32(a.uz && b.uz), BOOL_TO_U32(a.uw && b.uw)); +} + +PX_FORCE_INLINE BoolV BAndNot(const BoolV a, const BoolV b) +{ + return BoolV(a.ux & ~b.ux, a.uy & ~b.uy, a.uz & ~b.uz, a.uw & ~b.uw); +} + +PX_FORCE_INLINE BoolV BNot(const BoolV a) +{ + return BoolV(~a.ux, ~a.uy, ~a.uz, ~a.uw); +} + +PX_FORCE_INLINE BoolV BOr(const BoolV a, const BoolV b) +{ + return BoolV(BOOL_TO_U32(a.ux || b.ux), BOOL_TO_U32(a.uy || b.uy), BOOL_TO_U32(a.uz || b.uz), BOOL_TO_U32(a.uw || b.uw)); +} + +PX_FORCE_INLINE PxU32 BAllEq(const BoolV a, const BoolV b) +{ + return (a.ux == b.ux && a.uy == b.uy && a.uz == b.uz && a.uw == b.uw ? 1 : 0); +} + +PX_FORCE_INLINE PxU32 BAllEqTTTT(const BoolV a) +{ + return BAllEq(a, BTTTT()); +} + +PX_FORCE_INLINE PxU32 BAllEqFFFF(const BoolV a) +{ + return BAllEq(a, BFFFF()); +} + +PX_FORCE_INLINE BoolV BAllTrue4(const BoolV a) +{ + return (a.ux & a.uy & a.uz & a.uw) ? BTTTT() : BFFFF(); +} + +PX_FORCE_INLINE BoolV BAnyTrue4(const BoolV a) +{ + return (a.ux | a.uy | a.uz | a.uw) ? BTTTT() : BFFFF(); +} + +PX_FORCE_INLINE BoolV BAllTrue3(const BoolV a) +{ + return (a.ux & a.uy & a.uz) ? BTTTT() : BFFFF(); +} + +PX_FORCE_INLINE BoolV BAnyTrue3(const BoolV a) +{ + return (a.ux | a.uy | a.uz) ? BTTTT() : BFFFF(); +} + +PX_FORCE_INLINE PxU32 BGetBitMask(const BoolV a) +{ + return (a.ux & 1) | (a.uy & 2) | (a.uz & 4) | (a.uw & 8); +} + +////////////////////////////////// +// MAT33V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M33MulV3(const Mat33V& a, const Vec3V b) +{ + return Vec3V(a.col0.x * b.x + a.col1.x * b.y + a.col2.x * b.z, a.col0.y * b.x + a.col1.y * b.y + a.col2.y * b.z, + a.col0.z * b.x + a.col1.z * b.y + a.col2.z * b.z); +} + +PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b) +{ + return Vec3V(a.col0.x * b.x + a.col0.y * b.y + a.col0.z * b.z, a.col1.x * b.x + a.col1.y * b.y + a.col1.z * b.z, + a.col2.x * b.x + a.col2.y * b.y + a.col2.z * b.z); +} + +PX_FORCE_INLINE Vec3V M33MulV3AddV3(const Mat33V& A, const Vec3V b, const Vec3V c) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + Vec3V result = V3ScaleAdd(A.col0, x, c); + result = V3ScaleAdd(A.col1, y, result); + return V3ScaleAdd(A.col2, z, result); +} + +PX_FORCE_INLINE Mat33V M33MulM33(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(M33MulV3(a, b.col0), M33MulV3(a, b.col1), M33MulV3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Add(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Scale(const Mat33V& a, const FloatV& b) +{ + return Mat33V(V3Scale(a.col0, b), V3Scale(a.col1, b), V3Scale(a.col2, b)); +} + +PX_FORCE_INLINE Mat33V M33Sub(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(V3Sub(a.col0, b.col0), V3Sub(a.col1, b.col1), V3Sub(a.col2, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Neg(const Mat33V& a) +{ + return Mat33V(V3Neg(a.col0), V3Neg(a.col1), V3Neg(a.col2)); +} + +PX_FORCE_INLINE Mat33V M33Abs(const Mat33V& a) +{ + return Mat33V(V3Abs(a.col0), V3Abs(a.col1), V3Abs(a.col2)); +} + +PX_FORCE_INLINE Mat33V M33Diagonal(const Vec3VArg d) +{ + const Vec3V x = V3Mul(V3UnitX(), d); + const Vec3V y = V3Mul(V3UnitY(), d); + const Vec3V z = V3Mul(V3UnitZ(), d); + return Mat33V(x, y, z); +} + +PX_FORCE_INLINE Mat33V M33Inverse(const Mat33V& a) +{ + const PxF32 det = a.col0.x * (a.col1.y * a.col2.z - a.col1.z * a.col2.y) - + a.col1.x * (a.col0.y * a.col2.z - a.col2.y * a.col0.z) + + a.col2.x * (a.col0.y * a.col1.z - a.col1.y * a.col0.z); + + const PxF32 invDet = 1.0f / det; + + Mat33V ret; + ret.col0.x = invDet * (a.col1.y * a.col2.z - a.col2.y * a.col1.z); + ret.col0.y = invDet * (a.col2.y * a.col0.z - a.col0.y * a.col2.z); + ret.col0.z = invDet * (a.col0.y * a.col1.z - a.col1.y * a.col0.z); + + ret.col1.x = invDet * (a.col2.x * a.col1.z - a.col1.x * a.col2.z); + ret.col1.y = invDet * (a.col0.x * a.col2.z - a.col2.x * a.col0.z); + ret.col1.z = invDet * (a.col1.x * a.col0.z - a.col0.x * a.col1.z); + + ret.col2.x = invDet * (a.col1.x * a.col2.y - a.col2.x * a.col1.y); + ret.col2.y = invDet * (a.col2.x * a.col0.y - a.col0.x * a.col2.y); + ret.col2.z = invDet * (a.col0.x * a.col1.y - a.col1.x * a.col0.y); + + return ret; +} + +PX_FORCE_INLINE Mat33V Mat33V_From_PxMat33(const PxMat33& m) +{ + return Mat33V(V3LoadU(m.column0), V3LoadU(m.column1), V3LoadU(m.column2)); +} + +PX_FORCE_INLINE void PxMat33_From_Mat33V(const Mat33V& m, PxMat33& out) +{ + PX_ASSERT((size_t(&out) & 15) == 0); + V3StoreU(m.col0, out.column0); + V3StoreU(m.col1, out.column1); + V3StoreU(m.col2, out.column2); +} + +PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a) +{ + return Mat33V(Vec3V(a.col0.x, a.col1.x, a.col2.x), Vec3V(a.col0.y, a.col1.y, a.col2.y), + Vec3V(a.col0.z, a.col1.z, a.col2.z)); +} + +PX_FORCE_INLINE Mat33V M33Identity() +{ + return Mat33V(V3UnitX(), V3UnitY(), V3UnitZ()); +} + +////////////////////////////////// +// MAT34V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M34MulV3(const Mat34V& a, const Vec3V b) +{ + return Vec3V(a.col0.x * b.x + a.col1.x * b.y + a.col2.x * b.z + a.col3.x, + a.col0.y * b.x + a.col1.y * b.y + a.col2.y * b.z + a.col3.y, + a.col0.z * b.x + a.col1.z * b.y + a.col2.z * b.z + a.col3.z); +} + +PX_FORCE_INLINE Vec3V M34Mul33V3(const Mat34V& a, const Vec3V b) +{ + return Vec3V(a.col0.x * b.x + a.col1.x * b.y + a.col2.x * b.z, a.col0.y * b.x + a.col1.y * b.y + a.col2.y * b.z, + a.col0.z * b.x + a.col1.z * b.y + a.col2.z * b.z); +} + +PX_FORCE_INLINE Vec3V M34TrnspsMul33V3(const Mat34V& a, const Vec3V b) +{ + return Vec3V(a.col0.x * b.x + a.col0.y * b.y + a.col0.z * b.z, a.col1.x * b.x + a.col1.y * b.y + a.col1.z * b.z, + a.col2.x * b.x + a.col2.y * b.y + a.col2.z * b.z); +} + +PX_FORCE_INLINE Mat34V M34MulM34(const Mat34V& a, const Mat34V& b) +{ + return Mat34V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2), M34MulV3(a, b.col3)); +} + +PX_FORCE_INLINE Mat33V M34MulM33(const Mat34V& a, const Mat33V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M34Mul33V3(const Mat34V& a, const Mat33V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M34Mul33MM34(const Mat34V& a, const Mat34V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat34V M34Add(const Mat34V& a, const Mat34V& b) +{ + return Mat34V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2), V3Add(a.col3, b.col3)); +} + +PX_FORCE_INLINE Mat33V M34Trnsps33(const Mat34V& a) +{ + return Mat33V(Vec3V(a.col0.x, a.col1.x, a.col2.x), Vec3V(a.col0.y, a.col1.y, a.col2.y), + Vec3V(a.col0.z, a.col1.z, a.col2.z)); +} + +////////////////////////////////// +// MAT44V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V M44MulV4(const Mat44V& a, const Vec4V b) +{ + return Vec4V(a.col0.x * b.x + a.col1.x * b.y + a.col2.x * b.z + a.col3.x * b.w, + a.col0.y * b.x + a.col1.y * b.y + a.col2.y * b.z + a.col3.y * b.w, + a.col0.z * b.x + a.col1.z * b.y + a.col2.z * b.z + a.col3.z * b.w, + a.col0.w * b.x + a.col1.w * b.y + a.col2.w * b.z + a.col3.w * b.w); +} + +PX_FORCE_INLINE Vec4V M44TrnspsMulV4(const Mat44V& a, const Vec4V b) +{ + return Vec4V(a.col0.x * b.x + a.col0.y * b.y + a.col0.z * b.z + a.col0.w * b.w, + a.col1.x * b.x + a.col1.y * b.y + a.col1.z * b.z + a.col1.w * b.w, + a.col2.x * b.x + a.col2.y * b.y + a.col2.z * b.z + a.col2.w * b.w, + a.col3.x * b.x + a.col3.y * b.y + a.col3.z * b.z + a.col3.w * b.w); +} + +PX_FORCE_INLINE Mat44V M44MulM44(const Mat44V& a, const Mat44V& b) +{ + return Mat44V(M44MulV4(a, b.col0), M44MulV4(a, b.col1), M44MulV4(a, b.col2), M44MulV4(a, b.col3)); +} + +PX_FORCE_INLINE Mat44V M44Add(const Mat44V& a, const Mat44V& b) +{ + return Mat44V(V4Add(a.col0, b.col0), V4Add(a.col1, b.col1), V4Add(a.col2, b.col2), V4Add(a.col3, b.col3)); +} + +PX_FORCE_INLINE Mat44V M44Inverse(const Mat44V& a) +{ + PxF32 tmp[12]; + PxF32 dst[16]; + PxF32 det; + + const PxF32 src[16] = { a.col0.x, a.col0.y, a.col0.z, a.col0.w, a.col1.x, a.col1.y, a.col1.z, a.col1.w, + a.col2.x, a.col2.y, a.col2.z, a.col2.w, a.col3.x, a.col3.y, a.col3.z, a.col3.w }; + + tmp[0] = src[10] * src[15]; + tmp[1] = src[11] * src[14]; + tmp[2] = src[9] * src[15]; + tmp[3] = src[11] * src[13]; + tmp[4] = src[9] * src[14]; + tmp[5] = src[10] * src[13]; + tmp[6] = src[8] * src[15]; + tmp[7] = src[11] * src[12]; + tmp[8] = src[8] * src[14]; + tmp[9] = src[10] * src[12]; + tmp[10] = src[8] * src[13]; + tmp[11] = src[9] * src[12]; + + dst[0] = tmp[0] * src[5] + tmp[3] * src[6] + tmp[4] * src[7]; + dst[0] -= tmp[1] * src[5] + tmp[2] * src[6] + tmp[5] * src[7]; + dst[1] = tmp[1] * src[4] + tmp[6] * src[6] + tmp[9] * src[7]; + dst[1] -= tmp[0] * src[4] + tmp[7] * src[6] + tmp[8] * src[7]; + dst[2] = tmp[2] * src[4] + tmp[7] * src[5] + tmp[10] * src[7]; + dst[2] -= tmp[3] * src[4] + tmp[6] * src[5] + tmp[11] * src[7]; + dst[3] = tmp[5] * src[4] + tmp[8] * src[5] + tmp[11] * src[6]; + dst[3] -= tmp[4] * src[4] + tmp[9] * src[5] + tmp[10] * src[6]; + dst[4] = tmp[1] * src[1] + tmp[2] * src[2] + tmp[5] * src[3]; + dst[4] -= tmp[0] * src[1] + tmp[3] * src[2] + tmp[4] * src[3]; + dst[5] = tmp[0] * src[0] + tmp[7] * src[2] + tmp[8] * src[3]; + dst[5] -= tmp[1] * src[0] + tmp[6] * src[2] + tmp[9] * src[3]; + dst[6] = tmp[3] * src[0] + tmp[6] * src[1] + tmp[11] * src[3]; + dst[6] -= tmp[2] * src[0] + tmp[7] * src[1] + tmp[10] * src[3]; + dst[7] = tmp[4] * src[0] + tmp[9] * src[1] + tmp[10] * src[2]; + dst[7] -= tmp[5] * src[0] + tmp[8] * src[1] + tmp[11] * src[2]; + + tmp[0] = src[2] * src[7]; + tmp[1] = src[3] * src[6]; + tmp[2] = src[1] * src[7]; + tmp[3] = src[3] * src[5]; + tmp[4] = src[1] * src[6]; + tmp[5] = src[2] * src[5]; + tmp[6] = src[0] * src[7]; + tmp[7] = src[3] * src[4]; + tmp[8] = src[0] * src[6]; + tmp[9] = src[2] * src[4]; + tmp[10] = src[0] * src[5]; + tmp[11] = src[1] * src[4]; + + dst[8] = tmp[0] * src[13] + tmp[3] * src[14] + tmp[4] * src[15]; + dst[8] -= tmp[1] * src[13] + tmp[2] * src[14] + tmp[5] * src[15]; + dst[9] = tmp[1] * src[12] + tmp[6] * src[14] + tmp[9] * src[15]; + dst[9] -= tmp[0] * src[12] + tmp[7] * src[14] + tmp[8] * src[15]; + dst[10] = tmp[2] * src[12] + tmp[7] * src[13] + tmp[10] * src[15]; + dst[10] -= tmp[3] * src[12] + tmp[6] * src[13] + tmp[11] * src[15]; + dst[11] = tmp[5] * src[12] + tmp[8] * src[13] + tmp[11] * src[14]; + dst[11] -= tmp[4] * src[12] + tmp[9] * src[13] + tmp[10] * src[14]; + dst[12] = tmp[2] * src[10] + tmp[5] * src[11] + tmp[1] * src[9]; + dst[12] -= tmp[4] * src[11] + tmp[0] * src[9] + tmp[3] * src[10]; + dst[13] = tmp[8] * src[11] + tmp[0] * src[8] + tmp[7] * src[10]; + dst[13] -= tmp[6] * src[10] + tmp[9] * src[11] + tmp[1] * src[8]; + dst[14] = tmp[6] * src[9] + tmp[11] * src[11] + tmp[3] * src[8]; + dst[14] -= tmp[10] * src[11] + tmp[2] * src[8] + tmp[7] * src[9]; + dst[15] = tmp[10] * src[10] + tmp[4] * src[8] + tmp[9] * src[9]; + dst[15] -= tmp[8] * src[9] + tmp[11] * src[10] + tmp[5] * src[8]; + + det = src[0] * dst[0] + src[1] * dst[1] + src[2] * dst[2] + src[3] * dst[3]; + + det = 1.0f / det; + for(PxU32 j = 0; j < 16; j++) + { + dst[j] *= det; + } + + return Mat44V(Vec4V(dst[0], dst[4], dst[8], dst[12]), Vec4V(dst[1], dst[5], dst[9], dst[13]), + Vec4V(dst[2], dst[6], dst[10], dst[14]), Vec4V(dst[3], dst[7], dst[11], dst[15])); +} + +PX_FORCE_INLINE Mat44V M44Trnsps(const Mat44V& a) +{ + return Mat44V(Vec4V(a.col0.x, a.col1.x, a.col2.x, a.col3.x), Vec4V(a.col0.y, a.col1.y, a.col2.y, a.col3.y), + Vec4V(a.col0.z, a.col1.z, a.col2.z, a.col3.z), Vec4V(a.col0.w, a.col1.w, a.col2.w, a.col3.w)); +} + +PX_FORCE_INLINE Vec4V V4LoadXYZW(const PxF32& x, const PxF32& y, const PxF32& z, const PxF32& w) +{ + return Vec4V(x, y, z, w); +} + +/* +PX_FORCE_INLINE VecU16V V4U32PK(VecU32V a, VecU32V b) +{ + return VecU16V( + PxU16(PxClamp((a).u32[0], 0, 0xFFFF)), + PxU16(PxClamp((a).u32[1], 0, 0xFFFF)), + PxU16(PxClamp((a).u32[2], 0, 0xFFFF)), + PxU16(PxClamp((a).u32[3], 0, 0xFFFF)), + PxU16(PxClamp((b).u32[0], 0, 0xFFFF)), + PxU16(PxClamp((b).u32[1], 0, 0xFFFF)), + PxU16(PxClamp((b).u32[2], 0, 0xFFFF)), + PxU16(PxClamp((b).u32[3], 0, 0xFFFF))); +} +*/ + +PX_FORCE_INLINE VecU32V V4U32Sel(const BoolV c, const VecU32V a, const VecU32V b) +{ + return VecU32V(c.ux ? a.u32[0] : b.u32[0], c.uy ? a.u32[1] : b.u32[1], c.uz ? a.u32[2] : b.u32[2], + c.uw ? a.u32[3] : b.u32[3]); +} + +PX_FORCE_INLINE VecU32V V4U32or(VecU32V a, VecU32V b) +{ + return VecU32V((a).u32[0] | (b).u32[0], (a).u32[1] | (b).u32[1], (a).u32[2] | (b).u32[2], (a).u32[3] | (b).u32[3]); +} + +PX_FORCE_INLINE VecU32V V4U32xor(VecU32V a, VecU32V b) +{ + return VecU32V((a).u32[0] ^ (b).u32[0], (a).u32[1] ^ (b).u32[1], (a).u32[2] ^ (b).u32[2], (a).u32[3] ^ (b).u32[3]); +} + +PX_FORCE_INLINE VecU32V V4U32and(VecU32V a, VecU32V b) +{ + return VecU32V((a).u32[0] & (b).u32[0], (a).u32[1] & (b).u32[1], (a).u32[2] & (b).u32[2], (a).u32[3] & (b).u32[3]); +} + +PX_FORCE_INLINE VecU32V V4U32Andc(VecU32V a, VecU32V b) +{ + return VecU32V((a).u32[0] & ~(b).u32[0], (a).u32[1] & ~(b).u32[1], (a).u32[2] & ~(b).u32[2], + (a).u32[3] & ~(b).u32[3]); +} + +/* +PX_FORCE_INLINE VecU16V V4U16Or(VecU16V a, VecU16V b) +{ + return VecU16V( + (a).u16[0]|(b).u16[0], (a).u16[1]|(b).u16[1], (a).u16[2]|(b).u16[2], (a).u16[3]|(b).u16[3], + (a).u16[4]|(b).u16[4], (a).u16[5]|(b).u16[5], (a).u16[6]|(b).u16[6], (a).u16[7]|(b).u16[7]); +} +*/ + +/* +PX_FORCE_INLINE VecU16V V4U16And(VecU16V a, VecU16V b) +{ + return VecU16V( + (a).u16[0]&(b).u16[0], (a).u16[1]&(b).u16[1], (a).u16[2]&(b).u16[2], (a).u16[3]&(b).u16[3], + (a).u16[4]&(b).u16[4], (a).u16[5]&(b).u16[5], (a).u16[6]&(b).u16[6], (a).u16[7]&(b).u16[7]); +} +*/ + +/* +PX_FORCE_INLINE VecU16V V4U16Andc(VecU16V a, VecU16V b) +{ + return VecU16V( + (a).u16[0]&~(b).u16[0], (a).u16[1]&~(b).u16[1], (a).u16[2]&~(b).u16[2], (a).u16[3]&~(b).u16[3], + (a).u16[4]&~(b).u16[4], (a).u16[5]&~(b).u16[5], (a).u16[6]&~(b).u16[6], (a).u16[7]&~(b).u16[7]); +} +*/ + +/* +template PX_FORCE_INLINE VecI32V V4ISplat() +{ + return VecI32V(a, a, a, a); +} + +template PX_FORCE_INLINE VecU32V V4USplat() +{ + return VecU32V(a, a, a, a); +} +*/ + +/* +PX_FORCE_INLINE void V4U16StoreAligned(VecU16V val, VecU16V* address) +{ + *address = val; +} +*/ + +PX_FORCE_INLINE void V4U32StoreAligned(VecU32V val, VecU32V* address) +{ + *address = val; +} + +PX_FORCE_INLINE Vec4V V4Andc(const Vec4V a, const VecU32V b) +{ + VecU32V r = V4U32Andc(*reinterpret_cast(&a), b); + return (*reinterpret_cast(&r)); +} + +PX_FORCE_INLINE VecU32V V4IsGrtrV32u(const Vec4V a, const Vec4V b) +{ + return VecU32V(a.x > b.x ? 0xFFFFffff : 0, a.y > b.y ? 0xFFFFffff : 0, a.z > b.z ? 0xFFFFffff : 0, + a.w > b.w ? 0xFFFFffff : 0); +} + +PX_FORCE_INLINE VecU16V V4U16LoadAligned(const VecU16V* addr) +{ + return *addr; +} + +PX_FORCE_INLINE VecU16V V4U16LoadUnaligned(const VecU16V* addr) +{ + return *addr; +} + +PX_FORCE_INLINE VecU16V V4U16CompareGt(VecU16V a, VecU16V b) +{ + return VecU16V + ( + BOOL_TO_U16(a.u16[0] > b.u16[0]), BOOL_TO_U16(a.u16[1] > b.u16[1]), BOOL_TO_U16(a.u16[2] > b.u16[2]), BOOL_TO_U16(a.u16[3] > b.u16[3]), + BOOL_TO_U16(a.u16[4] > b.u16[4]), BOOL_TO_U16(a.u16[5] > b.u16[5]), BOOL_TO_U16(a.u16[6] > b.u16[6]), BOOL_TO_U16(a.u16[7] > b.u16[7]) + ); +} + +PX_FORCE_INLINE VecU16V V4I16CompareGt(VecU16V a, VecU16V b) +{ + return VecU16V + ( + BOOL_TO_U16(a.i16[0] > b.i16[0]), BOOL_TO_U16(a.i16[1] > b.i16[1]), BOOL_TO_U16(a.i16[2] > b.i16[2]), BOOL_TO_U16(a.i16[3] > b.i16[3]), + BOOL_TO_U16(a.i16[4] > b.i16[4]), BOOL_TO_U16(a.i16[5] > b.i16[5]), BOOL_TO_U16(a.i16[6] > b.i16[6]), BOOL_TO_U16(a.i16[7] > b.i16[7]) + ); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_VecU32V(VecU32V a) +{ + return Vec4V(PxF32((a).u32[0]), PxF32((a).u32[1]), PxF32((a).u32[2]), PxF32((a).u32[3])); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V a) +{ + return Vec4V(PxF32((a).i32[0]), PxF32((a).i32[1]), PxF32((a).i32[2]), PxF32((a).i32[3])); +} + +PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a) +{ + float* data = reinterpret_cast(&a); + return VecI32V(PxI32(data[0]), PxI32(data[1]), PxI32(data[2]), PxI32(data[3])); +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a) +{ + Vec4V b = *reinterpret_cast(&a); + return b; +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a) +{ + Vec4V b = *reinterpret_cast(&a); + return b; +} + +PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + VecU32V b = *reinterpret_cast(&a); + return b; +} + +PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + VecI32V b = *reinterpret_cast(&a); + return b; +} + +template +PX_FORCE_INLINE VecU32V V4U32SplatElement(VecU32V a) +{ + return VecU32V((a).u32[index], (a).u32[index], (a).u32[index], (a).u32[index]); +} + +template +PX_FORCE_INLINE VecU32V V4U32SplatElement(BoolV a) +{ + const PxU32 u = (&a.ux)[index]; + return VecU32V(u, u, u, u); +} + +template +PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a) +{ + float* data = reinterpret_cast(&a); + return Vec4V(data[index], data[index], data[index], data[index]); +} + +PX_FORCE_INLINE VecU32V U4LoadXYZW(PxU32 x, PxU32 y, PxU32 z, PxU32 w) +{ + return VecU32V(x, y, z, w); +} + +PX_FORCE_INLINE Vec4V V4Abs(const Vec4V a) +{ + return V4Max(a, V4Neg(a)); +} + +PX_FORCE_INLINE BoolV V4IsEqU32(const VecU32V a, const VecU32V b) +{ + return BoolV(BOOL_TO_U32(a.u32[0] == b.u32[0]), BOOL_TO_U32(a.u32[1] == b.u32[1]), BOOL_TO_U32(a.u32[2] == b.u32[2]), BOOL_TO_U32(a.u32[3] == b.u32[3])); +} + +PX_FORCE_INLINE VecU32V U4Load(const PxU32 i) +{ + return VecU32V(i, i, i, i); +} + +PX_FORCE_INLINE VecU32V U4LoadU(const PxU32* i) +{ + return VecU32V(i[0], i[1], i[2], i[3]); +} + +PX_FORCE_INLINE VecU32V U4LoadA(const PxU32* i) +{ + return VecU32V(i[0], i[1], i[2], i[3]); +} + +PX_FORCE_INLINE VecI32V I4LoadXYZW(const PxI32& x, const PxI32& y, const PxI32& z, const PxI32& w) +{ + return VecI32V(x, y, z, w); +} + +PX_FORCE_INLINE VecI32V I4Load(const PxI32 i) +{ + return VecI32V(i, i, i, i); +} + +PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i) +{ + return VecI32V(i[0], i[1], i[2], i[3]); +} + +PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i) +{ + return VecI32V(i[0], i[1], i[2], i[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b) +{ + return VecI32V(a.i32[0] + b.i32[0], a.i32[1] + b.i32[1], a.i32[2] + b.i32[2], a.i32[3] + b.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b) +{ + return VecI32V(a.i32[0] - b.i32[0], a.i32[1] - b.i32[1], a.i32[2] - b.i32[2], a.i32[3] - b.i32[3]); +} + +PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b) +{ + return BoolV(BOOL_TO_U32(a.i32[0] > b.i32[0]), BOOL_TO_U32(a.i32[1] > b.i32[1]), BOOL_TO_U32(a.i32[2] > b.i32[2]), BOOL_TO_U32(a.i32[3] > b.i32[3])); +} + +PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b) +{ + return BoolV(BOOL_TO_U32(a.i32[0] == b.i32[0]), BOOL_TO_U32(a.i32[1] == b.i32[1]), BOOL_TO_U32(a.i32[2] == b.i32[2]), BOOL_TO_U32(a.i32[3] == b.i32[3])); +} + +PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b) +{ + return VecI32V(c.ux ? a.i32[0] : b.i32[0], c.uy ? a.i32[1] : b.i32[1], c.uz ? a.i32[2] : b.i32[2], + c.uw ? a.i32[3] : b.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_Zero() +{ + return VecI32V(0, 0, 0, 0); +} + +PX_FORCE_INLINE VecI32V VecI32V_One() +{ + return VecI32V(1, 1, 1, 1); +} + +PX_FORCE_INLINE VecI32V VecI32V_Two() +{ + return VecI32V(2, 2, 2, 2); +} + +PX_FORCE_INLINE VecI32V VecI32V_MinusOne() +{ + return VecI32V(-1, -1, -1, -1); +} + +PX_FORCE_INLINE VecU32V U4Zero() +{ + return VecU32V(0, 0, 0, 0); +} + +PX_FORCE_INLINE VecU32V U4One() +{ + return VecU32V(1, 1, 1, 1); +} + +PX_FORCE_INLINE VecU32V U4Two() +{ + return VecU32V(2, 2, 2, 2); +} + +PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift) +{ + return shift; +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const VecShiftVArg count) +{ + return VecI32V(a.i32[0] << count.i32[0], a.i32[1] << count.i32[1], a.i32[2] << count.i32[2], a.i32[3] + << count.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg count) +{ + return VecI32V(a.i32[0] >> count.i32[0], a.i32[1] >> count.i32[1], a.i32[2] >> count.i32[2], + a.i32[3] >> count.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const PxU32 count) +{ + return VecI32V(a.i32[0] << count, a.i32[1] << count, a.i32[2] << count, a.i32[3] << count); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const PxU32 count) +{ + return VecI32V(a.i32[0] >> count, a.i32[1] >> count, a.i32[2] >> count, a.i32[3] >> count); +} + +PX_FORCE_INLINE VecI32V VecI32V_And(const VecI32VArg a, const VecI32VArg b) +{ + return VecI32V(a.i32[0] & b.i32[0], a.i32[1] & b.i32[1], a.i32[2] & b.i32[2], a.i32[3] & b.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b) +{ + return VecI32V(a.i32[0] | b.i32[0], a.i32[1] | b.i32[1], a.i32[2] | b.i32[2], a.i32[3] | b.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg a) +{ + return VecI32V(a.i32[0], a.i32[0], a.i32[0], a.i32[0]); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg a) +{ + return VecI32V(a.i32[1], a.i32[1], a.i32[1], a.i32[1]); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg a) +{ + return VecI32V(a.i32[2], a.i32[2], a.i32[2], a.i32[2]); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg a) +{ + return VecI32V(a.i32[3], a.i32[3], a.i32[3], a.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sel(const BoolV c, const VecI32VArg a, const VecI32VArg b) +{ + return VecI32V(c.ux ? a.i32[0] : b.i32[0], c.uy ? a.i32[1] : b.i32[1], c.uz ? a.i32[2] : b.i32[2], + c.uw ? a.i32[3] : b.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_Merge(const VecI32VArg a, const VecI32VArg b, const VecI32VArg c, const VecI32VArg d) +{ + return VecI32V(a.i32[0], b.i32[0], c.i32[0], d.i32[0]); +} + +PX_FORCE_INLINE void PxI32_From_VecI32V(const VecI32VArg a, PxI32* i) +{ + *i = a.i32[0]; +} + +PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg b) +{ + return VecI32V(PxI32(b.ux), PxI32(b.uy), PxI32(b.uz), PxI32(b.uw)); +} + +PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg b) +{ + return VecU32V(b.ux, b.uy, b.uz, b.uw); +} + +PX_FORCE_INLINE void QuatGetMat33V(const QuatVArg q, Vec3V& column0, Vec3V& column1, Vec3V& column2) +{ + const FloatV one = FOne(); + const FloatV x = V4GetX(q); + const FloatV y = V4GetY(q); + const FloatV z = V4GetZ(q); + const FloatV w = V4GetW(q); + + const FloatV x2 = FAdd(x, x); + const FloatV y2 = FAdd(y, y); + const FloatV z2 = FAdd(z, z); + + const FloatV xx = FMul(x2, x); + const FloatV yy = FMul(y2, y); + const FloatV zz = FMul(z2, z); + + const FloatV xy = FMul(x2, y); + const FloatV xz = FMul(x2, z); + const FloatV xw = FMul(x2, w); + + const FloatV yz = FMul(y2, z); + const FloatV yw = FMul(y2, w); + const FloatV zw = FMul(z2, w); + + const FloatV v = FSub(one, xx); + + column0 = V3Merge(FSub(FSub(one, yy), zz), FAdd(xy, zw), FSub(xz, yw)); + column1 = V3Merge(FSub(xy, zw), FSub(v, zz), FAdd(yz, xw)); + column2 = V3Merge(FAdd(xz, yw), FSub(yz, xw), FSub(v, yy)); +} + + +// not used + +/* +PX_FORCE_INLINE Vec4V V4LoadAligned(Vec4V* addr) +{ + return *addr; +} +*/ + +/* +PX_FORCE_INLINE Vec4V V4LoadUnaligned(Vec4V* addr) +{ + return *addr; +} +*/ + +/* +PX_FORCE_INLINE Vec4V V4Ceil(const Vec4V a) +{ + return Vec4V(PxCeil(a.x), PxCeil(a.y), PxCeil(a.z), PxCeil(a.w)); +} + +PX_FORCE_INLINE Vec4V V4Floor(const Vec4V a) +{ + return Vec4V(PxFloor(a.x), PxFloor(a.y), PxFloor(a.z), PxFloor(a.w)); +} +*/ + +/* +PX_FORCE_INLINE VecU32V V4ConvertToU32VSaturate(const Vec4V a, PxU32 power) +{ + PX_ASSERT(power == 0 && "Non-zero power not supported in convertToU32VSaturate"); + PX_UNUSED(power); // prevent warning in release builds + PxF32 ffffFFFFasFloat = PxF32(0xFFFF0000); + return VecU32V( + PxU32(PxClamp((a).x, 0.0f, ffffFFFFasFloat)), + PxU32(PxClamp((a).y, 0.0f, ffffFFFFasFloat)), + PxU32(PxClamp((a).z, 0.0f, ffffFFFFasFloat)), + PxU32(PxClamp((a).w, 0.0f, ffffFFFFasFloat))); +} +*/ + +} // namespace aos +#if !PX_DOXYGEN +} // namespace physx +#endif + +#if PX_GCC_FAMILY +#pragma GCC diagnostic pop +#endif + +#endif diff --git a/engine/third_party/physx/include/foundation/PxVecMathSSE.h b/engine/third_party/physx/include/foundation/PxVecMathSSE.h new file mode 100644 index 00000000..358e7e36 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxVecMathSSE.h @@ -0,0 +1,2716 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_VEC_MATH_SSE_H +#define PX_VEC_MATH_SSE_H + +// PT: this file contains the SSE code common to the Windows & Unix versions + +#if !COMPILE_VECTOR_INTRINSICS + #error Vector intrinsics should not be included when using scalar implementation. +#endif + +#ifdef __SSE4_2__ + #include "smmintrin.h" +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +namespace aos +{ + +namespace +{ + const PX_ALIGN(16, PxF32) minus1w[4] = { 0.0f, 0.0f, 0.0f, -1.0f }; +} + +PX_FORCE_INLINE void QuatGetMat33V(const QuatVArg q, Vec3V& column0, Vec3V& column1, Vec3V& column2) +{ + const __m128 q2 = V4Add(q, q); + const __m128 qw2 = V4MulAdd(q2, V4GetW(q), _mm_load_ps(minus1w)); // (2wx, 2wy, 2wz, 2ww-1) + const __m128 nw2 = Vec3V_From_Vec4V(V4Neg(qw2)); // (-2wx, -2wy, -2wz, 0) + const __m128 v = Vec3V_From_Vec4V(q); + + const __m128 a0 = _mm_shuffle_ps(qw2, nw2, _MM_SHUFFLE(3, 1, 2, 3)); // (2ww-1, 2wz, -2wy, 0) + column0 = V4MulAdd(v, V4GetX(q2), a0); + + const __m128 a1 = _mm_shuffle_ps(qw2, nw2, _MM_SHUFFLE(3, 2, 0, 3)); // (2ww-1, 2wx, -2wz, 0) + column1 = V4MulAdd(v, V4GetY(q2), _mm_shuffle_ps(a1, a1, _MM_SHUFFLE(3, 1, 0, 2))); + + const __m128 a2 = _mm_shuffle_ps(qw2, nw2, _MM_SHUFFLE(3, 0, 1, 3)); // (2ww-1, 2wy, -2wx, 0) + column2 = V4MulAdd(v, V4GetZ(q2), _mm_shuffle_ps(a2, a2, _MM_SHUFFLE(3, 0, 2, 1))); +} + +////////////////////////////////////////////////////////////////////// +//Test that Vec3V and FloatV are legal +////////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE bool isValidVec3V(const Vec3V a) +{ + //using _mm_comieq_ss to do the comparison doesn't work for NaN. + PX_ALIGN(16, PxF32 f[4]); + V4StoreA(a, f); + return f[3] == 0.0f; +} + +PX_FORCE_INLINE bool isFiniteLength(const Vec3V a) +{ + return !FAllEq(V4LengthSq(a), FZero()); +} + +PX_FORCE_INLINE bool isAligned16(const void* a) +{ + return (0 == (size_t(a) & 0x0f)); +} + +//ASSERT_FINITELENGTH is deactivated because there is a lot of code that calls a simd normalisation function with zero length but then ignores the result. + +#if PX_DEBUG + #define ASSERT_ISVALIDVEC3V(a) PX_ASSERT(isValidVec3V(a)) + #define ASSERT_ISVALIDFLOATV(a) PX_ASSERT(isValidFloatV(a)) + #define ASSERT_ISALIGNED16(a) PX_ASSERT(isAligned16(reinterpret_cast(a))) + #define ASSERT_ISFINITELENGTH(a) //PX_ASSERT(isFiniteLength(a)) +#else + #define ASSERT_ISVALIDVEC3V(a) + #define ASSERT_ISVALIDFLOATV(a) + #define ASSERT_ISALIGNED16(a) + #define ASSERT_ISFINITELENGTH(a) +#endif + +namespace internalSimd +{ +PX_FORCE_INLINE __m128 m128_I2F(__m128i n) +{ + return _mm_castsi128_ps(n); +} + +PX_FORCE_INLINE __m128i m128_F2I(__m128 n) +{ + return _mm_castps_si128(n); +} + +PX_FORCE_INLINE PxU32 BAllTrue4_R(const BoolV a) +{ + const PxI32 moveMask = _mm_movemask_ps(a); + return PxU32(moveMask == 0xf); +} + +PX_FORCE_INLINE PxU32 BAllTrue3_R(const BoolV a) +{ + const PxI32 moveMask = _mm_movemask_ps(a); + return PxU32((moveMask & 0x7) == 0x7); +} + +PX_FORCE_INLINE PxU32 BAnyTrue4_R(const BoolV a) +{ + const PxI32 moveMask = _mm_movemask_ps(a); + return PxU32(moveMask != 0x0); +} + +PX_FORCE_INLINE PxU32 BAnyTrue3_R(const BoolV a) +{ + const PxI32 moveMask = _mm_movemask_ps(a); + return PxU32((moveMask & 0x7) != 0x0); +} + +PX_FORCE_INLINE PxU32 FiniteTestEq(const Vec4V a, const Vec4V b) +{ + // This is a bit of a bodge. + //_mm_comieq_ss returns 1 if either value is nan so we need to re-cast a and b with true encoded as a non-nan + // number. + // There must be a better way of doing this in sse. + const BoolV one = FOne(); + const BoolV zero = FZero(); + const BoolV a1 = V4Sel(a, one, zero); + const BoolV b1 = V4Sel(b, one, zero); + return (PxU32( + _mm_comieq_ss(a1, b1) && + _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(1, 1, 1, 1)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(1, 1, 1, 1))) && + _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(2, 2, 2, 2)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(2, 2, 2, 2))) && + _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(3, 3, 3, 3)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(3, 3, 3, 3))))); +} + +PX_FORCE_INLINE bool hasZeroElementInFloatV(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) ? true : false; +} + +PX_FORCE_INLINE bool hasZeroElementInVec3V(const Vec3V a) +{ + return (_mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)), FZero())); +} + +PX_FORCE_INLINE bool hasZeroElementInVec4V(const Vec4V a) +{ + return (_mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 3, 3, 3)), FZero())); +} + +} //internalSimd + +namespace vecMathTests +{ +// PT: this function returns an invalid Vec3V (W!=0.0f) just for unit-testing 'isValidVec3V' +PX_FORCE_INLINE Vec3V getInvalidVec3V() +{ + const float f = 1.0f; + return _mm_load1_ps(&f); +} + +PX_FORCE_INLINE bool allElementsEqualFloatV(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_comieq_ss(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVec3V(const Vec3V a, const Vec3V b) +{ + return V3AllEq(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVec4V(const Vec4V a, const Vec4V b) +{ + return V4AllEq(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVecU32V(const VecU32V a, const VecU32V b) +{ + return internalSimd::BAllTrue4_R(V4IsEqU32(a, b)) != 0; +} + +} //vecMathTests + +///////////////////////////////////////////////////////////////////// +////VECTORISED FUNCTION IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE BoolV BLoad(const bool f) +{ + const PxU32 i = PxU32(-PxI32(f)); + return _mm_load1_ps(reinterpret_cast(&i)); +} + +PX_FORCE_INLINE FloatV FLoad(const PxF32 f) +{ + return _mm_load1_ps(&f); +} + +PX_FORCE_INLINE Vec3V V3Load(const PxF32 f) +{ + return _mm_set_ps(0.0f, f, f, f); +} + +PX_FORCE_INLINE Vec4V V4Load(const PxF32 f) +{ + return _mm_load1_ps(&f); +} + +PX_FORCE_INLINE Vec3V V3LoadU(const PxVec3& f) +{ + return _mm_set_ps(0.0f, f.z, f.y, f.x); +} + +PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* const i) +{ + return _mm_set_ps(0.0f, i[2], i[1], i[0]); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V(Vec4V v) +{ + return V4ClearW(v); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V_WUndefined(const Vec4V v) +{ + return v; +} + +PX_FORCE_INLINE Vec4V Vec4V_From_PxVec3_WUndefined(const PxVec3& f) +{ + return _mm_set_ps(0.0f, f.z, f.y, f.x); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_FloatV(FloatV f) +{ + return f; +} + +PX_FORCE_INLINE Vec4V Vec4V_From_Vec3V(Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + return f; // ok if it is implemented as the same type. +} + +PX_FORCE_INLINE Vec3V Vec3V_From_FloatV(FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return Vec3V_From_Vec4V(Vec4V_From_FloatV(f)); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_FloatV_WUndefined(FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return Vec3V_From_Vec4V_WUndefined(Vec4V_From_FloatV(f)); +} + +PX_FORCE_INLINE Vec4V V4LoadA(const PxF32* const f) +{ + ASSERT_ISALIGNED16(f); + return _mm_load_ps(f); +} + +PX_FORCE_INLINE Vec4V V4LoadU(const PxF32* const f) +{ + return _mm_loadu_ps(f); +} + +PX_FORCE_INLINE void V4StoreA(const Vec4V a, PxF32* f) +{ + ASSERT_ISALIGNED16(f); + _mm_store_ps(f, a); +} + +PX_FORCE_INLINE void V4StoreU(const Vec4V a, PxF32* f) +{ + _mm_storeu_ps(f, a); +} + +PX_FORCE_INLINE void BStoreA(const BoolV a, PxU32* f) +{ + ASSERT_ISALIGNED16(f); + _mm_store_ps(reinterpret_cast(f), a); +} + +PX_FORCE_INLINE void U4StoreA(const VecU32V uv, PxU32* u) +{ + ASSERT_ISALIGNED16(u); + _mm_store_ps(reinterpret_cast(u), uv); +} + +PX_FORCE_INLINE void FStore(const FloatV a, PxF32* PX_RESTRICT f) +{ + ASSERT_ISVALIDFLOATV(a); + _mm_store_ss(f, a); +} + +PX_FORCE_INLINE void Store_From_BoolV(const BoolV b, PxU32* b2) +{ + _mm_store_ss(reinterpret_cast(b2), b); +} + +////////////////////////////////// +// FLOATV +////////////////////////////////// + +PX_FORCE_INLINE FloatV FZero() +{ + return _mm_setzero_ps(); +} + +PX_FORCE_INLINE FloatV FOne() +{ + return FLoad(1.0f); +} + +PX_FORCE_INLINE FloatV FHalf() +{ + return FLoad(0.5f); +} + +PX_FORCE_INLINE FloatV FEps() +{ + return FLoad(PX_EPS_REAL); +} + +PX_FORCE_INLINE FloatV FEps6() +{ + return FLoad(1e-6f); +} + +PX_FORCE_INLINE FloatV FMax() +{ + return FLoad(PX_MAX_REAL); +} + +PX_FORCE_INLINE FloatV FNegMax() +{ + return FLoad(-PX_MAX_REAL); +} + +PX_FORCE_INLINE FloatV IZero() +{ + const PxU32 zero = 0; + return _mm_load1_ps(reinterpret_cast(&zero)); +} + +PX_FORCE_INLINE FloatV IOne() +{ + const PxU32 one = 1; + return _mm_load1_ps(reinterpret_cast(&one)); +} + +PX_FORCE_INLINE FloatV ITwo() +{ + const PxU32 two = 2; + return _mm_load1_ps(reinterpret_cast(&two)); +} + +PX_FORCE_INLINE FloatV IThree() +{ + const PxU32 three = 3; + return _mm_load1_ps(reinterpret_cast(&three)); +} + +PX_FORCE_INLINE FloatV IFour() +{ + const PxU32 four = 4; + return _mm_load1_ps(reinterpret_cast(&four)); +} + +PX_FORCE_INLINE FloatV FNeg(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return _mm_sub_ps(_mm_setzero_ps(), f); +} + +PX_FORCE_INLINE FloatV FAdd(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_add_ps(a, b); +} + +PX_FORCE_INLINE FloatV FSub(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_sub_ps(a, b); +} + +PX_FORCE_INLINE FloatV FMul(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE FloatV FDiv(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_div_ps(a, b); +} + +PX_FORCE_INLINE FloatV FDivFast(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, _mm_rcp_ps(b)); +} + +PX_FORCE_INLINE FloatV FRecip(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_div_ps(FOne(), a); +} + +PX_FORCE_INLINE FloatV FRecipFast(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_rcp_ps(a); +} + +PX_FORCE_INLINE FloatV FRsqrt(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_div_ps(FOne(), _mm_sqrt_ps(a)); +} + +PX_FORCE_INLINE FloatV FSqrt(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_sqrt_ps(a); +} + +PX_FORCE_INLINE FloatV FRsqrtFast(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_rsqrt_ps(a); +} + +PX_FORCE_INLINE FloatV FScaleAdd(const FloatV a, const FloatV b, const FloatV c) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDFLOATV(c); + return FAdd(FMul(a, b), c); +} + +PX_FORCE_INLINE FloatV FNegScaleSub(const FloatV a, const FloatV b, const FloatV c) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDFLOATV(c); + return FSub(c, FMul(a, b)); +} + +PX_FORCE_INLINE FloatV FSel(const BoolV c, const FloatV a, const FloatV b) +{ + PX_ASSERT(vecMathTests::allElementsEqualBoolV(c, BTTTT()) || + vecMathTests::allElementsEqualBoolV(c, BFFFF())); + ASSERT_ISVALIDFLOATV(_mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a))); + return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); +} + +PX_FORCE_INLINE BoolV FIsGrtr(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_cmpgt_ps(a, b); +} + +PX_FORCE_INLINE BoolV FIsGrtrOrEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_cmpge_ps(a, b); +} + +PX_FORCE_INLINE BoolV FIsEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_cmpeq_ps(a, b); +} + +PX_FORCE_INLINE FloatV FMax(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_max_ps(a, b); +} + +PX_FORCE_INLINE FloatV FMin(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_min_ps(a, b); +} + +PX_FORCE_INLINE FloatV FClamp(const FloatV a, const FloatV minV, const FloatV maxV) +{ + ASSERT_ISVALIDFLOATV(minV); + ASSERT_ISVALIDFLOATV(maxV); + return _mm_max_ps(_mm_min_ps(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 FAllGrtr(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return PxU32(_mm_comigt_ss(a, b)); +} + +PX_FORCE_INLINE PxU32 FAllGrtrOrEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return PxU32(_mm_comige_ss(a, b)); +} + +PX_FORCE_INLINE PxU32 FAllEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return PxU32(_mm_comieq_ss(a, b)); +} + +PX_FORCE_INLINE FloatV FRound(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); +#ifdef __SSE4_2__ + return _mm_round_ps(a, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC); +#else + // return _mm_round_ps(a, 0x0); + const FloatV half = FLoad(0.5f); + const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); + const FloatV aRound = FSub(FAdd(a, half), signBit); + __m128i tmp = _mm_cvttps_epi32(aRound); + return _mm_cvtepi32_ps(tmp); +#endif +} + +PX_FORCE_INLINE FloatV FSin(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const FloatV recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const FloatV twoPi = V4LoadA(g_PXTwoPi.f); + const FloatV tmp = FMul(a, recipTwoPi); + const FloatV b = FRound(tmp); + const FloatV V1 = FNegScaleSub(twoPi, b, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const FloatV V2 = FMul(V1, V1); + const FloatV V3 = FMul(V2, V1); + const FloatV V5 = FMul(V3, V2); + const FloatV V7 = FMul(V5, V2); + const FloatV V9 = FMul(V7, V2); + const FloatV V11 = FMul(V9, V2); + const FloatV V13 = FMul(V11, V2); + const FloatV V15 = FMul(V13, V2); + const FloatV V17 = FMul(V15, V2); + const FloatV V19 = FMul(V17, V2); + const FloatV V21 = FMul(V19, V2); + const FloatV V23 = FMul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + FloatV Result; + Result = FScaleAdd(S1, V3, V1); + Result = FScaleAdd(S2, V5, Result); + Result = FScaleAdd(S3, V7, Result); + Result = FScaleAdd(S4, V9, Result); + Result = FScaleAdd(S5, V11, Result); + Result = FScaleAdd(S6, V13, Result); + Result = FScaleAdd(S7, V15, Result); + Result = FScaleAdd(S8, V17, Result); + Result = FScaleAdd(S9, V19, Result); + Result = FScaleAdd(S10, V21, Result); + Result = FScaleAdd(S11, V23, Result); + + return Result; +} + +PX_FORCE_INLINE FloatV FCos(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const FloatV recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const FloatV twoPi = V4LoadA(g_PXTwoPi.f); + const FloatV tmp = FMul(a, recipTwoPi); + const FloatV b = FRound(tmp); + const FloatV V1 = FNegScaleSub(twoPi, b, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const FloatV V2 = FMul(V1, V1); + const FloatV V4 = FMul(V2, V2); + const FloatV V6 = FMul(V4, V2); + const FloatV V8 = FMul(V4, V4); + const FloatV V10 = FMul(V6, V4); + const FloatV V12 = FMul(V6, V6); + const FloatV V14 = FMul(V8, V6); + const FloatV V16 = FMul(V8, V8); + const FloatV V18 = FMul(V10, V8); + const FloatV V20 = FMul(V10, V10); + const FloatV V22 = FMul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + FloatV Result; + Result = FScaleAdd(C1, V2, V4One()); + Result = FScaleAdd(C2, V4, Result); + Result = FScaleAdd(C3, V6, Result); + Result = FScaleAdd(C4, V8, Result); + Result = FScaleAdd(C5, V10, Result); + Result = FScaleAdd(C6, V12, Result); + Result = FScaleAdd(C7, V14, Result); + Result = FScaleAdd(C8, V16, Result); + Result = FScaleAdd(C9, V18, Result); + Result = FScaleAdd(C10, V20, Result); + Result = FScaleAdd(C11, V22, Result); + + return Result; +} + +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV min, const FloatV max) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(min); + ASSERT_ISVALIDFLOATV(max); + const BoolV c = BOr(FIsGrtr(a, max), FIsGrtr(min, a)); + return PxU32(!BAllEqFFFF(c)); +} + +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV min, const FloatV max) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(min); + ASSERT_ISVALIDFLOATV(max); + const BoolV c = BAnd(FIsGrtrOrEq(a, min), FIsGrtrOrEq(max, a)); + return BAllEqTTTT(c); +} + +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV bounds) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(bounds); + return FOutOfBounds(a, FNeg(bounds), bounds); +} + +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV bounds) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(bounds); + return FInBounds(a, FNeg(bounds), bounds); +} + +////////////////////////////////// +// VEC3V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V V3Splat(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + const __m128 zero = _mm_setzero_ps(); + const __m128 fff0 = _mm_move_ss(f, zero); + return _mm_shuffle_ps(fff0, fff0, _MM_SHUFFLE(0, 1, 2, 3)); +} + +PX_FORCE_INLINE Vec3V V3Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z) +{ + ASSERT_ISVALIDFLOATV(x); + ASSERT_ISVALIDFLOATV(y); + ASSERT_ISVALIDFLOATV(z); + // static on zero causes compiler crash on x64 debug_opt + const __m128 zero = _mm_setzero_ps(); + const __m128 xy = _mm_move_ss(x, y); + const __m128 z0 = _mm_move_ss(zero, z); + + return _mm_shuffle_ps(xy, z0, _MM_SHUFFLE(1, 0, 0, 1)); +} + +PX_FORCE_INLINE FloatV V3GetX(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); +} + +PX_FORCE_INLINE FloatV V3GetY(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); +} + +PX_FORCE_INLINE FloatV V3GetZ(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); +} + +PX_FORCE_INLINE Vec3V V3SetX(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BFTTT(), v, f); +} + +PX_FORCE_INLINE Vec3V V3SetY(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTFTT(), v, f); +} + +PX_FORCE_INLINE Vec3V V3SetZ(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTFT(), v, f); +} + +PX_FORCE_INLINE Vec3V V3ColX(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + const Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 0, 3, 0)); + return V3SetY(r, V3GetX(b)); +} + +PX_FORCE_INLINE Vec3V V3ColY(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + const Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 1, 3, 1)); + return V3SetY(r, V3GetY(b)); +} + +PX_FORCE_INLINE Vec3V V3ColZ(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + const Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 2, 3, 2)); + return V3SetY(r, V3GetZ(b)); +} + +PX_FORCE_INLINE Vec3V V3Zero() +{ + return _mm_setzero_ps(); +} + +PX_FORCE_INLINE Vec3V V3One() +{ + return V3Load(1.0f); +} + +PX_FORCE_INLINE Vec3V V3Eps() +{ + return V3Load(PX_EPS_REAL); +} + +PX_FORCE_INLINE Vec3V V3Neg(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + return _mm_sub_ps(_mm_setzero_ps(), f); +} + +PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_add_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_sub_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Scale(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Mul(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3ScaleInv(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_div_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Div(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return V4ClearW(_mm_div_ps(a, b)); +} + +PX_FORCE_INLINE Vec3V V3ScaleInvFast(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, _mm_rcp_ps(b)); +} + +PX_FORCE_INLINE Vec3V V3DivFast(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return V4ClearW(_mm_mul_ps(a, _mm_rcp_ps(b))); +} + +PX_FORCE_INLINE Vec3V V3Recip(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 tttf = BTTTF(); + const __m128 recipA = _mm_div_ps(V3One(), a); + return V4Sel(tttf, recipA, zero); +} + +PX_FORCE_INLINE Vec3V V3RecipFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 tttf = BTTTF(); + const __m128 recipA = _mm_rcp_ps(a); + return V4Sel(tttf, recipA, zero); +} + +PX_FORCE_INLINE Vec3V V3Rsqrt(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 tttf = BTTTF(); + const __m128 recipA = _mm_div_ps(V3One(), _mm_sqrt_ps(a)); + return V4Sel(tttf, recipA, zero); +} + +PX_FORCE_INLINE Vec3V V3RsqrtFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 tttf = BTTTF(); + const __m128 recipA = _mm_rsqrt_ps(a); + return V4Sel(tttf, recipA, zero); +} + +PX_FORCE_INLINE Vec3V V3ScaleAdd(const Vec3V a, const FloatV b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDVEC3V(c); + return V3Add(V3Scale(a, b), c); +} + +PX_FORCE_INLINE Vec3V V3NegScaleSub(const Vec3V a, const FloatV b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDVEC3V(c); + return V3Sub(c, V3Scale(a, b)); +} + +PX_FORCE_INLINE Vec3V V3MulAdd(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + return V3Add(V3Mul(a, b), c); +} + +PX_FORCE_INLINE Vec3V V3NegMulSub(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + return V3Sub(c, V3Mul(a, b)); +} + +PX_FORCE_INLINE Vec3V V3Abs(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return V3Max(a, V3Neg(a)); +} + +PX_FORCE_INLINE FloatV V3Dot(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); +#ifdef __SSE4_2__ + return _mm_dp_ps(a, b, 0x7f); +#else + const __m128 t0 = _mm_mul_ps(a, b); // aw*bw | az*bz | ay*by | ax*bx + const __m128 t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(1,0,3,2)); // ay*by | ax*bx | aw*bw | az*bz + const __m128 t2 = _mm_add_ps(t0, t1); // ay*by + aw*bw | ax*bx + az*bz | aw*bw + ay*by | az*bz + ax*bx + const __m128 t3 = _mm_shuffle_ps(t2, t2, _MM_SHUFFLE(2,3,0,1)); // ax*bx + az*bz | ay*by + aw*bw | az*bz + ax*bx | aw*bw + ay*by + return _mm_add_ps(t3, t2); // ax*bx + az*bz + ay*by + aw*bw + // ay*by + aw*bw + ax*bx + az*bz + // az*bz + ax*bx + aw*bw + ay*by + // aw*bw + ay*by + az*bz + ax*bx +#endif +} + +PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); +/* if(0) + { + const __m128 r1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + return _mm_sub_ps(_mm_mul_ps(l1, l2), _mm_mul_ps(r1, r2)); + } + else*/ + { + const __m128 b0 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3,0,2,1)); + const __m128 a1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3,0,2,1)); + __m128 v = _mm_mul_ps(a1, b); + v = _mm_sub_ps(_mm_mul_ps(a, b0), v); + __m128 res = _mm_shuffle_ps(v, v, _MM_SHUFFLE(3,0,2,1)); + ASSERT_ISVALIDVEC3V(res); + return res; + } +} + +PX_FORCE_INLINE VecCrossV V3PrepareCross(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + VecCrossV v; + v.mR1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + v.mL1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + return v; +} + +PX_FORCE_INLINE Vec3V V3Cross(const VecCrossV& a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(b); + const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + return _mm_sub_ps(_mm_mul_ps(a.mL1, l2), _mm_mul_ps(a.mR1, r2)); +} + +PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const VecCrossV& b) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 r2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + return _mm_sub_ps(_mm_mul_ps(b.mR1, r2), _mm_mul_ps(b.mL1, l2)); +} + +PX_FORCE_INLINE Vec3V V3Cross(const VecCrossV& a, const VecCrossV& b) +{ + return _mm_sub_ps(_mm_mul_ps(a.mL1, b.mR1), _mm_mul_ps(a.mR1, b.mL1)); +} + +PX_FORCE_INLINE FloatV V3Length(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_sqrt_ps(V3Dot(a, a)); +} + +PX_FORCE_INLINE FloatV V3LengthSq(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return V3Dot(a, a); +} + +PX_FORCE_INLINE Vec3V V3Normalize(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISFINITELENGTH(a); + return V3ScaleInv(a, _mm_sqrt_ps(V3Dot(a, a))); +} + +PX_FORCE_INLINE Vec3V V3NormalizeFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISFINITELENGTH(a); + return V3Scale(a, _mm_rsqrt_ps(V3Dot(a, a))); +} + +PX_FORCE_INLINE Vec3V V3NormalizeSafe(const Vec3V a, const Vec3V unsafeReturnValue) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 eps = FEps(); + const __m128 length = V3Length(a); + const __m128 isGreaterThanZero = FIsGrtr(length, eps); + return V3Sel(isGreaterThanZero, V3ScaleInv(a, length), unsafeReturnValue); +} + +PX_FORCE_INLINE Vec3V V3Sel(const BoolV c, const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(_mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a))); + return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); +} + +PX_FORCE_INLINE BoolV V3IsGrtr(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_cmpgt_ps(a, b); +} + +PX_FORCE_INLINE BoolV V3IsGrtrOrEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_cmpge_ps(a, b); +} + +PX_FORCE_INLINE BoolV V3IsEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_cmpeq_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Max(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_max_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Min(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_min_ps(a, b); +} + +PX_FORCE_INLINE FloatV V3ExtractMax(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); + const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); + const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); + return _mm_max_ps(_mm_max_ps(shuf1, shuf2), shuf3); +} + +PX_FORCE_INLINE FloatV V3ExtractMin(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); + const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); + const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); + return _mm_min_ps(_mm_min_ps(shuf1, shuf2), shuf3); +} + +//// if(a > 0.0f) return 1.0f; else if a == 0.f return 0.f, else return -1.f; +// PX_FORCE_INLINE Vec3V V3MathSign(const Vec3V a) +//{ +// VECMATHAOS_ASSERT(isValidVec3V(a)); +// +// const __m128i ai = _mm_cvtps_epi32(a); +// const __m128i bi = _mm_cvtps_epi32(V3Neg(a)); +// const __m128 aa = _mm_cvtepi32_ps(_mm_srai_epi32(ai, 31)); +// const __m128 bb = _mm_cvtepi32_ps(_mm_srai_epi32(bi, 31)); +// return _mm_or_ps(aa, bb); +//} + +// return (a >= 0.0f) ? 1.0f : -1.0f; +PX_FORCE_INLINE Vec3V V3Sign(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 one = V3One(); + const __m128 none = V3Neg(one); + return V3Sel(V3IsGrtrOrEq(a, zero), one, none); +} + +PX_FORCE_INLINE Vec3V V3Clamp(const Vec3V a, const Vec3V minV, const Vec3V maxV) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(minV); + ASSERT_ISVALIDVEC3V(maxV); + return V3Max(V3Min(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 V3AllGrtr(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalSimd::BAllTrue3_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE PxU32 V3AllGrtrOrEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalSimd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V3AllEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalSimd::BAllTrue3_R(V4IsEq(a, b)); +} + +PX_FORCE_INLINE Vec3V V3Round(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); +#ifdef __SSE4_2__ + return _mm_round_ps(a, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC); +#else + // return _mm_round_ps(a, 0x0); + const Vec3V half = V3Load(0.5f); + const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); + const Vec3V aRound = V3Sub(V3Add(a, half), signBit); + __m128i tmp = _mm_cvttps_epi32(aRound); + return _mm_cvtepi32_ps(tmp); +#endif +} + +PX_FORCE_INLINE Vec3V V3Sin(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec3V tmp = V3Scale(a, recipTwoPi); + const Vec3V b = V3Round(tmp); + const Vec3V V1 = V3NegScaleSub(b, twoPi, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const Vec3V V2 = V3Mul(V1, V1); + const Vec3V V3 = V3Mul(V2, V1); + const Vec3V V5 = V3Mul(V3, V2); + const Vec3V V7 = V3Mul(V5, V2); + const Vec3V V9 = V3Mul(V7, V2); + const Vec3V V11 = V3Mul(V9, V2); + const Vec3V V13 = V3Mul(V11, V2); + const Vec3V V15 = V3Mul(V13, V2); + const Vec3V V17 = V3Mul(V15, V2); + const Vec3V V19 = V3Mul(V17, V2); + const Vec3V V21 = V3Mul(V19, V2); + const Vec3V V23 = V3Mul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + Vec3V Result; + Result = V3ScaleAdd(V3, S1, V1); + Result = V3ScaleAdd(V5, S2, Result); + Result = V3ScaleAdd(V7, S3, Result); + Result = V3ScaleAdd(V9, S4, Result); + Result = V3ScaleAdd(V11, S5, Result); + Result = V3ScaleAdd(V13, S6, Result); + Result = V3ScaleAdd(V15, S7, Result); + Result = V3ScaleAdd(V17, S8, Result); + Result = V3ScaleAdd(V19, S9, Result); + Result = V3ScaleAdd(V21, S10, Result); + Result = V3ScaleAdd(V23, S11, Result); + + ASSERT_ISVALIDVEC3V(Result); + return Result; +} + +PX_FORCE_INLINE Vec3V V3Cos(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec3V tmp = V3Scale(a, recipTwoPi); + const Vec3V b = V3Round(tmp); + const Vec3V V1 = V3NegScaleSub(b, twoPi, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const Vec3V V2 = V3Mul(V1, V1); + const Vec3V V4 = V3Mul(V2, V2); + const Vec3V V6 = V3Mul(V4, V2); + const Vec3V V8 = V3Mul(V4, V4); + const Vec3V V10 = V3Mul(V6, V4); + const Vec3V V12 = V3Mul(V6, V6); + const Vec3V V14 = V3Mul(V8, V6); + const Vec3V V16 = V3Mul(V8, V8); + const Vec3V V18 = V3Mul(V10, V8); + const Vec3V V20 = V3Mul(V10, V10); + const Vec3V V22 = V3Mul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + Vec3V Result; + Result = V3ScaleAdd(V2, C1, V3One()); + Result = V3ScaleAdd(V4, C2, Result); + Result = V3ScaleAdd(V6, C3, Result); + Result = V3ScaleAdd(V8, C4, Result); + Result = V3ScaleAdd(V10, C5, Result); + Result = V3ScaleAdd(V12, C6, Result); + Result = V3ScaleAdd(V14, C7, Result); + Result = V3ScaleAdd(V16, C8, Result); + Result = V3ScaleAdd(V18, C9, Result); + Result = V3ScaleAdd(V20, C10, Result); + Result = V3ScaleAdd(V22, C11, Result); + + ASSERT_ISVALIDVEC3V(Result); + return Result; +} + +PX_FORCE_INLINE Vec3V V3PermYZZ(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 2, 2, 1)); +} + +PX_FORCE_INLINE Vec3V V3PermXYX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 1, 0)); +} + +PX_FORCE_INLINE Vec3V V3PermYZX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); +} + +PX_FORCE_INLINE Vec3V V3PermZXY(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); +} + +PX_FORCE_INLINE Vec3V V3PermZZY(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 2, 2)); +} + +PX_FORCE_INLINE Vec3V V3PermYXX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 0, 1)); +} + +PX_FORCE_INLINE Vec3V V3Perm_Zero_1Z_0Y(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + return _mm_shuffle_ps(v1, v0, _MM_SHUFFLE(3, 1, 2, 3)); +} + +PX_FORCE_INLINE Vec3V V3Perm_0Z_Zero_1X(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + return _mm_shuffle_ps(v0, v1, _MM_SHUFFLE(3, 0, 3, 2)); +} + +PX_FORCE_INLINE Vec3V V3Perm_1Y_0X_Zero(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + // There must be a better way to do this. + Vec3V v2 = V3Zero(); + const FloatV y1 = V3GetY(v1); + const FloatV x0 = V3GetX(v0); + v2 = V3SetX(v2, y1); + return V3SetY(v2, x0); +} + +PX_FORCE_INLINE FloatV V3SumElems(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); +#ifdef __SSE4_2__ + Vec3V r = _mm_hadd_ps(a, a); + r = _mm_hadd_ps(r, r); + return r; +#else + const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); // z,y,x,w + const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); // y,x,w,z + const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); // x,w,z,y + return _mm_add_ps(_mm_add_ps(shuf1, shuf2), shuf3); +#endif +} + +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V min, const Vec3V max) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(min); + ASSERT_ISVALIDVEC3V(max); + const BoolV c = BOr(V3IsGrtr(a, max), V3IsGrtr(min, a)); + return PxU32(!BAllEqFFFF(c)); +} + +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V min, const Vec3V max) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(min); + ASSERT_ISVALIDVEC3V(max); + const BoolV c = BAnd(V3IsGrtrOrEq(a, min), V3IsGrtrOrEq(max, a)); + return BAllEqTTTT(c); +} + +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V bounds) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(bounds); + return V3OutOfBounds(a, V3Neg(bounds), bounds); +} + +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V bounds) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(bounds); + return V3InBounds(a, V3Neg(bounds), bounds); +} + +PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2) +{ + ASSERT_ISVALIDVEC3V(col0); + ASSERT_ISVALIDVEC3V(col1); + ASSERT_ISVALIDVEC3V(col2); + const Vec3V col3 = _mm_setzero_ps(); + const Vec3V tmp0 = _mm_unpacklo_ps(col0, col1); + const Vec3V tmp2 = _mm_unpacklo_ps(col2, col3); + const Vec3V tmp1 = _mm_unpackhi_ps(col0, col1); + const Vec3V tmp3 = _mm_unpackhi_ps(col2, col3); + col0 = _mm_movelh_ps(tmp0, tmp2); + col1 = _mm_movehl_ps(tmp2, tmp0); + col2 = _mm_movelh_ps(tmp1, tmp3); +} + +////////////////////////////////// +// VEC4V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V V4Splat(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + // return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0,0,0,0)); + return f; +} + +PX_FORCE_INLINE Vec4V V4Merge(const FloatV* const floatVArray) +{ + ASSERT_ISVALIDFLOATV(floatVArray[0]); + ASSERT_ISVALIDFLOATV(floatVArray[1]); + ASSERT_ISVALIDFLOATV(floatVArray[2]); + ASSERT_ISVALIDFLOATV(floatVArray[3]); + const __m128 xw = _mm_move_ss(floatVArray[1], floatVArray[0]); // y, y, y, x + const __m128 yz = _mm_move_ss(floatVArray[2], floatVArray[3]); // z, z, z, w + return _mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0)); +} + +PX_FORCE_INLINE Vec4V V4Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w) +{ + ASSERT_ISVALIDFLOATV(x); + ASSERT_ISVALIDFLOATV(y); + ASSERT_ISVALIDFLOATV(z); + ASSERT_ISVALIDFLOATV(w); + const __m128 xw = _mm_move_ss(y, x); // y, y, y, x + const __m128 yz = _mm_move_ss(z, w); // z, z, z, w + return _mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0)); +} + +PX_FORCE_INLINE Vec4V V4MergeW(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const Vec4V xz = _mm_unpackhi_ps(x, z); + const Vec4V yw = _mm_unpackhi_ps(y, w); + return _mm_unpackhi_ps(xz, yw); +} + +PX_FORCE_INLINE Vec4V V4MergeZ(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const Vec4V xz = _mm_unpackhi_ps(x, z); + const Vec4V yw = _mm_unpackhi_ps(y, w); + return _mm_unpacklo_ps(xz, yw); +} + +PX_FORCE_INLINE Vec4V V4MergeY(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const Vec4V xz = _mm_unpacklo_ps(x, z); + const Vec4V yw = _mm_unpacklo_ps(y, w); + return _mm_unpackhi_ps(xz, yw); +} + +PX_FORCE_INLINE Vec4V V4MergeX(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const Vec4V xz = _mm_unpacklo_ps(x, z); + const Vec4V yw = _mm_unpacklo_ps(y, w); + return _mm_unpacklo_ps(xz, yw); +} + +PX_FORCE_INLINE Vec4V V4UnpackXY(const Vec4VArg a, const Vec4VArg b) +{ + return _mm_unpacklo_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4UnpackZW(const Vec4VArg a, const Vec4VArg b) +{ + return _mm_unpackhi_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4PermYXWZ(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 0, 1)); +} + +PX_FORCE_INLINE Vec4V V4PermXZXZ(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 0, 2, 0)); +} + +PX_FORCE_INLINE Vec4V V4PermYWYW(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 3, 1)); +} + +PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); +} + +PX_FORCE_INLINE Vec4V V4PermZWXY(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2)); +} + +template +PX_FORCE_INLINE Vec4V V4Perm(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(w, z, y, x)); +} + +PX_FORCE_INLINE FloatV V4GetW(const Vec4V f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(3, 3, 3, 3)); +} + +PX_FORCE_INLINE FloatV V4GetX(const Vec4V f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); +} + +PX_FORCE_INLINE FloatV V4GetY(const Vec4V f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); +} + +PX_FORCE_INLINE FloatV V4GetZ(const Vec4V f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); +} + +PX_FORCE_INLINE Vec4V V4SetW(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTTF(), v, f); +} + +PX_FORCE_INLINE Vec4V V4SetX(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BFTTT(), v, f); +} + +PX_FORCE_INLINE Vec4V V4SetY(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTFTT(), v, f); +} + +PX_FORCE_INLINE Vec4V V4SetZ(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTFT(), v, f); +} + +PX_FORCE_INLINE Vec4V V4Zero() +{ + return _mm_setzero_ps(); +} + +PX_FORCE_INLINE Vec4V V4One() +{ + return V4Load(1.0f); +} + +PX_FORCE_INLINE Vec4V V4Eps() +{ + return V4Load(PX_EPS_REAL); +} + +PX_FORCE_INLINE Vec4V V4Neg(const Vec4V f) +{ + return _mm_sub_ps(_mm_setzero_ps(), f); +} + +PX_FORCE_INLINE Vec4V V4Add(const Vec4V a, const Vec4V b) +{ + return _mm_add_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Sub(const Vec4V a, const Vec4V b) +{ + return _mm_sub_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Scale(const Vec4V a, const FloatV b) +{ + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Mul(const Vec4V a, const Vec4V b) +{ + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4ScaleInv(const Vec4V a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(b); + return _mm_div_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Div(const Vec4V a, const Vec4V b) +{ + return _mm_div_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4ScaleInvFast(const Vec4V a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, _mm_rcp_ps(b)); +} + +PX_FORCE_INLINE Vec4V V4DivFast(const Vec4V a, const Vec4V b) +{ + return _mm_mul_ps(a, _mm_rcp_ps(b)); +} + +PX_FORCE_INLINE Vec4V V4Recip(const Vec4V a) +{ + return _mm_div_ps(V4One(), a); +} + +PX_FORCE_INLINE Vec4V V4RecipFast(const Vec4V a) +{ + return _mm_rcp_ps(a); +} + +PX_FORCE_INLINE Vec4V V4Rsqrt(const Vec4V a) +{ + return _mm_div_ps(V4One(), _mm_sqrt_ps(a)); +} + +PX_FORCE_INLINE Vec4V V4RsqrtFast(const Vec4V a) +{ + return _mm_rsqrt_ps(a); +} + +PX_FORCE_INLINE Vec4V V4Sqrt(const Vec4V a) +{ + return _mm_sqrt_ps(a); +} + +PX_FORCE_INLINE Vec4V V4ScaleAdd(const Vec4V a, const FloatV b, const Vec4V c) +{ + ASSERT_ISVALIDFLOATV(b); + return V4Add(V4Scale(a, b), c); +} + +PX_FORCE_INLINE Vec4V V4NegScaleSub(const Vec4V a, const FloatV b, const Vec4V c) +{ + ASSERT_ISVALIDFLOATV(b); + return V4Sub(c, V4Scale(a, b)); +} + +PX_FORCE_INLINE Vec4V V4MulAdd(const Vec4V a, const Vec4V b, const Vec4V c) +{ + return V4Add(V4Mul(a, b), c); +} + +PX_FORCE_INLINE Vec4V V4NegMulSub(const Vec4V a, const Vec4V b, const Vec4V c) +{ + return V4Sub(c, V4Mul(a, b)); +} + +PX_FORCE_INLINE Vec4V V4Abs(const Vec4V a) +{ + return V4Max(a, V4Neg(a)); +} + +PX_FORCE_INLINE FloatV V4SumElements(const Vec4V a) +{ +#ifdef __SSE4_2__ + Vec4V r = _mm_hadd_ps(a, a); + r = _mm_hadd_ps(r, r); + return r; +#else + const Vec4V xy = V4UnpackXY(a, a); // x,x,y,y + const Vec4V zw = V4UnpackZW(a, a); // z,z,w,w + const Vec4V xz_yw = V4Add(xy, zw); // x+z,x+z,y+w,y+w + const FloatV xz = V4GetX(xz_yw); // x+z + const FloatV yw = V4GetZ(xz_yw); // y+w + return FAdd(xz, yw); // sum +#endif +} + +PX_FORCE_INLINE FloatV V4Dot(const Vec4V a, const Vec4V b) +{ +#ifdef __SSE4_2__ + return _mm_dp_ps(a, b, 0xff); +#else + //const __m128 dot1 = _mm_mul_ps(a, b); // x,y,z,w + //const __m128 shuf1 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(2, 1, 0, 3)); // w,x,y,z + //const __m128 shuf2 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(1, 0, 3, 2)); // z,w,x,y + //const __m128 shuf3 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(0, 3, 2, 1)); // y,z,w,x + //return _mm_add_ps(_mm_add_ps(shuf2, shuf3), _mm_add_ps(dot1, shuf1)); + + // PT: this version has two less instructions but we should check its accuracy + // aw*bw | az*bz | ay*by | ax*bx + const __m128 t0 = _mm_mul_ps(a, b); + // ay*by | ax*bx | aw*bw | az*bz + const __m128 t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(1, 0, 3, 2)); + // ay*by + aw*bw | ax*bx + az*bz | aw*bw + ay*by | az*bz + ax*bx + const __m128 t2 = _mm_add_ps(t0, t1); + // ax*bx + az*bz | ay*by + aw*bw | az*bz + ax*bx | aw*bw + ay*by + const __m128 t3 = _mm_shuffle_ps(t2, t2, _MM_SHUFFLE(2, 3, 0, 1)); + // ax*bx + az*bz + ay*by + aw*bw + return _mm_add_ps(t3, t2); + // ay*by + aw*bw + ax*bx + az*bz + // az*bz + ax*bx + aw*bw + ay*by + // aw*bw + ay*by + az*bz + ax*bx +#endif +} + +PX_FORCE_INLINE FloatV V4Dot3(const Vec4V a, const Vec4V b) +{ +#ifdef __SSE4_2__ + return _mm_dp_ps(a, b, 0x7f); +#else + const __m128 dot1 = _mm_mul_ps(a, b); // aw*bw | az*bz | ay*by | ax*bx + const __m128 shuf1 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(0, 0, 0, 0)); // ax*bx | ax*bx | ax*bx | ax*bx + const __m128 shuf2 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(1, 1, 1, 1)); // ay*by | ay*by | ay*by | ay*by + const __m128 shuf3 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(2, 2, 2, 2)); // az*bz | az*bz | az*bz | az*bz + return _mm_add_ps(_mm_add_ps(shuf1, shuf2), shuf3); // ax*bx + ay*by + az*bz in each component +#endif +} + +PX_FORCE_INLINE Vec4V V4Cross(const Vec4V a, const Vec4V b) +{ +/* if(0) + { + const __m128 r1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + return _mm_sub_ps(_mm_mul_ps(l1, l2), _mm_mul_ps(r1, r2)); + } + else*/ + { + const __m128 b0 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3,0,2,1)); + const __m128 a1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3,0,2,1)); + __m128 v = _mm_mul_ps(a1, b); + v = _mm_sub_ps(_mm_mul_ps(a, b0), v); + return _mm_shuffle_ps(v, v, _MM_SHUFFLE(3,0,2,1)); + } +} + +PX_FORCE_INLINE FloatV V4Length(const Vec4V a) +{ + return _mm_sqrt_ps(V4Dot(a, a)); +} + +PX_FORCE_INLINE FloatV V4LengthSq(const Vec4V a) +{ + return V4Dot(a, a); +} + +PX_FORCE_INLINE Vec4V V4Normalize(const Vec4V a) +{ + ASSERT_ISFINITELENGTH(a); + return V4ScaleInv(a, _mm_sqrt_ps(V4Dot(a, a))); +} + +PX_FORCE_INLINE Vec4V V4NormalizeFast(const Vec4V a) +{ + ASSERT_ISFINITELENGTH(a); + return V4ScaleInvFast(a, _mm_sqrt_ps(V4Dot(a, a))); +} + +PX_FORCE_INLINE Vec4V V4NormalizeSafe(const Vec4V a, const Vec4V unsafeReturnValue) +{ + const __m128 eps = V3Eps(); + const __m128 length = V4Length(a); + const __m128 isGreaterThanZero = V4IsGrtr(length, eps); + return V4Sel(isGreaterThanZero, V4ScaleInv(a, length), unsafeReturnValue); +} + +PX_FORCE_INLINE Vec4V V4Sel(const BoolV c, const Vec4V a, const Vec4V b) +{ + return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); +} + +PX_FORCE_INLINE BoolV V4IsGrtr(const Vec4V a, const Vec4V b) +{ + return _mm_cmpgt_ps(a, b); +} + +PX_FORCE_INLINE BoolV V4IsGrtrOrEq(const Vec4V a, const Vec4V b) +{ + return _mm_cmpge_ps(a, b); +} + +PX_FORCE_INLINE BoolV V4IsEq(const Vec4V a, const Vec4V b) +{ + return _mm_cmpeq_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Max(const Vec4V a, const Vec4V b) +{ + return _mm_max_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Min(const Vec4V a, const Vec4V b) +{ + return _mm_min_ps(a, b); +} + +PX_FORCE_INLINE FloatV V4ExtractMax(const Vec4V a) +{ + const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 1, 0, 3)); + const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2)); + const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 3, 2, 1)); + + return _mm_max_ps(_mm_max_ps(a, shuf1), _mm_max_ps(shuf2, shuf3)); +} + +PX_FORCE_INLINE FloatV V4ExtractMin(const Vec4V a) +{ + const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 1, 0, 3)); + const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2)); + const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 3, 2, 1)); + + return _mm_min_ps(_mm_min_ps(a, shuf1), _mm_min_ps(shuf2, shuf3)); +} + +PX_FORCE_INLINE Vec4V V4Clamp(const Vec4V a, const Vec4V minV, const Vec4V maxV) +{ + return V4Max(V4Min(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 V4AllGrtr(const Vec4V a, const Vec4V b) +{ + return internalSimd::BAllTrue4_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq(const Vec4V a, const Vec4V b) +{ + return internalSimd::BAllTrue4_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq3(const Vec4V a, const Vec4V b) +{ + return internalSimd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllEq(const Vec4V a, const Vec4V b) +{ + return internalSimd::BAllTrue4_R(V4IsEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AnyGrtr3(const Vec4V a, const Vec4V b) +{ + return internalSimd::BAnyTrue3_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE Vec4V V4Round(const Vec4V a) +{ +#ifdef __SSE4_2__ + return _mm_round_ps(a, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC); +#else + // return _mm_round_ps(a, 0x0); + const Vec4V half = V4Load(0.5f); + const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); + const Vec4V aRound = V4Sub(V4Add(a, half), signBit); + const __m128i tmp = _mm_cvttps_epi32(aRound); + return _mm_cvtepi32_ps(tmp); +#endif +} + +PX_FORCE_INLINE Vec4V V4Sin(const Vec4V a) +{ + // PT: TODO: these should be FLoads + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec4V tmp = V4Mul(a, recipTwoPi); + const Vec4V b = V4Round(tmp); + const Vec4V V1 = V4NegMulSub(twoPi, b, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const Vec4V V2 = V4Mul(V1, V1); + const Vec4V V3 = V4Mul(V2, V1); + const Vec4V V5 = V4Mul(V3, V2); + const Vec4V V7 = V4Mul(V5, V2); + const Vec4V V9 = V4Mul(V7, V2); + const Vec4V V11 = V4Mul(V9, V2); + const Vec4V V13 = V4Mul(V11, V2); + const Vec4V V15 = V4Mul(V13, V2); + const Vec4V V17 = V4Mul(V15, V2); + const Vec4V V19 = V4Mul(V17, V2); + const Vec4V V21 = V4Mul(V19, V2); + const Vec4V V23 = V4Mul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + Vec4V Result; + Result = V4MulAdd(S1, V3, V1); + Result = V4MulAdd(S2, V5, Result); + Result = V4MulAdd(S3, V7, Result); + Result = V4MulAdd(S4, V9, Result); + Result = V4MulAdd(S5, V11, Result); + Result = V4MulAdd(S6, V13, Result); + Result = V4MulAdd(S7, V15, Result); + Result = V4MulAdd(S8, V17, Result); + Result = V4MulAdd(S9, V19, Result); + Result = V4MulAdd(S10, V21, Result); + Result = V4MulAdd(S11, V23, Result); + + return Result; +} + +PX_FORCE_INLINE Vec4V V4Cos(const Vec4V a) +{ + // PT: TODO: these should be FLoads + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const FloatV twoPi = V4LoadA(g_PXTwoPi.f); + const Vec4V tmp = V4Mul(a, recipTwoPi); + const Vec4V b = V4Round(tmp); + const Vec4V V1 = V4NegMulSub(twoPi, b, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const Vec4V V2 = V4Mul(V1, V1); + const Vec4V V4 = V4Mul(V2, V2); + const Vec4V V6 = V4Mul(V4, V2); + const Vec4V V8 = V4Mul(V4, V4); + const Vec4V V10 = V4Mul(V6, V4); + const Vec4V V12 = V4Mul(V6, V6); + const Vec4V V14 = V4Mul(V8, V6); + const Vec4V V16 = V4Mul(V8, V8); + const Vec4V V18 = V4Mul(V10, V8); + const Vec4V V20 = V4Mul(V10, V10); + const Vec4V V22 = V4Mul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + Vec4V Result; + Result = V4MulAdd(C1, V2, V4One()); + Result = V4MulAdd(C2, V4, Result); + Result = V4MulAdd(C3, V6, Result); + Result = V4MulAdd(C4, V8, Result); + Result = V4MulAdd(C5, V10, Result); + Result = V4MulAdd(C6, V12, Result); + Result = V4MulAdd(C7, V14, Result); + Result = V4MulAdd(C8, V16, Result); + Result = V4MulAdd(C9, V18, Result); + Result = V4MulAdd(C10, V20, Result); + Result = V4MulAdd(C11, V22, Result); + + return Result; +} + +PX_FORCE_INLINE void V4Transpose(Vec4V& col0, Vec4V& col1, Vec4V& col2, Vec4V& col3) +{ + const Vec4V tmp0 = _mm_unpacklo_ps(col0, col1); + const Vec4V tmp2 = _mm_unpacklo_ps(col2, col3); + const Vec4V tmp1 = _mm_unpackhi_ps(col0, col1); + const Vec4V tmp3 = _mm_unpackhi_ps(col2, col3); + col0 = _mm_movelh_ps(tmp0, tmp2); + col1 = _mm_movehl_ps(tmp2, tmp0); + col2 = _mm_movelh_ps(tmp1, tmp3); + col3 = _mm_movehl_ps(tmp3, tmp1); +} + +PX_FORCE_INLINE BoolV V4IsEqU32(const VecU32V a, const VecU32V b) +{ + return internalSimd::m128_I2F(_mm_cmpeq_epi32(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))); +} + +////////////////////////////////// +// BoolV +////////////////////////////////// + +PX_FORCE_INLINE BoolV BFFFF() +{ + return _mm_setzero_ps(); +} + +PX_FORCE_INLINE BoolV BFFFT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0,0xFFFFFFFF}; + const __m128 ffft=_mm_load_ps((float*)&f); + return ffft;*/ + return internalSimd::m128_I2F(_mm_set_epi32(-1, 0, 0, 0)); +} + +PX_FORCE_INLINE BoolV BFFTF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0}; + const __m128 fftf=_mm_load_ps((float*)&f); + return fftf;*/ + return internalSimd::m128_I2F(_mm_set_epi32(0, -1, 0, 0)); +} + +PX_FORCE_INLINE BoolV BFFTT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0xFFFFFFFF}; + const __m128 fftt=_mm_load_ps((float*)&f); + return fftt;*/ + return internalSimd::m128_I2F(_mm_set_epi32(-1, -1, 0, 0)); +} + +PX_FORCE_INLINE BoolV BFTFF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0}; + const __m128 ftff=_mm_load_ps((float*)&f); + return ftff;*/ + return internalSimd::m128_I2F(_mm_set_epi32(0, 0, -1, 0)); +} + +PX_FORCE_INLINE BoolV BFTFT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0xFFFFFFFF}; + const __m128 ftft=_mm_load_ps((float*)&f); + return ftft;*/ + return internalSimd::m128_I2F(_mm_set_epi32(-1, 0, -1, 0)); +} + +PX_FORCE_INLINE BoolV BFTTF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0xFFFFFFFF,0}; + const __m128 fttf=_mm_load_ps((float*)&f); + return fttf;*/ + return internalSimd::m128_I2F(_mm_set_epi32(0, -1, -1, 0)); +} + +PX_FORCE_INLINE BoolV BFTTT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}; + const __m128 fttt=_mm_load_ps((float*)&f); + return fttt;*/ + return internalSimd::m128_I2F(_mm_set_epi32(-1, -1, -1, 0)); +} + +PX_FORCE_INLINE BoolV BTFFF() +{ + // const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0}; + // const __m128 tfff=_mm_load_ps((float*)&f); + // return tfff; + return internalSimd::m128_I2F(_mm_set_epi32(0, 0, 0, -1)); +} + +PX_FORCE_INLINE BoolV BTFFT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0xFFFFFFFF}; + const __m128 tfft=_mm_load_ps((float*)&f); + return tfft;*/ + return internalSimd::m128_I2F(_mm_set_epi32(-1, 0, 0, -1)); +} + +PX_FORCE_INLINE BoolV BTFTF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0xFFFFFFFF,0}; + const __m128 tftf=_mm_load_ps((float*)&f); + return tftf;*/ + return internalSimd::m128_I2F(_mm_set_epi32(0, -1, 0, -1)); +} + +PX_FORCE_INLINE BoolV BTFTT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0xFFFFFFFF,0xFFFFFFFF}; + const __m128 tftt=_mm_load_ps((float*)&f); + return tftt;*/ + return internalSimd::m128_I2F(_mm_set_epi32(-1, -1, 0, -1)); +} + +PX_FORCE_INLINE BoolV BTTFF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0,0}; + const __m128 ttff=_mm_load_ps((float*)&f); + return ttff;*/ + return internalSimd::m128_I2F(_mm_set_epi32(0, 0, -1, -1)); +} + +PX_FORCE_INLINE BoolV BTTFT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0,0xFFFFFFFF}; + const __m128 ttft=_mm_load_ps((float*)&f); + return ttft;*/ + return internalSimd::m128_I2F(_mm_set_epi32(-1, 0, -1, -1)); +} + +PX_FORCE_INLINE BoolV BTTTF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0}; + const __m128 tttf=_mm_load_ps((float*)&f); + return tttf;*/ + return internalSimd::m128_I2F(_mm_set_epi32(0, -1, -1, -1)); +} + +PX_FORCE_INLINE BoolV BTTTT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}; + const __m128 tttt=_mm_load_ps((float*)&f); + return tttt;*/ + return internalSimd::m128_I2F(_mm_set_epi32(-1, -1, -1, -1)); +} + +PX_FORCE_INLINE BoolV BXMask() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0}; + const __m128 tfff=_mm_load_ps((float*)&f); + return tfff;*/ + return internalSimd::m128_I2F(_mm_set_epi32(0, 0, 0, -1)); +} + +PX_FORCE_INLINE BoolV BYMask() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0}; + const __m128 ftff=_mm_load_ps((float*)&f); + return ftff;*/ + return internalSimd::m128_I2F(_mm_set_epi32(0, 0, -1, 0)); +} + +PX_FORCE_INLINE BoolV BZMask() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0}; + const __m128 fftf=_mm_load_ps((float*)&f); + return fftf;*/ + return internalSimd::m128_I2F(_mm_set_epi32(0, -1, 0, 0)); +} + +PX_FORCE_INLINE BoolV BWMask() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0,0xFFFFFFFF}; + const __m128 ffft=_mm_load_ps((float*)&f); + return ffft;*/ + return internalSimd::m128_I2F(_mm_set_epi32(-1, 0, 0, 0)); +} + +PX_FORCE_INLINE BoolV BGetX(const BoolV f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); +} + +PX_FORCE_INLINE BoolV BGetY(const BoolV f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); +} + +PX_FORCE_INLINE BoolV BGetZ(const BoolV f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); +} + +PX_FORCE_INLINE BoolV BGetW(const BoolV f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(3, 3, 3, 3)); +} + +PX_FORCE_INLINE BoolV BSetX(const BoolV v, const BoolV f) +{ + return V4Sel(BFTTT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetY(const BoolV v, const BoolV f) +{ + return V4Sel(BTFTT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetZ(const BoolV v, const BoolV f) +{ + return V4Sel(BTTFT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetW(const BoolV v, const BoolV f) +{ + return V4Sel(BTTTF(), v, f); +} + +PX_FORCE_INLINE BoolV BAnd(const BoolV a, const BoolV b) +{ + return _mm_and_ps(a, b); +} + +PX_FORCE_INLINE BoolV BNot(const BoolV a) +{ + const BoolV bAllTrue(BTTTT()); + return _mm_xor_ps(a, bAllTrue); +} + +PX_FORCE_INLINE BoolV BAndNot(const BoolV a, const BoolV b) +{ + return _mm_andnot_ps(b, a); +} + +PX_FORCE_INLINE BoolV BOr(const BoolV a, const BoolV b) +{ + return _mm_or_ps(a, b); +} + +PX_FORCE_INLINE BoolV BAllTrue4(const BoolV a) +{ + const BoolV bTmp = _mm_and_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 2, 3))); + return _mm_and_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), + _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); +} + +PX_FORCE_INLINE BoolV BAnyTrue4(const BoolV a) +{ + const BoolV bTmp = _mm_or_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 2, 3))); + return _mm_or_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), + _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); +} + +PX_FORCE_INLINE BoolV BAllTrue3(const BoolV a) +{ + const BoolV bTmp = _mm_and_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2))); + return _mm_and_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), + _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); +} + +PX_FORCE_INLINE BoolV BAnyTrue3(const BoolV a) +{ + const BoolV bTmp = _mm_or_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2))); + return _mm_or_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), + _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); +} + +PX_FORCE_INLINE PxU32 BAllEq(const BoolV a, const BoolV b) +{ + const BoolV bTest = internalSimd::m128_I2F(_mm_cmpeq_epi32(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))); + return internalSimd::BAllTrue4_R(bTest); +} + +PX_FORCE_INLINE PxU32 BAllEqTTTT(const BoolV a) +{ + return PxU32(_mm_movemask_ps(a)==15); +} + +PX_FORCE_INLINE PxU32 BAllEqFFFF(const BoolV a) +{ + return PxU32(_mm_movemask_ps(a)==0); +} + +PX_FORCE_INLINE PxU32 BGetBitMask(const BoolV a) +{ + return PxU32(_mm_movemask_ps(a)); +} + +////////////////////////////////// +// MAT33V +////////////////////////////////// + +PX_FORCE_INLINE Mat33V M33Identity() +{ + return Mat33V(V3UnitX(), V3UnitY(), V3UnitZ()); +} + +PX_FORCE_INLINE Vec3V M33MulV3(const Mat33V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + return V3Add(v0PlusV1, v2); +} + +PX_FORCE_INLINE Vec3V M33MulV3AddV3(const Mat33V& A, const Vec3V b, const Vec3V c) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + Vec3V result = V3ScaleAdd(A.col0, x, c); + result = V3ScaleAdd(A.col1, y, result); + return V3ScaleAdd(A.col2, z, result); +} + +PX_FORCE_INLINE Mat33V M33MulM33(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(M33MulV3(a, b.col0), M33MulV3(a, b.col1), M33MulV3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Add(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Scale(const Mat33V& a, const FloatV& b) +{ + return Mat33V(V3Scale(a.col0, b), V3Scale(a.col1, b), V3Scale(a.col2, b)); +} + +PX_FORCE_INLINE Mat33V M33Sub(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(V3Sub(a.col0, b.col0), V3Sub(a.col1, b.col1), V3Sub(a.col2, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Neg(const Mat33V& a) +{ + return Mat33V(V3Neg(a.col0), V3Neg(a.col1), V3Neg(a.col2)); +} + +PX_FORCE_INLINE Mat33V M33Abs(const Mat33V& a) +{ + return Mat33V(V3Abs(a.col0), V3Abs(a.col1), V3Abs(a.col2)); +} + +PX_FORCE_INLINE Mat33V M33Inverse(const Mat33V& a) +{ + const BoolV tfft = BTFFT(); + const BoolV tttf = BTTTF(); + const FloatV zero = FZero(); + const Vec3V cross01 = V3Cross(a.col0, a.col1); + const Vec3V cross12 = V3Cross(a.col1, a.col2); + const Vec3V cross20 = V3Cross(a.col2, a.col0); + const FloatV dot = V3Dot(cross01, a.col2); + const FloatV invDet = _mm_rcp_ps(dot); + const Vec3V mergeh = _mm_unpacklo_ps(cross12, cross01); + const Vec3V mergel = _mm_unpackhi_ps(cross12, cross01); + Vec3V colInv0 = _mm_unpacklo_ps(mergeh, cross20); + colInv0 = _mm_or_ps(_mm_andnot_ps(tttf, zero), _mm_and_ps(tttf, colInv0)); + const Vec3V zppd = _mm_shuffle_ps(mergeh, cross20, _MM_SHUFFLE(3, 0, 0, 2)); + const Vec3V pbwp = _mm_shuffle_ps(cross20, mergeh, _MM_SHUFFLE(3, 3, 1, 0)); + const Vec3V colInv1 = _mm_or_ps(_mm_andnot_ps(BTFFT(), pbwp), _mm_and_ps(BTFFT(), zppd)); + const Vec3V xppd = _mm_shuffle_ps(mergel, cross20, _MM_SHUFFLE(3, 0, 0, 0)); + const Vec3V pcyp = _mm_shuffle_ps(cross20, mergel, _MM_SHUFFLE(3, 1, 2, 0)); + const Vec3V colInv2 = _mm_or_ps(_mm_andnot_ps(tfft, pcyp), _mm_and_ps(tfft, xppd)); + + return Mat33V(_mm_mul_ps(colInv0, invDet), _mm_mul_ps(colInv1, invDet), _mm_mul_ps(colInv2, invDet)); +} + +PX_FORCE_INLINE Mat33V M33Diagonal(const Vec3VArg d) +{ + const FloatV x = V3Mul(V3UnitX(), d); + const FloatV y = V3Mul(V3UnitY(), d); + const FloatV z = V3Mul(V3UnitZ(), d); + return Mat33V(x, y, z); +} + +PX_FORCE_INLINE Mat33V Mat33V_From_PxMat33(const PxMat33& m) +{ + return Mat33V(V3LoadU(m.column0), V3LoadU(m.column1), V3LoadU(m.column2)); +} + +PX_FORCE_INLINE void PxMat33_From_Mat33V(const Mat33V& m, PxMat33& out) +{ + V3StoreU(m.col0, out.column0); + V3StoreU(m.col1, out.column1); + V3StoreU(m.col2, out.column2); +} + +////////////////////////////////// +// MAT34V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M34MulV3(const Mat34V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + const Vec3V v0PlusV1Plusv2 = V3Add(v0PlusV1, v2); + return V3Add(v0PlusV1Plusv2, a.col3); +} + +PX_FORCE_INLINE Vec3V M34Mul33V3(const Mat34V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + return V3Add(v0PlusV1, v2); +} + +PX_FORCE_INLINE Mat34V M34MulM34(const Mat34V& a, const Mat34V& b) +{ + return Mat34V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2), M34MulV3(a, b.col3)); +} + +PX_FORCE_INLINE Mat33V M34MulM33(const Mat34V& a, const Mat33V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M34Mul33MM34(const Mat34V& a, const Mat34V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat34V M34Add(const Mat34V& a, const Mat34V& b) +{ + return Mat34V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2), V3Add(a.col3, b.col3)); +} + +////////////////////////////////// +// MAT44V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V M44MulV4(const Mat44V& a, const Vec4V b) +{ + const FloatV x = V4GetX(b); + const FloatV y = V4GetY(b); + const FloatV z = V4GetZ(b); + const FloatV w = V4GetW(b); + + const Vec4V v0 = V4Scale(a.col0, x); + const Vec4V v1 = V4Scale(a.col1, y); + const Vec4V v2 = V4Scale(a.col2, z); + const Vec4V v3 = V4Scale(a.col3, w); + const Vec4V v0PlusV1 = V4Add(v0, v1); + const Vec4V v0PlusV1Plusv2 = V4Add(v0PlusV1, v2); + return V4Add(v0PlusV1Plusv2, v3); +} + +PX_FORCE_INLINE Mat44V M44MulM44(const Mat44V& a, const Mat44V& b) +{ + return Mat44V(M44MulV4(a, b.col0), M44MulV4(a, b.col1), M44MulV4(a, b.col2), M44MulV4(a, b.col3)); +} + +PX_FORCE_INLINE Mat44V M44Add(const Mat44V& a, const Mat44V& b) +{ + return Mat44V(V4Add(a.col0, b.col0), V4Add(a.col1, b.col1), V4Add(a.col2, b.col2), V4Add(a.col3, b.col3)); +} + +PX_FORCE_INLINE Mat44V M44Trnsps(const Mat44V& a); + +PX_FORCE_INLINE Mat44V M44Inverse(const Mat44V& a) +{ + __m128 minor0, minor1, minor2, minor3; + __m128 row0, row1, row2, row3; + __m128 det, tmp1; + + tmp1 = V4Zero(); + row1 = V4Zero(); + row3 = V4Zero(); + + row0 = a.col0; + row1 = _mm_shuffle_ps(a.col1, a.col1, _MM_SHUFFLE(1, 0, 3, 2)); + row2 = a.col2; + row3 = _mm_shuffle_ps(a.col3, a.col3, _MM_SHUFFLE(1, 0, 3, 2)); + + tmp1 = _mm_mul_ps(row2, row3); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor0 = _mm_mul_ps(row1, tmp1); + minor1 = _mm_mul_ps(row0, tmp1); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor0 = _mm_sub_ps(_mm_mul_ps(row1, tmp1), minor0); + minor1 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor1); + minor1 = _mm_shuffle_ps(minor1, minor1, 0x4E); + + tmp1 = _mm_mul_ps(row1, row2); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor0 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor0); + minor3 = _mm_mul_ps(row0, tmp1); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor0 = _mm_sub_ps(minor0, _mm_mul_ps(row3, tmp1)); + minor3 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor3); + minor3 = _mm_shuffle_ps(minor3, minor3, 0x4E); + + tmp1 = _mm_mul_ps(_mm_shuffle_ps(row1, row1, 0x4E), row3); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + row2 = _mm_shuffle_ps(row2, row2, 0x4E); + minor0 = _mm_add_ps(_mm_mul_ps(row2, tmp1), minor0); + minor2 = _mm_mul_ps(row0, tmp1); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor0 = _mm_sub_ps(minor0, _mm_mul_ps(row2, tmp1)); + minor2 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor2); + minor2 = _mm_shuffle_ps(minor2, minor2, 0x4E); + + tmp1 = _mm_mul_ps(row0, row1); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor2 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor2); + minor3 = _mm_sub_ps(_mm_mul_ps(row2, tmp1), minor3); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor2 = _mm_sub_ps(_mm_mul_ps(row3, tmp1), minor2); + minor3 = _mm_sub_ps(minor3, _mm_mul_ps(row2, tmp1)); + + tmp1 = _mm_mul_ps(row0, row3); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor1 = _mm_sub_ps(minor1, _mm_mul_ps(row2, tmp1)); + minor2 = _mm_add_ps(_mm_mul_ps(row1, tmp1), minor2); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor1 = _mm_add_ps(_mm_mul_ps(row2, tmp1), minor1); + minor2 = _mm_sub_ps(minor2, _mm_mul_ps(row1, tmp1)); + + tmp1 = _mm_mul_ps(row0, row2); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor1 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor1); + minor3 = _mm_sub_ps(minor3, _mm_mul_ps(row1, tmp1)); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor1 = _mm_sub_ps(minor1, _mm_mul_ps(row3, tmp1)); + minor3 = _mm_add_ps(_mm_mul_ps(row1, tmp1), minor3); + + det = _mm_mul_ps(row0, minor0); + det = _mm_add_ps(_mm_shuffle_ps(det, det, 0x4E), det); + det = _mm_add_ss(_mm_shuffle_ps(det, det, 0xB1), det); + tmp1 = _mm_rcp_ss(det); +#if 0 + det = _mm_sub_ss(_mm_add_ss(tmp1, tmp1), _mm_mul_ss(det, _mm_mul_ss(tmp1, tmp1))); + det = _mm_shuffle_ps(det, det, 0x00); +#else + det = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(0, 0, 0, 0)); +#endif + + minor0 = _mm_mul_ps(det, minor0); + minor1 = _mm_mul_ps(det, minor1); + minor2 = _mm_mul_ps(det, minor2); + minor3 = _mm_mul_ps(det, minor3); + Mat44V invTrans(minor0, minor1, minor2, minor3); + return M44Trnsps(invTrans); +} + +////////////////////////////////// +// Misc +////////////////////////////////// + +// PT: TODO: seems to be in the wrong section +PX_FORCE_INLINE Vec4V V4LoadXYZW(const PxF32& x, const PxF32& y, const PxF32& z, const PxF32& w) +{ + return _mm_set_ps(w, z, y, x); +} + +PX_FORCE_INLINE VecU32V V4U32Sel(const BoolV c, const VecU32V a, const VecU32V b) +{ + return internalSimd::m128_I2F(_mm_or_si128(_mm_andnot_si128(internalSimd::m128_F2I(c), internalSimd::m128_F2I(b)), _mm_and_si128(internalSimd::m128_F2I(c), internalSimd::m128_F2I(a)))); +} + +PX_FORCE_INLINE VecU32V V4U32or(VecU32V a, VecU32V b) +{ + return internalSimd::m128_I2F(_mm_or_si128(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE VecU32V V4U32xor(VecU32V a, VecU32V b) +{ + return internalSimd::m128_I2F(_mm_xor_si128(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE VecU32V V4U32and(VecU32V a, VecU32V b) +{ + return internalSimd::m128_I2F(_mm_and_si128(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE VecU32V V4U32Andc(VecU32V a, VecU32V b) +{ + return internalSimd::m128_I2F(_mm_andnot_si128(internalSimd::m128_F2I(b), internalSimd::m128_F2I(a))); +} + +PX_FORCE_INLINE VecU32V U4Load(const PxU32 i) +{ + return _mm_load1_ps(reinterpret_cast(&i)); +} + +PX_FORCE_INLINE VecU32V U4LoadU(const PxU32* i) +{ + return _mm_loadu_ps(reinterpret_cast(i)); +} + +PX_FORCE_INLINE VecU32V U4LoadA(const PxU32* i) +{ + ASSERT_ISALIGNED16(i); + return _mm_load_ps(reinterpret_cast(i)); +} + +PX_FORCE_INLINE VecI32V VecI32V_One() +{ + return I4Load(1); +} + +PX_FORCE_INLINE VecI32V VecI32V_Two() +{ + return I4Load(2); +} + +PX_FORCE_INLINE VecI32V VecI32V_MinusOne() +{ + return I4Load(-1); +} + +PX_FORCE_INLINE VecU32V U4Zero() +{ + return U4Load(0); +} + +PX_FORCE_INLINE VecU32V U4One() +{ + return U4Load(1); +} + +PX_FORCE_INLINE VecU32V U4Two() +{ + return U4Load(2); +} + +PX_FORCE_INLINE Vec4V V4Andc(const Vec4V a, const VecU32V b) +{ + VecU32V result32(a); + result32 = V4U32Andc(result32, b); + return Vec4V(result32); +} + +PX_FORCE_INLINE VecU32V V4IsGrtrV32u(const Vec4V a, const Vec4V b) +{ + return V4IsGrtr(a, b); +} + +PX_FORCE_INLINE VecU16V V4U16LoadAligned(const VecU16V* addr) +{ + return *addr; +} + +PX_FORCE_INLINE VecU16V V4U16LoadUnaligned(const VecU16V* addr) +{ + return *addr; +} + +PX_FORCE_INLINE VecU16V V4I16CompareGt(VecU16V a, VecU16V b) +{ + return internalSimd::m128_I2F(_mm_cmpgt_epi16(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))); +} + +// unsigned compares are not supported on x86 +PX_FORCE_INLINE VecU16V V4U16CompareGt(VecU16V a, VecU16V b) +{ + // _mm_cmpgt_epi16 doesn't work for unsigned values unfortunately + // return m128_I2F(_mm_cmpgt_epi16(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))); + VecU16V result; + result.m128_u16[0] = PxU16((a).m128_u16[0] > (b).m128_u16[0]); + result.m128_u16[1] = PxU16((a).m128_u16[1] > (b).m128_u16[1]); + result.m128_u16[2] = PxU16((a).m128_u16[2] > (b).m128_u16[2]); + result.m128_u16[3] = PxU16((a).m128_u16[3] > (b).m128_u16[3]); + result.m128_u16[4] = PxU16((a).m128_u16[4] > (b).m128_u16[4]); + result.m128_u16[5] = PxU16((a).m128_u16[5] > (b).m128_u16[5]); + result.m128_u16[6] = PxU16((a).m128_u16[6] > (b).m128_u16[6]); + result.m128_u16[7] = PxU16((a).m128_u16[7] > (b).m128_u16[7]); + return result; +} + +PX_FORCE_INLINE Vec4V Vec4V_From_VecU32V(VecU32V a) +{ + Vec4V result = V4LoadXYZW(PxF32(a.m128_u32[0]), PxF32(a.m128_u32[1]), PxF32(a.m128_u32[2]), PxF32(a.m128_u32[3])); + return result; +} + +PX_FORCE_INLINE VecU32V U4LoadXYZW(PxU32 x, PxU32 y, PxU32 z, PxU32 w) +{ + VecU32V result; + result.m128_u32[0] = x; + result.m128_u32[1] = y; + result.m128_u32[2] = z; + result.m128_u32[3] = w; + return result; +} + +} // namespace aos +#if !PX_DOXYGEN +} // namespace physx +#endif + + +#endif + diff --git a/engine/third_party/physx/include/foundation/PxVecQuat.h b/engine/third_party/physx/include/foundation/PxVecQuat.h new file mode 100644 index 00000000..3bb2a882 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxVecQuat.h @@ -0,0 +1,497 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_VEC_QUAT_H +#define PX_VEC_QUAT_H + +#if !PX_DOXYGEN +namespace physx +{ +#endif +namespace aos +{ + +#ifndef PX_PIDIV2 +#define PX_PIDIV2 1.570796327f +#endif + +////////////////////////////////// +// QuatV +////////////////////////////////// +PX_FORCE_INLINE QuatV QuatVLoadXYZW(const PxF32 x, const PxF32 y, const PxF32 z, const PxF32 w) +{ + return V4LoadXYZW(x, y, z, w); +} + +PX_FORCE_INLINE QuatV QuatVLoadU(const PxF32* v) +{ + return V4LoadU(v); +} + +PX_FORCE_INLINE QuatV QuatVLoadA(const PxF32* v) +{ + return V4LoadA(v); +} + +PX_FORCE_INLINE QuatV QuatV_From_RotationAxisAngle(const Vec3V u, const FloatV a) +{ + // q = cos(a/2) + u*sin(a/2) + const FloatV half = FLoad(0.5f); + const FloatV hangle = FMul(a, half); + const FloatV piByTwo(FLoad(PX_PIDIV2)); + const FloatV PiByTwoMinHangle(FSub(piByTwo, hangle)); + const Vec4V hangle2(Vec4V_From_Vec3V(V3Merge(hangle, PiByTwoMinHangle, hangle))); + + /*const FloatV sina = FSin(hangle); + const FloatV cosa = FCos(hangle);*/ + + const Vec4V _sina = V4Sin(hangle2); + const FloatV sina = V4GetX(_sina); + const FloatV cosa = V4GetY(_sina); + + const Vec3V v = V3Scale(u, sina); + // return V4Sel(BTTTF(), Vec4V_From_Vec3V(v), V4Splat(cosa)); + return V4SetW(Vec4V_From_Vec3V(v), cosa); +} + +// Normalize +PX_FORCE_INLINE QuatV QuatNormalize(const QuatV q) +{ + return V4Normalize(q); +} + +PX_FORCE_INLINE FloatV QuatLength(const QuatV q) +{ + return V4Length(q); +} + +PX_FORCE_INLINE FloatV QuatLengthSq(const QuatV q) +{ + return V4LengthSq(q); +} + +PX_FORCE_INLINE FloatV QuatDot(const QuatV a, const QuatV b) // convert this PxQuat to a unit quaternion +{ + return V4Dot(a, b); +} + +PX_FORCE_INLINE QuatV QuatConjugate(const QuatV q) +{ + return V4SetW(V4Neg(q), V4GetW(q)); +} + +PX_FORCE_INLINE Vec3V QuatGetImaginaryPart(const QuatV q) +{ + return Vec3V_From_Vec4V(q); +} + +/** brief computes rotation of x-axis */ +PX_FORCE_INLINE Vec3V QuatGetBasisVector0(const QuatV q) +{ + /*const PxF32 x2 = x*2.0f; + const PxF32 w2 = w*2.0f; + return PxVec3( (w * w2) - 1.0f + x*x2, + (z * w2) + y*x2, + (-y * w2) + z*x2);*/ + + const FloatV two = FLoad(2.0f); + const FloatV w = V4GetW(q); + const Vec3V u = Vec3V_From_Vec4V(q); + + const FloatV x2 = FMul(V3GetX(u), two); + const FloatV w2 = FMul(w, two); + + const Vec3V a = V3Scale(u, x2); + const Vec3V tmp = V3Merge(w, V3GetZ(u), FNeg(V3GetY(u))); + // const Vec3V b = V3Scale(tmp, w2); + // const Vec3V ab = V3Add(a, b); + const Vec3V ab = V3ScaleAdd(tmp, w2, a); + return V3SetX(ab, FSub(V3GetX(ab), FOne())); +} + +/** brief computes rotation of y-axis */ +PX_FORCE_INLINE Vec3V QuatGetBasisVector1(const QuatV q) +{ + /*const PxF32 y2 = y*2.0f; + const PxF32 w2 = w*2.0f; + return PxVec3( (-z * w2) + x*y2, + (w * w2) - 1.0f + y*y2, + (x * w2) + z*y2);*/ + + const FloatV two = FLoad(2.0f); + const FloatV w = V4GetW(q); + const Vec3V u = Vec3V_From_Vec4V(q); + + const FloatV y2 = FMul(V3GetY(u), two); + const FloatV w2 = FMul(w, two); + + const Vec3V a = V3Scale(u, y2); + const Vec3V tmp = V3Merge(FNeg(V3GetZ(u)), w, V3GetX(u)); + // const Vec3V b = V3Scale(tmp, w2); + // const Vec3V ab = V3Add(a, b); + const Vec3V ab = V3ScaleAdd(tmp, w2, a); + return V3SetY(ab, FSub(V3GetY(ab), FOne())); +} + +/** brief computes rotation of z-axis */ +PX_FORCE_INLINE Vec3V QuatGetBasisVector2(const QuatV q) +{ + /*const PxF32 z2 = z*2.0f; + const PxF32 w2 = w*2.0f; + return PxVec3( (y * w2) + x*z2, + (-x * w2) + y*z2, + (w * w2) - 1.0f + z*z2);*/ + + const FloatV two = FLoad(2.0f); + const FloatV w = V4GetW(q); + const Vec3V u = Vec3V_From_Vec4V(q); + + const FloatV z2 = FMul(V3GetZ(u), two); + const FloatV w2 = FMul(w, two); + + const Vec3V a = V3Scale(u, z2); + const Vec3V tmp = V3Merge(V3GetY(u), FNeg(V3GetX(u)), w); + /*const Vec3V b = V3Scale(tmp, w2); + const Vec3V ab = V3Add(a, b);*/ + const Vec3V ab = V3ScaleAdd(tmp, w2, a); + return V3SetZ(ab, FSub(V3GetZ(ab), FOne())); +} + +PX_FORCE_INLINE Vec3V QuatRotate(const QuatV q, const Vec3V v) +{ + /* + const PxVec3 qv(x,y,z); + return (v*(w*w-0.5f) + (qv.cross(v))*w + qv*(qv.dot(v)))*2; + */ + + const FloatV two = FLoad(2.0f); + // const FloatV half = FloatV_From_F32(0.5f); + const FloatV nhalf = FLoad(-0.5f); + const Vec3V u = Vec3V_From_Vec4V(q); + const FloatV w = V4GetW(q); + // const FloatV w2 = FSub(FMul(w, w), half); + const FloatV w2 = FScaleAdd(w, w, nhalf); + const Vec3V a = V3Scale(v, w2); + // const Vec3V b = V3Scale(V3Cross(u, v), w); + // const Vec3V c = V3Scale(u, V3Dot(u, v)); + // return V3Scale(V3Add(V3Add(a, b), c), two); + const Vec3V temp = V3ScaleAdd(V3Cross(u, v), w, a); + return V3Scale(V3ScaleAdd(u, V3Dot(u, v), temp), two); +} + +// PT: same as QuatRotate but operates on a Vec4V +PX_FORCE_INLINE Vec4V QuatRotate4V(const QuatV q, const Vec4V v) +{ + const FloatV two = FLoad(2.0f); + const FloatV nhalf = FLoad(-0.5f); + const Vec4V u = q; // PT: W not cleared here + const FloatV w = V4GetW(q); + const FloatV w2 = FScaleAdd(w, w, nhalf); + const Vec4V a = V4Scale(v, w2); // PT: W has non-zero data here + const Vec4V temp = V4ScaleAdd(V4Cross(u, v), w, a); + return V4Scale(V4ScaleAdd(u, V4Dot3(u, v), temp), two); // PT: beware, V4Dot3 has one more instruction here +} + +// PT: avoid some multiplies when immediately normalizing a rotated vector +PX_FORCE_INLINE Vec3V QuatRotateAndNormalize(const QuatV q, const Vec3V v) +{ + const FloatV nhalf = FLoad(-0.5f); + const Vec3V u = Vec3V_From_Vec4V(q); + const FloatV w = V4GetW(q); + const FloatV w2 = FScaleAdd(w, w, nhalf); + const Vec3V a = V3Scale(v, w2); + const Vec3V temp = V3ScaleAdd(V3Cross(u, v), w, a); + return V3Normalize(V3ScaleAdd(u, V3Dot(u, v), temp)); +} + +PX_FORCE_INLINE Vec3V QuatTransform(const QuatV q, const Vec3V p, const Vec3V v) +{ + // p + q.rotate(v) + const FloatV two = FLoad(2.0f); + // const FloatV half = FloatV_From_F32(0.5f); + const FloatV nhalf = FLoad(-0.5f); + const Vec3V u = Vec3V_From_Vec4V(q); + const FloatV w = V4GetW(q); + // const FloatV w2 = FSub(FMul(w, w), half); + const FloatV w2 = FScaleAdd(w, w, nhalf); + const Vec3V a = V3Scale(v, w2); + /*const Vec3V b = V3Scale(V3Cross(u, v), w); + const Vec3V c = V3Scale(u, V3Dot(u, v)); + return V3ScaleAdd(V3Add(V3Add(a, b), c), two, p);*/ + const Vec3V temp = V3ScaleAdd(V3Cross(u, v), w, a); + const Vec3V z = V3ScaleAdd(u, V3Dot(u, v), temp); + return V3ScaleAdd(z, two, p); +} + +PX_FORCE_INLINE Vec3V QuatRotateInv(const QuatV q, const Vec3V v) +{ + // const PxVec3 qv(x,y,z); + // return (v*(w*w-0.5f) - (qv.cross(v))*w + qv*(qv.dot(v)))*2; + + const FloatV two = FLoad(2.0f); + const FloatV nhalf = FLoad(-0.5f); + const Vec3V u = Vec3V_From_Vec4V(q); + const FloatV w = V4GetW(q); + const FloatV w2 = FScaleAdd(w, w, nhalf); + const Vec3V a = V3Scale(v, w2); + /*const Vec3V b = V3Scale(V3Cross(u, v), w); + const Vec3V c = V3Scale(u, V3Dot(u, v)); + return V3Scale(V3Add(V3Sub(a, b), c), two);*/ + const Vec3V temp = V3NegScaleSub(V3Cross(u, v), w, a); + return V3Scale(V3ScaleAdd(u, V3Dot(u, v), temp), two); +} + +PX_FORCE_INLINE QuatV QuatMul(const QuatV a, const QuatV b) +{ + const Vec4V imagA = a; + const Vec4V imagB = b; + const FloatV rA = V4GetW(a); + const FloatV rB = V4GetW(b); + + const FloatV real = FSub(FMul(rA, rB), V4Dot3(imagA, imagB)); + const Vec4V v0 = V4Scale(imagA, rB); + const Vec4V v1 = V4Scale(imagB, rA); + const Vec4V v2 = V4Cross(imagA, imagB); + const Vec4V imag = V4Add(V4Add(v0, v1), v2); + + return V4SetW(imag, real); +} + +PX_FORCE_INLINE QuatV QuatAdd(const QuatV a, const QuatV b) +{ + return V4Add(a, b); +} + +PX_FORCE_INLINE QuatV QuatNeg(const QuatV q) +{ + return V4Neg(q); +} + +PX_FORCE_INLINE QuatV QuatSub(const QuatV a, const QuatV b) +{ + return V4Sub(a, b); +} + +PX_FORCE_INLINE QuatV QuatScale(const QuatV a, const FloatV b) +{ + return V4Scale(a, b); +} + +PX_FORCE_INLINE QuatV QuatMerge(const FloatV* const floatVArray) +{ + return V4Merge(floatVArray); +} + +PX_FORCE_INLINE QuatV QuatMerge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w) +{ + return V4Merge(x, y, z, w); +} + +PX_FORCE_INLINE QuatV QuatIdentity() +{ + return V4SetW(V4Zero(), FOne()); +} + +PX_FORCE_INLINE bool isFiniteQuatV(const QuatV q) +{ + return isFiniteVec4V(q); +} + +#if (PX_LINUX || PX_SWITCH) && PX_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical" // bitwise intentionally chosen for performance +#endif + +PX_FORCE_INLINE bool isValidQuatV(const QuatV q) +{ + const FloatV unitTolerance = FLoad(1e-4f); + const FloatV tmp = FAbs(FSub(QuatLength(q), FOne())); + const BoolV con = FIsGrtr(unitTolerance, tmp); + return isFiniteVec4V(q) & (BAllEqTTTT(con) == 1); +} + +PX_FORCE_INLINE bool isSaneQuatV(const QuatV q) +{ + const FloatV unitTolerance = FLoad(1e-2f); + const FloatV tmp = FAbs(FSub(QuatLength(q), FOne())); + const BoolV con = FIsGrtr(unitTolerance, tmp); + return isFiniteVec4V(q) & (BAllEqTTTT(con) == 1); +} + +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic pop +#endif + +PX_FORCE_INLINE Mat33V QuatGetMat33V(const QuatVArg q) +{ + // const FloatV two = FloatV_From_F32(2.0f); + // const FloatV one = FOne(); + + // const FloatV x = V4GetX(q); + // const FloatV y = V4GetY(q); + // const FloatV z = V4GetZ(q); + // const Vec4V _q = V4Mul(q, two); + // + ////const FloatV w = V4GetW(q); + + // const Vec4V t0 = V4Mul(_q, x); // 2xx, 2xy, 2xz, 2xw + // const Vec4V t1 = V4Mul(_q, y); // 2xy, 2yy, 2yz, 2yw + // const Vec4V t2 = V4Mul(_q, z); // 2xz, 2yz, 2zz, 2zw + ////const Vec4V t3 = V4Mul(_q, w); // 2xw, 2yw, 2zw, 2ww + + // const FloatV xx2 = V4GetX(t0); + // const FloatV xy2 = V4GetY(t0); + // const FloatV xz2 = V4GetZ(t0); + // const FloatV xw2 = V4GetW(t0); + + // const FloatV yy2 = V4GetY(t1); + // const FloatV yz2 = V4GetZ(t1); + // const FloatV yw2 = V4GetW(t1); + + // const FloatV zz2 = V4GetZ(t2); + // const FloatV zw2 = V4GetW(t2); + + ////const FloatV ww2 = V4GetW(t3); + + // const FloatV c00 = FSub(one, FAdd(yy2, zz2)); + // const FloatV c01 = FSub(xy2, zw2); + // const FloatV c02 = FAdd(xz2, yw2); + + // const FloatV c10 = FAdd(xy2, zw2); + // const FloatV c11 = FSub(one, FAdd(xx2, zz2)); + // const FloatV c12 = FSub(yz2, xw2); + + // const FloatV c20 = FSub(xz2, yw2); + // const FloatV c21 = FAdd(yz2, xw2); + // const FloatV c22 = FSub(one, FAdd(xx2, yy2)); + + // const Vec3V c0 = V3Merge(c00, c10, c20); + // const Vec3V c1 = V3Merge(c01, c11, c21); + // const Vec3V c2 = V3Merge(c02, c12, c22); + + // return Mat33V(c0, c1, c2); + + const FloatV one = FOne(); + const FloatV x = V4GetX(q); + const FloatV y = V4GetY(q); + const FloatV z = V4GetZ(q); + const FloatV w = V4GetW(q); + + const FloatV x2 = FAdd(x, x); + const FloatV y2 = FAdd(y, y); + const FloatV z2 = FAdd(z, z); + + const FloatV xx = FMul(x2, x); + const FloatV yy = FMul(y2, y); + const FloatV zz = FMul(z2, z); + + const FloatV xy = FMul(x2, y); + const FloatV xz = FMul(x2, z); + const FloatV xw = FMul(x2, w); + + const FloatV yz = FMul(y2, z); + const FloatV yw = FMul(y2, w); + const FloatV zw = FMul(z2, w); + + const FloatV v = FSub(one, xx); + + const Vec3V column0 = V3Merge(FSub(FSub(one, yy), zz), FAdd(xy, zw), FSub(xz, yw)); + const Vec3V column1 = V3Merge(FSub(xy, zw), FSub(v, zz), FAdd(yz, xw)); + const Vec3V column2 = V3Merge(FAdd(xz, yw), FSub(yz, xw), FSub(v, yy)); + return Mat33V(column0, column1, column2); +} + +PX_FORCE_INLINE QuatV Mat33GetQuatV(const Mat33V& a) +{ + const FloatV one = FOne(); + const FloatV zero = FZero(); + const FloatV half = FLoad(0.5f); + const FloatV two = FLoad(2.0f); + const FloatV scale = FLoad(0.25f); + const FloatV a00 = V3GetX(a.col0); + const FloatV a11 = V3GetY(a.col1); + const FloatV a22 = V3GetZ(a.col2); + + const FloatV a21 = V3GetZ(a.col1); // row=2, col=1; + const FloatV a12 = V3GetY(a.col2); // row=1, col=2; + const FloatV a02 = V3GetX(a.col2); // row=0, col=2; + const FloatV a20 = V3GetZ(a.col0); // row=2, col=0; + const FloatV a10 = V3GetY(a.col0); // row=1, col=0; + const FloatV a01 = V3GetX(a.col1); // row=0, col=1; + + const Vec3V vec0 = V3Merge(a21, a02, a10); + const Vec3V vec1 = V3Merge(a12, a20, a01); + const Vec3V v = V3Sub(vec0, vec1); + const Vec3V g = V3Add(vec0, vec1); + + const FloatV trace = FAdd(a00, FAdd(a11, a22)); + + if(FAllGrtrOrEq(trace, zero)) + { + const FloatV h = FSqrt(FAdd(trace, one)); + const FloatV w = FMul(half, h); + const FloatV s = FMul(half, FRecip(h)); + const Vec3V u = V3Scale(v, s); + return V4SetW(Vec4V_From_Vec3V(u), w); + } + else + { + const FloatV ntrace = FNeg(trace); + const Vec3V d = V3Merge(a00, a11, a22); + const BoolV con0 = BAllTrue3(V3IsGrtrOrEq(V3Splat(a00), d)); + const BoolV con1 = BAllTrue3(V3IsGrtrOrEq(V3Splat(a11), d)); + + const FloatV t0 = FAdd(one, FScaleAdd(a00, two, ntrace)); + const FloatV t1 = FAdd(one, FScaleAdd(a11, two, ntrace)); + const FloatV t2 = FAdd(one, FScaleAdd(a22, two, ntrace)); + + const FloatV t = FSel(con0, t0, FSel(con1, t1, t2)); + + const FloatV h = FMul(two, FSqrt(t)); + const FloatV s = FRecip(h); + const FloatV g0 = FMul(scale, h); + const Vec3V vs = V3Scale(v, s); + const Vec3V gs = V3Scale(g, s); + const FloatV gsx = V3GetX(gs); + const FloatV gsy = V3GetY(gs); + const FloatV gsz = V3GetZ(gs); + // vs.x= (a21 - a12)*s; vs.y=(a02 - a20)*s; vs.z=(a10 - a01)*s; + // gs.x= (a21 + a12)*s; gs.y=(a02 + a20)*s; gs.z=(a10 + a01)*s; + const Vec4V v0 = V4Merge(g0, gsz, gsy, V3GetX(vs)); + const Vec4V v1 = V4Merge(gsz, g0, gsx, V3GetY(vs)); + const Vec4V v2 = V4Merge(gsy, gsx, g0, V3GetZ(vs)); + return V4Sel(con0, v0, V4Sel(con1, v1, v2)); + } +} + +} // namespace aos +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/foundation/PxVecTransform.h b/engine/third_party/physx/include/foundation/PxVecTransform.h new file mode 100644 index 00000000..ea476b17 --- /dev/null +++ b/engine/third_party/physx/include/foundation/PxVecTransform.h @@ -0,0 +1,290 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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_VEC_TRANSFORM_H +#define PX_VEC_TRANSFORM_H + +#include "foundation/PxVecMath.h" +#include "foundation/PxTransform.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +namespace aos +{ + +class PxTransformV +{ + public: + QuatV q; + Vec3V p; + + PX_FORCE_INLINE PxTransformV(const PxTransform& transform) + { + // PT: this is now similar to loadTransformU below. + q = QuatVLoadU(&transform.q.x); + p = V3LoadU(&transform.p.x); + } + + PX_FORCE_INLINE PxTransformV(const Vec3VArg p0 = V3Zero(), const QuatVArg q0 = QuatIdentity()) : q(q0), p(p0) + { + PX_ASSERT(isSaneQuatV(q0)); + } + + PX_FORCE_INLINE PxTransformV operator*(const PxTransformV& x) const + { + PX_ASSERT(x.isSane()); + return transform(x); + } + + PX_FORCE_INLINE PxTransformV getInverse() const + { + PX_ASSERT(isFinite()); + // return PxTransform(q.rotateInv(-p),q.getConjugate()); + return PxTransformV(QuatRotateInv(q, V3Neg(p)), QuatConjugate(q)); + } + + PX_FORCE_INLINE void invalidate() + { + p = V3Splat(FMax()); + q = QuatIdentity(); + } + + PX_FORCE_INLINE Vec3V transform(const Vec3VArg input) const + { + PX_ASSERT(isFinite()); + // return q.rotate(input) + p; + return QuatTransform(q, p, input); + } + + PX_FORCE_INLINE Vec3V transformInv(const Vec3VArg input) const + { + PX_ASSERT(isFinite()); + // return q.rotateInv(input-p); + return QuatRotateInv(q, V3Sub(input, p)); + } + + PX_FORCE_INLINE Vec3V rotate(const Vec3VArg input) const + { + PX_ASSERT(isFinite()); + // return q.rotate(input); + return QuatRotate(q, input); + } + + // PT: avoid some multiplies when immediately normalizing a rotated vector + PX_FORCE_INLINE Vec3V rotateAndNormalize(const Vec3VArg input) const + { + PX_ASSERT(isFinite()); + return QuatRotateAndNormalize(q, input); + } + + PX_FORCE_INLINE Vec3V rotateInv(const Vec3VArg input) const + { + PX_ASSERT(isFinite()); + // return q.rotateInv(input); + return QuatRotateInv(q, input); + } + + //! Transform transform to parent (returns compound transform: first src, then *this) + PX_FORCE_INLINE PxTransformV transform(const PxTransformV& src) const + { + PX_ASSERT(src.isSane()); + PX_ASSERT(isSane()); + // src = [srct, srcr] -> [r*srct + t, r*srcr] + // return PxTransform(q.rotate(src.p) + p, q*src.q); + return PxTransformV(V3Add(QuatRotate(q, src.p), p), QuatMul(q, src.q)); + } + +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical" // bitwise intentionally chosen for performance +#endif + + /** + \brief returns true if finite and q is a unit quaternion + */ + PX_FORCE_INLINE bool isValid() const + { + // return p.isFinite() && q.isFinite() && q.isValid(); + return isFiniteVec3V(p) & isFiniteQuatV(q) & isValidQuatV(q); + } + + /** + \brief returns true if finite and quat magnitude is reasonably close to unit to allow for some accumulation of error + vs isValid + */ + + PX_FORCE_INLINE bool isSane() const + { + // return isFinite() && q.isSane(); + return isFinite() & isSaneQuatV(q); + } + + /** + \brief returns true if all elems are finite (not NAN or INF, etc.) + */ + PX_FORCE_INLINE bool isFinite() const + { + // return p.isFinite() && q.isFinite(); + return isFiniteVec3V(p) & isFiniteQuatV(q); + } + +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic pop +#endif + + //! Transform transform from parent (returns compound transform: first src, then this->inverse) + PX_FORCE_INLINE PxTransformV transformInv(const PxTransformV& src) const + { + PX_ASSERT(src.isSane()); + PX_ASSERT(isFinite()); + // src = [srct, srcr] -> [r^-1*(srct-t), r^-1*srcr] + /*PxQuat qinv = q.getConjugate(); + return PxTransform(qinv.rotate(src.p - p), qinv*src.q);*/ + const QuatV qinv = QuatConjugate(q); + const Vec3V v = QuatRotate(qinv, V3Sub(src.p, p)); + const QuatV rot = QuatMul(qinv, src.q); + return PxTransformV(v, rot); + } + + static PX_FORCE_INLINE PxTransformV createIdentity() + { + return PxTransformV(V3Zero()); + } +}; + +PX_FORCE_INLINE PxTransformV loadTransformA(const PxTransform& transform) +{ + const QuatV q0 = QuatVLoadA(&transform.q.x); + const Vec3V p0 = V3LoadA(&transform.p.x); + + return PxTransformV(p0, q0); +} + +PX_FORCE_INLINE PxTransformV loadTransformU(const PxTransform& transform) +{ + const QuatV q0 = QuatVLoadU(&transform.q.x); + const Vec3V p0 = V3LoadU(&transform.p.x); + + return PxTransformV(p0, q0); +} + +class PxMatTransformV +{ + public: + Mat33V rot; + Vec3V p; + + PX_FORCE_INLINE PxMatTransformV() + { + p = V3Zero(); + rot = M33Identity(); + } + PX_FORCE_INLINE PxMatTransformV(const Vec3VArg _p, const Mat33V& _rot) + { + p = _p; + rot = _rot; + } + + PX_FORCE_INLINE PxMatTransformV(const PxTransformV& other) + { + p = other.p; + QuatGetMat33V(other.q, rot.col0, rot.col1, rot.col2); + } + + PX_FORCE_INLINE PxMatTransformV(const Vec3VArg _p, const QuatV& quat) + { + p = _p; + QuatGetMat33V(quat, rot.col0, rot.col1, rot.col2); + } + + PX_FORCE_INLINE Vec3V getCol0() const + { + return rot.col0; + } + + PX_FORCE_INLINE Vec3V getCol1() const + { + return rot.col1; + } + + PX_FORCE_INLINE Vec3V getCol2() const + { + return rot.col2; + } + + PX_FORCE_INLINE void setCol0(const Vec3VArg col0) + { + rot.col0 = col0; + } + + PX_FORCE_INLINE void setCol1(const Vec3VArg col1) + { + rot.col1 = col1; + } + + PX_FORCE_INLINE void setCol2(const Vec3VArg col2) + { + rot.col2 = col2; + } + + PX_FORCE_INLINE Vec3V transform(const Vec3VArg input) const + { + return V3Add(p, M33MulV3(rot, input)); + } + + PX_FORCE_INLINE Vec3V transformInv(const Vec3VArg input) const + { + return M33TrnspsMulV3(rot, V3Sub(input, p)); // QuatRotateInv(q, V3Sub(input, p)); + } + + PX_FORCE_INLINE Vec3V rotate(const Vec3VArg input) const + { + return M33MulV3(rot, input); + } + + PX_FORCE_INLINE Vec3V rotateInv(const Vec3VArg input) const + { + return M33TrnspsMulV3(rot, input); + } + + PX_FORCE_INLINE PxMatTransformV transformInv(const PxMatTransformV& src) const + { + + const Vec3V v = M33TrnspsMulV3(rot, V3Sub(src.p, p)); + const Mat33V mat = M33MulM33(M33Trnsps(rot), src.rot); + return PxMatTransformV(v, mat); + } +}; +} +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/foundation/unix/PxUnixAoS.h b/engine/third_party/physx/include/foundation/unix/PxUnixAoS.h new file mode 100644 index 00000000..7543dba1 --- /dev/null +++ b/engine/third_party/physx/include/foundation/unix/PxUnixAoS.h @@ -0,0 +1,46 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PXFOUNDATION_PXUNIXAOS_H +#define PXFOUNDATION_PXUNIXAOS_H + +// no includes here! this file should be included from PxcVecMath.h only!!! + +#if !COMPILE_VECTOR_INTRINSICS +#error Vector intrinsics should not be included when using scalar implementation. +#endif + +#if PX_INTEL_FAMILY +#include "foundation/unix/sse2/PxUnixSse2AoS.h" +#elif PX_NEON +#include "foundation/unix/neon/PxUnixNeonAoS.h" +#else +#error No SIMD implementation for this unix platform. +#endif + +#endif // PXFOUNDATION_PXUNIXAOS_H diff --git a/engine/third_party/physx/include/foundation/unix/PxUnixFPU.h b/engine/third_party/physx/include/foundation/unix/PxUnixFPU.h new file mode 100644 index 00000000..b6ecaad2 --- /dev/null +++ b/engine/third_party/physx/include/foundation/unix/PxUnixFPU.h @@ -0,0 +1,83 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PXFOUNDATION_PXUNIXFPU_H +#define PXFOUNDATION_PXUNIXFPU_H + +#include "foundation/PxPreprocessor.h" + +#if PX_LINUX || PX_OSX + +#if PX_X86 || PX_X64 +#if PX_EMSCRIPTEN +#include +#endif +#include +#elif PX_NEON +#include +#endif + +PX_INLINE physx::PxSIMDGuard::PxSIMDGuard(bool enable) +#if !PX_EMSCRIPTEN && (PX_X86 || PX_X64) + : mEnabled(enable) +#endif +{ +#if !PX_EMSCRIPTEN && (PX_X86 || PX_X64) + if(enable) + { + mControlWord = _mm_getcsr(); + // set default (disable exceptions: _MM_MASK_MASK) and FTZ (_MM_FLUSH_ZERO_ON), DAZ (_MM_DENORMALS_ZERO_ON: (1<<6)) + _mm_setcsr(_MM_MASK_MASK | _MM_FLUSH_ZERO_ON | (1 << 6)); + } + else + { + PX_UNUSED(enable); + PX_ASSERT(_mm_getcsr() & _MM_FLUSH_ZERO_ON); + PX_ASSERT(_mm_getcsr() & (1 << 6)); + PX_ASSERT(_mm_getcsr() & _MM_MASK_MASK); + } +#endif +} + +PX_INLINE physx::PxSIMDGuard::~PxSIMDGuard() +{ +#if !PX_EMSCRIPTEN && (PX_X86 || PX_X64) + if(mEnabled) + { + // restore control word and clear exception flags + // (setting exception state flags cause exceptions on the first following fp operation) + _mm_setcsr(mControlWord & PxU32(~_MM_EXCEPT_MASK)); + } +#endif +} + +#else + #error No SIMD implementation for this unix platform. +#endif // PX_LINUX || PX_OSX + +#endif // #ifndef PXFOUNDATION_PXUNIXFPU_H diff --git a/engine/third_party/physx/include/foundation/unix/PxUnixInlineAoS.h b/engine/third_party/physx/include/foundation/unix/PxUnixInlineAoS.h new file mode 100644 index 00000000..83f75084 --- /dev/null +++ b/engine/third_party/physx/include/foundation/unix/PxUnixInlineAoS.h @@ -0,0 +1,44 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PXFOUNDATION_PXUNIXINLINEAOS_H +#define PXFOUNDATION_PXUNIXINLINEAOS_H + +#if !COMPILE_VECTOR_INTRINSICS +#error Vector intrinsics should not be included when using scalar implementation. +#endif + +#if PX_INTEL_FAMILY +#include "foundation/unix/sse2/PxUnixSse2InlineAoS.h" +#elif PX_NEON +#include "foundation/unix/neon/PxUnixNeonInlineAoS.h" +#else +#error No SIMD implementation for this unix platform. +#endif + +#endif // PXFOUNDATION_PXUNIXINLINEAOS_H diff --git a/engine/third_party/physx/include/foundation/unix/PxUnixIntrinsics.h b/engine/third_party/physx/include/foundation/unix/PxUnixIntrinsics.h new file mode 100644 index 00000000..36bb371b --- /dev/null +++ b/engine/third_party/physx/include/foundation/unix/PxUnixIntrinsics.h @@ -0,0 +1,127 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PSFOUNDATION_PSUNIXINTRINSICS_H +#define PSFOUNDATION_PSUNIXINTRINSICS_H + +#include "foundation/PxAssert.h" +#include + +// this file is for internal intrinsics - that is, intrinsics that are used in +// cross platform code but do not appear in the API + +#if !(PX_LINUX || PX_APPLE_FAMILY) +#error "This file should only be included by unix builds!!" +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +PX_FORCE_INLINE void PxMemoryBarrier() +{ + __sync_synchronize(); +} + +/*! +Return the index of the highest set bit. Undefined for zero arg. +*/ +PX_INLINE uint32_t PxHighestSetBitUnsafe(uint64_t v) +{ + return uint32_t(63 - __builtin_clzl(v)); +} + +/*! +Return the index of the highest set bit. Undefined for zero arg. +*/ +PX_INLINE uint32_t PxHighestSetBitUnsafe(uint32_t v) +{ + return uint32_t(31 - __builtin_clz(v)); +} + +/*! +Return the index of the lowest set bit. Undefined for zero arg. +*/ +PX_INLINE uint32_t PxLowestSetBitUnsafe(uint64_t v) +{ + return uint32_t(__builtin_ctzl(v)); +} + +/*! +Return the index of the lowest set bit. Undefined for zero arg. +*/ +PX_INLINE uint32_t PxLowestSetBitUnsafe(uint32_t v) +{ + return uint32_t(__builtin_ctz(v)); +} + +/*! +Returns the index of the highest set bit. Returns 32 for v=0. +*/ +PX_INLINE uint32_t PxCountLeadingZeros(uint32_t v) +{ + if(v) + return uint32_t(__builtin_clz(v)); + else + return 32u; +} + +/*! +Prefetch aligned 64B x86, 32b ARM around \c ptr+offset. +*/ +PX_FORCE_INLINE void PxPrefetchLine(const void* ptr, uint32_t offset = 0) +{ +#if PX_CUDA_COMPILER + __builtin_prefetch(reinterpret_cast(ptr) + offset, 0, 3); +#else + __builtin_prefetch(reinterpret_cast(ptr) + offset, 0, 3); +#endif +} + +/*! +Prefetch \c count bytes starting at \c ptr. +*/ +PX_FORCE_INLINE void PxPrefetch(const void* ptr, uint32_t count = 1) +{ + const char* cp = reinterpret_cast(ptr); + uint64_t p = size_t(ptr); + uint64_t startLine = p >> 6, endLine = (p + count - 1) >> 6; + uint64_t lines = endLine - startLine + 1; + do + { + PxPrefetchLine(cp); + cp += 64; + } while(--lines); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif // #ifndef PSFOUNDATION_PSUNIXINTRINSICS_H diff --git a/engine/third_party/physx/include/foundation/unix/PxUnixMathIntrinsics.h b/engine/third_party/physx/include/foundation/unix/PxUnixMathIntrinsics.h new file mode 100644 index 00000000..7eff6e6f --- /dev/null +++ b/engine/third_party/physx/include/foundation/unix/PxUnixMathIntrinsics.h @@ -0,0 +1,179 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PXFOUNDATION_PXUNIXINTRINSICS_H +#define PXFOUNDATION_PXUNIXINTRINSICS_H + +#include "foundation/PxAssert.h" + +#if !(PX_LINUX || PX_APPLE_FAMILY) +#error "This file should only be included by Unix builds!!" +#endif + +#if PX_LINUX && !PX_CUDA_COMPILER && !PX_EMSCRIPTEN + // Linux and CUDA compilation does not work with std::isfnite, as it is not marked as CUDA callable + #include + #ifndef isfinite + using std::isfinite; + #endif +#endif + +#include +#include + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +namespace intrinsics +{ +//! \brief platform-specific absolute value +PX_CUDA_CALLABLE PX_FORCE_INLINE float abs(float a) +{ + return ::fabsf(a); +} + +//! \brief platform-specific select float +PX_CUDA_CALLABLE PX_FORCE_INLINE float fsel(float a, float b, float c) +{ + return (a >= 0.0f) ? b : c; +} + +//! \brief platform-specific sign +PX_CUDA_CALLABLE PX_FORCE_INLINE float sign(float a) +{ + return (a >= 0.0f) ? 1.0f : -1.0f; +} + +//! \brief platform-specific reciprocal +PX_CUDA_CALLABLE PX_FORCE_INLINE float recip(float a) +{ + return 1.0f / a; +} + +//! \brief platform-specific reciprocal estimate +PX_CUDA_CALLABLE PX_FORCE_INLINE float recipFast(float a) +{ + return 1.0f / a; +} + +//! \brief platform-specific square root +PX_CUDA_CALLABLE PX_FORCE_INLINE float sqrt(float a) +{ + return ::sqrtf(a); +} + +//! \brief platform-specific reciprocal square root +PX_CUDA_CALLABLE PX_FORCE_INLINE float recipSqrt(float a) +{ + return 1.0f / ::sqrtf(a); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float recipSqrtFast(float a) +{ + return 1.0f / ::sqrtf(a); +} + +//! \brief platform-specific sine +PX_CUDA_CALLABLE PX_FORCE_INLINE float sin(float a) +{ + return ::sinf(a); +} + +//! \brief platform-specific cosine +PX_CUDA_CALLABLE PX_FORCE_INLINE float cos(float a) +{ + return ::cosf(a); +} + +//! \brief platform-specific minimum +PX_CUDA_CALLABLE PX_FORCE_INLINE float selectMin(float a, float b) +{ + return a < b ? a : b; +} + +//! \brief platform-specific maximum +PX_CUDA_CALLABLE PX_FORCE_INLINE float selectMax(float a, float b) +{ + return a > b ? a : b; +} + +//! \brief platform-specific finiteness check (not INF or NAN) +PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite(float a) +{ + //std::isfinite not recommended as of Feb 2017, since it doesn't work with g++/clang's floating point optimization. + union localU { PxU32 i; float f; } floatUnion; + floatUnion.f = a; + return !((floatUnion.i & 0x7fffffff) >= 0x7f800000); +} + +//! \brief platform-specific finiteness check (not INF or NAN) +PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite(double a) +{ + return !!isfinite(a); +} + +/*! +Sets \c count bytes starting at \c dst to zero. +*/ +PX_FORCE_INLINE void* memZero(void* dest, size_t count) +{ + return memset(dest, 0, count); +} + +/*! +Sets \c count bytes starting at \c dst to \c c. +*/ +PX_FORCE_INLINE void* memSet(void* dest, int32_t c, size_t count) +{ + return memset(dest, c, count); +} + +/*! +Copies \c count bytes from \c src to \c dst. User memMove if regions overlap. +*/ +PX_FORCE_INLINE void* memCopy(void* dest, const void* src, size_t count) +{ + return memcpy(dest, src, count); +} + +/*! +Copies \c count bytes from \c src to \c dst. Supports overlapping regions. +*/ +PX_FORCE_INLINE void* memMove(void* dest, const void* src, size_t count) +{ + return memmove(dest, src, count); +} + +} // namespace intrinsics +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif // #ifndef PXFOUNDATION_PXUNIXINTRINSICS_H diff --git a/engine/third_party/physx/include/foundation/unix/PxUnixTrigConstants.h b/engine/third_party/physx/include/foundation/unix/PxUnixTrigConstants.h new file mode 100644 index 00000000..fa70ef2f --- /dev/null +++ b/engine/third_party/physx/include/foundation/unix/PxUnixTrigConstants.h @@ -0,0 +1,76 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PXFOUNDATION_PXUNIXTRIGCONSTANTS_H +#define PXFOUNDATION_PXUNIXTRIGCONSTANTS_H + +#include "foundation/PxMath.h" +#include "foundation/PxPreprocessor.h" + +namespace physx +{ +namespace aos +{ + +#if PX_CLANG +#if PX_LINUX +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wmissing-variable-declarations" +#endif +#endif + +#define PX_GLOBALCONST extern const __attribute__((weak)) + +PX_ALIGN_PREFIX(16) +struct PX_VECTORF32 +{ + float f[4]; +} PX_ALIGN_SUFFIX(16); + +PX_GLOBALCONST PX_VECTORF32 g_PXSinCoefficients0 = { { 1.0f, -0.166666667f, 8.333333333e-3f, -1.984126984e-4f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXSinCoefficients1 = { { 2.755731922e-6f, -2.505210839e-8f, 1.605904384e-10f, -7.647163732e-13f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXSinCoefficients2 = { { 2.811457254e-15f, -8.220635247e-18f, 1.957294106e-20f, -3.868170171e-23f } }; +PX_GLOBALCONST PX_VECTORF32 g_PXCosCoefficients0 = { { 1.0f, -0.5f, 4.166666667e-2f, -1.388888889e-3f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXCosCoefficients1 = { { 2.480158730e-5f, -2.755731922e-7f, 2.087675699e-9f, -1.147074560e-11f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXCosCoefficients2 = { { 4.779477332e-14f, -1.561920697e-16f, 4.110317623e-19f, -8.896791392e-22f } }; +PX_GLOBALCONST PX_VECTORF32 g_PXReciprocalTwoPi = { { PxInvTwoPi, PxInvTwoPi, PxInvTwoPi, PxInvTwoPi } }; +PX_GLOBALCONST PX_VECTORF32 g_PXTwoPi = { { PxTwoPi, PxTwoPi, PxTwoPi, PxTwoPi } }; + +#if PX_CLANG +#if PX_LINUX +#pragma clang diagnostic pop +#endif +#endif +} // namespace aos +} // namespace physx + +#endif //PXFOUNDATION_PXUNIXTRIGCONSTANTS_H diff --git a/engine/third_party/physx/include/foundation/unix/neon/PxUnixNeonAoS.h b/engine/third_party/physx/include/foundation/unix/neon/PxUnixNeonAoS.h new file mode 100644 index 00000000..d88b931c --- /dev/null +++ b/engine/third_party/physx/include/foundation/unix/neon/PxUnixNeonAoS.h @@ -0,0 +1,136 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PXFOUNDATION_PXUNIXNEONAOS_H +#define PXFOUNDATION_PXUNIXNEONAOS_H + +// no includes here! this file should be included from PxcVecMath.h only!!! + +#if !COMPILE_VECTOR_INTRINSICS +#error Vector intrinsics should not be included when using scalar implementation. +#endif + +// only ARM NEON compatible platforms should reach this +#include + +namespace physx +{ +namespace aos +{ + +typedef float32x2_t FloatV; +typedef float32x4_t Vec3V; +typedef float32x4_t Vec4V; +typedef uint32x4_t BoolV; +typedef float32x4_t QuatV; + +typedef uint32x4_t VecU32V; +typedef int32x4_t VecI32V; +typedef uint16x8_t VecU16V; +typedef int16x8_t VecI16V; +typedef uint8x16_t VecU8V; + +#define FloatVArg FloatV & +#define Vec3VArg Vec3V & +#define Vec4VArg Vec4V & +#define BoolVArg BoolV & +#define VecU32VArg VecU32V & +#define VecI32VArg VecI32V & +#define VecU16VArg VecU16V & +#define VecI16VArg VecI16V & +#define VecU8VArg VecU8V & +#define QuatVArg QuatV & + +// KS - TODO - make an actual VecCrossV type for NEON +#define VecCrossV Vec3V + +typedef VecI32V VecShiftV; +#define VecShiftVArg VecShiftV & + +PX_ALIGN_PREFIX(16) +struct Mat33V +{ + Mat33V() + { + } + Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec3V PX_ALIGN(16, col0); + Vec3V PX_ALIGN(16, col1); + Vec3V PX_ALIGN(16, col2); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat34V +{ + Mat34V() + { + } + Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec3V PX_ALIGN(16, col0); + Vec3V PX_ALIGN(16, col1); + Vec3V PX_ALIGN(16, col2); + Vec3V PX_ALIGN(16, col3); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat43V +{ + Mat43V() + { + } + Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec4V PX_ALIGN(16, col0); + Vec4V PX_ALIGN(16, col1); + Vec4V PX_ALIGN(16, col2); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat44V +{ + Mat44V() + { + } + Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec4V PX_ALIGN(16, col0); + Vec4V PX_ALIGN(16, col1); + Vec4V PX_ALIGN(16, col2); + Vec4V PX_ALIGN(16, col3); +} PX_ALIGN_SUFFIX(16); + +} // namespace aos +} // namespace physx + +#endif // PXFOUNDATION_PXUNIXNEONAOS_H diff --git a/engine/third_party/physx/include/foundation/unix/neon/PxUnixNeonInlineAoS.h b/engine/third_party/physx/include/foundation/unix/neon/PxUnixNeonInlineAoS.h new file mode 100644 index 00000000..faeca80e --- /dev/null +++ b/engine/third_party/physx/include/foundation/unix/neon/PxUnixNeonInlineAoS.h @@ -0,0 +1,3636 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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 PXFOUNDATION_PXUNIXNEONINLINEAOS_H +#define PXFOUNDATION_PXUNIXNEONINLINEAOS_H + +#if !COMPILE_VECTOR_INTRINSICS +#error Vector intrinsics should not be included when using scalar implementation. +#endif + +namespace physx +{ +namespace aos +{ + +// improved estimates +#define VRECIPEQ recipq_newton<1> +#define VRECIPE recip_newton<1> +#define VRECIPSQRTEQ rsqrtq_newton<1> +#define VRECIPSQRTE rsqrt_newton<1> + +// "exact" +#define VRECIPQ recipq_newton<4> +#if PX_SWITCH +// StabilizationTests.AveragePoint needs more precision to succeed. +#define VRECIP recip_newton<5> +#else +#define VRECIP recip_newton<4> +#endif +#define VRECIPSQRTQ rsqrtq_newton<4> +#define VRECIPSQRT rsqrt_newton<4> + +#define VECMATH_AOS_EPSILON (1e-3f) + +////////////////////////////////////////////////////////////////////// +//Test that Vec3V and FloatV are legal +////////////////////////////////// + +#define FLOAT_COMPONENTS_EQUAL_THRESHOLD 0.01f +PX_FORCE_INLINE bool isValidFloatV(const FloatV a) +{ + /* + PX_ALIGN(16, PxF32) data[4]; + vst1_f32(reinterpret_cast(data), a); + return + PxU32* intData = reinterpret_cast(data); + return intData[0] == intData[1]; + */ + PX_ALIGN(16, PxF32) data[4]; + vst1_f32(reinterpret_cast(data), a); + const float32_t x = data[0]; + const float32_t y = data[1]; + + return (x == y); + + /*if (PxAbs(x - y) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) + { + return true; + } + + if (PxAbs((x - y) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) + { + return true; + } + + return false;*/ +} + +PX_FORCE_INLINE bool isValidVec3V(const Vec3V a) +{ + const float32_t w = vgetq_lane_f32(a, 3); + return (0.0f == w); + //const PxU32* intData = reinterpret_cast(&w); + //return *intData == 0; +} + +PX_FORCE_INLINE bool isAligned16(const void* a) +{ + return(0 == (size_t(a) & 0x0f)); +} + +#if PX_DEBUG +#define ASSERT_ISVALIDVEC3V(a) PX_ASSERT(isValidVec3V(a)) +#define ASSERT_ISVALIDFLOATV(a) PX_ASSERT(isValidFloatV(a)) +#define ASSERT_ISALIGNED16(a) PX_ASSERT(isAligned16(static_cast(a))) +#else +#define ASSERT_ISVALIDVEC3V(a) +#define ASSERT_ISVALIDFLOATV(a) +#define ASSERT_ISALIGNED16(a) +#endif + +namespace internalUnitNeonSimd +{ +PX_FORCE_INLINE PxU32 BAllTrue4_R(const BoolV a) +{ + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + const uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + return PxU32(vget_lane_u32(finalReduce, 0) == 0xffffFFFF); +} + +PX_FORCE_INLINE PxU32 BAllTrue3_R(const BoolV a) +{ + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + const uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + return PxU32((vget_lane_u32(finalReduce, 0) & 0xffFFff) == 0xffFFff); +} + +PX_FORCE_INLINE PxU32 BAnyTrue4_R(const BoolV a) +{ + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + const uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + return PxU32(vget_lane_u32(finalReduce, 0) != 0x0); +} + +PX_FORCE_INLINE PxU32 BAnyTrue3_R(const BoolV a) +{ + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + const uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + return PxU32((vget_lane_u32(finalReduce, 0) & 0xffFFff) != 0); +} +} + +namespace vecMathTests +{ +// PT: this function returns an invalid Vec3V (W!=0.0f) just for unit-testing 'isValidVec3V' +PX_FORCE_INLINE Vec3V getInvalidVec3V() +{ + PX_ALIGN(16, PxF32) data[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE bool allElementsEqualFloatV(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vget_lane_u32(vceq_f32(a, b), 0) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVec3V(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return V3AllEq(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVec4V(const Vec4V a, const Vec4V b) +{ + return V4AllEq(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b) +{ + return internalUnitNeonSimd::BAllTrue4_R(vceqq_u32(a, b)) != 0; +} + +PX_FORCE_INLINE PxU32 V4U32AllEq(const VecU32V a, const VecU32V b) +{ + return internalUnitNeonSimd::BAllTrue4_R(V4IsEqU32(a, b)); +} + +PX_FORCE_INLINE bool allElementsEqualVecU32V(const VecU32V a, const VecU32V b) +{ + return V4U32AllEq(a, b) != 0; +} + +PX_FORCE_INLINE BoolV V4IsEqI32(const VecI32V a, const VecI32V b) +{ + return vceqq_s32(a, b); +} + +PX_FORCE_INLINE PxU32 V4I32AllEq(const VecI32V a, const VecI32V b) +{ + return internalUnitNeonSimd::BAllTrue4_R(V4IsEqI32(a, b)); +} + +PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b) +{ + return V4I32AllEq(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + + const float32x2_t c = vsub_f32(a, b); + const float32x2_t error = vdup_n_f32(VECMATH_AOS_EPSILON); +// absolute compare abs(error) > abs(c) + const uint32x2_t greater = vcagt_f32(error, c); + const uint32x2_t min = vpmin_u32(greater, greater); + return vget_lane_u32(min, 0) != 0x0; +} + +PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + const float32x4_t c = vsubq_f32(a, b); + const float32x4_t error = vdupq_n_f32(VECMATH_AOS_EPSILON); +// absolute compare abs(error) > abs(c) + const uint32x4_t greater = vcagtq_f32(error, c); + return internalUnitNeonSimd::BAllTrue3_R(greater) != 0; +} + +PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b) +{ + const float32x4_t c = vsubq_f32(a, b); + const float32x4_t error = vdupq_n_f32(VECMATH_AOS_EPSILON); +// absolute compare abs(error) > abs(c) + const uint32x4_t greater = vcagtq_f32(error, c); + return internalUnitNeonSimd::BAllTrue4_R(greater) != 0x0; +} +} + +#if 0 // debugging printfs +#include +PX_FORCE_INLINE void printVec(const float32x4_t& v, const char* name) +{ + PX_ALIGN(16, float32_t) data[4]; + vst1q_f32(data, v); + printf("%s: (%f, %f, %f, %f)\n", name, data[0], data[1], data[2], data[3]); +} + +PX_FORCE_INLINE void printVec(const float32x2_t& v, const char* name) +{ + PX_ALIGN(16, float32_t) data[2]; + vst1_f32(data, v); + printf("%s: (%f, %f)\n", name, data[0], data[1]); +} + +PX_FORCE_INLINE void printVec(const uint32x4_t& v, const char* name) +{ + PX_ALIGN(16, uint32_t) data[4]; + vst1q_u32(data, v); + printf("%s: (0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3]); +} + +PX_FORCE_INLINE void printVec(const uint16x8_t& v, const char* name) +{ + PX_ALIGN(16, uint16_t) data[8]; + vst1q_u16(data, v); + printf("%s: (0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3], + data[4], data[5], data[6], data[7]); +} + +PX_FORCE_INLINE void printVec(const int32x4_t& v, const char* name) +{ + PX_ALIGN(16, int32_t) data[4]; + vst1q_s32(data, v); + printf("%s: (0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3]); +} + +PX_FORCE_INLINE void printVec(const int16x8_t& v, const char* name) +{ + PX_ALIGN(16, int16_t) data[8]; + vst1q_s16(data, v); + printf("%s: (0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3], + data[4], data[5], data[6], data[7]); +} + +PX_FORCE_INLINE void printVec(const uint16x4_t& v, const char* name) +{ + PX_ALIGN(16, uint16_t) data[4]; + vst1_u16(data, v); + printf("%s: (0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3]); +} + +PX_FORCE_INLINE void printVec(const uint32x2_t& v, const char* name) +{ + PX_ALIGN(16, uint32_t) data[2]; + vst1_u32(data, v); + printf("%s: (0x%x, 0x%x)\n", name, data[0], data[1]); +} + +PX_FORCE_INLINE void printVar(const PxU32 v, const char* name) +{ + printf("%s: 0x%x\n", name, v); +} + +PX_FORCE_INLINE void printVar(const PxF32 v, const char* name) +{ + printf("%s: %f\n", name, v); +} + +#define PRINT_VAR(X) printVar((X), #X) +#define PRINT_VEC(X) printVec((X), #X) +#define PRINT_VEC_TITLE(TITLE, X) printVec((X), TITLE #X) +#endif // debugging printf + +///////////////////////////////////////////////////////////////////// +////FUNCTIONS USED ONLY FOR ASSERTS IN VECTORISED IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a) +{ + PX_ALIGN(16, PxF32) data[4]; + vst1_f32(reinterpret_cast(data), a); + return PxIsFinite(data[0]) && PxIsFinite(data[1]); +} + +PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a) +{ + PX_ALIGN(16, PxF32) data[4]; + vst1q_f32(reinterpret_cast(data), a); + return PxIsFinite(data[0]) && PxIsFinite(data[1]) && PxIsFinite(data[2]); +} + +PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a) +{ + PX_ALIGN(16, PxF32) data[4]; + vst1q_f32(reinterpret_cast(data), a); + return PxIsFinite(data[0]) && PxIsFinite(data[1]) && PxIsFinite(data[2]) && PxIsFinite(data[3]); +} + +PX_FORCE_INLINE bool hasZeroElementinFloatV(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return vget_lane_u32(vreinterpret_u32_f32(a), 0) == 0; +} + +PX_FORCE_INLINE bool hasZeroElementInVec3V(const Vec3V a) +{ + const uint32x2_t dLow = vget_low_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t dMin = vpmin_u32(dLow, dLow); + + return vget_lane_u32(dMin, 0) == 0 || vgetq_lane_u32(vreinterpretq_u32_f32(a), 2) == 0; +} + +PX_FORCE_INLINE bool hasZeroElementInVec4V(const Vec4V a) +{ + const uint32x2_t dHigh = vget_high_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t dLow = vget_low_u32(vreinterpretq_u32_f32(a)); + + const uint32x2_t dMin = vmin_u32(dHigh, dLow); + const uint32x2_t pairMin = vpmin_u32(dMin, dMin); + return vget_lane_u32(pairMin, 0) == 0; +} + +///////////////////////////////////////////////////////////////////// +////VECTORISED FUNCTION IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE FloatV FLoad(const PxF32 f) +{ + return vdup_n_f32(reinterpret_cast(f)); +} + +PX_FORCE_INLINE FloatV FLoadA(const PxF32* const f) +{ + ASSERT_ISALIGNED16(f); + return vld1_f32(reinterpret_cast(f)); +} + +PX_FORCE_INLINE Vec3V V3Load(const PxF32 f) +{ + PX_ALIGN(16, PxF32) data[4] = { f, f, f, 0.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE Vec4V V4Load(const PxF32 f) +{ + return vdupq_n_f32(reinterpret_cast(f)); +} + +PX_FORCE_INLINE BoolV BLoad(const bool f) +{ + const PxU32 i = static_cast(-(static_cast(f))); + return vdupq_n_u32(i); +} + +PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + PX_ALIGN(16, PxF32) data[4] = { f.x, f.y, f.z, 0.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE Vec3V V3LoadU(const PxVec3& f) +{ + PX_ALIGN(16, PxF32) data[4] = { f.x, f.y, f.z, 0.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + PX_ALIGN(16, PxF32) data[4] = { f.x, f.y, f.z, 0.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* f) +{ + ASSERT_ISALIGNED16(f); + PX_ALIGN(16, PxF32) data[4] = { f[0], f[1], f[2], 0.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* f) +{ + PX_ALIGN(16, PxF32) data[4] = { f[0], f[1], f[2], 0.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V(Vec4V v) +{ + return vsetq_lane_f32(0.0f, v, 3); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V_WUndefined(Vec4V v) +{ + return v; +} + +PX_FORCE_INLINE Vec4V Vec4V_From_Vec3V(Vec3V f) +{ + return f; // ok if it is implemented as the same type. +} + +PX_FORCE_INLINE Vec4V Vec4V_From_FloatV(FloatV f) +{ + return vcombine_f32(f, f); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_FloatV(FloatV f) +{ + return Vec3V_From_Vec4V(Vec4V_From_FloatV(f)); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_FloatV_WUndefined(FloatV f) +{ + return Vec3V_From_Vec4V_WUndefined(Vec4V_From_FloatV(f)); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_PxVec3_WUndefined(const PxVec3& f) +{ + PX_ALIGN(16, PxF32) data[4] = { f.x, f.y, f.z, 0.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE Mat33V Mat33V_From_PxMat33(const PxMat33& m) +{ + return Mat33V(V3LoadU(m.column0), V3LoadU(m.column1), V3LoadU(m.column2)); +} + +PX_FORCE_INLINE void PxMat33_From_Mat33V(const Mat33V& m, PxMat33& out) +{ + V3StoreU(m.col0, out.column0); + V3StoreU(m.col1, out.column1); + V3StoreU(m.col2, out.column2); +} + +PX_FORCE_INLINE Vec4V V4LoadA(const PxF32* const f) +{ + ASSERT_ISALIGNED16(f); + return vld1q_f32(reinterpret_cast(f)); +} + +PX_FORCE_INLINE void V4StoreA(Vec4V a, PxF32* f) +{ + ASSERT_ISALIGNED16(f); + vst1q_f32(reinterpret_cast(f), a); +} + +PX_FORCE_INLINE void V4StoreU(const Vec4V a, PxF32* f) +{ + PX_ALIGN(16, PxF32) f2[4]; + vst1q_f32(reinterpret_cast(f2), a); + f[0] = f2[0]; + f[1] = f2[1]; + f[2] = f2[2]; + f[3] = f2[3]; +} + +PX_FORCE_INLINE void BStoreA(const BoolV a, PxU32* u) +{ + ASSERT_ISALIGNED16(u); + vst1q_u32(reinterpret_cast(u), a); +} + +PX_FORCE_INLINE void U4StoreA(const VecU32V uv, PxU32* u) +{ + ASSERT_ISALIGNED16(u); + vst1q_u32(reinterpret_cast(u), uv); +} + +PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i) +{ + ASSERT_ISALIGNED16(i); + vst1q_s32(reinterpret_cast(i), iv); +} + +PX_FORCE_INLINE Vec4V V4LoadU(const PxF32* const f) +{ + return vld1q_f32(reinterpret_cast(f)); +} + +PX_FORCE_INLINE BoolV BLoad(const bool* const f) +{ + const PX_ALIGN(16, PxU32) b[4] = { static_cast(-static_cast(f[0])), + static_cast(-static_cast(f[1])), + static_cast(-static_cast(f[2])), + static_cast(-static_cast(f[3])) }; + return vld1q_u32(b); +} + +PX_FORCE_INLINE void FStore(const FloatV a, PxF32* PX_RESTRICT f) +{ + ASSERT_ISVALIDFLOATV(a); + // vst1q_lane_f32(f, a, 0); // causes vst1 alignment bug + *f = vget_lane_f32(a, 0); +} + +PX_FORCE_INLINE void Store_From_BoolV(const BoolV a, PxU32* PX_RESTRICT f) +{ + *f = vget_lane_u32(vget_low_u32(a), 0); +} + +PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + PX_ALIGN(16, PxF32) f2[4]; + vst1q_f32(reinterpret_cast(f2), a); + f = PxVec3(f2[0], f2[1], f2[2]); +} + +PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f) +{ + PX_ALIGN(16, PxF32) f2[4]; + vst1q_f32(reinterpret_cast(f2), a); + f = PxVec3(f2[0], f2[1], f2[2]); +} + +////////////////////////////////// +// FLOATV +////////////////////////////////// + +PX_FORCE_INLINE FloatV FZero() +{ + return FLoad(0.0f); +} + +PX_FORCE_INLINE FloatV FOne() +{ + return FLoad(1.0f); +} + +PX_FORCE_INLINE FloatV FHalf() +{ + return FLoad(0.5f); +} + +PX_FORCE_INLINE FloatV FEps() +{ + return FLoad(PX_EPS_REAL); +} + +PX_FORCE_INLINE FloatV FEps6() +{ + return FLoad(1e-6f); +} + +PX_FORCE_INLINE FloatV FMax() +{ + return FLoad(PX_MAX_REAL); +} + +PX_FORCE_INLINE FloatV FNegMax() +{ + return FLoad(-PX_MAX_REAL); +} + +PX_FORCE_INLINE FloatV IZero() +{ + return vreinterpret_f32_u32(vdup_n_u32(0)); +} + +PX_FORCE_INLINE FloatV IOne() +{ + return vreinterpret_f32_u32(vdup_n_u32(1)); +} + +PX_FORCE_INLINE FloatV ITwo() +{ + return vreinterpret_f32_u32(vdup_n_u32(2)); +} + +PX_FORCE_INLINE FloatV IThree() +{ + return vreinterpret_f32_u32(vdup_n_u32(3)); +} + +PX_FORCE_INLINE FloatV IFour() +{ + return vreinterpret_f32_u32(vdup_n_u32(4)); +} + +PX_FORCE_INLINE FloatV FNeg(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return vneg_f32(f); +} + +PX_FORCE_INLINE FloatV FAdd(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vadd_f32(a, b); +} + +PX_FORCE_INLINE FloatV FSub(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vsub_f32(a, b); +} + +PX_FORCE_INLINE FloatV FMul(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vmul_f32(a, b); +} + +template +PX_FORCE_INLINE float32x2_t recip_newton(const float32x2_t& in) +{ + float32x2_t recip = vrecpe_f32(in); + for(int i = 0; i < n; ++i) + recip = vmul_f32(recip, vrecps_f32(in, recip)); + return recip; +} + +template +PX_FORCE_INLINE float32x4_t recipq_newton(const float32x4_t& in) +{ + float32x4_t recip = vrecpeq_f32(in); + for(int i = 0; i < n; ++i) + recip = vmulq_f32(recip, vrecpsq_f32(recip, in)); + return recip; +} + +template +PX_FORCE_INLINE float32x2_t rsqrt_newton(const float32x2_t& in) +{ + float32x2_t rsqrt = vrsqrte_f32(in); + for(int i = 0; i < n; ++i) + rsqrt = vmul_f32(rsqrt, vrsqrts_f32(vmul_f32(rsqrt, rsqrt), in)); + return rsqrt; +} + +template +PX_FORCE_INLINE float32x4_t rsqrtq_newton(const float32x4_t& in) +{ + float32x4_t rsqrt = vrsqrteq_f32(in); + for(int i = 0; i < n; ++i) + rsqrt = vmulq_f32(rsqrt, vrsqrtsq_f32(vmulq_f32(rsqrt, rsqrt), in)); + return rsqrt; +} + +PX_FORCE_INLINE FloatV FDiv(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vmul_f32(a, VRECIP(b)); +} + +PX_FORCE_INLINE FloatV FDivFast(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vmul_f32(a, VRECIPE(b)); +} + +PX_FORCE_INLINE FloatV FRecip(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return VRECIP(a); +} + +PX_FORCE_INLINE FloatV FRecipFast(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return VRECIPE(a); +} + +PX_FORCE_INLINE FloatV FRsqrt(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return VRECIPSQRT(a); +} + +PX_FORCE_INLINE FloatV FSqrt(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return FSel(FIsEq(a, FZero()), a, vmul_f32(a, VRECIPSQRT(a))); +} + +PX_FORCE_INLINE FloatV FRsqrtFast(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return VRECIPSQRTE(a); +} + +PX_FORCE_INLINE FloatV FScaleAdd(const FloatV a, const FloatV b, const FloatV c) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDFLOATV(c); + return vmla_f32(c, a, b); +} + +PX_FORCE_INLINE FloatV FNegScaleSub(const FloatV a, const FloatV b, const FloatV c) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDFLOATV(c); + return vmls_f32(c, a, b); +} + +PX_FORCE_INLINE FloatV FAbs(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return vabs_f32(a); +} + +PX_FORCE_INLINE FloatV FSel(const BoolV c, const FloatV a, const FloatV b) +{ + PX_ASSERT( vecMathTests::allElementsEqualBoolV(c, BTTTT()) || + vecMathTests::allElementsEqualBoolV(c, BFFFF())); + ASSERT_ISVALIDFLOATV(vbsl_f32(vget_low_u32(c), a, b)); + return vbsl_f32(vget_low_u32(c), a, b); +} + +PX_FORCE_INLINE BoolV FIsGrtr(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vdupq_lane_u32(vcgt_f32(a, b), 0); +} + +PX_FORCE_INLINE BoolV FIsGrtrOrEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vdupq_lane_u32(vcge_f32(a, b), 0); +} + +PX_FORCE_INLINE BoolV FIsEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vdupq_lane_u32(vceq_f32(a, b), 0); +} + +PX_FORCE_INLINE FloatV FMax(const FloatV a, const FloatV b) +{ + //ASSERT_ISVALIDFLOATV(a); + //ASSERT_ISVALIDFLOATV(b); + return vmax_f32(a, b); +} + +PX_FORCE_INLINE FloatV FMin(const FloatV a, const FloatV b) +{ + //ASSERT_ISVALIDFLOATV(a); + //ASSERT_ISVALIDFLOATV(b); + return vmin_f32(a, b); +} + +PX_FORCE_INLINE FloatV FClamp(const FloatV a, const FloatV minV, const FloatV maxV) +{ + ASSERT_ISVALIDFLOATV(minV); + ASSERT_ISVALIDFLOATV(maxV); + return vmax_f32(vmin_f32(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 FAllGrtr(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vget_lane_u32(vcgt_f32(a, b), 0); +} + +PX_FORCE_INLINE PxU32 FAllGrtrOrEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vget_lane_u32(vcge_f32(a, b), 0); +} + +PX_FORCE_INLINE PxU32 FAllEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vget_lane_u32(vceq_f32(a, b), 0); +} + +PX_FORCE_INLINE FloatV FRound(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + + // truncate(a + (0.5f - sign(a))) + const float32x2_t half = vdup_n_f32(0.5f); + const float32x2_t sign = vcvt_f32_u32((vshr_n_u32(vreinterpret_u32_f32(a), 31))); + const float32x2_t aPlusHalf = vadd_f32(a, half); + const float32x2_t aRound = vsub_f32(aPlusHalf, sign); + int32x2_t tmp = vcvt_s32_f32(aRound); + return vcvt_f32_s32(tmp); +} + +PX_FORCE_INLINE FloatV FSin(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const FloatV recipTwoPi = FLoadA(g_PXReciprocalTwoPi.f); + const FloatV twoPi = FLoadA(g_PXTwoPi.f); + const FloatV tmp = FMul(a, recipTwoPi); + const FloatV b = FRound(tmp); + const FloatV V1 = FNegScaleSub(twoPi, b, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const FloatV V2 = FMul(V1, V1); + const FloatV V3 = FMul(V2, V1); + const FloatV V5 = FMul(V3, V2); + const FloatV V7 = FMul(V5, V2); + const FloatV V9 = FMul(V7, V2); + const FloatV V11 = FMul(V9, V2); + const FloatV V13 = FMul(V11, V2); + const FloatV V15 = FMul(V13, V2); + const FloatV V17 = FMul(V15, V2); + const FloatV V19 = FMul(V17, V2); + const FloatV V21 = FMul(V19, V2); + const FloatV V23 = FMul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + FloatV Result; + Result = FScaleAdd(S1, V3, V1); + Result = FScaleAdd(S2, V5, Result); + Result = FScaleAdd(S3, V7, Result); + Result = FScaleAdd(S4, V9, Result); + Result = FScaleAdd(S5, V11, Result); + Result = FScaleAdd(S6, V13, Result); + Result = FScaleAdd(S7, V15, Result); + Result = FScaleAdd(S8, V17, Result); + Result = FScaleAdd(S9, V19, Result); + Result = FScaleAdd(S10, V21, Result); + Result = FScaleAdd(S11, V23, Result); + + return Result; +} + +PX_FORCE_INLINE FloatV FCos(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const FloatV recipTwoPi = FLoadA(g_PXReciprocalTwoPi.f); + const FloatV twoPi = FLoadA(g_PXTwoPi.f); + const FloatV tmp = FMul(a, recipTwoPi); + const FloatV b = FRound(tmp); + const FloatV V1 = FNegScaleSub(twoPi, b, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const FloatV V2 = FMul(V1, V1); + const FloatV V4 = FMul(V2, V2); + const FloatV V6 = FMul(V4, V2); + const FloatV V8 = FMul(V4, V4); + const FloatV V10 = FMul(V6, V4); + const FloatV V12 = FMul(V6, V6); + const FloatV V14 = FMul(V8, V6); + const FloatV V16 = FMul(V8, V8); + const FloatV V18 = FMul(V10, V8); + const FloatV V20 = FMul(V10, V10); + const FloatV V22 = FMul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + FloatV Result; + Result = FScaleAdd(C1, V2, FOne()); + Result = FScaleAdd(C2, V4, Result); + Result = FScaleAdd(C3, V6, Result); + Result = FScaleAdd(C4, V8, Result); + Result = FScaleAdd(C5, V10, Result); + Result = FScaleAdd(C6, V12, Result); + Result = FScaleAdd(C7, V14, Result); + Result = FScaleAdd(C8, V16, Result); + Result = FScaleAdd(C9, V18, Result); + Result = FScaleAdd(C10, V20, Result); + Result = FScaleAdd(C11, V22, Result); + + return Result; +} + +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV min, const FloatV max) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(min); + ASSERT_ISVALIDFLOATV(max); + + const BoolV c = BOr(FIsGrtr(a, max), FIsGrtr(min, a)); + return PxU32(!BAllEqFFFF(c)); +} + +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV min, const FloatV max) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(min); + ASSERT_ISVALIDFLOATV(max); + + const BoolV c = BAnd(FIsGrtrOrEq(a, min), FIsGrtrOrEq(max, a)); + return PxU32(BAllEqTTTT(c)); +} + +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV bounds) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(bounds); + const uint32x2_t greater = vcagt_f32(a, bounds); + return vget_lane_u32(greater, 0); +} + +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV bounds) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(bounds); + const uint32x2_t geq = vcage_f32(bounds, a); + return vget_lane_u32(geq, 0); +} + +////////////////////////////////// +// VEC3V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V V3Splat(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + + const uint32x2_t mask = { 0xffffFFFF, 0x0 }; + const uint32x2_t uHigh = vreinterpret_u32_f32(f); + const float32x2_t dHigh = vreinterpret_f32_u32(vand_u32(uHigh, mask)); + + return vcombine_f32(f, dHigh); +} + +PX_FORCE_INLINE Vec3V V3Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z) +{ + ASSERT_ISVALIDFLOATV(x); + ASSERT_ISVALIDFLOATV(y); + ASSERT_ISVALIDFLOATV(z); + + const uint32x2_t mask = { 0xffffFFFF, 0x0 }; + const uint32x2_t dHigh = vand_u32(vreinterpret_u32_f32(z), mask); + const uint32x2_t dLow = vext_u32(vreinterpret_u32_f32(x), vreinterpret_u32_f32(y), 1); + return vreinterpretq_f32_u32(vcombine_u32(dLow, dHigh)); +} + +PX_FORCE_INLINE Vec3V V3UnitX() +{ + const float32x4_t x = { 1.0f, 0.0f, 0.0f, 0.0f }; + return x; +} + +PX_FORCE_INLINE Vec3V V3UnitY() +{ + const float32x4_t y = { 0, 1.0f, 0, 0 }; + return y; +} + +PX_FORCE_INLINE Vec3V V3UnitZ() +{ + const float32x4_t z = { 0, 0, 1.0f, 0 }; + return z; +} + +PX_FORCE_INLINE FloatV V3GetX(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + const float32x2_t fLow = vget_low_f32(f); + return vdup_lane_f32(fLow, 0); +} + +PX_FORCE_INLINE FloatV V3GetY(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + const float32x2_t fLow = vget_low_f32(f); + return vdup_lane_f32(fLow, 1); +} + +PX_FORCE_INLINE FloatV V3GetZ(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + const float32x2_t fhigh = vget_high_f32(f); + return vdup_lane_f32(fhigh, 0); +} + +PX_FORCE_INLINE Vec3V V3SetX(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BFTTT(), v, vcombine_f32(f, f)); +} + +PX_FORCE_INLINE Vec3V V3SetY(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTFTT(), v, vcombine_f32(f, f)); +} + +PX_FORCE_INLINE Vec3V V3SetZ(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTFT(), v, vcombine_f32(f, f)); +} + +PX_FORCE_INLINE Vec3V V3ColX(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + + const float32x2_t aLow = vget_low_f32(a); + const float32x2_t bLow = vget_low_f32(b); + const float32x2_t cLow = vget_low_f32(c); + const float32x2_t zero = vdup_n_f32(0.0f); + + const float32x2x2_t zipL = vzip_f32(aLow, bLow); + const float32x2x2_t zipH = vzip_f32(cLow, zero); + + return vcombine_f32(zipL.val[0], zipH.val[0]); +} + +PX_FORCE_INLINE Vec3V V3ColY(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + + const float32x2_t aLow = vget_low_f32(a); + const float32x2_t bLow = vget_low_f32(b); + const float32x2_t cLow = vget_low_f32(c); + const float32x2_t zero = vdup_n_f32(0.0f); + + const float32x2x2_t zipL = vzip_f32(aLow, bLow); + const float32x2x2_t zipH = vzip_f32(cLow, zero); + + return vcombine_f32(zipL.val[1], zipH.val[1]); +} + +PX_FORCE_INLINE Vec3V V3ColZ(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + + const float32x2_t aHi = vget_high_f32(a); + const float32x2_t bHi = vget_high_f32(b); + const float32x2_t cHi = vget_high_f32(c); + + const float32x2x2_t zipL = vzip_f32(aHi, bHi); + + return vcombine_f32(zipL.val[0], cHi); +} + +PX_FORCE_INLINE Vec3V V3Zero() +{ + return vdupq_n_f32(0.0f); +} + +PX_FORCE_INLINE Vec3V V3Eps() +{ + return V3Load(PX_EPS_REAL); +} + +PX_FORCE_INLINE Vec3V V3One() +{ + return V3Load(1.0f); +} + +PX_FORCE_INLINE Vec3V V3Neg(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + const float32x4_t tmp = vnegq_f32(f); + return vsetq_lane_f32(0.0f, tmp, 3); +} + +PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vaddq_f32(a, b); +} + +PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + return vaddq_f32(a, Vec3V_From_FloatV(b)); +} + +PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vsubq_f32(a, b); +} + +PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + return vsubq_f32(a, Vec3V_From_FloatV(b)); +} + +PX_FORCE_INLINE Vec3V V3Scale(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + const float32x4_t tmp = vmulq_lane_f32(a, b, 0); + return vsetq_lane_f32(0.0f, tmp, 3); +} + +PX_FORCE_INLINE Vec3V V3Mul(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vmulq_f32(a, b); +} + +PX_FORCE_INLINE Vec3V V3ScaleInv(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + const float32x2_t invB = VRECIP(b); + const float32x4_t tmp = vmulq_lane_f32(a, invB, 0); + return vsetq_lane_f32(0.0f, tmp, 3); +} + +PX_FORCE_INLINE Vec3V V3Div(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + float32x4_t invB = VRECIPQ(b); + invB = vsetq_lane_f32(0.0f, invB, 3); + return vmulq_f32(a, invB); +} + +PX_FORCE_INLINE Vec3V V3ScaleInvFast(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + const float32x2_t invB = VRECIPE(b); + const float32x4_t tmp = vmulq_lane_f32(a, invB, 0); + return vsetq_lane_f32(0.0f, tmp, 3); +} + +PX_FORCE_INLINE Vec3V V3DivFast(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + float32x4_t invB = VRECIPEQ(b); + invB = vsetq_lane_f32(0.0f, invB, 3); + return vmulq_f32(a, invB); +} + +PX_FORCE_INLINE Vec3V V3Recip(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const float32x4_t recipA = VRECIPQ(a); + return vsetq_lane_f32(0.0f, recipA, 3); +} + +PX_FORCE_INLINE Vec3V V3RecipFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const float32x4_t recipA = VRECIPEQ(a); + return vsetq_lane_f32(0.0f, recipA, 3); +} + +PX_FORCE_INLINE Vec3V V3Rsqrt(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const float32x4_t rSqrA = VRECIPSQRTQ(a); + return vsetq_lane_f32(0.0f, rSqrA, 3); +} + +PX_FORCE_INLINE Vec3V V3RsqrtFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const float32x4_t rSqrA = VRECIPSQRTEQ(a); + return vsetq_lane_f32(0.0f, rSqrA, 3); +} + +PX_FORCE_INLINE Vec3V V3ScaleAdd(const Vec3V a, const FloatV b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDVEC3V(c); + + float32x4_t tmp = vmlaq_lane_f32(c, a, b, 0); + // using vsetq_lane_f32 resulted in failures, + // probably related to a compiler bug on + // ndk r9d-win32, gcc 4.8, cardhu/shield + + // code with issue + // return vsetq_lane_f32(0.0f, tmp, 3); + + // workaround + float32x2_t w_z = vget_high_f32(tmp); + float32x2_t y_x = vget_low_f32(tmp); + w_z = vset_lane_f32(0.0f, w_z, 1); + return vcombine_f32(y_x, w_z); +} + +PX_FORCE_INLINE Vec3V V3NegScaleSub(const Vec3V a, const FloatV b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDVEC3V(c); + + float32x4_t tmp = vmlsq_lane_f32(c, a, b, 0); + // using vsetq_lane_f32 resulted in failures, + // probably related to a compiler bug on + // ndk r9d-win32, gcc 4.8, cardhu/shield + + // code with issue + // return vsetq_lane_f32(0.0f, tmp, 3); + + // workaround + float32x2_t w_z = vget_high_f32(tmp); + float32x2_t y_x = vget_low_f32(tmp); + w_z = vset_lane_f32(0.0f, w_z, 1); + return vcombine_f32(y_x, w_z); +} + +PX_FORCE_INLINE Vec3V V3MulAdd(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + return vmlaq_f32(c, a, b); +} + +PX_FORCE_INLINE Vec3V V3NegMulSub(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + return vmlsq_f32(c, a, b); +} + +PX_FORCE_INLINE Vec3V V3Abs(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return vabsq_f32(a); +} + +PX_FORCE_INLINE FloatV V3Dot(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + + // const uint32x2_t mask = {0xffffFFFF, 0x0}; + const float32x4_t tmp = vmulq_f32(a, b); + + const float32x2_t low = vget_low_f32(tmp); + const float32x2_t high = vget_high_f32(tmp); + // const float32x2_t high = vreinterpret_f32_u32(vand_u32(vreinterpret_u32_f32(high_), mask)); + + const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} + const float32x2_t sum0ZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} + + return sum0ZYX; +} + +PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + + const uint32x2_t TF = { 0xffffFFFF, 0x0 }; + const float32x2_t ay_ax = vget_low_f32(a); // d2 + const float32x2_t aw_az = vget_high_f32(a); // d3 + const float32x2_t by_bx = vget_low_f32(b); // d4 + const float32x2_t bw_bz = vget_high_f32(b); // d5 + // Hi, Lo + const float32x2_t bz_by = vext_f32(by_bx, bw_bz, 1); // bz, by + const float32x2_t az_ay = vext_f32(ay_ax, aw_az, 1); // az, ay + + const float32x2_t azbx = vmul_f32(aw_az, by_bx); // 0, az*bx + const float32x2_t aybz_axby = vmul_f32(ay_ax, bz_by); // ay*bz, ax*by + + const float32x2_t azbxSUBaxbz = vmls_f32(azbx, bw_bz, ay_ax); // 0, az*bx-ax*bz + const float32x2_t aybzSUBazby_axbySUBaybx = vmls_f32(aybz_axby, by_bx, az_ay); // ay*bz-az*by, ax*by-ay*bx + + const float32x2_t retLow = vext_f32(aybzSUBazby_axbySUBaybx, azbxSUBaxbz, 1); // az*bx-ax*bz, ay*bz-az*by + const uint32x2_t retHigh = vand_u32(TF, vreinterpret_u32_f32(aybzSUBazby_axbySUBaybx)); // 0, ax*by-ay*bx + + return vcombine_f32(retLow, vreinterpret_f32_u32(retHigh)); +} + +PX_FORCE_INLINE VecCrossV V3PrepareCross(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return a; +} + +PX_FORCE_INLINE FloatV V3Length(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + // const uint32x2_t mask = {0xffffFFFF, 0x0}; + + const float32x4_t tmp = vmulq_f32(a, a); + const float32x2_t low = vget_low_f32(tmp); + const float32x2_t high = vget_high_f32(tmp); + // const float32x2_t high = vreinterpret_f32_u32(vand_u32(vreinterpret_u32_f32(high_), mask)); + + const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} + const float32x2_t sum0ZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} + + return FSqrt(sum0ZYX); +} + +PX_FORCE_INLINE FloatV V3LengthSq(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return V3Dot(a, a); +} + +PX_FORCE_INLINE Vec3V V3Normalize(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + //PX_ASSERT(!FAllEq(V4LengthSq(a), FZero())); + return V3ScaleInv(a, V3Length(a)); +} + +PX_FORCE_INLINE Vec3V V3NormalizeFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + //PX_ASSERT(!FAllEq(V4LengthSq(a), FZero())); + return V3Scale(a, VRECIPSQRTE(V3Dot(a, a))); +} + +PX_FORCE_INLINE Vec3V V3NormalizeSafe(const Vec3V a, const Vec3V unsafeReturnValue) +{ + ASSERT_ISVALIDVEC3V(a); + const FloatV zero = vdup_n_f32(0.0f); + const FloatV length = V3Length(a); + const uint32x4_t isGreaterThanZero = FIsGrtr(length, zero); + return V3Sel(isGreaterThanZero, V3ScaleInv(a, length), unsafeReturnValue); +} + +PX_FORCE_INLINE Vec3V V3Sel(const BoolV c, const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V( vbslq_f32(c, a, b)); + return vbslq_f32(c, a, b); +} + +PX_FORCE_INLINE BoolV V3IsGrtr(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vcgtq_f32(a, b); +} + +PX_FORCE_INLINE BoolV V3IsGrtrOrEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vcgeq_f32(a, b); +} + +PX_FORCE_INLINE BoolV V3IsEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vceqq_f32(a, b); +} + +PX_FORCE_INLINE Vec3V V3Max(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vmaxq_f32(a, b); +} + +PX_FORCE_INLINE Vec3V V3Min(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vminq_f32(a, b); +} + +PX_FORCE_INLINE FloatV V3ExtractMax(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const float32x2_t low = vget_low_f32(a); + const float32x2_t high = vget_high_f32(a); + + const float32x2_t zz = vdup_lane_f32(high, 0); + const float32x2_t max0 = vpmax_f32(zz, low); + const float32x2_t max1 = vpmax_f32(max0, max0); + + return max1; +} + +PX_FORCE_INLINE FloatV V3ExtractMin(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const float32x2_t low = vget_low_f32(a); + const float32x2_t high = vget_high_f32(a); + + const float32x2_t zz = vdup_lane_f32(high, 0); + const float32x2_t min0 = vpmin_f32(zz, low); + const float32x2_t min1 = vpmin_f32(min0, min0); + + return min1; +} + +// return (a >= 0.0f) ? 1.0f : -1.0f; +PX_FORCE_INLINE Vec3V V3Sign(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const Vec3V zero = V3Zero(); + const Vec3V one = V3One(); + const Vec3V none = V3Neg(one); + return V3Sel(V3IsGrtrOrEq(a, zero), one, none); +} + +PX_FORCE_INLINE Vec3V V3Clamp(const Vec3V a, const Vec3V minV, const Vec3V maxV) +{ + ASSERT_ISVALIDVEC3V(minV); + ASSERT_ISVALIDVEC3V(maxV); + return V3Max(V3Min(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 V3AllGrtr(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalUnitNeonSimd::BAllTrue3_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE PxU32 V3AllGrtrOrEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalUnitNeonSimd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V3AllEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalUnitNeonSimd::BAllTrue3_R(V4IsEq(a, b)); +} + +PX_FORCE_INLINE Vec3V V3Round(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + // truncate(a + (0.5f - sign(a))) + const Vec3V half = V3Load(0.5f); + const float32x4_t sign = vcvtq_f32_u32((vshrq_n_u32(vreinterpretq_u32_f32(a), 31))); + const Vec3V aPlusHalf = V3Add(a, half); + const Vec3V aRound = V3Sub(aPlusHalf, sign); + return vcvtq_f32_s32(vcvtq_s32_f32(aRound)); +} + +PX_FORCE_INLINE Vec3V V3Sin(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec3V tmp = V4Mul(a, recipTwoPi); + const Vec3V b = V3Round(tmp); + const Vec3V V1 = V4NegMulSub(twoPi, b, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const Vec3V V2 = V3Mul(V1, V1); + const Vec3V V3 = V3Mul(V2, V1); + const Vec3V V5 = V3Mul(V3, V2); + const Vec3V V7 = V3Mul(V5, V2); + const Vec3V V9 = V3Mul(V7, V2); + const Vec3V V11 = V3Mul(V9, V2); + const Vec3V V13 = V3Mul(V11, V2); + const Vec3V V15 = V3Mul(V13, V2); + const Vec3V V17 = V3Mul(V15, V2); + const Vec3V V19 = V3Mul(V17, V2); + const Vec3V V21 = V3Mul(V19, V2); + const Vec3V V23 = V3Mul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + Vec3V Result; + Result = V4ScaleAdd(V3, S1, V1); + Result = V4ScaleAdd(V5, S2, Result); + Result = V4ScaleAdd(V7, S3, Result); + Result = V4ScaleAdd(V9, S4, Result); + Result = V4ScaleAdd(V11, S5, Result); + Result = V4ScaleAdd(V13, S6, Result); + Result = V4ScaleAdd(V15, S7, Result); + Result = V4ScaleAdd(V17, S8, Result); + Result = V4ScaleAdd(V19, S9, Result); + Result = V4ScaleAdd(V21, S10, Result); + Result = V4ScaleAdd(V23, S11, Result); + + return Result; +} + +PX_FORCE_INLINE Vec3V V3Cos(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec3V tmp = V4Mul(a, recipTwoPi); + const Vec3V b = V3Round(tmp); + const Vec3V V1 = V4NegMulSub(twoPi, b, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const Vec3V V2 = V3Mul(V1, V1); + const Vec3V V4 = V3Mul(V2, V2); + const Vec3V V6 = V3Mul(V4, V2); + const Vec3V V8 = V3Mul(V4, V4); + const Vec3V V10 = V3Mul(V6, V4); + const Vec3V V12 = V3Mul(V6, V6); + const Vec3V V14 = V3Mul(V8, V6); + const Vec3V V16 = V3Mul(V8, V8); + const Vec3V V18 = V3Mul(V10, V8); + const Vec3V V20 = V3Mul(V10, V10); + const Vec3V V22 = V3Mul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + Vec3V Result; + Result = V4ScaleAdd(V2, C1, V4One()); + Result = V4ScaleAdd(V4, C2, Result); + Result = V4ScaleAdd(V6, C3, Result); + Result = V4ScaleAdd(V8, C4, Result); + Result = V4ScaleAdd(V10, C5, Result); + Result = V4ScaleAdd(V12, C6, Result); + Result = V4ScaleAdd(V14, C7, Result); + Result = V4ScaleAdd(V16, C8, Result); + Result = V4ScaleAdd(V18, C9, Result); + Result = V4ScaleAdd(V20, C10, Result); + Result = V4ScaleAdd(V22, C11, Result); + + return V4ClearW(Result); +} + +PX_FORCE_INLINE Vec3V V3PermYZZ(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const float32x2_t xy = vget_low_f32(a); + const float32x2_t zw = vget_high_f32(a); + const float32x2_t yz = vext_f32(xy, zw, 1); + return vcombine_f32(yz, zw); +} + +PX_FORCE_INLINE Vec3V V3PermXYX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const uint32x2_t mask = { 0xffffFFFF, 0x0 }; + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t xw = vand_u32(xy, mask); + return vreinterpretq_f32_u32(vcombine_u32(xy, xw)); +} + +PX_FORCE_INLINE Vec3V V3PermYZX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const uint32x2_t mask = { 0xffffFFFF, 0x0 }; + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t yz = vext_u32(xy, zw, 1); + const uint32x2_t xw = vand_u32(xy, mask); + return vreinterpretq_f32_u32(vcombine_u32(yz, xw)); +} + +PX_FORCE_INLINE Vec3V V3PermZXY(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t wz = vrev64_u32(zw); + + const uint32x2_t zx = vext_u32(wz, xy, 1); + const uint32x2_t yw = vext_u32(xy, wz, 1); + + return vreinterpretq_f32_u32(vcombine_u32(zx, yw)); +} + +PX_FORCE_INLINE Vec3V V3PermZZY(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(a)); + + const uint32x2_t wz = vrev64_u32(zw); + const uint32x2_t yw = vext_u32(xy, wz, 1); + const uint32x2_t zz = vdup_lane_u32(wz, 1); + + return vreinterpretq_f32_u32(vcombine_u32(zz, yw)); +} + +PX_FORCE_INLINE Vec3V V3PermYXX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const uint32x2_t mask = { 0xffffFFFF, 0x0 }; + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t yx = vrev64_u32(xy); + const uint32x2_t xw = vand_u32(xy, mask); + return vreinterpretq_f32_u32(vcombine_u32(yx, xw)); +} + +PX_FORCE_INLINE Vec3V V3Perm_Zero_1Z_0Y(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(v0)); + const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(v1)); + const uint32x2_t wz = vrev64_u32(zw); + const uint32x2_t yw = vext_u32(xy, wz, 1); + + return vreinterpretq_f32_u32(vcombine_u32(wz, yw)); +} + +PX_FORCE_INLINE Vec3V V3Perm_0Z_Zero_1X(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + + const uint32x2_t mask = { 0xffffFFFF, 0x0 }; + const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(v0)); + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(v1)); + const uint32x2_t xw = vand_u32(xy, mask); + + return vreinterpretq_f32_u32(vcombine_u32(zw, xw)); +} + +PX_FORCE_INLINE Vec3V V3Perm_1Y_0X_Zero(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + + const uint32x2_t axy = vget_low_u32(vreinterpretq_u32_f32(v0)); + const uint32x2_t bxy = vget_low_u32(vreinterpretq_u32_f32(v1)); + const uint32x2_t byax = vext_u32(bxy, axy, 1); + const uint32x2_t ww = vdup_n_u32(0); + + return vreinterpretq_f32_u32(vcombine_u32(byax, ww)); +} + +PX_FORCE_INLINE FloatV V3SumElems(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + // const uint32x2_t mask = {0xffffFFFF, 0x0}; + + const float32x2_t low = vget_low_f32(a); + const float32x2_t high = vget_high_f32(a); + // const float32x2_t high = vreinterpret_f32_u32(vand_u32(vreinterpret_u32_f32(high_), mask)); + + const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} + const float32x2_t sum0ZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} + + return sum0ZYX; +} + +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V min, const Vec3V max) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(min); + ASSERT_ISVALIDVEC3V(max); + + const BoolV c = BOr(V3IsGrtr(a, max), V3IsGrtr(min, a)); + return internalUnitNeonSimd::BAnyTrue3_R(c); +} + +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V min, const Vec3V max) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(min); + ASSERT_ISVALIDVEC3V(max); + + const BoolV c = BAnd(V3IsGrtrOrEq(a, min), V3IsGrtrOrEq(max, a)); + return internalUnitNeonSimd::BAllTrue4_R(c); +} + +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V bounds) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(bounds); + + const BoolV greater = V3IsGrtr(V3Abs(a), bounds); + return internalUnitNeonSimd::BAnyTrue3_R(greater); +} + +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V bounds) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(bounds); + + const BoolV greaterOrEq = V3IsGrtrOrEq(bounds, V3Abs(a)); + return internalUnitNeonSimd::BAllTrue4_R(greaterOrEq); +} + +PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2) +{ + ASSERT_ISVALIDVEC3V(col0); + ASSERT_ISVALIDVEC3V(col1); + ASSERT_ISVALIDVEC3V(col2); + + Vec3V col3 = V3Zero(); + const float32x4x2_t v0v1 = vzipq_f32(col0, col2); + const float32x4x2_t v2v3 = vzipq_f32(col1, col3); + const float32x4x2_t zip0 = vzipq_f32(v0v1.val[0], v2v3.val[0]); + const float32x4x2_t zip1 = vzipq_f32(v0v1.val[1], v2v3.val[1]); + col0 = zip0.val[0]; + col1 = zip0.val[1]; + col2 = zip1.val[0]; + // col3 = zip1.val[1]; +} + +////////////////////////////////// +// VEC4V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V V4Splat(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return vcombine_f32(f, f); +} + +PX_FORCE_INLINE Vec4V V4Merge(const FloatV* const floatVArray) +{ + ASSERT_ISVALIDFLOATV(floatVArray[0]); + ASSERT_ISVALIDFLOATV(floatVArray[1]); + ASSERT_ISVALIDFLOATV(floatVArray[2]); + ASSERT_ISVALIDFLOATV(floatVArray[3]); + + const uint32x2_t xLow = vreinterpret_u32_f32(floatVArray[0]); + const uint32x2_t yLow = vreinterpret_u32_f32(floatVArray[1]); + const uint32x2_t zLow = vreinterpret_u32_f32(floatVArray[2]); + const uint32x2_t wLow = vreinterpret_u32_f32(floatVArray[3]); + + const uint32x2_t dLow = vext_u32(xLow, yLow, 1); + const uint32x2_t dHigh = vext_u32(zLow, wLow, 1); + + return vreinterpretq_f32_u32(vcombine_u32(dLow, dHigh)); +} + +PX_FORCE_INLINE Vec4V V4Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w) +{ + ASSERT_ISVALIDFLOATV(x); + ASSERT_ISVALIDFLOATV(y); + ASSERT_ISVALIDFLOATV(z); + ASSERT_ISVALIDFLOATV(w); + + const uint32x2_t xLow = vreinterpret_u32_f32(x); + const uint32x2_t yLow = vreinterpret_u32_f32(y); + const uint32x2_t zLow = vreinterpret_u32_f32(z); + const uint32x2_t wLow = vreinterpret_u32_f32(w); + + const uint32x2_t dLow = vext_u32(xLow, yLow, 1); + const uint32x2_t dHigh = vext_u32(zLow, wLow, 1); + + return vreinterpretq_f32_u32(vcombine_u32(dLow, dHigh)); +} + +PX_FORCE_INLINE Vec4V V4MergeW(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const float32x2_t xx = vget_high_f32(x); + const float32x2_t yy = vget_high_f32(y); + const float32x2_t zz = vget_high_f32(z); + const float32x2_t ww = vget_high_f32(w); + + const float32x2x2_t zipL = vzip_f32(xx, yy); + const float32x2x2_t zipH = vzip_f32(zz, ww); + + return vcombine_f32(zipL.val[1], zipH.val[1]); +} + +PX_FORCE_INLINE Vec4V V4MergeZ(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const float32x2_t xx = vget_high_f32(x); + const float32x2_t yy = vget_high_f32(y); + const float32x2_t zz = vget_high_f32(z); + const float32x2_t ww = vget_high_f32(w); + + const float32x2x2_t zipL = vzip_f32(xx, yy); + const float32x2x2_t zipH = vzip_f32(zz, ww); + + return vcombine_f32(zipL.val[0], zipH.val[0]); +} + +PX_FORCE_INLINE Vec4V V4MergeY(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const float32x2_t xx = vget_low_f32(x); + const float32x2_t yy = vget_low_f32(y); + const float32x2_t zz = vget_low_f32(z); + const float32x2_t ww = vget_low_f32(w); + + const float32x2x2_t zipL = vzip_f32(xx, yy); + const float32x2x2_t zipH = vzip_f32(zz, ww); + + return vcombine_f32(zipL.val[1], zipH.val[1]); +} + +PX_FORCE_INLINE Vec4V V4MergeX(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const float32x2_t xx = vget_low_f32(x); + const float32x2_t yy = vget_low_f32(y); + const float32x2_t zz = vget_low_f32(z); + const float32x2_t ww = vget_low_f32(w); + + const float32x2x2_t zipL = vzip_f32(xx, yy); + const float32x2x2_t zipH = vzip_f32(zz, ww); + + return vcombine_f32(zipL.val[0], zipH.val[0]); +} + +PX_FORCE_INLINE Vec4V V4UnpackXY(const Vec4VArg a, const Vec4VArg b) +{ + return vzipq_f32(a, b).val[0]; +} + +PX_FORCE_INLINE Vec4V V4UnpackZW(const Vec4VArg a, const Vec4VArg b) +{ + return vzipq_f32(a, b).val[1]; +} + +PX_FORCE_INLINE Vec4V V4UnitW() +{ + const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); + const float32x2_t ones = vmov_n_f32(1.0f); + const float32x2_t zo = vext_f32(zeros, ones, 1); + return vcombine_f32(zeros, zo); +} + +PX_FORCE_INLINE Vec4V V4UnitX() +{ + const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); + const float32x2_t ones = vmov_n_f32(1.0f); + const float32x2_t oz = vext_f32(ones, zeros, 1); + return vcombine_f32(oz, zeros); +} + +PX_FORCE_INLINE Vec4V V4UnitY() +{ + const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); + const float32x2_t ones = vmov_n_f32(1.0f); + const float32x2_t zo = vext_f32(zeros, ones, 1); + return vcombine_f32(zo, zeros); +} + +PX_FORCE_INLINE Vec4V V4UnitZ() +{ + const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); + const float32x2_t ones = vmov_n_f32(1.0f); + const float32x2_t oz = vext_f32(ones, zeros, 1); + return vcombine_f32(zeros, oz); +} + +PX_FORCE_INLINE FloatV V4GetW(const Vec4V f) +{ + const float32x2_t fhigh = vget_high_f32(f); + return vdup_lane_f32(fhigh, 1); +} + +PX_FORCE_INLINE FloatV V4GetX(const Vec4V f) +{ + const float32x2_t fLow = vget_low_f32(f); + return vdup_lane_f32(fLow, 0); +} + +PX_FORCE_INLINE FloatV V4GetY(const Vec4V f) +{ + const float32x2_t fLow = vget_low_f32(f); + return vdup_lane_f32(fLow, 1); +} + +PX_FORCE_INLINE FloatV V4GetZ(const Vec4V f) +{ + const float32x2_t fhigh = vget_high_f32(f); + return vdup_lane_f32(fhigh, 0); +} + +PX_FORCE_INLINE Vec4V V4SetW(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTTF(), v, vcombine_f32(f, f)); +} + +PX_FORCE_INLINE Vec4V V4SetX(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BFTTT(), v, vcombine_f32(f, f)); +} + +PX_FORCE_INLINE Vec4V V4SetY(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTFTT(), v, vcombine_f32(f, f)); +} + +PX_FORCE_INLINE Vec4V V4SetZ(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTFT(), v, vcombine_f32(f, f)); +} + +PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v) +{ + return V4Sel(BTTTF(), v, V4Zero()); +} + +PX_FORCE_INLINE Vec4V V4PermYXWZ(const Vec4V a) +{ + const float32x2_t xy = vget_low_f32(a); + const float32x2_t zw = vget_high_f32(a); + const float32x2_t yx = vext_f32(xy, xy, 1); + const float32x2_t wz = vext_f32(zw, zw, 1); + return vcombine_f32(yx, wz); +} + +PX_FORCE_INLINE Vec4V V4PermXZXZ(const Vec4V a) +{ + const float32x2_t xy = vget_low_f32(a); + const float32x2_t zw = vget_high_f32(a); + const float32x2x2_t xzyw = vzip_f32(xy, zw); + return vcombine_f32(xzyw.val[0], xzyw.val[0]); +} + +PX_FORCE_INLINE Vec4V V4PermYWYW(const Vec4V a) +{ + const float32x2_t xy = vget_low_f32(a); + const float32x2_t zw = vget_high_f32(a); + const float32x2x2_t xzyw = vzip_f32(xy, zw); + return vcombine_f32(xzyw.val[1], xzyw.val[1]); +} + +PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V a) +{ + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t yz = vext_u32(xy, zw, 1); + const uint32x2_t xw = vrev64_u32(vext_u32(zw, xy, 1)); + return vreinterpretq_f32_u32(vcombine_u32(yz, xw)); +} + +PX_FORCE_INLINE Vec4V V4PermZWXY(const Vec4V a) +{ + const float32x2_t low = vget_low_f32(a); + const float32x2_t high = vget_high_f32(a); + return vcombine_f32(high, low); +} + +template +PX_FORCE_INLINE Vec4V V4Perm(const Vec4V V) +{ + static const uint32_t ControlElement[4] = + { +#if 1 + 0x03020100, // XM_SWIZZLE_X + 0x07060504, // XM_SWIZZLE_Y + 0x0B0A0908, // XM_SWIZZLE_Z + 0x0F0E0D0C, // XM_SWIZZLE_W +#else + 0x00010203, // XM_SWIZZLE_X + 0x04050607, // XM_SWIZZLE_Y + 0x08090A0B, // XM_SWIZZLE_Z + 0x0C0D0E0F, // XM_SWIZZLE_W +#endif + }; + + uint8x8x2_t tbl; + tbl.val[0] = vreinterpret_u8_f32(vget_low_f32(V)); + tbl.val[1] = vreinterpret_u8_f32(vget_high_f32(V)); + + uint8x8_t idx = + vcreate_u8(static_cast(ControlElement[E0]) | (static_cast(ControlElement[E1]) << 32)); + const uint8x8_t rL = vtbl2_u8(tbl, idx); + idx = vcreate_u8(static_cast(ControlElement[E2]) | (static_cast(ControlElement[E3]) << 32)); + const uint8x8_t rH = vtbl2_u8(tbl, idx); + return vreinterpretq_f32_u8(vcombine_u8(rL, rH)); +} + +// PT: this seems measurably slower than the hardcoded version +/*PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V a) +{ + return V4Perm<1, 2, 0, 3>(a); +}*/ + +PX_FORCE_INLINE Vec4V V4Zero() +{ + return vreinterpretq_f32_u32(vmovq_n_u32(0)); + // return vmovq_n_f32(0.0f); +} + +PX_FORCE_INLINE Vec4V V4One() +{ + return vmovq_n_f32(1.0f); +} + +PX_FORCE_INLINE Vec4V V4Eps() +{ + // return vmovq_n_f32(PX_EPS_REAL); + return V4Load(PX_EPS_REAL); +} + +PX_FORCE_INLINE Vec4V V4Neg(const Vec4V f) +{ + return vnegq_f32(f); +} + +PX_FORCE_INLINE Vec4V V4Add(const Vec4V a, const Vec4V b) +{ + return vaddq_f32(a, b); +} + +PX_FORCE_INLINE Vec4V V4Sub(const Vec4V a, const Vec4V b) +{ + return vsubq_f32(a, b); +} + +PX_FORCE_INLINE Vec4V V4Scale(const Vec4V a, const FloatV b) +{ + return vmulq_lane_f32(a, b, 0); +} + +PX_FORCE_INLINE Vec4V V4Mul(const Vec4V a, const Vec4V b) +{ + return vmulq_f32(a, b); +} + +PX_FORCE_INLINE Vec4V V4ScaleInv(const Vec4V a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(b); + const float32x2_t invB = VRECIP(b); + return vmulq_lane_f32(a, invB, 0); +} + +PX_FORCE_INLINE Vec4V V4Div(const Vec4V a, const Vec4V b) +{ + const float32x4_t invB = VRECIPQ(b); + return vmulq_f32(a, invB); +} + +PX_FORCE_INLINE Vec4V V4ScaleInvFast(const Vec4V a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(b); + const float32x2_t invB = VRECIPE(b); + return vmulq_lane_f32(a, invB, 0); +} + +PX_FORCE_INLINE Vec4V V4DivFast(const Vec4V a, const Vec4V b) +{ + const float32x4_t invB = VRECIPEQ(b); + return vmulq_f32(a, invB); +} + +PX_FORCE_INLINE Vec4V V4Recip(const Vec4V a) +{ + return VRECIPQ(a); +} + +PX_FORCE_INLINE Vec4V V4RecipFast(const Vec4V a) +{ + return VRECIPEQ(a); +} + +PX_FORCE_INLINE Vec4V V4Rsqrt(const Vec4V a) +{ + return VRECIPSQRTQ(a); +} + +PX_FORCE_INLINE Vec4V V4RsqrtFast(const Vec4V a) +{ + return VRECIPSQRTEQ(a); +} + +PX_FORCE_INLINE Vec4V V4Sqrt(const Vec4V a) +{ + return V4Sel(V4IsEq(a, V4Zero()), a, V4Mul(a, VRECIPSQRTQ(a))); +} + +PX_FORCE_INLINE Vec4V V4ScaleAdd(const Vec4V a, const FloatV b, const Vec4V c) +{ + ASSERT_ISVALIDFLOATV(b); + return vmlaq_lane_f32(c, a, b, 0); +} + +PX_FORCE_INLINE Vec4V V4NegScaleSub(const Vec4V a, const FloatV b, const Vec4V c) +{ + ASSERT_ISVALIDFLOATV(b); + return vmlsq_lane_f32(c, a, b, 0); +} + +PX_FORCE_INLINE Vec4V V4MulAdd(const Vec4V a, const Vec4V b, const Vec4V c) +{ + return vmlaq_f32(c, a, b); +} + +PX_FORCE_INLINE Vec4V V4NegMulSub(const Vec4V a, const Vec4V b, const Vec4V c) +{ + return vmlsq_f32(c, a, b); +} + +PX_FORCE_INLINE Vec4V V4Abs(const Vec4V a) +{ + return vabsq_f32(a); +} + +PX_FORCE_INLINE FloatV V4SumElements(const Vec4V a) +{ + const Vec4V xy = V4UnpackXY(a, a); // x,x,y,y + const Vec4V zw = V4UnpackZW(a, a); // z,z,w,w + const Vec4V xz_yw = V4Add(xy, zw); // x+z,x+z,y+w,y+w + const FloatV xz = V4GetX(xz_yw); // x+z + const FloatV yw = V4GetZ(xz_yw); // y+w + return FAdd(xz, yw); // sum +} + +PX_FORCE_INLINE FloatV V4Dot(const Vec4V a, const Vec4V b) +{ + const float32x4_t tmp = vmulq_f32(a, b); + const float32x2_t low = vget_low_f32(tmp); + const float32x2_t high = vget_high_f32(tmp); + + const float32x2_t sumTmp = vpadd_f32(low, high); // = {z+w, x+y} + const float32x2_t sumWZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z+w, x+y+z+w} + return sumWZYX; +} + +PX_FORCE_INLINE FloatV V4Dot3(const Vec4V aa, const Vec4V bb) +{ + // PT: the V3Dot code relies on the fact that W=0 so we can't reuse it as-is, we need to clear W first. + // TODO: find a better implementation that does not need to clear W. + const Vec4V a = V4ClearW(aa); + const Vec4V b = V4ClearW(bb); + + const float32x4_t tmp = vmulq_f32(a, b); + const float32x2_t low = vget_low_f32(tmp); + const float32x2_t high = vget_high_f32(tmp); + + const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} + const float32x2_t sum0ZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} + return sum0ZYX; +} + +PX_FORCE_INLINE Vec4V V4Cross(const Vec4V a, const Vec4V b) +{ + const uint32x2_t TF = { 0xffffFFFF, 0x0 }; + const float32x2_t ay_ax = vget_low_f32(a); // d2 + const float32x2_t aw_az = vget_high_f32(a); // d3 + const float32x2_t by_bx = vget_low_f32(b); // d4 + const float32x2_t bw_bz = vget_high_f32(b); // d5 + // Hi, Lo + const float32x2_t bz_by = vext_f32(by_bx, bw_bz, 1); // bz, by + const float32x2_t az_ay = vext_f32(ay_ax, aw_az, 1); // az, ay + + const float32x2_t azbx = vmul_f32(aw_az, by_bx); // 0, az*bx + const float32x2_t aybz_axby = vmul_f32(ay_ax, bz_by); // ay*bz, ax*by + + const float32x2_t azbxSUBaxbz = vmls_f32(azbx, bw_bz, ay_ax); // 0, az*bx-ax*bz + const float32x2_t aybzSUBazby_axbySUBaybx = vmls_f32(aybz_axby, by_bx, az_ay); // ay*bz-az*by, ax*by-ay*bx + + const float32x2_t retLow = vext_f32(aybzSUBazby_axbySUBaybx, azbxSUBaxbz, 1); // az*bx-ax*bz, ay*bz-az*by + const uint32x2_t retHigh = vand_u32(TF, vreinterpret_u32_f32(aybzSUBazby_axbySUBaybx)); // 0, ax*by-ay*bx + + return vcombine_f32(retLow, vreinterpret_f32_u32(retHigh)); +} + +PX_FORCE_INLINE FloatV V4Length(const Vec4V a) +{ + const float32x4_t tmp = vmulq_f32(a, a); + const float32x2_t low = vget_low_f32(tmp); + const float32x2_t high = vget_high_f32(tmp); + + const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} + const float32x2_t sumWZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} + return FSqrt(sumWZYX); +} + +PX_FORCE_INLINE FloatV V4LengthSq(const Vec4V a) +{ + return V4Dot(a, a); +} + +PX_FORCE_INLINE Vec4V V4Normalize(const Vec4V a) +{ + //PX_ASSERT(!FAllEq(V4LengthSq(a), FZero())); + return V4ScaleInv(a, V4Length(a)); +} + +PX_FORCE_INLINE Vec4V V4NormalizeFast(const Vec4V a) +{ + //PX_ASSERT(!FAllEq(V4LengthSq(a), FZero())); + return V4Scale(a, FRsqrtFast(V4Dot(a, a))); +} + +PX_FORCE_INLINE Vec4V V4NormalizeSafe(const Vec4V a, const Vec4V unsafeReturnValue) +{ + const FloatV zero = FZero(); + const FloatV length = V4Length(a); + const uint32x4_t isGreaterThanZero = FIsGrtr(length, zero); + return V4Sel(isGreaterThanZero, V4ScaleInv(a, length), unsafeReturnValue); +} + +PX_FORCE_INLINE BoolV V4IsEqU32(const VecU32V a, const VecU32V b) +{ + return vceqq_u32(a, b); +} + +PX_FORCE_INLINE Vec4V V4Sel(const BoolV c, const Vec4V a, const Vec4V b) +{ + return vbslq_f32(c, a, b); +} + +PX_FORCE_INLINE BoolV V4IsGrtr(const Vec4V a, const Vec4V b) +{ + return vcgtq_f32(a, b); +} + +PX_FORCE_INLINE BoolV V4IsGrtrOrEq(const Vec4V a, const Vec4V b) +{ + return vcgeq_f32(a, b); +} + +PX_FORCE_INLINE BoolV V4IsEq(const Vec4V a, const Vec4V b) +{ + return vceqq_f32(a, b); +} + +PX_FORCE_INLINE Vec4V V4Max(const Vec4V a, const Vec4V b) +{ + return vmaxq_f32(a, b); +} + +PX_FORCE_INLINE Vec4V V4Min(const Vec4V a, const Vec4V b) +{ + return vminq_f32(a, b); +} + +PX_FORCE_INLINE FloatV V4ExtractMax(const Vec4V a) +{ + const float32x2_t low = vget_low_f32(a); + const float32x2_t high = vget_high_f32(a); + + const float32x2_t max0 = vpmax_f32(high, low); + const float32x2_t max1 = vpmax_f32(max0, max0); + + return max1; +} + +PX_FORCE_INLINE FloatV V4ExtractMin(const Vec4V a) +{ + const float32x2_t low = vget_low_f32(a); + const float32x2_t high = vget_high_f32(a); + + const float32x2_t min0 = vpmin_f32(high, low); + const float32x2_t min1 = vpmin_f32(min0, min0); + + return min1; +} + +PX_FORCE_INLINE Vec4V V4Clamp(const Vec4V a, const Vec4V minV, const Vec4V maxV) +{ + return V4Max(V4Min(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 V4AllGrtr(const Vec4V a, const Vec4V b) +{ + return internalUnitNeonSimd::BAllTrue4_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq(const Vec4V a, const Vec4V b) +{ + return internalUnitNeonSimd::BAllTrue4_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq3(const Vec4V a, const Vec4V b) +{ + return internalUnitNeonSimd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllEq(const Vec4V a, const Vec4V b) +{ + return internalUnitNeonSimd::BAllTrue4_R(V4IsEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AnyGrtr3(const Vec4V a, const Vec4V b) +{ + return internalUnitNeonSimd::BAnyTrue3_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE Vec4V V4Round(const Vec4V a) +{ + // truncate(a + (0.5f - sign(a))) + const Vec4V half = V4Load(0.5f); + const float32x4_t sign = vcvtq_f32_u32((vshrq_n_u32(vreinterpretq_u32_f32(a), 31))); + const Vec4V aPlusHalf = V4Add(a, half); + const Vec4V aRound = V4Sub(aPlusHalf, sign); + return vcvtq_f32_s32(vcvtq_s32_f32(aRound)); +} + +PX_FORCE_INLINE Vec4V V4Sin(const Vec4V a) +{ + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec4V tmp = V4Mul(a, recipTwoPi); + const Vec4V b = V4Round(tmp); + const Vec4V V1 = V4NegMulSub(twoPi, b, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const Vec4V V2 = V4Mul(V1, V1); + const Vec4V V3 = V4Mul(V2, V1); + const Vec4V V5 = V4Mul(V3, V2); + const Vec4V V7 = V4Mul(V5, V2); + const Vec4V V9 = V4Mul(V7, V2); + const Vec4V V11 = V4Mul(V9, V2); + const Vec4V V13 = V4Mul(V11, V2); + const Vec4V V15 = V4Mul(V13, V2); + const Vec4V V17 = V4Mul(V15, V2); + const Vec4V V19 = V4Mul(V17, V2); + const Vec4V V21 = V4Mul(V19, V2); + const Vec4V V23 = V4Mul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + Vec4V Result; + Result = V4ScaleAdd(V3, S1, V1); + Result = V4ScaleAdd(V5, S2, Result); + Result = V4ScaleAdd(V7, S3, Result); + Result = V4ScaleAdd(V9, S4, Result); + Result = V4ScaleAdd(V11, S5, Result); + Result = V4ScaleAdd(V13, S6, Result); + Result = V4ScaleAdd(V15, S7, Result); + Result = V4ScaleAdd(V17, S8, Result); + Result = V4ScaleAdd(V19, S9, Result); + Result = V4ScaleAdd(V21, S10, Result); + Result = V4ScaleAdd(V23, S11, Result); + + return Result; +} + +PX_FORCE_INLINE Vec4V V4Cos(const Vec4V a) +{ + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec4V tmp = V4Mul(a, recipTwoPi); + const Vec4V b = V4Round(tmp); + const Vec4V V1 = V4NegMulSub(twoPi, b, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const Vec4V V2 = V4Mul(V1, V1); + const Vec4V V4 = V4Mul(V2, V2); + const Vec4V V6 = V4Mul(V4, V2); + const Vec4V V8 = V4Mul(V4, V4); + const Vec4V V10 = V4Mul(V6, V4); + const Vec4V V12 = V4Mul(V6, V6); + const Vec4V V14 = V4Mul(V8, V6); + const Vec4V V16 = V4Mul(V8, V8); + const Vec4V V18 = V4Mul(V10, V8); + const Vec4V V20 = V4Mul(V10, V10); + const Vec4V V22 = V4Mul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + Vec4V Result; + Result = V4ScaleAdd(V2, C1, V4One()); + Result = V4ScaleAdd(V4, C2, Result); + Result = V4ScaleAdd(V6, C3, Result); + Result = V4ScaleAdd(V8, C4, Result); + Result = V4ScaleAdd(V10, C5, Result); + Result = V4ScaleAdd(V12, C6, Result); + Result = V4ScaleAdd(V14, C7, Result); + Result = V4ScaleAdd(V16, C8, Result); + Result = V4ScaleAdd(V18, C9, Result); + Result = V4ScaleAdd(V20, C10, Result); + Result = V4ScaleAdd(V22, C11, Result); + + return Result; +} + +PX_FORCE_INLINE void V4Transpose(Vec4V& col0, Vec4V& col1, Vec4V& col2, Vec4V& col3) +{ + const float32x4x2_t v0v1 = vzipq_f32(col0, col2); + const float32x4x2_t v2v3 = vzipq_f32(col1, col3); + const float32x4x2_t zip0 = vzipq_f32(v0v1.val[0], v2v3.val[0]); + const float32x4x2_t zip1 = vzipq_f32(v0v1.val[1], v2v3.val[1]); + col0 = zip0.val[0]; + col1 = zip0.val[1]; + col2 = zip1.val[0]; + col3 = zip1.val[1]; +} + +////////////////////////////////// +// VEC4V +////////////////////////////////// + +PX_FORCE_INLINE BoolV BFFFF() +{ + return vmovq_n_u32(0); +} + +PX_FORCE_INLINE BoolV BFFFT() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t zo = vext_u32(zeros, ones, 1); + return vcombine_u32(zeros, zo); +} + +PX_FORCE_INLINE BoolV BFFTF() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t oz = vext_u32(ones, zeros, 1); + return vcombine_u32(zeros, oz); +} + +PX_FORCE_INLINE BoolV BFFTT() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + return vcombine_u32(zeros, ones); +} + +PX_FORCE_INLINE BoolV BFTFF() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t zo = vext_u32(zeros, ones, 1); + return vcombine_u32(zo, zeros); +} + +PX_FORCE_INLINE BoolV BFTFT() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t zo = vext_u32(zeros, ones, 1); + return vcombine_u32(zo, zo); +} + +PX_FORCE_INLINE BoolV BFTTF() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t zo = vext_u32(zeros, ones, 1); + const uint32x2_t oz = vext_u32(ones, zeros, 1); + return vcombine_u32(zo, oz); +} + +PX_FORCE_INLINE BoolV BFTTT() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t zo = vext_u32(zeros, ones, 1); + return vcombine_u32(zo, ones); +} + +PX_FORCE_INLINE BoolV BTFFF() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + // const uint32x2_t zo = vext_u32(zeros, ones, 1); + const uint32x2_t oz = vext_u32(ones, zeros, 1); + return vcombine_u32(oz, zeros); +} + +PX_FORCE_INLINE BoolV BTFFT() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t zo = vext_u32(zeros, ones, 1); + const uint32x2_t oz = vext_u32(ones, zeros, 1); + return vcombine_u32(oz, zo); +} + +PX_FORCE_INLINE BoolV BTFTF() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t oz = vext_u32(ones, zeros, 1); + return vcombine_u32(oz, oz); +} + +PX_FORCE_INLINE BoolV BTFTT() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t oz = vext_u32(ones, zeros, 1); + return vcombine_u32(oz, ones); +} + +PX_FORCE_INLINE BoolV BTTFF() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + return vcombine_u32(ones, zeros); +} + +PX_FORCE_INLINE BoolV BTTFT() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t zo = vext_u32(zeros, ones, 1); + return vcombine_u32(ones, zo); +} + +PX_FORCE_INLINE BoolV BTTTF() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t oz = vext_u32(ones, zeros, 1); + return vcombine_u32(ones, oz); +} + +PX_FORCE_INLINE BoolV BTTTT() +{ + return vmovq_n_u32(0xffffFFFF); +} + +PX_FORCE_INLINE BoolV BXMask() +{ + return BTFFF(); +} + +PX_FORCE_INLINE BoolV BYMask() +{ + return BFTFF(); +} + +PX_FORCE_INLINE BoolV BZMask() +{ + return BFFTF(); +} + +PX_FORCE_INLINE BoolV BWMask() +{ + return BFFFT(); +} + +PX_FORCE_INLINE BoolV BGetX(const BoolV f) +{ + const uint32x2_t fLow = vget_low_u32(f); + return vdupq_lane_u32(fLow, 0); +} + +PX_FORCE_INLINE BoolV BGetY(const BoolV f) +{ + const uint32x2_t fLow = vget_low_u32(f); + return vdupq_lane_u32(fLow, 1); +} + +PX_FORCE_INLINE BoolV BGetZ(const BoolV f) +{ + const uint32x2_t fHigh = vget_high_u32(f); + return vdupq_lane_u32(fHigh, 0); +} + +PX_FORCE_INLINE BoolV BGetW(const BoolV f) +{ + const uint32x2_t fHigh = vget_high_u32(f); + return vdupq_lane_u32(fHigh, 1); +} + +PX_FORCE_INLINE BoolV BSetX(const BoolV v, const BoolV f) +{ + return vbslq_u32(BFTTT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetY(const BoolV v, const BoolV f) +{ + return vbslq_u32(BTFTT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetZ(const BoolV v, const BoolV f) +{ + return vbslq_u32(BTTFT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetW(const BoolV v, const BoolV f) +{ + return vbslq_u32(BTTTF(), v, f); +} + +PX_FORCE_INLINE BoolV BAnd(const BoolV a, const BoolV b) +{ + return vandq_u32(a, b); +} + +PX_FORCE_INLINE BoolV BNot(const BoolV a) +{ + return vmvnq_u32(a); +} + +PX_FORCE_INLINE BoolV BAndNot(const BoolV a, const BoolV b) +{ + // return vbicq_u32(a, b); + return vandq_u32(a, vmvnq_u32(b)); +} + +PX_FORCE_INLINE BoolV BOr(const BoolV a, const BoolV b) +{ + return vorrq_u32(a, b); +} + +PX_FORCE_INLINE BoolV BAllTrue4(const BoolV a) +{ + const uint32x2_t allTrue = vmov_n_u32(0xffffFFFF); + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + const uint32x2_t result = vceq_u32(finalReduce, allTrue); + return vdupq_lane_u32(result, 0); +} + +PX_FORCE_INLINE BoolV BAnyTrue4(const BoolV a) +{ + const uint32x2_t allTrue = vmov_n_u32(0xffffFFFF); + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + const uint32x2_t result = vtst_u32(finalReduce, allTrue); + return vdupq_lane_u32(result, 0); +} + +PX_FORCE_INLINE BoolV BAllTrue3(const BoolV a) +{ + const uint32x2_t allTrue3 = vmov_n_u32(0x00ffFFFF); + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + const uint32x2_t result = vceq_u32(vand_u32(finalReduce, allTrue3), allTrue3); + return vdupq_lane_u32(result, 0); +} + +PX_FORCE_INLINE BoolV BAnyTrue3(const BoolV a) +{ + const uint32x2_t allTrue3 = vmov_n_u32(0x00ffFFFF); + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + const uint32x2_t result = vtst_u32(vand_u32(finalReduce, allTrue3), allTrue3); + return vdupq_lane_u32(result, 0); +} + +PX_FORCE_INLINE PxU32 BAllEq(const BoolV a, const BoolV b) +{ + const BoolV bTest = vceqq_u32(a, b); + return internalUnitNeonSimd::BAllTrue4_R(bTest); +} + +PX_FORCE_INLINE PxU32 BAllEqTTTT(const BoolV a) +{ + return BAllEq(a, BTTTT()); +} + +PX_FORCE_INLINE PxU32 BAllEqFFFF(const BoolV a) +{ + return BAllEq(a, BFFFF()); +} + +PX_FORCE_INLINE PxU32 BGetBitMask(const BoolV a) +{ + static PX_ALIGN(16, const PxU32) bitMaskData[4] = { 1, 2, 4, 8 }; + const uint32x4_t bitMask = *(reinterpret_cast(bitMaskData)); + const uint32x4_t t0 = vandq_u32(a, bitMask); + const uint32x2_t t1 = vpadd_u32(vget_low_u32(t0), vget_high_u32(t0)); // Pairwise add (0 + 1), (2 + 3) + return PxU32(vget_lane_u32(vpadd_u32(t1, t1), 0)); +} + +////////////////////////////////// +// MAT33V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M33MulV3(const Mat33V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + return V3Add(v0PlusV1, v2); +} + +PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b) +{ + const FloatV x = V3Dot(a.col0, b); + const FloatV y = V3Dot(a.col1, b); + const FloatV z = V3Dot(a.col2, b); + return V3Merge(x, y, z); +} + +PX_FORCE_INLINE Vec3V M33MulV3AddV3(const Mat33V& A, const Vec3V b, const Vec3V c) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + Vec3V result = V3ScaleAdd(A.col0, x, c); + result = V3ScaleAdd(A.col1, y, result); + return V3ScaleAdd(A.col2, z, result); +} + +PX_FORCE_INLINE Mat33V M33MulM33(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(M33MulV3(a, b.col0), M33MulV3(a, b.col1), M33MulV3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Add(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Scale(const Mat33V& a, const FloatV& b) +{ + return Mat33V(V3Scale(a.col0, b), V3Scale(a.col1, b), V3Scale(a.col2, b)); +} + +PX_FORCE_INLINE Mat33V M33Inverse(const Mat33V& a) +{ + const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); + const BoolV btttf = BTTTF(); + + const Vec3V cross01 = V3Cross(a.col0, a.col1); + const Vec3V cross12 = V3Cross(a.col1, a.col2); + const Vec3V cross20 = V3Cross(a.col2, a.col0); + const FloatV dot = V3Dot(cross01, a.col2); + const FloatV invDet = FRecipFast(dot); + + const float32x4x2_t merge = vzipq_f32(cross12, cross01); + const float32x4_t mergeh = merge.val[0]; + const float32x4_t mergel = merge.val[1]; + + // const Vec3V colInv0 = XMVectorPermute(mergeh,cross20,PxPermuteControl(0,4,1,7)); + const float32x4_t colInv0_xxyy = vzipq_f32(mergeh, cross20).val[0]; + const float32x4_t colInv0 = vreinterpretq_f32_u32(vandq_u32(vreinterpretq_u32_f32(colInv0_xxyy), btttf)); + + // const Vec3V colInv1 = XMVectorPermute(mergeh,cross20,PxPermuteControl(2,5,3,7)); + const float32x2_t zw0 = vget_high_f32(mergeh); + const float32x2_t xy1 = vget_low_f32(cross20); + const float32x2_t yzero1 = vext_f32(xy1, zeros, 1); + const float32x2x2_t merge1 = vzip_f32(zw0, yzero1); + const float32x4_t colInv1 = vcombine_f32(merge1.val[0], merge1.val[1]); + + // const Vec3V colInv2 = XMVectorPermute(mergel,cross20,PxPermuteControl(0,6,1,7)); + const float32x2_t x0y0 = vget_low_f32(mergel); + const float32x2_t z1w1 = vget_high_f32(cross20); + const float32x2x2_t merge2 = vzip_f32(x0y0, z1w1); + const float32x4_t colInv2 = vcombine_f32(merge2.val[0], merge2.val[1]); + + return Mat33V(vmulq_lane_f32(colInv0, invDet, 0), vmulq_lane_f32(colInv1, invDet, 0), + vmulq_lane_f32(colInv2, invDet, 0)); +} + +PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a) +{ + return Mat33V(V3Merge(V3GetX(a.col0), V3GetX(a.col1), V3GetX(a.col2)), + V3Merge(V3GetY(a.col0), V3GetY(a.col1), V3GetY(a.col2)), + V3Merge(V3GetZ(a.col0), V3GetZ(a.col1), V3GetZ(a.col2))); +} + +PX_FORCE_INLINE Mat33V M33Identity() +{ + return Mat33V(V3UnitX(), V3UnitY(), V3UnitZ()); +} + +PX_FORCE_INLINE Mat33V M33Sub(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(V3Sub(a.col0, b.col0), V3Sub(a.col1, b.col1), V3Sub(a.col2, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Neg(const Mat33V& a) +{ + return Mat33V(V3Neg(a.col0), V3Neg(a.col1), V3Neg(a.col2)); +} + +PX_FORCE_INLINE Mat33V M33Abs(const Mat33V& a) +{ + return Mat33V(V3Abs(a.col0), V3Abs(a.col1), V3Abs(a.col2)); +} + +PX_FORCE_INLINE Mat33V PromoteVec3V(const Vec3V v) +{ + const BoolV bTFFF = BTFFF(); + const BoolV bFTFF = BFTFF(); + const BoolV bFFTF = BTFTF(); + + const Vec3V zero = V3Zero(); + + return Mat33V(V3Sel(bTFFF, v, zero), V3Sel(bFTFF, v, zero), V3Sel(bFFTF, v, zero)); +} + +PX_FORCE_INLINE Mat33V M33Diagonal(const Vec3VArg d) +{ + const Vec3V x = V3Mul(V3UnitX(), d); + const Vec3V y = V3Mul(V3UnitY(), d); + const Vec3V z = V3Mul(V3UnitZ(), d); + return Mat33V(x, y, z); +} + +////////////////////////////////// +// MAT34V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M34MulV3(const Mat34V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + const Vec3V v0PlusV1Plusv2 = V3Add(v0PlusV1, v2); + return V3Add(v0PlusV1Plusv2, a.col3); +} + +PX_FORCE_INLINE Vec3V M34Mul33V3(const Mat34V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + return V3Add(v0PlusV1, v2); +} + +PX_FORCE_INLINE Vec3V M34TrnspsMul33V3(const Mat34V& a, const Vec3V b) +{ + const FloatV x = V3Dot(a.col0, b); + const FloatV y = V3Dot(a.col1, b); + const FloatV z = V3Dot(a.col2, b); + return V3Merge(x, y, z); +} + +PX_FORCE_INLINE Mat34V M34MulM34(const Mat34V& a, const Mat34V& b) +{ + return Mat34V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2), M34MulV3(a, b.col3)); +} + +PX_FORCE_INLINE Mat33V M34MulM33(const Mat34V& a, const Mat33V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M34Mul33MM34(const Mat34V& a, const Mat34V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat34V M34Add(const Mat34V& a, const Mat34V& b) +{ + return Mat34V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2), V3Add(a.col3, b.col3)); +} + +PX_FORCE_INLINE Mat33V M34Trnsps33(const Mat34V& a) +{ + return Mat33V(V3Merge(V3GetX(a.col0), V3GetX(a.col1), V3GetX(a.col2)), + V3Merge(V3GetY(a.col0), V3GetY(a.col1), V3GetY(a.col2)), + V3Merge(V3GetZ(a.col0), V3GetZ(a.col1), V3GetZ(a.col2))); +} + +////////////////////////////////// +// MAT44V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V M44MulV4(const Mat44V& a, const Vec4V b) +{ + const FloatV x = V4GetX(b); + const FloatV y = V4GetY(b); + const FloatV z = V4GetZ(b); + const FloatV w = V4GetW(b); + + const Vec4V v0 = V4Scale(a.col0, x); + const Vec4V v1 = V4Scale(a.col1, y); + const Vec4V v2 = V4Scale(a.col2, z); + const Vec4V v3 = V4Scale(a.col3, w); + const Vec4V v0PlusV1 = V4Add(v0, v1); + const Vec4V v0PlusV1Plusv2 = V4Add(v0PlusV1, v2); + return V4Add(v0PlusV1Plusv2, v3); +} + +PX_FORCE_INLINE Vec4V M44TrnspsMulV4(const Mat44V& a, const Vec4V b) +{ + return V4Merge(V4Dot(a.col0, b), V4Dot(a.col1, b), V4Dot(a.col2, b), V4Dot(a.col3, b)); +} + +PX_FORCE_INLINE Mat44V M44MulM44(const Mat44V& a, const Mat44V& b) +{ + return Mat44V(M44MulV4(a, b.col0), M44MulV4(a, b.col1), M44MulV4(a, b.col2), M44MulV4(a, b.col3)); +} + +PX_FORCE_INLINE Mat44V M44Add(const Mat44V& a, const Mat44V& b) +{ + return Mat44V(V4Add(a.col0, b.col0), V4Add(a.col1, b.col1), V4Add(a.col2, b.col2), V4Add(a.col3, b.col3)); +} + +PX_FORCE_INLINE Mat44V M44Trnsps(const Mat44V& a) +{ + // asm volatile( + // "vzip.f32 %q0, %q2 \n\t" + // "vzip.f32 %q1, %q3 \n\t" + // "vzip.f32 %q0, %q1 \n\t" + // "vzip.f32 %q2, %q3 \n\t" + // : "+w" (a.col0), "+w" (a.col1), "+w" (a.col2), "+w" a.col3)); + + const float32x4x2_t v0v1 = vzipq_f32(a.col0, a.col2); + const float32x4x2_t v2v3 = vzipq_f32(a.col1, a.col3); + const float32x4x2_t zip0 = vzipq_f32(v0v1.val[0], v2v3.val[0]); + const float32x4x2_t zip1 = vzipq_f32(v0v1.val[1], v2v3.val[1]); + + return Mat44V(zip0.val[0], zip0.val[1], zip1.val[0], zip1.val[1]); +} + +PX_FORCE_INLINE Mat44V M44Inverse(const Mat44V& a) +{ + float32x4_t minor0, minor1, minor2, minor3; + float32x4_t row0, row1, row2, row3; + float32x4_t det, tmp1; + + tmp1 = vmovq_n_f32(0.0f); + row1 = vmovq_n_f32(0.0f); + row3 = vmovq_n_f32(0.0f); + + row0 = a.col0; + row1 = vextq_f32(a.col1, a.col1, 2); + row2 = a.col2; + row3 = vextq_f32(a.col3, a.col3, 2); + + tmp1 = vmulq_f32(row2, row3); + tmp1 = vrev64q_f32(tmp1); + minor0 = vmulq_f32(row1, tmp1); + minor1 = vmulq_f32(row0, tmp1); + tmp1 = vextq_f32(tmp1, tmp1, 2); + minor0 = vsubq_f32(vmulq_f32(row1, tmp1), minor0); + minor1 = vsubq_f32(vmulq_f32(row0, tmp1), minor1); + minor1 = vextq_f32(minor1, minor1, 2); + + tmp1 = vmulq_f32(row1, row2); + tmp1 = vrev64q_f32(tmp1); + minor0 = vaddq_f32(vmulq_f32(row3, tmp1), minor0); + minor3 = vmulq_f32(row0, tmp1); + tmp1 = vextq_f32(tmp1, tmp1, 2); + minor0 = vsubq_f32(minor0, vmulq_f32(row3, tmp1)); + minor3 = vsubq_f32(vmulq_f32(row0, tmp1), minor3); + minor3 = vextq_f32(minor3, minor3, 2); + + tmp1 = vmulq_f32(vextq_f32(row1, row1, 2), row3); + tmp1 = vrev64q_f32(tmp1); + row2 = vextq_f32(row2, row2, 2); + minor0 = vaddq_f32(vmulq_f32(row2, tmp1), minor0); + minor2 = vmulq_f32(row0, tmp1); + tmp1 = vextq_f32(tmp1, tmp1, 2); + minor0 = vsubq_f32(minor0, vmulq_f32(row2, tmp1)); + minor2 = vsubq_f32(vmulq_f32(row0, tmp1), minor2); + minor2 = vextq_f32(minor2, minor2, 2); + + tmp1 = vmulq_f32(row0, row1); + tmp1 = vrev64q_f32(tmp1); + minor2 = vaddq_f32(vmulq_f32(row3, tmp1), minor2); + minor3 = vsubq_f32(vmulq_f32(row2, tmp1), minor3); + tmp1 = vextq_f32(tmp1, tmp1, 2); + minor2 = vsubq_f32(vmulq_f32(row3, tmp1), minor2); + minor3 = vsubq_f32(minor3, vmulq_f32(row2, tmp1)); + + tmp1 = vmulq_f32(row0, row3); + tmp1 = vrev64q_f32(tmp1); + minor1 = vsubq_f32(minor1, vmulq_f32(row2, tmp1)); + minor2 = vaddq_f32(vmulq_f32(row1, tmp1), minor2); + tmp1 = vextq_f32(tmp1, tmp1, 2); + minor1 = vaddq_f32(vmulq_f32(row2, tmp1), minor1); + minor2 = vsubq_f32(minor2, vmulq_f32(row1, tmp1)); + + tmp1 = vmulq_f32(row0, row2); + tmp1 = vrev64q_f32(tmp1); + minor1 = vaddq_f32(vmulq_f32(row3, tmp1), minor1); + minor3 = vsubq_f32(minor3, vmulq_f32(row1, tmp1)); + tmp1 = vextq_f32(tmp1, tmp1, 2); + minor1 = vsubq_f32(minor1, vmulq_f32(row3, tmp1)); + minor3 = vaddq_f32(vmulq_f32(row1, tmp1), minor3); + + det = vmulq_f32(row0, minor0); + det = vaddq_f32(vextq_f32(det, det, 2), det); + det = vaddq_f32(vrev64q_f32(det), det); + det = vdupq_lane_f32(VRECIPE(vget_low_f32(det)), 0); + + minor0 = vmulq_f32(det, minor0); + minor1 = vmulq_f32(det, minor1); + minor2 = vmulq_f32(det, minor2); + minor3 = vmulq_f32(det, minor3); + Mat44V invTrans(minor0, minor1, minor2, minor3); + return M44Trnsps(invTrans); +} + +PX_FORCE_INLINE Vec4V V4LoadXYZW(const PxF32& x, const PxF32& y, const PxF32& z, const PxF32& w) +{ + const float32x4_t ret = { x, y, z, w }; + return ret; +} + +/* +PX_FORCE_INLINE VecU16V V4U32PK(VecU32V a, VecU32V b) +{ + return vcombine_u16(vqmovn_u32(a), vqmovn_u32(b)); +} +*/ + +PX_FORCE_INLINE VecU32V V4U32Sel(const BoolV c, const VecU32V a, const VecU32V b) +{ + return vbslq_u32(c, a, b); +} + +PX_FORCE_INLINE VecU32V V4U32or(VecU32V a, VecU32V b) +{ + return vorrq_u32(a, b); +} + +PX_FORCE_INLINE VecU32V V4U32xor(VecU32V a, VecU32V b) +{ + return veorq_u32(a, b); +} + +PX_FORCE_INLINE VecU32V V4U32and(VecU32V a, VecU32V b) +{ + return vandq_u32(a, b); +} + +PX_FORCE_INLINE VecU32V V4U32Andc(VecU32V a, VecU32V b) +{ + // return vbicq_u32(a, b); // creates gcc compiler bug in RTreeQueries.cpp + return vandq_u32(a, vmvnq_u32(b)); +} + +/* +PX_FORCE_INLINE VecU16V V4U16Or(VecU16V a, VecU16V b) +{ + return vorrq_u16(a, b); +} +*/ + +/* +PX_FORCE_INLINE VecU16V V4U16And(VecU16V a, VecU16V b) +{ + return vandq_u16(a, b); +} +*/ +/* +PX_FORCE_INLINE VecU16V V4U16Andc(VecU16V a, VecU16V b) +{ + return vbicq_u16(a, b); +} +*/ + +PX_FORCE_INLINE VecI32V I4LoadXYZW(const PxI32& x, const PxI32& y, const PxI32& z, const PxI32& w) +{ + const int32x4_t ret = { x, y, z, w }; + return ret; +} + +PX_FORCE_INLINE VecI32V I4Load(const PxI32 i) +{ + return vdupq_n_s32(i); +} + +PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i) +{ + return vld1q_s32(i); +} + +PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i) +{ + return vld1q_s32(i); +} + +PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b) +{ + return vaddq_s32(a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b) +{ + return vsubq_s32(a, b); +} + +PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b) +{ + return vcgtq_s32(a, b); +} + +PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b) +{ + return vceqq_s32(a, b); +} + +PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b) +{ + return vbslq_s32(c, a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_Zero() +{ + return vdupq_n_s32(0); +} + +PX_FORCE_INLINE VecI32V VecI32V_One() +{ + return vdupq_n_s32(1); +} + +PX_FORCE_INLINE VecI32V VecI32V_Two() +{ + return vdupq_n_s32(2); +} + +PX_FORCE_INLINE VecI32V VecI32V_MinusOne() +{ + return vdupq_n_s32(-1); +} + +PX_FORCE_INLINE VecU32V U4Zero() +{ + return U4Load(0); +} + +PX_FORCE_INLINE VecU32V U4One() +{ + return U4Load(1); +} + +PX_FORCE_INLINE VecU32V U4Two() +{ + return U4Load(2); +} + +PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift) +{ + return shift; +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const VecShiftVArg count) +{ + return vshlq_s32(a, count); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg count) +{ + return vshlq_s32(a, VecI32V_Sub(I4Load(0), count)); +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const PxU32 count) +{ + const int32x4_t shiftCount = { (PxI32)count, (PxI32)count, (PxI32)count, (PxI32)count }; + return vshlq_s32(a, shiftCount); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const PxU32 count) +{ + const int32x4_t shiftCount = { -(PxI32)count, -(PxI32)count, -(PxI32)count, -(PxI32)count }; + return vshlq_s32(a, shiftCount); +} + +PX_FORCE_INLINE VecI32V VecI32V_And(const VecI32VArg a, const VecI32VArg b) +{ + return vandq_s32(a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b) +{ + return vorrq_s32(a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg f) +{ + const int32x2_t fLow = vget_low_s32(f); + return vdupq_lane_s32(fLow, 0); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg f) +{ + const int32x2_t fLow = vget_low_s32(f); + return vdupq_lane_s32(fLow, 1); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg f) +{ + const int32x2_t fHigh = vget_high_s32(f); + return vdupq_lane_s32(fHigh, 0); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg f) +{ + const int32x2_t fHigh = vget_high_s32(f); + return vdupq_lane_s32(fHigh, 1); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sel(const BoolV c, const VecI32VArg a, const VecI32VArg b) +{ + return vbslq_s32(c, a, b); +} + +PX_FORCE_INLINE void PxI32_From_VecI32V(const VecI32VArg a, PxI32* i) +{ + *i = vgetq_lane_s32(a, 0); +} + +PX_FORCE_INLINE VecI32V VecI32V_Merge(const VecI32VArg a, const VecI32VArg b, const VecI32VArg c, const VecI32VArg d) +{ + const int32x2_t aLow = vget_low_s32(a); + const int32x2_t bLow = vget_low_s32(b); + const int32x2_t cLow = vget_low_s32(c); + const int32x2_t dLow = vget_low_s32(d); + + const int32x2_t low = vext_s32(aLow, bLow, 1); + const int32x2_t high = vext_s32(cLow, dLow, 1); + + return vcombine_s32(low, high); +} + +PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg a) +{ + return vreinterpretq_s32_u32(a); +} + +PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg a) +{ + return a; +} + +/* +template PX_FORCE_INLINE VecI32V V4ISplat() +{ + return vdupq_n_s32(a); +} + +template PX_FORCE_INLINE VecU32V V4USplat() +{ + return vdupq_n_u32(a); +} +*/ + +/* +PX_FORCE_INLINE void V4U16StoreAligned(VecU16V val, VecU16V* address) +{ + vst1q_u16((uint16_t*)address, val); +} +*/ + +PX_FORCE_INLINE void V4U32StoreAligned(VecU32V val, VecU32V* address) +{ + vst1q_u32(reinterpret_cast(address), val); +} + +PX_FORCE_INLINE Vec4V V4LoadAligned(Vec4V* addr) +{ + return vld1q_f32(reinterpret_cast(addr)); +} + +PX_FORCE_INLINE Vec4V V4LoadUnaligned(Vec4V* addr) +{ + return vld1q_f32(reinterpret_cast(addr)); +} + +PX_FORCE_INLINE Vec4V V4Andc(const Vec4V a, const VecU32V b) +{ + return vreinterpretq_f32_u32(V4U32Andc(vreinterpretq_u32_f32(a), b)); +} + +PX_FORCE_INLINE VecU32V V4IsGrtrV32u(const Vec4V a, const Vec4V b) +{ + return V4IsGrtr(a, b); +} + +PX_FORCE_INLINE VecU16V V4U16LoadAligned(VecU16V* addr) +{ + return vld1q_u16(reinterpret_cast(addr)); +} + +PX_FORCE_INLINE VecU16V V4U16LoadUnaligned(VecU16V* addr) +{ + return vld1q_u16(reinterpret_cast(addr)); +} + +PX_FORCE_INLINE VecU16V V4U16CompareGt(VecU16V a, VecU16V b) +{ + return vcgtq_u16(a, b); +} + +PX_FORCE_INLINE VecU16V V4I16CompareGt(VecI16V a, VecI16V b) +{ + return vcgtq_s16(a, b); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_VecU32V(VecU32V a) +{ + return vcvtq_f32_u32(a); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V a) +{ + return vcvtq_f32_s32(a); +} + +PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a) +{ + return vcvtq_s32_f32(a); +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a) +{ + return vreinterpretq_f32_u32(a); +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a) +{ + return vreinterpretq_f32_s32(a); +} + +PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + return vreinterpretq_u32_f32(a); +} + +PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + return vreinterpretq_s32_f32(a); +} + +#if !PX_SWITCH +template +PX_FORCE_INLINE BoolV BSplatElement(BoolV a) +{ + if(index < 2) + { + return vdupq_lane_u32(vget_low_u32(a), index); + } + else if(index == 2) + { + return vdupq_lane_u32(vget_high_u32(a), 0); + } + else if(index == 3) + { + return vdupq_lane_u32(vget_high_u32(a), 1); + } +} +#else +//workaround for template compile issue +template PX_FORCE_INLINE BoolV BSplatElement(BoolV a); +template<> PX_FORCE_INLINE BoolV BSplatElement<0>(BoolV a) { return vdupq_lane_u32(vget_low_u32(a), 0); } +template<> PX_FORCE_INLINE BoolV BSplatElement<1>(BoolV a) { return vdupq_lane_u32(vget_low_u32(a), 1); } +template<> PX_FORCE_INLINE BoolV BSplatElement<2>(BoolV a) { return vdupq_lane_u32(vget_high_u32(a), 0); } +template<> PX_FORCE_INLINE BoolV BSplatElement<3>(BoolV a) { return vdupq_lane_u32(vget_high_u32(a), 1); } +#endif + +#if !PX_SWITCH +template +PX_FORCE_INLINE VecU32V V4U32SplatElement(VecU32V a) +{ + if(index < 2) + { + return vdupq_lane_u32(vget_low_u32(a), index); + } + else if(index == 2) + { + return vdupq_lane_u32(vget_high_u32(a), 0); + } + else if(index == 3) + { + return vdupq_lane_u32(vget_high_u32(a), 1); + } +} +#else +//workaround for template compile issue +template PX_FORCE_INLINE VecU32V V4U32SplatElement(VecU32V a); +template <> PX_FORCE_INLINE VecU32V V4U32SplatElement<0>(VecU32V a) { return vdupq_lane_u32(vget_low_u32(a), 0); } +template <> PX_FORCE_INLINE VecU32V V4U32SplatElement<1>(VecU32V a) { return vdupq_lane_u32(vget_low_u32(a), 1); } +template <> PX_FORCE_INLINE VecU32V V4U32SplatElement<2>(VecU32V a) { return vdupq_lane_u32(vget_high_u32(a), 0); } +template <> PX_FORCE_INLINE VecU32V V4U32SplatElement<3>(VecU32V a) { return vdupq_lane_u32(vget_high_u32(a), 1); } +#endif + +#if !PX_SWITCH +template +PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a) +{ + if(index < 2) + { + return vdupq_lane_f32(vget_low_f32(a), index); + } + else if(index == 2) + { + return vdupq_lane_f32(vget_high_f32(a), 0); + } + else if(index == 3) + { + return vdupq_lane_f32(vget_high_f32(a), 1); + } +} +#else +//workaround for template compile issue +template PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a); +template <> PX_FORCE_INLINE Vec4V V4SplatElement<0>(Vec4V a) { return vdupq_lane_f32(vget_low_f32(a), 0); } +template <> PX_FORCE_INLINE Vec4V V4SplatElement<1>(Vec4V a) { return vdupq_lane_f32(vget_low_f32(a), 1); } +template <> PX_FORCE_INLINE Vec4V V4SplatElement<2>(Vec4V a) { return vdupq_lane_f32(vget_high_f32(a), 0); } +template <> PX_FORCE_INLINE Vec4V V4SplatElement<3>(Vec4V a) { return vdupq_lane_f32(vget_high_f32(a), 1); } +#endif + +PX_FORCE_INLINE VecU32V U4LoadXYZW(PxU32 x, PxU32 y, PxU32 z, PxU32 w) +{ + const uint32x4_t ret = { x, y, z, w }; + return ret; +} + +PX_FORCE_INLINE VecU32V U4Load(const PxU32 i) +{ + return vdupq_n_u32(i); +} + +PX_FORCE_INLINE VecU32V U4LoadU(const PxU32* i) +{ + return vld1q_u32(i); +} + +PX_FORCE_INLINE VecU32V U4LoadA(const PxU32* i) +{ + return vld1q_u32(i); +} + +PX_FORCE_INLINE Vec4V V4Ceil(const Vec4V in) +{ + const float32x4_t ones = vdupq_n_f32(1.0f); + const float32x4_t rdToZero = vcvtq_f32_s32(vcvtq_s32_f32(in)); + const float32x4_t rdToZeroPlusOne = vaddq_f32(rdToZero, ones); + const uint32x4_t gt = vcgtq_f32(in, rdToZero); + return vbslq_f32(gt, rdToZeroPlusOne, rdToZero); +} + +PX_FORCE_INLINE Vec4V V4Floor(const Vec4V in) +{ + const float32x4_t ones = vdupq_n_f32(1.0f); + const float32x4_t rdToZero = vcvtq_f32_s32(vcvtq_s32_f32(in)); + const float32x4_t rdToZeroMinusOne = vsubq_f32(rdToZero, ones); + const uint32x4_t lt = vcltq_f32(in, rdToZero); + return vbslq_f32(lt, rdToZeroMinusOne, rdToZero); +} + +PX_FORCE_INLINE VecU32V V4ConvertToU32VSaturate(const Vec4V in, PxU32 power) +{ + PX_ASSERT(power == 0 && "Non-zero power not supported in convertToU32VSaturate"); + PX_UNUSED(power); // prevent warning in release builds + + return vcvtq_u32_f32(in); +} + +PX_FORCE_INLINE void QuatGetMat33V(const QuatVArg q, Vec3V& column0, Vec3V& column1, Vec3V& column2) +{ + const FloatV one = FOne(); + const FloatV x = V4GetX(q); + const FloatV y = V4GetY(q); + const FloatV z = V4GetZ(q); + const FloatV w = V4GetW(q); + + const FloatV x2 = FAdd(x, x); + const FloatV y2 = FAdd(y, y); + const FloatV z2 = FAdd(z, z); + + const FloatV xx = FMul(x2, x); + const FloatV yy = FMul(y2, y); + const FloatV zz = FMul(z2, z); + + const FloatV xy = FMul(x2, y); + const FloatV xz = FMul(x2, z); + const FloatV xw = FMul(x2, w); + + const FloatV yz = FMul(y2, z); + const FloatV yw = FMul(y2, w); + const FloatV zw = FMul(z2, w); + + const FloatV v = FSub(one, xx); + + column0 = V3Merge(FSub(FSub(one, yy), zz), FAdd(xy, zw), FSub(xz, yw)); + column1 = V3Merge(FSub(xy, zw), FSub(v, zz), FAdd(yz, xw)); + column2 = V3Merge(FAdd(xz, yw), FSub(yz, xw), FSub(v, yy)); +} + +} // namespace aos +} // namespace physx + +#endif // PXFOUNDATION_PXUNIXNEONINLINEAOS_H diff --git a/engine/third_party/physx/include/foundation/unix/sse2/PxUnixSse2AoS.h b/engine/third_party/physx/include/foundation/unix/sse2/PxUnixSse2AoS.h new file mode 100644 index 00000000..f7b761af --- /dev/null +++ b/engine/third_party/physx/include/foundation/unix/sse2/PxUnixSse2AoS.h @@ -0,0 +1,187 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PXFOUNDATION_PXUNIXSSE2AOS_H +#define PXFOUNDATION_PXUNIXSSE2AOS_H + +// no includes here! this file should be included from PxcVecMath.h only!!! + +#if !COMPILE_VECTOR_INTRINSICS +#error Vector intrinsics should not be included when using scalar implementation. +#endif + +namespace physx +{ +namespace aos +{ + +#if PX_EMSCRIPTEN +typedef int8_t __int8_t; +typedef int16_t __int16_t; +typedef int32_t __int32_t; +typedef int64_t __int64_t; +typedef uint16_t __uint16_t; +typedef uint32_t __uint32_t; +typedef uint64_t __uint64_t; +#endif + +typedef union UnionM128 +{ + UnionM128() + { + } + UnionM128(__m128 in) + { + m128 = in; + } + + UnionM128(__m128i in) + { + m128i = in; + } + + operator __m128() + { + return m128; + } + + operator __m128() const + { + return m128; + } + + float m128_f32[4]; + __int8_t m128_i8[16]; + __int16_t m128_i16[8]; + __int32_t m128_i32[4]; + __int64_t m128_i64[2]; + __uint16_t m128_u16[8]; + __uint32_t m128_u32[4]; + __uint64_t m128_u64[2]; + __m128 m128; + __m128i m128i; +} UnionM128; + +typedef __m128 FloatV; +typedef __m128 Vec3V; +typedef __m128 Vec4V; +typedef __m128 BoolV; +typedef __m128 QuatV; +typedef __m128i VecI32V; +typedef UnionM128 VecU32V; +typedef UnionM128 VecU16V; +typedef UnionM128 VecI16V; +typedef UnionM128 VecU8V; + +#define FloatVArg FloatV & +#define Vec3VArg Vec3V & +#define Vec4VArg Vec4V & +#define BoolVArg BoolV & +#define VecU32VArg VecU32V & +#define VecI32VArg VecI32V & +#define VecU16VArg VecU16V & +#define VecI16VArg VecI16V & +#define VecU8VArg VecU8V & +#define QuatVArg QuatV & + +// Optimization for situations in which you cross product multiple vectors with the same vector. +// Avoids 2X shuffles per product +struct VecCrossV +{ + Vec3V mL1; + Vec3V mR1; +}; + +struct VecShiftV +{ + VecI32V shift; +}; +#define VecShiftVArg VecShiftV & + +PX_ALIGN_PREFIX(16) +struct Mat33V +{ + Mat33V() + { + } + Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec3V PX_ALIGN(16, col0); + Vec3V PX_ALIGN(16, col1); + Vec3V PX_ALIGN(16, col2); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat34V +{ + Mat34V() + { + } + Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec3V PX_ALIGN(16, col0); + Vec3V PX_ALIGN(16, col1); + Vec3V PX_ALIGN(16, col2); + Vec3V PX_ALIGN(16, col3); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat43V +{ + Mat43V() + { + } + Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec4V PX_ALIGN(16, col0); + Vec4V PX_ALIGN(16, col1); + Vec4V PX_ALIGN(16, col2); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat44V +{ + Mat44V() + { + } + Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec4V PX_ALIGN(16, col0); + Vec4V PX_ALIGN(16, col1); + Vec4V PX_ALIGN(16, col2); + Vec4V PX_ALIGN(16, col3); +} PX_ALIGN_SUFFIX(16); + +} // namespace aos +} // namespace physx + +#endif // PXFOUNDATION_PXUNIXSSE2AOS_H diff --git a/engine/third_party/physx/include/foundation/unix/sse2/PxUnixSse2InlineAoS.h b/engine/third_party/physx/include/foundation/unix/sse2/PxUnixSse2InlineAoS.h new file mode 100644 index 00000000..4f2b881c --- /dev/null +++ b/engine/third_party/physx/include/foundation/unix/sse2/PxUnixSse2InlineAoS.h @@ -0,0 +1,719 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PXFOUNDATION_PXUNIXSSE2INLINEAOS_H +#define PXFOUNDATION_PXUNIXSSE2INLINEAOS_H + +namespace physx +{ +namespace aos +{ +////////////////////////////////////////////////////////////////////// +//Test that Vec3V and FloatV are legal +////////////////////////////////////////////////////////////////////// + +#define FLOAT_COMPONENTS_EQUAL_THRESHOLD 0.01f +PX_FORCE_INLINE static bool isValidFloatV(const FloatV a) +{ + const PxF32 x = V4ReadX(a); + const PxF32 y = V4ReadY(a); + const PxF32 z = V4ReadZ(a); + const PxF32 w = V4ReadW(a); + + return (x == y && x == z && x == w); + + /*if ( + (PxAbs(x - y) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && + (PxAbs(x - z) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && + (PxAbs(x - w) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) + ) + { + return true; + } + + if ( + (PxAbs((x - y) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && + (PxAbs((x - z) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && + (PxAbs((x - w) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) + ) + { + return true; + } + return false;*/ +} + +} +} + +#include "../../PxVecMathSSE.h" + +namespace physx +{ +namespace aos +{ + +#define PX_FPCLASS_SNAN 0x0001 /* signaling NaN */ +#define PX_FPCLASS_QNAN 0x0002 /* quiet NaN */ +#define PX_FPCLASS_NINF 0x0004 /* negative infinity */ +#define PX_FPCLASS_PINF 0x0200 /* positive infinity */ + +namespace internalSimd +{ +#if !PX_EMSCRIPTEN +#if PX_CLANG +#if PX_LINUX +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wglobal-constructors" +#endif +#endif +const PX_ALIGN(16, PxF32 gMaskXYZ[4]) = { physx::PxUnionCast(0xffffffff), physx::PxUnionCast(0xffffffff), + physx::PxUnionCast(0xffffffff), 0 }; +#if PX_CLANG +#if PX_LINUX +#pragma clang diagnostic pop +#endif +#endif +#else +// emscripten doesn't like the PxUnionCast data structure +// the following is what windows and xbox does -- using these for emscripten +const PX_ALIGN(16, PxU32 gMaskXYZ[4]) = { 0xffffffff, 0xffffffff, 0xffffffff, 0 }; +#endif +} + +namespace vecMathTests +{ +PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b) +{ + return internalSimd::BAllTrue4_R(VecI32V_IsEq(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b) +{ + BoolV c = internalSimd::m128_I2F(_mm_cmpeq_epi32(a, b)); + return internalSimd::BAllTrue4_R(c) != 0; +} + +#define VECMATH_AOS_EPSILON (1e-3f) + +PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + const FloatV c = FSub(a, b); + const FloatV minError = FLoad(-VECMATH_AOS_EPSILON); + const FloatV maxError = FLoad(VECMATH_AOS_EPSILON); + return _mm_comigt_ss(c, minError) && _mm_comilt_ss(c, maxError); +} + +PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b) +{ + const Vec3V c = V3Sub(a, b); + const Vec3V minError = V3Load(-VECMATH_AOS_EPSILON); + const Vec3V maxError = V3Load(VECMATH_AOS_EPSILON); + return (_mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), minError) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), maxError) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), minError) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), maxError) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), minError) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), maxError)); +} + +PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b) +{ + const Vec4V c = V4Sub(a, b); + const Vec4V minError = V4Load(-VECMATH_AOS_EPSILON); + const Vec4V maxError = V4Load(VECMATH_AOS_EPSILON); + return (_mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), minError) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), maxError) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), minError) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), maxError) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), minError) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), maxError) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(3, 3, 3, 3)), minError) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(3, 3, 3, 3)), maxError)); +} +} //vecMathTests + +///////////////////////////////////////////////////////////////////// +////FUNCTIONS USED ONLY FOR ASSERTS IN VECTORISED IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a) +{ + PxF32 badNumber = + physx::PxUnionCast(PX_FPCLASS_SNAN | PX_FPCLASS_QNAN | PX_FPCLASS_NINF | PX_FPCLASS_PINF); + const FloatV vBadNum = FLoad(badNumber); + const BoolV vMask = BAnd(vBadNum, a); + return internalSimd::FiniteTestEq(vMask, BFFFF()) == 1; +} + +PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a) +{ + PxF32 badNumber = + physx::PxUnionCast(PX_FPCLASS_SNAN | PX_FPCLASS_QNAN | PX_FPCLASS_NINF | PX_FPCLASS_PINF); + const Vec3V vBadNum = V3Load(badNumber); + const BoolV vMask = BAnd(BAnd(vBadNum, a), BTTTF()); + return internalSimd::FiniteTestEq(vMask, BFFFF()) == 1; +} + +PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a) +{ + /*Vec4V a; + PX_ALIGN(16, PxF32 f[4]); + F32Array_Aligned_From_Vec4V(a, f); + return PxIsFinite(f[0]) + && PxIsFinite(f[1]) + && PxIsFinite(f[2]) + && PxIsFinite(f[3]);*/ + + PxF32 badNumber = + physx::PxUnionCast(PX_FPCLASS_SNAN | PX_FPCLASS_QNAN | PX_FPCLASS_NINF | PX_FPCLASS_PINF); + const Vec4V vBadNum = V4Load(badNumber); + const BoolV vMask = BAnd(vBadNum, a); + + return internalSimd::FiniteTestEq(vMask, BFFFF()) == 1; +} + +///////////////////////////////////////////////////////////////////// +////VECTORISED FUNCTION IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); +#if !PX_EMSCRIPTEN + return _mm_and_ps(reinterpret_cast(f), V4LoadA(internalSimd::gMaskXYZ)); +#else + return _mm_and_ps((Vec3V&)f, (VecI32V&)internalSimd::gMaskXYZ); +#endif +} + +PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + return _mm_set_ps(0.0f, f.z, f.y, f.x); +} + +PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* const f) +{ + ASSERT_ISALIGNED16(f); +#if !PX_EMSCRIPTEN + return _mm_and_ps(V4LoadA(f), V4LoadA(internalSimd::gMaskXYZ)); +#else + return _mm_and_ps((Vec3V&)*f, (VecI32V&)internalSimd::gMaskXYZ); +#endif +} + +PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i) +{ + ASSERT_ISALIGNED16(i); + _mm_store_ps(reinterpret_cast(i), internalSimd::m128_I2F(iv)); +} + +PX_FORCE_INLINE BoolV BLoad(const bool* const f) +{ + const PX_ALIGN(16, PxI32) b[4] = { -PxI32(f[0]), -PxI32(f[1]), -PxI32(f[2]), -PxI32(f[3]) }; + return _mm_load_ps(reinterpret_cast(&b)); +} + +PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + PX_ALIGN(16, PxF32) f2[4]; + _mm_store_ps(f2, a); + f = PxVec3(f2[0], f2[1], f2[2]); +} + +PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f) +{ + PX_ALIGN(16, PxF32) f2[4]; + _mm_store_ps(f2, a); + f = PxVec3(f2[0], f2[1], f2[2]); +} + +////////////////////////////////// +// FLOATV +////////////////////////////////// + +PX_FORCE_INLINE FloatV FAbs(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + PX_ALIGN(16, const PxU32) absMask[4] = { 0x7fFFffFF, 0x7fFFffFF, 0x7fFFffFF, 0x7fFFffFF }; + return _mm_and_ps(a, _mm_load_ps(reinterpret_cast(absMask))); +} + +////////////////////////////////// +// VEC3V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V V3UnitX() +{ + const PX_ALIGN(16, PxF32) x[4] = { 1.0f, 0.0f, 0.0f, 0.0f }; + const __m128 x128 = _mm_load_ps(x); + return x128; +} + +PX_FORCE_INLINE Vec3V V3UnitY() +{ + const PX_ALIGN(16, PxF32) y[4] = { 0.0f, 1.0f, 0.0f, 0.0f }; + const __m128 y128 = _mm_load_ps(y); + return y128; +} + +PX_FORCE_INLINE Vec3V V3UnitZ() +{ + const PX_ALIGN(16, PxF32) z[4] = { 0.0f, 0.0f, 1.0f, 0.0f }; + const __m128 z128 = _mm_load_ps(z); + return z128; +} + +////////////////////////////////// +// VEC4V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V V4UnitW() +{ + const PX_ALIGN(16, PxF32) w[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; + const __m128 w128 = _mm_load_ps(w); + return w128; +} + +PX_FORCE_INLINE Vec4V V4UnitX() +{ + const PX_ALIGN(16, PxF32) x[4] = { 1.0f, 0.0f, 0.0f, 0.0f }; + const __m128 x128 = _mm_load_ps(x); + return x128; +} + +PX_FORCE_INLINE Vec4V V4UnitY() +{ + const PX_ALIGN(16, PxF32) y[4] = { 0.0f, 1.0f, 0.0f, 0.0f }; + const __m128 y128 = _mm_load_ps(y); + return y128; +} + +PX_FORCE_INLINE Vec4V V4UnitZ() +{ + const PX_ALIGN(16, PxF32) z[4] = { 0.0f, 0.0f, 1.0f, 0.0f }; + const __m128 z128 = _mm_load_ps(z); + return z128; +} + +PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v) +{ +#if !PX_EMSCRIPTEN + return _mm_and_ps(v, V4LoadA(internalSimd::gMaskXYZ)); +#else + return _mm_and_ps(v, (VecI32V&)internalSimd::gMaskXYZ); +#endif +} + +////////////////////////////////// +// BoolV +////////////////////////////////// + +/* +template PX_FORCE_INLINE BoolV BSplatElement(BoolV a) +{ + BoolV result; + result[0] = result[1] = result[2] = result[3] = a[index]; + return result; +} +*/ + +template +BoolV BSplatElement(BoolV a) +{ + float* data = reinterpret_cast(&a); + return V4Load(data[index]); +} + +////////////////////////////////// +// MAT33V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b) +{ + const FloatV x = V3Dot(a.col0, b); + const FloatV y = V3Dot(a.col1, b); + const FloatV z = V3Dot(a.col2, b); + return V3Merge(x, y, z); +} + +PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a) +{ + return Mat33V(V3Merge(V3GetX(a.col0), V3GetX(a.col1), V3GetX(a.col2)), + V3Merge(V3GetY(a.col0), V3GetY(a.col1), V3GetY(a.col2)), + V3Merge(V3GetZ(a.col0), V3GetZ(a.col1), V3GetZ(a.col2))); +} + +/*PX_FORCE_INLINE Mat33V PromoteVec3V(const Vec3V v) +{ + const BoolV bTFFF = BTFFF(); + const BoolV bFTFF = BFTFF(); + const BoolV bFFTF = BTFTF(); + + const Vec3V zero = V3Zero(); + + return Mat33V(V3Sel(bTFFF, v, zero), V3Sel(bFTFF, v, zero), V3Sel(bFFTF, v, zero)); +}*/ + +////////////////////////////////// +// MAT34V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M34TrnspsMul33V3(const Mat34V& a, const Vec3V b) +{ + const FloatV x = V3Dot(a.col0, b); + const FloatV y = V3Dot(a.col1, b); + const FloatV z = V3Dot(a.col2, b); + return V3Merge(x, y, z); +} + +PX_FORCE_INLINE Mat33V M34Trnsps33(const Mat34V& a) +{ + return Mat33V(V3Merge(V3GetX(a.col0), V3GetX(a.col1), V3GetX(a.col2)), + V3Merge(V3GetY(a.col0), V3GetY(a.col1), V3GetY(a.col2)), + V3Merge(V3GetZ(a.col0), V3GetZ(a.col1), V3GetZ(a.col2))); +} + +////////////////////////////////// +// MAT44V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V M44TrnspsMulV4(const Mat44V& a, const Vec4V b) +{ + PX_ALIGN(16, FloatV) dotProdArray[4] = { V4Dot(a.col0, b), V4Dot(a.col1, b), V4Dot(a.col2, b), V4Dot(a.col3, b) }; + return V4Merge(dotProdArray); +} + +PX_FORCE_INLINE Mat44V M44Trnsps(const Mat44V& a) +{ + const Vec4V v0 = _mm_unpacklo_ps(a.col0, a.col2); + const Vec4V v1 = _mm_unpackhi_ps(a.col0, a.col2); + const Vec4V v2 = _mm_unpacklo_ps(a.col1, a.col3); + const Vec4V v3 = _mm_unpackhi_ps(a.col1, a.col3); + return Mat44V(_mm_unpacklo_ps(v0, v2), _mm_unpackhi_ps(v0, v2), _mm_unpacklo_ps(v1, v3), _mm_unpackhi_ps(v1, v3)); +} + +////////////////////////////////// +// Misc +////////////////////////////////// + +/* +// AP: work in progress - use proper SSE intrinsics where possible +PX_FORCE_INLINE VecU16V V4U32PK(VecU32V a, VecU32V b) +{ + VecU16V result; + result.m128_u16[0] = PxU16(PxClamp((a).m128_u32[0], 0, 0xFFFF)); + result.m128_u16[1] = PxU16(PxClamp((a).m128_u32[1], 0, 0xFFFF)); + result.m128_u16[2] = PxU16(PxClamp((a).m128_u32[2], 0, 0xFFFF)); + result.m128_u16[3] = PxU16(PxClamp((a).m128_u32[3], 0, 0xFFFF)); + result.m128_u16[4] = PxU16(PxClamp((b).m128_u32[0], 0, 0xFFFF)); + result.m128_u16[5] = PxU16(PxClamp((b).m128_u32[1], 0, 0xFFFF)); + result.m128_u16[6] = PxU16(PxClamp((b).m128_u32[2], 0, 0xFFFF)); + result.m128_u16[7] = PxU16(PxClamp((b).m128_u32[3], 0, 0xFFFF)); + return result; +} +*/ + +/* +PX_FORCE_INLINE VecU16V V4U16Or(VecU16V a, VecU16V b) +{ + return m128_I2F(_mm_or_si128(m128_F2I(a), m128_F2I(b))); +} +*/ + +/* +PX_FORCE_INLINE VecU16V V4U16And(VecU16V a, VecU16V b) +{ + return m128_I2F(_mm_and_si128(m128_F2I(a), m128_F2I(b))); +} +*/ + +/* +PX_FORCE_INLINE VecU16V V4U16Andc(VecU16V a, VecU16V b) +{ + return m128_I2F(_mm_andnot_si128(m128_F2I(b), m128_F2I(a))); +} +*/ + +PX_FORCE_INLINE VecI32V I4LoadXYZW(const PxI32& x, const PxI32& y, const PxI32& z, const PxI32& w) +{ + return _mm_set_epi32(w, z, y, x); +} + +PX_FORCE_INLINE VecI32V I4Load(const PxI32 i) +{ + return internalSimd::m128_F2I(_mm_load1_ps(reinterpret_cast(&i))); +} + +PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i) +{ + return internalSimd::m128_F2I(_mm_loadu_ps(reinterpret_cast(i))); +} + +PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i) +{ + ASSERT_ISALIGNED16(i); + return internalSimd::m128_F2I(_mm_load_ps(reinterpret_cast(i))); +} + +PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b) +{ + return _mm_add_epi32(a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b) +{ + return _mm_sub_epi32(a, b); +} + +PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b) +{ + return internalSimd::m128_I2F(_mm_cmpgt_epi32(a, b)); +} + +PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b) +{ + return internalSimd::m128_I2F(_mm_cmpeq_epi32(a, b)); +} + +PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b) +{ + return _mm_or_si128(_mm_andnot_si128(internalSimd::m128_F2I(c), b), _mm_and_si128(internalSimd::m128_F2I(c), a)); +} + +PX_FORCE_INLINE VecI32V VecI32V_Zero() +{ + return _mm_setzero_si128(); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sel(const BoolV c, const VecI32VArg a, const VecI32VArg b) +{ + return _mm_or_si128(_mm_andnot_si128(internalSimd::m128_F2I(c), b), _mm_and_si128(internalSimd::m128_F2I(c), a)); +} + +PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift) +{ + VecShiftV s; + s.shift = VecI32V_Sel(BTFFF(), shift, VecI32V_Zero()); + return s; +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const VecShiftVArg count) +{ + return _mm_sll_epi32(a, count.shift); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg count) +{ + return _mm_srl_epi32(a, count.shift); +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const PxU32 count) +{ + return _mm_slli_epi32(a, PxI32(count)); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const PxU32 count) +{ + return _mm_srai_epi32(a, PxI32(count)); +} + +PX_FORCE_INLINE VecI32V VecI32V_And(const VecI32VArg a, const VecI32VArg b) +{ + return _mm_and_si128(a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b) +{ + return _mm_or_si128(a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg a) +{ + return internalSimd::m128_F2I(_mm_shuffle_ps(internalSimd::m128_I2F(a), internalSimd::m128_I2F(a), _MM_SHUFFLE(0, 0, 0, 0))); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg a) +{ + return internalSimd::m128_F2I(_mm_shuffle_ps(internalSimd::m128_I2F(a), internalSimd::m128_I2F(a), _MM_SHUFFLE(1, 1, 1, 1))); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg a) +{ + return internalSimd::m128_F2I(_mm_shuffle_ps(internalSimd::m128_I2F(a), internalSimd::m128_I2F(a), _MM_SHUFFLE(2, 2, 2, 2))); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg a) +{ + return internalSimd::m128_F2I(_mm_shuffle_ps(internalSimd::m128_I2F(a), internalSimd::m128_I2F(a), _MM_SHUFFLE(3, 3, 3, 3))); +} + +PX_FORCE_INLINE void PxI32_From_VecI32V(const VecI32VArg a, PxI32* i) +{ + _mm_store_ss(reinterpret_cast(i), internalSimd::m128_I2F(a)); +} + +PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg a) +{ + return internalSimd::m128_F2I(a); +} + +PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg a) +{ + return a; +} + +PX_FORCE_INLINE VecI32V VecI32V_Merge(const VecI32VArg x, const VecI32VArg y, const VecI32VArg z, const VecI32VArg w) +{ + const __m128 xw = _mm_move_ss(internalSimd::m128_I2F(y), internalSimd::m128_I2F(x)); // y, y, y, x + const __m128 yz = _mm_move_ss(internalSimd::m128_I2F(z), internalSimd::m128_I2F(w)); // z, z, z, w + return internalSimd::m128_F2I(_mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0))); +} + +/* +template PX_FORCE_INLINE VecI32V V4ISplat() +{ + VecI32V result; + result.m128_i32[0] = a; + result.m128_i32[1] = a; + result.m128_i32[2] = a; + result.m128_i32[3] = a; + return result; +} + +template PX_FORCE_INLINE VecU32V V4USplat() +{ + VecU32V result; + result.m128_u32[0] = a; + result.m128_u32[1] = a; + result.m128_u32[2] = a; + result.m128_u32[3] = a; + return result; +} +*/ + +/* +PX_FORCE_INLINE void V4U16StoreAligned(VecU16V val, VecU16V* address) +{ + *address = val; +} +*/ + +PX_FORCE_INLINE void V4U32StoreAligned(VecU32V val, VecU32V* address) +{ + *address = val; +} + +/*PX_FORCE_INLINE Vec4V V4LoadAligned(Vec4V* addr) +{ + return *addr; +} + +PX_FORCE_INLINE Vec4V V4LoadUnaligned(Vec4V* addr) +{ + return V4LoadU(reinterpret_cast(addr)); +}*/ + +PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V in) +{ + return _mm_cvtepi32_ps(in); +} + +PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a) +{ + return _mm_cvttps_epi32(a); +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a) +{ + return Vec4V(a); +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a) +{ + return internalSimd::m128_I2F(a); +} + +PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + return VecU32V(a); +} + +PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + return internalSimd::m128_F2I(a); +} + +template +PX_FORCE_INLINE VecU32V V4U32SplatElement(VecU32V a) +{ + VecU32V result; + result.m128_u32[0] = result.m128_u32[1] = result.m128_u32[2] = result.m128_u32[3] = a.m128_u32[index]; + return result; +} + +template +PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a) +{ + float* data = reinterpret_cast(&a); + return V4Load(data[index]); +} + +/*PX_FORCE_INLINE Vec4V V4Ceil(const Vec4V in) +{ + UnionM128 a(in); + return V4LoadXYZW(PxCeil(a.m128_f32[0]), PxCeil(a.m128_f32[1]), PxCeil(a.m128_f32[2]), PxCeil(a.m128_f32[3])); +} + +PX_FORCE_INLINE Vec4V V4Floor(const Vec4V in) +{ + UnionM128 a(in); + return V4LoadXYZW(PxFloor(a.m128_f32[0]), PxFloor(a.m128_f32[1]), PxFloor(a.m128_f32[2]), PxFloor(a.m128_f32[3])); +} + +PX_FORCE_INLINE VecU32V V4ConvertToU32VSaturate(const Vec4V in, PxU32 power) +{ + PX_ASSERT(power == 0 && "Non-zero power not supported in convertToU32VSaturate"); + PX_UNUSED(power); // prevent warning in release builds + PxF32 ffffFFFFasFloat = PxF32(0xFFFF0000); + UnionM128 a(in); + VecU32V result; + result.m128_u32[0] = PxU32(PxClamp((a).m128_f32[0], 0.0f, ffffFFFFasFloat)); + result.m128_u32[1] = PxU32(PxClamp((a).m128_f32[1], 0.0f, ffffFFFFasFloat)); + result.m128_u32[2] = PxU32(PxClamp((a).m128_f32[2], 0.0f, ffffFFFFasFloat)); + result.m128_u32[3] = PxU32(PxClamp((a).m128_f32[3], 0.0f, ffffFFFFasFloat)); + return result; +}*/ + +} // namespace aos +} // namespace physx + +#endif // PXFOUNDATION_PXUNIXSSE2INLINEAOS_H diff --git a/engine/third_party/physx/include/foundation/windows/PxWindowsAoS.h b/engine/third_party/physx/include/foundation/windows/PxWindowsAoS.h new file mode 100644 index 00000000..8e126fcf --- /dev/null +++ b/engine/third_party/physx/include/foundation/windows/PxWindowsAoS.h @@ -0,0 +1,143 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_WINDOWS_AOS_H +#define PX_WINDOWS_AOS_H + +// no includes here! this file should be included from PxAOS.h only!!! + +#if !COMPILE_VECTOR_INTRINSICS +#error Vector intrinsics should not be included when using scalar implementation. +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +namespace aos +{ + +typedef __m128 FloatV; +typedef __m128 Vec3V; +typedef __m128 Vec4V; +typedef __m128 BoolV; +typedef __m128 VecU32V; +typedef __m128 VecI32V; +typedef __m128 VecU16V; +typedef __m128 VecI16V; +typedef __m128 QuatV; + +#define FloatVArg FloatV & +#define Vec3VArg Vec3V & +#define Vec4VArg Vec4V & +#define BoolVArg BoolV & +#define VecU32VArg VecU32V & +#define VecI32VArg VecI32V & +#define VecU16VArg VecU16V & +#define VecI16VArg VecI16V & +#define QuatVArg QuatV & + +// Optimization for situations in which you cross product multiple vectors with the same vector. +// Avoids 2X shuffles per product +struct VecCrossV +{ + Vec3V mL1; + Vec3V mR1; +}; + +struct VecShiftV +{ + VecI32V shift; +}; +#define VecShiftVArg VecShiftV & + +PX_ALIGN_PREFIX(16) +struct Mat33V +{ + Mat33V() + { + } + Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec3V PX_ALIGN(16, col0); + Vec3V PX_ALIGN(16, col1); + Vec3V PX_ALIGN(16, col2); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat34V +{ + Mat34V() + { + } + Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec3V PX_ALIGN(16, col0); + Vec3V PX_ALIGN(16, col1); + Vec3V PX_ALIGN(16, col2); + Vec3V PX_ALIGN(16, col3); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat43V +{ + Mat43V() + { + } + Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec4V PX_ALIGN(16, col0); + Vec4V PX_ALIGN(16, col1); + Vec4V PX_ALIGN(16, col2); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat44V +{ + Mat44V() + { + } + Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec4V PX_ALIGN(16, col0); + Vec4V PX_ALIGN(16, col1); + Vec4V PX_ALIGN(16, col2); + Vec4V PX_ALIGN(16, col3); +} PX_ALIGN_SUFFIX(16); + +} // namespace aos +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/windows/PxWindowsFPU.h b/engine/third_party/physx/include/foundation/windows/PxWindowsFPU.h new file mode 100644 index 00000000..f26a2656 --- /dev/null +++ b/engine/third_party/physx/include/foundation/windows/PxWindowsFPU.h @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_WINDOWS_FPU_H +#define PX_WINDOWS_FPU_H + +PX_INLINE physx::PxSIMDGuard::PxSIMDGuard(bool enable) : mEnabled(enable) +{ +#if !PX_ARM && !PX_A64 + if (enable) + { + mControlWord = _mm_getcsr(); + // set default (disable exceptions: _MM_MASK_MASK) and FTZ (_MM_FLUSH_ZERO_ON), DAZ (_MM_DENORMALS_ZERO_ON: (1<<6)) + _mm_setcsr(_MM_MASK_MASK | _MM_FLUSH_ZERO_ON | (1 << 6)); + } + else + { + PX_ASSERT(_mm_getcsr() & _MM_FLUSH_ZERO_ON); + PX_ASSERT(_mm_getcsr() & (1 << 6)); + PX_ASSERT(_mm_getcsr() & _MM_MASK_MASK); + } +#endif +} + +PX_INLINE physx::PxSIMDGuard::~PxSIMDGuard() +{ +#if !PX_ARM && !PX_A64 + if (mEnabled) + { + // restore control word and clear any exception flags + // (setting exception state flags cause exceptions on the first following fp operation) + _mm_setcsr(mControlWord & ~_MM_EXCEPT_MASK); + } +#endif +} + +#endif + diff --git a/engine/third_party/physx/include/foundation/windows/PxWindowsInclude.h b/engine/third_party/physx/include/foundation/windows/PxWindowsInclude.h new file mode 100644 index 00000000..1385c0cf --- /dev/null +++ b/engine/third_party/physx/include/foundation/windows/PxWindowsInclude.h @@ -0,0 +1,96 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_WINDOWS_INCLUDE_H +#define PX_WINDOWS_INCLUDE_H + +#ifndef _WIN32 +#error "This file should only be included by Windows builds!!" +#endif + +#ifdef _WINDOWS_ // windows already included +#error "Only include windows.h through this file!!" +#endif + +// We only support >= Windows 7, and we need this for critical section and +// Setting this hides some important APIs (e.g. LoadPackagedLibrary), so don't do it +#define _WIN32_WINNT 0x0601 + +// turn off as much as we can for windows. All we really need is the thread functions(critical sections/Interlocked* +// etc) +#define NOGDICAPMASKS +#define NOVIRTUALKEYCODES +#define NOWINMESSAGES +#define NOWINSTYLES +#define NOSYSMETRICS +#define NOMENUS +#define NOICONS +#define NOKEYSTATES +#define NOSYSCOMMANDS +#define NORASTEROPS +#define NOSHOWWINDOW +#define NOATOM +#define NOCLIPBOARD +#define NOCOLOR +#define NOCTLMGR +#define NODRAWTEXT +#define NOGDI +#define NOMB +#define NOMEMMGR +#define NOMETAFILE +#define NOMINMAX +#define NOOPENFILE +#define NOSCROLL +#define NOSERVICE +#define NOSOUND +#define NOTEXTMETRIC +#define NOWH +#define NOWINOFFSETS +#define NOCOMM +#define NOKANJI +#define NOHELP +#define NOPROFILER +#define NODEFERWINDOWPOS +#define NOMCX +#define WIN32_LEAN_AND_MEAN +// We need a slightly wider API surface for e.g. MultiByteToWideChar +#define NOUSER +#define NONLS +#define NOMSG + +#pragma warning(push) +#pragma warning(disable : 4668) //'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' +#include +#pragma warning(pop) + +#if PX_SSE2 +#include +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/windows/PxWindowsInlineAoS.h b/engine/third_party/physx/include/foundation/windows/PxWindowsInlineAoS.h new file mode 100644 index 00000000..1bc4f9ab --- /dev/null +++ b/engine/third_party/physx/include/foundation/windows/PxWindowsInlineAoS.h @@ -0,0 +1,610 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_WINDOWS_INLINE_AOS_H +#define PX_WINDOWS_INLINE_AOS_H + +namespace physx +{ +namespace aos +{ +////////////////////////////////////////////////////////////////////// +//Test that Vec3V and FloatV are legal +////////////////////////////////////////////////////////////////////// + +#define FLOAT_COMPONENTS_EQUAL_THRESHOLD 0.01f +PX_FORCE_INLINE bool isValidFloatV(const FloatV a) +{ + const PxF32 x = V4ReadX(a); + const PxF32 y = V4ReadY(a); + const PxF32 z = V4ReadZ(a); + const PxF32 w = V4ReadW(a); + + return (!(x != y || x != z || x != w)); + + /*if ( + (PxAbs(x - y) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && + (PxAbs(x - z) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && + (PxAbs(x - w) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) + ) + { + return true; + } + + if ( + (PxAbs((x - y) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && + (PxAbs((x - z) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && + (PxAbs((x - w) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) + ) + { + return true; + } + return false;*/ +} + +} +} + +#include "../PxVecMathSSE.h" + +namespace physx +{ +namespace aos +{ + +///////////////////////////////////////////////////////////////////// +////FUNCTIONS USED ONLY FOR ASSERTS IN VECTORISED IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////// +// USED ONLY INTERNALLY +////////////////////////////////////////////////////////////////////// + +namespace internalSimd +{ +const PX_ALIGN(16, PxU32 gMaskXYZ[4]) = { 0xffffffff, 0xffffffff, 0xffffffff, 0 }; +} //internalSimd + +namespace vecMathTests +{ +PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b) +{ + return internalSimd::BAllTrue4_R(VecI32V_IsEq(a, b)) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b) +{ + BoolV c = internalSimd::m128_I2F(_mm_cmpeq_epi32(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))); + return internalSimd::BAllTrue4_R(c) != 0; +} + +#define VECMATH_AOS_EPSILON (1e-3f) +static const FloatV minFError = FLoad(-VECMATH_AOS_EPSILON); +static const FloatV maxFError = FLoad(VECMATH_AOS_EPSILON); +static const Vec3V minV3Error = V3Load(-VECMATH_AOS_EPSILON); +static const Vec3V maxV3Error = V3Load(VECMATH_AOS_EPSILON); +static const Vec4V minV4Error = V4Load(-VECMATH_AOS_EPSILON); +static const Vec4V maxV4Error = V4Load(VECMATH_AOS_EPSILON); + +PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + const FloatV c = FSub(a, b); + return _mm_comigt_ss(c, minFError) && _mm_comilt_ss(c, maxFError); +} + +PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b) +{ + const Vec3V c = V3Sub(a, b); + return (_mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), minV3Error) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), maxV3Error) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), minV3Error) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), maxV3Error) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), minV3Error) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), maxV3Error)); +} + +PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b) +{ + const Vec4V c = V4Sub(a, b); + return (_mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), minV4Error) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), maxV4Error) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), minV4Error) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), maxV4Error) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), minV4Error) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), maxV4Error) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(3, 3, 3, 3)), minV4Error) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(3, 3, 3, 3)), maxV4Error)); +} +} //vecMathTests + +PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a) +{ + PxF32 f; + FStore(a, &f); + return PxIsFinite(f); + /* + const PxU32 badNumber = (_FPCLASS_SNAN | _FPCLASS_QNAN | _FPCLASS_NINF | _FPCLASS_PINF); + const FloatV vBadNum = FloatV_From_F32((PxF32&)badNumber); + const BoolV vMask = BAnd(vBadNum, a); + return FiniteTestEq(vMask, BFFFF()) == 1; + */ +} + +PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a) +{ + PX_ALIGN(16, PxF32 f[4]); + V4StoreA((Vec4V&)a, f); + return PxIsFinite(f[0]) && PxIsFinite(f[1]) && PxIsFinite(f[2]); + + /* + const PxU32 badNumber = (_FPCLASS_SNAN | _FPCLASS_QNAN | _FPCLASS_NINF | _FPCLASS_PINF); + const Vec3V vBadNum = Vec3V_From_F32((PxF32&)badNumber); + const BoolV vMask = BAnd(BAnd(vBadNum, a), BTTTF()); + return FiniteTestEq(vMask, BFFFF()) == 1; + */ +} + +PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a) +{ + PX_ALIGN(16, PxF32 f[4]); + V4StoreA(a, f); + return PxIsFinite(f[0]) && PxIsFinite(f[1]) && PxIsFinite(f[2]) && PxIsFinite(f[3]); + + /* + const PxU32 badNumber = (_FPCLASS_SNAN | _FPCLASS_QNAN | _FPCLASS_NINF | _FPCLASS_PINF); + const Vec4V vBadNum = Vec4V_From_U32((PxF32&)badNumber); + const BoolV vMask = BAnd(vBadNum, a); + + return FiniteTestEq(vMask, BFFFF()) == 1; + */ +} + +///////////////////////////////////////////////////////////////////// +////VECTORISED FUNCTION IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + return _mm_and_ps(_mm_load_ps(&f.x), reinterpret_cast(internalSimd::gMaskXYZ)); +} + +// w component of result is undefined +PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + return _mm_load_ps(&f.x); +} + +PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* const f) +{ + ASSERT_ISALIGNED16(f); + return V4ClearW(_mm_load_ps(f)); +} + +PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i) +{ + ASSERT_ISALIGNED16(i); + _mm_store_ps((PxF32*)i, iv); +} + +PX_FORCE_INLINE BoolV BLoad(const bool* const f) +{ + const PX_ALIGN(16, PxU32 b[4]) = { PxU32(-(PxI32)f[0]), PxU32(-(PxI32)f[1]), + PxU32(-(PxI32)f[2]), PxU32(-(PxI32)f[3]) }; + return _mm_load_ps((float*)&b); +} + +PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + PX_ALIGN(16, PxF32 f2[4]); + _mm_store_ps(f2, a); + f = PxVec3(f2[0], f2[1], f2[2]); +} + +PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f) +{ + PX_ALIGN(16, PxF32 f2[4]); + _mm_store_ps(f2, a); + f = PxVec3(f2[0], f2[1], f2[2]); +} + +////////////////////////////////// +// FLOATV +////////////////////////////////// + +PX_FORCE_INLINE FloatV FAbs(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + PX_ALIGN(16, const static PxU32 absMask[4]) = { 0x7fFFffFF, 0x7fFFffFF, 0x7fFFffFF, 0x7fFFffFF }; + return _mm_and_ps(a, _mm_load_ps(reinterpret_cast(absMask))); +} + +////////////////////////////////// +// VEC3V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V V3UnitX() +{ + const PX_ALIGN(16, PxF32 x[4]) = { 1.0f, 0.0f, 0.0f, 0.0f }; + const __m128 x128 = _mm_load_ps(x); + return x128; +} + +PX_FORCE_INLINE Vec3V V3UnitY() +{ + const PX_ALIGN(16, PxF32 y[4]) = { 0.0f, 1.0f, 0.0f, 0.0f }; + const __m128 y128 = _mm_load_ps(y); + return y128; +} + +PX_FORCE_INLINE Vec3V V3UnitZ() +{ + const PX_ALIGN(16, PxF32 z[4]) = { 0.0f, 0.0f, 1.0f, 0.0f }; + const __m128 z128 = _mm_load_ps(z); + return z128; +} + +////////////////////////////////// +// VEC4V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V V4UnitW() +{ + const PX_ALIGN(16, PxF32 w[4]) = { 0.0f, 0.0f, 0.0f, 1.0f }; + const __m128 w128 = _mm_load_ps(w); + return w128; +} + +PX_FORCE_INLINE Vec4V V4UnitX() +{ + const PX_ALIGN(16, PxF32 x[4]) = { 1.0f, 0.0f, 0.0f, 0.0f }; + const __m128 x128 = _mm_load_ps(x); + return x128; +} + +PX_FORCE_INLINE Vec4V V4UnitY() +{ + const PX_ALIGN(16, PxF32 y[4]) = { 0.0f, 1.0f, 0.0f, 0.0f }; + const __m128 y128 = _mm_load_ps(y); + return y128; +} + +PX_FORCE_INLINE Vec4V V4UnitZ() +{ + const PX_ALIGN(16, PxF32 z[4]) = { 0.0f, 0.0f, 1.0f, 0.0f }; + const __m128 z128 = _mm_load_ps(z); + return z128; +} + +PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v) +{ + return _mm_and_ps(v, (VecI32V&)internalSimd::gMaskXYZ); +} + +////////////////////////////////// +// BoolV +////////////////////////////////// + +template +BoolV BSplatElement(BoolV a) +{ + return internalSimd::m128_I2F( + _mm_shuffle_epi32(internalSimd::m128_F2I(a), _MM_SHUFFLE(index, index, index, index))); +} + +////////////////////////////////// +// MAT33V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b) +{ + Vec3V v0 = V3Mul(a.col0, b); + Vec3V v1 = V3Mul(a.col1, b); + Vec3V v2 = V3Mul(a.col2, b); + V3Transpose(v0, v1, v2); + return V3Add(V3Add(v0, v1), v2); +} + +PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a) +{ + Vec3V col0 = a.col0, col1 = a.col1, col2 = a.col2; + V3Transpose(col0, col1, col2); + return Mat33V(col0, col1, col2); +} + +////////////////////////////////// +// MAT34V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M34TrnspsMul33V3(const Mat34V& a, const Vec3V b) +{ + Vec3V v0 = V3Mul(a.col0, b); + Vec3V v1 = V3Mul(a.col1, b); + Vec3V v2 = V3Mul(a.col2, b); + V3Transpose(v0, v1, v2); + return V3Add(V3Add(v0, v1), v2); +} + +PX_FORCE_INLINE Mat33V M34Trnsps33(const Mat34V& a) +{ + Vec3V col0 = a.col0, col1 = a.col1, col2 = a.col2; + V3Transpose(col0, col1, col2); + return Mat33V(col0, col1, col2); +} + +/*PX_FORCE_INLINE Mat34V M34Inverse(const Mat34V& a) +{ + Mat34V aInv; + const BoolV tfft = BTFFT(); + const BoolV tttf = BTTTF(); + const FloatV zero = V3Zero(); + const Vec3V cross01 = V3Cross(a.col0, a.col1); + const Vec3V cross12 = V3Cross(a.col1, a.col2); + const Vec3V cross20 = V3Cross(a.col2, a.col0); + const FloatV dot = V3Dot(cross01, a.col2); + const FloatV invDet = _mm_rcp_ps(dot); + const Vec3V mergeh = _mm_unpacklo_ps(cross12, cross01); + const Vec3V mergel = _mm_unpackhi_ps(cross12, cross01); + Vec3V colInv0 = _mm_unpacklo_ps(mergeh, cross20); + colInv0 = _mm_or_ps(_mm_andnot_ps(tttf, zero), _mm_and_ps(tttf, colInv0)); + const Vec3V zppd = _mm_shuffle_ps(mergeh, cross20, _MM_SHUFFLE(3, 0, 0, 2)); + const Vec3V pbwp = _mm_shuffle_ps(cross20, mergeh, _MM_SHUFFLE(3, 3, 1, 0)); + const Vec3V colInv1 = _mm_or_ps(_mm_andnot_ps(BTFFT(), pbwp), _mm_and_ps(BTFFT(), zppd)); + const Vec3V xppd = _mm_shuffle_ps(mergel, cross20, _MM_SHUFFLE(3, 0, 0, 0)); + const Vec3V pcyp = _mm_shuffle_ps(cross20, mergel, _MM_SHUFFLE(3, 1, 2, 0)); + const Vec3V colInv2 = _mm_or_ps(_mm_andnot_ps(tfft, pcyp), _mm_and_ps(tfft, xppd)); + aInv.col0 = _mm_mul_ps(colInv0, invDet); + aInv.col1 = _mm_mul_ps(colInv1, invDet); + aInv.col2 = _mm_mul_ps(colInv2, invDet); + aInv.col3 = M34Mul33V3(aInv, V3Neg(a.col3)); + return aInv; +}*/ + +////////////////////////////////// +// MAT44V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V M44TrnspsMulV4(const Mat44V& a, const Vec4V b) +{ + Vec4V v0 = V4Mul(a.col0, b); + Vec4V v1 = V4Mul(a.col1, b); + Vec4V v2 = V4Mul(a.col2, b); + Vec4V v3 = V4Mul(a.col3, b); + V4Transpose(v0, v1, v2, v3); + return V4Add(V4Add(v0, v1), V4Add(v2, v3)); +} + +PX_FORCE_INLINE Mat44V M44Trnsps(const Mat44V& a) +{ + Vec4V col0 = a.col0, col1 = a.col1, col2 = a.col2, col3 = a.col3; + V4Transpose(col0, col1, col2, col3); + return Mat44V(col0, col1, col2, col3); +} + +////////////////////////////////// +// Misc +////////////////////////////////// + +PX_FORCE_INLINE VecI32V I4LoadXYZW(const PxI32& x, const PxI32& y, const PxI32& z, const PxI32& w) +{ + return internalSimd::m128_I2F(_mm_set_epi32(w, z, y, x)); +} + +PX_FORCE_INLINE VecI32V I4Load(const PxI32 i) +{ + return _mm_load1_ps(reinterpret_cast(&i)); +} + +PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i) +{ + return _mm_loadu_ps(reinterpret_cast(i)); +} + +PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i) +{ + ASSERT_ISALIGNED16(i); + return _mm_load_ps(reinterpret_cast(i)); +} + +PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b) +{ + return internalSimd::m128_I2F(_mm_add_epi32(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b) +{ + return internalSimd::m128_I2F(_mm_sub_epi32(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b) +{ + return internalSimd::m128_I2F(_mm_cmpgt_epi32(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b) +{ + return internalSimd::m128_I2F(_mm_cmpeq_epi32(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b) +{ + return V4U32Sel(c, a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_Zero() +{ + return V4Zero(); // PT: TODO: unify VecI32V / VecU32V on Windows / Linux, not the same types (?!) +} + +PX_FORCE_INLINE VecI32V VecI32V_Sel(const BoolV c, const VecI32VArg a, const VecI32VArg b) +{ + PX_ASSERT(vecMathTests::allElementsEqualBoolV(c, BTTTT()) || + vecMathTests::allElementsEqualBoolV(c, BFFFF())); + return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); +} + +PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift) +{ + VecShiftV preparedShift; + preparedShift.shift = _mm_or_ps(_mm_andnot_ps(BTFFF(), VecI32V_Zero()), _mm_and_ps(BTFFF(), shift)); + return preparedShift; +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const VecShiftVArg count) +{ + return internalSimd::m128_I2F(_mm_sll_epi32(internalSimd::m128_F2I(a), internalSimd::m128_F2I(count.shift))); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg count) +{ + return internalSimd::m128_I2F(_mm_srl_epi32(internalSimd::m128_F2I(a), internalSimd::m128_F2I(count.shift))); +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const PxU32 count) +{ + return internalSimd::m128_I2F(_mm_slli_epi32(internalSimd::m128_F2I(a), count)); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const PxU32 count) +{ + return internalSimd::m128_I2F(_mm_srai_epi32(internalSimd::m128_F2I(a), count)); +} + +PX_FORCE_INLINE VecI32V VecI32V_And(const VecI32VArg a, const VecI32VArg b) +{ + return internalSimd::m128_I2F(_mm_and_si128(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b) +{ + return internalSimd::m128_I2F(_mm_or_si128(internalSimd::m128_F2I(a), internalSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 3, 3, 3)); +} + +PX_FORCE_INLINE void PxI32_From_VecI32V(const VecI32VArg a, PxI32* i) +{ + _mm_store_ss(reinterpret_cast(i), a); +} + +PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg a) +{ + return a; +} + +PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg a) +{ + return a; +} + +PX_FORCE_INLINE VecI32V VecI32V_Merge(const VecI32VArg a, const VecI32VArg b, const VecI32VArg c, const VecI32VArg d) +{ + const __m128 xw = _mm_move_ss(b, a); // y, y, y, x + const __m128 yz = _mm_move_ss(c, d); // z, z, z, w + return _mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0)); +} + +PX_FORCE_INLINE void V4U32StoreAligned(VecU32V val, VecU32V* address) +{ + *address = val; +} + +PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V a) +{ + return _mm_cvtepi32_ps(internalSimd::m128_F2I(a)); +} + +PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a) +{ + return internalSimd::m128_I2F(_mm_cvttps_epi32(a)); +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a) +{ + return Vec4V(a); +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a) +{ + return Vec4V(a); +} + +PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + return VecU32V(a); +} + +PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + return VecI32V(a); +} + +template +PX_FORCE_INLINE VecU32V V4U32SplatElement(VecU32V a) +{ + return internalSimd::m128_I2F(_mm_shuffle_epi32(internalSimd::m128_F2I(a), _MM_SHUFFLE(index, index, index, index))); +} + +template +PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a) +{ + return internalSimd::m128_I2F(_mm_shuffle_epi32(internalSimd::m128_F2I(a), _MM_SHUFFLE(index, index, index, index))); +} + +/*PX_FORCE_INLINE Vec4V V4ConvertFromI32V(const VecI32V in) +{ + return _mm_cvtepi32_ps(internalSimd::m128_F2I(in)); +}*/ + +} // namespace aos +} // namespace physx + +#endif + diff --git a/engine/third_party/physx/include/foundation/windows/PxWindowsIntrinsics.h b/engine/third_party/physx/include/foundation/windows/PxWindowsIntrinsics.h new file mode 100644 index 00000000..80131614 --- /dev/null +++ b/engine/third_party/physx/include/foundation/windows/PxWindowsIntrinsics.h @@ -0,0 +1,201 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_WINDOWS_INTRINSICS_H +#define PX_WINDOWS_INTRINSICS_H + +#include "foundation/PxAssert.h" +#include + +// this file is for internal intrinsics - that is, intrinsics that are used in +// cross platform code but do not appear in the API + +#if !PX_WINDOWS_FAMILY +#error "This file should only be included by Windows builds!!" +#endif + +#pragma intrinsic(memcmp) +#pragma intrinsic(memcpy) +#pragma intrinsic(memset) + +#pragma warning(push) +//'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' +#pragma warning(disable : 4668) +#if PX_VC == 10 +#pragma warning(disable : 4987) // nonstandard extension used: 'throw (...)' +#endif +#include +#pragma warning(pop) + +#pragma warning(push) +#pragma warning(disable : 4985) // 'symbol name': attributes not present on previous declaration +#include +#pragma warning(pop) + +#include +// do not include for ARM target +#if !PX_ARM && !PX_A64 +#include +#endif + +#pragma intrinsic(_BitScanForward) +#pragma intrinsic(_BitScanReverse) + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/* +* Implements a memory barrier +*/ +PX_FORCE_INLINE void PxMemoryBarrier() +{ + _ReadWriteBarrier(); + /* long Barrier; + __asm { + xchg Barrier, eax + }*/ +} + +/*! +Returns the index of the highest set bit. Not valid for zero arg. +*/ +PX_FORCE_INLINE uint32_t PxHighestSetBitUnsafe(uint64_t v) +{ + unsigned long retval; +#ifndef PX_GENERATE_META_DATA + _BitScanReverse64(&retval, v); +#endif + return retval; +} + +/*! +Returns the index of the highest set bit. Not valid for zero arg. +*/ +PX_FORCE_INLINE uint32_t PxHighestSetBitUnsafe(uint32_t v) +{ + unsigned long retval; + _BitScanReverse(&retval, v); + return retval; +} + +/*! +Returns the index of the lowest set bit. Undefined for zero arg. +*/ +PX_FORCE_INLINE uint32_t PxLowestSetBitUnsafe(uint64_t v) +{ + unsigned long retval; +#ifndef PX_GENERATE_META_DATA + _BitScanForward64(&retval, v); +#endif + return retval; +} + +/*! +Returns the index of the lowest set bit. Undefined for zero arg. +*/ +PX_FORCE_INLINE uint32_t PxLowestSetBitUnsafe(uint32_t v) +{ + unsigned long retval; + _BitScanForward(&retval, v); + return retval; +} + +/*! +Returns the number of leading zeros in v. Returns 32 for v=0. +*/ +PX_FORCE_INLINE uint32_t PxCountLeadingZeros(uint32_t v) +{ + if(v) + { + unsigned long bsr = (unsigned long)-1; + _BitScanReverse(&bsr, v); + return 31 - bsr; + } + else + return 32; +} + +/*! +Prefetch aligned cache size around \c ptr+offset. +*/ +#if !PX_ARM && !PX_A64 +PX_FORCE_INLINE void PxPrefetchLine(const void* ptr, uint32_t offset = 0) +{ + // cache line on X86/X64 is 64-bytes so a 128-byte prefetch would require 2 prefetches. + // However, we can only dispatch a limited number of prefetch instructions so we opt to prefetch just 1 cache line + /*_mm_prefetch(((const char*)ptr + offset), _MM_HINT_T0);*/ + // We get slightly better performance prefetching to non-temporal addresses instead of all cache levels + _mm_prefetch(((const char*)ptr + offset), _MM_HINT_NTA); +} +#else +PX_FORCE_INLINE void PxPrefetchLine(const void* ptr, uint32_t offset = 0) +{ + // arm does have 32b cache line size + __prefetch(((const char*)ptr + offset)); +} +#endif + +/*! +Prefetch \c count bytes starting at \c ptr. +*/ +#if !PX_ARM +PX_FORCE_INLINE void PxPrefetch(const void* ptr, uint32_t count = 1) +{ + const char* cp = (char*)ptr; + uint64_t p = size_t(ptr); + uint64_t startLine = p >> 6, endLine = (p + count - 1) >> 6; + uint64_t lines = endLine - startLine + 1; + do + { + PxPrefetchLine(cp); + cp += 64; + } while(--lines); +} +#else +PX_FORCE_INLINE void PxPrefetch(const void* ptr, uint32_t count = 1) +{ + const char* cp = (char*)ptr; + uint32_t p = size_t(ptr); + uint32_t startLine = p >> 5, endLine = (p + count - 1) >> 5; + uint32_t lines = endLine - startLine + 1; + do + { + PxPrefetchLine(cp); + cp += 32; + } while(--lines); +} +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/windows/PxWindowsMathIntrinsics.h b/engine/third_party/physx/include/foundation/windows/PxWindowsMathIntrinsics.h new file mode 100644 index 00000000..94c5c777 --- /dev/null +++ b/engine/third_party/physx/include/foundation/windows/PxWindowsMathIntrinsics.h @@ -0,0 +1,178 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_WINDOWS_MATH_INTRINSICS_H +#define PX_WINDOWS_MATH_INTRINSICS_H + +#include "foundation/PxAssert.h" + +#if !PX_WINDOWS_FAMILY +#error "This file should only be included by Windows builds!!" +#endif + +#include +#include + +#if !PX_DOXYGEN +namespace physx +{ +namespace intrinsics +{ +#endif + +//! \brief platform-specific absolute value +PX_CUDA_CALLABLE PX_FORCE_INLINE float abs(float a) +{ + return ::fabsf(a); +} + +//! \brief platform-specific select float +PX_CUDA_CALLABLE PX_FORCE_INLINE float fsel(float a, float b, float c) +{ + return (a >= 0.0f) ? b : c; +} + +//! \brief platform-specific sign +PX_CUDA_CALLABLE PX_FORCE_INLINE float sign(float a) +{ + return (a >= 0.0f) ? 1.0f : -1.0f; +} + +//! \brief platform-specific reciprocal +PX_CUDA_CALLABLE PX_FORCE_INLINE float recip(float a) +{ + return 1.0f / a; +} + +//! \brief platform-specific reciprocal estimate +PX_CUDA_CALLABLE PX_FORCE_INLINE float recipFast(float a) +{ + return 1.0f / a; +} + +//! \brief platform-specific square root +PX_CUDA_CALLABLE PX_FORCE_INLINE float sqrt(float a) +{ + return ::sqrtf(a); +} + +//! \brief platform-specific reciprocal square root +PX_CUDA_CALLABLE PX_FORCE_INLINE float recipSqrt(float a) +{ + return 1.0f / ::sqrtf(a); +} + +//! \brief platform-specific reciprocal square root estimate +PX_CUDA_CALLABLE PX_FORCE_INLINE float recipSqrtFast(float a) +{ + return 1.0f / ::sqrtf(a); +} + +//! \brief platform-specific sine +PX_CUDA_CALLABLE PX_FORCE_INLINE float sin(float a) +{ + return ::sinf(a); +} + +//! \brief platform-specific cosine +PX_CUDA_CALLABLE PX_FORCE_INLINE float cos(float a) +{ + return ::cosf(a); +} + +//! \brief platform-specific minimum +PX_CUDA_CALLABLE PX_FORCE_INLINE float selectMin(float a, float b) +{ + return a < b ? a : b; +} + +//! \brief platform-specific maximum +PX_CUDA_CALLABLE PX_FORCE_INLINE float selectMax(float a, float b) +{ + return a > b ? a : b; +} + +//! \brief platform-specific finiteness check (not INF or NAN) +PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite(float a) +{ +#if PX_CUDA_COMPILER + return !!isfinite(a); +#else + return (0 == ((_FPCLASS_SNAN | _FPCLASS_QNAN | _FPCLASS_NINF | _FPCLASS_PINF) & _fpclass(a))); +#endif +} + +//! \brief platform-specific finiteness check (not INF or NAN) +PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite(double a) +{ +#if PX_CUDA_COMPILER + return !!isfinite(a); +#else + return (0 == ((_FPCLASS_SNAN | _FPCLASS_QNAN | _FPCLASS_NINF | _FPCLASS_PINF) & _fpclass(a))); +#endif +} + +/*! +Sets \c count bytes starting at \c dst to zero. +*/ +PX_FORCE_INLINE void* memZero(void* dest, size_t count) +{ + return memset(dest, 0, count); +} + +/*! +Sets \c count bytes starting at \c dst to \c c. +*/ +PX_FORCE_INLINE void* memSet(void* dest, int32_t c, size_t count) +{ + return memset(dest, c, count); +} + +/*! +Copies \c count bytes from \c src to \c dst. User memMove if regions overlap. +*/ +PX_FORCE_INLINE void* memCopy(void* dest, const void* src, size_t count) +{ + return memcpy(dest, src, count); +} + +/*! +Copies \c count bytes from \c src to \c dst. Supports overlapping regions. +*/ +PX_FORCE_INLINE void* memMove(void* dest, const void* src, size_t count) +{ + return memmove(dest, src, count); +} + +#if !PX_DOXYGEN +} // namespace intrinsics +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/foundation/windows/PxWindowsTrigConstants.h b/engine/third_party/physx/include/foundation/windows/PxWindowsTrigConstants.h new file mode 100644 index 00000000..58180c84 --- /dev/null +++ b/engine/third_party/physx/include/foundation/windows/PxWindowsTrigConstants.h @@ -0,0 +1,60 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_WINDOWS_TRIG_CONSTANTS_H +#define PX_WINDOWS_TRIG_CONSTANTS_H + +namespace physx +{ +namespace aos +{ + +#define PX_GLOBALCONST extern const __declspec(selectany) + +__declspec(align(16)) struct PX_VECTORF32 +{ + float f[4]; +}; + +PX_GLOBALCONST PX_VECTORF32 g_PXSinCoefficients0 = { { 1.0f, -0.166666667f, 8.333333333e-3f, -1.984126984e-4f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXSinCoefficients1 = { { 2.755731922e-6f, -2.505210839e-8f, 1.605904384e-10f, -7.647163732e-13f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXSinCoefficients2 = { { 2.811457254e-15f, -8.220635247e-18f, 1.957294106e-20f, -3.868170171e-23f } }; +PX_GLOBALCONST PX_VECTORF32 g_PXCosCoefficients0 = { { 1.0f, -0.5f, 4.166666667e-2f, -1.388888889e-3f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXCosCoefficients1 = { { 2.480158730e-5f, -2.755731922e-7f, 2.087675699e-9f, -1.147074560e-11f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXCosCoefficients2 = { { 4.779477332e-14f, -1.561920697e-16f, 4.110317623e-19f, -8.896791392e-22f } }; +PX_GLOBALCONST PX_VECTORF32 g_PXReciprocalTwoPi = { { PxInvTwoPi, PxInvTwoPi, PxInvTwoPi, PxInvTwoPi } }; +PX_GLOBALCONST PX_VECTORF32 g_PXTwoPi = { { PxTwoPi, PxTwoPi, PxTwoPi, PxTwoPi } }; + +} // namespace aos +} // namespace physx + +#endif diff --git a/engine/third_party/physx/include/geometry/PxBVH.h b/engine/third_party/physx/include/geometry/PxBVH.h new file mode 100644 index 00000000..cc3c8b4c --- /dev/null +++ b/engine/third_party/physx/include/geometry/PxBVH.h @@ -0,0 +1,282 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_BVH_H +#define PX_BVH_H + +#include "common/PxBase.h" +#include "foundation/PxTransform.h" +#include "foundation/PxBounds3.h" +#include "geometry/PxGeometryQueryFlags.h" +#include "geometry/PxReportCallback.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxGeometry; +class PxPlane; + +/** +\brief Class representing a bounding volume hierarchy. + +PxBVH can be provided to PxScene::addActor. In this case the scene query +pruning structure inside PhysX SDK will store/update one bound per actor. +The scene queries against such an actor will query actor bounds and then +make a local space query against the provided BVH, which is in actor's +local space. + +PxBVH can also be used as a standalone data-structure for arbitrary +purposes, unrelated to PxScene / PxActor. + +\see PxScene::addActor +*/ +class PxBVH : public PxBase +{ +public: + + struct RaycastCallback + { + RaycastCallback() {} + virtual ~RaycastCallback() {} + + // Reports one raycast or sweep hit. + // boundsIndex [in] Index of touched bounds + // distance [in/out] Impact distance. Shrinks the ray if written out. + // return false to abort the query + virtual bool reportHit(PxU32 boundsIndex, PxReal& distance) = 0; + }; + + struct OverlapCallback + { + OverlapCallback() {} + virtual ~OverlapCallback() {} + + // Reports one overlap hit. + // boundsIndex [in] Index of touched bounds + // return false to abort the query + virtual bool reportHit(PxU32 boundsIndex) = 0; + }; + + struct TraversalCallback + { + TraversalCallback() {} + virtual ~TraversalCallback() {} + + // Reports one visited node. + // bounds [in] node bounds + // return true to continue traversing this branch + virtual bool visitNode(const PxBounds3& bounds) = 0; + + // Reports one validated leaf node. Called on leaf nodes after visitNode returns true on them. + // nbPrims [in] number of primitives in the node + // prims [in] primitives in the node (nbPrims entries) + // return false to abort the query + virtual bool reportLeaf(PxU32 nbPrims, const PxU32* prims) = 0; + }; + + /** + \brief Raycast test against a BVH. + + \param[in] origin The origin of the ray. + \param[in] unitDir Normalized direction of the ray. + \param[in] maxDist Maximum ray length, has to be in the [0, inf) range + \param[in] cb Raycast callback, called once per hit + \param[in] queryFlags Optional flags controlling the query. + \return false if query has been aborted + */ + virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, float maxDist, RaycastCallback& cb, PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT) const = 0; + + /** + \brief Sweep test against a BVH. + + \param[in] geom The query volume + \param[in] pose The pose of the query volume + \param[in] unitDir Normalized direction of the sweep. + \param[in] maxDist Maximum sweep length, has to be in the [0, inf) range + \param[in] cb Raycast callback, called once per hit + \param[in] queryFlags Optional flags controlling the query. + \return false if query has been aborted + */ + virtual bool sweep(const PxGeometry& geom, const PxTransform& pose, const PxVec3& unitDir, float maxDist, RaycastCallback& cb, PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT) const = 0; + + /** + \brief Overlap test against a BVH. + + \param[in] geom The query volume + \param[in] pose The pose of the query volume + \param[in] cb Overlap callback, called once per hit + \param[in] queryFlags Optional flags controlling the query. + \return false if query has been aborted + */ + virtual bool overlap(const PxGeometry& geom, const PxTransform& pose, OverlapCallback& cb, PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT) const = 0; + + /** + \brief Frustum culling test against a BVH. + + This is similar in spirit to an overlap query using a convex object around the frustum. + However this specialized query has better performance, and can support more than the 6 planes + of a frustum, which can be useful in portal-based engines. + + On the other hand this test only returns a conservative number of bounds, i.e. some of the returned + bounds may actually be outside the frustum volume, close to it but not touching it. This is usually + an ok performance trade-off when the function is used for view-frustum culling. + + \param[in] nbPlanes Number of planes. Only 32 planes max are supported. + \param[in] planes Array of planes, should be in the same space as the BVH. + \param[in] cb Overlap callback, called once per visible object + \param[in] queryFlags Optional flags controlling the query. + \return false if query has been aborted + */ + virtual bool cull(PxU32 nbPlanes, const PxPlane* planes, OverlapCallback& cb, PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT) const = 0; + + /** + \brief Returns the number of bounds in the BVH. + + You can use #getBounds() to retrieve the bounds. + + \note These are the user-defined bounds passed to the BVH builder, not the internal bounds around each BVH node. + + \return Number of bounds in the BVH. + + \see getBounds() getBoundsForModification() + */ + virtual PxU32 getNbBounds() const = 0; + + /** + \brief Retrieve the read-only bounds in the BVH. + + \note These are the user-defined bounds passed to the BVH builder, not the internal bounds around each BVH node. + + \see PxBounds3 getNbBounds() getBoundsForModification() + */ + virtual const PxBounds3* getBounds() const = 0; + + /** + \brief Retrieve the bounds in the BVH. + + These bounds can be modified. Call refit() after modifications are done. + + \note These are the user-defined bounds passed to the BVH builder, not the internal bounds around each BVH node. + + \see PxBounds3 getNbBounds() getBounds() refit() updateBounds() partialRefit() + */ + PX_FORCE_INLINE PxBounds3* getBoundsForModification() + { + return const_cast(getBounds()); + } + + /** + \brief Refit the BVH. + + This function "refits" the tree, i.e. takes the new (leaf) bounding boxes into account and + recomputes all the BVH bounds accordingly. This is an O(n) operation with n = number of bounds in the BVH. + + This works best with minor bounds modifications, i.e. when the bounds remain close to their initial values. + With large modifications the tree quality degrades more and more, and subsequent query performance suffers. + It might be a better strategy to create a brand new BVH if bounds change drastically. + + This function refits the whole tree after an arbitrary number of bounds have potentially been modified by + users (via getBoundsForModification()). If you only have a small number of bounds to update, it might be + more efficient to use setBounds() and partialRefit() instead. + + \see getNbBounds() getBoundsForModification() updateBounds() partialRefit() + */ + virtual void refit() = 0; + + /** + \brief Update single bounds. + + This is an alternative to getBoundsForModification() / refit(). If you only have a small set of bounds to + update, it can be inefficient to call the refit() function, because it refits the whole BVH. + + Instead, one can update individual bounds with this updateBounds() function. It sets the new bounds and + marks the corresponding BVH nodes for partial refit. Once all the individual bounds have been updated, + call partialRefit() to only refit the subset of marked nodes. + + \param[in] boundsIndex Index of updated bounds. Valid range is between 0 and getNbBounds(). + \param[in] newBounds Updated bounds. + + \return true if success + + \see getNbBounds() getBoundsForModification() refit() partialRefit() + */ + virtual bool updateBounds(PxU32 boundsIndex, const PxBounds3& newBounds) = 0; + + /** + \brief Refits subset of marked nodes. + + This is an alternative to the refit() function, to be called after updateBounds() calls. + See updateBounds() for details. + + \see getNbBounds() getBoundsForModification() refit() updateBounds() + */ + virtual void partialRefit() = 0; + + /** + \brief Generic BVH traversal function. + + This can be used to implement custom BVH traversal functions if provided ones are not enough. + In particular this can be used to visualize the tree's bounds. + + \param[in] cb Traversal callback, called for each visited node + \return false if query has been aborted + */ + virtual bool traverse(TraversalCallback& cb) const = 0; + + virtual const char* getConcreteTypeName() const PX_OVERRIDE PX_FINAL { return "PxBVH"; } +protected: + PX_INLINE PxBVH(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxBVH(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + virtual ~PxBVH() {} + + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxBVH", PxBase); } +}; + + struct PxGeomIndexPair; + + /** + \brief BVH-vs-BVH overlap test + + This function returns pairs of box indices that belong to both the first & second input bvhs. + + \param[in] callback The callback object used to report results + \param[in] bvh0 First bvh + \param[in] bvh1 Second bvh + \return true if an overlap has been detected + + \see PxBVH PxReportCallback + */ + PX_C_EXPORT PX_PHYSX_COMMON_API bool PX_CALL_CONV PxFindOverlap(PxReportCallback& callback, const PxBVH& bvh0, const PxBVH& bvh1); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/geometry/PxBVHBuildStrategy.h b/engine/third_party/physx/include/geometry/PxBVHBuildStrategy.h new file mode 100644 index 00000000..e7d51439 --- /dev/null +++ b/engine/third_party/physx/include/geometry/PxBVHBuildStrategy.h @@ -0,0 +1,58 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_BVH_BUILD_STRATEGY_H +#define PX_BVH_BUILD_STRATEGY_H + +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Desired build strategy for bounding-volume hierarchies +*/ +struct PxBVHBuildStrategy +{ + enum Enum + { + eFAST = 0, //!< Fast build strategy. Fast build speed, good runtime performance in most cases. Recommended for runtime cooking. + eDEFAULT = 1, //!< Default build strategy. Medium build speed, good runtime performance in all cases. + eSAH = 2, //!< SAH build strategy. Slower builds, slightly improved runtime performance in some cases. + + eLAST + }; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/geometry/PxBoxGeometry.h b/engine/third_party/physx/include/geometry/PxBoxGeometry.h new file mode 100644 index 00000000..92dab583 --- /dev/null +++ b/engine/third_party/physx/include/geometry/PxBoxGeometry.h @@ -0,0 +1,113 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_BOX_GEOMETRY_H +#define PX_BOX_GEOMETRY_H +#include "geometry/PxGeometry.h" +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Class representing the geometry of a box. + +The geometry of a box can be fully specified by its half extents. This is the half of its width, height, and depth. +\note The scaling of the box is expected to be baked into these values, there is no additional scaling parameter. +*/ +class PxBoxGeometry : public PxGeometry +{ +public: + /** + \brief Constructor to initialize half extents from scalar parameters. + \param hx Initial half extents' x component. + \param hy Initial half extents' y component. + \param hz Initial half extents' z component. + */ + PX_INLINE PxBoxGeometry(PxReal hx=0.0f, PxReal hy=0.0f, PxReal hz=0.0f) : PxGeometry(PxGeometryType::eBOX), halfExtents(hx, hy, hz) {} + + /** + \brief Constructor to initialize half extents from vector parameter. + \param halfExtents_ Initial half extents. + */ + PX_INLINE PxBoxGeometry(PxVec3 halfExtents_) : PxGeometry(PxGeometryType::eBOX), halfExtents(halfExtents_) {} + + /** + \brief Copy constructor. + + \param[in] that Other object + */ + PX_INLINE PxBoxGeometry(const PxBoxGeometry& that) : PxGeometry(that), halfExtents(that.halfExtents) {} + + /** + \brief Assignment operator + */ + PX_INLINE void operator=(const PxBoxGeometry& that) + { + mType = that.mType; + halfExtents = that.halfExtents; + } + + /** + \brief Returns true if the geometry is valid. + + \return True if the current settings are valid + + \note A valid box has a positive extent in each direction (halfExtents.x > 0, halfExtents.y > 0, halfExtents.z > 0). + It is illegal to call PxPhysics::createShape with a box that has zero extent in any direction. + + \see PxPhysics::createShape + */ + PX_INLINE bool isValid() const; + +public: + /** + \brief Half of the width, height, and depth of the box. + */ + PxVec3 halfExtents; +}; + +PX_INLINE bool PxBoxGeometry::isValid() const +{ + if(mType != PxGeometryType::eBOX) + return false; + if(!halfExtents.isFinite()) + return false; + if(halfExtents.x <= 0.0f || halfExtents.y <= 0.0f || halfExtents.z <= 0.0f) + return false; + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/geometry/PxCapsuleGeometry.h b/engine/third_party/physx/include/geometry/PxCapsuleGeometry.h new file mode 100644 index 00000000..bd5ad868 --- /dev/null +++ b/engine/third_party/physx/include/geometry/PxCapsuleGeometry.h @@ -0,0 +1,115 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CAPSULE_GEOMETRY_H +#define PX_CAPSULE_GEOMETRY_H +#include "geometry/PxGeometry.h" +#include "foundation/PxFoundationConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Class representing the geometry of a capsule. + +Capsules are shaped as the union of a cylinder of length 2 * halfHeight and with the +given radius centered at the origin and extending along the x axis, and two hemispherical ends. +\note The scaling of the capsule is expected to be baked into these values, there is no additional scaling parameter. + +The function PxTransformFromSegment is a helper for generating an appropriate transform for the capsule from the capsule's interior line segment. + +\see PxTransformFromSegment +*/ +class PxCapsuleGeometry : public PxGeometry +{ +public: + /** + \brief Constructor, initializes to a capsule with passed radius and half height. + */ + PX_INLINE PxCapsuleGeometry(PxReal radius_=0.0f, PxReal halfHeight_=0.0f) : PxGeometry(PxGeometryType::eCAPSULE), radius(radius_), halfHeight(halfHeight_) {} + + /** + \brief Copy constructor. + + \param[in] that Other object + */ + PX_INLINE PxCapsuleGeometry(const PxCapsuleGeometry& that) : PxGeometry(that), radius(that.radius), halfHeight(that.halfHeight) {} + + /** + \brief Assignment operator + */ + PX_INLINE void operator=(const PxCapsuleGeometry& that) + { + mType = that.mType; + radius = that.radius; + halfHeight = that.halfHeight; + } + + /** + \brief Returns true if the geometry is valid. + + \return True if the current settings are valid. + + \note A valid capsule has radius > 0, halfHeight >= 0. + It is illegal to call PxPhysics::createShape with a capsule that has zero radius or height. + + \see PxPhysics::createShape + */ + PX_INLINE bool isValid() const; + +public: + /** + \brief The radius of the capsule. + */ + PxReal radius; + + /** + \brief half of the capsule's height, measured between the centers of the hemispherical ends. + */ + PxReal halfHeight; +}; + +PX_INLINE bool PxCapsuleGeometry::isValid() const +{ + if(mType != PxGeometryType::eCAPSULE) + return false; + if(!PxIsFinite(radius) || !PxIsFinite(halfHeight)) + return false; + if(radius <= 0.0f || halfHeight < 0.0f) + return false; + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/geometry/PxConvexCoreGeometry.h b/engine/third_party/physx/include/geometry/PxConvexCoreGeometry.h new file mode 100644 index 00000000..ca18a91c --- /dev/null +++ b/engine/third_party/physx/include/geometry/PxConvexCoreGeometry.h @@ -0,0 +1,360 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CONVEX_CORE_GEOMETRY_H +#define PX_CONVEX_CORE_GEOMETRY_H + +#include "foundation/PxVec3.h" +#include "foundation/PxMemory.h" +#include "geometry/PxGeometry.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Pre-authored cores for convex core geometry + */ + class PxConvexCore + { + public: + /** + \brief Enumeration of core types for convex core geometries. + + This enum defines the various cores that can be used as the basis + for creating convex core geometries. Each type represents a different + fundamental shape that can be extended with a margin to create more + complex convex shapes. + */ + enum Type + { + ePOINT, + eSEGMENT, + eBOX, + eELLIPSOID, + eCYLINDER, + eCONE, + + eCOUNT + }; + + /** + \brief Point core data + + The point core has no additional data. The point is located + at the origin of the geometry's local space + */ + struct Point + { + static const Type TYPE = ePOINT; + }; + + /** + \brief Segment core data + + The segment is defined by its length and goes along the geometry's + local space X axis, from -length/2 to length/2 + */ + struct Segment + { + static const Type TYPE = eSEGMENT; + + /// Segment length + PxReal length; + + PX_INLINE Segment() {} + + /** + \brief Constructs a SegmentCore with a specified length + \param _length Segment length + */ + PX_INLINE Segment(PxReal _length) : length(_length) {} + }; + + /** + \brief Box core data + + The box is defined by its extents, centered at the origin of the + geometry's local space, and aligned with the local space's axes + */ + struct Box + { + static const Type TYPE = eBOX; + + /// Box extents + PxVec3 extents; + + PX_INLINE Box() {} + + /** + \brief Constructs a BoxCore with specified extents + \param eX Extent in the x direction + \param eY Extent in the y direction + \param eZ Extent in the z direction + */ + PX_INLINE Box(PxReal eX, PxReal eY, PxReal eZ) : extents(eX, eY, eZ) {} + + /** + \brief Constructs a BoxCore with specified extents + \param _extents Vector containing extents in x, y, and z directions + */ + PX_INLINE Box(const PxVec3& _extents) : extents(_extents) {} + }; + + /** + \brief Ellipsoid core data + + The ellipsoid is defined by its radii and is centered at the origin + of the geometry's local space + */ + struct Ellipsoid + { + static const Type TYPE = eELLIPSOID; + + /// Ellipsoid radii + PxVec3 radii; + + PX_INLINE Ellipsoid() {} + + /** + \brief Constructs an EllipsoidCore with specified radii + \param rX Radius in the x direction + \param rY Radius in the y direction + \param rZ Radius in the z direction + */ + PX_INLINE Ellipsoid(PxReal rX, PxReal rY, PxReal rZ) : radii(rX, rY, rZ) {} + + /** + \brief Constructs an EllipsoidCore with specified radii + \param _radii Vector containing radii in x, y, and z directions + */ + PX_INLINE Ellipsoid(const PxVec3& _radii) : radii(_radii) {} + }; + + /** + \brief Cylinder core data + + The cylinder is defined by its height and radius. It is centered at the origin + of the geometry's local space with its axis along the X axis + */ + struct Cylinder + { + static const Type TYPE = eCYLINDER; + + /// Cylinder height + PxReal height; + + /// Cylinder radius + PxReal radius; + + PX_INLINE Cylinder() {} + + /** + \brief Constructs a CylinderCore with specified height and radius + \param _height Cylinder height + \param _radius Cylinder radius + */ + PX_INLINE Cylinder(PxReal _height, PxReal _radius) : height(_height), radius(_radius) {} + }; + + /** + \brief Cone core data + + The cone is defined by its height and base radius. It is centered at the origin + of the geometry's local space with its axis along the X axis and the base + at x = -height/2 + */ + struct Cone + { + static const Type TYPE = eCONE; + + /// Cone height + PxReal height; + + /// Cone base radius + PxReal radius; + + PX_INLINE Cone() {} + + /** + \brief Constructs a ConeCore with specified height and radius + \param _height Cone height + \param _radius Cone base radius + */ + PX_INLINE Cone(PxReal _height, PxReal _radius) : height(_height), radius(_radius) {} + }; + }; + + /** + \brief Convex core geometry class. + + This class allows users to create a variety of convex shapes. Each shape is defined by: + 1. A core, specified by one of the pre-authored GJK support functions. + 2. A margin, which is an arbitrary distance that extends the core. + + The resulting convex shape includes both the core and the surrounding space within the margin. + + Simple examples include: + - A sphere: created from a point core with a non-zero margin (radius). + - A capsule: created from a segment core with a non-zero margin. + */ + class PxConvexCoreGeometry : public PxGeometry + { + public: + + /** + \brief Default constructor + */ + PX_INLINE PxConvexCoreGeometry(); + + /** + \brief Constructor + \tparam Core The type of the core + \param core The core to use + \param margin The margin to add around the core. Defaults to 0 + */ + template + PX_INLINE PxConvexCoreGeometry(const Core& core, PxReal margin = 0); + + /** + \brief Copy constructor + \param that The geometry to copy from + */ + PX_INLINE PxConvexCoreGeometry(const PxConvexCoreGeometry& that); + + /** + \brief Assignment operator + \param that The geometry to assign from + */ + PX_INLINE PxConvexCoreGeometry& operator=(const PxConvexCoreGeometry& that); + + /** + \brief Get the type of the core + \return The type of the core + */ + PX_INLINE PxConvexCore::Type getCoreType() const; + + /// Maximum size of the core data in bytes. + static const PxU32 MAX_CORE_SIZE = sizeof(PxReal) * 6; + + /** + \brief Get a pointer to the core data. + \return A pointer to the core data. + */ + PX_INLINE const void* getCoreData() const; + + /** + \brief Get the core. + \return The core. + */ + template + PX_INLINE const Core& getCore() const; + + /** + \brief Get the margin of the convex core geometry. + \return The margin size. + */ + PX_INLINE PxReal getMargin() const; + + /** + \brief Check if the convex core geometry is valid. + \return True if the geometry is valid, false otherwise. + */ + PX_PHYSX_COMMON_API bool isValid() const; + + private: + + // Core type + PxConvexCore::Type mCoreType; + // Core data + PxU8 mCore[MAX_CORE_SIZE]; + // Margin + PxReal mMargin; + }; + + PX_INLINE PxConvexCoreGeometry::PxConvexCoreGeometry() + : + PxGeometry(PxGeometryType::eCONVEXCORE), + mCoreType(PxConvexCore::Type(-1)), mMargin(0) + {} + + template + PX_INLINE PxConvexCoreGeometry::PxConvexCoreGeometry(const Core& core, PxReal margin) + : + PxGeometry(PxGeometryType::eCONVEXCORE), + mCoreType(Core::TYPE), mMargin(margin) + { + PX_ASSERT(sizeof(Core) <= MAX_CORE_SIZE); + PxMemCopy(mCore, &core, sizeof(Core)); + } + + PX_INLINE PxConvexCoreGeometry::PxConvexCoreGeometry(const PxConvexCoreGeometry& that) + : + PxGeometry(that), + mCoreType(that.getCoreType()), mMargin(that.getMargin()) + { + PxMemCopy(mCore, that.mCore, MAX_CORE_SIZE); + } + + PX_INLINE PxConvexCoreGeometry& PxConvexCoreGeometry::operator = (const PxConvexCoreGeometry& that) + { + mType = that.mType; + mCoreType = that.mCoreType; + mMargin = that.mMargin; + PxMemCopy(mCore, that.mCore, MAX_CORE_SIZE); + return *this; + } + + PX_INLINE PxConvexCore::Type PxConvexCoreGeometry::getCoreType() const + { + return mCoreType; + } + + PX_INLINE const void* PxConvexCoreGeometry::getCoreData() const + { + return mCore; + } + + template + PX_INLINE const Core& PxConvexCoreGeometry::getCore() const + { + PX_ASSERT(Core::TYPE == mCoreType); + return *reinterpret_cast(getCoreData()); + } + + PX_INLINE PxReal PxConvexCoreGeometry::getMargin() const + { + return mMargin; + } + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/geometry/PxConvexMesh.h b/engine/third_party/physx/include/geometry/PxConvexMesh.h new file mode 100644 index 00000000..b7495e33 --- /dev/null +++ b/engine/third_party/physx/include/geometry/PxConvexMesh.h @@ -0,0 +1,184 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CONVEX_MESH_H +#define PX_CONVEX_MESH_H + +#include "foundation/PxVec3.h" +#include "foundation/PxMat33.h" +#include "common/PxBase.h" + +#if !PX_DOXYGEN +namespace physx +{ +class PxBounds3; +#endif + +/** +\brief Polygon data + +Plane format: (mPlane[0],mPlane[1],mPlane[2]).dot(x) + mPlane[3] = 0 +With the normal outward-facing from the hull. +*/ +struct PxHullPolygon +{ + PxReal mPlane[4]; //!< Plane equation for this polygon + PxU16 mNbVerts; //!< Number of vertices/edges in the polygon + PxU16 mIndexBase; //!< Offset in index buffer +}; + +/** +\brief A convex mesh. + +Internally represented as a list of convex polygons. The number +of polygons is limited to 256. + +To avoid duplicating data when you have several instances of a particular +mesh positioned differently, you do not use this class to represent a +convex object directly. Instead, you create an instance of this mesh via +the PxConvexMeshGeometry and PxShape classes. + +

Creation

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

Visualizations:

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

Creation

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

Visualizations:

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

Creation

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

Visualizations:

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

Creation

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

Creation

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

Visualizations:

+\li #PxVisualizationParameter::eCOLLISION_AABBS +\li #PxVisualizationParameter::eCOLLISION_SHAPES +\li #PxVisualizationParameter::eCOLLISION_AXES +\li #PxVisualizationParameter::eCOLLISION_FNORMALS +\li #PxVisualizationParameter::eCOLLISION_EDGES + +\see PxTriangleMeshDesc PxTriangleMeshGeometry PxShape PxPhysics.createTriangleMesh() +*/ +class PxTriangleMesh : public PxRefCounted +{ + public: + /** + \brief Returns the number of vertices. + \return number of vertices + \see getVertices() + */ + virtual PxU32 getNbVertices() const = 0; + + /** + \brief Returns the vertices. + \return array of vertices + \see getNbVertices() + */ + virtual const PxVec3* getVertices() const = 0; + + /** + \brief Returns all mesh vertices for modification. + + This function will return the vertices of the mesh so that their positions can be changed in place. + After modifying the vertices you must call refitBVH for the refitting to actually take place. + This function maintains the old mesh topology (triangle indices). + + \return inplace vertex coordinates for each existing mesh vertex. + + \note It is recommended to use this feature for scene queries only. + \note Size of array returned is equal to the number returned by getNbVertices(). + \note This function operates on cooked vertex indices. + \note This means the index mapping and vertex count can be different from what was provided as an input to the cooking routine. + \note To achieve unchanged 1-to-1 index mapping with orignal mesh data (before cooking) please use the following cooking flags: + \note eWELD_VERTICES = 0, eDISABLE_CLEAN_MESH = 1. + \note It is also recommended to make sure that a call to validateTriangleMesh returns true if mesh cleaning is disabled. + \see getNbVertices() + \see refitBVH() + */ + virtual PxVec3* getVerticesForModification() = 0; + + /** + \brief Refits BVH for mesh vertices. + + This function will refit the mesh BVH to correctly enclose the new positions updated by getVerticesForModification. + Mesh BVH will not be reoptimized by this function so significantly different new positions will cause significantly reduced performance. + + \return New bounds for the entire mesh. + + \note For PxMeshMidPhase::eBVH34 trees the refit operation is only available on non-quantized trees (see PxBVH34MidphaseDesc::quantized) + \note PhysX does not keep a mapping from the mesh to mesh shapes that reference it. + \note Call PxShape::setGeometry on each shape which references the mesh, to ensure that internal data structures are updated to reflect the new geometry. + \note PxShape::setGeometry does not guarantee correct/continuous behavior when objects are resting on top of old or new geometry. + \note It is also recommended to make sure that a call to validateTriangleMesh returns true if mesh cleaning is disabled. + \note Active edges information will be lost during refit, the rigid body mesh contact generation might not perform as expected. + \see getNbVertices() + \see getVerticesForModification() + \see PxBVH34MidphaseDesc::quantized + */ + virtual PxBounds3 refitBVH() = 0; + + /** + \brief Returns the number of triangles. + \return number of triangles + \see getTriangles() getTrianglesRemap() + */ + virtual PxU32 getNbTriangles() const = 0; + + /** + \brief Returns the triangle indices. + + The indices can be 16 or 32bit depending on the number of triangles in the mesh. + Call getTriangleMeshFlags() to know if the indices are 16 or 32 bits. + + The number of indices is the number of triangles * 3. + + \return array of triangles + \see getNbTriangles() getTriangleMeshFlags() getTrianglesRemap() + */ + virtual const void* getTriangles() const = 0; + + /** + \brief Reads the PxTriangleMesh flags. + + See the list of flags #PxTriangleMeshFlag + + \return The values of the PxTriangleMesh flags. + + \see PxTriangleMesh + */ + virtual PxTriangleMeshFlags getTriangleMeshFlags() const = 0; + + /** + \brief Returns the triangle remapping table. + + The triangles are internally sorted according to various criteria. Hence the internal triangle order + does not always match the original (user-defined) order. The remapping table helps finding the old + indices knowing the new ones: + + remapTable[ internalTriangleIndex ] = originalTriangleIndex + + \return the remapping table (or NULL if 'PxCookingParams::suppressTriangleMeshRemapTable' has been used) + \see getNbTriangles() getTriangles() PxCookingParams::suppressTriangleMeshRemapTable + */ + virtual const PxU32* getTrianglesRemap() const = 0; + + /** + \brief Decrements the reference count of a triangle mesh and releases it if the new reference count is zero. + + \see PxPhysics.createTriangleMesh() + */ + virtual void release() = 0; + + /** + \brief Returns material table index of given triangle + + This function takes a post cooking triangle index. + + \param[in] triangleIndex (internal) index of desired triangle + \return Material table index, or 0xffff if no per-triangle materials are used + */ + virtual PxMaterialTableIndex getTriangleMaterialIndex(PxTriangleID triangleIndex) const = 0; + + /** + \brief Returns the local-space (vertex space) AABB from the triangle mesh. + + \return local-space bounds + */ + virtual PxBounds3 getLocalBounds() const = 0; + + /** + \brief Returns the local-space Signed Distance Field for this mesh if it has one. + \return local-space SDF. + */ + virtual const PxReal* getSDF() const = 0; + + /** + \brief Returns the resolution of the local-space dense SDF. + */ + virtual void getSDFDimensions(PxU32& numX, PxU32& numY, PxU32& numZ) const = 0; + + /** + \brief Sets whether this mesh should be preferred for SDF projection. + + By default, meshes are flagged as preferring projection and the decisions on which mesh to project is based on the triangle and vertex + count. The model with the fewer triangles is projected onto the SDF of the more detailed mesh. + If one of the meshes is set to prefer SDF projection (default) and the other is set to not prefer SDF projection, model flagged as + preferring SDF projection will be projected onto the model flagged as not preferring, regardless of the detail of the respective meshes. + Where both models are flagged as preferring no projection, the less detailed model will be projected as before. + + \param[in] preferProjection Indicates if projection is preferred + */ + virtual void setPreferSDFProjection(bool preferProjection) = 0; + + /** + \brief Returns whether this mesh prefers SDF projection. + \return whether this mesh prefers SDF projection. + */ + virtual bool getPreferSDFProjection() const = 0; + + /** + \brief Returns the mass properties of the mesh assuming unit density. + + The following relationship holds between mass and volume: + + mass = volume * density + + The mass of a unit density mesh is equal to its volume, so this function returns the volume of the mesh. + + Similarly, to obtain the localInertia of an identically shaped object with a uniform density of d, simply multiply the + localInertia of the unit density mesh by d. + + \param[out] mass The mass of the mesh assuming unit density. + \param[out] localInertia The inertia tensor in mesh local space assuming unit density. + \param[out] localCenterOfMass Position of center of mass (or centroid) in mesh local space. + */ + virtual void getMassInformation(PxReal& mass, PxMat33& localInertia, PxVec3& localCenterOfMass) const = 0; + +protected: + PX_INLINE PxTriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxRefCounted(concreteType, baseFlags) {} + PX_INLINE PxTriangleMesh(PxBaseFlags baseFlags) : PxRefCounted(baseFlags) {} + virtual ~PxTriangleMesh() {} + + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxTriangleMesh", PxRefCounted); } +}; + +/** +\deprecated Use PxBVH34TriangleMesh instead. + +\brief A triangle mesh containing the PxMeshMidPhase::eBVH33 structure. + +\see PxMeshMidPhase +*/ +class PX_DEPRECATED PxBVH33TriangleMesh : public PxTriangleMesh +{ + public: +protected: + PX_INLINE PxBVH33TriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxTriangleMesh(concreteType, baseFlags) {} + PX_INLINE PxBVH33TriangleMesh(PxBaseFlags baseFlags) : PxTriangleMesh(baseFlags) {} + virtual ~PxBVH33TriangleMesh() {} + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxBVH33TriangleMesh", PxTriangleMesh); } +}; + +/** + +\brief A triangle mesh containing the PxMeshMidPhase::eBVH34 structure. + +\see PxMeshMidPhase +*/ +class PxBVH34TriangleMesh : public PxTriangleMesh +{ + public: +protected: + PX_INLINE PxBVH34TriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxTriangleMesh(concreteType, baseFlags) {} + PX_INLINE PxBVH34TriangleMesh(PxBaseFlags baseFlags) : PxTriangleMesh(baseFlags) {} + virtual ~PxBVH34TriangleMesh() {} + virtual bool isKindOf(const char* name) const { PX_IS_KIND_OF(name, "PxBVH34TriangleMesh", PxTriangleMesh); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/geometry/PxTriangleMeshGeometry.h b/engine/third_party/physx/include/geometry/PxTriangleMeshGeometry.h new file mode 100644 index 00000000..719c4954 --- /dev/null +++ b/engine/third_party/physx/include/geometry/PxTriangleMeshGeometry.h @@ -0,0 +1,157 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_TRIANGLE_MESH_GEOMETRY_H +#define PX_TRIANGLE_MESH_GEOMETRY_H +#include "geometry/PxGeometry.h" +#include "geometry/PxMeshScale.h" +#include "common/PxCoreUtilityTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxTriangleMesh; + +/** +\brief Flags controlling the simulated behavior of the triangle mesh geometry. + +Used in ::PxMeshGeometryFlags. +*/ +struct PxMeshGeometryFlag +{ + enum Enum + { + eTIGHT_BOUNDS = (1<<0), //!< Use tighter (but more expensive to compute) bounds around the triangle mesh geometry. + eDOUBLE_SIDED = (1<<1) //!< Meshes with this flag set are treated as double-sided. + //!< This flag is currently only used for raycasts and sweeps. It is ignored for overlap queries and has no effect on contact generation, i.e. simulation. + //!< For detailed specifications of this flag for meshes and heightfields please refer to the Geometry Query section of the user guide. + //!< For double-sided collision meshes, consider duplicating their faces with flipped normals. + }; +}; + +/** +\brief collection of set bits defined in PxMeshGeometryFlag. + +\see PxMeshGeometryFlag +*/ +typedef PxFlags PxMeshGeometryFlags; +PX_FLAGS_OPERATORS(PxMeshGeometryFlag::Enum,PxU8) + +/** +\brief Triangle mesh geometry class. + +This class unifies a mesh object with a scaling transform, and +lets the combined object be used anywhere a PxGeometry is needed. + +The scaling is a transform along arbitrary axes contained in the scale object. +The vertices of the mesh in geometry (or shape) space is the +PxMeshScale::toMat33() transform, multiplied by the vertex space vertices +in the PxTriangleMeshGeometry object. +*/ +class PxTriangleMeshGeometry : public PxGeometry +{ +public: + /** + \brief Constructor. By default creates an empty object with a NULL mesh and identity scale. + + \param[in] mesh Mesh pointer. May be NULL, though this will not make the object valid for shape construction. + \param[in] scaling Scale factor. + \param[in] flags Mesh flags. + */ + PX_INLINE PxTriangleMeshGeometry( PxTriangleMesh* mesh = NULL, + const PxMeshScale& scaling = PxMeshScale(), + PxMeshGeometryFlags flags = PxMeshGeometryFlags()) : + PxGeometry (PxGeometryType::eTRIANGLEMESH), + scale (scaling), + meshFlags (flags), + triangleMesh(mesh) + {} + + /** + \brief Copy constructor. + + \param[in] that Other object + */ + PX_INLINE PxTriangleMeshGeometry(const PxTriangleMeshGeometry& that) : + PxGeometry (that), + scale (that.scale), + meshFlags (that.meshFlags), + triangleMesh(that.triangleMesh) + {} + + /** + \brief Assignment operator + */ + PX_INLINE void operator=(const PxTriangleMeshGeometry& that) + { + mType = that.mType; + scale = that.scale; + meshFlags = that.meshFlags; + triangleMesh = that.triangleMesh; + } + + /** + \brief Returns true if the geometry is valid. + + \return True if the current settings are valid for shape creation. + + \note A valid triangle mesh has a positive scale value in each direction (scale.scale.x > 0, scale.scale.y > 0, scale.scale.z > 0). + It is illegal to call PxPhysics::createShape with a triangle mesh that has zero extents in any direction. + + \see PxPhysics::createShape + */ + PX_INLINE bool isValid() const; + +public: + PxMeshScale scale; //!< The scaling transformation. + PxMeshGeometryFlags meshFlags; //!< Mesh flags. + PxPadding<3> paddingFromFlags; //!< padding for mesh flags + PxTriangleMesh* triangleMesh; //!< A reference to the mesh object. +}; + +PX_INLINE bool PxTriangleMeshGeometry::isValid() const +{ + if(mType != PxGeometryType::eTRIANGLEMESH) + return false; + if(!scale.scale.isFinite() || !scale.rotation.isUnit()) + return false; + if(!scale.isValidForTriangleMesh()) + return false; + if(!triangleMesh) + return false; + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/geomutils/PxContactBuffer.h b/engine/third_party/physx/include/geomutils/PxContactBuffer.h new file mode 100644 index 00000000..96ff8126 --- /dev/null +++ b/engine/third_party/physx/include/geomutils/PxContactBuffer.h @@ -0,0 +1,91 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_CONTACTBUFFER_H +#define PX_CONTACTBUFFER_H + +#include "PxPhysXConfig.h" +#include "geomutils/PxContactPoint.h" +#include "PxContact.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxContactBuffer + { + public: + + static const PxU32 MAX_CONTACTS = 256; + + PxContactPoint contacts[MAX_CONTACTS]; + PxU32 count; + PxU32 pad; + + PX_FORCE_INLINE void reset() + { + count = 0; + } + + PX_FORCE_INLINE bool contact(const PxVec3& worldPoint, const PxVec3& worldNormalIn, PxReal separation, PxU32 faceIndex1 = PXC_CONTACT_NO_FACE_INDEX) + { + PX_ASSERT(PxAbs(worldNormalIn.magnitude()-1)<1e-3f); + + if(count>=MAX_CONTACTS) + return false; + + PxContactPoint& p = contacts[count++]; + p.normal = worldNormalIn; + p.point = worldPoint; + p.separation = separation; + p.internalFaceIndex1= faceIndex1; + return true; + } + + PX_FORCE_INLINE bool contact(const PxContactPoint& pt) + { + if(count>=MAX_CONTACTS) + return false; + contacts[count++] = pt; + return true; + } + + PX_FORCE_INLINE PxContactPoint* contact() + { + if(count>=MAX_CONTACTS) + return NULL; + return &contacts[count++]; + } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/geomutils/PxContactPoint.h b/engine/third_party/physx/include/geomutils/PxContactPoint.h new file mode 100644 index 00000000..38850e3c --- /dev/null +++ b/engine/third_party/physx/include/geomutils/PxContactPoint.h @@ -0,0 +1,102 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_POINT_H +#define PX_CONTACT_POINT_H + +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + struct PxContactPoint + { + /** + \brief The normal of the contacting surfaces at the contact point. + + For two shapes s0 and s1, the normal points in the direction that s0 needs to move in to resolve the contact with s1. + */ + PX_ALIGN(16, PxVec3 normal); + + /** + \brief The separation of the shapes at the contact point. A negative separation denotes a penetration. + */ + PxReal separation; + + /** + \brief The point of contact between the shapes, in world space. + */ + PX_ALIGN(16, PxVec3 point); + + /** + \brief The max impulse permitted at this point + */ + PxReal maxImpulse; + + PX_ALIGN(16, PxVec3 targetVel); + + /** + \brief The static friction coefficient + */ + PxReal staticFriction; + + /** + \brief Material flags for this contact (eDISABLE_FRICTION, eDISABLE_STRONG_FRICTION). \see PxMaterialFlag + */ + PxU8 materialFlags; + + /** + \brief The surface index of shape 1 at the contact point. This is used to identify the surface material. + + \note This field is only supported by triangle meshes and heightfields, else it will be set to PXC_CONTACT_NO_FACE_INDEX. + */ + PxU32 internalFaceIndex1; + + /** + \brief The dynamic friction coefficient + */ + PxReal dynamicFriction; + + /** + \brief The restitution coefficient + */ + PxReal restitution; + + /** + \brief Damping coefficient (for compliant contacts) + */ + PxReal damping; + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/gpu/PxGpu.h b/engine/third_party/physx/include/gpu/PxGpu.h new file mode 100644 index 00000000..228ea481 --- /dev/null +++ b/engine/third_party/physx/include/gpu/PxGpu.h @@ -0,0 +1,149 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +#ifndef PX_GPU_H +#define PX_GPU_H + +#include "PxPhysXConfig.h" + + +#if PX_SUPPORT_GPU_PHYSX + +#include "cudamanager/PxCudaContextManager.h" +#include "foundation/PxPreprocessor.h" +#include "foundation/PxFoundation.h" +#include "common/PxPhysXCommonConfig.h" + +/** +\brief PxGpuLoadHook + +This is a helper class for loading the PhysXGpu dll. +If a PhysXGpu dll with a non-default file name needs to be loaded, +PxGpuLoadHook can be sub-classed to provide the custom filenames. + +Once the names are set, the instance must be set for use by PhysX.dll using PxSetPhysXGpuLoadHook(), + +\see PxSetPhysXGpuLoadHook() +*/ +class PxGpuLoadHook +{ +public: + PxGpuLoadHook() {} + virtual ~PxGpuLoadHook() {} + + virtual const char* getPhysXGpuDllName() const = 0; + +protected: +private: +}; + +/** +\brief Sets GPU load hook instance for PhysX dll. + +\param[in] hook GPU load hook. + +\see PxGpuLoadHook +*/ +PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxSetPhysXGpuLoadHook(const PxGpuLoadHook* hook); + +/** + * \brief Ask the NVIDIA control panel which GPU has been selected for use by + * PhysX. Returns -1 if no PhysX capable GPU is found or GPU PhysX has + * been disabled. + */ +PX_C_EXPORT PX_PHYSX_CORE_API int PX_CALL_CONV PxGetSuggestedCudaDeviceOrdinal(physx::PxErrorCallback& errc); + +/** + * \brief Allocate a CUDA Context manager, complete with heaps. + * You only need one CUDA context manager per GPU device you intend to use for + * CUDA tasks. + \param[in] foundation PhysXFoundation instance. + \param[in] desc Cuda context manager desc. + \param[in] profilerCallback PhysX profiler callback instance. + \param[in] launchSynchronous Set launchSynchronous to true for CUDA to report the actual point of failure. + + \see PxGetProfilerCallback() + */ +PX_C_EXPORT PX_PHYSX_CORE_API physx::PxCudaContextManager* PX_CALL_CONV PxCreateCudaContextManager(physx::PxFoundation& foundation, const physx::PxCudaContextManagerDesc& desc, physx::PxProfilerCallback* profilerCallback = NULL, bool launchSynchronous = false); + +/** + * \brief Sets profiler callback to PhysX GPU + \param[in] profilerCallback PhysX profiler callback instance. + + \see PxGetProfilerCallback() + */ +PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxSetPhysXGpuProfilerCallback(physx::PxProfilerCallback* profilerCallback); + +/** + * \brief Sets PhysXFoundation instance + \param[in] foundation PhysXFoundation instance. + + \see PxGetFoundation() + */ +PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxSetPhysXGpuFoundationInstance(physx::PxFoundation& foundation); + +/** +\brief Internally used callback to register function names of cuda kernels +*/ +PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxCudaRegisterFunction(int moduleIndex, const char* functionName); + +/** +\brief Internally used callback to register cuda modules at load time +*/ +PX_C_EXPORT PX_PHYSX_CORE_API void** PX_CALL_CONV PxCudaRegisterFatBinary(void*); + +/** +\brief Access to the registered cuda modules +*/ +PX_C_EXPORT PX_PHYSX_CORE_API void** PX_CALL_CONV PxGetCudaModuleTable(); + +/** +\brief Number of registered cuda modules +*/ +PX_C_EXPORT PX_PHYSX_CORE_API physx::PxU32 PX_CALL_CONV PxGetCudaModuleTableSize(); + +/** +\brief Access to the loaded cuda functions (kernels) +*/ +PX_C_EXPORT PX_PHYSX_CORE_API physx::PxKernelIndex* PX_CALL_CONV PxGetCudaFunctionTable(); + +/** +\brief Number of loaded cuda functions (kernels) +*/ +PX_C_EXPORT PX_PHYSX_CORE_API physx::PxU32 PX_CALL_CONV PxGetCudaFunctionTableSize(); + + +namespace physx +{ + class PxPhysicsGpu; +} + +PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysicsGpu* PX_CALL_CONV PxGetPhysicsGpu(); + + +#endif // PX_SUPPORT_GPU_PHYSX + +#endif diff --git a/engine/third_party/physx/include/gpu/PxPhysicsGpu.h b/engine/third_party/physx/include/gpu/PxPhysicsGpu.h new file mode 100644 index 00000000..035e3346 --- /dev/null +++ b/engine/third_party/physx/include/gpu/PxPhysicsGpu.h @@ -0,0 +1,165 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_GPU_H +#define PX_PHYSICS_GPU_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 PxSceneDesc; + + class PxIsosurfaceExtractor; + class PxSparseGridIsosurfaceExtractor; + class PxAnisotropyGenerator; + class PxSmoothedPositionGenerator; + class PxParticleNeighborhoodProvider; + + class PxArrayConverter; + class PxSDFBuilder; + class PxDeformableSkinning; + + struct PxIsosurfaceParams; + struct PxSparseGridParams; + + class PxPhysicsGpu + { + public: + /** + \brief Creates an isosurface extractor operating on a dense grid + + \param[in] cudaContextManager A cuda context manager + \param[in] worldBounds The bounds of the internally used dense grid. The isosurface can only be generated inside those bounds. + \param[in] cellSize The size of a single grid cell + \param[in] isosurfaceParams The isosurface parameters to control the isolevel etc. + \param[in] maxNumParticles The maximal number of particles that can be processed + \param[in] maxNumVertices The maximal number of vertices the output buffer can hold + \param[in] maxNumTriangles The maximal number of triangles the output buffer can hold + */ + virtual PxIsosurfaceExtractor* createDenseGridIsosurfaceExtractor(PxCudaContextManager* cudaContextManager, const PxBounds3& worldBounds, + PxReal cellSize, const PxIsosurfaceParams& isosurfaceParams, PxU32 maxNumParticles, PxU32 maxNumVertices = 512 * 1024, PxU32 maxNumTriangles = 1024 * 1024) = 0; + + /** + \brief Creates an isosurface extractor operating on a sparse grid + + \param[in] cudaContextManager A cuda context manager + \param[in] sparseGridParams The sparse grid parameters defining the cell size etc. + \param[in] isosurfaceParams The isosurface parameters to control the isolevel etc. + \param[in] maxNumParticles The maximal number of particles that can be processed + \param[in] maxNumVertices The maximal number of vertices the output buffer can hold + \param[in] maxNumTriangles The maximal number of triangles the output buffer can hold + */ + virtual PxSparseGridIsosurfaceExtractor* createSparseGridIsosurfaceExtractor(PxCudaContextManager* cudaContextManager, const PxSparseGridParams& sparseGridParams, + const PxIsosurfaceParams& isosurfaceParams, PxU32 maxNumParticles, PxU32 maxNumVertices = 512 * 1024, PxU32 maxNumTriangles = 1024 * 1024) = 0; + + + /** + \brief Creates an anisotropy generator + + \param[in] cudaContextManager A cuda context manager + \param[in] maxNumParticles The number of particles + \param[in] anisotropyScale A uniform scaling factor to increase or decrease anisotropy + \param[in] minAnisotropy The minimum scaling factor in any dimension that anisotropy can have + \param[in] maxAnisotropy The maximum scaling factor in any dimension that anisotropy can have + */ + virtual PxAnisotropyGenerator* createAnisotropyGenerator(PxCudaContextManager* cudaContextManager, PxU32 maxNumParticles, + PxReal anisotropyScale = 1.0f, PxReal minAnisotropy = 0.1f, PxReal maxAnisotropy = 2.0f) = 0; + + /** + \brief Creates a smoothed position generator + + \param[in] cudaContextManager A cuda context manager + \param[in] maxNumParticles The number of particles + \param[in] smoothingStrength Controls the strength of the smoothing effect + */ + virtual PxSmoothedPositionGenerator* createSmoothedPositionGenerator(PxCudaContextManager* cudaContextManager, PxU32 maxNumParticles, PxReal smoothingStrength = 0.5f) = 0; + + + /** + \brief Creates a neighborhood provider + + \param[in] cudaContextManager A cuda context manager + \param[in] maxNumParticles The number of particles + \param[in] cellSize The grid cell size. Should be equal to 2*contactOffset for PBD particle systems. + \param[in] maxNumSparseGridCells The maximal number of cells the internally used sparse grid can provide + */ + virtual PxParticleNeighborhoodProvider* createParticleNeighborhoodProvider(PxCudaContextManager* cudaContextManager, const PxU32 maxNumParticles, + const PxReal cellSize, const PxU32 maxNumSparseGridCells = 262144) = 0; + + /** + \brief Creates an array converter. If not used anymore, the caller needs to delete the returned pointer. + + \param[in] cudaContextManager A cuda context manager + */ + virtual PxArrayConverter* createArrayConverter(PxCudaContextManager* cudaContextManager) = 0; + + /** + \brief Creates sdf builder to construct sdfs quickly on the GPU. If not used anymore, the caller needs to delete the returned pointer. + + \param[in] cudaContextManager A cuda context manager + + \return Pointer to a new instance of a PxSDFBuilder + */ + virtual PxSDFBuilder* createSDFBuilder(PxCudaContextManager* cudaContextManager) = 0; + + /** + \brief Creates a deformable skinning instance to perform skinning operations on the GPU. If not used anymore, the caller needs to delete the returned pointer. + + \param[in] cudaContextManager A cuda context manager + + \return Pointer to a new instance of a PxDeformableSkinning + */ + virtual PxDeformableSkinning* createDeformableSkinning(PxCudaContextManager* cudaContextManager) = 0; + + virtual void release() = 0; + + virtual ~PxPhysicsGpu() {} + }; + +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/omnipvd/PxOmniPvd.h b/engine/third_party/physx/include/omnipvd/PxOmniPvd.h new file mode 100644 index 00000000..f605ee9e --- /dev/null +++ b/engine/third_party/physx/include/omnipvd/PxOmniPvd.h @@ -0,0 +1,163 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_OMNI_PVD_H +#define PX_OMNI_PVD_H + +#include "PxPhysXConfig.h" + +class OmniPvdWriter; +class OmniPvdFileWriteStream; + +// The OVD integration version: +// +// Major version indicates breaking changes in how PhysX SDK objects +// are streamed using the OmniPVD API, or if certain attributes changed +// name/type or set size, or was removed, hence subtractive changes. +// +// Minor version version indicates non-breaking changes such as the +// addition of a class or attribute on top of those already existing, +// hence additive changes. +#define PX_PHYSICS_OVD_INTEGRATION_VERSION_MAJOR 3 +#define PX_PHYSICS_OVD_INTEGRATION_VERSION_MINOR 0 + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxFoundation; + +class PxOmniPvd +{ +public: + class ScopedExclusiveWriter + { + public: + PX_FORCE_INLINE ScopedExclusiveWriter(PxOmniPvd* omniPvd) + { + mOmniPvd = omniPvd; + mWriter = NULL; + if (mOmniPvd) { + mWriter = mOmniPvd->acquireExclusiveWriterAccess(); + } + } + + PX_FORCE_INLINE ~ScopedExclusiveWriter() + { + if (mOmniPvd && mWriter) { + mOmniPvd->releaseExclusiveWriterAccess(); + } + } + + PX_FORCE_INLINE OmniPvdWriter* operator-> () + { + return mWriter; + } + + PX_FORCE_INLINE OmniPvdWriter* getWriter() + { + return mWriter; + } + private: + OmniPvdWriter* mWriter; + PxOmniPvd* mOmniPvd; + }; + + virtual ~PxOmniPvd() + { + } + /** + \brief Get the OmniPvd writer. + + Gets an instance of the OmniPvd writer. The writer access will not be thread safe since the OmniPVD API is not thread safe itself. Writing concurrently and simultaneously using the OmniPVD API is undefined. + + For thread safe exlcusive access use the mechanism acquireExclusiveWriterAccess/releaseExclusiveWriterAccess. + + \return OmniPvdWriter instance on succes, NULL otherwise. + */ + virtual OmniPvdWriter* getWriter() = 0; + + /** + \brief Acquires an exclusive writer access. + + This call blocks until exclusive access to the writer can be acquired. Once access has been granted, it is guaranteed that no other caller can access the writer through this method until releaseExclusiveWriterAccess() has been called. + + This allows to safely write PVD data in environments with concurrent processing workflows. + + \return OmniPvdWriter instance on succes, NULL otherwise. + */ + virtual OmniPvdWriter* acquireExclusiveWriterAccess() = 0; + + /** + \brief Releases the exclusive writer access + + Releases the access to the writer that was previously acquired using acquireExclusiveWriterAccess. + + */ + virtual void releaseExclusiveWriterAccess() = 0; + + /** + \brief Gets an instance to the OmniPvd file write stream + + \return OmniPvdFileWriteStream instance on succes, NULL otherwise. + */ + virtual OmniPvdFileWriteStream* getFileWriteStream() = 0; + + /** + \brief Starts the OmniPvd sampling + + \return True if sampling started correctly, false if not. + */ + virtual bool startSampling() = 0; + + /** + \brief Releases the PxOmniPvd object + + */ + virtual void release() = 0; + +}; +#if !PX_DOXYGEN +} // namespace physx +#endif +/** +\brief Creates an instance of the OmniPvd object + +Creates an instance of the OmniPvd class. There may be only one instance of this class per process. Calling this method after an instance +has been created already will return the same instance over and over. + +\param foundation Foundation instance (see PxFoundation) + +\return PxOmniPvd instance on succes, NULL otherwise. + +*/ +PX_C_EXPORT PX_PHYSX_CORE_API physx::PxOmniPvd* PX_CALL_CONV PxCreateOmniPvd(physx::PxFoundation& foundation); + + +#endif diff --git a/engine/third_party/physx/include/pvd/PxPvd.h b/engine/third_party/physx/include/pvd/PxPvd.h new file mode 100644 index 00000000..39fc2d7e --- /dev/null +++ b/engine/third_party/physx/include/pvd/PxPvd.h @@ -0,0 +1,174 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_PVD_H +#define PX_PVD_H + +#include "foundation/PxFlags.h" +#include "foundation/PxProfiler.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxFoundation; +class PxPvdTransport; + +/** +\brief types of instrumentation that PVD can do. +*/ +struct PxPvdInstrumentationFlag +{ + enum Enum + { + /** + \brief Send debugging information to PVD. + + This information is the actual object data of the rigid statics, shapes, + articulations, etc. Sending this information has a noticeable impact on + performance and thus this flag should not be set if you want an accurate + performance profile. + */ + eDEBUG = 1 << 0, + + /** + \brief Send profile information to PVD. + + This information populates PVD's profile view. It has (at this time) negligible + cost compared to Debug information and makes PVD *much* more useful so it is quite + highly recommended. + + This flag works together with a PxCreatePhysics parameter. + Using it allows the SDK to send profile events to PVD. + */ + ePROFILE = 1 << 1, + + /** + \brief Send memory information to PVD. + + The PVD sdk side hooks into the Foundation memory controller and listens to + allocation/deallocation events. This has a noticable hit on the first frame, + however, this data is somewhat compressed and the PhysX SDK doesn't allocate much + once it hits a steady state. This information also has a fairly negligible + impact and thus is also highly recommended. + + This flag works together with a PxCreatePhysics parameter, + trackOutstandingAllocations. Using both of them together allows users to have + an accurate view of the overall memory usage of the simulation at the cost of + a hashtable lookup per allocation/deallocation. Again, PhysX makes a best effort + attempt not to allocate or deallocate during simulation so this hashtable lookup + tends to have no effect past the first frame. + + Sending memory information without tracking outstanding allocations means that + PVD will accurate information about the state of the memory system before the + actual connection happened. + */ + eMEMORY = 1 << 2, + + eALL = (eDEBUG | ePROFILE | eMEMORY) + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxPvdInstrumentationFlag. + +\see PxPvdInstrumentationFlag +*/ +typedef PxFlags PxPvdInstrumentationFlags; +PX_FLAGS_OPERATORS(PxPvdInstrumentationFlag::Enum, uint8_t) + +/** +\brief PxPvd is the top-level class for the PVD framework, and the main customer interface for PVD +configuration.It is a singleton class, instantiated and owned by the application. +*/ +class PxPvd : public physx::PxProfilerCallback +{ + public: + /** + Connects the SDK to the PhysX Visual Debugger application. + \param transport transport for pvd captured data. + \param flags Flags to set. + return True if success + */ + virtual bool connect(PxPvdTransport& transport, PxPvdInstrumentationFlags flags) = 0; + + /** + Disconnects the SDK from the PhysX Visual Debugger application. + If we are still connected, this will kill the entire debugger connection. + */ + virtual void disconnect() = 0; + + /** + * Return if connection to PVD is created. + \param useCachedStatus + 1> When useCachedStaus is false, isConnected() checks the lowlevel network status. + This can be slow because it needs to lock the lowlevel network stream. If isConnected() is + called frequently, the expense of locking can be significant. + 2> When useCachedStatus is true, isConnected() checks the highlevel cached status with atomic access. + It is faster than locking, but the status may be different from the lowlevel network with latency of up to + one frame. + The reason for this is that the cached status is changed inside socket listener, which is not + called immediately when the lowlevel connection status changes. + */ + virtual bool isConnected(bool useCachedStatus = true) = 0; + + /** + returns the PVD data transport + returns NULL if no transport is present. + */ + virtual PxPvdTransport* getTransport() = 0; + + /** + Retrieves the PVD flags. See PxPvdInstrumentationFlags. + */ + virtual PxPvdInstrumentationFlags getInstrumentationFlags() = 0; + + /** + \brief Releases the pvd instance. + */ + virtual void release() = 0; + + protected: + virtual ~PxPvd() + { + } +}; + +/** + \brief Create a pvd instance. + \param foundation is the foundation instance that stores the allocator and error callbacks. +*/ +PX_C_EXPORT PxPvd* PX_CALL_CONV PxCreatePvd(PxFoundation& foundation); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/pvd/PxPvdSceneClient.h b/engine/third_party/physx/include/pvd/PxPvdSceneClient.h new file mode 100644 index 00000000..da676b64 --- /dev/null +++ b/engine/third_party/physx/include/pvd/PxPvdSceneClient.h @@ -0,0 +1,142 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_PVD_SCENE_CLIENT_H +#define PX_PVD_SCENE_CLIENT_H + + +#include "foundation/PxFlags.h" +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + namespace pvdsdk + { + class PvdClient; + } + struct PxDebugPoint; + struct PxDebugLine; + struct PxDebugTriangle; + struct PxDebugText; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief PVD scene Flags. They are disabled by default, and only works if PxPvdInstrumentationFlag::eDEBUG is set. +*/ +struct PxPvdSceneFlag +{ + enum Enum + { + eTRANSMIT_CONTACTS = (1 << 0), //! Transmits contact stream to PVD. + eTRANSMIT_SCENEQUERIES = (1 << 1), //! Transmits scene query stream to PVD. + eTRANSMIT_CONSTRAINTS = (1 << 2) //! Transmits constraints visualize stream to PVD. + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxPvdSceneFlag. + +\see PxPvdSceneFlag +*/ +typedef PxFlags PxPvdSceneFlags; +PX_FLAGS_OPERATORS(PxPvdSceneFlag::Enum, PxU8) + +/** +\brief Special client for PxScene. +It provides access to the PxPvdSceneFlag. +It also provides simple user debug services that associated scene position such as immediate rendering and camera updates. +*/ +class PxPvdSceneClient +{ + public: + /** + Sets the PVD flag. See PxPvdSceneFlag. + \param flag Flag to set. + \param value value the flag gets set to. + */ + virtual void setScenePvdFlag(PxPvdSceneFlag::Enum flag, bool value) = 0; + + /** + Sets the PVD flags. See PxPvdSceneFlags. + \param flags Flags to set. + */ + virtual void setScenePvdFlags(PxPvdSceneFlags flags) = 0; + + /** + Retrieves the PVD flags. See PxPvdSceneFlags. + */ + virtual PxPvdSceneFlags getScenePvdFlags() const = 0; + + /** + update camera on PVD application's render window + */ + virtual void updateCamera(const char* name, const PxVec3& origin, const PxVec3& up, const PxVec3& target) = 0; + + /** + draw points on PVD application's render window + */ + virtual void drawPoints(const physx::PxDebugPoint* points, PxU32 count) = 0; + + /** + draw lines on PVD application's render window + */ + virtual void drawLines(const physx::PxDebugLine* lines, PxU32 count) = 0; + + /** + draw triangles on PVD application's render window + */ + virtual void drawTriangles(const physx::PxDebugTriangle* triangles, PxU32 count) = 0; + + /** + draw text on PVD application's render window + */ + virtual void drawText(const physx::PxDebugText& text) = 0; + + /** + get the underlying client, for advanced users + */ + virtual physx::pvdsdk::PvdClient* getClientInternal() = 0; + +protected: + virtual ~PxPvdSceneClient(){} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/engine/third_party/physx/include/pvd/PxPvdTransport.h b/engine/third_party/physx/include/pvd/PxPvdTransport.h new file mode 100644 index 00000000..0ec58d28 --- /dev/null +++ b/engine/third_party/physx/include/pvd/PxPvdTransport.h @@ -0,0 +1,125 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_PVD_TRANSPORT_H +#define PX_PVD_TRANSPORT_H + +#include "foundation/PxErrors.h" +#include "foundation/PxFlags.h" +#include "pvd/PxPvd.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief PxPvdTransport is an interface representing the data transport mechanism. +This class defines all services associated with the transport: configuration, connection, reading, writing etc. +It is owned by the application, and can be realized as a file or a socket (using one-line PxDefault<...> methods in +PhysXExtensions) or in a custom implementation. This is a class that is intended for use by PVD, not by the +application, the application entry points are PxPvd and PvdClient. +*/ + +class PxPvdTransport +{ + public: + // connect, isConnected, disconnect, read, write, flush + + /** + Connects to the Visual Debugger application. + return True if success + */ + virtual bool connect() = 0; + + /** + Disconnects from the Visual Debugger application. + If we are still connected, this will kill the entire debugger connection. + */ + virtual void disconnect() = 0; + + /** + * Return if connection to PVD is created. + */ + virtual bool isConnected() = 0; + + /** + * write bytes to the other endpoint of the connection. should lock before witre. If an error occurs + * this connection will assume to be dead. + */ + virtual bool write(const uint8_t* inBytes, uint32_t inLength) = 0; + + /* + lock this transport and return it + */ + virtual PxPvdTransport& lock() = 0; + + /* + unlock this transport + */ + virtual void unlock() = 0; + + /** + * send any data and block until we know it is at least on the wire. + */ + virtual void flush() = 0; + + /** + * Return size of written data. + */ + virtual uint64_t getWrittenDataSize() = 0; + + virtual void release() = 0; + + protected: + virtual ~PxPvdTransport() + { + } +}; + +/** + \brief Create a default socket transport. + \param host host address of the pvd application. + \param port ip port used for pvd, should same as the port setting in pvd application. + \param timeoutInMilliseconds timeout when connect to pvd host. +*/ +PX_C_EXPORT PxPvdTransport* PX_CALL_CONV +PxDefaultPvdSocketTransportCreate(const char* host, int port, unsigned int timeoutInMilliseconds); + +/** + \brief Create a default file transport. + \param name full path filename used save captured pvd data, or NULL for a fake/test file transport. +*/ +PX_C_EXPORT PxPvdTransport* PX_CALL_CONV PxDefaultPvdFileTransportCreate(const char* name); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/solver/PxSolverDefs.h b/engine/third_party/physx/include/solver/PxSolverDefs.h new file mode 100644 index 00000000..1f66eb05 --- /dev/null +++ b/engine/third_party/physx/include/solver/PxSolverDefs.h @@ -0,0 +1,709 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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_SOLVER_DEFS_H +#define PX_SOLVER_DEFS_H + +#include "PxPhysXConfig.h" +#include "foundation/PxVec3.h" +#include "foundation/PxMat33.h" +#include "foundation/PxTransform.h" +#include "PxConstraintDesc.h" +#include "geomutils/PxContactPoint.h" + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4324) // structure was padded due to alignment +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxTGSSolverBodyVel; + +/** +\brief Struct that the solver uses to store velocity updates for a body +*/ +struct PxSolverBody +{ + PX_ALIGN(16, PxVec3) linearVelocity; //!< Delta linear velocity computed by the solver + PxU16 maxSolverNormalProgress; //!< Progress counter used by constraint batching and parallel island solver. + PxU16 maxSolverFrictionProgress; //!< Progress counter used by constraint batching and parallel island solver. + + PxVec3 angularState; //!< Delta angular velocity state computed by the solver. + + PxU32 solverProgress; //!< Progress counter used by constraint batching and parallel island solver + + PxSolverBody() : linearVelocity(0.f), maxSolverNormalProgress(0), maxSolverFrictionProgress(0), angularState(0), solverProgress(0) + { + } +}; +PX_COMPILE_TIME_ASSERT(sizeof(PxSolverBody) == 32); +PX_COMPILE_TIME_ASSERT((PX_OFFSET_OF(PxSolverBody, angularState) & 15) == 0); + +/** +\brief Struct that the solver uses to store the state and other properties of a body +*/ +struct PxSolverBodyData +{ + PX_ALIGN(16, PxVec3 linearVelocity); //!< 12 Pre-solver linear velocity + PxReal invMass; //!< 16 inverse mass + PxVec3 angularVelocity; //!< 28 Pre-solver angular velocity + PxReal reportThreshold; //!< 32 contact force threshold + PxMat33 sqrtInvInertia; //!< 68 inverse inertia in world space + PxReal penBiasClamp; //!< 72 the penetration bias clamp + PxU32 nodeIndex; //!< 76 the node idx of this solverBodyData. Used by solver to reference between solver bodies and island bodies. Not required by immediate mode + PxReal maxContactImpulse; //!< 80 the max contact impulse + PxTransform body2World; //!< 108 the body's transform + PxU16 pad; //!< 112 pad + + PX_FORCE_INLINE PxReal projectVelocity(const PxVec3& lin, const PxVec3& ang) const + { + return linearVelocity.dot(lin) + angularVelocity.dot(ang); + } +}; +PX_COMPILE_TIME_ASSERT(0 == (sizeof(PxSolverBodyData) & 15)); +// PT: ensure that sqrtInvInertia is not the last member of PxSolverBodyData, i.e. it is safe to load 4 bytes after sqrtInvInertia +PX_COMPILE_TIME_ASSERT(PX_OFFSET_OF(PxSolverBodyData, sqrtInvInertia)+sizeof(PxSolverBodyData::sqrtInvInertia) + 4 <= sizeof(PxSolverBodyData)); + +//---------------------------------- +/** +\brief A header that defines the size of a specific batch of constraints (of same type and without dependencies) +*/ +struct PxConstraintBatchHeader +{ + PxU32 startIndex; //!< Start index for this batch + PxU16 stride; //!< Number of constraints in this batch (range: 1-4) + PxU16 constraintType; //!< The type of constraint this batch references +}; + +/** +\brief Constraint descriptor used inside the solver +*/ +PX_ALIGN_PREFIX(16) +struct PxSolverConstraintDesc +{ + static const PxU16 RIGID_BODY = 0xffff; + + enum ConstraintType + { + eCONTACT_CONSTRAINT, //!< Defines this pair is a contact constraint + eJOINT_CONSTRAINT //!< Defines this pair is a joint constraint + }; + + union + { + PxSolverBody* bodyA; //!< bodyA pointer + PxTGSSolverBodyVel* tgsBodyA; //!< bodyA pointer + void* articulationA; //!< Articulation pointer for body A + }; + + union + { + PxSolverBody* bodyB; //!< BodyB pointer + PxTGSSolverBodyVel* tgsBodyB; //!< BodyB pointer + void* articulationB; //!< Articulation pointer for body B + }; + PxU32 bodyADataIndex; //!< Body A's index into the SolverBodyData array + PxU32 bodyBDataIndex; //!< Body B's index into the SolverBodyData array + + PxU32 linkIndexA; //!< Link index defining which link in Articulation A this constraint affects. If not an articulation, must be PxSolverConstraintDesc::RIGID_BODY + PxU32 linkIndexB; //!< Link index defining which link in Articulation B this constraint affects. If not an articulation, must be PxSolverConstraintDesc::RIGID_BODY + PxU8* constraint; //!< Pointer to the constraint rows to be solved + void* writeBack; //!< Pointer to the writeback structure results for this given constraint are to be written to + void* writeBackFriction; //!< Pointer to writeback contact friction impulses. Points to a PxVec3* buffer + + PxU16 progressA; //!< Internal progress counter + PxU16 progressB; //!< Internal progress counter + + union + { + PxU16 constraintType; //!< type of constraint. Union member active until constraint prepping, afterwards memory used for constraint length + PxU16 constraintLengthOver16; //!< constraintLength/16, max constraint length is 1MB. + }; +}PX_ALIGN_SUFFIX(16); +PX_COMPILE_TIME_ASSERT(sizeof(PxSolverConstraintDesc) % 16 == 0); + +/** +\brief Data structure used for preparing constraints before solving them +*/ +struct PxSolverConstraintPrepDescBase +{ + enum BodyState + { + eDYNAMIC_BODY = 1 << 0, + eSTATIC_BODY = 1 << 1, + eKINEMATIC_BODY = 1 << 2, + eARTICULATION = 1 << 3 + }; + + PxConstraintInvMassScale invMassScales; //!< In: The local mass scaling for this pair. + + PxSolverConstraintDesc* desc; //!< Output: The PxSolverConstraintDesc filled in by contact prep + + const PxSolverBody* body0; //!< In: The first body. Stores velocity information. Unused unless contact involves articulations. + const PxSolverBody* body1; //!< In: The second body. Stores velocity information. Unused unless contact involves articulations. + + const PxSolverBodyData* data0; //!< In: The first PxSolverBodyData. Stores mass and miscellaneous information for the first body. + const PxSolverBodyData* data1; //!< In: The second PxSolverBodyData. Stores mass and miscellaneous information for the second body + + PxTransform bodyFrame0; //!< In: The world-space transform of the first body. + PxTransform bodyFrame1; //!< In: The world-space transform of the second body. + + // PT: these two use 4 bytes each but we only need 4 bits (or even just 2 bits) for a type + BodyState bodyState0; //!< In: Defines what kind of actor the first body is + BodyState bodyState1; //!< In: Defines what kind of actor the second body is + + // PT: the following pointers have been moved here from derived structures to fill padding bytes + union + { + // PT: moved from PxSolverConstraintPrepDesc + void* writeback; //!< Pointer to constraint writeback structure. Reports back joint breaking. If not required, set to NULL. + + // PT: moved from PxSolverContactDesc + void* shapeInteraction; //!< Pointer to shape interaction. Used for force threshold reports in solver. Set to NULL if using immediate mode. + }; +}; +PX_COMPILE_TIME_ASSERT(sizeof(PxSolverConstraintPrepDescBase)<=128); +// PT: ensure that we can safely read 4 bytes after the bodyFrames +PX_COMPILE_TIME_ASSERT(PX_OFFSET_OF(PxSolverConstraintPrepDescBase, bodyFrame0)+sizeof(PxSolverConstraintPrepDescBase::bodyFrame0) + 4 <= sizeof(PxSolverConstraintPrepDescBase)); +PX_COMPILE_TIME_ASSERT(PX_OFFSET_OF(PxSolverConstraintPrepDescBase, bodyFrame1)+sizeof(PxSolverConstraintPrepDescBase::bodyFrame1) + 4 <= sizeof(PxSolverConstraintPrepDescBase)); + +/** +\brief Data structure used for preparing constraints before solving them +*/ +struct PxSolverConstraintPrepDesc : public PxSolverConstraintPrepDescBase +{ + PX_ALIGN(16, Px1DConstraint* rows); //!< The start of the constraint rows + PxU32 numRows; //!< The number of rows + + PxReal linBreakForce, angBreakForce; //!< Break forces + PxReal minResponseThreshold; //!< The minimum response threshold + bool disablePreprocessing; //!< Disable joint pre-processing. Pre-processing can improve stability but under certain circumstances, e.g. when some invInertia rows are zero/almost zero, can cause instabilities. + bool improvedSlerp; //!< Use improved slerp model + bool driveLimitsAreForces; //!< Indicates whether drive limits are forces + bool extendedLimits; //!< Indicates whether we want to use extended limits + bool disableConstraint; //!< Disables constraint + + PxVec3p body0WorldOffset; //!< Body0 world offset +}; + +/** +\brief Data structure used for preparing constraints before solving them +*/ +struct PxSolverContactDesc : public PxSolverConstraintPrepDescBase +{ + PxU8* frictionPtr; //!< InOut: Friction patch correlation data. Set each frame by solver. Can be retained for improved behavior or discarded each frame. + const PxContactPoint* contacts; //!< The start of the contacts for this pair + PxU32 numContacts; //!< The total number of contacts this pair references. + + PxU8 frictionCount; //!< The total number of friction patches in this pair + bool hasMaxImpulse; //!< Defines whether this pairs has maxImpulses clamping enabled + bool disableStrongFriction; //!< Defines whether this pair disables strong friction (sticky friction correlation) + bool hasForceThresholds; //!< Defines whether this pair requires force thresholds + + PxReal restDistance; //!< A distance at which the solver should aim to hold the bodies separated. Default is 0 + PxReal maxCCDSeparation; //!< A distance used to configure speculative CCD behavior. Default is PX_MAX_F32. Set internally in PhysX for bodies with eENABLE_SPECULATIVE_CCD on. Do not set directly! + + PxReal* contactForces; //!< Out: A buffer for the solver to write applied contact forces to. + + PxU32 startFrictionPatchIndex; //!< Start index of friction patch in the correlation buffer. Set by friction correlation + PxU32 numFrictionPatches; //!< Total number of friction patches in this pair. Set by friction correlation + + PxU32 startContactPatchIndex; //!< The start index of this pair's contact patches in the correlation buffer. For internal use only + PxU16 numContactPatches; //!< Total number of contact patches. + PxU16 axisConstraintCount; //!< Axis constraint count. Defines how many constraint rows this pair has produced. Useful for statistical purposes. + + PxReal offsetSlop; //!< Slop value used to snap contact line of action back in-line with the COM. +}; + +class PxConstraintAllocator +{ +public: + /** + \brief Allocates constraint data. It is the application's responsibility to release this memory after PxSolveConstraints has completed. + \param[in] byteSize Allocation size in bytes + \return The allocated memory. This address must be 16-byte aligned. + */ + virtual PxU8* reserveConstraintData(const PxU32 byteSize) = 0; + + /** + \brief Allocates friction data. Friction data can be retained by the application for a given pair and provided as an input to PxSolverContactDesc to improve simulation stability. + It is the application's responsibility to release this memory. If this memory is released, the application should ensure it does not pass pointers to this memory to PxSolverContactDesc. + \param[in] byteSize Allocation size in bytes + \return The allocated memory. This address must be 4-byte aligned. + */ + virtual PxU8* reserveFrictionData(const PxU32 byteSize) = 0; + + virtual ~PxConstraintAllocator() {} +}; + +struct PxArticulationAxis +{ + enum Enum + { + eTWIST = 0, //!< Rotational about eX + eSWING1 = 1, //!< Rotational about eY + eSWING2 = 2, //!< Rotational about eZ + eX = 3, //!< Linear in eX + eY = 4, //!< Linear in eY + eZ = 5, //!< Linear in eZ + eCOUNT = 6 + }; +}; + +PX_FLAGS_OPERATORS(PxArticulationAxis::Enum, PxU8) + +struct PxArticulationMotion +{ + enum Enum + { + eLOCKED = 0, //!< Locked axis, i.e. degree of freedom (DOF) + eLIMITED = 1, //!< Limited DOF - set limits of joint DOF together with this flag, see PxArticulationJointReducedCoordinate::setLimitParams + eFREE = 2 //!< Free DOF + }; +}; + +typedef PxFlags PxArticulationMotions; +PX_FLAGS_OPERATORS(PxArticulationMotion::Enum, PxU8) + +struct PxArticulationJointType +{ + enum Enum + { + eFIX = 0, //!< All joint axes, i.e. degrees of freedom (DOFs) locked + ePRISMATIC = 1, //!< Single linear DOF, e.g. cart on a rail + eREVOLUTE = 2, //!< Single rotational DOF, e.g. an elbow joint or a rotational motor, position wrapped at 2pi radians + eREVOLUTE_UNWRAPPED = 3, //!< Single rotational DOF, e.g. an elbow joint or a rotational motor, position not wrapped + eSPHERICAL = 4, //!< Ball and socket joint with two or three DOFs + eUNDEFINED = 5 + }; +}; + +struct PxArticulationFlag +{ + enum Enum + { + eFIX_BASE = (1 << 0), //!< Set articulation base to be fixed. + eDRIVE_LIMITS_ARE_FORCES = (1<<1), //!< Limits for drive effort are forces and torques rather than impulses, see PxArticulationDrive::maxForce. + eDISABLE_SELF_COLLISION = (1<<2) //!< Disable collisions between the articulation's links (note that parent/child collisions are disabled internally in either case). + }; +}; + +typedef PxFlags PxArticulationFlags; +PX_FLAGS_OPERATORS(PxArticulationFlag::Enum, PxU8) + +struct PxArticulationDriveType +{ + enum Enum + { + eFORCE = 0, //!< The output of the implicit spring drive controller is a force/torque. + eACCELERATION = 1, //!< The output of the implicit spring drive controller is a joint acceleration (use this to get (spatial)-inertia-invariant behavior of the drive). + eNONE = 2 + }; +}; + +/** +\brief Data structure to set articulation joint limits. + +- The lower limit should be strictly smaller than the higher limit. If the limits should be equal, use PxArticulationMotion::eLOCKED +and an appropriate offset in the parent/child joint frames. +- The limit units are linear units (equivalent to scene units) for a translational axis, or radians for a rotational axis. + +\see PxArticulationJointReducedCoordinate::setLimitParams, PxArticulationReducedCoordinate +*/ +struct PxArticulationLimit +{ + PxArticulationLimit(){} + + PxArticulationLimit(const PxReal low_, const PxReal high_) + { + low = low_; + high = high_; + } + + /** + \brief The lower limit on the joint axis position. + + Range: [-PX_MAX_F32, high)
+ Default: 0.0f
+ */ + PxReal low; + + /** + \brief The higher limit on the joint axis position. + + Range: (low, PX_MAX_F32]
+ Default: 0.0f
+ */ + PxReal high; +}; + +/** +\brief Data structure to enforce static model of a DC motor. + +Performance envelope is composed of 2 constraints: +1. effort-velocity curve: |Effort| <= maxEffort - velDependentResistance * |jointVelocity| +2. velocity-effort curve: |JointVelocity| <= maxActuatorVelocity - speedEffortGradient * |Effort| +where Effort refers to the sum of the articulation cache effort to the joint and the drive effort. +*/ +struct PxPerformanceEnvelope +{ + + // PX_SERIALIZATION + PxPerformanceEnvelope(const PxEMPTY&){} + // ~PX_SERIALIZATION + + PxPerformanceEnvelope( + PxReal maxEffort_ = 0.0f, + PxReal maxActuatorVelocity_ = 0.0f, + PxReal velocityDependentResistance_ = 0.0f, + PxReal speedEffortGradient_ = 0.0f + ) : maxEffort(maxEffort_), + maxActuatorVelocity(maxActuatorVelocity_), + velocityDependentResistance(velocityDependentResistance_), + speedEffortGradient(speedEffortGradient_) + {} + + /** + \brief Max effort the actuator can produce at zero velocity. For linear actuators, effort refers to force; for rotational actuators, effort refers to torque. + + Range: [0, PX_MAX_F32] + Default: 0.0f + */ + PxReal maxEffort; + + /** + \brief The maximum velocity of the actuator at zero effort. + + Range: [0, PX_MAX_F32] + Default: 0.0f + */ + PxReal maxActuatorVelocity; + + /** + \brief The rate at which available effort decreases as velocity increases. + + This represents the slope of the effort-velocity curve. + Range: [0, PX_MAX_F32] + Default: 0.0f + */ + PxReal velocityDependentResistance; + + /** + \brief The rate at which maximum velocity decreases as effort increases. + + This represents the inverse slope of the velocity-effort curve. + Range: [0, PX_MAX_F32] + Default: 0.0f + */ + PxReal speedEffortGradient; +}; + +/** +\brief Data structure to store friction parameters. + +\see PxArticulationJointReducedCoordinate::setFrictionParams, PxArticulationReducedCoordinate +*/ +struct PxJointFrictionParams +{ + PxJointFrictionParams(){} + + PxJointFrictionParams(const PxReal staticFrictionEffort_, const PxReal dynamicFrictionEffort_, const PxReal viscousFrictionCoefficient_) + : staticFrictionEffort(staticFrictionEffort_) + , dynamicFrictionEffort(dynamicFrictionEffort_) + , viscousFrictionCoefficient(viscousFrictionCoefficient_) + { + } + + /** + \brief Coulomb static friction effort. For linear motion effort refers to force, for rotational - to torque. + + Range: [0, PX_MAX_F32]
+ Default: 0.0f
+ */ + PxReal staticFrictionEffort; + + /** + \brief Coulomb dynamic friction effort. For linear motion effort refers to force, for rotational - to torque. + + Range: [0, PX_MAX_F32]
+ Default: 0.0f
+ */ + PxReal dynamicFrictionEffort; + + /** + \brief Viscous friction coefficient. viscousFrictionForce(Torque) = -viscousFrictionCoefficient * speed. + + Range: [0, PX_MAX_F32]
+ Default: 0.0f
+ */ + PxReal viscousFrictionCoefficient; +}; + +/** +\brief Data structure for articulation joint drive configuration. + +\see PxArticulationJointReducedCoordinate::setDriveParams, PxArticulationReducedCoordinate +*/ +struct PxArticulationDrive +{ + // PX_SERIALIZATION + PxArticulationDrive(const PxEMPTY&): envelope(PxEmpty) {} + //~PX_SERIALIZATION + + PxArticulationDrive() {} + + PxArticulationDrive(const PxReal stiffness_, const PxReal damping_, const PxReal maxForce_, + PxArticulationDriveType::Enum driveType_ = PxArticulationDriveType::eFORCE) + { + stiffness = stiffness_; + damping = damping_; + maxForce = maxForce_; + driveType = driveType_; + envelope = PxPerformanceEnvelope(0.0f, 0.0f, 0.0f, 0.0f); + } + + PxArticulationDrive(const PxReal stiffness_, const PxReal damping_, + const PxPerformanceEnvelope envelope_, + PxArticulationDriveType::Enum driveType_ = PxArticulationDriveType::eFORCE) + { + stiffness = stiffness_; + damping = damping_; + driveType = driveType_; + envelope = envelope_; + maxForce = 0.0f; + } + + /** + \brief The drive stiffness, i.e. the proportional gain of the implicit PD controller. + + See manual for further information, and the drives' implicit spring-damper (i.e. PD control) implementation in particular. + + Units: (distance = linear scene units)
+ Rotational axis: torque/rad if driveType = PxArticulationDriveType::eFORCE; or (rad/s^2)/rad if driveType = PxArticulationDriveType::eACCELERATION
+ Translational axis: force/distance if driveType = PxArticulationDriveType::eFORCE; or (distance/s^2)/distance if driveType = PxArticulationDriveType::eACCELERATION
+ Range: [0, PX_MAX_F32]
+ Default: 0.0f
+ */ + PxReal stiffness; + + /** + \brief The drive damping, i.e. the derivative gain of the implicit PD controller. + + See manual for further information, and the drives' implicit spring-damper (i.e. PD control) implementation in particular. + + Units: (distance = linear scene units)
+ Rotational axis: torque/(rad/s) if driveType = PxArticulationDriveType::eFORCE; or (rad/s^2)/(rad/s) if driveType = PxArticulationDriveType::eACCELERATION
+ Translational axis: force/(distance/s) if driveType = PxArticulationDriveType::eFORCE; or (distance/s^2)/(distance/s) if driveType = PxArticulationDriveType::eACCELERATION
+ Range: [0, PX_MAX_F32]
+ Default: 0.0f
+ */ + PxReal damping; + + /** + \deprecated Will be removed in a future version + \brief The drive force limit. + + - The limit is enforced regardless of the drive type #PxArticulationDriveType. + - The limit corresponds to a force (linear axis) or torque (rotational axis) if PxArticulationFlag::eDRIVE_LIMITS_ARE_FORCES is set, and to an impulse (force|torque * dt) otherwise. + + Range: [0, PX_MAX_F32]
+ Default: 0.0f
+ + \see PxArticulationFlag::eDRIVE_LIMITS_ARE_FORCES + */ + PxReal maxForce; + + /** + \brief The performance envelope of a motor. + + When an envelope with a non-zero maxEffort is explicitly set (via constructor or otherwise), the envelope takes precedence over maxForce. + In such cases, the joint force is clamped according to the performance envelope. If the default envelope (with zero maxEffort) is used, + clamping is instead based on the maxForce parameter and the PxArticulationFlag::eDRIVE_LIMITS_ARE_FORCES flag. + + \see PxPerformanceEnvelope + */ + PxPerformanceEnvelope envelope; + + /** + \brief The drive type. + + \see PxArticulationDriveType + */ + PxArticulationDriveType::Enum driveType; +}; + +struct PxTGSSolverBodyVel +{ + PX_ALIGN(16, PxVec3) linearVelocity; //12 + PxU16 maxDynamicPartition; //14 Used to accumulate the max partition of dynamic interactions + PxU16 nbStaticInteractions; //16 Used to accumulate the number of static interactions + PxVec3 angularVelocity; //28 + PxU32 partitionMask; //32 Used in partitioning as a bit-field + PxVec3 deltaAngDt; //44 + PxReal maxAngVel; //48 + PxVec3 deltaLinDt; //60 + PxU16 lockFlags; //62 + bool isKinematic; //63 + PxU8 pad; //64 + + PX_FORCE_INLINE PxReal projectVelocity(const PxVec3& lin, const PxVec3& ang) const + { + return linearVelocity.dot(lin) + angularVelocity.dot(ang); + } +}; + +//Needed only by prep, integration and 1D constraints +//Solver body state at time = simulationTime + simStepDt*posIter/nbPosIters +struct PxTGSSolverBodyTxInertia +{ + //Accumulated change to quaternion that has accumulated since solver started. + PxQuat deltaBody2WorldQ; + //Absolute body position at t + PxVec3 body2WorldP; + //RotMatrix * I0^(-1/2) * RotMatrixTranspose + PxMat33 sqrtInvInertia; //!< inverse inertia in world space +}; +PX_COMPILE_TIME_ASSERT(0 == (sizeof(PxTGSSolverBodyTxInertia) & 15)); + +struct PxTGSSolverBodyData +{ + PX_ALIGN(16, PxVec3) originalLinearVelocity; //!< Pre-solver linear velocity. + PxReal maxContactImpulse; //!< The max contact impulse. + PxVec3 originalAngularVelocity; //!< Pre-solver angular velocity + PxReal penBiasClamp; //!< The penetration bias clamp. + + PxReal invMass; //!< Inverse mass. + PxU32 nodeIndex; //!< The node idx of this solverBodyData. Used by solver to reference between solver bodies and island bodies. Not required by immediate mode. + PxReal reportThreshold; //!< Contact force threshold. + PxU32 pad; + + PxReal projectVelocity(const PxVec3& linear, const PxVec3& angular) const + { + return originalLinearVelocity.dot(linear) + originalAngularVelocity.dot(angular); + } +}; + +struct PxTGSSolverConstraintPrepDescBase +{ + PxConstraintInvMassScale invMassScales; //!< In: The local mass scaling for this pair. + + PxSolverConstraintDesc* desc; //!< Output: The PxSolverConstraintDesc filled in by contact prep + + const PxTGSSolverBodyVel* body0; //!< In: The first body. Stores velocity information. Unused unless contact involves articulations. + const PxTGSSolverBodyVel* body1; //!< In: The second body. Stores velocity information. Unused unless contact involves articulations. + + const PxTGSSolverBodyTxInertia* body0TxI; //!< In: The first PxTGSSolverBodyTxInertia. Stores the delta body to world transform and sqrtInvInertia for first body. + const PxTGSSolverBodyTxInertia* body1TxI; //!< In: The second PxTGSSolverBodyTxInertia. Stores the delta body to world transform and sqrtInvInertia for second body. + + const PxTGSSolverBodyData* bodyData0; //!< In: The first PxTGSSolverBodyData. Stores mass and miscellaneous information for the first body. + const PxTGSSolverBodyData* bodyData1; //!< In: The second PxTGSSolverBodyData. Stores mass and miscellaneous information for the second body. + + PxTransform bodyFrame0; //!< In: The world-space transform of the first body. + PxTransform bodyFrame1; //!< In: The world-space transform of the second body. + + // PT: these two use 4 bytes each but we only need 4 bits (or even just 2 bits) for a type + PxSolverContactDesc::BodyState bodyState0; //!< In: Defines what kind of actor the first body is + PxSolverContactDesc::BodyState bodyState1; //!< In: Defines what kind of actor the second body is + + // PT: the following pointers have been moved here from derived structures to fill padding bytes + union + { + // PT: moved from PxTGSSolverConstraintPrepDesc + void* writeback; //!< Pointer to constraint writeback structure. Reports back joint breaking. If not required, set to NULL. + + // PT: moved from PxTGSSolverContactDesc + void* shapeInteraction; //!< Pointer to shape interaction. Used for force threshold reports in solver. Set to NULL if using immediate mode. + }; +}; + +// PT: ensure that we can safely read 4 bytes after the bodyFrames +PX_COMPILE_TIME_ASSERT(PX_OFFSET_OF(PxTGSSolverConstraintPrepDescBase, bodyFrame0)+sizeof(PxTGSSolverConstraintPrepDescBase::bodyFrame0) + 4 <= sizeof(PxTGSSolverConstraintPrepDescBase)); +PX_COMPILE_TIME_ASSERT(PX_OFFSET_OF(PxTGSSolverConstraintPrepDescBase, bodyFrame1)+sizeof(PxTGSSolverConstraintPrepDescBase::bodyFrame1) + 4 <= sizeof(PxTGSSolverConstraintPrepDescBase)); + +struct PxTGSSolverConstraintPrepDesc : public PxTGSSolverConstraintPrepDescBase +{ + Px1DConstraint* rows; //!< The start of the constraint rows + PxU32 numRows; //!< The number of rows + + PxReal linBreakForce, angBreakForce; //!< Break forces + PxReal minResponseThreshold; //!< The minimum response threshold + bool disablePreprocessing; //!< Disable joint pre-processing. Pre-processing can improve stability but under certain circumstances, e.g. when some invInertia rows are zero/almost zero, can cause instabilities. + bool improvedSlerp; //!< Use improved slerp model + bool driveLimitsAreForces; //!< Indicates whether drive limits are forces + bool extendedLimits; //!< Indicates whether extended limits are used + bool disableConstraint; //!< Disables constraint + + PxVec3p body0WorldOffset; //!< Body0 world offset + PxVec3p cA2w; //!< Location of anchor point A in world space + PxVec3p cB2w; //!< Location of anchor point B in world space +}; + +struct PxTGSSolverContactDesc : public PxTGSSolverConstraintPrepDescBase +{ + PxU8* frictionPtr; //!< InOut: Friction patch correlation data. Set each frame by solver. Can be retained for improved behavior or discarded each frame. + const PxContactPoint* contacts; //!< The start of the contacts for this pair + PxU32 numContacts; //!< The total number of contacts this pair references. + + PxU8 frictionCount; //!< The total number of friction patches in this pair + bool hasMaxImpulse; //!< Defines whether this pairs has maxImpulses clamping enabled + bool disableStrongFriction; //!< Defines whether this pair disables strong friction (sticky friction correlation) + bool hasForceThresholds; //!< Defines whether this pair requires force thresholds + + PxReal restDistance; //!< A distance at which the solver should aim to hold the bodies separated. Default is 0 + PxReal maxCCDSeparation; //!< A distance used to configure speculative CCD behavior. Default is PX_MAX_F32. Set internally in PhysX for bodies with eENABLE_SPECULATIVE_CCD on. Do not set directly! + + PxReal* contactForces; //!< Out: A buffer for the solver to write applied contact forces to. + + PxU32 startFrictionPatchIndex; //!< Start index of friction patch in the correlation buffer. Set by friction correlation + PxU32 numFrictionPatches; //!< Total number of friction patches in this pair. Set by friction correlation + + PxU32 startContactPatchIndex; //!< The start index of this pair's contact patches in the correlation buffer. For internal use only + PxU16 numContactPatches; //!< Total number of contact patches. + PxU16 axisConstraintCount; //!< Axis constraint count. Defines how many constraint rows this pair has produced. Useful for statistical purposes. + + PxReal maxImpulse; //!< The maximum impulse the solver is allowed to introduce for this pair of bodies. + + PxReal torsionalPatchRadius; //!< This defines the radius of the contact patch used to apply torsional friction. + PxReal minTorsionalPatchRadius; //!< This defines the minimum radius of the contact patch used to apply torsional friction. + PxReal offsetSlop; //!< Slop value used to snap contact line of action back in-line with the COM. +}; + +#if !PX_DOXYGEN +} +#endif + +#if PX_VC +#pragma warning(pop) +#endif + +#endif + diff --git a/engine/third_party/physx/include/task/PxCpuDispatcher.h b/engine/third_party/physx/include/task/PxCpuDispatcher.h new file mode 100644 index 00000000..717e968b --- /dev/null +++ b/engine/third_party/physx/include/task/PxCpuDispatcher.h @@ -0,0 +1,82 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +#ifndef PX_CPU_DISPATCHER_H +#define PX_CPU_DISPATCHER_H + +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxBaseTask; + +/** + \brief A CpuDispatcher is responsible for scheduling the execution of tasks passed to it by the SDK. + + A typical implementation would for example use a thread pool with the dispatcher + pushing tasks onto worker thread queues or a global queue. + + \see PxBaseTask + \see PxTask + \see PxTaskManager +*/ +class PxCpuDispatcher +{ +public: + /** + \brief Called by the TaskManager when a task is to be queued for execution. + + Upon receiving a task, the dispatcher should schedule the task to run. + After the task has been run, it should call the release() method and + discard its pointer. + + \param[in] task The task to be run. + + \see PxBaseTask + */ + virtual void submitTask(PxBaseTask& task) = 0; + + /** + \brief Returns the number of available worker threads for this dispatcher. + + The SDK will use this count to control how many tasks are submitted. By + matching the number of tasks with the number of execution units task + overhead can be reduced. + */ + virtual uint32_t getWorkerCount() const = 0; + + virtual ~PxCpuDispatcher() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/engine/third_party/physx/include/task/PxTask.h b/engine/third_party/physx/include/task/PxTask.h new file mode 100644 index 00000000..0da86ade --- /dev/null +++ b/engine/third_party/physx/include/task/PxTask.h @@ -0,0 +1,331 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +#ifndef PX_TASK_H +#define PX_TASK_H + +#include "task/PxTaskManager.h" +#include "task/PxCpuDispatcher.h" +#include "foundation/PxAssert.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** + * \brief Base class of all task types + * + * PxBaseTask defines a runnable reference counted task with built-in profiling. + */ +class PxBaseTask +{ +public: + PxBaseTask() : mContextID(0), mTm(NULL) {} + virtual ~PxBaseTask() {} + + /** + * \brief The user-implemented run method where the task's work should be performed + * + * run() methods must be thread safe, stack friendly (no alloca, etc), and + * must never block. + */ + virtual void run() = 0; + + /** + * \brief Return a user-provided task name for profiling purposes. + * + * It does not have to be unique, but unique names are helpful. + * + * \return The name of this task + */ + virtual const char* getName() const = 0; + + //! \brief Implemented by derived implementation classes + virtual void addReference() = 0; + //! \brief Implemented by derived implementation classes + virtual void removeReference() = 0; + //! \brief Implemented by derived implementation classes + virtual int32_t getReference() const = 0; + + /** \brief Implemented by derived implementation classes + * + * A task may assume in its release() method that the task system no longer holds + * references to it - so it may safely run its destructor, recycle itself, etc. + * provided no additional user references to the task exist + */ + virtual void release() = 0; + + /** + * \brief Tells the scheduler if a task is high priority or not. + * + * This function is a hint to the scheduler, to let it know that some tasks are + * higher priority than others. The scheduler should try to execute high priority + * tasks first, but there is no guarantee that it does (some schedulers can ignore + * this information). + * + * \return True for high priority task, false for regular tasks + */ + virtual bool isHighPriority() const { return false; } + + /** + * \brief Return PxTaskManager to which this task was submitted + * + * Note, can return NULL if task was not submitted, or has been + * completed. + */ + PX_FORCE_INLINE PxTaskManager* getTaskManager() const + { + return mTm; + } + + PX_FORCE_INLINE void setContextId(PxU64 id) { mContextID = id; } + PX_FORCE_INLINE PxU64 getContextId() const { return mContextID; } + +protected: + PxU64 mContextID; //!< Context ID for profiler interface + PxTaskManager* mTm; //!< Owning PxTaskManager instance + + friend class PxTaskMgr; +}; + + +/** + * \brief A PxBaseTask implementation with deferred execution and full dependencies + * + * A PxTask must be submitted to a PxTaskManager to to be executed, Tasks may + * optionally be named when they are submitted. + */ +class PxTask : public PxBaseTask +{ +public: + PxTask() : mTaskID(0) {} + virtual ~PxTask() {} + + //! \brief Release method implementation + virtual void release() PX_OVERRIDE + { + PX_ASSERT(mTm); + + // clear mTm before calling taskCompleted() for safety + PxTaskManager* save = mTm; + mTm = NULL; + save->taskCompleted(*this); + } + + //! \brief Inform the PxTaskManager this task must finish before the given + // task is allowed to start. + PX_INLINE void finishBefore(PxTaskID taskID) + { + PX_ASSERT(mTm); + mTm->finishBefore(*this, taskID); + } + + //! \brief Inform the PxTaskManager this task cannot start until the given + // task has completed. + PX_INLINE void startAfter(PxTaskID taskID) + { + PX_ASSERT(mTm); + mTm->startAfter(*this, taskID); + } + + /** + * \brief Manually increment this task's reference count. The task will + * not be allowed to run until removeReference() is called. + */ + virtual void addReference() PX_OVERRIDE + { + PX_ASSERT(mTm); + mTm->addReference(mTaskID); + } + + /** + * \brief Manually decrement this task's reference count. If the reference + * count reaches zero, the task will be dispatched. + */ + virtual void removeReference() PX_OVERRIDE + { + PX_ASSERT(mTm); + mTm->decrReference(mTaskID); + } + + /** + * \brief Return the ref-count for this task + */ + virtual int32_t getReference() const PX_OVERRIDE + { + return mTm->getReference(mTaskID); + } + + /** + * \brief Return the unique ID for this task + */ + PX_INLINE PxTaskID getTaskID() const + { + return mTaskID; + } + + /** + * \brief Called by PxTaskManager at submission time for initialization + * + * Perform simulation step initialization here. + */ + virtual void submitted() + { + } + +protected: + PxTaskID mTaskID; //!< ID assigned at submission + + friend class PxTaskMgr; +}; + + +/** + * \brief A PxBaseTask implementation with immediate execution and simple dependencies + * + * A PxLightCpuTask bypasses the PxTaskManager launch dependencies and will be + * submitted directly to your scene's CpuDispatcher. When the run() function + * completes, it will decrement the reference count of the specified + * continuation task. + * + * You must use a full-blown PxTask if you want your task to be resolved + * by another PxTask, or you need more than a single dependency to be + * resolved when your task completes, or your task will not run on the + * CpuDispatcher. + */ +class PxLightCpuTask : public PxBaseTask +{ +public: + PxLightCpuTask() + : mCont( NULL ) + , mRefCount( 0 ) + { + } + virtual ~PxLightCpuTask() + { + mTm = NULL; + } + + /** + * \brief Initialize this task and specify the task that will have its ref count decremented on completion. + * + * Submission is deferred until the task's mRefCount is decremented to zero. + * Note that we only use the PxTaskManager to query the appropriate dispatcher. + * + * \param[in] tm The PxTaskManager this task is managed by + * \param[in] c The task to be executed when this task has finished running + */ + PX_INLINE void setContinuation(PxTaskManager& tm, PxBaseTask* c) + { + PX_ASSERT(mRefCount == 0); + mRefCount = 1; + mCont = c; + mTm = &tm; + if(c) + c->addReference(); + } + + /** + * \brief Initialize this task and specify the task that will have its ref count decremented on completion. + * + * This overload of setContinuation() queries the PxTaskManager from the continuation + * task, which cannot be NULL. + * \param[in] c The task to be executed after this task has finished running + */ + PX_INLINE void setContinuation(PxBaseTask* c) + { + PX_ASSERT(c); + PX_ASSERT(mRefCount == 0); + mRefCount = 1; + mCont = c; + if(c) + { + c->addReference(); + mTm = c->getTaskManager(); + PX_ASSERT(mTm); + } + } + + /** + * \brief Retrieves continuation task + */ + PX_INLINE PxBaseTask* getContinuation() const + { + return mCont; + } + + /** + * \brief Manually decrement this task's reference count. If the reference + * count reaches zero, the task will be dispatched. + */ + virtual void removeReference() PX_OVERRIDE + { + mTm->decrReference(*this); + } + + /** \brief Return the ref-count for this task */ + virtual int32_t getReference() const PX_OVERRIDE + { + return mRefCount; + } + + /** + * \brief Manually increment this task's reference count. The task will + * not be allowed to run until removeReference() is called. + */ + virtual void addReference() PX_OVERRIDE + { + mTm->addReference(*this); + } + + /** + * \brief called by CpuDispatcher after run method has completed + * + * Decrements the continuation task's reference count, if specified. + */ + virtual void release() PX_OVERRIDE + { + if(mCont) + mCont->removeReference(); + } + +protected: + + PxBaseTask* mCont; //!< Continuation task, can be NULL + volatile int32_t mRefCount; //!< PxTask is dispatched when reaches 0 + + friend class PxTaskMgr; +}; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + + +#endif + diff --git a/engine/third_party/physx/include/task/PxTaskManager.h b/engine/third_party/physx/include/task/PxTaskManager.h new file mode 100644 index 00000000..853f090f --- /dev/null +++ b/engine/third_party/physx/include/task/PxTaskManager.h @@ -0,0 +1,203 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +#ifndef PX_TASK_MANAGER_H +#define PX_TASK_MANAGER_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxErrorCallback.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxBaseTask; +class PxTask; +class PxLightCpuTask; +typedef unsigned int PxTaskID; + +/** +\brief Identifies the type of each heavyweight PxTask object + +\note This enum type is only used by PxTask objects, PxLightCpuTasks do not use this enum. + +\see PxTask +\see PxLightCpuTask +*/ +struct PxTaskType +{ + /** + * \brief Identifies the type of each heavyweight PxTask object + */ + enum Enum + { + eCPU, //!< PxTask will be run on the CPU + eNOT_PRESENT, //!< Return code when attempting to find a task that does not exist + eCOMPLETED //!< PxTask execution has been completed + }; +}; + +class PxCpuDispatcher; + +/** + \brief The PxTaskManager interface + + A PxTaskManager instance holds references to user-provided dispatcher objects. When tasks are + submitted the PxTaskManager routes them to the appropriate dispatcher and handles task profiling if enabled. + Users should not implement the PxTaskManager interface, the SDK creates its own concrete PxTaskManager object + per-scene which users can configure by passing dispatcher objects into the PxSceneDesc. + + \see PxCpuDispatcher + +*/ +class PxTaskManager +{ +public: + + /** + \brief Set the user-provided dispatcher object for CPU tasks + + \param[in] ref The dispatcher object. + + \see PxCpuDispatcher + */ + virtual void setCpuDispatcher(PxCpuDispatcher& ref) = 0; + + /** + \brief Get the user-provided dispatcher object for CPU tasks + + \return The CPU dispatcher object. + + \see PxCpuDispatcher + */ + virtual PxCpuDispatcher* getCpuDispatcher() const = 0; + + /** + \brief Reset any dependencies between Tasks + + \note Will be called at the start of every frame before tasks are submitted. + + \see PxTask + */ + virtual void resetDependencies() = 0; + + /** + \brief Called by the owning scene to start the task graph. + + \note All tasks with ref count of 1 will be dispatched. + + \see PxTask + */ + virtual void startSimulation() = 0; + + /** + \brief Called by the owning scene at the end of a simulation step. + */ + virtual void stopSimulation() = 0; + + /** + \brief Called by the worker threads to inform the PxTaskManager that a task has completed processing. + + \param[in] task The task which has been completed + */ + virtual void taskCompleted(PxTask& task) = 0; + + /** + \brief Retrieve a task by name + + \param[in] name The unique name of a task + \return The ID of the task with that name, or eNOT_PRESENT if not found + */ + virtual PxTaskID getNamedTask(const char* name) = 0; + + /** + \brief Submit a task with a unique name. + + \param[in] task The task to be executed + \param[in] name The unique name of a task + \param[in] type The type of the task (default eCPU) + \return The ID of the task with that name, or eNOT_PRESENT if not found + */ + virtual PxTaskID submitNamedTask(PxTask* task, const char* name, PxTaskType::Enum type = PxTaskType::eCPU) = 0; + + /** + \brief Submit an unnamed task. + + \param[in] task The task to be executed + \param[in] type The type of the task (default eCPU) + + \return The ID of the task with that name, or eNOT_PRESENT if not found + */ + virtual PxTaskID submitUnnamedTask(PxTask& task, PxTaskType::Enum type = PxTaskType::eCPU) = 0; + + /** + \brief Retrieve a task given a task ID + + \param[in] id The ID of the task to return, a valid ID must be passed or results are undefined + + \return The task associated with the ID + */ + virtual PxTask* getTaskFromID(PxTaskID id) = 0; + + /** + \brief Release the PxTaskManager object, referenced dispatchers will not be released + */ + virtual void release() = 0; + + /** + \brief Construct a new PxTaskManager instance with the given [optional] dispatchers + */ + static PxTaskManager* createTaskManager(PxErrorCallback& errorCallback, PxCpuDispatcher* = NULL); + +protected: + virtual ~PxTaskManager() {} + + /*! \cond PRIVATE */ + + virtual void finishBefore(PxTask& task, PxTaskID taskID) = 0; + virtual void startAfter(PxTask& task, PxTaskID taskID) = 0; + + virtual void addReference(PxTaskID taskID) = 0; + virtual void decrReference(PxTaskID taskID) = 0; + virtual int32_t getReference(PxTaskID taskID) const = 0; + + virtual void decrReference(PxLightCpuTask&) = 0; + virtual void addReference(PxLightCpuTask&) = 0; + + /*! \endcond */ + + friend class PxBaseTask; + friend class PxTask; + friend class PxLightCpuTask; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + +#endif diff --git a/engine/third_party/physx/include/vehicle2/PxVehicleAPI.h b/engine/third_party/physx/include/vehicle2/PxVehicleAPI.h new file mode 100644 index 00000000..b0a283ab --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/PxVehicleAPI.h @@ -0,0 +1,143 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "vehicle2/PxVehicleLimits.h" +#include "vehicle2/PxVehicleComponent.h" +#include "vehicle2/PxVehicleComponentSequence.h" +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleFunctions.h" +#include "vehicle2/PxVehicleMaths.h" + +#include "vehicle2/braking/PxVehicleBrakingParams.h" +#include "vehicle2/braking/PxVehicleBrakingFunctions.h" + +#include "vehicle2/commands/PxVehicleCommandParams.h" +#include "vehicle2/commands/PxVehicleCommandStates.h" +#include "vehicle2/commands/PxVehicleCommandHelpers.h" + +#include "vehicle2/drivetrain/PxVehicleDrivetrainParams.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainStates.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainHelpers.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainFunctions.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainComponents.h" + +#include "vehicle2/physxActor/PxVehiclePhysXActorStates.h" +#include "vehicle2/physxActor/PxVehiclePhysXActorHelpers.h" +#include "vehicle2/physxActor/PxVehiclePhysXActorFunctions.h" +#include "vehicle2/physxActor/PxVehiclePhysXActorComponents.h" + +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintParams.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintHelpers.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintFunctions.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintComponents.h" + +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryHelpers.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryFunctions.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryComponents.h" + +#include "vehicle2/pvd/PxVehiclePvdHelpers.h" +#include "vehicle2/pvd/PxVehiclePvdFunctions.h" +#include "vehicle2/pvd/PxVehiclePvdComponents.h" + +#include "vehicle2/rigidBody/PxVehicleRigidBodyParams.h" +#include "vehicle2/rigidBody/PxVehicleRigidBodyStates.h" +#include "vehicle2/rigidBody/PxVehicleRigidBodyFunctions.h" +#include "vehicle2/rigidBody/PxVehicleRigidBodyComponents.h" + +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" + +#include "vehicle2/steering/PxVehicleSteeringParams.h" +#include "vehicle2/steering/PxVehicleSteeringFunctions.h" + +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionStates.h" +#include "vehicle2/suspension/PxVehicleSuspensionHelpers.h" +#include "vehicle2/suspension/PxVehicleSuspensionFunctions.h" +#include "vehicle2/suspension/PxVehicleSuspensionComponents.h" + +#include "vehicle2/tire/PxVehicleTireParams.h" +#include "vehicle2/tire/PxVehicleTireStates.h" +#include "vehicle2/tire/PxVehicleTireHelpers.h" +#include "vehicle2/tire/PxVehicleTireFunctions.h" +#include "vehicle2/tire/PxVehicleTireComponents.h" + +#include "vehicle2/wheel/PxVehicleWheelParams.h" +#include "vehicle2/wheel/PxVehicleWheelStates.h" +#include "vehicle2/wheel/PxVehicleWheelHelpers.h" +#include "vehicle2/wheel/PxVehicleWheelFunctions.h" +#include "vehicle2/wheel/PxVehicleWheelComponents.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + + /** \brief Initialize the PhysX Vehicle library. + + This should be called before calling any functions or methods in extensions which may require allocation. + \note This function does not need to be called before creating a PxDefaultAllocator object. + + \param foundation a PxFoundation object + + \see PxCloseVehicleExtension PxFoundation + */ + PX_FORCE_INLINE bool PxInitVehicleExtension(physx::PxFoundation& foundation) + { + PX_UNUSED(foundation); + PX_CHECK_AND_RETURN_VAL(&PxGetFoundation() == &foundation, "Supplied foundation must match the one that will be used to perform allocations", false); + PxIncFoundationRefCount(); + return true; + } + + /** \brief Shut down the PhysX Vehicle library. + + This function should be called to cleanly shut down the PhysX Vehicle library before application exit. + + \note This function is required to be called to release foundation usage. + + \see PxInitVehicleExtension + */ + PX_FORCE_INLINE void PxCloseVehicleExtension() + { + PxDecFoundationRefCount(); + } + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/PxVehicleComponent.h b/engine/third_party/physx/include/vehicle2/PxVehicleComponent.h new file mode 100644 index 00000000..2026b25a --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/PxVehicleComponent.h @@ -0,0 +1,66 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif +struct PxVehicleSimulationContext; + +class PxVehicleComponent +{ +public: + + virtual ~PxVehicleComponent() {} + + /** + \brief Update function for a vehicle component. + + \param[in] dt The timestep size to use for the update step. + \param[in] context Vehicle simulation context holding global data or data that usually applies to a + large group of vehicles. + \return True if subsequent components in a sequence should get updated, false if the sequence should + be aborted. + + \see PxVehicleComponentSequence + */ + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) = 0; + +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/PxVehicleComponentSequence.h b/engine/third_party/physx/include/vehicle2/PxVehicleComponentSequence.h new file mode 100644 index 00000000..d6462c3e --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/PxVehicleComponentSequence.h @@ -0,0 +1,322 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +#pragma once +#include "foundation/PxAssert.h" +#include "foundation/PxErrors.h" +#include "foundation/PxFoundation.h" +#include "PxVehicleComponent.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + + +struct PxVehicleComponentSequenceLimits +{ + enum Enum + { + eMAX_NB_SUBGROUPS = 16, + eMAX_NB_COMPONENTS = 64, + eMAX_NB_SUBGROUPELEMENTS = eMAX_NB_SUBGROUPS + eMAX_NB_COMPONENTS + }; +}; + +struct PxVehicleComponentSequence +{ + enum + { + eINVALID_SUBSTEP_GROUP = 0xff + }; + + PxVehicleComponentSequence() + : mNbComponents(0), mNbSubgroups(1), mNbSubGroupElements(0), mActiveSubgroup(0) + { + } + + /** + \brief Add a component to the sequence. + + \param[in] component The component to add to the sequence. + \return True on success, else false (for example due to component count limit being reached). + */ + PX_FORCE_INLINE bool add(PxVehicleComponent* component); + + /** + \brief Start a substepping group. + \note All components added using #add() will be added to the new substepping group until either the group + is marked as complete with a call to #endSubstepGroup() or a subsequent substepping group is started with + a call to #beginSubstepGroup(). + \note Groups can be nested with stacked calls to #beginSubstepGroup(). + \note Each group opened by #beginSubstepGroup() must be closed with a complementary #endSubstepGroup() prior to calling #update(). + \param[in] nbSubSteps is the number of substeps for the group's sequence. This can be changed with a call to #setSubsteps(). + \return Handle for the substepping group on success, else eINVALID_SUBSTEP_GROUP + \see setSubsteps() + \see endSubstepGroup() + */ + PX_FORCE_INLINE PxU8 beginSubstepGroup(const PxU8 nbSubSteps = 1); + + /** + \brief End a substepping group + \note The group most recently opened with #beginSubstepGroup() will be closed by this call. + \see setSubsteps() + \see beginSubstepGroup() + */ + PX_FORCE_INLINE void endSubstepGroup() + { + mActiveSubgroup = mSubGroups[mActiveSubgroup].parentGroup; + } + + /** + \brief Set the number of substeps to perform for a specific substepping group. + \param[in] subGroupHandle specifies the substepping group + \param[in] nbSteps is the number of times to invoke the sequence of components and groups in the specified substepping group. + \see beginSubstepGroup() + \see endSubstepGroup() + */ + void setSubsteps(const PxU8 subGroupHandle, const PxU8 nbSteps) + { + PX_ASSERT(subGroupHandle < mNbSubgroups); + mSubGroups[subGroupHandle].nbSteps = nbSteps; + } + + /** + \brief Update each component in the sequence. + + \note If the update method of a component in the sequence returns false, the update process gets aborted. + + \param[in] dt is the timestep of the update. The provided value has to be positive. + \param[in] context specifies global quantities of the simulation such as gravitational acceleration. + */ + void update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_ASSERT(0 == mActiveSubgroup); + + if (dt > 0.0f) + { + updateSubGroup(dt, context, 0, 1); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, + "PxVehicleComponentSequence::update: The timestep must be positive!"); + } + } + +private: + enum + { + eINVALID_COMPONENT = 0xff, + eINVALID_SUB_GROUP_ELEMENT = 0xff + }; + + //Elements have the form of a linked list to allow traversal over a list of elements. + //Each element is either a single component or a subgroup. + struct SubGroupElement + { + SubGroupElement() + : childGroup(eINVALID_SUBSTEP_GROUP), + component(eINVALID_COMPONENT), + nextElement(eINVALID_SUB_GROUP_ELEMENT) + { + } + + PxU8 childGroup; + PxU8 component; + PxU8 nextElement; + }; + + //A group is a linked list of elements to be processed in sequence. + //Each group stores the first element in the sequence. + //Each element in the sequence stores the next element in the sequence + //to allow traversal over the list of elements in the group. + struct Group + { + Group() + : parentGroup(eINVALID_SUBSTEP_GROUP), + firstElement(eINVALID_SUB_GROUP_ELEMENT), + nbSteps(1) + { + } + PxU8 parentGroup; + PxU8 firstElement; + PxU8 nbSteps; + }; + + PxVehicleComponent* mComponents[PxVehicleComponentSequenceLimits::eMAX_NB_COMPONENTS]; + PxU8 mNbComponents; + + Group mSubGroups[PxVehicleComponentSequenceLimits::eMAX_NB_SUBGROUPS]; + PxU8 mNbSubgroups; + + SubGroupElement mSubGroupElements[PxVehicleComponentSequenceLimits::eMAX_NB_SUBGROUPELEMENTS]; + PxU8 mNbSubGroupElements; + + PxU8 mActiveSubgroup; + + bool updateSubGroup(const PxReal dt, const PxVehicleSimulationContext& context, const PxU8 groupId, const PxU8 parentSepMultiplier) + { + const PxU8 nbSteps = mSubGroups[groupId].nbSteps; + const PxU8 stepMultiplier = parentSepMultiplier * nbSteps; + const PxReal timestepForGroup = dt / PxReal(stepMultiplier); + for (PxU8 k = 0; k < nbSteps; k++) + { + PxU8 nextElement = mSubGroups[groupId].firstElement; + while (eINVALID_SUB_GROUP_ELEMENT != nextElement) + { + const SubGroupElement& e = mSubGroupElements[nextElement]; + PX_ASSERT(e.component != eINVALID_COMPONENT || e.childGroup != eINVALID_SUBSTEP_GROUP); + if (eINVALID_COMPONENT != e.component) + { + PxVehicleComponent* c = mComponents[e.component]; + if (!c->update(timestepForGroup, context)) + return false; + } + else + { + PX_ASSERT(eINVALID_SUBSTEP_GROUP != e.childGroup); + if (!updateSubGroup(dt, context, e.childGroup, stepMultiplier)) + return false; + } + nextElement = e.nextElement; + } + } + + return true; + } + + PxU8 getLastKnownElementInGroup(const PxU8 groupId) const + { + PxU8 currElement = mSubGroups[groupId].firstElement; + PxU8 nextElement = mSubGroups[groupId].firstElement; + while (nextElement != eINVALID_SUB_GROUP_ELEMENT) + { + currElement = nextElement; + nextElement = mSubGroupElements[nextElement].nextElement; + } + return currElement; + } +}; + + +bool PxVehicleComponentSequence::add(PxVehicleComponent* c) +{ + if (PxVehicleComponentSequenceLimits::eMAX_NB_COMPONENTS == mNbComponents) + return false; + if (PxVehicleComponentSequenceLimits::eMAX_NB_SUBGROUPELEMENTS == mNbSubGroupElements) + return false; + + //Create a new element and point it at the component. + SubGroupElement& nextElementInGroup = mSubGroupElements[mNbSubGroupElements]; + nextElementInGroup.childGroup = eINVALID_SUBSTEP_GROUP; + nextElementInGroup.component = mNbComponents; + nextElementInGroup.nextElement = eINVALID_SUB_GROUP_ELEMENT; + + if (eINVALID_SUB_GROUP_ELEMENT == mSubGroups[mActiveSubgroup].firstElement) + { + //The group is empty so add the first element to it. + //Point the group at the new element because this will + //be the first element in the group. + mSubGroups[mActiveSubgroup].firstElement = mNbSubGroupElements; + } + else + { + //We are extending the sequence of element of the group. + //Add the new element to the end of the group's sequence. + mSubGroupElements[getLastKnownElementInGroup(mActiveSubgroup)].nextElement = mNbSubGroupElements; + } + + //Increment the number of elements. + mNbSubGroupElements++; + + //Record the component and increment the number of components. + mComponents[mNbComponents] = c; + mNbComponents++; + + return true; +} + +PxU8 PxVehicleComponentSequence::beginSubstepGroup(const PxU8 nbSubSteps) +{ + if (mNbSubgroups == PxVehicleComponentSequenceLimits::eMAX_NB_SUBGROUPS) + return eINVALID_SUBSTEP_GROUP; + if (mNbSubGroupElements == PxVehicleComponentSequenceLimits::eMAX_NB_SUBGROUPELEMENTS) + return eINVALID_SUBSTEP_GROUP; + + //We have a parent and child group relationship. + const PxU8 parentGroup = mActiveSubgroup; + const PxU8 childGroup = mNbSubgroups; + + //Set up the child group. + mSubGroups[childGroup].parentGroup = parentGroup; + mSubGroups[childGroup].firstElement = eINVALID_SUB_GROUP_ELEMENT; + mSubGroups[childGroup].nbSteps = nbSubSteps; + + //Create a new element to add to the parent group and point it at the child group. + SubGroupElement& nextElementIInGroup = mSubGroupElements[mNbSubGroupElements]; + nextElementIInGroup.childGroup = childGroup; + nextElementIInGroup.nextElement = eINVALID_SUB_GROUP_ELEMENT; + nextElementIInGroup.component = eINVALID_COMPONENT; + + //Add the new element to the parent group. + if (eINVALID_SUB_GROUP_ELEMENT == mSubGroups[parentGroup].firstElement) + { + //The parent group is empty so add the first element to it. + //Point the parent group at the new element because this will + //be the first element in the group. + mSubGroups[parentGroup].firstElement = mNbSubGroupElements; + } + else + { + //We are extending the sequence of elements of the parent group. + //Add the new element to the end of the group's sequence. + mSubGroupElements[getLastKnownElementInGroup(parentGroup)].nextElement = mNbSubGroupElements; + } + + //Push the active group. + //All subsequent operations will now address the child group and we push or pop the group. + mActiveSubgroup = childGroup; + + //Increment the number of elements. + mNbSubGroupElements++; + + //Increment the number of groups. + mNbSubgroups++; + + //Return the group id. + return mActiveSubgroup; +} + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/PxVehicleFunctions.h b/engine/third_party/physx/include/vehicle2/PxVehicleFunctions.h new file mode 100644 index 00000000..6b9330b2 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/PxVehicleFunctions.h @@ -0,0 +1,195 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "foundation/PxTransform.h" +#include "foundation/PxMat33.h" +#include "foundation/PxSimpleTypes.h" +#include "PxRigidBody.h" +#include "PxVehicleParams.h" +#include "roadGeometry/PxVehicleRoadGeometryState.h" +#include "rigidBody/PxVehicleRigidBodyStates.h" +#include "physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h" +#include "physxActor/PxVehiclePhysXActorStates.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif +PX_FORCE_INLINE PxVec3 PxVehicleTransformFrameToFrame +(const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVec3& v) +{ + PxVec3 result = v; + if ((srcFrame.lngAxis != trgFrame.lngAxis) || (srcFrame.latAxis != trgFrame.latAxis) || (srcFrame.vrtAxis != trgFrame.vrtAxis)) + { + const PxMat33 a = srcFrame.getFrame(); + const PxMat33 r = trgFrame.getFrame(); + result = (r * a.getTranspose() * v); + } + return result; +} + +PX_FORCE_INLINE PxVec3 PxVehicleTransformFrameToFrame +(const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, + const PxVehicleScale& srcScale, const PxVehicleScale& trgScale, + const PxVec3& v) +{ + PxVec3 result = PxVehicleTransformFrameToFrame(srcFrame, trgFrame, v); + if((srcScale.scale != trgScale.scale)) + result *= (trgScale.scale / srcScale.scale); + return result; +} + +PX_FORCE_INLINE PxTransform PxVehicleTransformFrameToFrame +(const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, + const PxVehicleScale& srcScale, const PxVehicleScale& trgScale, + const PxTransform& v) +{ + PxTransform result(PxVehicleTransformFrameToFrame(srcFrame, trgFrame, srcScale, trgScale, v.p), v.q); + if ((srcFrame.lngAxis != trgFrame.lngAxis) || (srcFrame.latAxis != trgFrame.latAxis) || (srcFrame.vrtAxis != trgFrame.vrtAxis)) + { + PxF32 angle; + PxVec3 axis; + v.q.toRadiansAndUnitAxis(angle, axis); + result.q = PxQuat(angle, PxVehicleTransformFrameToFrame(srcFrame, trgFrame, axis)); + } + return result; +} + +PX_FORCE_INLINE PxVec3 PxVehicleComputeTranslation(const PxVehicleFrame& frame, const PxReal lng, const PxReal lat, const PxReal vrt) +{ + const PxVec3 v = frame.getFrame()*PxVec3(lng, lat, vrt); + return v; +} + +PX_FORCE_INLINE PxQuat PxVehicleComputeRotation(const PxVehicleFrame& frame, const PxReal roll, const PxReal pitch, const PxReal yaw) +{ + const PxMat33 m = frame.getFrame(); + const PxVec3& lngAxis = m.column0; + const PxVec3& latAxis = m.column1; + const PxVec3& vrtAxis = m.column2; + const PxQuat quatPitch(pitch, latAxis); + const PxQuat quatRoll(roll, lngAxis); + const PxQuat quatYaw(yaw, vrtAxis); + const PxQuat result = quatYaw * quatRoll * quatPitch; + return result; +} + +PX_FORCE_INLINE PxF32 PxVehicleComputeSign(const PxReal f) +{ + return physx::intrinsics::fsel(f, physx::intrinsics::fsel(-f, 0.0f, 1.0f), -1.0f); +} + + +/** +\brief Shift the origin of a vehicle by the specified vector. + +Call this method to adjust the internal data structures of vehicles to reflect the shifted origin location +(the shift vector will get subtracted from all world space spatial data). + +\param[in] axleDesc is a description of the wheels on the vehicle. +\param[in] shift is the translation vector used to shift the origin. +\param[in] rigidBodyState stores the current position of the vehicle +\param[in] roadGeometryStates stores the hit plane under each wheel. +\param[in] physxActor stores the PxRigidActor that is the vehicle's PhysX representation. +\param[in] physxQueryStates stores the hit point of the most recent execution of PxVehiclePhysXRoadGeometryQueryUpdate() for each wheel. +\note It is the user's responsibility to keep track of the summed total origin shift and adjust all input/output to/from the vehicle accordingly. +\note This call will not automatically shift the PhysX scene and its objects. PxScene::shiftOrigin() must be called separately to keep the systems in sync. +\note If there is no associated PxRigidActor then set physxActor to NULL. +\note If there is an associated PxRigidActor and it is already in a PxScene then the complementary call to PxScene::shiftOrigin() will take care of +shifting the associated PxRigidActor. This being the case, set physxActor to NULL. physxActor should be a non-NULL pointer only when there is an +associated PxRigidActor and it is not part of a PxScene. This can occur if the associated PxRigidActor is updated using PhysX immediate mode. +\note If scene queries are independent of PhysX geometry then set queryStates to NULL. +*/ +PX_FORCE_INLINE void PxVehicleShiftOrigin +(const PxVehicleAxleDescription& axleDesc, const PxVec3& shift, + PxVehicleRigidBodyState& rigidBodyState, PxVehicleRoadGeometryState* roadGeometryStates, + PxVehiclePhysXActor* physxActor = NULL, PxVehiclePhysXRoadGeometryQueryState* physxQueryStates = NULL) +{ + //Adjust the vehicle's internal pose. + rigidBodyState.pose.p -= shift; + + //Optionally adjust the PxRigidActor pose. + if (physxActor && !physxActor->rigidBody->getScene()) + { + const PxTransform oldPose = physxActor->rigidBody->getGlobalPose(); + const PxTransform newPose(oldPose.p - shift, oldPose.q); + physxActor->rigidBody->setGlobalPose(newPose); + } + + for (PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheelId = axleDesc.wheelIdsInAxleOrder[i]; + + //Optionally adjust the hit position. + if (physxQueryStates && physxQueryStates[wheelId].actor) + physxQueryStates[wheelId].hitPosition -= shift; + + //Adjust the hit plane. + if (roadGeometryStates[wheelId].hitState) + { + const PxPlane plane = roadGeometryStates[wheelId].plane; + PxU32 largestNormalComponentAxis = 0; + PxReal largestNormalComponent = 0.0f; + const PxF32 normalComponents[3] = { plane.n.x, plane.n.y, plane.n.z }; + for (PxU32 k = 0; k < 3; k++) + { + if (PxAbs(normalComponents[k]) > largestNormalComponent) + { + largestNormalComponent = PxAbs(normalComponents[k]); + largestNormalComponentAxis = k; + } + } + PxVec3 pointInPlane(PxZero); + switch (largestNormalComponentAxis) + { + case 0: + pointInPlane.x = -plane.d / plane.n.x; + break; + case 1: + pointInPlane.y = -plane.d / plane.n.y; + break; + case 2: + pointInPlane.z = -plane.d / plane.n.z; + break; + default: + break; + } + roadGeometryStates[wheelId].plane.d = -plane.n.dot(pointInPlane - shift); + } + } +} + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/PxVehicleLimits.h b/engine/third_party/physx/include/vehicle2/PxVehicleLimits.h new file mode 100644 index 00000000..96be3e50 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/PxVehicleLimits.h @@ -0,0 +1,53 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "foundation/PxPreprocessor.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif +struct PxVehicleLimits +{ + enum Enum + { + eMAX_NB_WHEELS = 20, + eMAX_NB_AXLES = eMAX_NB_WHEELS + }; +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + + diff --git a/engine/third_party/physx/include/vehicle2/PxVehicleMaths.h b/engine/third_party/physx/include/vehicle2/PxVehicleMaths.h new file mode 100644 index 00000000..9958220a --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/PxVehicleMaths.h @@ -0,0 +1,233 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxMemory.h" + +#include "PxVehicleLimits.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +class PxVehicleVectorN +{ +public: + enum + { + eMAX_SIZE = PxVehicleLimits::eMAX_NB_WHEELS + 3 + }; + + PxVehicleVectorN(const PxU32 size) + : mSize(size) + { + PX_ASSERT(mSize <= PxVehicleVectorN::eMAX_SIZE); + PxMemZero(mValues, sizeof(PxReal)*PxVehicleVectorN::eMAX_SIZE); + } + + ~PxVehicleVectorN() + { + } + + PxVehicleVectorN(const PxVehicleVectorN& src) + { + for (PxU32 i = 0; i < src.mSize; i++) + { + mValues[i] = src.mValues[i]; + } + mSize = src.mSize; + } + + PX_FORCE_INLINE PxVehicleVectorN& operator=(const PxVehicleVectorN& src) + { + for (PxU32 i = 0; i < src.mSize; i++) + { + mValues[i] = src.mValues[i]; + } + mSize = src.mSize; + return *this; + } + + PX_FORCE_INLINE PxReal& operator[] (const PxU32 i) + { + PX_ASSERT(i < mSize); + return (mValues[i]); + } + + PX_FORCE_INLINE const PxReal& operator[] (const PxU32 i) const + { + //PX_ASSERT(i < mSize); + return (mValues[i]); + } + + PX_FORCE_INLINE PxU32 getSize() const { return mSize; } + +private: + + PxReal mValues[PxVehicleVectorN::eMAX_SIZE]; + PxU32 mSize; +}; + +class PxVehicleMatrixNN +{ +public: + + PxVehicleMatrixNN() + : mSize(0) + { + } + + PxVehicleMatrixNN(const PxU32 size) + : mSize(size) + { + PX_ASSERT(mSize <= PxVehicleVectorN::eMAX_SIZE); + PxMemZero(mValues, sizeof(PxReal)*PxVehicleVectorN::eMAX_SIZE*PxVehicleVectorN::eMAX_SIZE); + } + + PxVehicleMatrixNN(const PxVehicleMatrixNN& src) + { + for (PxU32 i = 0; i < src.mSize; i++) + { + for (PxU32 j = 0; j < src.mSize; j++) + { + mValues[i][j] = src.mValues[i][j]; + } + } + mSize = src.mSize; + } + + ~PxVehicleMatrixNN() + { + } + + PX_FORCE_INLINE PxVehicleMatrixNN& operator=(const PxVehicleMatrixNN& src) + { + for (PxU32 i = 0; i < src.mSize; i++) + { + for (PxU32 j = 0; j < src.mSize; j++) + { + mValues[i][j] = src.mValues[i][j]; + } + } + mSize = src.mSize; + return *this; + } + + PX_FORCE_INLINE PxReal get(const PxU32 i, const PxU32 j) const + { + PX_ASSERT(i < mSize); + PX_ASSERT(j < mSize); + return mValues[i][j]; + } + + PX_FORCE_INLINE void set(const PxU32 i, const PxU32 j, const PxReal val) + { + PX_ASSERT(i < mSize); + PX_ASSERT(j < mSize); + mValues[i][j] = val; + } + + PX_FORCE_INLINE PxU32 getSize() const { return mSize; } + + PX_FORCE_INLINE void setSize(const PxU32 size) + { + PX_ASSERT(size <= PxVehicleVectorN::eMAX_SIZE); + mSize = size; + } + +public: + + PxReal mValues[PxVehicleVectorN::eMAX_SIZE][PxVehicleVectorN::eMAX_SIZE]; + PxU32 mSize; +}; + + +/* + LUPQ decomposition + + Based upon "Outer Product LU with Complete Pivoting," from Matrix Computations (4th Edition), Golub and Van Loan + + Solve A*x = b using: + + MatrixNNLUSolver solver; + solver.decomposeLU(A); + solver.solve(b, x); +*/ +class PxVehicleMatrixNNLUSolver +{ +private: + + PxVehicleMatrixNN mLU; + PxU32 mP[PxVehicleVectorN::eMAX_SIZE - 1]; // Row permutation + PxU32 mQ[PxVehicleVectorN::eMAX_SIZE - 1]; // Column permutation + PxReal mDetM; + +public: + + PxVehicleMatrixNNLUSolver() {} + ~PxVehicleMatrixNNLUSolver() {} + + PxReal getDet() const { return mDetM; } + + void decomposeLU(const PxVehicleMatrixNN& A); + + //Given a matrix A and a vector b find x that satisfies Ax = b, where the matrix A is the matrix that was passed to #decomposeLU. + //Returns true if the lu decomposition indicates that the matrix has an inverse and x was successfully computed. + //Returns false if the lu decomposition resulted in zero determinant ie the matrix has no inverse and no solution exists for x. + //Returns false if the size of either b or x doesn't match the size of the matrix passed to #decomposeLU. + //If false is returned then each relevant element of x is set to zero. + bool solve(const PxVehicleVectorN& b, PxVehicleVectorN& x) const; +}; + + +class PxVehicleMatrixNGaussSeidelSolver +{ +public: + + void solve(const PxU32 maxIterations, const PxReal tolerance, const PxVehicleMatrixNN& A, const PxVehicleVectorN& b, PxVehicleVectorN& result) const; +}; + +class PxVehicleMatrix33Solver +{ +public: + + bool solve(const PxVehicleMatrixNN& A_, const PxVehicleVectorN& b_, PxVehicleVectorN& result) const; +}; + +#if !PX_DOXYGEN +} //namespace vehicle2 +} //namespace physx +#endif + + + diff --git a/engine/third_party/physx/include/vehicle2/PxVehicleParams.h b/engine/third_party/physx/include/vehicle2/PxVehicleParams.h new file mode 100644 index 00000000..dd10e044 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/PxVehicleParams.h @@ -0,0 +1,910 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +#pragma once +#include "foundation/PxFoundation.h" +#include "foundation/PxAssert.h" +#include "foundation/PxMemory.h" +#include "foundation/PxVec3.h" +#include "foundation/PxMat33.h" + +#include "PxVehicleLimits.h" + +class OmniPvdWriter; + +#if !PX_DOXYGEN +namespace physx +{ +class PxConvexMesh; +class PxScene; +namespace vehicle2 +{ +#endif + +struct PxVehicleAxleDescription +{ + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleAxleDescription)); + } + + /** + \brief Add an axle to the vehicle by specifying the number of wheels on the axle and an array of wheel ids specifying each wheel on the axle. + \param[in] nbWheelsOnAxle is the number of wheels on the axle to be added. + \param[in] wheelIdsOnAxle is an array of wheel ids specifying all the wheels on the axle to be added. + */ + void addAxle(const PxU32 nbWheelsOnAxle, const PxU32* const wheelIdsOnAxle) + { + PX_ASSERT((nbWheels + nbWheelsOnAxle) < PxVehicleLimits::eMAX_NB_WHEELS); + PX_ASSERT(nbAxles < PxVehicleLimits::eMAX_NB_AXLES); + nbWheelsPerAxle[nbAxles] = nbWheelsOnAxle; + axleToWheelIds[nbAxles] = nbWheels; + for (PxU32 i = 0; i < nbWheelsOnAxle; i++) + { + wheelIdsInAxleOrder[nbWheels + i] = wheelIdsOnAxle[i]; + } + nbWheels += nbWheelsOnAxle; + nbAxles++; + } + + /** + \brief Return the number of axles on the vehicle. + \return The number of axles. + \see getNbWheelsOnAxle() + */ + PX_FORCE_INLINE PxU32 getNbAxles() const + { + return nbAxles; + } + + /** + \brief Return the number of wheels on the ith axle. + \param[in] i specifies the axle to be queried for its wheel count. + \return The number of wheels on the specified axle. + \see getWheelOnAxle() + */ + PX_FORCE_INLINE PxU32 getNbWheelsOnAxle(const PxU32 i) const + { + return nbWheelsPerAxle[i]; + } + + /** + \brief Return the wheel id of the jth wheel on the ith axle. + \param[in] j specifies that the wheel id to be returned is the jth wheel in the list of wheels on the specified axle. + \param[in] i specifies the axle to be queried. + \return The wheel id of the jth wheel on the ith axle. + \see getNbWheelsOnAxle() + */ + PX_FORCE_INLINE PxU32 getWheelOnAxle(const PxU32 j, const PxU32 i) const + { + return wheelIdsInAxleOrder[axleToWheelIds[i] + j]; + } + + /** + \brief Return the number of wheels on the vehicle. + \return The number of wheels. + */ + PX_FORCE_INLINE PxU32 getNbWheels() const + { + return nbWheels; + } + + /** + \brief Return the axle of a specified wheel. + \param[in] wheelId is the wheel whose axle is to be queried. + \return The axle of the specified wheel. + */ + PX_FORCE_INLINE PxU32 getAxle(const PxU32 wheelId) const + { + for (PxU32 i = 0; i < getNbAxles(); i++) + { + for (PxU32 j = 0; j < getNbWheelsOnAxle(i); j++) + { + if (getWheelOnAxle(j, i) == wheelId) + return i; + } + } + return 0xffffffff; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(nbAxles > 0, "PxVehicleAxleDescription.nbAxles must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(nbWheels > 0, "PxVehicleAxleDescription.nbWheels must be greater than zero", false); + return true; + } + + PxU32 nbAxles; //!< The number of axles on the vehicle + PxU32 nbWheelsPerAxle[PxVehicleLimits::eMAX_NB_AXLES]; //!< The number of wheels on each axle. + PxU32 axleToWheelIds[PxVehicleLimits::eMAX_NB_AXLES]; //!< The list of wheel ids for the ith axle begins at wheelIdsInAxleOrder[axleToWheelIds[i]] + + PxU32 wheelIdsInAxleOrder[PxVehicleLimits::eMAX_NB_WHEELS]; //!< The list of all wheel ids on the vehicle. + PxU32 nbWheels; //!< The number of wheels on the vehicle. + + + PX_COMPILE_TIME_ASSERT(PxVehicleLimits::eMAX_NB_AXLES == PxVehicleLimits::eMAX_NB_WHEELS); + // It should be possible to support cases where each wheel is controlled individually and thus + // having a wheel per axle for up to the max wheel count. +}; + + +struct PxVehicleAxes +{ + enum Enum + { + ePosX = 0, //!< The +x axis + eNegX, //!< The -x axis + ePosY, //!< The +y axis + eNegY, //!< The -y axis + ePosZ, //!< The +z axis + eNegZ, //!< The -z axis + eMAX_NB_AXES + }; +}; + +struct PxVehicleFrame +{ + PxVehicleAxes::Enum lngAxis; //!< The axis defining the longitudinal (forward) direction of the vehicle. + PxVehicleAxes::Enum latAxis; //!< The axis defining the lateral (side) direction of the vehicle. + PxVehicleAxes::Enum vrtAxis; //!< The axis defining the vertical (up) direction of the vehicle. + + PX_FORCE_INLINE void setToDefault() + { + lngAxis = PxVehicleAxes::ePosX; + latAxis = PxVehicleAxes::ePosY; + vrtAxis = PxVehicleAxes::ePosZ; + } + + PX_FORCE_INLINE PxMat33 getFrame() const + { + const PxVec3 basisDirs[6] = { PxVec3(1,0,0), PxVec3(-1,0,0), PxVec3(0,1,0), PxVec3(0,-1,0), PxVec3(0,0,1), PxVec3(0,0,-1) }; + const PxMat33 mat33(basisDirs[lngAxis], basisDirs[latAxis], basisDirs[vrtAxis]); + return mat33; + } + + PX_FORCE_INLINE PxVec3 getLngAxis() const + { + const PxVec3 basisDirs[6] = { PxVec3(1,0,0), PxVec3(-1,0,0), PxVec3(0,1,0), PxVec3(0,-1,0), PxVec3(0,0,1), PxVec3(0,0,-1) }; + return basisDirs[lngAxis]; + } + + PX_FORCE_INLINE PxVec3 getLatAxis() const + { + const PxVec3 basisDirs[6] = { PxVec3(1,0,0), PxVec3(-1,0,0), PxVec3(0,1,0), PxVec3(0,-1,0), PxVec3(0,0,1), PxVec3(0,0,-1) }; + return basisDirs[latAxis]; + } + + PX_FORCE_INLINE PxVec3 getVrtAxis() const + { + const PxVec3 basisDirs[6] = { PxVec3(1,0,0), PxVec3(-1,0,0), PxVec3(0,1,0), PxVec3(0,-1,0), PxVec3(0,0,1), PxVec3(0,0,-1) }; + return basisDirs[vrtAxis]; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(lngAxis < PxVehicleAxes::eMAX_NB_AXES, "PxVehicleFrame.lngAxis is invalid", false); + PX_CHECK_AND_RETURN_VAL(latAxis < PxVehicleAxes::eMAX_NB_AXES, "PxVehicleFrame.latAxis is invalid", false); + PX_CHECK_AND_RETURN_VAL(vrtAxis < PxVehicleAxes::eMAX_NB_AXES, "PxVehicleFrame.vrtAxis is invalid", false); + const PxMat33 frame = getFrame(); + const PxQuat quat(frame); + PX_CHECK_AND_RETURN_VAL(quat.isFinite() && quat.isUnit() && quat.isSane(), "PxVehicleFrame is not a legal frame", false); + return true; + } +}; + +struct PxVehicleScale +{ + PxReal scale; //!< The length scale used for the vehicle. For example, if 1.0 is considered meters, then 100.0 would be for centimeters. + + PX_FORCE_INLINE void setToDefault() + { + scale = 1.0f; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(scale > 0.0f, "PxVehicleScale.scale must be greater than zero", false); + return true; + } +}; + +/** +\brief Helper struct to pass array type data to vehice components and functions. + +The Vehicle SDK tries to give the user a certain freedom in how the parameters and +states are stored. This helper struct presents a way to either use array of structs +or array of pointers to structs to pass data into the provided vehicle components +and functions. +*/ +template +struct PxVehicleArrayData +{ + enum DataFormat + { + eARRAY_OF_STRUCTS = 0, //!< The data is provided as an array of structs and stored in #arrayOfStructs. + eARRAY_OF_POINTERS //!< The data is provided as an array of pointers and stored in #arrayOfPointers. + }; + + /** + \brief Set the data as an array of structs. + + \param[in] data The data as an array of structs. + */ + PX_FORCE_INLINE void setData(T* data) + { + arrayOfStructs = data; + dataFormat = eARRAY_OF_STRUCTS; + } + + /** + \brief Set the data as an array of pointers. + + \param[in] data The data as an array of pointers. + */ + PX_FORCE_INLINE void setData(T*const* data) + { + arrayOfPointers = data; + dataFormat = eARRAY_OF_POINTERS; + } + + PX_FORCE_INLINE PxVehicleArrayData() + { + } + + PX_FORCE_INLINE explicit PxVehicleArrayData(T* data) + { + setData(data); + } + + PX_FORCE_INLINE explicit PxVehicleArrayData(T*const* data) + { + setData(data); + } + + /** + \brief Get the data entry at a given index. + + \param[in] index The index to retrieve the data entry for. + \return Reference to the requested data entry. + */ + PX_FORCE_INLINE T& getData(PxU32 index) + { + if (dataFormat == eARRAY_OF_STRUCTS) + return arrayOfStructs[index]; + else + return *arrayOfPointers[index]; + } + + PX_FORCE_INLINE T& operator[](PxU32 index) + { + return getData(index); + } + + /** + \brief Get the data entry at a given index. + + \param[in] index The index to retrieve the data entry for. + \return Reference to the requested data entry. + */ + PX_FORCE_INLINE const T& getData(PxU32 index) const + { + if (dataFormat == eARRAY_OF_STRUCTS) + return arrayOfStructs[index]; + else + return *arrayOfPointers[index]; + } + + PX_FORCE_INLINE const T& operator[](PxU32 index) const + { + return getData(index); + } + + /** + \brief Set as empty. + */ + PX_FORCE_INLINE void setEmpty() + { + arrayOfStructs = NULL; + } + + /** + \brief Check if declared as empty. + + \return True if empty, else false. + */ + PX_FORCE_INLINE bool isEmpty() const + { + return (arrayOfStructs == NULL); + } + + /** + \brief Get a reference to the array but read only. + + \return Read only version of the data. + */ + PX_FORCE_INLINE const PxVehicleArrayData& getConst() const + { + return reinterpret_cast&>(*this); + } + + + union + { + T* arrayOfStructs; //!< The data stored as an array of structs. + T*const* arrayOfPointers; //!< The data stored as an array of pointers. + }; + PxU8 dataFormat; +}; + +template +struct PxVehicleSizedArrayData : public PxVehicleArrayData +{ + /** + \brief Set the data as an array of structs and set the number of data entries. + + \param[in] data The data as an array of structs. + \param[in] count The number of entries in the data array. + */ + PX_FORCE_INLINE void setDataAndCount(T* data, const PxU32 count) + { + PxVehicleArrayData::setData(data); + size = count; + } + + /** + \brief Set the data as an array of pointers and set the number of data entries. + + \param[in] data The data as an array of pointers. + \param[in] count The number of entries in the data array. + */ + PX_FORCE_INLINE void setDataAndCount(T*const* data, const PxU32 count) + { + PxVehicleArrayData::setData(data); + size = count; + } + + /** + \brief Set as empty. + */ + PX_FORCE_INLINE void setEmpty() + { + PxVehicleArrayData::setEmpty(); + size = 0; + } + + /** + \brief Check if declared as empty. + + \return True if empty, else false. + */ + PX_FORCE_INLINE bool isEmpty() const + { + return ((size == 0) || PxVehicleArrayData::isEmpty()); + } + + PxU32 size; +}; + +/** +\brief Determine whether the PhysX actor associated with a vehicle is to be updated with a velocity change or an acceleration change. +A velocity change will be immediately reflected in linear and angular velocity queries against the vehicle. An acceleration change, on the other hand, +will leave the linear and angular velocities unchanged until the next PhysX scene update has applied the acceleration update to the actor's linear and +angular velocities. +\see PxVehiclePhysXActorEndComponent +\see PxVehicleWriteRigidBodyStateToPhysXActor +*/ +struct PxVehiclePhysXActorUpdateMode +{ + enum Enum + { + eAPPLY_VELOCITY = 0, + eAPPLY_ACCELERATION + }; +}; + +/** +\brief Tire slip values are computed using ratios with potential for divide-by-zero errors. PxVehicleTireSlipParams +introduces a minimum value for the denominator of each of these ratios. +*/ +struct PxVehicleTireSlipParams +{ + /** + \brief The lateral slip angle is typically computed as a function of the ratio of lateral and longitudinal speeds + of the rigid body in the tire's frame. This leads to a divide-by-zero in the event that the longitudinal speed + approaches zero. The parameter minLatSlipDenominator sets a minimum denominator for the ratio of speeds used to + compute the lateral slip angle. + \note Larger timesteps typically require larger values of minLatSlipDenominator. + + Range: (0, inf)
+ Unit: velocity = length / time + */ + PxReal minLatSlipDenominator; + + /** + \brief The longitudinal slip represents the difference between the longitudinal speed of the rigid body in the tire's + frame and the linear speed arising from the rotation of the wheel. This is typically normalized using the reciprocal + of the longitudinal speed of the rigid body in the tire's frame. This leads to a divide-by-zero in the event that the + longitudinal speed approaches zero. The parameter minPassiveLongSlipDenominator sets a minimum denominator for the normalized + longitudinal slip when the wheel experiences zero drive torque and zero brake torque and zero handbrake torque. The aim is + to bring the vehicle to rest without experiencing wheel rotational speeds that oscillate around zero. + \note The vehicle will come to rest more smoothly with larger values of minPassiveLongSlipDenominator, particularly + with large timesteps that often lead to oscillation in wheel rotation speeds when the wheel rotation speed approaches + zero. + \note It is recommended that minActiveLongSlipDenominator < minPassiveLongSlipDenominator. + + Range: (0, inf)
+ Unit: velocity = length / time + */ + PxReal minPassiveLongSlipDenominator; + + /** + \brief The longitudinal slip represents the difference between the longitudinal speed of the rigid body in the tire's + frame and the linear speed arising from the rotation of the wheel. This is typically normalized using the reciprocal + of the longitudinal speed of the rigid body in the tire's frame. This leads to a divide-by-zero in the event that the + longitudinal speed approaches zero. The parameter minActiveLongSlipDenominator sets a minimum denominator for the normalized + longitudinal slip when the wheel experiences either a non-zero drive torque or a non-zero brake torque or a non-zero handbrake + torque. + \note Larger timesteps typically require larger values of minActiveLongSlipDenominator to avoid instabilities occurring when + the vehicle is aggressively throttled from rest. + \note It is recommended that minActiveLongSlipDenominator < minPassiveLongSlipDenominator. + + Range: (0, inf)
+ Unit: velocity = length / time + */ + PxReal minActiveLongSlipDenominator; + + PX_FORCE_INLINE void setToDefault() + { + minLatSlipDenominator = 1.0f; + minActiveLongSlipDenominator = 0.1f; + minPassiveLongSlipDenominator = 4.0f; + } + + PX_FORCE_INLINE PxVehicleTireSlipParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleTireSlipParams p = *this; + const PxReal scaleRatio = trgScale.scale / srcScale.scale; + p.minLatSlipDenominator *= scaleRatio; + p.minPassiveLongSlipDenominator *= scaleRatio; + p.minActiveLongSlipDenominator *= scaleRatio; + return p; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(minLatSlipDenominator > 0.0f, "PxVehicleTireSlipParams.minLatSlipDenominator must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(minPassiveLongSlipDenominator > 0.0f, "PxVehicleTireSlipParams.minPassiveLongSlipDenominator must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(minActiveLongSlipDenominator > 0.0f, "PxVehicleTireSlipParams.minActiveLongSlipDenominator must be greater than zero", false); + return true; + } +}; + +/** +\brief Tires have two important directions for the purposes of tire force computation: longitudinal and lateral. +*/ +struct PxVehicleTireDirectionModes +{ + enum Enum + { + eLONGITUDINAL = 0, + eLATERAL, + eMAX_NB_PLANAR_DIRECTIONS + }; +}; + +/** +\brief The low speed regime often presents numerical difficulties for the tire model due to the potential for divide-by-zero errors. +This particularly affects scenarios where the vehicle is slowing down due to damping and drag. In scenarios where there is no +significant brake or drive torque, numerical error begins to dominate and it can be difficult to bring the vehicle to rest. A solution +to this problem is to recognise that the vehicle is close to rest and to replace the tire forces with velocity constraints that will +bring the vehicle to rest. This regime is known as the "sticky tire" regime. PxVehicleTireAxisStickyParams describes velocity and time +thresholds that categorise the "sticky tire" regime. It also describes the rate at which the velocity constraints approach zero speed. +*/ +struct PxVehicleTireAxisStickyParams +{ + /** + \brief A tire enters the "sticky tire" regime when it has been below a speed specified by #thresholdSpeed for a continuous time + specified by #thresholdTime. + + Range: [0, inf)
+ Unit: velocity = length / time + */ + PxReal thresholdSpeed; + + /** + \brief A tire enters the "sticky tire" regime when it has been below a speed specified by #thresholdSpeed for a continuous time + specified by #thresholdTime. + + Range: [0, inf)
+ Unit: time + */ + PxReal thresholdTime; + + /** + \brief The rate at which the velocity constraint approaches zero is controlled by the damping parameter. + \note Larger values of damping lead to faster approaches to zero. Since the damping behaves like a + stiffness with respect to the velocity, too large a value can lead to instabilities. + + Range: [0, inf)
+ Unit: 1 / time (acceleration instead of force based damping, thus not mass/time) + */ + PxReal damping; + + + PX_FORCE_INLINE PxVehicleTireAxisStickyParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleTireAxisStickyParams p = *this; + const PxReal scaleRatio = trgScale.scale / srcScale.scale; + p.thresholdSpeed *= scaleRatio; + return p; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(thresholdSpeed >= 0.0f, "PxVehicleTireAxisStickyParams.thresholdSpeed must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(thresholdTime >= 0.0f, "PxVehicleTireAxisStickyParams.thresholdTime must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(damping >= 0.0f, "PxVehicleTireAxisStickyParams.damping must be greater than or equal to zero", false); + return true; + } +}; + +/** +\brief For each tire, the forces of the tire model may be replaced by velocity constraints when the tire enters the "sticky tire" +regime. The "sticky tire" regime of the lateral and longitudinal directions of the tire are managed separately. +*/ +struct PxVehicleTireStickyParams +{ + /** + The "sticky tire" regime of the lateral and longitudinal directions of the tire are managed separately and are individually + parameterized. + */ + PxVehicleTireAxisStickyParams stickyParams[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + PX_FORCE_INLINE void setToDefault() + { + stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL].thresholdSpeed = 0.2f; + stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL].thresholdTime = 1.0f; + stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL].damping = 1.0f; + stickyParams[PxVehicleTireDirectionModes::eLATERAL].thresholdSpeed = 0.2f; + stickyParams[PxVehicleTireDirectionModes::eLATERAL].thresholdTime = 1.0f; + stickyParams[PxVehicleTireDirectionModes::eLATERAL].damping = 0.1f; + } + + PX_FORCE_INLINE PxVehicleTireStickyParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PxVehicleTireStickyParams p = *this; + p.stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL] = + stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL].transformAndScale(srcFrame, trgFrame, srcScale, trgScale); + p.stickyParams[PxVehicleTireDirectionModes::eLATERAL] = + stickyParams[PxVehicleTireDirectionModes::eLATERAL].transformAndScale(srcFrame, trgFrame, srcScale, trgScale); + return p; + } + + PX_FORCE_INLINE bool isValid() const + { + if (!stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL].isValid()) + return false; + if (!stickyParams[PxVehicleTireDirectionModes::eLATERAL].isValid()) + return false; + return true; + } +}; + +struct PxVehicleSimulationContextType +{ + enum Enum + { + eDEFAULT, //!< The simulation context inherits from PxVehicleSimulationContext + ePHYSX //!< The simulation context inherits from PxVehiclePhysXSimulationContext + }; +}; + +/** +\brief Structure to support Omni PVD, the PhysX Visual Debugger. +*/ +struct PxVehiclePvdContext +{ +public: + PX_FORCE_INLINE void setToDefault() + { + attributeHandles = NULL; + writer = NULL; + } + + + /** + \brief The attribute handles used to reflect vehicle parameter and state data in omnipvd. + \note A null value will result in no values being reflected in omnipvd. + \note #attributeHandles and #writer both need to be non-NULL to reflect vehicle values in omnipvd. + \see PxVehiclePvdAttributesCreate + \see PxVehiclePvdAttributesRelease + \see PxVehiclePVDComponent + */ + const struct PxVehiclePvdAttributeHandles* attributeHandles; + + /** + \brief An instance of OmniPvdWriter used to write vehicle prameter and state data to omnipvd. + \note A null value will result in no values being reflected in omnipvd. + \note #attributeHandles and #writer both need to be non-NULL to reflect vehicle values in omnipvd. + \see PxVehiclePvdAttributesCreate + \see PxVehiclePvdAttributesRelease + \see PxVehiclePVDComponent + */ + OmniPvdWriter* writer; +}; + +struct PxVehicleSimulationContext +{ + PxVehicleSimulationContext() + : type(PxVehicleSimulationContextType::eDEFAULT) + {} + + PxVec3 gravity; + + PxVehicleFrame frame; + PxVehicleScale scale; + + //Tire + PxVehicleTireSlipParams tireSlipParams; + PxVehicleTireStickyParams tireStickyParams; + + /** + \brief Forward wheel speed below which the wheel rotation speed gets blended with the rolling speed. + + The blended rotation speed is used to integrate the wheel rotation angle. At low forward wheel speed, + the wheel rotation speed can get unstable (depending on the tire model used) and, for example, oscillate. + + \note If brake or throttle is applied, there will be no blending. + + Unit: velocity = length / time + */ + PxReal thresholdForwardSpeedForWheelAngleIntegration; + + /** + \brief Structure to support Omni PVD, the PhysX Visual Debugger. + */ + PxVehiclePvdContext pvdContext; + +protected: + PxVehicleSimulationContextType::Enum type; + + +public: + PX_FORCE_INLINE PxVehicleSimulationContextType::Enum getType() const { return type; } + + PX_FORCE_INLINE void setToDefault() + { + frame.setToDefault(); + scale.setToDefault(); + + gravity = frame.getVrtAxis() * (-9.81f * scale.scale); + + tireSlipParams.setToDefault(); + tireStickyParams.setToDefault(); + + thresholdForwardSpeedForWheelAngleIntegration = 5.0f * scale.scale; + + pvdContext.setToDefault(); + } + + PX_FORCE_INLINE PxVehicleSimulationContext transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PxVehicleSimulationContext c = *this; + const PxReal scaleRatio = trgScale.scale / srcScale.scale; + c.gravity = trgFrame.getFrame()*srcFrame.getFrame().getTranspose()*c.gravity; + c.gravity *= scaleRatio; + c.tireSlipParams = tireSlipParams.transformAndScale(srcFrame, trgFrame, srcScale, trgScale); + c.tireStickyParams = tireStickyParams.transformAndScale(srcFrame, trgFrame, srcScale, trgScale); + c.thresholdForwardSpeedForWheelAngleIntegration *= scaleRatio; + c.frame = trgFrame; + c.scale = trgScale; + return c; + } +}; + +struct PxVehiclePhysXSimulationContext : public PxVehicleSimulationContext +{ + PxVehiclePhysXSimulationContext() + : PxVehicleSimulationContext() + { + type = PxVehicleSimulationContextType::ePHYSX; + } + + //Road geometry queries to find the plane under the wheel. + const PxConvexMesh* physxUnitCylinderSweepMesh; + const PxScene* physxScene; + + //PhysX actor update + PxVehiclePhysXActorUpdateMode::Enum physxActorUpdateMode; + + /** + \brief Wake counter value to set on the physx actor if a reset is required. + + Certain vehicle states should keep a physx actor of a vehicle awake. This + will be achieved by resetting the wake counter value if needed. The wake + counter value is the minimum simulation time that a physx actor will stay + awake. + + Unit: time + + \see physxActorWakeCounterThreshold PxVehiclePhysxActorKeepAwakeCheck + */ + PxReal physxActorWakeCounterResetValue; + + /** + \brief Threshold below which to check whether the physx actor wake counter + should get reset. + + Unit: time + + \see physxActorWakeCounterResetValue PxVehiclePhysxActorKeepAwakeCheck + */ + PxReal physxActorWakeCounterThreshold; + + + PX_FORCE_INLINE void setToDefault() + { + PxVehicleSimulationContext::setToDefault(); + + physxUnitCylinderSweepMesh = NULL; + physxScene = NULL; + + physxActorUpdateMode = PxVehiclePhysXActorUpdateMode::eAPPLY_VELOCITY; + + physxActorWakeCounterResetValue = 20.0f * 0.02f; // 20 timesteps of size 0.02 + physxActorWakeCounterThreshold = 0.5f * physxActorWakeCounterResetValue; + } + + PX_FORCE_INLINE PxVehiclePhysXSimulationContext transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PxVehiclePhysXSimulationContext r = *this; + static_cast(r) = PxVehicleSimulationContext::transformAndScale(srcFrame, trgFrame, srcScale, trgScale); + return r; + } +}; + +/** +* \brief Express a function as a sequence of points {(x, y)} that form a piecewise polynomial. +*/ +template +class PxVehicleFixedSizeLookupTable +{ +public: + + PxVehicleFixedSizeLookupTable() + : nbDataPairs(0) + { + } + + PxVehicleFixedSizeLookupTable(const PxVehicleFixedSizeLookupTable& src) + { + PxMemCopy(xVals, src.xVals, sizeof(PxReal)* src.nbDataPairs); + PxMemCopy(yVals, src.yVals, sizeof(T)*src.nbDataPairs); + nbDataPairs = src.nbDataPairs; + } + + ~PxVehicleFixedSizeLookupTable() + { + } + + PxVehicleFixedSizeLookupTable& operator=(const PxVehicleFixedSizeLookupTable& src) + { + PxMemCopy(xVals, src.xVals, sizeof(PxReal)*src.nbDataPairs); + PxMemCopy(yVals, src.yVals, sizeof(T)*src.nbDataPairs); + nbDataPairs = src.nbDataPairs; + return *this; + } + + /** + \brief Add one more point to create one more polynomial segment of a piecewise polynomial. + */ + PX_FORCE_INLINE bool addPair(const PxReal x, const T y) + { + PX_CHECK_AND_RETURN_VAL(nbDataPairs < NB_ELEMENTS, "PxVehicleFixedSizeLookupTable::addPair() exceeded fixed size capacity", false); + xVals[nbDataPairs] = x; + yVals[nbDataPairs] = y; + nbDataPairs++; + return true; + } + + /** + \brief Identify the segment of the piecewise polynomial that includes x and compute the corresponding y value by linearly interpolating the gradient of the segment. + \param[in] x is the value on the x-axis of the piecewise polynomial. + \return Returns the y value that corresponds to the input x. + */ + PX_FORCE_INLINE T interpolate(const PxReal x) const + { + if (0 == nbDataPairs) + { + return T(0); + } + + if (1 == nbDataPairs || x < xVals[0]) + { + return yVals[0]; + } + + PxReal x0 = xVals[0]; + T y0 = yVals[0]; + + for (PxU32 i = 1; i < nbDataPairs; i++) + { + const PxReal x1 = xVals[i]; + const T y1 = yVals[i]; + + if ((x >= x0) && (x < x1)) + { + return (y0 + (y1 - y0) * (x - x0) / (x1 - x0)); + } + + x0 = x1; + y0 = y1; + } + + PX_ASSERT(x >= xVals[nbDataPairs - 1]); + return yVals[nbDataPairs - 1]; + } + + void clear() + { + PxMemSet(xVals, 0, NB_ELEMENTS * sizeof(PxReal)); + PxMemSet(yVals, 0, NB_ELEMENTS * sizeof(T)); + nbDataPairs = 0; + } + + PxReal xVals[NB_ELEMENTS]; + T yVals[NB_ELEMENTS]; + PxU32 nbDataPairs; + + PX_FORCE_INLINE bool isValid() const + { + for (PxU32 i = 1; i < nbDataPairs; i++) + { + PX_CHECK_AND_RETURN_VAL(xVals[i] > xVals[i - 1], "PxVehicleFixedSizeLookupTable:: xVals[i+1] must be greater than xVals[i]", false); + } + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + + + + diff --git a/engine/third_party/physx/include/vehicle2/braking/PxVehicleBrakingFunctions.h b/engine/third_party/physx/include/vehicle2/braking/PxVehicleBrakingFunctions.h new file mode 100644 index 00000000..ebf7afe8 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/braking/PxVehicleBrakingFunctions.h @@ -0,0 +1,75 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxMath.h" +#include "PxVehicleBrakingParams.h" +#include "../commands/PxVehicleCommandStates.h" +#include "../commands/PxVehicleCommandHelpers.h" +#include "../drivetrain/PxVehicleDrivetrainParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Compute the brake torque response to an array of brake commands. +\param[in] brakeCommands is the array of input brake commands to be applied to the vehicle. +\param[in] nbBrakeCommands is the number of input brake commands to be applied to the vehicle. +\param[in] longitudinalSpeed is the longitudinal speed of the vehicle. +\param[in] wheelId specifies the wheel that is to have its brake response computed. +\param[in] brakeResponseParams specifies the per wheel brake torque response to each brake command as a nonlinear function of brake command and longitudinal speed. +\param[out] brakeResponseState is the brake torque response to the input brake command. +\note commands.brakes[i] and brakeResponseParams[i] are treated as pairs of brake command and brake command response. +*/ +PX_FORCE_INLINE void PxVehicleBrakeCommandResponseUpdate +(const PxReal* brakeCommands, const PxU32 nbBrakeCommands, const PxReal longitudinalSpeed, + const PxU32 wheelId, const PxVehicleSizedArrayData& brakeResponseParams, + PxReal& brakeResponseState) +{ + PX_CHECK_AND_RETURN(nbBrakeCommands <= brakeResponseParams.size, "PxVehicleBrakeCommandLinearUpdate: nbBrakes must be less than or equal to brakeResponseParams.size"); + PxReal sum = 0.0f; + for (PxU32 i = 0; i < nbBrakeCommands; i++) + { + sum += PxVehicleNonLinearResponseCompute(brakeCommands[i], longitudinalSpeed, wheelId, brakeResponseParams[i]); + } + brakeResponseState = sum; +} + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/braking/PxVehicleBrakingParams.h b/engine/third_party/physx/include/vehicle2/braking/PxVehicleBrakingParams.h new file mode 100644 index 00000000..44a949b4 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/braking/PxVehicleBrakingParams.h @@ -0,0 +1,82 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxFoundation.h" + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/commands/PxVehicleCommandParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Distribute a brake response to the wheels of a vehicle. +\note The brake torque of each wheel on the ith wheel is brakeCommand * maxResponse * wheelResponseMultipliers[i]. +\note A typical use case is to set maxResponse to be the vehicle's maximum achievable brake torque +that occurs when the brake command is equal to 1.0. The array wheelResponseMultipliers[i] would then be used +to specify the maximum achievable brake torque per wheel as a fractional multiplier of the vehicle's maximum achievable brake torque. +*/ +struct PxVehicleBrakeCommandResponseParams : public PxVehicleCommandResponseParams +{ + PX_FORCE_INLINE PxVehicleBrakeCommandResponseParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleBrakeCommandResponseParams r = *this; + const PxReal scale = trgScale.scale/srcScale.scale; + r.maxResponse *= (scale*scale); //maxResponse is a torque! + return r; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + if (!axleDesc.isValid()) + return false; + PX_CHECK_AND_RETURN_VAL(maxResponse >= 0.0f, "PxVehicleBrakeCommandResponseParams.maxResponse must be greater than or equal to zero", false); + for (PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + PX_CHECK_AND_RETURN_VAL(wheelResponseMultipliers[axleDesc.wheelIdsInAxleOrder[i]] >= 0.0f, "PxVehicleBrakeCommandResponseParams.wheelResponseMultipliers[i] must be greater than or equal to zero.", false); + } + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/commands/PxVehicleCommandHelpers.h b/engine/third_party/physx/include/vehicle2/commands/PxVehicleCommandHelpers.h new file mode 100644 index 00000000..eea1af90 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/commands/PxVehicleCommandHelpers.h @@ -0,0 +1,72 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "vehicle2/PxVehicleParams.h" +#include "PxVehicleCommandParams.h" +#include "PxVehicleCommandStates.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Compute the linear response to a command. +\param[in] command is a normalised command value. +\param[in] wheelId specifies the wheel that is to respond to the command. +\param[in] responseParams specifies the wheel responses for all wheels on a vehicle. +\return The linear response of the specified wheel to the command. +*/ +PX_FORCE_INLINE PxReal PxVehicleLinearResponseCompute +(const PxReal command, const PxU32 wheelId, const PxVehicleCommandResponseParams& responseParams) +{ + return command*responseParams.maxResponse*responseParams.wheelResponseMultipliers[wheelId]; +} + +/** +\brief Compute the non-linear response to a command. +\param[in] command is a normalised command value. +\param[in] longitudinalSpeed is the longitudional speed of the vehicle. +\param[in] wheelId specifies the wheel that is to respond to the command. +\param[in] responseParams specifies the wheel responses for all wheels on a vehicle. +\note responseParams is used to compute an interpolated normalized response to the combination of command and longitudinalSpeed. +The interpolated normalized response is then used in place of the command as input to PxVehicleComputeLinearResponse(). +*/ +PxReal PxVehicleNonLinearResponseCompute +(const PxReal command, const PxReal longitudinalSpeed, const PxU32 wheelId, const PxVehicleCommandResponseParams& responseParams); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/commands/PxVehicleCommandParams.h b/engine/third_party/physx/include/vehicle2/commands/PxVehicleCommandParams.h new file mode 100644 index 00000000..ec3fee01 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/commands/PxVehicleCommandParams.h @@ -0,0 +1,198 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxFoundation.h" +#include "vehicle2/PxVehicleLimits.h" +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + + + +/** +\brief Each command value may be associated with a table specifying a normalized response as a function of longitudinal speed. +Multiple instances of PxVehicleCommandValueResponseTable allow a normalized response to be authored as a multi-variate +piecewise polynomial with normalized command response expressed as a nonlinear function of command value and speed. +*/ +struct PxVehicleCommandValueResponseTable +{ + enum Enum + { + eMAX_NB_SPEED_RESPONSES = 64 + }; + + /** + \brief The command value associated with the table of speed responses. + */ + PxReal commandValue; + + /** + \brief A lookup table specifying the normalised response to the specified command value as a function of longitudinal speed. + \note Each entry in the speedResponses table must be of the form (speed, normalizedResponse). + \note The longitudinal speeds in the table must form a strictly increasing series. + \note The normalized responses must be in range [0, 1]. + */ + PxVehicleFixedSizeLookupTable speedResponses; +}; + +/** +\note Brake, drive and steer response typically reduce at increased longitudinal speed. Moreover, response to a brake, throttle or steer command is typically +nonlinear and may be subject to dead zones where response is constant with either zero or non-zero response. PxVehicleCommandNonLinearResponseParams allows +command responses to be authored as multi-variate piecewise polynomials with normalized command response a function of command value and longitudinal speed. +*/ +class PxVehicleCommandNonLinearResponseParams +{ +public: + + enum Enum + { + eMAX_NB_COMMAND_VALUES = 8 + }; + + PxVehicleCommandNonLinearResponseParams() + : nbSpeedResponses(0), + nbCommandValues(0) + { + } + + void clear() + { + nbCommandValues = 0; + nbSpeedResponses = 0; + } + + /** + \brief Add a table of normalised response vs speed and associated it with a specified command value. + \note commandValueSpeedResponses must be authored as a series of strictly increasing speeds with form {speed, normalizedResponse} + \note The responses added must form a series of strictly increasing command values. + */ + bool addResponse(const PxVehicleCommandValueResponseTable& commandValueSpeedResponses) + { + const PxReal commandValue = commandValueSpeedResponses.commandValue; + const PxReal* speeds = commandValueSpeedResponses.speedResponses.xVals; + const PxReal* responses = commandValueSpeedResponses.speedResponses.yVals; + const PxU16 nb = PxU16(commandValueSpeedResponses.speedResponses.nbDataPairs); + + PX_CHECK_AND_RETURN_VAL(commandValue >= 0.0f && commandValue <= 1.0f, "PxVehicleCommandAndResponseTable::commandValue must be in range [0, 1]", false); + + PX_CHECK_AND_RETURN_VAL(nbCommandValues < eMAX_NB_COMMAND_VALUES, "PxVehicleNonLinearCommandResponse::addResponse - exceeded maximum number of command responses", false); + + PX_CHECK_AND_RETURN_VAL(((nbSpeedResponses + nb) <= PxVehicleCommandValueResponseTable::eMAX_NB_SPEED_RESPONSES), "PxVehicleNonLinearCommandResponse::addResponse - exceeded maximum number of command responses", false); + + PX_CHECK_AND_RETURN_VAL((0 == nbCommandValues) || (commandValue > commandValues[nbCommandValues - 1]), "PxVehicleNonLinearCommandResponse::addResponse - command must be part of a strictly increasing series", false); + + PX_CHECK_AND_RETURN_VAL(nb > 0, "PxVehicleNonLinearCommandResponse::addResponse - each command response must have at least 1 point", false); + +#if PX_CHECKED + for (PxU32 i = 1; i < nb; i++) + { + PX_CHECK_AND_RETURN_VAL(speeds[i] > speeds[i - 1], "PxVehicleNonLinearCommandResponse::addResponse - speeds array must be a strictly increasing series", false); + PX_CHECK_AND_RETURN_VAL(responses[i] >= 0.0f && responses[i] <= 1.0f , "PxVehicleNonLinearCommandResponse::addResponse - response must be in range [0, 1]", false); + } +#endif + + commandValues[nbCommandValues] = commandValue; + nbSpeedResponsesPerCommandValue[nbCommandValues] = nb; + speedResponsesPerCommandValue[nbCommandValues] = nbSpeedResponses; + PxMemCopy(speedResponses + 2 * nbSpeedResponses, speeds, sizeof(PxReal)*nb); + PxMemCopy(speedResponses + 2 * nbSpeedResponses + nb, responses, sizeof(PxReal)*nb); + nbCommandValues++; + nbSpeedResponses += nb; + return true; + } + +public: + + /** + \brief A ragged array of speeds and normalized responses. + */ + PxReal speedResponses[PxVehicleCommandValueResponseTable::eMAX_NB_SPEED_RESPONSES * 2]; + + /** + \brief The number of speeds and normalized responses. + */ + PxU16 nbSpeedResponses; + + /** + \brief The table of speed responses for the ith command value begins at speedResponses[2*speedResponsesPerCommandValue[i]] + */ + PxU16 speedResponsesPerCommandValue[eMAX_NB_COMMAND_VALUES]; + + /** + \brief The ith command value has N speed responses with N = nbSpeedRenponsesPerCommandValue[i]. + */ + PxU16 nbSpeedResponsesPerCommandValue[eMAX_NB_COMMAND_VALUES]; + + /** + \brief The command values. + */ + PxReal commandValues[eMAX_NB_COMMAND_VALUES]; + + /** + \brief The number of command values. + */ + PxU16 nbCommandValues; +}; + +/** +\brief A description of the per wheel response to an input command. +*/ +struct PxVehicleCommandResponseParams +{ + /** + \brief A nonlinear response to command value expressed as a lookup table of normalized response as a function of command value and longitudinal speed. + \note The effect of the default state of nonlinearResponse is a linear response to command value that is independent of longitudinal speed. + */ + PxVehicleCommandNonLinearResponseParams nonlinearResponse; + + /** + \brief A description of the per wheel response multiplier to an input command. + */ + PxReal wheelResponseMultipliers[PxVehicleLimits::eMAX_NB_WHEELS]; + + /** + \brief The maximum response that occurs when the wheel response multiplier has value 1.0 and nonlinearResponse is in the default state of linear response. + */ + PxF32 maxResponse; +}; + + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/commands/PxVehicleCommandStates.h b/engine/third_party/physx/include/vehicle2/commands/PxVehicleCommandStates.h new file mode 100644 index 00000000..9fc690ee --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/commands/PxVehicleCommandStates.h @@ -0,0 +1,136 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxMemory.h" +#include "vehicle2/PxVehicleLimits.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + + +/** +\brief A description of the state of commands that are applied to the vehicle +\note brakes[0] and brakes[1] may be used to distinguish brake and handbrake controls. +*/ +struct PxVehicleCommandState +{ + PxReal brakes[2]; //!< The instantaneous state of the brake controllers in range [0,1] with 1 denoting fully pressed and 0 fully depressed. + PxU32 nbBrakes; //|< The number of brake commands. + PxReal throttle; //!< The instantaneous state of the throttle controller in range [0,1] with 1 denoting fully pressed and 0 fully depressed. + PxReal steer; //!< The instantaneous state of the steer controller in range [-1,1]. + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleCommandState)); + } +}; + +/** +\brief A description of the state of transmission-related commands that are applied to a vehicle with direct drive. +*/ +struct PxVehicleDirectDriveTransmissionCommandState +{ + /** + \brief Direct drive vehicles only have reverse, neutral or forward gear. + */ + enum Enum + { + eREVERSE = 0, + eNEUTRAL, + eFORWARD + }; + + Enum gear; //!< The desired gear of the input gear controller. + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleDirectDriveTransmissionCommandState)); + } +}; + +/** +\brief A description of the state of transmission-related commands that are applied to a vehicle with engine drive. +*/ +struct PxVehicleEngineDriveTransmissionCommandState +{ + enum Enum + { + /** + \brief Special gear value to denote the automatic shift mode (often referred to as DRIVE). + + When using automatic transmission, setting this value as target gear will enable automatic + gear shifts between first and highest gear. If the current gear is a reverse gear or + the neutral gear, then this value will trigger a shift to first gear. If this value is + used even though there is no automatic transmission available, the gear state will remain + unchanged. + */ + eAUTOMATIC_GEAR = 0xff + }; + + PxReal clutch; //!< The instantaneous state of the clutch controller in range [0,1] with 1 denoting fully pressed and 0 fully depressed. + PxU32 targetGear; //!< The desired gear of the input gear controller. + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleEngineDriveTransmissionCommandState)); + } +}; + +/** +\brief A description of the state of transmission-related commands that are applied to a vehicle with tank drive. +*/ +struct PxVehicleTankDriveTransmissionCommandState : public PxVehicleEngineDriveTransmissionCommandState +{ + /** + \brief The wheels of each tank track are either all connected to thrusts[0] or all connected to thrusts[1]. + \note The thrust commands are used to divert torque from the engine to the wheels of the tank tracks controlled by each thrust. + \note thrusts[0] and thrusts[1] are in range [-1,1] with the sign dictating whether the thrust will be applied positively or negatively with respect to the gearing ratio. + */ + PxReal thrusts[2]; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTankDriveTransmissionCommandState)); + } +}; + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainComponents.h b/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainComponents.h new file mode 100644 index 00000000..de4224f8 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainComponents.h @@ -0,0 +1,798 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "vehicle2/PxVehicleFunctions.h" +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "vehicle2/braking/PxVehicleBrakingFunctions.h" +#include "vehicle2/commands/PxVehicleCommandHelpers.h" +#include "vehicle2/rigidBody/PxVehicleRigidBodyStates.h" +#include "vehicle2/steering/PxVehicleSteeringFunctions.h" +#include "vehicle2/steering/PxVehicleSteeringParams.h" +#include "vehicle2/wheel/PxVehicleWheelStates.h" +#include "vehicle2/wheel/PxVehicleWheelParams.h" +#include "vehicle2/tire/PxVehicleTireStates.h" + +#include "PxVehicleDrivetrainStates.h" +#include "PxVehicleDrivetrainFunctions.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleBrakeCommandResponseParams; +struct PxVehicleDirectDriveThrottleCommandResponseParams; + +/** +\brief Forward the applicable set of control values for a direct drive vehicle to a command response state for each +applicable control value. +\note The applicable control values are brake, handbrake, throttle and steer. +\see PxVehicleDirectDriveActuationStateComponent +\see PxVehicleDirectDrivetrainComponent +\see PxVehicleBrakeCommandLinearUpdate +\see PxVehicleDirectDriveThrottleLinearCommandUpdate +\see PxVehicleSteerCommandLinearUpdate +\see PxVehicleAckermannSteerUpdate +*/ +class PxVehicleDirectDriveCommandResponseComponent : public PxVehicleComponent +{ +public: + + PxVehicleDirectDriveCommandResponseComponent() : PxVehicleComponent() {} + virtual ~PxVehicleDirectDriveCommandResponseComponent() {} + + /** + \brief Provide vehicle data items for this component. + + \param[out] axleDescription identifies the wheels on each axle. + \param[out] brakeResponseParams An array of brake response parameters with a brake response for each brake command. + \param[out] throttleResponseParams The throttle response parameters. + \param[out] steerResponseParams The steer response parameters. + \param[out] ackermannParams The parameters defining Ackermann steering. NULL if no Ackermann steering is desired. + \param[out] commands The throttle, brake, steer etc. command states. + \param[out] transmissionCommands The transmission command state describing the current gear. + \param[out] rigidBodyState The state of the vehicle's rigid body. + \param[out] brakeResponseStates The resulting brake response states given the command input and brake response parameters. + \param[out] throttleResponseStates The resulting throttle response states given the command input and throttle response parameters. + \param[out] steerResponseStates The resulting steer response states given the command input, steer response and (optionally) Ackermann parameters. + */ + virtual void getDataForDirectDriveCommandResponseComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleSizedArrayData& brakeResponseParams, + const PxVehicleDirectDriveThrottleCommandResponseParams*& throttleResponseParams, + const PxVehicleSteerCommandResponseParams*& steerResponseParams, + PxVehicleSizedArrayData& ackermannParams, + const PxVehicleCommandState*& commands, const PxVehicleDirectDriveTransmissionCommandState*& transmissionCommands, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& brakeResponseStates, + PxVehicleArrayData& throttleResponseStates, + PxVehicleArrayData& steerResponseStates) = 0; + + /** + \brief Compute a per wheel response to the input brake/handbrake/throttle/steer commands + and determine if there is an intention to accelerate the vehicle. + */ + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleDirectDriveCommandResponseComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleSizedArrayData brakeResponseParams; + const PxVehicleDirectDriveThrottleCommandResponseParams* throttleResponseParams; + const PxVehicleSteerCommandResponseParams* steerResponseParams; + PxVehicleSizedArrayData ackermannParams; + const PxVehicleCommandState* commands; + const PxVehicleDirectDriveTransmissionCommandState* transmissionCommands; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData brakeResponseStates; + PxVehicleArrayData throttleResponseStates; + PxVehicleArrayData steerResponseStates; + + getDataForDirectDriveCommandResponseComponent(axleDescription, + brakeResponseParams, throttleResponseParams, steerResponseParams, ackermannParams, + commands, transmissionCommands, + rigidBodyState, + brakeResponseStates, throttleResponseStates, steerResponseStates); + + const PxReal longitudinalSpeed = rigidBodyState->getLongitudinalSpeed(context.frame); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + PxVehicleBrakeCommandResponseUpdate( + commands->brakes, commands->nbBrakes, longitudinalSpeed, + wheelId, brakeResponseParams, + brakeResponseStates[wheelId]); + + PxVehicleDirectDriveThrottleCommandResponseUpdate( + commands->throttle, *transmissionCommands, longitudinalSpeed, + wheelId, *throttleResponseParams, + throttleResponseStates[wheelId]); + + PxVehicleSteerCommandResponseUpdate( + commands->steer, longitudinalSpeed, + wheelId, *steerResponseParams, + steerResponseStates[wheelId]); + } + if (ackermannParams.size > 0) + PxVehicleAckermannSteerUpdate( + commands->steer, + *steerResponseParams, ackermannParams, + steerResponseStates); + + return true; + } +}; + + +/** +\brief Determine the actuation state for each wheel of a direct drive vehicle. +\note The actuation state for each wheel contains a binary record of whether brake and drive torque are to be applied to the wheel. +\see PxVehicleDirectDriveCommandResponseComponent +\see PxVehicleDirectDrivetrainComponent +\see PxVehicleDirectDriveActuationStateUpdate +*/ +class PxVehicleDirectDriveActuationStateComponent : public PxVehicleComponent +{ +public: + + PxVehicleDirectDriveActuationStateComponent() : PxVehicleComponent() {} + virtual ~PxVehicleDirectDriveActuationStateComponent() {} + + + /** + \brief Provide vehicle data items for this component. + + \param[out] axleDescription identifies the wheels on each axle. + \param[out] brakeResponseStates The brake response states. + \param[out] throttleResponseStates The throttle response states. + \param[out] actuationStates The actuation states. + */ + virtual void getDataForDirectDriveActuationStateComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleArrayData& brakeResponseStates, + PxVehicleArrayData& throttleResponseStates, + PxVehicleArrayData& actuationStates) = 0; + + /** + \brief Compute the actuation state for each wheel given the brake, handbrake and throttle states. + \*/ + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleDirectDriveActuationStateComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleArrayData brakeResponseStates; + PxVehicleArrayData throttleResponseStates; + PxVehicleArrayData actuationStates; + + getDataForDirectDriveActuationStateComponent( + axleDescription, + brakeResponseStates, throttleResponseStates, + actuationStates); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + PxVehicleDirectDriveActuationStateUpdate( + brakeResponseStates[wheelId], throttleResponseStates[wheelId], + actuationStates[wheelId]); + } + + return true; + } +}; + +/** +\brief Forward integrate the angular speed of each wheel on a vehicle by integrating the +brake and drive torque applied to each wheel and the torque that develops on the tire as a response +to the longitudinal tire force. +\see PxVehicleDirectDriveUpdate +*/ +class PxVehicleDirectDrivetrainComponent : public PxVehicleComponent +{ +public: + + PxVehicleDirectDrivetrainComponent() : PxVehicleComponent() {} + virtual ~PxVehicleDirectDrivetrainComponent() {} + + virtual void getDataForDirectDrivetrainComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleArrayData& brakeResponseStates, + PxVehicleArrayData& throttleResponseStates, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& actuationStates, + PxVehicleArrayData& tireForces, + PxVehicleArrayData& wheelRigidBody1dStates) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleDirectDrivetrainComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleArrayData brakeResponseStates; + PxVehicleArrayData throttleResponseStates; + PxVehicleArrayData wheelParams; + PxVehicleArrayData actuationStates; + PxVehicleArrayData tireForces; + PxVehicleArrayData wheelRigidBody1dStates; + + getDataForDirectDrivetrainComponent(axleDescription, + brakeResponseStates, throttleResponseStates, + wheelParams, actuationStates, tireForces, + wheelRigidBody1dStates); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + PxVehicleDirectDriveUpdate( + wheelParams[wheelId], actuationStates[wheelId], + brakeResponseStates[wheelId], throttleResponseStates[wheelId], + tireForces[wheelId], + dt, + wheelRigidBody1dStates[wheelId]); + } + + return true; + } +}; + +/** +\brief Forward the applicable set of control values for a vehicle driven by an engine to a command response state for each +applicable control value. + +If parameters for an autobox are provided, the autobox will determine if a gear change should begin in order to +maintain a desired engine revs. + +\see PxVehicleBrakeCommandLinearUpdate +\see PxVehicleClutchCommandResponseLinearUpdate +\see PxVehicleEngineDriveThrottleCommandResponseUpdate +\see PxVehicleSteerCommandLinearUpdate +\see PxVehicleAckermannSteerUpdate +\see PxVehicleAutoBoxUpdate +\see PxVehicleGearCommandResponseUpdate +*/ +class PxVehicleEngineDriveCommandResponseComponent : public PxVehicleComponent +{ +public: + + PxVehicleEngineDriveCommandResponseComponent() : PxVehicleComponent() {} + virtual ~PxVehicleEngineDriveCommandResponseComponent() {} + + /** + \brief Provide vehicle data items for this component. + \param[out] axleDescription identifies the wheels on each axle. + \param[out] brakeResponseParams An array of brake response parameters with a brake response for each brake command. + \param[out] steerResponseParams The steer response parameters. + \param[out] ackermannParams The parameters defining Ackermann steering. NULL if no Ackermann steering is desired. + \param[out] gearboxParams The gearbox parameters. + \param[out] clutchResponseParams The clutch response parameters. + \param[out] engineParams The engine parameters. Only needed if an autobox is provided (see autoboxParams), else it can be set to NULL. + \param[out] engineState The engine state. Only needed if an autobox is provided (see autoboxParams), else it can be set to NULL. + \param[out] autoboxParams The autobox parameters. If not NULL, the autobox will determine the target gear. Requires the parameters + engineParams, engineState and autoboxState to be available. If no autobox is desired, NULL can be used in which case + the aforementioned additional parameters can be set to NULL too. + \param[out] rigidBodyState The state of the vehicle's rigid body. + \param[out] commands The throttle, brake, steer etc. command states. + \param[out] transmissionCommands The clutch, target gear etc. command states. If an autobox is provided (see autoboxParams) + and the target gear is set to PxVehicleEngineDriveTransmissionCommandState::eAUTOMATIC_GEAR, then the autobox will trigger + gear shifts. + \param[out] brakeResponseStates The resulting brake response states given the command input and brake response parameters. + \param[out] throttleResponseState The resulting throttle response to the input throttle command. + \param[out] steerResponseStates The resulting steer response states given the command input, steer response and (optionally) Ackermann parameters. + \param[out] gearboxResponseState The resulting gearbox response state given the command input and gearbox parameters. + \param[out] clutchResponseState The resulting clutch state given the command input and clutch response parameters. + \param[out] autoboxState The resulting autobox state given the autobox/engine/gear params and engine state. Only needed if an autobox is + provided (see autoboxParams), else it can be set to NULL. + */ + virtual void getDataForEngineDriveCommandResponseComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleSizedArrayData& brakeResponseParams, + const PxVehicleSteerCommandResponseParams*& steerResponseParams, + PxVehicleSizedArrayData& ackermannParams, + const PxVehicleGearboxParams*& gearboxParams, + const PxVehicleClutchCommandResponseParams*& clutchResponseParams, + const PxVehicleEngineParams*& engineParams, + const PxVehicleRigidBodyState*& rigidBodyState, + const PxVehicleEngineState*& engineState, + const PxVehicleAutoboxParams*& autoboxParams, + const PxVehicleCommandState*& commands, + const PxVehicleEngineDriveTransmissionCommandState*& transmissionCommands, + PxVehicleArrayData& brakeResponseStates, + PxVehicleEngineDriveThrottleCommandResponseState*& throttleResponseState, + PxVehicleArrayData& steerResponseStates, + PxVehicleGearboxState*& gearboxResponseState, + PxVehicleClutchCommandResponseState*& clutchResponseState, + PxVehicleAutoboxState*& autoboxState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleEngineDriveCommandResponseComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleSizedArrayData brakeResponseParams; + const PxVehicleSteerCommandResponseParams* steerResponseParams; + PxVehicleSizedArrayData ackermannParams; + const PxVehicleGearboxParams* gearboxParams; + const PxVehicleClutchCommandResponseParams* clutchResponseParams; + const PxVehicleEngineParams* engineParams; + const PxVehicleRigidBodyState* rigidBodyState; + const PxVehicleEngineState* engineState; + const PxVehicleAutoboxParams* autoboxParams; + const PxVehicleCommandState* commands; + const PxVehicleEngineDriveTransmissionCommandState* transmissionCommands; + PxVehicleArrayData brakeResponseStates; + PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState; + PxVehicleArrayData steerResponseStates; + PxVehicleGearboxState* gearboxResponseState; + PxVehicleClutchCommandResponseState* clutchResponseState; + PxVehicleAutoboxState* autoboxState; + + getDataForEngineDriveCommandResponseComponent(axleDescription, + brakeResponseParams, steerResponseParams, ackermannParams, + gearboxParams, clutchResponseParams, engineParams, rigidBodyState, + engineState, autoboxParams, + commands, transmissionCommands, + brakeResponseStates, throttleResponseState, + steerResponseStates, + gearboxResponseState, clutchResponseState, autoboxState); + + //The autobox can modify commands like throttle and target gear. Since the user defined + //values should not be overwritten, a copy is used to compute the response. + PxVehicleCommandState commandsTmp = *commands; + PxVehicleEngineDriveTransmissionCommandState transmissionCommandsTmp = *transmissionCommands; + + const PxReal longitudinalSpeed = rigidBodyState->getLongitudinalSpeed(context.frame); + + //Let the autobox set the target gear, unless the user defined target gear requests + //a shift already + if (autoboxParams) + { + PX_ASSERT(engineParams); + PX_ASSERT(engineState); + PX_ASSERT(autoboxState); + + PxVehicleAutoBoxUpdate( + *engineParams, *gearboxParams, *autoboxParams, + *engineState, *gearboxResponseState, dt, + transmissionCommandsTmp.targetGear, *autoboxState, commandsTmp.throttle); + } + else if (transmissionCommandsTmp.targetGear == PxVehicleEngineDriveTransmissionCommandState::eAUTOMATIC_GEAR) + { + //If there is no autobox but eAUTOMATIC_GEAR was specified, use the current target gear + transmissionCommandsTmp.targetGear = gearboxResponseState->targetGear; + } + + //Distribute brake torque to the wheels across each axle. + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + PxVehicleBrakeCommandResponseUpdate( + commandsTmp.brakes, commandsTmp.nbBrakes, longitudinalSpeed, + wheelId, brakeResponseParams, + brakeResponseStates[i]); + } + + //Update target gear as required. + PxVehicleGearCommandResponseUpdate( + transmissionCommandsTmp.targetGear, + *gearboxParams, + *gearboxResponseState); + + //Compute the response to the clutch command. + PxVehicleClutchCommandResponseLinearUpdate( + transmissionCommandsTmp.clutch, + *clutchResponseParams, + *clutchResponseState); + + //Compute the response to the throttle command. + PxVehicleEngineDriveThrottleCommandResponseLinearUpdate( + commandsTmp, + *throttleResponseState); + + //Update the steer angles and Ackermann correction. + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + PxVehicleSteerCommandResponseUpdate(commandsTmp.steer, longitudinalSpeed, wheelId, *steerResponseParams, steerResponseStates[i]); + } + if (ackermannParams.size > 0) + PxVehicleAckermannSteerUpdate(commandsTmp.steer, *steerResponseParams, ackermannParams, steerResponseStates); + + return true; + } +}; + +/** +\brief Compute the per wheel drive torque split of a multi-wheel drive differential. +\see PxVehicleDifferentialStateUpdate +*/ +class PxVehicleMultiWheelDriveDifferentialStateComponent : public PxVehicleComponent +{ +public: + + PxVehicleMultiWheelDriveDifferentialStateComponent() : PxVehicleComponent() {} + virtual ~PxVehicleMultiWheelDriveDifferentialStateComponent() {} + + virtual void getDataForMultiWheelDriveDifferentialStateComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleMultiWheelDriveDifferentialParams*& differentialParams, + PxVehicleDifferentialState*& differentialState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleMultiWheelDriveDifferentialStateComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleMultiWheelDriveDifferentialParams* differentialParams; + PxVehicleDifferentialState* differentialState; + + getDataForMultiWheelDriveDifferentialStateComponent(axleDescription, + differentialParams, differentialState); + + PxVehicleDifferentialStateUpdate( + *axleDescription, + *differentialParams, + *differentialState); + + return true; + } +}; + +/** +\brief Compute the per wheel drive torque split of a differential delivering torque to multiple wheels +with limited slip applied to specified wheel pairs. +\see PxVehicleDifferentialStateUpdate +*/ +class PxVehicleFourWheelDriveDifferentialStateComponent : public PxVehicleComponent +{ +public: + + PxVehicleFourWheelDriveDifferentialStateComponent() : PxVehicleComponent() {} + virtual ~PxVehicleFourWheelDriveDifferentialStateComponent() {} + + virtual void getDataForFourWheelDriveDifferentialStateComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleFourWheelDriveDifferentialParams*& differentialParams, + PxVehicleArrayData& wheelRigidbody1dStates, + PxVehicleDifferentialState*& differentialState, + PxVehicleWheelConstraintGroupState*& wheelConstraintGroupState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleFourWheelDriveDifferentialStateComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleFourWheelDriveDifferentialParams* differentialParams; + PxVehicleArrayData wheelRigidbody1dStates; + PxVehicleDifferentialState* differentialState; + PxVehicleWheelConstraintGroupState* wheelConstraintGroupState; + + getDataForFourWheelDriveDifferentialStateComponent(axleDescription, differentialParams, + wheelRigidbody1dStates, + differentialState, wheelConstraintGroupState); + + PxVehicleDifferentialStateUpdate( + *axleDescription, *differentialParams, + wheelRigidbody1dStates, dt, + *differentialState, *wheelConstraintGroupState); + + return true; + } +}; + +/** +\brief Compute the per wheel drive torque split of a tank drive differential. +\see PxVehicleDifferentialStateUpdate +*/ +class PxVehicleTankDriveDifferentialStateComponent : public PxVehicleComponent +{ +public: + + PxVehicleTankDriveDifferentialStateComponent() : PxVehicleComponent() {} + virtual ~PxVehicleTankDriveDifferentialStateComponent() {} + + /** + \brief Provide vehicle data items for this component. + + \param[out] axleDescription identifies the wheels on each axle. + \param[out] transmissionCommands specifies the values of the thrust controllers that divert torque to the tank tracks. + \param[out] wheelParams is an array describing the radius of each wheel. + \param[out] differentialParams describes the operation of the tank differential by + specifying the default torque split between all wheels connected to the differential and by + specifying the wheels coupled to each tank track. + \param[out] differentialState stores the instantaneous torque split between all wheels arising from the difference between the thrust controllers. + \param[out] constraintGroupState stores the groups of wheels that are connected by sharing a tank track. + */ + virtual void getDataForTankDriveDifferentialStateComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleTankDriveTransmissionCommandState*& transmissionCommands, + PxVehicleArrayData& wheelParams, + const PxVehicleTankDriveDifferentialParams*& differentialParams, + PxVehicleDifferentialState*& differentialState, + PxVehicleWheelConstraintGroupState*& constraintGroupState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleTankDriveDifferentialStateComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleTankDriveTransmissionCommandState* transmissionCommands; + PxVehicleArrayData wheelParams; + const PxVehicleTankDriveDifferentialParams* differentialParams; + PxVehicleDifferentialState* differentialState; + PxVehicleWheelConstraintGroupState* constraintGroupState; + + getDataForTankDriveDifferentialStateComponent( + axleDescription, + transmissionCommands, + wheelParams, + differentialParams, + differentialState, constraintGroupState); + + PxVehicleDifferentialStateUpdate( + *axleDescription, + wheelParams, *differentialParams, + transmissionCommands->thrusts[0], transmissionCommands->thrusts[1], + *differentialState, *constraintGroupState); + + return true; + } +}; + +/** +\deprecated This API was introduced with the new Vehicle API for transition purposes but will be removed in a future version. + +\brief Compute the per wheel drive torque split of a four wheel drive differential. +\see PxVehicleDifferentialStateUpdate +*/ +class PX_DEPRECATED PxVehicleLegacyFourWheelDriveDifferentialStateComponent : public PxVehicleComponent +{ +public: + + PxVehicleLegacyFourWheelDriveDifferentialStateComponent() : PxVehicleComponent() {} + virtual ~PxVehicleLegacyFourWheelDriveDifferentialStateComponent() {} + + virtual void getDataForLegacyFourWheelDriveDifferentialStateComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleFourWheelDriveDifferentialLegacyParams*& differentialParams, + PxVehicleArrayData& wheelRigidbody1dStates, + PxVehicleDifferentialState*& differentialState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleLegacyFourWheelDriveDifferentialStateComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleFourWheelDriveDifferentialLegacyParams* differentialParams; + PxVehicleArrayData wheelRigidbody1dStates; + PxVehicleDifferentialState* differentialState; + + getDataForLegacyFourWheelDriveDifferentialStateComponent(axleDescription, differentialParams, + wheelRigidbody1dStates, + differentialState); + + PxVehicleDifferentialStateUpdate( + *differentialParams, wheelRigidbody1dStates, + *differentialState); + + return true; + } +}; + +/** +\brief Determine the actuation state for each wheel for a vehicle propelled by engine torque. +\note The actuation state for each wheel contains a binary record of whether brake and drive torque are to be applied to the wheel. +\see PxVehicleEngineDriveActuationStateUpdate +*/ +class PxVehicleEngineDriveActuationStateComponent : public PxVehicleComponent +{ +public: + + PxVehicleEngineDriveActuationStateComponent() : PxVehicleComponent() {} + virtual ~PxVehicleEngineDriveActuationStateComponent() {} + + virtual void getDataForEngineDriveActuationStateComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleGearboxParams*& gearboxParams, + PxVehicleArrayData& brakeResponseStates, + const PxVehicleEngineDriveThrottleCommandResponseState*& throttleResponseState, + const PxVehicleGearboxState*& gearboxState, + const PxVehicleDifferentialState*& differentialState, + const PxVehicleClutchCommandResponseState*& clutchResponseState, + PxVehicleArrayData& actuationStates) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleEngineDriveActuationStateComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleGearboxParams* gearboxParams; + PxVehicleArrayData brakeResponseStates; + const PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState; + const PxVehicleGearboxState* gearboxState; + const PxVehicleDifferentialState* differentialState; + const PxVehicleClutchCommandResponseState* clutchResponseState; + PxVehicleArrayData actuationStates; + + getDataForEngineDriveActuationStateComponent(axleDescription, gearboxParams, + brakeResponseStates, throttleResponseState, + gearboxState, differentialState, clutchResponseState, + actuationStates); + + PxVehicleEngineDriveActuationStateUpdate( + *axleDescription, + *gearboxParams, + brakeResponseStates, + *throttleResponseState, + *gearboxState, *differentialState, *clutchResponseState, + actuationStates); + + return true; + } +}; + +/** +\brief Forward integrate the angular speed of each wheel and of the engine, accounting for the +state of the clutch, gearbox and differential. +\see PxVehicleGearboxUpdate +\see PxVehicleEngineDrivetrainUpdate +*/ +class PxVehicleEngineDrivetrainComponent : public PxVehicleComponent +{ +public: + + PxVehicleEngineDrivetrainComponent() : PxVehicleComponent() {} + virtual ~PxVehicleEngineDrivetrainComponent() {} + + /** + \brief Provide vehicle data items for this component. + + \param[out] axleDescription identifies the wheels on each axle. + \param[out] wheelParams specifies the radius of each wheel. + \param[out] engineParams specifies the engine's torque curve, idle revs and max revs. + \param[out] clutchParams specifies the maximum strength of the clutch. + \param[out] gearboxParams specifies the gear ratio of each gear. + \param[out] brakeResponseStates stores the instantaneous brake brake torque to apply to each wheel. + \param[out] actuationStates stores whether a brake and/or drive torque are to be applied to each wheel. + \param[out] tireForces stores the lateral and longitudinal tire force that has developed on each tire. + \param[out] throttleResponseState stores the response of the throttle to the input throttle command. + \param[out] clutchResponseState stores the instantaneous clutch strength that arises from the input clutch command. + \param[out] differentialState stores the instantaneous torque split between the wheels. + \param[out] constraintGroupState stores the groups of wheels that are subject to constraints that require them to have the same angular or linear velocity. + \param[out] wheelRigidBody1dStates stores the per wheel angular speed to be computed by the component. + \param[out] engineState stores the engine rotation speed to be computed by the component. + \param[out] gearboxState stores the state of the gearbox to be computed by the component. + \param[out] clutchState stores the clutch slip to be computed by the component. + \note If constraintGroupState is set to NULL it is assumed that there are no requirements for any wheels to have the same angular or linear velocity. + */ + virtual void getDataForEngineDrivetrainComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleArrayData& wheelParams, + const PxVehicleEngineParams*& engineParams, + const PxVehicleClutchParams*& clutchParams, + const PxVehicleGearboxParams*& gearboxParams, + PxVehicleArrayData& brakeResponseStates, + PxVehicleArrayData& actuationStates, + PxVehicleArrayData& tireForces, + const PxVehicleEngineDriveThrottleCommandResponseState*& throttleResponseState, + const PxVehicleClutchCommandResponseState*& clutchResponseState, + const PxVehicleDifferentialState*& differentialState, + const PxVehicleWheelConstraintGroupState*& constraintGroupState, + PxVehicleArrayData& wheelRigidBody1dStates, + PxVehicleEngineState*& engineState, + PxVehicleGearboxState*& gearboxState, + PxVehicleClutchSlipState*& clutchState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleEngineDrivetrainComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleArrayData wheelParams; + const PxVehicleEngineParams* engineParams; + const PxVehicleClutchParams* clutchParams; + const PxVehicleGearboxParams* gearboxParams; + PxVehicleArrayData brakeResponseStates; + PxVehicleArrayData actuationStates; + PxVehicleArrayData tireForces; + const PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState; + const PxVehicleClutchCommandResponseState* clutchResponseState; + const PxVehicleDifferentialState* differentialState; + const PxVehicleWheelConstraintGroupState* constraintGroupState; + PxVehicleArrayData wheelRigidBody1dStates; + PxVehicleEngineState* engineState; + PxVehicleGearboxState* gearboxState; + PxVehicleClutchSlipState* clutchState; + + getDataForEngineDrivetrainComponent(axleDescription, wheelParams, + engineParams, clutchParams, gearboxParams, + brakeResponseStates, actuationStates, tireForces, + throttleResponseState, clutchResponseState, differentialState, constraintGroupState, + wheelRigidBody1dStates, engineState, gearboxState, clutchState); + + PxVehicleGearboxUpdate(*gearboxParams, dt, *gearboxState); + + PxVehicleEngineDrivetrainUpdate( + *axleDescription, + wheelParams, + *engineParams, *clutchParams, *gearboxParams, + brakeResponseStates, actuationStates, + tireForces, + *gearboxState, *throttleResponseState, *clutchResponseState, *differentialState, constraintGroupState, + dt, + wheelRigidBody1dStates, *engineState, *clutchState); + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainFunctions.h b/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainFunctions.h new file mode 100644 index 00000000..690f9dac --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainFunctions.h @@ -0,0 +1,314 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxSimpleTypes.h" +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleCommandState; +struct PxVehicleDirectDriveTransmissionCommandState; +struct PxVehicleEngineDriveTransmissionCommandState; +struct PxVehicleDirectDriveThrottleCommandResponseParams; +struct PxVehicleWheelActuationState; +struct PxVehicleWheelParams; +struct PxVehicleTireForce; +struct PxVehicleWheelRigidBody1dState; +struct PxVehicleEngineParams; +struct PxVehicleGearboxParams; +struct PxVehicleAutoboxParams; +struct PxVehicleEngineState; +struct PxVehicleGearboxState; +struct PxVehicleAutoboxState; +struct PxVehicleClutchCommandResponseParams; +struct PxVehicleClutchCommandResponseState; +struct PxVehicleEngineDriveThrottleCommandResponseState; +struct PxVehicleDifferentialState; +struct PxVehicleMultiWheelDriveDifferentialParams; +struct PxVehicleFourWheelDriveDifferentialParams; +struct PxVehicleTankDriveDifferentialParams; +struct PxVehicleFourWheelDriveDifferentialLegacyParams; +struct PxVehicleClutchParams; +struct PxVehicleWheelConstraintGroupState; +struct PxVehicleClutchSlipState; + +/** +\brief Compute the drive torque response to a throttle command. +\param[in] throttle is the throttle command. +\param[in] transmissionCommands is the gearing command to apply to the direct drive tranmission. +\param[in] longitudinalSpeed is the longitudinal speed of the vehicle's rigid body. +\param[in] wheelId specifies the wheel that is to have its throttle response computed. +\param[in] throttleResponseParams specifies the per wheel drive torque response to the throttle command as a nonlinear function of throttle command and longitudinal speed. +\param[out] throttleResponseState is the drive torque response to the input throttle command. +*/ +void PxVehicleDirectDriveThrottleCommandResponseUpdate +(const PxReal throttle, const PxVehicleDirectDriveTransmissionCommandState& transmissionCommands, const PxReal longitudinalSpeed, + const PxU32 wheelId, const PxVehicleDirectDriveThrottleCommandResponseParams& throttleResponseParams, + PxReal& throttleResponseState); + +/** +\brief Determine the actuation state of a wheel given the brake torque, handbrake torque and drive torque applied to it. +\param[in] brakeTorque is the brake torque to be applied to the wheel. +\param[in] driveTorque is the drive torque to be applied to the wheel. +\param[out] actuationState contains a binary record of whether brake or drive torque is applied to the wheel. +*/ +void PxVehicleDirectDriveActuationStateUpdate +(const PxReal brakeTorque, const PxReal driveTorque, + PxVehicleWheelActuationState& actuationState); + +/** +\brief Forward integrate the angular speed of a wheel given the brake and drive torque applied to it +\param[in] wheelParams specifies the moment of inertia of the wheel. +\param[in] actuationState is a binary record of whether brake and drive torque are to be applied to the wheel. +\param[in] brakeTorque is the brake torque to be applied to the wheel. +\param[in] driveTorque is the drive torque to be applied to the wheel. +\param[in] tireForce specifies the torque to apply to the wheel as a response to the longitudinal tire force. +\param[in] dt is the timestep of the forward integration. +\param[out] wheelRigidBody1dState describes the angular speed of the wheel. +*/ +void PxVehicleDirectDriveUpdate +(const PxVehicleWheelParams& wheelParams, + const PxVehicleWheelActuationState& actuationState, + const PxReal brakeTorque, const PxReal driveTorque, const PxVehicleTireForce& tireForce, + const PxF32 dt, + PxVehicleWheelRigidBody1dState& wheelRigidBody1dState); + +/** +\param[in] engineParams specifies the engine configuration. +\param[in] gearboxParams specifies the gear ratios and the time required to complete a gear change. +\param[in] autoboxParams specifies the conditions for switching gear. +\param[in] engineState contains the current angular speed of the engine. +\param[in] gearboxState describes the current and target gear. +\param[in] dt is the time that has lapsed since the last call to PxVehicleAutoBoxUpdate. +\param[in,out] targetGearCommand specifies the desired target gear for the gearbox. If set to + PxVehicleEngineDriveTransmissionCommandState::eAUTOMATIC_GEAR, the value will get overwritten + with a target gear chosen by the autobox. +\param[out] autoboxState specifies the time that has lapsed since the last automated gear change and contains a record of +any ongoing automated gear change. +\param[out] throttle A throttle command value in [0, 1] that will be set to 0 if a gear change is initiated or is ongoing. + +\note The autobox will not begin a gear change if a gear change is already ongoing. +\note The autobox will not begin a gear change until a threshold time has lapsed since the last automated gear change. +\note A gear change is considered as ongoing for as long as PxVehicleGearboxState::currentGear is different from + PxVehicleGearboxState::targetGear. +\note The autobox will not shift down from 1st gear or up from reverse gear. +\note The autobox shifts in single gear increments or decrements. +\note The autobox instantiates a gear change by setting PxVehicleCommandState::targetGear to be different from +from PxVehicleGearboxState::currentGear +*/ +void PxVehicleAutoBoxUpdate +(const PxVehicleEngineParams& engineParams, const PxVehicleGearboxParams& gearboxParams, const PxVehicleAutoboxParams& autoboxParams, + const PxVehicleEngineState& engineState, const PxVehicleGearboxState& gearboxState, + const PxReal dt, + PxU32& targetGearCommand, PxVehicleAutoboxState& autoboxState, + PxReal& throttle); + +/** +\brief Propagate input gear commands to the gearbox state. +\param[in] targetGearCommand specifies the target gear for the gearbox. +\param[in] gearboxParams specifies the number of gears and the index of neutral gear. +\param[out] gearboxState contains a record of the current and target gear. +\note Any ongoing gear change must complete before starting another. +\note A gear change is considered as ongoing for as long as PxVehicleGearboxState::currentGear is different from + PxVehicleGearboxState::targetGear. + \note The gearbox remains in neutral for the duration of the gear change. + \note A gear change begins if PxVehicleCommandState::targetGear is different from PxVehicleGearboxState::currentGear. +*/ +void PxVehicleGearCommandResponseUpdate +(const PxU32 targetGearCommand, + const PxVehicleGearboxParams& gearboxParams, + PxVehicleGearboxState& gearboxState); + +/** +\brief Propagate the input clutch command to the clutch response state. +\param[in] clutchCommand specifies the state of the clutch pedal. +\param[in] clutchResponseParams specifies how the clutch responds to the input clutch command. +\param[out] clutchResponse specifies the response of the clutch to the input clutch command. +*/ +void PxVehicleClutchCommandResponseLinearUpdate +(const PxReal clutchCommand, + const PxVehicleClutchCommandResponseParams& clutchResponseParams, + PxVehicleClutchCommandResponseState& clutchResponse); + +/** +\brief Propagate the input throttle command to the throttle response state. +\param[in] commands specifies the state of the throttle pedal. +\param[out] throttleResponse specifies how the clutch responds to the input throttle command. +*/ +void PxVehicleEngineDriveThrottleCommandResponseLinearUpdate +(const PxVehicleCommandState& commands, + PxVehicleEngineDriveThrottleCommandResponseState& throttleResponse); + +/** +\brief Determine the actuation state of all wheels on a vehicle. +\param[in] axleDescription is a decription of the axles of the vehicle and the wheels on each axle. +\param[in] gearboxParams specifies the index of the neutral gear of the gearbox. +\param[in] brakeResponseStates specifies the response of each wheel to the input brake command. +\param[in] throttleResponseState specifies the response of the engine to the input throttle command. +\param[in] gearboxState specifies the current gear. +\param[in] diffState specifies the fraction of available drive torque to be delivered to each wheel. +\param[in] clutchResponseState specifies the response of the clutch to the input throttle command. +\param[out] actuationStates is an array of binary records determining whether brake and drive torque are to be applied to each wheel. +\note Drive torque is not applied to a wheel if + a) the gearbox is in neutral + b) the differential delivers no torque to the wheel + c) no throttle is applied to the engine + c) the clutch is fully disengaged. +*/ +void PxVehicleEngineDriveActuationStateUpdate +(const PxVehicleAxleDescription& axleDescription, + const PxVehicleGearboxParams& gearboxParams, + const PxVehicleArrayData& brakeResponseStates, + const PxVehicleEngineDriveThrottleCommandResponseState& throttleResponseState, + const PxVehicleGearboxState& gearboxState, const PxVehicleDifferentialState& diffState, const PxVehicleClutchCommandResponseState& clutchResponseState, + PxVehicleArrayData& actuationStates); + +/** +\deprecated This API was introduced with the new Vehicle API for transition purposes but will be removed in a future version. + +\brief Compute the fraction of available torque to be delivered to each wheel and gather a list of all +wheels connected to the differential. +\param[in] diffParams specifies the operation of a differential that can be connected to up to four wheels. +\param[in] wheelStates describes the angular speed of each wheel +\param[out] diffState contains the fraction of available drive torque to be delivered to each wheel. +\note If the handbrake is on then torque is only delivered to the wheels specified as the front wheels of the differential. +*/ +void PX_DEPRECATED PxVehicleDifferentialStateUpdate +(const PxVehicleFourWheelDriveDifferentialLegacyParams& diffParams, + const PxVehicleArrayData& wheelStates, + PxVehicleDifferentialState& diffState); + +/** +\brief Compute the fraction of available torque to be delivered to each wheel and gather a list of all +wheels connected to the differential. Additionally, add wheel constraints for wheel pairs whose +rotational speed ratio exceeds the corresponding differential bias. +\param[in] axleDescription is a decription of the axles of the vehicle and the wheels on each axle. +\param[in] diffParams describe the division of available drive torque and the biases of the limited +slip differential. +\param[in] wheelStates describes the rotational speeds of each wheel. +\param[in] dt is the simulation time that has passes since the last call to PxVehicleDifferentialStateUpdate() +\param[out] diffState contains the fraction of available drive torque to be delivered to each wheel. +\param[out] wheelConstraintGroupState describes the groups of wheels that have exceeded their corresponding +differential biases. +*/ +void PxVehicleDifferentialStateUpdate +(const PxVehicleAxleDescription& axleDescription, const PxVehicleFourWheelDriveDifferentialParams& diffParams, + const PxVehicleArrayData& wheelStates, + const PxReal dt, + PxVehicleDifferentialState& diffState, PxVehicleWheelConstraintGroupState& wheelConstraintGroupState); + +/** +\brief Compute the fraction of available torque to be delivered to each wheel and gather a list of all +wheels connected to the differential. +\param[in] axleDescription is a decription of the axles of the vehicle and the wheels on each axle. +\param[in] diffParams specifies the operation of a differential that can be connected to any combination of wheels. +\param[out] diffState contains the fraction of available drive torque to be delivered to each wheel connected to the differential. +*/ +void PxVehicleDifferentialStateUpdate +(const PxVehicleAxleDescription& axleDescription, const PxVehicleMultiWheelDriveDifferentialParams& diffParams, + PxVehicleDifferentialState& diffState); + +/** +\brief Compute the fraction of available torque to be delivered to each wheel and gather a list of all +wheels connected to the differential. +\param[in] axleDescription is a decription of the axles of the vehicle and the wheels on each axle. +\param[in] wheelParams is an array that describes the wheel radius of each wheel. +\param[in] diffParams specifies the operation of a tank differential. +\param[in] thrustCommand0 is the state of one of the two thrust controllers. +\param[in] thrustCommand1 is the state of one of the two thrust controllers. +\param[out] diffState contains the fraction of available drive torque to be delivered to each wheel connected to the differential. +\param[out] wheelConstraintGroupState describes the groups of wheels connected by sharing a tank track. +*/ +void PxVehicleDifferentialStateUpdate +(const PxVehicleAxleDescription& axleDescription, + const PxVehicleArrayData& wheelParams, const PxVehicleTankDriveDifferentialParams& diffParams, + const PxReal thrustCommand0, PxReal thrustCommand1, + PxVehicleDifferentialState& diffState, PxVehicleWheelConstraintGroupState& wheelConstraintGroupState); + + +/** +\brief Update the current gear of the gearbox. If a gear change is ongoing then complete the gear change if a threshold +time has passed since the beginning of the gear change. +\param[in] gearboxParams describes the time required to complete a gear change. +\param[in] dt is the time that has lapsed since the last call to PxVehicleGearboxUpdate. +\param[out] gearboxState is the gearbox state to be updated. +\note A gear change is considered as ongoing for as long as PxVehicleGearboxState::currentGear is different from + PxVehicleGearboxState::targetGear. +*/ +void PxVehicleGearboxUpdate +(const PxVehicleGearboxParams& gearboxParams, + const PxF32 dt, + PxVehicleGearboxState& gearboxState); + +/** +\brief Forward integrate the angular speed of the vehicle's wheels and engine, given the state of clutch, differential and gearbox. +\param[in] axleDescription is a decription of the axles of the vehicle and the wheels on each axle. +\param[in] wheelParams specifies the moment of inertia of each wheel. +\param[in] engineParams specifies the torque curve of the engine and its moment of inertia. +\param[in] clutchParams specifies the maximum clutch strength that happens when the clutch is fully engaged. +\param[in] gearboxParams specifies the gearing ratios of the gearbox. +\param[in] brakeResponseStates describes the per wheel response to the input brake command. +\param[in] actuationStates is a binary record of whether brake or drive torque is applied to each wheel. +\param[in] tireForces describes the torque to apply to each wheel as a response to the longitudinal tire force. +\param[in] gearboxState describes the current gear. +\param[in] throttleResponse describes the engine response to the input throttle pedal. +\param[in] clutchResponse describes the clutch response to the input clutch pedal. +\param[in] diffState describes the fraction of available drive torque to be delivered to each wheel. +\param[in] constraintGroupState describes groups of wheels with rotational speed constrained to the same value. +\param[in] dt is the time that has lapsed since the last call to PxVehicleEngineDrivetrainUpdate +\param[out] wheelRigidbody1dStates describes the angular speed of each wheel. +\param[out] engineState describes the angular speed of the engine. +\param[out] clutchState describes the clutch slip. +\note If constraintGroupState is NULL then it is assumed that there are no wheels subject to rotational speed constraints. +*/ +void PxVehicleEngineDrivetrainUpdate +(const PxVehicleAxleDescription& axleDescription, + const PxVehicleArrayData& wheelParams, + const PxVehicleEngineParams& engineParams, const PxVehicleClutchParams& clutchParams, const PxVehicleGearboxParams& gearboxParams, + const PxVehicleArrayData& brakeResponseStates, + const PxVehicleArrayData& actuationStates, + const PxVehicleArrayData& tireForces, + const PxVehicleGearboxState& gearboxState, const PxVehicleEngineDriveThrottleCommandResponseState& throttleResponse, const PxVehicleClutchCommandResponseState& clutchResponse, + const PxVehicleDifferentialState& diffState, const PxVehicleWheelConstraintGroupState* constraintGroupState, + const PxReal dt, + PxVehicleArrayData& wheelRigidbody1dStates, + PxVehicleEngineState& engineState, PxVehicleClutchSlipState& clutchState); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainHelpers.h b/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainHelpers.h new file mode 100644 index 00000000..96e58344 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainHelpers.h @@ -0,0 +1,156 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "vehicle2/drivetrain/PxVehicleDrivetrainParams.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainStates.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleWheelRigidBody1dState; + +/** +\brief Compute the coupling strength of the clutch. +\param[in] clutchResponseState describes the response of the clutch to the input clutch command. +\param[in] gearboxParams holds the index of neutral gear. +\param[in] gearboxState describes the current gear. +\note If the gear is in neutral the clutch is fully disengaged and the clutch strength is 0. +\note A clutch response state of 0.0 denotes a fully engaged clutch with maximum strength. +\note A clutch response state of 1.0 denotes a fully disengaged clutch with a strength of 0.0. +*/ +PX_FORCE_INLINE PxReal PxVehicleClutchStrengthCompute(const PxVehicleClutchCommandResponseState& clutchResponseState, const PxVehicleGearboxParams& gearboxParams, const PxVehicleGearboxState& gearboxState) +{ + return (gearboxParams.neutralGear != gearboxState.currentGear) ? clutchResponseState.commandResponse : 0.0f; +} + +/** +\brief Compute the damping rate of the engine. +\param[in] engineParams describes various damping rates of the engine in different operational states. +\param[in] gearboxParams holds the index of neutral gear. +\param[in] gearboxState describes the current gear. +\param[in] clutchResponseState is the response of the clutch to the clutch command. +\param[in] throttleResponseState is the response of the throttle to the throttle command. +\note Engines typically have different damping rates with clutch engaged and disengaged. +\note Engines typically have different damping rates at different throttle pedal values. +\see PxVehicleClutchStrengthCompute() +\note In neutral gear the clutch is considered to be fully disengaged. +*/ +PX_FORCE_INLINE PxReal PxVehicleEngineDampingRateCompute +(const PxVehicleEngineParams& engineParams, + const PxVehicleGearboxParams& gearboxParams, const PxVehicleGearboxState& gearboxState, + const PxVehicleClutchCommandResponseState& clutchResponseState, + const PxVehicleEngineDriveThrottleCommandResponseState& throttleResponseState) +{ + const PxReal K = (gearboxParams.neutralGear != gearboxState.currentGear) ? clutchResponseState.normalisedCommandResponse : 0.0f; + const PxReal zeroThrottleDamping = engineParams.dampingRateZeroThrottleClutchEngaged + + (1.0f - K)* (engineParams.dampingRateZeroThrottleClutchDisengaged - engineParams.dampingRateZeroThrottleClutchEngaged); + const PxReal appliedThrottle = throttleResponseState.commandResponse; + const PxReal fullThrottleDamping = engineParams.dampingRateFullThrottle; + const PxReal engineDamping = zeroThrottleDamping + (fullThrottleDamping - zeroThrottleDamping)*appliedThrottle; + return engineDamping; +} + +/** +\brief Compute the gear ratio delivered by the gearbox in the current gear. +\param[in] gearboxParams describes the gear ratio of each gear and the final ratio. +\param[in] gearboxState describes the current gear. +\note The gear ratio is the product of the gear ratio of the current gear and the final gear ratio of the gearbox. +*/ +PX_FORCE_INLINE PxReal PxVehicleGearRatioCompute +(const PxVehicleGearboxParams& gearboxParams, const PxVehicleGearboxState& gearboxState) +{ + const PxReal gearRatio = gearboxParams.ratios[gearboxState.currentGear] * gearboxParams.finalRatio; + return gearRatio; +} + +/** +\brief Compute the drive torque to deliver to the engine. +\param[in] engineParams describes the profile of maximum available torque across the full range of engine rotational speed. +\param[in] engineState describes the engine rotational speed. +\param[in] throttleCommandResponseState describes the engine's response to input throttle command. +*/ +PX_FORCE_INLINE PxReal PxVehicleEngineDriveTorqueCompute +(const PxVehicleEngineParams& engineParams, const PxVehicleEngineState& engineState, const PxVehicleEngineDriveThrottleCommandResponseState& throttleCommandResponseState) +{ + const PxReal appliedThrottle = throttleCommandResponseState.commandResponse; + const PxReal peakTorque = engineParams.peakTorque; + const PxVehicleFixedSizeLookupTable& torqueCurve = engineParams.torqueCurve; + const PxReal normalisedRotSpeed = engineState.rotationSpeed/engineParams.maxOmega; + const PxReal engineDriveTorque = appliedThrottle*peakTorque*torqueCurve.interpolate(normalisedRotSpeed); + return engineDriveTorque; +} + +/** +\deprecated This API was introduced with the new Vehicle API for transition purposes but will be removed in a future version. + +\brief Compute the contribution that each wheel makes to the averaged wheel speed at the clutch plate connected to the wheels driven by +the differential. +\param[in] diffParams describes the wheels coupled to the differential and the operation of the torque split at the differential. +\param[in] nbWheels The number of wheels. Can be larger than the number of wheels connected to the differential. +\param[out] diffAveWheelSpeedContributions describes the contribution that each wheel makes to the averaged wheel speed at the clutch. + The buffer needs to be sized to be able to hold at least nbWheels entries. +\note Any wheel on an axle connected to the differential could have a non-zero value, depending on the way the differential couples to the wheels. +\note Any wheel on an axle not connected to the differential will have a zero contribution to the averaged wheel speed. +*/ +void PX_DEPRECATED PxVehicleLegacyDifferentialWheelSpeedContributionsCompute +(const PxVehicleFourWheelDriveDifferentialLegacyParams& diffParams, + const PxU32 nbWheels, PxReal* diffAveWheelSpeedContributions); + +/** +\deprecated This API was introduced with the new Vehicle API for transition purposes but will be removed in a future version. + +\brief Compute the fraction of available torque that is delivered to each wheel through the differential. +\param[in] diffParams describes the wheels coupled to the differential and the operation of the torque split at the differential. +\param[in] wheelOmegas describes the rotational speeds of the wheels. Is expected to have nbWheels entries. +\param[in] nbWheels The number of wheels. Can be larger than the number of wheels connected to the differential. +\param[out] diffTorqueRatios describes the fraction of available torque delivered to each wheel. + The buffer needs to be sized to be able to hold at least nbWheels entries. +\note Any wheel on an axle connected to the diff could receive a non-zero ratio, depending on the way the differential couples to the wheels. +\note Any wheel not on an axle connected to the diff will have a zero value. +\note The sum of all the ratios adds to 1.0. +\note Slipping wheels driven by the differential will typically receive less torque than non-slipping wheels in the event that the +differential has a limited slip configuration. +*/ +void PX_DEPRECATED PxVehicleLegacyDifferentialTorqueRatiosCompute +(const PxVehicleFourWheelDriveDifferentialLegacyParams& diffParams, + const PxVehicleArrayData& wheelOmegas, + const PxU32 nbWheels, PxReal* diffTorqueRatios); + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainParams.h b/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainParams.h new file mode 100644 index 00000000..1e7dd602 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainParams.h @@ -0,0 +1,993 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +#pragma once + + +#include "foundation/PxFoundation.h" +#include "common/PxCoreUtilityTypes.h" + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/commands/PxVehicleCommandParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Distribute a throttle response to the wheels of a direct drive vehicle. +\note The drive torque applied to each wheel on the ith axle is throttleCommand * maxResponse * wheelResponseMultipliers[i]. +\note A typical use case is to set maxResponse to be the vehicle's maximum achievable drive torque +that occurs when the steer command is equal to 1.0. The array wheelResponseMultipliers[i] would then be used +to specify the maximum achievable drive torque per wheel as a fractional multiplier of the vehicle's maximum achievable steer angle. +*/ +struct PxVehicleDirectDriveThrottleCommandResponseParams : public PxVehicleCommandResponseParams +{ + PX_FORCE_INLINE PxVehicleDirectDriveThrottleCommandResponseParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleDirectDriveThrottleCommandResponseParams r = *this; + const PxReal scale = trgScale.scale/srcScale.scale; + r.maxResponse *= (scale*scale); //Max response is a torque! + return r; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + PX_CHECK_AND_RETURN_VAL(PxIsFinite(maxResponse), "PxVehicleDirectDriveThrottleCommandResponseParams.maxResponse must be a finite value", false); + for (PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + PX_CHECK_AND_RETURN_VAL(PxIsFinite(wheelResponseMultipliers[axleDesc.wheelIdsInAxleOrder[i]]), "PxVehicleDirectDriveThrottleCommandResponseParams.wheelResponseMultipliers[i] must be a finite value", false); + } + return true; + } +}; + +/** +\brief Specifies the maximum clutch strength that occurs when the clutch pedal is fully disengaged and the clutch is fully engaged. +*/ +struct PxVehicleClutchCommandResponseParams +{ + /** + \brief Strength of clutch. + + \note The clutch is the mechanism that couples the engine to the wheels. + A stronger clutch more strongly couples the engine to the wheels, while a + clutch of strength zero completely decouples the engine from the wheels. + Stronger clutches more quickly bring the wheels and engine into equilibrium, while weaker + clutches take longer, resulting in periods of clutch slip and delays in power transmission + from the engine to the wheels. + The torque generated by the clutch is proportional to the clutch strength and + the velocity difference between the engine's rotational speed and the rotational speed of the + driven wheels after accounting for the gear ratio. + The torque at the clutch is applied negatively to the engine and positively to the driven wheels. + + Range: [0,inf)
+ Unit: torque * time = mass * (length^2) / time + */ + PxReal maxResponse; + + PX_FORCE_INLINE PxVehicleClutchCommandResponseParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + const PxReal scale = trgScale.scale/srcScale.scale; + PxVehicleClutchCommandResponseParams r = *this; + r.maxResponse *= (scale*scale); + return r; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(maxResponse >= 0.0f, "PxVehicleClutchCommandResponseParams.maxResponse must be greater than or equal to zero", false); + return true; + } +}; + +/** +\brief Choose between a potentially more expensive but more accurate solution to the clutch model or a potentially cheaper but less accurate solution. +\see PxVehicleClutchParams +*/ +struct PxVehicleClutchAccuracyMode +{ + enum Enum + { + eESTIMATE = 0, + eBEST_POSSIBLE + }; +}; + +/** +\brief The clutch connects two plates together. One plate rotates with the speed of the engine. The second plate rotates with a weighted average of all +wheels connected to the differential after accounting for the gear ratio. The difference in rotation speeds generates a restoring torque applied to engine and wheels +that aims to reduce the difference in rotational speed. The restoring torque is proportional to the clutch strength and the clutch pedal position. +*/ +struct PxVehicleClutchParams +{ +public: + + /** + \brief The engine and wheel rotation speeds that are coupled through the clutch can be updated by choosing + one of two modes: eESTIMATE and eBEST_POSSIBLE. + + \note If eESTIMATE is chosen the vehicle sdk will update the wheel and engine rotation speeds + with estimated values to the implemented clutch model. + + \note If eBEST_POSSIBLE is chosen the vehicle sdk will compute the best possible + solution (within floating point tolerance) to the implemented clutch model. + This is the recommended mode. + + \note The clutch model remains the same if either eESTIMATE or eBEST_POSSIBLE is chosen but the accuracy and + computational cost of the solution to the model can be tuned as required. + */ + PxVehicleClutchAccuracyMode::Enum accuracyMode; + + /** + \brief Tune the mathematical accuracy and computational cost of the computed estimate to the wheel and + engine rotation speeds if eESTIMATE is chosen. + + \note As estimateIterations increases the computational cost of the clutch also increases and the solution + approaches the solution that would be computed if eBEST_POSSIBLE was chosen instead. + + \note This has no effect if eBEST_POSSIBLE is chosen as the accuracy mode. + + \note A value of zero is not allowed if eESTIMATE is chosen as the accuracy mode. + */ + PxU32 estimateIterations; + + PX_FORCE_INLINE PxVehicleClutchParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL((PxVehicleClutchAccuracyMode::eBEST_POSSIBLE == accuracyMode) || ((PxVehicleClutchAccuracyMode::eESTIMATE == accuracyMode) && (estimateIterations > 0)), "PxVehicleClutchParams.estimateIterations must be greater than zero if PxVehicleClutchAccuracyMode::eESTIMATE is selected", false); + return true; + } +}; + + +struct PxVehicleEngineParams +{ + /** + \brief Maximum supported number of points in the #torqueCurve graph. + */ + enum + { + eMAX_NB_ENGINE_TORQUE_CURVE_ENTRIES = 8 + }; + + /** + \brief Graph of normalized torque (torque/#peakTorque) against normalized engine speed ( engineRotationSpeed / #maxOmega ). + + \note The normalized engine speed is the x-axis of the graph, while the normalized torque is the y-axis of the graph. + */ + PxVehicleFixedSizeLookupTable torqueCurve; + + /** + \brief Moment of inertia of the engine around the axis of rotation. + + Range: (0, inf)
+ Unit: mass * (length^2) + */ + PxReal moi; + + /** + \brief Maximum torque available to apply to the engine when the accelerator pedal is at maximum. + + \note The torque available is the value of the accelerator pedal (in range [0, 1]) multiplied by the normalized torque as computed from #torqueCurve multiplied by #peakTorque. + + Range: [0, inf)
+ Unit: mass * (length^2) / (time^2) + */ + PxReal peakTorque; + + /** + \brief Minimum rotation speed of the engine. + + Range: [0, inf)
+ Unit: radians / time + */ + PxReal idleOmega; + + /** + \brief Maximum rotation speed of the engine. + + Range: [0, inf)
+ Unit: radians / time + */ + PxReal maxOmega; + + /** + \brief Damping rate of engine when full throttle is applied. + + \note If the clutch is engaged (any gear except neutral) then the damping rate applied at run-time is an interpolation + between #dampingRateZeroThrottleClutchEngaged and #dampingRateFullThrottle: + #dampingRateZeroThrottleClutchEngaged + (#dampingRateFullThrottle-#dampingRateZeroThrottleClutchEngaged)*acceleratorPedal; + + \note If the clutch is disengaged (in neutral gear) the damping rate applied at run-time is an interpolation + between #dampingRateZeroThrottleClutchDisengaged and #dampingRateFullThrottle: + #dampingRateZeroThrottleClutchDisengaged + (#dampingRateFullThrottle-#dampingRateZeroThrottleClutchDisengaged)*acceleratorPedal; + + Range: [0, inf)
+ Unit: torque * time = mass * (length^2) / time + */ + PxReal dampingRateFullThrottle; + + /** + \brief Damping rate of engine when no throttle is applied and with engaged clutch. + + \note If the clutch is engaged (any gear except neutral) then the damping rate applied at run-time is an interpolation + between #dampingRateZeroThrottleClutchEngaged and #dampingRateFullThrottle: + #dampingRateZeroThrottleClutchEngaged + (#dampingRateFullThrottle-#dampingRateZeroThrottleClutchEngaged)*acceleratorPedal; + + \note If the clutch is disengaged (in neutral gear) the damping rate applied at run-time is an interpolation + between #dampingRateZeroThrottleClutchDisengaged and #dampingRateFullThrottle: + #dampingRateZeroThrottleClutchDisengaged + (#dampingRateFullThrottle-#dampingRateZeroThrottleClutchDisengaged)*acceleratorPedal; + + Range: [0, inf)
+ Unit: torque * time = mass * (length^2) / time + */ + PxReal dampingRateZeroThrottleClutchEngaged; + + /** + \brief Damping rate of engine when no throttle is applied and with disengaged clutch. + + \note If the clutch is engaged (any gear except neutral) then the damping rate applied at run-time is an interpolation + between #dampingRateZeroThrottleClutchEngaged and #dampingRateFullThrottle: + #dampingRateZeroThrottleClutchEngaged + (#dampingRateFullThrottle-#dampingRateZeroThrottleClutchEngaged)*acceleratorPedal; + + \note If the clutch is disengaged (in neutral gear) the damping rate applied at run-time is an interpolation + between #dampingRateZeroThrottleClutchDisengaged and #dampingRateFullThrottle: + #dampingRateZeroThrottleClutchDisengaged + (#dampingRateFullThrottle-#dampingRateZeroThrottleClutchDisengaged)*acceleratorPedal; + + Range: [0, inf)
+ Unit: torque * time = mass * (length^2) / time + */ + PxReal dampingRateZeroThrottleClutchDisengaged; + + PX_FORCE_INLINE PxVehicleEngineParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleEngineParams r = *this; + const PxReal scale = trgScale.scale/srcScale.scale; + r.moi *= (scale*scale); + r.peakTorque *= (scale*scale); + r.dampingRateFullThrottle *= (scale*scale); + r.dampingRateZeroThrottleClutchDisengaged *= (scale*scale); + r.dampingRateZeroThrottleClutchEngaged *= (scale*scale); + return r; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(moi > 0.0f, "PxVehicleEngineParams.moi must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(peakTorque >= 0.0f, "PxVehicleEngineParams.peakTorque must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(torqueCurve.isValid(), "PxVehicleEngineParams.torqueCurve is invalid", false); + PX_CHECK_AND_RETURN_VAL(maxOmega >= 0.0f, "PxVehicleEngineParams.maxOmega must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(idleOmega >= 0.0f, "PxVehicleEngineParams.idleOmega must be greater or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(dampingRateFullThrottle >= 0.0f, "PxVehicleEngineParams.dampingRateFullThrottle must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(dampingRateZeroThrottleClutchEngaged >= 0.0f, "PxVehicleEngineParams.dampingRateZeroThrottleClutchEngaged must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(dampingRateZeroThrottleClutchDisengaged >= 0.0f, "PxVehicleEngineParams.dampingRateZeroThrottleClutchDisengaged must be greater than or equal to zero", false) + return true; + } +}; + +struct PxVehicleGearboxParams +{ +public: + + /** + \brief The gear that denotes neutral gear + */ + PxU32 neutralGear; + + /** + \brief Maximum supported number of gears, including reverse and neutral. + */ + enum Enum + { + eMAX_NB_GEARS = 32 + }; + + /** + \brief Gear ratios + + The ratio for reverse gears must be negative, the ratio for the neutral gear + has to be 0 and the ratio for forward gears must be positive. + */ + PxReal ratios[eMAX_NB_GEARS]; + + /** + \brief Gear ratio applied is #ratios[currentGear]*#finalRatio + + Range: (0, inf)
+ */ + PxReal finalRatio; + + /** + \brief Number of gears (including reverse and neutral). + + Range: [1, eMAX_NB_GEARS]
+ */ + PxU32 nbRatios; + + /** + \brief Time it takes to switch gear. + + Range: [0, inf)
+ Unit: time + */ + PxReal switchTime; + + PX_FORCE_INLINE PxVehicleGearboxParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(finalRatio > 0, "PxVehicleGearboxParams.finalRatio must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(nbRatios >= 1, "PxVehicleGearboxParams.nbRatios must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(nbRatios <= eMAX_NB_GEARS, "PxVehicleGearboxParams.nbRatios must be less than or equal to eMAX_NB_GEARS", false); + PX_CHECK_AND_RETURN_VAL(neutralGear < nbRatios, "PxVehicleGearboxParams.neutralGear must be less than PxVehicleGearboxParams.nbRatios", false); + PX_CHECK_AND_RETURN_VAL(switchTime >= 0.0f, "PxVehicleGearboxParams.switchTime must be greater than or equal to zero", false); + for(PxU32 i = 0; i < neutralGear; i++) + { + PX_CHECK_AND_RETURN_VAL(ratios[i] < 0.0f, "Reverse gear ratios must be less than zero", false); + } + { + PX_CHECK_AND_RETURN_VAL(ratios[neutralGear] == 0.0f, "Neutral gear ratio must be equal to zero", false); + } + for (PxU32 i = neutralGear + 1; i < nbRatios; i++) + { + PX_CHECK_AND_RETURN_VAL(ratios[i] > 0.0f, "Forward gear ratios must be greater than zero", false); + } + for (PxU32 i = neutralGear + 2; i < nbRatios; i++) + { + PX_CHECK_AND_RETURN_VAL(ratios[i] < ratios[i - 1], "Forward gear ratios must be a descending sequence of gear ratios", false); + } + return true; + } +}; + + +struct PxVehicleAutoboxParams +{ +public: + + /** + \brief Value of ( engineRotationSpeed /maxEngineRevs ) that is high enough to increment gear. + + \note When ( engineRotationSpeed / #PxVehicleEngineParams::maxOmega ) > upRatios[currentGear] the autobox will begin + a transition to currentGear+1 unless currentGear is the highest possible gear or neutral or reverse. + + Range: [0, 1]
+ */ + PxReal upRatios[PxVehicleGearboxParams::eMAX_NB_GEARS]; + + /** + \brief Value of engineRevs/maxEngineRevs that is low enough to decrement gear. + + \note When ( engineRotationSpeed / #PxVehicleEngineParams::maxOmega) < downRatios[currentGear] the autobox will begin + a transition to currentGear-1 unless currentGear is first gear or neutral or reverse. + + Range: [0, 1]
+ */ + PxReal downRatios[PxVehicleGearboxParams::eMAX_NB_GEARS]; + + /** + \brief Set the latency time of the autobox. + + \note Latency time is the minimum time that must pass between each gear change that is initiated by the autobox. + The auto-box will only attempt to initiate another gear change up or down if the simulation time that has passed since the most recent + automated gear change is greater than the specified latency. + + Range: [0, inf)
+ Unit: time + */ + PxReal latency; + + PX_FORCE_INLINE PxVehicleAutoboxParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleGearboxParams& gearboxParams) const + { + if (!gearboxParams.isValid()) + return false; + + for (PxU32 i = gearboxParams.neutralGear + 1; i < gearboxParams.nbRatios-1; i++) + { + PX_CHECK_AND_RETURN_VAL(upRatios[i] >= 0.0f, "PxVehicleAutoboxParams.upRatios must be greater than or equal to zero", false); + } + for (PxU32 i = gearboxParams.neutralGear + 2; i < gearboxParams.nbRatios; i++) + { + PX_CHECK_AND_RETURN_VAL(downRatios[i] >= 0.0f, "PxVehicleAutoboxParams.downRatios must be greater than or equal to zero", false); + } + PX_CHECK_AND_RETURN_VAL(latency >= 0.0f, "PxVehicleAutoboxParams.latency must be greater than or equal to zero", false); + return true; + } +}; + +/** +\deprecated This API was introduced with the new Vehicle API for transition purposes but will be removed in a future version. +*/ +struct PX_DEPRECATED PxVehicleFourWheelDriveDifferentialLegacyParams +{ +public: + + enum Enum + { + eDIFF_TYPE_LS_4WD, //limited slip differential for car with 4 driven wheels + eDIFF_TYPE_LS_FRONTWD, //limited slip differential for car with front-wheel drive + eDIFF_TYPE_LS_REARWD, //limited slip differential for car with rear-wheel drive + eMAX_NB_DIFF_TYPES + }; + + /** + \brief The two front wheels are specified by the array frontWheelIds. + \note The states eDIFF_TYPE_LS_4WD, eDIFF_TYPE_LS_FRONTWD require knowledge of the front wheels + to allow torque splits between front and rear axles as well as torque splits across the front axle. + \note frontWheelIds[0] should specify the wheel on the front axle that is negatively placed on the lateral axis. + \note frontWheelIds[1] should specify the wheel on the front axle that is positively placed on the lateral axis. + \note If #frontNegPosSplit > 0.5, more torque will be delivered to the wheel specified by frontWheelIds[0] than to the wheel + specified by frontWheelIds[1]. The converse is true if #frontNegPosSplit < 0.5. + */ + PxU32 frontWheelIds[2]; + + + /** + \brief The two rear wheels are specified by the array rearWheelIds. + \note The states eDIFF_TYPE_LS_4WD, eDIFF_TYPE_LS_REARWD require knowledge of the rear wheels + to allow torque splits between front and rear axles as well as torque splits across the rear axle. + \note rearWheelIds[0] should specify the wheel on the rear axle that is negatively placed on the lateral axis. + \note rearWheelIds[1] should specify the wheel on the rear axle that is positively placed on the lateral axis. + \note If #rearNegPosSplit > 0.5, more torque will be delivered to the wheel specified by rearWheelIds[0] than to the wheel + specified by rearWheelIds[1]. The converse is true if #rearNegPosSplit < 0.5. + */ + PxU32 rearWheelIds[2]; + + /** + \brief Ratio of torque split between front and rear wheels (>0.5 means more front, <0.5 means more to rear). + + \note Only applied to DIFF_TYPE_LS_4WD + + Range: [0, 1]
+ */ + PxReal frontRearSplit; + + /** + \brief Ratio of torque split between front-negative and front-positive wheels (>0.5 means more to #frontWheelIds[0], <0.5 means more to #frontWheelIds[1]). + + \note Only applied to DIFF_TYPE_LS_4WD and DIFF_TYPE_LS_FRONTWD + + Range: [0, 1]
+ */ + PxReal frontNegPosSplit; + + /** + \brief Ratio of torque split between rear-negative wheel and rear-positive wheels (>0.5 means more to #rearWheelIds[0], <0.5 means more to #rearWheelIds[1]). + + \note Only applied to DIFF_TYPE_LS_4WD and eDIFF_TYPE_LS_REARWD + + Range: [0, 1]
+ */ + PxReal rearNegPosSplit; + + /** + \brief Maximum allowed ratio of average front wheel rotation speed and rear wheel rotation speeds. + The differential will divert more torque to the slower wheels when the bias is exceeded. + + \note Only applied to DIFF_TYPE_LS_4WD + + Range: [1, inf)
+ */ + PxReal centerBias; + + /** + \brief Maximum allowed ratio of front-left and front-right wheel rotation speeds. + The differential will divert more torque to the slower wheel when the bias is exceeded. + + \note Only applied to DIFF_TYPE_LS_4WD and DIFF_TYPE_LS_FRONTWD + + Range: [1, inf)
+ */ + PxReal frontBias; + + /** + \brief Maximum allowed ratio of rear-left and rear-right wheel rotation speeds. + The differential will divert more torque to the slower wheel when the bias is exceeded. + + \note Only applied to DIFF_TYPE_LS_4WD and DIFF_TYPE_LS_REARWD + + Range: [1, inf)
+ */ + PxReal rearBias; + + /** + \brief Type of differential. + + Range: [DIFF_TYPE_LS_4WD, eDIFF_TYPE_LS_REARWD]
+ */ + Enum type; + + PX_FORCE_INLINE PxVehicleFourWheelDriveDifferentialLegacyParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + PX_UNUSED(axleDesc); + PX_CHECK_AND_RETURN_VAL((axleDesc.getAxle(frontWheelIds[0]) != 0xffffffff) && (axleDesc.getAxle(frontWheelIds[0])== axleDesc.getAxle(frontWheelIds[1])), "frontWheelIds[0] and frontWheelIds[1] must reference wheels on the same axle", false); + PX_CHECK_AND_RETURN_VAL((axleDesc.getAxle(rearWheelIds[0]) != 0xffffffff) && (axleDesc.getAxle(rearWheelIds[0]) == axleDesc.getAxle(rearWheelIds[1])), "rearWheelIds[0] and rearWheelIds[1] must reference wheels on the same axle", false); + PX_CHECK_AND_RETURN_VAL(frontRearSplit <= 1.0f && frontRearSplit >= 0.0f, "PxVehicleLegacyFourWheelDriveDifferentialParams.frontRearSplit must be in range [0,1]", false); + PX_CHECK_AND_RETURN_VAL(frontNegPosSplit <= 1.0f && frontNegPosSplit >= 0.0f, "PxVehicleLegacyFourWheelDriveDifferentialParams.frontNegPosSplit must be in range [0,1]", false); + PX_CHECK_AND_RETURN_VAL(rearNegPosSplit <= 1.0f && rearNegPosSplit >= 0.0f, "PxVehicleLegacyFourWheelDriveDifferentialParams.rearNegPosSplit must be in range [0,1]", false); + PX_CHECK_AND_RETURN_VAL(centerBias >= 1.0f, "PxVehicleLegacyFourWheelDriveDifferentialParams.centerBias must be greater than or equal to 1.0f", false); + PX_CHECK_AND_RETURN_VAL(frontBias >= 1.0f, "PxVehicleLegacyFourWheelDriveDifferentialParams.frontBias must be greater than or equal to 1.0f", false); + PX_CHECK_AND_RETURN_VAL(rearBias >= 1.0f, "PxVehicleLegacyFourWheelDriveDifferentialParams.rearBias must be greater than or equal to 1.0f", false); + PX_CHECK_AND_RETURN_VAL(type < PxVehicleFourWheelDriveDifferentialLegacyParams::eMAX_NB_DIFF_TYPES, "PxVehicleLegacyFourWheelDriveDifferentialParams.type has illegal value", false); + return true; + } +}; + +/** +\brief PxVehicleMultiWheelDriveDifferentialParams specifies the wheels that are to receive drive torque from the differential +and the division of torque between the wheels that are connected to the differential. +*/ +struct PxVehicleMultiWheelDriveDifferentialParams +{ + /** + \brief torqueRatios describes the fraction of torque delivered to each wheel through the differential. + \note Wheels not connected to the differential must receive zero torque. + \note Wheels connected to the differential may receive a non-zero torque. + \note The sum of the absolute of the ratios of all wheels must equal to 1.0. + \note A negative torque ratio simulates a wheel with negative gearing applied. + + Range: [1, -1]
+ */ + PxReal torqueRatios[PxVehicleLimits::eMAX_NB_WHEELS]; + + /** + \brief aveWheelSpeedRatios describes the contribution of each wheel to the average wheel speed measured at the clutch. + \note Wheels not connected to the differential do not contribute to the average wheel speed measured at the clutch. + \note Wheels connected to the differential may delivere a non-zero contribution to the average wheel speed measured at the clutch. + \note The sum of all ratios of all wheels must equal to 1.0. + + Range: [0, 1]
+ */ + PxReal aveWheelSpeedRatios[PxVehicleLimits::eMAX_NB_WHEELS]; + + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleMultiWheelDriveDifferentialParams)); + } + + PX_FORCE_INLINE PxVehicleMultiWheelDriveDifferentialParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + if (!axleDesc.isValid()) + return false; + PxReal aveWheelSpeedSum = 0.0f; + PxReal torqueRatioSum = 0.0f; + for (PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheelId = axleDesc.wheelIdsInAxleOrder[i]; + PX_CHECK_AND_RETURN_VAL(PxAbs(torqueRatios[wheelId]) <= 1.0f, "PxVehicleMultiWheelDriveDifferentialParams.torqueRatios[i] must be in range [-1, 1] for all wheels connected to the differential", false); + PX_CHECK_AND_RETURN_VAL(aveWheelSpeedRatios[wheelId] >= 0.0f && aveWheelSpeedRatios[wheelId] <= 1.0f, "PxVehicleMultiWheelDriveDifferentialParams.aveWheelSpeedRatios[i] must be in range [0, 1] for all wheels connected to the differential", false); + aveWheelSpeedSum += aveWheelSpeedRatios[wheelId]; + torqueRatioSum += PxAbs(torqueRatios[wheelId]); + } + PX_CHECK_AND_RETURN_VAL(aveWheelSpeedSum >= 0.99f && aveWheelSpeedSum <= 1.01f, "Sum of PxVehicleMultiWheelDriveDifferentialParams.aveWheelSpeedRatios[i] must be 1.0.", false); + PX_CHECK_AND_RETURN_VAL(torqueRatioSum >= 0.99f && torqueRatioSum <= 1.01f, "Sum of PxVehicleMultiWheelDriveDifferentialParams.torqueRatios[i] must be 1.0.", false); + PX_UNUSED(aveWheelSpeedSum); + PX_UNUSED(torqueRatioSum); + return true; + } +}; + +/** +\brief A special value that indicates instantaneous resolution of a slip that exceeds a differential bias. +*/ +#define PX_VEHICLE_FOUR_WHEEL_DIFFERENTIAL_MAXIMUM_STRENGTH PX_MAX_F32 + +/** +\brief PxVehicleFourWheelDriveDifferentialParams specifies the wheels that are to receive drive torque from the differential +and the division of torque between the wheels that are connected to the differential. Additionally, it specifies the biases +and strength of a limited slip differential that operates on two wheels specified as front wheels and two wheels specified +as rear wheels. +*/ +struct PxVehicleFourWheelDriveDifferentialParams : public PxVehicleMultiWheelDriveDifferentialParams +{ + /** + \brief The ids of the two wheels considered by the differential to be the front pair. + \note When the ratio of the rotational speeds of the front wheels exceeds frontBias, drive torque is diverted so + that the ratio approaches the value specified by frontTarget. When the bias is not breached, the drive torque + is specified by the corresponding entries in PxVehicleMultiWheelDriveDifferentialParams::torqueRatios. + */ + PxU32 frontWheelIds[2]; + + /** + \brief The ids of the two wheels considered by the differential to be the rear pair. + \note When the ratio of the rotational speeds of the rear wheels exceeds rearBias, drive torque is diverted so + that the ratio approaches the value specified by rearTarget. When the bias is not breached, the drive torque + is specified by the corresponding entries in PxVehicleMultiWheelDriveDifferentialParams::torqueRatios. + */ + PxU32 rearWheelIds[2]; + + /** + \brief The parameter frontBias specifies the maximum angular speed ratio of the two front wheels specified by frontWheelIds[2]. + \note If frontBias has value 0.0, the differential will not try to enforce any relationship between the rotational speeds of the two front wheels. + \note If frontBias has value 0.0, the torque split between the front wheels is specified by the array torqueRatios. + \note frontBias must have value 0.0 (deactivated limited slip) or be greater than 1.0 (activated limited slip) or be equal to 1.0 (locked axle). + \note If frontBias has value greater than or equal to 1.0 then the array frontWheelIds must be specified and the corresponding entries of + the isConnected[] array must be set true. + \note If frontBias has value greater than or equal to 1.0 then frontTarget must also be specified. + \note A locked axle may be achieved by setting frontBias and frontTarget to 1.0. + \note A limited slip differential may be achieved by setting frontBias > 1.0 and frontBias > frontTarget > 1.0. + */ + PxReal frontBias; + + /** + \brief The parameter frontTarget specifies the target rotational speed ratio of the two front wheels in the event that the ratio exceeds frontBias and frontBias + is configured for an activated limited slip or locked axle. + \note frontTarget must be less than frontBias and greater than 1.0 to implement a limited slip differential. + \note Set frontTarget and frontBias to 1.0 to implement a locked axle. + */ + PxReal frontTarget; + + /** + \brief The parameter rearBias specifies the maximum angular speed ratio of the two rear wheels specified by rearWheelIds[2]. + \note If rearBias has value 0.0, the differential will not try to enforce any relationship between the rotational speeds of the two rear wheels. + \note If rearBias has value 0.0, the torque split between the rear wheels is specified by the array torqueRatios. + \note rearBias must have value 0.0 (deactivated limited slip) or be greater than 1.0 (activated limited slip) or be equal to 1.0 (locked axle). + \note If rearBias has value greater than or equal to 1.0 then the array rearWheelIds must be specified and the corresponding entries of + the isConnected[] array must be set true. + \note If rearBias has value greater than or equal to 1.0 then rearTarget must also be specified. + \note A locked axle may be achieved by setting rearBias and rearTarget to 1.0. + \note A limited slip differential may be achieved by setting rearBias > 1.0 and rearBias > rearTarget > 1.0 + */ + PxReal rearBias; + + /** + \brief The parameter rearTarget specifies the target rotational speed ratio of the two rear wheels in the event that the ratio exceeds rearBias and rearBias + is configured for an activated limited slip or locked axle. + \note rearTarget must be less than rearBias and greater than 1.0 to implement a limited slip differential. + \note Set rearTarget and rearBias to 1.0 to implement a locked axle. + */ + PxReal rearTarget; + + /** + \brief The parameter centerBias specifies the maximum angular speed ratio of the sum of the two front wheels and the sum of the two rear wheels, + as specified by frontWheelIds[2] and rearWheelIds[2]. + \note If centerBias has value 0.0, the differential will not try to enforce any relationship between the rotational speeds of the front and rear wheels. + \note If centerBias has value 0.0, the torque split between the front and rear rear wheels is specified by the array torqueRatios. + \note centerBias must have value 0.0 (deactivated limited slip) or be greater than 1.0 (activated limited slip) or be equal to 1.0 (locked). + \note If centerBias has value greater than or equal to 1.0 then the arrays frontWheelIds and rearWheelIds must be specified and the corresponding entries of + the isConnected[] array must be set true. + \note If centerBias has value greater than or equal to 1.0 then centerTarget must also be specified. + \note A locked front/rear differential may be achieved by setting centerBias and centerTarget to 1.0. + \note A limited slip differential may be achieved by setting centerBias > 1.0 and centerBias > centerTarget > 1.0 + */ + PxReal centerBias; + + /** + \brief The parameter centerTarget specifies the target rotational speed ratio of the sum of the two front wheels and the sum of the two rear wheels + in the event that the ratio exceeds centerBias and centerBias is configured for an activated limited slip. + \note centerTarget must be less than centerBias and greater than 1.0 to implement a limited slip differential. + \note Set centerTarget and centerBias to 1.0 to implement a locked differential. + */ + PxReal centerTarget; + + /** + \brief The parameter rate specifies how quickly the ratio of rotational speeds approaches the target rotational speed ratio. + \note strength must be in range [0,PX_VEHICLE_FOUR_WHEEL_DIFF_MAXIMUM_STRENGTH]. + \note The ratio of rotational speeds is decremented each update by rate*dt until the ratio is equal to the target ratio. + \note A value of 0 will result in a deactivated limited slip. + \note A value of PX_VEHICLE_FOUR_WHEEL_DIFF_MAXIMUM_STRENGTH will result in instantaneous correction of the rotational speed ratios. + */ + PxReal rate; + + + PX_FORCE_INLINE void setToDefault() + { + PxVehicleMultiWheelDriveDifferentialParams::setToDefault(); + frontBias = 0.0f; + rearBias = 0.0f; + centerBias = 0.0f; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + if (!PxVehicleMultiWheelDriveDifferentialParams::isValid(axleDesc)) + return false; + + PX_CHECK_AND_RETURN_VAL((0.0f == centerBias) || + (centerBias > 1.0f && + frontWheelIds[0] < axleDesc.nbWheels && frontWheelIds[1] < axleDesc.nbWheels && + rearWheelIds[0] < axleDesc.nbWheels && rearWheelIds[1] < axleDesc.nbWheels), + "PxVehicleFourWheelDriveDifferentialParams:: centreBias is enabled but the frontWheelIds and rearWheelIds are not configured correctly.", false); + PX_CHECK_AND_RETURN_VAL((0.0f == centerBias) || + (centerBias > 1.0f && + frontWheelIds[0] != frontWheelIds[1] && frontWheelIds[0] != rearWheelIds[0] && frontWheelIds[0] != rearWheelIds[1] && + frontWheelIds[1] != rearWheelIds[0] && frontWheelIds[1] != rearWheelIds[1] && + rearWheelIds[0] != rearWheelIds[1]), + "PxVehicleFourWheelDriveDifferentialParams:: centreBias is enabled but the frontWheelIds and rearWheelIds are not configured correctly.", false); + PX_CHECK_AND_RETURN_VAL((0.0f == centerBias) || + (centerBias > 1.0f && + torqueRatios[frontWheelIds[0]] != 0.0f && torqueRatios[frontWheelIds[1]] != 0.0f && torqueRatios[rearWheelIds[0]] != 0.0f && torqueRatios[rearWheelIds[1]] != 0.0f), + "PxVehicleFourWheelDriveDifferentialParams:: centreBias is enabled but the front and rear wheels are not connected.", false); + + PX_CHECK_AND_RETURN_VAL((0.0f == rearBias) || + (rearBias > 1.0f && rearWheelIds[0] < axleDesc.nbWheels && rearWheelIds[1] < axleDesc.nbWheels), + "PxVehicleFourWheelDriveDifferentialParams:: rearBias is enabled but the rearWheelIds are not configured correctly.", false); + PX_CHECK_AND_RETURN_VAL((0.0f == rearBias) || + (rearBias > 1.0f && rearWheelIds[0] != rearWheelIds[1]), + "PxVehicleFourWheelDriveDifferentialParams:: rearBias is enabled but the rearWheelIds are not configured correctly.", false); + PX_CHECK_AND_RETURN_VAL((0.0f == centerBias) || + (rearBias > 1.0f && torqueRatios[rearWheelIds[0]] != 0.0f && torqueRatios[rearWheelIds[1]] != 0.0f), + "PxVehicleFourWheelDriveDifferentialParams:: rearBias is enabled but the rear wheels are not connected.", false); + + PX_CHECK_AND_RETURN_VAL((0.0f == frontBias) || + (frontBias > 1.0f && frontWheelIds[0] < axleDesc.nbWheels && frontWheelIds[1] < axleDesc.nbWheels), + "PxVehicleFourWheelDriveDifferentialParams:: frontBias is enabled but the frontWheelIds are not configured correctly.", false); + PX_CHECK_AND_RETURN_VAL((0.0f == frontBias) || + (frontBias > 1.0f && frontWheelIds[0] != frontWheelIds[1]), + "PxVehicleFourWheelDriveDifferentialParams:: frontBias is enabled but the frontWheelIds are not configured correctly.", false); + PX_CHECK_AND_RETURN_VAL((0.0f == frontBias) || + (frontBias > 1.0f && torqueRatios[frontWheelIds[0]] != 0.0f && frontWheelIds[frontWheelIds[1]]), + "PxVehicleFourWheelDriveDifferentialParams:: frontBias is enabled but the front wheels are not connected.", false); + + PX_CHECK_AND_RETURN_VAL(((0.0f == frontBias) && (0.0f == rearBias) && (0.0f == centerBias)) || (rate >= 0.0f), + "PxVehicleFourWheelDriveDifferentialParams:: strength must be greater than or equal to zero", false); + + PX_CHECK_AND_RETURN_VAL((0.0f == frontBias) || ((1.0f == frontTarget && 1.0f == rearTarget) || (frontTarget > 1.0f && frontTarget < frontBias)), + "PxVehicleFourWheelDriveDifferentialParams: frontBias is enabled but frontTarget not in range (1.0f, frontBias)", false); + PX_CHECK_AND_RETURN_VAL((0.0f == rearBias) || ((1.0f == rearTarget && 1.0f == rearBias) || (rearTarget > 1.0f && rearTarget < rearBias)), + "PxVehicleFourWheelDriveDifferentialParams: rearBias is enabled but rearTarget not in range (1.0f, rearBias)", false); + PX_CHECK_AND_RETURN_VAL((0.0f == centerBias) || ((1.0f == centerTarget && 1.0f == centerBias) || (centerTarget > 1.0f && centerTarget < centerBias)), + "PxVehicleFourWheelDriveDifferentialParams: centerBias is enabled but centerTarget not in range (1.0f, centerBias)", false); + + return true; + } + + PX_FORCE_INLINE PxVehicleFourWheelDriveDifferentialParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + PxVehicleFourWheelDriveDifferentialParams r = *this; + static_cast(r) = PxVehicleMultiWheelDriveDifferentialParams::transformAndScale(srcFrame, trgFrame, srcScale, trgScale); + return r; + } +}; + +/** +\brief A description of a tank differential. +\note The wheels on a tank may be connected to the differential or not connected to the differential. +\note The wheels on a tank track may be connected to a tank track or not connected to a tank track. +\note Wheels connected to the differential but not to a tank track receive the torque split specified by the +corresponding elements of PxVehicleMultiWheelDriveDifferentialParams::torqueRatios[]. +\note Wheels connected to a tank track but not to the differential receive no torque from the engine. +\note Wheels connected to a tank track and to the differential receive the torque split specified by the +corresponding elements of PxVehicleMultiWheelDriveDifferentialParams::torqueRatios[] multiplied by the corresponding +thrust controller value. If the thrust controller has a negative value, the wheels will receive a torque that is negative +with respect to the gearing ratio. +\note The wheels in each tank track have a constraint applied to them to enforce the rule that they all have the same longitudinal speed +at the contact point between the wheel and the tank track. +*/ +struct PxVehicleTankDriveDifferentialParams : public PxVehicleMultiWheelDriveDifferentialParams +{ + PX_FORCE_INLINE void setToDefault() + { + PxVehicleMultiWheelDriveDifferentialParams::setToDefault(); + nbTracks = 0; + } + + /** + \brief Add a tank track by specifying the number of wheels along the track and an array of wheel ids specifying each wheel in the tank track. + \param[in] nbWheelsInTrackToAdd is the number of wheels in the track to be added. + \param[in] wheelIdsInTrackToAdd is an array of wheel ids specifying all the wheels in the track to be added. + \param[in] thrustControllerIndex specifies the index of the thrust controller that will be used to control the tank track. + */ + void addTankTrack(const PxU32 nbWheelsInTrackToAdd, const PxU32* const wheelIdsInTrackToAdd, const PxU32 thrustControllerIndex) + { + PxU32 trackToWheelIdsOffset = nbTracks ? trackToWheelIds[nbTracks - 1] + nbWheelsPerTrack[nbTracks - 1] : 0; + PX_ASSERT((trackToWheelIdsOffset + nbWheelsInTrackToAdd) <= PxVehicleLimits::eMAX_NB_WHEELS); + PX_ASSERT(nbTracks < PxVehicleLimits::eMAX_NB_WHEELS); + PX_ASSERT(thrustControllerIndex < 2); + nbWheelsPerTrack[nbTracks] = nbWheelsInTrackToAdd; + thrustIdPerTrack[nbTracks] = thrustControllerIndex; + trackToWheelIds[nbTracks] = trackToWheelIdsOffset; + for (PxU32 i = 0; i < nbWheelsInTrackToAdd; i++) + { + wheelIdsInTrackOrder[trackToWheelIdsOffset + i] = wheelIdsInTrackToAdd[i]; + } + nbTracks++; + } + + /** + \brief Return the number of tracks. + \return The number of tracks. + \see getNbWheelsInTrack() + */ + PX_FORCE_INLINE PxU32 getNbTracks() const + { + return nbTracks; + } + + /** + \brief Return the number of wheels in the ith track. + \param[in] i specifies the track to be queried for its wheel count. + \return The number of wheels in the specified track. + \see getWheelInTrack() + */ + PX_FORCE_INLINE PxU32 getNbWheelsInTrack(const PxU32 i) const + { + return nbWheelsPerTrack[i]; + } + + /** + \brief Return the array of all wheels in the ith track. + \param[in] i specifies the track to be queried for its wheels. + \return The array of wheels in the specified track. + */ + PX_FORCE_INLINE const PxU32* getWheelsInTrack(const PxU32 i) const + { + return (wheelIdsInTrackOrder + trackToWheelIds[i]); + } + + /** + \brief Return the wheel id of the jth wheel in the ith track. + \param[in] j specifies that the wheel id to be returned is the jth wheel in the list of wheels on the specified track. + \param[in] i specifies the track to be queried. + \return The wheel id of the jth wheel in the ith track. + \see getNbWheelsInTrack() + */ + PX_FORCE_INLINE PxU32 getWheelInTrack(const PxU32 j, const PxU32 i) const + { + return wheelIdsInTrackOrder[trackToWheelIds[i] + j]; + } + + /** + \brief Return the index of the thrust controller that will control a specified track. + \param[in] i specifies the track to be queried for its thrust controller index + \return The index of the thrust controller that will control the ith track. + */ + PX_FORCE_INLINE PxU32 getThrustControllerIndex(const PxU32 i) const + { + return thrustIdPerTrack[i]; + } + + PX_FORCE_INLINE PxVehicleTankDriveDifferentialParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + PxVehicleTankDriveDifferentialParams r = *this; + static_cast(r) = PxVehicleMultiWheelDriveDifferentialParams::transformAndScale(srcFrame, trgFrame, srcScale, trgScale); + return r; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + if (!PxVehicleMultiWheelDriveDifferentialParams::isValid(axleDesc)) + return false; + + PX_CHECK_AND_RETURN_VAL(nbTracks <= PxVehicleLimits::eMAX_NB_WHEELS, "PxVehicleTankDriveDifferentialParams.nbTracks must not exceed PxVehicleLimits::eMAX_NB_WHEELS", false); + + const PxU32 nbWheelsInTracksSize = nbTracks ? trackToWheelIds[nbTracks - 1] + nbWheelsPerTrack[nbTracks - 1] : 0; + PX_UNUSED(nbWheelsInTracksSize); + PX_CHECK_AND_RETURN_VAL(nbWheelsInTracksSize <= PxVehicleLimits::eMAX_NB_WHEELS, "PxVehicleTankDriveDifferentialParams.nbWheelsInTracks must not exceed PxVehicleLimits::eMAX_NB_WHEELS", false); + for (PxU32 i = 0; i < nbTracks; i++) + { + PX_CHECK_AND_RETURN_VAL(thrustIdPerTrack[i] < 2, "PxVehicleTankDriveDifferentialParams.thrustId must be less than 2", false); + } + + for (PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheelId = axleDesc.wheelIdsInAxleOrder[i]; + PxU32 count = 0; + for (PxU32 j = 0; j < nbTracks; j++) + { + const PxU32 nbWheels = getNbWheelsInTrack(j); + const PxU32* wheelIds = getWheelsInTrack(j); + + for (PxU32 k = 0; k < nbWheels; k++) + { + if (wheelIds[k] == wheelId) + count++; + } + } + PX_CHECK_AND_RETURN_VAL(count <= 1, "PxVehicleTankDriveDifferentialParams - a wheel cannot be in more than one tank track", false); + } + return true; + } + + PxU32 nbTracks; //!< The number of tracks + PxU32 thrustIdPerTrack[PxVehicleLimits::eMAX_NB_WHEELS]; //!< The id of the thrust that will control the track. Must have value 0 or 1. + PxU32 nbWheelsPerTrack[PxVehicleLimits::eMAX_NB_WHEELS]; //!< The number of wheels in each track + PxU32 trackToWheelIds[PxVehicleLimits::eMAX_NB_WHEELS]; //!< The list of wheel ids for the ith tank track begins at wheelIdsInTrackOrder[trackToWheelIds[i]] + + PxU32 wheelIdsInTrackOrder[PxVehicleLimits::eMAX_NB_WHEELS];//!< The list of all wheel ids in all tracks +}; + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + + diff --git a/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainStates.h b/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainStates.h new file mode 100644 index 00000000..359220a6 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainStates.h @@ -0,0 +1,284 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "vehicle2/commands/PxVehicleCommandStates.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + + +struct PxVehicleClutchCommandResponseState +{ + PxReal normalisedCommandResponse; + PxReal commandResponse; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleClutchCommandResponseState)); + } +}; + +struct PxVehicleEngineDriveThrottleCommandResponseState +{ + PxReal commandResponse; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleEngineDriveThrottleCommandResponseState)); + } +}; + +struct PxVehicleEngineState +{ + /** + \brief The rotation speed of the engine (radians per second). + + Unit: radians / time + */ + PxReal rotationSpeed; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleEngineState)); + } +}; + +#define PX_VEHICLE_NO_GEAR_SWITCH_PENDING -1.0f +#define PX_VEHICLE_GEAR_SWITCH_INITIATED -2.0f + +struct PxVehicleGearboxState +{ + /** + \brief Current gear + */ + PxU32 currentGear; + + /** + \brief Target gear (different from current gear if a gear change is underway) + */ + PxU32 targetGear; + + /** + \brief Reported time that has passed since gear change started. + + The special value PX_VEHICLE_NO_GEAR_SWITCH_PENDING denotes that there is currently + no gear change underway. + + If a gear switch was initiated, the special value PX_VEHICLE_GEAR_SWITCH_INITIATED + will be used temporarily but get translated to 0 in the gearbox update immediately. + This state might only get encountered, if the vehicle component update is split into + multiple sequences that do not run in one go. + + Unit: time + */ + PxReal gearSwitchTime; + + PX_FORCE_INLINE void setToDefault() + { + currentGear = 0; + targetGear = 0; + gearSwitchTime = PX_VEHICLE_NO_GEAR_SWITCH_PENDING; + } +}; + +#define PX_VEHICLE_UNSPECIFIED_TIME_SINCE_LAST_SHIFT PX_MAX_F32 + +struct PxVehicleAutoboxState +{ + /** + \brief Time that has lapsed since the last autobox gear shift. + + Unit: time + */ + PxReal timeSinceLastShift; + + /** + \brief Describes whether a gear shift triggered by the autobox is still in flight. + */ + bool activeAutoboxGearShift; + + PX_FORCE_INLINE void setToDefault() + { + timeSinceLastShift = PX_VEHICLE_UNSPECIFIED_TIME_SINCE_LAST_SHIFT; + activeAutoboxGearShift = false; + } +}; + +struct PxVehicleDifferentialState +{ + /** + \brief A list of wheel indices that are connected to the differential. + */ + PxU32 connectedWheels[PxVehicleLimits::eMAX_NB_WHEELS]; + + /** + \brief The number of wheels that are connected to the differential. + */ + PxU32 nbConnectedWheels; + + /** + \brief The fraction of available torque that is delivered to each wheel through the differential. + \note If a wheel is not connected to the differential then the fraction of available torque delivered to that wheel will be zero. + \note A negative torque ratio for a wheel indicates a negative gearing is to be applied to that wheel. + \note The sum of the absolute value of each fraction must equal 1.0. + */ + PxReal torqueRatiosAllWheels[PxVehicleLimits::eMAX_NB_WHEELS]; + + /** + \brief The contribution of each wheel to the average wheel rotation speed measured at the clutch. + \note If a wheel is not connected to the differential then the contribution to the average rotation speed measured at the clutch must be zero. + \note The sum of all contributions must equal 1.0. + */ + PxReal aveWheelSpeedContributionAllWheels[PxVehicleLimits::eMAX_NB_WHEELS]; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleDifferentialState)); + } +}; + +/** +\brief Specify groups of wheels that are to be constrained to have pre-determined angular velocity relationship. +*/ +struct PxVehicleWheelConstraintGroupState +{ + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleWheelConstraintGroupState)); + } + + /** + \brief Add a wheel constraint group by specifying the number of wheels in the group, an array of wheel ids specifying each wheel in the group + and a desired rotational speed relationship. + \param[in] nbWheelsInGroupToAdd is the number of wheels in the group to be added. + \param[in] wheelIdsInGroupToAdd is an array of wheel ids specifying all the wheels in the group to be added. + \param[in] constraintMultipliers is an array of constraint multipliers describing the desired relationship of the wheel rotational speeds. + \note constraintMultipliers[j] specifies the target rotational speed of the jth wheel in the constraint group as a multiplier of the rotational + speed of the zeroth wheel in the group. + */ + void addConstraintGroup(const PxU32 nbWheelsInGroupToAdd, const PxU32* const wheelIdsInGroupToAdd, const PxF32* constraintMultipliers) + { + PX_ASSERT((nbWheelsInGroups + nbWheelsInGroupToAdd) < PxVehicleLimits::eMAX_NB_WHEELS); + PX_ASSERT(nbGroups < PxVehicleLimits::eMAX_NB_WHEELS); + nbWheelsPerGroup[nbGroups] = nbWheelsInGroupToAdd; + groupToWheelIds[nbGroups] = nbWheelsInGroups; + for (PxU32 i = 0; i < nbWheelsInGroupToAdd; i++) + { + wheelIdsInGroupOrder[nbWheelsInGroups + i] = wheelIdsInGroupToAdd[i]; + wheelMultipliersInGroupOrder[nbWheelsInGroups + i] = constraintMultipliers[i]; + } + nbWheelsInGroups += nbWheelsInGroupToAdd; + nbGroups++; + } + + /** + \brief Return the number of wheel constraint groups in the vehicle. + \return The number of wheel constraint groups. + \see getNbWheelsInConstraintGroup() + */ + PX_FORCE_INLINE PxU32 getNbConstraintGroups() const + { + return nbGroups; + } + + /** + \brief Return the number of wheels in the ith constraint group. + \param[in] i specifies the constraint group to be queried for its wheel count. + \return The number of wheels in the specified constraint group. + \see getWheelInConstraintGroup() + */ + PX_FORCE_INLINE PxU32 getNbWheelsInConstraintGroup(const PxU32 i) const + { + return nbWheelsPerGroup[i]; + } + + /** + \brief Return the wheel id of the jth wheel in the ith constraint group. + \param[in] j specifies that the wheel id to be returned is the jth wheel in the list of wheels on the specified constraint group. + \param[in] i specifies the constraint group to be queried. + \return The wheel id of the jth wheel in the ith constraint group. + \see getNbWheelsInConstraintGroup() + */ + PX_FORCE_INLINE PxU32 getWheelInConstraintGroup(const PxU32 j, const PxU32 i) const + { + return wheelIdsInGroupOrder[groupToWheelIds[i] + j]; + } + + /** + \brief Return the constraint multiplier of the jth wheel in the ith constraint group + \param[in] j specifies that the wheel id to be returned is the jth wheel in the list of wheels on the specified constraint group. + \param[in] i specifies the constraint group to be queried. + \return The constraint multiplier of the jth wheel in the ith constraint group. + */ + PX_FORCE_INLINE PxReal getMultiplierInConstraintGroup(const PxU32 j, const PxU32 i) const + { + return wheelMultipliersInGroupOrder[groupToWheelIds[i] + j]; + } + + PxU32 nbGroups; //!< The number of constraint groups in the vehicle + PxU32 nbWheelsPerGroup[PxVehicleLimits::eMAX_NB_AXLES]; //!< The number of wheels in each group + PxU32 groupToWheelIds[PxVehicleLimits::eMAX_NB_AXLES]; //!< The list of wheel ids for the ith group begins at wheelIdsInGroupOrder[groupToWheelIds[i]] + + PxU32 wheelIdsInGroupOrder[PxVehicleLimits::eMAX_NB_WHEELS]; //!< The list of all wheel ids in constraint groups + PxF32 wheelMultipliersInGroupOrder[PxVehicleLimits::eMAX_NB_WHEELS];//!< The constraint multipliers for each constraint group. + PxU32 nbWheelsInGroups; //!< The number of wheels in a constraint group. +}; + +/** +\brief The clutch is modelled as two spinning plates with one connected to the wheels through the gearing and the other connected to the engine. The clutch slip is angular speed difference of the two plates. +*/ +struct PxVehicleClutchSlipState +{ + /** + \brief The slip at the clutch. + + Unit: radians / time + */ + PxReal clutchSlip; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleClutchSlipState)); + } +}; + + + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/physxActor/PxVehiclePhysXActorComponents.h b/engine/third_party/physx/include/vehicle2/physxActor/PxVehiclePhysXActorComponents.h new file mode 100644 index 00000000..a75db6f3 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/physxActor/PxVehiclePhysXActorComponents.h @@ -0,0 +1,239 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "vehicle2/wheel/PxVehicleWheelStates.h" + +#include "PxVehiclePhysXActorFunctions.h" +#include "PxVehiclePhysXActorStates.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Work items at the beginning of an update step for a PhysX actor based vehicle. + +Includes: + - Waking the actor up if it is sleeping and a throttle or steer command is issued. + - Clearing certain states if the actor is sleeping. + - Reading the state from the PhysX actor and copy to the vehicle internal state. + +\see PxVehiclePhysxActorWakeup PxVehiclePhysxActorSleepCheck PxVehicleReadRigidBodyStateFromPhysXActor +*/ +class PxVehiclePhysXActorBeginComponent : public PxVehicleComponent +{ +public: + + PxVehiclePhysXActorBeginComponent() : PxVehicleComponent() {} + virtual ~PxVehiclePhysXActorBeginComponent() {} + + /** + \brief Provide vehicle data items for this component. + + \param[out] axleDescription identifies the wheels on each axle. + \param[out] commands are the brake, throttle and steer values that will drive the vehicle. + \param[out] transmissionCommands are the target gear and clutch values that will control + the transmission. Can be set to NULL if the vehicle does not have a gearbox. If + specified, then gearParams and gearState has to be specifed too. + \param[out] gearParams The gearbox parameters. Can be set to NULL if the vehicle does + not have a gearbox and transmissionCommands is NULL. + \param[out] gearState The state of the gearbox. Can be set to NULL if the vehicle does + not have a gearbox and transmissionCommands is NULL. + \param[out] engineParams The engine parameters. Can be set to NULL if the vehicle does + not have an engine. Must be specified, if engineState is specified. + \param[out] physxActor is the PxRigidBody instance associated with the vehicle. + \param[out] physxSteerState is the previous state of the steer and is used to determine if the + steering wheel has changed by comparing with PxVehicleCommandState::steer. + \param[out] physxConstraints The state of the suspension limit and low speed tire constraints. + If the vehicle actor is sleeping and constraints are active, they will be + deactivated and marked as dirty. + \param[out] rigidBodyState is the state of the rigid body used by the Vehicle SDK. + \param[out] wheelRigidBody1dStates describes the angular speed of each wheel. + \param[out] engineState The engine state. Can be set to NULL if the vehicle does + not have an engine. If specified, then engineParams has to be specifed too. + */ + virtual void getDataForPhysXActorBeginComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleCommandState*& commands, + const PxVehicleEngineDriveTransmissionCommandState*& transmissionCommands, + const PxVehicleGearboxParams*& gearParams, + const PxVehicleGearboxState*& gearState, + const PxVehicleEngineParams*& engineParams, + PxVehiclePhysXActor*& physxActor, + PxVehiclePhysXSteerState*& physxSteerState, + PxVehiclePhysXConstraints*& physxConstraints, + PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& wheelRigidBody1dStates, + PxVehicleEngineState*& engineState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehiclePhysXActorBeginComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleCommandState* commands; + const PxVehicleEngineDriveTransmissionCommandState* transmissionCommands; + const PxVehicleGearboxParams* gearParams; + const PxVehicleGearboxState* gearState; + const PxVehicleEngineParams* engineParams; + PxVehiclePhysXActor* physxActor; + PxVehiclePhysXSteerState* physxSteerState; + PxVehiclePhysXConstraints* physxConstraints; + PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData wheelRigidBody1dStates; + PxVehicleEngineState* engineState; + + getDataForPhysXActorBeginComponent(axleDescription, commands, transmissionCommands, + gearParams, gearState, engineParams, + physxActor, physxSteerState, physxConstraints, + rigidBodyState, wheelRigidBody1dStates, engineState); + + if (physxActor->rigidBody->getScene()) // Considering case where actor is not in a scene and constraints get solved via immediate mode + { + PxVehiclePhysxActorWakeup(*commands, transmissionCommands, gearParams, gearState, + *physxActor->rigidBody, *physxSteerState); + + if (PxVehiclePhysxActorSleepCheck(*axleDescription, *physxActor->rigidBody, engineParams, + *rigidBodyState, *physxConstraints, wheelRigidBody1dStates, engineState)) + { + return false; + } + } + + PxVehicleReadRigidBodyStateFromPhysXActor(*physxActor->rigidBody, *rigidBodyState); + + return true; + } +}; + +/** +\brief Work items at the end of an update step for a PhysX actor based vehicle. + +Includes: + - Writing vehicle internal state to the PhysX actor. + - Keeping the vehicle awake if certain criteria are met. +*/ +class PxVehiclePhysXActorEndComponent : public PxVehicleComponent +{ +public: + + PxVehiclePhysXActorEndComponent() : PxVehicleComponent() {} + virtual ~PxVehiclePhysXActorEndComponent() {} + + /** + \brief Provide vehicle data items for this component. + + \param[out] axleDescription identifies the wheels on each axle. + \param[out] rigidBodyState is the state of the rigid body used by the Vehicle SDK. + \param[out] wheelParams describes the radius, mass etc. of the wheels. + \param[out] wheelShapeLocalPoses are the local poses in the wheel's frame to apply to the PxShape instances that represent the wheel + \param[out] wheelRigidBody1dStates describes the angular speed of the wheels. + \param[out] wheelLocalPoses describes the local poses of the wheels in the rigid body frame. + \param[out] gearState The gear state. Can be set to NULL if the vehicle does + not have gears. + \param[out] throttle The throttle command state (see #PxVehicleCommandState). + Can be set to NULL if the vehicle is not controlled through + PxVehicleCommandState. + \param[out] physxActor is the PxRigidBody instance associated with the vehicle. + */ + virtual void getDataForPhysXActorEndComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& wheelShapeLocalPoses, + PxVehicleArrayData& wheelRigidBody1dStates, + PxVehicleArrayData& wheelLocalPoses, + const PxVehicleGearboxState*& gearState, + const PxReal*& throttle, + PxVehiclePhysXActor*& physxActor) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + + PX_PROFILE_ZONE("PxVehiclePhysXActorEndComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData wheelParams; + PxVehicleArrayData wheelShapeLocalPoses; + PxVehicleArrayData wheelRigidBody1dStates; + PxVehicleArrayData wheelLocalPoses; + const PxVehicleGearboxState* gearState; + const PxReal* throttle; + PxVehiclePhysXActor* physxActor; + + getDataForPhysXActorEndComponent(axleDescription, rigidBodyState, + wheelParams, wheelShapeLocalPoses, wheelRigidBody1dStates, wheelLocalPoses, gearState, throttle, + physxActor); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + PxVehicleWriteWheelLocalPoseToPhysXWheelShape(wheelLocalPoses[wheelId].localPose, wheelShapeLocalPoses[wheelId], + physxActor->wheelShapes[wheelId]); + } + + if (context.getType() == PxVehicleSimulationContextType::ePHYSX) + { + const PxVehiclePhysXSimulationContext& physxContext = static_cast(context); + + PxVehicleWriteRigidBodyStateToPhysXActor(physxContext.physxActorUpdateMode, *rigidBodyState, dt, *physxActor->rigidBody); + + PxVehiclePhysxActorKeepAwakeCheck(*axleDescription, wheelParams, wheelRigidBody1dStates, + physxContext.physxActorWakeCounterThreshold, physxContext.physxActorWakeCounterResetValue, gearState, throttle, + *physxActor->rigidBody); + } + else + { + PX_ALWAYS_ASSERT(); + } + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/physxActor/PxVehiclePhysXActorFunctions.h b/engine/third_party/physx/include/vehicle2/physxActor/PxVehiclePhysXActorFunctions.h new file mode 100644 index 00000000..0522d49d --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/physxActor/PxVehiclePhysXActorFunctions.h @@ -0,0 +1,196 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxTransform.h" + +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ + +class PxRigidBody; +class PxShape; + +namespace vehicle2 +{ +#endif + +struct PxVehicleCommandState; +struct PxVehicleEngineDriveTransmissionCommandState; +struct PxVehicleEngineParams; +struct PxVehicleEngineState; +struct PxVehicleGearboxParams; +struct PxVehicleGearboxState; +struct PxVehicleRigidBodyState; +struct PxVehiclePhysXConstraints; +struct PxVehicleWheelLocalPose; +struct PxVehicleWheelParams; +struct PxVehicleWheelRigidBody1dState; +struct PxVehiclePhysXSteerState; + +/** +\brief Wake up the physx actor if the actor is asleep and the commands signal an intent to +change the state of the vehicle. +\param[in] commands are the brake, throttle and steer values that will drive the vehicle. +\param[in] transmissionCommands are the target gear and clutch values that will control + the transmission. If the target gear is different from the current gearbox + target gear, then the physx actor will get woken up. Can be set to NULL if the + vehicle does not have a gearbox or if this is not a desired behavior. If + specified, then gearParams and gearState has to be specifed too. +\param[in] gearParams The gearbox parameters. Can be set to NULL if the vehicle does + not have a gearbox and transmissionCommands is NULL. +\param[in] gearState The state of the gearbox. Can be set to NULL if the vehicle does + not have a gearbox and transmissionCommands is NULL. +\param[in] physxActor is the PxRigidBody instance associated with the vehicle. +\param[in,out] physxSteerState and commands are compared to +determine if the steering state has changed since the last call to PxVehiclePhysxActorWakeup(). +\note If the steering has changed, the actor will be woken up. +\note On exit from PxVehiclePhysxActorWakeup, physxSteerState.previousSteerCommand is assigned to the value +of commands.steer so that the steer state may be propagated to the subsequent call to PxVehiclePhysxActorWakeup(). +\note If physxSteerState.previousSteerCommand has value PX_VEHICLE_UNSPECIFIED_STEER_STATE, the steering state +is treated as though it has not changed. +*/ +void PxVehiclePhysxActorWakeup( + const PxVehicleCommandState& commands, + const PxVehicleEngineDriveTransmissionCommandState* transmissionCommands, + const PxVehicleGearboxParams* gearParams, + const PxVehicleGearboxState* gearState, + PxRigidBody& physxActor, + PxVehiclePhysXSteerState& physxSteerState); + +/** +\brief Check if the physx actor is sleeping and clear certain vehicle states if it is. + +\param[in] axleDescription identifies the wheels on each axle. +\param[in] physxActor is the PxRigidBody instance associated with the vehicle. +\param[in] engineParams The engine parameters. Can be set to NULL if the vehicle does + not have an engine. Must be specified, if engineState is specified. +\param[in,out] rigidBodyState is the state of the rigid body used by the Vehicle SDK. +\param[in,out] physxConstraints The state of the suspension limit and low speed tire constraints. + If the vehicle actor is sleeping and constraints are active, they will be + deactivated and marked as dirty. +\param[in,out] wheelRigidBody1dStates describes the angular speed of the wheels. +\param[out] engineState The engine state. Can be set to NULL if the vehicle does + not have an engine. If specified, then engineParams has to be specifed too. + The engine rotation speed will get set to the idle rotation speed if + the actor is sleeping. +\return True if the actor was sleeping, else false. +*/ +bool PxVehiclePhysxActorSleepCheck +(const PxVehicleAxleDescription& axleDescription, + const PxRigidBody& physxActor, + const PxVehicleEngineParams* engineParams, + PxVehicleRigidBodyState& rigidBodyState, + PxVehiclePhysXConstraints& physxConstraints, + PxVehicleArrayData& wheelRigidBody1dStates, + PxVehicleEngineState* engineState); + +/** +\brief Check if the physx actor has to be kept awake. + +Certain criteria should keep the vehicle physx actor awake, for example, if the +(mass normalized) rotational kinetic energy of the wheels is above a certain +threshold or if a gear change is pending or if throttle is applied. +This method will reset the wake counter of the physx actor to a specified value, +if any of the mentioned criteria are met. + +\note The physx actor's sleep threshold will be used as threshold to test against + for the energy criteria. + +\param[in] axleDescription identifies the wheels on each axle. +\param[in] wheelParams describes the radius, mass etc. of the wheels. +\param[in] wheelRigidBody1dStates describes the angular speed of the wheels. +\param[in] wakeCounterThreshold Once the wake counter of the physx actor falls + below this threshold, the method will start testing if the wake + counter needs to be reset. +\param[in] wakeCounterResetValue The value to set the physx actor wake counter + to, if any of the criteria to do so are met. +\param[in] gearState The gear state. Can be set to NULL if the vehicle does + not have gears or if the mentioned behavior is not desired. +\param[in] throttle The throttle command state (see #PxVehicleCommandState). + Can be set to NULL if the vehicle is not controlled through + PxVehicleCommandState or if the mentioned behavior is not desired. +\param[in] physxActor is the PxRigidBody instance associated with the vehicle. +*/ +void PxVehiclePhysxActorKeepAwakeCheck +(const PxVehicleAxleDescription& axleDescription, + const PxVehicleArrayData& wheelParams, + const PxVehicleArrayData& wheelRigidBody1dStates, + const PxReal wakeCounterThreshold, + const PxReal wakeCounterResetValue, + const PxVehicleGearboxState* gearState, + const PxReal* throttle, + PxRigidBody& physxActor); + + +/** +\brief Read the rigid body state from a PhysX actor. +\param[in] physxActor is a reference to a PhysX actor. +\param[out] rigidBodyState is the state of the rigid body used by the Vehicle SDK. +*/ +void PxVehicleReadRigidBodyStateFromPhysXActor +(const PxRigidBody& physxActor, + PxVehicleRigidBodyState& rigidBodyState); + +/** +\brief Update the local pose of a PxShape that is associated with a wheel. +\param[in] wheelLocalPose describes the local pose of each wheel in the rigid body frame. +\param[in] wheelShapeLocalPose describes the local pose to apply to the PxShape instance in the wheel's frame. +\param[in] shape is the target PxShape. +*/ +void PxVehicleWriteWheelLocalPoseToPhysXWheelShape +(const PxTransform& wheelLocalPose, const PxTransform& wheelShapeLocalPose, PxShape* shape); + +/** +\brief Write the rigid body state to a PhysX actor. +\param[in] physxActorUpdateMode controls whether the PhysX actor is to be updated with +instantaneous velocity changes or with accumulated accelerations to be applied in +the next simulation step of the associated PxScene. +\param[in] rigidBodyState is the state of the rigid body. +\param[in] dt is the simulation time that has elapsed since the last call to +PxVehicleWriteRigidBodyStateToPhysXActor(). +\param[out] physXActor is a reference to the PhysX actor. +*/ +void PxVehicleWriteRigidBodyStateToPhysXActor +(const PxVehiclePhysXActorUpdateMode::Enum physxActorUpdateMode, + const PxVehicleRigidBodyState& rigidBodyState, + const PxReal dt, + PxRigidBody& physXActor); + + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/physxActor/PxVehiclePhysXActorHelpers.h b/engine/third_party/physx/include/vehicle2/physxActor/PxVehiclePhysXActorHelpers.h new file mode 100644 index 00000000..b663b761 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/physxActor/PxVehiclePhysXActorHelpers.h @@ -0,0 +1,205 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "PxFiltering.h" +#include "PxShape.h" + +#if !PX_DOXYGEN +namespace physx +{ + +class PxGeometry; +class PxMaterial; +struct PxCookingParams; + +namespace vehicle2 +{ +#endif + +struct PxVehicleRigidBodyParams; +struct PxVehicleAxleDescription; +struct PxVehicleWheelParams; +struct PxVehiclePhysXActor; +struct PxVehicleFrame; +struct PxVehicleSuspensionParams; + +class PxVehiclePhysXRigidActorParams +{ + PX_NOCOPY(PxVehiclePhysXRigidActorParams) + +public: + + PxVehiclePhysXRigidActorParams(const PxVehicleRigidBodyParams& _physxActorRigidBodyParams, const char* _physxActorName) + : rigidBodyParams(_physxActorRigidBodyParams), + physxActorName(_physxActorName) + { + } + + const PxVehicleRigidBodyParams& rigidBodyParams; + const char* physxActorName; +}; + +class PxVehiclePhysXRigidActorShapeParams +{ + PX_NOCOPY(PxVehiclePhysXRigidActorShapeParams) + +public: + + PxVehiclePhysXRigidActorShapeParams + (const PxGeometry& _geometry, const PxTransform& _localPose, const PxMaterial& _material, + const PxShapeFlags _flags, const PxFilterData& _simulationFilterData, const PxFilterData& _queryFilterData) + : geometry(_geometry), + localPose(_localPose), + material(_material), + flags(_flags), + simulationFilterData(_simulationFilterData), + queryFilterData(_queryFilterData) + { + } + + const PxGeometry& geometry; + const PxTransform& localPose; + const PxMaterial& material; + PxShapeFlags flags; + PxFilterData simulationFilterData; + PxFilterData queryFilterData; +}; + +class PxVehiclePhysXWheelParams +{ + PX_NOCOPY(PxVehiclePhysXWheelParams) + +public: + + PxVehiclePhysXWheelParams(const PxVehicleAxleDescription& _axleDescription, const PxVehicleWheelParams* _wheelParams) + : axleDescription(_axleDescription), + wheelParams(_wheelParams) + { + } + + const PxVehicleAxleDescription& axleDescription; + const PxVehicleWheelParams* wheelParams; +}; + +class PxVehiclePhysXWheelShapeParams +{ + PX_NOCOPY(PxVehiclePhysXWheelShapeParams) + +public: + + PxVehiclePhysXWheelShapeParams(const PxMaterial& _material, const PxShapeFlags _flags, const PxFilterData _simulationFilterData, const PxFilterData _queryFilterData) + : material(_material), + flags(_flags), + simulationFilterData(_simulationFilterData), + queryFilterData(_queryFilterData) + { + } + + const PxMaterial& material; + PxShapeFlags flags; + PxFilterData simulationFilterData; + PxFilterData queryFilterData; +}; + +/** +\brief Create a PxRigidDynamic instance, instantiate it with desired properties and populate it with PxShape instances. +\param[in] vehicleFrame describes the frame of the vehicle. +\param[in] rigidActorParams describes the mass and moment of inertia of the rigid body. +\param[in] rigidActorCmassLocalPose specifies the mapping between actor and rigid body frame. +\param[in] rigidActorShapeParams describes the collision geometry associated with the rigid body. +\param[in] wheelParams describes the radius and half-width of the wheels. +\param[in] wheelShapeParams describes the PxMaterial and PxShapeFlags to apply to the wheel shapes. +\param[in] physics is a PxPhysics instance. +\param[in] params is a PxCookingParams instance +\param[in] vehiclePhysXActor is a record of the PxRigidDynamic and PxShape instances instantiated. +\note This is an alternative to PxVehiclePhysXArticulationLinkCreate. +\note PxVehiclePhysXActorCreate primarily serves as an illustration of the instantiation of the PhysX class instances +required to simulate a vehicle with a PxRigidDynamic. +\see PxVehiclePhysXActorDestroy +*/ +void PxVehiclePhysXActorCreate +(const PxVehicleFrame& vehicleFrame, + const PxVehiclePhysXRigidActorParams& rigidActorParams, const PxTransform& rigidActorCmassLocalPose, + const PxVehiclePhysXRigidActorShapeParams& rigidActorShapeParams, + const PxVehiclePhysXWheelParams& wheelParams, const PxVehiclePhysXWheelShapeParams& wheelShapeParams, + PxPhysics& physics, const PxCookingParams& params, + PxVehiclePhysXActor& vehiclePhysXActor); + + +/** +\brief Configure an actor so that it is ready for vehicle simulation. +\param[in] rigidActorParams describes the mass and moment of inertia of the rigid body. +\param[in] rigidActorCmassLocalPose specifies the mapping between actor and rigid body frame. +\param[out] rigidBody is the body to be prepared for simulation. +*/ +void PxVehiclePhysXActorConfigure +(const PxVehiclePhysXRigidActorParams& rigidActorParams, const PxTransform& rigidActorCmassLocalPose, + PxRigidBody& rigidBody); + +/** +\brief Create a PxArticulationReducedCoordinate and a single PxArticulationLink, +instantiate the PxArticulationLink with desired properties and populate it with PxShape instances. +\param[in] vehicleFrame describes the frame of the vehicle. +\param[in] rigidActorParams describes the mass and moment of inertia of the rigid body. +\param[in] rigidActorCmassLocalPose specifies the mapping between actor and rigid body frame. +\param[in] rigidActorShapeParams describes the collision geometry associated with the rigid body. +\param[in] wheelParams describes the radius and half-width of the wheels. +\param[in] wheelShapeParams describes the PxMaterial and PxShapeFlags to apply to the wheel shapes. +\param[in] physics is a PxPhysics instance. +\param[in] params is a PxCookingParams instance +\param[in] vehiclePhysXActor is a record of the PxArticulationReducedCoordinate, PxArticulationLink and PxShape instances instantiated. +\note This is an alternative to PxVehiclePhysXActorCreate. +\note PxVehiclePhysXArticulationLinkCreate primarily serves as an illustration of the instantiation of the PhysX class instances +required to simulate a vehicle as part of an articulated ensemble. +\see PxVehiclePhysXActorDestroy +*/ +void PxVehiclePhysXArticulationLinkCreate +(const PxVehicleFrame& vehicleFrame, + const PxVehiclePhysXRigidActorParams& rigidActorParams, const PxTransform& rigidActorCmassLocalPose, + const PxVehiclePhysXRigidActorShapeParams& rigidActorShapeParams, + const PxVehiclePhysXWheelParams& wheelParams, const PxVehiclePhysXWheelShapeParams& wheelShapeParams, + PxPhysics& physics, const PxCookingParams& params, + PxVehiclePhysXActor& vehiclePhysXActor); + +/** +\brief Release the PxRigidDynamic, PxArticulationReducedCoordinate, PxArticulationLink and PxShape instances +instantiated by PxVehiclePhysXActorCreate or PxVehiclePhysXArticulationLinkCreate. +\param[in] vehiclePhysXActor is a description of the PhysX instances to be released. +*/ +void PxVehiclePhysXActorDestroy(PxVehiclePhysXActor& vehiclePhysXActor); + + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/physxActor/PxVehiclePhysXActorStates.h b/engine/third_party/physx/include/vehicle2/physxActor/PxVehiclePhysXActorStates.h new file mode 100644 index 00000000..894b56ae --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/physxActor/PxVehiclePhysXActorStates.h @@ -0,0 +1,94 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxMemory.h" + +#include "PxRigidBody.h" + +#include "vehicle2/PxVehicleLimits.h" + +#if !PX_DOXYGEN +namespace physx +{ + +class PxShape; + +namespace vehicle2 +{ +#endif + +/** +\brief A description of the PhysX actor and shapes that represent the vehicle in an associated PxScene. +*/ +struct PxVehiclePhysXActor +{ + /** + \brief The PhysX rigid body that represents the vehcle in the associated PhysX scene. + \note PxActorFlag::eDISABLE_GRAVITY must be set true on the PxRigidBody + */ + PxRigidBody* rigidBody; + + /** + \brief An array of shapes with one shape pointer (or NULL) for each wheel. + */ + PxShape* wheelShapes[PxVehicleLimits::eMAX_NB_WHEELS]; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehiclePhysXActor)); + } +}; + + +#define PX_VEHICLE_UNSPECIFIED_STEER_STATE PX_MAX_F32 + +/** +\brief A description of the previous steer command applied to the vehicle. +*/ +struct PxVehiclePhysXSteerState +{ + + /** + \brief The steer command that was most previously applied to the vehicle. + */ + PxReal previousSteerCommand; + + PX_FORCE_INLINE void setToDefault() + { + previousSteerCommand = PX_VEHICLE_UNSPECIFIED_STEER_STATE; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintComponents.h b/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintComponents.h new file mode 100644 index 00000000..84545459 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintComponents.h @@ -0,0 +1,119 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionStates.h" + +#include "PxVehiclePhysXConstraintFunctions.h" +#include "PxVehiclePhysXConstraintHelpers.h" +#include "PxVehiclePhysXConstraintStates.h" +#include "PxVehiclePhysXConstraintParams.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +class PxVehiclePhysXConstraintComponent : public PxVehicleComponent +{ +public: + PxVehiclePhysXConstraintComponent() : PxVehicleComponent() {} + virtual ~PxVehiclePhysXConstraintComponent() {} + + virtual void getDataForPhysXConstraintComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& suspensionParams, + PxVehicleArrayData& suspensionLimitParams, + PxVehicleArrayData& suspensionStates, + PxVehicleArrayData& suspensionComplianceStates, + PxVehicleArrayData& wheelRoadGeomStates, + PxVehicleArrayData& tireDirectionStates, + PxVehicleArrayData& tireStickyStates, + PxVehiclePhysXConstraints*& constraints) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehiclePhysXConstraintComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData suspensionParams; + PxVehicleArrayData suspensionLimitParams; + PxVehicleArrayData suspensionStates; + PxVehicleArrayData suspensionComplianceStates; + PxVehicleArrayData wheelRoadGeomStates; + PxVehicleArrayData tireDirectionStates; + PxVehicleArrayData tireStickyStates; + PxVehiclePhysXConstraints* constraints; + + getDataForPhysXConstraintComponent(axleDescription, rigidBodyState, + suspensionParams, suspensionLimitParams, suspensionStates, suspensionComplianceStates, + wheelRoadGeomStates, tireDirectionStates, tireStickyStates, + constraints); + + PxVehicleConstraintsDirtyStateUpdate(*constraints); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + PxVehiclePhysXConstraintStatesUpdate( + suspensionParams[wheelId], suspensionLimitParams[wheelId], + suspensionStates[wheelId], suspensionComplianceStates[wheelId], + wheelRoadGeomStates[wheelId].plane.n, + context.tireStickyParams.stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL].damping, + context.tireStickyParams.stickyParams[PxVehicleTireDirectionModes::eLATERAL].damping, + tireDirectionStates[wheelId], tireStickyStates[wheelId], + *rigidBodyState, + constraints->constraintStates[wheelId]); + } + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintFunctions.h b/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintFunctions.h new file mode 100644 index 00000000..2aa05e4f --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintFunctions.h @@ -0,0 +1,88 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleSuspensionParams; +struct PxVehiclePhysXSuspensionLimitConstraintParams; +struct PxVehicleSuspensionState; +struct PxVehicleSuspensionComplianceState; +struct PxVehicleTireDirectionState; +struct PxVehicleTireStickyState; +struct PxVehicleRigidBodyState; +struct PxVehiclePhysXConstraintState; + +/** +\brief Read constraint data from the vehicle's internal state for a single wheel and write it to a +structure that will be read by the associated PxScene and used to impose the constraints during the next +PxScene::simulate() step. +\param[in] suspensionParams describes the suspension frame. +\param[in] suspensionLimitParams describes the restitution value applied to any constraint triggered by +the suspension travel limit. +\param[in] suspensionState describes the excess suspension compression beyond the suspension travel limit that will be +resolved with a constraint. +\param[in] suspensionComplianceState describes the effect of suspension compliance on the effective application point +of the suspension force. +\param[in] groundPlaneNormal The normal direction of the ground plane the wheel is driving on. A normalized vector is + expected. +\param[in] tireStickyDampingLong The damping coefficient to use in the constraint to approach a zero target velocity + along the longitudinal tire axis. +\param[in] tireStickyDampingLat Same concept as tireStickyDampingLong but for the lateral tire axis. +\param[in] tireDirectionState describes the longitudinal and lateral directions of the tire in the world frame. +\param[in] tireStickyState describes the low speed state of the tire in the longitudinal and lateral directions. +\param[in] rigidBodyState describes the pose of the rigid body. +\param[out] constraintState is the data structure that will be read by the associated PxScene in the next call to +PxScene::simulate(). +\note Constraints include suspension constraints to account for suspension travel limit and sticky +tire constraints that bring the vehicle to rest at low longitudinal and lateral speed. +*/ +void PxVehiclePhysXConstraintStatesUpdate +(const PxVehicleSuspensionParams& suspensionParams, + const PxVehiclePhysXSuspensionLimitConstraintParams& suspensionLimitParams, + const PxVehicleSuspensionState& suspensionState, const PxVehicleSuspensionComplianceState& suspensionComplianceState, + const PxVec3& groundPlaneNormal, + const PxReal tireStickyDampingLong, const PxReal tireStickyDampingLat, + const PxVehicleTireDirectionState& tireDirectionState, const PxVehicleTireStickyState& tireStickyState, + const PxVehicleRigidBodyState& rigidBodyState, + PxVehiclePhysXConstraintState& constraintState); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintHelpers.h b/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintHelpers.h new file mode 100644 index 00000000..de3af744 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintHelpers.h @@ -0,0 +1,88 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "foundation/PxPreprocessor.h" + + +#if !PX_DOXYGEN +namespace physx +{ + +class PxPhysics; +class PxRigidBody; + +namespace vehicle2 +{ +#endif + +struct PxVehicleAxleDescription; +struct PxVehiclePhysXConstraints; + +/** +\brief Instantiate the PhysX custom constraints. + +Custom constraints will resolve excess suspension compression and velocity constraints that serve as +a replacement low speed tire model. + +\param[in] axleDescription describes the axles of the vehicle and the wheels on each axle. +\param[in] physics is a PxPhysics instance. +\param[in] physxActor is the vehicle's PhysX representation as a PxRigidBody +\param[in] vehicleConstraints is a wrapper class that holds pointers to PhysX objects required to implement the custom constraint. +*/ +void PxVehicleConstraintsCreate +(const PxVehicleAxleDescription& axleDescription, + PxPhysics& physics, PxRigidBody& physxActor, + PxVehiclePhysXConstraints& vehicleConstraints); + +/** +\brief To ensure the constraints are processed by the PhysX scene they are marked as dirty prior to each simulate step. + +\param[in] vehicleConstraints is a wrapper class that holds pointers to PhysX objects required to implement the custom constraint. + +\see PxVehicleConstraintsCreate +*/ +void PxVehicleConstraintsDirtyStateUpdate +(PxVehiclePhysXConstraints& vehicleConstraints); + +/** +\brief Destroy the PhysX custom constraints. + +\param[in,out] vehicleConstraints describes the PhysX custom constraints to be released. + +\see PxVehicleConstraintsCreate +*/ +void PxVehicleConstraintsDestroy +(PxVehiclePhysXConstraints& vehicleConstraints); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintParams.h b/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintParams.h new file mode 100644 index 00000000..d882a7d7 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintParams.h @@ -0,0 +1,106 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxFoundation.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleFrame; +struct PxVehicleScale; + +/** +\brief A description of the PhysX models employed to resolve suspension limit constraints. +\see PxVehiclePhysXConstraintState +*/ +struct PxVehiclePhysXSuspensionLimitConstraintParams +{ + /** + \brief restitution is used by the restitution model used to generate a target velocity when resolving suspension limit + constraints. + \note A value of 0.0 means that the restitution model is not employed. + \note Restitution has no effect if directionForSuspensionLimitConstraint has value Enum::eNONE. + \see Px1DConstraintFlag::eRESTITUTION + \see Px1DConstraint::RestitutionModifiers::restitution + */ + PxReal restitution; + + /** + \brief Set the direction to apply a constraint impulse when the suspension cannot place the wheel on the ground + and simultaneously respect the limits of suspension travel. The choices are to push along the ground normal to resolve the + geometric error or to push along the suspension direction. The former choice can be thought of as mimicing a force applied + by the tire's contact with the ground, while the latter can be thought of as mimicing a force arising from a suspension limit spring. + When the ground normal and the suspension direction are approximately aligned, both do an equivalent job of maintaining the wheel above + the ground. When the vehicle is on its side, eSUSPENSION does a better job of keeping the wheels above + the ground but comes at the cost of an unnaturally strong torque that can lead to unwanted self-righting behaviour. + eROAD_GEOMETRY_NORMAL is a good choice to avoid self-righting behaviour and still do a reasonable job at maintaining + the wheel above the ground in the event that the vehicle is tending towards a roll onto its side. + eNONE should be chosen if it is desired that no extra impulse is applied when the suspension alone cannot keep the wheels above + the ground plane. + */ + enum DirectionSpecifier + { + eSUSPENSION, + eROAD_GEOMETRY_NORMAL, + eNONE + }; + DirectionSpecifier directionForSuspensionLimitConstraint; + + PX_FORCE_INLINE PxVehiclePhysXSuspensionLimitConstraintParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL( + PxVehiclePhysXSuspensionLimitConstraintParams::eSUSPENSION == directionForSuspensionLimitConstraint || + PxVehiclePhysXSuspensionLimitConstraintParams::eROAD_GEOMETRY_NORMAL == directionForSuspensionLimitConstraint || + PxVehiclePhysXSuspensionLimitConstraintParams::eNONE == directionForSuspensionLimitConstraint, "PxVehiclePhysXSuspensionLimitConstraintParams.directionForSuspensionLimitConstraint must have legal value", false); + PX_CHECK_AND_RETURN_VAL(restitution >= 0.0f && restitution <= 1.0f, "PxVehiclePhysXSuspensionLimitConstraintParams.restitution must be in range [0, 1]", false); + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h b/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h new file mode 100644 index 00000000..3b825b5d --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h @@ -0,0 +1,353 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "foundation/PxAssert.h" +#include "foundation/PxTransform.h" +#include "extensions/PxConstraintExt.h" + +#include "vehicle2/PxVehicleLimits.h" +#include "vehicle2/tire/PxVehicleTireStates.h" + +#include "PxConstraint.h" +#include "PxConstraintDesc.h" + +#if !PX_DOXYGEN +namespace physx +{ + +class PxConstraint; + +namespace vehicle2 +{ +#endif + + +/** +\brief A description of the number of PxConstraintConnector instances per vehicle required to maintain suspension limit +and sticky tire instances. +*/ +struct PxVehiclePhysXConstraintLimits +{ + enum Enum + { + eNB_DOFS_PER_PXCONSTRAINT = 12, + eNB_DOFS_PER_WHEEL = 3, + eNB_WHEELS_PER_PXCONSTRAINT = eNB_DOFS_PER_PXCONSTRAINT / eNB_DOFS_PER_WHEEL, + eNB_CONSTRAINTS_PER_VEHICLE = (PxVehicleLimits::eMAX_NB_WHEELS + (eNB_WHEELS_PER_PXCONSTRAINT - 1)) / (eNB_WHEELS_PER_PXCONSTRAINT) + }; +}; + +/** +\brief PxVehiclePhysXConstraintState is a data structure used to write +constraint data to the internal state of the associated PxScene. +\see Px1dConstraint +*/ +struct PxVehiclePhysXConstraintState +{ + /** + \brief a boolean describing whether to trigger a low speed constraint along the tire longitudinal and lateral directions. + */ + bool tireActiveStatus[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + /** + \brief linear component of velocity jacobian in world space for the tire's longitudinal and lateral directions. + */ + PxVec3 tireLinears[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + /** + \brief angular component of velocity jacobian in world space for the tire's longitudinal and lateral directions. + */ + PxVec3 tireAngulars[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + /** + \brief damping coefficient applied to the tire's longitudinal and lateral velocities. + + The constraint sets a target velocity of 0 and the damping coefficient will impact the size of the + impulse applied to reach the target. Since damping acts as a stiffness with respect to the velocity, + too large a value can cause instabilities. + */ + PxReal tireDamping[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + + /** + \brief a boolean describing whether to trigger a suspension limit constraint. + */ + bool suspActiveStatus; + /** + \brief linear component of velocity jacobian in the world frame. + */ + PxVec3 suspLinear; + /** + \brief angular component of velocity jacobian in the world frame. + */ + PxVec3 suspAngular; + /** + \brief the excess suspension compression to be resolved by the constraint that cannot be resolved due to the travel limit + of the suspension spring. + + \note The expected error value is the excess suspension compression projected onto the ground plane normal and should have + a negative sign. + */ + PxReal suspGeometricError; + /** + \brief restitution value of the restitution model used to generate a target velocity that will resolve the geometric error. + \note A value of 0.0 means that the restitution model is not employed. + \see Px1DConstraintFlag::eRESTITUTION + \see Px1DConstraint::RestitutionModifiers::restitution + */ + PxReal restitution; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehiclePhysXConstraintState)); + } +}; + +//TAG:solverprepshader +PX_FORCE_INLINE PxU32 vehicleConstraintSolverPrep +(Px1DConstraint* constraints, + PxVec3p& body0WorldOffset, + PxU32 maxConstraints, + PxConstraintInvMassScale&, + const void* constantBlock, + const PxTransform& bodyAToWorld, + const PxTransform& bodyBToWorld, + bool, + PxVec3p& cA2w, PxVec3p& cB2w) +{ + PX_UNUSED(maxConstraints); + PX_UNUSED(body0WorldOffset); + PX_UNUSED(bodyBToWorld); + PX_ASSERT(bodyAToWorld.isValid()); PX_ASSERT(bodyBToWorld.isValid()); + + const PxVehiclePhysXConstraintState* data = static_cast(constantBlock); + PxU32 numActive = 0; + + //KS - the TGS solver will use raXn to try to add to the angular part of the linear constraints. + //We overcome this by setting the ra and rb offsets to be 0. + cA2w = bodyAToWorld.p; + cB2w = bodyBToWorld.p; + // note: this is only needed for PxSolverType::eTGS and even then it should not have an effect as + // long as a constraint raises Px1DConstraintFlag::eANGULAR_CONSTRAINT + + //Susp limit constraints. + for (PxU32 i = 0; i < PxVehiclePhysXConstraintLimits::eNB_WHEELS_PER_PXCONSTRAINT; i++) + { + if (data[i].suspActiveStatus) + { + // Going beyond max suspension compression should be treated similar to rigid body contacts. + // Thus setting up constraints that try to emulate such contacts. + // + // linear l = contact normal = n + // angular a = suspension force application offset x contact normal = cross(r, n) + // + // velocity at contact: + // vl: part from linear vehicle velocity v + // vl = dot(n, v) = dot(l, v) + // + // va: part from angular vehicle velocity w + // va = dot(n, cross(w, r)) = dot(w, cross(r, n)) = dot(w, a) + // + // ve: part from excess suspension compression + // ve = (geomError / dt) (note: geomError is expected to be negative here) + // + // velocity target vt = vl + va + ve + // => should become 0 by applying positive impulse along l. If vt is positive, + // nothing will happen as a negative impulse would have to be applied (but + // min impulse is set to 0). If vt is negative, a positive impulse will get + // applied to push vt towards 0. + // + + Px1DConstraint& p = constraints[numActive]; + p.linear0 = data[i].suspLinear; + p.angular0 = data[i].suspAngular; + p.geometricError = data[i].suspGeometricError; + p.linear1 = PxVec3(0); + p.angular1 = PxVec3(0); + p.minImpulse = 0; + p.maxImpulse = FLT_MAX; + p.velocityTarget = 0; + p.solveHint = PxConstraintSolveHint::eINEQUALITY; + + // note: this is only needed for PxSolverType::eTGS to not have the angular part + // be modified based on the linear part during substeps. Basically, it will + // disable the constraint re-projection etc. to emulate PxSolverType::ePGS. + p.flags |= Px1DConstraintFlag::eANGULAR_CONSTRAINT; + + if (data[i].restitution > 0.0f) + { + p.flags |= Px1DConstraintFlag::eRESTITUTION; + p.mods.bounce.restitution = data[i].restitution; + p.mods.bounce.velocityThreshold = -FLT_MAX; + } + numActive++; + } + } + + //Sticky tire friction constraints. + for (PxU32 i = 0; i < PxVehiclePhysXConstraintLimits::eNB_WHEELS_PER_PXCONSTRAINT; i++) + { + if (data[i].tireActiveStatus[PxVehicleTireDirectionModes::eLONGITUDINAL]) + { + Px1DConstraint& p = constraints[numActive]; + p.linear0 = data[i].tireLinears[PxVehicleTireDirectionModes::eLONGITUDINAL]; + p.angular0 = data[i].tireAngulars[PxVehicleTireDirectionModes::eLONGITUDINAL]; + p.geometricError = 0.0f; + p.linear1 = PxVec3(0); + p.angular1 = PxVec3(0); + p.minImpulse = -FLT_MAX; + p.maxImpulse = FLT_MAX; + p.velocityTarget = 0.0f; + p.mods.spring.damping = data[i].tireDamping[PxVehicleTireDirectionModes::eLONGITUDINAL]; + // note: no stiffness specified as this will have no effect with geometricError=0 + p.flags = Px1DConstraintFlag::eSPRING | Px1DConstraintFlag::eACCELERATION_SPRING; + p.flags |= Px1DConstraintFlag::eANGULAR_CONSTRAINT; // see explanation of same flag usage further above + numActive++; + } + } + + //Sticky tire friction constraints. + for (PxU32 i = 0; i < PxVehiclePhysXConstraintLimits::eNB_WHEELS_PER_PXCONSTRAINT; i++) + { + if (data[i].tireActiveStatus[PxVehicleTireDirectionModes::eLATERAL]) + { + Px1DConstraint& p = constraints[numActive]; + p.linear0 = data[i].tireLinears[PxVehicleTireDirectionModes::eLATERAL]; + p.angular0 = data[i].tireAngulars[PxVehicleTireDirectionModes::eLATERAL]; + p.geometricError = 0.0f; + p.linear1 = PxVec3(0); + p.angular1 = PxVec3(0); + p.minImpulse = -FLT_MAX; + p.maxImpulse = FLT_MAX; + p.velocityTarget = 0.0f; + p.mods.spring.damping = data[i].tireDamping[PxVehicleTireDirectionModes::eLATERAL]; + // note: no stiffness specified as this will have no effect with geometricError=0 + p.flags = Px1DConstraintFlag::eSPRING | Px1DConstraintFlag::eACCELERATION_SPRING; + p.flags |= Px1DConstraintFlag::eANGULAR_CONSTRAINT; // see explanation of same flag usage further above + numActive++; + } + } + + return numActive; +} + +PX_FORCE_INLINE void visualiseVehicleConstraint +(PxConstraintVisualizer &viz, + const void* constantBlock, + const PxTransform& body0Transform, + const PxTransform& body1Transform, + PxU32 flags) +{ + PX_UNUSED(&viz); + PX_UNUSED(constantBlock); + PX_UNUSED(body0Transform); + PX_UNUSED(body1Transform); + PX_UNUSED(flags); + PX_ASSERT(body0Transform.isValid()); + PX_ASSERT(body1Transform.isValid()); +} + +class PxVehicleConstraintConnector : public PxConstraintConnector +{ +public: + + PxVehicleConstraintConnector() : mVehicleConstraintState(NULL) {} + PxVehicleConstraintConnector(PxVehiclePhysXConstraintState* vehicleConstraintState) : mVehicleConstraintState(vehicleConstraintState) {} + ~PxVehicleConstraintConnector() {} + + void setConstraintState(PxVehiclePhysXConstraintState* constraintState) { mVehicleConstraintState = constraintState; } + + virtual void* prepareData() { return mVehicleConstraintState; } + virtual const void* getConstantBlock() const { return mVehicleConstraintState; } + virtual PxConstraintSolverPrep getPrep() const { return vehicleConstraintSolverPrep; } + + //Is this necessary if physx no longer supports double-buffering? + virtual void onConstraintRelease() { } + + //Can be empty functions. + virtual bool updatePvdProperties(physx::pvdsdk::PvdDataStream& pvdConnection, const PxConstraint* c, PxPvdUpdateType::Enum updateType) const + { + PX_UNUSED(pvdConnection); + PX_UNUSED(c); + PX_UNUSED(updateType); + return true; + } + virtual void updateOmniPvdProperties() const { } + virtual void onComShift(PxU32 actor) { PX_UNUSED(actor); } + virtual void onOriginShift(const PxVec3& shift) { PX_UNUSED(shift); } + virtual void* getExternalReference(PxU32& typeID) { typeID = PxConstraintExtIDs::eVEHICLE_JOINT; return this; } + virtual PxBase* getSerializable() { return NULL; } + +private: + + PxVehiclePhysXConstraintState* mVehicleConstraintState; +}; + +/** +\brief A mapping between constraint state data and the associated PxConstraint instances. +*/ +struct PxVehiclePhysXConstraints +{ + /** + \brief PxVehiclePhysXConstraintComponent writes to the constraintStates array and a + callback invoked by PxScene::simulate() reads a portion from it for a block of wheels + and writes that portion to an associated PxConstraint instance. + */ + PxVehiclePhysXConstraintState constraintStates[PxVehicleLimits::eMAX_NB_WHEELS]; + + /** + \brief PxVehiclePhysXConstraintComponent writes to the constraintStates array and a + callback invoked by PxScene::simulate() reads a portion from it for a block of wheels + and writes that portion to an associated PxConstraint instance. + */ + PxConstraint* constraints[PxVehiclePhysXConstraintLimits::eNB_CONSTRAINTS_PER_VEHICLE]; + + /** + \brief A constraint connector is necessary to connect each PxConstraint to a portion of the constraintStates array. + */ + PxVehicleConstraintConnector* constraintConnectors[PxVehiclePhysXConstraintLimits::eNB_CONSTRAINTS_PER_VEHICLE]; + + PX_FORCE_INLINE void setToDefault() + { + for (PxU32 i = 0; i < PxVehicleLimits::eMAX_NB_WHEELS; i++) + { + constraintStates[i].setToDefault(); + } + for(PxU32 i = 0; i < PxVehiclePhysXConstraintLimits::eNB_CONSTRAINTS_PER_VEHICLE; i++) + { + constraints[i] = NULL; + constraintConnectors[i] = NULL; + } + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + + diff --git a/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryComponents.h b/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryComponents.h new file mode 100644 index 00000000..e93b892c --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryComponents.h @@ -0,0 +1,144 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "vehicle2/commands/PxVehicleCommandHelpers.h" +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/wheel/PxVehicleWheelParams.h" + +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryFunctions.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +class PxVehiclePhysXRoadGeometrySceneQueryComponent : public PxVehicleComponent +{ +public: + PxVehiclePhysXRoadGeometrySceneQueryComponent() : PxVehicleComponent() {} + virtual ~PxVehiclePhysXRoadGeometrySceneQueryComponent() {} + + /** + \brief Provide vehicle data items for this component. + + \param[out] axleDescription identifies the wheels on each axle. + \param[out] roadGeomParams The road geometry parameters of the vehicle. + \param[out] steerResponseStates The steer response state of the wheels. + \param[out] rigidBodyState The pose, velocity etc. of the vehicle rigid body. + \param[out] wheelParams The wheel parameters for the wheels. + \param[out] suspensionParams The suspension parameters for the wheels. + \param[out] materialFrictionParams The tire friction tables for the wheels. + \param[out] roadGeometryStates The detected ground surface plane, friction value etc. for the wheels. + \param[out] physxRoadGeometryStates Optional buffer to store additional information about the query (like actor/shape that got hit etc.). + Set to empty if not desired. + */ + virtual void getDataForPhysXRoadGeometrySceneQueryComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehiclePhysXRoadGeometryQueryParams*& roadGeomParams, + PxVehicleArrayData& steerResponseStates, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& suspensionParams, + PxVehicleArrayData& materialFrictionParams, + PxVehicleArrayData& roadGeometryStates, + PxVehicleArrayData& physxRoadGeometryStates) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + + PX_PROFILE_ZONE("PxVehiclePhysXRoadGeometrySceneQueryComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehiclePhysXRoadGeometryQueryParams* roadGeomParams; + PxVehicleArrayData steerResponseStates; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData wheelParams; + PxVehicleArrayData suspensionParams; + PxVehicleArrayData materialFrictionParams; + PxVehicleArrayData roadGeometryStates; + PxVehicleArrayData physxRoadGeometryStates; + + getDataForPhysXRoadGeometrySceneQueryComponent(axleDescription, + roadGeomParams, steerResponseStates, rigidBodyState, + wheelParams, suspensionParams, materialFrictionParams, + roadGeometryStates, physxRoadGeometryStates); + + if (context.getType() == PxVehicleSimulationContextType::ePHYSX) + { + const PxVehiclePhysXSimulationContext& physxContext = static_cast(context); + + for(PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + const PxQueryFilterData* fdPtr = roadGeomParams->filterDataEntries ? (roadGeomParams->filterDataEntries + wheelId) : &roadGeomParams->defaultFilterData; + + PxVehiclePhysXRoadGeometryQueryUpdate( + wheelParams[wheelId], suspensionParams[wheelId], + roadGeomParams->roadGeometryQueryType, roadGeomParams->filterCallback, *fdPtr, + materialFrictionParams[wheelId], + steerResponseStates[wheelId], *rigidBodyState, + *physxContext.physxScene, physxContext.physxUnitCylinderSweepMesh, context.frame, + roadGeometryStates[wheelId], + !physxRoadGeometryStates.isEmpty() ? &physxRoadGeometryStates[wheelId] : NULL); + } + } + else + { + PX_ALWAYS_ASSERT(); + + for(PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + roadGeometryStates[wheelId].setToDefault(); + } + } + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryFunctions.h b/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryFunctions.h new file mode 100644 index 00000000..2b5876a4 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryFunctions.h @@ -0,0 +1,91 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxSimpleTypes.h" + +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +class PxScene; +class PxConvexMesh; + +namespace vehicle2 +{ +#endif + +struct PxVehicleWheelParams; +struct PxVehicleSuspensionParams; +struct PxVehiclePhysXRoadGeometryQueryState; +struct PxVehicleRigidBodyState; +struct PxVehicleFrame; +struct PxVehicleRoadGeometryState; + +/** +\brief Compute the plane of the road geometry under a wheel and the tire friction of the contact. +\param[in] wheelParams describes the radius and halfwidth of the wheel. +\param[in] suspParams describes the frame of the suspension and wheel and the maximum suspension travel. +\param[in] queryType describes what type of PhysX scene query to use (see #PxVehiclePhysXRoadGeometryQueryType). + If PxVehiclePhysXRoadGeometryQueryType::eNONE is used, no work will be done. +\param[in] filterCallback describes the filter callback to use for the PhysX scene query. NULL is a valid input. +\param[in] filterData describes the filter data to use for the PhysX scene query. +\param[in] materialFrictionParams describes a mapping between PxMaterial and friction in order to compute a tire friction value. +\param[in] wheelYawAngle is the yaw angle (in radians) of the wheel. +\param[in] rigidBodyState describes the pose of the rigid body. +\param[in] scene is the PhysX scene that will be queried by the scene query. +\param[in] unitCylinderSweepMesh is a convex cylindrical mesh of unit radius and half-width to be used in +the event that a sweep query is to be used. +\param[in] frame describes the lateral, longitudinal and vertical axes and is used to scale unitCylinderSweepMesh +by the wheel's radius and half-width. +\param[out] roadGeomState contains the plane and friction of the road geometry under the wheel. +\param[out] physxRoadGeometryState Optional buffer to store additional information about the query (like actor/shape that got hit etc.). + Set to NULL if not needed. +\note PxVehicleRoadGeometryState::hitState will have value false in the event that the there is no reachable road geometry under the wheel and +true if there is reachable road geometry under the wheel. Road geometry is considered reachable if the suspension can elongate from its +reference pose far enough to place wheel on the ground. +*/ +void PxVehiclePhysXRoadGeometryQueryUpdate +(const PxVehicleWheelParams& wheelParams, const PxVehicleSuspensionParams& suspParams, + const PxVehiclePhysXRoadGeometryQueryType::Enum queryType, + PxQueryFilterCallback* filterCallback, const PxQueryFilterData& filterData, + const PxVehiclePhysXMaterialFrictionParams& materialFrictionParams, + const PxReal wheelYawAngle, const PxVehicleRigidBodyState& rigidBodyState, + const PxScene& scene, const PxConvexMesh* unitCylinderSweepMesh, + const PxVehicleFrame& frame, + PxVehicleRoadGeometryState& roadGeomState, + PxVehiclePhysXRoadGeometryQueryState* physxRoadGeometryState); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryHelpers.h b/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryHelpers.h new file mode 100644 index 00000000..f80959e7 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryHelpers.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxPreprocessor.h" + +#if !PX_DOXYGEN +namespace physx +{ + +class PxConvexMesh; +class PxPhysics; +struct PxCookingParams; + +namespace vehicle2 +{ +#endif + +struct PxVehicleFrame; + +/** +\brief Create a cylindrical mesh with unit radius and half-width. +\param[in] vehicleFrame is a description of the lateral and longitudinal axes. +\param[in] physics is a PxPhysics instance. +\param[in] params is a PxCookingParams instance +\return Return a PxConvexMesh instance that represents a convex hull with unit radius and half-width. +\see PxVehicleUnitCylinderSweepMeshDestroy +*/ +PxConvexMesh* PxVehicleUnitCylinderSweepMeshCreate(const PxVehicleFrame& vehicleFrame, PxPhysics& physics, const PxCookingParams& params); + +/** +\brief Release the mesh created with PxVehicleUnitCylinderSweepMeshCreate. +\param[in] mesh is a PxConvexMesh instance. +\see PxVehicleUnitCylinderSweepMeshCreate +*/ +void PxVehicleUnitCylinderSweepMeshDestroy(PxConvexMesh* mesh); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h b/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h new file mode 100644 index 00000000..8bccd732 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h @@ -0,0 +1,174 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxFoundation.h" + +#include "PxQueryFiltering.h" + +#if !PX_DOXYGEN +namespace physx +{ +class PxMaterial; + +namespace vehicle2 +{ +#endif + +struct PxVehicleFrame; +struct PxVehicleScale; + +/** +\brief PhysX scene queries may be raycasts or sweeps. +\note eNONE will result in no PhysX scene query. This option will not overwrite the associated PxVehicleRoadGeometryState. +*/ +struct PxVehiclePhysXRoadGeometryQueryType +{ + enum Enum + { + eNONE = 0, //!< Info about the road geometry below the wheel is provided by the user + eRAYCAST, //!< The road geometry below the wheel is analyzed using a raycast query + eSWEEP, //!< The road geometry below the wheel is analyzed using a sweep query + eMAX_NB + }; +}; + +/** +\brief A description of type of PhysX scene query and the filter data to apply to the query. +*/ +struct PxVehiclePhysXRoadGeometryQueryParams +{ + /** + \brief The default filter data to use for the physx scene query. + + If per wheel filter data is provided in #filterDataEntries, then this member + will be ignored. + + \see PxSceneQuerySystemBase::raycast + \see PxSceneQuerySystemBase::sweep + */ + PxQueryFilterData defaultFilterData; + + /** + \brief Array of filter data entries (one per wheel) to use for the physx scene query. + + A null pointer is allowed in which case #defaultFilterData will be used for all wheels. + + \see PxSceneQuerySystemBase::raycast + \see PxSceneQuerySystemBase::sweep + */ + PxQueryFilterData* filterDataEntries; + + /** + \brief A filter callback to be used by the physx scene query + \note A null pointer is allowed. + \see PxSceneQuerySystemBase::raycast + \see PxSceneQuerySystemBase::sweep + */ + PxQueryFilterCallback* filterCallback; + + /** + \brief A description of the type of physx scene query to employ. + \see PxSceneQuerySystemBase::raycast + \see PxSceneQuerySystemBase::sweep + */ + PxVehiclePhysXRoadGeometryQueryType::Enum roadGeometryQueryType; + + PX_FORCE_INLINE PxVehiclePhysXRoadGeometryQueryParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(roadGeometryQueryType < PxVehiclePhysXRoadGeometryQueryType::eMAX_NB, "PxVehiclePhysXRoadGeometryQueryParams.roadGeometryQueryType has illegal value", false); + return true; + } +}; + +/** +A mapping between PxMaterial and a friction value to be used by the tire model. +\see PxVehiclePhysXMaterialFrictionParams +*/ +struct PxVehiclePhysXMaterialFriction +{ + /** + \brief A PxMaterial instance that is to be mapped to a friction value. + */ + const PxMaterial* material; + + /** + \brief A friction value that is to be mapped to a PxMaterial instance. + \note friction must have value greater than or equal to zero. + + Range: [0, inf)
+ + \see PxVehicleTireGripState::friction + */ + PxReal friction; + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(friction >= 0.0f, "PxVehiclePhysXMaterialFriction.friction must be greater than or equal to zero", false); + return true; + } +}; + +/** +\brief A mappping between PxMaterial instance and friction for multiple PxMaterial intances. +*/ +struct PxVehiclePhysXMaterialFrictionParams +{ + PxVehiclePhysXMaterialFriction* materialFrictions; //!< An array of mappings between PxMaterial and friction. + PxU32 nbMaterialFrictions; //!< The number of mappings between PxMaterial and friction. + PxReal defaultFriction; //!< A default friction value to be used in the event that the PxMaterial under the tire is not found in the array #materialFrictions. + + PX_FORCE_INLINE bool isValid() const + { + for (PxU32 i = 0; i < nbMaterialFrictions; i++) + { + if (!materialFrictions[i].isValid()) + return false; + } + PX_CHECK_AND_RETURN_VAL(defaultFriction >= 0.0f, "PxVehiclePhysXMaterialFrictionParams.defaultFriction must be greater than or equal to zero", false); + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h b/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h new file mode 100644 index 00000000..a872bae0 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h @@ -0,0 +1,65 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxMemory.h" +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ + +class PxRigidActor; +class PxShape; +class PxMaterial; + +namespace vehicle2 +{ +#endif + +struct PxVehiclePhysXRoadGeometryQueryState +{ + PxRigidActor* actor; //!< The actor that got hit by the query. + PxShape* shape; //!< The shape that got hit by the query. + PxMaterial* material; //!< The material at the hit point. + PxVec3 hitPosition; //!< The hit position in world space. + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehiclePhysXRoadGeometryQueryState)); + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + + diff --git a/engine/third_party/physx/include/vehicle2/pvd/PxVehiclePvdComponents.h b/engine/third_party/physx/include/vehicle2/pvd/PxVehiclePvdComponents.h new file mode 100644 index 00000000..c888f380 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/pvd/PxVehiclePvdComponents.h @@ -0,0 +1,351 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +#pragma once + + +#include "vehicle2/PxVehicleComponent.h" +#include "vehicle2/PxVehicleParams.h" +#include "PxVehiclePvdFunctions.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +#define VEHICLE_FLOAT_ARRAY_DATA(b) PxVehicleArrayData b; b.setEmpty(); +#define VEHICLE_ARRAY_DATA(a, b) PxVehicleArrayData b; b.setEmpty(); +#define VEHICLE_SIZED_ARRAY_DATA(a, b) PxVehicleSizedArrayData b; b.setEmpty(); + +class PxVehiclePVDComponent : public PxVehicleComponent +{ +public: + + PxVehiclePVDComponent() : PxVehicleComponent() , firstTime(true) {} + virtual ~PxVehiclePVDComponent() {} + + virtual void getDataForPVDComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleRigidBodyParams*& rbodyParams, const PxVehicleRigidBodyState*& rbodyState, + const PxVehicleSuspensionStateCalculationParams*& suspStateCalcParams, + PxVehicleSizedArrayData& brakeResponseParams, + const PxVehicleSteerCommandResponseParams*& steerResponseParams, + const PxVehicleAckermannParams*& ackermannParams, + PxVehicleArrayData& brakeResponseStates, + PxVehicleArrayData& steerResponseStates, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& wheelActuationStates, + PxVehicleArrayData& wheelRigidBody1dStates, + PxVehicleArrayData& wheelLocalPoses, + PxVehicleArrayData& roadGeomStates, + PxVehicleArrayData& suspParams, + PxVehicleArrayData& suspCompParams, + PxVehicleArrayData& suspForceParams, + PxVehicleArrayData& suspStates, + PxVehicleArrayData& suspCompStates, + PxVehicleArrayData& suspForces, + PxVehicleArrayData& tireForceParams, + PxVehicleArrayData& tireDirectionStates, + PxVehicleArrayData& tireSpeedStates, + PxVehicleArrayData& tireSlipStates, + PxVehicleArrayData& tireStickyStates, + PxVehicleArrayData& tireGripStates, + PxVehicleArrayData& tireCamberStates, + PxVehicleArrayData& tireForces, + PxVehicleSizedArrayData& antiRollForceParams, + const PxVehicleAntiRollTorque*& antiRollTorque, + const PxVehicleCommandState*& commandState, + const PxVehicleDirectDriveThrottleCommandResponseParams*& directDriveThrottleResponseParams, + const PxVehicleDirectDriveTransmissionCommandState*& directDriveTransmissionState, + PxVehicleArrayData& directDrivethrottleResponseState, + const PxVehicleClutchCommandResponseParams*& clutchResponseParams, + const PxVehicleClutchParams*& clutchParams, + const PxVehicleEngineParams*& engineParams, + const PxVehicleGearboxParams*& gearboxParams, + const PxVehicleAutoboxParams*& autoboxParams, + const PxVehicleMultiWheelDriveDifferentialParams*& multiWheelDiffParams, + const PxVehicleFourWheelDriveDifferentialParams*& fourWheelDiffParams, + const PxVehicleTankDriveDifferentialParams*& tankDiffParams, + const PxVehicleEngineDriveTransmissionCommandState*& engineDriveTransmissionState, + const PxVehicleTankDriveTransmissionCommandState*& tankDriveTransmissionState, + const PxVehicleClutchCommandResponseState*& clutchResponseState, + const PxVehicleEngineDriveThrottleCommandResponseState*& engineDriveThrottleResponseState, + const PxVehicleEngineState*& engineState, + const PxVehicleGearboxState*& gearboxState, + const PxVehicleAutoboxState*& autoboxState, + const PxVehicleDifferentialState*& diffState, + const PxVehicleClutchSlipState*& clutchSlipState, + PxVehicleArrayData& physxConstraintParams, + PxVehicleArrayData& physxMaterialFrictionParams, + const PxVehiclePhysXActor*& physxActor, + const PxVehiclePhysXRoadGeometryQueryParams*& physxRoadGeomQryParams, + PxVehicleArrayData& physxRoadGeomStates, + PxVehicleArrayData& physxConstraintStates, + const PxVehiclePhysXSteerState*& physxSteerState, + PxVehiclePvdObjectHandles*& objectHandles) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + OmniPvdWriter* pvdWriter = context.pvdContext.writer; + + if(!context.pvdContext.attributeHandles || !pvdWriter) + return true; + + const PxVehicleAxleDescription* axleDesc = NULL; + const PxVehicleRigidBodyParams* rbodyParams = NULL; + const PxVehicleRigidBodyState* rbodyState = NULL; + const PxVehicleSuspensionStateCalculationParams* suspStateCalcParams = NULL; + VEHICLE_SIZED_ARRAY_DATA(PxVehicleBrakeCommandResponseParams, brakeResponseParams); + const PxVehicleSteerCommandResponseParams* steerResponseParams = NULL; + const PxVehicleAckermannParams* ackermannParams = NULL; + VEHICLE_FLOAT_ARRAY_DATA(brakeResponseStates); + VEHICLE_FLOAT_ARRAY_DATA(steerResponseStates); + VEHICLE_ARRAY_DATA(PxVehicleWheelParams, wheelParams); + VEHICLE_ARRAY_DATA(PxVehicleWheelActuationState, wheelActuationStates); + VEHICLE_ARRAY_DATA(PxVehicleWheelRigidBody1dState, wheelRigidBody1dStates); + VEHICLE_ARRAY_DATA(PxVehicleWheelLocalPose, wheelLocalPoses); + VEHICLE_ARRAY_DATA(PxVehicleRoadGeometryState, roadGeomStates); + VEHICLE_ARRAY_DATA(PxVehicleSuspensionParams, suspParams); + VEHICLE_ARRAY_DATA(PxVehicleSuspensionComplianceParams, suspComplianceParams); + VEHICLE_ARRAY_DATA(PxVehicleSuspensionForceParams, suspForceParams); + VEHICLE_ARRAY_DATA(PxVehicleSuspensionState, suspStates); + VEHICLE_ARRAY_DATA(PxVehicleSuspensionComplianceState, suspComplianceStates); + VEHICLE_ARRAY_DATA(PxVehicleSuspensionForce, suspForces); + VEHICLE_ARRAY_DATA(PxVehicleTireForceParams, tireForceParams); + VEHICLE_ARRAY_DATA(PxVehicleTireDirectionState, tireDirectionStates); + VEHICLE_ARRAY_DATA(PxVehicleTireSpeedState, tireSpeedStates); + VEHICLE_ARRAY_DATA(PxVehicleTireSlipState, tireSlipStates); + VEHICLE_ARRAY_DATA(PxVehicleTireStickyState, tireStickyStates); + VEHICLE_ARRAY_DATA(PxVehicleTireGripState, tireGripStates); + VEHICLE_ARRAY_DATA(PxVehicleTireCamberAngleState, tireCamberStates); + VEHICLE_ARRAY_DATA(PxVehicleTireForce, tireForces); + VEHICLE_SIZED_ARRAY_DATA(PxVehicleAntiRollForceParams, antiRollParams); + const PxVehicleAntiRollTorque* antiRollTorque = NULL; + const PxVehicleCommandState* commandState = NULL; + const PxVehicleDirectDriveThrottleCommandResponseParams* directDriveThrottleResponseParams = NULL; + const PxVehicleDirectDriveTransmissionCommandState* directDriveTransmissionState = NULL; + VEHICLE_FLOAT_ARRAY_DATA(directDrivethrottleResponseState); + const PxVehicleClutchCommandResponseParams* clutchResponseParams = NULL; + const PxVehicleClutchParams* clutchParams = NULL; + const PxVehicleEngineParams* engineParams = NULL; + const PxVehicleGearboxParams* gearboxParams = NULL; + const PxVehicleAutoboxParams* autoboxParams = NULL; + const PxVehicleMultiWheelDriveDifferentialParams* multiWheelDiffParams = NULL; + const PxVehicleFourWheelDriveDifferentialParams* fourWheelDiffParams = NULL; + const PxVehicleTankDriveDifferentialParams* tankDiffParams = NULL; + const PxVehicleEngineDriveTransmissionCommandState* engineDriveTransmissionCommandState = NULL; + const PxVehicleTankDriveTransmissionCommandState* tankDriveTransmissionCommandState = NULL; + const PxVehicleClutchCommandResponseState* clutchResponseState = NULL; + const PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState = NULL; + const PxVehicleEngineState* engineState = NULL; + const PxVehicleGearboxState* gearboxState = NULL; + const PxVehicleAutoboxState* autoboxState = NULL; + const PxVehicleDifferentialState* diffState = NULL; + const PxVehicleClutchSlipState* clutchSlipState = NULL; + VEHICLE_ARRAY_DATA(PxVehiclePhysXSuspensionLimitConstraintParams, physxConstraintParams); + VEHICLE_ARRAY_DATA(PxVehiclePhysXMaterialFrictionParams, physxMaterialFrictionParams); + const PxVehiclePhysXActor* physxActor = NULL; + const PxVehiclePhysXRoadGeometryQueryParams* physxRoadGeomQryParams = NULL; + VEHICLE_ARRAY_DATA(PxVehiclePhysXRoadGeometryQueryState, physxRoadGeomStates); + VEHICLE_ARRAY_DATA(PxVehiclePhysXConstraintState, physxConstraintStates); + const PxVehiclePhysXSteerState* physxSteerState = NULL; + PxVehiclePvdObjectHandles* omniPvdObjectHandles = NULL; + + getDataForPVDComponent( + axleDesc, + rbodyParams, rbodyState, + suspStateCalcParams, + brakeResponseParams, steerResponseParams, ackermannParams, + brakeResponseStates, steerResponseStates, + wheelParams, + wheelActuationStates, wheelRigidBody1dStates, wheelLocalPoses, + roadGeomStates, + suspParams, suspComplianceParams, suspForceParams, + suspStates, suspComplianceStates, + suspForces, + tireForceParams, + tireDirectionStates, tireSpeedStates, tireSlipStates, tireStickyStates, tireGripStates, tireCamberStates, + tireForces, + antiRollParams, antiRollTorque, + commandState, + directDriveThrottleResponseParams, directDriveTransmissionState, directDrivethrottleResponseState, + clutchResponseParams, clutchParams, engineParams, gearboxParams, autoboxParams, + multiWheelDiffParams, fourWheelDiffParams, tankDiffParams, + engineDriveTransmissionCommandState, tankDriveTransmissionCommandState, + clutchResponseState, throttleResponseState, engineState, gearboxState, autoboxState, diffState, clutchSlipState, + physxConstraintParams, physxMaterialFrictionParams, + physxActor, physxRoadGeomQryParams, physxRoadGeomStates, physxConstraintStates, physxSteerState, + omniPvdObjectHandles); + + if(!omniPvdObjectHandles) + return true; + + if(firstTime) + { + PxVehiclePvdRigidBodyRegister( + rbodyParams, rbodyState, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + PxVehiclePvdSuspensionStateCalculationParamsRegister( + suspStateCalcParams, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + PxVehiclePvdCommandResponseRegister( + brakeResponseParams, steerResponseParams, ackermannParams, + brakeResponseStates, steerResponseStates, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + PxVehiclePvdWheelAttachmentsRegister( + *axleDesc, + wheelParams, wheelActuationStates, wheelRigidBody1dStates, wheelLocalPoses, + roadGeomStates, + suspParams, suspComplianceParams, suspForceParams, suspStates, suspComplianceStates, + suspForces, + tireForceParams, + tireDirectionStates, tireSpeedStates, tireSlipStates, tireStickyStates, tireGripStates, tireCamberStates, + tireForces, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + PxVehiclePvdAntiRollsRegister( + antiRollParams, antiRollTorque, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + if (engineParams) + { + PxVehiclePvdEngineDrivetrainRegister( + commandState, engineDriveTransmissionCommandState, tankDriveTransmissionCommandState, + clutchResponseParams, clutchParams, engineParams, gearboxParams, autoboxParams, + multiWheelDiffParams, fourWheelDiffParams, tankDiffParams, + clutchResponseState, throttleResponseState, engineState, gearboxState, autoboxState, diffState, clutchSlipState, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + } + else + { + PxVehiclePvdDirectDrivetrainRegister( + commandState, directDriveTransmissionState, + directDriveThrottleResponseParams, + directDrivethrottleResponseState, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + } + + PxVehiclePvdPhysXWheelAttachmentRegister( + *axleDesc, + physxConstraintParams, physxMaterialFrictionParams, + physxActor, physxRoadGeomQryParams, physxRoadGeomStates, physxConstraintStates, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + PxVehiclePvdPhysXRigidActorRegister( + physxActor, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + PxVehiclePvdPhysXSteerStateRegister( + physxSteerState, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + firstTime = false; + } + + PxVehiclePvdRigidBodyWrite( + rbodyParams, rbodyState, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + PxVehiclePvdSuspensionStateCalculationParamsWrite( + suspStateCalcParams, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + PxVehiclePvdCommandResponseWrite( + *axleDesc, brakeResponseParams, steerResponseParams, ackermannParams, + brakeResponseStates, steerResponseStates, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + PxVehiclePvdWheelAttachmentsWrite( + *axleDesc, + wheelParams, wheelActuationStates, wheelRigidBody1dStates, wheelLocalPoses, + roadGeomStates, + suspParams, suspComplianceParams, suspForceParams, suspStates, suspComplianceStates, + suspForces, + tireForceParams, + tireDirectionStates, tireSpeedStates, tireSlipStates, tireStickyStates, tireGripStates, tireCamberStates, + tireForces, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + PxVehiclePvdAntiRollsWrite( + antiRollParams, antiRollTorque, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + if (engineParams) + { + PxVehiclePvdEngineDrivetrainWrite( + commandState, engineDriveTransmissionCommandState, tankDriveTransmissionCommandState, + clutchResponseParams, clutchParams, engineParams, gearboxParams, autoboxParams, + multiWheelDiffParams, fourWheelDiffParams, tankDiffParams, + clutchResponseState, throttleResponseState, engineState, gearboxState, autoboxState, diffState, clutchSlipState, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + } + else + { + PxVehiclePvdDirectDrivetrainWrite( + *axleDesc, + commandState, directDriveTransmissionState, + directDriveThrottleResponseParams, + directDrivethrottleResponseState, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + } + + PxVehiclePvdPhysXWheelAttachmentWrite( + *axleDesc, + physxConstraintParams, physxMaterialFrictionParams, + physxActor, physxRoadGeomQryParams, physxRoadGeomStates, physxConstraintStates, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + PxVehiclePvdPhysXRigidActorWrite( + physxActor, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + PxVehiclePvdPhysXSteerStateWrite( + physxSteerState, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, *pvdWriter); + + return true; + } + +private: + + bool firstTime; +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/pvd/PxVehiclePvdFunctions.h b/engine/third_party/physx/include/vehicle2/pvd/PxVehiclePvdFunctions.h new file mode 100644 index 00000000..962406dd --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/pvd/PxVehiclePvdFunctions.h @@ -0,0 +1,634 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +#pragma once + + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/braking/PxVehicleBrakingParams.h" +#include "vehicle2/commands/PxVehicleCommandStates.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainParams.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainStates.h" +#include "vehicle2/physxActor/PxVehiclePhysXActorStates.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintParams.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h" +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" +#include "vehicle2/steering/PxVehicleSteeringParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionStates.h" +#include "vehicle2/tire/PxVehicleTireParams.h" +#include "vehicle2/tire/PxVehicleTireStates.h" +#include "vehicle2/wheel/PxVehicleWheelParams.h" +#include "vehicle2/wheel/PxVehicleWheelStates.h" + +class OmniPvdWriter; +namespace physx +{ +class PxAllocatorCallback; +namespace vehicle2 +{ +struct PxVehiclePvdAttributeHandles; +struct PxVehiclePvdObjectHandles; +} // namespace vehicle2 +} // namespace physx + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Create object instances in omnipvd that will be used to reflect the parameters and state of the rigid body of a vehicle instance. +Handles to the created object instances will be stored in a PxVehiclePvdObjectHandles instance. +\param[in] rbodyParams describes the parameters of the vehicle's rigid body. +\param[in] rbodyState describes the state of the vehicle's rigid body. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If rbodyParams is NULL, omnipvd will not reflect rigid body parameters. +\note If rbodyState is NULL, omnipvd will not reflect rigid body state. +\note PxVehiclePvdRigidBodyRegister should be called once for each vehicle instance. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdRigidBodyWrite +*/ +void PxVehiclePvdRigidBodyRegister +(const PxVehicleRigidBodyParams* rbodyParams, const PxVehicleRigidBodyState* rbodyState, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Write the parameters and state of the rigid body of a vehicle instance to omnipvd. +\param[in] rbodyParams describes the parameters of the vehicle's rigid body. +\param[in] rbodyState describes the state of the vehicle's rigid body. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If rbodyParams is NULL but a non-NULL value was used in PxVehiclePvdRigidBodyRegister(), the rigid body parameters will not be updated in omnipvd. +\note If rbodyState is NULL but a non-NULL value was used in PxVehiclePvdRigidBodyRegister(), the rigid body state will not be updated in omnipvd. +\note omniWriter must be the same instance used in PxVehiclePvdRigidBodyRegister(). +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdRigidBodyRegister +*/ +void PxVehiclePvdRigidBodyWrite +(const PxVehicleRigidBodyParams* rbodyParams, const PxVehicleRigidBodyState* rbodyState, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Register object instances in omnipvd that will be used to reflect the suspension state calculation parameters of a vehicle instance. +\param[in] suspStateCalcParams describes parameters used to calculate suspension state. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If suspStateCalcParams is NULL, omnipvd will not reflect the suspension state calculation parameters. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdSuspensionStateCalculationParamsWrite +*/ +void PxVehiclePvdSuspensionStateCalculationParamsRegister +(const PxVehicleSuspensionStateCalculationParams* suspStateCalcParams, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Write the parameters and state of the rigid body of a vehicle instance to omnipvd. +\param[in] suspStateCalcParams describes parameters used to calculate suspension state. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If suspStateCalcParams is NULL but a non-NULL value was used in void PxVehiclePvdSuspensionStateCalculationParamsRegister(), +the suspension state calculation parameters will not be updated in omnipvd. +\note omniWriter must be the same instance used in PxVehiclePvdSuspensionStateCalculationParamsRegister(). +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdSuspensionStateCalculationParamsRegister +*/ +void PxVehiclePvdSuspensionStateCalculationParamsWrite +(const PxVehicleSuspensionStateCalculationParams* suspStateCalcParams, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Register object instances in omnipvd that will be used to reflect the brake and steer command response parameters of a vehicle instance. +\param[in] brakeResponseParams is an array of brake command response parameters. +\param[in] steerResponseParams describes the steer command response parameters. +\param[in] ackermannParams defines the Ackermann steer correction. +\param[in] brakeResponseStates is an array of brake responses torqyes, +\param[in] steerResponseStates is an array of steer response angles. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If brakeResponseParams is empty, omnipvd will not reflect any brake command response parameters. +\note If steerResponseParams is NULL, omnipvd will not reflect the steer command response parameters. +\note If ackermannParams is NULL, omnipvd will not reflect any Ackermann steer correction parameters. +\note If brakeResponseStates is empty, omnipvd will not reflect any brake command response state. +\note If steerResponseStates is empty, omnipvd will not reflect any steer command response state. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdCommandResponseWrite +*/ +void PxVehiclePvdCommandResponseRegister +(const PxVehicleSizedArrayData& brakeResponseParams, + const PxVehicleSteerCommandResponseParams* steerResponseParams, + const PxVehicleAckermannParams* ackermannParams, + const PxVehicleArrayData& brakeResponseStates, + const PxVehicleArrayData& steerResponseStates, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Write brake and steer command response parameters to omnipvd. +\param[in] axleDesc is a description of the wheels and axles of a vehicle. +\param[in] brakeResponseParams is an array of brake command response parameters. +\param[in] steerResponseParams describes the steer command response parameters. +\param[in] ackermannParams defines the Ackermann steer correction. +\param[in] brakeResponseStates is an array of brake response torques. +\param[in] steerResponseStates is an array of steer response angles. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If brakeResponseParams is empty but a non-empty array was used in PxVehiclePvdCommandResponseRegister(), +the brake command response parameters will not be updated in omnipvd. +\note If steerResponseParams is non-NULL but a NULL value was used in PxVehiclePvdCommandResponseRegister(), +the steer command parameters will not be updated in omnipvd. +\note If ackermannParams is non-NULL but a NULL value was used in PxVehiclePvdCommandResponseRegister(), +the Ackermann steer correction parameters will not be updated in omnipvd. +\note If brakeResponseStates is empty but a non-empty array was used in PxVehiclePvdCommandResponseRegister(), +the brake response states will not be updated in omnipvd. +\note If steerResponseStates is empty but a non-empty array was used in PxVehiclePvdCommandResponseRegister(), +the steer response states will not be updated in omnipvd. +\note omniWriter must be the same instance used in PxVehiclePvdCommandResponseRegister(). +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdCommandResponseRegister +*/ +void PxVehiclePvdCommandResponseWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleSizedArrayData& brakeResponseParams, + const PxVehicleSteerCommandResponseParams* steerResponseParams, + const PxVehicleAckermannParams* ackermannParams, + const PxVehicleArrayData& brakeResponseStates, + const PxVehicleArrayData& steerResponseStates, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Register object instances in omnipvd that will be used to reflect wheel attachment data such as tires, suspensions and wheels. +\param[in] axleDesc is a description of the wheels and axles of a vehicle. +\param[in] wheelParams is an array of wheel parameters. +\param[in] wheelActuationStates is an array of wheel actuation states. +\param[in] wheelRigidBody1dStates is an array of wheel rigid body states. +\param[in] wheelLocalPoses is an array of wheel local poses. +\param[in] roadGeometryStates is an array of road geometry states. +\param[in] suspParams is an array of suspension parameters. +\param[in] suspCompParams is an array of suspension compliance parameters. +\param[in] suspForceParams is an array of suspension force parameters. +\param[in] suspStates is an array of suspension states. +\param[in] suspCompStates is an array of suspension compliance states. +\param[in] suspForces is an array of suspension forces. +\param[in] tireForceParams is an array of tire force parameters. +\param[in] tireDirectionStates is an array of tire direction states. +\param[in] tireSpeedStates is an array of tire speed states. +\param[in] tireSlipStates is an array of tire slip states. +\param[in] tireStickyStates is an array of tire sticky states. +\param[in] tireGripStates is an array of tire grip states. +\param[in] tireCamberStates is an array of tire camber states. +\param[in] tireForces is an array of tire forces. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If any array is empty, the corresponding data will not be reflected in omnipvd. +\note Each array must either be empty or contain an entry for each wheel present in axleDesc. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdWheelAttachmentsWrite +*/ +void PxVehiclePvdWheelAttachmentsRegister +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& wheelParams, + const PxVehicleArrayData& wheelActuationStates, + const PxVehicleArrayData& wheelRigidBody1dStates, + const PxVehicleArrayData& wheelLocalPoses, + const PxVehicleArrayData& roadGeometryStates, + const PxVehicleArrayData& suspParams, + const PxVehicleArrayData& suspCompParams, + const PxVehicleArrayData& suspForceParams, + const PxVehicleArrayData& suspStates, + const PxVehicleArrayData& suspCompStates, + const PxVehicleArrayData& suspForces, + const PxVehicleArrayData& tireForceParams, + const PxVehicleArrayData& tireDirectionStates, + const PxVehicleArrayData& tireSpeedStates, + const PxVehicleArrayData& tireSlipStates, + const PxVehicleArrayData& tireStickyStates, + const PxVehicleArrayData& tireGripStates, + const PxVehicleArrayData& tireCamberStates, + const PxVehicleArrayData& tireForces, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Write wheel attachment data such as tire, suspension and wheel data to omnipvd. +\param[in] axleDesc is a description of the wheels and axles of a vehicle. +\param[in] wheelParams is an array of wheel parameters. +\param[in] wheelActuationStates is an array of wheel actuation states. +\param[in] wheelRigidBody1dStates is an array of wheel rigid body states. +\param[in] wheelLocalPoses is an array of wheel local poses. +\param[in] roadGeometryStates is an array of road geometry states. +\param[in] suspParams is an array of suspension parameters. +\param[in] suspCompParams is an array of suspension compliance parameters. +\param[in] suspForceParams is an array of suspension force parameters. +\param[in] suspStates is an array of suspension states. +\param[in] suspCompStates is an array of suspension compliance states. +\param[in] suspForces is an array of suspension forces. +\param[in] tireForceParams is an array of tire force parameters. +\param[in] tireDirectionStates is an array of tire direction states. +\param[in] tireSpeedStates is an array of tire speed states. +\param[in] tireSlipStates is an array of tire slip states. +\param[in] tireStickyStates is an array of tire sticky states. +\param[in] tireGripStates is an array of tire grip states. +\param[in] tireCamberStates is an array of tire camber states. +\param[in] tireForces is an array of tire forces. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If any array is empty but the corresponding argument in PxVehiclePvdWheelAttachmentsRegister was not empty, the corresponding data will not be updated in omnipvd. +\note Each array must either be empty or contain an entry for each wheel present in axleDesc. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdWheelAttachmentsRegister +*/ +void PxVehiclePvdWheelAttachmentsWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& wheelParams, + const PxVehicleArrayData& wheelActuationStates, + const PxVehicleArrayData& wheelRigidBody1dStates, + const PxVehicleArrayData& wheelLocalPoses, + const PxVehicleArrayData& roadGeometryStates, + const PxVehicleArrayData& suspParams, + const PxVehicleArrayData& suspCompParams, + const PxVehicleArrayData& suspForceParams, + const PxVehicleArrayData& suspStates, + const PxVehicleArrayData& suspCompStates, + const PxVehicleArrayData& suspForces, + const PxVehicleArrayData& tireForceParams, + const PxVehicleArrayData& tireDirectionStates, + const PxVehicleArrayData& tireSpeedStates, + const PxVehicleArrayData& tireSlipStates, + const PxVehicleArrayData& tireStickyStates, + const PxVehicleArrayData& tireGripStates, + const PxVehicleArrayData& tireCamberStates, + const PxVehicleArrayData& tireForces, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Register object instances in omnipvd that will be used to reflect the antiroll bars of a vehicle instance. +\param[in] antiRollForceParams is an array of antiroll parameters. +\param[in] antiRollTorque describes the instantaneous accumulated torque from all antiroll bas. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If antiRollForceParams is empty, the corresponding data will not be reflected in omnipvd. +\note If antiRollTorque is NULL, the corresponding data will not be reflected in omnipvd. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdAntiRollsWrite +*/ +void PxVehiclePvdAntiRollsRegister +(const PxVehicleSizedArrayData& antiRollForceParams, const PxVehicleAntiRollTorque* antiRollTorque, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Write antiroll data to omnipvd. +\param[in] antiRollForceParams is an array of antiroll parameters. +\param[in] antiRollTorque describes the instantaneous accumulated torque from all antiroll bas. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If antiRollForceParams is empty but the corresponding argument was not empty, the corresponding data will not be updated in omnipvd. +\note If antiRollTorque is NULL but the corresponding argument was not NULL, the corresponding data will not be updated in omnipvd. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdAntiRollsRegister +*/ +void PxVehiclePvdAntiRollsWrite +(const PxVehicleSizedArrayData& antiRollForceParams, const PxVehicleAntiRollTorque* antiRollTorque, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Register object instances in omnipvd that will be used to reflect the direct drivetrain of a vehicle instance. +\param[in] commandState describes the control values applied to the vehicle. +\param[in] transmissionCommandState describes the state of the direct drive transmission. +\param[in] directDriveThrottleResponseParams describes the vehicle's torque response to a throttle command. +\param[in] directDriveThrottleResponseState is the instantaneous torque response of each wheel to a throttle command. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If commandState is NULL, the corresponding data will not be reflected in omnipvd. +\note If transmissionCommandState is NULL, the corresponding data will not be reflected in omnipvd. +\note If directDriveThrottleResponseParams is NULL, the corresponding data will not be reflected in omnipvd. +\note If directDriveThrottleResponseState is empty, the corresponding data will not be reflected in omnipvd. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdDirectDrivetrainWrite +*/ +void PxVehiclePvdDirectDrivetrainRegister +(const PxVehicleCommandState* commandState, const PxVehicleDirectDriveTransmissionCommandState* transmissionCommandState, + const PxVehicleDirectDriveThrottleCommandResponseParams* directDriveThrottleResponseParams, + const PxVehicleArrayData& directDriveThrottleResponseState, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Write direct drivetrain data to omnipvd. +\param[in] axleDesc is a description of the wheels and axles of a vehicle. +\param[in] commandState describes the control values applied to the vehicle. +\param[in] transmissionCommandState describes the state of the direct drive transmission. +\param[in] directDriveThrottleResponseParams describes the vehicle's torque response to a throttle command. +\param[in] directDriveThrottleResponseState is the instantaneous torque response of each wheel to a throttle command. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If commandState is NULL but the corresponding entry in PxVehiclePvdDirectDrivetrainRegister() was not NULL, the corresponding data will not be updated in omnipvd. +\note If transmissionCommandState is NULL but the corresponding entry in PxVehiclePvdDirectDrivetrainRegister() was not NULL, the corresponding data will not be updated in omnipvd. +\note If directDriveThrottleResponseParams is NULL but the corresponding entry in PxVehiclePvdDirectDrivetrainRegister() was not NULL, the corresponding data will not be updated in omnipvd. +\note If directDriveThrottleResponseState is empty but the corresponding entry in PxVehiclePvdDirectDrivetrainRegister() was not empty, the corresponding data will not be updated in omnipvd. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdDirectDrivetrainRegister +*/ +void PxVehiclePvdDirectDrivetrainWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleCommandState* commandState, const PxVehicleDirectDriveTransmissionCommandState* transmissionCommandState, + const PxVehicleDirectDriveThrottleCommandResponseParams* directDriveThrottleResponseParams, + const PxVehicleArrayData& directDriveThrottleResponseState, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Register object instances in omnipvd that will be used to reflect the engine drivetrain of a vehicle instance. +\param[in] commandState describes the control values applied to the vehicle. +\param[in] engineDriveTransmissionCommandState describes the state of the engine drive transmission. +\param[in] tankDriveTransmissionCommandState describes the state of the tank drive transmission. +\param[in] clutchResponseParams describes the vehicle's response to a clutch command. +\param[in] clutchParams describes the vehicle's clutch. +\param[in] engineParams describes the engine. +\param[in] gearboxParams describes the gearbox. +\param[in] autoboxParams describes the automatic gearbox. +\param[in] multiWheelDiffParams describes a multiwheel differential without limited slip compensation. +\param[in] fourWheelDiffPrams describes a differential that delivers torque to four drive wheels with limited slip compensation. +\param[in] tankDiffParams describes the operation of the tank differential. +\param[in] clutchResponseState is the instantaneous reponse of the clutch to a clutch command. +\param[in] throttleResponseState is the instantaneous response to a throttle command. +\param[in] engineState is the instantaneous state of the engine. +\param[in] gearboxState is the instantaneous state of the gearbox. +\param[in] autoboxState is the instantaneous state of the automatic gearbox. +\param[in] diffState is the instantaneous state of the differential. +\param[in] clutchSlipState is the instantaneous slip recorded at the clutch. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If any pointer is NULL, the corresponding data will not be reflected in omnipvd. +\note At most one of engineDriveTransmissionCommandState and tankDriveTransmissionCommandState is expected to be non-NULL. +\note At most one of multiWheelDiffParams, fourWheelDiffParams and tankDiffParams is expected to be non-NULL. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdEngineDrivetrainWrite +*/ +void PxVehiclePvdEngineDrivetrainRegister +(const PxVehicleCommandState* commandState, + const PxVehicleEngineDriveTransmissionCommandState* engineDriveTransmissionCommandState, + const PxVehicleTankDriveTransmissionCommandState* tankDriveTransmissionCommandState, + const PxVehicleClutchCommandResponseParams* clutchResponseParams, + const PxVehicleClutchParams* clutchParams, + const PxVehicleEngineParams* engineParams, + const PxVehicleGearboxParams* gearboxParams, + const PxVehicleAutoboxParams* autoboxParams, + const PxVehicleMultiWheelDriveDifferentialParams* multiWheelDiffParams, + const PxVehicleFourWheelDriveDifferentialParams* fourWheelDiffPrams, + const PxVehicleTankDriveDifferentialParams* tankDiffParams, + const PxVehicleClutchCommandResponseState* clutchResponseState, + const PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState, + const PxVehicleEngineState* engineState, + const PxVehicleGearboxState* gearboxState, + const PxVehicleAutoboxState* autoboxState, + const PxVehicleDifferentialState* diffState, + const PxVehicleClutchSlipState* clutchSlipState, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Write engine drivetrain data of a vehicle instance to omnipvd. +\param[in] commandState describes the control values applied to the vehicle. +\param[in] engineDriveTransmissionCommandState describes the state of the engine drive transmission. +\param[in] tankDriveTransmissionCommandState describes the state of the tank drive transmission. +\param[in] clutchResponseParams describes the vehicle's response to a clutch command. +\param[in] clutchParams describes the vehicle's clutch. +\param[in] engineParams describes the engine. +\param[in] gearboxParams describes the gearbox. +\param[in] autoboxParams describes the automatic gearbox. +\param[in] multiWheelDiffParams describes a multiwheel differential without limited slip compensation. +\param[in] fourWheelDiffParams describes a differential that delivers torque to four drive wheels with limited slip compensation. +\param[in] tankDiffParams describes the operation of the tank differential. +\param[in] clutchResponseState is the instantaneous reponse of the clutch to a clutch command. +\param[in] throttleResponseState is the instantaneous response to a throttle command. +\param[in] engineState is the instantaneous state of the engine. +\param[in] gearboxState is the instantaneous state of the gearbox. +\param[in] autoboxState is the instantaneous state of the automatic gearbox. +\param[in] diffState is the instantaneous state of the differential. +\param[in] clutchSlipState is the instantaneous slip recorded at the clutch. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If any pointer is NULL and the corresponding argument in PxVehiclePvdEngineDrivetrainRegister() was not NULL, the corresponding data will not be reflected in omnipvd. +\note At most one of engineDriveTransmissionCommandState and tankDriveTransmissionCommandState is expected to be non-NULL. +\note At most one of multiWheelDiffParams, fourWheelDiffParams and tankDiffParams is expected to be non-NULL. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdEngineDrivetrainRegister +*/ +void PxVehiclePvdEngineDrivetrainWrite +(const PxVehicleCommandState* commandState, + const PxVehicleEngineDriveTransmissionCommandState* engineDriveTransmissionCommandState, + const PxVehicleTankDriveTransmissionCommandState* tankDriveTransmissionCommandState, + const PxVehicleClutchCommandResponseParams* clutchResponseParams, + const PxVehicleClutchParams* clutchParams, + const PxVehicleEngineParams* engineParams, + const PxVehicleGearboxParams* gearboxParams, + const PxVehicleAutoboxParams* autoboxParams, + const PxVehicleMultiWheelDriveDifferentialParams* multiWheelDiffParams, + const PxVehicleFourWheelDriveDifferentialParams* fourWheelDiffParams, + const PxVehicleTankDriveDifferentialParams* tankDiffParams, + const PxVehicleClutchCommandResponseState* clutchResponseState, + const PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState, + const PxVehicleEngineState* engineState, + const PxVehicleGearboxState* gearboxState, + const PxVehicleAutoboxState* autoboxState, + const PxVehicleDifferentialState* diffState, + const PxVehicleClutchSlipState* clutchSlipState, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Register per wheel attachment data that involves the vehicle's integration with a PhysX scene. +\param[in] axleDesc is a description of the wheels and axles of a vehicle. +\param[in] physxSuspLimitConstraintParams describes the method used by PhysX to enforce suspension travel limits. +\param[in] physxMaterialFrictionParams describes the friction response of each wheel to a set of PxMaterial instances. +\param[in] physxActor describes the PxRigidActor and PxShape instances that are used to represent the vehicle's rigid body and wheel shapes in PhysX. +\param[in] physxRoadGeometryQueryParams describes the physx scene query method used to place each wheel on the ground. +\param[in] physxRoadGeomState is an array of per wheel physx scene query results. +\param[in] physxConstraintStates is an array of constraints states used by PhysX to enforce sticky tire and suspension travel limit constraints. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If any array is empty, the corresponding data will not be reflected in omnipvd. +\note If physxActor is NULL, the corresponding data will not be reflected in omnipvd. +\note If physxRoadGeometryQueryParams is NULL, the corresponding data will not be reflected in omnipvd. +\note Each array must either be empty or contain an entry for each wheel present in axleDesc. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdPhysXWheelAttachmentWrite +*/ +void PxVehiclePvdPhysXWheelAttachmentRegister +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& physxSuspLimitConstraintParams, + const PxVehicleArrayData& physxMaterialFrictionParams, + const PxVehiclePhysXActor* physxActor, const PxVehiclePhysXRoadGeometryQueryParams* physxRoadGeometryQueryParams, + const PxVehicleArrayData& physxRoadGeomState, + const PxVehicleArrayData& physxConstraintStates, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Write to omnipvd the per wheel attachment data that involves the vehicle's integration with a PhysX scene. +\param[in] axleDesc is a description of the wheels and axles of a vehicle. +\param[in] physxSuspLimitConstraintParams describes the method used by PhysX to enforce suspension travel limits. +\param[in] physxMaterialFrictionParams describes the friction response of each wheel to a set of PxMaterial instances. +\param[in] physxActor describes the PxShape instances that are used to represent the vehicle's wheel shapes in PhysX. +\param[in] physxRoadGeometryQueryParams describes the physx scene query method used to place each wheel on the ground. +\param[in] physxRoadGeomState is an array of per wheel physx scene query results. +\param[in] physxConstraintStates is an array of constraints states used by PhysX to enforce sticky tire and suspension travel limit constraints. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If any array is empty but the corresponding array in PxVehiclePvdPhysXWheelAttachmentRegister() was not empty, the corresponding data will not be updated in omnipvd. +\note If physxActor is NULL but the corresponding argument in PxVehiclePvdPhysXWheelAttachmentRegister was not NULL, the corresponding data will not be reflected in omnipvd. +\note If physxRoadGeometryQueryParams is NULL but the corresponding argument in PxVehiclePvdPhysXWheelAttachmentRegister was not NULL, the corresponding data will not be reflected in omnipvd. +\note Each array must either be empty or contain an entry for each wheel present in axleDesc. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdPhysXWheelAttachmentWrite +*/ +void PxVehiclePvdPhysXWheelAttachmentWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& physxSuspLimitConstraintParams, + const PxVehicleArrayData& physxMaterialFrictionParams, + const PxVehiclePhysXActor* physxActor, const PxVehiclePhysXRoadGeometryQueryParams* physxRoadGeometryQueryParams, + const PxVehicleArrayData& physxRoadGeomState, + const PxVehicleArrayData& physxConstraintStates, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Register the PxRigidActor instance that represents the vehicle's rigid body in a PhysX scene. +\param[in] physxActor describes the PxRigidActor instance that is used to represent the vehicle's rigid body in PhysX. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If physxActor is NULL, the corresponding data will not be reflected in omnipvd. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdPhysXRigidActorWrite +*/ +void PxVehiclePvdPhysXRigidActorRegister +(const PxVehiclePhysXActor* physxActor, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Write the PxRigidActor instance to omnipvd. +\param[in] physxActor describes the PxRigidActor instance that is used to represent the vehicle's rigid body in PhysX. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If physxActor is NULL and the corresponding argument in PxVehiclePvdPhysXRigidActorRegister was not NULL, the corresponding data will not be updated in omnipvd. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdPhysXRigidActorRegister +*/ +void PxVehiclePvdPhysXRigidActorWrite +(const PxVehiclePhysXActor* physxActor, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Register the PhysX related steer state class. +\param[in] physxSteerState describes the PxVehiclePhysXSteerState instance that holds steer related state information. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If physxSteerState is NULL, the corresponding data will not be reflected in omnipvd. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdPhysXSteerStateWrite +*/ +void PxVehiclePvdPhysXSteerStateRegister +(const PxVehiclePhysXSteerState* physxSteerState, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +/** +\brief Write the PxVehiclePhysXSteerState instance to omnipvd. +\param[in] physxSteerState describes the PxVehiclePhysXSteerState instance that holds steer related state information. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If physxSteerState is NULL and the corresponding argument in PxVehiclePvdPhysXSteerStateRegister was not NULL, the corresponding data will not be updated in omnipvd. +\see PxVehiclePvdAttributesCreate +\see PxVehiclePvdObjectCreate +\see PxVehiclePvdPhysXSteerStateRegister +*/ +void PxVehiclePvdPhysXSteerStateWrite +(const PxVehiclePhysXSteerState* physxSteerState, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter& omniWriter); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/pvd/PxVehiclePvdHelpers.h b/engine/third_party/physx/include/vehicle2/pvd/PxVehiclePvdHelpers.h new file mode 100644 index 00000000..d9c12521 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/pvd/PxVehiclePvdHelpers.h @@ -0,0 +1,103 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxSimpleTypes.h" + +class OmniPvdWriter; +namespace physx +{ +class PxAllocatorCallback; +namespace vehicle2 +{ +struct PxVehiclePvdAttributeHandles; +struct PxVehiclePvdObjectHandles; +} +} + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Create the attribute handles necessary to reflect vehicles in omnipvd. +\param[in] allocator is used to allocate the memory used to store the attribute handles. +\param[in] omniWriter is used to register the attribute handles with omnipvd. +\see PxVehicleSimulationContext +\see PxVehiclePVDComponent +\see PxVehiclePvdAttributesRelease +*/ +PxVehiclePvdAttributeHandles* PxVehiclePvdAttributesCreate +(PxAllocatorCallback& allocator, OmniPvdWriter& omniWriter); + +/** +\brief Destory the attribute handles created by PxVehiclePvdAttributesCreate(). +\param[in] allocator must be the instance used by PxVehiclePvdObjectCreate(). +\param[in] attributeHandles is the PxVehiclePvdAttributeHandles created by PxVehiclePvdAttributesCreate(). +\see PxVehiclePvdAttributesCreate +*/ +void PxVehiclePvdAttributesRelease +(PxAllocatorCallback& allocator, PxVehiclePvdAttributeHandles& attributeHandles); + +/** +\brief Create omnipvd objects that will be used to reflect an individual veicle in omnipvd. +\param[in] nbWheels must be greater than or equal to the number of wheels on the vehicle. +\param[in] nbAntirolls must be greater than or equal to the number of antiroll bars on the vehicle. +\param[in] maxNbPhysxMaterialFrictions must be greater than or equal to the number of PxPhysXMaterialFriction instances associated with any wheel of the vehicle. +\param[in] contextHandle is typically used to associated vehicles with a particular scene or group. +\param[in] allocator is used to allocate the memory used to store handles to the created omnipvd objects. +\note PxVehiclePvdObjectCreate() must be called after PxVehiclePvdAttributesCreate(). +\see PxVehicleAxleDescription +\see PxVehicleAntiRollForceParams +\see PxVehiclePhysXMaterialFrictionParams +\see PxVehiclePVDComponent +\see PxVehiclePvdAttributesCreate +*/ +PxVehiclePvdObjectHandles* PxVehiclePvdObjectCreate +(const PxU32 nbWheels, const PxU32 nbAntirolls, const PxU32 maxNbPhysxMaterialFrictions, + const PxU64 contextHandle, PxAllocatorCallback& allocator); + +/** +\brief Destroy the PxVehiclePvdObjectHandles instance created by PxVehiclePvdObjectCreate(). +\param[in] omniWriter is used to register the attribute handles with omnipvd. +\param[in] allocator must be the instance used by PxVehiclePvdObjectCreate(). +\param[in] objectHandles is the PxVehiclePvdObjectHandles that was created by PxVehiclePvdObjectCreate(). +*/ +void PxVehiclePvdObjectRelease +(OmniPvdWriter& omniWriter, PxAllocatorCallback& allocator, PxVehiclePvdObjectHandles& objectHandles); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyComponents.h b/engine/third_party/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyComponents.h new file mode 100644 index 00000000..675f4b1e --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyComponents.h @@ -0,0 +1,110 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "PxVehicleRigidBodyFunctions.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Forward integrate the momentum and pose of the vehicle's rigid body after applying forces and torques +from the suspension, tires and anti-roll bars. +*/ +class PxVehicleRigidBodyComponent : public PxVehicleComponent +{ +public: + + PxVehicleRigidBodyComponent() : PxVehicleComponent() {} + virtual ~PxVehicleRigidBodyComponent() {} + + /** + \brief Retrieve pointers to the parameter and state data required to update the dynamic state of a rigid body. + \param[out] axleDescription must be returned as a non-null pointer to a single PxVehicleAxleDescription instance that describes the wheels and axles + of the vehicle. + \param[out] rigidBodyParams must be returned as a non-null pointer to a single PxVehicleRigidBodyParams instance that describes the mass and moment of + inertia of the rigid body. + \param[out] suspensionForces must be returned as a non-null pointer to an array of suspension forces and torques in the world frame. + The suspension forces and torques will be applied to the rigid body to update *rigidBodyState*. + \param[out] tireForces must be returned as a non-null pointer to an array of tire forces and torques in the world frame. + The tire forces and torques will be applied to the rigid body to update *rigidBodyState*. + \param[out] antiRollTorque may be returned an optionally non-null pointer to a single PxVehicleAntiRollTorque instance that contains the accumulated anti-roll + torque to apply to the rigid body. + \param[out] rigidBodyState imust be returned as a non-null pointer to a single PxVehicleRigidBodyState instance that is to be forward integrated. + \note The suspensionForces array must contain an entry for each wheel listed as an active wheel in axleDescription. + \note The tireForces array must contain an entry for each wheel listed as an active wheel in axleDescription. + \note If antiRollTorque is returned as a null pointer then zero anti-roll torque will be applied to the rigid body. + */ + virtual void getDataForRigidBodyComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleRigidBodyParams*& rigidBodyParams, + PxVehicleArrayData& suspensionForces, + PxVehicleArrayData& tireForces, + const PxVehicleAntiRollTorque*& antiRollTorque, + PxVehicleRigidBodyState*& rigidBodyState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_PROFILE_ZONE("PxVehicleRigidBodyComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleRigidBodyParams* rigidBodyParams; + PxVehicleArrayData suspensionForces; + PxVehicleArrayData tireForces; + const PxVehicleAntiRollTorque* antiRollTorque; + PxVehicleRigidBodyState* rigidBodyState; + + getDataForRigidBodyComponent(axleDescription, rigidBodyParams, + suspensionForces, tireForces, antiRollTorque, + rigidBodyState); + + PxVehicleRigidBodyUpdate( + *axleDescription, *rigidBodyParams, + suspensionForces, tireForces, antiRollTorque, + dt, context.gravity, + *rigidBodyState); + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyFunctions.h b/engine/third_party/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyFunctions.h new file mode 100644 index 00000000..11960096 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyFunctions.h @@ -0,0 +1,76 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxVec3.h" +#include "foundation/PxSimpleTypes.h" +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleRigidBodyParams; +struct PxVehicleSuspensionForce; +struct PxVehicleTireForce; +struct PxVehicleAntiRollTorque; +struct PxVehicleRigidBodyState; + +/** +\brief Forward integrate rigid body state. +\param[in] axleDescription is a description of the axles of the vehicle and the wheels on each axle. +\param[in] rigidBodyParams is a description of rigid body mass and moment of inertia. +\param[in] suspensionForces is an array of suspension forces and torques in the world frame to be applied to the rigid body. +\param[in] tireForces is an array of tire forces and torques in the world frame to be applied to the rigid body. +\param[in] antiRollTorque is an optional pointer to a single PxVehicleAntiRollTorque instance that contains the accumulated anti-roll +torque to apply to the rigid body. +\param[in] dt is the timestep of the forward integration. +\param[in] gravity is gravitational acceleration. +\param[in,out] rigidBodyState is the rigid body state that is to be updated. +\note The suspensionForces array must contain an entry for each wheel listed as an active wheel in axleDescription. +\note The tireForces array must contain an entry for each wheel listed as an active wheel in axleDescription. +\note If antiRollTorque is a null pointer then zero anti-roll torque will be applied to the rigid body. +*/ +void PxVehicleRigidBodyUpdate + (const PxVehicleAxleDescription& axleDescription, const PxVehicleRigidBodyParams& rigidBodyParams, + const PxVehicleArrayData& suspensionForces, + const PxVehicleArrayData& tireForces, + const PxVehicleAntiRollTorque* antiRollTorque, + const PxReal dt, const PxVec3& gravity, + PxVehicleRigidBodyState& rigidBodyState); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyParams.h b/engine/third_party/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyParams.h new file mode 100644 index 00000000..2ff21073 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyParams.h @@ -0,0 +1,87 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxFoundation.h" +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleFunctions.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief The properties of the rigid body. +*/ +struct PxVehicleRigidBodyParams +{ + /** + \brief The mass of the rigid body. + + Range: (0, inf)
+ Unit: mass + */ + PxReal mass; + + /** + \brief The moment of inertia of the rigid body. + + Range: (0, inf)
+ Unit: mass * (length^2) + */ + PxVec3 moi; + + PX_FORCE_INLINE PxVehicleRigidBodyParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PxVehicleRigidBodyParams r = *this; + r.moi = PxVehicleTransformFrameToFrame(srcFrame, trgFrame, moi).abs(); + const PxReal scale = trgScale.scale/srcScale.scale; + r.moi *= (scale*scale); + return r; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(mass > 0.0f, "PxVehicleRigidBodyParams.mass must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(moi.x > 0.0f && moi.y > 0.0f && moi.z> 0.0f, "PxVehicleRigidBodyParams.moi must be greater than zero", false); + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + + diff --git a/engine/third_party/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyStates.h b/engine/third_party/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyStates.h new file mode 100644 index 00000000..1e30aa40 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyStates.h @@ -0,0 +1,94 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxTransform.h" +#include "foundation/PxVec3.h" +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleRigidBodyState +{ + PxTransform pose; //!< the body's pose (in world space) + PxVec3 linearVelocity; //!< the body's linear velocity (in world space) + PxVec3 angularVelocity; //!< the body's angular velocity (in world space) + PxVec3 previousLinearVelocity; //!< the previous linear velocity of the body (in world space) + PxVec3 previousAngularVelocity; //!< the previous angular velocity of the body (in world space) + PxVec3 externalForce; //!< external force (in world space) affecting the rigid body (usually excluding gravitational force) + PxVec3 externalTorque; //!< external torque (in world space) affecting the rigid body + + PX_FORCE_INLINE void setToDefault() + { + pose = PxTransform(PxIdentity); + linearVelocity = PxVec3(PxZero); + angularVelocity = PxVec3(PxZero); + externalForce = PxVec3(PxZero); + externalTorque = PxVec3(PxZero); + } + + /** + \brief Compute the vertical speed of the rigid body transformed to the world frame. + \param[in] frame describes the axes of the vehicle + */ + PX_FORCE_INLINE PxReal getVerticalSpeed(const PxVehicleFrame& frame) const + { + return linearVelocity.dot(pose.q.rotate(frame.getVrtAxis())); + } + + /** + \param[in] frame describes the axes of the vehicle + \brief Compute the lateral speed of the rigid body transformed to the world frame. + */ + PX_FORCE_INLINE PxReal getLateralSpeed(const PxVehicleFrame& frame) const + { + return linearVelocity.dot(pose.q.rotate(frame.getLatAxis())); + } + + /** + \brief Compute the longitudinal speed of the rigid body transformed to the world frame. + \param[in] frame describes the axes of the vehicle + */ + PX_FORCE_INLINE PxReal getLongitudinalSpeed(const PxVehicleFrame& frame) const + { + return linearVelocity.dot(pose.q.rotate(frame.getLngAxis())); + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/roadGeometry/PxVehicleRoadGeometryState.h b/engine/third_party/physx/include/vehicle2/roadGeometry/PxVehicleRoadGeometryState.h new file mode 100644 index 00000000..e17870f0 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/roadGeometry/PxVehicleRoadGeometryState.h @@ -0,0 +1,59 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxPlane.h" +#include "foundation/PxMemory.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleRoadGeometryState +{ + PxPlane plane; //!< the plane under the wheel + PxReal friction; //!< the friction to be used by the tire model + PxVec3 velocity; //!< the velocity of the road geometry + bool hitState; //!< true if a plane is found, false if there is no plane. + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleRoadGeometryState)); + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/steering/PxVehicleSteeringFunctions.h b/engine/third_party/physx/include/vehicle2/steering/PxVehicleSteeringFunctions.h new file mode 100644 index 00000000..5b6c7811 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/steering/PxVehicleSteeringFunctions.h @@ -0,0 +1,76 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxSimpleTypes.h" + +#include "vehicle2/PxVehicleParams.h" +#include "PxVehicleSteeringParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleCommandState; + +/** +\brief Compute the yaw angle response to a steer command. +\param[in] steer is the input steer command value. +\param[in] longitudinalSpeed is the longitudinal speed of the vehicle. +\param[in] wheelId specifies the wheel to have its steer response computed. +\param[in] steerResponseParams specifies the per wheel yaw angle response to the steer command as a nonlinear function of steer command and longitudinal speed. +\param[out] steerResponseState is the yaw angle response to the input steer command. +*/ +void PxVehicleSteerCommandResponseUpdate +(const PxReal steer, const PxReal longitudinalSpeed, + const PxU32 wheelId, const PxVehicleSteerCommandResponseParams& steerResponseParams, + PxReal& steerResponseState); + +/** +\brief Account for Ackermann correction by modifying the per wheel steer response multipliers to engineer an asymmetric steer response across axles. +\param[in] steer is the input steer command value. +\param[in] steerResponseParams describes the maximum response and a response multiplier per axle. +\param[in] ackermannParams is an array that describes the wheels affected by Ackermann steer correction. +\param[in,out] steerResponseStates contains the corrected per wheel steer response multipliers that take account of Ackermann steer correction. +*/ +void PxVehicleAckermannSteerUpdate +(const PxReal steer, const PxVehicleSteerCommandResponseParams& steerResponseParams, + const PxVehicleSizedArrayData& ackermannParams, + PxVehicleArrayData& steerResponseStates); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/steering/PxVehicleSteeringParams.h b/engine/third_party/physx/include/vehicle2/steering/PxVehicleSteeringParams.h new file mode 100644 index 00000000..cfc9c4d2 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/steering/PxVehicleSteeringParams.h @@ -0,0 +1,118 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "foundation/PxFoundation.h" + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/commands/PxVehicleCommandParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleFrame; +struct PxVehicleScale; + +/** +\brief Distribute a steer response to the wheels of a vehicle. +\note The steer angle applied to each wheel on the ith wheel is steerCommand * maxResponse * wheelResponseMultipliers[i]. +\note A typical use case is to set maxResponse to be the vehicle's maximum achievable steer angle +that occurs when the steer command is equal to 1.0. The array wheelResponseMultipliers[i] would then be used +to specify the maximum achievable steer angle per wheel as a fractional multiplier of the vehicle's maximum achievable steer angle. +*/ +struct PxVehicleSteerCommandResponseParams : public PxVehicleCommandResponseParams +{ + PX_FORCE_INLINE PxVehicleSteerCommandResponseParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + if (!axleDesc.isValid()) + return false; + for (PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + PX_CHECK_AND_RETURN_VAL(PxAbs(maxResponse*wheelResponseMultipliers[axleDesc.wheelIdsInAxleOrder[i]]) <= PxPi, + "PxVehicleSteerCommandResponseParams.maxResponse*PxVehicleSteerCommandResponseParams.wheelResponseMultipliers[i] must be in range [-Pi, Pi]", false); + } + return true; + } +}; + +/** +\brief A description of a single axle that is to be affected by Ackermann steer correction. +*/ +struct PxVehicleAckermannParams +{ + PxU32 wheelIds[2]; //!< wheelIds[0] is the id of the wheel that is negative along the lateral axis, wheelIds[1] is the wheel id that is positive along the lateral axis. + PxReal wheelBase; //!< wheelBase is the longitudinal distance between the axle that is affected by Ackermann correction and a reference axle. + PxReal trackWidth; //!< trackWidth is the width of the axle specified by #wheelIds + PxReal strength; //!< is the strength of the correction with 0 denoting no correction and 1 denoting perfect correction. + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + PX_CHECK_AND_RETURN_VAL(0.0f == strength || wheelIds[0] < axleDesc.getNbWheels(), "PxVehicleAckermannParams.wheelIds[0] must be valid wheel", false); + PX_CHECK_AND_RETURN_VAL(0.0f == strength || wheelIds[1] < axleDesc.getNbWheels(), "PxVehicleAckermannParams.wheelIds[1] must be a valid wheel", false); + PX_CHECK_AND_RETURN_VAL(0.0f == strength || wheelIds[0] != wheelIds[1], "PxVehicleAckermannParams.wheelIds[0] and PxVehicleAckermannParams.wheelIds[1] must reference two different wheels", false); + PX_CHECK_AND_RETURN_VAL(0.0f == strength || wheelBase > 0.0f, "PxVehicleAckermannParams.wheelBase must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(0.0f == strength || trackWidth > 0.0f, "PxVehicleAckermannParams.trackWidth must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(strength >= 0.0f && strength <= 1.0f, "PxVehicleAckermannParams.strength must be in range [0,1]", false); + PX_UNUSED(axleDesc); + return true; + } + + PX_FORCE_INLINE PxVehicleAckermannParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleAckermannParams r = *this; + const PxReal scale = trgScale.scale / srcScale.scale; + r.wheelBase *= scale; + r.trackWidth *= scale; + return r; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionComponents.h b/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionComponents.h new file mode 100644 index 00000000..1961ecea --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionComponents.h @@ -0,0 +1,324 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "vehicle2/commands/PxVehicleCommandStates.h" +#include "vehicle2/commands/PxVehicleCommandHelpers.h" +#include "vehicle2/rigidBody/PxVehicleRigidBodyParams.h" +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" +#include "vehicle2/wheel/PxVehicleWheelParams.h" + +#include "PxVehicleSuspensionParams.h" +#include "PxVehicleSuspensionStates.h" +#include "PxVehicleSuspensionFunctions.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + + +class PxVehicleSuspensionComponent : public PxVehicleComponent +{ +public: + + PxVehicleSuspensionComponent() : PxVehicleComponent() {} + virtual ~PxVehicleSuspensionComponent() {} + + /** + \brief Retrieve pointers to the parameter and state data required to compute the suspension state and the forces/torques that arise from the suspension state. + \param[out] axleDescription must be returned as a non-null pointer to a single PxVehicleAxleDescription instance that describes the wheels and axles + of the vehicle. + \param[out] rigidBodyParams must be returned as a a non-null pointer to a single PxVehicleRigidBodyParams instance that describes the mass and moment + of inertia of the vehicle's rigid body. + \param[out] suspensionStateCalculationParams must be returned as a non-null pointer to a single PxVehicleSuspensionStateCalculationParams instance + that describes the jounce computation type etc. + \param[out] steerResponseStates must be returned as a non-null pointer to a single PxVehicleSteerCommandResponseStates instance that describes the steer + state of the wheels. + \param[out] rigidBodyState must be returned as a non-null pointer to a single PxVehicleRigidBodyState instance that describes the pose and momentum of + the vehicle's rigid body. + \param[out] wheelParams must be set to a non-null pointer to an array of PxVehicleWheelParams containing per-wheel parameters for each wheel + referenced by axleDescription. + \param[out] suspensionParams must be set to a non-null pointer to an array of PxVehicleSuspensionParams containing per-wheel parameters for each + wheel referenced by axleDescription. + \param[out] suspensionComplianceParams must be set to a non-null pointer to an array of PxVehicleSuspensionComplianceParams containing per-wheel + parameters for each wheel referenced by axleDescription. + \param[out] suspensionForceParams must be set to a non-null pointer to an array of PxVehicleSuspensionForceParams containing per-wheel parameters + for each wheel referenced by axleDescription. + \param[out] antiRollForceParams is optionally returned as a non-null pointer to an array of PxVehicleAntiRollForceParams with each element in the array + describing a unique anti-roll bar connecting a pair of wheels. + \param[out] wheelRoadGeomStates must be set to non-null pointer to an array of PxVehicleRoadGeometryState containing per-wheel road geometry for + each wheel referenced by axleDescription. + \param[out] suspensionStates must be set to a non-null pointer to an array of PxVehicleSuspensionState containing per-wheel suspension state for each + wheel referenced by axleDescription. + \param[out] suspensionComplianceStates must be set to a non-null pointer to an array of PxVehicleSuspensionComplianceState containing per-wheel suspension + compliance state for each wheel referenced by axleDescription. + \param[out] suspensionForces must be set to a non-null pointer to an array of PxVehicleSuspensionForce containing per-wheel suspension forces for each + wheel referenced by axleDescription. + \param[out] antiRollTorque is optionally returned as a non-null pointer to a single PxVehicleAntiRollTorque instance that will store the accumulated anti-roll + torque to be applied to the vheicle's rigid body. + \note antiRollForceParams and antiRollTorque should be returned either both non-NULL or both NULL. + */ + virtual void getDataForSuspensionComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleRigidBodyParams*& rigidBodyParams, + const PxVehicleSuspensionStateCalculationParams*& suspensionStateCalculationParams, + PxVehicleArrayData& steerResponseStates, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& suspensionParams, + PxVehicleArrayData& suspensionComplianceParams, + PxVehicleArrayData& suspensionForceParams, + PxVehicleSizedArrayData& antiRollForceParams, + PxVehicleArrayData& wheelRoadGeomStates, + PxVehicleArrayData& suspensionStates, + PxVehicleArrayData& suspensionComplianceStates, + PxVehicleArrayData& suspensionForces, + PxVehicleAntiRollTorque*& antiRollTorque) = 0; + + /** + \brief Update the suspension state and suspension compliance state and use those updated states to compute suspension and anti-roll forces/torques + to apply to the vehicle's rigid body. + \param[in] dt is the simulation time that has passed since the last call to PxVehicleSuspensionComponent::update() + \param[in] context describes a variety of global simulation constants such as frame and scale of the simulation and the gravitational acceleration + of the simulated environment. + \note The suspension and anti-roll forces/torques are computed in the world frame. + */ + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_PROFILE_ZONE("PxVehicleSuspensionComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleRigidBodyParams* rigidBodyParams; + const PxVehicleSuspensionStateCalculationParams* suspensionStateCalculationParams; + PxVehicleArrayData steerResponseStates; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData wheelParams; + PxVehicleArrayData suspensionParams; + PxVehicleArrayData suspensionComplianceParams; + PxVehicleArrayData suspensionForceParams; + PxVehicleSizedArrayData antiRollForceParams; + PxVehicleArrayData wheelRoadGeomStates; + PxVehicleArrayData suspensionStates; + PxVehicleArrayData suspensionComplianceStates; + PxVehicleArrayData suspensionForces; + PxVehicleAntiRollTorque* antiRollTorque; + + getDataForSuspensionComponent(axleDescription, rigidBodyParams, suspensionStateCalculationParams, + steerResponseStates, rigidBodyState, + wheelParams, suspensionParams, + suspensionComplianceParams, suspensionForceParams, antiRollForceParams, + wheelRoadGeomStates, suspensionStates, suspensionComplianceStates, + suspensionForces, antiRollTorque); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + //Update the suspension state (jounce, jounce speed) + PxVehicleSuspensionStateUpdate( + wheelParams[wheelId], suspensionParams[wheelId], *suspensionStateCalculationParams, + suspensionForceParams[wheelId].stiffness, suspensionForceParams[wheelId].damping, + steerResponseStates[wheelId], wheelRoadGeomStates[wheelId], + *rigidBodyState, + dt, context.frame, context.gravity, + suspensionStates[wheelId]); + + //Update the compliance from the suspension state. + PxVehicleSuspensionComplianceUpdate( + suspensionParams[wheelId], suspensionComplianceParams[wheelId], + suspensionStates[wheelId], + suspensionComplianceStates[wheelId]); + + //Compute the suspension force from the suspension and compliance states. + PxVehicleSuspensionForceUpdate( + suspensionParams[wheelId], suspensionForceParams[wheelId], + wheelRoadGeomStates[wheelId], suspensionStates[wheelId], + suspensionComplianceStates[wheelId], *rigidBodyState, + context.gravity, rigidBodyParams->mass, + suspensionForces[wheelId]); + } + + if (antiRollForceParams.size>0 && antiRollTorque) + { + PxVehicleAntiRollForceUpdate( + suspensionParams, antiRollForceParams, + suspensionStates.getConst(), suspensionComplianceStates.getConst(), *rigidBodyState, + *antiRollTorque); + } + + return true; + } +}; + +/** +\deprecated This API was introduced with the new Vehicle API for transition purposes but will be removed in a future version. +*/ +class PX_DEPRECATED PxVehicleLegacySuspensionComponent : public PxVehicleComponent +{ +public: + + PxVehicleLegacySuspensionComponent() : PxVehicleComponent() {} + virtual ~PxVehicleLegacySuspensionComponent() {} + + /** + \brief Retrieve pointers to the parameter and state data required to compute the suspension state and the forces/torques that arise from the suspension state. + \param[out] axleDescription must be returned as a non-null pointer to a single PxVehicleAxleDescription instance that describes the wheels and axles + of the vehicle. + \param[out] suspensionStateCalculationParams must be returned as a non-null pointer to a single PxVehicleSuspensionStateCalculationParams instance + that describes the jounce computation type etc. + \param[out] steerResponseStates must be returned as a non-null pointer to a single PxVehicleSteerCommandResponseStates instance that describes the steer + state of the wheels. + \param[out] rigidBodyState must be returned as a non-null pointer to a single PxVehicleRigidBodyState instance that describes the pose and momentum of + the vehicle's rigid body. + \param[out] wheelParams must be set to a non-null pointer to an array of PxVehicleWheelParams containing per-wheel parameters for each wheel + referenced by axleDescription. + \param[out] suspensionParams must be set to a non-null pointer to an array of PxVehicleSuspensionParams containing per-wheel parameters for each + wheel referenced by axleDescription. + \param[out] suspensionComplianceParams must be set to a non-null pointer to an array of PxVehicleSuspensionComplianceParams containing per-wheel + parameters for each wheel referenced by axleDescription. + \param[out] suspensionForceParams must be set to a non-null pointer to an array of PxVehicleSuspensionForceLegacyParams containing per-wheel parameters + for each wheel referenced by axleDescription. + \param[out] antiRollForceParams is optionally returned as a non-null pointer to an array of PxVehicleAntiRollForceParams with each element in the array + describing a unique anti-roll bar connecting a pair of wheels. + \param[out] wheelRoadGeomStates must be set to non-null pointer to an array of PxVehicleRoadGeometryState containing per-wheel road geometry for + each wheel referenced by axleDescription. + \param[out] suspensionStates must be set to a non-null pointer to an array of PxVehicleSuspensionState containing per-wheel suspension state for each + wheel referenced by axleDescription. + \param[out] suspensionComplianceStates must be set to a non-null pointer to an array of PxVehicleSuspensionComplianceState containing per-wheel suspension + compliance state for each wheel referenced by axleDescription. + \param[out] suspensionForces must be set to a non-null pointer to an array of PxVehicleSuspensionForce containing per-wheel suspension forces for each + wheel referenced by axleDescription. + \param[out] antiRollTorque is optionally returned as a non-null pointer to a single PxVehicleAntiRollTorque instance that will store the accumulated anti-roll + torque to be applied to the vheicle's rigid body. + \note antiRollForceParams and antiRollTorque should be returned either both non-NULL or both NULL. + */ + virtual void getDataForLegacySuspensionComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleSuspensionStateCalculationParams*& suspensionStateCalculationParams, + PxVehicleArrayData& steerResponseStates, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& suspensionParams, + PxVehicleArrayData& suspensionComplianceParams, + PxVehicleArrayData& suspensionForceParams, + PxVehicleSizedArrayData& antiRollForceParams, + PxVehicleArrayData& wheelRoadGeomStates, + PxVehicleArrayData& suspensionStates, + PxVehicleArrayData& suspensionComplianceStates, + PxVehicleArrayData& suspensionForces, + PxVehicleAntiRollTorque*& antiRollTorque) = 0; + + /** + \brief Update the suspension state and suspension compliance state and use those updated states to compute suspension and anti-roll forces/torques + to apply to the vehicle's rigid body. + \param[in] dt is the simulation time that has passed since the last call to PxVehicleSuspensionComponent::update() + \param[in] context describes a variety of global simulation constants such as frame and scale of the simulation and the gravitational acceleration + of the simulated environment. + \note The suspension and anti-roll forces are computed in the world frame. + \note PxVehicleLegacySuspensionComponent::update() implements legacy suspension behaviour. + */ + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_PROFILE_ZONE("PxVehicleLegacySuspensionComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleSuspensionStateCalculationParams* suspensionStateCalculationParams; + PxVehicleArrayData steerResponseStates; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData wheelParams; + PxVehicleArrayData suspensionParams; + PxVehicleArrayData suspensionComplianceParams; + PxVehicleArrayData suspensionForceParams; + PxVehicleSizedArrayData antiRollForceParams; + PxVehicleArrayData wheelRoadGeomStates; + PxVehicleArrayData suspensionStates; + PxVehicleArrayData suspensionComplianceStates; + PxVehicleArrayData suspensionForces; + PxVehicleAntiRollTorque* antiRollTorque; + + getDataForLegacySuspensionComponent(axleDescription, suspensionStateCalculationParams, + steerResponseStates, rigidBodyState, wheelParams, + suspensionParams, suspensionComplianceParams, + suspensionForceParams, antiRollForceParams, + wheelRoadGeomStates, suspensionStates, suspensionComplianceStates, + suspensionForces, antiRollTorque); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + //Update the suspension state (jounce, jounce speed) + PxVehicleSuspensionStateUpdate( + wheelParams[wheelId], suspensionParams[wheelId], *suspensionStateCalculationParams, + suspensionForceParams[wheelId].stiffness, suspensionForceParams[wheelId].damping, + steerResponseStates[wheelId], wheelRoadGeomStates[wheelId], *rigidBodyState, + dt, context.frame, context.gravity, + suspensionStates[wheelId]); + + //Update the compliance from the suspension state. + PxVehicleSuspensionComplianceUpdate( + suspensionParams[wheelId], suspensionComplianceParams[wheelId], + suspensionStates[wheelId], + suspensionComplianceStates[wheelId]); + + //Compute the suspension force from the suspension and compliance states. + PxVehicleSuspensionLegacyForceUpdate( + suspensionParams[wheelId], suspensionForceParams[wheelId], + wheelRoadGeomStates[wheelId], suspensionStates[wheelId], + suspensionComplianceStates[wheelId], *rigidBodyState, + context.gravity, + suspensionForces[wheelId]); + } + + if (antiRollForceParams.size>0 && antiRollTorque) + { + PxVehicleAntiRollForceUpdate( + suspensionParams, antiRollForceParams, + suspensionStates.getConst(), suspensionComplianceStates.getConst(), *rigidBodyState, + *antiRollTorque); + } + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionFunctions.h b/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionFunctions.h new file mode 100644 index 00000000..cf40bdee --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionFunctions.h @@ -0,0 +1,163 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxVec3.h" +#include "foundation/PxSimpleTypes.h" +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleWheelParams; +struct PxVehicleSuspensionParams; +struct PxVehicleSuspensionStateCalculationParams; +struct PxVehicleRoadGeometryState; +struct PxVehicleRigidBodyState; +struct PxVehicleSuspensionState; +struct PxVehicleSuspensionComplianceParams; +struct PxVehicleSuspensionComplianceState; +struct PxVehicleSuspensionForceParams; +struct PxVehicleSuspensionForce; +struct PxVehicleSuspensionForceLegacyParams; +struct PxVehicleAntiRollForceParams; +struct PxVehicleAntiRollTorque; + +/** +\brief Compute the suspension compression and compression speed for a single suspension. +\param[in] wheelParams is a description of the radius and half-width of the wheel on the suspension. +\param[in] suspensionParams is a description of the suspension and wheel frames. +\param[in] suspensionStateCalcParams specifies whether to compute the suspension compression by either +raycasting or sweeping against the plane of the road geometry under the wheel. +\param[in] suspensionStiffness is the stiffness of the suspension +\param[in] suspensionDamping is the damping rate of the suspension. +or whether to apply a limit to the expansion speed so that the wheel may not reach the ground. +\param[in] steerAngle is the yaw angle (in radians) of the wheel. +\param[in] roadGeometryState describes the plane under the wheel. +\param[in] rigidBodyState describes the pose of the rigid body. +\param[in] dt is the simulation time that has lapsed since the last call to PxVehicleSuspensionStateUpdate +\param[in] frame describes the longitudinal, lateral and vertical axes of the vehicle. +\param[in] gravity is the gravitational acceleration that acts on the suspension sprung mass. +\param[in,out] suspState is the compression (jounce) and compression speed of the suspension. +*/ +void PxVehicleSuspensionStateUpdate +(const PxVehicleWheelParams& wheelParams, const PxVehicleSuspensionParams& suspensionParams, const PxVehicleSuspensionStateCalculationParams& suspensionStateCalcParams, + const PxReal suspensionStiffness, const PxReal suspensionDamping, + const PxReal steerAngle, const PxVehicleRoadGeometryState& roadGeometryState, const PxVehicleRigidBodyState& rigidBodyState, + const PxReal dt, const PxVehicleFrame& frame, const PxVec3& gravity, + PxVehicleSuspensionState& suspState); + +/** +\brief Compute the toe, camber and force application points that are affected by suspension compression. +\param[in] suspensionParams is a description of the suspension and wheel frames. +\param[in] complianceParams describes how toe, camber and force application points are affected by suspension compression. +\param[in] suspensionState describes the current suspension compression. +\param[in] complianceState is the computed toe, camber and force application points. +*/ +void PxVehicleSuspensionComplianceUpdate +(const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleSuspensionComplianceParams& complianceParams, + const PxVehicleSuspensionState& suspensionState, + PxVehicleSuspensionComplianceState& complianceState); + +/** +\brief Compute the suspension force and torque arising from suspension compression and speed. +\param[in] suspensionParams is a description of the suspension and wheel frames. +\param[in] suspensionForceParams describes the conversion of suspension state to suspension force. +\param[in] roadGeometryState describes the plane under the wheel of the suspension. +\param[in] suspensionState is the current compression state of the suspension. +\param[in] complianceState is the current compliance state of the suspension. +\param[in] rigidBodyState describes the current pose of the rigid body. +\param[in] gravity is the gravitational acceleration. +\param[in] vehicleMass is the rigid body mass. +\param[out] suspensionForce is the force and torque to apply to the rigid body arising from the suspension state. +*/ +void PxVehicleSuspensionForceUpdate +(const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleSuspensionForceParams& suspensionForceParams, + const PxVehicleRoadGeometryState& roadGeometryState, const PxVehicleSuspensionState& suspensionState, + const PxVehicleSuspensionComplianceState& complianceState, const PxVehicleRigidBodyState& rigidBodyState, + const PxVec3& gravity, const PxReal vehicleMass, + PxVehicleSuspensionForce& suspensionForce); + + +/** +\deprecated This API was introduced with the new Vehicle API for transition purposes but will be removed in a future version. + +\brief Compute the suspension force and torque arising from suspension compression and speed. +\param[in] suspensionParams is a description of the suspension and wheel frames. +\param[in] suspensionForceParams describes the conversion of suspension state to suspension force. +\param[in] roadGeometryState describes the plane under the wheel of the suspension. +\param[in] suspensionState is the current compression state of the suspension. +\param[in] complianceState is the current compliance state of the suspension. +\param[in] rigidBodyState describes the current pose of the rigid body. +\param[in] gravity is the gravitational acceleration. +\param[out] suspensionForce is the force and torque to apply to the rigid body arising from the suspension state. +\note PxVehicleSuspensionLegacyForceUpdate implements the legacy force computation of PhysX 5.0 and earlier. +*/ +PX_DEPRECATED void PxVehicleSuspensionLegacyForceUpdate +(const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleSuspensionForceLegacyParams& suspensionForceParams, + const PxVehicleRoadGeometryState& roadGeometryState, const PxVehicleSuspensionState& suspensionState, + const PxVehicleSuspensionComplianceState& complianceState, const PxVehicleRigidBodyState& rigidBodyState, + const PxVec3& gravity, + PxVehicleSuspensionForce& suspensionForce); + +/** +\brief Compute the accumulated anti-roll torque to apply to the vehicle's rigid body. +\param[in] suspensionParams The suspension parameters for each wheel. +\param[in] antiRollParams describes the wheel pairs connected by anti-roll bars and the strength of each anti-roll bar. +\param[in] suspensionStates The suspension states for each wheel. +\param[in] complianceStates The suspension compliance states for each wheel. +\param[in] rigidBodyState describes the pose and momentum of the vehicle's rigid body in the world frame. +\param[in] antiRollTorque is the accumulated anti-roll torque that is computed by iterating over all anti-roll bars +describes in *antiRollParams*. +\note suspensionParams must contain an entry for each wheel index referenced by *antiRollParams*. +\note suspensionStates must contain an entry for each wheel index referenced by *antiRollParams*. +\note complianceStates must contain an entry for each wheel index referenced by *antiRollParams*. +\note antiRollTorque is expressed in the world frame. +*/ +void PxVehicleAntiRollForceUpdate +(const PxVehicleArrayData& suspensionParams, + const PxVehicleSizedArrayData& antiRollParams, + const PxVehicleArrayData& suspensionStates, + const PxVehicleArrayData& complianceStates, + const PxVehicleRigidBodyState& rigidBodyState, + PxVehicleAntiRollTorque& antiRollTorque); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionHelpers.h b/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionHelpers.h new file mode 100644 index 00000000..dcd8e919 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionHelpers.h @@ -0,0 +1,149 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "foundation/PxTransform.h" + +#include "vehicle2/wheel/PxVehicleWheelParams.h" +#include "vehicle2/wheel/PxVehicleWheelHelpers.h" + +#include "PxVehicleSuspensionParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Compute suspension travel direction in the world frame. +\param[in] suspensionParams is a description of the suspension frame. +\param[in] rigidBodyPose is the current pose of the vehicle's rigid body. +\return The return value is the suspension travel direction in the world frame. +\note The suspension travel direction is used to perform queries against the road geometry. +*/ +PX_FORCE_INLINE PxVec3 PxVehicleComputeSuspensionDirection(const PxVehicleSuspensionParams& suspensionParams, const PxTransform& rigidBodyPose) +{ + const PxVec3 suspDir = rigidBodyPose.rotate(suspensionParams.suspensionTravelDir); + return suspDir; +} + +/** +\brief Compute the start pose of a suspension query. +\param[in] frame is a description of the longitudinal, lateral and vertical axes. +\param[in] suspensionParams is a description of the suspension frame. +\param[in] steerAngle is the yaw angle of the wheel in radians. +\param[in] rigidBodyPose is the pose of the rigid body in the world frame. +*/ +PX_FORCE_INLINE PxTransform PxVehicleComputeWheelPoseForSuspensionQuery(const PxVehicleFrame& frame, const PxVehicleSuspensionParams& suspensionParams, + const PxReal steerAngle, const PxTransform& rigidBodyPose) +{ + //Compute the wheel pose with zero travel from attachment point, zero compliance, + //zero wheel pitch (ignore due to radial symmetry). + //Zero travel from attachment point (we want the wheel pose at the top of the suspension, i.e., at max compression) + PxVehicleSuspensionState suspState; + suspState.setToDefault(); + //Compute the wheel pose. + const PxTransform wheelPose = PxVehicleComputeWheelPose(frame, suspensionParams, suspState, 0.0f, 0.0f, steerAngle, rigidBodyPose, + 0.0f); + + return wheelPose; +} + +/** +\brief Compute the start point, direction and length of a suspension scene raycast. +\param[in] frame is a description of the longitudinal, lateral and vertical axes. +\param[in] wheelParams describes the radius and halfwidth of the wheel. +\param[in] suspensionParams describes the suspension frame and the maximum suspension travel. +\param[in] steerAngle is the yaw angle of the wheel in radians. +\param[in] rigidBodyPose is the pose of the rigid body in the world frame. +\param[out] start is the starting point of the raycast in the world frame. +\param[out] dir is the direction of the raycast in the world frame. +\param[out] dist is the length of the raycast. +\note start, dir and dist together describe a raycast that begins at the top of wheel at maximum compression +and ends at the bottom of wheel at maximum droop. +*/ +PX_FORCE_INLINE void PxVehicleComputeSuspensionRaycast +(const PxVehicleFrame& frame, const PxVehicleWheelParams& wheelParams, const PxVehicleSuspensionParams& suspensionParams, + const PxF32 steerAngle, const PxTransform& rigidBodyPose, + PxVec3& start, PxVec3& dir, PxReal& dist) +{ + const PxTransform wheelPose = PxVehicleComputeWheelPoseForSuspensionQuery(frame, suspensionParams, steerAngle, rigidBodyPose); + + //Raycast from top of wheel at max compression to bottom of wheel at max droop. + dir = PxVehicleComputeSuspensionDirection(suspensionParams, rigidBodyPose); + start = wheelPose.p - dir * wheelParams.radius; + dist = suspensionParams.suspensionTravelDist + 2.0f*wheelParams.radius; +} + +/** +\brief Compute the start pose, direction and length of a suspension scene sweep. +\param[in] frame is a description of the longitudinal, lateral and vertical axes. +\param[in] suspensionParams describes the suspension frame and the maximum suspension travel. +\param[in] steerAngle is the yaw angle of the wheel in radians. +\param[in] rigidBodyPose is the pose of the rigid body in the world frame. +\param[out] start is the start pose of the sweep in the world frame. +\param[out] dir is the direction of the sweep in the world frame. +\param[out] dist is the length of the sweep. +\note start, dir and dist together describe a sweep that begins with the wheel placed at maximum +compression and ends at the maximum droop pose. +*/ +PX_FORCE_INLINE void PxVehicleComputeSuspensionSweep +(const PxVehicleFrame& frame, const PxVehicleSuspensionParams& suspensionParams, + const PxReal steerAngle, const PxTransform& rigidBodyPose, + PxTransform& start, PxVec3& dir, PxReal& dist) +{ + start = PxVehicleComputeWheelPoseForSuspensionQuery(frame, suspensionParams, steerAngle, rigidBodyPose); + dir = PxVehicleComputeSuspensionDirection(suspensionParams, rigidBodyPose); + dist = suspensionParams.suspensionTravelDist; +} + + +/** +\brief Compute the sprung masses of the suspension springs given (i) the number of sprung masses, +(ii) coordinates of the sprung masses in the rigid body frame, (iii) the center of mass offset of the rigid body, (iv) the +total mass of the rigid body, and (v) the direction of gravity +\param[in] nbSprungMasses is the number of sprung masses of the vehicle. This value corresponds to the number of wheels on the vehicle. +\param[in] sprungMassCoordinates are the coordinates of the sprung masses in the rigid body frame. The array sprungMassCoordinates must be of +length nbSprungMasses or greater. +\param[in] totalMass is the total mass of all the sprung masses. +\param[in] gravityDirection describes the direction of gravitational acceleration. +\param[out] sprungMasses are the masses to set in the associated suspension data with PxVehicleSuspensionData::mSprungMass. The sprungMasses array must be of length +nbSprungMasses or greater. Each element in the sprungMasses array corresponds to the suspension located at the same array element in sprungMassCoordinates. +The center of mass of the masses in sprungMasses with the coordinates in sprungMassCoordinates satisfy the specified centerOfMass. +\return True if the sprung masses were successfully computed, false if the sprung masses were not successfully computed. +*/ +bool PxVehicleComputeSprungMasses(const PxU32 nbSprungMasses, const PxVec3* sprungMassCoordinates, const PxReal totalMass, const PxVehicleAxes::Enum gravityDirection, PxReal* sprungMasses); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionParams.h b/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionParams.h new file mode 100644 index 00000000..28dab468 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionParams.h @@ -0,0 +1,411 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxTransform.h" +#include "foundation/PxFoundation.h" + +#include "common/PxCoreUtilityTypes.h" + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleFunctions.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleSuspensionParams +{ + /** + \brief suspensionAttachment specifies the wheel pose at maximum compression. + \note suspensionAttachment is specified in the frame of the rigid body. + \note camber, steer and toe angles are all applied in the suspension frame. + */ + PxTransform suspensionAttachment; + + /** + \brief suspensionTravelDir specifies the direction of suspension travel. + \note suspensionTravelDir is specified in the frame of the rigid body. + */ + PxVec3 suspensionTravelDir; + + /** + \brief suspensionTravelDist is the maximum distance that the suspenson can elongate along #suspensionTravelDir + from the pose specified by #suspensionAttachment. + \note The position suspensionAttachment.p + #suspensionTravelDir*#suspensionTravelDist corresponds to the + the suspension at maximum droop in the rigid body frame. + */ + PxReal suspensionTravelDist; + + /** + \brief wheelAttachment is the pose of the wheel in the suspension frame. + \note The rotation angle around the wheel's lateral axis is applied in the wheel attachment frame. + */ + PxTransform wheelAttachment; + + + PX_FORCE_INLINE PxVehicleSuspensionParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PxVehicleSuspensionParams r = *this; + r.suspensionAttachment = PxVehicleTransformFrameToFrame(srcFrame, trgFrame, srcScale, trgScale, suspensionAttachment); + r.suspensionTravelDir = PxVehicleTransformFrameToFrame(srcFrame, trgFrame, suspensionTravelDir); + r.suspensionTravelDist *= (trgScale.scale/srcScale.scale); + r.wheelAttachment = PxVehicleTransformFrameToFrame(srcFrame, trgFrame, srcScale, trgScale, wheelAttachment); + return r; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(suspensionAttachment.isValid(), "PxVehicleSuspensionParams.suspensionAttachment must be a valid transform", false); + PX_CHECK_AND_RETURN_VAL(suspensionTravelDir.isFinite(), "PxVehicleSuspensionParams.suspensionTravelDir must be a valid vector", false); + PX_CHECK_AND_RETURN_VAL(suspensionTravelDir.isNormalized(), "PxVehicleSuspensionParams.suspensionTravelDir must be a unit vector", false); + PX_CHECK_AND_RETURN_VAL(suspensionTravelDist > 0.0f, "PxVehicleSuspensionParams.suspensionTravelDist must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(wheelAttachment.isValid(), "PxVehicleSuspensionParams.wheelAttachment must be a valid transform", false); + return true; + } +}; + +struct PxVehicleSuspensionJounceCalculationType +{ + enum Enum + { + eRAYCAST, //!< The jounce is calculated using a raycast against the plane of the road geometry state + eSWEEP, //!< The jounce is calculated by sweeping a cylinder against the plane of the road geometry state + eMAX_NB + }; +}; + +struct PxVehicleSuspensionStateCalculationParams +{ + PxVehicleSuspensionJounceCalculationType::Enum suspensionJounceCalculationType; + + /** + \brief Limit the suspension expansion dynamics. + + If a hit with the ground is detected, the suspension jounce will be set such that the wheel + is placed on the ground. This can result in large changes to jounce within a single + simulation frame, if the ground surface has high frequency or if the simulation time step + is large. As a result, large damping forces can evolve and cause undesired behavior. If this + parameter is set to true, the suspension expansion speed will be limited to what can be + achieved given the time step, suspension stiffness etc. As a consequence, handling of the + vehicle will be affected as the wheel might loose contact with the ground more easily. + */ + bool limitSuspensionExpansionVelocity; + + PX_FORCE_INLINE PxVehicleSuspensionStateCalculationParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid() const + { + return true; + } +}; + +/** +\brief Compliance describes how toe and camber angle and force application points are affected by suspension compression. +\note Each compliance term is in the form of a graph with up to 3 points. +\note Each point in the graph has form (jounce/suspensionTravelDist, complianceValue). +\note The sequence of points must respresent monotonically increasing values of jounce. +\note The compliance value can be computed by linear interpolation. +\note If any graph has zero points in it, a value of 0.0 is used for the compliance value. +\note If any graph has 1 point in it, the compliance value of that point is used directly. +*/ +struct PxVehicleSuspensionComplianceParams +{ + /** + \brief A graph of toe angle against jounce/suspensionTravelDist with the toe angle expressed in radians. + \note The toe angle is applied in the suspension frame. + */ + PxVehicleFixedSizeLookupTable wheelToeAngle; + + /** + \brief A graph of camber angle against jounce/suspensionTravelDist with the camber angle expressed in radians. + \note The camber angle is applied in the suspension frame. + */ + PxVehicleFixedSizeLookupTable wheelCamberAngle; + + /** + \brief Suspension forces are applied at an offset from the suspension frame. suspForceAppPoint + specifies the (X, Y, Z) components of that offset as a function of jounce/suspensionTravelDist. + */ + PxVehicleFixedSizeLookupTable suspForceAppPoint; + + /** + \brief Tire forces are applied at an offset from the suspension frame. tireForceAppPoint + specifies the (X, Y, Z) components of that offset as a function of jounce/suspensionTravelDist. + */ + PxVehicleFixedSizeLookupTable tireForceAppPoint; + + PX_FORCE_INLINE PxVehicleSuspensionComplianceParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleSuspensionComplianceParams r = *this; + + const PxReal scale = trgScale.scale / srcScale.scale; + for (PxU32 i = 0; i < r.suspForceAppPoint.nbDataPairs; i++) + { + r.suspForceAppPoint.yVals[i] = PxVehicleTransformFrameToFrame(srcFrame, trgFrame, suspForceAppPoint.yVals[i]); + r.suspForceAppPoint.yVals[i] *= scale; + } + for (PxU32 i = 0; i < r.tireForceAppPoint.nbDataPairs; i++) + { + r.tireForceAppPoint.yVals[i] = PxVehicleTransformFrameToFrame(srcFrame, trgFrame, tireForceAppPoint.yVals[i]); + r.tireForceAppPoint.yVals[i] *= scale; + } + return r; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(wheelToeAngle.isValid(), "PxVehicleSuspensionComplianceParams.wheelToeAngle is invalid", false); + PX_CHECK_AND_RETURN_VAL(wheelCamberAngle.isValid(), "PxVehicleSuspensionComplianceParams.wheelCamberAngle is invalid", false); + PX_CHECK_AND_RETURN_VAL(suspForceAppPoint.isValid(), "PxVehicleSuspensionComplianceParams.wheelToeAngle is invalid", false); + PX_CHECK_AND_RETURN_VAL(tireForceAppPoint.isValid(), "PxVehicleSuspensionComplianceParams.wheelCamberAngle is invalid", false); + + for (PxU32 i = 0; i < wheelToeAngle.nbDataPairs; i++) + { + PX_CHECK_AND_RETURN_VAL(wheelToeAngle.xVals[i] >= 0.0f && wheelToeAngle.xVals[i] <= 1.0f, "PxVehicleSuspensionComplianceParams.wheelToeAngle must be an array of points (x,y) with x in range [0, 1]", false); + PX_CHECK_AND_RETURN_VAL(wheelToeAngle.yVals[i] >= -PxPi && wheelToeAngle.yVals[i] <= PxPi, "PxVehicleSuspensionComplianceParams.wheelToeAngle must be an array of points (x,y) with y in range [-Pi, Pi]", false); + } + for (PxU32 i = 0; i < wheelCamberAngle.nbDataPairs; i++) + { + PX_CHECK_AND_RETURN_VAL(wheelCamberAngle.xVals[i] >= 0.0f && wheelCamberAngle.xVals[i] <= 1.0f, "PxVehicleSuspensionComplianceParams.wheelCamberAngle must be an array of points (x,y) with x in range [0, 1]", false); + PX_CHECK_AND_RETURN_VAL(wheelCamberAngle.yVals[i] >= -PxPi && wheelCamberAngle.yVals[i] <= PxPi, "PxVehicleSuspensionComplianceParams.wheelCamberAngle must be an array of points (x,y) with y in range [-Pi, Pi]", false); + } + + for (PxU32 i = 0; i < suspForceAppPoint.nbDataPairs; i++) + { + PX_CHECK_AND_RETURN_VAL(suspForceAppPoint.xVals[i] >= 0.0f && suspForceAppPoint.xVals[i] <= 1.0f, "PxVehicleSuspensionComplianceParams.suspForceAppPoint[0] must be an array of points (x,y) with x in range [0, 1]", false); + } + for (PxU32 i = 0; i < tireForceAppPoint.nbDataPairs; i++) + { + PX_CHECK_AND_RETURN_VAL(tireForceAppPoint.xVals[i] >= 0.0f && tireForceAppPoint.xVals[i] <= 1.0f, "PxVehicleSuspensionComplianceParams.tireForceAppPoint[0] must be an array of points (x,y) with x in range [0, 1]", false); + } + return true; + } +}; + +/** +\brief Suspension force is computed by converting suspenson state to suspension force under the assumption of a linear spring. +\see PxVehicleSuspensionForceUpdate +*/ +struct PxVehicleSuspensionForceParams +{ + /** + \brief Spring strength of suspension. + + Range: (0, inf)
+ Unit: mass / (time^2) + */ + PxReal stiffness; + + /** + \brief Spring damper rate of suspension. + + Range: [0, inf)
+ Unit: mass / time + */ + PxReal damping; + + /** + \brief Part of the vehicle mass that is supported by the suspension spring. + + Range: (0, inf)
+ Unit: mass + */ + PxReal sprungMass; + + PX_FORCE_INLINE PxVehicleSuspensionForceParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(stiffness > 0.0f, "PxVehicleSuspensionForceParams.stiffness must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(damping >= 0.0f, "PxVehicleSuspensionForceParams.damping must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(sprungMass > 0.0f, "PxVehicleSuspensionForceParams.sprungMass must be greater than zero", false); + return true; + } +}; + +/** +\deprecated This API was introduced with the new Vehicle API for transition purposes but will be removed in a future version. + +\brief Suspension force is computed by converting suspenson state to suspension force under the assumption of a linear spring. +\see PxVehicleSuspensionLegacyForceUpdate +*/ +struct PX_DEPRECATED PxVehicleSuspensionForceLegacyParams +{ + /** + \brief Spring strength of suspension. + + Range: (0, inf)
+ Unit: mass / (time^2) + */ + PxReal stiffness; + + /** + \brief Spring damper rate of suspension. + + Range: [0, inf)
+ Unit: mass / time + */ + PxReal damping; + + /** + \brief The suspension compression that balances the gravitational force acting on the sprung mass. + + Range: (0, inf)
+ Unit: length + */ + PxReal restDistance; + + /** + \brief The mass supported by the suspension spring. + + Range: (0, inf)
+ Unit: mass + */ + PxReal sprungMass; + + PX_FORCE_INLINE PxVehicleSuspensionForceLegacyParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleSuspensionForceLegacyParams r = *this; + r.restDistance *= (trgScale.scale / srcScale.scale); + return *this; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(stiffness > 0.0f, "PxVehicleSuspensionForceLegacyParams.stiffness must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(damping >= 0.0f, "PxVehicleSuspensionForceLegacyParams.damping must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(restDistance > 0.0f, "PxVehicleSuspensionForceLegacyParams.restDistance must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(sprungMass > 0.0f, "PxVehicleSuspensionForceLegacyParams.sprungMass must be greater than zero", false); + return true; + } + +}; + +/** +\brief The purpose of the anti-roll bar is to generate a torque to apply to the vehicle's rigid body that will reduce the jounce difference arising +between any pair of chosen wheels. If the chosen wheels share an axle, the anti-roll bar will attempt to reduce the roll angle of the vehicle's rigid body. +Alternatively, if the chosen wheels are the front and rear wheels along one side of the vehicle, the anti-roll bar will attempt to reduce the pitch angle of the +vehicle's rigid body. +*/ +struct PxVehicleAntiRollForceParams +{ + /* + \brief The anti-roll bar connects two wheels with indices wheel0 and wheel1 + \note wheel0 and wheel1 may be chosen to have the effect of an anti-dive bar or to have the effect of an anti-roll bar. + */ + PxU32 wheel0; + + /* + \brief The anti-roll bar connects two wheels with indices wheel0 and wheel1 + \note wheel0 and wheel1 may be chosen to have the effect of an anti-dive bar or to have the effect of an anti-roll bar. + */ + PxU32 wheel1; + + /* + \brief The linear stiffness of the anti-roll bar. + \note A positive stiffness will work to reduce the discrepancy in jounce between wheel0 and wheel1. + \note A negative stiffness will work to increase the discrepancy in jounce between wheel0 and wheel1. + + Unit: mass / (time^2) + */ + PxReal stiffness; + + PX_FORCE_INLINE PxVehicleAntiRollForceParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + if (!PxIsFinite(stiffness)) + return false; + if (wheel0 == wheel1) + return false; + + //Check that each wheel id is a valid wheel. + const PxU32 wheelIds[2] = { wheel0, wheel1 }; + for (PxU32 k = 0; k < 2; k++) + { + const PxU32 wheelToFind = wheelIds[k]; + bool foundWheelInAxleDescription = false; + for (PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheel = axleDesc.wheelIdsInAxleOrder[i]; + if (wheel == wheelToFind) + { + foundWheelInAxleDescription = true; + } + } + if (!foundWheelInAxleDescription) + return false; + } + + return true; + } +}; + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionStates.h b/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionStates.h new file mode 100644 index 00000000..e540e7fd --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/suspension/PxVehicleSuspensionStates.h @@ -0,0 +1,185 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec3.h" +#include "foundation/PxMemory.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +#define PX_VEHICLE_UNSPECIFIED_JOUNCE PX_MAX_F32 +#define PX_VEHICLE_UNSPECIFIED_SEPARATION PX_MAX_F32 + +/** + +*/ +struct PxVehicleSuspensionState +{ + /** + \brief jounce is the distance from maximum droop. + \note jounce is positive semi-definite + \note A value of 0.0 represents the suspension at maximum droop and zero suspension force. + \note A value of suspensionTravelDist represents the suspension at maximum compression. + \note jounce is clamped in range [0, suspensionTravelDist]. + */ + PxReal jounce; + + /** + \brief jounceSpeed is the rate of change of jounce. + */ + PxReal jounceSpeed; + + /** + \brief separation holds extra information about the contact state of the wheel with the ground. + + If the suspension travel range is enough to place the wheel on the ground, then separation will be 0. + If separation holds a negative value, then the wheel penetrates into the ground at maximum compression + as well as maximum droop. The suspension would need to go beyond maximum compression (ground normal + pointing in opposite direction of suspension) or beyond maximum droop (ground normal pointing in same + direction as suspension) to place the wheel on the ground. In that case the separation value defines + how much the wheel penetrates into the ground along the ground plane normal. This penetration may be + resolved by using a constraint that simulates the effect of a bump stop. + If separation holds a positive value, then the wheel does not penetrate the ground at maximum droop + but can not touch the ground because the suspension would need to expand beyond max droop to reach it + or because the suspension could not expand fast enough to reach the ground. + */ + PxReal separation; + + PX_FORCE_INLINE void setToDefault(const PxReal _jounce = PX_VEHICLE_UNSPECIFIED_JOUNCE, + const PxReal _separation = PX_VEHICLE_UNSPECIFIED_SEPARATION) + { + jounce = _jounce; + jounceSpeed = 0; + separation = _separation; + } +}; + +/** +\brief The effect of suspension compliance on toe and camber angle and on the tire and suspension force application points. +*/ +struct PxVehicleSuspensionComplianceState +{ + /** + \brief The toe angle in radians that arises from suspension compliance. + \note toe is expressed in the suspension frame. + */ + PxReal toe; + + /** + \brief The camber angle in radians that arises from suspension compliance. + \note camber is expressed in the suspension frame. + */ + PxReal camber; + + /** + \brief The tire force application point that arises from suspension compliance. + \note tireForceAppPoint is expressed in the suspension frame. + */ + PxVec3 tireForceAppPoint; + + /** + \brief The suspension force application point that arises from suspension compliance. + \note suspForceAppPoint is expressed in the suspension frame. + */ + PxVec3 suspForceAppPoint; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleSuspensionComplianceState)); + } +}; + +/** +\brief The force and torque for a single suspension to apply to the vehicle's rigid body. +*/ +struct PxVehicleSuspensionForce +{ + /** + \brief The force to apply to the rigid body. + \note force is expressed in the world frame. + + Unit: mass * length / (time^2) + */ + PxVec3 force; + + /** + \brief The torque to apply to the rigid body. + \note torque is expressed in the world frame. + + Unit: mass * (length^2) / (time^2) + */ + PxVec3 torque; + + /** + \brief The component of force that lies along the normal of the plane under the wheel. + \note normalForce may be used by the tire model as the tire load. + + Unit: mass * length / (time^2) + */ + PxReal normalForce; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleSuspensionForce)); + } +}; + +/** +\brief The anti-roll torque of all anti-roll bars accumulates in a single torque to apply +to the vehicle's rigid body. +*/ +struct PxVehicleAntiRollTorque +{ + /** + \brief The accumulated torque to apply to the rigid body. + \note antiRollTorque is expressed in the world frame. + + Unit: mass * (length^2) / (time^2) + */ + PxVec3 antiRollTorque; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleAntiRollTorque)); + } +}; + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireComponents.h b/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireComponents.h new file mode 100644 index 00000000..63fb0929 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireComponents.h @@ -0,0 +1,341 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +#pragma once + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "vehicle2/commands/PxVehicleCommandHelpers.h" +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionStates.h" +#include "vehicle2/wheel/PxVehicleWheelStates.h" +#include "vehicle2/wheel/PxVehicleWheelParams.h" +#include "vehicle2/wheel/PxVehicleWheelHelpers.h" + +#include "PxVehicleTireFunctions.h" +#include "PxVehicleTireParams.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +class PxVehicleTireComponent : public PxVehicleComponent +{ +public: + + PxVehicleTireComponent() : PxVehicleComponent() {} + virtual ~PxVehicleTireComponent() {} + + virtual void getDataForTireComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleArrayData& steerResponseStates, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& actuationStates, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& suspensionParams, + PxVehicleArrayData& tireForceParams, + PxVehicleArrayData& roadGeomStates, + PxVehicleArrayData& suspensionStates, + PxVehicleArrayData& suspensionComplianceStates, + PxVehicleArrayData& suspensionForces, + PxVehicleArrayData& wheelRigidBody1DStates, + PxVehicleArrayData& tireGripStates, + PxVehicleArrayData& tireDirectionStates, + PxVehicleArrayData& tireSpeedStates, + PxVehicleArrayData& tireSlipStates, + PxVehicleArrayData& tireCamberAngleStates, + PxVehicleArrayData& tireStickyStates, + PxVehicleArrayData& tireForces) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_PROFILE_ZONE("PxVehicleTireComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleArrayData steerResponseStates; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData actuationStates; + PxVehicleArrayData wheelParams; + PxVehicleArrayData suspensionParams; + PxVehicleArrayData tireForceParams; + PxVehicleArrayData roadGeomStates; + PxVehicleArrayData suspensionStates; + PxVehicleArrayData suspensionComplianceStates; + PxVehicleArrayData suspensionForces; + PxVehicleArrayData wheelRigidBody1DStates; + PxVehicleArrayData tireGripStates; + PxVehicleArrayData tireDirectionStates; + PxVehicleArrayData tireSpeedStates; + PxVehicleArrayData tireSlipStates; + PxVehicleArrayData tireCamberAngleStates; + PxVehicleArrayData tireStickyStates; + PxVehicleArrayData tireForces; + + getDataForTireComponent(axleDescription, steerResponseStates, + rigidBodyState, actuationStates, wheelParams, suspensionParams, tireForceParams, + roadGeomStates, suspensionStates, suspensionComplianceStates, suspensionForces, + wheelRigidBody1DStates, tireGripStates, tireDirectionStates, tireSpeedStates, + tireSlipStates, tireCamberAngleStates, tireStickyStates, tireForces); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + const bool isWheelOnGround = PxVehicleIsWheelOnGround(suspensionStates[wheelId]); + + //Compute the tire slip directions + PxVehicleTireDirsUpdate( + suspensionParams[wheelId], + steerResponseStates[wheelId], + roadGeomStates[wheelId].plane.n, isWheelOnGround, + suspensionComplianceStates[wheelId], + *rigidBodyState, + context.frame, + tireDirectionStates[wheelId]); + + //Compute the rigid body speeds along the tire slip directions. + PxVehicleTireSlipSpeedsUpdate( + wheelParams[wheelId], suspensionParams[wheelId], + steerResponseStates[wheelId], suspensionStates[wheelId], tireDirectionStates[wheelId], + *rigidBodyState, roadGeomStates[wheelId], + context.frame, + tireSpeedStates[wheelId]); + + //Compute the tire slip angles. + PxVehicleTireSlipsUpdate( + wheelParams[wheelId], context.tireSlipParams, + actuationStates[wheelId], tireSpeedStates[wheelId], + wheelRigidBody1DStates[wheelId], + tireSlipStates[wheelId]); + + //Update the camber angle + PxVehicleTireCamberAnglesUpdate( + suspensionParams[wheelId], steerResponseStates[wheelId], + roadGeomStates[wheelId].plane.n, isWheelOnGround, + suspensionComplianceStates[wheelId], *rigidBodyState, + context.frame, + tireCamberAngleStates[wheelId]); + + //Compute the friction + PxVehicleTireGripUpdate( + tireForceParams[wheelId], roadGeomStates[wheelId].friction, + isWheelOnGround, suspensionForces[wheelId], + tireSlipStates[wheelId], tireGripStates[wheelId]); + + //Update the tire sticky state + // + //Note: this should be skipped if tires do not use the sticky feature + PxVehicleTireStickyStateUpdate( + *axleDescription, + wheelParams[wheelId], + context.tireStickyParams, + actuationStates, tireGripStates[wheelId], + tireSpeedStates[wheelId], wheelRigidBody1DStates[wheelId], + dt, + tireStickyStates[wheelId]); + + //If sticky tire is active set the slip angle to zero. + // + //Note: this should be skipped if tires do not use the sticky feature + PxVehicleTireSlipsAccountingForStickyStatesUpdate( + tireStickyStates[wheelId], + tireSlipStates[wheelId]); + + //Compute the tire forces + PxVehicleTireForcesUpdate( + wheelParams[wheelId], suspensionParams[wheelId], + tireForceParams[wheelId], + suspensionComplianceStates[wheelId], + tireGripStates[wheelId], tireDirectionStates[wheelId], + tireSlipStates[wheelId], tireCamberAngleStates[wheelId], + *rigidBodyState, + tireForces[wheelId]); + } + + return true; + } +}; + +/** +\deprecated This API was introduced with the new Vehicle API for transition purposes but will be removed in a future version. +*/ +class PX_DEPRECATED PxVehicleLegacyTireComponent : public PxVehicleComponent +{ +public: + + PxVehicleLegacyTireComponent() : PxVehicleComponent() {} + virtual ~PxVehicleLegacyTireComponent() {} + + virtual void getDataForLegacyTireComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleArrayData& steerResponseStates, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& actuationStates, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& suspensionParams, + PxVehicleArrayData& tireForceParams, + PxVehicleArrayData& roadGeomStates, + PxVehicleArrayData& suspensionStates, + PxVehicleArrayData& suspensionComplianceStates, + PxVehicleArrayData& suspensionForces, + PxVehicleArrayData& wheelRigidBody1DStates, + PxVehicleArrayData& tireGripStates, + PxVehicleArrayData& tireDirectionStates, + PxVehicleArrayData& tireSpeedStates, + PxVehicleArrayData& tireSlipStates, + PxVehicleArrayData& tireCamberAngleStates, + PxVehicleArrayData& tireStickyStates, + PxVehicleArrayData& tireForces) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_PROFILE_ZONE("PxVehicleLegacyTireComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleArrayData steerResponseStates; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData actuationStates; + PxVehicleArrayData wheelParams; + PxVehicleArrayData suspensionParams; + PxVehicleArrayData tireForceParams; + PxVehicleArrayData roadGeomStates; + PxVehicleArrayData suspensionStates; + PxVehicleArrayData suspensionComplianceStates; + PxVehicleArrayData suspensionForces; + PxVehicleArrayData wheelRigidBody1DStates; + PxVehicleArrayData tireGripStates; + PxVehicleArrayData tireDirectionStates; + PxVehicleArrayData tireSpeedStates; + PxVehicleArrayData tireSlipStates; + PxVehicleArrayData tireCamberAngleStates; + PxVehicleArrayData tireStickyStates; + PxVehicleArrayData tireForces; + + getDataForLegacyTireComponent(axleDescription, steerResponseStates, + rigidBodyState, actuationStates, + wheelParams, suspensionParams, tireForceParams, + roadGeomStates, suspensionStates, suspensionComplianceStates, + suspensionForces, wheelRigidBody1DStates, + tireGripStates, tireDirectionStates, tireSpeedStates, tireSlipStates, + tireCamberAngleStates, tireStickyStates, tireForces); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + const bool isWheelOnGround = roadGeomStates[wheelId].hitState; + // note: since this is the legacy component, PxVehicleIsWheelOnGround() is not used + // here + + //Compute the tire slip directions + PxVehicleTireDirsLegacyUpdate( + suspensionParams[wheelId], + steerResponseStates[wheelId], + roadGeomStates[wheelId], *rigidBodyState, + context.frame, + tireDirectionStates[wheelId]); + + //Compute the rigid body speeds along the tire slip directions. + PxVehicleTireSlipSpeedsUpdate( + wheelParams[wheelId], suspensionParams[wheelId], + steerResponseStates[wheelId], suspensionStates[wheelId], tireDirectionStates[wheelId], + *rigidBodyState, roadGeomStates[wheelId], + context.frame, + tireSpeedStates[wheelId]); + + //Compute the tire slip angles. + PxVehicleTireSlipsLegacyUpdate( + wheelParams[wheelId], context.tireSlipParams, + actuationStates[wheelId], tireSpeedStates[wheelId], + wheelRigidBody1DStates[wheelId], + tireSlipStates[wheelId]); + + //Update the camber angle + PxVehicleTireCamberAnglesUpdate( + suspensionParams[wheelId], steerResponseStates[wheelId], + roadGeomStates[wheelId].plane.n, isWheelOnGround, + suspensionComplianceStates[wheelId], *rigidBodyState, + context.frame, + tireCamberAngleStates[wheelId]); + + //Compute the friction + PxVehicleTireGripUpdate( + tireForceParams[wheelId], roadGeomStates[wheelId].friction, + PxVehicleIsWheelOnGround(suspensionStates[wheelId]), suspensionForces[wheelId], + tireSlipStates[wheelId], tireGripStates[wheelId]); + // note: PxVehicleIsWheelOnGround() used here to reflect previous behavior since this is + // the legacy component after all + + //Update the tire sticky state + // + //Note: this should be skipped if tires do not use the sticky feature + PxVehicleTireStickyStateUpdate( + *axleDescription, + wheelParams[wheelId], + context.tireStickyParams, + actuationStates, tireGripStates[wheelId], + tireSpeedStates[wheelId], wheelRigidBody1DStates[wheelId], + dt, + tireStickyStates[wheelId]); + + //If sticky tire is active set the slip angle to zero. + // + //Note: this should be skipped if tires do not use the sticky feature + PxVehicleTireSlipsAccountingForStickyStatesUpdate( + tireStickyStates[wheelId], + tireSlipStates[wheelId]); + + //Compute the tire forces + PxVehicleTireForcesUpdate( + wheelParams[wheelId], suspensionParams[wheelId], + tireForceParams[wheelId], + suspensionComplianceStates[wheelId], + tireGripStates[wheelId], tireDirectionStates[wheelId], + tireSlipStates[wheelId], tireCamberAngleStates[wheelId], + *rigidBodyState, + tireForces[wheelId]); + } + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + + + diff --git a/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireFunctions.h b/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireFunctions.h new file mode 100644 index 00000000..1d1060b1 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireFunctions.h @@ -0,0 +1,270 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "foundation/PxSimpleTypes.h" +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleSuspensionParams; +struct PxVehicleRoadGeometryState; +struct PxVehicleRigidBodyState; +struct PxVehicleTireDirectionState; +struct PxVehicleSuspensionComplianceState; +struct PxVehicleWheelParams; +struct PxVehicleTireSpeedState; +struct PxVehicleWheelActuationState; +struct PxVehicleWheelRigidBody1dState; +struct PxVehicleTireSlipState; +struct PxVehicleSuspensionState; +struct PxVehicleTireCamberAngleState; +struct PxVehicleTireGripState; +struct PxVehicleTireForceParams; +struct PxVehicleSuspensionForce; +struct PxVehicleTireForce; +struct PxVehicleTireStickyState; + +/** +\deprecated This API was introduced with the new Vehicle API for transition purposes but will be removed in a future version. + +\brief Compute the longitudinal and lateral tire directions in the ground plane. +\param[in] suspensionParams describes the frame of the suspension and wheel. +\param[in] steerAngle is the steer angle in radians to be applied to the wheel. +\param[in] roadGeometryState describes the plane of the road geometry under the wheel +\param[in] rigidBodyState describes the current pose of the vehicle's rigid body in the world frame. +\param[in] frame is a description of the vehicle's lateral and longitudinal axes. +\param[out] tireDirectionState is the computed tire longitudinal and lateral directions in the world frame. +\note PxVehicleTireDirsLegacyUpdate replicates the tire direction calculation of PhysX 5.0 and earlier. +*/ +PX_DEPRECATED void PxVehicleTireDirsLegacyUpdate +(const PxVehicleSuspensionParams& suspensionParams, + const PxReal steerAngle, const PxVehicleRoadGeometryState& roadGeometryState, const PxVehicleRigidBodyState& rigidBodyState, + const PxVehicleFrame& frame, + PxVehicleTireDirectionState& tireDirectionState); + +/** +\brief Compute the longitudinal and lateral tire directions in the ground plane. +\param[in] suspensionParams describes the frame of the suspension and wheel. +\param[in] steerAngle is the steer angle in radians to be applied to the wheel. +\param[in] groundNormal describes the plane normal of the road geometry under the wheel. +\param[in] isWheelOnGround defines whether the wheel touches the road geometry. +\param[in] complianceState is a description of the camber and toe angle that arise from suspension compliance. +\param[in] rigidBodyState describes the current pose of the vehicle's rigid body in the world frame. +\param[in] frame is a description of the vehicle's lateral and longitudinal axes. +\param[out] tireDirectionState is the computed tire longitudinal and lateral directions in the world frame. +\note The difference between PxVehicleTireDirsUpdate and PxVehicleTireDirsLegacyUpdate is that +PxVehicleTireDirsUpdate accounts for suspension compliance while PxVehicleTireDirsLegacyUpdate does not. +*/ +void PxVehicleTireDirsUpdate +(const PxVehicleSuspensionParams& suspensionParams, + const PxReal steerAngle, const PxVec3& groundNormal, bool isWheelOnGround, + const PxVehicleSuspensionComplianceState& complianceState, + const PxVehicleRigidBodyState& rigidBodyState, + const PxVehicleFrame& frame, + PxVehicleTireDirectionState& tireDirectionState); + +/** +\brief Project the rigid body velocity at the tire contact point along the tire longitudinal directions. +\param[in] wheelParams is a description of the wheel's radius and half-width. +\param[in] suspensionParams describes the frame of the suspension and wheel. +\param[in] steerAngle is the steer angle in radians to be applied to the wheel. +\param[in] suspensionStates is the current suspension compression state. +\param[in] tireDirectionState is the tire's longitudinal and lateral directions in the ground plane. +\param[in] rigidBodyState describes the current pose and velocity of the vehicle's rigid body in the world frame. +\param[in] roadGeometryState describes the current velocity of the road geometry under each wheel. +\param[in] frame is a description of the vehicle's lateral and longitudinal axes. +\param[out] tireSpeedState is the components of rigid body velocity at the tire contact point along the +tire's longitudinal and lateral axes. +\see PxVehicleTireDirsUpdate +\see PxVehicleTireDirsLegacyUpdate +*/ +void PxVehicleTireSlipSpeedsUpdate +(const PxVehicleWheelParams& wheelParams, const PxVehicleSuspensionParams& suspensionParams, + const PxF32 steerAngle, const PxVehicleSuspensionState& suspensionStates, const PxVehicleTireDirectionState& tireDirectionState, + const PxVehicleRigidBodyState& rigidBodyState, const PxVehicleRoadGeometryState& roadGeometryState, + const PxVehicleFrame& frame, + PxVehicleTireSpeedState& tireSpeedState); + +/** +\brief Compute a tire's longitudinal and lateral slip angles. +\param[in] wheelParams describes the radius of the wheel. +\param[in] tireSlipParams describes how to manage small longitudinal speeds by setting minimum values on the +denominator of the quotients used to calculate lateral and longitudinal slip. +\param[in] actuationState describes whether a wheel is to be driven by a drive torque or not. +\param[in] tireSpeedState is the component of rigid body velocity at the tire contact point projected along the +tire's longitudinal and lateral axes. +\param[in] wheelRigidBody1dState is the wheel rotation speed. +\param[out] tireSlipState is the computed tire longitudinal and lateral slips. +\note Longitudinal slip angle has the following theoretical form: (wheelRotationSpeed*wheelRadius - longitudinalSpeed)/|longitudinalSpeed| +\note Lateral slip angle has the following theoretical form: atan(lateralSpeed/|longitudinalSpeed|) +\note The calculation of both longitudinal and lateral slip angles avoid a zero denominator using minimum values for the denominator set in +tireSlipParams. +*/ +void PxVehicleTireSlipsUpdate +(const PxVehicleWheelParams& wheelParams, + const PxVehicleTireSlipParams& tireSlipParams, + const PxVehicleWheelActuationState& actuationState, PxVehicleTireSpeedState& tireSpeedState, const PxVehicleWheelRigidBody1dState& wheelRigidBody1dState, + PxVehicleTireSlipState& tireSlipState); + +/** +\deprecated This API was introduced with the new Vehicle API for transition purposes but will be removed in a future version. + +\brief Compute a tire's longitudinal and lateral slip angles. +\param[in] wheelParams describes the radius of the wheel. +\param[in] tireSlipParams describes how to manage small longitudinal speeds by setting minimum values on the +denominator of the quotients used to calculate lateral and longitudinal slip. +\param[in] actuationState describes whether a wheel is to be driven by a drive torque or not. +\param[in] tireSpeedState is the component of rigid body velocity at the tire contact point projected along the +tire's longitudinal and lateral axes. +\param[in] wheelRigidBody1dState is the wheel rotation speed. +\param[out] tireSlipState is the computed tire longitudinal and lateral slips. +\note Longitudinal slip angle has the following theoretical form: (wheelRotationSpeed*wheelRadius - longitudinalSpeed)/|longitudinalSpeed| +\note Lateral slip angle has the following theoretical form: atan(lateralSpeed/|longitudinalSpeed|) +\note The calculation of both longitudinal and lateral slip angles avoid a zero denominator using minimum values for the denominator set in +tireSlipParams. +*/ +void PX_DEPRECATED PxVehicleTireSlipsLegacyUpdate +(const PxVehicleWheelParams& wheelParams, + const PxVehicleTireSlipParams& tireSlipParams, + const PxVehicleWheelActuationState& actuationState, PxVehicleTireSpeedState& tireSpeedState, const PxVehicleWheelRigidBody1dState& wheelRigidBody1dState, + PxVehicleTireSlipState& tireSlipState); + + +/** +\brief Compute the camber angle of the wheel +\param[in] suspensionParams describes the frame of the suspension and wheel. +\param[in] steerAngle is the steer angle in radians to be applied to the wheel. +\param[in] groundNormal describes the plane normal of the road geometry under the wheel. +\param[in] isWheelOnGround defines whether the wheel touches the road geometry. +\param[in] complianceState is a description of the camber and toe angle that arise from suspension compliance. +\param[in] rigidBodyState describes the current pose of the vehicle's rigid body in the world frame. +\param[in] frame is a description of the vehicle's lateral and longitudinal axes. +\param[out] tireCamberAngleState is the computed camber angle of the tire expressed in radians. +*/ +void PxVehicleTireCamberAnglesUpdate +(const PxVehicleSuspensionParams& suspensionParams, + const PxReal steerAngle, const PxVec3& groundNormal, bool isWheelOnGround, + const PxVehicleSuspensionComplianceState& complianceState, + const PxVehicleRigidBodyState& rigidBodyState, + const PxVehicleFrame& frame, + PxVehicleTireCamberAngleState& tireCamberAngleState); + +/** +\brief Compute the load and friction experienced by the tire. +\param[in] tireForceParams describes the tire's friction response to longitudinal lip angle and its load response. +\param[in] frictionCoefficient describes the friction coefficient for the tire and road geometry pair. +\param[in] isWheelOnGround defines whether the wheel touches the road geometry. +\param[in] suspensionForce is the force that the suspension exerts on the sprung mass of the suspension. +\param[in] tireSlipState is the tire longitudinal and lateral slip angles. +\param[out] tireGripState is the computed load and friction experienced by the tire. +\note If the suspension cannot place the wheel on the ground the tire load and friction will be 0.0. +*/ +void PxVehicleTireGripUpdate +(const PxVehicleTireForceParams& tireForceParams, + PxReal frictionCoefficient, bool isWheelOnGround, const PxVehicleSuspensionForce& suspensionForce, + const PxVehicleTireSlipState& tireSlipState, + PxVehicleTireGripState& tireGripState); + +/** +\brief When a tire has been at a very low speed for a threshold time without application of drive torque, a +secondary tire model is applied to bring the tire to rest using velocity constraints that asymptotically approach zero speed +along the tire's lateral and longitudinal directions. This secondary tire model is referred to as the sticky tire model and the +tire is considered to be in the sticky tire state when the speed and time conditions are satisfied. The purpose of +PxVehicleTireStickyStateUpdate is to compute the target speeds of the sticky state and to record whether sticky state is +active or not. +\param[in] axleDescription is the axles of the vehicle and the wheels on each axle. +\param[in] wheelParams describes the radius of the wheel +\param[in] tireStickyParams describe the threshold speeds and times for the lateral and longitudinal sticky states. +\param[in] actuationStates describes whether each wheel experiences a drive torque. +\param[in] tireGripState is the load and friction experienced by the tire. +\param[in] tireSpeedState is the component of rigid body velocity at the tire contact point projected along the +tire's longitudinal and lateral axes. +\param[in] wheelRigidBody1dState is the wheel rotation speed. +\param[in] dt is the simulation time that has lapsed since the last call to PxVehicleTireStickyStateUpdate +\param[out] tireStickyState is a description of the sticky state of the tire in the longitudinal and lateral directions. +\note The velocity constraints are maintained through integration with the PhysX scene using the function +PxVehiclePhysXConstraintStatesUpdate. Alternative implementations independent of PhysX are possible. +\see PxVehiclePhysXConstraintStatesUpdate +\see PxVehicleTireSlipsAccountingForStickyStatesUpdate +*/ +void PxVehicleTireStickyStateUpdate +(const PxVehicleAxleDescription& axleDescription, const PxVehicleWheelParams& wheelParams, + const PxVehicleTireStickyParams& tireStickyParams, + const PxVehicleArrayData& actuationStates, + const PxVehicleTireGripState& tireGripState, const PxVehicleTireSpeedState& tireSpeedState, const PxVehicleWheelRigidBody1dState& wheelRigidBody1dState, + const PxReal dt, + PxVehicleTireStickyState& tireStickyState); + +/** +\brief Set the tire longitudinal and lateral slip values to 0.0 in the event that the tire has entred tire sticky state. This is +necessary to avoid both tire models being simultaneously active and interfering with each other. +\param[in] tireStickyState is a description of the sticky state of the tire in the longitudinal and lateral directions. +\param[out] tireSlipState is the updated lateral and longudinal slip with either set to 0.0 in the event that the correspoinding +sticky state is active. +\note This function should not be invoked if there is no subsequent component to implement the sticky tire model. +*/ +void PxVehicleTireSlipsAccountingForStickyStatesUpdate +(const PxVehicleTireStickyState& tireStickyState, + PxVehicleTireSlipState& tireSlipState); + +/** +\brief Compute the longitudinal and lateral forces in the world frame that develop on the tire as a consequence of +the tire's slip angles, friction and load. +\param[in] wheelParams describes the radius and half-width of the wheel. +\param[in] suspensionParams describes the frame of the suspension and wheel. +\param[in] tireForceParams describes the conversion of slip angle, friction and load to a force along the longitudinal +and lateral directions of the tire. +\param[in] complianceState is a description of the camber and toe angle that arise from suspension compliance. +\param[out] tireGripState is the load and friction experienced by the tire. +\param[in] tireDirectionState is the tire's longitudinal and lateral directions in the ground plane. +\param[in] tireSlipState is the longitudinal and lateral slip angles. +\param[in] tireCamberAngleState is the camber angle of the tire expressed in radians. +\param[in] rigidBodyState describes the current pose of the vehicle's rigid body in the world frame. +\param[out] tireForce is the computed tire forces in the world frame. +*/ +void PxVehicleTireForcesUpdate +(const PxVehicleWheelParams& wheelParams, const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleTireForceParams& tireForceParams, + const PxVehicleSuspensionComplianceState& complianceState, + const PxVehicleTireGripState& tireGripState, const PxVehicleTireDirectionState& tireDirectionState, + const PxVehicleTireSlipState& tireSlipState, const PxVehicleTireCamberAngleState& tireCamberAngleState, + const PxVehicleRigidBodyState& rigidBodyState, + PxVehicleTireForce& tireForce); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireHelpers.h b/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireHelpers.h new file mode 100644 index 00000000..c0a99f57 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireHelpers.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/wheel/PxVehicleWheelStates.h" +#include "PxVehicleTireStates.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Compute the intention to accelerate by inspecting the actuation states of the wheels of a powered vehicle. +\param[in] poweredVehicleAxleDesc describes the axles and wheels of a powered vehicle in a jointed ensemble of vehicles. +\param[in] poweredVehicleActuationStates describes the drive state of each wheel of the powered vehicle. +\see PxVehicleTireStickyStateReset +*/ +bool PxVehicleAccelerationIntentCompute +(const PxVehicleAxleDescription& poweredVehicleAxleDesc, const PxVehicleArrayData& poweredVehicleActuationStates); + +/** +\brief Reset the sticky tire states of an unpowered vehicle if it is in a jointed ensemble of vehicles with at least one powered vehicle. +\param[in] poweredVehicleIntentionToAccelerate describes the state of the powered vehicle in an ensemble of jointed vehicles. +\param[in] unpoweredVehicleAxleDesc describes the axles and wheels of an unpowered vehicle towed by a powered vehicle. +\param[out] unpoweredVehicleStickyState is the sticky state of the wheels of an unpowered vehicle towed by a powered vehicle. +\note If any wheel on the powered vehicle is to receive a drive torque, the sticky tire states of the towed vehicle will be reset to the deactivated state. +\note poweredVehicleIntentionToAccelerate may be computed using PxVehicleAccelerationIntentCompute(). +\see PxVehicleAccelerationIntentCompute +*/ +void PxVehicleTireStickyStateReset +(const bool poweredVehicleIntentionToAccelerate, + const PxVehicleAxleDescription& unpoweredVehicleAxleDesc, + PxVehicleArrayData& unpoweredVehicleStickyState); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireParams.h b/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireParams.h new file mode 100644 index 00000000..579f7bd1 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireParams.h @@ -0,0 +1,162 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxFoundation.h" + +#include "vehicle2/PxVehicleParams.h" + +#include "PxVehicleTireStates.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleTireForceParams +{ + /** + \brief Tire lateral stiffness is a graph of tire load that has linear behavior near zero load and + flattens at large loads. latStiffX describes the minimum normalized load (load/restLoad) that gives a + flat lateral stiffness response to load. + \note A value of 0.0 indicates that the tire lateral stiffness is independent of load and will adopt + the value #latStiffY for all values of tire load. + */ + PxReal latStiffX; + + /** + \brief Tire lateral stiffness is a graph of tire load that has linear behavior near zero load and + flattens at large loads. latStiffY describes the maximum possible value of lateral stiffness that occurs + when (load/restLoad) >= #latStiffX. + + Unit: force per lateral slip = mass * length / (time^2) + */ + PxReal latStiffY; + + /** + \brief Tire Longitudinal stiffness + \note Longitudinal force can be approximated as longStiff*longitudinalSlip. + + Unit: force per longitudinal slip = mass * length / (time^2) + */ + PxReal longStiff; + + /** + \brief Tire camber stiffness + \note Camber force can be approximated as camberStiff*camberAngle. + + Unit: force per radian = mass * length / (time^2) + */ + PxReal camberStiff; + + /** + \brief Graph of friction vs longitudinal slip with 3 points. + \note frictionVsSlip[0][0] is always zero. + \note frictionVsSlip[0][1] is the friction available at zero longitudinal slip. + \note frictionVsSlip[1][0] is the value of longitudinal slip with maximum friction. + \note frictionVsSlip[1][1] is the maximum friction. + \note frictionVsSlip[2][0] is the end point of the graph. + \note frictionVsSlip[2][1] is the value of friction for slips greater than frictionVsSlip[2][0]. + \note The friction value is computed from the friction vs longitudinal slip graph using linear interpolation. + \note The friction value computed from the friction vs longitudinal slip graph is used to scale the friction + value of the road geometry. + \note frictionVsSlip[2][0] > frictionVsSlip[1][0] > frictionVsSlip[0][0] + \note frictionVsSlip[1][1] is typically greater than frictionVsSlip[0][1] + \note frictionVsSlip[2][1] is typically smaller than frictionVsSlip[1][1] + \note longitudinal slips > frictionVsSlip[2][0] use friction multiplier frictionVsSlip[2][1] + */ + PxReal frictionVsSlip[3][2]; //3 (x,y) points + + /** + \brief The rest load is the load that develops on the tire when the vehicle is at rest on a flat plane. + \note The rest load is approximately the product of gravitational acceleration and (sprungMass + wheelMass). + + Unit: force = mass * length / (time^2) + */ + PxReal restLoad; + + /** + \brief Tire load variation can be strongly dependent on the time-step so it is a good idea to filter it + to give less jerky handling behavior. + \note Tire load filtering is implemented by linear interpolating a graph containing just two points. + The x-axis of the graph is normalized tire load, while the y-axis is the filtered normalized tire load that is + to be applied during the tire force calculation. + \note The normalized load is the force acting downwards on the tire divided by restLoad. + \note The minimum possible normalized load is zero. + \note There are two points on the graph: (minNormalisedLoad, minNormalisedFilteredLoad) and (maxNormalisedLoad, maxFilteredNormalisedLoad). + \note Normalized loads less than minNormalisedLoad have filtered normalized load = minNormalisedFilteredLoad. + \note Normalized loads greater than maxNormalisedLoad have filtered normalized load = maxFilteredNormalisedLoad. + \note Normalized loads in-between are linearly interpolated between minNormalisedFilteredLoad and maxFilteredNormalisedLoad. + \note The tire load applied as input to the tire force computation is the filtered normalized load multiplied by the rest load. + \note loadFilter[0][0] is minNormalisedLoad + \note loadFilter[0][1] is minFilteredNormalisedLoad + \note loadFilter[1][0] is maxNormalisedLoad + \note loadFilter[1][1] is maxFilteredNormalisedLoad + */ + PxReal loadFilter[2][2]; //2 (x,y) points + + PX_FORCE_INLINE PxVehicleTireForceParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleTireForceParams r = *this; + const PxReal scale = trgScale.scale / srcScale.scale; + r.latStiffY *= scale; + r.longStiff *= scale; + r.camberStiff *= scale; + r.restLoad *= scale; + return r; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(latStiffX >= 0, "PxVehicleTireForceParams.latStiffX must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(latStiffY > 0, "PxVehicleTireForceParams.latStiffY must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(longStiff > 0, "PxVehicleTireForceParams.longStiff must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(camberStiff >= 0, "PxVehicleTireForceParams.camberStiff must be greater than or equal zero", false); + PX_CHECK_AND_RETURN_VAL(restLoad > 0, "PxVehicleTireForceParams.restLoad must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(loadFilter[1][0] >= loadFilter[0][0], "PxVehicleTireForceParams.loadFilter[1][0] must be greater than or equal to PxVehicleTireForceParams.loadFilter[0][0]", false); + PX_CHECK_AND_RETURN_VAL(loadFilter[1][1] > 0, "PxVehicleTireLoadFilterData.loadFilter[1][1] must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(0.0f == loadFilter[0][0], "PxVehicleTireLoadFilterData.loadFilter[0][0] must be equal to zero", false); + PX_CHECK_AND_RETURN_VAL(frictionVsSlip[0][0] >= 0.0f && frictionVsSlip[0][1] >= 0.0f, "Illegal values for frictionVsSlip[0]", false); + PX_CHECK_AND_RETURN_VAL(frictionVsSlip[1][0] >= 0.0f && frictionVsSlip[1][1] >= 0.0f, "Illegal values for frictionVsSlip[1]", false); + PX_CHECK_AND_RETURN_VAL(frictionVsSlip[2][0] >= 0.0f && frictionVsSlip[2][1] >= 0.0f, "Illegal values for frictionVsSlip[2]", false); + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireStates.h b/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireStates.h new file mode 100644 index 00000000..2acbd297 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/tire/PxVehicleTireStates.h @@ -0,0 +1,177 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + +#include "foundation/PxVec3.h" +#include "foundation/PxMemory.h" + +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + + +/** +\brief PxVehicleTireDirectionState stores the world frame lateral and longtidinal axes of the tire after +projecting the wheel pose in the world frame onto the road geometry plane (also in the world frame). +*/ +struct PxVehicleTireDirectionState +{ + PxVec3 directions[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTireDirectionState)); + } +}; + + +/** +\brief PxVehicleTireSpeedState stores the components of the instantaneous velocity of the rigid body at the tire contact point projected +along the lateral and longitudinal axes of the tire. +\see PxVehicleTireDirectionState +*/ +struct PxVehicleTireSpeedState +{ + PxReal speedStates[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTireSpeedState)); + } +}; + +/** +\brief The lateral and longitudinal tire slips. +\see PxVehicleTireSpeedState +*/ +struct PxVehicleTireSlipState +{ + PxReal slips[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTireSlipState)); + } +}; + +/** +\brief The load and friction experienced by a tire. +*/ +struct PxVehicleTireGripState +{ + /** + \brief The tire load + + Unit: force = mass * length / (time^2) + */ + PxReal load; + + /** + \brief The tire friction is the product of the road geometry friction and a friction response multiplier. + */ + PxReal friction; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTireGripState)); + } +}; + +/** +\brief Camber angle of the tire relative to the ground plane. +*/ +struct PxVehicleTireCamberAngleState +{ + PxReal camberAngle; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTireCamberAngleState)); + } +}; + +/** +\brief Prolonged low speeds in the lateral and longitudinal directions may be handled with "sticky" velocity constraints that activate after +a speed below a threshold has been recorded for a threshold time. +\see PxVehicleTireStickyParams +\see PxVehicleTireSpeedState +*/ +struct PxVehicleTireStickyState +{ + PxReal lowSpeedTime[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + bool activeStatus[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTireStickyState)); + } +}; + +/** +\brief The longitudinal/lateral forces/torques that develop on the tire. +*/ +struct PxVehicleTireForce +{ + /* + \brief The tire forces that develop along the tire's longitudinal and lateral directions. Specified in the world frame. + */ + PxVec3 forces[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + /* + \brief The tire torques that develop around the tire's longitudinal and lateral directions. Specified in the world frame. + */ + PxVec3 torques[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + /** + \brief The aligning moment may be propagated to a torque-driven steering controller. + */ + PxReal aligningMoment; + + /** + \brief The torque to apply to the wheel's 1d rigid body. + */ + PxReal wheelTorque; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTireForce)); + } +}; + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelComponents.h b/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelComponents.h new file mode 100644 index 00000000..a82bcefd --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelComponents.h @@ -0,0 +1,116 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "vehicle2/commands/PxVehicleCommandHelpers.h" +#include "vehicle2/tire/PxVehicleTireStates.h" + +#include "PxVehicleWheelFunctions.h" +#include "PxVehicleWheelHelpers.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +class PxVehicleWheelComponent : public PxVehicleComponent +{ +public: + + PxVehicleWheelComponent() : PxVehicleComponent() {} + virtual ~PxVehicleWheelComponent() {} + + virtual void getDataForWheelComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleArrayData& steerResponseStates, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& suspensionParams, + PxVehicleArrayData& actuationStates, + PxVehicleArrayData& suspensionStates, + PxVehicleArrayData& suspensionComplianceStates, + PxVehicleArrayData& tireSpeedStates, + PxVehicleArrayData& wheelRigidBody1dStates, + PxVehicleArrayData& wheelLocalPoses) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_PROFILE_ZONE("PxVehicleWheelComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleArrayData steerResponseStates; + PxVehicleArrayData wheelParams; + PxVehicleArrayData suspensionParams; + PxVehicleArrayData actuationStates; + PxVehicleArrayData suspensionStates; + PxVehicleArrayData suspensionComplianceStates; + PxVehicleArrayData tireSpeedStates; + PxVehicleArrayData wheelRigidBody1dStates; + PxVehicleArrayData wheelLocalPoses; + + getDataForWheelComponent(axleDescription, steerResponseStates, + wheelParams, suspensionParams, actuationStates, suspensionStates, + suspensionComplianceStates, tireSpeedStates, wheelRigidBody1dStates, + wheelLocalPoses); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + PxVehicleWheelRotationAngleUpdate( + wheelParams[wheelId], + actuationStates[wheelId], suspensionStates[wheelId], + tireSpeedStates[wheelId], + context.thresholdForwardSpeedForWheelAngleIntegration, dt, + wheelRigidBody1dStates[wheelId]); + + wheelLocalPoses[wheelId].localPose = PxVehicleComputeWheelLocalPose(context.frame, + suspensionParams[wheelId], + suspensionStates[wheelId], + suspensionComplianceStates[wheelId], + steerResponseStates[wheelId], + wheelRigidBody1dStates[wheelId]); + } + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelFunctions.h b/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelFunctions.h new file mode 100644 index 00000000..6e122f44 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelFunctions.h @@ -0,0 +1,77 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleWheelParams; +struct PxVehicleWheelActuationState; +struct PxVehicleSuspensionState; +struct PxVehicleTireSpeedState; +struct PxVehicleScale; +struct PxVehicleWheelRigidBody1dState; + +/** +\brief Forward integrate the rotation angle of a wheel +\note The rotation angle of the wheel plays no role in simulation but is important to compute the pose of the wheel for rendering. +\param[in] wheelParams describes the radius and half-width of the wheel +\param[in] actuationState describes whether the wheel has drive or brake torque applied to it. +\param[in] suspensionState describes whether the wheel touches the ground. +\param[in] tireSpeedState describes the components of rigid body velocity at the ground contact point along the tire's lateral and longitudinal directions. +\param[in] thresholdForwardSpeedForWheelAngleIntegration Forward wheel speed below which the wheel rotation speed gets blended with the rolling + speed (based on the forward wheel speed) which is then used to integrate the wheel rotation angle. At low forward wheel speed, the wheel + rotation speed can get unstable (depending on the tire model used) and, for example, oscillate. If brake or throttle is applied, there + will be no blending. +\param[in] dt is the simulation time that has lapsed since the last call to PxVehicleWheelRotationAngleUpdate +\param[in,out] wheelRigidBody1dState describes the current angular speed and angle of the wheel. +\note At low speeds and large timesteps, wheel rotation speed can become noisy due to singularities in the tire slip computations. +At low speeds, therefore, the wheel speed used for integrating the angle is a blend of current angular speed and rolling angular speed if the +wheel experiences neither brake nor drive torque and can be placed on the ground. The blended rotation speed gets stored in +PxVehicleWheelRigidBody1dState::correctedRotationSpeed. +*/ +void PxVehicleWheelRotationAngleUpdate +(const PxVehicleWheelParams& wheelParams, + const PxVehicleWheelActuationState& actuationState, const PxVehicleSuspensionState& suspensionState, const PxVehicleTireSpeedState& tireSpeedState, + const PxReal thresholdForwardSpeedForWheelAngleIntegration, const PxReal dt, + PxVehicleWheelRigidBody1dState& wheelRigidBody1dState); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + + diff --git a/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelHelpers.h b/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelHelpers.h new file mode 100644 index 00000000..831442d7 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelHelpers.h @@ -0,0 +1,217 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "vehicle2/PxVehicleFunctions.h" + +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionStates.h" + +#include "PxVehicleWheelParams.h" +#include "PxVehicleWheelStates.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Compute the quaternion of a wheel in the rigid body frame. +\param[in] frame describes the longitudinal and lateral axes of the vehicle. +\param[in] suspensionParams describes the suspension and wheel frames. +\param[in] camberAngle is the camber angle in radian sinduced by suspension compliance. +\param[in] toeAngle is the toe angle in radians induced by suspension compliance. +\param[in] steerAngle is the steer angle in radians applied to the wheel. +\param[in] rotationAngle is the angle around the wheel's lateral axis. +\return The quaterion of the wheel in the rigid body frame. +\see PxVehicleComputeWheelOrientation +*/ +PX_FORCE_INLINE PxQuat PxVehicleComputeWheelLocalOrientation +(const PxVehicleFrame& frame, + const PxVehicleSuspensionParams& suspensionParams, + const PxReal camberAngle, const PxReal toeAngle, const PxReal steerAngle, + const PxReal rotationAngle) +{ + const PxQuat wheelLocalOrientation = + (suspensionParams.suspensionAttachment.q * PxVehicleComputeRotation(frame, camberAngle, 0.0f, steerAngle + toeAngle))* + (suspensionParams.wheelAttachment.q * PxVehicleComputeRotation(frame, 0.0f, rotationAngle, 0.0f)); + return wheelLocalOrientation; +} + +/** +\brief Compute the quaternion of a wheel in the world frame. +\param[in] frame describes the longitudinal and lateral axes of the vehicle. +\param[in] suspensionParams describes the suspension and wheel frames. +\param[in] camberAngle is the camber angle in radian induced by suspension compliance. +\param[in] toeAngle is the toe angle in radians induced by suspension compliance. +\param[in] steerAngle is the steer angle in radians applied to the wheel. +\param[in] rigidBodyOrientation is the quaterion of the rigid body in the world frame. +\param[in] rotationAngle is the angle around the wheel's lateral axis. +\return The quaterion of the wheel in the world frame. +\see PxVehicleComputeWheelLocalOrientation +*/ +PX_FORCE_INLINE PxQuat PxVehicleComputeWheelOrientation +(const PxVehicleFrame& frame, + const PxVehicleSuspensionParams& suspensionParams, + const PxReal camberAngle, const PxReal toeAngle, const PxReal steerAngle, + const PxQuat& rigidBodyOrientation, const PxReal rotationAngle) +{ + const PxQuat wheelOrientation = rigidBodyOrientation * PxVehicleComputeWheelLocalOrientation(frame, suspensionParams, + camberAngle, toeAngle, steerAngle, rotationAngle); + return wheelOrientation; +} + +/** +\brief Compute the pose of the wheel in the rigid body frame. +\param[in] frame describes the longitudinal and lateral axes of the vehicle. +\param[in] suspensionParams describes the suspension and wheel frames. +\param[in] suspensionState is the compression state of the suspenson. +\param[in] camberAngle is the camber angle in radian induced by suspension compliance. +\param[in] toeAngle is the toe angle in radians induced by suspension compliance. +\param[in] steerAngle is the steer angle in radians applied to the wheel. +\param[in] rotationAngle is the angle around the wheel's lateral axis. +\return The pose of the wheel in the rigid body frame. +*/ +PX_FORCE_INLINE PxTransform PxVehicleComputeWheelLocalPose +(const PxVehicleFrame& frame, + const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleSuspensionState& suspensionState, + const PxReal camberAngle, const PxReal toeAngle, const PxReal steerAngle, + const PxReal rotationAngle) +{ + //Full equation: + //PxTransform(suspAttachment.p + suspParams.suspensionTravelDir*suspDist, suspAttachment.q) * + //PxTransform(PxVec3(0), PxQuat(camber, 0, steer+toe)) * + //wheelAttachment * + //PxTransform(PxVec3(0), PxQuat(0, rotation, 0)) + //Reduces to: + //PxTransform(suspAttachment.p + suspParams.suspensionTravelDir*suspDist, suspAttachment.q * PxQuat(camber, 0, steer+toe)) * + //PxTranfsorm(wheelAttachment.p, wheelAttachment.q * PxQuat(0, rotation, 0)) + const PxF32 suspDist = (suspensionState.jounce != PX_VEHICLE_UNSPECIFIED_JOUNCE) ? (suspensionParams.suspensionTravelDist - suspensionState.jounce) : 0.0f; + const PxTransform wheelLocalPose = + PxTransform( + suspensionParams.suspensionAttachment.p + suspensionParams.suspensionTravelDir*suspDist, + suspensionParams.suspensionAttachment.q*PxVehicleComputeRotation(frame, camberAngle, 0.0f, steerAngle + toeAngle))* + PxTransform( + suspensionParams.wheelAttachment.p, + suspensionParams.wheelAttachment.q*PxVehicleComputeRotation(frame, 0.0f, rotationAngle, 0.0f)); + return wheelLocalPose; +} + + +/** +\brief Compute the pose of the wheel in the rigid body frame. +\param[in] frame describes the longitudinal and lateral axes of the vehicle. +\param[in] suspensionParams describes the suspension and wheel frames. +\param[in] suspensionState is the compression state of the suspenson. +\param[in] suspensionComplianceState is the camber and toe angles induced by suspension compliance. +\param[in] steerAngle is the steer angle in radians applied to the wheel. +\param[in] wheelState is angle around the wheel's lateral axis. +\return The pose of the wheel in the rigid body frame. +*/ +PX_FORCE_INLINE PxTransform PxVehicleComputeWheelLocalPose +(const PxVehicleFrame& frame, + const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleSuspensionState& suspensionState, const PxVehicleSuspensionComplianceState& suspensionComplianceState, + const PxReal steerAngle, + const PxVehicleWheelRigidBody1dState& wheelState) +{ + return PxVehicleComputeWheelLocalPose(frame, suspensionParams, suspensionState, + suspensionComplianceState.camber, suspensionComplianceState.toe, steerAngle, + wheelState.rotationAngle); +} + +/** +\brief Compute the pose of the wheel in the world frame. +\param[in] frame describes the longitudinal and lateral axes of the vehicle. +\param[in] suspensionParams describes the suspension and wheel frames. +\param[in] suspensionState is the compression state of the suspenson. +\param[in] camberAngle is the camber angle in radian induced by suspension compliance. +\param[in] toeAngle is the toe angle in radians induced by suspension compliance. +\param[in] steerAngle is the steer angle in radians applied to the wheel. +\param[in] rigidBodyPose is the pose of the rigid body in the world frame. +\param[in] rotationAngle is the angle around the wheel's lateral axis. +\return The pose of the wheel in the world frame. +*/ +PX_FORCE_INLINE PxTransform PxVehicleComputeWheelPose +(const PxVehicleFrame& frame, + const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleSuspensionState& suspensionState, + const PxReal camberAngle, const PxReal toeAngle, const PxReal steerAngle, + const PxTransform& rigidBodyPose, const PxReal rotationAngle) +{ + const PxTransform wheelPose = rigidBodyPose * PxVehicleComputeWheelLocalPose(frame, suspensionParams, suspensionState, + camberAngle, toeAngle, steerAngle, rotationAngle); + return wheelPose; +} + +/** +\brief Compute the pose of the wheel in the world frame. +\param[in] frame describes the longitudinal and lateral axes of the vehicle. +\param[in] suspensionParams describes the suspension and wheel frames. +\param[in] suspensionState is the compression state of the suspenson. +\param[in] suspensionComplianceState is the camber and toe angles induced by suspension compliance. +\param[in] steerAngle is the steer angle in radians applied to the wheel. +\param[in] rigidBodyPose is the pose of the rigid body in the world frame. +\param[in] wheelState is angle around the wheel's lateral axis. +\return The pose of the wheel in the world frame. +*/ + +PX_FORCE_INLINE PxTransform PxVehicleComputeWheelPose +(const PxVehicleFrame& frame, + const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleSuspensionState& suspensionState, const PxVehicleSuspensionComplianceState& suspensionComplianceState, const PxReal steerAngle, + const PxTransform& rigidBodyPose, const PxVehicleWheelRigidBody1dState& wheelState) +{ + return PxVehicleComputeWheelPose(frame, suspensionParams, suspensionState, + suspensionComplianceState.camber, suspensionComplianceState.toe, steerAngle, + rigidBodyPose, wheelState.rotationAngle); +} + +/** +\brief Check if the suspension could place the wheel on the ground or not. + +\param[in] suspState The state of the suspension to check. +\return True if the wheel connects to the ground, else false. + +\see PxVehicleSuspensionState +*/ +PX_FORCE_INLINE bool PxVehicleIsWheelOnGround(const PxVehicleSuspensionState& suspState) +{ + return (suspState.separation <= 0.0f); +} + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelParams.h b/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelParams.h new file mode 100644 index 00000000..4bd31300 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelParams.h @@ -0,0 +1,115 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxFoundation.h" + +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleWheelParams +{ + /** + \brief Radius of unit that includes metal wheel plus rubber tire. + + Range: (0, inf)
+ Unit: length + */ + PxReal radius; + + /** + \brief Half-width of unit that includes wheel plus tire. + + Range: (0, inf)
+ Unit: length + */ + PxReal halfWidth; + + /** + \brief Mass of unit that includes wheel plus tire. + + Range: (0, inf)
+ Unit: mass + */ + PxReal mass; + + /** + \brief Moment of inertia of unit that includes wheel plus tire about the rolling axis. + + Range: (0, inf)
+ Unit: mass * (length^2) + */ + PxReal moi; + + /** + \brief Damping rate applied to wheel. + + Range: [0, inf)
+ Unit: torque * time = mass * (length^2) / time + */ + PxReal dampingRate; + + PX_FORCE_INLINE PxVehicleWheelParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleWheelParams r = *this; + const PxReal scale = trgScale.scale/srcScale.scale; + r.radius *= scale; + r.halfWidth *= scale; + r.moi *= (scale*scale); + r.dampingRate *= (scale*scale); + return r; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(radius > 0.0f, "PxVehicleWheelParams.radius must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(halfWidth > 0.0f, "PxVehicleWheelParams.halfWidth must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mass > 0.0f, "PxVehicleWheelParams.mass must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(moi > 0.0f, "PxVehicleWheelParams.moi must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(dampingRate >= 0.0f, "PxVehicleWheelParams.dampingRate must be greater than or equal to zero", false); + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + + diff --git a/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelStates.h b/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelStates.h new file mode 100644 index 00000000..e133a3f0 --- /dev/null +++ b/engine/third_party/physx/include/vehicle2/wheel/PxVehicleWheelStates.h @@ -0,0 +1,104 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#pragma once + + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxTransform.h" +#include "foundation/PxMemory.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief It is useful to know if a brake or drive torque is to be applied to a wheel. +*/ +struct PxVehicleWheelActuationState +{ + bool isBrakeApplied; //!< True if a brake torque is applied, false if not. + bool isDriveApplied; //!< True if a drive torque is applied, false if not. + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleWheelActuationState)); + } +}; + +struct PxVehicleWheelRigidBody1dState +{ + /** + \brief The rotation speed of the wheel around the lateral axis. + + Unit: radians / time + */ + PxReal rotationSpeed; + + /** + \brief The corrected rotation speed of the wheel around the lateral axis in radians per second. + + At low forward wheel speed, the wheel rotation speed can get unstable (depending on the tire + model used) and, for example, oscillate. To integrate the wheel rotation angle, a (potentially) + blended rotation speed is used which gets stored in #correctedRotationSpeed. + + Unit: radians / time + + \see PxVehicleSimulationContext::thresholdForwardSpeedForWheelAngleIntegration + */ + PxReal correctedRotationSpeed; + + /** + \brief The accumulated angle of the wheel around the lateral axis in radians in range (-2*Pi,2*Pi) + */ + PxReal rotationAngle; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleWheelRigidBody1dState)); + } +}; + +struct PxVehicleWheelLocalPose +{ + PxTransform localPose; //!< The pose of the wheel in the rigid body frame. + + PX_FORCE_INLINE void setToDefault() + { + localPose = PxTransform(PxIdentity); + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + diff --git a/engine/third_party/physx/pvdruntime/compiler/cmake/CMakeLists.txt b/engine/third_party/physx/pvdruntime/compiler/cmake/CMakeLists.txt new file mode 100644 index 00000000..ce6e4938 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/compiler/cmake/CMakeLists.txt @@ -0,0 +1,80 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +cmake_minimum_required(VERSION 3.16) + +project(PVDRuntime C CXX) + +set(PVDRuntimeBuilt 1 CACHE INTERNAL "PVDRuntimeBuilt") + +# This is required to be defined by external callers! +IF(NOT DEFINED PHYSX_ROOT_DIR) + MESSAGE(FATAL_ERROR "PHYSX_ROOT_DIR variable wasn't set.") +ENDIF() + +IF(NOT EXISTS ${PHYSX_ROOT_DIR}) + MESSAGE(FATAL_ERROR "PHYSX_ROOT_DIR variable was invalid.") +ENDIF() + +INCLUDE(NvidiaBuildOptions) + +IF(CMAKE_CONFIGURATION_TYPES) + SET(CMAKE_CONFIGURATION_TYPES debug checked profile release) + SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING + "Reset config to what we need" + FORCE) + + # Need to define these at least once. + SET(CMAKE_EXE_LINKER_FLAGS_CHECKED "") + SET(CMAKE_EXE_LINKER_FLAGS_PROFILE "") + SET(CMAKE_SHARED_LINKER_FLAGS_CHECKED "") + SET(CMAKE_SHARED_LINKER_FLAGS_PROFILE "") + + # Build PDBs for all configurations + SET(CMAKE_EXE_LINKER_FLAGS "/DEBUG") + SET(CMAKE_SHARED_LINKER_FLAGS "/DEBUG") + +ENDIF() + +SET(PROJECT_CMAKE_FILES_DIR compiler/cmake) +SET(PLATFORM_CMAKELISTS ${PHYSX_ROOT_DIR}/pvdruntime/${PROJECT_CMAKE_FILES_DIR}/${TARGET_BUILD_PLATFORM}/CMakeLists.txt) + +IF(NOT EXISTS ${PLATFORM_CMAKELISTS}) + MESSAGE(FATAL_ERROR "Unable to find platform CMakeLists.txt for ${TARGET_BUILD_PLATFORM} at ${PLATFORM_CMAKELISTS}") +ENDIF() + +# Include the platform specific CMakeLists +INCLUDE(${PHYSX_ROOT_DIR}/pvdruntime/${PROJECT_CMAKE_FILES_DIR}/${TARGET_BUILD_PLATFORM}/CMakeLists.txt) + +# Set folder Server to all Server projects +SET_PROPERTY(TARGET PVDRuntime PROPERTY FOLDER "PVDRuntime") + +INSTALL( + TARGETS PVDRuntime + EXPORT PhysXSDK + DESTINATION $<$:${PX_ROOT_LIB_DIR}/debug>$<$:${PX_ROOT_LIB_DIR}/release>$<$:${PX_ROOT_LIB_DIR}/checked>$<$:${PX_ROOT_LIB_DIR}/profile> + ) + diff --git a/engine/third_party/physx/pvdruntime/compiler/cmake/linux/CMakeLists.txt b/engine/third_party/physx/pvdruntime/compiler/cmake/linux/CMakeLists.txt new file mode 100644 index 00000000..d48aef00 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/compiler/cmake/linux/CMakeLists.txt @@ -0,0 +1,45 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +IF(NOT DEFINED PHYSX_LINUX_COMPILE_DEFS) + MESSAGE(FATAL ERROR "PVDRuntime uses the PhysX compile defs, and they're not defined when they need to be.") +ENDIF() + +IF (NOT DEFINED PHYSX_CXX_FLAGS) + MESSAGE(FATAL ERROR "PVDRuntime uses the PhysX CXX flags, and they're not defined when they need to be.") +ENDIF() + +# Get the CXX Flags from the Cached variables set by the PhysX CMakeLists +SET(CMAKE_CXX_FLAGS "${PHYSX_CXX_FLAGS}") + +SET(CMAKE_CXX_FLAGS_DEBUG "${PHYSX_CXX_FLAGS_DEBUG}") +SET(CMAKE_CXX_FLAGS_CHECKED "${PHYSX_CXX_FLAGS_CHECKED}") +SET(CMAKE_CXX_FLAGS_PROFILE "${PHYSX_CXX_FLAGS_PROFILE}") +SET(CMAKE_CXX_FLAGS_RELEASE "${PHYSX_CXX_FLAGS_RELEASE}") + +# Include all of the projects +INCLUDE(PVDRuntime.cmake) + diff --git a/engine/third_party/physx/pvdruntime/compiler/cmake/windows/CMakeLists.txt b/engine/third_party/physx/pvdruntime/compiler/cmake/windows/CMakeLists.txt new file mode 100644 index 00000000..ba0b90c2 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/compiler/cmake/windows/CMakeLists.txt @@ -0,0 +1,48 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +IF(NOT DEFINED PHYSX_WINDOWS_COMPILE_DEFS) + MESSAGE(FATAL ERROR "PVDRuntime uses the PhysX compile defs, and they're not defined when they need to be.") +ENDIF() + +IF (NOT DEFINED PHYSX_CXX_FLAGS) + MESSAGE(FATAL ERROR "PVDRuntime uses the PhysX CXX flags, and they're not defined when they need to be.") +ENDIF() + +# Get the CXX Flags from the Cached variables set by the PhysX CMakeLists +SET(CMAKE_CXX_FLAGS "${PHYSX_CXX_FLAGS} /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4577 /EHsc") + +SET(CMAKE_CXX_FLAGS_DEBUG "${PHYSX_CXX_FLAGS_DEBUG}") +SET(CMAKE_CXX_FLAGS_CHECKED "${PHYSX_CXX_FLAGS_CHECKED}") +SET(CMAKE_CXX_FLAGS_PROFILE "${PHYSX_CXX_FLAGS_PROFILE}") +SET(CMAKE_CXX_FLAGS_RELEASE "${PHYSX_CXX_FLAGS_RELEASE}") + +# Build PDBs for all configurations +SET(CMAKE_SHARED_LINKER_FLAGS "/DEBUG") + +# Include all of the projects +INCLUDE(PVDRuntime.cmake) + diff --git a/engine/third_party/physx/pvdruntime/include/OmniPvdCommands.h b/engine/third_party/physx/pvdruntime/include/OmniPvdCommands.h new file mode 100644 index 00000000..56e12f85 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/include/OmniPvdCommands.h @@ -0,0 +1,53 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_COMMANDS_H +#define OMNI_PVD_COMMANDS_H + +struct OmniPvdCommand +{ + enum Enum + { + eINVALID, + eREGISTER_CLASS, + eREGISTER_ENUM, + eREGISTER_ATTRIBUTE, + eREGISTER_CLASS_ATTRIBUTE, + eREGISTER_UNIQUE_LIST_ATTRIBUTE, + eSET_ATTRIBUTE, + eADD_TO_UNIQUE_LIST_ATTRIBUTE, + eREMOVE_FROM_UNIQUE_LIST_ATTRIBUTE, + eCREATE_OBJECT, + eDESTROY_OBJECT, + eSTART_FRAME, + eSTOP_FRAME, + eRECORD_MESSAGE + }; +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/include/OmniPvdDefines.h b/engine/third_party/physx/pvdruntime/include/OmniPvdDefines.h new file mode 100644 index 00000000..989639d5 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/include/OmniPvdDefines.h @@ -0,0 +1,199 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_DEFINES_H +#define OMNI_PVD_DEFINES_H + +#define OMNI_PVD_INVALID_HANDLE 0 + +#define OMNI_PVD_VERSION_MAJOR 0 +#define OMNI_PVD_VERSION_MINOR 4 +#define OMNI_PVD_VERSION_PATCH 0 + +//////////////////////////////////////////////////////////////////////////////// +// Versions so far : (major, minor, patch), top one is newest +// +// [0, 4, 0] +// add new eRECORD_MESSAGE command to record messages in the OVD stream. +// [0, 3, 0] +// writes/read out the base class handle in the class registration call +// backwards compatible with [0, 2, 0] and [0, 1, 42] +// [0, 2, 0] +// intermediate version was never official, no real change, but there are many files with this version +// [0, 1, 42] +// no proper base class written/read in the class registration call +// +//////////////////////////////////////////////////////////////////////////////// + +#include + +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) +#define OMNI_PVD_WIN +#define OMNI_PVD_CALL __cdecl +#define OMNI_PVD_EXPORT extern "C" __declspec(dllexport) +#else +#ifdef __cdecl__ + #define OMNI_PVD_CALL __attribute__((__cdecl__)) +#else + #define OMNI_PVD_CALL +#endif +#if __GNUC__ >= 4 + #define OMNI_PVD_EXPORT extern "C" __attribute__((visibility("default"))) + #else + #define OMNI_PVD_EXPORT extern "C" +#endif +#endif + +typedef uint64_t OmniPvdObjectHandle; +typedef uint64_t OmniPvdContextHandle; +typedef uint32_t OmniPvdClassHandle; +typedef uint32_t OmniPvdAttributeHandle; +typedef uint32_t OmniPvdVersionType; +typedef uint32_t OmniPvdEnumValueType; + +typedef void (OMNI_PVD_CALL *OmniPvdLogFunction)(char *logLine); + +struct OmniPvdDataType +{ + enum Enum + { + eINT8, + eINT16, + eINT32, + eINT64, + eUINT8, + eUINT16, + eUINT32, + eUINT64, + eFLOAT32, + eFLOAT64, + eSTRING, + eOBJECT_HANDLE, + eENUM_VALUE, + eFLAGS_WORD + }; +}; + +template +inline uint32_t getOmniPvdDataTypeSize() { return 0; } + +template<> +inline uint32_t getOmniPvdDataTypeSize() { return sizeof(int8_t); } + +template<> +inline uint32_t getOmniPvdDataTypeSize() { return sizeof(int16_t); } + +template<> +inline uint32_t getOmniPvdDataTypeSize() { return sizeof(int32_t); } + +template<> +inline uint32_t getOmniPvdDataTypeSize() { return sizeof(int64_t); } + +template<> +inline uint32_t getOmniPvdDataTypeSize() { return sizeof(uint8_t); } + +template<> +inline uint32_t getOmniPvdDataTypeSize() { return sizeof(uint16_t); } + +template<> +inline uint32_t getOmniPvdDataTypeSize() { return sizeof(uint32_t); } + +template<> +inline uint32_t getOmniPvdDataTypeSize() { return sizeof(uint64_t); } + +template<> +inline uint32_t getOmniPvdDataTypeSize() { return sizeof(float); } + +template<> +inline uint32_t getOmniPvdDataTypeSize() { return sizeof(double); } + +template<> +inline uint32_t getOmniPvdDataTypeSize() { return 0; } + +template<> +inline uint32_t getOmniPvdDataTypeSize() { return sizeof(OmniPvdObjectHandle); } + +template<> +inline uint32_t getOmniPvdDataTypeSize() { return sizeof(OmniPvdEnumValueType); } + +template<> +inline uint32_t getOmniPvdDataTypeSize() { return sizeof(OmniPvdClassHandle); } + +inline uint32_t getOmniPvdDataTypeSizeFromEnum(OmniPvdDataType::Enum dataType) +{ + switch (dataType) + { + case OmniPvdDataType::eINT8: + return getOmniPvdDataTypeSize(); + break; + case OmniPvdDataType::eINT16: + return getOmniPvdDataTypeSize(); + break; + case OmniPvdDataType::eINT32: + return getOmniPvdDataTypeSize(); + break; + case OmniPvdDataType::eINT64: + return getOmniPvdDataTypeSize(); + break; + case OmniPvdDataType::eUINT8: + return getOmniPvdDataTypeSize(); + break; + case OmniPvdDataType::eUINT16: + return getOmniPvdDataTypeSize(); + break; + case OmniPvdDataType::eUINT32: + return getOmniPvdDataTypeSize(); + break; + case OmniPvdDataType::eUINT64: + return getOmniPvdDataTypeSize(); + break; + case OmniPvdDataType::eFLOAT32: + return getOmniPvdDataTypeSize(); + break; + case OmniPvdDataType::eFLOAT64: + return getOmniPvdDataTypeSize(); + break; + case OmniPvdDataType::eSTRING: + return getOmniPvdDataTypeSize(); + break; + case OmniPvdDataType::eOBJECT_HANDLE: + return getOmniPvdDataTypeSize(); + break; + case OmniPvdDataType::eENUM_VALUE: + return getOmniPvdDataTypeSize(); + break; + case OmniPvdDataType::eFLAGS_WORD: + return getOmniPvdDataTypeSize(); + break; + default: + return 0; + break; + } +} + +#endif diff --git a/engine/third_party/physx/pvdruntime/include/OmniPvdFileReadStream.h b/engine/third_party/physx/pvdruntime/include/OmniPvdFileReadStream.h new file mode 100644 index 00000000..720d2055 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/include/OmniPvdFileReadStream.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_FILE_READ_STREAM_H +#define OMNI_PVD_FILE_READ_STREAM_H + +#include "OmniPvdReadStream.h" + +/** + * \brief Used to abstract a file read stream + * + * Used to set the filename, opening and closing it. + */ +class OmniPvdFileReadStream : public OmniPvdReadStream +{ +public: + virtual ~OmniPvdFileReadStream() + { + } + + /** + * \brief Sets the file name of the file to read from + * + * \param fileName The file name of the file to open + */ + virtual void OMNI_PVD_CALL setFileName(const char* fileName) = 0; + + /** + * \brief Opens the file + * + * \return True if the file opening was successfull + */ + virtual bool OMNI_PVD_CALL openFile() = 0; + + /** + * \brief Closes the file + * + * \return True if the file closing was successfull + */ + virtual bool OMNI_PVD_CALL closeFile() = 0; +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/include/OmniPvdFileWriteStream.h b/engine/third_party/physx/pvdruntime/include/OmniPvdFileWriteStream.h new file mode 100644 index 00000000..5936b00e --- /dev/null +++ b/engine/third_party/physx/pvdruntime/include/OmniPvdFileWriteStream.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_FILE_WRITE_STREAM_H +#define OMNI_PVD_FILE_WRITE_STREAM_H + +#include "OmniPvdWriteStream.h" + +/** + * \brief Used to abstract a file write stream + * + * Used to set the filename, opening and closing it. + */ +class OmniPvdFileWriteStream : public OmniPvdWriteStream +{ +public: + virtual ~OmniPvdFileWriteStream() + { + } + + /** + * \brief Sets the file name of the file to write to + * + * \param fileName The file name of the file to open + */ + virtual void OMNI_PVD_CALL setFileName(const char* fileName) = 0; + + /** + * \brief Opens the file + * + * \return True if the file opening was successfull + */ + virtual bool OMNI_PVD_CALL openFile() = 0; + + /** + * \brief Closes the file + * + * \return True if the file closing was successfull + */ + virtual bool OMNI_PVD_CALL closeFile() = 0; +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/include/OmniPvdLibraryFunctions.h b/engine/third_party/physx/pvdruntime/include/OmniPvdLibraryFunctions.h new file mode 100644 index 00000000..2845047e --- /dev/null +++ b/engine/third_party/physx/pvdruntime/include/OmniPvdLibraryFunctions.h @@ -0,0 +1,54 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_LIBRARY_FUNCTIONS_H +#define OMNI_PVD_LIBRARY_FUNCTIONS_H + +#include "OmniPvdDefines.h" + +class OmniPvdReader; +class OmniPvdWriter; +class OmniPvdFileReadStream; +class OmniPvdFileWriteStream; +class OmniPvdMemoryStream; + +typedef OmniPvdReader* (OMNI_PVD_CALL *createOmniPvdReaderFp)(); +typedef void (OMNI_PVD_CALL *destroyOmniPvdReaderFp)(OmniPvdReader& reader); + +typedef OmniPvdWriter* (OMNI_PVD_CALL *createOmniPvdWriterFp)(); +typedef void (OMNI_PVD_CALL *destroyOmniPvdWriterFp)(OmniPvdWriter& writer); + +typedef OmniPvdFileReadStream* (OMNI_PVD_CALL *createOmniPvdFileReadStreamFp)(); +typedef void (OMNI_PVD_CALL *destroyOmniPvdFileReadStreamFp)(OmniPvdFileReadStream& fileReadStream); + +typedef OmniPvdFileWriteStream* (OMNI_PVD_CALL *createOmniPvdFileWriteStreamFp)(); +typedef void (OMNI_PVD_CALL *destroyOmniPvdFileWriteStreamFp)(OmniPvdFileWriteStream& fileWriteStream); + +typedef OmniPvdMemoryStream* (OMNI_PVD_CALL *createOmniPvdMemoryStreamFp)(); +typedef void (OMNI_PVD_CALL *destroyOmniPvdMemoryStreamFp)(OmniPvdMemoryStream& memoryStream); + +#endif diff --git a/engine/third_party/physx/pvdruntime/include/OmniPvdLibraryHelpers.h b/engine/third_party/physx/pvdruntime/include/OmniPvdLibraryHelpers.h new file mode 100644 index 00000000..1f60823b --- /dev/null +++ b/engine/third_party/physx/pvdruntime/include/OmniPvdLibraryHelpers.h @@ -0,0 +1,41 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +#ifndef OMNI_PVD_LIBRARY_FUNCTIONS_H +#define OMNI_PVD_LIBRARY_FUNCTIONS_H + +#include "OmniPvdDefines.h" + +class OmniPvdReader; +class OmniPvdWriter; + +typedef OmniPvdReader* (OMNI_PVD_CALL *createOmniPvdReaderFp)(); +typedef void (OMNI_PVD_CALL *destroyOmniPvdReaderFp)(OmniPvdReader *reader); + +typedef OmniPvdWriter* (OMNI_PVD_CALL *createOmniPvdWriterFp)(); +typedef void (OMNI_PVD_CALL *destroyOmniPvdWriterFp)(OmniPvdWriter *writer); + +#endif \ No newline at end of file diff --git a/engine/third_party/physx/pvdruntime/include/OmniPvdLoader.h b/engine/third_party/physx/pvdruntime/include/OmniPvdLoader.h new file mode 100644 index 00000000..1bc353f5 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/include/OmniPvdLoader.h @@ -0,0 +1,178 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +#ifndef OMNI_PVD_LOADER_H +#define OMNI_PVD_LOADER_H + +#include "OmniPvdWriter.h" +#include "OmniPvdReader.h" +#include "OmniPvdLibraryFunctions.h" + +#include + +#ifdef OMNI_PVD_WIN + #ifndef _WINDOWS_ // windows already included otherwise + #include + #endif +#elif defined(__linux__) + #include +#endif + +class OmniPvdLoader +{ +public: + OmniPvdLoader(); + ~OmniPvdLoader(); + bool loadOmniPvd(const char *libFile); + void unloadOmniPvd(); + void* mLibraryHandle; + + createOmniPvdWriterFp mCreateOmniPvdWriter; + destroyOmniPvdWriterFp mDestroyOmniPvdWriter; + + createOmniPvdReaderFp mCreateOmniPvdReader; + destroyOmniPvdReaderFp mDestroyOmniPvdReader; + + createOmniPvdFileReadStreamFp mCreateOmniPvdFileReadStream; + destroyOmniPvdFileReadStreamFp mDestroyOmniPvdFileReadStream; + + createOmniPvdFileWriteStreamFp mCreateOmniPvdFileWriteStream; + destroyOmniPvdFileWriteStreamFp mDestroyOmniPvdFileWriteStream; + + createOmniPvdMemoryStreamFp mCreateOmniPvdMemoryStream; + destroyOmniPvdMemoryStreamFp mDestroyOmniPvdMemoryStream; +}; + +inline OmniPvdLoader::OmniPvdLoader() +{ + mLibraryHandle = 0; + + mCreateOmniPvdWriter = 0; + mDestroyOmniPvdWriter = 0; + + mCreateOmniPvdReader = 0; + mDestroyOmniPvdReader = 0; + + mCreateOmniPvdFileReadStream = 0; + mDestroyOmniPvdFileReadStream = 0; + + mCreateOmniPvdFileWriteStream = 0; + mDestroyOmniPvdFileWriteStream = 0; + + mCreateOmniPvdMemoryStream = 0; + mDestroyOmniPvdMemoryStream = 0; +} + +inline OmniPvdLoader::~OmniPvdLoader() +{ + unloadOmniPvd(); +} + +inline bool OmniPvdLoader::loadOmniPvd(const char *libFile) +{ + +#ifdef OMNI_PVD_WIN + mLibraryHandle = LoadLibraryA(libFile); +#elif defined(__linux__) + mLibraryHandle = dlopen(libFile, RTLD_NOW); +#endif + + if (mLibraryHandle) + { +#ifdef OMNI_PVD_WIN + mCreateOmniPvdWriter = (createOmniPvdWriterFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdWriter"); + mDestroyOmniPvdWriter = (destroyOmniPvdWriterFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdWriter"); + + mCreateOmniPvdReader = (createOmniPvdReaderFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdReader"); + mDestroyOmniPvdReader = (destroyOmniPvdReaderFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdReader"); + + mCreateOmniPvdFileReadStream = (createOmniPvdFileReadStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdFileReadStream"); + mDestroyOmniPvdFileReadStream = (destroyOmniPvdFileReadStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdFileReadStream"); + + mCreateOmniPvdFileWriteStream = (createOmniPvdFileWriteStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdFileWriteStream"); + mDestroyOmniPvdFileWriteStream = (destroyOmniPvdFileWriteStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdFileWriteStream"); + + mCreateOmniPvdMemoryStream = (createOmniPvdMemoryStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdMemoryStream"); + mDestroyOmniPvdMemoryStream = (destroyOmniPvdMemoryStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdMemoryStream"); +#elif defined(__linux__) + mCreateOmniPvdWriter = (createOmniPvdWriterFp)dlsym(mLibraryHandle, "createOmniPvdWriter"); + mDestroyOmniPvdWriter = (destroyOmniPvdWriterFp)dlsym(mLibraryHandle, "destroyOmniPvdWriter"); + + mCreateOmniPvdReader = (createOmniPvdReaderFp)dlsym(mLibraryHandle, "createOmniPvdReader"); + mDestroyOmniPvdReader = (destroyOmniPvdReaderFp)dlsym(mLibraryHandle, "destroyOmniPvdReader"); + + mCreateOmniPvdFileReadStream = (createOmniPvdFileReadStreamFp)dlsym(mLibraryHandle, "createOmniPvdFileReadStream"); + mDestroyOmniPvdFileReadStream = (destroyOmniPvdFileReadStreamFp)dlsym(mLibraryHandle, "destroyOmniPvdFileReadStream"); + + mCreateOmniPvdFileWriteStream = (createOmniPvdFileWriteStreamFp)dlsym(mLibraryHandle, "createOmniPvdFileWriteStream"); + mDestroyOmniPvdFileWriteStream = (destroyOmniPvdFileWriteStreamFp)dlsym(mLibraryHandle, "destroyOmniPvdFileWriteStream"); + + mCreateOmniPvdMemoryStream = (createOmniPvdMemoryStreamFp)dlsym(mLibraryHandle, "createOmniPvdMemoryStream"); + mDestroyOmniPvdMemoryStream = (destroyOmniPvdMemoryStreamFp)dlsym(mLibraryHandle, "destroyOmniPvdMemoryStream"); + +#endif + + if ((!mCreateOmniPvdWriter) || + (!mDestroyOmniPvdWriter) || + (!mCreateOmniPvdReader) || + (!mDestroyOmniPvdReader) || + (!mCreateOmniPvdFileReadStream) || + (!mDestroyOmniPvdFileReadStream) || + (!mCreateOmniPvdFileWriteStream) || + (!mDestroyOmniPvdFileWriteStream) || + (!mCreateOmniPvdMemoryStream) || + (!mDestroyOmniPvdMemoryStream) + ) + { +#ifdef OMNI_PVD_WIN + FreeLibrary((HINSTANCE)mLibraryHandle); +#elif defined(__linux__) + dlclose(mLibraryHandle); +#endif + mLibraryHandle = 0; + return false; + } + } + else { + return false; + } + return true; +} + +inline void OmniPvdLoader::unloadOmniPvd() +{ + if (mLibraryHandle) + { +#ifdef OMNI_PVD_WIN + FreeLibrary((HINSTANCE)mLibraryHandle); +#elif defined(__linux__) + dlclose(mLibraryHandle); +#endif + mLibraryHandle = 0; + } +} + +#endif diff --git a/engine/third_party/physx/pvdruntime/include/OmniPvdMemoryStream.h b/engine/third_party/physx/pvdruntime/include/OmniPvdMemoryStream.h new file mode 100644 index 00000000..ae3c958e --- /dev/null +++ b/engine/third_party/physx/pvdruntime/include/OmniPvdMemoryStream.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_MEMORY_STREAM_H +#define OMNI_PVD_MEMORY_STREAM_H + +#include "OmniPvdReadStream.h" +#include "OmniPvdWriteStream.h" + +/** + * \brief Used to abstract a memory read/write stream + * + * Used to get the read and write streams. + */ +class OmniPvdMemoryStream +{ +public: + virtual ~OmniPvdMemoryStream() + { + } + /** + * \brief Used to get the read stream + * + * \return The read stream + */ + virtual OmniPvdReadStream* OMNI_PVD_CALL getReadStream() = 0; + + /** + * \brief Used to get the write stream + * + * \return The write stream + */ + virtual OmniPvdWriteStream* OMNI_PVD_CALL getWriteStream() = 0; + + /** + * \brief Sets the buffer size in bytes of the memory streams + * + * \return The actually allocated length of the memory stream + */ + virtual uint64_t OMNI_PVD_CALL setBufferSize(uint64_t bufferLength) = 0; +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/include/OmniPvdReadStream.h b/engine/third_party/physx/pvdruntime/include/OmniPvdReadStream.h new file mode 100644 index 00000000..7b02a979 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/include/OmniPvdReadStream.h @@ -0,0 +1,78 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_READ_STREAM_H +#define OMNI_PVD_READ_STREAM_H + +#include "OmniPvdDefines.h" + +/** + * \brief Used to abstract a memory read stream + * + * Allows to read and skip bytes as well as open/close it. + */ +class OmniPvdReadStream +{ +public: + virtual ~OmniPvdReadStream() + { + } + + /** + * \brief Read n bytes from the shared memory buffer + * + * \param bytes Reads n bytes into the destination pointer + * \param nbrBytes The requested number of bytes to read + * \return The actual number of bytes read + */ + virtual uint64_t OMNI_PVD_CALL readBytes(uint8_t* bytes, uint64_t nbrBytes) = 0; + + /** + * \brief Skip n bytes from the shared memory buffer + * + * \param nbrBytes The requested number of bytes to skip + * \return The actual number of bytes skipped + */ + virtual uint64_t OMNI_PVD_CALL skipBytes(uint64_t nbrBytes) = 0; + + /** + * \brief Opens the read stream + * + * \return True if it succeeded + */ + virtual bool OMNI_PVD_CALL openStream() = 0; + + /** + * \brief Closes the read stream + * + * \return True if it succeeded + */ + virtual bool OMNI_PVD_CALL closeStream() = 0; +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/include/OmniPvdReader.h b/engine/third_party/physx/pvdruntime/include/OmniPvdReader.h new file mode 100644 index 00000000..1383e425 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/include/OmniPvdReader.h @@ -0,0 +1,237 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_READER_H +#define OMNI_PVD_READER_H + +#include "OmniPvdDefines.h" +#include "OmniPvdCommands.h" +#include "OmniPvdReadStream.h" + +#define OMNI_PVD_MAX_STRING_LENGTH 2048 + + +/** + * \brief Used to read debug information from an OmniPvdReadStream + * + * Using the getNextCommand function in a while loop for example one can traverse the stream one command after another. Given the command, different functions below will be available. + * + * Using the OmniPvdCommand::Enum one can determine the type of command and like that use the appropriate get functions to extract the payload from the command. + */ + +class OmniPvdReader +{ +public: + virtual ~OmniPvdReader() + { + } + + /** + * \brief Sets the log function to print the internal debug messages of the OmniPVD Reader instance + * + * \param logFunction The function pointer to receive the log messages + */ + virtual void OMNI_PVD_CALL setLogFunction(OmniPvdLogFunction logFunction) = 0; + + /** + * \brief Sets the read stream that contains the OmniPVD API command stream + * + * \param stream The OmniPvdReadStream that holds the stream of API calls/notifications + */ + virtual void OMNI_PVD_CALL setReadStream(OmniPvdReadStream& stream) = 0; + + /** + * \brief Extracts the versions from the binary file to read and tests if the file is older or equal to that of the reader. + * + * \param majorVersion The major versions of the stream + * \param minorVersion The minor versions of the stream + * \param patch The patch number of the stream + * \return If the reading was possible to start or not + */ + virtual bool OMNI_PVD_CALL startReading(OmniPvdVersionType& majorVersion, OmniPvdVersionType& minorVersion, OmniPvdVersionType& patch) = 0; + + /** + * \brief The heartbeat function of the reader class. As long as the command that is returned is not equal to OmniPvdCommand::eINVALID, then one can safely extract the data fields from the command. + * + * \return The command enum type + */ + virtual OmniPvdCommand::Enum OMNI_PVD_CALL getNextCommand() = 0; + + /** + * \brief Returns the major version of the stream + * + * \return The major version + */ + virtual OmniPvdVersionType OMNI_PVD_CALL getMajorVersion() = 0; + + /** + * \brief Returns the minor version of the stream + * + * \return The minor version + */ + virtual OmniPvdVersionType OMNI_PVD_CALL getMinorVersion() = 0; + + /** + * \brief Returns the patch number of the stream + * + * \return The patch value + */ + virtual OmniPvdVersionType OMNI_PVD_CALL getPatch() = 0; + + /** + * \brief Returns the context handle of the latest command, if it had one, else OMNI_PVD_INVALID_HANDLE + * + * \return The context handle of the latest command + */ + virtual OmniPvdContextHandle OMNI_PVD_CALL getContextHandle() = 0; + + /** + * \brief Returns the object handle of the latest command, if it had one, else OMNI_PVD_INVALID_HANDLE + * + * \return The object handle of the latest command + */ + virtual OmniPvdObjectHandle OMNI_PVD_CALL getObjectHandle() = 0; + + /** + * \brief Returns the class handle of the latest command, if it had one, else OMNI_PVD_INVALID_HANDLE + * + * \return The class handle of the latest command + */ + virtual OmniPvdClassHandle OMNI_PVD_CALL getClassHandle() = 0; + + /** + * \brief Returns the base class handle of the latest command, if it had one, else OMNI_PVD_INVALID_HANDLE + * + * \return The base class handle of the latest command + */ + virtual OmniPvdClassHandle OMNI_PVD_CALL getBaseClassHandle() = 0; + + /** + * \brief Returns the attribute handle of the latest command, if it had one, else OMNI_PVD_INVALID_HANDLE + * + * \return The attribute handle of the latest command + */ + virtual OmniPvdAttributeHandle OMNI_PVD_CALL getAttributeHandle() = 0; + + /** + * \brief Returns the class name of the latest command, if it had one, else a null terminated string of length 0 + * + * \return The string containing the class name + */ + virtual const char* OMNI_PVD_CALL getClassName() = 0; + + /** + * \brief Returns the attribute name of the latest command, if it had one, else a null terminated string of length 0 + * + * \return The string containing the attribute name + */ + virtual const char* OMNI_PVD_CALL getAttributeName() = 0; + + /** + * \brief Returns the object name of the latest command, if it had one, else a null terminated string of length 0 + * + * \return The string containing the object name + */ + virtual const char* OMNI_PVD_CALL getObjectName() = 0; + + /** + * \brief Returns the attribute data pointer, if it had one, else returns 0 + * + * \return The array containing the attribute data + */ + virtual const uint8_t* OMNI_PVD_CALL getAttributeDataPointer() = 0; + + /** + * \brief Returns the attribute data type, the data type is undefined if the last command did not contain attribute data + * + * \return The attribute data type + */ + virtual OmniPvdDataType::Enum OMNI_PVD_CALL getAttributeDataType() = 0; + + /** + * \brief Returns the attribute data length, the data length of the last command if it was defined, otherwise returns 0 + * + * \return The attribute data length + */ + virtual uint32_t OMNI_PVD_CALL getAttributeDataLength() = 0; + + /** + * \brief Returns the number of elements contained in the last set operation, if they were defined, otherwise returns 0 + * + * \return The number of elements + */ + virtual uint32_t OMNI_PVD_CALL getAttributeNumberElements() = 0; + + /** + * \brief Returns the numberclass handle of the attribute class, if it was defined, else returns OMNI_PVD_INVALID_HANDLE + * + * \return The attibute class handle + */ + virtual OmniPvdClassHandle OMNI_PVD_CALL getAttributeClassHandle() = 0; + + /** + * \brief Returns the frame start value + * + * \return The frame ID value + */ + virtual uint64_t OMNI_PVD_CALL getFrameTimeStart() = 0; + + /** + * \brief Returns the frame stop value + * + * \return The frame ID value + */ + virtual uint64_t OMNI_PVD_CALL getFrameTimeStop() = 0; + + /** + * \brief Returns data for the last message received. + * + * \param message A handle to the message string is returned. + * \param file A handle to the string containing the file name the message originated from is returned. + * \param line A handle to the line number in the file where the message originated from is returned. + * \param type A handle to the message type is returned. + * \param handle A handle to the Omni PVD class handle is returned. + */ + virtual bool OMNI_PVD_CALL getMessageData(const char*& message, const char*& file, uint32_t& line, uint32_t& type, OmniPvdClassHandle& handle) = 0; + + /** + * \brief Returns the class handle containing the enum values, if it was defined, else returns OMNI_PVD_INVALID_HANDLE + * + * \return The enum class handle + */ + virtual OmniPvdClassHandle OMNI_PVD_CALL getEnumClassHandle() = 0; + + /** + * \brief Returns the enum value for a specific flag, if it was defined, else returns 0 + * + * \return The enum value + */ + virtual OmniPvdEnumValueType OMNI_PVD_CALL getEnumValue() = 0; +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/include/OmniPvdWriteStream.h b/engine/third_party/physx/pvdruntime/include/OmniPvdWriteStream.h new file mode 100644 index 00000000..fc621282 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/include/OmniPvdWriteStream.h @@ -0,0 +1,77 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_WRITE_STREAM_H +#define OMNI_PVD_WRITE_STREAM_H + +#include "OmniPvdDefines.h" + +/** + * \brief Used to abstract a memory write stream + * + * Allows to write bytes as well as open/close the stream. + */ +class OmniPvdWriteStream +{ +public: + virtual ~OmniPvdWriteStream() + { + } + + /** + * \brief Write n bytes to the shared memory buffer + * + * \param bytes pointer to the bytes to write + * \param nbrBytes The requested number of bytes to write + * \return The actual number of bytes written + */ + virtual uint64_t OMNI_PVD_CALL writeBytes(const uint8_t* bytes, uint64_t nbrBytes) = 0; + + /** + * \brief Flushes the writes + * + * \return The success of the operation + */ + virtual bool OMNI_PVD_CALL flush() = 0; + + /** + * \brief Opens the stream + * + * \return The success of the operation + */ + virtual bool OMNI_PVD_CALL openStream() = 0; + + /** + * \brief Closes the stream + * + * \return The success of the operation + */ + virtual bool OMNI_PVD_CALL closeStream() = 0; +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/include/OmniPvdWriter.h b/engine/third_party/physx/pvdruntime/include/OmniPvdWriter.h new file mode 100644 index 00000000..f3a225f2 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/include/OmniPvdWriter.h @@ -0,0 +1,396 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_WRITER_H +#define OMNI_PVD_WRITER_H + +#include "OmniPvdDefines.h" +#include "OmniPvdWriteStream.h" + + +/** +\brief Flags which report the status of an OmniPvdWriter. +*/ +struct OmniPvdWriterStatusFlag +{ + enum Enum + { + /** + * \brief Set if any attempt to write to the stream failed + * + * \see OmniPvdWriter.getStatus() + */ + eSTREAM_WRITE_FAILURE = (1<<0) + }; +}; + +/** + * \brief Used to write debug information to an OmniPvdWriteStream + * + * Allows the registration of OmniPVD classes and attributes, in a similar fashion to an object oriented language. A registration returns a unique identifier or handle. + * + * Once classes and attributes have been registered, one can create for example object instances of a class and set the values of the attributes of a specific object. + * + * Objects can be grouped by context using the context handle. The context handle is a user-specified handle which is passed to the set functions and object creation and destruction functions. + * + * Each context can have its own notion of time. The current time of a context can be exported with calls to the startFrame and stopFrame functions. + */ +class OmniPvdWriter +{ +public: + virtual ~OmniPvdWriter() + { + } + + /** + * \brief Sets the log function to print the internal debug messages of the OmniPVD API + * + * \param logFunction The function pointer to receive the log messages + */ + virtual void OMNI_PVD_CALL setLogFunction(OmniPvdLogFunction logFunction) = 0; + + /** + * \brief Sets the write stream to receive the API command stream + * + * \param writeStream The OmniPvdWriteStream to receive the stream of API calls/notifications + */ + virtual void OMNI_PVD_CALL setWriteStream(OmniPvdWriteStream& writeStream) = 0; + + /** + * \brief Gets the pointer to the write stream + * + * \return A pointer to the write stream + */ + virtual OmniPvdWriteStream* OMNI_PVD_CALL getWriteStream() = 0; + + /** + * \brief Registers an OmniPVD class + * + * Returns a unique handle to a class, which can be used to register class attributes and express object lifetimes with the createObject and destroyObject functions. Class inheritance can be described by calling registerClass with a base class handle. Derived classes inherit the attributes of the parent classes. + * + * \param className The class name + * \param baseClassHandle The handle to the base class. This handle is obtained by pre-registering the base class. Defaults to 0 which means the class has no parent class + * \return A unique class handle for the registered class + * + * \see OmniPvdWriter::registerAttribute() + * \see OmniPvdWriter::registerEnumValue() + * \see OmniPvdWriter::registerFlagsAttribute() + * \see OmniPvdWriter::registerClassAttribute() + * \see OmniPvdWriter::registerUniqueListAttribute() + * \see OmniPvdWriter::createObject() + */ + virtual OmniPvdClassHandle OMNI_PVD_CALL registerClass(const char* className, OmniPvdClassHandle baseClassHandle = 0) = 0; + + /** + * \brief Registers an enum name and corresponding value for a pre-registered class. + * + * Registering enums happens in two steps. First, registerClass() is called with the name of the enum. This returns a class handle, which is used in a second step for the enum value registration with registerEnumValue(). If an enum has multiple values, registerEnumValue() has to be called with the different values. + * + * Note that enums differ from usual classes because their attributes, the enum values, do not change over time and there is no need to call setAttribute(). + * + * \param classHandle The handle from the registerClass() call + * \param attributeName The name of the enum value + * \param value The value of the enum value + * \return A unique attribute handle for the registered enum value + * + * \see OmniPvdWriter::registerClass() + */ + virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerEnumValue(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdEnumValueType value) = 0; + + /** + * \brief Registers an attribute. + * + * The class handle is obtained from a previous call to registerClass(). After registering an attribute, one gets an attribute handle which can be used to set data values of an attribute with setAttribute(). All attributes are treated as arrays, even if the attribute has only a single data item. Set nbElements to 0 to indicate that the array has a variable length. + * + * \param classHandle The handle from the registerClass() call + * \param attributeName The attribute name + * \param attributeDataType The attribute data type + * \param nbElements The number of elements in the array. Set this to 0 to indicate a variable length array + * \return A unique attribute handle for the registered attribute + * + * \see OmniPvdWriter::registerClass() + * \see OmniPvdWriter::setAttribute() + */ + virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdDataType::Enum attributeDataType, uint32_t nbElements) = 0; + + /** + * \brief Registers an attribute which is a flag. + * + * Use this function to indicate that a pre-registered class has a flag attribute, i.e., the attribute is a pre-registered enum. + * + * The returned attribute handle can be used in setAttribute() to set an object's flags. + * + * \param classHandle The handle from the registerClass() call of the class + * \param attributeName The attribute name + * \param enumClassHandle The handle from the registerClass() call of the enum + * \return A unique attribute handle for the registered flags attribute + * + * \see OmniPvdWriter::registerClass() + * \see OmniPvdWriter::setAttribute() + */ + virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerFlagsAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdClassHandle enumClassHandle) = 0; + + /** + * \brief Registers an attribute which is a class. + * + * Use this function to indicate that a pre-registered class has an attribute which is a pre-registered class. + * + * The returned attribute handle can be used in setAttribute() to set an object's class attribute. + * + * \param classHandle The handle from the registerClass() call of the class + * \param attributeName The attribute name + * \param classAttributeHandle The handle from the registerClass() call of the class attribute + * \return A unique handle for the registered class attribute + * + * \see OmniPvdWriter::registerClass() + * \see OmniPvdWriter::setAttribute() + */ + virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerClassAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdClassHandle classAttributeHandle) = 0; + + /** + * \brief Registers an attribute which can hold a list of unique items. + * + * The returned attribute handle can be used in calls to addToUniqueListAttribute() and removeFromUniqueListAttribute(), to add an item to and remove it from the list, respectively. + * + * \param classHandle The handle from the registerClass() call of the class + * \param attributeName The attribute name + * \param attributeDataType The data type of the items which will get added to the list attribute + * \return A unique handle for the registered list attribute + * + * \see OmniPvdWriter::registerClass() + * \see OmniPvdWriter::addToUniqueListAttribute() + * \see OmniPvdWriter::removeFromUniqueListAttribute() + */ + virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerUniqueListAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdDataType::Enum attributeDataType) = 0; + + /** + * \brief Sets an attribute value. + * + * Since an attribute can be part of a nested construct of class attributes, the method + * expects an array of attribute handles as input to uniquely identify the attribute. + * + * \param contextHandle The user-defined context handle for grouping objects + * \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * \param attributeHandles The attribute handles containing all class attribute handles of a nested class + * construct. The last one has to be the handle from the registerUniqueListAttribute() call. + * \param nbAttributeHandles The number of attribute handles provided in attributeHandles + * \param data The pointer to the data of the element(s) to remove from the set + * \param nbrBytes The number of bytes to be written + * + * \see OmniPvdWriter::registerAttribute() + */ + virtual void OMNI_PVD_CALL setAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t *data, uint32_t nbrBytes) = 0; + + /** + * \brief Sets an attribute value. + * + * See other setAttribute method for details. This special version covers the case where the + * attribute is not part of a class attribute construct. + * + * \param contextHandle The user-defined context handle for grouping objects + * \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * \param attributeHandle The handle from the registerAttribute() call + * \param data The pointer to the data + * \param nbrBytes The number of bytes to be written + * + * \see OmniPvdWriter::registerAttribute() + */ + inline void OMNI_PVD_CALL setAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, OmniPvdAttributeHandle attributeHandle, const uint8_t *data, uint32_t nbrBytes) + { + setAttribute(contextHandle, objectHandle, &attributeHandle, 1, data, nbrBytes); + } + + /** + * \brief Adds an item to a unique list attribute. + * + * A unique list attribute is defined like a set in mathematics, where each element must be unique. + * + * Since an attribute can be part of a nested construct of class attributes, the method + * expects an array of attribute handles as input to uniquely identify the attribute. + * + * \param contextHandle The user-defined context handle for grouping objects + * \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * \param attributeHandles The attribute handles containing all class attribute handles of a nested class + * construct. The last one has to be the handle from the registerUniqueListAttribute() call. + * \param nbAttributeHandles The number of attribute handles provided in attributeHandles + * \param data The pointer to the data of the item to add to the list + * \param nbrBytes The number of bytes to be written + * + * \see OmniPvdWriter::registerUniqueListAttribute() + */ + virtual void OMNI_PVD_CALL addToUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes) = 0; + + /** + * \brief Adds an item to a unique list attribute. + * + * See other addToUniqueListAttribute method for details. This special version covers the case where the + * attribute is not part of a class attribute construct. + * + * \param contextHandle The user-defined context handle for grouping objects + * \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * \param attributeHandle The handle from the registerUniqueListAttribute() call + * \param data The pointer to the data of the item to add to the list + * \param nbrBytes The number of bytes to be written + * + * \see OmniPvdWriter::registerUniqueListAttribute() + */ + inline void OMNI_PVD_CALL addToUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, OmniPvdAttributeHandle attributeHandle, const uint8_t* data, uint32_t nbrBytes) + { + addToUniqueListAttribute(contextHandle, objectHandle, &attributeHandle, 1, data, nbrBytes); + } + + /** + * \brief Removes an item from a uniqe list attribute + * + * A uniqe list attribute is defined like a set in mathematics, where each element must be unique. + * + * Since an attribute can be part of a nested construct of class attributes, the method + * expects an array of attribute handles as input to uniquely identify the attribute. + * + * \param contextHandle The user-defined context handle for grouping objects + * \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * \param attributeHandles The attribute handles containing all class attribute handles of a nested class + * construct. The last one has to be the handle from the registerUniqueListAttribute() call. + * \param nbAttributeHandles The number of attribute handles provided in attributeHandles + * \param data The pointer to the data of the item to remove from the list + * \param nbrBytes The number of bytes to be written + * + * \see OmniPvdWriter::registerUniqueListAttribute() + */ + virtual void OMNI_PVD_CALL removeFromUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes) = 0; + + /** + * \brief Removes an item from a uniqe list attribute + * + * See other removeFromUniqueListAttribute method for details. This special version covers the case where the + * attribute is not part of a class attribute construct. + * + * \param contextHandle The user-defined context handle for grouping objects + * \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * \param attributeHandle The handle from the registerUniqueListAttribute() call + * \param data The pointer to the data of the item to remove from the list + * \param nbrBytes The number of bytes to be written + * + * \see OmniPvdWriter::registerUniqueListAttribute() + */ + inline void OMNI_PVD_CALL removeFromUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, OmniPvdAttributeHandle attributeHandle, const uint8_t* data, uint32_t nbrBytes) + { + removeFromUniqueListAttribute(contextHandle, objectHandle, &attributeHandle, 1, data, nbrBytes); + } + + /** + * \brief Creates an object creation event + * + * Indicates that an object is created. One can freely choose a context handle for grouping objects. + * + * The class handle is obtained from a registerClass() call. The object handle should be unique, but as it's not tracked by the OmniPVD API, it's important this is set to a valid handle such as the object's physical memory address. + * + * The object name can be freely choosen or not set. + * + * Create about object destruction event by calling destroyObject(). + * + * \param contextHandle The user-defined context handle for grouping objects + * \param classHandle The handle from the registerClass() call + * \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * \param objectName The user-defined name of the object. Can be the empty string + * + * \see OmniPvdWriter::registerClass() + * \see OmniPvdWriter::destroyObject() + */ + virtual void OMNI_PVD_CALL createObject(OmniPvdContextHandle contextHandle, OmniPvdClassHandle classHandle, OmniPvdObjectHandle objectHandle, const char* objectName) = 0; + + /** + * \brief Creates an object destruction event + * + * Use this to indicate that an object is destroyed. Use the same user-defined context and object handles as were used in the create object calls. + * + * \param contextHandle The user-defined context handle for grouping objects + * \param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * + * \see OmniPvdWriter::registerClass() + * \see OmniPvdWriter::createObject() + */ + virtual void OMNI_PVD_CALL destroyObject(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle) = 0; + + /** + * \brief Creates a frame start event + * + * Time or frames are counted separatly per user-defined context. + * + * \param contextHandle The user-defined context handle for grouping objects + * \param timeStamp The timestamp of the frame start event + */ + virtual void OMNI_PVD_CALL startFrame(OmniPvdContextHandle contextHandle, uint64_t timeStamp) = 0; + + /** + * \brief Creates a stop frame event + * + * Time is counted separately per user-defined context. + * + * \param contextHandle The user-defined context handle for grouping objects + * \param timeStamp The timestamp of the frame stop event + */ + + virtual void OMNI_PVD_CALL stopFrame(OmniPvdContextHandle contextHandle, uint64_t timeStamp) = 0; + + /** + * \brief Record a message + * + * Record a message in the OVD stream. The file, line and type parameters can help locate + * the source of the message when debugging. + * + * \param contextHandle The user-defined context handle for grouping objects + * \param message A character string text message. + * \param file A character string containing the name of the source file where the message originated from. + * NULL is a valid value if a file name is not needed. + * \param line The line number in the source file where the message originated from. + * \param type An enumerated type describing the message type. If unneeded, any value can be set. + * \param handle A handle to an Omni PVD enumerated type that contains all values for the previous type parameter. + * Setting OMNI_PVD_INVALID_HANDLE will cause this parameter to be ignored. + * See #registerEnumValue() + */ + virtual void OMNI_PVD_CALL recordMessage(OmniPvdContextHandle contextHandle, const char* message, const char* file, uint32_t line, uint32_t type, OmniPvdClassHandle handle = OMNI_PVD_INVALID_HANDLE) = 0; + + /** + * @brief Gets the status of the writer + * + * \return The current status flags of the writer, held in a 32 bit unsigned integer with the flag bits defined by OmniPvdWriterStatusFlag + * + * \see OmniPvdWriterStatusFlag + */ + virtual uint32_t OMNI_PVD_CALL getStatus() = 0; + + /** + * \brief Clears or resets the status of the writer + * + */ + virtual void OMNI_PVD_CALL clearStatus() = 0; + +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdDefinesInternal.h b/engine/third_party/physx/pvdruntime/src/OmniPvdDefinesInternal.h new file mode 100644 index 00000000..a92a04ff --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdDefinesInternal.h @@ -0,0 +1,40 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_DEFINES_INTERNAL_H +#define OMNI_PVD_DEFINES_INTERNAL_H + +#include + + +// types used to store certain properties in the PVD data stream +typedef uint8_t OmniPvdCommandStorageType; +typedef uint16_t OmniPvdDataTypeStorageType; + + +#endif diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.cpp b/engine/third_party/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.cpp new file mode 100644 index 00000000..d6f300a1 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.cpp @@ -0,0 +1,144 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#include "OmniPvdFileReadStreamImpl.h" + +OmniPvdFileReadStreamImpl::OmniPvdFileReadStreamImpl() +{ + mFileName = 0; + resetFileParams(); +} + +OmniPvdFileReadStreamImpl::~OmniPvdFileReadStreamImpl() +{ + closeFile(); + delete[] mFileName; + mFileName = 0; +} + +void OmniPvdFileReadStreamImpl::resetFileParams() +{ + mFileOpenAttempted = false; + mPFile = 0; +} + +void OMNI_PVD_CALL OmniPvdFileReadStreamImpl::setFileName(const char* fileName) +{ + if (!fileName) return; + int n = (int)strlen(fileName) + 1; + if (n < 2) return; + delete[] mFileName; + mFileName = new char[n]; +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) + strcpy_s(mFileName, n, fileName); +#else + strcpy(mFileName, fileName); +#endif + mFileName[n - 1] = 0; +} + +bool OMNI_PVD_CALL OmniPvdFileReadStreamImpl::openFile() +{ + if (mFileOpenAttempted) + { + return (mPFile!=0); + } + if (!mFileName) + { + return false; + } + mPFile = 0; + mFileOpenAttempted = true; +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) + errno_t err = fopen_s(&mPFile, mFileName, "rb"); + if (err != 0) + { + mPFile = 0; + } + else + { + fseek(mPFile, 0, SEEK_SET); + } +#else + mPFile = fopen(mFileName, "rb"); + if (mPFile) + { + fseek(mPFile, 0, SEEK_SET); + } +#endif + return (mPFile!=0); +} + +bool OMNI_PVD_CALL OmniPvdFileReadStreamImpl::closeFile() +{ + bool returnOK = true; + if (mFileOpenAttempted && (mPFile!=0)) + { + fclose(mPFile); + mPFile = 0; + } + else + { + returnOK = false; + } + resetFileParams(); + return returnOK; +} + +uint64_t OMNI_PVD_CALL OmniPvdFileReadStreamImpl::readBytes(uint8_t* bytes, uint64_t nbrBytes) +{ + size_t result = 0; + if (mPFile!=0) + { + result = fread(bytes, 1, nbrBytes, mPFile); + } + return result; +} + +uint64_t OMNI_PVD_CALL OmniPvdFileReadStreamImpl::skipBytes(uint64_t nbrBytes) +{ + if (mPFile==0) + { + return 0; + } + if (fseek(mPFile, (long)nbrBytes, SEEK_CUR)==0) + { + return nbrBytes; + } + return 0; +} + +bool OMNI_PVD_CALL OmniPvdFileReadStreamImpl::openStream() +{ + return openFile(); +} + +bool OMNI_PVD_CALL OmniPvdFileReadStreamImpl::closeStream() +{ + return closeFile(); +} diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.h b/engine/third_party/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.h new file mode 100644 index 00000000..ea45896e --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.h @@ -0,0 +1,56 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_FILE_READ_STREAM_IMPL_H +#define OMNI_PVD_FILE_READ_STREAM_IMPL_H + +#include "OmniPvdFileReadStream.h" +#include +#include +#include + +class OmniPvdFileReadStreamImpl : public OmniPvdFileReadStream +{ +public: + OmniPvdFileReadStreamImpl(); + ~OmniPvdFileReadStreamImpl(); + void resetFileParams(); + void OMNI_PVD_CALL setFileName(const char *fileName); + bool OMNI_PVD_CALL openFile(); + bool OMNI_PVD_CALL closeFile(); + uint64_t OMNI_PVD_CALL readBytes(uint8_t* bytes, uint64_t nbrBytes); + uint64_t OMNI_PVD_CALL skipBytes(uint64_t nbrBytes); + bool OMNI_PVD_CALL openStream(); + bool OMNI_PVD_CALL closeStream(); + + char* mFileName; + bool mFileOpenAttempted; + FILE* mPFile; +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.cpp b/engine/third_party/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.cpp new file mode 100644 index 00000000..27fc6948 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.cpp @@ -0,0 +1,132 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#include "OmniPvdFileWriteStreamImpl.h" + +OmniPvdFileWriteStreamImpl::OmniPvdFileWriteStreamImpl() +{ + mFileName = 0; + resetFileParams(); +} + +void OmniPvdFileWriteStreamImpl::resetFileParams() +{ + mFileOpenAttempted = false; + mPFile = 0; +} + +OmniPvdFileWriteStreamImpl::~OmniPvdFileWriteStreamImpl() +{ + closeFile(); + delete[] mFileName; + mFileName = 0; +} + +void OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::setFileName(const char* fileName) +{ + if (!fileName) return; + int n = (int)strlen(fileName) + 1; + if (n < 2) return; + delete[] mFileName; + mFileName = new char[n]; +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) + strcpy_s(mFileName, n, fileName); +#else + strcpy(mFileName, fileName); +#endif + mFileName[n - 1] = 0; +} + +bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::openFile() +{ + if (mFileOpenAttempted) + { + return (mPFile!=0); + } + if (!mFileName) + { + return false; + } + mPFile = 0; + mFileOpenAttempted = true; + +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) + errno_t err = fopen_s(&mPFile, mFileName, "wb"); + if (err != 0) + { + mPFile = 0; + } +#else + mPFile = fopen(mFileName, "wb"); +#endif + return (mPFile!=0); +} + +bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::closeFile() +{ + bool returnOK = true; + if (mFileOpenAttempted && (mPFile!=0)) + { + fclose(mPFile); + } + else + { + returnOK = false; + } + resetFileParams(); + return returnOK; +} + +uint64_t OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::writeBytes(const uint8_t *bytes, uint64_t nbrBytes) +{ + size_t result = 0; + if (mPFile!=0) + { + result = fwrite(bytes, 1, nbrBytes, mPFile); + } + return result; +} + +bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::flush() +{ + if (mPFile==0) + { + return false; + } + return fflush(mPFile) != 0; +} + +bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::openStream() +{ + return openFile(); +} + +bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::closeStream() +{ + return closeFile(); +} diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.h b/engine/third_party/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.h new file mode 100644 index 00000000..31d84ba0 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_FILE_WRITE_STREAM_IMPL_H +#define OMNI_PVD_FILE_WRITE_STREAM_IMPL_H + +#include "OmniPvdFileWriteStream.h" +#include +#include +#include + +class OmniPvdFileWriteStreamImpl : public OmniPvdFileWriteStream { +public: + OmniPvdFileWriteStreamImpl(); + ~OmniPvdFileWriteStreamImpl(); + void resetFileParams(); + void OMNI_PVD_CALL setFileName(const char *fileName); + bool OMNI_PVD_CALL openFile(); + bool OMNI_PVD_CALL closeFile(); + uint64_t OMNI_PVD_CALL writeBytes(const uint8_t* bytes, uint64_t nbrBytes); + bool OMNI_PVD_CALL flush(); + bool OMNI_PVD_CALL openStream(); + bool OMNI_PVD_CALL closeStream(); + + char *mFileName; + FILE *mPFile; + bool mFileOpenAttempted; +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdHelpers.cpp b/engine/third_party/physx/pvdruntime/src/OmniPvdHelpers.cpp new file mode 100644 index 00000000..0ae0d429 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdHelpers.cpp @@ -0,0 +1,72 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#include "OmniPvdHelpers.h" + +uint8_t OmniPvdCompressInt(uint64_t handle, uint8_t *bytes) { + uint8_t lastBitGroupIndex = 0; + uint8_t shiftBits = 0; + for (int i = 0; i < 8; i++) { + if ((handle >> shiftBits) & 0x7f) { + lastBitGroupIndex = static_cast(i); + } + shiftBits += 7; + } + shiftBits = 0; + for (int i = 0; i <= lastBitGroupIndex; i++) { + uint8_t currentBitGroup = (handle >> shiftBits) & 0x7f; + if (i < lastBitGroupIndex) { + currentBitGroup |= 0x80; // Set the continuation flag bit to true + } + bytes[i] = currentBitGroup; + shiftBits += 7; + } + + return lastBitGroupIndex; +} + +uint64_t OmniPvdDeCompressInt(uint8_t *bytes, uint8_t maxBytes) { + if (maxBytes > 8) { + maxBytes = 8; + } + uint64_t decompressedInt = 0; + uint8_t continueFlag = 1; + uint8_t readBytes = 0; + uint8_t shiftBits = 0; + while (continueFlag && (readBytes < maxBytes)) { + const uint8_t currentByte = *bytes; + uint64_t decompressedBits = currentByte & 0x7f; + continueFlag = currentByte & 0x80; + decompressedInt |= (decompressedBits << shiftBits); + shiftBits += 7; + if (continueFlag) { + bytes++; + } + } + return decompressedInt; +} diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdHelpers.h b/engine/third_party/physx/pvdruntime/src/OmniPvdHelpers.h new file mode 100644 index 00000000..8dc64081 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdHelpers.h @@ -0,0 +1,37 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_HELPERS_H +#define OMNI_PVD_HELPERS_H + +#include + +extern uint8_t OmniPvdCompressInt(uint64_t handle, uint8_t *bytes); +extern uint64_t OmniPvdDeCompressInt(uint8_t *bytes, uint8_t maxBytes); + +#endif \ No newline at end of file diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdLibraryFunctionsImpl.cpp b/engine/third_party/physx/pvdruntime/src/OmniPvdLibraryFunctionsImpl.cpp new file mode 100644 index 00000000..c99c7c6c --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdLibraryFunctionsImpl.cpp @@ -0,0 +1,89 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#include "OmniPvdLibraryFunctions.h" +#include "OmniPvdReaderImpl.h" +#include "OmniPvdWriterImpl.h" +#include "OmniPvdFileReadStreamImpl.h" +#include "OmniPvdFileWriteStreamImpl.h" +#include "OmniPvdMemoryStreamImpl.h" + +OMNI_PVD_EXPORT OmniPvdReader* OMNI_PVD_CALL createOmniPvdReader() +{ + return new OmniPvdReaderImpl(); +} + +OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdReader(OmniPvdReader& reader) +{ + OmniPvdReaderImpl* impl = (OmniPvdReaderImpl*)(&reader); + delete impl; +} + +OMNI_PVD_EXPORT OmniPvdWriter* OMNI_PVD_CALL createOmniPvdWriter() +{ + return new OmniPvdWriterImpl(); +} + +OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdWriter(OmniPvdWriter& writer) +{ + OmniPvdWriterImpl* impl = (OmniPvdWriterImpl*)(&writer); + delete impl; +} + +OMNI_PVD_EXPORT OmniPvdFileReadStream* OMNI_PVD_CALL createOmniPvdFileReadStream() +{ + return new OmniPvdFileReadStreamImpl(); +} + +OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdFileReadStream(OmniPvdFileReadStream& readStream) +{ + OmniPvdFileReadStreamImpl* impl = (OmniPvdFileReadStreamImpl*)(&readStream); + delete impl; +} + +OMNI_PVD_EXPORT OmniPvdFileWriteStream* OMNI_PVD_CALL createOmniPvdFileWriteStream() +{ + return new OmniPvdFileWriteStreamImpl(); +} + +OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdFileWriteStream(OmniPvdFileWriteStream& writeStream) +{ + OmniPvdFileWriteStreamImpl* impl = (OmniPvdFileWriteStreamImpl*)(&writeStream); + delete impl; +} + +OMNI_PVD_EXPORT OmniPvdMemoryStream* OMNI_PVD_CALL createOmniPvdMemoryStream() +{ + return new OmniPvdMemoryStreamImpl(); +} + +OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdMemoryStream(OmniPvdMemoryStream& memoryStream) +{ + OmniPvdMemoryStreamImpl* impl = (OmniPvdMemoryStreamImpl*)(&memoryStream); + delete impl; +} diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdLog.cpp b/engine/third_party/physx/pvdruntime/src/OmniPvdLog.cpp new file mode 100644 index 00000000..e77d46b7 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdLog.cpp @@ -0,0 +1,57 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#include "OmniPvdLog.h" + +#include +#include + +OmniPvdLog::OmniPvdLog() +{ + mLogFunction = 0; +} + +OmniPvdLog::~OmniPvdLog() +{ +} + +void OmniPvdLog::setLogFunction(OmniPvdLogFunction logFunction) +{ + mLogFunction = logFunction; +} + +void OmniPvdLog::outputLine(const char* fmt, ...) +{ + if (!mLogFunction) return; + char logLineBuff[2048]; + va_list args; + va_start(args, fmt); + vsprintf(logLineBuff, fmt, args); + va_end(args); + mLogFunction(logLineBuff); +} diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdLog.h b/engine/third_party/physx/pvdruntime/src/OmniPvdLog.h new file mode 100644 index 00000000..466b7ae4 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdLog.h @@ -0,0 +1,43 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_LOG_H +#define OMNI_PVD_LOG_H + +#include "OmniPvdDefines.h" + +class OmniPvdLog { +public: + OmniPvdLog(); + ~OmniPvdLog(); + void setLogFunction(OmniPvdLogFunction logFunction); + void outputLine(const char* fmt, ...); + OmniPvdLogFunction mLogFunction; +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.cpp b/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.cpp new file mode 100644 index 00000000..a310e3eb --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.cpp @@ -0,0 +1,58 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#include "OmniPvdMemoryStreamImpl.h" +#include "OmniPvdMemoryReadStreamImpl.h" + +OmniPvdMemoryReadStreamImpl::OmniPvdMemoryReadStreamImpl() +{ +} + +OmniPvdMemoryReadStreamImpl::~OmniPvdMemoryReadStreamImpl() +{ +} + +uint64_t OMNI_PVD_CALL OmniPvdMemoryReadStreamImpl::readBytes(uint8_t* destination, uint64_t nbrBytes) +{ + return mMemoryStream->readBytes(destination, nbrBytes); +} + +uint64_t OMNI_PVD_CALL OmniPvdMemoryReadStreamImpl::skipBytes(uint64_t nbrBytes) +{ + return mMemoryStream->skipBytes(nbrBytes); +} + +bool OMNI_PVD_CALL OmniPvdMemoryReadStreamImpl::openStream() +{ + return true; +} + +bool OMNI_PVD_CALL OmniPvdMemoryReadStreamImpl::closeStream() +{ + return true; +} diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.h b/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.h new file mode 100644 index 00000000..4d0f1c74 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.h @@ -0,0 +1,50 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_MEMORY_READ_STREAM_IMPL_H +#define OMNI_PVD_MEMORY_READ_STREAM_IMPL_H + +#include "OmniPvdReadStream.h" + +class OmniPvdMemoryStreamImpl; + +class OmniPvdMemoryReadStreamImpl : public OmniPvdReadStream +{ +public: + OmniPvdMemoryReadStreamImpl(); + ~OmniPvdMemoryReadStreamImpl(); + + uint64_t OMNI_PVD_CALL readBytes(uint8_t* destination, uint64_t nbrBytes); + uint64_t OMNI_PVD_CALL skipBytes(uint64_t nbrBytes); + bool OMNI_PVD_CALL openStream(); + bool OMNI_PVD_CALL closeStream(); + + OmniPvdMemoryStreamImpl* mMemoryStream; +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.cpp b/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.cpp new file mode 100644 index 00000000..f6aea905 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.cpp @@ -0,0 +1,202 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#include "OmniPvdMemoryStreamImpl.h" +#include "OmniPvdMemoryReadStreamImpl.h" +#include "OmniPvdMemoryWriteStreamImpl.h" +#include + +OmniPvdMemoryStreamImpl::OmniPvdMemoryStreamImpl() +{ + mReadStream = 0; + mWriteStream = 0; + + mBuffer = 0; + mBufferLength = 0; + mWrittenBytes = 0; + mWritePosition = 0; + mReadPosition = 0; + + mReadStream = new OmniPvdMemoryReadStreamImpl(); + mReadStream->mMemoryStream = this; + + mWriteStream = new OmniPvdMemoryWriteStreamImpl(); + mWriteStream->mMemoryStream = this; +} + +OmniPvdMemoryStreamImpl::~OmniPvdMemoryStreamImpl() +{ + delete[] mBuffer; + delete mReadStream; + delete mWriteStream; +} + +OmniPvdReadStream* OMNI_PVD_CALL OmniPvdMemoryStreamImpl::getReadStream() +{ + return mReadStream; +} + +OmniPvdWriteStream* OMNI_PVD_CALL OmniPvdMemoryStreamImpl::getWriteStream() +{ + return mWriteStream; +} + +uint64_t OMNI_PVD_CALL OmniPvdMemoryStreamImpl::setBufferSize(uint64_t bufferLength) +{ + if (bufferLength < mBufferLength) + { + return mBufferLength; + } + delete[] mBuffer; + mBuffer = new uint8_t[bufferLength]; + mBufferLength = bufferLength; + mWrittenBytes = 0; + mWritePosition = 0; + mReadPosition = 0; + return bufferLength; +} + +uint64_t OMNI_PVD_CALL OmniPvdMemoryStreamImpl::readBytes(uint8_t* destination, uint64_t nbrBytes) +{ + if (mWrittenBytes < 1) return 0; + + //////////////////////////////////////////////////////////////////////////////// + // Limit the number of bytes requested to requestedReadBytes + //////////////////////////////////////////////////////////////////////////////// + uint64_t requestedReadBytes = nbrBytes; + if (requestedReadBytes > mBufferLength) + { + requestedReadBytes = mBufferLength; + } + if (requestedReadBytes > mWrittenBytes) + { + return 0; + } + + //////////////////////////////////////////////////////////////////////////////// + // Separate the reading of bytes into two operations: + // tail bytes : bytes from mReadPosition until maximum the end of the buffer + // head bytes : bytes from start of the buffer until maximum the mReadPosition-1 + //////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////// + // Tail bytes + //////////////////////////////////////////////////////////////////////////////// + uint64_t tailBytes = mBufferLength - mReadPosition; + if (tailBytes > requestedReadBytes) + { + tailBytes = requestedReadBytes; + } + if (destination) + { + memcpy(destination, mBuffer + mReadPosition, tailBytes); + } + //////////////////////////////////////////////////////////////////////////////// + // Head bytes + //////////////////////////////////////////////////////////////////////////////// + uint64_t headBytes = requestedReadBytes - tailBytes; + if (destination) + { + memcpy(destination + tailBytes, mBuffer, headBytes); + } + //////////////////////////////////////////////////////////////////////////////// + // Update the internal parameters : mReadPosition and mWrittenBytes + //////////////////////////////////////////////////////////////////////////////// + mReadPosition += requestedReadBytes; + if (mReadPosition >= mBufferLength) + { + mReadPosition -= mBufferLength; + } + mWrittenBytes -= requestedReadBytes; + return requestedReadBytes; +} + +uint64_t OmniPvdMemoryStreamImpl::skipBytes(uint64_t nbrBytes) +{ + return readBytes(0, nbrBytes); +} + +uint64_t OmniPvdMemoryStreamImpl::writeBytes(const uint8_t* source, uint64_t nbrBytes) +{ + if (mWrittenBytes >= mBufferLength) + { + return 0; + } + + //////////////////////////////////////////////////////////////////////////////// + // Limit the number of bytes requested to requestedWriteBytes + //////////////////////////////////////////////////////////////////////////////// + uint64_t requestedWriteBytes = nbrBytes; + if (requestedWriteBytes > mBufferLength) + { + requestedWriteBytes = mBufferLength; + } + uint64_t writeBytesLeft = mBufferLength - mWrittenBytes; + if (requestedWriteBytes > writeBytesLeft) + { + return 0; + //requestedWriteBytes = writeBytesLeft; + } + + //////////////////////////////////////////////////////////////////////////////// + // Tail bytes + //////////////////////////////////////////////////////////////////////////////// + uint64_t tailBytes = mBufferLength - mWritePosition; + if (tailBytes > requestedWriteBytes) + { + tailBytes = requestedWriteBytes; + } + if (source) + { + memcpy(mBuffer + mWritePosition, source, tailBytes); + } + //////////////////////////////////////////////////////////////////////////////// + // Head bytes + //////////////////////////////////////////////////////////////////////////////// + uint64_t headBytes = requestedWriteBytes - tailBytes; + if (source) + { + memcpy(mBuffer, source + tailBytes, headBytes); + } + //////////////////////////////////////////////////////////////////////////////// + // Update the internal parameters : mReadPosition and mWrittenBytes + //////////////////////////////////////////////////////////////////////////////// + mWritePosition += requestedWriteBytes; + if (mWritePosition >= mBufferLength) + { + mWritePosition -= mBufferLength; + } + mWrittenBytes += requestedWriteBytes; + return requestedWriteBytes; +} + +bool OmniPvdMemoryStreamImpl::flush() +{ + return true; +} + diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.h b/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.h new file mode 100644 index 00000000..6e05e747 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.h @@ -0,0 +1,75 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_MEMORY_STREAM_IMPL_H +#define OMNI_PVD_MEMORY_STREAM_IMPL_H + +#include "OmniPvdMemoryStream.h" + +class OmniPvdMemoryReadStreamImpl; +class OmniPvdMemoryWriteStreamImpl; + +class OmniPvdMemoryStreamImpl : public OmniPvdMemoryStream +{ +public: + OmniPvdMemoryStreamImpl(); + ~OmniPvdMemoryStreamImpl(); + + OmniPvdReadStream* OMNI_PVD_CALL getReadStream(); + OmniPvdWriteStream* OMNI_PVD_CALL getWriteStream(); + uint64_t OMNI_PVD_CALL setBufferSize(uint64_t bufferLength); + + //////////////////////////////////////////////////////////////////////////////// + // Read part + //////////////////////////////////////////////////////////////////////////////// + uint64_t readBytes(uint8_t* destination, uint64_t nbrBytes); + uint64_t skipBytes(uint64_t nbrBytes); + + //////////////////////////////////////////////////////////////////////////////// + // Write part + //////////////////////////////////////////////////////////////////////////////// + uint64_t writeBytes(const uint8_t* source, uint64_t nbrBytes); + bool flush(); + + //////////////////////////////////////////////////////////////////////////////// + // Read/write streams + //////////////////////////////////////////////////////////////////////////////// + OmniPvdMemoryReadStreamImpl *mReadStream; + OmniPvdMemoryWriteStreamImpl *mWriteStream; + + //////////////////////////////////////////////////////////////////////////////// + // Round robin buffer + //////////////////////////////////////////////////////////////////////////////// + uint8_t *mBuffer; + uint64_t mBufferLength; + uint64_t mWrittenBytes; + uint64_t mWritePosition; + uint64_t mReadPosition; +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.cpp b/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.cpp new file mode 100644 index 00000000..562c75ee --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.cpp @@ -0,0 +1,58 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#include "OmniPvdMemoryStreamImpl.h" +#include "OmniPvdMemoryWriteStreamImpl.h" + +OmniPvdMemoryWriteStreamImpl::OmniPvdMemoryWriteStreamImpl() +{ +} + +OmniPvdMemoryWriteStreamImpl::~OmniPvdMemoryWriteStreamImpl() +{ +} + +uint64_t OMNI_PVD_CALL OmniPvdMemoryWriteStreamImpl::writeBytes(const uint8_t* source, uint64_t nbrBytes) +{ + return mMemoryStream->writeBytes(source, nbrBytes); +} + +bool OMNI_PVD_CALL OmniPvdMemoryWriteStreamImpl::flush() +{ + return mMemoryStream->flush(); +} + +bool OMNI_PVD_CALL OmniPvdMemoryWriteStreamImpl::openStream() +{ + return true; +} + +bool OMNI_PVD_CALL OmniPvdMemoryWriteStreamImpl::closeStream() +{ + return true; +} diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.h b/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.h new file mode 100644 index 00000000..3e486098 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.h @@ -0,0 +1,49 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_MEMORY_WRITE_STREAM_IMPL_H +#define OMNI_PVD_MEMORY_WRITE_STREAM_IMPL_H + +#include "OmniPvdWriteStream.h" + +class OmniPvdMemoryStreamImpl; + +class OmniPvdMemoryWriteStreamImpl : public OmniPvdWriteStream +{ +public: + OmniPvdMemoryWriteStreamImpl(); + ~OmniPvdMemoryWriteStreamImpl(); + uint64_t OMNI_PVD_CALL writeBytes(const uint8_t* source, uint64_t nbrBytes); + bool OMNI_PVD_CALL flush(); + bool OMNI_PVD_CALL openStream(); + bool OMNI_PVD_CALL closeStream(); + + OmniPvdMemoryStreamImpl *mMemoryStream; +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdReaderImpl.cpp b/engine/third_party/physx/pvdruntime/src/OmniPvdReaderImpl.cpp new file mode 100644 index 00000000..6ef0f9d4 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdReaderImpl.cpp @@ -0,0 +1,572 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +#include "OmniPvdDefinesInternal.h" +#include "OmniPvdReaderImpl.h" + +#include + + +OmniPvdReaderImpl::OmniPvdReaderImpl() +{ + mMajorVersion = OMNI_PVD_VERSION_MAJOR; + mMinorVersion = OMNI_PVD_VERSION_MINOR; + mPatch = OMNI_PVD_VERSION_PATCH; + mDataBuffer = 0; + mDataBuffAllocatedLen = 0; + mCmdAttributeDataPtr = 0; + mIsReadingStarted = false; + mReadBaseClassHandle = 1; +} + +OmniPvdReaderImpl::~OmniPvdReaderImpl() +{ + mCmdAttributeDataPtr = 0; + delete[] mDataBuffer; + mDataBuffer = 0; + mDataBuffAllocatedLen = 0; +} + +void OMNI_PVD_CALL OmniPvdReaderImpl::setLogFunction(OmniPvdLogFunction logFunction) +{ + mLog.setLogFunction(logFunction); +} + +void OMNI_PVD_CALL OmniPvdReaderImpl::setReadStream(OmniPvdReadStream& stream) +{ + mStream = &stream; + mStream->openStream(); +} + +bool OMNI_PVD_CALL OmniPvdReaderImpl::startReading(OmniPvdVersionType& majorVersion, OmniPvdVersionType& minorVersion, OmniPvdVersionType& patch) +{ + if (mIsReadingStarted) + { + return true; + } + if (mStream) + { + mStream->readBytes((uint8_t*)&majorVersion, sizeof(OmniPvdVersionType)); + mStream->readBytes((uint8_t*)&minorVersion, sizeof(OmniPvdVersionType)); + mStream->readBytes((uint8_t*)&patch, sizeof(OmniPvdVersionType)); + + mCmdMajorVersion = majorVersion; + mCmdMinorVersion = minorVersion; + mCmdPatch = patch; + + if ((mCmdMajorVersion == 0) && (mCmdMinorVersion < 3)) + { + mCmdBaseClassHandle = 0; + mReadBaseClassHandle = 0; + } + else + { + mCmdBaseClassHandle = 0; + mReadBaseClassHandle = 1; + } + + mLog.outputLine("OmniPvdRuntimeReaderImpl::startReading majorVersion(%lu), minorVersion(%lu), patch(%lu)", static_cast(majorVersion), static_cast(minorVersion), static_cast(patch)); + if (majorVersion > mMajorVersion) + { + mLog.outputLine("[parser] major version too new\n"); + return false; + } + else if (majorVersion == mMajorVersion) + { + if (minorVersion > mMinorVersion) + { + mLog.outputLine("[parser] minor version too new\n"); + return false; + } + else if (minorVersion == mMinorVersion) + { + if (patch > mPatch) + { + mLog.outputLine("[parser] patch too new\n"); + return false; + } + } + } + mIsReadingStarted = true; + return true; + } + else { + return false; + } + +} + +static OmniPvdDataType::Enum readDataType(OmniPvdReadStream& stream) +{ + OmniPvdDataTypeStorageType dataType; + stream.readBytes((uint8_t*)&dataType, sizeof(OmniPvdDataTypeStorageType)); + return static_cast(dataType); +} + +bool OmniPvdReaderImpl::readStringFromStream(char* string, uint16_t& stringLength) +{ + mStream->readBytes((uint8_t*)&stringLength, sizeof(uint16_t)); + + if (stringLength < OMNI_PVD_MAX_STRING_LENGTH) + { + mStream->readBytes((uint8_t*)string, stringLength); + string[stringLength] = 0; // trailing zero + + return true; + } + else + { + uint16_t readBytes = OMNI_PVD_MAX_STRING_LENGTH - 1; + + mStream->readBytes((uint8_t*)string, readBytes); + string[readBytes] = 0; // trailing zero + mStream->skipBytes(stringLength - readBytes); + + mLog.outputLine("[parser] ERROR: string name %s... exceeds max length of %d\n", string, OMNI_PVD_MAX_STRING_LENGTH); + return false; + } +} + +OmniPvdCommand::Enum OMNI_PVD_CALL OmniPvdReaderImpl::getNextCommand() +{ + OmniPvdCommand::Enum cmdType = OmniPvdCommand::eINVALID; + resetCommandParams(); + if (!mIsReadingStarted) + { + if (!startReading(mCmdMajorVersion, mCmdMinorVersion, mCmdPatch)) + { + return cmdType; + } + } + if (mStream) { + OmniPvdCommandStorageType command; + if (mStream->readBytes(&command, sizeof(OmniPvdCommandStorageType))) + { + mCmdMessageParsed = false; + + switch (command) { + case OmniPvdCommand::eREGISTER_CLASS: + { + cmdType = OmniPvdCommand::eREGISTER_CLASS; + mStream->readBytes((uint8_t*)&mCmdClassHandle, sizeof(OmniPvdClassHandle)); + //////////////////////////////////////////////////////////////////////////////// + // Skip reading the base class if the stream is older or equal to (0,2,x) + //////////////////////////////////////////////////////////////////////////////// + if (mReadBaseClassHandle) + { + mStream->readBytes((uint8_t*)&mCmdBaseClassHandle, sizeof(OmniPvdClassHandle)); + } + + readStringFromStream(mCmdClassName, mCmdClassNameLen); + mLog.outputLine("[parser] register class (handle: %d, name: %s)\n", mCmdClassHandle, mCmdClassName); + } + break; + case OmniPvdCommand::eREGISTER_ATTRIBUTE: + { + cmdType = OmniPvdCommand::eREGISTER_ATTRIBUTE; + mStream->readBytes((uint8_t*)&mCmdClassHandle, sizeof(OmniPvdClassHandle)); + mStream->readBytes((uint8_t*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle)); + mCmdAttributeDataType = readDataType(*mStream); + if (mCmdAttributeDataType == OmniPvdDataType::eENUM_VALUE) + { + mStream->readBytes((uint8_t*)&mCmdEnumValue, sizeof(OmniPvdEnumValueType)); + } + else if (mCmdAttributeDataType == OmniPvdDataType::eFLAGS_WORD) + { + mStream->readBytes((uint8_t*)&mCmdEnumClassHandle, sizeof(OmniPvdClassHandle)); + } + else + { + mCmdEnumValue = 0; + mStream->readBytes((uint8_t*)&mCmdAttributeNbElements, sizeof(uint32_t)); + } + + readStringFromStream(mCmdAttributeName, mCmdAttributeNameLen); + mLog.outputLine("[parser] register attribute (classHandle: %d, attributeHandle: %d, attributeDataType: %d, nrFields: %d, name: %s)\n", mCmdClassHandle, mCmdAttributeHandle, mCmdAttributeDataType, mCmdAttributeNbElements, mCmdAttributeName); + } + break; + case OmniPvdCommand::eREGISTER_CLASS_ATTRIBUTE: + { + cmdType = OmniPvdCommand::eREGISTER_CLASS_ATTRIBUTE; + mStream->readBytes((uint8_t*)&mCmdClassHandle, sizeof(OmniPvdClassHandle)); + mStream->readBytes((uint8_t*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle)); + mStream->readBytes((uint8_t*)&mCmdAttributeClassHandle, sizeof(OmniPvdClassHandle)); + + readStringFromStream(mCmdAttributeName, mCmdAttributeNameLen); + mLog.outputLine("[parser] register class attribute (classHandle: %d, attributeHandle: %d, attribute classAttributeHandle: %d, name: %s)\n", mCmdClassHandle, mCmdAttributeHandle, mCmdAttributeClassHandle, mCmdAttributeName); + } + break; + case OmniPvdCommand::eREGISTER_UNIQUE_LIST_ATTRIBUTE: + { + cmdType = OmniPvdCommand::eREGISTER_UNIQUE_LIST_ATTRIBUTE; + mStream->readBytes((uint8_t*)&mCmdClassHandle, sizeof(OmniPvdClassHandle)); + mStream->readBytes((uint8_t*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle)); + mCmdAttributeDataType = readDataType(*mStream); + + readStringFromStream(mCmdAttributeName, mCmdAttributeNameLen); + mLog.outputLine("[parser] register attributeSet (classHandle: %d, attributeHandle: %d, attributeDataType: %d, name: %s)\n", mCmdClassHandle, mCmdAttributeHandle, mCmdAttributeDataType, mCmdAttributeName); + } + break; + case OmniPvdCommand::eSET_ATTRIBUTE: + { + cmdType = OmniPvdCommand::eSET_ATTRIBUTE; + mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + mStream->readBytes((uint8_t*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle)); + mStream->readBytes((uint8_t*)&mCmdAttributeHandleDepth, sizeof(uint8_t)); + uint32_t* attributeHandleStack = mCmdAttributeHandleStack; + for (int i = 0; i < mCmdAttributeHandleDepth; i++) { + mStream->readBytes((uint8_t*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle)); + attributeHandleStack++; + } + mStream->readBytes((uint8_t*)&mCmdAttributeDataLen, sizeof(uint32_t)); + readLongDataFromStream(mCmdAttributeDataLen); + mLog.outputLine("[parser] set attribute (contextHandle:%d, objectHandle: %d, attributeHandle: %d, dataLen: %d)\n", mCmdContextHandle, mCmdObjectHandle, mCmdAttributeHandle, mCmdAttributeDataLen); + } + break; + case OmniPvdCommand::eADD_TO_UNIQUE_LIST_ATTRIBUTE: + { + cmdType = OmniPvdCommand::eADD_TO_UNIQUE_LIST_ATTRIBUTE; + mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + mStream->readBytes((uint8_t*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle)); + mStream->readBytes((uint8_t*)&mCmdAttributeHandleDepth, sizeof(uint8_t)); + uint32_t* attributeHandleStack = mCmdAttributeHandleStack; + for (int i = 0; i < mCmdAttributeHandleDepth; i++) { + mStream->readBytes((uint8_t*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle)); + attributeHandleStack++; + } + mStream->readBytes((uint8_t*)&mCmdAttributeDataLen, sizeof(uint32_t)); + readLongDataFromStream(mCmdAttributeDataLen); + mLog.outputLine("[parser] add to attributeSet (contextHandle:%d, objectHandle: %d, attributeHandle: %d, dataLen: %d)\n", mCmdContextHandle, mCmdObjectHandle, mCmdAttributeHandle, mCmdAttributeDataLen); + } + break; + case OmniPvdCommand::eREMOVE_FROM_UNIQUE_LIST_ATTRIBUTE: + { + cmdType = OmniPvdCommand::eREMOVE_FROM_UNIQUE_LIST_ATTRIBUTE; + mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + mStream->readBytes((uint8_t*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle)); + mStream->readBytes((uint8_t*)&mCmdAttributeHandleDepth, sizeof(uint8_t)); + uint32_t* attributeHandleStack = mCmdAttributeHandleStack; + for (int i = 0; i < mCmdAttributeHandleDepth; i++) { + mStream->readBytes((uint8_t*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle)); + attributeHandleStack++; + } + mStream->readBytes((uint8_t*)&mCmdAttributeDataLen, sizeof(uint32_t)); + readLongDataFromStream(mCmdAttributeDataLen); + mLog.outputLine("[parser] remove from attributeSet (contextHandle:%d, objectHandle: %d, attributeHandle: %d, dataLen: %d)\n", mCmdContextHandle, mCmdObjectHandle, mCmdAttributeHandle, mCmdAttributeDataLen); + } + break; + case OmniPvdCommand::eCREATE_OBJECT: + { + cmdType = OmniPvdCommand::eCREATE_OBJECT; + mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + mStream->readBytes((uint8_t*)&mCmdClassHandle, sizeof(OmniPvdClassHandle)); + mStream->readBytes((uint8_t*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle)); + + readStringFromStream(mCmdObjectName, mCmdObjectNameLen); + mLog.outputLine("[parser] create object (contextHandle: %d, classHandle: %d, objectHandle: %d, name: %s)\n", mCmdContextHandle, mCmdClassHandle, mCmdObjectHandle, mCmdObjectName); + } + break; + case OmniPvdCommand::eDESTROY_OBJECT: + { + cmdType = OmniPvdCommand::eDESTROY_OBJECT; + mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + mStream->readBytes((uint8_t*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle)); + mLog.outputLine("[parser] destroy object (contextHandle: %d, objectHandle: %d)\n", mCmdContextHandle, mCmdObjectHandle); + } + break; + case OmniPvdCommand::eSTART_FRAME: + { + cmdType = OmniPvdCommand::eSTART_FRAME; + mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + mStream->readBytes((uint8_t*)&mCmdFrameTimeStart, sizeof(uint64_t)); + mLog.outputLine("[parser] start frame (contextHandle: %d, timeStamp: %d)\n", mCmdContextHandle, mCmdFrameTimeStart); + } + break; + case OmniPvdCommand::eSTOP_FRAME: + { + cmdType = OmniPvdCommand::eSTOP_FRAME; + mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + mStream->readBytes((uint8_t*)&mCmdFrameTimeStop, sizeof(uint64_t)); + mLog.outputLine("[parser] stop frame (contextHandle: %d, timeStamp: %d)\n", mCmdContextHandle, mCmdFrameTimeStop); + } + break; + case OmniPvdCommand::eRECORD_MESSAGE: + { + cmdType = OmniPvdCommand::eRECORD_MESSAGE; + mStream->readBytes((uint8_t*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + + // Message. + readStringFromStream(mCmdMessage, mCmdMessageLength); + + // File name. + readStringFromStream(mCmdMessageFile, mCmdMessageFileLength); + + mStream->readBytes((uint8_t*)&mCmdMessageLine, sizeof(uint32_t)); + mStream->readBytes((uint8_t*)&mCmdMessageType, sizeof(uint32_t)); + mStream->readBytes((uint8_t*)&mCmdMessageClassHandle, sizeof(OmniPvdClassHandle)); + + mCmdMessageParsed = true; + + mLog.outputLine("[parser] message (contextHandle: %d, message: %s, file: %s, line: %d, type: %d)\n", + mCmdContextHandle, + mCmdMessage, mCmdMessageFile, mCmdMessageLine, mCmdMessageType + ); + } + break; + default: + { + } + break; + } + return cmdType; + } else { + return cmdType; + } + } + else { + return cmdType; + } +} + +uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getMajorVersion() +{ + return mCmdMajorVersion; +} + +uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getMinorVersion() +{ + return mCmdMinorVersion; +} + +uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getPatch() +{ + return mCmdPatch; +} + +uint64_t OMNI_PVD_CALL OmniPvdReaderImpl::getContextHandle() +{ + return mCmdContextHandle; +} + +OmniPvdClassHandle OMNI_PVD_CALL OmniPvdReaderImpl::getClassHandle() +{ + return mCmdClassHandle; +} + +OmniPvdClassHandle OMNI_PVD_CALL OmniPvdReaderImpl::getBaseClassHandle() +{ + return mCmdBaseClassHandle; +} + +uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeHandle() +{ + return mCmdAttributeHandle; +} + +uint64_t OMNI_PVD_CALL OmniPvdReaderImpl::getObjectHandle() +{ + return mCmdObjectHandle; +} + +const char* OMNI_PVD_CALL OmniPvdReaderImpl::getClassName() +{ + return mCmdClassName; +} + +const char* OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeName() +{ + return mCmdAttributeName; +} + +const char* OMNI_PVD_CALL OmniPvdReaderImpl::getObjectName() +{ + return mCmdObjectName; +} + +const uint8_t* OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeDataPointer() +{ + return mCmdAttributeDataPtr; +} + +OmniPvdDataType::Enum OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeDataType() +{ + return mCmdAttributeDataType; +} + +uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeDataLength() +{ + return mCmdAttributeDataLen; +} + +uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeNumberElements() +{ + return mCmdAttributeNbElements; +} + +OmniPvdClassHandle OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeClassHandle() +{ + return mCmdAttributeClassHandle; +} + +uint8_t OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeNumberHandles() +{ + return mCmdAttributeHandleDepth; +} + +uint32_t* OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeHandles() +{ + return mCmdAttributeHandleStack; +} + +uint64_t OMNI_PVD_CALL OmniPvdReaderImpl::getFrameTimeStart() +{ + return mCmdFrameTimeStart; +} + +uint64_t OMNI_PVD_CALL OmniPvdReaderImpl::getFrameTimeStop() +{ + return mCmdFrameTimeStop; +} + +bool OMNI_PVD_CALL OmniPvdReaderImpl::getMessageData(const char*& message, const char*& file, uint32_t& line, uint32_t& type, OmniPvdClassHandle& handle) +{ + message = mCmdMessage; + file = mCmdMessageFile; + line = mCmdMessageLine; + type = mCmdMessageType; + handle = mCmdMessageClassHandle; + + return mCmdMessageParsed; +} + +OmniPvdClassHandle OMNI_PVD_CALL OmniPvdReaderImpl::getEnumClassHandle() +{ + return mCmdEnumClassHandle; +} + +uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getEnumValue() +{ + return mCmdEnumValue; +} + +void OmniPvdReaderImpl::readLongDataFromStream(uint32_t streamByteLen) +{ + if (streamByteLen < 1) return; + if (streamByteLen > mDataBuffAllocatedLen) { + delete[] mDataBuffer; + mDataBuffAllocatedLen = (uint32_t)(streamByteLen * 1.3f); + mDataBuffer = new uint8_t[mDataBuffAllocatedLen]; + } + mCmdAttributeDataPtr = mDataBuffer; + mStream->readBytes(mCmdAttributeDataPtr, streamByteLen); +} + +//////////////////////////////////////////////////////////////////////////////// +// Resets all command parameters before a new read command is executed, +// except for those parameters that are "stateful" which are left commented out. +//////////////////////////////////////////////////////////////////////////////// +void OmniPvdReaderImpl::resetCommandParams() +{ + //////////////////////////////////////////////////////////////////////////////// + // Stateful: Depends on the version of the stream reader + //////////////////////////////////////////////////////////////////////////////// + // OmniPvdVersionType mMajorVersion; + // OmniPvdVersionType mMinorVersion; + // OmniPvdVersionType mPatch; + //////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////// + // Stateful: Depends on the stream being read and stay the same + //////////////////////////////////////////////////////////////////////////////// + // OmniPvdVersionType mCmdMajorVersion; + // OmniPvdVersionType mCmdMinorVersion; + // OmniPvdVersionType mCmdPatch; + //////////////////////////////////////////////////////////////////////////////// + + mCmdContextHandle = OMNI_PVD_INVALID_HANDLE; + mCmdObjectHandle = OMNI_PVD_INVALID_HANDLE; + + mCmdClassHandle = OMNI_PVD_INVALID_HANDLE; + mCmdBaseClassHandle = OMNI_PVD_INVALID_HANDLE; + mCmdAttributeHandle = OMNI_PVD_INVALID_HANDLE; + + mCmdClassName[0] = 0; + mCmdAttributeName[0] = 0; + mCmdObjectName[0] = 0; + + mCmdClassNameLen = 0; + mCmdAttributeNameLen = 0; + mCmdObjectNameLen = 0; + + mCmdAttributeDataPtr = 0; + + //////////////////////////////////////////////////////////////////////////////// + // Unsure how to handle this, a zero value could still be valid + //////////////////////////////////////////////////////////////////////////////// + //mCmdAttributeDataType = OmniPvdDataType::eINT8; // int 8 is 0 + //////////////////////////////////////////////////////////////////////////////// + + mCmdAttributeDataLen = 0; + mCmdAttributeNbElements = 0; + mCmdEnumValue = 0; + mCmdEnumClassHandle = OMNI_PVD_INVALID_HANDLE; + mCmdAttributeClassHandle = OMNI_PVD_INVALID_HANDLE; + + //////////////////////////////////////////////////////////////////////////////// + // Left untouched/dirty : instead depends on the depth parameter below + //////////////////////////////////////////////////////////////////////////////// + // OmniPvdAttributeHandle mCmdAttributeHandleStack[32]; + //////////////////////////////////////////////////////////////////////////////// + mCmdAttributeHandleDepth = 0; + + //////////////////////////////////////////////////////////////////////////////// + // Stateful for the duration of a frame + //////////////////////////////////////////////////////////////////////////////// + // uint64_t mCmdFrameTimeStart; + // uint64_t mCmdFrameTimeStop; + //////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////// + // Internal scratch buffer, instead the mCmdAttributeDataPtr is set to 0 + //////////////////////////////////////////////////////////////////////////////// + // uint8_t *mDataBuffer; + // uint32_t mDataBuffAllocatedLen; + //////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////// + // Internal message buffer + //////////////////////////////////////////////////////////////////////////////// + mCmdMessageParsed = false; + mCmdMessageLength = 0; + mCmdMessage[0] = 0; + mCmdMessageFileLength = 0; + mCmdMessageFile[0] = 0; + mCmdMessageLine = 0; + mCmdMessageType = 0; + mCmdMessageClassHandle = 0; +} \ No newline at end of file diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdReaderImpl.h b/engine/third_party/physx/pvdruntime/src/OmniPvdReaderImpl.h new file mode 100644 index 00000000..7b98b460 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdReaderImpl.h @@ -0,0 +1,141 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_RUNTIME_READER_IMPL_H +#define OMNI_PVD_RUNTIME_READER_IMPL_H + +#include "OmniPvdReader.h" +#include "OmniPvdLog.h" + + +class OmniPvdReaderImpl : public OmniPvdReader { +public: + OmniPvdReaderImpl(); + ~OmniPvdReaderImpl(); + + void OMNI_PVD_CALL setLogFunction(OmniPvdLogFunction logFunction); + void OMNI_PVD_CALL setReadStream(OmniPvdReadStream& stream); + bool OMNI_PVD_CALL startReading(OmniPvdVersionType& majorVersion, OmniPvdVersionType& minorVersion, OmniPvdVersionType& patch); + OmniPvdCommand::Enum OMNI_PVD_CALL getNextCommand(); + + OmniPvdVersionType OMNI_PVD_CALL getMajorVersion(); + OmniPvdVersionType OMNI_PVD_CALL getMinorVersion(); + OmniPvdVersionType OMNI_PVD_CALL getPatch(); + + OmniPvdContextHandle OMNI_PVD_CALL getContextHandle(); + OmniPvdObjectHandle OMNI_PVD_CALL getObjectHandle(); + + OmniPvdClassHandle OMNI_PVD_CALL getClassHandle(); + OmniPvdClassHandle OMNI_PVD_CALL getBaseClassHandle(); + OmniPvdAttributeHandle OMNI_PVD_CALL getAttributeHandle(); + + const char* OMNI_PVD_CALL getClassName(); + const char* OMNI_PVD_CALL getAttributeName(); + const char* OMNI_PVD_CALL getObjectName(); + + const uint8_t* OMNI_PVD_CALL getAttributeDataPointer(); + OmniPvdDataType::Enum OMNI_PVD_CALL getAttributeDataType(); + uint32_t OMNI_PVD_CALL getAttributeDataLength(); + uint32_t OMNI_PVD_CALL getAttributeNumberElements(); + OmniPvdClassHandle OMNI_PVD_CALL getAttributeClassHandle(); + + uint8_t OMNI_PVD_CALL getAttributeNumberHandles(); + OmniPvdAttributeHandle* OMNI_PVD_CALL getAttributeHandles(); + + uint64_t OMNI_PVD_CALL getFrameTimeStart(); + uint64_t OMNI_PVD_CALL getFrameTimeStop(); + + bool OMNI_PVD_CALL getMessageData(const char*& message, const char*& file, uint32_t& line, uint32_t& type, OmniPvdClassHandle& handle) override; + + OmniPvdClassHandle OMNI_PVD_CALL getEnumClassHandle(); + uint32_t OMNI_PVD_CALL getEnumValue(); + + // Internal helper + void readLongDataFromStream(uint32_t streamByteLen); + bool readStringFromStream(char* string, uint16_t& stringLength); + void resetCommandParams(); + + OmniPvdLog mLog; + + OmniPvdReadStream *mStream; + + OmniPvdVersionType mMajorVersion; + OmniPvdVersionType mMinorVersion; + OmniPvdVersionType mPatch; + + OmniPvdVersionType mCmdMajorVersion; + OmniPvdVersionType mCmdMinorVersion; + OmniPvdVersionType mCmdPatch; + + OmniPvdContextHandle mCmdContextHandle; + OmniPvdObjectHandle mCmdObjectHandle; + + uint32_t mCmdClassHandle; + uint32_t mCmdBaseClassHandle; + uint32_t mCmdAttributeHandle; + + char mCmdClassName[OMNI_PVD_MAX_STRING_LENGTH]; + char mCmdAttributeName[OMNI_PVD_MAX_STRING_LENGTH]; + char mCmdObjectName[OMNI_PVD_MAX_STRING_LENGTH]; + + uint16_t mCmdClassNameLen; + uint16_t mCmdAttributeNameLen; + uint16_t mCmdObjectNameLen; + + uint8_t* mCmdAttributeDataPtr; + OmniPvdDataType::Enum mCmdAttributeDataType; + uint32_t mCmdAttributeDataLen; + uint32_t mCmdAttributeNbElements; + OmniPvdEnumValueType mCmdEnumValue; + OmniPvdClassHandle mCmdEnumClassHandle; + OmniPvdClassHandle mCmdAttributeClassHandle; + + OmniPvdAttributeHandle mCmdAttributeHandleStack[32]; + uint8_t mCmdAttributeHandleDepth; + + uint64_t mCmdFrameTimeStart; + uint64_t mCmdFrameTimeStop; + + uint8_t *mDataBuffer; + uint32_t mDataBuffAllocatedLen; + + bool mIsReadingStarted; + uint8_t mReadBaseClassHandle; + + // Messages + bool mCmdMessageParsed; + uint16_t mCmdMessageLength; + char mCmdMessage[OMNI_PVD_MAX_STRING_LENGTH]; + uint16_t mCmdMessageFileLength; + char mCmdMessageFile[OMNI_PVD_MAX_STRING_LENGTH]; + uint32_t mCmdMessageLine; + uint32_t mCmdMessageType; + OmniPvdClassHandle mCmdMessageClassHandle; +}; + +#endif diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdWriterImpl.cpp b/engine/third_party/physx/pvdruntime/src/OmniPvdWriterImpl.cpp new file mode 100644 index 00000000..4ffb6811 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdWriterImpl.cpp @@ -0,0 +1,384 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#include "OmniPvdWriterImpl.h" +#include "OmniPvdDefines.h" +#include + +OmniPvdWriterImpl::OmniPvdWriterImpl() +{ + resetParams(); +} + +OmniPvdWriterImpl::~OmniPvdWriterImpl() +{ +} + +void OmniPvdWriterImpl::resetParams() +{ + mStream = 0; + mLastClassHandle = 0; + mLastAttributeHandle = 0; + mIsFirstWrite = true; + mStatusFlags = 0; // That or set all flag bits off +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::setLogFunction(OmniPvdLogFunction logFunction) +{ + mLog.setLogFunction(logFunction); +} + +void OmniPvdWriterImpl::setVersionHelper() +{ + if (mStream && mIsFirstWrite) + { + const OmniPvdVersionType omniPvdVersionMajor = OMNI_PVD_VERSION_MAJOR; + const OmniPvdVersionType omniPvdVersionMinor = OMNI_PVD_VERSION_MINOR; + const OmniPvdVersionType omniPvdVersionPatch = OMNI_PVD_VERSION_PATCH; + setVersion(omniPvdVersionMajor, omniPvdVersionMinor, omniPvdVersionPatch); + } +} + +void OmniPvdWriterImpl::setVersion(OmniPvdVersionType majorVersion, OmniPvdVersionType minorVersion, OmniPvdVersionType patch) +{ + if (mStream && mIsFirstWrite) + { + if (!mStream->openStream()) + { + return; + } + + writeWithStatus((const uint8_t*)&majorVersion, sizeof(OmniPvdVersionType)); + writeWithStatus((const uint8_t*)&minorVersion, sizeof(OmniPvdVersionType)); + writeWithStatus((const uint8_t*)&patch, sizeof(OmniPvdVersionType)); + + mLog.outputLine("OmniPvdRuntimeWriterImpl::setVersion majorVersion(%lu), minorVersion(%lu), patch(%lu)", static_cast(majorVersion), static_cast(minorVersion), static_cast(patch)); + mIsFirstWrite = false; + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::setWriteStream(OmniPvdWriteStream& stream) +{ + mLog.outputLine("OmniPvdRuntimeWriterImpl::setWriteStream"); + mStream = &stream; +} + +OmniPvdWriteStream* OMNI_PVD_CALL OmniPvdWriterImpl::getWriteStream() +{ + return mStream; +} + +OmniPvdClassHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerClass(const char* className, OmniPvdClassHandle baseClass) +{ + setVersionHelper(); + if (mStream) + { + mLog.outputLine("OmniPvdWriterImpl::registerClass className(%s)", className); + + int classNameLen = (int)strlen(className); + writeCommand(OmniPvdCommand::eREGISTER_CLASS); + mLastClassHandle++; + writeWithStatus((const uint8_t*)&mLastClassHandle, sizeof(OmniPvdClassHandle)); + writeWithStatus((const uint8_t*)&baseClass, sizeof(OmniPvdClassHandle)); + writeWithStatus((const uint8_t*)&classNameLen, sizeof(uint16_t)); + writeWithStatus((const uint8_t*)className, classNameLen); + return mLastClassHandle; + } else { + return OMNI_PVD_INVALID_HANDLE; + } +} + +OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdDataType::Enum attributeDataType, uint32_t nbElements) +{ + setVersionHelper(); + if (mStream) { + + mLog.outputLine("OmniPvdWriterImpl::registerAttribute classHandle(%llu), attributeName(%s), attributeDataType(%d), nbrFields(%llu)", static_cast(classHandle), attributeName, static_cast(attributeDataType), static_cast(nbElements)); + + int attribNameLen = (int)strlen(attributeName); + writeCommand(OmniPvdCommand::eREGISTER_ATTRIBUTE); + mLastAttributeHandle++; + writeWithStatus((const uint8_t*)&classHandle, sizeof(OmniPvdClassHandle)); + writeWithStatus((const uint8_t*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle)); + writeDataType(attributeDataType); + writeWithStatus((const uint8_t*)&nbElements, sizeof(uint32_t)); + writeWithStatus((const uint8_t*)&attribNameLen, sizeof(uint16_t)); + writeWithStatus((const uint8_t*)attributeName, attribNameLen); + return mLastAttributeHandle; + } + else { + return OMNI_PVD_INVALID_HANDLE; + } +} + +OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerFlagsAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdClassHandle enumClassHandle) +{ + setVersionHelper(); + if (mStream) { + + mLog.outputLine("OmniPvdWriterImpl::registerFlagsAttribute classHandle(%llu), enumClassHandle(%llu), attributeName(%s)", static_cast(classHandle), static_cast(enumClassHandle), attributeName); + + int attribNameLen = (int)strlen(attributeName); + writeCommand(OmniPvdCommand::eREGISTER_ATTRIBUTE); + mLastAttributeHandle++; + writeWithStatus((const uint8_t*)&classHandle, sizeof(OmniPvdClassHandle)); + writeWithStatus((const uint8_t*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle)); + writeDataType(OmniPvdDataType::eFLAGS_WORD); + writeWithStatus((const uint8_t*)&enumClassHandle, sizeof(OmniPvdClassHandle)); + writeWithStatus((const uint8_t*)&attribNameLen, sizeof(uint16_t)); + writeWithStatus((const uint8_t*)attributeName, attribNameLen); + return mLastAttributeHandle; + } + else { + return OMNI_PVD_INVALID_HANDLE; + } +} + +OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerEnumValue(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdEnumValueType value) +{ + setVersionHelper(); + if (mStream) { + int attribNameLen = (int)strlen(attributeName); + writeCommand(OmniPvdCommand::eREGISTER_ATTRIBUTE); + mLastAttributeHandle++; + writeWithStatus((const uint8_t*)&classHandle, sizeof(OmniPvdClassHandle)); + writeWithStatus((const uint8_t*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle)); + writeDataType(OmniPvdDataType::eENUM_VALUE); + writeWithStatus((const uint8_t*)&value, sizeof(OmniPvdEnumValueType)); + writeWithStatus((const uint8_t*)&attribNameLen, sizeof(uint16_t)); + writeWithStatus((const uint8_t*)attributeName, attribNameLen); + return mLastAttributeHandle; + } + else { + return OMNI_PVD_INVALID_HANDLE; + } +} + +OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerClassAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdClassHandle classAttributeHandle) +{ + setVersionHelper(); + if (mStream) + { + int attribNameLen = (int)strlen(attributeName); + writeCommand(OmniPvdCommand::eREGISTER_CLASS_ATTRIBUTE); + mLastAttributeHandle++; + writeWithStatus((const uint8_t*)&classHandle, sizeof(OmniPvdClassHandle)); + writeWithStatus((const uint8_t*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle)); + writeWithStatus((const uint8_t*)&classAttributeHandle, sizeof(OmniPvdClassHandle)); + writeWithStatus((const uint8_t*)&attribNameLen, sizeof(uint16_t)); + writeWithStatus((const uint8_t*)attributeName, attribNameLen); + return mLastAttributeHandle; + } + else { + return OMNI_PVD_INVALID_HANDLE; + } +} + +OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerUniqueListAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdDataType::Enum attributeDataType) +{ + setVersionHelper(); + if (mStream) + { + int attribNameLen = (int)strlen(attributeName); + writeCommand(OmniPvdCommand::eREGISTER_UNIQUE_LIST_ATTRIBUTE); + mLastAttributeHandle++; + writeWithStatus((const uint8_t*)&classHandle, sizeof(OmniPvdClassHandle)); + writeWithStatus((const uint8_t*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle)); + writeDataType(attributeDataType); + writeWithStatus((const uint8_t*)&attribNameLen, sizeof(uint16_t)); + writeWithStatus((const uint8_t*)attributeName, attribNameLen); + return mLastAttributeHandle; + } + else + { + return OMNI_PVD_INVALID_HANDLE; + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::setAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes) +{ + setVersionHelper(); + if (mStream) + { + writeCommand(OmniPvdCommand::eSET_ATTRIBUTE); + writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle)); + writeWithStatus((const uint8_t*)&objectHandle, sizeof(OmniPvdObjectHandle)); + writeWithStatus((const uint8_t*)&nbAttributeHandles, sizeof(uint8_t)); + for (int i = 0; i < nbAttributeHandles; i++) + { + writeWithStatus((const uint8_t*)attributeHandles, sizeof(OmniPvdAttributeHandle)); + attributeHandles++; + } + writeWithStatus((const uint8_t*)&nbrBytes, sizeof(uint32_t)); + writeWithStatus((const uint8_t*)data, nbrBytes); + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::addToUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes) +{ + setVersionHelper(); + if (mStream) + { + writeCommand(OmniPvdCommand::eADD_TO_UNIQUE_LIST_ATTRIBUTE); + writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle)); + writeWithStatus((const uint8_t*)&objectHandle, sizeof(OmniPvdObjectHandle)); + writeWithStatus((const uint8_t*)&nbAttributeHandles, sizeof(uint8_t)); + for (int i = 0; i < nbAttributeHandles; i++) + { + writeWithStatus((const uint8_t*)attributeHandles, sizeof(OmniPvdAttributeHandle)); + attributeHandles++; + } + writeWithStatus((const uint8_t*)&nbrBytes, sizeof(uint32_t)); + writeWithStatus((const uint8_t*)data, nbrBytes); + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::removeFromUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes) +{ + setVersionHelper(); + if (mStream) + { + writeCommand(OmniPvdCommand::eREMOVE_FROM_UNIQUE_LIST_ATTRIBUTE); + writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle)); + writeWithStatus((const uint8_t*)&objectHandle, sizeof(OmniPvdObjectHandle)); + writeWithStatus((const uint8_t*)&nbAttributeHandles, sizeof(uint8_t)); + for (int i = 0; i < nbAttributeHandles; i++) + { + writeWithStatus((const uint8_t*)attributeHandles, sizeof(OmniPvdAttributeHandle)); + attributeHandles++; + } + writeWithStatus((const uint8_t*)&nbrBytes, sizeof(uint32_t)); + writeWithStatus((const uint8_t*)data, nbrBytes); + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::createObject(OmniPvdContextHandle contextHandle, OmniPvdClassHandle classHandle, OmniPvdObjectHandle objectHandle, const char* objectName) +{ + setVersionHelper(); + if (mStream) + { + writeCommand(OmniPvdCommand::eCREATE_OBJECT); + writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle)); + writeWithStatus((const uint8_t*)&classHandle, sizeof(OmniPvdClassHandle)); + writeWithStatus((const uint8_t*)&objectHandle, sizeof(OmniPvdObjectHandle)); + int objectNameLen = 0; + if (objectName) + { + objectNameLen = (int)strlen(objectName); + writeWithStatus((const uint8_t*)&objectNameLen, sizeof(uint16_t)); + writeWithStatus((const uint8_t*)objectName, objectNameLen); + } + else + { + writeWithStatus((const uint8_t*)&objectNameLen, sizeof(uint16_t)); + } + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::destroyObject(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle) +{ + setVersionHelper(); + if (mStream) + { + writeCommand(OmniPvdCommand::eDESTROY_OBJECT); + writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle)); + writeWithStatus((const uint8_t*)&objectHandle, sizeof(OmniPvdObjectHandle)); + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::startFrame(OmniPvdContextHandle contextHandle, uint64_t timeStamp) +{ + setVersionHelper(); + if (mStream) + { + writeCommand(OmniPvdCommand::eSTART_FRAME); + writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle)); + writeWithStatus((const uint8_t*)&timeStamp, sizeof(uint64_t)); + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::stopFrame(OmniPvdContextHandle contextHandle, uint64_t timeStamp) +{ + setVersionHelper(); + if (mStream) + { + writeCommand(OmniPvdCommand::eSTOP_FRAME); + writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle)); + writeWithStatus((const uint8_t*)&timeStamp, sizeof(uint64_t)); + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::recordMessage(OmniPvdContextHandle contextHandle, const char* message, const char* file, uint32_t line, uint32_t type, OmniPvdClassHandle handle) +{ + setVersionHelper(); + if (mStream) + { + writeCommand(OmniPvdCommand::eRECORD_MESSAGE); + writeWithStatus((const uint8_t*)&contextHandle, sizeof(OmniPvdContextHandle)); + + int messageLength = 0; + + if (message) + { + messageLength = (int)strlen(message); + writeWithStatus((const uint8_t*)&messageLength, sizeof(uint16_t)); + writeWithStatus((const uint8_t*)message, messageLength); + } + else + { + writeWithStatus((const uint8_t*)&messageLength, sizeof(uint16_t)); + } + + int filenameLength = 0; + + if (file) + { + filenameLength = (int)strlen(file); + writeWithStatus((const uint8_t*)&filenameLength, sizeof(uint16_t)); + writeWithStatus((const uint8_t*)file, filenameLength); + } + else + { + writeWithStatus((const uint8_t*)&filenameLength, sizeof(uint16_t)); + } + + writeWithStatus((const uint8_t*)&line, sizeof(uint32_t)); + writeWithStatus((const uint8_t*)&type, sizeof(uint32_t)); + writeWithStatus((const uint8_t*)&handle, sizeof(OmniPvdClassHandle)); + } +} + +uint32_t OMNI_PVD_CALL OmniPvdWriterImpl::getStatus() +{ + return mStatusFlags; +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::clearStatus() +{ + mStatusFlags = 0; +} \ No newline at end of file diff --git a/engine/third_party/physx/pvdruntime/src/OmniPvdWriterImpl.h b/engine/third_party/physx/pvdruntime/src/OmniPvdWriterImpl.h new file mode 100644 index 00000000..b6f95aa2 --- /dev/null +++ b/engine/third_party/physx/pvdruntime/src/OmniPvdWriterImpl.h @@ -0,0 +1,129 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 OMNI_PVD_WRITER_IMPL_H +#define OMNI_PVD_WRITER_IMPL_H + +#include "OmniPvdWriter.h" +#include "OmniPvdCommands.h" +#include "OmniPvdDefinesInternal.h" +#include "OmniPvdLog.h" + +class OmniPvdWriterImpl : public OmniPvdWriter { +public: + OmniPvdWriterImpl(); + ~OmniPvdWriterImpl(); + void OMNI_PVD_CALL setLogFunction(OmniPvdLogFunction logFunction); + void setVersionHelper(); + void setVersion(OmniPvdVersionType majorVersion, OmniPvdVersionType minorVersion, OmniPvdVersionType patch); + void OMNI_PVD_CALL setWriteStream(OmniPvdWriteStream& stream); + OmniPvdWriteStream* OMNI_PVD_CALL getWriteStream(); + + OmniPvdClassHandle OMNI_PVD_CALL registerClass(const char* className, OmniPvdClassHandle baseClass); + OmniPvdAttributeHandle OMNI_PVD_CALL registerEnumValue(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdEnumValueType value); + OmniPvdAttributeHandle OMNI_PVD_CALL registerAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdDataType::Enum attributeDataType, uint32_t nbElements); + OmniPvdAttributeHandle OMNI_PVD_CALL registerFlagsAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdClassHandle enumClassHandle); + OmniPvdAttributeHandle OMNI_PVD_CALL registerClassAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdClassHandle classAttributeHandle); + OmniPvdAttributeHandle OMNI_PVD_CALL registerUniqueListAttribute(OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdDataType::Enum attributeDataType); + void OMNI_PVD_CALL setAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes); + + void OMNI_PVD_CALL addToUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes); + + void OMNI_PVD_CALL removeFromUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle* attributeHandles, uint8_t nbAttributeHandles, const uint8_t* data, uint32_t nbrBytes); + + void OMNI_PVD_CALL createObject(OmniPvdContextHandle contextHandle, OmniPvdClassHandle classHandle, OmniPvdObjectHandle objectHandle, const char* objectName); + void OMNI_PVD_CALL destroyObject(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle); + void OMNI_PVD_CALL startFrame(OmniPvdContextHandle contextHandle, uint64_t timeStamp); + void OMNI_PVD_CALL stopFrame(OmniPvdContextHandle contextHandle, uint64_t timeStamp); + + void OMNI_PVD_CALL recordMessage(OmniPvdContextHandle contextHandle, const char* message, const char* file, uint32_t line, uint32_t type, OmniPvdClassHandle handle) override; + + uint32_t OMNI_PVD_CALL getStatus(); + void OMNI_PVD_CALL clearStatus(); + + void resetParams(); + + bool isFlagOn(OmniPvdWriterStatusFlag::Enum flagBitMask) + { + return mStatusFlags & uint32_t(flagBitMask); + } + + void setFlagOn(OmniPvdWriterStatusFlag::Enum flagBitMask) + { + mStatusFlags = mStatusFlags | uint32_t(flagBitMask); + } + + void setFlagOff(OmniPvdWriterStatusFlag::Enum flagBitMask) + { + mStatusFlags = mStatusFlags & ~uint32_t(flagBitMask); + } + + void setFlagVal(OmniPvdWriterStatusFlag::Enum flagBitMask, bool value) + { + if (value) + { + setFlagOn(flagBitMask); + } + else + { + setFlagOff(flagBitMask); + } + } + + void writeWithStatus(const uint8_t* writePtr, uint64_t nbrBytesToWrite) + { + if (! (mStream && writePtr && (nbrBytesToWrite > 0)) ) return; + uint64_t nbrBytesWritten = mStream->writeBytes(writePtr, nbrBytesToWrite); + const bool writeFailure = nbrBytesWritten != nbrBytesToWrite; + if (writeFailure) { + setFlagOn(OmniPvdWriterStatusFlag::eSTREAM_WRITE_FAILURE); + } + } + + void writeDataType(OmniPvdDataType::Enum attributeDataType) + { + const OmniPvdDataTypeStorageType dataType = static_cast(attributeDataType); + writeWithStatus((const uint8_t*)&dataType, sizeof(OmniPvdDataTypeStorageType)); + } + + void writeCommand(OmniPvdCommand::Enum command) + { + const OmniPvdCommandStorageType commandTmp = static_cast(command); + writeWithStatus((const uint8_t*)&commandTmp, sizeof(OmniPvdCommandStorageType)); + } + + bool mIsFirstWrite; + OmniPvdLog mLog; + OmniPvdWriteStream* mStream; + int mLastClassHandle; + int mLastAttributeHandle; + + uint32_t mStatusFlags; +}; + +#endif diff --git a/engine/third_party/physx/snippets/compiler/cmake/CMakeLists.txt b/engine/third_party/physx/snippets/compiler/cmake/CMakeLists.txt new file mode 100644 index 00000000..63f7b2f4 --- /dev/null +++ b/engine/third_party/physx/snippets/compiler/cmake/CMakeLists.txt @@ -0,0 +1,123 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +cmake_minimum_required(VERSION 3.16) +project(Snippets C CXX) + +# This is required to be defined by external callers! +IF(NOT DEFINED PHYSX_ROOT_DIR) + MESSAGE(FATAL_ERROR "PHYSX_ROOT_DIR variable wasn't set.") +ENDIF() + +IF(NOT EXISTS ${PHYSX_ROOT_DIR}) + MESSAGE(FATAL_ERROR "PHYSX_ROOT_DIR variable was invalid.") +ENDIF() + +INCLUDE(NvidiaBuildOptions) + + +IF(CMAKE_CONFIGURATION_TYPES) + SET(CMAKE_CONFIGURATION_TYPES debug checked profile release) + SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING + "Reset config to what we need" + FORCE) + + # Need to define these at least once. + SET(CMAKE_SHARED_LINKER_FLAGS_CHECKED "/DEBUG") + SET(CMAKE_SHARED_LINKER_FLAGS_PROFILE "/DEBUG") + + SET(CMAKE_EXE_LINKER_FLAGS_PROFILE "/DEBUG") + SET(CMAKE_EXE_LINKER_FLAGS_CHECKED "/DEBUG") +ENDIF() + + +SET(PROJECT_CMAKE_FILES_DIR compiler/cmake) +SET(PLATFORM_CMAKELISTS ${PHYSX_ROOT_DIR}/snippets/${PROJECT_CMAKE_FILES_DIR}/${TARGET_BUILD_PLATFORM}/CMakeLists.txt) + +IF(NOT EXISTS ${PLATFORM_CMAKELISTS}) + MESSAGE(FATAL_ERROR "Unable to find platform CMakeLists.txt for ${TARGET_BUILD_PLATFORM} at ${PLATFORM_CMAKELISTS}") +ENDIF() + +# Include the platform specific CMakeLists +INCLUDE(${PHYSX_ROOT_DIR}/snippets/${PROJECT_CMAKE_FILES_DIR}/${TARGET_BUILD_PLATFORM}/CMakeLists.txt) + +SET(SOURCE_DISTRO_FILE_LIST "") + +# Include all of the projects +SET(SNIPPETS_LIST ArticulationRC BVHStructure CCD ContactModification ContactReport ContactReportCCD ConvexMeshCreate + CustomJoint CustomProfiler DeformableMesh FrustumQuery GearJoint GeometryQuery Gyroscopic HelloWorld ImmediateArticulation ImmediateMode Joint JointDrive MassProperties + MBP MimicJoint MultiPruners MultiThreading OmniPvd PathTracing PointDistanceQuery ProfilerConverter PrunerSerialization QuerySystemAllQueries QuerySystemCustomCompound RackJoint Serialization SplitFetchResults + SplitSim StandaloneBVH StandaloneBroadphase StandaloneQuerySystem Stepper ToleranceScale TriangleMeshCreate Triggers CustomGeometry CustomConvex CustomGeometryCollision CustomGeometryQueries FixedTendon SpatialTendon) +LIST(APPEND SNIPPETS_LIST ${PLATFORM_SNIPPETS_LIST}) + +# Add further snippets that use GPU features directly. +# These are separate because we don't ship CUDA in the public release yet. +# To be changed if we decide otherwise. +SET(GPU_SNIPPET_LIST + HelloGRB DeformableSurface DeformableVolume DeformableVolumeAttachment DeformableVolumeKinematic DeformableSurfaceSkinning DeformableVolumeSkinning SDF PBF PBFMultiMat PBDCloth PBDInflatable Isosurface + RBDirectGPUAPI DirectGPUAPIArticulation) + +#TODO, create a propper define for whether GPU features are enabled or not! +IF (PX_GENERATE_GPU_PROJECTS AND + (NOT (CMAKE_CROSSCOMPILING OR CMAKE_GENERATOR_PLATFORM STREQUAL "NX64"))) + LIST(APPEND SNIPPETS_LIST ${GPU_SNIPPET_LIST}) +ENDIF() + +SET(SNIPPETS_VEHICLE_LIST VehicleDirectDrive VehicleFourWheelDrive VehicleTankDrive VehicleCustomSuspension VehicleMultithreading VehicleTruck VehicleCustomTire) +LIST(APPEND SNIPPETS_VEHICLE_LIST ${PLATFORM_SNIPPETS_VEHICLE_LIST}) + +IF(SNIPPET_RENDER_ENABLED) + INCLUDE(SnippetRender.cmake) + SET_PROPERTY(TARGET SnippetRender PROPERTY FOLDER "Snippets/Libraries only") +ENDIF() + +INCLUDE(SnippetUtils.cmake) +SET_PROPERTY(TARGET SnippetUtils PROPERTY FOLDER "Snippets/Libraries only") + +# Compile snippets +FOREACH(SNIPPET_NAME ${SNIPPETS_LIST}) + INCLUDE(SnippetTemplate.cmake) + SET_PROPERTY(TARGET Snippet${SNIPPET_NAME} PROPERTY FOLDER "Snippets") +ENDFOREACH() + +# Compile vehicle snippets +FOREACH(SNIPPET_NAME ${SNIPPETS_VEHICLE_LIST}) + INCLUDE(SnippetVehicleTemplate.cmake) + SET_PROPERTY(TARGET Snippet${SNIPPET_NAME} PROPERTY FOLDER "Snippets") +ENDFOREACH() + +# For internal builds, make sure the GPU lib is built (but not linked!) before GPU snippets +IF (PX_GENERATE_GPU_PROJECTS OR PX_GENERATE_GPU_PROJECTS_ONLY) + FOREACH(SNIPPET_NAME ${GPU_SNIPPET_LIST}) + ADD_DEPENDENCIES(Snippet${SNIPPET_NAME} PhysXGpu) + ENDFOREACH() +ENDIF() + +IF(PX_GENERATE_SOURCE_DISTRO) + FOREACH(FILE_NAME ${SOURCE_DISTRO_FILE_LIST}) + FILE(APPEND "${CMAKE_CURRENT_BINARY_DIR}/source_distro_list.txt" "${FILE_NAME}\n") + ENDFOREACH() +ENDIF() diff --git a/engine/third_party/physx/snippets/compiler/cmake/linux/CMakeLists.txt b/engine/third_party/physx/snippets/compiler/cmake/linux/CMakeLists.txt new file mode 100644 index 00000000..7f6e32dc --- /dev/null +++ b/engine/third_party/physx/snippets/compiler/cmake/linux/CMakeLists.txt @@ -0,0 +1,51 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +IF(NOT DEFINED PHYSX_LINUX_COMPILE_DEFS) + MESSAGE(FATAL ERROR "Snippets uses the PhysX compile defs, and they're not defined when they need to be.") +ENDIF() + +IF (NOT DEFINED PHYSX_CXX_FLAGS) + MESSAGE(FATAL ERROR "Snippets uses the PhysX CXX flags, and they're not defined when they need to be.") +ENDIF() + +# Get the CXX Flags from the Cached variables set by the PhysX CMakeLists +SET(CMAKE_CXX_FLAGS "${PHYSX_CXX_FLAGS}") + +SET(CMAKE_CXX_FLAGS_DEBUG "${PHYSX_CXX_FLAGS_DEBUG}") +SET(CMAKE_CXX_FLAGS_CHECKED ${PHYSX_CXX_FLAGS_CHECKED}) +SET(CMAKE_CXX_FLAGS_PROFILE ${PHYSX_CXX_FLAGS_PROFILE}) +SET(CMAKE_CXX_FLAGS_RELEASE ${PHYSX_CXX_FLAGS_RELEASE}) + +# Build PDBs for all configurations +SET(CMAKE_SHARED_LINKER_FLAGS "/DEBUG") + +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath='$ORIGIN'") + +# Include all of the projects +SET(PLATFORM_SNIPPETS_LIST LoadCollection) + +SET(SNIPPET_RENDER_ENABLED 1) diff --git a/engine/third_party/physx/snippets/compiler/cmake/windows/CMakeLists.txt b/engine/third_party/physx/snippets/compiler/cmake/windows/CMakeLists.txt new file mode 100644 index 00000000..98607d52 --- /dev/null +++ b/engine/third_party/physx/snippets/compiler/cmake/windows/CMakeLists.txt @@ -0,0 +1,70 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2025 NVIDIA Corporation. All rights reserved. + +IF(NOT DEFINED PHYSX_WINDOWS_COMPILE_DEFS) + MESSAGE(FATAL ERROR "Snippets uses the PhysX compile defs, and they're not defined when they need to be.") +ENDIF() + +IF (NOT DEFINED PHYSX_CXX_FLAGS) + MESSAGE(FATAL ERROR "Snippets uses the PhysX CXX flags, and they're not defined when they need to be.") +ENDIF() + +IF(MSVC_VERSION LESS_EQUAL 1900) + SET(SNIPPET_WARNING_DISABLES "/wd4714") +ENDIF() + +# Get the CXX Flags from the Cached variables set by the PhysX CMakeLists +SET(CMAKE_CXX_FLAGS "${PHYSX_CXX_FLAGS} ${SNIPPET_WARNING_DISABLES} /EHsc") + +SET(CMAKE_CXX_FLAGS_DEBUG ${PHYSX_CXX_FLAGS_DEBUG}) +SET(CMAKE_CXX_FLAGS_CHECKED ${PHYSX_CXX_FLAGS_CHECKED}) +SET(CMAKE_CXX_FLAGS_PROFILE ${PHYSX_CXX_FLAGS_PROFILE}) +SET(CMAKE_CXX_FLAGS_RELEASE ${PHYSX_CXX_FLAGS_RELEASE}) + +# Get the C Flags from the Cached variables set by the PhysX CMakeLists +SET(CMAKE_C_FLAGS "${PHYSX_C_FLAGS} ${SNIPPET_WARNING_DISABLES}") + +SET(CMAKE_C_FLAGS_DEBUG ${PHYSX_C_FLAGS_DEBUG}) +SET(CMAKE_C_FLAGS_CHECKED ${PHYSX_C_FLAGS_CHECKED}) +SET(CMAKE_C_FLAGS_PROFILE ${PHYSX_C_FLAGS_PROFILE}) +SET(CMAKE_C_FLAGS_RELEASE ${PHYSX_C_FLAGS_RELEASE}) + +# Build PDBs for all configurations +SET(CMAKE_SHARED_LINKER_FLAGS "/DEBUG") + +SET(SLN_PHYSXDEVICE_PATH "$ENV{PM_PhysXDevice_PATH}/bin/x86/") + +# Include ConfigureFileMT to expose that function +INCLUDE(ConfigureFileMT) + +SET(SNIPPET_RENDER_ENABLED 1) + +# Include all of the projects +SET(PLATFORM_SNIPPETS_LIST LoadCollection DelayLoadHook) + +IF(PX_BUILDVHACD) + LIST(APPEND PLATFORM_SNIPPETS_LIST ConvexDecomposition) +ENDIF() diff --git a/engine/third_party/physx/snippets/graphics/include/GL/glew.h b/engine/third_party/physx/snippets/graphics/include/GL/glew.h new file mode 100644 index 00000000..3cd8451d --- /dev/null +++ b/engine/third_party/physx/snippets/graphics/include/GL/glew.h @@ -0,0 +1,19756 @@ +/* +** The OpenGL Extension Wrangler Library +** Copyright (C) 2008-2015, Nigel Stewart +** Copyright (C) 2002-2008, Milan Ikits +** Copyright (C) 2002-2008, Marcelo E. Magallon +** Copyright (C) 2002, Lev Povalahev +** 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. +** * The name of the author may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +** THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Mesa 3-D graphics library + * Version: 7.0 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* +** Copyright (c) 2007 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#define GLEW_STATIC + +//#pragma warning( disable : 4273) +#ifndef __glew_h__ +#define __glew_h__ +#define __GLEW_H__ + +#if defined(__gl_h_) || defined(__GL_H__) || defined(_GL_H) || defined(__X_GL_H) +#error gl.h included before glew.h +#endif +#if defined(__gl2_h_) +#error gl2.h included before glew.h +#endif +#if defined(__gltypes_h_) +#error gltypes.h included before glew.h +#endif +#if defined(__REGAL_H__) +#error Regal.h included before glew.h +#endif +#if defined(__glext_h_) || defined(__GLEXT_H_) +#error glext.h included before glew.h +#endif +#if defined(__gl_ATI_h_) +#error glATI.h included before glew.h +#endif + +#define __gl_h_ +#define __gl2_h_ +#define __GL_H__ +#define _GL_H +#define __gltypes_h_ +#define __REGAL_H__ +#define __X_GL_H +#define __glext_h_ +#define __GLEXT_H_ +#define __gl_ATI_h_ + +#if defined(_WIN32) + +/* + * GLEW does not include to avoid name space pollution. + * GL needs GLAPI and GLAPIENTRY, GLU needs APIENTRY, CALLBACK, and wchar_t + * defined properly. + */ +/* and */ +#ifdef APIENTRY +# ifndef GLAPIENTRY +# define GLAPIENTRY APIENTRY +# endif +# ifndef GLEWAPIENTRY +# define GLEWAPIENTRY APIENTRY +# endif +#else +#define GLEW_APIENTRY_DEFINED +# if defined(__MINGW32__) || defined(__CYGWIN__) || (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) +# define APIENTRY __stdcall +# ifndef GLAPIENTRY +# define GLAPIENTRY __stdcall +# endif +# ifndef GLEWAPIENTRY +# define GLEWAPIENTRY __stdcall +# endif +# else +# define APIENTRY +# endif +#endif +#ifndef GLAPI +# if defined(__MINGW32__) || defined(__CYGWIN__) +# define GLAPI extern +# endif +#endif +/* */ +#ifndef CALLBACK +#define GLEW_CALLBACK_DEFINED +# if defined(__MINGW32__) || defined(__CYGWIN__) +# define CALLBACK __attribute__ ((__stdcall__)) +# elif (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) +# define CALLBACK __stdcall +# else +# define CALLBACK +# endif +#endif +/* and */ +#ifndef WINGDIAPI +#define GLEW_WINGDIAPI_DEFINED +#define WINGDIAPI __declspec(dllimport) +#endif +/* */ +#if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(_WCHAR_T_DEFINED) +typedef unsigned short wchar_t; +# define _WCHAR_T_DEFINED +#endif +/* */ +#if !defined(_W64) +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && defined(_MSC_VER) && _MSC_VER >= 1300 +# define _W64 __w64 +# else +# define _W64 +# endif +#endif +#if !defined(_PTRDIFF_T_DEFINED) && !defined(_PTRDIFF_T_) && !defined(__MINGW64__) +# ifdef _WIN64 +typedef __int64 ptrdiff_t; +# else +typedef _W64 int ptrdiff_t; +# endif +# define _PTRDIFF_T_DEFINED +# define _PTRDIFF_T_ +#endif + +#ifndef GLAPI +# if defined(__MINGW32__) || defined(__CYGWIN__) +# define GLAPI extern +# else +# define GLAPI WINGDIAPI +# endif +#endif + +/* + * GLEW_STATIC is defined for static library. + * GLEW_BUILD is defined for building the DLL library. + */ + +#ifdef GLEW_STATIC +# define GLEWAPI extern +#else +# ifdef GLEW_BUILD +# define GLEWAPI extern __declspec(dllexport) +# else +# define GLEWAPI extern __declspec(dllimport) +# endif +#endif + +#else /* _UNIX */ + +/* + * Needed for ptrdiff_t in turn needed by VBO. This is defined by ISO + * C. On my system, this amounts to _3 lines_ of included code, all of + * them pretty much harmless. If you know of a way of detecting 32 vs + * 64 _targets_ at compile time you are free to replace this with + * something that's portable. For now, _this_ is the portable solution. + * (mem, 2004-01-04) + */ + +#include + +/* SGI MIPSPro doesn't like stdint.h in C++ mode */ +/* ID: 3376260 Solaris 9 has inttypes.h, but not stdint.h */ + +#if (defined(__sgi) || defined(__sun)) && !defined(__GNUC__) +#include +#else +#include +#endif + +#define GLEW_APIENTRY_DEFINED +#define APIENTRY + +/* + * GLEW_STATIC is defined for static library. + */ + +#ifdef GLEW_STATIC +# define GLEWAPI extern +#else +# if defined(__GNUC__) && __GNUC__>=4 +# define GLEWAPI extern __attribute__ ((visibility("default"))) +# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +# define GLEWAPI extern __global +# else +# define GLEWAPI extern +# endif +#endif + +/* */ +#ifndef GLAPI +#define GLAPI extern +#endif + +#endif /* _WIN32 */ + +#ifndef GLAPIENTRY +#define GLAPIENTRY +#endif + +#ifndef GLEWAPIENTRY +#define GLEWAPIENTRY +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* ----------------------------- GL_VERSION_1_1 ---------------------------- */ + +#ifndef GL_VERSION_1_1 +#define GL_VERSION_1_1 1 + +typedef unsigned int GLenum; +typedef unsigned int GLbitfield; +typedef unsigned int GLuint; +typedef int GLint; +typedef int GLsizei; +typedef unsigned char GLboolean; +typedef signed char GLbyte; +typedef short GLshort; +typedef unsigned char GLubyte; +typedef unsigned short GLushort; +typedef unsigned long GLulong; +typedef float GLfloat; +typedef float GLclampf; +typedef double GLdouble; +typedef double GLclampd; +typedef void GLvoid; +#if defined(_MSC_VER) && _MSC_VER < 1400 +typedef __int64 GLint64EXT; +typedef unsigned __int64 GLuint64EXT; +#elif defined(_MSC_VER) || defined(__BORLANDC__) +typedef signed long long GLint64EXT; +typedef unsigned long long GLuint64EXT; +#else +# if defined(__MINGW32__) || defined(__CYGWIN__) +#include +# endif +typedef int64_t GLint64EXT; +typedef uint64_t GLuint64EXT; +#endif +typedef GLint64EXT GLint64; +typedef GLuint64EXT GLuint64; +typedef struct __GLsync *GLsync; + +typedef char GLchar; + +#define GL_ZERO 0 +#define GL_FALSE 0 +#define GL_LOGIC_OP 0x0BF1 +#define GL_NONE 0 +#define GL_TEXTURE_COMPONENTS 0x1003 +#define GL_NO_ERROR 0 +#define GL_POINTS 0x0000 +#define GL_CURRENT_BIT 0x00000001 +#define GL_TRUE 1 +#define GL_ONE 1 +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_POINT_BIT 0x00000002 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_LINE_STRIP 0x0003 +#define GL_LINE_BIT 0x00000004 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON 0x0009 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_ACCUM 0x0100 +#define GL_LOAD 0x0101 +#define GL_RETURN 0x0102 +#define GL_MULT 0x0103 +#define GL_ADD 0x0104 +#define GL_NEVER 0x0200 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_2D 0x0600 +#define GL_3D 0x0601 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_4D_COLOR_TEXTURE 0x0604 +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_POINT_TOKEN 0x0701 +#define GL_LINE_TOKEN 0x0702 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_LINE_RESET_TOKEN 0x0707 +#define GL_EXP 0x0800 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_EXP2 0x0801 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_COEFF 0x0A00 +#define GL_ORDER 0x0A01 +#define GL_DOMAIN 0x0A02 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_RANGE 0x0B12 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_RANGE 0x0B22 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LIST_MODE 0x0B30 +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_SHADE_MODEL 0x0B54 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_FOG 0x0B60 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_COLOR 0x0B66 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_MATRIX_MODE 0x0BA0 +#define GL_NORMALIZE 0x0BA1 +#define GL_VIEWPORT 0x0BA2 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_FUNC 0x0BC1 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_DITHER 0x0BD0 +#define GL_BLEND_DST 0x0BE0 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND 0x0BE2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_READ_BUFFER 0x0C02 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_INDEX_MODE 0x0C30 +#define GL_RGBA_MODE 0x0C31 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_RENDER_MODE 0x0C40 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_FOG_HINT 0x0C54 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_STENCIL 0x0D11 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_BIAS 0x0D15 +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GREEN_BIAS 0x0D19 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BLUE_BIAS 0x0D1B +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_BIAS 0x0D1D +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_BIAS 0x0D1F +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_INDEX_BITS 0x0D51 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 +#define GL_DOUBLE 0x140A +#define GL_CLEAR 0x1500 +#define GL_AND 0x1501 +#define GL_AND_REVERSE 0x1502 +#define GL_COPY 0x1503 +#define GL_AND_INVERTED 0x1504 +#define GL_NOOP 0x1505 +#define GL_XOR 0x1506 +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_EQUIV 0x1509 +#define GL_INVERT 0x150A +#define GL_OR_REVERSE 0x150B +#define GL_COPY_INVERTED 0x150C +#define GL_OR_INVERTED 0x150D +#define GL_NAND 0x150E +#define GL_SET 0x150F +#define GL_EMISSION 0x1600 +#define GL_SHININESS 0x1601 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_COLOR_INDEX 0x1900 +#define GL_STENCIL_INDEX 0x1901 +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_BITMAP 0x1A00 +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 +#define GL_RENDER 0x1C00 +#define GL_FEEDBACK 0x1C01 +#define GL_SELECT 0x1C02 +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 +#define GL_S 0x2000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 +#define GL_MODULATE 0x2100 +#define GL_DECAL 0x2101 +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_ENV_COLOR 0x2201 +#define GL_TEXTURE_ENV 0x2300 +#define GL_EYE_LINEAR 0x2400 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_SPHERE_MAP 0x2402 +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_PLANE 0x2502 +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_CLAMP 0x2900 +#define GL_REPEAT 0x2901 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_R3_G3_B2 0x2A10 +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 +#define GL_LIGHT0 0x4000 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 +#define GL_HINT_BIT 0x00008000 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_EVAL_BIT 0x00010000 +#define GL_LIST_BIT 0x00020000 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_SCISSOR_BIT 0x00080000 +#define GL_ALL_ATTRIB_BITS 0x000fffff +#define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff + +GLAPI void GLAPIENTRY glAccum (GLenum op, GLfloat value); +GLAPI void GLAPIENTRY glAlphaFunc (GLenum func, GLclampf ref); +GLAPI GLboolean GLAPIENTRY glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences); +GLAPI void GLAPIENTRY glArrayElement (GLint i); +GLAPI void GLAPIENTRY glBegin (GLenum mode); +GLAPI void GLAPIENTRY glBindTexture (GLenum target, GLuint texture); +GLAPI void GLAPIENTRY glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); +GLAPI void GLAPIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GLAPI void GLAPIENTRY glCallList (GLuint list); +GLAPI void GLAPIENTRY glCallLists (GLsizei n, GLenum type, const void *lists); +GLAPI void GLAPIENTRY glClear (GLbitfield mask); +GLAPI void GLAPIENTRY glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI void GLAPIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GLAPI void GLAPIENTRY glClearDepth (GLclampd depth); +GLAPI void GLAPIENTRY glClearIndex (GLfloat c); +GLAPI void GLAPIENTRY glClearStencil (GLint s); +GLAPI void GLAPIENTRY glClipPlane (GLenum plane, const GLdouble *equation); +GLAPI void GLAPIENTRY glColor3b (GLbyte red, GLbyte green, GLbyte blue); +GLAPI void GLAPIENTRY glColor3bv (const GLbyte *v); +GLAPI void GLAPIENTRY glColor3d (GLdouble red, GLdouble green, GLdouble blue); +GLAPI void GLAPIENTRY glColor3dv (const GLdouble *v); +GLAPI void GLAPIENTRY glColor3f (GLfloat red, GLfloat green, GLfloat blue); +GLAPI void GLAPIENTRY glColor3fv (const GLfloat *v); +GLAPI void GLAPIENTRY glColor3i (GLint red, GLint green, GLint blue); +GLAPI void GLAPIENTRY glColor3iv (const GLint *v); +GLAPI void GLAPIENTRY glColor3s (GLshort red, GLshort green, GLshort blue); +GLAPI void GLAPIENTRY glColor3sv (const GLshort *v); +GLAPI void GLAPIENTRY glColor3ub (GLubyte red, GLubyte green, GLubyte blue); +GLAPI void GLAPIENTRY glColor3ubv (const GLubyte *v); +GLAPI void GLAPIENTRY glColor3ui (GLuint red, GLuint green, GLuint blue); +GLAPI void GLAPIENTRY glColor3uiv (const GLuint *v); +GLAPI void GLAPIENTRY glColor3us (GLushort red, GLushort green, GLushort blue); +GLAPI void GLAPIENTRY glColor3usv (const GLushort *v); +GLAPI void GLAPIENTRY glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); +GLAPI void GLAPIENTRY glColor4bv (const GLbyte *v); +GLAPI void GLAPIENTRY glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); +GLAPI void GLAPIENTRY glColor4dv (const GLdouble *v); +GLAPI void GLAPIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI void GLAPIENTRY glColor4fv (const GLfloat *v); +GLAPI void GLAPIENTRY glColor4i (GLint red, GLint green, GLint blue, GLint alpha); +GLAPI void GLAPIENTRY glColor4iv (const GLint *v); +GLAPI void GLAPIENTRY glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha); +GLAPI void GLAPIENTRY glColor4sv (const GLshort *v); +GLAPI void GLAPIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +GLAPI void GLAPIENTRY glColor4ubv (const GLubyte *v); +GLAPI void GLAPIENTRY glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha); +GLAPI void GLAPIENTRY glColor4uiv (const GLuint *v); +GLAPI void GLAPIENTRY glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha); +GLAPI void GLAPIENTRY glColor4usv (const GLushort *v); +GLAPI void GLAPIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GLAPI void GLAPIENTRY glColorMaterial (GLenum face, GLenum mode); +GLAPI void GLAPIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void GLAPIENTRY glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); +GLAPI void GLAPIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void GLAPIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void GLAPIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void GLAPIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void GLAPIENTRY glCullFace (GLenum mode); +GLAPI void GLAPIENTRY glDeleteLists (GLuint list, GLsizei range); +GLAPI void GLAPIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); +GLAPI void GLAPIENTRY glDepthFunc (GLenum func); +GLAPI void GLAPIENTRY glDepthMask (GLboolean flag); +GLAPI void GLAPIENTRY glDepthRange (GLclampd zNear, GLclampd zFar); +GLAPI void GLAPIENTRY glDisable (GLenum cap); +GLAPI void GLAPIENTRY glDisableClientState (GLenum array); +GLAPI void GLAPIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GLAPI void GLAPIENTRY glDrawBuffer (GLenum mode); +GLAPI void GLAPIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices); +GLAPI void GLAPIENTRY glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI void GLAPIENTRY glEdgeFlag (GLboolean flag); +GLAPI void GLAPIENTRY glEdgeFlagPointer (GLsizei stride, const void *pointer); +GLAPI void GLAPIENTRY glEdgeFlagv (const GLboolean *flag); +GLAPI void GLAPIENTRY glEnable (GLenum cap); +GLAPI void GLAPIENTRY glEnableClientState (GLenum array); +GLAPI void GLAPIENTRY glEnd (void); +GLAPI void GLAPIENTRY glEndList (void); +GLAPI void GLAPIENTRY glEvalCoord1d (GLdouble u); +GLAPI void GLAPIENTRY glEvalCoord1dv (const GLdouble *u); +GLAPI void GLAPIENTRY glEvalCoord1f (GLfloat u); +GLAPI void GLAPIENTRY glEvalCoord1fv (const GLfloat *u); +GLAPI void GLAPIENTRY glEvalCoord2d (GLdouble u, GLdouble v); +GLAPI void GLAPIENTRY glEvalCoord2dv (const GLdouble *u); +GLAPI void GLAPIENTRY glEvalCoord2f (GLfloat u, GLfloat v); +GLAPI void GLAPIENTRY glEvalCoord2fv (const GLfloat *u); +GLAPI void GLAPIENTRY glEvalMesh1 (GLenum mode, GLint i1, GLint i2); +GLAPI void GLAPIENTRY glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); +GLAPI void GLAPIENTRY glEvalPoint1 (GLint i); +GLAPI void GLAPIENTRY glEvalPoint2 (GLint i, GLint j); +GLAPI void GLAPIENTRY glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer); +GLAPI void GLAPIENTRY glFinish (void); +GLAPI void GLAPIENTRY glFlush (void); +GLAPI void GLAPIENTRY glFogf (GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glFogfv (GLenum pname, const GLfloat *params); +GLAPI void GLAPIENTRY glFogi (GLenum pname, GLint param); +GLAPI void GLAPIENTRY glFogiv (GLenum pname, const GLint *params); +GLAPI void GLAPIENTRY glFrontFace (GLenum mode); +GLAPI void GLAPIENTRY glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI GLuint GLAPIENTRY glGenLists (GLsizei range); +GLAPI void GLAPIENTRY glGenTextures (GLsizei n, GLuint *textures); +GLAPI void GLAPIENTRY glGetBooleanv (GLenum pname, GLboolean *params); +GLAPI void GLAPIENTRY glGetClipPlane (GLenum plane, GLdouble *equation); +GLAPI void GLAPIENTRY glGetDoublev (GLenum pname, GLdouble *params); +GLAPI GLenum GLAPIENTRY glGetError (void); +GLAPI void GLAPIENTRY glGetFloatv (GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetIntegerv (GLenum pname, GLint *params); +GLAPI void GLAPIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetLightiv (GLenum light, GLenum pname, GLint *params); +GLAPI void GLAPIENTRY glGetMapdv (GLenum target, GLenum query, GLdouble *v); +GLAPI void GLAPIENTRY glGetMapfv (GLenum target, GLenum query, GLfloat *v); +GLAPI void GLAPIENTRY glGetMapiv (GLenum target, GLenum query, GLint *v); +GLAPI void GLAPIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetMaterialiv (GLenum face, GLenum pname, GLint *params); +GLAPI void GLAPIENTRY glGetPixelMapfv (GLenum map, GLfloat *values); +GLAPI void GLAPIENTRY glGetPixelMapuiv (GLenum map, GLuint *values); +GLAPI void GLAPIENTRY glGetPixelMapusv (GLenum map, GLushort *values); +GLAPI void GLAPIENTRY glGetPointerv (GLenum pname, void* *params); +GLAPI void GLAPIENTRY glGetPolygonStipple (GLubyte *mask); +GLAPI const GLubyte * GLAPIENTRY glGetString (GLenum name); +GLAPI void GLAPIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params); +GLAPI void GLAPIENTRY glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params); +GLAPI void GLAPIENTRY glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetTexGeniv (GLenum coord, GLenum pname, GLint *params); +GLAPI void GLAPIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +GLAPI void GLAPIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params); +GLAPI void GLAPIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void GLAPIENTRY glHint (GLenum target, GLenum mode); +GLAPI void GLAPIENTRY glIndexMask (GLuint mask); +GLAPI void GLAPIENTRY glIndexPointer (GLenum type, GLsizei stride, const void *pointer); +GLAPI void GLAPIENTRY glIndexd (GLdouble c); +GLAPI void GLAPIENTRY glIndexdv (const GLdouble *c); +GLAPI void GLAPIENTRY glIndexf (GLfloat c); +GLAPI void GLAPIENTRY glIndexfv (const GLfloat *c); +GLAPI void GLAPIENTRY glIndexi (GLint c); +GLAPI void GLAPIENTRY glIndexiv (const GLint *c); +GLAPI void GLAPIENTRY glIndexs (GLshort c); +GLAPI void GLAPIENTRY glIndexsv (const GLshort *c); +GLAPI void GLAPIENTRY glIndexub (GLubyte c); +GLAPI void GLAPIENTRY glIndexubv (const GLubyte *c); +GLAPI void GLAPIENTRY glInitNames (void); +GLAPI void GLAPIENTRY glInterleavedArrays (GLenum format, GLsizei stride, const void *pointer); +GLAPI GLboolean GLAPIENTRY glIsEnabled (GLenum cap); +GLAPI GLboolean GLAPIENTRY glIsList (GLuint list); +GLAPI GLboolean GLAPIENTRY glIsTexture (GLuint texture); +GLAPI void GLAPIENTRY glLightModelf (GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glLightModelfv (GLenum pname, const GLfloat *params); +GLAPI void GLAPIENTRY glLightModeli (GLenum pname, GLint param); +GLAPI void GLAPIENTRY glLightModeliv (GLenum pname, const GLint *params); +GLAPI void GLAPIENTRY glLightf (GLenum light, GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params); +GLAPI void GLAPIENTRY glLighti (GLenum light, GLenum pname, GLint param); +GLAPI void GLAPIENTRY glLightiv (GLenum light, GLenum pname, const GLint *params); +GLAPI void GLAPIENTRY glLineStipple (GLint factor, GLushort pattern); +GLAPI void GLAPIENTRY glLineWidth (GLfloat width); +GLAPI void GLAPIENTRY glListBase (GLuint base); +GLAPI void GLAPIENTRY glLoadIdentity (void); +GLAPI void GLAPIENTRY glLoadMatrixd (const GLdouble *m); +GLAPI void GLAPIENTRY glLoadMatrixf (const GLfloat *m); +GLAPI void GLAPIENTRY glLoadName (GLuint name); +GLAPI void GLAPIENTRY glLogicOp (GLenum opcode); +GLAPI void GLAPIENTRY glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); +GLAPI void GLAPIENTRY glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); +GLAPI void GLAPIENTRY glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); +GLAPI void GLAPIENTRY glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); +GLAPI void GLAPIENTRY glMapGrid1d (GLint un, GLdouble u1, GLdouble u2); +GLAPI void GLAPIENTRY glMapGrid1f (GLint un, GLfloat u1, GLfloat u2); +GLAPI void GLAPIENTRY glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); +GLAPI void GLAPIENTRY glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); +GLAPI void GLAPIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params); +GLAPI void GLAPIENTRY glMateriali (GLenum face, GLenum pname, GLint param); +GLAPI void GLAPIENTRY glMaterialiv (GLenum face, GLenum pname, const GLint *params); +GLAPI void GLAPIENTRY glMatrixMode (GLenum mode); +GLAPI void GLAPIENTRY glMultMatrixd (const GLdouble *m); +GLAPI void GLAPIENTRY glMultMatrixf (const GLfloat *m); +GLAPI void GLAPIENTRY glNewList (GLuint list, GLenum mode); +GLAPI void GLAPIENTRY glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz); +GLAPI void GLAPIENTRY glNormal3bv (const GLbyte *v); +GLAPI void GLAPIENTRY glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz); +GLAPI void GLAPIENTRY glNormal3dv (const GLdouble *v); +GLAPI void GLAPIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz); +GLAPI void GLAPIENTRY glNormal3fv (const GLfloat *v); +GLAPI void GLAPIENTRY glNormal3i (GLint nx, GLint ny, GLint nz); +GLAPI void GLAPIENTRY glNormal3iv (const GLint *v); +GLAPI void GLAPIENTRY glNormal3s (GLshort nx, GLshort ny, GLshort nz); +GLAPI void GLAPIENTRY glNormal3sv (const GLshort *v); +GLAPI void GLAPIENTRY glNormalPointer (GLenum type, GLsizei stride, const void *pointer); +GLAPI void GLAPIENTRY glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI void GLAPIENTRY glPassThrough (GLfloat token); +GLAPI void GLAPIENTRY glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values); +GLAPI void GLAPIENTRY glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values); +GLAPI void GLAPIENTRY glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values); +GLAPI void GLAPIENTRY glPixelStoref (GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glPixelStorei (GLenum pname, GLint param); +GLAPI void GLAPIENTRY glPixelTransferf (GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glPixelTransferi (GLenum pname, GLint param); +GLAPI void GLAPIENTRY glPixelZoom (GLfloat xfactor, GLfloat yfactor); +GLAPI void GLAPIENTRY glPointSize (GLfloat size); +GLAPI void GLAPIENTRY glPolygonMode (GLenum face, GLenum mode); +GLAPI void GLAPIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GLAPI void GLAPIENTRY glPolygonStipple (const GLubyte *mask); +GLAPI void GLAPIENTRY glPopAttrib (void); +GLAPI void GLAPIENTRY glPopClientAttrib (void); +GLAPI void GLAPIENTRY glPopMatrix (void); +GLAPI void GLAPIENTRY glPopName (void); +GLAPI void GLAPIENTRY glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities); +GLAPI void GLAPIENTRY glPushAttrib (GLbitfield mask); +GLAPI void GLAPIENTRY glPushClientAttrib (GLbitfield mask); +GLAPI void GLAPIENTRY glPushMatrix (void); +GLAPI void GLAPIENTRY glPushName (GLuint name); +GLAPI void GLAPIENTRY glRasterPos2d (GLdouble x, GLdouble y); +GLAPI void GLAPIENTRY glRasterPos2dv (const GLdouble *v); +GLAPI void GLAPIENTRY glRasterPos2f (GLfloat x, GLfloat y); +GLAPI void GLAPIENTRY glRasterPos2fv (const GLfloat *v); +GLAPI void GLAPIENTRY glRasterPos2i (GLint x, GLint y); +GLAPI void GLAPIENTRY glRasterPos2iv (const GLint *v); +GLAPI void GLAPIENTRY glRasterPos2s (GLshort x, GLshort y); +GLAPI void GLAPIENTRY glRasterPos2sv (const GLshort *v); +GLAPI void GLAPIENTRY glRasterPos3d (GLdouble x, GLdouble y, GLdouble z); +GLAPI void GLAPIENTRY glRasterPos3dv (const GLdouble *v); +GLAPI void GLAPIENTRY glRasterPos3f (GLfloat x, GLfloat y, GLfloat z); +GLAPI void GLAPIENTRY glRasterPos3fv (const GLfloat *v); +GLAPI void GLAPIENTRY glRasterPos3i (GLint x, GLint y, GLint z); +GLAPI void GLAPIENTRY glRasterPos3iv (const GLint *v); +GLAPI void GLAPIENTRY glRasterPos3s (GLshort x, GLshort y, GLshort z); +GLAPI void GLAPIENTRY glRasterPos3sv (const GLshort *v); +GLAPI void GLAPIENTRY glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void GLAPIENTRY glRasterPos4dv (const GLdouble *v); +GLAPI void GLAPIENTRY glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void GLAPIENTRY glRasterPos4fv (const GLfloat *v); +GLAPI void GLAPIENTRY glRasterPos4i (GLint x, GLint y, GLint z, GLint w); +GLAPI void GLAPIENTRY glRasterPos4iv (const GLint *v); +GLAPI void GLAPIENTRY glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void GLAPIENTRY glRasterPos4sv (const GLshort *v); +GLAPI void GLAPIENTRY glReadBuffer (GLenum mode); +GLAPI void GLAPIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +GLAPI void GLAPIENTRY glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); +GLAPI void GLAPIENTRY glRectdv (const GLdouble *v1, const GLdouble *v2); +GLAPI void GLAPIENTRY glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); +GLAPI void GLAPIENTRY glRectfv (const GLfloat *v1, const GLfloat *v2); +GLAPI void GLAPIENTRY glRecti (GLint x1, GLint y1, GLint x2, GLint y2); +GLAPI void GLAPIENTRY glRectiv (const GLint *v1, const GLint *v2); +GLAPI void GLAPIENTRY glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2); +GLAPI void GLAPIENTRY glRectsv (const GLshort *v1, const GLshort *v2); +GLAPI GLint GLAPIENTRY glRenderMode (GLenum mode); +GLAPI void GLAPIENTRY glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +GLAPI void GLAPIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +GLAPI void GLAPIENTRY glScaled (GLdouble x, GLdouble y, GLdouble z); +GLAPI void GLAPIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z); +GLAPI void GLAPIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void GLAPIENTRY glSelectBuffer (GLsizei size, GLuint *buffer); +GLAPI void GLAPIENTRY glShadeModel (GLenum mode); +GLAPI void GLAPIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GLAPI void GLAPIENTRY glStencilMask (GLuint mask); +GLAPI void GLAPIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GLAPI void GLAPIENTRY glTexCoord1d (GLdouble s); +GLAPI void GLAPIENTRY glTexCoord1dv (const GLdouble *v); +GLAPI void GLAPIENTRY glTexCoord1f (GLfloat s); +GLAPI void GLAPIENTRY glTexCoord1fv (const GLfloat *v); +GLAPI void GLAPIENTRY glTexCoord1i (GLint s); +GLAPI void GLAPIENTRY glTexCoord1iv (const GLint *v); +GLAPI void GLAPIENTRY glTexCoord1s (GLshort s); +GLAPI void GLAPIENTRY glTexCoord1sv (const GLshort *v); +GLAPI void GLAPIENTRY glTexCoord2d (GLdouble s, GLdouble t); +GLAPI void GLAPIENTRY glTexCoord2dv (const GLdouble *v); +GLAPI void GLAPIENTRY glTexCoord2f (GLfloat s, GLfloat t); +GLAPI void GLAPIENTRY glTexCoord2fv (const GLfloat *v); +GLAPI void GLAPIENTRY glTexCoord2i (GLint s, GLint t); +GLAPI void GLAPIENTRY glTexCoord2iv (const GLint *v); +GLAPI void GLAPIENTRY glTexCoord2s (GLshort s, GLshort t); +GLAPI void GLAPIENTRY glTexCoord2sv (const GLshort *v); +GLAPI void GLAPIENTRY glTexCoord3d (GLdouble s, GLdouble t, GLdouble r); +GLAPI void GLAPIENTRY glTexCoord3dv (const GLdouble *v); +GLAPI void GLAPIENTRY glTexCoord3f (GLfloat s, GLfloat t, GLfloat r); +GLAPI void GLAPIENTRY glTexCoord3fv (const GLfloat *v); +GLAPI void GLAPIENTRY glTexCoord3i (GLint s, GLint t, GLint r); +GLAPI void GLAPIENTRY glTexCoord3iv (const GLint *v); +GLAPI void GLAPIENTRY glTexCoord3s (GLshort s, GLshort t, GLshort r); +GLAPI void GLAPIENTRY glTexCoord3sv (const GLshort *v); +GLAPI void GLAPIENTRY glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void GLAPIENTRY glTexCoord4dv (const GLdouble *v); +GLAPI void GLAPIENTRY glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void GLAPIENTRY glTexCoord4fv (const GLfloat *v); +GLAPI void GLAPIENTRY glTexCoord4i (GLint s, GLint t, GLint r, GLint q); +GLAPI void GLAPIENTRY glTexCoord4iv (const GLint *v); +GLAPI void GLAPIENTRY glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void GLAPIENTRY glTexCoord4sv (const GLshort *v); +GLAPI void GLAPIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void GLAPIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void GLAPIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param); +GLAPI void GLAPIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params); +GLAPI void GLAPIENTRY glTexGend (GLenum coord, GLenum pname, GLdouble param); +GLAPI void GLAPIENTRY glTexGendv (GLenum coord, GLenum pname, const GLdouble *params); +GLAPI void GLAPIENTRY glTexGenf (GLenum coord, GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params); +GLAPI void GLAPIENTRY glTexGeni (GLenum coord, GLenum pname, GLint param); +GLAPI void GLAPIENTRY glTexGeniv (GLenum coord, GLenum pname, const GLint *params); +GLAPI void GLAPIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void GLAPIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void GLAPIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void GLAPIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GLAPI void GLAPIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +GLAPI void GLAPIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI void GLAPIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI void GLAPIENTRY glTranslated (GLdouble x, GLdouble y, GLdouble z); +GLAPI void GLAPIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z); +GLAPI void GLAPIENTRY glVertex2d (GLdouble x, GLdouble y); +GLAPI void GLAPIENTRY glVertex2dv (const GLdouble *v); +GLAPI void GLAPIENTRY glVertex2f (GLfloat x, GLfloat y); +GLAPI void GLAPIENTRY glVertex2fv (const GLfloat *v); +GLAPI void GLAPIENTRY glVertex2i (GLint x, GLint y); +GLAPI void GLAPIENTRY glVertex2iv (const GLint *v); +GLAPI void GLAPIENTRY glVertex2s (GLshort x, GLshort y); +GLAPI void GLAPIENTRY glVertex2sv (const GLshort *v); +GLAPI void GLAPIENTRY glVertex3d (GLdouble x, GLdouble y, GLdouble z); +GLAPI void GLAPIENTRY glVertex3dv (const GLdouble *v); +GLAPI void GLAPIENTRY glVertex3f (GLfloat x, GLfloat y, GLfloat z); +GLAPI void GLAPIENTRY glVertex3fv (const GLfloat *v); +GLAPI void GLAPIENTRY glVertex3i (GLint x, GLint y, GLint z); +GLAPI void GLAPIENTRY glVertex3iv (const GLint *v); +GLAPI void GLAPIENTRY glVertex3s (GLshort x, GLshort y, GLshort z); +GLAPI void GLAPIENTRY glVertex3sv (const GLshort *v); +GLAPI void GLAPIENTRY glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void GLAPIENTRY glVertex4dv (const GLdouble *v); +GLAPI void GLAPIENTRY glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void GLAPIENTRY glVertex4fv (const GLfloat *v); +GLAPI void GLAPIENTRY glVertex4i (GLint x, GLint y, GLint z, GLint w); +GLAPI void GLAPIENTRY glVertex4iv (const GLint *v); +GLAPI void GLAPIENTRY glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void GLAPIENTRY glVertex4sv (const GLshort *v); +GLAPI void GLAPIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); + +#define GLEW_VERSION_1_1 GLEW_GET_VAR(__GLEW_VERSION_1_1) + +#endif /* GL_VERSION_1_1 */ + +/* ---------------------------------- GLU ---------------------------------- */ + +#ifndef GLEW_NO_GLU +# ifdef __APPLE__ +# include +# if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) +# define GLEW_NO_GLU +# endif +# endif +#endif + +#ifndef GLEW_NO_GLU +/* this is where we can safely include GLU */ +# if defined(__APPLE__) && defined(__MACH__) +# include +# else +# include +# endif +#endif + +/* ----------------------------- GL_VERSION_1_2 ---------------------------- */ + +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 + +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_RESCALE_NORMAL 0x803A +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E + +typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); + +#define glCopyTexSubImage3D GLEW_GET_FUN(__glewCopyTexSubImage3D) +#define glDrawRangeElements GLEW_GET_FUN(__glewDrawRangeElements) +#define glTexImage3D GLEW_GET_FUN(__glewTexImage3D) +#define glTexSubImage3D GLEW_GET_FUN(__glewTexSubImage3D) + +#define GLEW_VERSION_1_2 GLEW_GET_VAR(__GLEW_VERSION_1_2) + +#endif /* GL_VERSION_1_2 */ + +/* ---------------------------- GL_VERSION_1_2_1 --------------------------- */ + +#ifndef GL_VERSION_1_2_1 +#define GL_VERSION_1_2_1 1 + +#define GLEW_VERSION_1_2_1 GLEW_GET_VAR(__GLEW_VERSION_1_2_1) + +#endif /* GL_VERSION_1_2_1 */ + +/* ----------------------------- GL_VERSION_1_3 ---------------------------- */ + +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 + +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_CLAMP_TO_BORDER 0x812D +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_SUBTRACT 0x84E7 +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +#define GL_MULTISAMPLE_BIT 0x20000000 + +typedef void (GLAPIENTRY * PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, void *img); +typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble m[16]); +typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat m[16]); +typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble m[16]); +typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat m[16]); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); + +#define glActiveTexture GLEW_GET_FUN(__glewActiveTexture) +#define glClientActiveTexture GLEW_GET_FUN(__glewClientActiveTexture) +#define glCompressedTexImage1D GLEW_GET_FUN(__glewCompressedTexImage1D) +#define glCompressedTexImage2D GLEW_GET_FUN(__glewCompressedTexImage2D) +#define glCompressedTexImage3D GLEW_GET_FUN(__glewCompressedTexImage3D) +#define glCompressedTexSubImage1D GLEW_GET_FUN(__glewCompressedTexSubImage1D) +#define glCompressedTexSubImage2D GLEW_GET_FUN(__glewCompressedTexSubImage2D) +#define glCompressedTexSubImage3D GLEW_GET_FUN(__glewCompressedTexSubImage3D) +#define glGetCompressedTexImage GLEW_GET_FUN(__glewGetCompressedTexImage) +#define glLoadTransposeMatrixd GLEW_GET_FUN(__glewLoadTransposeMatrixd) +#define glLoadTransposeMatrixf GLEW_GET_FUN(__glewLoadTransposeMatrixf) +#define glMultTransposeMatrixd GLEW_GET_FUN(__glewMultTransposeMatrixd) +#define glMultTransposeMatrixf GLEW_GET_FUN(__glewMultTransposeMatrixf) +#define glMultiTexCoord1d GLEW_GET_FUN(__glewMultiTexCoord1d) +#define glMultiTexCoord1dv GLEW_GET_FUN(__glewMultiTexCoord1dv) +#define glMultiTexCoord1f GLEW_GET_FUN(__glewMultiTexCoord1f) +#define glMultiTexCoord1fv GLEW_GET_FUN(__glewMultiTexCoord1fv) +#define glMultiTexCoord1i GLEW_GET_FUN(__glewMultiTexCoord1i) +#define glMultiTexCoord1iv GLEW_GET_FUN(__glewMultiTexCoord1iv) +#define glMultiTexCoord1s GLEW_GET_FUN(__glewMultiTexCoord1s) +#define glMultiTexCoord1sv GLEW_GET_FUN(__glewMultiTexCoord1sv) +#define glMultiTexCoord2d GLEW_GET_FUN(__glewMultiTexCoord2d) +#define glMultiTexCoord2dv GLEW_GET_FUN(__glewMultiTexCoord2dv) +#define glMultiTexCoord2f GLEW_GET_FUN(__glewMultiTexCoord2f) +#define glMultiTexCoord2fv GLEW_GET_FUN(__glewMultiTexCoord2fv) +#define glMultiTexCoord2i GLEW_GET_FUN(__glewMultiTexCoord2i) +#define glMultiTexCoord2iv GLEW_GET_FUN(__glewMultiTexCoord2iv) +#define glMultiTexCoord2s GLEW_GET_FUN(__glewMultiTexCoord2s) +#define glMultiTexCoord2sv GLEW_GET_FUN(__glewMultiTexCoord2sv) +#define glMultiTexCoord3d GLEW_GET_FUN(__glewMultiTexCoord3d) +#define glMultiTexCoord3dv GLEW_GET_FUN(__glewMultiTexCoord3dv) +#define glMultiTexCoord3f GLEW_GET_FUN(__glewMultiTexCoord3f) +#define glMultiTexCoord3fv GLEW_GET_FUN(__glewMultiTexCoord3fv) +#define glMultiTexCoord3i GLEW_GET_FUN(__glewMultiTexCoord3i) +#define glMultiTexCoord3iv GLEW_GET_FUN(__glewMultiTexCoord3iv) +#define glMultiTexCoord3s GLEW_GET_FUN(__glewMultiTexCoord3s) +#define glMultiTexCoord3sv GLEW_GET_FUN(__glewMultiTexCoord3sv) +#define glMultiTexCoord4d GLEW_GET_FUN(__glewMultiTexCoord4d) +#define glMultiTexCoord4dv GLEW_GET_FUN(__glewMultiTexCoord4dv) +#define glMultiTexCoord4f GLEW_GET_FUN(__glewMultiTexCoord4f) +#define glMultiTexCoord4fv GLEW_GET_FUN(__glewMultiTexCoord4fv) +#define glMultiTexCoord4i GLEW_GET_FUN(__glewMultiTexCoord4i) +#define glMultiTexCoord4iv GLEW_GET_FUN(__glewMultiTexCoord4iv) +#define glMultiTexCoord4s GLEW_GET_FUN(__glewMultiTexCoord4s) +#define glMultiTexCoord4sv GLEW_GET_FUN(__glewMultiTexCoord4sv) +#define glSampleCoverage GLEW_GET_FUN(__glewSampleCoverage) + +#define GLEW_VERSION_1_3 GLEW_GET_VAR(__GLEW_VERSION_1_3) + +#endif /* GL_VERSION_1_3 */ + +/* ----------------------------- GL_VERSION_1_4 ---------------------------- */ + +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 + +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_COLOR_SUM 0x8458 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_COMPARE_R_TO_TEXTURE 0x884E + +typedef void (GLAPIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const void *pointer); +typedef void (GLAPIENTRY * PFNGLFOGCOORDDPROC) (GLdouble coord); +typedef void (GLAPIENTRY * PFNGLFOGCOORDDVPROC) (const GLdouble *coord); +typedef void (GLAPIENTRY * PFNGLFOGCOORDFPROC) (GLfloat coord); +typedef void (GLAPIENTRY * PFNGLFOGCOORDFVPROC) (const GLfloat *coord); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const* indices, GLsizei drawcount); +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVPROC) (const GLdouble *p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVPROC) (const GLfloat *p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVPROC) (const GLint *p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVPROC) (const GLshort *p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVPROC) (const GLdouble *p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVPROC) (const GLfloat *p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVPROC) (const GLint *p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVPROC) (const GLshort *p); + +#define glBlendColor GLEW_GET_FUN(__glewBlendColor) +#define glBlendEquation GLEW_GET_FUN(__glewBlendEquation) +#define glBlendFuncSeparate GLEW_GET_FUN(__glewBlendFuncSeparate) +#define glFogCoordPointer GLEW_GET_FUN(__glewFogCoordPointer) +#define glFogCoordd GLEW_GET_FUN(__glewFogCoordd) +#define glFogCoorddv GLEW_GET_FUN(__glewFogCoorddv) +#define glFogCoordf GLEW_GET_FUN(__glewFogCoordf) +#define glFogCoordfv GLEW_GET_FUN(__glewFogCoordfv) +#define glMultiDrawArrays GLEW_GET_FUN(__glewMultiDrawArrays) +#define glMultiDrawElements GLEW_GET_FUN(__glewMultiDrawElements) +#define glPointParameterf GLEW_GET_FUN(__glewPointParameterf) +#define glPointParameterfv GLEW_GET_FUN(__glewPointParameterfv) +#define glPointParameteri GLEW_GET_FUN(__glewPointParameteri) +#define glPointParameteriv GLEW_GET_FUN(__glewPointParameteriv) +#define glSecondaryColor3b GLEW_GET_FUN(__glewSecondaryColor3b) +#define glSecondaryColor3bv GLEW_GET_FUN(__glewSecondaryColor3bv) +#define glSecondaryColor3d GLEW_GET_FUN(__glewSecondaryColor3d) +#define glSecondaryColor3dv GLEW_GET_FUN(__glewSecondaryColor3dv) +#define glSecondaryColor3f GLEW_GET_FUN(__glewSecondaryColor3f) +#define glSecondaryColor3fv GLEW_GET_FUN(__glewSecondaryColor3fv) +#define glSecondaryColor3i GLEW_GET_FUN(__glewSecondaryColor3i) +#define glSecondaryColor3iv GLEW_GET_FUN(__glewSecondaryColor3iv) +#define glSecondaryColor3s GLEW_GET_FUN(__glewSecondaryColor3s) +#define glSecondaryColor3sv GLEW_GET_FUN(__glewSecondaryColor3sv) +#define glSecondaryColor3ub GLEW_GET_FUN(__glewSecondaryColor3ub) +#define glSecondaryColor3ubv GLEW_GET_FUN(__glewSecondaryColor3ubv) +#define glSecondaryColor3ui GLEW_GET_FUN(__glewSecondaryColor3ui) +#define glSecondaryColor3uiv GLEW_GET_FUN(__glewSecondaryColor3uiv) +#define glSecondaryColor3us GLEW_GET_FUN(__glewSecondaryColor3us) +#define glSecondaryColor3usv GLEW_GET_FUN(__glewSecondaryColor3usv) +#define glSecondaryColorPointer GLEW_GET_FUN(__glewSecondaryColorPointer) +#define glWindowPos2d GLEW_GET_FUN(__glewWindowPos2d) +#define glWindowPos2dv GLEW_GET_FUN(__glewWindowPos2dv) +#define glWindowPos2f GLEW_GET_FUN(__glewWindowPos2f) +#define glWindowPos2fv GLEW_GET_FUN(__glewWindowPos2fv) +#define glWindowPos2i GLEW_GET_FUN(__glewWindowPos2i) +#define glWindowPos2iv GLEW_GET_FUN(__glewWindowPos2iv) +#define glWindowPos2s GLEW_GET_FUN(__glewWindowPos2s) +#define glWindowPos2sv GLEW_GET_FUN(__glewWindowPos2sv) +#define glWindowPos3d GLEW_GET_FUN(__glewWindowPos3d) +#define glWindowPos3dv GLEW_GET_FUN(__glewWindowPos3dv) +#define glWindowPos3f GLEW_GET_FUN(__glewWindowPos3f) +#define glWindowPos3fv GLEW_GET_FUN(__glewWindowPos3fv) +#define glWindowPos3i GLEW_GET_FUN(__glewWindowPos3i) +#define glWindowPos3iv GLEW_GET_FUN(__glewWindowPos3iv) +#define glWindowPos3s GLEW_GET_FUN(__glewWindowPos3s) +#define glWindowPos3sv GLEW_GET_FUN(__glewWindowPos3sv) + +#define GLEW_VERSION_1_4 GLEW_GET_VAR(__GLEW_VERSION_1_4) + +#endif /* GL_VERSION_1_4 */ + +/* ----------------------------- GL_VERSION_1_5 ---------------------------- */ + +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 + +#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE +#define GL_FOG_COORD GL_FOG_COORDINATE +#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING +#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER +#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE +#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE +#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE +#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA +#define GL_SRC0_RGB GL_SOURCE0_RGB +#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA +#define GL_SRC1_RGB GL_SOURCE1_RGB +#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA +#define GL_SRC2_RGB GL_SOURCE2_RGB +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 + +typedef ptrdiff_t GLintptr; +typedef ptrdiff_t GLsizeiptr; + +typedef void (GLAPIENTRY * PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); +typedef void (GLAPIENTRY * PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (GLAPIENTRY * PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void* data, GLenum usage); +typedef void (GLAPIENTRY * PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void* data); +typedef void (GLAPIENTRY * PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint* buffers); +typedef void (GLAPIENTRY * PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint* ids); +typedef void (GLAPIENTRY * PFNGLENDQUERYPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLGENBUFFERSPROC) (GLsizei n, GLuint* buffers); +typedef void (GLAPIENTRY * PFNGLGENQUERIESPROC) (GLsizei n, GLuint* ids); +typedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void** params); +typedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void* data); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISBUFFERPROC) (GLuint buffer); +typedef GLboolean (GLAPIENTRY * PFNGLISQUERYPROC) (GLuint id); +typedef void* (GLAPIENTRY * PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +typedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERPROC) (GLenum target); + +#define glBeginQuery GLEW_GET_FUN(__glewBeginQuery) +#define glBindBuffer GLEW_GET_FUN(__glewBindBuffer) +#define glBufferData GLEW_GET_FUN(__glewBufferData) +#define glBufferSubData GLEW_GET_FUN(__glewBufferSubData) +#define glDeleteBuffers GLEW_GET_FUN(__glewDeleteBuffers) +#define glDeleteQueries GLEW_GET_FUN(__glewDeleteQueries) +#define glEndQuery GLEW_GET_FUN(__glewEndQuery) +#define glGenBuffers GLEW_GET_FUN(__glewGenBuffers) +#define glGenQueries GLEW_GET_FUN(__glewGenQueries) +#define glGetBufferParameteriv GLEW_GET_FUN(__glewGetBufferParameteriv) +#define glGetBufferPointerv GLEW_GET_FUN(__glewGetBufferPointerv) +#define glGetBufferSubData GLEW_GET_FUN(__glewGetBufferSubData) +#define glGetQueryObjectiv GLEW_GET_FUN(__glewGetQueryObjectiv) +#define glGetQueryObjectuiv GLEW_GET_FUN(__glewGetQueryObjectuiv) +#define glGetQueryiv GLEW_GET_FUN(__glewGetQueryiv) +#define glIsBuffer GLEW_GET_FUN(__glewIsBuffer) +#define glIsQuery GLEW_GET_FUN(__glewIsQuery) +#define glMapBuffer GLEW_GET_FUN(__glewMapBuffer) +#define glUnmapBuffer GLEW_GET_FUN(__glewUnmapBuffer) + +#define GLEW_VERSION_1_5 GLEW_GET_VAR(__GLEW_VERSION_1_5) + +#endif /* GL_VERSION_1_5 */ + +/* ----------------------------- GL_VERSION_2_0 ---------------------------- */ + +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 + +#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_COORDS 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 + +typedef void (GLAPIENTRY * PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar* name); +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (GLAPIENTRY * PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef GLuint (GLAPIENTRY * PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROC) (GLenum type); +typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (GLAPIENTRY * PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (GLAPIENTRY * PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (GLAPIENTRY * PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum* bufs); +typedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +typedef void (GLAPIENTRY * PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders); +typedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar* name); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint* param); +typedef void (GLAPIENTRY * PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog); +typedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEPROC) (GLuint obj, GLsizei maxLength, GLsizei* length, GLchar* source); +typedef void (GLAPIENTRY * PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint* param); +typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar* name); +typedef void (GLAPIENTRY * PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void** pointer); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (GLAPIENTRY * PFNGLISSHADERPROC) (GLuint shader); +typedef void (GLAPIENTRY * PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (GLAPIENTRY * PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const* string, const GLint* length); +typedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +typedef void (GLAPIENTRY * PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (GLAPIENTRY * PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (GLAPIENTRY * PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (GLAPIENTRY * PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (GLAPIENTRY * PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (GLAPIENTRY * PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GLAPIENTRY * PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GLAPIENTRY * PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GLAPIENTRY * PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GLAPIENTRY * PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer); + +#define glAttachShader GLEW_GET_FUN(__glewAttachShader) +#define glBindAttribLocation GLEW_GET_FUN(__glewBindAttribLocation) +#define glBlendEquationSeparate GLEW_GET_FUN(__glewBlendEquationSeparate) +#define glCompileShader GLEW_GET_FUN(__glewCompileShader) +#define glCreateProgram GLEW_GET_FUN(__glewCreateProgram) +#define glCreateShader GLEW_GET_FUN(__glewCreateShader) +#define glDeleteProgram GLEW_GET_FUN(__glewDeleteProgram) +#define glDeleteShader GLEW_GET_FUN(__glewDeleteShader) +#define glDetachShader GLEW_GET_FUN(__glewDetachShader) +#define glDisableVertexAttribArray GLEW_GET_FUN(__glewDisableVertexAttribArray) +#define glDrawBuffers GLEW_GET_FUN(__glewDrawBuffers) +#define glEnableVertexAttribArray GLEW_GET_FUN(__glewEnableVertexAttribArray) +#define glGetActiveAttrib GLEW_GET_FUN(__glewGetActiveAttrib) +#define glGetActiveUniform GLEW_GET_FUN(__glewGetActiveUniform) +#define glGetAttachedShaders GLEW_GET_FUN(__glewGetAttachedShaders) +#define glGetAttribLocation GLEW_GET_FUN(__glewGetAttribLocation) +#define glGetProgramInfoLog GLEW_GET_FUN(__glewGetProgramInfoLog) +#define glGetProgramiv GLEW_GET_FUN(__glewGetProgramiv) +#define glGetShaderInfoLog GLEW_GET_FUN(__glewGetShaderInfoLog) +#define glGetShaderSource GLEW_GET_FUN(__glewGetShaderSource) +#define glGetShaderiv GLEW_GET_FUN(__glewGetShaderiv) +#define glGetUniformLocation GLEW_GET_FUN(__glewGetUniformLocation) +#define glGetUniformfv GLEW_GET_FUN(__glewGetUniformfv) +#define glGetUniformiv GLEW_GET_FUN(__glewGetUniformiv) +#define glGetVertexAttribPointerv GLEW_GET_FUN(__glewGetVertexAttribPointerv) +#define glGetVertexAttribdv GLEW_GET_FUN(__glewGetVertexAttribdv) +#define glGetVertexAttribfv GLEW_GET_FUN(__glewGetVertexAttribfv) +#define glGetVertexAttribiv GLEW_GET_FUN(__glewGetVertexAttribiv) +#define glIsProgram GLEW_GET_FUN(__glewIsProgram) +#define glIsShader GLEW_GET_FUN(__glewIsShader) +#define glLinkProgram GLEW_GET_FUN(__glewLinkProgram) +#define glShaderSource GLEW_GET_FUN(__glewShaderSource) +#define glStencilFuncSeparate GLEW_GET_FUN(__glewStencilFuncSeparate) +#define glStencilMaskSeparate GLEW_GET_FUN(__glewStencilMaskSeparate) +#define glStencilOpSeparate GLEW_GET_FUN(__glewStencilOpSeparate) +#define glUniform1f GLEW_GET_FUN(__glewUniform1f) +#define glUniform1fv GLEW_GET_FUN(__glewUniform1fv) +#define glUniform1i GLEW_GET_FUN(__glewUniform1i) +#define glUniform1iv GLEW_GET_FUN(__glewUniform1iv) +#define glUniform2f GLEW_GET_FUN(__glewUniform2f) +#define glUniform2fv GLEW_GET_FUN(__glewUniform2fv) +#define glUniform2i GLEW_GET_FUN(__glewUniform2i) +#define glUniform2iv GLEW_GET_FUN(__glewUniform2iv) +#define glUniform3f GLEW_GET_FUN(__glewUniform3f) +#define glUniform3fv GLEW_GET_FUN(__glewUniform3fv) +#define glUniform3i GLEW_GET_FUN(__glewUniform3i) +#define glUniform3iv GLEW_GET_FUN(__glewUniform3iv) +#define glUniform4f GLEW_GET_FUN(__glewUniform4f) +#define glUniform4fv GLEW_GET_FUN(__glewUniform4fv) +#define glUniform4i GLEW_GET_FUN(__glewUniform4i) +#define glUniform4iv GLEW_GET_FUN(__glewUniform4iv) +#define glUniformMatrix2fv GLEW_GET_FUN(__glewUniformMatrix2fv) +#define glUniformMatrix3fv GLEW_GET_FUN(__glewUniformMatrix3fv) +#define glUniformMatrix4fv GLEW_GET_FUN(__glewUniformMatrix4fv) +#define glUseProgram GLEW_GET_FUN(__glewUseProgram) +#define glValidateProgram GLEW_GET_FUN(__glewValidateProgram) +#define glVertexAttrib1d GLEW_GET_FUN(__glewVertexAttrib1d) +#define glVertexAttrib1dv GLEW_GET_FUN(__glewVertexAttrib1dv) +#define glVertexAttrib1f GLEW_GET_FUN(__glewVertexAttrib1f) +#define glVertexAttrib1fv GLEW_GET_FUN(__glewVertexAttrib1fv) +#define glVertexAttrib1s GLEW_GET_FUN(__glewVertexAttrib1s) +#define glVertexAttrib1sv GLEW_GET_FUN(__glewVertexAttrib1sv) +#define glVertexAttrib2d GLEW_GET_FUN(__glewVertexAttrib2d) +#define glVertexAttrib2dv GLEW_GET_FUN(__glewVertexAttrib2dv) +#define glVertexAttrib2f GLEW_GET_FUN(__glewVertexAttrib2f) +#define glVertexAttrib2fv GLEW_GET_FUN(__glewVertexAttrib2fv) +#define glVertexAttrib2s GLEW_GET_FUN(__glewVertexAttrib2s) +#define glVertexAttrib2sv GLEW_GET_FUN(__glewVertexAttrib2sv) +#define glVertexAttrib3d GLEW_GET_FUN(__glewVertexAttrib3d) +#define glVertexAttrib3dv GLEW_GET_FUN(__glewVertexAttrib3dv) +#define glVertexAttrib3f GLEW_GET_FUN(__glewVertexAttrib3f) +#define glVertexAttrib3fv GLEW_GET_FUN(__glewVertexAttrib3fv) +#define glVertexAttrib3s GLEW_GET_FUN(__glewVertexAttrib3s) +#define glVertexAttrib3sv GLEW_GET_FUN(__glewVertexAttrib3sv) +#define glVertexAttrib4Nbv GLEW_GET_FUN(__glewVertexAttrib4Nbv) +#define glVertexAttrib4Niv GLEW_GET_FUN(__glewVertexAttrib4Niv) +#define glVertexAttrib4Nsv GLEW_GET_FUN(__glewVertexAttrib4Nsv) +#define glVertexAttrib4Nub GLEW_GET_FUN(__glewVertexAttrib4Nub) +#define glVertexAttrib4Nubv GLEW_GET_FUN(__glewVertexAttrib4Nubv) +#define glVertexAttrib4Nuiv GLEW_GET_FUN(__glewVertexAttrib4Nuiv) +#define glVertexAttrib4Nusv GLEW_GET_FUN(__glewVertexAttrib4Nusv) +#define glVertexAttrib4bv GLEW_GET_FUN(__glewVertexAttrib4bv) +#define glVertexAttrib4d GLEW_GET_FUN(__glewVertexAttrib4d) +#define glVertexAttrib4dv GLEW_GET_FUN(__glewVertexAttrib4dv) +#define glVertexAttrib4f GLEW_GET_FUN(__glewVertexAttrib4f) +#define glVertexAttrib4fv GLEW_GET_FUN(__glewVertexAttrib4fv) +#define glVertexAttrib4iv GLEW_GET_FUN(__glewVertexAttrib4iv) +#define glVertexAttrib4s GLEW_GET_FUN(__glewVertexAttrib4s) +#define glVertexAttrib4sv GLEW_GET_FUN(__glewVertexAttrib4sv) +#define glVertexAttrib4ubv GLEW_GET_FUN(__glewVertexAttrib4ubv) +#define glVertexAttrib4uiv GLEW_GET_FUN(__glewVertexAttrib4uiv) +#define glVertexAttrib4usv GLEW_GET_FUN(__glewVertexAttrib4usv) +#define glVertexAttribPointer GLEW_GET_FUN(__glewVertexAttribPointer) + +#define GLEW_VERSION_2_0 GLEW_GET_VAR(__GLEW_VERSION_2_0) + +#endif /* GL_VERSION_2_0 */ + +/* ----------------------------- GL_VERSION_2_1 ---------------------------- */ + +#ifndef GL_VERSION_2_1 +#define GL_VERSION_2_1 1 + +#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F +#define GL_PIXEL_PACK_BUFFER 0x88EB +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF +#define GL_FLOAT_MAT2x3 0x8B65 +#define GL_FLOAT_MAT2x4 0x8B66 +#define GL_FLOAT_MAT3x2 0x8B67 +#define GL_FLOAT_MAT3x4 0x8B68 +#define GL_FLOAT_MAT4x2 0x8B69 +#define GL_FLOAT_MAT4x3 0x8B6A +#define GL_SRGB 0x8C40 +#define GL_SRGB8 0x8C41 +#define GL_SRGB_ALPHA 0x8C42 +#define GL_SRGB8_ALPHA8 0x8C43 +#define GL_SLUMINANCE_ALPHA 0x8C44 +#define GL_SLUMINANCE8_ALPHA8 0x8C45 +#define GL_SLUMINANCE 0x8C46 +#define GL_SLUMINANCE8 0x8C47 +#define GL_COMPRESSED_SRGB 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 +#define GL_COMPRESSED_SLUMINANCE 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B + +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + +#define glUniformMatrix2x3fv GLEW_GET_FUN(__glewUniformMatrix2x3fv) +#define glUniformMatrix2x4fv GLEW_GET_FUN(__glewUniformMatrix2x4fv) +#define glUniformMatrix3x2fv GLEW_GET_FUN(__glewUniformMatrix3x2fv) +#define glUniformMatrix3x4fv GLEW_GET_FUN(__glewUniformMatrix3x4fv) +#define glUniformMatrix4x2fv GLEW_GET_FUN(__glewUniformMatrix4x2fv) +#define glUniformMatrix4x3fv GLEW_GET_FUN(__glewUniformMatrix4x3fv) + +#define GLEW_VERSION_2_1 GLEW_GET_VAR(__GLEW_VERSION_2_1) + +#endif /* GL_VERSION_2_1 */ + +/* ----------------------------- GL_VERSION_3_0 ---------------------------- */ + +#ifndef GL_VERSION_3_0 +#define GL_VERSION_3_0 1 + +#define GL_CLIP_DISTANCE0 GL_CLIP_PLANE0 +#define GL_CLIP_DISTANCE1 GL_CLIP_PLANE1 +#define GL_CLIP_DISTANCE2 GL_CLIP_PLANE2 +#define GL_CLIP_DISTANCE3 GL_CLIP_PLANE3 +#define GL_CLIP_DISTANCE4 GL_CLIP_PLANE4 +#define GL_CLIP_DISTANCE5 GL_CLIP_PLANE5 +#define GL_COMPARE_REF_TO_TEXTURE GL_COMPARE_R_TO_TEXTURE_ARB +#define GL_MAX_CLIP_DISTANCES GL_MAX_CLIP_PLANES +#define GL_MAX_VARYING_COMPONENTS GL_MAX_VARYING_FLOATS +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 +#define GL_MAJOR_VERSION 0x821B +#define GL_MINOR_VERSION 0x821C +#define GL_NUM_EXTENSIONS 0x821D +#define GL_CONTEXT_FLAGS 0x821E +#define GL_DEPTH_BUFFER 0x8223 +#define GL_STENCIL_BUFFER 0x8224 +#define GL_RGBA32F 0x8814 +#define GL_RGB32F 0x8815 +#define GL_RGBA16F 0x881A +#define GL_RGB16F 0x881B +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD +#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF +#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 +#define GL_CLAMP_VERTEX_COLOR 0x891A +#define GL_CLAMP_FRAGMENT_COLOR 0x891B +#define GL_CLAMP_READ_COLOR 0x891C +#define GL_FIXED_ONLY 0x891D +#define GL_TEXTURE_RED_TYPE 0x8C10 +#define GL_TEXTURE_GREEN_TYPE 0x8C11 +#define GL_TEXTURE_BLUE_TYPE 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE 0x8C13 +#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 +#define GL_TEXTURE_DEPTH_TYPE 0x8C16 +#define GL_TEXTURE_1D_ARRAY 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D +#define GL_R11F_G11F_B10F 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B +#define GL_RGB9_E5 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E +#define GL_TEXTURE_SHARED_SIZE 0x8C3F +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 +#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 +#define GL_PRIMITIVES_GENERATED 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 +#define GL_RASTERIZER_DISCARD 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B +#define GL_INTERLEAVED_ATTRIBS 0x8C8C +#define GL_SEPARATE_ATTRIBS 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F +#define GL_RGBA32UI 0x8D70 +#define GL_RGB32UI 0x8D71 +#define GL_RGBA16UI 0x8D76 +#define GL_RGB16UI 0x8D77 +#define GL_RGBA8UI 0x8D7C +#define GL_RGB8UI 0x8D7D +#define GL_RGBA32I 0x8D82 +#define GL_RGB32I 0x8D83 +#define GL_RGBA16I 0x8D88 +#define GL_RGB16I 0x8D89 +#define GL_RGBA8I 0x8D8E +#define GL_RGB8I 0x8D8F +#define GL_RED_INTEGER 0x8D94 +#define GL_GREEN_INTEGER 0x8D95 +#define GL_BLUE_INTEGER 0x8D96 +#define GL_ALPHA_INTEGER 0x8D97 +#define GL_RGB_INTEGER 0x8D98 +#define GL_RGBA_INTEGER 0x8D99 +#define GL_BGR_INTEGER 0x8D9A +#define GL_BGRA_INTEGER 0x8D9B +#define GL_SAMPLER_1D_ARRAY 0x8DC0 +#define GL_SAMPLER_2D_ARRAY 0x8DC1 +#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 +#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 +#define GL_UNSIGNED_INT_VEC2 0x8DC6 +#define GL_UNSIGNED_INT_VEC3 0x8DC7 +#define GL_UNSIGNED_INT_VEC4 0x8DC8 +#define GL_INT_SAMPLER_1D 0x8DC9 +#define GL_INT_SAMPLER_2D 0x8DCA +#define GL_INT_SAMPLER_3D 0x8DCB +#define GL_INT_SAMPLER_CUBE 0x8DCC +#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE +#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF +#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 +#define GL_QUERY_WAIT 0x8E13 +#define GL_QUERY_NO_WAIT 0x8E14 +#define GL_QUERY_BY_REGION_WAIT 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 + +typedef void (GLAPIENTRY * PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); +typedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode); +typedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint colorNumber, const GLchar* name); +typedef void (GLAPIENTRY * PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); +typedef void (GLAPIENTRY * PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawBuffer, GLfloat depth, GLint stencil); +typedef void (GLAPIENTRY * PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawBuffer, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawBuffer, const GLint* value); +typedef void (GLAPIENTRY * PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawBuffer, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLCOLORMASKIPROC) (GLuint buf, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +typedef void (GLAPIENTRY * PFNGLDISABLEIPROC) (GLenum cap, GLuint index); +typedef void (GLAPIENTRY * PFNGLENABLEIPROC) (GLenum cap, GLuint index); +typedef void (GLAPIENTRY * PFNGLENDCONDITIONALRENDERPROC) (void); +typedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKPROC) (void); +typedef void (GLAPIENTRY * PFNGLGETBOOLEANI_VPROC) (GLenum pname, GLuint index, GLboolean* data); +typedef GLint (GLAPIENTRY * PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar* name); +typedef const GLubyte* (GLAPIENTRY * PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); +typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); +typedef void (GLAPIENTRY * PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISENABLEDIPROC) (GLenum cap, GLuint index); +typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint* params); +typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode); +typedef void (GLAPIENTRY * PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0); +typedef void (GLAPIENTRY * PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1); +typedef void (GLAPIENTRY * PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (GLAPIENTRY * PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (GLAPIENTRY * PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint v0); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint* v0); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint v0); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint* v0); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint v0, GLint v1); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint* v0); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint v0, GLuint v1); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint* v0); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint v0, GLint v1, GLint v2); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint* v0); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint v0, GLuint v1, GLuint v2); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint* v0); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte* v0); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint* v0); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort* v0); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte* v0); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint* v0); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort* v0); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void*pointer); + +#define glBeginConditionalRender GLEW_GET_FUN(__glewBeginConditionalRender) +#define glBeginTransformFeedback GLEW_GET_FUN(__glewBeginTransformFeedback) +#define glBindFragDataLocation GLEW_GET_FUN(__glewBindFragDataLocation) +#define glClampColor GLEW_GET_FUN(__glewClampColor) +#define glClearBufferfi GLEW_GET_FUN(__glewClearBufferfi) +#define glClearBufferfv GLEW_GET_FUN(__glewClearBufferfv) +#define glClearBufferiv GLEW_GET_FUN(__glewClearBufferiv) +#define glClearBufferuiv GLEW_GET_FUN(__glewClearBufferuiv) +#define glColorMaski GLEW_GET_FUN(__glewColorMaski) +#define glDisablei GLEW_GET_FUN(__glewDisablei) +#define glEnablei GLEW_GET_FUN(__glewEnablei) +#define glEndConditionalRender GLEW_GET_FUN(__glewEndConditionalRender) +#define glEndTransformFeedback GLEW_GET_FUN(__glewEndTransformFeedback) +#define glGetBooleani_v GLEW_GET_FUN(__glewGetBooleani_v) +#define glGetFragDataLocation GLEW_GET_FUN(__glewGetFragDataLocation) +#define glGetStringi GLEW_GET_FUN(__glewGetStringi) +#define glGetTexParameterIiv GLEW_GET_FUN(__glewGetTexParameterIiv) +#define glGetTexParameterIuiv GLEW_GET_FUN(__glewGetTexParameterIuiv) +#define glGetTransformFeedbackVarying GLEW_GET_FUN(__glewGetTransformFeedbackVarying) +#define glGetUniformuiv GLEW_GET_FUN(__glewGetUniformuiv) +#define glGetVertexAttribIiv GLEW_GET_FUN(__glewGetVertexAttribIiv) +#define glGetVertexAttribIuiv GLEW_GET_FUN(__glewGetVertexAttribIuiv) +#define glIsEnabledi GLEW_GET_FUN(__glewIsEnabledi) +#define glTexParameterIiv GLEW_GET_FUN(__glewTexParameterIiv) +#define glTexParameterIuiv GLEW_GET_FUN(__glewTexParameterIuiv) +#define glTransformFeedbackVaryings GLEW_GET_FUN(__glewTransformFeedbackVaryings) +#define glUniform1ui GLEW_GET_FUN(__glewUniform1ui) +#define glUniform1uiv GLEW_GET_FUN(__glewUniform1uiv) +#define glUniform2ui GLEW_GET_FUN(__glewUniform2ui) +#define glUniform2uiv GLEW_GET_FUN(__glewUniform2uiv) +#define glUniform3ui GLEW_GET_FUN(__glewUniform3ui) +#define glUniform3uiv GLEW_GET_FUN(__glewUniform3uiv) +#define glUniform4ui GLEW_GET_FUN(__glewUniform4ui) +#define glUniform4uiv GLEW_GET_FUN(__glewUniform4uiv) +#define glVertexAttribI1i GLEW_GET_FUN(__glewVertexAttribI1i) +#define glVertexAttribI1iv GLEW_GET_FUN(__glewVertexAttribI1iv) +#define glVertexAttribI1ui GLEW_GET_FUN(__glewVertexAttribI1ui) +#define glVertexAttribI1uiv GLEW_GET_FUN(__glewVertexAttribI1uiv) +#define glVertexAttribI2i GLEW_GET_FUN(__glewVertexAttribI2i) +#define glVertexAttribI2iv GLEW_GET_FUN(__glewVertexAttribI2iv) +#define glVertexAttribI2ui GLEW_GET_FUN(__glewVertexAttribI2ui) +#define glVertexAttribI2uiv GLEW_GET_FUN(__glewVertexAttribI2uiv) +#define glVertexAttribI3i GLEW_GET_FUN(__glewVertexAttribI3i) +#define glVertexAttribI3iv GLEW_GET_FUN(__glewVertexAttribI3iv) +#define glVertexAttribI3ui GLEW_GET_FUN(__glewVertexAttribI3ui) +#define glVertexAttribI3uiv GLEW_GET_FUN(__glewVertexAttribI3uiv) +#define glVertexAttribI4bv GLEW_GET_FUN(__glewVertexAttribI4bv) +#define glVertexAttribI4i GLEW_GET_FUN(__glewVertexAttribI4i) +#define glVertexAttribI4iv GLEW_GET_FUN(__glewVertexAttribI4iv) +#define glVertexAttribI4sv GLEW_GET_FUN(__glewVertexAttribI4sv) +#define glVertexAttribI4ubv GLEW_GET_FUN(__glewVertexAttribI4ubv) +#define glVertexAttribI4ui GLEW_GET_FUN(__glewVertexAttribI4ui) +#define glVertexAttribI4uiv GLEW_GET_FUN(__glewVertexAttribI4uiv) +#define glVertexAttribI4usv GLEW_GET_FUN(__glewVertexAttribI4usv) +#define glVertexAttribIPointer GLEW_GET_FUN(__glewVertexAttribIPointer) + +#define GLEW_VERSION_3_0 GLEW_GET_VAR(__GLEW_VERSION_3_0) + +#endif /* GL_VERSION_3_0 */ + +/* ----------------------------- GL_VERSION_3_1 ---------------------------- */ + +#ifndef GL_VERSION_3_1 +#define GL_VERSION_3_1 1 + +#define GL_TEXTURE_RECTANGLE 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 +#define GL_SAMPLER_2D_RECT 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 +#define GL_TEXTURE_BUFFER 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E +#define GL_SAMPLER_BUFFER 0x8DC2 +#define GL_INT_SAMPLER_2D_RECT 0x8DCD +#define GL_INT_SAMPLER_BUFFER 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 +#define GL_RED_SNORM 0x8F90 +#define GL_RG_SNORM 0x8F91 +#define GL_RGB_SNORM 0x8F92 +#define GL_RGBA_SNORM 0x8F93 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGB8_SNORM 0x8F96 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM 0x8F98 +#define GL_RG16_SNORM 0x8F99 +#define GL_RGB16_SNORM 0x8F9A +#define GL_RGBA16_SNORM 0x8F9B +#define GL_SIGNED_NORMALIZED 0x8F9C +#define GL_PRIMITIVE_RESTART 0x8F9D +#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E +#define GL_BUFFER_ACCESS_FLAGS 0x911F +#define GL_BUFFER_MAP_LENGTH 0x9120 +#define GL_BUFFER_MAP_OFFSET 0x9121 + +typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint buffer); +typedef void (GLAPIENTRY * PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalFormat, GLuint buffer); + +#define glDrawArraysInstanced GLEW_GET_FUN(__glewDrawArraysInstanced) +#define glDrawElementsInstanced GLEW_GET_FUN(__glewDrawElementsInstanced) +#define glPrimitiveRestartIndex GLEW_GET_FUN(__glewPrimitiveRestartIndex) +#define glTexBuffer GLEW_GET_FUN(__glewTexBuffer) + +#define GLEW_VERSION_3_1 GLEW_GET_VAR(__GLEW_VERSION_3_1) + +#endif /* GL_VERSION_3_1 */ + +/* ----------------------------- GL_VERSION_3_2 ---------------------------- */ + +#ifndef GL_VERSION_3_2 +#define GL_VERSION_3_2 1 + +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define GL_LINES_ADJACENCY 0x000A +#define GL_LINE_STRIP_ADJACENCY 0x000B +#define GL_TRIANGLES_ADJACENCY 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D +#define GL_PROGRAM_POINT_SIZE 0x8642 +#define GL_GEOMETRY_VERTICES_OUT 0x8916 +#define GL_GEOMETRY_INPUT_TYPE 0x8917 +#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 +#define GL_GEOMETRY_SHADER 0x8DD9 +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 +#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 +#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 +#define GL_CONTEXT_PROFILE_MASK 0x9126 + +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum value, GLint64 * data); +typedef void (GLAPIENTRY * PFNGLGETINTEGER64I_VPROC) (GLenum pname, GLuint index, GLint64 * data); + +#define glFramebufferTexture GLEW_GET_FUN(__glewFramebufferTexture) +#define glGetBufferParameteri64v GLEW_GET_FUN(__glewGetBufferParameteri64v) +#define glGetInteger64i_v GLEW_GET_FUN(__glewGetInteger64i_v) + +#define GLEW_VERSION_3_2 GLEW_GET_VAR(__GLEW_VERSION_3_2) + +#endif /* GL_VERSION_3_2 */ + +/* ----------------------------- GL_VERSION_3_3 ---------------------------- */ + +#ifndef GL_VERSION_3_3 +#define GL_VERSION_3_3 1 + +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE +#define GL_RGB10_A2UI 0x906F + +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); + +#define glVertexAttribDivisor GLEW_GET_FUN(__glewVertexAttribDivisor) + +#define GLEW_VERSION_3_3 GLEW_GET_VAR(__GLEW_VERSION_3_3) + +#endif /* GL_VERSION_3_3 */ + +/* ----------------------------- GL_VERSION_4_0 ---------------------------- */ + +#ifndef GL_VERSION_4_0 +#define GL_VERSION_4_0 1 + +#define GL_SAMPLE_SHADING 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F +#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS 0x8F9F +#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F + +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); +typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (GLAPIENTRY * PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (GLAPIENTRY * PFNGLMINSAMPLESHADINGPROC) (GLclampf value); + +#define glBlendEquationSeparatei GLEW_GET_FUN(__glewBlendEquationSeparatei) +#define glBlendEquationi GLEW_GET_FUN(__glewBlendEquationi) +#define glBlendFuncSeparatei GLEW_GET_FUN(__glewBlendFuncSeparatei) +#define glBlendFunci GLEW_GET_FUN(__glewBlendFunci) +#define glMinSampleShading GLEW_GET_FUN(__glewMinSampleShading) + +#define GLEW_VERSION_4_0 GLEW_GET_VAR(__GLEW_VERSION_4_0) + +#endif /* GL_VERSION_4_0 */ + +/* ----------------------------- GL_VERSION_4_1 ---------------------------- */ + +#ifndef GL_VERSION_4_1 +#define GL_VERSION_4_1 1 + +#define GLEW_VERSION_4_1 GLEW_GET_VAR(__GLEW_VERSION_4_1) + +#endif /* GL_VERSION_4_1 */ + +/* ----------------------------- GL_VERSION_4_2 ---------------------------- */ + +#ifndef GL_VERSION_4_2 +#define GL_VERSION_4_2 1 + +#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 +#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 +#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F +#define GL_COPY_READ_BUFFER_BINDING 0x8F36 +#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 + +#define GLEW_VERSION_4_2 GLEW_GET_VAR(__GLEW_VERSION_4_2) + +#endif /* GL_VERSION_4_2 */ + +/* ----------------------------- GL_VERSION_4_3 ---------------------------- */ + +#ifndef GL_VERSION_4_3 +#define GL_VERSION_4_3 1 + +#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 +#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E + +#define GLEW_VERSION_4_3 GLEW_GET_VAR(__GLEW_VERSION_4_3) + +#endif /* GL_VERSION_4_3 */ + +/* ----------------------------- GL_VERSION_4_4 ---------------------------- */ + +#ifndef GL_VERSION_4_4 +#define GL_VERSION_4_4 1 + +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 +#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5 +#define GL_TEXTURE_BUFFER_BINDING 0x8C2A + +#define GLEW_VERSION_4_4 GLEW_GET_VAR(__GLEW_VERSION_4_4) + +#endif /* GL_VERSION_4_4 */ + +/* ----------------------------- GL_VERSION_4_5 ---------------------------- */ + +#ifndef GL_VERSION_4_5 +#define GL_VERSION_4_5 1 + +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004 + +typedef GLenum (GLAPIENTRY * PFNGLGETGRAPHICSRESETSTATUSPROC) (void); +typedef void (GLAPIENTRY * PFNGLGETNCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLsizei bufSize, GLvoid *pixels); +typedef void (GLAPIENTRY * PFNGLGETNTEXIMAGEPROC) (GLenum tex, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *pixels); +typedef void (GLAPIENTRY * PFNGLGETNUNIFORMDVPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); + +#define glGetGraphicsResetStatus GLEW_GET_FUN(__glewGetGraphicsResetStatus) +#define glGetnCompressedTexImage GLEW_GET_FUN(__glewGetnCompressedTexImage) +#define glGetnTexImage GLEW_GET_FUN(__glewGetnTexImage) +#define glGetnUniformdv GLEW_GET_FUN(__glewGetnUniformdv) + +#define GLEW_VERSION_4_5 GLEW_GET_VAR(__GLEW_VERSION_4_5) + +#endif /* GL_VERSION_4_5 */ + +/* -------------------------- GL_3DFX_multisample -------------------------- */ + +#ifndef GL_3DFX_multisample +#define GL_3DFX_multisample 1 + +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 + +#define GLEW_3DFX_multisample GLEW_GET_VAR(__GLEW_3DFX_multisample) + +#endif /* GL_3DFX_multisample */ + +/* ---------------------------- GL_3DFX_tbuffer ---------------------------- */ + +#ifndef GL_3DFX_tbuffer +#define GL_3DFX_tbuffer 1 + +typedef void (GLAPIENTRY * PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); + +#define glTbufferMask3DFX GLEW_GET_FUN(__glewTbufferMask3DFX) + +#define GLEW_3DFX_tbuffer GLEW_GET_VAR(__GLEW_3DFX_tbuffer) + +#endif /* GL_3DFX_tbuffer */ + +/* -------------------- GL_3DFX_texture_compression_FXT1 ------------------- */ + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_3DFX_texture_compression_FXT1 1 + +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 + +#define GLEW_3DFX_texture_compression_FXT1 GLEW_GET_VAR(__GLEW_3DFX_texture_compression_FXT1) + +#endif /* GL_3DFX_texture_compression_FXT1 */ + +/* ----------------------- GL_AMD_blend_minmax_factor ---------------------- */ + +#ifndef GL_AMD_blend_minmax_factor +#define GL_AMD_blend_minmax_factor 1 + +#define GL_FACTOR_MIN_AMD 0x901C +#define GL_FACTOR_MAX_AMD 0x901D + +#define GLEW_AMD_blend_minmax_factor GLEW_GET_VAR(__GLEW_AMD_blend_minmax_factor) + +#endif /* GL_AMD_blend_minmax_factor */ + +/* ----------------------- GL_AMD_conservative_depth ----------------------- */ + +#ifndef GL_AMD_conservative_depth +#define GL_AMD_conservative_depth 1 + +#define GLEW_AMD_conservative_depth GLEW_GET_VAR(__GLEW_AMD_conservative_depth) + +#endif /* GL_AMD_conservative_depth */ + +/* -------------------------- GL_AMD_debug_output -------------------------- */ + +#ifndef GL_AMD_debug_output +#define GL_AMD_debug_output 1 + +#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147 +#define GL_DEBUG_SEVERITY_LOW_AMD 0x9148 +#define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149 +#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A +#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B +#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C +#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D +#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E +#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F +#define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150 + +typedef void (GLAPIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, void* userParam); + +typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, void *userParam); +typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled); +typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar* buf); +typedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum* categories, GLuint* severities, GLuint* ids, GLsizei* lengths, GLchar* message); + +#define glDebugMessageCallbackAMD GLEW_GET_FUN(__glewDebugMessageCallbackAMD) +#define glDebugMessageEnableAMD GLEW_GET_FUN(__glewDebugMessageEnableAMD) +#define glDebugMessageInsertAMD GLEW_GET_FUN(__glewDebugMessageInsertAMD) +#define glGetDebugMessageLogAMD GLEW_GET_FUN(__glewGetDebugMessageLogAMD) + +#define GLEW_AMD_debug_output GLEW_GET_VAR(__GLEW_AMD_debug_output) + +#endif /* GL_AMD_debug_output */ + +/* ---------------------- GL_AMD_depth_clamp_separate ---------------------- */ + +#ifndef GL_AMD_depth_clamp_separate +#define GL_AMD_depth_clamp_separate 1 + +#define GL_DEPTH_CLAMP_NEAR_AMD 0x901E +#define GL_DEPTH_CLAMP_FAR_AMD 0x901F + +#define GLEW_AMD_depth_clamp_separate GLEW_GET_VAR(__GLEW_AMD_depth_clamp_separate) + +#endif /* GL_AMD_depth_clamp_separate */ + +/* ----------------------- GL_AMD_draw_buffers_blend ----------------------- */ + +#ifndef GL_AMD_draw_buffers_blend +#define GL_AMD_draw_buffers_blend 1 + +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode); +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (GLAPIENTRY * PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); + +#define glBlendEquationIndexedAMD GLEW_GET_FUN(__glewBlendEquationIndexedAMD) +#define glBlendEquationSeparateIndexedAMD GLEW_GET_FUN(__glewBlendEquationSeparateIndexedAMD) +#define glBlendFuncIndexedAMD GLEW_GET_FUN(__glewBlendFuncIndexedAMD) +#define glBlendFuncSeparateIndexedAMD GLEW_GET_FUN(__glewBlendFuncSeparateIndexedAMD) + +#define GLEW_AMD_draw_buffers_blend GLEW_GET_VAR(__GLEW_AMD_draw_buffers_blend) + +#endif /* GL_AMD_draw_buffers_blend */ + +/* --------------------------- GL_AMD_gcn_shader --------------------------- */ + +#ifndef GL_AMD_gcn_shader +#define GL_AMD_gcn_shader 1 + +#define GLEW_AMD_gcn_shader GLEW_GET_VAR(__GLEW_AMD_gcn_shader) + +#endif /* GL_AMD_gcn_shader */ + +/* ------------------------ GL_AMD_gpu_shader_int64 ------------------------ */ + +#ifndef GL_AMD_gpu_shader_int64 +#define GL_AMD_gpu_shader_int64 1 + +#define GLEW_AMD_gpu_shader_int64 GLEW_GET_VAR(__GLEW_AMD_gpu_shader_int64) + +#endif /* GL_AMD_gpu_shader_int64 */ + +/* ---------------------- GL_AMD_interleaved_elements ---------------------- */ + +#ifndef GL_AMD_interleaved_elements +#define GL_AMD_interleaved_elements 1 + +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_RG8UI 0x8238 +#define GL_RG16UI 0x823A +#define GL_RGBA8UI 0x8D7C +#define GL_VERTEX_ELEMENT_SWIZZLE_AMD 0x91A4 +#define GL_VERTEX_ID_SWIZZLE_AMD 0x91A5 + +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPARAMETERIAMDPROC) (GLuint index, GLenum pname, GLint param); + +#define glVertexAttribParameteriAMD GLEW_GET_FUN(__glewVertexAttribParameteriAMD) + +#define GLEW_AMD_interleaved_elements GLEW_GET_VAR(__GLEW_AMD_interleaved_elements) + +#endif /* GL_AMD_interleaved_elements */ + +/* ----------------------- GL_AMD_multi_draw_indirect ---------------------- */ + +#ifndef GL_AMD_multi_draw_indirect +#define GL_AMD_multi_draw_indirect 1 + +typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC) (GLenum mode, const void *indirect, GLsizei primcount, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei primcount, GLsizei stride); + +#define glMultiDrawArraysIndirectAMD GLEW_GET_FUN(__glewMultiDrawArraysIndirectAMD) +#define glMultiDrawElementsIndirectAMD GLEW_GET_FUN(__glewMultiDrawElementsIndirectAMD) + +#define GLEW_AMD_multi_draw_indirect GLEW_GET_VAR(__GLEW_AMD_multi_draw_indirect) + +#endif /* GL_AMD_multi_draw_indirect */ + +/* ------------------------- GL_AMD_name_gen_delete ------------------------ */ + +#ifndef GL_AMD_name_gen_delete +#define GL_AMD_name_gen_delete 1 + +#define GL_DATA_BUFFER_AMD 0x9151 +#define GL_PERFORMANCE_MONITOR_AMD 0x9152 +#define GL_QUERY_OBJECT_AMD 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154 +#define GL_SAMPLER_OBJECT_AMD 0x9155 + +typedef void (GLAPIENTRY * PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint* names); +typedef void (GLAPIENTRY * PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint* names); +typedef GLboolean (GLAPIENTRY * PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name); + +#define glDeleteNamesAMD GLEW_GET_FUN(__glewDeleteNamesAMD) +#define glGenNamesAMD GLEW_GET_FUN(__glewGenNamesAMD) +#define glIsNameAMD GLEW_GET_FUN(__glewIsNameAMD) + +#define GLEW_AMD_name_gen_delete GLEW_GET_VAR(__GLEW_AMD_name_gen_delete) + +#endif /* GL_AMD_name_gen_delete */ + +/* ---------------------- GL_AMD_occlusion_query_event --------------------- */ + +#ifndef GL_AMD_occlusion_query_event +#define GL_AMD_occlusion_query_event 1 + +#define GL_QUERY_DEPTH_PASS_EVENT_BIT_AMD 0x00000001 +#define GL_QUERY_DEPTH_FAIL_EVENT_BIT_AMD 0x00000002 +#define GL_QUERY_STENCIL_FAIL_EVENT_BIT_AMD 0x00000004 +#define GL_QUERY_DEPTH_BOUNDS_FAIL_EVENT_BIT_AMD 0x00000008 +#define GL_OCCLUSION_QUERY_EVENT_MASK_AMD 0x874F +#define GL_QUERY_ALL_EVENT_BITS_AMD 0xFFFFFFFF + +typedef void (GLAPIENTRY * PFNGLQUERYOBJECTPARAMETERUIAMDPROC) (GLenum target, GLuint id, GLenum pname, GLuint param); + +#define glQueryObjectParameteruiAMD GLEW_GET_FUN(__glewQueryObjectParameteruiAMD) + +#define GLEW_AMD_occlusion_query_event GLEW_GET_VAR(__GLEW_AMD_occlusion_query_event) + +#endif /* GL_AMD_occlusion_query_event */ + +/* ----------------------- GL_AMD_performance_monitor ---------------------- */ + +#ifndef GL_AMD_performance_monitor +#define GL_AMD_performance_monitor 1 + +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 + +typedef void (GLAPIENTRY * PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GLAPIENTRY * PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint* monitors); +typedef void (GLAPIENTRY * PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GLAPIENTRY * PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint* monitors); +typedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint* data, GLint *bytesWritten); +typedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data); +typedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei* length, GLchar *counterString); +typedef void (GLAPIENTRY * PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint* numCounters, GLint *maxActiveCounters, GLsizei countersSize, GLuint *counters); +typedef void (GLAPIENTRY * PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei* length, GLchar *groupString); +typedef void (GLAPIENTRY * PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint* numGroups, GLsizei groupsSize, GLuint *groups); +typedef void (GLAPIENTRY * PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint* counterList); + +#define glBeginPerfMonitorAMD GLEW_GET_FUN(__glewBeginPerfMonitorAMD) +#define glDeletePerfMonitorsAMD GLEW_GET_FUN(__glewDeletePerfMonitorsAMD) +#define glEndPerfMonitorAMD GLEW_GET_FUN(__glewEndPerfMonitorAMD) +#define glGenPerfMonitorsAMD GLEW_GET_FUN(__glewGenPerfMonitorsAMD) +#define glGetPerfMonitorCounterDataAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterDataAMD) +#define glGetPerfMonitorCounterInfoAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterInfoAMD) +#define glGetPerfMonitorCounterStringAMD GLEW_GET_FUN(__glewGetPerfMonitorCounterStringAMD) +#define glGetPerfMonitorCountersAMD GLEW_GET_FUN(__glewGetPerfMonitorCountersAMD) +#define glGetPerfMonitorGroupStringAMD GLEW_GET_FUN(__glewGetPerfMonitorGroupStringAMD) +#define glGetPerfMonitorGroupsAMD GLEW_GET_FUN(__glewGetPerfMonitorGroupsAMD) +#define glSelectPerfMonitorCountersAMD GLEW_GET_FUN(__glewSelectPerfMonitorCountersAMD) + +#define GLEW_AMD_performance_monitor GLEW_GET_VAR(__GLEW_AMD_performance_monitor) + +#endif /* GL_AMD_performance_monitor */ + +/* -------------------------- GL_AMD_pinned_memory ------------------------- */ + +#ifndef GL_AMD_pinned_memory +#define GL_AMD_pinned_memory 1 + +#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160 + +#define GLEW_AMD_pinned_memory GLEW_GET_VAR(__GLEW_AMD_pinned_memory) + +#endif /* GL_AMD_pinned_memory */ + +/* ----------------------- GL_AMD_query_buffer_object ---------------------- */ + +#ifndef GL_AMD_query_buffer_object +#define GL_AMD_query_buffer_object 1 + +#define GL_QUERY_BUFFER_AMD 0x9192 +#define GL_QUERY_BUFFER_BINDING_AMD 0x9193 +#define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194 + +#define GLEW_AMD_query_buffer_object GLEW_GET_VAR(__GLEW_AMD_query_buffer_object) + +#endif /* GL_AMD_query_buffer_object */ + +/* ------------------------ GL_AMD_sample_positions ------------------------ */ + +#ifndef GL_AMD_sample_positions +#define GL_AMD_sample_positions 1 + +#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F + +typedef void (GLAPIENTRY * PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat* val); + +#define glSetMultisamplefvAMD GLEW_GET_FUN(__glewSetMultisamplefvAMD) + +#define GLEW_AMD_sample_positions GLEW_GET_VAR(__GLEW_AMD_sample_positions) + +#endif /* GL_AMD_sample_positions */ + +/* ------------------ GL_AMD_seamless_cubemap_per_texture ------------------ */ + +#ifndef GL_AMD_seamless_cubemap_per_texture +#define GL_AMD_seamless_cubemap_per_texture 1 + +#define GL_TEXTURE_CUBE_MAP_SEAMLESS_ARB 0x884F + +#define GLEW_AMD_seamless_cubemap_per_texture GLEW_GET_VAR(__GLEW_AMD_seamless_cubemap_per_texture) + +#endif /* GL_AMD_seamless_cubemap_per_texture */ + +/* -------------------- GL_AMD_shader_atomic_counter_ops ------------------- */ + +#ifndef GL_AMD_shader_atomic_counter_ops +#define GL_AMD_shader_atomic_counter_ops 1 + +#define GLEW_AMD_shader_atomic_counter_ops GLEW_GET_VAR(__GLEW_AMD_shader_atomic_counter_ops) + +#endif /* GL_AMD_shader_atomic_counter_ops */ + +/* ---------------------- GL_AMD_shader_stencil_export --------------------- */ + +#ifndef GL_AMD_shader_stencil_export +#define GL_AMD_shader_stencil_export 1 + +#define GLEW_AMD_shader_stencil_export GLEW_GET_VAR(__GLEW_AMD_shader_stencil_export) + +#endif /* GL_AMD_shader_stencil_export */ + +/* ------------------- GL_AMD_shader_stencil_value_export ------------------ */ + +#ifndef GL_AMD_shader_stencil_value_export +#define GL_AMD_shader_stencil_value_export 1 + +#define GLEW_AMD_shader_stencil_value_export GLEW_GET_VAR(__GLEW_AMD_shader_stencil_value_export) + +#endif /* GL_AMD_shader_stencil_value_export */ + +/* ---------------------- GL_AMD_shader_trinary_minmax --------------------- */ + +#ifndef GL_AMD_shader_trinary_minmax +#define GL_AMD_shader_trinary_minmax 1 + +#define GLEW_AMD_shader_trinary_minmax GLEW_GET_VAR(__GLEW_AMD_shader_trinary_minmax) + +#endif /* GL_AMD_shader_trinary_minmax */ + +/* ------------------------- GL_AMD_sparse_texture ------------------------- */ + +#ifndef GL_AMD_sparse_texture +#define GL_AMD_sparse_texture 1 + +#define GL_TEXTURE_STORAGE_SPARSE_BIT_AMD 0x00000001 +#define GL_VIRTUAL_PAGE_SIZE_X_AMD 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_AMD 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_AMD 0x9197 +#define GL_MAX_SPARSE_TEXTURE_SIZE_AMD 0x9198 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS 0x919A +#define GL_MIN_SPARSE_LEVEL_AMD 0x919B +#define GL_MIN_LOD_WARNING_AMD 0x919C + +typedef void (GLAPIENTRY * PFNGLTEXSTORAGESPARSEAMDPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGESPARSEAMDPROC) (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); + +#define glTexStorageSparseAMD GLEW_GET_FUN(__glewTexStorageSparseAMD) +#define glTextureStorageSparseAMD GLEW_GET_FUN(__glewTextureStorageSparseAMD) + +#define GLEW_AMD_sparse_texture GLEW_GET_VAR(__GLEW_AMD_sparse_texture) + +#endif /* GL_AMD_sparse_texture */ + +/* ------------------- GL_AMD_stencil_operation_extended ------------------- */ + +#ifndef GL_AMD_stencil_operation_extended +#define GL_AMD_stencil_operation_extended 1 + +#define GL_SET_AMD 0x874A +#define GL_REPLACE_VALUE_AMD 0x874B +#define GL_STENCIL_OP_VALUE_AMD 0x874C +#define GL_STENCIL_BACK_OP_VALUE_AMD 0x874D + +typedef void (GLAPIENTRY * PFNGLSTENCILOPVALUEAMDPROC) (GLenum face, GLuint value); + +#define glStencilOpValueAMD GLEW_GET_FUN(__glewStencilOpValueAMD) + +#define GLEW_AMD_stencil_operation_extended GLEW_GET_VAR(__GLEW_AMD_stencil_operation_extended) + +#endif /* GL_AMD_stencil_operation_extended */ + +/* ------------------------ GL_AMD_texture_texture4 ------------------------ */ + +#ifndef GL_AMD_texture_texture4 +#define GL_AMD_texture_texture4 1 + +#define GLEW_AMD_texture_texture4 GLEW_GET_VAR(__GLEW_AMD_texture_texture4) + +#endif /* GL_AMD_texture_texture4 */ + +/* --------------- GL_AMD_transform_feedback3_lines_triangles -------------- */ + +#ifndef GL_AMD_transform_feedback3_lines_triangles +#define GL_AMD_transform_feedback3_lines_triangles 1 + +#define GLEW_AMD_transform_feedback3_lines_triangles GLEW_GET_VAR(__GLEW_AMD_transform_feedback3_lines_triangles) + +#endif /* GL_AMD_transform_feedback3_lines_triangles */ + +/* ----------------------- GL_AMD_transform_feedback4 ---------------------- */ + +#ifndef GL_AMD_transform_feedback4 +#define GL_AMD_transform_feedback4 1 + +#define GL_STREAM_RASTERIZATION_AMD 0x91A0 + +#define GLEW_AMD_transform_feedback4 GLEW_GET_VAR(__GLEW_AMD_transform_feedback4) + +#endif /* GL_AMD_transform_feedback4 */ + +/* ----------------------- GL_AMD_vertex_shader_layer ---------------------- */ + +#ifndef GL_AMD_vertex_shader_layer +#define GL_AMD_vertex_shader_layer 1 + +#define GLEW_AMD_vertex_shader_layer GLEW_GET_VAR(__GLEW_AMD_vertex_shader_layer) + +#endif /* GL_AMD_vertex_shader_layer */ + +/* -------------------- GL_AMD_vertex_shader_tessellator ------------------- */ + +#ifndef GL_AMD_vertex_shader_tessellator +#define GL_AMD_vertex_shader_tessellator 1 + +#define GL_SAMPLER_BUFFER_AMD 0x9001 +#define GL_INT_SAMPLER_BUFFER_AMD 0x9002 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003 +#define GL_TESSELLATION_MODE_AMD 0x9004 +#define GL_TESSELLATION_FACTOR_AMD 0x9005 +#define GL_DISCRETE_AMD 0x9006 +#define GL_CONTINUOUS_AMD 0x9007 + +typedef void (GLAPIENTRY * PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor); +typedef void (GLAPIENTRY * PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode); + +#define glTessellationFactorAMD GLEW_GET_FUN(__glewTessellationFactorAMD) +#define glTessellationModeAMD GLEW_GET_FUN(__glewTessellationModeAMD) + +#define GLEW_AMD_vertex_shader_tessellator GLEW_GET_VAR(__GLEW_AMD_vertex_shader_tessellator) + +#endif /* GL_AMD_vertex_shader_tessellator */ + +/* ------------------ GL_AMD_vertex_shader_viewport_index ------------------ */ + +#ifndef GL_AMD_vertex_shader_viewport_index +#define GL_AMD_vertex_shader_viewport_index 1 + +#define GLEW_AMD_vertex_shader_viewport_index GLEW_GET_VAR(__GLEW_AMD_vertex_shader_viewport_index) + +#endif /* GL_AMD_vertex_shader_viewport_index */ + +/* ------------------------- GL_ANGLE_depth_texture ------------------------ */ + +#ifndef GL_ANGLE_depth_texture +#define GL_ANGLE_depth_texture 1 + +#define GLEW_ANGLE_depth_texture GLEW_GET_VAR(__GLEW_ANGLE_depth_texture) + +#endif /* GL_ANGLE_depth_texture */ + +/* ----------------------- GL_ANGLE_framebuffer_blit ----------------------- */ + +#ifndef GL_ANGLE_framebuffer_blit +#define GL_ANGLE_framebuffer_blit 1 + +#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 +#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA + +typedef void (GLAPIENTRY * PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); + +#define glBlitFramebufferANGLE GLEW_GET_FUN(__glewBlitFramebufferANGLE) + +#define GLEW_ANGLE_framebuffer_blit GLEW_GET_VAR(__GLEW_ANGLE_framebuffer_blit) + +#endif /* GL_ANGLE_framebuffer_blit */ + +/* -------------------- GL_ANGLE_framebuffer_multisample ------------------- */ + +#ifndef GL_ANGLE_framebuffer_multisample +#define GL_ANGLE_framebuffer_multisample 1 + +#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 +#define GL_MAX_SAMPLES_ANGLE 0x8D57 + +typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); + +#define glRenderbufferStorageMultisampleANGLE GLEW_GET_FUN(__glewRenderbufferStorageMultisampleANGLE) + +#define GLEW_ANGLE_framebuffer_multisample GLEW_GET_VAR(__GLEW_ANGLE_framebuffer_multisample) + +#endif /* GL_ANGLE_framebuffer_multisample */ + +/* ----------------------- GL_ANGLE_instanced_arrays ----------------------- */ + +#ifndef GL_ANGLE_instanced_arrays +#define GL_ANGLE_instanced_arrays 1 + +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE + +typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); + +#define glDrawArraysInstancedANGLE GLEW_GET_FUN(__glewDrawArraysInstancedANGLE) +#define glDrawElementsInstancedANGLE GLEW_GET_FUN(__glewDrawElementsInstancedANGLE) +#define glVertexAttribDivisorANGLE GLEW_GET_FUN(__glewVertexAttribDivisorANGLE) + +#define GLEW_ANGLE_instanced_arrays GLEW_GET_VAR(__GLEW_ANGLE_instanced_arrays) + +#endif /* GL_ANGLE_instanced_arrays */ + +/* -------------------- GL_ANGLE_pack_reverse_row_order -------------------- */ + +#ifndef GL_ANGLE_pack_reverse_row_order +#define GL_ANGLE_pack_reverse_row_order 1 + +#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 + +#define GLEW_ANGLE_pack_reverse_row_order GLEW_GET_VAR(__GLEW_ANGLE_pack_reverse_row_order) + +#endif /* GL_ANGLE_pack_reverse_row_order */ + +/* ------------------------ GL_ANGLE_program_binary ------------------------ */ + +#ifndef GL_ANGLE_program_binary +#define GL_ANGLE_program_binary 1 + +#define GL_PROGRAM_BINARY_ANGLE 0x93A6 + +#define GLEW_ANGLE_program_binary GLEW_GET_VAR(__GLEW_ANGLE_program_binary) + +#endif /* GL_ANGLE_program_binary */ + +/* ------------------- GL_ANGLE_texture_compression_dxt1 ------------------- */ + +#ifndef GL_ANGLE_texture_compression_dxt1 +#define GL_ANGLE_texture_compression_dxt1 1 + +#define GL_COMPRESSED_RGB_S3TC_DXT1_ANGLE 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_ANGLE 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 + +#define GLEW_ANGLE_texture_compression_dxt1 GLEW_GET_VAR(__GLEW_ANGLE_texture_compression_dxt1) + +#endif /* GL_ANGLE_texture_compression_dxt1 */ + +/* ------------------- GL_ANGLE_texture_compression_dxt3 ------------------- */ + +#ifndef GL_ANGLE_texture_compression_dxt3 +#define GL_ANGLE_texture_compression_dxt3 1 + +#define GL_COMPRESSED_RGB_S3TC_DXT1_ANGLE 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_ANGLE 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 + +#define GLEW_ANGLE_texture_compression_dxt3 GLEW_GET_VAR(__GLEW_ANGLE_texture_compression_dxt3) + +#endif /* GL_ANGLE_texture_compression_dxt3 */ + +/* ------------------- GL_ANGLE_texture_compression_dxt5 ------------------- */ + +#ifndef GL_ANGLE_texture_compression_dxt5 +#define GL_ANGLE_texture_compression_dxt5 1 + +#define GL_COMPRESSED_RGB_S3TC_DXT1_ANGLE 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_ANGLE 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 + +#define GLEW_ANGLE_texture_compression_dxt5 GLEW_GET_VAR(__GLEW_ANGLE_texture_compression_dxt5) + +#endif /* GL_ANGLE_texture_compression_dxt5 */ + +/* ------------------------- GL_ANGLE_texture_usage ------------------------ */ + +#ifndef GL_ANGLE_texture_usage +#define GL_ANGLE_texture_usage 1 + +#define GL_TEXTURE_USAGE_ANGLE 0x93A2 +#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 + +#define GLEW_ANGLE_texture_usage GLEW_GET_VAR(__GLEW_ANGLE_texture_usage) + +#endif /* GL_ANGLE_texture_usage */ + +/* -------------------------- GL_ANGLE_timer_query ------------------------- */ + +#ifndef GL_ANGLE_timer_query +#define GL_ANGLE_timer_query 1 + +#define GL_QUERY_COUNTER_BITS_ANGLE 0x8864 +#define GL_CURRENT_QUERY_ANGLE 0x8865 +#define GL_QUERY_RESULT_ANGLE 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_ANGLE 0x8867 +#define GL_TIME_ELAPSED_ANGLE 0x88BF +#define GL_TIMESTAMP_ANGLE 0x8E28 + +typedef void (GLAPIENTRY * PFNGLBEGINQUERYANGLEPROC) (GLenum target, GLuint id); +typedef void (GLAPIENTRY * PFNGLDELETEQUERIESANGLEPROC) (GLsizei n, const GLuint* ids); +typedef void (GLAPIENTRY * PFNGLENDQUERYANGLEPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLGENQUERIESANGLEPROC) (GLsizei n, GLuint* ids); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTI64VANGLEPROC) (GLuint id, GLenum pname, GLint64* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVANGLEPROC) (GLuint id, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUI64VANGLEPROC) (GLuint id, GLenum pname, GLuint64* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVANGLEPROC) (GLuint id, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYIVANGLEPROC) (GLenum target, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISQUERYANGLEPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLQUERYCOUNTERANGLEPROC) (GLuint id, GLenum target); + +#define glBeginQueryANGLE GLEW_GET_FUN(__glewBeginQueryANGLE) +#define glDeleteQueriesANGLE GLEW_GET_FUN(__glewDeleteQueriesANGLE) +#define glEndQueryANGLE GLEW_GET_FUN(__glewEndQueryANGLE) +#define glGenQueriesANGLE GLEW_GET_FUN(__glewGenQueriesANGLE) +#define glGetQueryObjecti64vANGLE GLEW_GET_FUN(__glewGetQueryObjecti64vANGLE) +#define glGetQueryObjectivANGLE GLEW_GET_FUN(__glewGetQueryObjectivANGLE) +#define glGetQueryObjectui64vANGLE GLEW_GET_FUN(__glewGetQueryObjectui64vANGLE) +#define glGetQueryObjectuivANGLE GLEW_GET_FUN(__glewGetQueryObjectuivANGLE) +#define glGetQueryivANGLE GLEW_GET_FUN(__glewGetQueryivANGLE) +#define glIsQueryANGLE GLEW_GET_FUN(__glewIsQueryANGLE) +#define glQueryCounterANGLE GLEW_GET_FUN(__glewQueryCounterANGLE) + +#define GLEW_ANGLE_timer_query GLEW_GET_VAR(__GLEW_ANGLE_timer_query) + +#endif /* GL_ANGLE_timer_query */ + +/* ------------------- GL_ANGLE_translated_shader_source ------------------- */ + +#ifndef GL_ANGLE_translated_shader_source +#define GL_ANGLE_translated_shader_source 1 + +#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 + +typedef void (GLAPIENTRY * PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); + +#define glGetTranslatedShaderSourceANGLE GLEW_GET_FUN(__glewGetTranslatedShaderSourceANGLE) + +#define GLEW_ANGLE_translated_shader_source GLEW_GET_VAR(__GLEW_ANGLE_translated_shader_source) + +#endif /* GL_ANGLE_translated_shader_source */ + +/* ----------------------- GL_APPLE_aux_depth_stencil ---------------------- */ + +#ifndef GL_APPLE_aux_depth_stencil +#define GL_APPLE_aux_depth_stencil 1 + +#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14 + +#define GLEW_APPLE_aux_depth_stencil GLEW_GET_VAR(__GLEW_APPLE_aux_depth_stencil) + +#endif /* GL_APPLE_aux_depth_stencil */ + +/* ------------------------ GL_APPLE_client_storage ------------------------ */ + +#ifndef GL_APPLE_client_storage +#define GL_APPLE_client_storage 1 + +#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 + +#define GLEW_APPLE_client_storage GLEW_GET_VAR(__GLEW_APPLE_client_storage) + +#endif /* GL_APPLE_client_storage */ + +/* ------------------------- GL_APPLE_element_array ------------------------ */ + +#ifndef GL_APPLE_element_array +#define GL_APPLE_element_array 1 + +#define GL_ELEMENT_ARRAY_APPLE 0x8A0C +#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D +#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E + +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); +typedef void (GLAPIENTRY * PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const void *pointer); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint* first, const GLsizei *count, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint* first, const GLsizei *count, GLsizei primcount); + +#define glDrawElementArrayAPPLE GLEW_GET_FUN(__glewDrawElementArrayAPPLE) +#define glDrawRangeElementArrayAPPLE GLEW_GET_FUN(__glewDrawRangeElementArrayAPPLE) +#define glElementPointerAPPLE GLEW_GET_FUN(__glewElementPointerAPPLE) +#define glMultiDrawElementArrayAPPLE GLEW_GET_FUN(__glewMultiDrawElementArrayAPPLE) +#define glMultiDrawRangeElementArrayAPPLE GLEW_GET_FUN(__glewMultiDrawRangeElementArrayAPPLE) + +#define GLEW_APPLE_element_array GLEW_GET_VAR(__GLEW_APPLE_element_array) + +#endif /* GL_APPLE_element_array */ + +/* ----------------------------- GL_APPLE_fence ---------------------------- */ + +#ifndef GL_APPLE_fence +#define GL_APPLE_fence 1 + +#define GL_DRAW_PIXELS_APPLE 0x8A0A +#define GL_FENCE_APPLE 0x8A0B + +typedef void (GLAPIENTRY * PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint* fences); +typedef void (GLAPIENTRY * PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); +typedef void (GLAPIENTRY * PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); +typedef void (GLAPIENTRY * PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint* fences); +typedef GLboolean (GLAPIENTRY * PFNGLISFENCEAPPLEPROC) (GLuint fence); +typedef void (GLAPIENTRY * PFNGLSETFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (GLAPIENTRY * PFNGLTESTFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (GLAPIENTRY * PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); + +#define glDeleteFencesAPPLE GLEW_GET_FUN(__glewDeleteFencesAPPLE) +#define glFinishFenceAPPLE GLEW_GET_FUN(__glewFinishFenceAPPLE) +#define glFinishObjectAPPLE GLEW_GET_FUN(__glewFinishObjectAPPLE) +#define glGenFencesAPPLE GLEW_GET_FUN(__glewGenFencesAPPLE) +#define glIsFenceAPPLE GLEW_GET_FUN(__glewIsFenceAPPLE) +#define glSetFenceAPPLE GLEW_GET_FUN(__glewSetFenceAPPLE) +#define glTestFenceAPPLE GLEW_GET_FUN(__glewTestFenceAPPLE) +#define glTestObjectAPPLE GLEW_GET_FUN(__glewTestObjectAPPLE) + +#define GLEW_APPLE_fence GLEW_GET_VAR(__GLEW_APPLE_fence) + +#endif /* GL_APPLE_fence */ + +/* ------------------------- GL_APPLE_float_pixels ------------------------- */ + +#ifndef GL_APPLE_float_pixels +#define GL_APPLE_float_pixels 1 + +#define GL_HALF_APPLE 0x140B +#define GL_RGBA_FLOAT32_APPLE 0x8814 +#define GL_RGB_FLOAT32_APPLE 0x8815 +#define GL_ALPHA_FLOAT32_APPLE 0x8816 +#define GL_INTENSITY_FLOAT32_APPLE 0x8817 +#define GL_LUMINANCE_FLOAT32_APPLE 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 +#define GL_RGBA_FLOAT16_APPLE 0x881A +#define GL_RGB_FLOAT16_APPLE 0x881B +#define GL_ALPHA_FLOAT16_APPLE 0x881C +#define GL_INTENSITY_FLOAT16_APPLE 0x881D +#define GL_LUMINANCE_FLOAT16_APPLE 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F +#define GL_COLOR_FLOAT_APPLE 0x8A0F + +#define GLEW_APPLE_float_pixels GLEW_GET_VAR(__GLEW_APPLE_float_pixels) + +#endif /* GL_APPLE_float_pixels */ + +/* ---------------------- GL_APPLE_flush_buffer_range ---------------------- */ + +#ifndef GL_APPLE_flush_buffer_range +#define GL_APPLE_flush_buffer_range 1 + +#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 +#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 + +typedef void (GLAPIENTRY * PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size); + +#define glBufferParameteriAPPLE GLEW_GET_FUN(__glewBufferParameteriAPPLE) +#define glFlushMappedBufferRangeAPPLE GLEW_GET_FUN(__glewFlushMappedBufferRangeAPPLE) + +#define GLEW_APPLE_flush_buffer_range GLEW_GET_VAR(__GLEW_APPLE_flush_buffer_range) + +#endif /* GL_APPLE_flush_buffer_range */ + +/* ----------------------- GL_APPLE_object_purgeable ----------------------- */ + +#ifndef GL_APPLE_object_purgeable +#define GL_APPLE_object_purgeable 1 + +#define GL_BUFFER_OBJECT_APPLE 0x85B3 +#define GL_RELEASED_APPLE 0x8A19 +#define GL_VOLATILE_APPLE 0x8A1A +#define GL_RETAINED_APPLE 0x8A1B +#define GL_UNDEFINED_APPLE 0x8A1C +#define GL_PURGEABLE_APPLE 0x8A1D + +typedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint* params); +typedef GLenum (GLAPIENTRY * PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); +typedef GLenum (GLAPIENTRY * PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); + +#define glGetObjectParameterivAPPLE GLEW_GET_FUN(__glewGetObjectParameterivAPPLE) +#define glObjectPurgeableAPPLE GLEW_GET_FUN(__glewObjectPurgeableAPPLE) +#define glObjectUnpurgeableAPPLE GLEW_GET_FUN(__glewObjectUnpurgeableAPPLE) + +#define GLEW_APPLE_object_purgeable GLEW_GET_VAR(__GLEW_APPLE_object_purgeable) + +#endif /* GL_APPLE_object_purgeable */ + +/* ------------------------- GL_APPLE_pixel_buffer ------------------------- */ + +#ifndef GL_APPLE_pixel_buffer +#define GL_APPLE_pixel_buffer 1 + +#define GL_MIN_PBUFFER_VIEWPORT_DIMS_APPLE 0x8A10 + +#define GLEW_APPLE_pixel_buffer GLEW_GET_VAR(__GLEW_APPLE_pixel_buffer) + +#endif /* GL_APPLE_pixel_buffer */ + +/* ---------------------------- GL_APPLE_rgb_422 --------------------------- */ + +#ifndef GL_APPLE_rgb_422 +#define GL_APPLE_rgb_422 1 + +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#define GL_RGB_422_APPLE 0x8A1F +#define GL_RGB_RAW_422_APPLE 0x8A51 + +#define GLEW_APPLE_rgb_422 GLEW_GET_VAR(__GLEW_APPLE_rgb_422) + +#endif /* GL_APPLE_rgb_422 */ + +/* --------------------------- GL_APPLE_row_bytes -------------------------- */ + +#ifndef GL_APPLE_row_bytes +#define GL_APPLE_row_bytes 1 + +#define GL_PACK_ROW_BYTES_APPLE 0x8A15 +#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16 + +#define GLEW_APPLE_row_bytes GLEW_GET_VAR(__GLEW_APPLE_row_bytes) + +#endif /* GL_APPLE_row_bytes */ + +/* ------------------------ GL_APPLE_specular_vector ----------------------- */ + +#ifndef GL_APPLE_specular_vector +#define GL_APPLE_specular_vector 1 + +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 + +#define GLEW_APPLE_specular_vector GLEW_GET_VAR(__GLEW_APPLE_specular_vector) + +#endif /* GL_APPLE_specular_vector */ + +/* ------------------------- GL_APPLE_texture_range ------------------------ */ + +#ifndef GL_APPLE_texture_range +#define GL_APPLE_texture_range 1 + +#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7 +#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8 +#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC +#define GL_STORAGE_PRIVATE_APPLE 0x85BD +#define GL_STORAGE_CACHED_APPLE 0x85BE +#define GL_STORAGE_SHARED_APPLE 0x85BF + +typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, void **params); +typedef void (GLAPIENTRY * PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, void *pointer); + +#define glGetTexParameterPointervAPPLE GLEW_GET_FUN(__glewGetTexParameterPointervAPPLE) +#define glTextureRangeAPPLE GLEW_GET_FUN(__glewTextureRangeAPPLE) + +#define GLEW_APPLE_texture_range GLEW_GET_VAR(__GLEW_APPLE_texture_range) + +#endif /* GL_APPLE_texture_range */ + +/* ------------------------ GL_APPLE_transform_hint ------------------------ */ + +#ifndef GL_APPLE_transform_hint +#define GL_APPLE_transform_hint 1 + +#define GL_TRANSFORM_HINT_APPLE 0x85B1 + +#define GLEW_APPLE_transform_hint GLEW_GET_VAR(__GLEW_APPLE_transform_hint) + +#endif /* GL_APPLE_transform_hint */ + +/* ---------------------- GL_APPLE_vertex_array_object --------------------- */ + +#ifndef GL_APPLE_vertex_array_object +#define GL_APPLE_vertex_array_object 1 + +#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 + +typedef void (GLAPIENTRY * PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); +typedef void (GLAPIENTRY * PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint* arrays); +typedef void (GLAPIENTRY * PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint* arrays); +typedef GLboolean (GLAPIENTRY * PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); + +#define glBindVertexArrayAPPLE GLEW_GET_FUN(__glewBindVertexArrayAPPLE) +#define glDeleteVertexArraysAPPLE GLEW_GET_FUN(__glewDeleteVertexArraysAPPLE) +#define glGenVertexArraysAPPLE GLEW_GET_FUN(__glewGenVertexArraysAPPLE) +#define glIsVertexArrayAPPLE GLEW_GET_FUN(__glewIsVertexArrayAPPLE) + +#define GLEW_APPLE_vertex_array_object GLEW_GET_VAR(__GLEW_APPLE_vertex_array_object) + +#endif /* GL_APPLE_vertex_array_object */ + +/* ---------------------- GL_APPLE_vertex_array_range ---------------------- */ + +#ifndef GL_APPLE_vertex_array_range +#define GL_APPLE_vertex_array_range 1 + +#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E +#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 +#define GL_STORAGE_CLIENT_APPLE 0x85B4 +#define GL_STORAGE_CACHED_APPLE 0x85BE +#define GL_STORAGE_SHARED_APPLE 0x85BF + +typedef void (GLAPIENTRY * PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void *pointer); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void *pointer); + +#define glFlushVertexArrayRangeAPPLE GLEW_GET_FUN(__glewFlushVertexArrayRangeAPPLE) +#define glVertexArrayParameteriAPPLE GLEW_GET_FUN(__glewVertexArrayParameteriAPPLE) +#define glVertexArrayRangeAPPLE GLEW_GET_FUN(__glewVertexArrayRangeAPPLE) + +#define GLEW_APPLE_vertex_array_range GLEW_GET_VAR(__GLEW_APPLE_vertex_array_range) + +#endif /* GL_APPLE_vertex_array_range */ + +/* ------------------- GL_APPLE_vertex_program_evaluators ------------------ */ + +#ifndef GL_APPLE_vertex_program_evaluators +#define GL_APPLE_vertex_program_evaluators 1 + +#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00 +#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01 +#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02 +#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03 +#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04 +#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05 +#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06 +#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07 +#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08 +#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09 + +typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); +typedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); +typedef GLboolean (GLAPIENTRY * PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname); +typedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble* points); +typedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat* points); +typedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble* points); +typedef void (GLAPIENTRY * PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat* points); + +#define glDisableVertexAttribAPPLE GLEW_GET_FUN(__glewDisableVertexAttribAPPLE) +#define glEnableVertexAttribAPPLE GLEW_GET_FUN(__glewEnableVertexAttribAPPLE) +#define glIsVertexAttribEnabledAPPLE GLEW_GET_FUN(__glewIsVertexAttribEnabledAPPLE) +#define glMapVertexAttrib1dAPPLE GLEW_GET_FUN(__glewMapVertexAttrib1dAPPLE) +#define glMapVertexAttrib1fAPPLE GLEW_GET_FUN(__glewMapVertexAttrib1fAPPLE) +#define glMapVertexAttrib2dAPPLE GLEW_GET_FUN(__glewMapVertexAttrib2dAPPLE) +#define glMapVertexAttrib2fAPPLE GLEW_GET_FUN(__glewMapVertexAttrib2fAPPLE) + +#define GLEW_APPLE_vertex_program_evaluators GLEW_GET_VAR(__GLEW_APPLE_vertex_program_evaluators) + +#endif /* GL_APPLE_vertex_program_evaluators */ + +/* --------------------------- GL_APPLE_ycbcr_422 -------------------------- */ + +#ifndef GL_APPLE_ycbcr_422 +#define GL_APPLE_ycbcr_422 1 + +#define GL_YCBCR_422_APPLE 0x85B9 + +#define GLEW_APPLE_ycbcr_422 GLEW_GET_VAR(__GLEW_APPLE_ycbcr_422) + +#endif /* GL_APPLE_ycbcr_422 */ + +/* ------------------------ GL_ARB_ES2_compatibility ----------------------- */ + +#ifndef GL_ARB_ES2_compatibility +#define GL_ARB_ES2_compatibility 1 + +#define GL_FIXED 0x140C +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#define GL_RGB565 0x8D62 +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD + +typedef int GLfixed; + +typedef void (GLAPIENTRY * PFNGLCLEARDEPTHFPROC) (GLclampf d); +typedef void (GLAPIENTRY * PFNGLDEPTHRANGEFPROC) (GLclampf n, GLclampf f); +typedef void (GLAPIENTRY * PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint* range, GLint *precision); +typedef void (GLAPIENTRY * PFNGLRELEASESHADERCOMPILERPROC) (void); +typedef void (GLAPIENTRY * PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint* shaders, GLenum binaryformat, const void*binary, GLsizei length); + +#define glClearDepthf GLEW_GET_FUN(__glewClearDepthf) +#define glDepthRangef GLEW_GET_FUN(__glewDepthRangef) +#define glGetShaderPrecisionFormat GLEW_GET_FUN(__glewGetShaderPrecisionFormat) +#define glReleaseShaderCompiler GLEW_GET_FUN(__glewReleaseShaderCompiler) +#define glShaderBinary GLEW_GET_FUN(__glewShaderBinary) + +#define GLEW_ARB_ES2_compatibility GLEW_GET_VAR(__GLEW_ARB_ES2_compatibility) + +#endif /* GL_ARB_ES2_compatibility */ + +/* ----------------------- GL_ARB_ES3_1_compatibility ---------------------- */ + +#ifndef GL_ARB_ES3_1_compatibility +#define GL_ARB_ES3_1_compatibility 1 + +typedef void (GLAPIENTRY * PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers); + +#define glMemoryBarrierByRegion GLEW_GET_FUN(__glewMemoryBarrierByRegion) + +#define GLEW_ARB_ES3_1_compatibility GLEW_GET_VAR(__GLEW_ARB_ES3_1_compatibility) + +#endif /* GL_ARB_ES3_1_compatibility */ + +/* ----------------------- GL_ARB_ES3_2_compatibility ---------------------- */ + +#ifndef GL_ARB_ES3_2_compatibility +#define GL_ARB_ES3_2_compatibility 1 + +#define GL_PRIMITIVE_BOUNDING_BOX_ARB 0x92BE +#define GL_MULTISAMPLE_LINE_WIDTH_RANGE_ARB 0x9381 +#define GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY_ARB 0x9382 + +typedef void (GLAPIENTRY * PFNGLPRIMITIVEBOUNDINGBOXARBPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); + +#define glPrimitiveBoundingBoxARB GLEW_GET_FUN(__glewPrimitiveBoundingBoxARB) + +#define GLEW_ARB_ES3_2_compatibility GLEW_GET_VAR(__GLEW_ARB_ES3_2_compatibility) + +#endif /* GL_ARB_ES3_2_compatibility */ + +/* ------------------------ GL_ARB_ES3_compatibility ----------------------- */ + +#ifndef GL_ARB_ES3_compatibility +#define GL_ARB_ES3_compatibility 1 + +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A +#define GL_MAX_ELEMENT_INDEX 0x8D6B +#define GL_COMPRESSED_R11_EAC 0x9270 +#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 +#define GL_COMPRESSED_RG11_EAC 0x9272 +#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 +#define GL_COMPRESSED_RGB8_ETC2 0x9274 +#define GL_COMPRESSED_SRGB8_ETC2 0x9275 +#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 +#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 +#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 +#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 + +#define GLEW_ARB_ES3_compatibility GLEW_GET_VAR(__GLEW_ARB_ES3_compatibility) + +#endif /* GL_ARB_ES3_compatibility */ + +/* ------------------------ GL_ARB_arrays_of_arrays ------------------------ */ + +#ifndef GL_ARB_arrays_of_arrays +#define GL_ARB_arrays_of_arrays 1 + +#define GLEW_ARB_arrays_of_arrays GLEW_GET_VAR(__GLEW_ARB_arrays_of_arrays) + +#endif /* GL_ARB_arrays_of_arrays */ + +/* -------------------------- GL_ARB_base_instance ------------------------- */ + +#ifndef GL_ARB_base_instance +#define GL_ARB_base_instance 1 + +typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance); +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLuint baseinstance); +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex, GLuint baseinstance); + +#define glDrawArraysInstancedBaseInstance GLEW_GET_FUN(__glewDrawArraysInstancedBaseInstance) +#define glDrawElementsInstancedBaseInstance GLEW_GET_FUN(__glewDrawElementsInstancedBaseInstance) +#define glDrawElementsInstancedBaseVertexBaseInstance GLEW_GET_FUN(__glewDrawElementsInstancedBaseVertexBaseInstance) + +#define GLEW_ARB_base_instance GLEW_GET_VAR(__GLEW_ARB_base_instance) + +#endif /* GL_ARB_base_instance */ + +/* ------------------------ GL_ARB_bindless_texture ------------------------ */ + +#ifndef GL_ARB_bindless_texture +#define GL_ARB_bindless_texture 1 + +#define GL_UNSIGNED_INT64_ARB 0x140F + +typedef GLuint64 (GLAPIENTRY * PFNGLGETIMAGEHANDLEARBPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +typedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture); +typedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLUI64VARBPROC) (GLuint index, GLenum pname, GLuint64EXT* params); +typedef GLboolean (GLAPIENTRY * PFNGLISIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef GLboolean (GLAPIENTRY * PFNGLISTEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef void (GLAPIENTRY * PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC) (GLuint64 handle); +typedef void (GLAPIENTRY * PFNGLMAKEIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle, GLenum access); +typedef void (GLAPIENTRY * PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC) (GLuint64 handle); +typedef void (GLAPIENTRY * PFNGLMAKETEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64* values); +typedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64ARBPROC) (GLint location, GLuint64 value); +typedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64VARBPROC) (GLint location, GLsizei count, const GLuint64* value); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1UI64ARBPROC) (GLuint index, GLuint64EXT x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1UI64VARBPROC) (GLuint index, const GLuint64EXT* v); + +#define glGetImageHandleARB GLEW_GET_FUN(__glewGetImageHandleARB) +#define glGetTextureHandleARB GLEW_GET_FUN(__glewGetTextureHandleARB) +#define glGetTextureSamplerHandleARB GLEW_GET_FUN(__glewGetTextureSamplerHandleARB) +#define glGetVertexAttribLui64vARB GLEW_GET_FUN(__glewGetVertexAttribLui64vARB) +#define glIsImageHandleResidentARB GLEW_GET_FUN(__glewIsImageHandleResidentARB) +#define glIsTextureHandleResidentARB GLEW_GET_FUN(__glewIsTextureHandleResidentARB) +#define glMakeImageHandleNonResidentARB GLEW_GET_FUN(__glewMakeImageHandleNonResidentARB) +#define glMakeImageHandleResidentARB GLEW_GET_FUN(__glewMakeImageHandleResidentARB) +#define glMakeTextureHandleNonResidentARB GLEW_GET_FUN(__glewMakeTextureHandleNonResidentARB) +#define glMakeTextureHandleResidentARB GLEW_GET_FUN(__glewMakeTextureHandleResidentARB) +#define glProgramUniformHandleui64ARB GLEW_GET_FUN(__glewProgramUniformHandleui64ARB) +#define glProgramUniformHandleui64vARB GLEW_GET_FUN(__glewProgramUniformHandleui64vARB) +#define glUniformHandleui64ARB GLEW_GET_FUN(__glewUniformHandleui64ARB) +#define glUniformHandleui64vARB GLEW_GET_FUN(__glewUniformHandleui64vARB) +#define glVertexAttribL1ui64ARB GLEW_GET_FUN(__glewVertexAttribL1ui64ARB) +#define glVertexAttribL1ui64vARB GLEW_GET_FUN(__glewVertexAttribL1ui64vARB) + +#define GLEW_ARB_bindless_texture GLEW_GET_VAR(__GLEW_ARB_bindless_texture) + +#endif /* GL_ARB_bindless_texture */ + +/* ----------------------- GL_ARB_blend_func_extended ---------------------- */ + +#ifndef GL_ARB_blend_func_extended +#define GL_ARB_blend_func_extended 1 + +#define GL_SRC1_COLOR 0x88F9 +#define GL_ONE_MINUS_SRC1_COLOR 0x88FA +#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB +#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC + +typedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar * name); +typedef GLint (GLAPIENTRY * PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar * name); + +#define glBindFragDataLocationIndexed GLEW_GET_FUN(__glewBindFragDataLocationIndexed) +#define glGetFragDataIndex GLEW_GET_FUN(__glewGetFragDataIndex) + +#define GLEW_ARB_blend_func_extended GLEW_GET_VAR(__GLEW_ARB_blend_func_extended) + +#endif /* GL_ARB_blend_func_extended */ + +/* ------------------------- GL_ARB_buffer_storage ------------------------- */ + +#ifndef GL_ARB_buffer_storage +#define GL_ARB_buffer_storage 1 + +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_PERSISTENT_BIT 0x00000040 +#define GL_MAP_COHERENT_BIT 0x00000080 +#define GL_DYNAMIC_STORAGE_BIT 0x0100 +#define GL_CLIENT_STORAGE_BIT 0x0200 +#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000 +#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F +#define GL_BUFFER_STORAGE_FLAGS 0x8220 + +typedef void (GLAPIENTRY * PFNGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERSTORAGEEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); + +#define glBufferStorage GLEW_GET_FUN(__glewBufferStorage) +#define glNamedBufferStorageEXT GLEW_GET_FUN(__glewNamedBufferStorageEXT) + +#define GLEW_ARB_buffer_storage GLEW_GET_VAR(__GLEW_ARB_buffer_storage) + +#endif /* GL_ARB_buffer_storage */ + +/* ---------------------------- GL_ARB_cl_event ---------------------------- */ + +#ifndef GL_ARB_cl_event +#define GL_ARB_cl_event 1 + +#define GL_SYNC_CL_EVENT_ARB 0x8240 +#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241 + +typedef struct _cl_context *cl_context; +typedef struct _cl_event *cl_event; + +typedef GLsync (GLAPIENTRY * PFNGLCREATESYNCFROMCLEVENTARBPROC) (cl_context context, cl_event event, GLbitfield flags); + +#define glCreateSyncFromCLeventARB GLEW_GET_FUN(__glewCreateSyncFromCLeventARB) + +#define GLEW_ARB_cl_event GLEW_GET_VAR(__GLEW_ARB_cl_event) + +#endif /* GL_ARB_cl_event */ + +/* ----------------------- GL_ARB_clear_buffer_object ---------------------- */ + +#ifndef GL_ARB_clear_buffer_object +#define GL_ARB_clear_buffer_object 1 + +typedef void (GLAPIENTRY * PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (GLAPIENTRY * PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); + +#define glClearBufferData GLEW_GET_FUN(__glewClearBufferData) +#define glClearBufferSubData GLEW_GET_FUN(__glewClearBufferSubData) +#define glClearNamedBufferDataEXT GLEW_GET_FUN(__glewClearNamedBufferDataEXT) +#define glClearNamedBufferSubDataEXT GLEW_GET_FUN(__glewClearNamedBufferSubDataEXT) + +#define GLEW_ARB_clear_buffer_object GLEW_GET_VAR(__GLEW_ARB_clear_buffer_object) + +#endif /* GL_ARB_clear_buffer_object */ + +/* -------------------------- GL_ARB_clear_texture ------------------------- */ + +#ifndef GL_ARB_clear_texture +#define GL_ARB_clear_texture 1 + +#define GL_CLEAR_TEXTURE 0x9365 + +typedef void (GLAPIENTRY * PFNGLCLEARTEXIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +typedef void (GLAPIENTRY * PFNGLCLEARTEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); + +#define glClearTexImage GLEW_GET_FUN(__glewClearTexImage) +#define glClearTexSubImage GLEW_GET_FUN(__glewClearTexSubImage) + +#define GLEW_ARB_clear_texture GLEW_GET_VAR(__GLEW_ARB_clear_texture) + +#endif /* GL_ARB_clear_texture */ + +/* -------------------------- GL_ARB_clip_control -------------------------- */ + +#ifndef GL_ARB_clip_control +#define GL_ARB_clip_control 1 + +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_CLIP_ORIGIN 0x935C +#define GL_CLIP_DEPTH_MODE 0x935D +#define GL_NEGATIVE_ONE_TO_ONE 0x935E +#define GL_ZERO_TO_ONE 0x935F + +typedef void (GLAPIENTRY * PFNGLCLIPCONTROLPROC) (GLenum origin, GLenum depth); + +#define glClipControl GLEW_GET_FUN(__glewClipControl) + +#define GLEW_ARB_clip_control GLEW_GET_VAR(__GLEW_ARB_clip_control) + +#endif /* GL_ARB_clip_control */ + +/* ----------------------- GL_ARB_color_buffer_float ----------------------- */ + +#ifndef GL_ARB_color_buffer_float +#define GL_ARB_color_buffer_float 1 + +#define GL_RGBA_FLOAT_MODE_ARB 0x8820 +#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A +#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B +#define GL_CLAMP_READ_COLOR_ARB 0x891C +#define GL_FIXED_ONLY_ARB 0x891D + +typedef void (GLAPIENTRY * PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); + +#define glClampColorARB GLEW_GET_FUN(__glewClampColorARB) + +#define GLEW_ARB_color_buffer_float GLEW_GET_VAR(__GLEW_ARB_color_buffer_float) + +#endif /* GL_ARB_color_buffer_float */ + +/* -------------------------- GL_ARB_compatibility ------------------------- */ + +#ifndef GL_ARB_compatibility +#define GL_ARB_compatibility 1 + +#define GLEW_ARB_compatibility GLEW_GET_VAR(__GLEW_ARB_compatibility) + +#endif /* GL_ARB_compatibility */ + +/* ---------------- GL_ARB_compressed_texture_pixel_storage ---------------- */ + +#ifndef GL_ARB_compressed_texture_pixel_storage +#define GL_ARB_compressed_texture_pixel_storage 1 + +#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 +#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 +#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 +#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A +#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B +#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C +#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D +#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E + +#define GLEW_ARB_compressed_texture_pixel_storage GLEW_GET_VAR(__GLEW_ARB_compressed_texture_pixel_storage) + +#endif /* GL_ARB_compressed_texture_pixel_storage */ + +/* ------------------------- GL_ARB_compute_shader ------------------------- */ + +#ifndef GL_ARB_compute_shader +#define GL_ARB_compute_shader 1 + +#define GL_COMPUTE_SHADER_BIT 0x00000020 +#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 +#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 +#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 +#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 +#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 +#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267 +#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB +#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED +#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE +#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF +#define GL_COMPUTE_SHADER 0x91B9 +#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB +#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC +#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD +#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE +#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF + +typedef void (GLAPIENTRY * PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +typedef void (GLAPIENTRY * PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); + +#define glDispatchCompute GLEW_GET_FUN(__glewDispatchCompute) +#define glDispatchComputeIndirect GLEW_GET_FUN(__glewDispatchComputeIndirect) + +#define GLEW_ARB_compute_shader GLEW_GET_VAR(__GLEW_ARB_compute_shader) + +#endif /* GL_ARB_compute_shader */ + +/* ------------------- GL_ARB_compute_variable_group_size ------------------ */ + +#ifndef GL_ARB_compute_variable_group_size +#define GL_ARB_compute_variable_group_size 1 + +#define GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB 0x90EB +#define GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB 0x91BF +#define GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB 0x9344 +#define GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB 0x9345 + +typedef void (GLAPIENTRY * PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z); + +#define glDispatchComputeGroupSizeARB GLEW_GET_FUN(__glewDispatchComputeGroupSizeARB) + +#define GLEW_ARB_compute_variable_group_size GLEW_GET_VAR(__GLEW_ARB_compute_variable_group_size) + +#endif /* GL_ARB_compute_variable_group_size */ + +/* ------------------- GL_ARB_conditional_render_inverted ------------------ */ + +#ifndef GL_ARB_conditional_render_inverted +#define GL_ARB_conditional_render_inverted 1 + +#define GL_QUERY_WAIT_INVERTED 0x8E17 +#define GL_QUERY_NO_WAIT_INVERTED 0x8E18 +#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19 +#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A + +#define GLEW_ARB_conditional_render_inverted GLEW_GET_VAR(__GLEW_ARB_conditional_render_inverted) + +#endif /* GL_ARB_conditional_render_inverted */ + +/* ----------------------- GL_ARB_conservative_depth ----------------------- */ + +#ifndef GL_ARB_conservative_depth +#define GL_ARB_conservative_depth 1 + +#define GLEW_ARB_conservative_depth GLEW_GET_VAR(__GLEW_ARB_conservative_depth) + +#endif /* GL_ARB_conservative_depth */ + +/* --------------------------- GL_ARB_copy_buffer -------------------------- */ + +#ifndef GL_ARB_copy_buffer +#define GL_ARB_copy_buffer 1 + +#define GL_COPY_READ_BUFFER 0x8F36 +#define GL_COPY_WRITE_BUFFER 0x8F37 + +typedef void (GLAPIENTRY * PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readtarget, GLenum writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size); + +#define glCopyBufferSubData GLEW_GET_FUN(__glewCopyBufferSubData) + +#define GLEW_ARB_copy_buffer GLEW_GET_VAR(__GLEW_ARB_copy_buffer) + +#endif /* GL_ARB_copy_buffer */ + +/* --------------------------- GL_ARB_copy_image --------------------------- */ + +#ifndef GL_ARB_copy_image +#define GL_ARB_copy_image 1 + +typedef void (GLAPIENTRY * PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); + +#define glCopyImageSubData GLEW_GET_FUN(__glewCopyImageSubData) + +#define GLEW_ARB_copy_image GLEW_GET_VAR(__GLEW_ARB_copy_image) + +#endif /* GL_ARB_copy_image */ + +/* -------------------------- GL_ARB_cull_distance ------------------------- */ + +#ifndef GL_ARB_cull_distance +#define GL_ARB_cull_distance 1 + +#define GL_MAX_CULL_DISTANCES 0x82F9 +#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA + +#define GLEW_ARB_cull_distance GLEW_GET_VAR(__GLEW_ARB_cull_distance) + +#endif /* GL_ARB_cull_distance */ + +/* -------------------------- GL_ARB_debug_output -------------------------- */ + +#ifndef GL_ARB_debug_output +#define GL_ARB_debug_output 1 + +#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 +#define GL_DEBUG_SOURCE_API_ARB 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A +#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B +#define GL_DEBUG_TYPE_ERROR_ARB 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E +#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250 +#define GL_DEBUG_TYPE_OTHER_ARB 0x8251 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 +#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 + +typedef void (GLAPIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam); + +typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const void *userParam); +typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled); +typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf); +typedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufSize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog); + +#define glDebugMessageCallbackARB GLEW_GET_FUN(__glewDebugMessageCallbackARB) +#define glDebugMessageControlARB GLEW_GET_FUN(__glewDebugMessageControlARB) +#define glDebugMessageInsertARB GLEW_GET_FUN(__glewDebugMessageInsertARB) +#define glGetDebugMessageLogARB GLEW_GET_FUN(__glewGetDebugMessageLogARB) + +#define GLEW_ARB_debug_output GLEW_GET_VAR(__GLEW_ARB_debug_output) + +#endif /* GL_ARB_debug_output */ + +/* ----------------------- GL_ARB_depth_buffer_float ----------------------- */ + +#ifndef GL_ARB_depth_buffer_float +#define GL_ARB_depth_buffer_float 1 + +#define GL_DEPTH_COMPONENT32F 0x8CAC +#define GL_DEPTH32F_STENCIL8 0x8CAD +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD + +#define GLEW_ARB_depth_buffer_float GLEW_GET_VAR(__GLEW_ARB_depth_buffer_float) + +#endif /* GL_ARB_depth_buffer_float */ + +/* --------------------------- GL_ARB_depth_clamp -------------------------- */ + +#ifndef GL_ARB_depth_clamp +#define GL_ARB_depth_clamp 1 + +#define GL_DEPTH_CLAMP 0x864F + +#define GLEW_ARB_depth_clamp GLEW_GET_VAR(__GLEW_ARB_depth_clamp) + +#endif /* GL_ARB_depth_clamp */ + +/* -------------------------- GL_ARB_depth_texture ------------------------- */ + +#ifndef GL_ARB_depth_texture +#define GL_ARB_depth_texture 1 + +#define GL_DEPTH_COMPONENT16_ARB 0x81A5 +#define GL_DEPTH_COMPONENT24_ARB 0x81A6 +#define GL_DEPTH_COMPONENT32_ARB 0x81A7 +#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A +#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B + +#define GLEW_ARB_depth_texture GLEW_GET_VAR(__GLEW_ARB_depth_texture) + +#endif /* GL_ARB_depth_texture */ + +/* ----------------------- GL_ARB_derivative_control ----------------------- */ + +#ifndef GL_ARB_derivative_control +#define GL_ARB_derivative_control 1 + +#define GLEW_ARB_derivative_control GLEW_GET_VAR(__GLEW_ARB_derivative_control) + +#endif /* GL_ARB_derivative_control */ + +/* ----------------------- GL_ARB_direct_state_access ---------------------- */ + +#ifndef GL_ARB_direct_state_access +#define GL_ARB_direct_state_access 1 + +#define GL_TEXTURE_TARGET 0x1006 +#define GL_QUERY_TARGET 0x82EA + +typedef void (GLAPIENTRY * PFNGLBINDTEXTUREUNITPROC) (GLuint unit, GLuint texture); +typedef void (GLAPIENTRY * PFNGLBLITNAMEDFRAMEBUFFERPROC) (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef GLenum (GLAPIENTRY * PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC) (GLuint framebuffer, GLenum target); +typedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERDATAPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void (GLAPIENTRY * PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, GLfloat depth, GLint stencil); +typedef void (GLAPIENTRY * PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLCLEARNAMEDFRAMEBUFFERIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint* value); +typedef void (GLAPIENTRY * PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOPYNAMEDBUFFERSUBDATAPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLCREATEBUFFERSPROC) (GLsizei n, GLuint* buffers); +typedef void (GLAPIENTRY * PFNGLCREATEFRAMEBUFFERSPROC) (GLsizei n, GLuint* framebuffers); +typedef void (GLAPIENTRY * PFNGLCREATEPROGRAMPIPELINESPROC) (GLsizei n, GLuint* pipelines); +typedef void (GLAPIENTRY * PFNGLCREATEQUERIESPROC) (GLenum target, GLsizei n, GLuint* ids); +typedef void (GLAPIENTRY * PFNGLCREATERENDERBUFFERSPROC) (GLsizei n, GLuint* renderbuffers); +typedef void (GLAPIENTRY * PFNGLCREATESAMPLERSPROC) (GLsizei n, GLuint* samplers); +typedef void (GLAPIENTRY * PFNGLCREATETEXTURESPROC) (GLenum target, GLsizei n, GLuint* textures); +typedef void (GLAPIENTRY * PFNGLCREATETRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint* ids); +typedef void (GLAPIENTRY * PFNGLCREATEVERTEXARRAYSPROC) (GLsizei n, GLuint* arrays); +typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); +typedef void (GLAPIENTRY * PFNGLENABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); +typedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (GLAPIENTRY * PFNGLGENERATETEXTUREMIPMAPPROC) (GLuint texture); +typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLsizei bufSize, void *pixels); +typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPARAMETERI64VPROC) (GLuint buffer, GLenum pname, GLint64* params); +typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPARAMETERIVPROC) (GLuint buffer, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPOINTERVPROC) (GLuint buffer, GLenum pname, void** params); +typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +typedef void (GLAPIENTRY * PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC) (GLuint framebuffer, GLenum pname, GLint* param); +typedef void (GLAPIENTRY * PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC) (GLuint renderbuffer, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYBUFFEROBJECTI64VPROC) (GLuint id,GLuint buffer,GLenum pname,GLintptr offset); +typedef void (GLAPIENTRY * PFNGLGETQUERYBUFFEROBJECTIVPROC) (GLuint id,GLuint buffer,GLenum pname,GLintptr offset); +typedef void (GLAPIENTRY * PFNGLGETQUERYBUFFEROBJECTUI64VPROC) (GLuint id,GLuint buffer,GLenum pname,GLintptr offset); +typedef void (GLAPIENTRY * PFNGLGETQUERYBUFFEROBJECTUIVPROC) (GLuint id,GLuint buffer,GLenum pname,GLintptr offset); +typedef void (GLAPIENTRY * PFNGLGETTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (GLAPIENTRY * PFNGLGETTEXTURELEVELPARAMETERFVPROC) (GLuint texture, GLint level, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETTEXTURELEVELPARAMETERIVPROC) (GLuint texture, GLint level, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64* param); +typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint* param); +typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKIVPROC) (GLuint xfb, GLenum pname, GLint* param); +typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYINDEXED64IVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint64* param); +typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYINDEXEDIVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint* param); +typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYIVPROC) (GLuint vaobj, GLenum pname, GLint* param); +typedef void (GLAPIENTRY * PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum* attachments); +typedef void (GLAPIENTRY * PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void * (GLAPIENTRY * PFNGLMAPNAMEDBUFFERPROC) (GLuint buffer, GLenum access); +typedef void * (GLAPIENTRY * PFNGLMAPNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERDATAPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERSTORAGEPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); +typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC) (GLuint framebuffer, GLenum mode); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC) (GLuint framebuffer, GLsizei n, const GLenum* bufs); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC) (GLuint framebuffer, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC) (GLuint framebuffer, GLenum mode); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLTEXTUREBUFFERPROC) (GLuint texture, GLenum internalformat, GLuint buffer); +typedef void (GLAPIENTRY * PFNGLTEXTUREBUFFERRANGEPROC) (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, const GLuint* params); +typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERFPROC) (GLuint texture, GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, const GLfloat* param); +typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIPROC) (GLuint texture, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, const GLint* param); +typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE1DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE2DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE3DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC) (GLuint xfb, GLuint index, GLuint buffer); +typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC) (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef GLboolean (GLAPIENTRY * PFNGLUNMAPNAMEDBUFFERPROC) (GLuint buffer); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYATTRIBBINDINGPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYATTRIBFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYATTRIBIFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYATTRIBLFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYBINDINGDIVISORPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYELEMENTBUFFERPROC) (GLuint vaobj, GLuint buffer); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXBUFFERPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXBUFFERSPROC) (GLuint vaobj, GLuint first, GLsizei count, const GLuint* buffers, const GLintptr *offsets, const GLsizei *strides); + +#define glBindTextureUnit GLEW_GET_FUN(__glewBindTextureUnit) +#define glBlitNamedFramebuffer GLEW_GET_FUN(__glewBlitNamedFramebuffer) +#define glCheckNamedFramebufferStatus GLEW_GET_FUN(__glewCheckNamedFramebufferStatus) +#define glClearNamedBufferData GLEW_GET_FUN(__glewClearNamedBufferData) +#define glClearNamedBufferSubData GLEW_GET_FUN(__glewClearNamedBufferSubData) +#define glClearNamedFramebufferfi GLEW_GET_FUN(__glewClearNamedFramebufferfi) +#define glClearNamedFramebufferfv GLEW_GET_FUN(__glewClearNamedFramebufferfv) +#define glClearNamedFramebufferiv GLEW_GET_FUN(__glewClearNamedFramebufferiv) +#define glClearNamedFramebufferuiv GLEW_GET_FUN(__glewClearNamedFramebufferuiv) +#define glCompressedTextureSubImage1D GLEW_GET_FUN(__glewCompressedTextureSubImage1D) +#define glCompressedTextureSubImage2D GLEW_GET_FUN(__glewCompressedTextureSubImage2D) +#define glCompressedTextureSubImage3D GLEW_GET_FUN(__glewCompressedTextureSubImage3D) +#define glCopyNamedBufferSubData GLEW_GET_FUN(__glewCopyNamedBufferSubData) +#define glCopyTextureSubImage1D GLEW_GET_FUN(__glewCopyTextureSubImage1D) +#define glCopyTextureSubImage2D GLEW_GET_FUN(__glewCopyTextureSubImage2D) +#define glCopyTextureSubImage3D GLEW_GET_FUN(__glewCopyTextureSubImage3D) +#define glCreateBuffers GLEW_GET_FUN(__glewCreateBuffers) +#define glCreateFramebuffers GLEW_GET_FUN(__glewCreateFramebuffers) +#define glCreateProgramPipelines GLEW_GET_FUN(__glewCreateProgramPipelines) +#define glCreateQueries GLEW_GET_FUN(__glewCreateQueries) +#define glCreateRenderbuffers GLEW_GET_FUN(__glewCreateRenderbuffers) +#define glCreateSamplers GLEW_GET_FUN(__glewCreateSamplers) +#define glCreateTextures GLEW_GET_FUN(__glewCreateTextures) +#define glCreateTransformFeedbacks GLEW_GET_FUN(__glewCreateTransformFeedbacks) +#define glCreateVertexArrays GLEW_GET_FUN(__glewCreateVertexArrays) +#define glDisableVertexArrayAttrib GLEW_GET_FUN(__glewDisableVertexArrayAttrib) +#define glEnableVertexArrayAttrib GLEW_GET_FUN(__glewEnableVertexArrayAttrib) +#define glFlushMappedNamedBufferRange GLEW_GET_FUN(__glewFlushMappedNamedBufferRange) +#define glGenerateTextureMipmap GLEW_GET_FUN(__glewGenerateTextureMipmap) +#define glGetCompressedTextureImage GLEW_GET_FUN(__glewGetCompressedTextureImage) +#define glGetNamedBufferParameteri64v GLEW_GET_FUN(__glewGetNamedBufferParameteri64v) +#define glGetNamedBufferParameteriv GLEW_GET_FUN(__glewGetNamedBufferParameteriv) +#define glGetNamedBufferPointerv GLEW_GET_FUN(__glewGetNamedBufferPointerv) +#define glGetNamedBufferSubData GLEW_GET_FUN(__glewGetNamedBufferSubData) +#define glGetNamedFramebufferAttachmentParameteriv GLEW_GET_FUN(__glewGetNamedFramebufferAttachmentParameteriv) +#define glGetNamedFramebufferParameteriv GLEW_GET_FUN(__glewGetNamedFramebufferParameteriv) +#define glGetNamedRenderbufferParameteriv GLEW_GET_FUN(__glewGetNamedRenderbufferParameteriv) +#define glGetQueryBufferObjecti64v GLEW_GET_FUN(__glewGetQueryBufferObjecti64v) +#define glGetQueryBufferObjectiv GLEW_GET_FUN(__glewGetQueryBufferObjectiv) +#define glGetQueryBufferObjectui64v GLEW_GET_FUN(__glewGetQueryBufferObjectui64v) +#define glGetQueryBufferObjectuiv GLEW_GET_FUN(__glewGetQueryBufferObjectuiv) +#define glGetTextureImage GLEW_GET_FUN(__glewGetTextureImage) +#define glGetTextureLevelParameterfv GLEW_GET_FUN(__glewGetTextureLevelParameterfv) +#define glGetTextureLevelParameteriv GLEW_GET_FUN(__glewGetTextureLevelParameteriv) +#define glGetTextureParameterIiv GLEW_GET_FUN(__glewGetTextureParameterIiv) +#define glGetTextureParameterIuiv GLEW_GET_FUN(__glewGetTextureParameterIuiv) +#define glGetTextureParameterfv GLEW_GET_FUN(__glewGetTextureParameterfv) +#define glGetTextureParameteriv GLEW_GET_FUN(__glewGetTextureParameteriv) +#define glGetTransformFeedbacki64_v GLEW_GET_FUN(__glewGetTransformFeedbacki64_v) +#define glGetTransformFeedbacki_v GLEW_GET_FUN(__glewGetTransformFeedbacki_v) +#define glGetTransformFeedbackiv GLEW_GET_FUN(__glewGetTransformFeedbackiv) +#define glGetVertexArrayIndexed64iv GLEW_GET_FUN(__glewGetVertexArrayIndexed64iv) +#define glGetVertexArrayIndexediv GLEW_GET_FUN(__glewGetVertexArrayIndexediv) +#define glGetVertexArrayiv GLEW_GET_FUN(__glewGetVertexArrayiv) +#define glInvalidateNamedFramebufferData GLEW_GET_FUN(__glewInvalidateNamedFramebufferData) +#define glInvalidateNamedFramebufferSubData GLEW_GET_FUN(__glewInvalidateNamedFramebufferSubData) +#define glMapNamedBuffer GLEW_GET_FUN(__glewMapNamedBuffer) +#define glMapNamedBufferRange GLEW_GET_FUN(__glewMapNamedBufferRange) +#define glNamedBufferData GLEW_GET_FUN(__glewNamedBufferData) +#define glNamedBufferStorage GLEW_GET_FUN(__glewNamedBufferStorage) +#define glNamedBufferSubData GLEW_GET_FUN(__glewNamedBufferSubData) +#define glNamedFramebufferDrawBuffer GLEW_GET_FUN(__glewNamedFramebufferDrawBuffer) +#define glNamedFramebufferDrawBuffers GLEW_GET_FUN(__glewNamedFramebufferDrawBuffers) +#define glNamedFramebufferParameteri GLEW_GET_FUN(__glewNamedFramebufferParameteri) +#define glNamedFramebufferReadBuffer GLEW_GET_FUN(__glewNamedFramebufferReadBuffer) +#define glNamedFramebufferRenderbuffer GLEW_GET_FUN(__glewNamedFramebufferRenderbuffer) +#define glNamedFramebufferTexture GLEW_GET_FUN(__glewNamedFramebufferTexture) +#define glNamedFramebufferTextureLayer GLEW_GET_FUN(__glewNamedFramebufferTextureLayer) +#define glNamedRenderbufferStorage GLEW_GET_FUN(__glewNamedRenderbufferStorage) +#define glNamedRenderbufferStorageMultisample GLEW_GET_FUN(__glewNamedRenderbufferStorageMultisample) +#define glTextureBuffer GLEW_GET_FUN(__glewTextureBuffer) +#define glTextureBufferRange GLEW_GET_FUN(__glewTextureBufferRange) +#define glTextureParameterIiv GLEW_GET_FUN(__glewTextureParameterIiv) +#define glTextureParameterIuiv GLEW_GET_FUN(__glewTextureParameterIuiv) +#define glTextureParameterf GLEW_GET_FUN(__glewTextureParameterf) +#define glTextureParameterfv GLEW_GET_FUN(__glewTextureParameterfv) +#define glTextureParameteri GLEW_GET_FUN(__glewTextureParameteri) +#define glTextureParameteriv GLEW_GET_FUN(__glewTextureParameteriv) +#define glTextureStorage1D GLEW_GET_FUN(__glewTextureStorage1D) +#define glTextureStorage2D GLEW_GET_FUN(__glewTextureStorage2D) +#define glTextureStorage2DMultisample GLEW_GET_FUN(__glewTextureStorage2DMultisample) +#define glTextureStorage3D GLEW_GET_FUN(__glewTextureStorage3D) +#define glTextureStorage3DMultisample GLEW_GET_FUN(__glewTextureStorage3DMultisample) +#define glTextureSubImage1D GLEW_GET_FUN(__glewTextureSubImage1D) +#define glTextureSubImage2D GLEW_GET_FUN(__glewTextureSubImage2D) +#define glTextureSubImage3D GLEW_GET_FUN(__glewTextureSubImage3D) +#define glTransformFeedbackBufferBase GLEW_GET_FUN(__glewTransformFeedbackBufferBase) +#define glTransformFeedbackBufferRange GLEW_GET_FUN(__glewTransformFeedbackBufferRange) +#define glUnmapNamedBuffer GLEW_GET_FUN(__glewUnmapNamedBuffer) +#define glVertexArrayAttribBinding GLEW_GET_FUN(__glewVertexArrayAttribBinding) +#define glVertexArrayAttribFormat GLEW_GET_FUN(__glewVertexArrayAttribFormat) +#define glVertexArrayAttribIFormat GLEW_GET_FUN(__glewVertexArrayAttribIFormat) +#define glVertexArrayAttribLFormat GLEW_GET_FUN(__glewVertexArrayAttribLFormat) +#define glVertexArrayBindingDivisor GLEW_GET_FUN(__glewVertexArrayBindingDivisor) +#define glVertexArrayElementBuffer GLEW_GET_FUN(__glewVertexArrayElementBuffer) +#define glVertexArrayVertexBuffer GLEW_GET_FUN(__glewVertexArrayVertexBuffer) +#define glVertexArrayVertexBuffers GLEW_GET_FUN(__glewVertexArrayVertexBuffers) + +#define GLEW_ARB_direct_state_access GLEW_GET_VAR(__GLEW_ARB_direct_state_access) + +#endif /* GL_ARB_direct_state_access */ + +/* -------------------------- GL_ARB_draw_buffers -------------------------- */ + +#ifndef GL_ARB_draw_buffers +#define GL_ARB_draw_buffers 1 + +#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 +#define GL_DRAW_BUFFER0_ARB 0x8825 +#define GL_DRAW_BUFFER1_ARB 0x8826 +#define GL_DRAW_BUFFER2_ARB 0x8827 +#define GL_DRAW_BUFFER3_ARB 0x8828 +#define GL_DRAW_BUFFER4_ARB 0x8829 +#define GL_DRAW_BUFFER5_ARB 0x882A +#define GL_DRAW_BUFFER6_ARB 0x882B +#define GL_DRAW_BUFFER7_ARB 0x882C +#define GL_DRAW_BUFFER8_ARB 0x882D +#define GL_DRAW_BUFFER9_ARB 0x882E +#define GL_DRAW_BUFFER10_ARB 0x882F +#define GL_DRAW_BUFFER11_ARB 0x8830 +#define GL_DRAW_BUFFER12_ARB 0x8831 +#define GL_DRAW_BUFFER13_ARB 0x8832 +#define GL_DRAW_BUFFER14_ARB 0x8833 +#define GL_DRAW_BUFFER15_ARB 0x8834 + +typedef void (GLAPIENTRY * PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum* bufs); + +#define glDrawBuffersARB GLEW_GET_FUN(__glewDrawBuffersARB) + +#define GLEW_ARB_draw_buffers GLEW_GET_VAR(__GLEW_ARB_draw_buffers) + +#endif /* GL_ARB_draw_buffers */ + +/* ----------------------- GL_ARB_draw_buffers_blend ----------------------- */ + +#ifndef GL_ARB_draw_buffers_blend +#define GL_ARB_draw_buffers_blend 1 + +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode); +typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (GLAPIENTRY * PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst); + +#define glBlendEquationSeparateiARB GLEW_GET_FUN(__glewBlendEquationSeparateiARB) +#define glBlendEquationiARB GLEW_GET_FUN(__glewBlendEquationiARB) +#define glBlendFuncSeparateiARB GLEW_GET_FUN(__glewBlendFuncSeparateiARB) +#define glBlendFunciARB GLEW_GET_FUN(__glewBlendFunciARB) + +#define GLEW_ARB_draw_buffers_blend GLEW_GET_VAR(__GLEW_ARB_draw_buffers_blend) + +#endif /* GL_ARB_draw_buffers_blend */ + +/* -------------------- GL_ARB_draw_elements_base_vertex ------------------- */ + +#ifndef GL_ARB_draw_elements_base_vertex +#define GL_ARB_draw_elements_base_vertex 1 + +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex); +typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei* count, GLenum type, const void *const *indices, GLsizei primcount, const GLint *basevertex); + +#define glDrawElementsBaseVertex GLEW_GET_FUN(__glewDrawElementsBaseVertex) +#define glDrawElementsInstancedBaseVertex GLEW_GET_FUN(__glewDrawElementsInstancedBaseVertex) +#define glDrawRangeElementsBaseVertex GLEW_GET_FUN(__glewDrawRangeElementsBaseVertex) +#define glMultiDrawElementsBaseVertex GLEW_GET_FUN(__glewMultiDrawElementsBaseVertex) + +#define GLEW_ARB_draw_elements_base_vertex GLEW_GET_VAR(__GLEW_ARB_draw_elements_base_vertex) + +#endif /* GL_ARB_draw_elements_base_vertex */ + +/* -------------------------- GL_ARB_draw_indirect ------------------------- */ + +#ifndef GL_ARB_draw_indirect +#define GL_ARB_draw_indirect 1 + +#define GL_DRAW_INDIRECT_BUFFER 0x8F3F +#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 + +typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect); +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect); + +#define glDrawArraysIndirect GLEW_GET_FUN(__glewDrawArraysIndirect) +#define glDrawElementsIndirect GLEW_GET_FUN(__glewDrawElementsIndirect) + +#define GLEW_ARB_draw_indirect GLEW_GET_VAR(__GLEW_ARB_draw_indirect) + +#endif /* GL_ARB_draw_indirect */ + +/* ------------------------- GL_ARB_draw_instanced ------------------------- */ + +#ifndef GL_ARB_draw_instanced +#define GL_ARB_draw_instanced 1 + +#define GLEW_ARB_draw_instanced GLEW_GET_VAR(__GLEW_ARB_draw_instanced) + +#endif /* GL_ARB_draw_instanced */ + +/* ------------------------ GL_ARB_enhanced_layouts ------------------------ */ + +#ifndef GL_ARB_enhanced_layouts +#define GL_ARB_enhanced_layouts 1 + +#define GL_LOCATION_COMPONENT 0x934A +#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B +#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C + +#define GLEW_ARB_enhanced_layouts GLEW_GET_VAR(__GLEW_ARB_enhanced_layouts) + +#endif /* GL_ARB_enhanced_layouts */ + +/* -------------------- GL_ARB_explicit_attrib_location -------------------- */ + +#ifndef GL_ARB_explicit_attrib_location +#define GL_ARB_explicit_attrib_location 1 + +#define GLEW_ARB_explicit_attrib_location GLEW_GET_VAR(__GLEW_ARB_explicit_attrib_location) + +#endif /* GL_ARB_explicit_attrib_location */ + +/* -------------------- GL_ARB_explicit_uniform_location ------------------- */ + +#ifndef GL_ARB_explicit_uniform_location +#define GL_ARB_explicit_uniform_location 1 + +#define GL_MAX_UNIFORM_LOCATIONS 0x826E + +#define GLEW_ARB_explicit_uniform_location GLEW_GET_VAR(__GLEW_ARB_explicit_uniform_location) + +#endif /* GL_ARB_explicit_uniform_location */ + +/* ------------------- GL_ARB_fragment_coord_conventions ------------------- */ + +#ifndef GL_ARB_fragment_coord_conventions +#define GL_ARB_fragment_coord_conventions 1 + +#define GLEW_ARB_fragment_coord_conventions GLEW_GET_VAR(__GLEW_ARB_fragment_coord_conventions) + +#endif /* GL_ARB_fragment_coord_conventions */ + +/* --------------------- GL_ARB_fragment_layer_viewport -------------------- */ + +#ifndef GL_ARB_fragment_layer_viewport +#define GL_ARB_fragment_layer_viewport 1 + +#define GLEW_ARB_fragment_layer_viewport GLEW_GET_VAR(__GLEW_ARB_fragment_layer_viewport) + +#endif /* GL_ARB_fragment_layer_viewport */ + +/* ------------------------ GL_ARB_fragment_program ------------------------ */ + +#ifndef GL_ARB_fragment_program +#define GL_ARB_fragment_program 1 + +#define GL_FRAGMENT_PROGRAM_ARB 0x8804 +#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 +#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 +#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 +#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 +#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 +#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A +#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B +#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C +#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D +#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E +#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F +#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 +#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 + +#define GLEW_ARB_fragment_program GLEW_GET_VAR(__GLEW_ARB_fragment_program) + +#endif /* GL_ARB_fragment_program */ + +/* --------------------- GL_ARB_fragment_program_shadow -------------------- */ + +#ifndef GL_ARB_fragment_program_shadow +#define GL_ARB_fragment_program_shadow 1 + +#define GLEW_ARB_fragment_program_shadow GLEW_GET_VAR(__GLEW_ARB_fragment_program_shadow) + +#endif /* GL_ARB_fragment_program_shadow */ + +/* ------------------------- GL_ARB_fragment_shader ------------------------ */ + +#ifndef GL_ARB_fragment_shader +#define GL_ARB_fragment_shader 1 + +#define GL_FRAGMENT_SHADER_ARB 0x8B30 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B + +#define GLEW_ARB_fragment_shader GLEW_GET_VAR(__GLEW_ARB_fragment_shader) + +#endif /* GL_ARB_fragment_shader */ + +/* -------------------- GL_ARB_fragment_shader_interlock ------------------- */ + +#ifndef GL_ARB_fragment_shader_interlock +#define GL_ARB_fragment_shader_interlock 1 + +#define GLEW_ARB_fragment_shader_interlock GLEW_GET_VAR(__GLEW_ARB_fragment_shader_interlock) + +#endif /* GL_ARB_fragment_shader_interlock */ + +/* ------------------- GL_ARB_framebuffer_no_attachments ------------------- */ + +#ifndef GL_ARB_framebuffer_no_attachments +#define GL_ARB_framebuffer_no_attachments 1 + +#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 +#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312 +#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313 +#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314 +#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315 +#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316 +#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317 +#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 + +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param); + +#define glFramebufferParameteri GLEW_GET_FUN(__glewFramebufferParameteri) +#define glGetFramebufferParameteriv GLEW_GET_FUN(__glewGetFramebufferParameteriv) +#define glGetNamedFramebufferParameterivEXT GLEW_GET_FUN(__glewGetNamedFramebufferParameterivEXT) +#define glNamedFramebufferParameteriEXT GLEW_GET_FUN(__glewNamedFramebufferParameteriEXT) + +#define GLEW_ARB_framebuffer_no_attachments GLEW_GET_VAR(__GLEW_ARB_framebuffer_no_attachments) + +#endif /* GL_ARB_framebuffer_no_attachments */ + +/* ----------------------- GL_ARB_framebuffer_object ----------------------- */ + +#ifndef GL_ARB_framebuffer_object +#define GL_ARB_framebuffer_object 1 + +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 +#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 +#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 +#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 +#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 +#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 +#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 +#define GL_FRAMEBUFFER_DEFAULT 0x8218 +#define GL_FRAMEBUFFER_UNDEFINED 0x8219 +#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A +#define GL_INDEX 0x8222 +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#define GL_DEPTH_STENCIL 0x84F9 +#define GL_UNSIGNED_INT_24_8 0x84FA +#define GL_DEPTH24_STENCIL8 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE 0x88F1 +#define GL_UNSIGNED_NORMALIZED 0x8C17 +#define GL_SRGB 0x8C40 +#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_READ_FRAMEBUFFER 0x8CA8 +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA +#define GL_RENDERBUFFER_SAMPLES 0x8CAB +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_COLOR_ATTACHMENT1 0x8CE1 +#define GL_COLOR_ATTACHMENT2 0x8CE2 +#define GL_COLOR_ATTACHMENT3 0x8CE3 +#define GL_COLOR_ATTACHMENT4 0x8CE4 +#define GL_COLOR_ATTACHMENT5 0x8CE5 +#define GL_COLOR_ATTACHMENT6 0x8CE6 +#define GL_COLOR_ATTACHMENT7 0x8CE7 +#define GL_COLOR_ATTACHMENT8 0x8CE8 +#define GL_COLOR_ATTACHMENT9 0x8CE9 +#define GL_COLOR_ATTACHMENT10 0x8CEA +#define GL_COLOR_ATTACHMENT11 0x8CEB +#define GL_COLOR_ATTACHMENT12 0x8CEC +#define GL_COLOR_ATTACHMENT13 0x8CED +#define GL_COLOR_ATTACHMENT14 0x8CEE +#define GL_COLOR_ATTACHMENT15 0x8CEF +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_STENCIL_INDEX1 0x8D46 +#define GL_STENCIL_INDEX4 0x8D47 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_STENCIL_INDEX16 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 +#define GL_MAX_SAMPLES 0x8D57 + +typedef void (GLAPIENTRY * PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); +typedef void (GLAPIENTRY * PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); +typedef void (GLAPIENTRY * PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint* framebuffers); +typedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint* renderbuffers); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint layer); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target,GLenum attachment, GLuint texture,GLint level,GLint layer); +typedef void (GLAPIENTRY * PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint* framebuffers); +typedef void (GLAPIENTRY * PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint* renderbuffers); +typedef void (GLAPIENTRY * PFNGLGENERATEMIPMAPPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); +typedef GLboolean (GLAPIENTRY * PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); +typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); + +#define glBindFramebuffer GLEW_GET_FUN(__glewBindFramebuffer) +#define glBindRenderbuffer GLEW_GET_FUN(__glewBindRenderbuffer) +#define glBlitFramebuffer GLEW_GET_FUN(__glewBlitFramebuffer) +#define glCheckFramebufferStatus GLEW_GET_FUN(__glewCheckFramebufferStatus) +#define glDeleteFramebuffers GLEW_GET_FUN(__glewDeleteFramebuffers) +#define glDeleteRenderbuffers GLEW_GET_FUN(__glewDeleteRenderbuffers) +#define glFramebufferRenderbuffer GLEW_GET_FUN(__glewFramebufferRenderbuffer) +#define glFramebufferTexture1D GLEW_GET_FUN(__glewFramebufferTexture1D) +#define glFramebufferTexture2D GLEW_GET_FUN(__glewFramebufferTexture2D) +#define glFramebufferTexture3D GLEW_GET_FUN(__glewFramebufferTexture3D) +#define glFramebufferTextureLayer GLEW_GET_FUN(__glewFramebufferTextureLayer) +#define glGenFramebuffers GLEW_GET_FUN(__glewGenFramebuffers) +#define glGenRenderbuffers GLEW_GET_FUN(__glewGenRenderbuffers) +#define glGenerateMipmap GLEW_GET_FUN(__glewGenerateMipmap) +#define glGetFramebufferAttachmentParameteriv GLEW_GET_FUN(__glewGetFramebufferAttachmentParameteriv) +#define glGetRenderbufferParameteriv GLEW_GET_FUN(__glewGetRenderbufferParameteriv) +#define glIsFramebuffer GLEW_GET_FUN(__glewIsFramebuffer) +#define glIsRenderbuffer GLEW_GET_FUN(__glewIsRenderbuffer) +#define glRenderbufferStorage GLEW_GET_FUN(__glewRenderbufferStorage) +#define glRenderbufferStorageMultisample GLEW_GET_FUN(__glewRenderbufferStorageMultisample) + +#define GLEW_ARB_framebuffer_object GLEW_GET_VAR(__GLEW_ARB_framebuffer_object) + +#endif /* GL_ARB_framebuffer_object */ + +/* ------------------------ GL_ARB_framebuffer_sRGB ------------------------ */ + +#ifndef GL_ARB_framebuffer_sRGB +#define GL_ARB_framebuffer_sRGB 1 + +#define GL_FRAMEBUFFER_SRGB 0x8DB9 + +#define GLEW_ARB_framebuffer_sRGB GLEW_GET_VAR(__GLEW_ARB_framebuffer_sRGB) + +#endif /* GL_ARB_framebuffer_sRGB */ + +/* ------------------------ GL_ARB_geometry_shader4 ------------------------ */ + +#ifndef GL_ARB_geometry_shader4 +#define GL_ARB_geometry_shader4 1 + +#define GL_LINES_ADJACENCY_ARB 0xA +#define GL_LINE_STRIP_ADJACENCY_ARB 0xB +#define GL_TRIANGLES_ADJACENCY_ARB 0xC +#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0xD +#define GL_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9 +#define GL_GEOMETRY_SHADER_ARB 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA +#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB +#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC +#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD +#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1 + +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value); + +#define glFramebufferTextureARB GLEW_GET_FUN(__glewFramebufferTextureARB) +#define glFramebufferTextureFaceARB GLEW_GET_FUN(__glewFramebufferTextureFaceARB) +#define glFramebufferTextureLayerARB GLEW_GET_FUN(__glewFramebufferTextureLayerARB) +#define glProgramParameteriARB GLEW_GET_FUN(__glewProgramParameteriARB) + +#define GLEW_ARB_geometry_shader4 GLEW_GET_VAR(__GLEW_ARB_geometry_shader4) + +#endif /* GL_ARB_geometry_shader4 */ + +/* ----------------------- GL_ARB_get_program_binary ----------------------- */ + +#ifndef GL_ARB_get_program_binary +#define GL_ARB_get_program_binary 1 + +#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 +#define GL_PROGRAM_BINARY_LENGTH 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE +#define GL_PROGRAM_BINARY_FORMATS 0x87FF + +typedef void (GLAPIENTRY * PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLenum *binaryFormat, void*binary); +typedef void (GLAPIENTRY * PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); + +#define glGetProgramBinary GLEW_GET_FUN(__glewGetProgramBinary) +#define glProgramBinary GLEW_GET_FUN(__glewProgramBinary) +#define glProgramParameteri GLEW_GET_FUN(__glewProgramParameteri) + +#define GLEW_ARB_get_program_binary GLEW_GET_VAR(__GLEW_ARB_get_program_binary) + +#endif /* GL_ARB_get_program_binary */ + +/* ---------------------- GL_ARB_get_texture_sub_image --------------------- */ + +#ifndef GL_ARB_get_texture_sub_image +#define GL_ARB_get_texture_sub_image 1 + +typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); +typedef void (GLAPIENTRY * PFNGLGETTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); + +#define glGetCompressedTextureSubImage GLEW_GET_FUN(__glewGetCompressedTextureSubImage) +#define glGetTextureSubImage GLEW_GET_FUN(__glewGetTextureSubImage) + +#define GLEW_ARB_get_texture_sub_image GLEW_GET_VAR(__GLEW_ARB_get_texture_sub_image) + +#endif /* GL_ARB_get_texture_sub_image */ + +/* --------------------------- GL_ARB_gpu_shader5 -------------------------- */ + +#ifndef GL_ARB_gpu_shader5 +#define GL_ARB_gpu_shader5 1 + +#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D +#define GL_MAX_VERTEX_STREAMS 0x8E71 + +#define GLEW_ARB_gpu_shader5 GLEW_GET_VAR(__GLEW_ARB_gpu_shader5) + +#endif /* GL_ARB_gpu_shader5 */ + +/* ------------------------- GL_ARB_gpu_shader_fp64 ------------------------ */ + +#ifndef GL_ARB_gpu_shader_fp64 +#define GL_ARB_gpu_shader_fp64 1 + +#define GL_DOUBLE_MAT2 0x8F46 +#define GL_DOUBLE_MAT3 0x8F47 +#define GL_DOUBLE_MAT4 0x8F48 +#define GL_DOUBLE_MAT2x3 0x8F49 +#define GL_DOUBLE_MAT2x4 0x8F4A +#define GL_DOUBLE_MAT3x2 0x8F4B +#define GL_DOUBLE_MAT3x4 0x8F4C +#define GL_DOUBLE_MAT4x2 0x8F4D +#define GL_DOUBLE_MAT4x3 0x8F4E +#define GL_DOUBLE_VEC2 0x8FFC +#define GL_DOUBLE_VEC3 0x8FFD +#define GL_DOUBLE_VEC4 0x8FFE + +typedef void (GLAPIENTRY * PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLUNIFORM1DPROC) (GLint location, GLdouble x); +typedef void (GLAPIENTRY * PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); + +#define glGetUniformdv GLEW_GET_FUN(__glewGetUniformdv) +#define glUniform1d GLEW_GET_FUN(__glewUniform1d) +#define glUniform1dv GLEW_GET_FUN(__glewUniform1dv) +#define glUniform2d GLEW_GET_FUN(__glewUniform2d) +#define glUniform2dv GLEW_GET_FUN(__glewUniform2dv) +#define glUniform3d GLEW_GET_FUN(__glewUniform3d) +#define glUniform3dv GLEW_GET_FUN(__glewUniform3dv) +#define glUniform4d GLEW_GET_FUN(__glewUniform4d) +#define glUniform4dv GLEW_GET_FUN(__glewUniform4dv) +#define glUniformMatrix2dv GLEW_GET_FUN(__glewUniformMatrix2dv) +#define glUniformMatrix2x3dv GLEW_GET_FUN(__glewUniformMatrix2x3dv) +#define glUniformMatrix2x4dv GLEW_GET_FUN(__glewUniformMatrix2x4dv) +#define glUniformMatrix3dv GLEW_GET_FUN(__glewUniformMatrix3dv) +#define glUniformMatrix3x2dv GLEW_GET_FUN(__glewUniformMatrix3x2dv) +#define glUniformMatrix3x4dv GLEW_GET_FUN(__glewUniformMatrix3x4dv) +#define glUniformMatrix4dv GLEW_GET_FUN(__glewUniformMatrix4dv) +#define glUniformMatrix4x2dv GLEW_GET_FUN(__glewUniformMatrix4x2dv) +#define glUniformMatrix4x3dv GLEW_GET_FUN(__glewUniformMatrix4x3dv) + +#define GLEW_ARB_gpu_shader_fp64 GLEW_GET_VAR(__GLEW_ARB_gpu_shader_fp64) + +#endif /* GL_ARB_gpu_shader_fp64 */ + +/* ------------------------ GL_ARB_gpu_shader_int64 ------------------------ */ + +#ifndef GL_ARB_gpu_shader_int64 +#define GL_ARB_gpu_shader_int64 1 + +#define GL_INT64_ARB 0x140E +#define GL_UNSIGNED_INT64_ARB 0x140F +#define GL_INT64_VEC2_ARB 0x8FE9 +#define GL_INT64_VEC3_ARB 0x8FEA +#define GL_INT64_VEC4_ARB 0x8FEB +#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FF5 +#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FF6 +#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FF7 + +typedef void (GLAPIENTRY * PFNGLGETUNIFORMI64VARBPROC) (GLuint program, GLint location, GLint64* params); +typedef void (GLAPIENTRY * PFNGLGETUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLuint64* params); +typedef void (GLAPIENTRY * PFNGLGETNUNIFORMI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint64* params); +typedef void (GLAPIENTRY * PFNGLGETNUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint64* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1I64ARBPROC) (GLuint program, GLint location, GLint64 x); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UI64ARBPROC) (GLuint program, GLint location, GLuint64 x); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM1I64ARBPROC) (GLint location, GLint64 x); +typedef void (GLAPIENTRY * PFNGLUNIFORM1I64VARBPROC) (GLint location, GLsizei count, const GLint64* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM1UI64ARBPROC) (GLint location, GLuint64 x); +typedef void (GLAPIENTRY * PFNGLUNIFORM1UI64VARBPROC) (GLint location, GLsizei count, const GLuint64* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2I64ARBPROC) (GLint location, GLint64 x, GLint64 y); +typedef void (GLAPIENTRY * PFNGLUNIFORM2I64VARBPROC) (GLint location, GLsizei count, const GLint64* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y); +typedef void (GLAPIENTRY * PFNGLUNIFORM2UI64VARBPROC) (GLint location, GLsizei count, const GLuint64* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z); +typedef void (GLAPIENTRY * PFNGLUNIFORM3I64VARBPROC) (GLint location, GLsizei count, const GLint64* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z); +typedef void (GLAPIENTRY * PFNGLUNIFORM3UI64VARBPROC) (GLint location, GLsizei count, const GLuint64* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); +typedef void (GLAPIENTRY * PFNGLUNIFORM4I64VARBPROC) (GLint location, GLsizei count, const GLint64* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); +typedef void (GLAPIENTRY * PFNGLUNIFORM4UI64VARBPROC) (GLint location, GLsizei count, const GLuint64* value); + +#define glGetUniformi64vARB GLEW_GET_FUN(__glewGetUniformi64vARB) +#define glGetUniformui64vARB GLEW_GET_FUN(__glewGetUniformui64vARB) +#define glGetnUniformi64vARB GLEW_GET_FUN(__glewGetnUniformi64vARB) +#define glGetnUniformui64vARB GLEW_GET_FUN(__glewGetnUniformui64vARB) +#define glProgramUniform1i64ARB GLEW_GET_FUN(__glewProgramUniform1i64ARB) +#define glProgramUniform1i64vARB GLEW_GET_FUN(__glewProgramUniform1i64vARB) +#define glProgramUniform1ui64ARB GLEW_GET_FUN(__glewProgramUniform1ui64ARB) +#define glProgramUniform1ui64vARB GLEW_GET_FUN(__glewProgramUniform1ui64vARB) +#define glProgramUniform2i64ARB GLEW_GET_FUN(__glewProgramUniform2i64ARB) +#define glProgramUniform2i64vARB GLEW_GET_FUN(__glewProgramUniform2i64vARB) +#define glProgramUniform2ui64ARB GLEW_GET_FUN(__glewProgramUniform2ui64ARB) +#define glProgramUniform2ui64vARB GLEW_GET_FUN(__glewProgramUniform2ui64vARB) +#define glProgramUniform3i64ARB GLEW_GET_FUN(__glewProgramUniform3i64ARB) +#define glProgramUniform3i64vARB GLEW_GET_FUN(__glewProgramUniform3i64vARB) +#define glProgramUniform3ui64ARB GLEW_GET_FUN(__glewProgramUniform3ui64ARB) +#define glProgramUniform3ui64vARB GLEW_GET_FUN(__glewProgramUniform3ui64vARB) +#define glProgramUniform4i64ARB GLEW_GET_FUN(__glewProgramUniform4i64ARB) +#define glProgramUniform4i64vARB GLEW_GET_FUN(__glewProgramUniform4i64vARB) +#define glProgramUniform4ui64ARB GLEW_GET_FUN(__glewProgramUniform4ui64ARB) +#define glProgramUniform4ui64vARB GLEW_GET_FUN(__glewProgramUniform4ui64vARB) +#define glUniform1i64ARB GLEW_GET_FUN(__glewUniform1i64ARB) +#define glUniform1i64vARB GLEW_GET_FUN(__glewUniform1i64vARB) +#define glUniform1ui64ARB GLEW_GET_FUN(__glewUniform1ui64ARB) +#define glUniform1ui64vARB GLEW_GET_FUN(__glewUniform1ui64vARB) +#define glUniform2i64ARB GLEW_GET_FUN(__glewUniform2i64ARB) +#define glUniform2i64vARB GLEW_GET_FUN(__glewUniform2i64vARB) +#define glUniform2ui64ARB GLEW_GET_FUN(__glewUniform2ui64ARB) +#define glUniform2ui64vARB GLEW_GET_FUN(__glewUniform2ui64vARB) +#define glUniform3i64ARB GLEW_GET_FUN(__glewUniform3i64ARB) +#define glUniform3i64vARB GLEW_GET_FUN(__glewUniform3i64vARB) +#define glUniform3ui64ARB GLEW_GET_FUN(__glewUniform3ui64ARB) +#define glUniform3ui64vARB GLEW_GET_FUN(__glewUniform3ui64vARB) +#define glUniform4i64ARB GLEW_GET_FUN(__glewUniform4i64ARB) +#define glUniform4i64vARB GLEW_GET_FUN(__glewUniform4i64vARB) +#define glUniform4ui64ARB GLEW_GET_FUN(__glewUniform4ui64ARB) +#define glUniform4ui64vARB GLEW_GET_FUN(__glewUniform4ui64vARB) + +#define GLEW_ARB_gpu_shader_int64 GLEW_GET_VAR(__GLEW_ARB_gpu_shader_int64) + +#endif /* GL_ARB_gpu_shader_int64 */ + +/* ------------------------ GL_ARB_half_float_pixel ------------------------ */ + +#ifndef GL_ARB_half_float_pixel +#define GL_ARB_half_float_pixel 1 + +#define GL_HALF_FLOAT_ARB 0x140B + +#define GLEW_ARB_half_float_pixel GLEW_GET_VAR(__GLEW_ARB_half_float_pixel) + +#endif /* GL_ARB_half_float_pixel */ + +/* ------------------------ GL_ARB_half_float_vertex ----------------------- */ + +#ifndef GL_ARB_half_float_vertex +#define GL_ARB_half_float_vertex 1 + +#define GL_HALF_FLOAT 0x140B + +#define GLEW_ARB_half_float_vertex GLEW_GET_VAR(__GLEW_ARB_half_float_vertex) + +#endif /* GL_ARB_half_float_vertex */ + +/* ----------------------------- GL_ARB_imaging ---------------------------- */ + +#ifndef GL_ARB_imaging +#define GL_ARB_imaging 1 + +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_FUNC_ADD 0x8006 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BLEND_EQUATION 0x8009 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_IGNORE_BORDER 0x8150 +#define GL_CONSTANT_BORDER 0x8151 +#define GL_WRAP_BORDER 0x8152 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 + +typedef void (GLAPIENTRY * PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); +typedef void (GLAPIENTRY * PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); +typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GLAPIENTRY * PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, void *table); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, void *image); +typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GLAPIENTRY * PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum types, void *values); +typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GLAPIENTRY * PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); +typedef void (GLAPIENTRY * PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (GLAPIENTRY * PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (GLAPIENTRY * PFNGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLRESETMINMAXPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); + +#define glColorSubTable GLEW_GET_FUN(__glewColorSubTable) +#define glColorTable GLEW_GET_FUN(__glewColorTable) +#define glColorTableParameterfv GLEW_GET_FUN(__glewColorTableParameterfv) +#define glColorTableParameteriv GLEW_GET_FUN(__glewColorTableParameteriv) +#define glConvolutionFilter1D GLEW_GET_FUN(__glewConvolutionFilter1D) +#define glConvolutionFilter2D GLEW_GET_FUN(__glewConvolutionFilter2D) +#define glConvolutionParameterf GLEW_GET_FUN(__glewConvolutionParameterf) +#define glConvolutionParameterfv GLEW_GET_FUN(__glewConvolutionParameterfv) +#define glConvolutionParameteri GLEW_GET_FUN(__glewConvolutionParameteri) +#define glConvolutionParameteriv GLEW_GET_FUN(__glewConvolutionParameteriv) +#define glCopyColorSubTable GLEW_GET_FUN(__glewCopyColorSubTable) +#define glCopyColorTable GLEW_GET_FUN(__glewCopyColorTable) +#define glCopyConvolutionFilter1D GLEW_GET_FUN(__glewCopyConvolutionFilter1D) +#define glCopyConvolutionFilter2D GLEW_GET_FUN(__glewCopyConvolutionFilter2D) +#define glGetColorTable GLEW_GET_FUN(__glewGetColorTable) +#define glGetColorTableParameterfv GLEW_GET_FUN(__glewGetColorTableParameterfv) +#define glGetColorTableParameteriv GLEW_GET_FUN(__glewGetColorTableParameteriv) +#define glGetConvolutionFilter GLEW_GET_FUN(__glewGetConvolutionFilter) +#define glGetConvolutionParameterfv GLEW_GET_FUN(__glewGetConvolutionParameterfv) +#define glGetConvolutionParameteriv GLEW_GET_FUN(__glewGetConvolutionParameteriv) +#define glGetHistogram GLEW_GET_FUN(__glewGetHistogram) +#define glGetHistogramParameterfv GLEW_GET_FUN(__glewGetHistogramParameterfv) +#define glGetHistogramParameteriv GLEW_GET_FUN(__glewGetHistogramParameteriv) +#define glGetMinmax GLEW_GET_FUN(__glewGetMinmax) +#define glGetMinmaxParameterfv GLEW_GET_FUN(__glewGetMinmaxParameterfv) +#define glGetMinmaxParameteriv GLEW_GET_FUN(__glewGetMinmaxParameteriv) +#define glGetSeparableFilter GLEW_GET_FUN(__glewGetSeparableFilter) +#define glHistogram GLEW_GET_FUN(__glewHistogram) +#define glMinmax GLEW_GET_FUN(__glewMinmax) +#define glResetHistogram GLEW_GET_FUN(__glewResetHistogram) +#define glResetMinmax GLEW_GET_FUN(__glewResetMinmax) +#define glSeparableFilter2D GLEW_GET_FUN(__glewSeparableFilter2D) + +#define GLEW_ARB_imaging GLEW_GET_VAR(__GLEW_ARB_imaging) + +#endif /* GL_ARB_imaging */ + +/* ----------------------- GL_ARB_indirect_parameters ---------------------- */ + +#ifndef GL_ARB_indirect_parameters +#define GL_ARB_indirect_parameters 1 + +#define GL_PARAMETER_BUFFER_ARB 0x80EE +#define GL_PARAMETER_BUFFER_BINDING_ARB 0x80EF + +typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); + +#define glMultiDrawArraysIndirectCountARB GLEW_GET_FUN(__glewMultiDrawArraysIndirectCountARB) +#define glMultiDrawElementsIndirectCountARB GLEW_GET_FUN(__glewMultiDrawElementsIndirectCountARB) + +#define GLEW_ARB_indirect_parameters GLEW_GET_VAR(__GLEW_ARB_indirect_parameters) + +#endif /* GL_ARB_indirect_parameters */ + +/* ------------------------ GL_ARB_instanced_arrays ------------------------ */ + +#ifndef GL_ARB_instanced_arrays +#define GL_ARB_instanced_arrays 1 + +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE + +typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor); + +#define glDrawArraysInstancedARB GLEW_GET_FUN(__glewDrawArraysInstancedARB) +#define glDrawElementsInstancedARB GLEW_GET_FUN(__glewDrawElementsInstancedARB) +#define glVertexAttribDivisorARB GLEW_GET_FUN(__glewVertexAttribDivisorARB) + +#define GLEW_ARB_instanced_arrays GLEW_GET_VAR(__GLEW_ARB_instanced_arrays) + +#endif /* GL_ARB_instanced_arrays */ + +/* ---------------------- GL_ARB_internalformat_query ---------------------- */ + +#ifndef GL_ARB_internalformat_query +#define GL_ARB_internalformat_query 1 + +#define GL_NUM_SAMPLE_COUNTS 0x9380 + +typedef void (GLAPIENTRY * PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params); + +#define glGetInternalformativ GLEW_GET_FUN(__glewGetInternalformativ) + +#define GLEW_ARB_internalformat_query GLEW_GET_VAR(__GLEW_ARB_internalformat_query) + +#endif /* GL_ARB_internalformat_query */ + +/* ---------------------- GL_ARB_internalformat_query2 --------------------- */ + +#ifndef GL_ARB_internalformat_query2 +#define GL_ARB_internalformat_query2 1 + +#define GL_INTERNALFORMAT_SUPPORTED 0x826F +#define GL_INTERNALFORMAT_PREFERRED 0x8270 +#define GL_INTERNALFORMAT_RED_SIZE 0x8271 +#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272 +#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273 +#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274 +#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275 +#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276 +#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277 +#define GL_INTERNALFORMAT_RED_TYPE 0x8278 +#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279 +#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A +#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B +#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C +#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D +#define GL_MAX_WIDTH 0x827E +#define GL_MAX_HEIGHT 0x827F +#define GL_MAX_DEPTH 0x8280 +#define GL_MAX_LAYERS 0x8281 +#define GL_MAX_COMBINED_DIMENSIONS 0x8282 +#define GL_COLOR_COMPONENTS 0x8283 +#define GL_DEPTH_COMPONENTS 0x8284 +#define GL_STENCIL_COMPONENTS 0x8285 +#define GL_COLOR_RENDERABLE 0x8286 +#define GL_DEPTH_RENDERABLE 0x8287 +#define GL_STENCIL_RENDERABLE 0x8288 +#define GL_FRAMEBUFFER_RENDERABLE 0x8289 +#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A +#define GL_FRAMEBUFFER_BLEND 0x828B +#define GL_READ_PIXELS 0x828C +#define GL_READ_PIXELS_FORMAT 0x828D +#define GL_READ_PIXELS_TYPE 0x828E +#define GL_TEXTURE_IMAGE_FORMAT 0x828F +#define GL_TEXTURE_IMAGE_TYPE 0x8290 +#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291 +#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292 +#define GL_MIPMAP 0x8293 +#define GL_MANUAL_GENERATE_MIPMAP 0x8294 +#define GL_AUTO_GENERATE_MIPMAP 0x8295 +#define GL_COLOR_ENCODING 0x8296 +#define GL_SRGB_READ 0x8297 +#define GL_SRGB_WRITE 0x8298 +#define GL_SRGB_DECODE_ARB 0x8299 +#define GL_FILTER 0x829A +#define GL_VERTEX_TEXTURE 0x829B +#define GL_TESS_CONTROL_TEXTURE 0x829C +#define GL_TESS_EVALUATION_TEXTURE 0x829D +#define GL_GEOMETRY_TEXTURE 0x829E +#define GL_FRAGMENT_TEXTURE 0x829F +#define GL_COMPUTE_TEXTURE 0x82A0 +#define GL_TEXTURE_SHADOW 0x82A1 +#define GL_TEXTURE_GATHER 0x82A2 +#define GL_TEXTURE_GATHER_SHADOW 0x82A3 +#define GL_SHADER_IMAGE_LOAD 0x82A4 +#define GL_SHADER_IMAGE_STORE 0x82A5 +#define GL_SHADER_IMAGE_ATOMIC 0x82A6 +#define GL_IMAGE_TEXEL_SIZE 0x82A7 +#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8 +#define GL_IMAGE_PIXEL_FORMAT 0x82A9 +#define GL_IMAGE_PIXEL_TYPE 0x82AA +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF +#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1 +#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2 +#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3 +#define GL_CLEAR_BUFFER 0x82B4 +#define GL_TEXTURE_VIEW 0x82B5 +#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6 +#define GL_FULL_SUPPORT 0x82B7 +#define GL_CAVEAT_SUPPORT 0x82B8 +#define GL_IMAGE_CLASS_4_X_32 0x82B9 +#define GL_IMAGE_CLASS_2_X_32 0x82BA +#define GL_IMAGE_CLASS_1_X_32 0x82BB +#define GL_IMAGE_CLASS_4_X_16 0x82BC +#define GL_IMAGE_CLASS_2_X_16 0x82BD +#define GL_IMAGE_CLASS_1_X_16 0x82BE +#define GL_IMAGE_CLASS_4_X_8 0x82BF +#define GL_IMAGE_CLASS_2_X_8 0x82C0 +#define GL_IMAGE_CLASS_1_X_8 0x82C1 +#define GL_IMAGE_CLASS_11_11_10 0x82C2 +#define GL_IMAGE_CLASS_10_10_10_2 0x82C3 +#define GL_VIEW_CLASS_128_BITS 0x82C4 +#define GL_VIEW_CLASS_96_BITS 0x82C5 +#define GL_VIEW_CLASS_64_BITS 0x82C6 +#define GL_VIEW_CLASS_48_BITS 0x82C7 +#define GL_VIEW_CLASS_32_BITS 0x82C8 +#define GL_VIEW_CLASS_24_BITS 0x82C9 +#define GL_VIEW_CLASS_16_BITS 0x82CA +#define GL_VIEW_CLASS_8_BITS 0x82CB +#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC +#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD +#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE +#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF +#define GL_VIEW_CLASS_RGTC1_RED 0x82D0 +#define GL_VIEW_CLASS_RGTC2_RG 0x82D1 +#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2 +#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3 + +typedef void (GLAPIENTRY * PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64* params); + +#define glGetInternalformati64v GLEW_GET_FUN(__glewGetInternalformati64v) + +#define GLEW_ARB_internalformat_query2 GLEW_GET_VAR(__GLEW_ARB_internalformat_query2) + +#endif /* GL_ARB_internalformat_query2 */ + +/* ----------------------- GL_ARB_invalidate_subdata ----------------------- */ + +#ifndef GL_ARB_invalidate_subdata +#define GL_ARB_invalidate_subdata 1 + +typedef void (GLAPIENTRY * PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer); +typedef void (GLAPIENTRY * PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (GLAPIENTRY * PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum* attachments); +typedef void (GLAPIENTRY * PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); + +#define glInvalidateBufferData GLEW_GET_FUN(__glewInvalidateBufferData) +#define glInvalidateBufferSubData GLEW_GET_FUN(__glewInvalidateBufferSubData) +#define glInvalidateFramebuffer GLEW_GET_FUN(__glewInvalidateFramebuffer) +#define glInvalidateSubFramebuffer GLEW_GET_FUN(__glewInvalidateSubFramebuffer) +#define glInvalidateTexImage GLEW_GET_FUN(__glewInvalidateTexImage) +#define glInvalidateTexSubImage GLEW_GET_FUN(__glewInvalidateTexSubImage) + +#define GLEW_ARB_invalidate_subdata GLEW_GET_VAR(__GLEW_ARB_invalidate_subdata) + +#endif /* GL_ARB_invalidate_subdata */ + +/* ---------------------- GL_ARB_map_buffer_alignment ---------------------- */ + +#ifndef GL_ARB_map_buffer_alignment +#define GL_ARB_map_buffer_alignment 1 + +#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC + +#define GLEW_ARB_map_buffer_alignment GLEW_GET_VAR(__GLEW_ARB_map_buffer_alignment) + +#endif /* GL_ARB_map_buffer_alignment */ + +/* ------------------------ GL_ARB_map_buffer_range ------------------------ */ + +#ifndef GL_ARB_map_buffer_range +#define GL_ARB_map_buffer_range 1 + +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 + +typedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +typedef void * (GLAPIENTRY * PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); + +#define glFlushMappedBufferRange GLEW_GET_FUN(__glewFlushMappedBufferRange) +#define glMapBufferRange GLEW_GET_FUN(__glewMapBufferRange) + +#define GLEW_ARB_map_buffer_range GLEW_GET_VAR(__GLEW_ARB_map_buffer_range) + +#endif /* GL_ARB_map_buffer_range */ + +/* ------------------------- GL_ARB_matrix_palette ------------------------- */ + +#ifndef GL_ARB_matrix_palette +#define GL_ARB_matrix_palette 1 + +#define GL_MATRIX_PALETTE_ARB 0x8840 +#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 +#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 +#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 +#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 +#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 +#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 + +typedef void (GLAPIENTRY * PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); +typedef void (GLAPIENTRY * PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, void *pointer); +typedef void (GLAPIENTRY * PFNGLMATRIXINDEXUBVARBPROC) (GLint size, GLubyte *indices); +typedef void (GLAPIENTRY * PFNGLMATRIXINDEXUIVARBPROC) (GLint size, GLuint *indices); +typedef void (GLAPIENTRY * PFNGLMATRIXINDEXUSVARBPROC) (GLint size, GLushort *indices); + +#define glCurrentPaletteMatrixARB GLEW_GET_FUN(__glewCurrentPaletteMatrixARB) +#define glMatrixIndexPointerARB GLEW_GET_FUN(__glewMatrixIndexPointerARB) +#define glMatrixIndexubvARB GLEW_GET_FUN(__glewMatrixIndexubvARB) +#define glMatrixIndexuivARB GLEW_GET_FUN(__glewMatrixIndexuivARB) +#define glMatrixIndexusvARB GLEW_GET_FUN(__glewMatrixIndexusvARB) + +#define GLEW_ARB_matrix_palette GLEW_GET_VAR(__GLEW_ARB_matrix_palette) + +#endif /* GL_ARB_matrix_palette */ + +/* --------------------------- GL_ARB_multi_bind --------------------------- */ + +#ifndef GL_ARB_multi_bind +#define GL_ARB_multi_bind 1 + +typedef void (GLAPIENTRY * PFNGLBINDBUFFERSBASEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint* buffers); +typedef void (GLAPIENTRY * PFNGLBINDBUFFERSRANGEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint* buffers, const GLintptr *offsets, const GLsizeiptr *sizes); +typedef void (GLAPIENTRY * PFNGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count, const GLuint* textures); +typedef void (GLAPIENTRY * PFNGLBINDSAMPLERSPROC) (GLuint first, GLsizei count, const GLuint* samplers); +typedef void (GLAPIENTRY * PFNGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint* textures); +typedef void (GLAPIENTRY * PFNGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint* buffers, const GLintptr *offsets, const GLsizei *strides); + +#define glBindBuffersBase GLEW_GET_FUN(__glewBindBuffersBase) +#define glBindBuffersRange GLEW_GET_FUN(__glewBindBuffersRange) +#define glBindImageTextures GLEW_GET_FUN(__glewBindImageTextures) +#define glBindSamplers GLEW_GET_FUN(__glewBindSamplers) +#define glBindTextures GLEW_GET_FUN(__glewBindTextures) +#define glBindVertexBuffers GLEW_GET_FUN(__glewBindVertexBuffers) + +#define GLEW_ARB_multi_bind GLEW_GET_VAR(__GLEW_ARB_multi_bind) + +#endif /* GL_ARB_multi_bind */ + +/* ----------------------- GL_ARB_multi_draw_indirect ---------------------- */ + +#ifndef GL_ARB_multi_draw_indirect +#define GL_ARB_multi_draw_indirect 1 + +typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei primcount, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei primcount, GLsizei stride); + +#define glMultiDrawArraysIndirect GLEW_GET_FUN(__glewMultiDrawArraysIndirect) +#define glMultiDrawElementsIndirect GLEW_GET_FUN(__glewMultiDrawElementsIndirect) + +#define GLEW_ARB_multi_draw_indirect GLEW_GET_VAR(__GLEW_ARB_multi_draw_indirect) + +#endif /* GL_ARB_multi_draw_indirect */ + +/* --------------------------- GL_ARB_multisample -------------------------- */ + +#ifndef GL_ARB_multisample +#define GL_ARB_multisample 1 + +#define GL_MULTISAMPLE_ARB 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 + +typedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); + +#define glSampleCoverageARB GLEW_GET_FUN(__glewSampleCoverageARB) + +#define GLEW_ARB_multisample GLEW_GET_VAR(__GLEW_ARB_multisample) + +#endif /* GL_ARB_multisample */ + +/* -------------------------- GL_ARB_multitexture -------------------------- */ + +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 + +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 + +typedef void (GLAPIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); + +#define glActiveTextureARB GLEW_GET_FUN(__glewActiveTextureARB) +#define glClientActiveTextureARB GLEW_GET_FUN(__glewClientActiveTextureARB) +#define glMultiTexCoord1dARB GLEW_GET_FUN(__glewMultiTexCoord1dARB) +#define glMultiTexCoord1dvARB GLEW_GET_FUN(__glewMultiTexCoord1dvARB) +#define glMultiTexCoord1fARB GLEW_GET_FUN(__glewMultiTexCoord1fARB) +#define glMultiTexCoord1fvARB GLEW_GET_FUN(__glewMultiTexCoord1fvARB) +#define glMultiTexCoord1iARB GLEW_GET_FUN(__glewMultiTexCoord1iARB) +#define glMultiTexCoord1ivARB GLEW_GET_FUN(__glewMultiTexCoord1ivARB) +#define glMultiTexCoord1sARB GLEW_GET_FUN(__glewMultiTexCoord1sARB) +#define glMultiTexCoord1svARB GLEW_GET_FUN(__glewMultiTexCoord1svARB) +#define glMultiTexCoord2dARB GLEW_GET_FUN(__glewMultiTexCoord2dARB) +#define glMultiTexCoord2dvARB GLEW_GET_FUN(__glewMultiTexCoord2dvARB) +#define glMultiTexCoord2fARB GLEW_GET_FUN(__glewMultiTexCoord2fARB) +#define glMultiTexCoord2fvARB GLEW_GET_FUN(__glewMultiTexCoord2fvARB) +#define glMultiTexCoord2iARB GLEW_GET_FUN(__glewMultiTexCoord2iARB) +#define glMultiTexCoord2ivARB GLEW_GET_FUN(__glewMultiTexCoord2ivARB) +#define glMultiTexCoord2sARB GLEW_GET_FUN(__glewMultiTexCoord2sARB) +#define glMultiTexCoord2svARB GLEW_GET_FUN(__glewMultiTexCoord2svARB) +#define glMultiTexCoord3dARB GLEW_GET_FUN(__glewMultiTexCoord3dARB) +#define glMultiTexCoord3dvARB GLEW_GET_FUN(__glewMultiTexCoord3dvARB) +#define glMultiTexCoord3fARB GLEW_GET_FUN(__glewMultiTexCoord3fARB) +#define glMultiTexCoord3fvARB GLEW_GET_FUN(__glewMultiTexCoord3fvARB) +#define glMultiTexCoord3iARB GLEW_GET_FUN(__glewMultiTexCoord3iARB) +#define glMultiTexCoord3ivARB GLEW_GET_FUN(__glewMultiTexCoord3ivARB) +#define glMultiTexCoord3sARB GLEW_GET_FUN(__glewMultiTexCoord3sARB) +#define glMultiTexCoord3svARB GLEW_GET_FUN(__glewMultiTexCoord3svARB) +#define glMultiTexCoord4dARB GLEW_GET_FUN(__glewMultiTexCoord4dARB) +#define glMultiTexCoord4dvARB GLEW_GET_FUN(__glewMultiTexCoord4dvARB) +#define glMultiTexCoord4fARB GLEW_GET_FUN(__glewMultiTexCoord4fARB) +#define glMultiTexCoord4fvARB GLEW_GET_FUN(__glewMultiTexCoord4fvARB) +#define glMultiTexCoord4iARB GLEW_GET_FUN(__glewMultiTexCoord4iARB) +#define glMultiTexCoord4ivARB GLEW_GET_FUN(__glewMultiTexCoord4ivARB) +#define glMultiTexCoord4sARB GLEW_GET_FUN(__glewMultiTexCoord4sARB) +#define glMultiTexCoord4svARB GLEW_GET_FUN(__glewMultiTexCoord4svARB) + +#define GLEW_ARB_multitexture GLEW_GET_VAR(__GLEW_ARB_multitexture) + +#endif /* GL_ARB_multitexture */ + +/* ------------------------- GL_ARB_occlusion_query ------------------------ */ + +#ifndef GL_ARB_occlusion_query +#define GL_ARB_occlusion_query 1 + +#define GL_QUERY_COUNTER_BITS_ARB 0x8864 +#define GL_CURRENT_QUERY_ARB 0x8865 +#define GL_QUERY_RESULT_ARB 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 +#define GL_SAMPLES_PASSED_ARB 0x8914 + +typedef void (GLAPIENTRY * PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); +typedef void (GLAPIENTRY * PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint* ids); +typedef void (GLAPIENTRY * PFNGLENDQUERYARBPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint* ids); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISQUERYARBPROC) (GLuint id); + +#define glBeginQueryARB GLEW_GET_FUN(__glewBeginQueryARB) +#define glDeleteQueriesARB GLEW_GET_FUN(__glewDeleteQueriesARB) +#define glEndQueryARB GLEW_GET_FUN(__glewEndQueryARB) +#define glGenQueriesARB GLEW_GET_FUN(__glewGenQueriesARB) +#define glGetQueryObjectivARB GLEW_GET_FUN(__glewGetQueryObjectivARB) +#define glGetQueryObjectuivARB GLEW_GET_FUN(__glewGetQueryObjectuivARB) +#define glGetQueryivARB GLEW_GET_FUN(__glewGetQueryivARB) +#define glIsQueryARB GLEW_GET_FUN(__glewIsQueryARB) + +#define GLEW_ARB_occlusion_query GLEW_GET_VAR(__GLEW_ARB_occlusion_query) + +#endif /* GL_ARB_occlusion_query */ + +/* ------------------------ GL_ARB_occlusion_query2 ------------------------ */ + +#ifndef GL_ARB_occlusion_query2 +#define GL_ARB_occlusion_query2 1 + +#define GL_ANY_SAMPLES_PASSED 0x8C2F + +#define GLEW_ARB_occlusion_query2 GLEW_GET_VAR(__GLEW_ARB_occlusion_query2) + +#endif /* GL_ARB_occlusion_query2 */ + +/* --------------------- GL_ARB_parallel_shader_compile -------------------- */ + +#ifndef GL_ARB_parallel_shader_compile +#define GL_ARB_parallel_shader_compile 1 + +#define GL_MAX_SHADER_COMPILER_THREADS_ARB 0x91B0 +#define GL_COMPLETION_STATUS_ARB 0x91B1 + +typedef void (GLAPIENTRY * PFNGLMAXSHADERCOMPILERTHREADSARBPROC) (GLuint count); + +#define glMaxShaderCompilerThreadsARB GLEW_GET_FUN(__glewMaxShaderCompilerThreadsARB) + +#define GLEW_ARB_parallel_shader_compile GLEW_GET_VAR(__GLEW_ARB_parallel_shader_compile) + +#endif /* GL_ARB_parallel_shader_compile */ + +/* -------------------- GL_ARB_pipeline_statistics_query ------------------- */ + +#ifndef GL_ARB_pipeline_statistics_query +#define GL_ARB_pipeline_statistics_query 1 + +#define GL_VERTICES_SUBMITTED_ARB 0x82EE +#define GL_PRIMITIVES_SUBMITTED_ARB 0x82EF +#define GL_VERTEX_SHADER_INVOCATIONS_ARB 0x82F0 +#define GL_TESS_CONTROL_SHADER_PATCHES_ARB 0x82F1 +#define GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB 0x82F2 +#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB 0x82F3 +#define GL_FRAGMENT_SHADER_INVOCATIONS_ARB 0x82F4 +#define GL_COMPUTE_SHADER_INVOCATIONS_ARB 0x82F5 +#define GL_CLIPPING_INPUT_PRIMITIVES_ARB 0x82F6 +#define GL_CLIPPING_OUTPUT_PRIMITIVES_ARB 0x82F7 +#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F + +#define GLEW_ARB_pipeline_statistics_query GLEW_GET_VAR(__GLEW_ARB_pipeline_statistics_query) + +#endif /* GL_ARB_pipeline_statistics_query */ + +/* ----------------------- GL_ARB_pixel_buffer_object ---------------------- */ + +#ifndef GL_ARB_pixel_buffer_object +#define GL_ARB_pixel_buffer_object 1 + +#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF + +#define GLEW_ARB_pixel_buffer_object GLEW_GET_VAR(__GLEW_ARB_pixel_buffer_object) + +#endif /* GL_ARB_pixel_buffer_object */ + +/* ------------------------ GL_ARB_point_parameters ------------------------ */ + +#ifndef GL_ARB_point_parameters +#define GL_ARB_point_parameters 1 + +#define GL_POINT_SIZE_MIN_ARB 0x8126 +#define GL_POINT_SIZE_MAX_ARB 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 + +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat* params); + +#define glPointParameterfARB GLEW_GET_FUN(__glewPointParameterfARB) +#define glPointParameterfvARB GLEW_GET_FUN(__glewPointParameterfvARB) + +#define GLEW_ARB_point_parameters GLEW_GET_VAR(__GLEW_ARB_point_parameters) + +#endif /* GL_ARB_point_parameters */ + +/* -------------------------- GL_ARB_point_sprite -------------------------- */ + +#ifndef GL_ARB_point_sprite +#define GL_ARB_point_sprite 1 + +#define GL_POINT_SPRITE_ARB 0x8861 +#define GL_COORD_REPLACE_ARB 0x8862 + +#define GLEW_ARB_point_sprite GLEW_GET_VAR(__GLEW_ARB_point_sprite) + +#endif /* GL_ARB_point_sprite */ + +/* ----------------------- GL_ARB_post_depth_coverage ---------------------- */ + +#ifndef GL_ARB_post_depth_coverage +#define GL_ARB_post_depth_coverage 1 + +#define GLEW_ARB_post_depth_coverage GLEW_GET_VAR(__GLEW_ARB_post_depth_coverage) + +#endif /* GL_ARB_post_depth_coverage */ + +/* --------------------- GL_ARB_program_interface_query -------------------- */ + +#ifndef GL_ARB_program_interface_query +#define GL_ARB_program_interface_query 1 + +#define GL_UNIFORM 0x92E1 +#define GL_UNIFORM_BLOCK 0x92E2 +#define GL_PROGRAM_INPUT 0x92E3 +#define GL_PROGRAM_OUTPUT 0x92E4 +#define GL_BUFFER_VARIABLE 0x92E5 +#define GL_SHADER_STORAGE_BLOCK 0x92E6 +#define GL_IS_PER_PATCH 0x92E7 +#define GL_VERTEX_SUBROUTINE 0x92E8 +#define GL_TESS_CONTROL_SUBROUTINE 0x92E9 +#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA +#define GL_GEOMETRY_SUBROUTINE 0x92EB +#define GL_FRAGMENT_SUBROUTINE 0x92EC +#define GL_COMPUTE_SUBROUTINE 0x92ED +#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE +#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF +#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0 +#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1 +#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2 +#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3 +#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4 +#define GL_ACTIVE_RESOURCES 0x92F5 +#define GL_MAX_NAME_LENGTH 0x92F6 +#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7 +#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8 +#define GL_NAME_LENGTH 0x92F9 +#define GL_TYPE 0x92FA +#define GL_ARRAY_SIZE 0x92FB +#define GL_OFFSET 0x92FC +#define GL_BLOCK_INDEX 0x92FD +#define GL_ARRAY_STRIDE 0x92FE +#define GL_MATRIX_STRIDE 0x92FF +#define GL_IS_ROW_MAJOR 0x9300 +#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301 +#define GL_BUFFER_BINDING 0x9302 +#define GL_BUFFER_DATA_SIZE 0x9303 +#define GL_NUM_ACTIVE_VARIABLES 0x9304 +#define GL_ACTIVE_VARIABLES 0x9305 +#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308 +#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309 +#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A +#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B +#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C +#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D +#define GL_LOCATION 0x930E +#define GL_LOCATION_INDEX 0x930F + +typedef void (GLAPIENTRY * PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint* params); +typedef GLuint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar* name); +typedef GLint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar* name); +typedef GLint (GLAPIENTRY * PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar* name); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, GLchar *name); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei *length, GLint *params); + +#define glGetProgramInterfaceiv GLEW_GET_FUN(__glewGetProgramInterfaceiv) +#define glGetProgramResourceIndex GLEW_GET_FUN(__glewGetProgramResourceIndex) +#define glGetProgramResourceLocation GLEW_GET_FUN(__glewGetProgramResourceLocation) +#define glGetProgramResourceLocationIndex GLEW_GET_FUN(__glewGetProgramResourceLocationIndex) +#define glGetProgramResourceName GLEW_GET_FUN(__glewGetProgramResourceName) +#define glGetProgramResourceiv GLEW_GET_FUN(__glewGetProgramResourceiv) + +#define GLEW_ARB_program_interface_query GLEW_GET_VAR(__GLEW_ARB_program_interface_query) + +#endif /* GL_ARB_program_interface_query */ + +/* ------------------------ GL_ARB_provoking_vertex ------------------------ */ + +#ifndef GL_ARB_provoking_vertex +#define GL_ARB_provoking_vertex 1 + +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C +#define GL_FIRST_VERTEX_CONVENTION 0x8E4D +#define GL_LAST_VERTEX_CONVENTION 0x8E4E +#define GL_PROVOKING_VERTEX 0x8E4F + +typedef void (GLAPIENTRY * PFNGLPROVOKINGVERTEXPROC) (GLenum mode); + +#define glProvokingVertex GLEW_GET_FUN(__glewProvokingVertex) + +#define GLEW_ARB_provoking_vertex GLEW_GET_VAR(__GLEW_ARB_provoking_vertex) + +#endif /* GL_ARB_provoking_vertex */ + +/* ----------------------- GL_ARB_query_buffer_object ---------------------- */ + +#ifndef GL_ARB_query_buffer_object +#define GL_ARB_query_buffer_object 1 + +#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000 +#define GL_QUERY_BUFFER 0x9192 +#define GL_QUERY_BUFFER_BINDING 0x9193 +#define GL_QUERY_RESULT_NO_WAIT 0x9194 + +#define GLEW_ARB_query_buffer_object GLEW_GET_VAR(__GLEW_ARB_query_buffer_object) + +#endif /* GL_ARB_query_buffer_object */ + +/* ------------------ GL_ARB_robust_buffer_access_behavior ----------------- */ + +#ifndef GL_ARB_robust_buffer_access_behavior +#define GL_ARB_robust_buffer_access_behavior 1 + +#define GLEW_ARB_robust_buffer_access_behavior GLEW_GET_VAR(__GLEW_ARB_robust_buffer_access_behavior) + +#endif /* GL_ARB_robust_buffer_access_behavior */ + +/* --------------------------- GL_ARB_robustness --------------------------- */ + +#ifndef GL_ARB_robustness +#define GL_ARB_robustness 1 + +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define GL_NO_RESET_NOTIFICATION_ARB 0x8261 + +typedef GLenum (GLAPIENTRY * PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void); +typedef void (GLAPIENTRY * PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void* table); +typedef void (GLAPIENTRY * PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void* img); +typedef void (GLAPIENTRY * PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void* image); +typedef void (GLAPIENTRY * PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void* values); +typedef void (GLAPIENTRY * PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble* v); +typedef void (GLAPIENTRY * PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat* v); +typedef void (GLAPIENTRY * PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint* v); +typedef void (GLAPIENTRY * PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void* values); +typedef void (GLAPIENTRY * PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat* values); +typedef void (GLAPIENTRY * PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint* values); +typedef void (GLAPIENTRY * PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort* values); +typedef void (GLAPIENTRY * PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte* pattern); +typedef void (GLAPIENTRY * PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void* row, GLsizei columnBufSize, void*column, void*span); +typedef void (GLAPIENTRY * PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void* img); +typedef void (GLAPIENTRY * PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint* params); +typedef void (GLAPIENTRY * PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void* data); + +#define glGetGraphicsResetStatusARB GLEW_GET_FUN(__glewGetGraphicsResetStatusARB) +#define glGetnColorTableARB GLEW_GET_FUN(__glewGetnColorTableARB) +#define glGetnCompressedTexImageARB GLEW_GET_FUN(__glewGetnCompressedTexImageARB) +#define glGetnConvolutionFilterARB GLEW_GET_FUN(__glewGetnConvolutionFilterARB) +#define glGetnHistogramARB GLEW_GET_FUN(__glewGetnHistogramARB) +#define glGetnMapdvARB GLEW_GET_FUN(__glewGetnMapdvARB) +#define glGetnMapfvARB GLEW_GET_FUN(__glewGetnMapfvARB) +#define glGetnMapivARB GLEW_GET_FUN(__glewGetnMapivARB) +#define glGetnMinmaxARB GLEW_GET_FUN(__glewGetnMinmaxARB) +#define glGetnPixelMapfvARB GLEW_GET_FUN(__glewGetnPixelMapfvARB) +#define glGetnPixelMapuivARB GLEW_GET_FUN(__glewGetnPixelMapuivARB) +#define glGetnPixelMapusvARB GLEW_GET_FUN(__glewGetnPixelMapusvARB) +#define glGetnPolygonStippleARB GLEW_GET_FUN(__glewGetnPolygonStippleARB) +#define glGetnSeparableFilterARB GLEW_GET_FUN(__glewGetnSeparableFilterARB) +#define glGetnTexImageARB GLEW_GET_FUN(__glewGetnTexImageARB) +#define glGetnUniformdvARB GLEW_GET_FUN(__glewGetnUniformdvARB) +#define glGetnUniformfvARB GLEW_GET_FUN(__glewGetnUniformfvARB) +#define glGetnUniformivARB GLEW_GET_FUN(__glewGetnUniformivARB) +#define glGetnUniformuivARB GLEW_GET_FUN(__glewGetnUniformuivARB) +#define glReadnPixelsARB GLEW_GET_FUN(__glewReadnPixelsARB) + +#define GLEW_ARB_robustness GLEW_GET_VAR(__GLEW_ARB_robustness) + +#endif /* GL_ARB_robustness */ + +/* ---------------- GL_ARB_robustness_application_isolation ---------------- */ + +#ifndef GL_ARB_robustness_application_isolation +#define GL_ARB_robustness_application_isolation 1 + +#define GLEW_ARB_robustness_application_isolation GLEW_GET_VAR(__GLEW_ARB_robustness_application_isolation) + +#endif /* GL_ARB_robustness_application_isolation */ + +/* ---------------- GL_ARB_robustness_share_group_isolation ---------------- */ + +#ifndef GL_ARB_robustness_share_group_isolation +#define GL_ARB_robustness_share_group_isolation 1 + +#define GLEW_ARB_robustness_share_group_isolation GLEW_GET_VAR(__GLEW_ARB_robustness_share_group_isolation) + +#endif /* GL_ARB_robustness_share_group_isolation */ + +/* ------------------------ GL_ARB_sample_locations ------------------------ */ + +#ifndef GL_ARB_sample_locations +#define GL_ARB_sample_locations 1 + +#define GL_SAMPLE_LOCATION_ARB 0x8E50 +#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_ARB 0x933D +#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_ARB 0x933E +#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_ARB 0x933F +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_ARB 0x9340 +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_ARB 0x9341 +#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_ARB 0x9342 +#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_ARB 0x9343 + +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat* v); + +#define glFramebufferSampleLocationsfvARB GLEW_GET_FUN(__glewFramebufferSampleLocationsfvARB) +#define glNamedFramebufferSampleLocationsfvARB GLEW_GET_FUN(__glewNamedFramebufferSampleLocationsfvARB) + +#define GLEW_ARB_sample_locations GLEW_GET_VAR(__GLEW_ARB_sample_locations) + +#endif /* GL_ARB_sample_locations */ + +/* ------------------------- GL_ARB_sample_shading ------------------------- */ + +#ifndef GL_ARB_sample_shading +#define GL_ARB_sample_shading 1 + +#define GL_SAMPLE_SHADING_ARB 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 + +typedef void (GLAPIENTRY * PFNGLMINSAMPLESHADINGARBPROC) (GLclampf value); + +#define glMinSampleShadingARB GLEW_GET_FUN(__glewMinSampleShadingARB) + +#define GLEW_ARB_sample_shading GLEW_GET_VAR(__GLEW_ARB_sample_shading) + +#endif /* GL_ARB_sample_shading */ + +/* ------------------------- GL_ARB_sampler_objects ------------------------ */ + +#ifndef GL_ARB_sampler_objects +#define GL_ARB_sampler_objects 1 + +#define GL_SAMPLER_BINDING 0x8919 + +typedef void (GLAPIENTRY * PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); +typedef void (GLAPIENTRY * PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint * samplers); +typedef void (GLAPIENTRY * PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint* samplers); +typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISSAMPLERPROC) (GLuint sampler); +typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint* params); +typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint* params); + +#define glBindSampler GLEW_GET_FUN(__glewBindSampler) +#define glDeleteSamplers GLEW_GET_FUN(__glewDeleteSamplers) +#define glGenSamplers GLEW_GET_FUN(__glewGenSamplers) +#define glGetSamplerParameterIiv GLEW_GET_FUN(__glewGetSamplerParameterIiv) +#define glGetSamplerParameterIuiv GLEW_GET_FUN(__glewGetSamplerParameterIuiv) +#define glGetSamplerParameterfv GLEW_GET_FUN(__glewGetSamplerParameterfv) +#define glGetSamplerParameteriv GLEW_GET_FUN(__glewGetSamplerParameteriv) +#define glIsSampler GLEW_GET_FUN(__glewIsSampler) +#define glSamplerParameterIiv GLEW_GET_FUN(__glewSamplerParameterIiv) +#define glSamplerParameterIuiv GLEW_GET_FUN(__glewSamplerParameterIuiv) +#define glSamplerParameterf GLEW_GET_FUN(__glewSamplerParameterf) +#define glSamplerParameterfv GLEW_GET_FUN(__glewSamplerParameterfv) +#define glSamplerParameteri GLEW_GET_FUN(__glewSamplerParameteri) +#define glSamplerParameteriv GLEW_GET_FUN(__glewSamplerParameteriv) + +#define GLEW_ARB_sampler_objects GLEW_GET_VAR(__GLEW_ARB_sampler_objects) + +#endif /* GL_ARB_sampler_objects */ + +/* ------------------------ GL_ARB_seamless_cube_map ----------------------- */ + +#ifndef GL_ARB_seamless_cube_map +#define GL_ARB_seamless_cube_map 1 + +#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F + +#define GLEW_ARB_seamless_cube_map GLEW_GET_VAR(__GLEW_ARB_seamless_cube_map) + +#endif /* GL_ARB_seamless_cube_map */ + +/* ------------------ GL_ARB_seamless_cubemap_per_texture ------------------ */ + +#ifndef GL_ARB_seamless_cubemap_per_texture +#define GL_ARB_seamless_cubemap_per_texture 1 + +#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F + +#define GLEW_ARB_seamless_cubemap_per_texture GLEW_GET_VAR(__GLEW_ARB_seamless_cubemap_per_texture) + +#endif /* GL_ARB_seamless_cubemap_per_texture */ + +/* --------------------- GL_ARB_separate_shader_objects -------------------- */ + +#ifndef GL_ARB_separate_shader_objects +#define GL_ARB_separate_shader_objects 1 + +#define GL_VERTEX_SHADER_BIT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT 0x00000002 +#define GL_GEOMETRY_SHADER_BIT 0x00000004 +#define GL_TESS_CONTROL_SHADER_BIT 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010 +#define GL_PROGRAM_SEPARABLE 0x8258 +#define GL_ACTIVE_PROGRAM 0x8259 +#define GL_PROGRAM_PIPELINE_BINDING 0x825A +#define GL_ALL_SHADER_BITS 0xFFFFFFFF + +typedef void (GLAPIENTRY * PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program); +typedef void (GLAPIENTRY * PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar * const * strings); +typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint* pipelines); +typedef void (GLAPIENTRY * PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint* pipelines); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar *infoLog); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble x); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat x); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint x); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint x); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint x, GLint y); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint x, GLuint y); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint x, GLuint y, GLuint z); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline); + +#define glActiveShaderProgram GLEW_GET_FUN(__glewActiveShaderProgram) +#define glBindProgramPipeline GLEW_GET_FUN(__glewBindProgramPipeline) +#define glCreateShaderProgramv GLEW_GET_FUN(__glewCreateShaderProgramv) +#define glDeleteProgramPipelines GLEW_GET_FUN(__glewDeleteProgramPipelines) +#define glGenProgramPipelines GLEW_GET_FUN(__glewGenProgramPipelines) +#define glGetProgramPipelineInfoLog GLEW_GET_FUN(__glewGetProgramPipelineInfoLog) +#define glGetProgramPipelineiv GLEW_GET_FUN(__glewGetProgramPipelineiv) +#define glIsProgramPipeline GLEW_GET_FUN(__glewIsProgramPipeline) +#define glProgramUniform1d GLEW_GET_FUN(__glewProgramUniform1d) +#define glProgramUniform1dv GLEW_GET_FUN(__glewProgramUniform1dv) +#define glProgramUniform1f GLEW_GET_FUN(__glewProgramUniform1f) +#define glProgramUniform1fv GLEW_GET_FUN(__glewProgramUniform1fv) +#define glProgramUniform1i GLEW_GET_FUN(__glewProgramUniform1i) +#define glProgramUniform1iv GLEW_GET_FUN(__glewProgramUniform1iv) +#define glProgramUniform1ui GLEW_GET_FUN(__glewProgramUniform1ui) +#define glProgramUniform1uiv GLEW_GET_FUN(__glewProgramUniform1uiv) +#define glProgramUniform2d GLEW_GET_FUN(__glewProgramUniform2d) +#define glProgramUniform2dv GLEW_GET_FUN(__glewProgramUniform2dv) +#define glProgramUniform2f GLEW_GET_FUN(__glewProgramUniform2f) +#define glProgramUniform2fv GLEW_GET_FUN(__glewProgramUniform2fv) +#define glProgramUniform2i GLEW_GET_FUN(__glewProgramUniform2i) +#define glProgramUniform2iv GLEW_GET_FUN(__glewProgramUniform2iv) +#define glProgramUniform2ui GLEW_GET_FUN(__glewProgramUniform2ui) +#define glProgramUniform2uiv GLEW_GET_FUN(__glewProgramUniform2uiv) +#define glProgramUniform3d GLEW_GET_FUN(__glewProgramUniform3d) +#define glProgramUniform3dv GLEW_GET_FUN(__glewProgramUniform3dv) +#define glProgramUniform3f GLEW_GET_FUN(__glewProgramUniform3f) +#define glProgramUniform3fv GLEW_GET_FUN(__glewProgramUniform3fv) +#define glProgramUniform3i GLEW_GET_FUN(__glewProgramUniform3i) +#define glProgramUniform3iv GLEW_GET_FUN(__glewProgramUniform3iv) +#define glProgramUniform3ui GLEW_GET_FUN(__glewProgramUniform3ui) +#define glProgramUniform3uiv GLEW_GET_FUN(__glewProgramUniform3uiv) +#define glProgramUniform4d GLEW_GET_FUN(__glewProgramUniform4d) +#define glProgramUniform4dv GLEW_GET_FUN(__glewProgramUniform4dv) +#define glProgramUniform4f GLEW_GET_FUN(__glewProgramUniform4f) +#define glProgramUniform4fv GLEW_GET_FUN(__glewProgramUniform4fv) +#define glProgramUniform4i GLEW_GET_FUN(__glewProgramUniform4i) +#define glProgramUniform4iv GLEW_GET_FUN(__glewProgramUniform4iv) +#define glProgramUniform4ui GLEW_GET_FUN(__glewProgramUniform4ui) +#define glProgramUniform4uiv GLEW_GET_FUN(__glewProgramUniform4uiv) +#define glProgramUniformMatrix2dv GLEW_GET_FUN(__glewProgramUniformMatrix2dv) +#define glProgramUniformMatrix2fv GLEW_GET_FUN(__glewProgramUniformMatrix2fv) +#define glProgramUniformMatrix2x3dv GLEW_GET_FUN(__glewProgramUniformMatrix2x3dv) +#define glProgramUniformMatrix2x3fv GLEW_GET_FUN(__glewProgramUniformMatrix2x3fv) +#define glProgramUniformMatrix2x4dv GLEW_GET_FUN(__glewProgramUniformMatrix2x4dv) +#define glProgramUniformMatrix2x4fv GLEW_GET_FUN(__glewProgramUniformMatrix2x4fv) +#define glProgramUniformMatrix3dv GLEW_GET_FUN(__glewProgramUniformMatrix3dv) +#define glProgramUniformMatrix3fv GLEW_GET_FUN(__glewProgramUniformMatrix3fv) +#define glProgramUniformMatrix3x2dv GLEW_GET_FUN(__glewProgramUniformMatrix3x2dv) +#define glProgramUniformMatrix3x2fv GLEW_GET_FUN(__glewProgramUniformMatrix3x2fv) +#define glProgramUniformMatrix3x4dv GLEW_GET_FUN(__glewProgramUniformMatrix3x4dv) +#define glProgramUniformMatrix3x4fv GLEW_GET_FUN(__glewProgramUniformMatrix3x4fv) +#define glProgramUniformMatrix4dv GLEW_GET_FUN(__glewProgramUniformMatrix4dv) +#define glProgramUniformMatrix4fv GLEW_GET_FUN(__glewProgramUniformMatrix4fv) +#define glProgramUniformMatrix4x2dv GLEW_GET_FUN(__glewProgramUniformMatrix4x2dv) +#define glProgramUniformMatrix4x2fv GLEW_GET_FUN(__glewProgramUniformMatrix4x2fv) +#define glProgramUniformMatrix4x3dv GLEW_GET_FUN(__glewProgramUniformMatrix4x3dv) +#define glProgramUniformMatrix4x3fv GLEW_GET_FUN(__glewProgramUniformMatrix4x3fv) +#define glUseProgramStages GLEW_GET_FUN(__glewUseProgramStages) +#define glValidateProgramPipeline GLEW_GET_FUN(__glewValidateProgramPipeline) + +#define GLEW_ARB_separate_shader_objects GLEW_GET_VAR(__GLEW_ARB_separate_shader_objects) + +#endif /* GL_ARB_separate_shader_objects */ + +/* -------------------- GL_ARB_shader_atomic_counter_ops ------------------- */ + +#ifndef GL_ARB_shader_atomic_counter_ops +#define GL_ARB_shader_atomic_counter_ops 1 + +#define GLEW_ARB_shader_atomic_counter_ops GLEW_GET_VAR(__GLEW_ARB_shader_atomic_counter_ops) + +#endif /* GL_ARB_shader_atomic_counter_ops */ + +/* --------------------- GL_ARB_shader_atomic_counters --------------------- */ + +#ifndef GL_ARB_shader_atomic_counters +#define GL_ARB_shader_atomic_counters 1 + +#define GL_ATOMIC_COUNTER_BUFFER 0x92C0 +#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1 +#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 +#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3 +#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4 +#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5 +#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB +#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF +#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0 +#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1 +#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2 +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5 +#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6 +#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7 +#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8 +#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9 +#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA +#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB +#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC + +typedef void (GLAPIENTRY * PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint* params); + +#define glGetActiveAtomicCounterBufferiv GLEW_GET_FUN(__glewGetActiveAtomicCounterBufferiv) + +#define GLEW_ARB_shader_atomic_counters GLEW_GET_VAR(__GLEW_ARB_shader_atomic_counters) + +#endif /* GL_ARB_shader_atomic_counters */ + +/* -------------------------- GL_ARB_shader_ballot ------------------------- */ + +#ifndef GL_ARB_shader_ballot +#define GL_ARB_shader_ballot 1 + +#define GLEW_ARB_shader_ballot GLEW_GET_VAR(__GLEW_ARB_shader_ballot) + +#endif /* GL_ARB_shader_ballot */ + +/* ----------------------- GL_ARB_shader_bit_encoding ---------------------- */ + +#ifndef GL_ARB_shader_bit_encoding +#define GL_ARB_shader_bit_encoding 1 + +#define GLEW_ARB_shader_bit_encoding GLEW_GET_VAR(__GLEW_ARB_shader_bit_encoding) + +#endif /* GL_ARB_shader_bit_encoding */ + +/* -------------------------- GL_ARB_shader_clock -------------------------- */ + +#ifndef GL_ARB_shader_clock +#define GL_ARB_shader_clock 1 + +#define GLEW_ARB_shader_clock GLEW_GET_VAR(__GLEW_ARB_shader_clock) + +#endif /* GL_ARB_shader_clock */ + +/* --------------------- GL_ARB_shader_draw_parameters --------------------- */ + +#ifndef GL_ARB_shader_draw_parameters +#define GL_ARB_shader_draw_parameters 1 + +#define GLEW_ARB_shader_draw_parameters GLEW_GET_VAR(__GLEW_ARB_shader_draw_parameters) + +#endif /* GL_ARB_shader_draw_parameters */ + +/* ------------------------ GL_ARB_shader_group_vote ----------------------- */ + +#ifndef GL_ARB_shader_group_vote +#define GL_ARB_shader_group_vote 1 + +#define GLEW_ARB_shader_group_vote GLEW_GET_VAR(__GLEW_ARB_shader_group_vote) + +#endif /* GL_ARB_shader_group_vote */ + +/* --------------------- GL_ARB_shader_image_load_store -------------------- */ + +#ifndef GL_ARB_shader_image_load_store +#define GL_ARB_shader_image_load_store 1 + +#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001 +#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 +#define GL_UNIFORM_BARRIER_BIT 0x00000004 +#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008 +#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020 +#define GL_COMMAND_BARRIER_BIT 0x00000040 +#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080 +#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100 +#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200 +#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400 +#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800 +#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000 +#define GL_MAX_IMAGE_UNITS 0x8F38 +#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39 +#define GL_IMAGE_BINDING_NAME 0x8F3A +#define GL_IMAGE_BINDING_LEVEL 0x8F3B +#define GL_IMAGE_BINDING_LAYERED 0x8F3C +#define GL_IMAGE_BINDING_LAYER 0x8F3D +#define GL_IMAGE_BINDING_ACCESS 0x8F3E +#define GL_IMAGE_1D 0x904C +#define GL_IMAGE_2D 0x904D +#define GL_IMAGE_3D 0x904E +#define GL_IMAGE_2D_RECT 0x904F +#define GL_IMAGE_CUBE 0x9050 +#define GL_IMAGE_BUFFER 0x9051 +#define GL_IMAGE_1D_ARRAY 0x9052 +#define GL_IMAGE_2D_ARRAY 0x9053 +#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054 +#define GL_IMAGE_2D_MULTISAMPLE 0x9055 +#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056 +#define GL_INT_IMAGE_1D 0x9057 +#define GL_INT_IMAGE_2D 0x9058 +#define GL_INT_IMAGE_3D 0x9059 +#define GL_INT_IMAGE_2D_RECT 0x905A +#define GL_INT_IMAGE_CUBE 0x905B +#define GL_INT_IMAGE_BUFFER 0x905C +#define GL_INT_IMAGE_1D_ARRAY 0x905D +#define GL_INT_IMAGE_2D_ARRAY 0x905E +#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F +#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060 +#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061 +#define GL_UNSIGNED_INT_IMAGE_1D 0x9062 +#define GL_UNSIGNED_INT_IMAGE_2D 0x9063 +#define GL_UNSIGNED_INT_IMAGE_3D 0x9064 +#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065 +#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 +#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067 +#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068 +#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C +#define GL_MAX_IMAGE_SAMPLES 0x906D +#define GL_IMAGE_BINDING_FORMAT 0x906E +#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9 +#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD +#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE +#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF +#define GL_ALL_BARRIER_BITS 0xFFFFFFFF + +typedef void (GLAPIENTRY * PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); +typedef void (GLAPIENTRY * PFNGLMEMORYBARRIERPROC) (GLbitfield barriers); + +#define glBindImageTexture GLEW_GET_FUN(__glewBindImageTexture) +#define glMemoryBarrier GLEW_GET_FUN(__glewMemoryBarrier) + +#define GLEW_ARB_shader_image_load_store GLEW_GET_VAR(__GLEW_ARB_shader_image_load_store) + +#endif /* GL_ARB_shader_image_load_store */ + +/* ------------------------ GL_ARB_shader_image_size ----------------------- */ + +#ifndef GL_ARB_shader_image_size +#define GL_ARB_shader_image_size 1 + +#define GLEW_ARB_shader_image_size GLEW_GET_VAR(__GLEW_ARB_shader_image_size) + +#endif /* GL_ARB_shader_image_size */ + +/* ------------------------- GL_ARB_shader_objects ------------------------- */ + +#ifndef GL_ARB_shader_objects +#define GL_ARB_shader_objects 1 + +#define GL_PROGRAM_OBJECT_ARB 0x8B40 +#define GL_SHADER_OBJECT_ARB 0x8B48 +#define GL_OBJECT_TYPE_ARB 0x8B4E +#define GL_OBJECT_SUBTYPE_ARB 0x8B4F +#define GL_FLOAT_VEC2_ARB 0x8B50 +#define GL_FLOAT_VEC3_ARB 0x8B51 +#define GL_FLOAT_VEC4_ARB 0x8B52 +#define GL_INT_VEC2_ARB 0x8B53 +#define GL_INT_VEC3_ARB 0x8B54 +#define GL_INT_VEC4_ARB 0x8B55 +#define GL_BOOL_ARB 0x8B56 +#define GL_BOOL_VEC2_ARB 0x8B57 +#define GL_BOOL_VEC3_ARB 0x8B58 +#define GL_BOOL_VEC4_ARB 0x8B59 +#define GL_FLOAT_MAT2_ARB 0x8B5A +#define GL_FLOAT_MAT3_ARB 0x8B5B +#define GL_FLOAT_MAT4_ARB 0x8B5C +#define GL_SAMPLER_1D_ARB 0x8B5D +#define GL_SAMPLER_2D_ARB 0x8B5E +#define GL_SAMPLER_3D_ARB 0x8B5F +#define GL_SAMPLER_CUBE_ARB 0x8B60 +#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 +#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 +#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 +#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 +#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 +#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 +#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 +#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 +#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 +#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 +#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 + +typedef char GLcharARB; +typedef unsigned int GLhandleARB; + +typedef void (GLAPIENTRY * PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); +typedef void (GLAPIENTRY * PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); +typedef GLhandleARB (GLAPIENTRY * PFNGLCREATEPROGRAMOBJECTARBPROC) (void); +typedef GLhandleARB (GLAPIENTRY * PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); +typedef void (GLAPIENTRY * PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); +typedef void (GLAPIENTRY * PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); +typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei* length, GLint *size, GLenum *type, GLcharARB *name); +typedef void (GLAPIENTRY * PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei* count, GLhandleARB *obj); +typedef GLhandleARB (GLAPIENTRY * PFNGLGETHANDLEARBPROC) (GLenum pname); +typedef void (GLAPIENTRY * PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei* length, GLcharARB *infoLog); +typedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei* length, GLcharARB *source); +typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB* name); +typedef void (GLAPIENTRY * PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint* params); +typedef void (GLAPIENTRY * PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (GLAPIENTRY * PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB ** string, const GLint *length); +typedef void (GLAPIENTRY * PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); +typedef void (GLAPIENTRY * PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); +typedef void (GLAPIENTRY * PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (GLAPIENTRY * PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); +typedef void (GLAPIENTRY * PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GLAPIENTRY * PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GLAPIENTRY * PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GLAPIENTRY * PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GLAPIENTRY * PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); +typedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); + +#define glAttachObjectARB GLEW_GET_FUN(__glewAttachObjectARB) +#define glCompileShaderARB GLEW_GET_FUN(__glewCompileShaderARB) +#define glCreateProgramObjectARB GLEW_GET_FUN(__glewCreateProgramObjectARB) +#define glCreateShaderObjectARB GLEW_GET_FUN(__glewCreateShaderObjectARB) +#define glDeleteObjectARB GLEW_GET_FUN(__glewDeleteObjectARB) +#define glDetachObjectARB GLEW_GET_FUN(__glewDetachObjectARB) +#define glGetActiveUniformARB GLEW_GET_FUN(__glewGetActiveUniformARB) +#define glGetAttachedObjectsARB GLEW_GET_FUN(__glewGetAttachedObjectsARB) +#define glGetHandleARB GLEW_GET_FUN(__glewGetHandleARB) +#define glGetInfoLogARB GLEW_GET_FUN(__glewGetInfoLogARB) +#define glGetObjectParameterfvARB GLEW_GET_FUN(__glewGetObjectParameterfvARB) +#define glGetObjectParameterivARB GLEW_GET_FUN(__glewGetObjectParameterivARB) +#define glGetShaderSourceARB GLEW_GET_FUN(__glewGetShaderSourceARB) +#define glGetUniformLocationARB GLEW_GET_FUN(__glewGetUniformLocationARB) +#define glGetUniformfvARB GLEW_GET_FUN(__glewGetUniformfvARB) +#define glGetUniformivARB GLEW_GET_FUN(__glewGetUniformivARB) +#define glLinkProgramARB GLEW_GET_FUN(__glewLinkProgramARB) +#define glShaderSourceARB GLEW_GET_FUN(__glewShaderSourceARB) +#define glUniform1fARB GLEW_GET_FUN(__glewUniform1fARB) +#define glUniform1fvARB GLEW_GET_FUN(__glewUniform1fvARB) +#define glUniform1iARB GLEW_GET_FUN(__glewUniform1iARB) +#define glUniform1ivARB GLEW_GET_FUN(__glewUniform1ivARB) +#define glUniform2fARB GLEW_GET_FUN(__glewUniform2fARB) +#define glUniform2fvARB GLEW_GET_FUN(__glewUniform2fvARB) +#define glUniform2iARB GLEW_GET_FUN(__glewUniform2iARB) +#define glUniform2ivARB GLEW_GET_FUN(__glewUniform2ivARB) +#define glUniform3fARB GLEW_GET_FUN(__glewUniform3fARB) +#define glUniform3fvARB GLEW_GET_FUN(__glewUniform3fvARB) +#define glUniform3iARB GLEW_GET_FUN(__glewUniform3iARB) +#define glUniform3ivARB GLEW_GET_FUN(__glewUniform3ivARB) +#define glUniform4fARB GLEW_GET_FUN(__glewUniform4fARB) +#define glUniform4fvARB GLEW_GET_FUN(__glewUniform4fvARB) +#define glUniform4iARB GLEW_GET_FUN(__glewUniform4iARB) +#define glUniform4ivARB GLEW_GET_FUN(__glewUniform4ivARB) +#define glUniformMatrix2fvARB GLEW_GET_FUN(__glewUniformMatrix2fvARB) +#define glUniformMatrix3fvARB GLEW_GET_FUN(__glewUniformMatrix3fvARB) +#define glUniformMatrix4fvARB GLEW_GET_FUN(__glewUniformMatrix4fvARB) +#define glUseProgramObjectARB GLEW_GET_FUN(__glewUseProgramObjectARB) +#define glValidateProgramARB GLEW_GET_FUN(__glewValidateProgramARB) + +#define GLEW_ARB_shader_objects GLEW_GET_VAR(__GLEW_ARB_shader_objects) + +#endif /* GL_ARB_shader_objects */ + +/* ------------------------ GL_ARB_shader_precision ------------------------ */ + +#ifndef GL_ARB_shader_precision +#define GL_ARB_shader_precision 1 + +#define GLEW_ARB_shader_precision GLEW_GET_VAR(__GLEW_ARB_shader_precision) + +#endif /* GL_ARB_shader_precision */ + +/* ---------------------- GL_ARB_shader_stencil_export --------------------- */ + +#ifndef GL_ARB_shader_stencil_export +#define GL_ARB_shader_stencil_export 1 + +#define GLEW_ARB_shader_stencil_export GLEW_GET_VAR(__GLEW_ARB_shader_stencil_export) + +#endif /* GL_ARB_shader_stencil_export */ + +/* ------------------ GL_ARB_shader_storage_buffer_object ------------------ */ + +#ifndef GL_ARB_shader_storage_buffer_object +#define GL_ARB_shader_storage_buffer_object 1 + +#define GL_SHADER_STORAGE_BARRIER_BIT 0x2000 +#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39 +#define GL_SHADER_STORAGE_BUFFER 0x90D2 +#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 +#define GL_SHADER_STORAGE_BUFFER_START 0x90D4 +#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5 +#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6 +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7 +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9 +#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA +#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB +#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC +#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD +#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE +#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF + +typedef void (GLAPIENTRY * PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); + +#define glShaderStorageBlockBinding GLEW_GET_FUN(__glewShaderStorageBlockBinding) + +#define GLEW_ARB_shader_storage_buffer_object GLEW_GET_VAR(__GLEW_ARB_shader_storage_buffer_object) + +#endif /* GL_ARB_shader_storage_buffer_object */ + +/* ------------------------ GL_ARB_shader_subroutine ----------------------- */ + +#ifndef GL_ARB_shader_subroutine +#define GL_ARB_shader_subroutine 1 + +#define GL_ACTIVE_SUBROUTINES 0x8DE5 +#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 +#define GL_MAX_SUBROUTINES 0x8DE7 +#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 +#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 +#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A +#define GL_COMPATIBLE_SUBROUTINES 0x8E4B + +typedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei* length, GLchar *name); +typedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei* length, GLchar *name); +typedef void (GLAPIENTRY * PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint* values); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint* values); +typedef GLuint (GLAPIENTRY * PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar* name); +typedef GLint (GLAPIENTRY * PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar* name); +typedef void (GLAPIENTRY * PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint* params); +typedef void (GLAPIENTRY * PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint* indices); + +#define glGetActiveSubroutineName GLEW_GET_FUN(__glewGetActiveSubroutineName) +#define glGetActiveSubroutineUniformName GLEW_GET_FUN(__glewGetActiveSubroutineUniformName) +#define glGetActiveSubroutineUniformiv GLEW_GET_FUN(__glewGetActiveSubroutineUniformiv) +#define glGetProgramStageiv GLEW_GET_FUN(__glewGetProgramStageiv) +#define glGetSubroutineIndex GLEW_GET_FUN(__glewGetSubroutineIndex) +#define glGetSubroutineUniformLocation GLEW_GET_FUN(__glewGetSubroutineUniformLocation) +#define glGetUniformSubroutineuiv GLEW_GET_FUN(__glewGetUniformSubroutineuiv) +#define glUniformSubroutinesuiv GLEW_GET_FUN(__glewUniformSubroutinesuiv) + +#define GLEW_ARB_shader_subroutine GLEW_GET_VAR(__GLEW_ARB_shader_subroutine) + +#endif /* GL_ARB_shader_subroutine */ + +/* ------------------ GL_ARB_shader_texture_image_samples ------------------ */ + +#ifndef GL_ARB_shader_texture_image_samples +#define GL_ARB_shader_texture_image_samples 1 + +#define GLEW_ARB_shader_texture_image_samples GLEW_GET_VAR(__GLEW_ARB_shader_texture_image_samples) + +#endif /* GL_ARB_shader_texture_image_samples */ + +/* ----------------------- GL_ARB_shader_texture_lod ----------------------- */ + +#ifndef GL_ARB_shader_texture_lod +#define GL_ARB_shader_texture_lod 1 + +#define GLEW_ARB_shader_texture_lod GLEW_GET_VAR(__GLEW_ARB_shader_texture_lod) + +#endif /* GL_ARB_shader_texture_lod */ + +/* ------------------- GL_ARB_shader_viewport_layer_array ------------------ */ + +#ifndef GL_ARB_shader_viewport_layer_array +#define GL_ARB_shader_viewport_layer_array 1 + +#define GLEW_ARB_shader_viewport_layer_array GLEW_GET_VAR(__GLEW_ARB_shader_viewport_layer_array) + +#endif /* GL_ARB_shader_viewport_layer_array */ + +/* ---------------------- GL_ARB_shading_language_100 ---------------------- */ + +#ifndef GL_ARB_shading_language_100 +#define GL_ARB_shading_language_100 1 + +#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C + +#define GLEW_ARB_shading_language_100 GLEW_GET_VAR(__GLEW_ARB_shading_language_100) + +#endif /* GL_ARB_shading_language_100 */ + +/* -------------------- GL_ARB_shading_language_420pack -------------------- */ + +#ifndef GL_ARB_shading_language_420pack +#define GL_ARB_shading_language_420pack 1 + +#define GLEW_ARB_shading_language_420pack GLEW_GET_VAR(__GLEW_ARB_shading_language_420pack) + +#endif /* GL_ARB_shading_language_420pack */ + +/* -------------------- GL_ARB_shading_language_include -------------------- */ + +#ifndef GL_ARB_shading_language_include +#define GL_ARB_shading_language_include 1 + +#define GL_SHADER_INCLUDE_ARB 0x8DAE +#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9 +#define GL_NAMED_STRING_TYPE_ARB 0x8DEA + +typedef void (GLAPIENTRY * PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar* const *path, const GLint *length); +typedef void (GLAPIENTRY * PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name); +typedef void (GLAPIENTRY * PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name, GLsizei bufSize, GLint *stringlen, GLchar *string); +typedef void (GLAPIENTRY * PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar* name, GLenum pname, GLint *params); +typedef GLboolean (GLAPIENTRY * PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar* name); +typedef void (GLAPIENTRY * PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar* name, GLint stringlen, const GLchar *string); + +#define glCompileShaderIncludeARB GLEW_GET_FUN(__glewCompileShaderIncludeARB) +#define glDeleteNamedStringARB GLEW_GET_FUN(__glewDeleteNamedStringARB) +#define glGetNamedStringARB GLEW_GET_FUN(__glewGetNamedStringARB) +#define glGetNamedStringivARB GLEW_GET_FUN(__glewGetNamedStringivARB) +#define glIsNamedStringARB GLEW_GET_FUN(__glewIsNamedStringARB) +#define glNamedStringARB GLEW_GET_FUN(__glewNamedStringARB) + +#define GLEW_ARB_shading_language_include GLEW_GET_VAR(__GLEW_ARB_shading_language_include) + +#endif /* GL_ARB_shading_language_include */ + +/* -------------------- GL_ARB_shading_language_packing -------------------- */ + +#ifndef GL_ARB_shading_language_packing +#define GL_ARB_shading_language_packing 1 + +#define GLEW_ARB_shading_language_packing GLEW_GET_VAR(__GLEW_ARB_shading_language_packing) + +#endif /* GL_ARB_shading_language_packing */ + +/* ----------------------------- GL_ARB_shadow ----------------------------- */ + +#ifndef GL_ARB_shadow +#define GL_ARB_shadow 1 + +#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C +#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D +#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E + +#define GLEW_ARB_shadow GLEW_GET_VAR(__GLEW_ARB_shadow) + +#endif /* GL_ARB_shadow */ + +/* ------------------------- GL_ARB_shadow_ambient ------------------------- */ + +#ifndef GL_ARB_shadow_ambient +#define GL_ARB_shadow_ambient 1 + +#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF + +#define GLEW_ARB_shadow_ambient GLEW_GET_VAR(__GLEW_ARB_shadow_ambient) + +#endif /* GL_ARB_shadow_ambient */ + +/* -------------------------- GL_ARB_sparse_buffer ------------------------- */ + +#ifndef GL_ARB_sparse_buffer +#define GL_ARB_sparse_buffer 1 + +#define GL_SPARSE_STORAGE_BIT_ARB 0x0400 +#define GL_SPARSE_BUFFER_PAGE_SIZE_ARB 0x82F8 + +typedef void (GLAPIENTRY * PFNGLBUFFERPAGECOMMITMENTARBPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); + +#define glBufferPageCommitmentARB GLEW_GET_FUN(__glewBufferPageCommitmentARB) + +#define GLEW_ARB_sparse_buffer GLEW_GET_VAR(__GLEW_ARB_sparse_buffer) + +#endif /* GL_ARB_sparse_buffer */ + +/* ------------------------- GL_ARB_sparse_texture ------------------------- */ + +#ifndef GL_ARB_sparse_texture +#define GL_ARB_sparse_texture 1 + +#define GL_VIRTUAL_PAGE_SIZE_X_ARB 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_ARB 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_ARB 0x9197 +#define GL_MAX_SPARSE_TEXTURE_SIZE_ARB 0x9198 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A +#define GL_TEXTURE_SPARSE_ARB 0x91A6 +#define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7 +#define GL_NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8 +#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9 +#define GL_NUM_SPARSE_LEVELS_ARB 0x91AA + +typedef void (GLAPIENTRY * PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +typedef void (GLAPIENTRY * PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); + +#define glTexPageCommitmentARB GLEW_GET_FUN(__glewTexPageCommitmentARB) +#define glTexturePageCommitmentEXT GLEW_GET_FUN(__glewTexturePageCommitmentEXT) + +#define GLEW_ARB_sparse_texture GLEW_GET_VAR(__GLEW_ARB_sparse_texture) + +#endif /* GL_ARB_sparse_texture */ + +/* ------------------------- GL_ARB_sparse_texture2 ------------------------ */ + +#ifndef GL_ARB_sparse_texture2 +#define GL_ARB_sparse_texture2 1 + +#define GLEW_ARB_sparse_texture2 GLEW_GET_VAR(__GLEW_ARB_sparse_texture2) + +#endif /* GL_ARB_sparse_texture2 */ + +/* ---------------------- GL_ARB_sparse_texture_clamp ---------------------- */ + +#ifndef GL_ARB_sparse_texture_clamp +#define GL_ARB_sparse_texture_clamp 1 + +#define GLEW_ARB_sparse_texture_clamp GLEW_GET_VAR(__GLEW_ARB_sparse_texture_clamp) + +#endif /* GL_ARB_sparse_texture_clamp */ + +/* ------------------------ GL_ARB_stencil_texturing ----------------------- */ + +#ifndef GL_ARB_stencil_texturing +#define GL_ARB_stencil_texturing 1 + +#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA + +#define GLEW_ARB_stencil_texturing GLEW_GET_VAR(__GLEW_ARB_stencil_texturing) + +#endif /* GL_ARB_stencil_texturing */ + +/* ------------------------------ GL_ARB_sync ------------------------------ */ + +#ifndef GL_ARB_sync +#define GL_ARB_sync 1 + +#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 +#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 +#define GL_OBJECT_TYPE 0x9112 +#define GL_SYNC_CONDITION 0x9113 +#define GL_SYNC_STATUS 0x9114 +#define GL_SYNC_FLAGS 0x9115 +#define GL_SYNC_FENCE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 +#define GL_UNSIGNALED 0x9118 +#define GL_SIGNALED 0x9119 +#define GL_ALREADY_SIGNALED 0x911A +#define GL_TIMEOUT_EXPIRED 0x911B +#define GL_CONDITION_SATISFIED 0x911C +#define GL_WAIT_FAILED 0x911D +#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF + +typedef GLenum (GLAPIENTRY * PFNGLCLIENTWAITSYNCPROC) (GLsync GLsync,GLbitfield flags,GLuint64 timeout); +typedef void (GLAPIENTRY * PFNGLDELETESYNCPROC) (GLsync GLsync); +typedef GLsync (GLAPIENTRY * PFNGLFENCESYNCPROC) (GLenum condition,GLbitfield flags); +typedef void (GLAPIENTRY * PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64* params); +typedef void (GLAPIENTRY * PFNGLGETSYNCIVPROC) (GLsync GLsync,GLenum pname,GLsizei bufSize,GLsizei* length, GLint *values); +typedef GLboolean (GLAPIENTRY * PFNGLISSYNCPROC) (GLsync GLsync); +typedef void (GLAPIENTRY * PFNGLWAITSYNCPROC) (GLsync GLsync,GLbitfield flags,GLuint64 timeout); + +#define glClientWaitSync GLEW_GET_FUN(__glewClientWaitSync) +#define glDeleteSync GLEW_GET_FUN(__glewDeleteSync) +#define glFenceSync GLEW_GET_FUN(__glewFenceSync) +#define glGetInteger64v GLEW_GET_FUN(__glewGetInteger64v) +#define glGetSynciv GLEW_GET_FUN(__glewGetSynciv) +#define glIsSync GLEW_GET_FUN(__glewIsSync) +#define glWaitSync GLEW_GET_FUN(__glewWaitSync) + +#define GLEW_ARB_sync GLEW_GET_VAR(__GLEW_ARB_sync) + +#endif /* GL_ARB_sync */ + +/* ----------------------- GL_ARB_tessellation_shader ---------------------- */ + +#ifndef GL_ARB_tessellation_shader +#define GL_ARB_tessellation_shader 1 + +#define GL_PATCHES 0xE +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F +#define GL_PATCH_VERTICES 0x8E72 +#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 +#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 +#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 +#define GL_TESS_GEN_MODE 0x8E76 +#define GL_TESS_GEN_SPACING 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER 0x8E78 +#define GL_TESS_GEN_POINT_MODE 0x8E79 +#define GL_ISOLINES 0x8E7A +#define GL_FRACTIONAL_ODD 0x8E7B +#define GL_FRACTIONAL_EVEN 0x8E7C +#define GL_MAX_PATCH_VERTICES 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 +#define GL_TESS_EVALUATION_SHADER 0x8E87 +#define GL_TESS_CONTROL_SHADER 0x8E88 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A + +typedef void (GLAPIENTRY * PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat* values); +typedef void (GLAPIENTRY * PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value); + +#define glPatchParameterfv GLEW_GET_FUN(__glewPatchParameterfv) +#define glPatchParameteri GLEW_GET_FUN(__glewPatchParameteri) + +#define GLEW_ARB_tessellation_shader GLEW_GET_VAR(__GLEW_ARB_tessellation_shader) + +#endif /* GL_ARB_tessellation_shader */ + +/* ------------------------- GL_ARB_texture_barrier ------------------------ */ + +#ifndef GL_ARB_texture_barrier +#define GL_ARB_texture_barrier 1 + +typedef void (GLAPIENTRY * PFNGLTEXTUREBARRIERPROC) (void); + +#define glTextureBarrier GLEW_GET_FUN(__glewTextureBarrier) + +#define GLEW_ARB_texture_barrier GLEW_GET_VAR(__GLEW_ARB_texture_barrier) + +#endif /* GL_ARB_texture_barrier */ + +/* ---------------------- GL_ARB_texture_border_clamp ---------------------- */ + +#ifndef GL_ARB_texture_border_clamp +#define GL_ARB_texture_border_clamp 1 + +#define GL_CLAMP_TO_BORDER_ARB 0x812D + +#define GLEW_ARB_texture_border_clamp GLEW_GET_VAR(__GLEW_ARB_texture_border_clamp) + +#endif /* GL_ARB_texture_border_clamp */ + +/* ---------------------- GL_ARB_texture_buffer_object --------------------- */ + +#ifndef GL_ARB_texture_buffer_object +#define GL_ARB_texture_buffer_object 1 + +#define GL_TEXTURE_BUFFER_ARB 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E + +typedef void (GLAPIENTRY * PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer); + +#define glTexBufferARB GLEW_GET_FUN(__glewTexBufferARB) + +#define GLEW_ARB_texture_buffer_object GLEW_GET_VAR(__GLEW_ARB_texture_buffer_object) + +#endif /* GL_ARB_texture_buffer_object */ + +/* ------------------- GL_ARB_texture_buffer_object_rgb32 ------------------ */ + +#ifndef GL_ARB_texture_buffer_object_rgb32 +#define GL_ARB_texture_buffer_object_rgb32 1 + +#define GLEW_ARB_texture_buffer_object_rgb32 GLEW_GET_VAR(__GLEW_ARB_texture_buffer_object_rgb32) + +#endif /* GL_ARB_texture_buffer_object_rgb32 */ + +/* ---------------------- GL_ARB_texture_buffer_range ---------------------- */ + +#ifndef GL_ARB_texture_buffer_range +#define GL_ARB_texture_buffer_range 1 + +#define GL_TEXTURE_BUFFER_OFFSET 0x919D +#define GL_TEXTURE_BUFFER_SIZE 0x919E +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F + +typedef void (GLAPIENTRY * PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (GLAPIENTRY * PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); + +#define glTexBufferRange GLEW_GET_FUN(__glewTexBufferRange) +#define glTextureBufferRangeEXT GLEW_GET_FUN(__glewTextureBufferRangeEXT) + +#define GLEW_ARB_texture_buffer_range GLEW_GET_VAR(__GLEW_ARB_texture_buffer_range) + +#endif /* GL_ARB_texture_buffer_range */ + +/* ----------------------- GL_ARB_texture_compression ---------------------- */ + +#ifndef GL_ARB_texture_compression +#define GL_ARB_texture_compression 1 + +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#define GL_COMPRESSED_RGB_ARB 0x84ED +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 + +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, void *img); + +#define glCompressedTexImage1DARB GLEW_GET_FUN(__glewCompressedTexImage1DARB) +#define glCompressedTexImage2DARB GLEW_GET_FUN(__glewCompressedTexImage2DARB) +#define glCompressedTexImage3DARB GLEW_GET_FUN(__glewCompressedTexImage3DARB) +#define glCompressedTexSubImage1DARB GLEW_GET_FUN(__glewCompressedTexSubImage1DARB) +#define glCompressedTexSubImage2DARB GLEW_GET_FUN(__glewCompressedTexSubImage2DARB) +#define glCompressedTexSubImage3DARB GLEW_GET_FUN(__glewCompressedTexSubImage3DARB) +#define glGetCompressedTexImageARB GLEW_GET_FUN(__glewGetCompressedTexImageARB) + +#define GLEW_ARB_texture_compression GLEW_GET_VAR(__GLEW_ARB_texture_compression) + +#endif /* GL_ARB_texture_compression */ + +/* -------------------- GL_ARB_texture_compression_bptc -------------------- */ + +#ifndef GL_ARB_texture_compression_bptc +#define GL_ARB_texture_compression_bptc 1 + +#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F + +#define GLEW_ARB_texture_compression_bptc GLEW_GET_VAR(__GLEW_ARB_texture_compression_bptc) + +#endif /* GL_ARB_texture_compression_bptc */ + +/* -------------------- GL_ARB_texture_compression_rgtc -------------------- */ + +#ifndef GL_ARB_texture_compression_rgtc +#define GL_ARB_texture_compression_rgtc 1 + +#define GL_COMPRESSED_RED_RGTC1 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC +#define GL_COMPRESSED_RG_RGTC2 0x8DBD +#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE + +#define GLEW_ARB_texture_compression_rgtc GLEW_GET_VAR(__GLEW_ARB_texture_compression_rgtc) + +#endif /* GL_ARB_texture_compression_rgtc */ + +/* ------------------------ GL_ARB_texture_cube_map ------------------------ */ + +#ifndef GL_ARB_texture_cube_map +#define GL_ARB_texture_cube_map 1 + +#define GL_NORMAL_MAP_ARB 0x8511 +#define GL_REFLECTION_MAP_ARB 0x8512 +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C + +#define GLEW_ARB_texture_cube_map GLEW_GET_VAR(__GLEW_ARB_texture_cube_map) + +#endif /* GL_ARB_texture_cube_map */ + +/* --------------------- GL_ARB_texture_cube_map_array --------------------- */ + +#ifndef GL_ARB_texture_cube_map_array +#define GL_ARB_texture_cube_map_array 1 + +#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F + +#define GLEW_ARB_texture_cube_map_array GLEW_GET_VAR(__GLEW_ARB_texture_cube_map_array) + +#endif /* GL_ARB_texture_cube_map_array */ + +/* ------------------------- GL_ARB_texture_env_add ------------------------ */ + +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 + +#define GLEW_ARB_texture_env_add GLEW_GET_VAR(__GLEW_ARB_texture_env_add) + +#endif /* GL_ARB_texture_env_add */ + +/* ----------------------- GL_ARB_texture_env_combine ---------------------- */ + +#ifndef GL_ARB_texture_env_combine +#define GL_ARB_texture_env_combine 1 + +#define GL_SUBTRACT_ARB 0x84E7 +#define GL_COMBINE_ARB 0x8570 +#define GL_COMBINE_RGB_ARB 0x8571 +#define GL_COMBINE_ALPHA_ARB 0x8572 +#define GL_RGB_SCALE_ARB 0x8573 +#define GL_ADD_SIGNED_ARB 0x8574 +#define GL_INTERPOLATE_ARB 0x8575 +#define GL_CONSTANT_ARB 0x8576 +#define GL_PRIMARY_COLOR_ARB 0x8577 +#define GL_PREVIOUS_ARB 0x8578 +#define GL_SOURCE0_RGB_ARB 0x8580 +#define GL_SOURCE1_RGB_ARB 0x8581 +#define GL_SOURCE2_RGB_ARB 0x8582 +#define GL_SOURCE0_ALPHA_ARB 0x8588 +#define GL_SOURCE1_ALPHA_ARB 0x8589 +#define GL_SOURCE2_ALPHA_ARB 0x858A +#define GL_OPERAND0_RGB_ARB 0x8590 +#define GL_OPERAND1_RGB_ARB 0x8591 +#define GL_OPERAND2_RGB_ARB 0x8592 +#define GL_OPERAND0_ALPHA_ARB 0x8598 +#define GL_OPERAND1_ALPHA_ARB 0x8599 +#define GL_OPERAND2_ALPHA_ARB 0x859A + +#define GLEW_ARB_texture_env_combine GLEW_GET_VAR(__GLEW_ARB_texture_env_combine) + +#endif /* GL_ARB_texture_env_combine */ + +/* ---------------------- GL_ARB_texture_env_crossbar ---------------------- */ + +#ifndef GL_ARB_texture_env_crossbar +#define GL_ARB_texture_env_crossbar 1 + +#define GLEW_ARB_texture_env_crossbar GLEW_GET_VAR(__GLEW_ARB_texture_env_crossbar) + +#endif /* GL_ARB_texture_env_crossbar */ + +/* ------------------------ GL_ARB_texture_env_dot3 ------------------------ */ + +#ifndef GL_ARB_texture_env_dot3 +#define GL_ARB_texture_env_dot3 1 + +#define GL_DOT3_RGB_ARB 0x86AE +#define GL_DOT3_RGBA_ARB 0x86AF + +#define GLEW_ARB_texture_env_dot3 GLEW_GET_VAR(__GLEW_ARB_texture_env_dot3) + +#endif /* GL_ARB_texture_env_dot3 */ + +/* ---------------------- GL_ARB_texture_filter_minmax --------------------- */ + +#ifndef GL_ARB_texture_filter_minmax +#define GL_ARB_texture_filter_minmax 1 + +#define GL_TEXTURE_REDUCTION_MODE_ARB 0x9366 +#define GL_WEIGHTED_AVERAGE_ARB 0x9367 + +#define GLEW_ARB_texture_filter_minmax GLEW_GET_VAR(__GLEW_ARB_texture_filter_minmax) + +#endif /* GL_ARB_texture_filter_minmax */ + +/* -------------------------- GL_ARB_texture_float ------------------------- */ + +#ifndef GL_ARB_texture_float +#define GL_ARB_texture_float 1 + +#define GL_RGBA32F_ARB 0x8814 +#define GL_RGB32F_ARB 0x8815 +#define GL_ALPHA32F_ARB 0x8816 +#define GL_INTENSITY32F_ARB 0x8817 +#define GL_LUMINANCE32F_ARB 0x8818 +#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 +#define GL_RGBA16F_ARB 0x881A +#define GL_RGB16F_ARB 0x881B +#define GL_ALPHA16F_ARB 0x881C +#define GL_INTENSITY16F_ARB 0x881D +#define GL_LUMINANCE16F_ARB 0x881E +#define GL_LUMINANCE_ALPHA16F_ARB 0x881F +#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 +#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 +#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 +#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 +#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 +#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 + +#define GLEW_ARB_texture_float GLEW_GET_VAR(__GLEW_ARB_texture_float) + +#endif /* GL_ARB_texture_float */ + +/* ------------------------- GL_ARB_texture_gather ------------------------- */ + +#ifndef GL_ARB_texture_gather +#define GL_ARB_texture_gather 1 + +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F +#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F + +#define GLEW_ARB_texture_gather GLEW_GET_VAR(__GLEW_ARB_texture_gather) + +#endif /* GL_ARB_texture_gather */ + +/* ------------------ GL_ARB_texture_mirror_clamp_to_edge ------------------ */ + +#ifndef GL_ARB_texture_mirror_clamp_to_edge +#define GL_ARB_texture_mirror_clamp_to_edge 1 + +#define GL_MIRROR_CLAMP_TO_EDGE 0x8743 + +#define GLEW_ARB_texture_mirror_clamp_to_edge GLEW_GET_VAR(__GLEW_ARB_texture_mirror_clamp_to_edge) + +#endif /* GL_ARB_texture_mirror_clamp_to_edge */ + +/* --------------------- GL_ARB_texture_mirrored_repeat -------------------- */ + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_ARB_texture_mirrored_repeat 1 + +#define GL_MIRRORED_REPEAT_ARB 0x8370 + +#define GLEW_ARB_texture_mirrored_repeat GLEW_GET_VAR(__GLEW_ARB_texture_mirrored_repeat) + +#endif /* GL_ARB_texture_mirrored_repeat */ + +/* ----------------------- GL_ARB_texture_multisample ---------------------- */ + +#ifndef GL_ARB_texture_multisample +#define GL_ARB_texture_multisample 1 + +#define GL_SAMPLE_POSITION 0x8E50 +#define GL_SAMPLE_MASK 0x8E51 +#define GL_SAMPLE_MASK_VALUE 0x8E52 +#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 +#define GL_TEXTURE_SAMPLES 0x9106 +#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 +#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 +#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D +#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E +#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F +#define GL_MAX_INTEGER_SAMPLES 0x9110 + +typedef void (GLAPIENTRY * PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat* val); +typedef void (GLAPIENTRY * PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask); +typedef void (GLAPIENTRY * PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); + +#define glGetMultisamplefv GLEW_GET_FUN(__glewGetMultisamplefv) +#define glSampleMaski GLEW_GET_FUN(__glewSampleMaski) +#define glTexImage2DMultisample GLEW_GET_FUN(__glewTexImage2DMultisample) +#define glTexImage3DMultisample GLEW_GET_FUN(__glewTexImage3DMultisample) + +#define GLEW_ARB_texture_multisample GLEW_GET_VAR(__GLEW_ARB_texture_multisample) + +#endif /* GL_ARB_texture_multisample */ + +/* -------------------- GL_ARB_texture_non_power_of_two -------------------- */ + +#ifndef GL_ARB_texture_non_power_of_two +#define GL_ARB_texture_non_power_of_two 1 + +#define GLEW_ARB_texture_non_power_of_two GLEW_GET_VAR(__GLEW_ARB_texture_non_power_of_two) + +#endif /* GL_ARB_texture_non_power_of_two */ + +/* ---------------------- GL_ARB_texture_query_levels ---------------------- */ + +#ifndef GL_ARB_texture_query_levels +#define GL_ARB_texture_query_levels 1 + +#define GLEW_ARB_texture_query_levels GLEW_GET_VAR(__GLEW_ARB_texture_query_levels) + +#endif /* GL_ARB_texture_query_levels */ + +/* ------------------------ GL_ARB_texture_query_lod ----------------------- */ + +#ifndef GL_ARB_texture_query_lod +#define GL_ARB_texture_query_lod 1 + +#define GLEW_ARB_texture_query_lod GLEW_GET_VAR(__GLEW_ARB_texture_query_lod) + +#endif /* GL_ARB_texture_query_lod */ + +/* ------------------------ GL_ARB_texture_rectangle ----------------------- */ + +#ifndef GL_ARB_texture_rectangle +#define GL_ARB_texture_rectangle 1 + +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 + +#define GLEW_ARB_texture_rectangle GLEW_GET_VAR(__GLEW_ARB_texture_rectangle) + +#endif /* GL_ARB_texture_rectangle */ + +/* --------------------------- GL_ARB_texture_rg --------------------------- */ + +#ifndef GL_ARB_texture_rg +#define GL_ARB_texture_rg 1 + +#define GL_COMPRESSED_RED 0x8225 +#define GL_COMPRESSED_RG 0x8226 +#define GL_RG 0x8227 +#define GL_RG_INTEGER 0x8228 +#define GL_R8 0x8229 +#define GL_R16 0x822A +#define GL_RG8 0x822B +#define GL_RG16 0x822C +#define GL_R16F 0x822D +#define GL_R32F 0x822E +#define GL_RG16F 0x822F +#define GL_RG32F 0x8230 +#define GL_R8I 0x8231 +#define GL_R8UI 0x8232 +#define GL_R16I 0x8233 +#define GL_R16UI 0x8234 +#define GL_R32I 0x8235 +#define GL_R32UI 0x8236 +#define GL_RG8I 0x8237 +#define GL_RG8UI 0x8238 +#define GL_RG16I 0x8239 +#define GL_RG16UI 0x823A +#define GL_RG32I 0x823B +#define GL_RG32UI 0x823C + +#define GLEW_ARB_texture_rg GLEW_GET_VAR(__GLEW_ARB_texture_rg) + +#endif /* GL_ARB_texture_rg */ + +/* ----------------------- GL_ARB_texture_rgb10_a2ui ----------------------- */ + +#ifndef GL_ARB_texture_rgb10_a2ui +#define GL_ARB_texture_rgb10_a2ui 1 + +#define GL_RGB10_A2UI 0x906F + +#define GLEW_ARB_texture_rgb10_a2ui GLEW_GET_VAR(__GLEW_ARB_texture_rgb10_a2ui) + +#endif /* GL_ARB_texture_rgb10_a2ui */ + +/* ------------------------ GL_ARB_texture_stencil8 ------------------------ */ + +#ifndef GL_ARB_texture_stencil8 +#define GL_ARB_texture_stencil8 1 + +#define GL_STENCIL_INDEX 0x1901 +#define GL_STENCIL_INDEX8 0x8D48 + +#define GLEW_ARB_texture_stencil8 GLEW_GET_VAR(__GLEW_ARB_texture_stencil8) + +#endif /* GL_ARB_texture_stencil8 */ + +/* ------------------------- GL_ARB_texture_storage ------------------------ */ + +#ifndef GL_ARB_texture_storage +#define GL_ARB_texture_storage 1 + +#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F + +typedef void (GLAPIENTRY * PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GLAPIENTRY * PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); + +#define glTexStorage1D GLEW_GET_FUN(__glewTexStorage1D) +#define glTexStorage2D GLEW_GET_FUN(__glewTexStorage2D) +#define glTexStorage3D GLEW_GET_FUN(__glewTexStorage3D) +#define glTextureStorage1DEXT GLEW_GET_FUN(__glewTextureStorage1DEXT) +#define glTextureStorage2DEXT GLEW_GET_FUN(__glewTextureStorage2DEXT) +#define glTextureStorage3DEXT GLEW_GET_FUN(__glewTextureStorage3DEXT) + +#define GLEW_ARB_texture_storage GLEW_GET_VAR(__GLEW_ARB_texture_storage) + +#endif /* GL_ARB_texture_storage */ + +/* ------------------- GL_ARB_texture_storage_multisample ------------------ */ + +#ifndef GL_ARB_texture_storage_multisample +#define GL_ARB_texture_storage_multisample 1 + +typedef void (GLAPIENTRY * PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (GLAPIENTRY * PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (GLAPIENTRY * PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); + +#define glTexStorage2DMultisample GLEW_GET_FUN(__glewTexStorage2DMultisample) +#define glTexStorage3DMultisample GLEW_GET_FUN(__glewTexStorage3DMultisample) +#define glTextureStorage2DMultisampleEXT GLEW_GET_FUN(__glewTextureStorage2DMultisampleEXT) +#define glTextureStorage3DMultisampleEXT GLEW_GET_FUN(__glewTextureStorage3DMultisampleEXT) + +#define GLEW_ARB_texture_storage_multisample GLEW_GET_VAR(__GLEW_ARB_texture_storage_multisample) + +#endif /* GL_ARB_texture_storage_multisample */ + +/* ------------------------- GL_ARB_texture_swizzle ------------------------ */ + +#ifndef GL_ARB_texture_swizzle +#define GL_ARB_texture_swizzle 1 + +#define GL_TEXTURE_SWIZZLE_R 0x8E42 +#define GL_TEXTURE_SWIZZLE_G 0x8E43 +#define GL_TEXTURE_SWIZZLE_B 0x8E44 +#define GL_TEXTURE_SWIZZLE_A 0x8E45 +#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 + +#define GLEW_ARB_texture_swizzle GLEW_GET_VAR(__GLEW_ARB_texture_swizzle) + +#endif /* GL_ARB_texture_swizzle */ + +/* -------------------------- GL_ARB_texture_view -------------------------- */ + +#ifndef GL_ARB_texture_view +#define GL_ARB_texture_view 1 + +#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF + +typedef void (GLAPIENTRY * PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); + +#define glTextureView GLEW_GET_FUN(__glewTextureView) + +#define GLEW_ARB_texture_view GLEW_GET_VAR(__GLEW_ARB_texture_view) + +#endif /* GL_ARB_texture_view */ + +/* --------------------------- GL_ARB_timer_query -------------------------- */ + +#ifndef GL_ARB_timer_query +#define GL_ARB_timer_query 1 + +#define GL_TIME_ELAPSED 0x88BF +#define GL_TIMESTAMP 0x8E28 + +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64* params); +typedef void (GLAPIENTRY * PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target); + +#define glGetQueryObjecti64v GLEW_GET_FUN(__glewGetQueryObjecti64v) +#define glGetQueryObjectui64v GLEW_GET_FUN(__glewGetQueryObjectui64v) +#define glQueryCounter GLEW_GET_FUN(__glewQueryCounter) + +#define GLEW_ARB_timer_query GLEW_GET_VAR(__GLEW_ARB_timer_query) + +#endif /* GL_ARB_timer_query */ + +/* ----------------------- GL_ARB_transform_feedback2 ---------------------- */ + +#ifndef GL_ARB_transform_feedback2 +#define GL_ARB_transform_feedback2 1 + +#define GL_TRANSFORM_FEEDBACK 0x8E22 +#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 +#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 + +typedef void (GLAPIENTRY * PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id); +typedef void (GLAPIENTRY * PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint* ids); +typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id); +typedef void (GLAPIENTRY * PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint* ids); +typedef GLboolean (GLAPIENTRY * PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLPAUSETRANSFORMFEEDBACKPROC) (void); +typedef void (GLAPIENTRY * PFNGLRESUMETRANSFORMFEEDBACKPROC) (void); + +#define glBindTransformFeedback GLEW_GET_FUN(__glewBindTransformFeedback) +#define glDeleteTransformFeedbacks GLEW_GET_FUN(__glewDeleteTransformFeedbacks) +#define glDrawTransformFeedback GLEW_GET_FUN(__glewDrawTransformFeedback) +#define glGenTransformFeedbacks GLEW_GET_FUN(__glewGenTransformFeedbacks) +#define glIsTransformFeedback GLEW_GET_FUN(__glewIsTransformFeedback) +#define glPauseTransformFeedback GLEW_GET_FUN(__glewPauseTransformFeedback) +#define glResumeTransformFeedback GLEW_GET_FUN(__glewResumeTransformFeedback) + +#define GLEW_ARB_transform_feedback2 GLEW_GET_VAR(__GLEW_ARB_transform_feedback2) + +#endif /* GL_ARB_transform_feedback2 */ + +/* ----------------------- GL_ARB_transform_feedback3 ---------------------- */ + +#ifndef GL_ARB_transform_feedback3 +#define GL_ARB_transform_feedback3 1 + +#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 +#define GL_MAX_VERTEX_STREAMS 0x8E71 + +typedef void (GLAPIENTRY * PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id); +typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream); +typedef void (GLAPIENTRY * PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index); +typedef void (GLAPIENTRY * PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint* params); + +#define glBeginQueryIndexed GLEW_GET_FUN(__glewBeginQueryIndexed) +#define glDrawTransformFeedbackStream GLEW_GET_FUN(__glewDrawTransformFeedbackStream) +#define glEndQueryIndexed GLEW_GET_FUN(__glewEndQueryIndexed) +#define glGetQueryIndexediv GLEW_GET_FUN(__glewGetQueryIndexediv) + +#define GLEW_ARB_transform_feedback3 GLEW_GET_VAR(__GLEW_ARB_transform_feedback3) + +#endif /* GL_ARB_transform_feedback3 */ + +/* ------------------ GL_ARB_transform_feedback_instanced ------------------ */ + +#ifndef GL_ARB_transform_feedback_instanced +#define GL_ARB_transform_feedback_instanced 1 + +typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei primcount); + +#define glDrawTransformFeedbackInstanced GLEW_GET_FUN(__glewDrawTransformFeedbackInstanced) +#define glDrawTransformFeedbackStreamInstanced GLEW_GET_FUN(__glewDrawTransformFeedbackStreamInstanced) + +#define GLEW_ARB_transform_feedback_instanced GLEW_GET_VAR(__GLEW_ARB_transform_feedback_instanced) + +#endif /* GL_ARB_transform_feedback_instanced */ + +/* ---------------- GL_ARB_transform_feedback_overflow_query --------------- */ + +#ifndef GL_ARB_transform_feedback_overflow_query +#define GL_ARB_transform_feedback_overflow_query 1 + +#define GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB 0x82EC +#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB 0x82ED + +#define GLEW_ARB_transform_feedback_overflow_query GLEW_GET_VAR(__GLEW_ARB_transform_feedback_overflow_query) + +#endif /* GL_ARB_transform_feedback_overflow_query */ + +/* ------------------------ GL_ARB_transpose_matrix ------------------------ */ + +#ifndef GL_ARB_transpose_matrix +#define GL_ARB_transpose_matrix 1 + +#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 + +typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXDARBPROC) (GLdouble m[16]); +typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXFARBPROC) (GLfloat m[16]); +typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXDARBPROC) (GLdouble m[16]); +typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFARBPROC) (GLfloat m[16]); + +#define glLoadTransposeMatrixdARB GLEW_GET_FUN(__glewLoadTransposeMatrixdARB) +#define glLoadTransposeMatrixfARB GLEW_GET_FUN(__glewLoadTransposeMatrixfARB) +#define glMultTransposeMatrixdARB GLEW_GET_FUN(__glewMultTransposeMatrixdARB) +#define glMultTransposeMatrixfARB GLEW_GET_FUN(__glewMultTransposeMatrixfARB) + +#define GLEW_ARB_transpose_matrix GLEW_GET_VAR(__GLEW_ARB_transpose_matrix) + +#endif /* GL_ARB_transpose_matrix */ + +/* ---------------------- GL_ARB_uniform_buffer_object --------------------- */ + +#ifndef GL_ARB_uniform_buffer_object +#define GL_ARB_uniform_buffer_object 1 + +#define GL_UNIFORM_BUFFER 0x8A11 +#define GL_UNIFORM_BUFFER_BINDING 0x8A28 +#define GL_UNIFORM_BUFFER_START 0x8A29 +#define GL_UNIFORM_BUFFER_SIZE 0x8A2A +#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C +#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D +#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E +#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F +#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 +#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 +#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 +#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 +#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 +#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 +#define GL_UNIFORM_TYPE 0x8A37 +#define GL_UNIFORM_SIZE 0x8A38 +#define GL_UNIFORM_NAME_LENGTH 0x8A39 +#define GL_UNIFORM_BLOCK_INDEX 0x8A3A +#define GL_UNIFORM_OFFSET 0x8A3B +#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C +#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D +#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E +#define GL_UNIFORM_BLOCK_BINDING 0x8A3F +#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 +#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 +#define GL_INVALID_INDEX 0xFFFFFFFF + +typedef void (GLAPIENTRY * PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName); +typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformName); +typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint* data); +typedef GLuint (GLAPIENTRY * PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar* uniformBlockName); +typedef void (GLAPIENTRY * PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* const * uniformNames, GLuint* uniformIndices); +typedef void (GLAPIENTRY * PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); + +#define glBindBufferBase GLEW_GET_FUN(__glewBindBufferBase) +#define glBindBufferRange GLEW_GET_FUN(__glewBindBufferRange) +#define glGetActiveUniformBlockName GLEW_GET_FUN(__glewGetActiveUniformBlockName) +#define glGetActiveUniformBlockiv GLEW_GET_FUN(__glewGetActiveUniformBlockiv) +#define glGetActiveUniformName GLEW_GET_FUN(__glewGetActiveUniformName) +#define glGetActiveUniformsiv GLEW_GET_FUN(__glewGetActiveUniformsiv) +#define glGetIntegeri_v GLEW_GET_FUN(__glewGetIntegeri_v) +#define glGetUniformBlockIndex GLEW_GET_FUN(__glewGetUniformBlockIndex) +#define glGetUniformIndices GLEW_GET_FUN(__glewGetUniformIndices) +#define glUniformBlockBinding GLEW_GET_FUN(__glewUniformBlockBinding) + +#define GLEW_ARB_uniform_buffer_object GLEW_GET_VAR(__GLEW_ARB_uniform_buffer_object) + +#endif /* GL_ARB_uniform_buffer_object */ + +/* ------------------------ GL_ARB_vertex_array_bgra ----------------------- */ + +#ifndef GL_ARB_vertex_array_bgra +#define GL_ARB_vertex_array_bgra 1 + +#define GL_BGRA 0x80E1 + +#define GLEW_ARB_vertex_array_bgra GLEW_GET_VAR(__GLEW_ARB_vertex_array_bgra) + +#endif /* GL_ARB_vertex_array_bgra */ + +/* ----------------------- GL_ARB_vertex_array_object ---------------------- */ + +#ifndef GL_ARB_vertex_array_object +#define GL_ARB_vertex_array_object 1 + +#define GL_VERTEX_ARRAY_BINDING 0x85B5 + +typedef void (GLAPIENTRY * PFNGLBINDVERTEXARRAYPROC) (GLuint array); +typedef void (GLAPIENTRY * PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint* arrays); +typedef void (GLAPIENTRY * PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint* arrays); +typedef GLboolean (GLAPIENTRY * PFNGLISVERTEXARRAYPROC) (GLuint array); + +#define glBindVertexArray GLEW_GET_FUN(__glewBindVertexArray) +#define glDeleteVertexArrays GLEW_GET_FUN(__glewDeleteVertexArrays) +#define glGenVertexArrays GLEW_GET_FUN(__glewGenVertexArrays) +#define glIsVertexArray GLEW_GET_FUN(__glewIsVertexArray) + +#define GLEW_ARB_vertex_array_object GLEW_GET_VAR(__GLEW_ARB_vertex_array_object) + +#endif /* GL_ARB_vertex_array_object */ + +/* ----------------------- GL_ARB_vertex_attrib_64bit ---------------------- */ + +#ifndef GL_ARB_vertex_attrib_64bit +#define GL_ARB_vertex_attrib_64bit 1 + +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer); + +#define glGetVertexAttribLdv GLEW_GET_FUN(__glewGetVertexAttribLdv) +#define glVertexAttribL1d GLEW_GET_FUN(__glewVertexAttribL1d) +#define glVertexAttribL1dv GLEW_GET_FUN(__glewVertexAttribL1dv) +#define glVertexAttribL2d GLEW_GET_FUN(__glewVertexAttribL2d) +#define glVertexAttribL2dv GLEW_GET_FUN(__glewVertexAttribL2dv) +#define glVertexAttribL3d GLEW_GET_FUN(__glewVertexAttribL3d) +#define glVertexAttribL3dv GLEW_GET_FUN(__glewVertexAttribL3dv) +#define glVertexAttribL4d GLEW_GET_FUN(__glewVertexAttribL4d) +#define glVertexAttribL4dv GLEW_GET_FUN(__glewVertexAttribL4dv) +#define glVertexAttribLPointer GLEW_GET_FUN(__glewVertexAttribLPointer) + +#define GLEW_ARB_vertex_attrib_64bit GLEW_GET_VAR(__GLEW_ARB_vertex_attrib_64bit) + +#endif /* GL_ARB_vertex_attrib_64bit */ + +/* ---------------------- GL_ARB_vertex_attrib_binding --------------------- */ + +#ifndef GL_ARB_vertex_attrib_binding +#define GL_ARB_vertex_attrib_binding 1 + +#define GL_VERTEX_ATTRIB_BINDING 0x82D4 +#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 +#define GL_VERTEX_BINDING_DIVISOR 0x82D6 +#define GL_VERTEX_BINDING_OFFSET 0x82D7 +#define GL_VERTEX_BINDING_STRIDE 0x82D8 +#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 +#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA +#define GL_VERTEX_BINDING_BUFFER 0x8F4F + +typedef void (GLAPIENTRY * PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (GLAPIENTRY * PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor); + +#define glBindVertexBuffer GLEW_GET_FUN(__glewBindVertexBuffer) +#define glVertexArrayBindVertexBufferEXT GLEW_GET_FUN(__glewVertexArrayBindVertexBufferEXT) +#define glVertexArrayVertexAttribBindingEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribBindingEXT) +#define glVertexArrayVertexAttribFormatEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribFormatEXT) +#define glVertexArrayVertexAttribIFormatEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribIFormatEXT) +#define glVertexArrayVertexAttribLFormatEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribLFormatEXT) +#define glVertexArrayVertexBindingDivisorEXT GLEW_GET_FUN(__glewVertexArrayVertexBindingDivisorEXT) +#define glVertexAttribBinding GLEW_GET_FUN(__glewVertexAttribBinding) +#define glVertexAttribFormat GLEW_GET_FUN(__glewVertexAttribFormat) +#define glVertexAttribIFormat GLEW_GET_FUN(__glewVertexAttribIFormat) +#define glVertexAttribLFormat GLEW_GET_FUN(__glewVertexAttribLFormat) +#define glVertexBindingDivisor GLEW_GET_FUN(__glewVertexBindingDivisor) + +#define GLEW_ARB_vertex_attrib_binding GLEW_GET_VAR(__GLEW_ARB_vertex_attrib_binding) + +#endif /* GL_ARB_vertex_attrib_binding */ + +/* -------------------------- GL_ARB_vertex_blend -------------------------- */ + +#ifndef GL_ARB_vertex_blend +#define GL_ARB_vertex_blend 1 + +#define GL_MODELVIEW0_ARB 0x1700 +#define GL_MODELVIEW1_ARB 0x850A +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#define GL_VERTEX_BLEND_ARB 0x86A7 +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#define GL_MODELVIEW2_ARB 0x8722 +#define GL_MODELVIEW3_ARB 0x8723 +#define GL_MODELVIEW4_ARB 0x8724 +#define GL_MODELVIEW5_ARB 0x8725 +#define GL_MODELVIEW6_ARB 0x8726 +#define GL_MODELVIEW7_ARB 0x8727 +#define GL_MODELVIEW8_ARB 0x8728 +#define GL_MODELVIEW9_ARB 0x8729 +#define GL_MODELVIEW10_ARB 0x872A +#define GL_MODELVIEW11_ARB 0x872B +#define GL_MODELVIEW12_ARB 0x872C +#define GL_MODELVIEW13_ARB 0x872D +#define GL_MODELVIEW14_ARB 0x872E +#define GL_MODELVIEW15_ARB 0x872F +#define GL_MODELVIEW16_ARB 0x8730 +#define GL_MODELVIEW17_ARB 0x8731 +#define GL_MODELVIEW18_ARB 0x8732 +#define GL_MODELVIEW19_ARB 0x8733 +#define GL_MODELVIEW20_ARB 0x8734 +#define GL_MODELVIEW21_ARB 0x8735 +#define GL_MODELVIEW22_ARB 0x8736 +#define GL_MODELVIEW23_ARB 0x8737 +#define GL_MODELVIEW24_ARB 0x8738 +#define GL_MODELVIEW25_ARB 0x8739 +#define GL_MODELVIEW26_ARB 0x873A +#define GL_MODELVIEW27_ARB 0x873B +#define GL_MODELVIEW28_ARB 0x873C +#define GL_MODELVIEW29_ARB 0x873D +#define GL_MODELVIEW30_ARB 0x873E +#define GL_MODELVIEW31_ARB 0x873F + +typedef void (GLAPIENTRY * PFNGLVERTEXBLENDARBPROC) (GLint count); +typedef void (GLAPIENTRY * PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, void *pointer); +typedef void (GLAPIENTRY * PFNGLWEIGHTBVARBPROC) (GLint size, GLbyte *weights); +typedef void (GLAPIENTRY * PFNGLWEIGHTDVARBPROC) (GLint size, GLdouble *weights); +typedef void (GLAPIENTRY * PFNGLWEIGHTFVARBPROC) (GLint size, GLfloat *weights); +typedef void (GLAPIENTRY * PFNGLWEIGHTIVARBPROC) (GLint size, GLint *weights); +typedef void (GLAPIENTRY * PFNGLWEIGHTSVARBPROC) (GLint size, GLshort *weights); +typedef void (GLAPIENTRY * PFNGLWEIGHTUBVARBPROC) (GLint size, GLubyte *weights); +typedef void (GLAPIENTRY * PFNGLWEIGHTUIVARBPROC) (GLint size, GLuint *weights); +typedef void (GLAPIENTRY * PFNGLWEIGHTUSVARBPROC) (GLint size, GLushort *weights); + +#define glVertexBlendARB GLEW_GET_FUN(__glewVertexBlendARB) +#define glWeightPointerARB GLEW_GET_FUN(__glewWeightPointerARB) +#define glWeightbvARB GLEW_GET_FUN(__glewWeightbvARB) +#define glWeightdvARB GLEW_GET_FUN(__glewWeightdvARB) +#define glWeightfvARB GLEW_GET_FUN(__glewWeightfvARB) +#define glWeightivARB GLEW_GET_FUN(__glewWeightivARB) +#define glWeightsvARB GLEW_GET_FUN(__glewWeightsvARB) +#define glWeightubvARB GLEW_GET_FUN(__glewWeightubvARB) +#define glWeightuivARB GLEW_GET_FUN(__glewWeightuivARB) +#define glWeightusvARB GLEW_GET_FUN(__glewWeightusvARB) + +#define GLEW_ARB_vertex_blend GLEW_GET_VAR(__GLEW_ARB_vertex_blend) + +#endif /* GL_ARB_vertex_blend */ + +/* ---------------------- GL_ARB_vertex_buffer_object ---------------------- */ + +#ifndef GL_ARB_vertex_buffer_object +#define GL_ARB_vertex_buffer_object 1 + +#define GL_BUFFER_SIZE_ARB 0x8764 +#define GL_BUFFER_USAGE_ARB 0x8765 +#define GL_ARRAY_BUFFER_ARB 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 +#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F +#define GL_READ_ONLY_ARB 0x88B8 +#define GL_WRITE_ONLY_ARB 0x88B9 +#define GL_READ_WRITE_ARB 0x88BA +#define GL_BUFFER_ACCESS_ARB 0x88BB +#define GL_BUFFER_MAPPED_ARB 0x88BC +#define GL_BUFFER_MAP_POINTER_ARB 0x88BD +#define GL_STREAM_DRAW_ARB 0x88E0 +#define GL_STREAM_READ_ARB 0x88E1 +#define GL_STREAM_COPY_ARB 0x88E2 +#define GL_STATIC_DRAW_ARB 0x88E4 +#define GL_STATIC_READ_ARB 0x88E5 +#define GL_STATIC_COPY_ARB 0x88E6 +#define GL_DYNAMIC_DRAW_ARB 0x88E8 +#define GL_DYNAMIC_READ_ARB 0x88E9 +#define GL_DYNAMIC_COPY_ARB 0x88EA + +typedef ptrdiff_t GLintptrARB; +typedef ptrdiff_t GLsizeiptrARB; + +typedef void (GLAPIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); +typedef void (GLAPIENTRY * PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage); +typedef void (GLAPIENTRY * PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data); +typedef void (GLAPIENTRY * PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint* buffers); +typedef void (GLAPIENTRY * PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint* buffers); +typedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, void** params); +typedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data); +typedef GLboolean (GLAPIENTRY * PFNGLISBUFFERARBPROC) (GLuint buffer); +typedef void * (GLAPIENTRY * PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); +typedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERARBPROC) (GLenum target); + +#define glBindBufferARB GLEW_GET_FUN(__glewBindBufferARB) +#define glBufferDataARB GLEW_GET_FUN(__glewBufferDataARB) +#define glBufferSubDataARB GLEW_GET_FUN(__glewBufferSubDataARB) +#define glDeleteBuffersARB GLEW_GET_FUN(__glewDeleteBuffersARB) +#define glGenBuffersARB GLEW_GET_FUN(__glewGenBuffersARB) +#define glGetBufferParameterivARB GLEW_GET_FUN(__glewGetBufferParameterivARB) +#define glGetBufferPointervARB GLEW_GET_FUN(__glewGetBufferPointervARB) +#define glGetBufferSubDataARB GLEW_GET_FUN(__glewGetBufferSubDataARB) +#define glIsBufferARB GLEW_GET_FUN(__glewIsBufferARB) +#define glMapBufferARB GLEW_GET_FUN(__glewMapBufferARB) +#define glUnmapBufferARB GLEW_GET_FUN(__glewUnmapBufferARB) + +#define GLEW_ARB_vertex_buffer_object GLEW_GET_VAR(__GLEW_ARB_vertex_buffer_object) + +#endif /* GL_ARB_vertex_buffer_object */ + +/* ------------------------- GL_ARB_vertex_program ------------------------- */ + +#ifndef GL_ARB_vertex_program +#define GL_ARB_vertex_program 1 + +#define GL_COLOR_SUM_ARB 0x8458 +#define GL_VERTEX_PROGRAM_ARB 0x8620 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 +#define GL_PROGRAM_LENGTH_ARB 0x8627 +#define GL_PROGRAM_STRING_ARB 0x8628 +#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E +#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F +#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 +#define GL_CURRENT_MATRIX_ARB 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 +#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B +#define GL_PROGRAM_BINDING_ARB 0x8677 +#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A +#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#define GL_PROGRAM_FORMAT_ARB 0x8876 +#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 +#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 +#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 +#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 +#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 +#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 +#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 +#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 +#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 +#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 +#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA +#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB +#define GL_PROGRAM_ATTRIBS_ARB 0x88AC +#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD +#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE +#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF +#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 +#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 +#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 +#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 +#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 +#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 +#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 +#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 +#define GL_MATRIX0_ARB 0x88C0 +#define GL_MATRIX1_ARB 0x88C1 +#define GL_MATRIX2_ARB 0x88C2 +#define GL_MATRIX3_ARB 0x88C3 +#define GL_MATRIX4_ARB 0x88C4 +#define GL_MATRIX5_ARB 0x88C5 +#define GL_MATRIX6_ARB 0x88C6 +#define GL_MATRIX7_ARB 0x88C7 +#define GL_MATRIX8_ARB 0x88C8 +#define GL_MATRIX9_ARB 0x88C9 +#define GL_MATRIX10_ARB 0x88CA +#define GL_MATRIX11_ARB 0x88CB +#define GL_MATRIX12_ARB 0x88CC +#define GL_MATRIX13_ARB 0x88CD +#define GL_MATRIX14_ARB 0x88CE +#define GL_MATRIX15_ARB 0x88CF +#define GL_MATRIX16_ARB 0x88D0 +#define GL_MATRIX17_ARB 0x88D1 +#define GL_MATRIX18_ARB 0x88D2 +#define GL_MATRIX19_ARB 0x88D3 +#define GL_MATRIX20_ARB 0x88D4 +#define GL_MATRIX21_ARB 0x88D5 +#define GL_MATRIX22_ARB 0x88D6 +#define GL_MATRIX23_ARB 0x88D7 +#define GL_MATRIX24_ARB 0x88D8 +#define GL_MATRIX25_ARB 0x88D9 +#define GL_MATRIX26_ARB 0x88DA +#define GL_MATRIX27_ARB 0x88DB +#define GL_MATRIX28_ARB 0x88DC +#define GL_MATRIX29_ARB 0x88DD +#define GL_MATRIX30_ARB 0x88DE +#define GL_MATRIX31_ARB 0x88DF + +typedef void (GLAPIENTRY * PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); +typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint* programs); +typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (GLAPIENTRY * PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint* programs); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, void *string); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, void** pointer); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMARBPROC) (GLuint program); +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const void *string); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); + +#define glBindProgramARB GLEW_GET_FUN(__glewBindProgramARB) +#define glDeleteProgramsARB GLEW_GET_FUN(__glewDeleteProgramsARB) +#define glDisableVertexAttribArrayARB GLEW_GET_FUN(__glewDisableVertexAttribArrayARB) +#define glEnableVertexAttribArrayARB GLEW_GET_FUN(__glewEnableVertexAttribArrayARB) +#define glGenProgramsARB GLEW_GET_FUN(__glewGenProgramsARB) +#define glGetProgramEnvParameterdvARB GLEW_GET_FUN(__glewGetProgramEnvParameterdvARB) +#define glGetProgramEnvParameterfvARB GLEW_GET_FUN(__glewGetProgramEnvParameterfvARB) +#define glGetProgramLocalParameterdvARB GLEW_GET_FUN(__glewGetProgramLocalParameterdvARB) +#define glGetProgramLocalParameterfvARB GLEW_GET_FUN(__glewGetProgramLocalParameterfvARB) +#define glGetProgramStringARB GLEW_GET_FUN(__glewGetProgramStringARB) +#define glGetProgramivARB GLEW_GET_FUN(__glewGetProgramivARB) +#define glGetVertexAttribPointervARB GLEW_GET_FUN(__glewGetVertexAttribPointervARB) +#define glGetVertexAttribdvARB GLEW_GET_FUN(__glewGetVertexAttribdvARB) +#define glGetVertexAttribfvARB GLEW_GET_FUN(__glewGetVertexAttribfvARB) +#define glGetVertexAttribivARB GLEW_GET_FUN(__glewGetVertexAttribivARB) +#define glIsProgramARB GLEW_GET_FUN(__glewIsProgramARB) +#define glProgramEnvParameter4dARB GLEW_GET_FUN(__glewProgramEnvParameter4dARB) +#define glProgramEnvParameter4dvARB GLEW_GET_FUN(__glewProgramEnvParameter4dvARB) +#define glProgramEnvParameter4fARB GLEW_GET_FUN(__glewProgramEnvParameter4fARB) +#define glProgramEnvParameter4fvARB GLEW_GET_FUN(__glewProgramEnvParameter4fvARB) +#define glProgramLocalParameter4dARB GLEW_GET_FUN(__glewProgramLocalParameter4dARB) +#define glProgramLocalParameter4dvARB GLEW_GET_FUN(__glewProgramLocalParameter4dvARB) +#define glProgramLocalParameter4fARB GLEW_GET_FUN(__glewProgramLocalParameter4fARB) +#define glProgramLocalParameter4fvARB GLEW_GET_FUN(__glewProgramLocalParameter4fvARB) +#define glProgramStringARB GLEW_GET_FUN(__glewProgramStringARB) +#define glVertexAttrib1dARB GLEW_GET_FUN(__glewVertexAttrib1dARB) +#define glVertexAttrib1dvARB GLEW_GET_FUN(__glewVertexAttrib1dvARB) +#define glVertexAttrib1fARB GLEW_GET_FUN(__glewVertexAttrib1fARB) +#define glVertexAttrib1fvARB GLEW_GET_FUN(__glewVertexAttrib1fvARB) +#define glVertexAttrib1sARB GLEW_GET_FUN(__glewVertexAttrib1sARB) +#define glVertexAttrib1svARB GLEW_GET_FUN(__glewVertexAttrib1svARB) +#define glVertexAttrib2dARB GLEW_GET_FUN(__glewVertexAttrib2dARB) +#define glVertexAttrib2dvARB GLEW_GET_FUN(__glewVertexAttrib2dvARB) +#define glVertexAttrib2fARB GLEW_GET_FUN(__glewVertexAttrib2fARB) +#define glVertexAttrib2fvARB GLEW_GET_FUN(__glewVertexAttrib2fvARB) +#define glVertexAttrib2sARB GLEW_GET_FUN(__glewVertexAttrib2sARB) +#define glVertexAttrib2svARB GLEW_GET_FUN(__glewVertexAttrib2svARB) +#define glVertexAttrib3dARB GLEW_GET_FUN(__glewVertexAttrib3dARB) +#define glVertexAttrib3dvARB GLEW_GET_FUN(__glewVertexAttrib3dvARB) +#define glVertexAttrib3fARB GLEW_GET_FUN(__glewVertexAttrib3fARB) +#define glVertexAttrib3fvARB GLEW_GET_FUN(__glewVertexAttrib3fvARB) +#define glVertexAttrib3sARB GLEW_GET_FUN(__glewVertexAttrib3sARB) +#define glVertexAttrib3svARB GLEW_GET_FUN(__glewVertexAttrib3svARB) +#define glVertexAttrib4NbvARB GLEW_GET_FUN(__glewVertexAttrib4NbvARB) +#define glVertexAttrib4NivARB GLEW_GET_FUN(__glewVertexAttrib4NivARB) +#define glVertexAttrib4NsvARB GLEW_GET_FUN(__glewVertexAttrib4NsvARB) +#define glVertexAttrib4NubARB GLEW_GET_FUN(__glewVertexAttrib4NubARB) +#define glVertexAttrib4NubvARB GLEW_GET_FUN(__glewVertexAttrib4NubvARB) +#define glVertexAttrib4NuivARB GLEW_GET_FUN(__glewVertexAttrib4NuivARB) +#define glVertexAttrib4NusvARB GLEW_GET_FUN(__glewVertexAttrib4NusvARB) +#define glVertexAttrib4bvARB GLEW_GET_FUN(__glewVertexAttrib4bvARB) +#define glVertexAttrib4dARB GLEW_GET_FUN(__glewVertexAttrib4dARB) +#define glVertexAttrib4dvARB GLEW_GET_FUN(__glewVertexAttrib4dvARB) +#define glVertexAttrib4fARB GLEW_GET_FUN(__glewVertexAttrib4fARB) +#define glVertexAttrib4fvARB GLEW_GET_FUN(__glewVertexAttrib4fvARB) +#define glVertexAttrib4ivARB GLEW_GET_FUN(__glewVertexAttrib4ivARB) +#define glVertexAttrib4sARB GLEW_GET_FUN(__glewVertexAttrib4sARB) +#define glVertexAttrib4svARB GLEW_GET_FUN(__glewVertexAttrib4svARB) +#define glVertexAttrib4ubvARB GLEW_GET_FUN(__glewVertexAttrib4ubvARB) +#define glVertexAttrib4uivARB GLEW_GET_FUN(__glewVertexAttrib4uivARB) +#define glVertexAttrib4usvARB GLEW_GET_FUN(__glewVertexAttrib4usvARB) +#define glVertexAttribPointerARB GLEW_GET_FUN(__glewVertexAttribPointerARB) + +#define GLEW_ARB_vertex_program GLEW_GET_VAR(__GLEW_ARB_vertex_program) + +#endif /* GL_ARB_vertex_program */ + +/* -------------------------- GL_ARB_vertex_shader ------------------------- */ + +#ifndef GL_ARB_vertex_shader +#define GL_ARB_vertex_shader 1 + +#define GL_VERTEX_SHADER_ARB 0x8B31 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A +#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D +#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 +#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A + +typedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB* name); +typedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei* length, GLint *size, GLenum *type, GLcharARB *name); +typedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB* name); + +#define glBindAttribLocationARB GLEW_GET_FUN(__glewBindAttribLocationARB) +#define glGetActiveAttribARB GLEW_GET_FUN(__glewGetActiveAttribARB) +#define glGetAttribLocationARB GLEW_GET_FUN(__glewGetAttribLocationARB) + +#define GLEW_ARB_vertex_shader GLEW_GET_VAR(__GLEW_ARB_vertex_shader) + +#endif /* GL_ARB_vertex_shader */ + +/* ------------------- GL_ARB_vertex_type_10f_11f_11f_rev ------------------ */ + +#ifndef GL_ARB_vertex_type_10f_11f_11f_rev +#define GL_ARB_vertex_type_10f_11f_11f_rev 1 + +#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B + +#define GLEW_ARB_vertex_type_10f_11f_11f_rev GLEW_GET_VAR(__GLEW_ARB_vertex_type_10f_11f_11f_rev) + +#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */ + +/* ------------------- GL_ARB_vertex_type_2_10_10_10_rev ------------------- */ + +#ifndef GL_ARB_vertex_type_2_10_10_10_rev +#define GL_ARB_vertex_type_2_10_10_10_rev 1 + +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_INT_2_10_10_10_REV 0x8D9F + +typedef void (GLAPIENTRY * PFNGLCOLORP3UIPROC) (GLenum type, GLuint color); +typedef void (GLAPIENTRY * PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint* color); +typedef void (GLAPIENTRY * PFNGLCOLORP4UIPROC) (GLenum type, GLuint color); +typedef void (GLAPIENTRY * PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint* color); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint* coords); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint* coords); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint* coords); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint* coords); +typedef void (GLAPIENTRY * PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords); +typedef void (GLAPIENTRY * PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint* coords); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint* color); +typedef void (GLAPIENTRY * PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords); +typedef void (GLAPIENTRY * PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint* coords); +typedef void (GLAPIENTRY * PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords); +typedef void (GLAPIENTRY * PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint* coords); +typedef void (GLAPIENTRY * PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords); +typedef void (GLAPIENTRY * PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint* coords); +typedef void (GLAPIENTRY * PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords); +typedef void (GLAPIENTRY * PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint* coords); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value); +typedef void (GLAPIENTRY * PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value); +typedef void (GLAPIENTRY * PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value); +typedef void (GLAPIENTRY * PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint* value); + +#define glColorP3ui GLEW_GET_FUN(__glewColorP3ui) +#define glColorP3uiv GLEW_GET_FUN(__glewColorP3uiv) +#define glColorP4ui GLEW_GET_FUN(__glewColorP4ui) +#define glColorP4uiv GLEW_GET_FUN(__glewColorP4uiv) +#define glMultiTexCoordP1ui GLEW_GET_FUN(__glewMultiTexCoordP1ui) +#define glMultiTexCoordP1uiv GLEW_GET_FUN(__glewMultiTexCoordP1uiv) +#define glMultiTexCoordP2ui GLEW_GET_FUN(__glewMultiTexCoordP2ui) +#define glMultiTexCoordP2uiv GLEW_GET_FUN(__glewMultiTexCoordP2uiv) +#define glMultiTexCoordP3ui GLEW_GET_FUN(__glewMultiTexCoordP3ui) +#define glMultiTexCoordP3uiv GLEW_GET_FUN(__glewMultiTexCoordP3uiv) +#define glMultiTexCoordP4ui GLEW_GET_FUN(__glewMultiTexCoordP4ui) +#define glMultiTexCoordP4uiv GLEW_GET_FUN(__glewMultiTexCoordP4uiv) +#define glNormalP3ui GLEW_GET_FUN(__glewNormalP3ui) +#define glNormalP3uiv GLEW_GET_FUN(__glewNormalP3uiv) +#define glSecondaryColorP3ui GLEW_GET_FUN(__glewSecondaryColorP3ui) +#define glSecondaryColorP3uiv GLEW_GET_FUN(__glewSecondaryColorP3uiv) +#define glTexCoordP1ui GLEW_GET_FUN(__glewTexCoordP1ui) +#define glTexCoordP1uiv GLEW_GET_FUN(__glewTexCoordP1uiv) +#define glTexCoordP2ui GLEW_GET_FUN(__glewTexCoordP2ui) +#define glTexCoordP2uiv GLEW_GET_FUN(__glewTexCoordP2uiv) +#define glTexCoordP3ui GLEW_GET_FUN(__glewTexCoordP3ui) +#define glTexCoordP3uiv GLEW_GET_FUN(__glewTexCoordP3uiv) +#define glTexCoordP4ui GLEW_GET_FUN(__glewTexCoordP4ui) +#define glTexCoordP4uiv GLEW_GET_FUN(__glewTexCoordP4uiv) +#define glVertexAttribP1ui GLEW_GET_FUN(__glewVertexAttribP1ui) +#define glVertexAttribP1uiv GLEW_GET_FUN(__glewVertexAttribP1uiv) +#define glVertexAttribP2ui GLEW_GET_FUN(__glewVertexAttribP2ui) +#define glVertexAttribP2uiv GLEW_GET_FUN(__glewVertexAttribP2uiv) +#define glVertexAttribP3ui GLEW_GET_FUN(__glewVertexAttribP3ui) +#define glVertexAttribP3uiv GLEW_GET_FUN(__glewVertexAttribP3uiv) +#define glVertexAttribP4ui GLEW_GET_FUN(__glewVertexAttribP4ui) +#define glVertexAttribP4uiv GLEW_GET_FUN(__glewVertexAttribP4uiv) +#define glVertexP2ui GLEW_GET_FUN(__glewVertexP2ui) +#define glVertexP2uiv GLEW_GET_FUN(__glewVertexP2uiv) +#define glVertexP3ui GLEW_GET_FUN(__glewVertexP3ui) +#define glVertexP3uiv GLEW_GET_FUN(__glewVertexP3uiv) +#define glVertexP4ui GLEW_GET_FUN(__glewVertexP4ui) +#define glVertexP4uiv GLEW_GET_FUN(__glewVertexP4uiv) + +#define GLEW_ARB_vertex_type_2_10_10_10_rev GLEW_GET_VAR(__GLEW_ARB_vertex_type_2_10_10_10_rev) + +#endif /* GL_ARB_vertex_type_2_10_10_10_rev */ + +/* ------------------------- GL_ARB_viewport_array ------------------------- */ + +#ifndef GL_ARB_viewport_array +#define GL_ARB_viewport_array 1 + +#define GL_DEPTH_RANGE 0x0B70 +#define GL_VIEWPORT 0x0BA2 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_MAX_VIEWPORTS 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE 0x825D +#define GL_LAYER_PROVOKING_VERTEX 0x825E +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F +#define GL_UNDEFINED_VERTEX 0x8260 +#define GL_FIRST_VERTEX_CONVENTION 0x8E4D +#define GL_LAST_VERTEX_CONVENTION 0x8E4E +#define GL_PROVOKING_VERTEX 0x8E4F + +typedef void (GLAPIENTRY * PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLclampd * v); +typedef void (GLAPIENTRY * PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLclampd n, GLclampd f); +typedef void (GLAPIENTRY * PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble* data); +typedef void (GLAPIENTRY * PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat* data); +typedef void (GLAPIENTRY * PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint * v); +typedef void (GLAPIENTRY * PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint * v); +typedef void (GLAPIENTRY * PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat * v); +typedef void (GLAPIENTRY * PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (GLAPIENTRY * PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat * v); + +#define glDepthRangeArrayv GLEW_GET_FUN(__glewDepthRangeArrayv) +#define glDepthRangeIndexed GLEW_GET_FUN(__glewDepthRangeIndexed) +#define glGetDoublei_v GLEW_GET_FUN(__glewGetDoublei_v) +#define glGetFloati_v GLEW_GET_FUN(__glewGetFloati_v) +#define glScissorArrayv GLEW_GET_FUN(__glewScissorArrayv) +#define glScissorIndexed GLEW_GET_FUN(__glewScissorIndexed) +#define glScissorIndexedv GLEW_GET_FUN(__glewScissorIndexedv) +#define glViewportArrayv GLEW_GET_FUN(__glewViewportArrayv) +#define glViewportIndexedf GLEW_GET_FUN(__glewViewportIndexedf) +#define glViewportIndexedfv GLEW_GET_FUN(__glewViewportIndexedfv) + +#define GLEW_ARB_viewport_array GLEW_GET_VAR(__GLEW_ARB_viewport_array) + +#endif /* GL_ARB_viewport_array */ + +/* --------------------------- GL_ARB_window_pos --------------------------- */ + +#ifndef GL_ARB_window_pos +#define GL_ARB_window_pos 1 + +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVARBPROC) (const GLdouble* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVARBPROC) (const GLfloat* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVARBPROC) (const GLint* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVARBPROC) (const GLshort* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVARBPROC) (const GLdouble* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVARBPROC) (const GLfloat* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVARBPROC) (const GLint* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVARBPROC) (const GLshort* p); + +#define glWindowPos2dARB GLEW_GET_FUN(__glewWindowPos2dARB) +#define glWindowPos2dvARB GLEW_GET_FUN(__glewWindowPos2dvARB) +#define glWindowPos2fARB GLEW_GET_FUN(__glewWindowPos2fARB) +#define glWindowPos2fvARB GLEW_GET_FUN(__glewWindowPos2fvARB) +#define glWindowPos2iARB GLEW_GET_FUN(__glewWindowPos2iARB) +#define glWindowPos2ivARB GLEW_GET_FUN(__glewWindowPos2ivARB) +#define glWindowPos2sARB GLEW_GET_FUN(__glewWindowPos2sARB) +#define glWindowPos2svARB GLEW_GET_FUN(__glewWindowPos2svARB) +#define glWindowPos3dARB GLEW_GET_FUN(__glewWindowPos3dARB) +#define glWindowPos3dvARB GLEW_GET_FUN(__glewWindowPos3dvARB) +#define glWindowPos3fARB GLEW_GET_FUN(__glewWindowPos3fARB) +#define glWindowPos3fvARB GLEW_GET_FUN(__glewWindowPos3fvARB) +#define glWindowPos3iARB GLEW_GET_FUN(__glewWindowPos3iARB) +#define glWindowPos3ivARB GLEW_GET_FUN(__glewWindowPos3ivARB) +#define glWindowPos3sARB GLEW_GET_FUN(__glewWindowPos3sARB) +#define glWindowPos3svARB GLEW_GET_FUN(__glewWindowPos3svARB) + +#define GLEW_ARB_window_pos GLEW_GET_VAR(__GLEW_ARB_window_pos) + +#endif /* GL_ARB_window_pos */ + +/* ------------------------- GL_ATIX_point_sprites ------------------------- */ + +#ifndef GL_ATIX_point_sprites +#define GL_ATIX_point_sprites 1 + +#define GL_TEXTURE_POINT_MODE_ATIX 0x60B0 +#define GL_TEXTURE_POINT_ONE_COORD_ATIX 0x60B1 +#define GL_TEXTURE_POINT_SPRITE_ATIX 0x60B2 +#define GL_POINT_SPRITE_CULL_MODE_ATIX 0x60B3 +#define GL_POINT_SPRITE_CULL_CENTER_ATIX 0x60B4 +#define GL_POINT_SPRITE_CULL_CLIP_ATIX 0x60B5 + +#define GLEW_ATIX_point_sprites GLEW_GET_VAR(__GLEW_ATIX_point_sprites) + +#endif /* GL_ATIX_point_sprites */ + +/* ---------------------- GL_ATIX_texture_env_combine3 --------------------- */ + +#ifndef GL_ATIX_texture_env_combine3 +#define GL_ATIX_texture_env_combine3 1 + +#define GL_MODULATE_ADD_ATIX 0x8744 +#define GL_MODULATE_SIGNED_ADD_ATIX 0x8745 +#define GL_MODULATE_SUBTRACT_ATIX 0x8746 + +#define GLEW_ATIX_texture_env_combine3 GLEW_GET_VAR(__GLEW_ATIX_texture_env_combine3) + +#endif /* GL_ATIX_texture_env_combine3 */ + +/* ----------------------- GL_ATIX_texture_env_route ----------------------- */ + +#ifndef GL_ATIX_texture_env_route +#define GL_ATIX_texture_env_route 1 + +#define GL_SECONDARY_COLOR_ATIX 0x8747 +#define GL_TEXTURE_OUTPUT_RGB_ATIX 0x8748 +#define GL_TEXTURE_OUTPUT_ALPHA_ATIX 0x8749 + +#define GLEW_ATIX_texture_env_route GLEW_GET_VAR(__GLEW_ATIX_texture_env_route) + +#endif /* GL_ATIX_texture_env_route */ + +/* ---------------- GL_ATIX_vertex_shader_output_point_size ---------------- */ + +#ifndef GL_ATIX_vertex_shader_output_point_size +#define GL_ATIX_vertex_shader_output_point_size 1 + +#define GL_OUTPUT_POINT_SIZE_ATIX 0x610E + +#define GLEW_ATIX_vertex_shader_output_point_size GLEW_GET_VAR(__GLEW_ATIX_vertex_shader_output_point_size) + +#endif /* GL_ATIX_vertex_shader_output_point_size */ + +/* -------------------------- GL_ATI_draw_buffers -------------------------- */ + +#ifndef GL_ATI_draw_buffers +#define GL_ATI_draw_buffers 1 + +#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 +#define GL_DRAW_BUFFER0_ATI 0x8825 +#define GL_DRAW_BUFFER1_ATI 0x8826 +#define GL_DRAW_BUFFER2_ATI 0x8827 +#define GL_DRAW_BUFFER3_ATI 0x8828 +#define GL_DRAW_BUFFER4_ATI 0x8829 +#define GL_DRAW_BUFFER5_ATI 0x882A +#define GL_DRAW_BUFFER6_ATI 0x882B +#define GL_DRAW_BUFFER7_ATI 0x882C +#define GL_DRAW_BUFFER8_ATI 0x882D +#define GL_DRAW_BUFFER9_ATI 0x882E +#define GL_DRAW_BUFFER10_ATI 0x882F +#define GL_DRAW_BUFFER11_ATI 0x8830 +#define GL_DRAW_BUFFER12_ATI 0x8831 +#define GL_DRAW_BUFFER13_ATI 0x8832 +#define GL_DRAW_BUFFER14_ATI 0x8833 +#define GL_DRAW_BUFFER15_ATI 0x8834 + +typedef void (GLAPIENTRY * PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum* bufs); + +#define glDrawBuffersATI GLEW_GET_FUN(__glewDrawBuffersATI) + +#define GLEW_ATI_draw_buffers GLEW_GET_VAR(__GLEW_ATI_draw_buffers) + +#endif /* GL_ATI_draw_buffers */ + +/* -------------------------- GL_ATI_element_array ------------------------- */ + +#ifndef GL_ATI_element_array +#define GL_ATI_element_array 1 + +#define GL_ELEMENT_ARRAY_ATI 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A + +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); +typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); +typedef void (GLAPIENTRY * PFNGLELEMENTPOINTERATIPROC) (GLenum type, const void *pointer); + +#define glDrawElementArrayATI GLEW_GET_FUN(__glewDrawElementArrayATI) +#define glDrawRangeElementArrayATI GLEW_GET_FUN(__glewDrawRangeElementArrayATI) +#define glElementPointerATI GLEW_GET_FUN(__glewElementPointerATI) + +#define GLEW_ATI_element_array GLEW_GET_VAR(__GLEW_ATI_element_array) + +#endif /* GL_ATI_element_array */ + +/* ------------------------- GL_ATI_envmap_bumpmap ------------------------- */ + +#ifndef GL_ATI_envmap_bumpmap +#define GL_ATI_envmap_bumpmap 1 + +#define GL_BUMP_ROT_MATRIX_ATI 0x8775 +#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 +#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 +#define GL_BUMP_TEX_UNITS_ATI 0x8778 +#define GL_DUDV_ATI 0x8779 +#define GL_DU8DV8_ATI 0x877A +#define GL_BUMP_ENVMAP_ATI 0x877B +#define GL_BUMP_TARGET_ATI 0x877C + +typedef void (GLAPIENTRY * PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); +typedef void (GLAPIENTRY * PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); +typedef void (GLAPIENTRY * PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); +typedef void (GLAPIENTRY * PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); + +#define glGetTexBumpParameterfvATI GLEW_GET_FUN(__glewGetTexBumpParameterfvATI) +#define glGetTexBumpParameterivATI GLEW_GET_FUN(__glewGetTexBumpParameterivATI) +#define glTexBumpParameterfvATI GLEW_GET_FUN(__glewTexBumpParameterfvATI) +#define glTexBumpParameterivATI GLEW_GET_FUN(__glewTexBumpParameterivATI) + +#define GLEW_ATI_envmap_bumpmap GLEW_GET_VAR(__GLEW_ATI_envmap_bumpmap) + +#endif /* GL_ATI_envmap_bumpmap */ + +/* ------------------------- GL_ATI_fragment_shader ------------------------ */ + +#ifndef GL_ATI_fragment_shader +#define GL_ATI_fragment_shader 1 + +#define GL_2X_BIT_ATI 0x00000001 +#define GL_RED_BIT_ATI 0x00000001 +#define GL_4X_BIT_ATI 0x00000002 +#define GL_COMP_BIT_ATI 0x00000002 +#define GL_GREEN_BIT_ATI 0x00000002 +#define GL_8X_BIT_ATI 0x00000004 +#define GL_BLUE_BIT_ATI 0x00000004 +#define GL_NEGATE_BIT_ATI 0x00000004 +#define GL_BIAS_BIT_ATI 0x00000008 +#define GL_HALF_BIT_ATI 0x00000008 +#define GL_QUARTER_BIT_ATI 0x00000010 +#define GL_EIGHTH_BIT_ATI 0x00000020 +#define GL_SATURATE_BIT_ATI 0x00000040 +#define GL_FRAGMENT_SHADER_ATI 0x8920 +#define GL_REG_0_ATI 0x8921 +#define GL_REG_1_ATI 0x8922 +#define GL_REG_2_ATI 0x8923 +#define GL_REG_3_ATI 0x8924 +#define GL_REG_4_ATI 0x8925 +#define GL_REG_5_ATI 0x8926 +#define GL_CON_0_ATI 0x8941 +#define GL_CON_1_ATI 0x8942 +#define GL_CON_2_ATI 0x8943 +#define GL_CON_3_ATI 0x8944 +#define GL_CON_4_ATI 0x8945 +#define GL_CON_5_ATI 0x8946 +#define GL_CON_6_ATI 0x8947 +#define GL_CON_7_ATI 0x8948 +#define GL_MOV_ATI 0x8961 +#define GL_ADD_ATI 0x8963 +#define GL_MUL_ATI 0x8964 +#define GL_SUB_ATI 0x8965 +#define GL_DOT3_ATI 0x8966 +#define GL_DOT4_ATI 0x8967 +#define GL_MAD_ATI 0x8968 +#define GL_LERP_ATI 0x8969 +#define GL_CND_ATI 0x896A +#define GL_CND0_ATI 0x896B +#define GL_DOT2_ADD_ATI 0x896C +#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D +#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E +#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F +#define GL_NUM_PASSES_ATI 0x8970 +#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 +#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 +#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 +#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 +#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 +#define GL_SWIZZLE_STR_ATI 0x8976 +#define GL_SWIZZLE_STQ_ATI 0x8977 +#define GL_SWIZZLE_STR_DR_ATI 0x8978 +#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 +#define GL_SWIZZLE_STRQ_ATI 0x897A +#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B + +typedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (GLAPIENTRY * PFNGLBEGINFRAGMENTSHADERATIPROC) (void); +typedef void (GLAPIENTRY * PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (GLAPIENTRY * PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLENDFRAGMENTSHADERATIPROC) (void); +typedef GLuint (GLAPIENTRY * PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); +typedef void (GLAPIENTRY * PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); +typedef void (GLAPIENTRY * PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); +typedef void (GLAPIENTRY * PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat* value); + +#define glAlphaFragmentOp1ATI GLEW_GET_FUN(__glewAlphaFragmentOp1ATI) +#define glAlphaFragmentOp2ATI GLEW_GET_FUN(__glewAlphaFragmentOp2ATI) +#define glAlphaFragmentOp3ATI GLEW_GET_FUN(__glewAlphaFragmentOp3ATI) +#define glBeginFragmentShaderATI GLEW_GET_FUN(__glewBeginFragmentShaderATI) +#define glBindFragmentShaderATI GLEW_GET_FUN(__glewBindFragmentShaderATI) +#define glColorFragmentOp1ATI GLEW_GET_FUN(__glewColorFragmentOp1ATI) +#define glColorFragmentOp2ATI GLEW_GET_FUN(__glewColorFragmentOp2ATI) +#define glColorFragmentOp3ATI GLEW_GET_FUN(__glewColorFragmentOp3ATI) +#define glDeleteFragmentShaderATI GLEW_GET_FUN(__glewDeleteFragmentShaderATI) +#define glEndFragmentShaderATI GLEW_GET_FUN(__glewEndFragmentShaderATI) +#define glGenFragmentShadersATI GLEW_GET_FUN(__glewGenFragmentShadersATI) +#define glPassTexCoordATI GLEW_GET_FUN(__glewPassTexCoordATI) +#define glSampleMapATI GLEW_GET_FUN(__glewSampleMapATI) +#define glSetFragmentShaderConstantATI GLEW_GET_FUN(__glewSetFragmentShaderConstantATI) + +#define GLEW_ATI_fragment_shader GLEW_GET_VAR(__GLEW_ATI_fragment_shader) + +#endif /* GL_ATI_fragment_shader */ + +/* ------------------------ GL_ATI_map_object_buffer ----------------------- */ + +#ifndef GL_ATI_map_object_buffer +#define GL_ATI_map_object_buffer 1 + +typedef void * (GLAPIENTRY * PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (GLAPIENTRY * PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); + +#define glMapObjectBufferATI GLEW_GET_FUN(__glewMapObjectBufferATI) +#define glUnmapObjectBufferATI GLEW_GET_FUN(__glewUnmapObjectBufferATI) + +#define GLEW_ATI_map_object_buffer GLEW_GET_VAR(__GLEW_ATI_map_object_buffer) + +#endif /* GL_ATI_map_object_buffer */ + +/* ----------------------------- GL_ATI_meminfo ---------------------------- */ + +#ifndef GL_ATI_meminfo +#define GL_ATI_meminfo 1 + +#define GL_VBO_FREE_MEMORY_ATI 0x87FB +#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC +#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD + +#define GLEW_ATI_meminfo GLEW_GET_VAR(__GLEW_ATI_meminfo) + +#endif /* GL_ATI_meminfo */ + +/* -------------------------- GL_ATI_pn_triangles -------------------------- */ + +#ifndef GL_ATI_pn_triangles +#define GL_ATI_pn_triangles 1 + +#define GL_PN_TRIANGLES_ATI 0x87F0 +#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 +#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 +#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 +#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 +#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 +#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 +#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 +#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 + +typedef void (GLAPIENTRY * PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); + +#define glPNTrianglesfATI GLEW_GET_FUN(__glewPNTrianglesfATI) +#define glPNTrianglesiATI GLEW_GET_FUN(__glewPNTrianglesiATI) + +#define GLEW_ATI_pn_triangles GLEW_GET_VAR(__GLEW_ATI_pn_triangles) + +#endif /* GL_ATI_pn_triangles */ + +/* ------------------------ GL_ATI_separate_stencil ------------------------ */ + +#ifndef GL_ATI_separate_stencil +#define GL_ATI_separate_stencil 1 + +#define GL_STENCIL_BACK_FUNC_ATI 0x8800 +#define GL_STENCIL_BACK_FAIL_ATI 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 + +typedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +typedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); + +#define glStencilFuncSeparateATI GLEW_GET_FUN(__glewStencilFuncSeparateATI) +#define glStencilOpSeparateATI GLEW_GET_FUN(__glewStencilOpSeparateATI) + +#define GLEW_ATI_separate_stencil GLEW_GET_VAR(__GLEW_ATI_separate_stencil) + +#endif /* GL_ATI_separate_stencil */ + +/* ----------------------- GL_ATI_shader_texture_lod ----------------------- */ + +#ifndef GL_ATI_shader_texture_lod +#define GL_ATI_shader_texture_lod 1 + +#define GLEW_ATI_shader_texture_lod GLEW_GET_VAR(__GLEW_ATI_shader_texture_lod) + +#endif /* GL_ATI_shader_texture_lod */ + +/* ---------------------- GL_ATI_text_fragment_shader ---------------------- */ + +#ifndef GL_ATI_text_fragment_shader +#define GL_ATI_text_fragment_shader 1 + +#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 + +#define GLEW_ATI_text_fragment_shader GLEW_GET_VAR(__GLEW_ATI_text_fragment_shader) + +#endif /* GL_ATI_text_fragment_shader */ + +/* --------------------- GL_ATI_texture_compression_3dc -------------------- */ + +#ifndef GL_ATI_texture_compression_3dc +#define GL_ATI_texture_compression_3dc 1 + +#define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI 0x8837 + +#define GLEW_ATI_texture_compression_3dc GLEW_GET_VAR(__GLEW_ATI_texture_compression_3dc) + +#endif /* GL_ATI_texture_compression_3dc */ + +/* ---------------------- GL_ATI_texture_env_combine3 ---------------------- */ + +#ifndef GL_ATI_texture_env_combine3 +#define GL_ATI_texture_env_combine3 1 + +#define GL_MODULATE_ADD_ATI 0x8744 +#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 +#define GL_MODULATE_SUBTRACT_ATI 0x8746 + +#define GLEW_ATI_texture_env_combine3 GLEW_GET_VAR(__GLEW_ATI_texture_env_combine3) + +#endif /* GL_ATI_texture_env_combine3 */ + +/* -------------------------- GL_ATI_texture_float ------------------------- */ + +#ifndef GL_ATI_texture_float +#define GL_ATI_texture_float 1 + +#define GL_RGBA_FLOAT32_ATI 0x8814 +#define GL_RGB_FLOAT32_ATI 0x8815 +#define GL_ALPHA_FLOAT32_ATI 0x8816 +#define GL_INTENSITY_FLOAT32_ATI 0x8817 +#define GL_LUMINANCE_FLOAT32_ATI 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 +#define GL_RGBA_FLOAT16_ATI 0x881A +#define GL_RGB_FLOAT16_ATI 0x881B +#define GL_ALPHA_FLOAT16_ATI 0x881C +#define GL_INTENSITY_FLOAT16_ATI 0x881D +#define GL_LUMINANCE_FLOAT16_ATI 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F + +#define GLEW_ATI_texture_float GLEW_GET_VAR(__GLEW_ATI_texture_float) + +#endif /* GL_ATI_texture_float */ + +/* ----------------------- GL_ATI_texture_mirror_once ---------------------- */ + +#ifndef GL_ATI_texture_mirror_once +#define GL_ATI_texture_mirror_once 1 + +#define GL_MIRROR_CLAMP_ATI 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 + +#define GLEW_ATI_texture_mirror_once GLEW_GET_VAR(__GLEW_ATI_texture_mirror_once) + +#endif /* GL_ATI_texture_mirror_once */ + +/* ----------------------- GL_ATI_vertex_array_object ---------------------- */ + +#ifndef GL_ATI_vertex_array_object +#define GL_ATI_vertex_array_object 1 + +#define GL_STATIC_ATI 0x8760 +#define GL_DYNAMIC_ATI 0x8761 +#define GL_PRESERVE_ATI 0x8762 +#define GL_DISCARD_ATI 0x8763 +#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 +#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 +#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 +#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 + +typedef void (GLAPIENTRY * PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (GLAPIENTRY * PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (GLAPIENTRY * PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); +typedef GLuint (GLAPIENTRY * PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const void *pointer, GLenum usage); +typedef void (GLAPIENTRY * PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const void *pointer, GLenum preserve); +typedef void (GLAPIENTRY * PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); + +#define glArrayObjectATI GLEW_GET_FUN(__glewArrayObjectATI) +#define glFreeObjectBufferATI GLEW_GET_FUN(__glewFreeObjectBufferATI) +#define glGetArrayObjectfvATI GLEW_GET_FUN(__glewGetArrayObjectfvATI) +#define glGetArrayObjectivATI GLEW_GET_FUN(__glewGetArrayObjectivATI) +#define glGetObjectBufferfvATI GLEW_GET_FUN(__glewGetObjectBufferfvATI) +#define glGetObjectBufferivATI GLEW_GET_FUN(__glewGetObjectBufferivATI) +#define glGetVariantArrayObjectfvATI GLEW_GET_FUN(__glewGetVariantArrayObjectfvATI) +#define glGetVariantArrayObjectivATI GLEW_GET_FUN(__glewGetVariantArrayObjectivATI) +#define glIsObjectBufferATI GLEW_GET_FUN(__glewIsObjectBufferATI) +#define glNewObjectBufferATI GLEW_GET_FUN(__glewNewObjectBufferATI) +#define glUpdateObjectBufferATI GLEW_GET_FUN(__glewUpdateObjectBufferATI) +#define glVariantArrayObjectATI GLEW_GET_FUN(__glewVariantArrayObjectATI) + +#define GLEW_ATI_vertex_array_object GLEW_GET_VAR(__GLEW_ATI_vertex_array_object) + +#endif /* GL_ATI_vertex_array_object */ + +/* ------------------- GL_ATI_vertex_attrib_array_object ------------------- */ + +#ifndef GL_ATI_vertex_attrib_array_object +#define GL_ATI_vertex_attrib_array_object 1 + +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); + +#define glGetVertexAttribArrayObjectfvATI GLEW_GET_FUN(__glewGetVertexAttribArrayObjectfvATI) +#define glGetVertexAttribArrayObjectivATI GLEW_GET_FUN(__glewGetVertexAttribArrayObjectivATI) +#define glVertexAttribArrayObjectATI GLEW_GET_FUN(__glewVertexAttribArrayObjectATI) + +#define GLEW_ATI_vertex_attrib_array_object GLEW_GET_VAR(__GLEW_ATI_vertex_attrib_array_object) + +#endif /* GL_ATI_vertex_attrib_array_object */ + +/* ------------------------- GL_ATI_vertex_streams ------------------------- */ + +#ifndef GL_ATI_vertex_streams +#define GL_ATI_vertex_streams 1 + +#define GL_MAX_VERTEX_STREAMS_ATI 0x876B +#define GL_VERTEX_SOURCE_ATI 0x876C +#define GL_VERTEX_STREAM0_ATI 0x876D +#define GL_VERTEX_STREAM1_ATI 0x876E +#define GL_VERTEX_STREAM2_ATI 0x876F +#define GL_VERTEX_STREAM3_ATI 0x8770 +#define GL_VERTEX_STREAM4_ATI 0x8771 +#define GL_VERTEX_STREAM5_ATI 0x8772 +#define GL_VERTEX_STREAM6_ATI 0x8773 +#define GL_VERTEX_STREAM7_ATI 0x8774 + +typedef void (GLAPIENTRY * PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte x, GLbyte y, GLbyte z); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); + +#define glClientActiveVertexStreamATI GLEW_GET_FUN(__glewClientActiveVertexStreamATI) +#define glNormalStream3bATI GLEW_GET_FUN(__glewNormalStream3bATI) +#define glNormalStream3bvATI GLEW_GET_FUN(__glewNormalStream3bvATI) +#define glNormalStream3dATI GLEW_GET_FUN(__glewNormalStream3dATI) +#define glNormalStream3dvATI GLEW_GET_FUN(__glewNormalStream3dvATI) +#define glNormalStream3fATI GLEW_GET_FUN(__glewNormalStream3fATI) +#define glNormalStream3fvATI GLEW_GET_FUN(__glewNormalStream3fvATI) +#define glNormalStream3iATI GLEW_GET_FUN(__glewNormalStream3iATI) +#define glNormalStream3ivATI GLEW_GET_FUN(__glewNormalStream3ivATI) +#define glNormalStream3sATI GLEW_GET_FUN(__glewNormalStream3sATI) +#define glNormalStream3svATI GLEW_GET_FUN(__glewNormalStream3svATI) +#define glVertexBlendEnvfATI GLEW_GET_FUN(__glewVertexBlendEnvfATI) +#define glVertexBlendEnviATI GLEW_GET_FUN(__glewVertexBlendEnviATI) +#define glVertexStream1dATI GLEW_GET_FUN(__glewVertexStream1dATI) +#define glVertexStream1dvATI GLEW_GET_FUN(__glewVertexStream1dvATI) +#define glVertexStream1fATI GLEW_GET_FUN(__glewVertexStream1fATI) +#define glVertexStream1fvATI GLEW_GET_FUN(__glewVertexStream1fvATI) +#define glVertexStream1iATI GLEW_GET_FUN(__glewVertexStream1iATI) +#define glVertexStream1ivATI GLEW_GET_FUN(__glewVertexStream1ivATI) +#define glVertexStream1sATI GLEW_GET_FUN(__glewVertexStream1sATI) +#define glVertexStream1svATI GLEW_GET_FUN(__glewVertexStream1svATI) +#define glVertexStream2dATI GLEW_GET_FUN(__glewVertexStream2dATI) +#define glVertexStream2dvATI GLEW_GET_FUN(__glewVertexStream2dvATI) +#define glVertexStream2fATI GLEW_GET_FUN(__glewVertexStream2fATI) +#define glVertexStream2fvATI GLEW_GET_FUN(__glewVertexStream2fvATI) +#define glVertexStream2iATI GLEW_GET_FUN(__glewVertexStream2iATI) +#define glVertexStream2ivATI GLEW_GET_FUN(__glewVertexStream2ivATI) +#define glVertexStream2sATI GLEW_GET_FUN(__glewVertexStream2sATI) +#define glVertexStream2svATI GLEW_GET_FUN(__glewVertexStream2svATI) +#define glVertexStream3dATI GLEW_GET_FUN(__glewVertexStream3dATI) +#define glVertexStream3dvATI GLEW_GET_FUN(__glewVertexStream3dvATI) +#define glVertexStream3fATI GLEW_GET_FUN(__glewVertexStream3fATI) +#define glVertexStream3fvATI GLEW_GET_FUN(__glewVertexStream3fvATI) +#define glVertexStream3iATI GLEW_GET_FUN(__glewVertexStream3iATI) +#define glVertexStream3ivATI GLEW_GET_FUN(__glewVertexStream3ivATI) +#define glVertexStream3sATI GLEW_GET_FUN(__glewVertexStream3sATI) +#define glVertexStream3svATI GLEW_GET_FUN(__glewVertexStream3svATI) +#define glVertexStream4dATI GLEW_GET_FUN(__glewVertexStream4dATI) +#define glVertexStream4dvATI GLEW_GET_FUN(__glewVertexStream4dvATI) +#define glVertexStream4fATI GLEW_GET_FUN(__glewVertexStream4fATI) +#define glVertexStream4fvATI GLEW_GET_FUN(__glewVertexStream4fvATI) +#define glVertexStream4iATI GLEW_GET_FUN(__glewVertexStream4iATI) +#define glVertexStream4ivATI GLEW_GET_FUN(__glewVertexStream4ivATI) +#define glVertexStream4sATI GLEW_GET_FUN(__glewVertexStream4sATI) +#define glVertexStream4svATI GLEW_GET_FUN(__glewVertexStream4svATI) + +#define GLEW_ATI_vertex_streams GLEW_GET_VAR(__GLEW_ATI_vertex_streams) + +#endif /* GL_ATI_vertex_streams */ + +/* --------------------------- GL_EXT_422_pixels --------------------------- */ + +#ifndef GL_EXT_422_pixels +#define GL_EXT_422_pixels 1 + +#define GL_422_EXT 0x80CC +#define GL_422_REV_EXT 0x80CD +#define GL_422_AVERAGE_EXT 0x80CE +#define GL_422_REV_AVERAGE_EXT 0x80CF + +#define GLEW_EXT_422_pixels GLEW_GET_VAR(__GLEW_EXT_422_pixels) + +#endif /* GL_EXT_422_pixels */ + +/* ---------------------------- GL_EXT_Cg_shader --------------------------- */ + +#ifndef GL_EXT_Cg_shader +#define GL_EXT_Cg_shader 1 + +#define GL_CG_VERTEX_SHADER_EXT 0x890E +#define GL_CG_FRAGMENT_SHADER_EXT 0x890F + +#define GLEW_EXT_Cg_shader GLEW_GET_VAR(__GLEW_EXT_Cg_shader) + +#endif /* GL_EXT_Cg_shader */ + +/* ------------------------------ GL_EXT_abgr ------------------------------ */ + +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 + +#define GL_ABGR_EXT 0x8000 + +#define GLEW_EXT_abgr GLEW_GET_VAR(__GLEW_EXT_abgr) + +#endif /* GL_EXT_abgr */ + +/* ------------------------------ GL_EXT_bgra ------------------------------ */ + +#ifndef GL_EXT_bgra +#define GL_EXT_bgra 1 + +#define GL_BGR_EXT 0x80E0 +#define GL_BGRA_EXT 0x80E1 + +#define GLEW_EXT_bgra GLEW_GET_VAR(__GLEW_EXT_bgra) + +#endif /* GL_EXT_bgra */ + +/* ------------------------ GL_EXT_bindable_uniform ------------------------ */ + +#ifndef GL_EXT_bindable_uniform +#define GL_EXT_bindable_uniform 1 + +#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 +#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 +#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 +#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED +#define GL_UNIFORM_BUFFER_EXT 0x8DEE +#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF + +typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location); +typedef GLintptr (GLAPIENTRY * PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location); +typedef void (GLAPIENTRY * PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer); + +#define glGetUniformBufferSizeEXT GLEW_GET_FUN(__glewGetUniformBufferSizeEXT) +#define glGetUniformOffsetEXT GLEW_GET_FUN(__glewGetUniformOffsetEXT) +#define glUniformBufferEXT GLEW_GET_FUN(__glewUniformBufferEXT) + +#define GLEW_EXT_bindable_uniform GLEW_GET_VAR(__GLEW_EXT_bindable_uniform) + +#endif /* GL_EXT_bindable_uniform */ + +/* --------------------------- GL_EXT_blend_color -------------------------- */ + +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 + +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 + +typedef void (GLAPIENTRY * PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + +#define glBlendColorEXT GLEW_GET_FUN(__glewBlendColorEXT) + +#define GLEW_EXT_blend_color GLEW_GET_VAR(__GLEW_EXT_blend_color) + +#endif /* GL_EXT_blend_color */ + +/* --------------------- GL_EXT_blend_equation_separate -------------------- */ + +#ifndef GL_EXT_blend_equation_separate +#define GL_EXT_blend_equation_separate 1 + +#define GL_BLEND_EQUATION_RGB_EXT 0x8009 +#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D + +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); + +#define glBlendEquationSeparateEXT GLEW_GET_FUN(__glewBlendEquationSeparateEXT) + +#define GLEW_EXT_blend_equation_separate GLEW_GET_VAR(__GLEW_EXT_blend_equation_separate) + +#endif /* GL_EXT_blend_equation_separate */ + +/* ----------------------- GL_EXT_blend_func_separate ---------------------- */ + +#ifndef GL_EXT_blend_func_separate +#define GL_EXT_blend_func_separate 1 + +#define GL_BLEND_DST_RGB_EXT 0x80C8 +#define GL_BLEND_SRC_RGB_EXT 0x80C9 +#define GL_BLEND_DST_ALPHA_EXT 0x80CA +#define GL_BLEND_SRC_ALPHA_EXT 0x80CB + +typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); + +#define glBlendFuncSeparateEXT GLEW_GET_FUN(__glewBlendFuncSeparateEXT) + +#define GLEW_EXT_blend_func_separate GLEW_GET_VAR(__GLEW_EXT_blend_func_separate) + +#endif /* GL_EXT_blend_func_separate */ + +/* ------------------------- GL_EXT_blend_logic_op ------------------------- */ + +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 + +#define GLEW_EXT_blend_logic_op GLEW_GET_VAR(__GLEW_EXT_blend_logic_op) + +#endif /* GL_EXT_blend_logic_op */ + +/* -------------------------- GL_EXT_blend_minmax -------------------------- */ + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 + +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 + +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); + +#define glBlendEquationEXT GLEW_GET_FUN(__glewBlendEquationEXT) + +#define GLEW_EXT_blend_minmax GLEW_GET_VAR(__GLEW_EXT_blend_minmax) + +#endif /* GL_EXT_blend_minmax */ + +/* ------------------------- GL_EXT_blend_subtract ------------------------- */ + +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 + +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B + +#define GLEW_EXT_blend_subtract GLEW_GET_VAR(__GLEW_EXT_blend_subtract) + +#endif /* GL_EXT_blend_subtract */ + +/* ------------------------ GL_EXT_clip_volume_hint ------------------------ */ + +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 + +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 + +#define GLEW_EXT_clip_volume_hint GLEW_GET_VAR(__GLEW_EXT_clip_volume_hint) + +#endif /* GL_EXT_clip_volume_hint */ + +/* ------------------------------ GL_EXT_cmyka ----------------------------- */ + +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 + +#define GL_CMYK_EXT 0x800C +#define GL_CMYKA_EXT 0x800D +#define GL_PACK_CMYK_HINT_EXT 0x800E +#define GL_UNPACK_CMYK_HINT_EXT 0x800F + +#define GLEW_EXT_cmyka GLEW_GET_VAR(__GLEW_EXT_cmyka) + +#endif /* GL_EXT_cmyka */ + +/* ------------------------- GL_EXT_color_subtable ------------------------- */ + +#ifndef GL_EXT_color_subtable +#define GL_EXT_color_subtable 1 + +typedef void (GLAPIENTRY * PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); +typedef void (GLAPIENTRY * PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); + +#define glColorSubTableEXT GLEW_GET_FUN(__glewColorSubTableEXT) +#define glCopyColorSubTableEXT GLEW_GET_FUN(__glewCopyColorSubTableEXT) + +#define GLEW_EXT_color_subtable GLEW_GET_VAR(__GLEW_EXT_color_subtable) + +#endif /* GL_EXT_color_subtable */ + +/* ---------------------- GL_EXT_compiled_vertex_array --------------------- */ + +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 + +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 + +typedef void (GLAPIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); +typedef void (GLAPIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void); + +#define glLockArraysEXT GLEW_GET_FUN(__glewLockArraysEXT) +#define glUnlockArraysEXT GLEW_GET_FUN(__glewUnlockArraysEXT) + +#define GLEW_EXT_compiled_vertex_array GLEW_GET_VAR(__GLEW_EXT_compiled_vertex_array) + +#endif /* GL_EXT_compiled_vertex_array */ + +/* --------------------------- GL_EXT_convolution -------------------------- */ + +#ifndef GL_EXT_convolution +#define GL_EXT_convolution 1 + +#define GL_CONVOLUTION_1D_EXT 0x8010 +#define GL_CONVOLUTION_2D_EXT 0x8011 +#define GL_SEPARABLE_2D_EXT 0x8012 +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#define GL_REDUCE_EXT 0x8016 +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 + +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void *image); +typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); +typedef void (GLAPIENTRY * PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); + +#define glConvolutionFilter1DEXT GLEW_GET_FUN(__glewConvolutionFilter1DEXT) +#define glConvolutionFilter2DEXT GLEW_GET_FUN(__glewConvolutionFilter2DEXT) +#define glConvolutionParameterfEXT GLEW_GET_FUN(__glewConvolutionParameterfEXT) +#define glConvolutionParameterfvEXT GLEW_GET_FUN(__glewConvolutionParameterfvEXT) +#define glConvolutionParameteriEXT GLEW_GET_FUN(__glewConvolutionParameteriEXT) +#define glConvolutionParameterivEXT GLEW_GET_FUN(__glewConvolutionParameterivEXT) +#define glCopyConvolutionFilter1DEXT GLEW_GET_FUN(__glewCopyConvolutionFilter1DEXT) +#define glCopyConvolutionFilter2DEXT GLEW_GET_FUN(__glewCopyConvolutionFilter2DEXT) +#define glGetConvolutionFilterEXT GLEW_GET_FUN(__glewGetConvolutionFilterEXT) +#define glGetConvolutionParameterfvEXT GLEW_GET_FUN(__glewGetConvolutionParameterfvEXT) +#define glGetConvolutionParameterivEXT GLEW_GET_FUN(__glewGetConvolutionParameterivEXT) +#define glGetSeparableFilterEXT GLEW_GET_FUN(__glewGetSeparableFilterEXT) +#define glSeparableFilter2DEXT GLEW_GET_FUN(__glewSeparableFilter2DEXT) + +#define GLEW_EXT_convolution GLEW_GET_VAR(__GLEW_EXT_convolution) + +#endif /* GL_EXT_convolution */ + +/* ------------------------ GL_EXT_coordinate_frame ------------------------ */ + +#ifndef GL_EXT_coordinate_frame +#define GL_EXT_coordinate_frame 1 + +#define GL_TANGENT_ARRAY_EXT 0x8439 +#define GL_BINORMAL_ARRAY_EXT 0x843A +#define GL_CURRENT_TANGENT_EXT 0x843B +#define GL_CURRENT_BINORMAL_EXT 0x843C +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#define GL_MAP1_TANGENT_EXT 0x8444 +#define GL_MAP2_TANGENT_EXT 0x8445 +#define GL_MAP1_BINORMAL_EXT 0x8446 +#define GL_MAP2_BINORMAL_EXT 0x8447 + +typedef void (GLAPIENTRY * PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, void *pointer); +typedef void (GLAPIENTRY * PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, void *pointer); + +#define glBinormalPointerEXT GLEW_GET_FUN(__glewBinormalPointerEXT) +#define glTangentPointerEXT GLEW_GET_FUN(__glewTangentPointerEXT) + +#define GLEW_EXT_coordinate_frame GLEW_GET_VAR(__GLEW_EXT_coordinate_frame) + +#endif /* GL_EXT_coordinate_frame */ + +/* -------------------------- GL_EXT_copy_texture -------------------------- */ + +#ifndef GL_EXT_copy_texture +#define GL_EXT_copy_texture 1 + +typedef void (GLAPIENTRY * PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (GLAPIENTRY * PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); + +#define glCopyTexImage1DEXT GLEW_GET_FUN(__glewCopyTexImage1DEXT) +#define glCopyTexImage2DEXT GLEW_GET_FUN(__glewCopyTexImage2DEXT) +#define glCopyTexSubImage1DEXT GLEW_GET_FUN(__glewCopyTexSubImage1DEXT) +#define glCopyTexSubImage2DEXT GLEW_GET_FUN(__glewCopyTexSubImage2DEXT) +#define glCopyTexSubImage3DEXT GLEW_GET_FUN(__glewCopyTexSubImage3DEXT) + +#define GLEW_EXT_copy_texture GLEW_GET_VAR(__GLEW_EXT_copy_texture) + +#endif /* GL_EXT_copy_texture */ + +/* --------------------------- GL_EXT_cull_vertex -------------------------- */ + +#ifndef GL_EXT_cull_vertex +#define GL_EXT_cull_vertex 1 + +#define GL_CULL_VERTEX_EXT 0x81AA +#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB +#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC + +typedef void (GLAPIENTRY * PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat* params); + +#define glCullParameterdvEXT GLEW_GET_FUN(__glewCullParameterdvEXT) +#define glCullParameterfvEXT GLEW_GET_FUN(__glewCullParameterfvEXT) + +#define GLEW_EXT_cull_vertex GLEW_GET_VAR(__GLEW_EXT_cull_vertex) + +#endif /* GL_EXT_cull_vertex */ + +/* --------------------------- GL_EXT_debug_label -------------------------- */ + +#ifndef GL_EXT_debug_label +#define GL_EXT_debug_label 1 + +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 + +typedef void (GLAPIENTRY * PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei* length, GLchar *label); +typedef void (GLAPIENTRY * PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar* label); + +#define glGetObjectLabelEXT GLEW_GET_FUN(__glewGetObjectLabelEXT) +#define glLabelObjectEXT GLEW_GET_FUN(__glewLabelObjectEXT) + +#define GLEW_EXT_debug_label GLEW_GET_VAR(__GLEW_EXT_debug_label) + +#endif /* GL_EXT_debug_label */ + +/* -------------------------- GL_EXT_debug_marker -------------------------- */ + +#ifndef GL_EXT_debug_marker +#define GL_EXT_debug_marker 1 + +typedef void (GLAPIENTRY * PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar* marker); +typedef void (GLAPIENTRY * PFNGLPOPGROUPMARKEREXTPROC) (void); +typedef void (GLAPIENTRY * PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar* marker); + +#define glInsertEventMarkerEXT GLEW_GET_FUN(__glewInsertEventMarkerEXT) +#define glPopGroupMarkerEXT GLEW_GET_FUN(__glewPopGroupMarkerEXT) +#define glPushGroupMarkerEXT GLEW_GET_FUN(__glewPushGroupMarkerEXT) + +#define GLEW_EXT_debug_marker GLEW_GET_VAR(__GLEW_EXT_debug_marker) + +#endif /* GL_EXT_debug_marker */ + +/* ------------------------ GL_EXT_depth_bounds_test ----------------------- */ + +#ifndef GL_EXT_depth_bounds_test +#define GL_EXT_depth_bounds_test 1 + +#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 +#define GL_DEPTH_BOUNDS_EXT 0x8891 + +typedef void (GLAPIENTRY * PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); + +#define glDepthBoundsEXT GLEW_GET_FUN(__glewDepthBoundsEXT) + +#define GLEW_EXT_depth_bounds_test GLEW_GET_VAR(__GLEW_EXT_depth_bounds_test) + +#endif /* GL_EXT_depth_bounds_test */ + +/* ----------------------- GL_EXT_direct_state_access ---------------------- */ + +#ifndef GL_EXT_direct_state_access +#define GL_EXT_direct_state_access 1 + +#define GL_PROGRAM_MATRIX_EXT 0x8E2D +#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E +#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F + +typedef void (GLAPIENTRY * PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture); +typedef GLenum (GLAPIENTRY * PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target); +typedef void (GLAPIENTRY * PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (GLAPIENTRY * PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); +typedef void (GLAPIENTRY * PFNGLDISABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index); +typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index); +typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array); +typedef void (GLAPIENTRY * PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); +typedef void (GLAPIENTRY * PFNGLENABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index); +typedef void (GLAPIENTRY * PFNGLENABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index); +typedef void (GLAPIENTRY * PFNGLENABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array); +typedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum* bufs); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); +typedef void (GLAPIENTRY * PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target); +typedef void (GLAPIENTRY * PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target); +typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, void *img); +typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, void *img); +typedef void (GLAPIENTRY * PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint* param); +typedef void (GLAPIENTRY * PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +typedef void (GLAPIENTRY * PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, void** params); +typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +typedef void (GLAPIENTRY * PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint* params); +typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, void *string); +typedef void (GLAPIENTRY * PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, void** params); +typedef void (GLAPIENTRY * PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, void** params); +typedef void (GLAPIENTRY * PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +typedef void (GLAPIENTRY * PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint* param); +typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYINTEGERVEXTPROC) (GLuint vaobj, GLenum pname, GLint* param); +typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, void** param); +typedef void (GLAPIENTRY * PFNGLGETVERTEXARRAYPOINTERVEXTPROC) (GLuint vaobj, GLenum pname, void** param); +typedef void * (GLAPIENTRY * PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access); +typedef void * (GLAPIENTRY * PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (GLAPIENTRY * PFNGLMATRIXFRUSTUMEXTPROC) (GLenum matrixMode, GLdouble l, GLdouble r, GLdouble b, GLdouble t, GLdouble n, GLdouble f); +typedef void (GLAPIENTRY * PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum matrixMode); +typedef void (GLAPIENTRY * PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum matrixMode, const GLdouble* m); +typedef void (GLAPIENTRY * PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum matrixMode, const GLfloat* m); +typedef void (GLAPIENTRY * PFNGLMATRIXLOADDEXTPROC) (GLenum matrixMode, const GLdouble* m); +typedef void (GLAPIENTRY * PFNGLMATRIXLOADFEXTPROC) (GLenum matrixMode, const GLfloat* m); +typedef void (GLAPIENTRY * PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum matrixMode, const GLdouble* m); +typedef void (GLAPIENTRY * PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum matrixMode, const GLfloat* m); +typedef void (GLAPIENTRY * PFNGLMATRIXMULTDEXTPROC) (GLenum matrixMode, const GLdouble* m); +typedef void (GLAPIENTRY * PFNGLMATRIXMULTFEXTPROC) (GLenum matrixMode, const GLfloat* m); +typedef void (GLAPIENTRY * PFNGLMATRIXORTHOEXTPROC) (GLenum matrixMode, GLdouble l, GLdouble r, GLdouble b, GLdouble t, GLdouble n, GLdouble f); +typedef void (GLAPIENTRY * PFNGLMATRIXPOPEXTPROC) (GLenum matrixMode); +typedef void (GLAPIENTRY * PFNGLMATRIXPUSHEXTPROC) (GLenum matrixMode); +typedef void (GLAPIENTRY * PFNGLMATRIXROTATEDEXTPROC) (GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLMATRIXROTATEFEXTPROC) (GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLMATRIXSCALEDEXTPROC) (GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLMATRIXSCALEFEXTPROC) (GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (GLAPIENTRY * PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param); +typedef void (GLAPIENTRY * PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble* params); +typedef void (GLAPIENTRY * PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint* params); +typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat* param); +typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint* param); +typedef void (GLAPIENTRY * PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer); +typedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +typedef void (GLAPIENTRY * PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble* params); +typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint* params); +typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint* params); +typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint* params); +typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint* params); +typedef void (GLAPIENTRY * PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const void *string); +typedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); +typedef void (GLAPIENTRY * PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer); +typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint* params); +typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat* param); +typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint* param); +typedef void (GLAPIENTRY * PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer); +typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef GLboolean (GLAPIENTRY * PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYINDEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYNORMALOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC) (GLuint vaobj, GLuint index, GLuint divisor); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); + +#define glBindMultiTextureEXT GLEW_GET_FUN(__glewBindMultiTextureEXT) +#define glCheckNamedFramebufferStatusEXT GLEW_GET_FUN(__glewCheckNamedFramebufferStatusEXT) +#define glClientAttribDefaultEXT GLEW_GET_FUN(__glewClientAttribDefaultEXT) +#define glCompressedMultiTexImage1DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage1DEXT) +#define glCompressedMultiTexImage2DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage2DEXT) +#define glCompressedMultiTexImage3DEXT GLEW_GET_FUN(__glewCompressedMultiTexImage3DEXT) +#define glCompressedMultiTexSubImage1DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage1DEXT) +#define glCompressedMultiTexSubImage2DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage2DEXT) +#define glCompressedMultiTexSubImage3DEXT GLEW_GET_FUN(__glewCompressedMultiTexSubImage3DEXT) +#define glCompressedTextureImage1DEXT GLEW_GET_FUN(__glewCompressedTextureImage1DEXT) +#define glCompressedTextureImage2DEXT GLEW_GET_FUN(__glewCompressedTextureImage2DEXT) +#define glCompressedTextureImage3DEXT GLEW_GET_FUN(__glewCompressedTextureImage3DEXT) +#define glCompressedTextureSubImage1DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage1DEXT) +#define glCompressedTextureSubImage2DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage2DEXT) +#define glCompressedTextureSubImage3DEXT GLEW_GET_FUN(__glewCompressedTextureSubImage3DEXT) +#define glCopyMultiTexImage1DEXT GLEW_GET_FUN(__glewCopyMultiTexImage1DEXT) +#define glCopyMultiTexImage2DEXT GLEW_GET_FUN(__glewCopyMultiTexImage2DEXT) +#define glCopyMultiTexSubImage1DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage1DEXT) +#define glCopyMultiTexSubImage2DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage2DEXT) +#define glCopyMultiTexSubImage3DEXT GLEW_GET_FUN(__glewCopyMultiTexSubImage3DEXT) +#define glCopyTextureImage1DEXT GLEW_GET_FUN(__glewCopyTextureImage1DEXT) +#define glCopyTextureImage2DEXT GLEW_GET_FUN(__glewCopyTextureImage2DEXT) +#define glCopyTextureSubImage1DEXT GLEW_GET_FUN(__glewCopyTextureSubImage1DEXT) +#define glCopyTextureSubImage2DEXT GLEW_GET_FUN(__glewCopyTextureSubImage2DEXT) +#define glCopyTextureSubImage3DEXT GLEW_GET_FUN(__glewCopyTextureSubImage3DEXT) +#define glDisableClientStateIndexedEXT GLEW_GET_FUN(__glewDisableClientStateIndexedEXT) +#define glDisableClientStateiEXT GLEW_GET_FUN(__glewDisableClientStateiEXT) +#define glDisableVertexArrayAttribEXT GLEW_GET_FUN(__glewDisableVertexArrayAttribEXT) +#define glDisableVertexArrayEXT GLEW_GET_FUN(__glewDisableVertexArrayEXT) +#define glEnableClientStateIndexedEXT GLEW_GET_FUN(__glewEnableClientStateIndexedEXT) +#define glEnableClientStateiEXT GLEW_GET_FUN(__glewEnableClientStateiEXT) +#define glEnableVertexArrayAttribEXT GLEW_GET_FUN(__glewEnableVertexArrayAttribEXT) +#define glEnableVertexArrayEXT GLEW_GET_FUN(__glewEnableVertexArrayEXT) +#define glFlushMappedNamedBufferRangeEXT GLEW_GET_FUN(__glewFlushMappedNamedBufferRangeEXT) +#define glFramebufferDrawBufferEXT GLEW_GET_FUN(__glewFramebufferDrawBufferEXT) +#define glFramebufferDrawBuffersEXT GLEW_GET_FUN(__glewFramebufferDrawBuffersEXT) +#define glFramebufferReadBufferEXT GLEW_GET_FUN(__glewFramebufferReadBufferEXT) +#define glGenerateMultiTexMipmapEXT GLEW_GET_FUN(__glewGenerateMultiTexMipmapEXT) +#define glGenerateTextureMipmapEXT GLEW_GET_FUN(__glewGenerateTextureMipmapEXT) +#define glGetCompressedMultiTexImageEXT GLEW_GET_FUN(__glewGetCompressedMultiTexImageEXT) +#define glGetCompressedTextureImageEXT GLEW_GET_FUN(__glewGetCompressedTextureImageEXT) +#define glGetDoubleIndexedvEXT GLEW_GET_FUN(__glewGetDoubleIndexedvEXT) +#define glGetDoublei_vEXT GLEW_GET_FUN(__glewGetDoublei_vEXT) +#define glGetFloatIndexedvEXT GLEW_GET_FUN(__glewGetFloatIndexedvEXT) +#define glGetFloati_vEXT GLEW_GET_FUN(__glewGetFloati_vEXT) +#define glGetFramebufferParameterivEXT GLEW_GET_FUN(__glewGetFramebufferParameterivEXT) +#define glGetMultiTexEnvfvEXT GLEW_GET_FUN(__glewGetMultiTexEnvfvEXT) +#define glGetMultiTexEnvivEXT GLEW_GET_FUN(__glewGetMultiTexEnvivEXT) +#define glGetMultiTexGendvEXT GLEW_GET_FUN(__glewGetMultiTexGendvEXT) +#define glGetMultiTexGenfvEXT GLEW_GET_FUN(__glewGetMultiTexGenfvEXT) +#define glGetMultiTexGenivEXT GLEW_GET_FUN(__glewGetMultiTexGenivEXT) +#define glGetMultiTexImageEXT GLEW_GET_FUN(__glewGetMultiTexImageEXT) +#define glGetMultiTexLevelParameterfvEXT GLEW_GET_FUN(__glewGetMultiTexLevelParameterfvEXT) +#define glGetMultiTexLevelParameterivEXT GLEW_GET_FUN(__glewGetMultiTexLevelParameterivEXT) +#define glGetMultiTexParameterIivEXT GLEW_GET_FUN(__glewGetMultiTexParameterIivEXT) +#define glGetMultiTexParameterIuivEXT GLEW_GET_FUN(__glewGetMultiTexParameterIuivEXT) +#define glGetMultiTexParameterfvEXT GLEW_GET_FUN(__glewGetMultiTexParameterfvEXT) +#define glGetMultiTexParameterivEXT GLEW_GET_FUN(__glewGetMultiTexParameterivEXT) +#define glGetNamedBufferParameterivEXT GLEW_GET_FUN(__glewGetNamedBufferParameterivEXT) +#define glGetNamedBufferPointervEXT GLEW_GET_FUN(__glewGetNamedBufferPointervEXT) +#define glGetNamedBufferSubDataEXT GLEW_GET_FUN(__glewGetNamedBufferSubDataEXT) +#define glGetNamedFramebufferAttachmentParameterivEXT GLEW_GET_FUN(__glewGetNamedFramebufferAttachmentParameterivEXT) +#define glGetNamedProgramLocalParameterIivEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterIivEXT) +#define glGetNamedProgramLocalParameterIuivEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterIuivEXT) +#define glGetNamedProgramLocalParameterdvEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterdvEXT) +#define glGetNamedProgramLocalParameterfvEXT GLEW_GET_FUN(__glewGetNamedProgramLocalParameterfvEXT) +#define glGetNamedProgramStringEXT GLEW_GET_FUN(__glewGetNamedProgramStringEXT) +#define glGetNamedProgramivEXT GLEW_GET_FUN(__glewGetNamedProgramivEXT) +#define glGetNamedRenderbufferParameterivEXT GLEW_GET_FUN(__glewGetNamedRenderbufferParameterivEXT) +#define glGetPointerIndexedvEXT GLEW_GET_FUN(__glewGetPointerIndexedvEXT) +#define glGetPointeri_vEXT GLEW_GET_FUN(__glewGetPointeri_vEXT) +#define glGetTextureImageEXT GLEW_GET_FUN(__glewGetTextureImageEXT) +#define glGetTextureLevelParameterfvEXT GLEW_GET_FUN(__glewGetTextureLevelParameterfvEXT) +#define glGetTextureLevelParameterivEXT GLEW_GET_FUN(__glewGetTextureLevelParameterivEXT) +#define glGetTextureParameterIivEXT GLEW_GET_FUN(__glewGetTextureParameterIivEXT) +#define glGetTextureParameterIuivEXT GLEW_GET_FUN(__glewGetTextureParameterIuivEXT) +#define glGetTextureParameterfvEXT GLEW_GET_FUN(__glewGetTextureParameterfvEXT) +#define glGetTextureParameterivEXT GLEW_GET_FUN(__glewGetTextureParameterivEXT) +#define glGetVertexArrayIntegeri_vEXT GLEW_GET_FUN(__glewGetVertexArrayIntegeri_vEXT) +#define glGetVertexArrayIntegervEXT GLEW_GET_FUN(__glewGetVertexArrayIntegervEXT) +#define glGetVertexArrayPointeri_vEXT GLEW_GET_FUN(__glewGetVertexArrayPointeri_vEXT) +#define glGetVertexArrayPointervEXT GLEW_GET_FUN(__glewGetVertexArrayPointervEXT) +#define glMapNamedBufferEXT GLEW_GET_FUN(__glewMapNamedBufferEXT) +#define glMapNamedBufferRangeEXT GLEW_GET_FUN(__glewMapNamedBufferRangeEXT) +#define glMatrixFrustumEXT GLEW_GET_FUN(__glewMatrixFrustumEXT) +#define glMatrixLoadIdentityEXT GLEW_GET_FUN(__glewMatrixLoadIdentityEXT) +#define glMatrixLoadTransposedEXT GLEW_GET_FUN(__glewMatrixLoadTransposedEXT) +#define glMatrixLoadTransposefEXT GLEW_GET_FUN(__glewMatrixLoadTransposefEXT) +#define glMatrixLoaddEXT GLEW_GET_FUN(__glewMatrixLoaddEXT) +#define glMatrixLoadfEXT GLEW_GET_FUN(__glewMatrixLoadfEXT) +#define glMatrixMultTransposedEXT GLEW_GET_FUN(__glewMatrixMultTransposedEXT) +#define glMatrixMultTransposefEXT GLEW_GET_FUN(__glewMatrixMultTransposefEXT) +#define glMatrixMultdEXT GLEW_GET_FUN(__glewMatrixMultdEXT) +#define glMatrixMultfEXT GLEW_GET_FUN(__glewMatrixMultfEXT) +#define glMatrixOrthoEXT GLEW_GET_FUN(__glewMatrixOrthoEXT) +#define glMatrixPopEXT GLEW_GET_FUN(__glewMatrixPopEXT) +#define glMatrixPushEXT GLEW_GET_FUN(__glewMatrixPushEXT) +#define glMatrixRotatedEXT GLEW_GET_FUN(__glewMatrixRotatedEXT) +#define glMatrixRotatefEXT GLEW_GET_FUN(__glewMatrixRotatefEXT) +#define glMatrixScaledEXT GLEW_GET_FUN(__glewMatrixScaledEXT) +#define glMatrixScalefEXT GLEW_GET_FUN(__glewMatrixScalefEXT) +#define glMatrixTranslatedEXT GLEW_GET_FUN(__glewMatrixTranslatedEXT) +#define glMatrixTranslatefEXT GLEW_GET_FUN(__glewMatrixTranslatefEXT) +#define glMultiTexBufferEXT GLEW_GET_FUN(__glewMultiTexBufferEXT) +#define glMultiTexCoordPointerEXT GLEW_GET_FUN(__glewMultiTexCoordPointerEXT) +#define glMultiTexEnvfEXT GLEW_GET_FUN(__glewMultiTexEnvfEXT) +#define glMultiTexEnvfvEXT GLEW_GET_FUN(__glewMultiTexEnvfvEXT) +#define glMultiTexEnviEXT GLEW_GET_FUN(__glewMultiTexEnviEXT) +#define glMultiTexEnvivEXT GLEW_GET_FUN(__glewMultiTexEnvivEXT) +#define glMultiTexGendEXT GLEW_GET_FUN(__glewMultiTexGendEXT) +#define glMultiTexGendvEXT GLEW_GET_FUN(__glewMultiTexGendvEXT) +#define glMultiTexGenfEXT GLEW_GET_FUN(__glewMultiTexGenfEXT) +#define glMultiTexGenfvEXT GLEW_GET_FUN(__glewMultiTexGenfvEXT) +#define glMultiTexGeniEXT GLEW_GET_FUN(__glewMultiTexGeniEXT) +#define glMultiTexGenivEXT GLEW_GET_FUN(__glewMultiTexGenivEXT) +#define glMultiTexImage1DEXT GLEW_GET_FUN(__glewMultiTexImage1DEXT) +#define glMultiTexImage2DEXT GLEW_GET_FUN(__glewMultiTexImage2DEXT) +#define glMultiTexImage3DEXT GLEW_GET_FUN(__glewMultiTexImage3DEXT) +#define glMultiTexParameterIivEXT GLEW_GET_FUN(__glewMultiTexParameterIivEXT) +#define glMultiTexParameterIuivEXT GLEW_GET_FUN(__glewMultiTexParameterIuivEXT) +#define glMultiTexParameterfEXT GLEW_GET_FUN(__glewMultiTexParameterfEXT) +#define glMultiTexParameterfvEXT GLEW_GET_FUN(__glewMultiTexParameterfvEXT) +#define glMultiTexParameteriEXT GLEW_GET_FUN(__glewMultiTexParameteriEXT) +#define glMultiTexParameterivEXT GLEW_GET_FUN(__glewMultiTexParameterivEXT) +#define glMultiTexRenderbufferEXT GLEW_GET_FUN(__glewMultiTexRenderbufferEXT) +#define glMultiTexSubImage1DEXT GLEW_GET_FUN(__glewMultiTexSubImage1DEXT) +#define glMultiTexSubImage2DEXT GLEW_GET_FUN(__glewMultiTexSubImage2DEXT) +#define glMultiTexSubImage3DEXT GLEW_GET_FUN(__glewMultiTexSubImage3DEXT) +#define glNamedBufferDataEXT GLEW_GET_FUN(__glewNamedBufferDataEXT) +#define glNamedBufferSubDataEXT GLEW_GET_FUN(__glewNamedBufferSubDataEXT) +#define glNamedCopyBufferSubDataEXT GLEW_GET_FUN(__glewNamedCopyBufferSubDataEXT) +#define glNamedFramebufferRenderbufferEXT GLEW_GET_FUN(__glewNamedFramebufferRenderbufferEXT) +#define glNamedFramebufferTexture1DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture1DEXT) +#define glNamedFramebufferTexture2DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture2DEXT) +#define glNamedFramebufferTexture3DEXT GLEW_GET_FUN(__glewNamedFramebufferTexture3DEXT) +#define glNamedFramebufferTextureEXT GLEW_GET_FUN(__glewNamedFramebufferTextureEXT) +#define glNamedFramebufferTextureFaceEXT GLEW_GET_FUN(__glewNamedFramebufferTextureFaceEXT) +#define glNamedFramebufferTextureLayerEXT GLEW_GET_FUN(__glewNamedFramebufferTextureLayerEXT) +#define glNamedProgramLocalParameter4dEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4dEXT) +#define glNamedProgramLocalParameter4dvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4dvEXT) +#define glNamedProgramLocalParameter4fEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4fEXT) +#define glNamedProgramLocalParameter4fvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameter4fvEXT) +#define glNamedProgramLocalParameterI4iEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4iEXT) +#define glNamedProgramLocalParameterI4ivEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4ivEXT) +#define glNamedProgramLocalParameterI4uiEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4uiEXT) +#define glNamedProgramLocalParameterI4uivEXT GLEW_GET_FUN(__glewNamedProgramLocalParameterI4uivEXT) +#define glNamedProgramLocalParameters4fvEXT GLEW_GET_FUN(__glewNamedProgramLocalParameters4fvEXT) +#define glNamedProgramLocalParametersI4ivEXT GLEW_GET_FUN(__glewNamedProgramLocalParametersI4ivEXT) +#define glNamedProgramLocalParametersI4uivEXT GLEW_GET_FUN(__glewNamedProgramLocalParametersI4uivEXT) +#define glNamedProgramStringEXT GLEW_GET_FUN(__glewNamedProgramStringEXT) +#define glNamedRenderbufferStorageEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageEXT) +#define glNamedRenderbufferStorageMultisampleCoverageEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageMultisampleCoverageEXT) +#define glNamedRenderbufferStorageMultisampleEXT GLEW_GET_FUN(__glewNamedRenderbufferStorageMultisampleEXT) +#define glProgramUniform1fEXT GLEW_GET_FUN(__glewProgramUniform1fEXT) +#define glProgramUniform1fvEXT GLEW_GET_FUN(__glewProgramUniform1fvEXT) +#define glProgramUniform1iEXT GLEW_GET_FUN(__glewProgramUniform1iEXT) +#define glProgramUniform1ivEXT GLEW_GET_FUN(__glewProgramUniform1ivEXT) +#define glProgramUniform1uiEXT GLEW_GET_FUN(__glewProgramUniform1uiEXT) +#define glProgramUniform1uivEXT GLEW_GET_FUN(__glewProgramUniform1uivEXT) +#define glProgramUniform2fEXT GLEW_GET_FUN(__glewProgramUniform2fEXT) +#define glProgramUniform2fvEXT GLEW_GET_FUN(__glewProgramUniform2fvEXT) +#define glProgramUniform2iEXT GLEW_GET_FUN(__glewProgramUniform2iEXT) +#define glProgramUniform2ivEXT GLEW_GET_FUN(__glewProgramUniform2ivEXT) +#define glProgramUniform2uiEXT GLEW_GET_FUN(__glewProgramUniform2uiEXT) +#define glProgramUniform2uivEXT GLEW_GET_FUN(__glewProgramUniform2uivEXT) +#define glProgramUniform3fEXT GLEW_GET_FUN(__glewProgramUniform3fEXT) +#define glProgramUniform3fvEXT GLEW_GET_FUN(__glewProgramUniform3fvEXT) +#define glProgramUniform3iEXT GLEW_GET_FUN(__glewProgramUniform3iEXT) +#define glProgramUniform3ivEXT GLEW_GET_FUN(__glewProgramUniform3ivEXT) +#define glProgramUniform3uiEXT GLEW_GET_FUN(__glewProgramUniform3uiEXT) +#define glProgramUniform3uivEXT GLEW_GET_FUN(__glewProgramUniform3uivEXT) +#define glProgramUniform4fEXT GLEW_GET_FUN(__glewProgramUniform4fEXT) +#define glProgramUniform4fvEXT GLEW_GET_FUN(__glewProgramUniform4fvEXT) +#define glProgramUniform4iEXT GLEW_GET_FUN(__glewProgramUniform4iEXT) +#define glProgramUniform4ivEXT GLEW_GET_FUN(__glewProgramUniform4ivEXT) +#define glProgramUniform4uiEXT GLEW_GET_FUN(__glewProgramUniform4uiEXT) +#define glProgramUniform4uivEXT GLEW_GET_FUN(__glewProgramUniform4uivEXT) +#define glProgramUniformMatrix2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2fvEXT) +#define glProgramUniformMatrix2x3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x3fvEXT) +#define glProgramUniformMatrix2x4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix2x4fvEXT) +#define glProgramUniformMatrix3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3fvEXT) +#define glProgramUniformMatrix3x2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x2fvEXT) +#define glProgramUniformMatrix3x4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix3x4fvEXT) +#define glProgramUniformMatrix4fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4fvEXT) +#define glProgramUniformMatrix4x2fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x2fvEXT) +#define glProgramUniformMatrix4x3fvEXT GLEW_GET_FUN(__glewProgramUniformMatrix4x3fvEXT) +#define glPushClientAttribDefaultEXT GLEW_GET_FUN(__glewPushClientAttribDefaultEXT) +#define glTextureBufferEXT GLEW_GET_FUN(__glewTextureBufferEXT) +#define glTextureImage1DEXT GLEW_GET_FUN(__glewTextureImage1DEXT) +#define glTextureImage2DEXT GLEW_GET_FUN(__glewTextureImage2DEXT) +#define glTextureImage3DEXT GLEW_GET_FUN(__glewTextureImage3DEXT) +#define glTextureParameterIivEXT GLEW_GET_FUN(__glewTextureParameterIivEXT) +#define glTextureParameterIuivEXT GLEW_GET_FUN(__glewTextureParameterIuivEXT) +#define glTextureParameterfEXT GLEW_GET_FUN(__glewTextureParameterfEXT) +#define glTextureParameterfvEXT GLEW_GET_FUN(__glewTextureParameterfvEXT) +#define glTextureParameteriEXT GLEW_GET_FUN(__glewTextureParameteriEXT) +#define glTextureParameterivEXT GLEW_GET_FUN(__glewTextureParameterivEXT) +#define glTextureRenderbufferEXT GLEW_GET_FUN(__glewTextureRenderbufferEXT) +#define glTextureSubImage1DEXT GLEW_GET_FUN(__glewTextureSubImage1DEXT) +#define glTextureSubImage2DEXT GLEW_GET_FUN(__glewTextureSubImage2DEXT) +#define glTextureSubImage3DEXT GLEW_GET_FUN(__glewTextureSubImage3DEXT) +#define glUnmapNamedBufferEXT GLEW_GET_FUN(__glewUnmapNamedBufferEXT) +#define glVertexArrayColorOffsetEXT GLEW_GET_FUN(__glewVertexArrayColorOffsetEXT) +#define glVertexArrayEdgeFlagOffsetEXT GLEW_GET_FUN(__glewVertexArrayEdgeFlagOffsetEXT) +#define glVertexArrayFogCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayFogCoordOffsetEXT) +#define glVertexArrayIndexOffsetEXT GLEW_GET_FUN(__glewVertexArrayIndexOffsetEXT) +#define glVertexArrayMultiTexCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayMultiTexCoordOffsetEXT) +#define glVertexArrayNormalOffsetEXT GLEW_GET_FUN(__glewVertexArrayNormalOffsetEXT) +#define glVertexArraySecondaryColorOffsetEXT GLEW_GET_FUN(__glewVertexArraySecondaryColorOffsetEXT) +#define glVertexArrayTexCoordOffsetEXT GLEW_GET_FUN(__glewVertexArrayTexCoordOffsetEXT) +#define glVertexArrayVertexAttribDivisorEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribDivisorEXT) +#define glVertexArrayVertexAttribIOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribIOffsetEXT) +#define glVertexArrayVertexAttribOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribOffsetEXT) +#define glVertexArrayVertexOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexOffsetEXT) + +#define GLEW_EXT_direct_state_access GLEW_GET_VAR(__GLEW_EXT_direct_state_access) + +#endif /* GL_EXT_direct_state_access */ + +/* -------------------------- GL_EXT_draw_buffers2 ------------------------- */ + +#ifndef GL_EXT_draw_buffers2 +#define GL_EXT_draw_buffers2 1 + +typedef void (GLAPIENTRY * PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef void (GLAPIENTRY * PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index); +typedef void (GLAPIENTRY * PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index); +typedef void (GLAPIENTRY * PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum value, GLuint index, GLboolean* data); +typedef void (GLAPIENTRY * PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum value, GLuint index, GLint* data); +typedef GLboolean (GLAPIENTRY * PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index); + +#define glColorMaskIndexedEXT GLEW_GET_FUN(__glewColorMaskIndexedEXT) +#define glDisableIndexedEXT GLEW_GET_FUN(__glewDisableIndexedEXT) +#define glEnableIndexedEXT GLEW_GET_FUN(__glewEnableIndexedEXT) +#define glGetBooleanIndexedvEXT GLEW_GET_FUN(__glewGetBooleanIndexedvEXT) +#define glGetIntegerIndexedvEXT GLEW_GET_FUN(__glewGetIntegerIndexedvEXT) +#define glIsEnabledIndexedEXT GLEW_GET_FUN(__glewIsEnabledIndexedEXT) + +#define GLEW_EXT_draw_buffers2 GLEW_GET_VAR(__GLEW_EXT_draw_buffers2) + +#endif /* GL_EXT_draw_buffers2 */ + +/* ------------------------- GL_EXT_draw_instanced ------------------------- */ + +#ifndef GL_EXT_draw_instanced +#define GL_EXT_draw_instanced 1 + +typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); + +#define glDrawArraysInstancedEXT GLEW_GET_FUN(__glewDrawArraysInstancedEXT) +#define glDrawElementsInstancedEXT GLEW_GET_FUN(__glewDrawElementsInstancedEXT) + +#define GLEW_EXT_draw_instanced GLEW_GET_VAR(__GLEW_EXT_draw_instanced) + +#endif /* GL_EXT_draw_instanced */ + +/* ----------------------- GL_EXT_draw_range_elements ---------------------- */ + +#ifndef GL_EXT_draw_range_elements +#define GL_EXT_draw_range_elements 1 + +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 + +typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); + +#define glDrawRangeElementsEXT GLEW_GET_FUN(__glewDrawRangeElementsEXT) + +#define GLEW_EXT_draw_range_elements GLEW_GET_VAR(__GLEW_EXT_draw_range_elements) + +#endif /* GL_EXT_draw_range_elements */ + +/* ---------------------------- GL_EXT_fog_coord --------------------------- */ + +#ifndef GL_EXT_fog_coord +#define GL_EXT_fog_coord 1 + +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#define GL_FOG_COORDINATE_EXT 0x8451 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 + +typedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer); +typedef void (GLAPIENTRY * PFNGLFOGCOORDDEXTPROC) (GLdouble coord); +typedef void (GLAPIENTRY * PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); +typedef void (GLAPIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord); +typedef void (GLAPIENTRY * PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); + +#define glFogCoordPointerEXT GLEW_GET_FUN(__glewFogCoordPointerEXT) +#define glFogCoorddEXT GLEW_GET_FUN(__glewFogCoorddEXT) +#define glFogCoorddvEXT GLEW_GET_FUN(__glewFogCoorddvEXT) +#define glFogCoordfEXT GLEW_GET_FUN(__glewFogCoordfEXT) +#define glFogCoordfvEXT GLEW_GET_FUN(__glewFogCoordfvEXT) + +#define GLEW_EXT_fog_coord GLEW_GET_VAR(__GLEW_EXT_fog_coord) + +#endif /* GL_EXT_fog_coord */ + +/* ------------------------ GL_EXT_fragment_lighting ----------------------- */ + +#ifndef GL_EXT_fragment_lighting +#define GL_EXT_fragment_lighting 1 + +#define GL_FRAGMENT_LIGHTING_EXT 0x8400 +#define GL_FRAGMENT_COLOR_MATERIAL_EXT 0x8401 +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_EXT 0x8402 +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_EXT 0x8403 +#define GL_MAX_FRAGMENT_LIGHTS_EXT 0x8404 +#define GL_MAX_ACTIVE_LIGHTS_EXT 0x8405 +#define GL_CURRENT_RASTER_NORMAL_EXT 0x8406 +#define GL_LIGHT_ENV_MODE_EXT 0x8407 +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_EXT 0x8408 +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_EXT 0x8409 +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_EXT 0x840A +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_EXT 0x840B +#define GL_FRAGMENT_LIGHT0_EXT 0x840C +#define GL_FRAGMENT_LIGHT7_EXT 0x8413 + +typedef void (GLAPIENTRY * PFNGLFRAGMENTCOLORMATERIALEXTPROC) (GLenum face, GLenum mode); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFEXTPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFVEXTPROC) (GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIEXTPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIVEXTPROC) (GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFEXTPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFVEXTPROC) (GLenum light, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIEXTPROC) (GLenum light, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIVEXTPROC) (GLenum light, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFEXTPROC) (GLenum face, GLenum pname, const GLfloat param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFVEXTPROC) (GLenum face, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIEXTPROC) (GLenum face, GLenum pname, const GLint param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIVEXTPROC) (GLenum face, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTFVEXTPROC) (GLenum light, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTIVEXTPROC) (GLenum light, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVEXTPROC) (GLenum face, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVEXTPROC) (GLenum face, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLLIGHTENVIEXTPROC) (GLenum pname, GLint param); + +#define glFragmentColorMaterialEXT GLEW_GET_FUN(__glewFragmentColorMaterialEXT) +#define glFragmentLightModelfEXT GLEW_GET_FUN(__glewFragmentLightModelfEXT) +#define glFragmentLightModelfvEXT GLEW_GET_FUN(__glewFragmentLightModelfvEXT) +#define glFragmentLightModeliEXT GLEW_GET_FUN(__glewFragmentLightModeliEXT) +#define glFragmentLightModelivEXT GLEW_GET_FUN(__glewFragmentLightModelivEXT) +#define glFragmentLightfEXT GLEW_GET_FUN(__glewFragmentLightfEXT) +#define glFragmentLightfvEXT GLEW_GET_FUN(__glewFragmentLightfvEXT) +#define glFragmentLightiEXT GLEW_GET_FUN(__glewFragmentLightiEXT) +#define glFragmentLightivEXT GLEW_GET_FUN(__glewFragmentLightivEXT) +#define glFragmentMaterialfEXT GLEW_GET_FUN(__glewFragmentMaterialfEXT) +#define glFragmentMaterialfvEXT GLEW_GET_FUN(__glewFragmentMaterialfvEXT) +#define glFragmentMaterialiEXT GLEW_GET_FUN(__glewFragmentMaterialiEXT) +#define glFragmentMaterialivEXT GLEW_GET_FUN(__glewFragmentMaterialivEXT) +#define glGetFragmentLightfvEXT GLEW_GET_FUN(__glewGetFragmentLightfvEXT) +#define glGetFragmentLightivEXT GLEW_GET_FUN(__glewGetFragmentLightivEXT) +#define glGetFragmentMaterialfvEXT GLEW_GET_FUN(__glewGetFragmentMaterialfvEXT) +#define glGetFragmentMaterialivEXT GLEW_GET_FUN(__glewGetFragmentMaterialivEXT) +#define glLightEnviEXT GLEW_GET_FUN(__glewLightEnviEXT) + +#define GLEW_EXT_fragment_lighting GLEW_GET_VAR(__GLEW_EXT_fragment_lighting) + +#endif /* GL_EXT_fragment_lighting */ + +/* ------------------------ GL_EXT_framebuffer_blit ------------------------ */ + +#ifndef GL_EXT_framebuffer_blit +#define GL_EXT_framebuffer_blit 1 + +#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_READ_FRAMEBUFFER_EXT 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 +#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA + +typedef void (GLAPIENTRY * PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); + +#define glBlitFramebufferEXT GLEW_GET_FUN(__glewBlitFramebufferEXT) + +#define GLEW_EXT_framebuffer_blit GLEW_GET_VAR(__GLEW_EXT_framebuffer_blit) + +#endif /* GL_EXT_framebuffer_blit */ + +/* --------------------- GL_EXT_framebuffer_multisample -------------------- */ + +#ifndef GL_EXT_framebuffer_multisample +#define GL_EXT_framebuffer_multisample 1 + +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_MAX_SAMPLES_EXT 0x8D57 + +typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); + +#define glRenderbufferStorageMultisampleEXT GLEW_GET_FUN(__glewRenderbufferStorageMultisampleEXT) + +#define GLEW_EXT_framebuffer_multisample GLEW_GET_VAR(__GLEW_EXT_framebuffer_multisample) + +#endif /* GL_EXT_framebuffer_multisample */ + +/* --------------- GL_EXT_framebuffer_multisample_blit_scaled -------------- */ + +#ifndef GL_EXT_framebuffer_multisample_blit_scaled +#define GL_EXT_framebuffer_multisample_blit_scaled 1 + +#define GL_SCALED_RESOLVE_FASTEST_EXT 0x90BA +#define GL_SCALED_RESOLVE_NICEST_EXT 0x90BB + +#define GLEW_EXT_framebuffer_multisample_blit_scaled GLEW_GET_VAR(__GLEW_EXT_framebuffer_multisample_blit_scaled) + +#endif /* GL_EXT_framebuffer_multisample_blit_scaled */ + +/* ----------------------- GL_EXT_framebuffer_object ----------------------- */ + +#ifndef GL_EXT_framebuffer_object +#define GL_EXT_framebuffer_object 1 + +#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 +#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 +#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 +#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 +#define GL_FRAMEBUFFER_EXT 0x8D40 +#define GL_RENDERBUFFER_EXT 0x8D41 +#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 +#define GL_STENCIL_INDEX1_EXT 0x8D46 +#define GL_STENCIL_INDEX4_EXT 0x8D47 +#define GL_STENCIL_INDEX8_EXT 0x8D48 +#define GL_STENCIL_INDEX16_EXT 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 + +typedef void (GLAPIENTRY * PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); +typedef void (GLAPIENTRY * PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); +typedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint* framebuffers); +typedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint* renderbuffers); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (GLAPIENTRY * PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint* framebuffers); +typedef void (GLAPIENTRY * PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint* renderbuffers); +typedef void (GLAPIENTRY * PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); +typedef GLboolean (GLAPIENTRY * PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); +typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); + +#define glBindFramebufferEXT GLEW_GET_FUN(__glewBindFramebufferEXT) +#define glBindRenderbufferEXT GLEW_GET_FUN(__glewBindRenderbufferEXT) +#define glCheckFramebufferStatusEXT GLEW_GET_FUN(__glewCheckFramebufferStatusEXT) +#define glDeleteFramebuffersEXT GLEW_GET_FUN(__glewDeleteFramebuffersEXT) +#define glDeleteRenderbuffersEXT GLEW_GET_FUN(__glewDeleteRenderbuffersEXT) +#define glFramebufferRenderbufferEXT GLEW_GET_FUN(__glewFramebufferRenderbufferEXT) +#define glFramebufferTexture1DEXT GLEW_GET_FUN(__glewFramebufferTexture1DEXT) +#define glFramebufferTexture2DEXT GLEW_GET_FUN(__glewFramebufferTexture2DEXT) +#define glFramebufferTexture3DEXT GLEW_GET_FUN(__glewFramebufferTexture3DEXT) +#define glGenFramebuffersEXT GLEW_GET_FUN(__glewGenFramebuffersEXT) +#define glGenRenderbuffersEXT GLEW_GET_FUN(__glewGenRenderbuffersEXT) +#define glGenerateMipmapEXT GLEW_GET_FUN(__glewGenerateMipmapEXT) +#define glGetFramebufferAttachmentParameterivEXT GLEW_GET_FUN(__glewGetFramebufferAttachmentParameterivEXT) +#define glGetRenderbufferParameterivEXT GLEW_GET_FUN(__glewGetRenderbufferParameterivEXT) +#define glIsFramebufferEXT GLEW_GET_FUN(__glewIsFramebufferEXT) +#define glIsRenderbufferEXT GLEW_GET_FUN(__glewIsRenderbufferEXT) +#define glRenderbufferStorageEXT GLEW_GET_FUN(__glewRenderbufferStorageEXT) + +#define GLEW_EXT_framebuffer_object GLEW_GET_VAR(__GLEW_EXT_framebuffer_object) + +#endif /* GL_EXT_framebuffer_object */ + +/* ------------------------ GL_EXT_framebuffer_sRGB ------------------------ */ + +#ifndef GL_EXT_framebuffer_sRGB +#define GL_EXT_framebuffer_sRGB 1 + +#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 +#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA + +#define GLEW_EXT_framebuffer_sRGB GLEW_GET_VAR(__GLEW_EXT_framebuffer_sRGB) + +#endif /* GL_EXT_framebuffer_sRGB */ + +/* ------------------------ GL_EXT_geometry_shader4 ------------------------ */ + +#ifndef GL_EXT_geometry_shader4 +#define GL_EXT_geometry_shader4 1 + +#define GL_LINES_ADJACENCY_EXT 0xA +#define GL_LINE_STRIP_ADJACENCY_EXT 0xB +#define GL_TRIANGLES_ADJACENCY_EXT 0xC +#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0xD +#define GL_PROGRAM_POINT_SIZE_EXT 0x8642 +#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 +#define GL_GEOMETRY_SHADER_EXT 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA +#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB +#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC +#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD +#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 + +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); + +#define glFramebufferTextureEXT GLEW_GET_FUN(__glewFramebufferTextureEXT) +#define glFramebufferTextureFaceEXT GLEW_GET_FUN(__glewFramebufferTextureFaceEXT) +#define glProgramParameteriEXT GLEW_GET_FUN(__glewProgramParameteriEXT) + +#define GLEW_EXT_geometry_shader4 GLEW_GET_VAR(__GLEW_EXT_geometry_shader4) + +#endif /* GL_EXT_geometry_shader4 */ + +/* --------------------- GL_EXT_gpu_program_parameters --------------------- */ + +#ifndef GL_EXT_gpu_program_parameters +#define GL_EXT_gpu_program_parameters 1 + +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat* params); + +#define glProgramEnvParameters4fvEXT GLEW_GET_FUN(__glewProgramEnvParameters4fvEXT) +#define glProgramLocalParameters4fvEXT GLEW_GET_FUN(__glewProgramLocalParameters4fvEXT) + +#define GLEW_EXT_gpu_program_parameters GLEW_GET_VAR(__GLEW_EXT_gpu_program_parameters) + +#endif /* GL_EXT_gpu_program_parameters */ + +/* --------------------------- GL_EXT_gpu_shader4 -------------------------- */ + +#ifndef GL_EXT_gpu_shader4 +#define GL_EXT_gpu_shader4 1 + +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD +#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 +#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 +#define GL_SAMPLER_BUFFER_EXT 0x8DC2 +#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 +#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5 +#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6 +#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7 +#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8 +#define GL_INT_SAMPLER_1D_EXT 0x8DC9 +#define GL_INT_SAMPLER_2D_EXT 0x8DCA +#define GL_INT_SAMPLER_3D_EXT 0x8DCB +#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC +#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD +#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE +#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF +#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 + +typedef void (GLAPIENTRY * PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (GLAPIENTRY * PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name); +typedef void (GLAPIENTRY * PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params); +typedef void (GLAPIENTRY * PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0); +typedef void (GLAPIENTRY * PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1); +typedef void (GLAPIENTRY * PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (GLAPIENTRY * PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (GLAPIENTRY * PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); + +#define glBindFragDataLocationEXT GLEW_GET_FUN(__glewBindFragDataLocationEXT) +#define glGetFragDataLocationEXT GLEW_GET_FUN(__glewGetFragDataLocationEXT) +#define glGetUniformuivEXT GLEW_GET_FUN(__glewGetUniformuivEXT) +#define glGetVertexAttribIivEXT GLEW_GET_FUN(__glewGetVertexAttribIivEXT) +#define glGetVertexAttribIuivEXT GLEW_GET_FUN(__glewGetVertexAttribIuivEXT) +#define glUniform1uiEXT GLEW_GET_FUN(__glewUniform1uiEXT) +#define glUniform1uivEXT GLEW_GET_FUN(__glewUniform1uivEXT) +#define glUniform2uiEXT GLEW_GET_FUN(__glewUniform2uiEXT) +#define glUniform2uivEXT GLEW_GET_FUN(__glewUniform2uivEXT) +#define glUniform3uiEXT GLEW_GET_FUN(__glewUniform3uiEXT) +#define glUniform3uivEXT GLEW_GET_FUN(__glewUniform3uivEXT) +#define glUniform4uiEXT GLEW_GET_FUN(__glewUniform4uiEXT) +#define glUniform4uivEXT GLEW_GET_FUN(__glewUniform4uivEXT) +#define glVertexAttribI1iEXT GLEW_GET_FUN(__glewVertexAttribI1iEXT) +#define glVertexAttribI1ivEXT GLEW_GET_FUN(__glewVertexAttribI1ivEXT) +#define glVertexAttribI1uiEXT GLEW_GET_FUN(__glewVertexAttribI1uiEXT) +#define glVertexAttribI1uivEXT GLEW_GET_FUN(__glewVertexAttribI1uivEXT) +#define glVertexAttribI2iEXT GLEW_GET_FUN(__glewVertexAttribI2iEXT) +#define glVertexAttribI2ivEXT GLEW_GET_FUN(__glewVertexAttribI2ivEXT) +#define glVertexAttribI2uiEXT GLEW_GET_FUN(__glewVertexAttribI2uiEXT) +#define glVertexAttribI2uivEXT GLEW_GET_FUN(__glewVertexAttribI2uivEXT) +#define glVertexAttribI3iEXT GLEW_GET_FUN(__glewVertexAttribI3iEXT) +#define glVertexAttribI3ivEXT GLEW_GET_FUN(__glewVertexAttribI3ivEXT) +#define glVertexAttribI3uiEXT GLEW_GET_FUN(__glewVertexAttribI3uiEXT) +#define glVertexAttribI3uivEXT GLEW_GET_FUN(__glewVertexAttribI3uivEXT) +#define glVertexAttribI4bvEXT GLEW_GET_FUN(__glewVertexAttribI4bvEXT) +#define glVertexAttribI4iEXT GLEW_GET_FUN(__glewVertexAttribI4iEXT) +#define glVertexAttribI4ivEXT GLEW_GET_FUN(__glewVertexAttribI4ivEXT) +#define glVertexAttribI4svEXT GLEW_GET_FUN(__glewVertexAttribI4svEXT) +#define glVertexAttribI4ubvEXT GLEW_GET_FUN(__glewVertexAttribI4ubvEXT) +#define glVertexAttribI4uiEXT GLEW_GET_FUN(__glewVertexAttribI4uiEXT) +#define glVertexAttribI4uivEXT GLEW_GET_FUN(__glewVertexAttribI4uivEXT) +#define glVertexAttribI4usvEXT GLEW_GET_FUN(__glewVertexAttribI4usvEXT) +#define glVertexAttribIPointerEXT GLEW_GET_FUN(__glewVertexAttribIPointerEXT) + +#define GLEW_EXT_gpu_shader4 GLEW_GET_VAR(__GLEW_EXT_gpu_shader4) + +#endif /* GL_EXT_gpu_shader4 */ + +/* ---------------------------- GL_EXT_histogram --------------------------- */ + +#ifndef GL_EXT_histogram +#define GL_EXT_histogram 1 + +#define GL_HISTOGRAM_EXT 0x8024 +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#define GL_HISTOGRAM_SINK_EXT 0x802D +#define GL_MINMAX_EXT 0x802E +#define GL_MINMAX_FORMAT_EXT 0x802F +#define GL_MINMAX_SINK_EXT 0x8030 + +typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (GLAPIENTRY * PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (GLAPIENTRY * PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLRESETMINMAXEXTPROC) (GLenum target); + +#define glGetHistogramEXT GLEW_GET_FUN(__glewGetHistogramEXT) +#define glGetHistogramParameterfvEXT GLEW_GET_FUN(__glewGetHistogramParameterfvEXT) +#define glGetHistogramParameterivEXT GLEW_GET_FUN(__glewGetHistogramParameterivEXT) +#define glGetMinmaxEXT GLEW_GET_FUN(__glewGetMinmaxEXT) +#define glGetMinmaxParameterfvEXT GLEW_GET_FUN(__glewGetMinmaxParameterfvEXT) +#define glGetMinmaxParameterivEXT GLEW_GET_FUN(__glewGetMinmaxParameterivEXT) +#define glHistogramEXT GLEW_GET_FUN(__glewHistogramEXT) +#define glMinmaxEXT GLEW_GET_FUN(__glewMinmaxEXT) +#define glResetHistogramEXT GLEW_GET_FUN(__glewResetHistogramEXT) +#define glResetMinmaxEXT GLEW_GET_FUN(__glewResetMinmaxEXT) + +#define GLEW_EXT_histogram GLEW_GET_VAR(__GLEW_EXT_histogram) + +#endif /* GL_EXT_histogram */ + +/* ----------------------- GL_EXT_index_array_formats ---------------------- */ + +#ifndef GL_EXT_index_array_formats +#define GL_EXT_index_array_formats 1 + +#define GLEW_EXT_index_array_formats GLEW_GET_VAR(__GLEW_EXT_index_array_formats) + +#endif /* GL_EXT_index_array_formats */ + +/* --------------------------- GL_EXT_index_func --------------------------- */ + +#ifndef GL_EXT_index_func +#define GL_EXT_index_func 1 + +typedef void (GLAPIENTRY * PFNGLINDEXFUNCEXTPROC) (GLenum func, GLfloat ref); + +#define glIndexFuncEXT GLEW_GET_FUN(__glewIndexFuncEXT) + +#define GLEW_EXT_index_func GLEW_GET_VAR(__GLEW_EXT_index_func) + +#endif /* GL_EXT_index_func */ + +/* ------------------------- GL_EXT_index_material ------------------------- */ + +#ifndef GL_EXT_index_material +#define GL_EXT_index_material 1 + +typedef void (GLAPIENTRY * PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); + +#define glIndexMaterialEXT GLEW_GET_FUN(__glewIndexMaterialEXT) + +#define GLEW_EXT_index_material GLEW_GET_VAR(__GLEW_EXT_index_material) + +#endif /* GL_EXT_index_material */ + +/* -------------------------- GL_EXT_index_texture ------------------------- */ + +#ifndef GL_EXT_index_texture +#define GL_EXT_index_texture 1 + +#define GLEW_EXT_index_texture GLEW_GET_VAR(__GLEW_EXT_index_texture) + +#endif /* GL_EXT_index_texture */ + +/* -------------------------- GL_EXT_light_texture ------------------------- */ + +#ifndef GL_EXT_light_texture +#define GL_EXT_light_texture 1 + +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#define GL_FRAGMENT_COLOR_EXT 0x834C +#define GL_ATTENUATION_EXT 0x834D +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 + +typedef void (GLAPIENTRY * PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); +typedef void (GLAPIENTRY * PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); +typedef void (GLAPIENTRY * PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); + +#define glApplyTextureEXT GLEW_GET_FUN(__glewApplyTextureEXT) +#define glTextureLightEXT GLEW_GET_FUN(__glewTextureLightEXT) +#define glTextureMaterialEXT GLEW_GET_FUN(__glewTextureMaterialEXT) + +#define GLEW_EXT_light_texture GLEW_GET_VAR(__GLEW_EXT_light_texture) + +#endif /* GL_EXT_light_texture */ + +/* ------------------------- GL_EXT_misc_attribute ------------------------- */ + +#ifndef GL_EXT_misc_attribute +#define GL_EXT_misc_attribute 1 + +#define GLEW_EXT_misc_attribute GLEW_GET_VAR(__GLEW_EXT_misc_attribute) + +#endif /* GL_EXT_misc_attribute */ + +/* ------------------------ GL_EXT_multi_draw_arrays ----------------------- */ + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 + +typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint* first, const GLsizei *count, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, GLsizei* count, GLenum type, const void *const *indices, GLsizei primcount); + +#define glMultiDrawArraysEXT GLEW_GET_FUN(__glewMultiDrawArraysEXT) +#define glMultiDrawElementsEXT GLEW_GET_FUN(__glewMultiDrawElementsEXT) + +#define GLEW_EXT_multi_draw_arrays GLEW_GET_VAR(__GLEW_EXT_multi_draw_arrays) + +#endif /* GL_EXT_multi_draw_arrays */ + +/* --------------------------- GL_EXT_multisample -------------------------- */ + +#ifndef GL_EXT_multisample +#define GL_EXT_multisample 1 + +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#define GL_SAMPLE_MASK_EXT 0x80A0 +#define GL_1PASS_EXT 0x80A1 +#define GL_2PASS_0_EXT 0x80A2 +#define GL_2PASS_1_EXT 0x80A3 +#define GL_4PASS_0_EXT 0x80A4 +#define GL_4PASS_1_EXT 0x80A5 +#define GL_4PASS_2_EXT 0x80A6 +#define GL_4PASS_3_EXT 0x80A7 +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#define GL_SAMPLES_EXT 0x80A9 +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 + +typedef void (GLAPIENTRY * PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); +typedef void (GLAPIENTRY * PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); + +#define glSampleMaskEXT GLEW_GET_FUN(__glewSampleMaskEXT) +#define glSamplePatternEXT GLEW_GET_FUN(__glewSamplePatternEXT) + +#define GLEW_EXT_multisample GLEW_GET_VAR(__GLEW_EXT_multisample) + +#endif /* GL_EXT_multisample */ + +/* ---------------------- GL_EXT_packed_depth_stencil ---------------------- */ + +#ifndef GL_EXT_packed_depth_stencil +#define GL_EXT_packed_depth_stencil 1 + +#define GL_DEPTH_STENCIL_EXT 0x84F9 +#define GL_UNSIGNED_INT_24_8_EXT 0x84FA +#define GL_DEPTH24_STENCIL8_EXT 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 + +#define GLEW_EXT_packed_depth_stencil GLEW_GET_VAR(__GLEW_EXT_packed_depth_stencil) + +#endif /* GL_EXT_packed_depth_stencil */ + +/* -------------------------- GL_EXT_packed_float -------------------------- */ + +#ifndef GL_EXT_packed_float +#define GL_EXT_packed_float 1 + +#define GL_R11F_G11F_B10F_EXT 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B +#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C + +#define GLEW_EXT_packed_float GLEW_GET_VAR(__GLEW_EXT_packed_float) + +#endif /* GL_EXT_packed_float */ + +/* -------------------------- GL_EXT_packed_pixels ------------------------- */ + +#ifndef GL_EXT_packed_pixels +#define GL_EXT_packed_pixels 1 + +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 + +#define GLEW_EXT_packed_pixels GLEW_GET_VAR(__GLEW_EXT_packed_pixels) + +#endif /* GL_EXT_packed_pixels */ + +/* ------------------------ GL_EXT_paletted_texture ------------------------ */ + +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 + +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8 +#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B + +typedef void (GLAPIENTRY * PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void *data); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, void *data); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); + +#define glColorTableEXT GLEW_GET_FUN(__glewColorTableEXT) +#define glGetColorTableEXT GLEW_GET_FUN(__glewGetColorTableEXT) +#define glGetColorTableParameterfvEXT GLEW_GET_FUN(__glewGetColorTableParameterfvEXT) +#define glGetColorTableParameterivEXT GLEW_GET_FUN(__glewGetColorTableParameterivEXT) + +#define GLEW_EXT_paletted_texture GLEW_GET_VAR(__GLEW_EXT_paletted_texture) + +#endif /* GL_EXT_paletted_texture */ + +/* ----------------------- GL_EXT_pixel_buffer_object ---------------------- */ + +#ifndef GL_EXT_pixel_buffer_object +#define GL_EXT_pixel_buffer_object 1 + +#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF + +#define GLEW_EXT_pixel_buffer_object GLEW_GET_VAR(__GLEW_EXT_pixel_buffer_object) + +#endif /* GL_EXT_pixel_buffer_object */ + +/* ------------------------- GL_EXT_pixel_transform ------------------------ */ + +#ifndef GL_EXT_pixel_transform +#define GL_EXT_pixel_transform 1 + +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#define GL_CUBIC_EXT 0x8334 +#define GL_AVERAGE_EXT 0x8335 +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 + +typedef void (GLAPIENTRY * PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, const GLfloat param); +typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, const GLint param); +typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params); + +#define glGetPixelTransformParameterfvEXT GLEW_GET_FUN(__glewGetPixelTransformParameterfvEXT) +#define glGetPixelTransformParameterivEXT GLEW_GET_FUN(__glewGetPixelTransformParameterivEXT) +#define glPixelTransformParameterfEXT GLEW_GET_FUN(__glewPixelTransformParameterfEXT) +#define glPixelTransformParameterfvEXT GLEW_GET_FUN(__glewPixelTransformParameterfvEXT) +#define glPixelTransformParameteriEXT GLEW_GET_FUN(__glewPixelTransformParameteriEXT) +#define glPixelTransformParameterivEXT GLEW_GET_FUN(__glewPixelTransformParameterivEXT) + +#define GLEW_EXT_pixel_transform GLEW_GET_VAR(__GLEW_EXT_pixel_transform) + +#endif /* GL_EXT_pixel_transform */ + +/* ------------------- GL_EXT_pixel_transform_color_table ------------------ */ + +#ifndef GL_EXT_pixel_transform_color_table +#define GL_EXT_pixel_transform_color_table 1 + +#define GLEW_EXT_pixel_transform_color_table GLEW_GET_VAR(__GLEW_EXT_pixel_transform_color_table) + +#endif /* GL_EXT_pixel_transform_color_table */ + +/* ------------------------ GL_EXT_point_parameters ------------------------ */ + +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 + +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 + +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat* params); + +#define glPointParameterfEXT GLEW_GET_FUN(__glewPointParameterfEXT) +#define glPointParameterfvEXT GLEW_GET_FUN(__glewPointParameterfvEXT) + +#define GLEW_EXT_point_parameters GLEW_GET_VAR(__GLEW_EXT_point_parameters) + +#endif /* GL_EXT_point_parameters */ + +/* ------------------------- GL_EXT_polygon_offset ------------------------- */ + +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 + +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 + +typedef void (GLAPIENTRY * PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); + +#define glPolygonOffsetEXT GLEW_GET_FUN(__glewPolygonOffsetEXT) + +#define GLEW_EXT_polygon_offset GLEW_GET_VAR(__GLEW_EXT_polygon_offset) + +#endif /* GL_EXT_polygon_offset */ + +/* ---------------------- GL_EXT_polygon_offset_clamp ---------------------- */ + +#ifndef GL_EXT_polygon_offset_clamp +#define GL_EXT_polygon_offset_clamp 1 + +#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B + +typedef void (GLAPIENTRY * PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp); + +#define glPolygonOffsetClampEXT GLEW_GET_FUN(__glewPolygonOffsetClampEXT) + +#define GLEW_EXT_polygon_offset_clamp GLEW_GET_VAR(__GLEW_EXT_polygon_offset_clamp) + +#endif /* GL_EXT_polygon_offset_clamp */ + +/* ----------------------- GL_EXT_post_depth_coverage ---------------------- */ + +#ifndef GL_EXT_post_depth_coverage +#define GL_EXT_post_depth_coverage 1 + +#define GLEW_EXT_post_depth_coverage GLEW_GET_VAR(__GLEW_EXT_post_depth_coverage) + +#endif /* GL_EXT_post_depth_coverage */ + +/* ------------------------ GL_EXT_provoking_vertex ------------------------ */ + +#ifndef GL_EXT_provoking_vertex +#define GL_EXT_provoking_vertex 1 + +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C +#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E +#define GL_PROVOKING_VERTEX_EXT 0x8E4F + +typedef void (GLAPIENTRY * PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode); + +#define glProvokingVertexEXT GLEW_GET_FUN(__glewProvokingVertexEXT) + +#define GLEW_EXT_provoking_vertex GLEW_GET_VAR(__GLEW_EXT_provoking_vertex) + +#endif /* GL_EXT_provoking_vertex */ + +/* ----------------------- GL_EXT_raster_multisample ----------------------- */ + +#ifndef GL_EXT_raster_multisample +#define GL_EXT_raster_multisample 1 + +#define GL_COLOR_SAMPLES_NV 0x8E20 +#define GL_RASTER_MULTISAMPLE_EXT 0x9327 +#define GL_RASTER_SAMPLES_EXT 0x9328 +#define GL_MAX_RASTER_SAMPLES_EXT 0x9329 +#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A +#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B +#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C +#define GL_DEPTH_SAMPLES_NV 0x932D +#define GL_STENCIL_SAMPLES_NV 0x932E +#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F +#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330 +#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331 +#define GL_COVERAGE_MODULATION_NV 0x9332 +#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 + +typedef void (GLAPIENTRY * PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components); +typedef void (GLAPIENTRY * PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat* v); +typedef void (GLAPIENTRY * PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations); + +#define glCoverageModulationNV GLEW_GET_FUN(__glewCoverageModulationNV) +#define glCoverageModulationTableNV GLEW_GET_FUN(__glewCoverageModulationTableNV) +#define glGetCoverageModulationTableNV GLEW_GET_FUN(__glewGetCoverageModulationTableNV) +#define glRasterSamplesEXT GLEW_GET_FUN(__glewRasterSamplesEXT) + +#define GLEW_EXT_raster_multisample GLEW_GET_VAR(__GLEW_EXT_raster_multisample) + +#endif /* GL_EXT_raster_multisample */ + +/* ------------------------- GL_EXT_rescale_normal ------------------------- */ + +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 + +#define GL_RESCALE_NORMAL_EXT 0x803A + +#define GLEW_EXT_rescale_normal GLEW_GET_VAR(__GLEW_EXT_rescale_normal) + +#endif /* GL_EXT_rescale_normal */ + +/* -------------------------- GL_EXT_scene_marker -------------------------- */ + +#ifndef GL_EXT_scene_marker +#define GL_EXT_scene_marker 1 + +typedef void (GLAPIENTRY * PFNGLBEGINSCENEEXTPROC) (void); +typedef void (GLAPIENTRY * PFNGLENDSCENEEXTPROC) (void); + +#define glBeginSceneEXT GLEW_GET_FUN(__glewBeginSceneEXT) +#define glEndSceneEXT GLEW_GET_FUN(__glewEndSceneEXT) + +#define GLEW_EXT_scene_marker GLEW_GET_VAR(__GLEW_EXT_scene_marker) + +#endif /* GL_EXT_scene_marker */ + +/* ------------------------- GL_EXT_secondary_color ------------------------ */ + +#ifndef GL_EXT_secondary_color +#define GL_EXT_secondary_color 1 + +#define GL_COLOR_SUM_EXT 0x8458 +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E + +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); + +#define glSecondaryColor3bEXT GLEW_GET_FUN(__glewSecondaryColor3bEXT) +#define glSecondaryColor3bvEXT GLEW_GET_FUN(__glewSecondaryColor3bvEXT) +#define glSecondaryColor3dEXT GLEW_GET_FUN(__glewSecondaryColor3dEXT) +#define glSecondaryColor3dvEXT GLEW_GET_FUN(__glewSecondaryColor3dvEXT) +#define glSecondaryColor3fEXT GLEW_GET_FUN(__glewSecondaryColor3fEXT) +#define glSecondaryColor3fvEXT GLEW_GET_FUN(__glewSecondaryColor3fvEXT) +#define glSecondaryColor3iEXT GLEW_GET_FUN(__glewSecondaryColor3iEXT) +#define glSecondaryColor3ivEXT GLEW_GET_FUN(__glewSecondaryColor3ivEXT) +#define glSecondaryColor3sEXT GLEW_GET_FUN(__glewSecondaryColor3sEXT) +#define glSecondaryColor3svEXT GLEW_GET_FUN(__glewSecondaryColor3svEXT) +#define glSecondaryColor3ubEXT GLEW_GET_FUN(__glewSecondaryColor3ubEXT) +#define glSecondaryColor3ubvEXT GLEW_GET_FUN(__glewSecondaryColor3ubvEXT) +#define glSecondaryColor3uiEXT GLEW_GET_FUN(__glewSecondaryColor3uiEXT) +#define glSecondaryColor3uivEXT GLEW_GET_FUN(__glewSecondaryColor3uivEXT) +#define glSecondaryColor3usEXT GLEW_GET_FUN(__glewSecondaryColor3usEXT) +#define glSecondaryColor3usvEXT GLEW_GET_FUN(__glewSecondaryColor3usvEXT) +#define glSecondaryColorPointerEXT GLEW_GET_FUN(__glewSecondaryColorPointerEXT) + +#define GLEW_EXT_secondary_color GLEW_GET_VAR(__GLEW_EXT_secondary_color) + +#endif /* GL_EXT_secondary_color */ + +/* --------------------- GL_EXT_separate_shader_objects -------------------- */ + +#ifndef GL_EXT_separate_shader_objects +#define GL_EXT_separate_shader_objects 1 + +#define GL_ACTIVE_PROGRAM_EXT 0x8B8D + +typedef void (GLAPIENTRY * PFNGLACTIVEPROGRAMEXTPROC) (GLuint program); +typedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar* string); +typedef void (GLAPIENTRY * PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program); + +#define glActiveProgramEXT GLEW_GET_FUN(__glewActiveProgramEXT) +#define glCreateShaderProgramEXT GLEW_GET_FUN(__glewCreateShaderProgramEXT) +#define glUseShaderProgramEXT GLEW_GET_FUN(__glewUseShaderProgramEXT) + +#define GLEW_EXT_separate_shader_objects GLEW_GET_VAR(__GLEW_EXT_separate_shader_objects) + +#endif /* GL_EXT_separate_shader_objects */ + +/* --------------------- GL_EXT_separate_specular_color -------------------- */ + +#ifndef GL_EXT_separate_specular_color +#define GL_EXT_separate_specular_color 1 + +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA + +#define GLEW_EXT_separate_specular_color GLEW_GET_VAR(__GLEW_EXT_separate_specular_color) + +#endif /* GL_EXT_separate_specular_color */ + +/* ------------------- GL_EXT_shader_image_load_formatted ------------------ */ + +#ifndef GL_EXT_shader_image_load_formatted +#define GL_EXT_shader_image_load_formatted 1 + +#define GLEW_EXT_shader_image_load_formatted GLEW_GET_VAR(__GLEW_EXT_shader_image_load_formatted) + +#endif /* GL_EXT_shader_image_load_formatted */ + +/* --------------------- GL_EXT_shader_image_load_store -------------------- */ + +#ifndef GL_EXT_shader_image_load_store +#define GL_EXT_shader_image_load_store 1 + +#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001 +#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002 +#define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004 +#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008 +#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020 +#define GL_COMMAND_BARRIER_BIT_EXT 0x00000040 +#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080 +#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100 +#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200 +#define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400 +#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800 +#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000 +#define GL_MAX_IMAGE_UNITS_EXT 0x8F38 +#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39 +#define GL_IMAGE_BINDING_NAME_EXT 0x8F3A +#define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B +#define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C +#define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D +#define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E +#define GL_IMAGE_1D_EXT 0x904C +#define GL_IMAGE_2D_EXT 0x904D +#define GL_IMAGE_3D_EXT 0x904E +#define GL_IMAGE_2D_RECT_EXT 0x904F +#define GL_IMAGE_CUBE_EXT 0x9050 +#define GL_IMAGE_BUFFER_EXT 0x9051 +#define GL_IMAGE_1D_ARRAY_EXT 0x9052 +#define GL_IMAGE_2D_ARRAY_EXT 0x9053 +#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 +#define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055 +#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056 +#define GL_INT_IMAGE_1D_EXT 0x9057 +#define GL_INT_IMAGE_2D_EXT 0x9058 +#define GL_INT_IMAGE_3D_EXT 0x9059 +#define GL_INT_IMAGE_2D_RECT_EXT 0x905A +#define GL_INT_IMAGE_CUBE_EXT 0x905B +#define GL_INT_IMAGE_BUFFER_EXT 0x905C +#define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D +#define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F +#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060 +#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061 +#define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062 +#define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063 +#define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064 +#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065 +#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066 +#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 +#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068 +#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069 +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C +#define GL_MAX_IMAGE_SAMPLES_EXT 0x906D +#define GL_IMAGE_BINDING_FORMAT_EXT 0x906E +#define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF + +typedef void (GLAPIENTRY * PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format); +typedef void (GLAPIENTRY * PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers); + +#define glBindImageTextureEXT GLEW_GET_FUN(__glewBindImageTextureEXT) +#define glMemoryBarrierEXT GLEW_GET_FUN(__glewMemoryBarrierEXT) + +#define GLEW_EXT_shader_image_load_store GLEW_GET_VAR(__GLEW_EXT_shader_image_load_store) + +#endif /* GL_EXT_shader_image_load_store */ + +/* ----------------------- GL_EXT_shader_integer_mix ----------------------- */ + +#ifndef GL_EXT_shader_integer_mix +#define GL_EXT_shader_integer_mix 1 + +#define GLEW_EXT_shader_integer_mix GLEW_GET_VAR(__GLEW_EXT_shader_integer_mix) + +#endif /* GL_EXT_shader_integer_mix */ + +/* -------------------------- GL_EXT_shadow_funcs -------------------------- */ + +#ifndef GL_EXT_shadow_funcs +#define GL_EXT_shadow_funcs 1 + +#define GLEW_EXT_shadow_funcs GLEW_GET_VAR(__GLEW_EXT_shadow_funcs) + +#endif /* GL_EXT_shadow_funcs */ + +/* --------------------- GL_EXT_shared_texture_palette --------------------- */ + +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 + +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB + +#define GLEW_EXT_shared_texture_palette GLEW_GET_VAR(__GLEW_EXT_shared_texture_palette) + +#endif /* GL_EXT_shared_texture_palette */ + +/* ------------------------- GL_EXT_sparse_texture2 ------------------------ */ + +#ifndef GL_EXT_sparse_texture2 +#define GL_EXT_sparse_texture2 1 + +#define GLEW_EXT_sparse_texture2 GLEW_GET_VAR(__GLEW_EXT_sparse_texture2) + +#endif /* GL_EXT_sparse_texture2 */ + +/* ------------------------ GL_EXT_stencil_clear_tag ----------------------- */ + +#ifndef GL_EXT_stencil_clear_tag +#define GL_EXT_stencil_clear_tag 1 + +#define GL_STENCIL_TAG_BITS_EXT 0x88F2 +#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 + +#define GLEW_EXT_stencil_clear_tag GLEW_GET_VAR(__GLEW_EXT_stencil_clear_tag) + +#endif /* GL_EXT_stencil_clear_tag */ + +/* ------------------------ GL_EXT_stencil_two_side ------------------------ */ + +#ifndef GL_EXT_stencil_two_side +#define GL_EXT_stencil_two_side 1 + +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 + +typedef void (GLAPIENTRY * PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); + +#define glActiveStencilFaceEXT GLEW_GET_FUN(__glewActiveStencilFaceEXT) + +#define GLEW_EXT_stencil_two_side GLEW_GET_VAR(__GLEW_EXT_stencil_two_side) + +#endif /* GL_EXT_stencil_two_side */ + +/* -------------------------- GL_EXT_stencil_wrap -------------------------- */ + +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 + +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 + +#define GLEW_EXT_stencil_wrap GLEW_GET_VAR(__GLEW_EXT_stencil_wrap) + +#endif /* GL_EXT_stencil_wrap */ + +/* --------------------------- GL_EXT_subtexture --------------------------- */ + +#ifndef GL_EXT_subtexture +#define GL_EXT_subtexture 1 + +typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); + +#define glTexSubImage1DEXT GLEW_GET_FUN(__glewTexSubImage1DEXT) +#define glTexSubImage2DEXT GLEW_GET_FUN(__glewTexSubImage2DEXT) +#define glTexSubImage3DEXT GLEW_GET_FUN(__glewTexSubImage3DEXT) + +#define GLEW_EXT_subtexture GLEW_GET_VAR(__GLEW_EXT_subtexture) + +#endif /* GL_EXT_subtexture */ + +/* ----------------------------- GL_EXT_texture ---------------------------- */ + +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 + +#define GL_ALPHA4_EXT 0x803B +#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA12_EXT 0x803D +#define GL_ALPHA16_EXT 0x803E +#define GL_LUMINANCE4_EXT 0x803F +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE12_EXT 0x8041 +#define GL_LUMINANCE16_EXT 0x8042 +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#define GL_INTENSITY_EXT 0x8049 +#define GL_INTENSITY4_EXT 0x804A +#define GL_INTENSITY8_EXT 0x804B +#define GL_INTENSITY12_EXT 0x804C +#define GL_INTENSITY16_EXT 0x804D +#define GL_RGB2_EXT 0x804E +#define GL_RGB4_EXT 0x804F +#define GL_RGB5_EXT 0x8050 +#define GL_RGB8_EXT 0x8051 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB12_EXT 0x8053 +#define GL_RGB16_EXT 0x8054 +#define GL_RGBA2_EXT 0x8055 +#define GL_RGBA4_EXT 0x8056 +#define GL_RGB5_A1_EXT 0x8057 +#define GL_RGBA8_EXT 0x8058 +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGBA12_EXT 0x805A +#define GL_RGBA16_EXT 0x805B +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#define GL_REPLACE_EXT 0x8062 +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 + +#define GLEW_EXT_texture GLEW_GET_VAR(__GLEW_EXT_texture) + +#endif /* GL_EXT_texture */ + +/* ---------------------------- GL_EXT_texture3D --------------------------- */ + +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 + +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 + +typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); + +#define glTexImage3DEXT GLEW_GET_FUN(__glewTexImage3DEXT) + +#define GLEW_EXT_texture3D GLEW_GET_VAR(__GLEW_EXT_texture3D) + +#endif /* GL_EXT_texture3D */ + +/* -------------------------- GL_EXT_texture_array ------------------------- */ + +#ifndef GL_EXT_texture_array +#define GL_EXT_texture_array 1 + +#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E +#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF +#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 +#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D + +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); + +#define glFramebufferTextureLayerEXT GLEW_GET_FUN(__glewFramebufferTextureLayerEXT) + +#define GLEW_EXT_texture_array GLEW_GET_VAR(__GLEW_EXT_texture_array) + +#endif /* GL_EXT_texture_array */ + +/* ---------------------- GL_EXT_texture_buffer_object --------------------- */ + +#ifndef GL_EXT_texture_buffer_object +#define GL_EXT_texture_buffer_object 1 + +#define GL_TEXTURE_BUFFER_EXT 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E + +typedef void (GLAPIENTRY * PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); + +#define glTexBufferEXT GLEW_GET_FUN(__glewTexBufferEXT) + +#define GLEW_EXT_texture_buffer_object GLEW_GET_VAR(__GLEW_EXT_texture_buffer_object) + +#endif /* GL_EXT_texture_buffer_object */ + +/* -------------------- GL_EXT_texture_compression_dxt1 -------------------- */ + +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_EXT_texture_compression_dxt1 1 + +#define GLEW_EXT_texture_compression_dxt1 GLEW_GET_VAR(__GLEW_EXT_texture_compression_dxt1) + +#endif /* GL_EXT_texture_compression_dxt1 */ + +/* -------------------- GL_EXT_texture_compression_latc -------------------- */ + +#ifndef GL_EXT_texture_compression_latc +#define GL_EXT_texture_compression_latc 1 + +#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 +#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 +#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 +#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 + +#define GLEW_EXT_texture_compression_latc GLEW_GET_VAR(__GLEW_EXT_texture_compression_latc) + +#endif /* GL_EXT_texture_compression_latc */ + +/* -------------------- GL_EXT_texture_compression_rgtc -------------------- */ + +#ifndef GL_EXT_texture_compression_rgtc +#define GL_EXT_texture_compression_rgtc 1 + +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE + +#define GLEW_EXT_texture_compression_rgtc GLEW_GET_VAR(__GLEW_EXT_texture_compression_rgtc) + +#endif /* GL_EXT_texture_compression_rgtc */ + +/* -------------------- GL_EXT_texture_compression_s3tc -------------------- */ + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_EXT_texture_compression_s3tc 1 + +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 + +#define GLEW_EXT_texture_compression_s3tc GLEW_GET_VAR(__GLEW_EXT_texture_compression_s3tc) + +#endif /* GL_EXT_texture_compression_s3tc */ + +/* ------------------------ GL_EXT_texture_cube_map ------------------------ */ + +#ifndef GL_EXT_texture_cube_map +#define GL_EXT_texture_cube_map 1 + +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C + +#define GLEW_EXT_texture_cube_map GLEW_GET_VAR(__GLEW_EXT_texture_cube_map) + +#endif /* GL_EXT_texture_cube_map */ + +/* ----------------------- GL_EXT_texture_edge_clamp ----------------------- */ + +#ifndef GL_EXT_texture_edge_clamp +#define GL_EXT_texture_edge_clamp 1 + +#define GL_CLAMP_TO_EDGE_EXT 0x812F + +#define GLEW_EXT_texture_edge_clamp GLEW_GET_VAR(__GLEW_EXT_texture_edge_clamp) + +#endif /* GL_EXT_texture_edge_clamp */ + +/* --------------------------- GL_EXT_texture_env -------------------------- */ + +#ifndef GL_EXT_texture_env +#define GL_EXT_texture_env 1 + +#define GLEW_EXT_texture_env GLEW_GET_VAR(__GLEW_EXT_texture_env) + +#endif /* GL_EXT_texture_env */ + +/* ------------------------- GL_EXT_texture_env_add ------------------------ */ + +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 + +#define GLEW_EXT_texture_env_add GLEW_GET_VAR(__GLEW_EXT_texture_env_add) + +#endif /* GL_EXT_texture_env_add */ + +/* ----------------------- GL_EXT_texture_env_combine ---------------------- */ + +#ifndef GL_EXT_texture_env_combine +#define GL_EXT_texture_env_combine 1 + +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_CONSTANT_EXT 0x8576 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND2_ALPHA_EXT 0x859A + +#define GLEW_EXT_texture_env_combine GLEW_GET_VAR(__GLEW_EXT_texture_env_combine) + +#endif /* GL_EXT_texture_env_combine */ + +/* ------------------------ GL_EXT_texture_env_dot3 ------------------------ */ + +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 + +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 + +#define GLEW_EXT_texture_env_dot3 GLEW_GET_VAR(__GLEW_EXT_texture_env_dot3) + +#endif /* GL_EXT_texture_env_dot3 */ + +/* ------------------- GL_EXT_texture_filter_anisotropic ------------------- */ + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 + +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF + +#define GLEW_EXT_texture_filter_anisotropic GLEW_GET_VAR(__GLEW_EXT_texture_filter_anisotropic) + +#endif /* GL_EXT_texture_filter_anisotropic */ + +/* ---------------------- GL_EXT_texture_filter_minmax --------------------- */ + +#ifndef GL_EXT_texture_filter_minmax +#define GL_EXT_texture_filter_minmax 1 + +#define GL_TEXTURE_REDUCTION_MODE_EXT 0x9366 +#define GL_WEIGHTED_AVERAGE_EXT 0x9367 + +#define GLEW_EXT_texture_filter_minmax GLEW_GET_VAR(__GLEW_EXT_texture_filter_minmax) + +#endif /* GL_EXT_texture_filter_minmax */ + +/* ------------------------- GL_EXT_texture_integer ------------------------ */ + +#ifndef GL_EXT_texture_integer +#define GL_EXT_texture_integer 1 + +#define GL_RGBA32UI_EXT 0x8D70 +#define GL_RGB32UI_EXT 0x8D71 +#define GL_ALPHA32UI_EXT 0x8D72 +#define GL_INTENSITY32UI_EXT 0x8D73 +#define GL_LUMINANCE32UI_EXT 0x8D74 +#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75 +#define GL_RGBA16UI_EXT 0x8D76 +#define GL_RGB16UI_EXT 0x8D77 +#define GL_ALPHA16UI_EXT 0x8D78 +#define GL_INTENSITY16UI_EXT 0x8D79 +#define GL_LUMINANCE16UI_EXT 0x8D7A +#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B +#define GL_RGBA8UI_EXT 0x8D7C +#define GL_RGB8UI_EXT 0x8D7D +#define GL_ALPHA8UI_EXT 0x8D7E +#define GL_INTENSITY8UI_EXT 0x8D7F +#define GL_LUMINANCE8UI_EXT 0x8D80 +#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81 +#define GL_RGBA32I_EXT 0x8D82 +#define GL_RGB32I_EXT 0x8D83 +#define GL_ALPHA32I_EXT 0x8D84 +#define GL_INTENSITY32I_EXT 0x8D85 +#define GL_LUMINANCE32I_EXT 0x8D86 +#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87 +#define GL_RGBA16I_EXT 0x8D88 +#define GL_RGB16I_EXT 0x8D89 +#define GL_ALPHA16I_EXT 0x8D8A +#define GL_INTENSITY16I_EXT 0x8D8B +#define GL_LUMINANCE16I_EXT 0x8D8C +#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D +#define GL_RGBA8I_EXT 0x8D8E +#define GL_RGB8I_EXT 0x8D8F +#define GL_ALPHA8I_EXT 0x8D90 +#define GL_INTENSITY8I_EXT 0x8D91 +#define GL_LUMINANCE8I_EXT 0x8D92 +#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93 +#define GL_RED_INTEGER_EXT 0x8D94 +#define GL_GREEN_INTEGER_EXT 0x8D95 +#define GL_BLUE_INTEGER_EXT 0x8D96 +#define GL_ALPHA_INTEGER_EXT 0x8D97 +#define GL_RGB_INTEGER_EXT 0x8D98 +#define GL_RGBA_INTEGER_EXT 0x8D99 +#define GL_BGR_INTEGER_EXT 0x8D9A +#define GL_BGRA_INTEGER_EXT 0x8D9B +#define GL_LUMINANCE_INTEGER_EXT 0x8D9C +#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D +#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E + +typedef void (GLAPIENTRY * PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha); +typedef void (GLAPIENTRY * PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha); +typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); + +#define glClearColorIiEXT GLEW_GET_FUN(__glewClearColorIiEXT) +#define glClearColorIuiEXT GLEW_GET_FUN(__glewClearColorIuiEXT) +#define glGetTexParameterIivEXT GLEW_GET_FUN(__glewGetTexParameterIivEXT) +#define glGetTexParameterIuivEXT GLEW_GET_FUN(__glewGetTexParameterIuivEXT) +#define glTexParameterIivEXT GLEW_GET_FUN(__glewTexParameterIivEXT) +#define glTexParameterIuivEXT GLEW_GET_FUN(__glewTexParameterIuivEXT) + +#define GLEW_EXT_texture_integer GLEW_GET_VAR(__GLEW_EXT_texture_integer) + +#endif /* GL_EXT_texture_integer */ + +/* ------------------------ GL_EXT_texture_lod_bias ------------------------ */ + +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 + +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 + +#define GLEW_EXT_texture_lod_bias GLEW_GET_VAR(__GLEW_EXT_texture_lod_bias) + +#endif /* GL_EXT_texture_lod_bias */ + +/* ---------------------- GL_EXT_texture_mirror_clamp ---------------------- */ + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_EXT_texture_mirror_clamp 1 + +#define GL_MIRROR_CLAMP_EXT 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 +#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 + +#define GLEW_EXT_texture_mirror_clamp GLEW_GET_VAR(__GLEW_EXT_texture_mirror_clamp) + +#endif /* GL_EXT_texture_mirror_clamp */ + +/* ------------------------- GL_EXT_texture_object ------------------------- */ + +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 + +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A + +typedef GLboolean (GLAPIENTRY * PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint* textures, GLboolean* residences); +typedef void (GLAPIENTRY * PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); +typedef void (GLAPIENTRY * PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint* textures); +typedef void (GLAPIENTRY * PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint* textures); +typedef GLboolean (GLAPIENTRY * PFNGLISTEXTUREEXTPROC) (GLuint texture); +typedef void (GLAPIENTRY * PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint* textures, const GLclampf* priorities); + +#define glAreTexturesResidentEXT GLEW_GET_FUN(__glewAreTexturesResidentEXT) +#define glBindTextureEXT GLEW_GET_FUN(__glewBindTextureEXT) +#define glDeleteTexturesEXT GLEW_GET_FUN(__glewDeleteTexturesEXT) +#define glGenTexturesEXT GLEW_GET_FUN(__glewGenTexturesEXT) +#define glIsTextureEXT GLEW_GET_FUN(__glewIsTextureEXT) +#define glPrioritizeTexturesEXT GLEW_GET_FUN(__glewPrioritizeTexturesEXT) + +#define GLEW_EXT_texture_object GLEW_GET_VAR(__GLEW_EXT_texture_object) + +#endif /* GL_EXT_texture_object */ + +/* --------------------- GL_EXT_texture_perturb_normal --------------------- */ + +#ifndef GL_EXT_texture_perturb_normal +#define GL_EXT_texture_perturb_normal 1 + +#define GL_PERTURB_EXT 0x85AE +#define GL_TEXTURE_NORMAL_EXT 0x85AF + +typedef void (GLAPIENTRY * PFNGLTEXTURENORMALEXTPROC) (GLenum mode); + +#define glTextureNormalEXT GLEW_GET_FUN(__glewTextureNormalEXT) + +#define GLEW_EXT_texture_perturb_normal GLEW_GET_VAR(__GLEW_EXT_texture_perturb_normal) + +#endif /* GL_EXT_texture_perturb_normal */ + +/* ------------------------ GL_EXT_texture_rectangle ----------------------- */ + +#ifndef GL_EXT_texture_rectangle +#define GL_EXT_texture_rectangle 1 + +#define GL_TEXTURE_RECTANGLE_EXT 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_EXT 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_EXT 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT 0x84F8 + +#define GLEW_EXT_texture_rectangle GLEW_GET_VAR(__GLEW_EXT_texture_rectangle) + +#endif /* GL_EXT_texture_rectangle */ + +/* -------------------------- GL_EXT_texture_sRGB -------------------------- */ + +#ifndef GL_EXT_texture_sRGB +#define GL_EXT_texture_sRGB 1 + +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB8_EXT 0x8C41 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_SLUMINANCE_ALPHA_EXT 0x8C44 +#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45 +#define GL_SLUMINANCE_EXT 0x8C46 +#define GL_SLUMINANCE8_EXT 0x8C47 +#define GL_COMPRESSED_SRGB_EXT 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49 +#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B +#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F + +#define GLEW_EXT_texture_sRGB GLEW_GET_VAR(__GLEW_EXT_texture_sRGB) + +#endif /* GL_EXT_texture_sRGB */ + +/* ----------------------- GL_EXT_texture_sRGB_decode ---------------------- */ + +#ifndef GL_EXT_texture_sRGB_decode +#define GL_EXT_texture_sRGB_decode 1 + +#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 +#define GL_DECODE_EXT 0x8A49 +#define GL_SKIP_DECODE_EXT 0x8A4A + +#define GLEW_EXT_texture_sRGB_decode GLEW_GET_VAR(__GLEW_EXT_texture_sRGB_decode) + +#endif /* GL_EXT_texture_sRGB_decode */ + +/* --------------------- GL_EXT_texture_shared_exponent -------------------- */ + +#ifndef GL_EXT_texture_shared_exponent +#define GL_EXT_texture_shared_exponent 1 + +#define GL_RGB9_E5_EXT 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E +#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F + +#define GLEW_EXT_texture_shared_exponent GLEW_GET_VAR(__GLEW_EXT_texture_shared_exponent) + +#endif /* GL_EXT_texture_shared_exponent */ + +/* -------------------------- GL_EXT_texture_snorm ------------------------- */ + +#ifndef GL_EXT_texture_snorm +#define GL_EXT_texture_snorm 1 + +#define GL_RED_SNORM 0x8F90 +#define GL_RG_SNORM 0x8F91 +#define GL_RGB_SNORM 0x8F92 +#define GL_RGBA_SNORM 0x8F93 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGB8_SNORM 0x8F96 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM 0x8F98 +#define GL_RG16_SNORM 0x8F99 +#define GL_RGB16_SNORM 0x8F9A +#define GL_RGBA16_SNORM 0x8F9B +#define GL_SIGNED_NORMALIZED 0x8F9C +#define GL_ALPHA_SNORM 0x9010 +#define GL_LUMINANCE_SNORM 0x9011 +#define GL_LUMINANCE_ALPHA_SNORM 0x9012 +#define GL_INTENSITY_SNORM 0x9013 +#define GL_ALPHA8_SNORM 0x9014 +#define GL_LUMINANCE8_SNORM 0x9015 +#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016 +#define GL_INTENSITY8_SNORM 0x9017 +#define GL_ALPHA16_SNORM 0x9018 +#define GL_LUMINANCE16_SNORM 0x9019 +#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A +#define GL_INTENSITY16_SNORM 0x901B + +#define GLEW_EXT_texture_snorm GLEW_GET_VAR(__GLEW_EXT_texture_snorm) + +#endif /* GL_EXT_texture_snorm */ + +/* ------------------------- GL_EXT_texture_swizzle ------------------------ */ + +#ifndef GL_EXT_texture_swizzle +#define GL_EXT_texture_swizzle 1 + +#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 +#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43 +#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44 +#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45 +#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46 + +#define GLEW_EXT_texture_swizzle GLEW_GET_VAR(__GLEW_EXT_texture_swizzle) + +#endif /* GL_EXT_texture_swizzle */ + +/* --------------------------- GL_EXT_timer_query -------------------------- */ + +#ifndef GL_EXT_timer_query +#define GL_EXT_timer_query 1 + +#define GL_TIME_ELAPSED_EXT 0x88BF + +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params); + +#define glGetQueryObjecti64vEXT GLEW_GET_FUN(__glewGetQueryObjecti64vEXT) +#define glGetQueryObjectui64vEXT GLEW_GET_FUN(__glewGetQueryObjectui64vEXT) + +#define GLEW_EXT_timer_query GLEW_GET_VAR(__GLEW_EXT_timer_query) + +#endif /* GL_EXT_timer_query */ + +/* ----------------------- GL_EXT_transform_feedback ----------------------- */ + +#ifndef GL_EXT_transform_feedback +#define GL_EXT_transform_feedback 1 + +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76 +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80 +#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85 +#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88 +#define GL_RASTERIZER_DISCARD_EXT 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B +#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C +#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F + +typedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode); +typedef void (GLAPIENTRY * PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (GLAPIENTRY * PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +typedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void); +typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei *size, GLenum *type, GLchar *name); +typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar * const* varyings, GLenum bufferMode); + +#define glBeginTransformFeedbackEXT GLEW_GET_FUN(__glewBeginTransformFeedbackEXT) +#define glBindBufferBaseEXT GLEW_GET_FUN(__glewBindBufferBaseEXT) +#define glBindBufferOffsetEXT GLEW_GET_FUN(__glewBindBufferOffsetEXT) +#define glBindBufferRangeEXT GLEW_GET_FUN(__glewBindBufferRangeEXT) +#define glEndTransformFeedbackEXT GLEW_GET_FUN(__glewEndTransformFeedbackEXT) +#define glGetTransformFeedbackVaryingEXT GLEW_GET_FUN(__glewGetTransformFeedbackVaryingEXT) +#define glTransformFeedbackVaryingsEXT GLEW_GET_FUN(__glewTransformFeedbackVaryingsEXT) + +#define GLEW_EXT_transform_feedback GLEW_GET_VAR(__GLEW_EXT_transform_feedback) + +#endif /* GL_EXT_transform_feedback */ + +/* -------------------------- GL_EXT_vertex_array -------------------------- */ + +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 + +#define GL_DOUBLE_EXT 0x140A +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 + +typedef void (GLAPIENTRY * PFNGLARRAYELEMENTEXTPROC) (GLint i); +typedef void (GLAPIENTRY * PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); +typedef void (GLAPIENTRY * PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (GLAPIENTRY * PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean* pointer); +typedef void (GLAPIENTRY * PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void *pointer); +typedef void (GLAPIENTRY * PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void *pointer); +typedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); +typedef void (GLAPIENTRY * PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); + +#define glArrayElementEXT GLEW_GET_FUN(__glewArrayElementEXT) +#define glColorPointerEXT GLEW_GET_FUN(__glewColorPointerEXT) +#define glDrawArraysEXT GLEW_GET_FUN(__glewDrawArraysEXT) +#define glEdgeFlagPointerEXT GLEW_GET_FUN(__glewEdgeFlagPointerEXT) +#define glIndexPointerEXT GLEW_GET_FUN(__glewIndexPointerEXT) +#define glNormalPointerEXT GLEW_GET_FUN(__glewNormalPointerEXT) +#define glTexCoordPointerEXT GLEW_GET_FUN(__glewTexCoordPointerEXT) +#define glVertexPointerEXT GLEW_GET_FUN(__glewVertexPointerEXT) + +#define GLEW_EXT_vertex_array GLEW_GET_VAR(__GLEW_EXT_vertex_array) + +#endif /* GL_EXT_vertex_array */ + +/* ------------------------ GL_EXT_vertex_array_bgra ----------------------- */ + +#ifndef GL_EXT_vertex_array_bgra +#define GL_EXT_vertex_array_bgra 1 + +#define GL_BGRA 0x80E1 + +#define GLEW_EXT_vertex_array_bgra GLEW_GET_VAR(__GLEW_EXT_vertex_array_bgra) + +#endif /* GL_EXT_vertex_array_bgra */ + +/* ----------------------- GL_EXT_vertex_attrib_64bit ---------------------- */ + +#ifndef GL_EXT_vertex_attrib_64bit +#define GL_EXT_vertex_attrib_64bit 1 + +#define GL_DOUBLE_MAT2_EXT 0x8F46 +#define GL_DOUBLE_MAT3_EXT 0x8F47 +#define GL_DOUBLE_MAT4_EXT 0x8F48 +#define GL_DOUBLE_MAT2x3_EXT 0x8F49 +#define GL_DOUBLE_MAT2x4_EXT 0x8F4A +#define GL_DOUBLE_MAT3x2_EXT 0x8F4B +#define GL_DOUBLE_MAT3x4_EXT 0x8F4C +#define GL_DOUBLE_MAT4x2_EXT 0x8F4D +#define GL_DOUBLE_MAT4x3_EXT 0x8F4E +#define GL_DOUBLE_VEC2_EXT 0x8FFC +#define GL_DOUBLE_VEC3_EXT 0x8FFD +#define GL_DOUBLE_VEC4_EXT 0x8FFE + +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); + +#define glGetVertexAttribLdvEXT GLEW_GET_FUN(__glewGetVertexAttribLdvEXT) +#define glVertexArrayVertexAttribLOffsetEXT GLEW_GET_FUN(__glewVertexArrayVertexAttribLOffsetEXT) +#define glVertexAttribL1dEXT GLEW_GET_FUN(__glewVertexAttribL1dEXT) +#define glVertexAttribL1dvEXT GLEW_GET_FUN(__glewVertexAttribL1dvEXT) +#define glVertexAttribL2dEXT GLEW_GET_FUN(__glewVertexAttribL2dEXT) +#define glVertexAttribL2dvEXT GLEW_GET_FUN(__glewVertexAttribL2dvEXT) +#define glVertexAttribL3dEXT GLEW_GET_FUN(__glewVertexAttribL3dEXT) +#define glVertexAttribL3dvEXT GLEW_GET_FUN(__glewVertexAttribL3dvEXT) +#define glVertexAttribL4dEXT GLEW_GET_FUN(__glewVertexAttribL4dEXT) +#define glVertexAttribL4dvEXT GLEW_GET_FUN(__glewVertexAttribL4dvEXT) +#define glVertexAttribLPointerEXT GLEW_GET_FUN(__glewVertexAttribLPointerEXT) + +#define GLEW_EXT_vertex_attrib_64bit GLEW_GET_VAR(__GLEW_EXT_vertex_attrib_64bit) + +#endif /* GL_EXT_vertex_attrib_64bit */ + +/* -------------------------- GL_EXT_vertex_shader ------------------------- */ + +#ifndef GL_EXT_vertex_shader +#define GL_EXT_vertex_shader 1 + +#define GL_VERTEX_SHADER_EXT 0x8780 +#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 +#define GL_OP_INDEX_EXT 0x8782 +#define GL_OP_NEGATE_EXT 0x8783 +#define GL_OP_DOT3_EXT 0x8784 +#define GL_OP_DOT4_EXT 0x8785 +#define GL_OP_MUL_EXT 0x8786 +#define GL_OP_ADD_EXT 0x8787 +#define GL_OP_MADD_EXT 0x8788 +#define GL_OP_FRAC_EXT 0x8789 +#define GL_OP_MAX_EXT 0x878A +#define GL_OP_MIN_EXT 0x878B +#define GL_OP_SET_GE_EXT 0x878C +#define GL_OP_SET_LT_EXT 0x878D +#define GL_OP_CLAMP_EXT 0x878E +#define GL_OP_FLOOR_EXT 0x878F +#define GL_OP_ROUND_EXT 0x8790 +#define GL_OP_EXP_BASE_2_EXT 0x8791 +#define GL_OP_LOG_BASE_2_EXT 0x8792 +#define GL_OP_POWER_EXT 0x8793 +#define GL_OP_RECIP_EXT 0x8794 +#define GL_OP_RECIP_SQRT_EXT 0x8795 +#define GL_OP_SUB_EXT 0x8796 +#define GL_OP_CROSS_PRODUCT_EXT 0x8797 +#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 +#define GL_OP_MOV_EXT 0x8799 +#define GL_OUTPUT_VERTEX_EXT 0x879A +#define GL_OUTPUT_COLOR0_EXT 0x879B +#define GL_OUTPUT_COLOR1_EXT 0x879C +#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D +#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E +#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F +#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 +#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 +#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 +#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 +#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 +#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 +#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 +#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 +#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 +#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 +#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA +#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB +#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC +#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD +#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE +#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF +#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 +#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 +#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 +#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 +#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 +#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 +#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 +#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 +#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 +#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 +#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA +#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB +#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC +#define GL_OUTPUT_FOG_EXT 0x87BD +#define GL_SCALAR_EXT 0x87BE +#define GL_VECTOR_EXT 0x87BF +#define GL_MATRIX_EXT 0x87C0 +#define GL_VARIANT_EXT 0x87C1 +#define GL_INVARIANT_EXT 0x87C2 +#define GL_LOCAL_CONSTANT_EXT 0x87C3 +#define GL_LOCAL_EXT 0x87C4 +#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 +#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 +#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 +#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 +#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CC +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CD +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE +#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF +#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 +#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 +#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 +#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 +#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 +#define GL_X_EXT 0x87D5 +#define GL_Y_EXT 0x87D6 +#define GL_Z_EXT 0x87D7 +#define GL_W_EXT 0x87D8 +#define GL_NEGATIVE_X_EXT 0x87D9 +#define GL_NEGATIVE_Y_EXT 0x87DA +#define GL_NEGATIVE_Z_EXT 0x87DB +#define GL_NEGATIVE_W_EXT 0x87DC +#define GL_ZERO_EXT 0x87DD +#define GL_ONE_EXT 0x87DE +#define GL_NEGATIVE_ONE_EXT 0x87DF +#define GL_NORMALIZED_RANGE_EXT 0x87E0 +#define GL_FULL_RANGE_EXT 0x87E1 +#define GL_CURRENT_VERTEX_EXT 0x87E2 +#define GL_MVP_MATRIX_EXT 0x87E3 +#define GL_VARIANT_VALUE_EXT 0x87E4 +#define GL_VARIANT_DATATYPE_EXT 0x87E5 +#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 +#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 +#define GL_VARIANT_ARRAY_EXT 0x87E8 +#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 +#define GL_INVARIANT_VALUE_EXT 0x87EA +#define GL_INVARIANT_DATATYPE_EXT 0x87EB +#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC +#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED + +typedef void (GLAPIENTRY * PFNGLBEGINVERTEXSHADEREXTPROC) (void); +typedef GLuint (GLAPIENTRY * PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); +typedef GLuint (GLAPIENTRY * PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); +typedef GLuint (GLAPIENTRY * PFNGLBINDPARAMETEREXTPROC) (GLenum value); +typedef GLuint (GLAPIENTRY * PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); +typedef GLuint (GLAPIENTRY * PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); +typedef void (GLAPIENTRY * PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLENDVERTEXSHADEREXTPROC) (void); +typedef void (GLAPIENTRY * PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef GLuint (GLAPIENTRY * PFNGLGENSYMBOLSEXTPROC) (GLenum dataType, GLenum storageType, GLenum range, GLuint components); +typedef GLuint (GLAPIENTRY * PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); +typedef void (GLAPIENTRY * PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (GLAPIENTRY * PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (GLAPIENTRY * PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (GLAPIENTRY * PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (GLAPIENTRY * PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (GLAPIENTRY * PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (GLAPIENTRY * PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, void **data); +typedef void (GLAPIENTRY * PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef GLboolean (GLAPIENTRY * PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); +typedef void (GLAPIENTRY * PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, void *addr); +typedef void (GLAPIENTRY * PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, void *addr); +typedef void (GLAPIENTRY * PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); +typedef void (GLAPIENTRY * PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); +typedef void (GLAPIENTRY * PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); +typedef void (GLAPIENTRY * PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (GLAPIENTRY * PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, void *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTBVEXTPROC) (GLuint id, GLbyte *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTDVEXTPROC) (GLuint id, GLdouble *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTFVEXTPROC) (GLuint id, GLfloat *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTIVEXTPROC) (GLuint id, GLint *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTSVEXTPROC) (GLuint id, GLshort *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTUBVEXTPROC) (GLuint id, GLubyte *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTUIVEXTPROC) (GLuint id, GLuint *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTUSVEXTPROC) (GLuint id, GLushort *addr); +typedef void (GLAPIENTRY * PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); + +#define glBeginVertexShaderEXT GLEW_GET_FUN(__glewBeginVertexShaderEXT) +#define glBindLightParameterEXT GLEW_GET_FUN(__glewBindLightParameterEXT) +#define glBindMaterialParameterEXT GLEW_GET_FUN(__glewBindMaterialParameterEXT) +#define glBindParameterEXT GLEW_GET_FUN(__glewBindParameterEXT) +#define glBindTexGenParameterEXT GLEW_GET_FUN(__glewBindTexGenParameterEXT) +#define glBindTextureUnitParameterEXT GLEW_GET_FUN(__glewBindTextureUnitParameterEXT) +#define glBindVertexShaderEXT GLEW_GET_FUN(__glewBindVertexShaderEXT) +#define glDeleteVertexShaderEXT GLEW_GET_FUN(__glewDeleteVertexShaderEXT) +#define glDisableVariantClientStateEXT GLEW_GET_FUN(__glewDisableVariantClientStateEXT) +#define glEnableVariantClientStateEXT GLEW_GET_FUN(__glewEnableVariantClientStateEXT) +#define glEndVertexShaderEXT GLEW_GET_FUN(__glewEndVertexShaderEXT) +#define glExtractComponentEXT GLEW_GET_FUN(__glewExtractComponentEXT) +#define glGenSymbolsEXT GLEW_GET_FUN(__glewGenSymbolsEXT) +#define glGenVertexShadersEXT GLEW_GET_FUN(__glewGenVertexShadersEXT) +#define glGetInvariantBooleanvEXT GLEW_GET_FUN(__glewGetInvariantBooleanvEXT) +#define glGetInvariantFloatvEXT GLEW_GET_FUN(__glewGetInvariantFloatvEXT) +#define glGetInvariantIntegervEXT GLEW_GET_FUN(__glewGetInvariantIntegervEXT) +#define glGetLocalConstantBooleanvEXT GLEW_GET_FUN(__glewGetLocalConstantBooleanvEXT) +#define glGetLocalConstantFloatvEXT GLEW_GET_FUN(__glewGetLocalConstantFloatvEXT) +#define glGetLocalConstantIntegervEXT GLEW_GET_FUN(__glewGetLocalConstantIntegervEXT) +#define glGetVariantBooleanvEXT GLEW_GET_FUN(__glewGetVariantBooleanvEXT) +#define glGetVariantFloatvEXT GLEW_GET_FUN(__glewGetVariantFloatvEXT) +#define glGetVariantIntegervEXT GLEW_GET_FUN(__glewGetVariantIntegervEXT) +#define glGetVariantPointervEXT GLEW_GET_FUN(__glewGetVariantPointervEXT) +#define glInsertComponentEXT GLEW_GET_FUN(__glewInsertComponentEXT) +#define glIsVariantEnabledEXT GLEW_GET_FUN(__glewIsVariantEnabledEXT) +#define glSetInvariantEXT GLEW_GET_FUN(__glewSetInvariantEXT) +#define glSetLocalConstantEXT GLEW_GET_FUN(__glewSetLocalConstantEXT) +#define glShaderOp1EXT GLEW_GET_FUN(__glewShaderOp1EXT) +#define glShaderOp2EXT GLEW_GET_FUN(__glewShaderOp2EXT) +#define glShaderOp3EXT GLEW_GET_FUN(__glewShaderOp3EXT) +#define glSwizzleEXT GLEW_GET_FUN(__glewSwizzleEXT) +#define glVariantPointerEXT GLEW_GET_FUN(__glewVariantPointerEXT) +#define glVariantbvEXT GLEW_GET_FUN(__glewVariantbvEXT) +#define glVariantdvEXT GLEW_GET_FUN(__glewVariantdvEXT) +#define glVariantfvEXT GLEW_GET_FUN(__glewVariantfvEXT) +#define glVariantivEXT GLEW_GET_FUN(__glewVariantivEXT) +#define glVariantsvEXT GLEW_GET_FUN(__glewVariantsvEXT) +#define glVariantubvEXT GLEW_GET_FUN(__glewVariantubvEXT) +#define glVariantuivEXT GLEW_GET_FUN(__glewVariantuivEXT) +#define glVariantusvEXT GLEW_GET_FUN(__glewVariantusvEXT) +#define glWriteMaskEXT GLEW_GET_FUN(__glewWriteMaskEXT) + +#define GLEW_EXT_vertex_shader GLEW_GET_VAR(__GLEW_EXT_vertex_shader) + +#endif /* GL_EXT_vertex_shader */ + +/* ------------------------ GL_EXT_vertex_weighting ------------------------ */ + +#ifndef GL_EXT_vertex_weighting +#define GL_EXT_vertex_weighting 1 + +#define GL_MODELVIEW0_STACK_DEPTH_EXT 0x0BA3 +#define GL_MODELVIEW0_MATRIX_EXT 0x0BA6 +#define GL_MODELVIEW0_EXT 0x1700 +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#define GL_MODELVIEW1_MATRIX_EXT 0x8506 +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#define GL_MODELVIEW1_EXT 0x850A +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F +#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 + +typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, void *pointer); +typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); +typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTFVEXTPROC) (GLfloat* weight); + +#define glVertexWeightPointerEXT GLEW_GET_FUN(__glewVertexWeightPointerEXT) +#define glVertexWeightfEXT GLEW_GET_FUN(__glewVertexWeightfEXT) +#define glVertexWeightfvEXT GLEW_GET_FUN(__glewVertexWeightfvEXT) + +#define GLEW_EXT_vertex_weighting GLEW_GET_VAR(__GLEW_EXT_vertex_weighting) + +#endif /* GL_EXT_vertex_weighting */ + +/* ------------------------- GL_EXT_x11_sync_object ------------------------ */ + +#ifndef GL_EXT_x11_sync_object +#define GL_EXT_x11_sync_object 1 + +#define GL_SYNC_X11_FENCE_EXT 0x90E1 + +typedef GLsync (GLAPIENTRY * PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags); + +#define glImportSyncEXT GLEW_GET_FUN(__glewImportSyncEXT) + +#define GLEW_EXT_x11_sync_object GLEW_GET_VAR(__GLEW_EXT_x11_sync_object) + +#endif /* GL_EXT_x11_sync_object */ + +/* ---------------------- GL_GREMEDY_frame_terminator ---------------------- */ + +#ifndef GL_GREMEDY_frame_terminator +#define GL_GREMEDY_frame_terminator 1 + +typedef void (GLAPIENTRY * PFNGLFRAMETERMINATORGREMEDYPROC) (void); + +#define glFrameTerminatorGREMEDY GLEW_GET_FUN(__glewFrameTerminatorGREMEDY) + +#define GLEW_GREMEDY_frame_terminator GLEW_GET_VAR(__GLEW_GREMEDY_frame_terminator) + +#endif /* GL_GREMEDY_frame_terminator */ + +/* ------------------------ GL_GREMEDY_string_marker ----------------------- */ + +#ifndef GL_GREMEDY_string_marker +#define GL_GREMEDY_string_marker 1 + +typedef void (GLAPIENTRY * PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const void *string); + +#define glStringMarkerGREMEDY GLEW_GET_FUN(__glewStringMarkerGREMEDY) + +#define GLEW_GREMEDY_string_marker GLEW_GET_VAR(__GLEW_GREMEDY_string_marker) + +#endif /* GL_GREMEDY_string_marker */ + +/* --------------------- GL_HP_convolution_border_modes -------------------- */ + +#ifndef GL_HP_convolution_border_modes +#define GL_HP_convolution_border_modes 1 + +#define GLEW_HP_convolution_border_modes GLEW_GET_VAR(__GLEW_HP_convolution_border_modes) + +#endif /* GL_HP_convolution_border_modes */ + +/* ------------------------- GL_HP_image_transform ------------------------- */ + +#ifndef GL_HP_image_transform +#define GL_HP_image_transform 1 + +typedef void (GLAPIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, const GLfloat param); +typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, const GLint param); +typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint* params); + +#define glGetImageTransformParameterfvHP GLEW_GET_FUN(__glewGetImageTransformParameterfvHP) +#define glGetImageTransformParameterivHP GLEW_GET_FUN(__glewGetImageTransformParameterivHP) +#define glImageTransformParameterfHP GLEW_GET_FUN(__glewImageTransformParameterfHP) +#define glImageTransformParameterfvHP GLEW_GET_FUN(__glewImageTransformParameterfvHP) +#define glImageTransformParameteriHP GLEW_GET_FUN(__glewImageTransformParameteriHP) +#define glImageTransformParameterivHP GLEW_GET_FUN(__glewImageTransformParameterivHP) + +#define GLEW_HP_image_transform GLEW_GET_VAR(__GLEW_HP_image_transform) + +#endif /* GL_HP_image_transform */ + +/* -------------------------- GL_HP_occlusion_test ------------------------- */ + +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 + +#define GLEW_HP_occlusion_test GLEW_GET_VAR(__GLEW_HP_occlusion_test) + +#endif /* GL_HP_occlusion_test */ + +/* ------------------------- GL_HP_texture_lighting ------------------------ */ + +#ifndef GL_HP_texture_lighting +#define GL_HP_texture_lighting 1 + +#define GLEW_HP_texture_lighting GLEW_GET_VAR(__GLEW_HP_texture_lighting) + +#endif /* GL_HP_texture_lighting */ + +/* --------------------------- GL_IBM_cull_vertex -------------------------- */ + +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 + +#define GL_CULL_VERTEX_IBM 103050 + +#define GLEW_IBM_cull_vertex GLEW_GET_VAR(__GLEW_IBM_cull_vertex) + +#endif /* GL_IBM_cull_vertex */ + +/* ---------------------- GL_IBM_multimode_draw_arrays --------------------- */ + +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 + +typedef void (GLAPIENTRY * PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum* mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +typedef void (GLAPIENTRY * PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum* mode, const GLsizei *count, GLenum type, const void *const *indices, GLsizei primcount, GLint modestride); + +#define glMultiModeDrawArraysIBM GLEW_GET_FUN(__glewMultiModeDrawArraysIBM) +#define glMultiModeDrawElementsIBM GLEW_GET_FUN(__glewMultiModeDrawElementsIBM) + +#define GLEW_IBM_multimode_draw_arrays GLEW_GET_VAR(__GLEW_IBM_multimode_draw_arrays) + +#endif /* GL_IBM_multimode_draw_arrays */ + +/* ------------------------- GL_IBM_rasterpos_clip ------------------------- */ + +#ifndef GL_IBM_rasterpos_clip +#define GL_IBM_rasterpos_clip 1 + +#define GL_RASTER_POSITION_UNCLIPPED_IBM 103010 + +#define GLEW_IBM_rasterpos_clip GLEW_GET_VAR(__GLEW_IBM_rasterpos_clip) + +#endif /* GL_IBM_rasterpos_clip */ + +/* --------------------------- GL_IBM_static_data -------------------------- */ + +#ifndef GL_IBM_static_data +#define GL_IBM_static_data 1 + +#define GL_ALL_STATIC_DATA_IBM 103060 +#define GL_STATIC_VERTEX_ARRAY_IBM 103061 + +#define GLEW_IBM_static_data GLEW_GET_VAR(__GLEW_IBM_static_data) + +#endif /* GL_IBM_static_data */ + +/* --------------------- GL_IBM_texture_mirrored_repeat -------------------- */ + +#ifndef GL_IBM_texture_mirrored_repeat +#define GL_IBM_texture_mirrored_repeat 1 + +#define GL_MIRRORED_REPEAT_IBM 0x8370 + +#define GLEW_IBM_texture_mirrored_repeat GLEW_GET_VAR(__GLEW_IBM_texture_mirrored_repeat) + +#endif /* GL_IBM_texture_mirrored_repeat */ + +/* ----------------------- GL_IBM_vertex_array_lists ----------------------- */ + +#ifndef GL_IBM_vertex_array_lists +#define GL_IBM_vertex_array_lists 1 + +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 + +typedef void (GLAPIENTRY * PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void** pointer, GLint ptrstride); +typedef void (GLAPIENTRY * PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean ** pointer, GLint ptrstride); +typedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void** pointer, GLint ptrstride); +typedef void (GLAPIENTRY * PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void** pointer, GLint ptrstride); +typedef void (GLAPIENTRY * PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void** pointer, GLint ptrstride); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void** pointer, GLint ptrstride); +typedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void** pointer, GLint ptrstride); +typedef void (GLAPIENTRY * PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void** pointer, GLint ptrstride); + +#define glColorPointerListIBM GLEW_GET_FUN(__glewColorPointerListIBM) +#define glEdgeFlagPointerListIBM GLEW_GET_FUN(__glewEdgeFlagPointerListIBM) +#define glFogCoordPointerListIBM GLEW_GET_FUN(__glewFogCoordPointerListIBM) +#define glIndexPointerListIBM GLEW_GET_FUN(__glewIndexPointerListIBM) +#define glNormalPointerListIBM GLEW_GET_FUN(__glewNormalPointerListIBM) +#define glSecondaryColorPointerListIBM GLEW_GET_FUN(__glewSecondaryColorPointerListIBM) +#define glTexCoordPointerListIBM GLEW_GET_FUN(__glewTexCoordPointerListIBM) +#define glVertexPointerListIBM GLEW_GET_FUN(__glewVertexPointerListIBM) + +#define GLEW_IBM_vertex_array_lists GLEW_GET_VAR(__GLEW_IBM_vertex_array_lists) + +#endif /* GL_IBM_vertex_array_lists */ + +/* -------------------------- GL_INGR_color_clamp -------------------------- */ + +#ifndef GL_INGR_color_clamp +#define GL_INGR_color_clamp 1 + +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 + +#define GLEW_INGR_color_clamp GLEW_GET_VAR(__GLEW_INGR_color_clamp) + +#endif /* GL_INGR_color_clamp */ + +/* ------------------------- GL_INGR_interlace_read ------------------------ */ + +#ifndef GL_INGR_interlace_read +#define GL_INGR_interlace_read 1 + +#define GL_INTERLACE_READ_INGR 0x8568 + +#define GLEW_INGR_interlace_read GLEW_GET_VAR(__GLEW_INGR_interlace_read) + +#endif /* GL_INGR_interlace_read */ + +/* ------------------- GL_INTEL_fragment_shader_ordering ------------------- */ + +#ifndef GL_INTEL_fragment_shader_ordering +#define GL_INTEL_fragment_shader_ordering 1 + +#define GLEW_INTEL_fragment_shader_ordering GLEW_GET_VAR(__GLEW_INTEL_fragment_shader_ordering) + +#endif /* GL_INTEL_fragment_shader_ordering */ + +/* ----------------------- GL_INTEL_framebuffer_CMAA ----------------------- */ + +#ifndef GL_INTEL_framebuffer_CMAA +#define GL_INTEL_framebuffer_CMAA 1 + +#define GLEW_INTEL_framebuffer_CMAA GLEW_GET_VAR(__GLEW_INTEL_framebuffer_CMAA) + +#endif /* GL_INTEL_framebuffer_CMAA */ + +/* -------------------------- GL_INTEL_map_texture ------------------------- */ + +#ifndef GL_INTEL_map_texture +#define GL_INTEL_map_texture 1 + +#define GL_LAYOUT_DEFAULT_INTEL 0 +#define GL_LAYOUT_LINEAR_INTEL 1 +#define GL_LAYOUT_LINEAR_CPU_CACHED_INTEL 2 +#define GL_TEXTURE_MEMORY_LAYOUT_INTEL 0x83FF + +typedef void * (GLAPIENTRY * PFNGLMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level, GLbitfield access, GLint* stride, GLenum *layout); +typedef void (GLAPIENTRY * PFNGLSYNCTEXTUREINTELPROC) (GLuint texture); +typedef void (GLAPIENTRY * PFNGLUNMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level); + +#define glMapTexture2DINTEL GLEW_GET_FUN(__glewMapTexture2DINTEL) +#define glSyncTextureINTEL GLEW_GET_FUN(__glewSyncTextureINTEL) +#define glUnmapTexture2DINTEL GLEW_GET_FUN(__glewUnmapTexture2DINTEL) + +#define GLEW_INTEL_map_texture GLEW_GET_VAR(__GLEW_INTEL_map_texture) + +#endif /* GL_INTEL_map_texture */ + +/* ------------------------ GL_INTEL_parallel_arrays ----------------------- */ + +#ifndef GL_INTEL_parallel_arrays +#define GL_INTEL_parallel_arrays 1 + +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 + +typedef void (GLAPIENTRY * PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer); +typedef void (GLAPIENTRY * PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const void** pointer); +typedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer); +typedef void (GLAPIENTRY * PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer); + +#define glColorPointervINTEL GLEW_GET_FUN(__glewColorPointervINTEL) +#define glNormalPointervINTEL GLEW_GET_FUN(__glewNormalPointervINTEL) +#define glTexCoordPointervINTEL GLEW_GET_FUN(__glewTexCoordPointervINTEL) +#define glVertexPointervINTEL GLEW_GET_FUN(__glewVertexPointervINTEL) + +#define GLEW_INTEL_parallel_arrays GLEW_GET_VAR(__GLEW_INTEL_parallel_arrays) + +#endif /* GL_INTEL_parallel_arrays */ + +/* ----------------------- GL_INTEL_performance_query ---------------------- */ + +#ifndef GL_INTEL_performance_query +#define GL_INTEL_performance_query 1 + +#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x0000 +#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x0001 +#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9 +#define GL_PERFQUERY_FLUSH_INTEL 0x83FA +#define GL_PERFQUERY_WAIT_INTEL 0x83FB +#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0 +#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1 +#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2 +#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3 +#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4 +#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5 +#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8 +#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9 +#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA +#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB +#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC +#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD +#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE +#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF +#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500 + +typedef void (GLAPIENTRY * PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GLAPIENTRY * PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint* queryHandle); +typedef void (GLAPIENTRY * PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GLAPIENTRY * PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GLAPIENTRY * PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint* queryId); +typedef void (GLAPIENTRY * PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint* nextQueryId); +typedef void (GLAPIENTRY * PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar* counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +typedef void (GLAPIENTRY * PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, void *data, GLuint *bytesWritten); +typedef void (GLAPIENTRY * PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar* queryName, GLuint *queryId); +typedef void (GLAPIENTRY * PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar* queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); + +#define glBeginPerfQueryINTEL GLEW_GET_FUN(__glewBeginPerfQueryINTEL) +#define glCreatePerfQueryINTEL GLEW_GET_FUN(__glewCreatePerfQueryINTEL) +#define glDeletePerfQueryINTEL GLEW_GET_FUN(__glewDeletePerfQueryINTEL) +#define glEndPerfQueryINTEL GLEW_GET_FUN(__glewEndPerfQueryINTEL) +#define glGetFirstPerfQueryIdINTEL GLEW_GET_FUN(__glewGetFirstPerfQueryIdINTEL) +#define glGetNextPerfQueryIdINTEL GLEW_GET_FUN(__glewGetNextPerfQueryIdINTEL) +#define glGetPerfCounterInfoINTEL GLEW_GET_FUN(__glewGetPerfCounterInfoINTEL) +#define glGetPerfQueryDataINTEL GLEW_GET_FUN(__glewGetPerfQueryDataINTEL) +#define glGetPerfQueryIdByNameINTEL GLEW_GET_FUN(__glewGetPerfQueryIdByNameINTEL) +#define glGetPerfQueryInfoINTEL GLEW_GET_FUN(__glewGetPerfQueryInfoINTEL) + +#define GLEW_INTEL_performance_query GLEW_GET_VAR(__GLEW_INTEL_performance_query) + +#endif /* GL_INTEL_performance_query */ + +/* ------------------------ GL_INTEL_texture_scissor ----------------------- */ + +#ifndef GL_INTEL_texture_scissor +#define GL_INTEL_texture_scissor 1 + +typedef void (GLAPIENTRY * PFNGLTEXSCISSORFUNCINTELPROC) (GLenum target, GLenum lfunc, GLenum hfunc); +typedef void (GLAPIENTRY * PFNGLTEXSCISSORINTELPROC) (GLenum target, GLclampf tlow, GLclampf thigh); + +#define glTexScissorFuncINTEL GLEW_GET_FUN(__glewTexScissorFuncINTEL) +#define glTexScissorINTEL GLEW_GET_FUN(__glewTexScissorINTEL) + +#define GLEW_INTEL_texture_scissor GLEW_GET_VAR(__GLEW_INTEL_texture_scissor) + +#endif /* GL_INTEL_texture_scissor */ + +/* --------------------- GL_KHR_blend_equation_advanced -------------------- */ + +#ifndef GL_KHR_blend_equation_advanced +#define GL_KHR_blend_equation_advanced 1 + +#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 +#define GL_MULTIPLY_KHR 0x9294 +#define GL_SCREEN_KHR 0x9295 +#define GL_OVERLAY_KHR 0x9296 +#define GL_DARKEN_KHR 0x9297 +#define GL_LIGHTEN_KHR 0x9298 +#define GL_COLORDODGE_KHR 0x9299 +#define GL_COLORBURN_KHR 0x929A +#define GL_HARDLIGHT_KHR 0x929B +#define GL_SOFTLIGHT_KHR 0x929C +#define GL_DIFFERENCE_KHR 0x929E +#define GL_EXCLUSION_KHR 0x92A0 +#define GL_HSL_HUE_KHR 0x92AD +#define GL_HSL_SATURATION_KHR 0x92AE +#define GL_HSL_COLOR_KHR 0x92AF +#define GL_HSL_LUMINOSITY_KHR 0x92B0 + +typedef void (GLAPIENTRY * PFNGLBLENDBARRIERKHRPROC) (void); + +#define glBlendBarrierKHR GLEW_GET_FUN(__glewBlendBarrierKHR) + +#define GLEW_KHR_blend_equation_advanced GLEW_GET_VAR(__GLEW_KHR_blend_equation_advanced) + +#endif /* GL_KHR_blend_equation_advanced */ + +/* ---------------- GL_KHR_blend_equation_advanced_coherent ---------------- */ + +#ifndef GL_KHR_blend_equation_advanced_coherent +#define GL_KHR_blend_equation_advanced_coherent 1 + +#define GLEW_KHR_blend_equation_advanced_coherent GLEW_GET_VAR(__GLEW_KHR_blend_equation_advanced_coherent) + +#endif /* GL_KHR_blend_equation_advanced_coherent */ + +/* ---------------------- GL_KHR_context_flush_control --------------------- */ + +#ifndef GL_KHR_context_flush_control +#define GL_KHR_context_flush_control 1 + +#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC + +#define GLEW_KHR_context_flush_control GLEW_GET_VAR(__GLEW_KHR_context_flush_control) + +#endif /* GL_KHR_context_flush_control */ + +/* ------------------------------ GL_KHR_debug ----------------------------- */ + +#ifndef GL_KHR_debug +#define GL_KHR_debug 1 + +#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 +#define GL_DEBUG_SOURCE_API 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION 0x824A +#define GL_DEBUG_SOURCE_OTHER 0x824B +#define GL_DEBUG_TYPE_ERROR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 +#define GL_DEBUG_TYPE_OTHER 0x8251 +#define GL_DEBUG_TYPE_MARKER 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP 0x826A +#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C +#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D +#define GL_BUFFER 0x82E0 +#define GL_SHADER 0x82E1 +#define GL_PROGRAM 0x82E2 +#define GL_QUERY 0x82E3 +#define GL_PROGRAM_PIPELINE 0x82E4 +#define GL_SAMPLER 0x82E6 +#define GL_DISPLAY_LIST 0x82E7 +#define GL_MAX_LABEL_LENGTH 0x82E8 +#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES 0x9145 +#define GL_DEBUG_SEVERITY_HIGH 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 +#define GL_DEBUG_SEVERITY_LOW 0x9148 +#define GL_DEBUG_OUTPUT 0x92E0 + +typedef void (GLAPIENTRY *GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam); + +typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam); +typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled); +typedef void (GLAPIENTRY * PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf); +typedef GLuint (GLAPIENTRY * PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufSize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog); +typedef void (GLAPIENTRY * PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei* length, GLchar *label); +typedef void (GLAPIENTRY * PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei* length, GLchar *label); +typedef void (GLAPIENTRY * PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar* label); +typedef void (GLAPIENTRY * PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar* label); +typedef void (GLAPIENTRY * PFNGLPOPDEBUGGROUPPROC) (void); +typedef void (GLAPIENTRY * PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar * message); + +#define glDebugMessageCallback GLEW_GET_FUN(__glewDebugMessageCallback) +#define glDebugMessageControl GLEW_GET_FUN(__glewDebugMessageControl) +#define glDebugMessageInsert GLEW_GET_FUN(__glewDebugMessageInsert) +#define glGetDebugMessageLog GLEW_GET_FUN(__glewGetDebugMessageLog) +#define glGetObjectLabel GLEW_GET_FUN(__glewGetObjectLabel) +#define glGetObjectPtrLabel GLEW_GET_FUN(__glewGetObjectPtrLabel) +#define glObjectLabel GLEW_GET_FUN(__glewObjectLabel) +#define glObjectPtrLabel GLEW_GET_FUN(__glewObjectPtrLabel) +#define glPopDebugGroup GLEW_GET_FUN(__glewPopDebugGroup) +#define glPushDebugGroup GLEW_GET_FUN(__glewPushDebugGroup) + +#define GLEW_KHR_debug GLEW_GET_VAR(__GLEW_KHR_debug) + +#endif /* GL_KHR_debug */ + +/* ---------------------------- GL_KHR_no_error ---------------------------- */ + +#ifndef GL_KHR_no_error +#define GL_KHR_no_error 1 + +#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 + +#define GLEW_KHR_no_error GLEW_GET_VAR(__GLEW_KHR_no_error) + +#endif /* GL_KHR_no_error */ + +/* ------------------ GL_KHR_robust_buffer_access_behavior ----------------- */ + +#ifndef GL_KHR_robust_buffer_access_behavior +#define GL_KHR_robust_buffer_access_behavior 1 + +#define GLEW_KHR_robust_buffer_access_behavior GLEW_GET_VAR(__GLEW_KHR_robust_buffer_access_behavior) + +#endif /* GL_KHR_robust_buffer_access_behavior */ + +/* --------------------------- GL_KHR_robustness --------------------------- */ + +#ifndef GL_KHR_robustness +#define GL_KHR_robustness 1 + +#define GL_CONTEXT_LOST 0x0507 +#define GL_LOSE_CONTEXT_ON_RESET 0x8252 +#define GL_GUILTY_CONTEXT_RESET 0x8253 +#define GL_INNOCENT_CONTEXT_RESET 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY 0x8256 +#define GL_NO_RESET_NOTIFICATION 0x8261 +#define GL_CONTEXT_ROBUST_ACCESS 0x90F3 + +typedef void (GLAPIENTRY * PFNGLGETNUNIFORMFVPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETNUNIFORMIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETNUNIFORMUIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint* params); +typedef void (GLAPIENTRY * PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); + +#define glGetnUniformfv GLEW_GET_FUN(__glewGetnUniformfv) +#define glGetnUniformiv GLEW_GET_FUN(__glewGetnUniformiv) +#define glGetnUniformuiv GLEW_GET_FUN(__glewGetnUniformuiv) +#define glReadnPixels GLEW_GET_FUN(__glewReadnPixels) + +#define GLEW_KHR_robustness GLEW_GET_VAR(__GLEW_KHR_robustness) + +#endif /* GL_KHR_robustness */ + +/* ------------------ GL_KHR_texture_compression_astc_hdr ------------------ */ + +#ifndef GL_KHR_texture_compression_astc_hdr +#define GL_KHR_texture_compression_astc_hdr 1 + +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD + +#define GLEW_KHR_texture_compression_astc_hdr GLEW_GET_VAR(__GLEW_KHR_texture_compression_astc_hdr) + +#endif /* GL_KHR_texture_compression_astc_hdr */ + +/* ------------------ GL_KHR_texture_compression_astc_ldr ------------------ */ + +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_KHR_texture_compression_astc_ldr 1 + +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD + +#define GLEW_KHR_texture_compression_astc_ldr GLEW_GET_VAR(__GLEW_KHR_texture_compression_astc_ldr) + +#endif /* GL_KHR_texture_compression_astc_ldr */ + +/* -------------------------- GL_KTX_buffer_region ------------------------- */ + +#ifndef GL_KTX_buffer_region +#define GL_KTX_buffer_region 1 + +#define GL_KTX_FRONT_REGION 0x0 +#define GL_KTX_BACK_REGION 0x1 +#define GL_KTX_Z_REGION 0x2 +#define GL_KTX_STENCIL_REGION 0x3 + +typedef GLuint (GLAPIENTRY * PFNGLBUFFERREGIONENABLEDPROC) (void); +typedef void (GLAPIENTRY * PFNGLDELETEBUFFERREGIONPROC) (GLenum region); +typedef void (GLAPIENTRY * PFNGLDRAWBUFFERREGIONPROC) (GLuint region, GLint x, GLint y, GLsizei width, GLsizei height, GLint xDest, GLint yDest); +typedef GLuint (GLAPIENTRY * PFNGLNEWBUFFERREGIONPROC) (GLenum region); +typedef void (GLAPIENTRY * PFNGLREADBUFFERREGIONPROC) (GLuint region, GLint x, GLint y, GLsizei width, GLsizei height); + +#define glBufferRegionEnabled GLEW_GET_FUN(__glewBufferRegionEnabled) +#define glDeleteBufferRegion GLEW_GET_FUN(__glewDeleteBufferRegion) +#define glDrawBufferRegion GLEW_GET_FUN(__glewDrawBufferRegion) +#define glNewBufferRegion GLEW_GET_FUN(__glewNewBufferRegion) +#define glReadBufferRegion GLEW_GET_FUN(__glewReadBufferRegion) + +#define GLEW_KTX_buffer_region GLEW_GET_VAR(__GLEW_KTX_buffer_region) + +#endif /* GL_KTX_buffer_region */ + +/* ------------------------- GL_MESAX_texture_stack ------------------------ */ + +#ifndef GL_MESAX_texture_stack +#define GL_MESAX_texture_stack 1 + +#define GL_TEXTURE_1D_STACK_MESAX 0x8759 +#define GL_TEXTURE_2D_STACK_MESAX 0x875A +#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B +#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C +#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D +#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E + +#define GLEW_MESAX_texture_stack GLEW_GET_VAR(__GLEW_MESAX_texture_stack) + +#endif /* GL_MESAX_texture_stack */ + +/* -------------------------- GL_MESA_pack_invert -------------------------- */ + +#ifndef GL_MESA_pack_invert +#define GL_MESA_pack_invert 1 + +#define GL_PACK_INVERT_MESA 0x8758 + +#define GLEW_MESA_pack_invert GLEW_GET_VAR(__GLEW_MESA_pack_invert) + +#endif /* GL_MESA_pack_invert */ + +/* ------------------------- GL_MESA_resize_buffers ------------------------ */ + +#ifndef GL_MESA_resize_buffers +#define GL_MESA_resize_buffers 1 + +typedef void (GLAPIENTRY * PFNGLRESIZEBUFFERSMESAPROC) (void); + +#define glResizeBuffersMESA GLEW_GET_FUN(__glewResizeBuffersMESA) + +#define GLEW_MESA_resize_buffers GLEW_GET_VAR(__GLEW_MESA_resize_buffers) + +#endif /* GL_MESA_resize_buffers */ + +/* --------------------------- GL_MESA_window_pos -------------------------- */ + +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 + +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVMESAPROC) (const GLint* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVMESAPROC) (const GLshort* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVMESAPROC) (const GLint* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVMESAPROC) (const GLshort* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4IVMESAPROC) (const GLint* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4SVMESAPROC) (const GLshort* p); + +#define glWindowPos2dMESA GLEW_GET_FUN(__glewWindowPos2dMESA) +#define glWindowPos2dvMESA GLEW_GET_FUN(__glewWindowPos2dvMESA) +#define glWindowPos2fMESA GLEW_GET_FUN(__glewWindowPos2fMESA) +#define glWindowPos2fvMESA GLEW_GET_FUN(__glewWindowPos2fvMESA) +#define glWindowPos2iMESA GLEW_GET_FUN(__glewWindowPos2iMESA) +#define glWindowPos2ivMESA GLEW_GET_FUN(__glewWindowPos2ivMESA) +#define glWindowPos2sMESA GLEW_GET_FUN(__glewWindowPos2sMESA) +#define glWindowPos2svMESA GLEW_GET_FUN(__glewWindowPos2svMESA) +#define glWindowPos3dMESA GLEW_GET_FUN(__glewWindowPos3dMESA) +#define glWindowPos3dvMESA GLEW_GET_FUN(__glewWindowPos3dvMESA) +#define glWindowPos3fMESA GLEW_GET_FUN(__glewWindowPos3fMESA) +#define glWindowPos3fvMESA GLEW_GET_FUN(__glewWindowPos3fvMESA) +#define glWindowPos3iMESA GLEW_GET_FUN(__glewWindowPos3iMESA) +#define glWindowPos3ivMESA GLEW_GET_FUN(__glewWindowPos3ivMESA) +#define glWindowPos3sMESA GLEW_GET_FUN(__glewWindowPos3sMESA) +#define glWindowPos3svMESA GLEW_GET_FUN(__glewWindowPos3svMESA) +#define glWindowPos4dMESA GLEW_GET_FUN(__glewWindowPos4dMESA) +#define glWindowPos4dvMESA GLEW_GET_FUN(__glewWindowPos4dvMESA) +#define glWindowPos4fMESA GLEW_GET_FUN(__glewWindowPos4fMESA) +#define glWindowPos4fvMESA GLEW_GET_FUN(__glewWindowPos4fvMESA) +#define glWindowPos4iMESA GLEW_GET_FUN(__glewWindowPos4iMESA) +#define glWindowPos4ivMESA GLEW_GET_FUN(__glewWindowPos4ivMESA) +#define glWindowPos4sMESA GLEW_GET_FUN(__glewWindowPos4sMESA) +#define glWindowPos4svMESA GLEW_GET_FUN(__glewWindowPos4svMESA) + +#define GLEW_MESA_window_pos GLEW_GET_VAR(__GLEW_MESA_window_pos) + +#endif /* GL_MESA_window_pos */ + +/* ------------------------- GL_MESA_ycbcr_texture ------------------------- */ + +#ifndef GL_MESA_ycbcr_texture +#define GL_MESA_ycbcr_texture 1 + +#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB +#define GL_YCBCR_MESA 0x8757 + +#define GLEW_MESA_ycbcr_texture GLEW_GET_VAR(__GLEW_MESA_ycbcr_texture) + +#endif /* GL_MESA_ycbcr_texture */ + +/* ----------------------- GL_NVX_conditional_render ----------------------- */ + +#ifndef GL_NVX_conditional_render +#define GL_NVX_conditional_render 1 + +typedef void (GLAPIENTRY * PFNGLBEGINCONDITIONALRENDERNVXPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLENDCONDITIONALRENDERNVXPROC) (void); + +#define glBeginConditionalRenderNVX GLEW_GET_FUN(__glewBeginConditionalRenderNVX) +#define glEndConditionalRenderNVX GLEW_GET_FUN(__glewEndConditionalRenderNVX) + +#define GLEW_NVX_conditional_render GLEW_GET_VAR(__GLEW_NVX_conditional_render) + +#endif /* GL_NVX_conditional_render */ + +/* ------------------------- GL_NVX_gpu_memory_info ------------------------ */ + +#ifndef GL_NVX_gpu_memory_info +#define GL_NVX_gpu_memory_info 1 + +#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047 +#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048 +#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049 +#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A +#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B + +#define GLEW_NVX_gpu_memory_info GLEW_GET_VAR(__GLEW_NVX_gpu_memory_info) + +#endif /* GL_NVX_gpu_memory_info */ + +/* ------------------- GL_NV_bindless_multi_draw_indirect ------------------ */ + +#ifndef GL_NV_bindless_multi_draw_indirect +#define GL_NV_bindless_multi_draw_indirect 1 + +typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); + +#define glMultiDrawArraysIndirectBindlessNV GLEW_GET_FUN(__glewMultiDrawArraysIndirectBindlessNV) +#define glMultiDrawElementsIndirectBindlessNV GLEW_GET_FUN(__glewMultiDrawElementsIndirectBindlessNV) + +#define GLEW_NV_bindless_multi_draw_indirect GLEW_GET_VAR(__GLEW_NV_bindless_multi_draw_indirect) + +#endif /* GL_NV_bindless_multi_draw_indirect */ + +/* ---------------- GL_NV_bindless_multi_draw_indirect_count --------------- */ + +#ifndef GL_NV_bindless_multi_draw_indirect_count +#define GL_NV_bindless_multi_draw_indirect_count 1 + +typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, const void *indirect, GLintptr drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, GLenum type, const void *indirect, GLintptr drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); + +#define glMultiDrawArraysIndirectBindlessCountNV GLEW_GET_FUN(__glewMultiDrawArraysIndirectBindlessCountNV) +#define glMultiDrawElementsIndirectBindlessCountNV GLEW_GET_FUN(__glewMultiDrawElementsIndirectBindlessCountNV) + +#define GLEW_NV_bindless_multi_draw_indirect_count GLEW_GET_VAR(__GLEW_NV_bindless_multi_draw_indirect_count) + +#endif /* GL_NV_bindless_multi_draw_indirect_count */ + +/* ------------------------- GL_NV_bindless_texture ------------------------ */ + +#ifndef GL_NV_bindless_texture +#define GL_NV_bindless_texture 1 + +typedef GLuint64 (GLAPIENTRY * PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +typedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture); +typedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler); +typedef GLboolean (GLAPIENTRY * PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef GLboolean (GLAPIENTRY * PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef void (GLAPIENTRY * PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef void (GLAPIENTRY * PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access); +typedef void (GLAPIENTRY * PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef void (GLAPIENTRY * PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64* values); +typedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value); +typedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64* value); + +#define glGetImageHandleNV GLEW_GET_FUN(__glewGetImageHandleNV) +#define glGetTextureHandleNV GLEW_GET_FUN(__glewGetTextureHandleNV) +#define glGetTextureSamplerHandleNV GLEW_GET_FUN(__glewGetTextureSamplerHandleNV) +#define glIsImageHandleResidentNV GLEW_GET_FUN(__glewIsImageHandleResidentNV) +#define glIsTextureHandleResidentNV GLEW_GET_FUN(__glewIsTextureHandleResidentNV) +#define glMakeImageHandleNonResidentNV GLEW_GET_FUN(__glewMakeImageHandleNonResidentNV) +#define glMakeImageHandleResidentNV GLEW_GET_FUN(__glewMakeImageHandleResidentNV) +#define glMakeTextureHandleNonResidentNV GLEW_GET_FUN(__glewMakeTextureHandleNonResidentNV) +#define glMakeTextureHandleResidentNV GLEW_GET_FUN(__glewMakeTextureHandleResidentNV) +#define glProgramUniformHandleui64NV GLEW_GET_FUN(__glewProgramUniformHandleui64NV) +#define glProgramUniformHandleui64vNV GLEW_GET_FUN(__glewProgramUniformHandleui64vNV) +#define glUniformHandleui64NV GLEW_GET_FUN(__glewUniformHandleui64NV) +#define glUniformHandleui64vNV GLEW_GET_FUN(__glewUniformHandleui64vNV) + +#define GLEW_NV_bindless_texture GLEW_GET_VAR(__GLEW_NV_bindless_texture) + +#endif /* GL_NV_bindless_texture */ + +/* --------------------- GL_NV_blend_equation_advanced --------------------- */ + +#ifndef GL_NV_blend_equation_advanced +#define GL_NV_blend_equation_advanced 1 + +#define GL_XOR_NV 0x1506 +#define GL_RED_NV 0x1903 +#define GL_GREEN_NV 0x1904 +#define GL_BLUE_NV 0x1905 +#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280 +#define GL_BLEND_OVERLAP_NV 0x9281 +#define GL_UNCORRELATED_NV 0x9282 +#define GL_DISJOINT_NV 0x9283 +#define GL_CONJOINT_NV 0x9284 +#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285 +#define GL_SRC_NV 0x9286 +#define GL_DST_NV 0x9287 +#define GL_SRC_OVER_NV 0x9288 +#define GL_DST_OVER_NV 0x9289 +#define GL_SRC_IN_NV 0x928A +#define GL_DST_IN_NV 0x928B +#define GL_SRC_OUT_NV 0x928C +#define GL_DST_OUT_NV 0x928D +#define GL_SRC_ATOP_NV 0x928E +#define GL_DST_ATOP_NV 0x928F +#define GL_PLUS_NV 0x9291 +#define GL_PLUS_DARKER_NV 0x9292 +#define GL_MULTIPLY_NV 0x9294 +#define GL_SCREEN_NV 0x9295 +#define GL_OVERLAY_NV 0x9296 +#define GL_DARKEN_NV 0x9297 +#define GL_LIGHTEN_NV 0x9298 +#define GL_COLORDODGE_NV 0x9299 +#define GL_COLORBURN_NV 0x929A +#define GL_HARDLIGHT_NV 0x929B +#define GL_SOFTLIGHT_NV 0x929C +#define GL_DIFFERENCE_NV 0x929E +#define GL_MINUS_NV 0x929F +#define GL_EXCLUSION_NV 0x92A0 +#define GL_CONTRAST_NV 0x92A1 +#define GL_INVERT_RGB_NV 0x92A3 +#define GL_LINEARDODGE_NV 0x92A4 +#define GL_LINEARBURN_NV 0x92A5 +#define GL_VIVIDLIGHT_NV 0x92A6 +#define GL_LINEARLIGHT_NV 0x92A7 +#define GL_PINLIGHT_NV 0x92A8 +#define GL_HARDMIX_NV 0x92A9 +#define GL_HSL_HUE_NV 0x92AD +#define GL_HSL_SATURATION_NV 0x92AE +#define GL_HSL_COLOR_NV 0x92AF +#define GL_HSL_LUMINOSITY_NV 0x92B0 +#define GL_PLUS_CLAMPED_NV 0x92B1 +#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2 +#define GL_MINUS_CLAMPED_NV 0x92B3 +#define GL_INVERT_OVG_NV 0x92B4 + +typedef void (GLAPIENTRY * PFNGLBLENDBARRIERNVPROC) (void); +typedef void (GLAPIENTRY * PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value); + +#define glBlendBarrierNV GLEW_GET_FUN(__glewBlendBarrierNV) +#define glBlendParameteriNV GLEW_GET_FUN(__glewBlendParameteriNV) + +#define GLEW_NV_blend_equation_advanced GLEW_GET_VAR(__GLEW_NV_blend_equation_advanced) + +#endif /* GL_NV_blend_equation_advanced */ + +/* ----------------- GL_NV_blend_equation_advanced_coherent ---------------- */ + +#ifndef GL_NV_blend_equation_advanced_coherent +#define GL_NV_blend_equation_advanced_coherent 1 + +#define GLEW_NV_blend_equation_advanced_coherent GLEW_GET_VAR(__GLEW_NV_blend_equation_advanced_coherent) + +#endif /* GL_NV_blend_equation_advanced_coherent */ + +/* --------------------------- GL_NV_blend_square -------------------------- */ + +#ifndef GL_NV_blend_square +#define GL_NV_blend_square 1 + +#define GLEW_NV_blend_square GLEW_GET_VAR(__GLEW_NV_blend_square) + +#endif /* GL_NV_blend_square */ + +/* ------------------------- GL_NV_compute_program5 ------------------------ */ + +#ifndef GL_NV_compute_program5 +#define GL_NV_compute_program5 1 + +#define GL_COMPUTE_PROGRAM_NV 0x90FB +#define GL_COMPUTE_PROGRAM_PARAMETER_BUFFER_NV 0x90FC + +#define GLEW_NV_compute_program5 GLEW_GET_VAR(__GLEW_NV_compute_program5) + +#endif /* GL_NV_compute_program5 */ + +/* ------------------------ GL_NV_conditional_render ----------------------- */ + +#ifndef GL_NV_conditional_render +#define GL_NV_conditional_render 1 + +#define GL_QUERY_WAIT_NV 0x8E13 +#define GL_QUERY_NO_WAIT_NV 0x8E14 +#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 + +typedef void (GLAPIENTRY * PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode); +typedef void (GLAPIENTRY * PFNGLENDCONDITIONALRENDERNVPROC) (void); + +#define glBeginConditionalRenderNV GLEW_GET_FUN(__glewBeginConditionalRenderNV) +#define glEndConditionalRenderNV GLEW_GET_FUN(__glewEndConditionalRenderNV) + +#define GLEW_NV_conditional_render GLEW_GET_VAR(__GLEW_NV_conditional_render) + +#endif /* GL_NV_conditional_render */ + +/* ----------------------- GL_NV_conservative_raster ----------------------- */ + +#ifndef GL_NV_conservative_raster +#define GL_NV_conservative_raster 1 + +#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346 +#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347 +#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348 +#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349 + +typedef void (GLAPIENTRY * PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits); + +#define glSubpixelPrecisionBiasNV GLEW_GET_FUN(__glewSubpixelPrecisionBiasNV) + +#define GLEW_NV_conservative_raster GLEW_GET_VAR(__GLEW_NV_conservative_raster) + +#endif /* GL_NV_conservative_raster */ + +/* -------------------- GL_NV_conservative_raster_dilate ------------------- */ + +#ifndef GL_NV_conservative_raster_dilate +#define GL_NV_conservative_raster_dilate 1 + +#define GL_CONSERVATIVE_RASTER_DILATE_NV 0x9379 +#define GL_CONSERVATIVE_RASTER_DILATE_RANGE_NV 0x937A +#define GL_CONSERVATIVE_RASTER_DILATE_GRANULARITY_NV 0x937B + +typedef void (GLAPIENTRY * PFNGLCONSERVATIVERASTERPARAMETERFNVPROC) (GLenum pname, GLfloat value); + +#define glConservativeRasterParameterfNV GLEW_GET_FUN(__glewConservativeRasterParameterfNV) + +#define GLEW_NV_conservative_raster_dilate GLEW_GET_VAR(__GLEW_NV_conservative_raster_dilate) + +#endif /* GL_NV_conservative_raster_dilate */ + +/* ----------------------- GL_NV_copy_depth_to_color ----------------------- */ + +#ifndef GL_NV_copy_depth_to_color +#define GL_NV_copy_depth_to_color 1 + +#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E +#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F + +#define GLEW_NV_copy_depth_to_color GLEW_GET_VAR(__GLEW_NV_copy_depth_to_color) + +#endif /* GL_NV_copy_depth_to_color */ + +/* ---------------------------- GL_NV_copy_image --------------------------- */ + +#ifndef GL_NV_copy_image +#define GL_NV_copy_image 1 + +typedef void (GLAPIENTRY * PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); + +#define glCopyImageSubDataNV GLEW_GET_FUN(__glewCopyImageSubDataNV) + +#define GLEW_NV_copy_image GLEW_GET_VAR(__GLEW_NV_copy_image) + +#endif /* GL_NV_copy_image */ + +/* -------------------------- GL_NV_deep_texture3D ------------------------- */ + +#ifndef GL_NV_deep_texture3D +#define GL_NV_deep_texture3D 1 + +#define GL_MAX_DEEP_3D_TEXTURE_WIDTH_HEIGHT_NV 0x90D0 +#define GL_MAX_DEEP_3D_TEXTURE_DEPTH_NV 0x90D1 + +#define GLEW_NV_deep_texture3D GLEW_GET_VAR(__GLEW_NV_deep_texture3D) + +#endif /* GL_NV_deep_texture3D */ + +/* ------------------------ GL_NV_depth_buffer_float ----------------------- */ + +#ifndef GL_NV_depth_buffer_float +#define GL_NV_depth_buffer_float 1 + +#define GL_DEPTH_COMPONENT32F_NV 0x8DAB +#define GL_DEPTH32F_STENCIL8_NV 0x8DAC +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD +#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF + +typedef void (GLAPIENTRY * PFNGLCLEARDEPTHDNVPROC) (GLdouble depth); +typedef void (GLAPIENTRY * PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax); +typedef void (GLAPIENTRY * PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar); + +#define glClearDepthdNV GLEW_GET_FUN(__glewClearDepthdNV) +#define glDepthBoundsdNV GLEW_GET_FUN(__glewDepthBoundsdNV) +#define glDepthRangedNV GLEW_GET_FUN(__glewDepthRangedNV) + +#define GLEW_NV_depth_buffer_float GLEW_GET_VAR(__GLEW_NV_depth_buffer_float) + +#endif /* GL_NV_depth_buffer_float */ + +/* --------------------------- GL_NV_depth_clamp --------------------------- */ + +#ifndef GL_NV_depth_clamp +#define GL_NV_depth_clamp 1 + +#define GL_DEPTH_CLAMP_NV 0x864F + +#define GLEW_NV_depth_clamp GLEW_GET_VAR(__GLEW_NV_depth_clamp) + +#endif /* GL_NV_depth_clamp */ + +/* ---------------------- GL_NV_depth_range_unclamped ---------------------- */ + +#ifndef GL_NV_depth_range_unclamped +#define GL_NV_depth_range_unclamped 1 + +#define GL_SAMPLE_COUNT_BITS_NV 0x8864 +#define GL_CURRENT_SAMPLE_COUNT_QUERY_NV 0x8865 +#define GL_QUERY_RESULT_NV 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_NV 0x8867 +#define GL_SAMPLE_COUNT_NV 0x8914 + +#define GLEW_NV_depth_range_unclamped GLEW_GET_VAR(__GLEW_NV_depth_range_unclamped) + +#endif /* GL_NV_depth_range_unclamped */ + +/* --------------------------- GL_NV_draw_texture -------------------------- */ + +#ifndef GL_NV_draw_texture +#define GL_NV_draw_texture 1 + +typedef void (GLAPIENTRY * PFNGLDRAWTEXTURENVPROC) (GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); + +#define glDrawTextureNV GLEW_GET_FUN(__glewDrawTextureNV) + +#define GLEW_NV_draw_texture GLEW_GET_VAR(__GLEW_NV_draw_texture) + +#endif /* GL_NV_draw_texture */ + +/* ---------------------------- GL_NV_evaluators --------------------------- */ + +#ifndef GL_NV_evaluators +#define GL_NV_evaluators 1 + +#define GL_EVAL_2D_NV 0x86C0 +#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 +#define GL_MAP_TESSELLATION_NV 0x86C2 +#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 +#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 +#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 +#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 +#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 +#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 +#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 +#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA +#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB +#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC +#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD +#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE +#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF +#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 +#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 +#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 +#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 +#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 +#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 +#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 +#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 + +typedef void (GLAPIENTRY * PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); +typedef void (GLAPIENTRY * PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void *points); +typedef void (GLAPIENTRY * PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void *points); +typedef void (GLAPIENTRY * PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint* params); + +#define glEvalMapsNV GLEW_GET_FUN(__glewEvalMapsNV) +#define glGetMapAttribParameterfvNV GLEW_GET_FUN(__glewGetMapAttribParameterfvNV) +#define glGetMapAttribParameterivNV GLEW_GET_FUN(__glewGetMapAttribParameterivNV) +#define glGetMapControlPointsNV GLEW_GET_FUN(__glewGetMapControlPointsNV) +#define glGetMapParameterfvNV GLEW_GET_FUN(__glewGetMapParameterfvNV) +#define glGetMapParameterivNV GLEW_GET_FUN(__glewGetMapParameterivNV) +#define glMapControlPointsNV GLEW_GET_FUN(__glewMapControlPointsNV) +#define glMapParameterfvNV GLEW_GET_FUN(__glewMapParameterfvNV) +#define glMapParameterivNV GLEW_GET_FUN(__glewMapParameterivNV) + +#define GLEW_NV_evaluators GLEW_GET_VAR(__GLEW_NV_evaluators) + +#endif /* GL_NV_evaluators */ + +/* ----------------------- GL_NV_explicit_multisample ---------------------- */ + +#ifndef GL_NV_explicit_multisample +#define GL_NV_explicit_multisample 1 + +#define GL_SAMPLE_POSITION_NV 0x8E50 +#define GL_SAMPLE_MASK_NV 0x8E51 +#define GL_SAMPLE_MASK_VALUE_NV 0x8E52 +#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53 +#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54 +#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55 +#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56 +#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57 +#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58 +#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59 + +typedef void (GLAPIENTRY * PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat* val); +typedef void (GLAPIENTRY * PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask); +typedef void (GLAPIENTRY * PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer); + +#define glGetMultisamplefvNV GLEW_GET_FUN(__glewGetMultisamplefvNV) +#define glSampleMaskIndexedNV GLEW_GET_FUN(__glewSampleMaskIndexedNV) +#define glTexRenderbufferNV GLEW_GET_FUN(__glewTexRenderbufferNV) + +#define GLEW_NV_explicit_multisample GLEW_GET_VAR(__GLEW_NV_explicit_multisample) + +#endif /* GL_NV_explicit_multisample */ + +/* ------------------------------ GL_NV_fence ------------------------------ */ + +#ifndef GL_NV_fence +#define GL_NV_fence 1 + +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 + +typedef void (GLAPIENTRY * PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint* fences); +typedef void (GLAPIENTRY * PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (GLAPIENTRY * PFNGLGENFENCESNVPROC) (GLsizei n, GLuint* fences); +typedef void (GLAPIENTRY * PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISFENCENVPROC) (GLuint fence); +typedef void (GLAPIENTRY * PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +typedef GLboolean (GLAPIENTRY * PFNGLTESTFENCENVPROC) (GLuint fence); + +#define glDeleteFencesNV GLEW_GET_FUN(__glewDeleteFencesNV) +#define glFinishFenceNV GLEW_GET_FUN(__glewFinishFenceNV) +#define glGenFencesNV GLEW_GET_FUN(__glewGenFencesNV) +#define glGetFenceivNV GLEW_GET_FUN(__glewGetFenceivNV) +#define glIsFenceNV GLEW_GET_FUN(__glewIsFenceNV) +#define glSetFenceNV GLEW_GET_FUN(__glewSetFenceNV) +#define glTestFenceNV GLEW_GET_FUN(__glewTestFenceNV) + +#define GLEW_NV_fence GLEW_GET_VAR(__GLEW_NV_fence) + +#endif /* GL_NV_fence */ + +/* -------------------------- GL_NV_fill_rectangle ------------------------- */ + +#ifndef GL_NV_fill_rectangle +#define GL_NV_fill_rectangle 1 + +#define GL_FILL_RECTANGLE_NV 0x933C + +#define GLEW_NV_fill_rectangle GLEW_GET_VAR(__GLEW_NV_fill_rectangle) + +#endif /* GL_NV_fill_rectangle */ + +/* --------------------------- GL_NV_float_buffer -------------------------- */ + +#ifndef GL_NV_float_buffer +#define GL_NV_float_buffer 1 + +#define GL_FLOAT_R_NV 0x8880 +#define GL_FLOAT_RG_NV 0x8881 +#define GL_FLOAT_RGB_NV 0x8882 +#define GL_FLOAT_RGBA_NV 0x8883 +#define GL_FLOAT_R16_NV 0x8884 +#define GL_FLOAT_R32_NV 0x8885 +#define GL_FLOAT_RG16_NV 0x8886 +#define GL_FLOAT_RG32_NV 0x8887 +#define GL_FLOAT_RGB16_NV 0x8888 +#define GL_FLOAT_RGB32_NV 0x8889 +#define GL_FLOAT_RGBA16_NV 0x888A +#define GL_FLOAT_RGBA32_NV 0x888B +#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C +#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D +#define GL_FLOAT_RGBA_MODE_NV 0x888E + +#define GLEW_NV_float_buffer GLEW_GET_VAR(__GLEW_NV_float_buffer) + +#endif /* GL_NV_float_buffer */ + +/* --------------------------- GL_NV_fog_distance -------------------------- */ + +#ifndef GL_NV_fog_distance +#define GL_NV_fog_distance 1 + +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C + +#define GLEW_NV_fog_distance GLEW_GET_VAR(__GLEW_NV_fog_distance) + +#endif /* GL_NV_fog_distance */ + +/* -------------------- GL_NV_fragment_coverage_to_color ------------------- */ + +#ifndef GL_NV_fragment_coverage_to_color +#define GL_NV_fragment_coverage_to_color 1 + +#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD +#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE + +typedef void (GLAPIENTRY * PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color); + +#define glFragmentCoverageColorNV GLEW_GET_FUN(__glewFragmentCoverageColorNV) + +#define GLEW_NV_fragment_coverage_to_color GLEW_GET_VAR(__GLEW_NV_fragment_coverage_to_color) + +#endif /* GL_NV_fragment_coverage_to_color */ + +/* ------------------------- GL_NV_fragment_program ------------------------ */ + +#ifndef GL_NV_fragment_program +#define GL_NV_fragment_program 1 + +#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 +#define GL_FRAGMENT_PROGRAM_NV 0x8870 +#define GL_MAX_TEXTURE_COORDS_NV 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 +#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 +#define GL_PROGRAM_ERROR_STRING_NV 0x8874 + +typedef void (GLAPIENTRY * PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLdouble *params); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLfloat *params); +typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, const GLdouble v[]); +typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, const GLfloat v[]); + +#define glGetProgramNamedParameterdvNV GLEW_GET_FUN(__glewGetProgramNamedParameterdvNV) +#define glGetProgramNamedParameterfvNV GLEW_GET_FUN(__glewGetProgramNamedParameterfvNV) +#define glProgramNamedParameter4dNV GLEW_GET_FUN(__glewProgramNamedParameter4dNV) +#define glProgramNamedParameter4dvNV GLEW_GET_FUN(__glewProgramNamedParameter4dvNV) +#define glProgramNamedParameter4fNV GLEW_GET_FUN(__glewProgramNamedParameter4fNV) +#define glProgramNamedParameter4fvNV GLEW_GET_FUN(__glewProgramNamedParameter4fvNV) + +#define GLEW_NV_fragment_program GLEW_GET_VAR(__GLEW_NV_fragment_program) + +#endif /* GL_NV_fragment_program */ + +/* ------------------------ GL_NV_fragment_program2 ------------------------ */ + +#ifndef GL_NV_fragment_program2 +#define GL_NV_fragment_program2 1 + +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 +#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 +#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 +#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 + +#define GLEW_NV_fragment_program2 GLEW_GET_VAR(__GLEW_NV_fragment_program2) + +#endif /* GL_NV_fragment_program2 */ + +/* ------------------------ GL_NV_fragment_program4 ------------------------ */ + +#ifndef GL_NV_fragment_program4 +#define GL_NV_fragment_program4 1 + +#define GLEW_NV_fragment_program4 GLEW_GET_VAR(__GLEW_NV_fragment_program4) + +#endif /* GL_NV_fragment_program4 */ + +/* --------------------- GL_NV_fragment_program_option --------------------- */ + +#ifndef GL_NV_fragment_program_option +#define GL_NV_fragment_program_option 1 + +#define GLEW_NV_fragment_program_option GLEW_GET_VAR(__GLEW_NV_fragment_program_option) + +#endif /* GL_NV_fragment_program_option */ + +/* -------------------- GL_NV_fragment_shader_interlock -------------------- */ + +#ifndef GL_NV_fragment_shader_interlock +#define GL_NV_fragment_shader_interlock 1 + +#define GLEW_NV_fragment_shader_interlock GLEW_GET_VAR(__GLEW_NV_fragment_shader_interlock) + +#endif /* GL_NV_fragment_shader_interlock */ + +/* -------------------- GL_NV_framebuffer_mixed_samples -------------------- */ + +#ifndef GL_NV_framebuffer_mixed_samples +#define GL_NV_framebuffer_mixed_samples 1 + +#define GL_COLOR_SAMPLES_NV 0x8E20 +#define GL_RASTER_MULTISAMPLE_EXT 0x9327 +#define GL_RASTER_SAMPLES_EXT 0x9328 +#define GL_MAX_RASTER_SAMPLES_EXT 0x9329 +#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A +#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B +#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C +#define GL_DEPTH_SAMPLES_NV 0x932D +#define GL_STENCIL_SAMPLES_NV 0x932E +#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F +#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330 +#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331 +#define GL_COVERAGE_MODULATION_NV 0x9332 +#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 + +#define GLEW_NV_framebuffer_mixed_samples GLEW_GET_VAR(__GLEW_NV_framebuffer_mixed_samples) + +#endif /* GL_NV_framebuffer_mixed_samples */ + +/* ----------------- GL_NV_framebuffer_multisample_coverage ---------------- */ + +#ifndef GL_NV_framebuffer_multisample_coverage +#define GL_NV_framebuffer_multisample_coverage 1 + +#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB +#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 +#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11 +#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12 + +typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); + +#define glRenderbufferStorageMultisampleCoverageNV GLEW_GET_FUN(__glewRenderbufferStorageMultisampleCoverageNV) + +#define GLEW_NV_framebuffer_multisample_coverage GLEW_GET_VAR(__GLEW_NV_framebuffer_multisample_coverage) + +#endif /* GL_NV_framebuffer_multisample_coverage */ + +/* ------------------------ GL_NV_geometry_program4 ------------------------ */ + +#ifndef GL_NV_geometry_program4 +#define GL_NV_geometry_program4 1 + +#define GL_GEOMETRY_PROGRAM_NV 0x8C26 +#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27 +#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 + +typedef void (GLAPIENTRY * PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit); + +#define glProgramVertexLimitNV GLEW_GET_FUN(__glewProgramVertexLimitNV) + +#define GLEW_NV_geometry_program4 GLEW_GET_VAR(__GLEW_NV_geometry_program4) + +#endif /* GL_NV_geometry_program4 */ + +/* ------------------------- GL_NV_geometry_shader4 ------------------------ */ + +#ifndef GL_NV_geometry_shader4 +#define GL_NV_geometry_shader4 1 + +#define GLEW_NV_geometry_shader4 GLEW_GET_VAR(__GLEW_NV_geometry_shader4) + +#endif /* GL_NV_geometry_shader4 */ + +/* ------------------- GL_NV_geometry_shader_passthrough ------------------- */ + +#ifndef GL_NV_geometry_shader_passthrough +#define GL_NV_geometry_shader_passthrough 1 + +#define GLEW_NV_geometry_shader_passthrough GLEW_GET_VAR(__GLEW_NV_geometry_shader_passthrough) + +#endif /* GL_NV_geometry_shader_passthrough */ + +/* --------------------------- GL_NV_gpu_program4 -------------------------- */ + +#ifndef GL_NV_gpu_program4 +#define GL_NV_gpu_program4 1 + +#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905 +#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906 +#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907 +#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908 +#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909 +#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5 +#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6 + +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); + +#define glProgramEnvParameterI4iNV GLEW_GET_FUN(__glewProgramEnvParameterI4iNV) +#define glProgramEnvParameterI4ivNV GLEW_GET_FUN(__glewProgramEnvParameterI4ivNV) +#define glProgramEnvParameterI4uiNV GLEW_GET_FUN(__glewProgramEnvParameterI4uiNV) +#define glProgramEnvParameterI4uivNV GLEW_GET_FUN(__glewProgramEnvParameterI4uivNV) +#define glProgramEnvParametersI4ivNV GLEW_GET_FUN(__glewProgramEnvParametersI4ivNV) +#define glProgramEnvParametersI4uivNV GLEW_GET_FUN(__glewProgramEnvParametersI4uivNV) +#define glProgramLocalParameterI4iNV GLEW_GET_FUN(__glewProgramLocalParameterI4iNV) +#define glProgramLocalParameterI4ivNV GLEW_GET_FUN(__glewProgramLocalParameterI4ivNV) +#define glProgramLocalParameterI4uiNV GLEW_GET_FUN(__glewProgramLocalParameterI4uiNV) +#define glProgramLocalParameterI4uivNV GLEW_GET_FUN(__glewProgramLocalParameterI4uivNV) +#define glProgramLocalParametersI4ivNV GLEW_GET_FUN(__glewProgramLocalParametersI4ivNV) +#define glProgramLocalParametersI4uivNV GLEW_GET_FUN(__glewProgramLocalParametersI4uivNV) + +#define GLEW_NV_gpu_program4 GLEW_GET_VAR(__GLEW_NV_gpu_program4) + +#endif /* GL_NV_gpu_program4 */ + +/* --------------------------- GL_NV_gpu_program5 -------------------------- */ + +#ifndef GL_NV_gpu_program5 +#define GL_NV_gpu_program5 1 + +#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C +#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F + +#define GLEW_NV_gpu_program5 GLEW_GET_VAR(__GLEW_NV_gpu_program5) + +#endif /* GL_NV_gpu_program5 */ + +/* -------------------- GL_NV_gpu_program5_mem_extended -------------------- */ + +#ifndef GL_NV_gpu_program5_mem_extended +#define GL_NV_gpu_program5_mem_extended 1 + +#define GLEW_NV_gpu_program5_mem_extended GLEW_GET_VAR(__GLEW_NV_gpu_program5_mem_extended) + +#endif /* GL_NV_gpu_program5_mem_extended */ + +/* ------------------------- GL_NV_gpu_program_fp64 ------------------------ */ + +#ifndef GL_NV_gpu_program_fp64 +#define GL_NV_gpu_program_fp64 1 + +#define GLEW_NV_gpu_program_fp64 GLEW_GET_VAR(__GLEW_NV_gpu_program_fp64) + +#endif /* GL_NV_gpu_program_fp64 */ + +/* --------------------------- GL_NV_gpu_shader5 --------------------------- */ + +#ifndef GL_NV_gpu_shader5 +#define GL_NV_gpu_shader5 1 + +#define GL_INT64_NV 0x140E +#define GL_UNSIGNED_INT64_NV 0x140F +#define GL_INT8_NV 0x8FE0 +#define GL_INT8_VEC2_NV 0x8FE1 +#define GL_INT8_VEC3_NV 0x8FE2 +#define GL_INT8_VEC4_NV 0x8FE3 +#define GL_INT16_NV 0x8FE4 +#define GL_INT16_VEC2_NV 0x8FE5 +#define GL_INT16_VEC3_NV 0x8FE6 +#define GL_INT16_VEC4_NV 0x8FE7 +#define GL_INT64_VEC2_NV 0x8FE9 +#define GL_INT64_VEC3_NV 0x8FEA +#define GL_INT64_VEC4_NV 0x8FEB +#define GL_UNSIGNED_INT8_NV 0x8FEC +#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED +#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE +#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF +#define GL_UNSIGNED_INT16_NV 0x8FF0 +#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 +#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 +#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 +#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 +#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 +#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 +#define GL_FLOAT16_NV 0x8FF8 +#define GL_FLOAT16_VEC2_NV 0x8FF9 +#define GL_FLOAT16_VEC3_NV 0x8FFA +#define GL_FLOAT16_VEC4_NV 0x8FFB + +typedef void (GLAPIENTRY * PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT* params); +typedef void (GLAPIENTRY * PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT* value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); +typedef void (GLAPIENTRY * PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x); +typedef void (GLAPIENTRY * PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); +typedef void (GLAPIENTRY * PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (GLAPIENTRY * PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (GLAPIENTRY * PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (GLAPIENTRY * PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (GLAPIENTRY * PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (GLAPIENTRY * PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value); + +#define glGetUniformi64vNV GLEW_GET_FUN(__glewGetUniformi64vNV) +#define glGetUniformui64vNV GLEW_GET_FUN(__glewGetUniformui64vNV) +#define glProgramUniform1i64NV GLEW_GET_FUN(__glewProgramUniform1i64NV) +#define glProgramUniform1i64vNV GLEW_GET_FUN(__glewProgramUniform1i64vNV) +#define glProgramUniform1ui64NV GLEW_GET_FUN(__glewProgramUniform1ui64NV) +#define glProgramUniform1ui64vNV GLEW_GET_FUN(__glewProgramUniform1ui64vNV) +#define glProgramUniform2i64NV GLEW_GET_FUN(__glewProgramUniform2i64NV) +#define glProgramUniform2i64vNV GLEW_GET_FUN(__glewProgramUniform2i64vNV) +#define glProgramUniform2ui64NV GLEW_GET_FUN(__glewProgramUniform2ui64NV) +#define glProgramUniform2ui64vNV GLEW_GET_FUN(__glewProgramUniform2ui64vNV) +#define glProgramUniform3i64NV GLEW_GET_FUN(__glewProgramUniform3i64NV) +#define glProgramUniform3i64vNV GLEW_GET_FUN(__glewProgramUniform3i64vNV) +#define glProgramUniform3ui64NV GLEW_GET_FUN(__glewProgramUniform3ui64NV) +#define glProgramUniform3ui64vNV GLEW_GET_FUN(__glewProgramUniform3ui64vNV) +#define glProgramUniform4i64NV GLEW_GET_FUN(__glewProgramUniform4i64NV) +#define glProgramUniform4i64vNV GLEW_GET_FUN(__glewProgramUniform4i64vNV) +#define glProgramUniform4ui64NV GLEW_GET_FUN(__glewProgramUniform4ui64NV) +#define glProgramUniform4ui64vNV GLEW_GET_FUN(__glewProgramUniform4ui64vNV) +#define glUniform1i64NV GLEW_GET_FUN(__glewUniform1i64NV) +#define glUniform1i64vNV GLEW_GET_FUN(__glewUniform1i64vNV) +#define glUniform1ui64NV GLEW_GET_FUN(__glewUniform1ui64NV) +#define glUniform1ui64vNV GLEW_GET_FUN(__glewUniform1ui64vNV) +#define glUniform2i64NV GLEW_GET_FUN(__glewUniform2i64NV) +#define glUniform2i64vNV GLEW_GET_FUN(__glewUniform2i64vNV) +#define glUniform2ui64NV GLEW_GET_FUN(__glewUniform2ui64NV) +#define glUniform2ui64vNV GLEW_GET_FUN(__glewUniform2ui64vNV) +#define glUniform3i64NV GLEW_GET_FUN(__glewUniform3i64NV) +#define glUniform3i64vNV GLEW_GET_FUN(__glewUniform3i64vNV) +#define glUniform3ui64NV GLEW_GET_FUN(__glewUniform3ui64NV) +#define glUniform3ui64vNV GLEW_GET_FUN(__glewUniform3ui64vNV) +#define glUniform4i64NV GLEW_GET_FUN(__glewUniform4i64NV) +#define glUniform4i64vNV GLEW_GET_FUN(__glewUniform4i64vNV) +#define glUniform4ui64NV GLEW_GET_FUN(__glewUniform4ui64NV) +#define glUniform4ui64vNV GLEW_GET_FUN(__glewUniform4ui64vNV) + +#define GLEW_NV_gpu_shader5 GLEW_GET_VAR(__GLEW_NV_gpu_shader5) + +#endif /* GL_NV_gpu_shader5 */ + +/* ---------------------------- GL_NV_half_float --------------------------- */ + +#ifndef GL_NV_half_float +#define GL_NV_half_float 1 + +#define GL_HALF_FLOAT_NV 0x140B + +typedef unsigned short GLhalf; + +typedef void (GLAPIENTRY * PFNGLCOLOR3HNVPROC) (GLhalf red, GLhalf green, GLhalf blue); +typedef void (GLAPIENTRY * PFNGLCOLOR3HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLCOLOR4HNVPROC) (GLhalf red, GLhalf green, GLhalf blue, GLhalf alpha); +typedef void (GLAPIENTRY * PFNGLCOLOR4HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLFOGCOORDHNVPROC) (GLhalf fog); +typedef void (GLAPIENTRY * PFNGLFOGCOORDHVNVPROC) (const GLhalf* fog); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalf s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalf s, GLhalf t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalf s, GLhalf t, GLhalf r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalf s, GLhalf t, GLhalf r, GLhalf q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLNORMAL3HNVPROC) (GLhalf nx, GLhalf ny, GLhalf nz); +typedef void (GLAPIENTRY * PFNGLNORMAL3HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3HNVPROC) (GLhalf red, GLhalf green, GLhalf blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD1HNVPROC) (GLhalf s); +typedef void (GLAPIENTRY * PFNGLTEXCOORD1HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2HNVPROC) (GLhalf s, GLhalf t); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD3HNVPROC) (GLhalf s, GLhalf t, GLhalf r); +typedef void (GLAPIENTRY * PFNGLTEXCOORD3HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD4HNVPROC) (GLhalf s, GLhalf t, GLhalf r, GLhalf q); +typedef void (GLAPIENTRY * PFNGLTEXCOORD4HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEX2HNVPROC) (GLhalf x, GLhalf y); +typedef void (GLAPIENTRY * PFNGLVERTEX2HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEX3HNVPROC) (GLhalf x, GLhalf y, GLhalf z); +typedef void (GLAPIENTRY * PFNGLVERTEX3HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEX4HNVPROC) (GLhalf x, GLhalf y, GLhalf z, GLhalf w); +typedef void (GLAPIENTRY * PFNGLVERTEX4HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalf x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalf x, GLhalf y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalf x, GLhalf y, GLhalf z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalf x, GLhalf y, GLhalf z, GLhalf w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTHNVPROC) (GLhalf weight); +typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalf* weight); + +#define glColor3hNV GLEW_GET_FUN(__glewColor3hNV) +#define glColor3hvNV GLEW_GET_FUN(__glewColor3hvNV) +#define glColor4hNV GLEW_GET_FUN(__glewColor4hNV) +#define glColor4hvNV GLEW_GET_FUN(__glewColor4hvNV) +#define glFogCoordhNV GLEW_GET_FUN(__glewFogCoordhNV) +#define glFogCoordhvNV GLEW_GET_FUN(__glewFogCoordhvNV) +#define glMultiTexCoord1hNV GLEW_GET_FUN(__glewMultiTexCoord1hNV) +#define glMultiTexCoord1hvNV GLEW_GET_FUN(__glewMultiTexCoord1hvNV) +#define glMultiTexCoord2hNV GLEW_GET_FUN(__glewMultiTexCoord2hNV) +#define glMultiTexCoord2hvNV GLEW_GET_FUN(__glewMultiTexCoord2hvNV) +#define glMultiTexCoord3hNV GLEW_GET_FUN(__glewMultiTexCoord3hNV) +#define glMultiTexCoord3hvNV GLEW_GET_FUN(__glewMultiTexCoord3hvNV) +#define glMultiTexCoord4hNV GLEW_GET_FUN(__glewMultiTexCoord4hNV) +#define glMultiTexCoord4hvNV GLEW_GET_FUN(__glewMultiTexCoord4hvNV) +#define glNormal3hNV GLEW_GET_FUN(__glewNormal3hNV) +#define glNormal3hvNV GLEW_GET_FUN(__glewNormal3hvNV) +#define glSecondaryColor3hNV GLEW_GET_FUN(__glewSecondaryColor3hNV) +#define glSecondaryColor3hvNV GLEW_GET_FUN(__glewSecondaryColor3hvNV) +#define glTexCoord1hNV GLEW_GET_FUN(__glewTexCoord1hNV) +#define glTexCoord1hvNV GLEW_GET_FUN(__glewTexCoord1hvNV) +#define glTexCoord2hNV GLEW_GET_FUN(__glewTexCoord2hNV) +#define glTexCoord2hvNV GLEW_GET_FUN(__glewTexCoord2hvNV) +#define glTexCoord3hNV GLEW_GET_FUN(__glewTexCoord3hNV) +#define glTexCoord3hvNV GLEW_GET_FUN(__glewTexCoord3hvNV) +#define glTexCoord4hNV GLEW_GET_FUN(__glewTexCoord4hNV) +#define glTexCoord4hvNV GLEW_GET_FUN(__glewTexCoord4hvNV) +#define glVertex2hNV GLEW_GET_FUN(__glewVertex2hNV) +#define glVertex2hvNV GLEW_GET_FUN(__glewVertex2hvNV) +#define glVertex3hNV GLEW_GET_FUN(__glewVertex3hNV) +#define glVertex3hvNV GLEW_GET_FUN(__glewVertex3hvNV) +#define glVertex4hNV GLEW_GET_FUN(__glewVertex4hNV) +#define glVertex4hvNV GLEW_GET_FUN(__glewVertex4hvNV) +#define glVertexAttrib1hNV GLEW_GET_FUN(__glewVertexAttrib1hNV) +#define glVertexAttrib1hvNV GLEW_GET_FUN(__glewVertexAttrib1hvNV) +#define glVertexAttrib2hNV GLEW_GET_FUN(__glewVertexAttrib2hNV) +#define glVertexAttrib2hvNV GLEW_GET_FUN(__glewVertexAttrib2hvNV) +#define glVertexAttrib3hNV GLEW_GET_FUN(__glewVertexAttrib3hNV) +#define glVertexAttrib3hvNV GLEW_GET_FUN(__glewVertexAttrib3hvNV) +#define glVertexAttrib4hNV GLEW_GET_FUN(__glewVertexAttrib4hNV) +#define glVertexAttrib4hvNV GLEW_GET_FUN(__glewVertexAttrib4hvNV) +#define glVertexAttribs1hvNV GLEW_GET_FUN(__glewVertexAttribs1hvNV) +#define glVertexAttribs2hvNV GLEW_GET_FUN(__glewVertexAttribs2hvNV) +#define glVertexAttribs3hvNV GLEW_GET_FUN(__glewVertexAttribs3hvNV) +#define glVertexAttribs4hvNV GLEW_GET_FUN(__glewVertexAttribs4hvNV) +#define glVertexWeighthNV GLEW_GET_FUN(__glewVertexWeighthNV) +#define glVertexWeighthvNV GLEW_GET_FUN(__glewVertexWeighthvNV) + +#define GLEW_NV_half_float GLEW_GET_VAR(__GLEW_NV_half_float) + +#endif /* GL_NV_half_float */ + +/* ------------------- GL_NV_internalformat_sample_query ------------------- */ + +#ifndef GL_NV_internalformat_sample_query +#define GL_NV_internalformat_sample_query 1 + +#define GL_MULTISAMPLES_NV 0x9371 +#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372 +#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373 +#define GL_CONFORMANT_NV 0x9374 + +typedef void (GLAPIENTRY * PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint* params); + +#define glGetInternalformatSampleivNV GLEW_GET_FUN(__glewGetInternalformatSampleivNV) + +#define GLEW_NV_internalformat_sample_query GLEW_GET_VAR(__GLEW_NV_internalformat_sample_query) + +#endif /* GL_NV_internalformat_sample_query */ + +/* ------------------------ GL_NV_light_max_exponent ----------------------- */ + +#ifndef GL_NV_light_max_exponent +#define GL_NV_light_max_exponent 1 + +#define GL_MAX_SHININESS_NV 0x8504 +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 + +#define GLEW_NV_light_max_exponent GLEW_GET_VAR(__GLEW_NV_light_max_exponent) + +#endif /* GL_NV_light_max_exponent */ + +/* ----------------------- GL_NV_multisample_coverage ---------------------- */ + +#ifndef GL_NV_multisample_coverage +#define GL_NV_multisample_coverage 1 + +#define GL_COLOR_SAMPLES_NV 0x8E20 + +#define GLEW_NV_multisample_coverage GLEW_GET_VAR(__GLEW_NV_multisample_coverage) + +#endif /* GL_NV_multisample_coverage */ + +/* --------------------- GL_NV_multisample_filter_hint --------------------- */ + +#ifndef GL_NV_multisample_filter_hint +#define GL_NV_multisample_filter_hint 1 + +#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 + +#define GLEW_NV_multisample_filter_hint GLEW_GET_VAR(__GLEW_NV_multisample_filter_hint) + +#endif /* GL_NV_multisample_filter_hint */ + +/* ------------------------- GL_NV_occlusion_query ------------------------- */ + +#ifndef GL_NV_occlusion_query +#define GL_NV_occlusion_query 1 + +#define GL_PIXEL_COUNTER_BITS_NV 0x8864 +#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 +#define GL_PIXEL_COUNT_NV 0x8866 +#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 + +typedef void (GLAPIENTRY * PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint* ids); +typedef void (GLAPIENTRY * PFNGLENDOCCLUSIONQUERYNVPROC) (void); +typedef void (GLAPIENTRY * PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint* ids); +typedef void (GLAPIENTRY * PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); + +#define glBeginOcclusionQueryNV GLEW_GET_FUN(__glewBeginOcclusionQueryNV) +#define glDeleteOcclusionQueriesNV GLEW_GET_FUN(__glewDeleteOcclusionQueriesNV) +#define glEndOcclusionQueryNV GLEW_GET_FUN(__glewEndOcclusionQueryNV) +#define glGenOcclusionQueriesNV GLEW_GET_FUN(__glewGenOcclusionQueriesNV) +#define glGetOcclusionQueryivNV GLEW_GET_FUN(__glewGetOcclusionQueryivNV) +#define glGetOcclusionQueryuivNV GLEW_GET_FUN(__glewGetOcclusionQueryuivNV) +#define glIsOcclusionQueryNV GLEW_GET_FUN(__glewIsOcclusionQueryNV) + +#define GLEW_NV_occlusion_query GLEW_GET_VAR(__GLEW_NV_occlusion_query) + +#endif /* GL_NV_occlusion_query */ + +/* ----------------------- GL_NV_packed_depth_stencil ---------------------- */ + +#ifndef GL_NV_packed_depth_stencil +#define GL_NV_packed_depth_stencil 1 + +#define GL_DEPTH_STENCIL_NV 0x84F9 +#define GL_UNSIGNED_INT_24_8_NV 0x84FA + +#define GLEW_NV_packed_depth_stencil GLEW_GET_VAR(__GLEW_NV_packed_depth_stencil) + +#endif /* GL_NV_packed_depth_stencil */ + +/* --------------------- GL_NV_parameter_buffer_object --------------------- */ + +#ifndef GL_NV_parameter_buffer_object +#define GL_NV_parameter_buffer_object 1 + +#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 +#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 +#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 +#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3 +#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4 + +typedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params); +typedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params); +typedef void (GLAPIENTRY * PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params); + +#define glProgramBufferParametersIivNV GLEW_GET_FUN(__glewProgramBufferParametersIivNV) +#define glProgramBufferParametersIuivNV GLEW_GET_FUN(__glewProgramBufferParametersIuivNV) +#define glProgramBufferParametersfvNV GLEW_GET_FUN(__glewProgramBufferParametersfvNV) + +#define GLEW_NV_parameter_buffer_object GLEW_GET_VAR(__GLEW_NV_parameter_buffer_object) + +#endif /* GL_NV_parameter_buffer_object */ + +/* --------------------- GL_NV_parameter_buffer_object2 -------------------- */ + +#ifndef GL_NV_parameter_buffer_object2 +#define GL_NV_parameter_buffer_object2 1 + +#define GLEW_NV_parameter_buffer_object2 GLEW_GET_VAR(__GLEW_NV_parameter_buffer_object2) + +#endif /* GL_NV_parameter_buffer_object2 */ + +/* -------------------------- GL_NV_path_rendering ------------------------- */ + +#ifndef GL_NV_path_rendering +#define GL_NV_path_rendering 1 + +#define GL_CLOSE_PATH_NV 0x00 +#define GL_BOLD_BIT_NV 0x01 +#define GL_GLYPH_WIDTH_BIT_NV 0x01 +#define GL_GLYPH_HEIGHT_BIT_NV 0x02 +#define GL_ITALIC_BIT_NV 0x02 +#define GL_MOVE_TO_NV 0x02 +#define GL_RELATIVE_MOVE_TO_NV 0x03 +#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04 +#define GL_LINE_TO_NV 0x04 +#define GL_RELATIVE_LINE_TO_NV 0x05 +#define GL_HORIZONTAL_LINE_TO_NV 0x06 +#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07 +#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08 +#define GL_VERTICAL_LINE_TO_NV 0x08 +#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09 +#define GL_QUADRATIC_CURVE_TO_NV 0x0A +#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B +#define GL_CUBIC_CURVE_TO_NV 0x0C +#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D +#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E +#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F +#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10 +#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10 +#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11 +#define GL_SMALL_CCW_ARC_TO_NV 0x12 +#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13 +#define GL_SMALL_CW_ARC_TO_NV 0x14 +#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15 +#define GL_LARGE_CCW_ARC_TO_NV 0x16 +#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17 +#define GL_LARGE_CW_ARC_TO_NV 0x18 +#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19 +#define GL_CONIC_CURVE_TO_NV 0x1A +#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B +#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20 +#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40 +#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80 +#define GL_ROUNDED_RECT_NV 0xE8 +#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9 +#define GL_ROUNDED_RECT2_NV 0xEA +#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB +#define GL_ROUNDED_RECT4_NV 0xEC +#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED +#define GL_ROUNDED_RECT8_NV 0xEE +#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF +#define GL_RESTART_PATH_NV 0xF0 +#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2 +#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4 +#define GL_RECT_NV 0xF6 +#define GL_RELATIVE_RECT_NV 0xF7 +#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8 +#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA +#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC +#define GL_ARC_TO_NV 0xFE +#define GL_RELATIVE_ARC_TO_NV 0xFF +#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100 +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PATH_FORMAT_SVG_NV 0x9070 +#define GL_PATH_FORMAT_PS_NV 0x9071 +#define GL_STANDARD_FONT_NAME_NV 0x9072 +#define GL_SYSTEM_FONT_NAME_NV 0x9073 +#define GL_FILE_NAME_NV 0x9074 +#define GL_PATH_STROKE_WIDTH_NV 0x9075 +#define GL_PATH_END_CAPS_NV 0x9076 +#define GL_PATH_INITIAL_END_CAP_NV 0x9077 +#define GL_PATH_TERMINAL_END_CAP_NV 0x9078 +#define GL_PATH_JOIN_STYLE_NV 0x9079 +#define GL_PATH_MITER_LIMIT_NV 0x907A +#define GL_PATH_DASH_CAPS_NV 0x907B +#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C +#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D +#define GL_PATH_DASH_OFFSET_NV 0x907E +#define GL_PATH_CLIENT_LENGTH_NV 0x907F +#define GL_PATH_FILL_MODE_NV 0x9080 +#define GL_PATH_FILL_MASK_NV 0x9081 +#define GL_PATH_FILL_COVER_MODE_NV 0x9082 +#define GL_PATH_STROKE_COVER_MODE_NV 0x9083 +#define GL_PATH_STROKE_MASK_NV 0x9084 +#define GL_PATH_STROKE_BOUND_NV 0x9086 +#define GL_COUNT_UP_NV 0x9088 +#define GL_COUNT_DOWN_NV 0x9089 +#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A +#define GL_CONVEX_HULL_NV 0x908B +#define GL_BOUNDING_BOX_NV 0x908D +#define GL_TRANSLATE_X_NV 0x908E +#define GL_TRANSLATE_Y_NV 0x908F +#define GL_TRANSLATE_2D_NV 0x9090 +#define GL_TRANSLATE_3D_NV 0x9091 +#define GL_AFFINE_2D_NV 0x9092 +#define GL_AFFINE_3D_NV 0x9094 +#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096 +#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098 +#define GL_UTF8_NV 0x909A +#define GL_UTF16_NV 0x909B +#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C +#define GL_PATH_COMMAND_COUNT_NV 0x909D +#define GL_PATH_COORD_COUNT_NV 0x909E +#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F +#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0 +#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1 +#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2 +#define GL_SQUARE_NV 0x90A3 +#define GL_ROUND_NV 0x90A4 +#define GL_TRIANGULAR_NV 0x90A5 +#define GL_BEVEL_NV 0x90A6 +#define GL_MITER_REVERT_NV 0x90A7 +#define GL_MITER_TRUNCATE_NV 0x90A8 +#define GL_SKIP_MISSING_GLYPH_NV 0x90A9 +#define GL_USE_MISSING_GLYPH_NV 0x90AA +#define GL_PATH_ERROR_POSITION_NV 0x90AB +#define GL_PATH_FOG_GEN_MODE_NV 0x90AC +#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD +#define GL_ADJACENT_PAIRS_NV 0x90AE +#define GL_FIRST_TO_REST_NV 0x90AF +#define GL_PATH_GEN_MODE_NV 0x90B0 +#define GL_PATH_GEN_COEFF_NV 0x90B1 +#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2 +#define GL_PATH_GEN_COMPONENTS_NV 0x90B3 +#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4 +#define GL_MOVE_TO_RESETS_NV 0x90B5 +#define GL_MOVE_TO_CONTINUES_NV 0x90B6 +#define GL_PATH_STENCIL_FUNC_NV 0x90B7 +#define GL_PATH_STENCIL_REF_NV 0x90B8 +#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9 +#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD +#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE +#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF +#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368 +#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369 +#define GL_FONT_UNAVAILABLE_NV 0x936A +#define GL_FONT_UNINTELLIGIBLE_NV 0x936B +#define GL_STANDARD_FONT_FORMAT_NV 0x936C +#define GL_FRAGMENT_INPUT_NV 0x936D +#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000 +#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000 +#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000 +#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000 +#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000 +#define GL_FONT_ASCENDER_BIT_NV 0x00200000 +#define GL_FONT_DESCENDER_BIT_NV 0x00400000 +#define GL_FONT_HEIGHT_BIT_NV 0x00800000 +#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000 +#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000 +#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000 +#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000 +#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000 +#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000 + +typedef void (GLAPIENTRY * PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath); +typedef void (GLAPIENTRY * PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GLAPIENTRY * PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (GLAPIENTRY * PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GLAPIENTRY * PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (GLAPIENTRY * PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range); +typedef GLuint (GLAPIENTRY * PFNGLGENPATHSNVPROC) (GLsizei range); +typedef void (GLAPIENTRY * PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat* value); +typedef void (GLAPIENTRY * PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint* value); +typedef void (GLAPIENTRY * PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte* commands); +typedef void (GLAPIENTRY * PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat* coords); +typedef void (GLAPIENTRY * PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat* dashArray); +typedef GLfloat (GLAPIENTRY * PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments); +typedef void (GLAPIENTRY * PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat* metrics); +typedef void (GLAPIENTRY * PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +typedef void (GLAPIENTRY * PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat* value); +typedef void (GLAPIENTRY * PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint* value); +typedef void (GLAPIENTRY * PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +typedef void (GLAPIENTRY * PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat* value); +typedef void (GLAPIENTRY * PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint* value); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei *length, GLfloat *params); +typedef void (GLAPIENTRY * PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +typedef GLboolean (GLAPIENTRY * PFNGLISPATHNVPROC) (GLuint path); +typedef GLboolean (GLAPIENTRY * PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y); +typedef GLboolean (GLAPIENTRY * PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat* m); +typedef void (GLAPIENTRY * PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat* m); +typedef void (GLAPIENTRY * PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat* m); +typedef void (GLAPIENTRY * PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat* m); +typedef void (GLAPIENTRY * PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat* m); +typedef void (GLAPIENTRY * PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat* m); +typedef void (GLAPIENTRY * PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat* coeffs); +typedef void (GLAPIENTRY * PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte* commands, GLsizei numCoords, GLenum coordType, const void*coords); +typedef void (GLAPIENTRY * PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GLAPIENTRY * PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum zfunc); +typedef void (GLAPIENTRY * PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat* dashArray); +typedef void (GLAPIENTRY * PFNGLPATHFOGGENNVPROC) (GLenum genMode); +typedef GLenum (GLAPIENTRY * PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef GLenum (GLAPIENTRY * PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +typedef void (GLAPIENTRY * PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (GLAPIENTRY * PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void*charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef GLenum (GLAPIENTRY * PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (GLAPIENTRY * PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value); +typedef void (GLAPIENTRY * PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value); +typedef void (GLAPIENTRY * PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint* value); +typedef void (GLAPIENTRY * PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units); +typedef void (GLAPIENTRY * PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask); +typedef void (GLAPIENTRY * PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString); +typedef void (GLAPIENTRY * PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte* commands, GLsizei numCoords, GLenum coordType, const void*coords); +typedef void (GLAPIENTRY * PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GLAPIENTRY * PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat* coeffs); +typedef GLboolean (GLAPIENTRY * PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat* x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +typedef void (GLAPIENTRY * PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat* coeffs); +typedef void (GLAPIENTRY * PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (GLAPIENTRY * PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask); +typedef void (GLAPIENTRY * PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (GLAPIENTRY * PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask); +typedef void (GLAPIENTRY * PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GLAPIENTRY * PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +typedef void (GLAPIENTRY * PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GLAPIENTRY * PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +typedef void (GLAPIENTRY * PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat* transformValues); +typedef void (GLAPIENTRY * PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint paths[], const GLfloat weights[]); + +#define glCopyPathNV GLEW_GET_FUN(__glewCopyPathNV) +#define glCoverFillPathInstancedNV GLEW_GET_FUN(__glewCoverFillPathInstancedNV) +#define glCoverFillPathNV GLEW_GET_FUN(__glewCoverFillPathNV) +#define glCoverStrokePathInstancedNV GLEW_GET_FUN(__glewCoverStrokePathInstancedNV) +#define glCoverStrokePathNV GLEW_GET_FUN(__glewCoverStrokePathNV) +#define glDeletePathsNV GLEW_GET_FUN(__glewDeletePathsNV) +#define glGenPathsNV GLEW_GET_FUN(__glewGenPathsNV) +#define glGetPathColorGenfvNV GLEW_GET_FUN(__glewGetPathColorGenfvNV) +#define glGetPathColorGenivNV GLEW_GET_FUN(__glewGetPathColorGenivNV) +#define glGetPathCommandsNV GLEW_GET_FUN(__glewGetPathCommandsNV) +#define glGetPathCoordsNV GLEW_GET_FUN(__glewGetPathCoordsNV) +#define glGetPathDashArrayNV GLEW_GET_FUN(__glewGetPathDashArrayNV) +#define glGetPathLengthNV GLEW_GET_FUN(__glewGetPathLengthNV) +#define glGetPathMetricRangeNV GLEW_GET_FUN(__glewGetPathMetricRangeNV) +#define glGetPathMetricsNV GLEW_GET_FUN(__glewGetPathMetricsNV) +#define glGetPathParameterfvNV GLEW_GET_FUN(__glewGetPathParameterfvNV) +#define glGetPathParameterivNV GLEW_GET_FUN(__glewGetPathParameterivNV) +#define glGetPathSpacingNV GLEW_GET_FUN(__glewGetPathSpacingNV) +#define glGetPathTexGenfvNV GLEW_GET_FUN(__glewGetPathTexGenfvNV) +#define glGetPathTexGenivNV GLEW_GET_FUN(__glewGetPathTexGenivNV) +#define glGetProgramResourcefvNV GLEW_GET_FUN(__glewGetProgramResourcefvNV) +#define glInterpolatePathsNV GLEW_GET_FUN(__glewInterpolatePathsNV) +#define glIsPathNV GLEW_GET_FUN(__glewIsPathNV) +#define glIsPointInFillPathNV GLEW_GET_FUN(__glewIsPointInFillPathNV) +#define glIsPointInStrokePathNV GLEW_GET_FUN(__glewIsPointInStrokePathNV) +#define glMatrixLoad3x2fNV GLEW_GET_FUN(__glewMatrixLoad3x2fNV) +#define glMatrixLoad3x3fNV GLEW_GET_FUN(__glewMatrixLoad3x3fNV) +#define glMatrixLoadTranspose3x3fNV GLEW_GET_FUN(__glewMatrixLoadTranspose3x3fNV) +#define glMatrixMult3x2fNV GLEW_GET_FUN(__glewMatrixMult3x2fNV) +#define glMatrixMult3x3fNV GLEW_GET_FUN(__glewMatrixMult3x3fNV) +#define glMatrixMultTranspose3x3fNV GLEW_GET_FUN(__glewMatrixMultTranspose3x3fNV) +#define glPathColorGenNV GLEW_GET_FUN(__glewPathColorGenNV) +#define glPathCommandsNV GLEW_GET_FUN(__glewPathCommandsNV) +#define glPathCoordsNV GLEW_GET_FUN(__glewPathCoordsNV) +#define glPathCoverDepthFuncNV GLEW_GET_FUN(__glewPathCoverDepthFuncNV) +#define glPathDashArrayNV GLEW_GET_FUN(__glewPathDashArrayNV) +#define glPathFogGenNV GLEW_GET_FUN(__glewPathFogGenNV) +#define glPathGlyphIndexArrayNV GLEW_GET_FUN(__glewPathGlyphIndexArrayNV) +#define glPathGlyphIndexRangeNV GLEW_GET_FUN(__glewPathGlyphIndexRangeNV) +#define glPathGlyphRangeNV GLEW_GET_FUN(__glewPathGlyphRangeNV) +#define glPathGlyphsNV GLEW_GET_FUN(__glewPathGlyphsNV) +#define glPathMemoryGlyphIndexArrayNV GLEW_GET_FUN(__glewPathMemoryGlyphIndexArrayNV) +#define glPathParameterfNV GLEW_GET_FUN(__glewPathParameterfNV) +#define glPathParameterfvNV GLEW_GET_FUN(__glewPathParameterfvNV) +#define glPathParameteriNV GLEW_GET_FUN(__glewPathParameteriNV) +#define glPathParameterivNV GLEW_GET_FUN(__glewPathParameterivNV) +#define glPathStencilDepthOffsetNV GLEW_GET_FUN(__glewPathStencilDepthOffsetNV) +#define glPathStencilFuncNV GLEW_GET_FUN(__glewPathStencilFuncNV) +#define glPathStringNV GLEW_GET_FUN(__glewPathStringNV) +#define glPathSubCommandsNV GLEW_GET_FUN(__glewPathSubCommandsNV) +#define glPathSubCoordsNV GLEW_GET_FUN(__glewPathSubCoordsNV) +#define glPathTexGenNV GLEW_GET_FUN(__glewPathTexGenNV) +#define glPointAlongPathNV GLEW_GET_FUN(__glewPointAlongPathNV) +#define glProgramPathFragmentInputGenNV GLEW_GET_FUN(__glewProgramPathFragmentInputGenNV) +#define glStencilFillPathInstancedNV GLEW_GET_FUN(__glewStencilFillPathInstancedNV) +#define glStencilFillPathNV GLEW_GET_FUN(__glewStencilFillPathNV) +#define glStencilStrokePathInstancedNV GLEW_GET_FUN(__glewStencilStrokePathInstancedNV) +#define glStencilStrokePathNV GLEW_GET_FUN(__glewStencilStrokePathNV) +#define glStencilThenCoverFillPathInstancedNV GLEW_GET_FUN(__glewStencilThenCoverFillPathInstancedNV) +#define glStencilThenCoverFillPathNV GLEW_GET_FUN(__glewStencilThenCoverFillPathNV) +#define glStencilThenCoverStrokePathInstancedNV GLEW_GET_FUN(__glewStencilThenCoverStrokePathInstancedNV) +#define glStencilThenCoverStrokePathNV GLEW_GET_FUN(__glewStencilThenCoverStrokePathNV) +#define glTransformPathNV GLEW_GET_FUN(__glewTransformPathNV) +#define glWeightPathsNV GLEW_GET_FUN(__glewWeightPathsNV) + +#define GLEW_NV_path_rendering GLEW_GET_VAR(__GLEW_NV_path_rendering) + +#endif /* GL_NV_path_rendering */ + +/* -------------------- GL_NV_path_rendering_shared_edge ------------------- */ + +#ifndef GL_NV_path_rendering_shared_edge +#define GL_NV_path_rendering_shared_edge 1 + +#define GL_SHARED_EDGE_NV 0xC0 + +#define GLEW_NV_path_rendering_shared_edge GLEW_GET_VAR(__GLEW_NV_path_rendering_shared_edge) + +#endif /* GL_NV_path_rendering_shared_edge */ + +/* ------------------------- GL_NV_pixel_data_range ------------------------ */ + +#ifndef GL_NV_pixel_data_range +#define GL_NV_pixel_data_range 1 + +#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 +#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 +#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A +#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B +#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C +#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D + +typedef void (GLAPIENTRY * PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, void *pointer); + +#define glFlushPixelDataRangeNV GLEW_GET_FUN(__glewFlushPixelDataRangeNV) +#define glPixelDataRangeNV GLEW_GET_FUN(__glewPixelDataRangeNV) + +#define GLEW_NV_pixel_data_range GLEW_GET_VAR(__GLEW_NV_pixel_data_range) + +#endif /* GL_NV_pixel_data_range */ + +/* --------------------------- GL_NV_point_sprite -------------------------- */ + +#ifndef GL_NV_point_sprite +#define GL_NV_point_sprite 1 + +#define GL_POINT_SPRITE_NV 0x8861 +#define GL_COORD_REPLACE_NV 0x8862 +#define GL_POINT_SPRITE_R_MODE_NV 0x8863 + +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint* params); + +#define glPointParameteriNV GLEW_GET_FUN(__glewPointParameteriNV) +#define glPointParameterivNV GLEW_GET_FUN(__glewPointParameterivNV) + +#define GLEW_NV_point_sprite GLEW_GET_VAR(__GLEW_NV_point_sprite) + +#endif /* GL_NV_point_sprite */ + +/* -------------------------- GL_NV_present_video -------------------------- */ + +#ifndef GL_NV_present_video +#define GL_NV_present_video 1 + +#define GL_FRAME_NV 0x8E26 +#define GL_FIELDS_NV 0x8E27 +#define GL_CURRENT_TIME_NV 0x8E28 +#define GL_NUM_FILL_STREAMS_NV 0x8E29 +#define GL_PRESENT_TIME_NV 0x8E2A +#define GL_PRESENT_DURATION_NV 0x8E2B + +typedef void (GLAPIENTRY * PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT* params); +typedef void (GLAPIENTRY * PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT* params); +typedef void (GLAPIENTRY * PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3); +typedef void (GLAPIENTRY * PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1); + +#define glGetVideoi64vNV GLEW_GET_FUN(__glewGetVideoi64vNV) +#define glGetVideoivNV GLEW_GET_FUN(__glewGetVideoivNV) +#define glGetVideoui64vNV GLEW_GET_FUN(__glewGetVideoui64vNV) +#define glGetVideouivNV GLEW_GET_FUN(__glewGetVideouivNV) +#define glPresentFrameDualFillNV GLEW_GET_FUN(__glewPresentFrameDualFillNV) +#define glPresentFrameKeyedNV GLEW_GET_FUN(__glewPresentFrameKeyedNV) + +#define GLEW_NV_present_video GLEW_GET_VAR(__GLEW_NV_present_video) + +#endif /* GL_NV_present_video */ + +/* ------------------------ GL_NV_primitive_restart ------------------------ */ + +#ifndef GL_NV_primitive_restart +#define GL_NV_primitive_restart 1 + +#define GL_PRIMITIVE_RESTART_NV 0x8558 +#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 + +typedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); +typedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTNVPROC) (void); + +#define glPrimitiveRestartIndexNV GLEW_GET_FUN(__glewPrimitiveRestartIndexNV) +#define glPrimitiveRestartNV GLEW_GET_FUN(__glewPrimitiveRestartNV) + +#define GLEW_NV_primitive_restart GLEW_GET_VAR(__GLEW_NV_primitive_restart) + +#endif /* GL_NV_primitive_restart */ + +/* ------------------------ GL_NV_register_combiners ----------------------- */ + +#ifndef GL_NV_register_combiners +#define GL_NV_register_combiners 1 + +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_SPARE0_NV 0x852E +#define GL_SPARE1_NV 0x852F +#define GL_DISCARD_NV 0x8530 +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 + +typedef void (GLAPIENTRY * PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (GLAPIENTRY * PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (GLAPIENTRY * PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint* params); + +#define glCombinerInputNV GLEW_GET_FUN(__glewCombinerInputNV) +#define glCombinerOutputNV GLEW_GET_FUN(__glewCombinerOutputNV) +#define glCombinerParameterfNV GLEW_GET_FUN(__glewCombinerParameterfNV) +#define glCombinerParameterfvNV GLEW_GET_FUN(__glewCombinerParameterfvNV) +#define glCombinerParameteriNV GLEW_GET_FUN(__glewCombinerParameteriNV) +#define glCombinerParameterivNV GLEW_GET_FUN(__glewCombinerParameterivNV) +#define glFinalCombinerInputNV GLEW_GET_FUN(__glewFinalCombinerInputNV) +#define glGetCombinerInputParameterfvNV GLEW_GET_FUN(__glewGetCombinerInputParameterfvNV) +#define glGetCombinerInputParameterivNV GLEW_GET_FUN(__glewGetCombinerInputParameterivNV) +#define glGetCombinerOutputParameterfvNV GLEW_GET_FUN(__glewGetCombinerOutputParameterfvNV) +#define glGetCombinerOutputParameterivNV GLEW_GET_FUN(__glewGetCombinerOutputParameterivNV) +#define glGetFinalCombinerInputParameterfvNV GLEW_GET_FUN(__glewGetFinalCombinerInputParameterfvNV) +#define glGetFinalCombinerInputParameterivNV GLEW_GET_FUN(__glewGetFinalCombinerInputParameterivNV) + +#define GLEW_NV_register_combiners GLEW_GET_VAR(__GLEW_NV_register_combiners) + +#endif /* GL_NV_register_combiners */ + +/* ----------------------- GL_NV_register_combiners2 ----------------------- */ + +#ifndef GL_NV_register_combiners2 +#define GL_NV_register_combiners2 1 + +#define GL_PER_STAGE_CONSTANTS_NV 0x8535 + +typedef void (GLAPIENTRY * PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat* params); + +#define glCombinerStageParameterfvNV GLEW_GET_FUN(__glewCombinerStageParameterfvNV) +#define glGetCombinerStageParameterfvNV GLEW_GET_FUN(__glewGetCombinerStageParameterfvNV) + +#define GLEW_NV_register_combiners2 GLEW_GET_VAR(__GLEW_NV_register_combiners2) + +#endif /* GL_NV_register_combiners2 */ + +/* ------------------------- GL_NV_sample_locations ------------------------ */ + +#ifndef GL_NV_sample_locations +#define GL_NV_sample_locations 1 + +#define GL_SAMPLE_LOCATION_NV 0x8E50 +#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D +#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E +#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340 +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341 +#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342 +#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343 + +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat* v); + +#define glFramebufferSampleLocationsfvNV GLEW_GET_FUN(__glewFramebufferSampleLocationsfvNV) +#define glNamedFramebufferSampleLocationsfvNV GLEW_GET_FUN(__glewNamedFramebufferSampleLocationsfvNV) + +#define GLEW_NV_sample_locations GLEW_GET_VAR(__GLEW_NV_sample_locations) + +#endif /* GL_NV_sample_locations */ + +/* ------------------ GL_NV_sample_mask_override_coverage ------------------ */ + +#ifndef GL_NV_sample_mask_override_coverage +#define GL_NV_sample_mask_override_coverage 1 + +#define GLEW_NV_sample_mask_override_coverage GLEW_GET_VAR(__GLEW_NV_sample_mask_override_coverage) + +#endif /* GL_NV_sample_mask_override_coverage */ + +/* ---------------------- GL_NV_shader_atomic_counters --------------------- */ + +#ifndef GL_NV_shader_atomic_counters +#define GL_NV_shader_atomic_counters 1 + +#define GLEW_NV_shader_atomic_counters GLEW_GET_VAR(__GLEW_NV_shader_atomic_counters) + +#endif /* GL_NV_shader_atomic_counters */ + +/* ----------------------- GL_NV_shader_atomic_float ----------------------- */ + +#ifndef GL_NV_shader_atomic_float +#define GL_NV_shader_atomic_float 1 + +#define GLEW_NV_shader_atomic_float GLEW_GET_VAR(__GLEW_NV_shader_atomic_float) + +#endif /* GL_NV_shader_atomic_float */ + +/* -------------------- GL_NV_shader_atomic_fp16_vector -------------------- */ + +#ifndef GL_NV_shader_atomic_fp16_vector +#define GL_NV_shader_atomic_fp16_vector 1 + +#define GLEW_NV_shader_atomic_fp16_vector GLEW_GET_VAR(__GLEW_NV_shader_atomic_fp16_vector) + +#endif /* GL_NV_shader_atomic_fp16_vector */ + +/* ----------------------- GL_NV_shader_atomic_int64 ----------------------- */ + +#ifndef GL_NV_shader_atomic_int64 +#define GL_NV_shader_atomic_int64 1 + +#define GLEW_NV_shader_atomic_int64 GLEW_GET_VAR(__GLEW_NV_shader_atomic_int64) + +#endif /* GL_NV_shader_atomic_int64 */ + +/* ------------------------ GL_NV_shader_buffer_load ----------------------- */ + +#ifndef GL_NV_shader_buffer_load +#define GL_NV_shader_buffer_load 1 + +#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D +#define GL_GPU_ADDRESS_NV 0x8F34 +#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35 + +typedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT* params); +typedef void (GLAPIENTRY * PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT* result); +typedef void (GLAPIENTRY * PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT* params); +typedef GLboolean (GLAPIENTRY * PFNGLISBUFFERRESIDENTNVPROC) (GLenum target); +typedef GLboolean (GLAPIENTRY * PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer); +typedef void (GLAPIENTRY * PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access); +typedef void (GLAPIENTRY * PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer); +typedef void (GLAPIENTRY * PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value); +typedef void (GLAPIENTRY * PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT* value); + +#define glGetBufferParameterui64vNV GLEW_GET_FUN(__glewGetBufferParameterui64vNV) +#define glGetIntegerui64vNV GLEW_GET_FUN(__glewGetIntegerui64vNV) +#define glGetNamedBufferParameterui64vNV GLEW_GET_FUN(__glewGetNamedBufferParameterui64vNV) +#define glIsBufferResidentNV GLEW_GET_FUN(__glewIsBufferResidentNV) +#define glIsNamedBufferResidentNV GLEW_GET_FUN(__glewIsNamedBufferResidentNV) +#define glMakeBufferNonResidentNV GLEW_GET_FUN(__glewMakeBufferNonResidentNV) +#define glMakeBufferResidentNV GLEW_GET_FUN(__glewMakeBufferResidentNV) +#define glMakeNamedBufferNonResidentNV GLEW_GET_FUN(__glewMakeNamedBufferNonResidentNV) +#define glMakeNamedBufferResidentNV GLEW_GET_FUN(__glewMakeNamedBufferResidentNV) +#define glProgramUniformui64NV GLEW_GET_FUN(__glewProgramUniformui64NV) +#define glProgramUniformui64vNV GLEW_GET_FUN(__glewProgramUniformui64vNV) +#define glUniformui64NV GLEW_GET_FUN(__glewUniformui64NV) +#define glUniformui64vNV GLEW_GET_FUN(__glewUniformui64vNV) + +#define GLEW_NV_shader_buffer_load GLEW_GET_VAR(__GLEW_NV_shader_buffer_load) + +#endif /* GL_NV_shader_buffer_load */ + +/* ------------------- GL_NV_shader_storage_buffer_object ------------------ */ + +#ifndef GL_NV_shader_storage_buffer_object +#define GL_NV_shader_storage_buffer_object 1 + +#define GLEW_NV_shader_storage_buffer_object GLEW_GET_VAR(__GLEW_NV_shader_storage_buffer_object) + +#endif /* GL_NV_shader_storage_buffer_object */ + +/* ----------------------- GL_NV_shader_thread_group ----------------------- */ + +#ifndef GL_NV_shader_thread_group +#define GL_NV_shader_thread_group 1 + +#define GL_WARP_SIZE_NV 0x9339 +#define GL_WARPS_PER_SM_NV 0x933A +#define GL_SM_COUNT_NV 0x933B + +#define GLEW_NV_shader_thread_group GLEW_GET_VAR(__GLEW_NV_shader_thread_group) + +#endif /* GL_NV_shader_thread_group */ + +/* ---------------------- GL_NV_shader_thread_shuffle ---------------------- */ + +#ifndef GL_NV_shader_thread_shuffle +#define GL_NV_shader_thread_shuffle 1 + +#define GLEW_NV_shader_thread_shuffle GLEW_GET_VAR(__GLEW_NV_shader_thread_shuffle) + +#endif /* GL_NV_shader_thread_shuffle */ + +/* ---------------------- GL_NV_tessellation_program5 ---------------------- */ + +#ifndef GL_NV_tessellation_program5 +#define GL_NV_tessellation_program5 1 + +#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8 +#define GL_TESS_CONTROL_PROGRAM_NV 0x891E +#define GL_TESS_EVALUATION_PROGRAM_NV 0x891F +#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74 +#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75 + +#define GLEW_NV_tessellation_program5 GLEW_GET_VAR(__GLEW_NV_tessellation_program5) + +#endif /* GL_NV_tessellation_program5 */ + +/* -------------------------- GL_NV_texgen_emboss -------------------------- */ + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 + +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E +#define GL_EMBOSS_MAP_NV 0x855F + +#define GLEW_NV_texgen_emboss GLEW_GET_VAR(__GLEW_NV_texgen_emboss) + +#endif /* GL_NV_texgen_emboss */ + +/* ------------------------ GL_NV_texgen_reflection ------------------------ */ + +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 + +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 + +#define GLEW_NV_texgen_reflection GLEW_GET_VAR(__GLEW_NV_texgen_reflection) + +#endif /* GL_NV_texgen_reflection */ + +/* ------------------------- GL_NV_texture_barrier ------------------------- */ + +#ifndef GL_NV_texture_barrier +#define GL_NV_texture_barrier 1 + +typedef void (GLAPIENTRY * PFNGLTEXTUREBARRIERNVPROC) (void); + +#define glTextureBarrierNV GLEW_GET_FUN(__glewTextureBarrierNV) + +#define GLEW_NV_texture_barrier GLEW_GET_VAR(__GLEW_NV_texture_barrier) + +#endif /* GL_NV_texture_barrier */ + +/* --------------------- GL_NV_texture_compression_vtc --------------------- */ + +#ifndef GL_NV_texture_compression_vtc +#define GL_NV_texture_compression_vtc 1 + +#define GLEW_NV_texture_compression_vtc GLEW_GET_VAR(__GLEW_NV_texture_compression_vtc) + +#endif /* GL_NV_texture_compression_vtc */ + +/* ----------------------- GL_NV_texture_env_combine4 ---------------------- */ + +#ifndef GL_NV_texture_env_combine4 +#define GL_NV_texture_env_combine4 1 + +#define GL_COMBINE4_NV 0x8503 +#define GL_SOURCE3_RGB_NV 0x8583 +#define GL_SOURCE3_ALPHA_NV 0x858B +#define GL_OPERAND3_RGB_NV 0x8593 +#define GL_OPERAND3_ALPHA_NV 0x859B + +#define GLEW_NV_texture_env_combine4 GLEW_GET_VAR(__GLEW_NV_texture_env_combine4) + +#endif /* GL_NV_texture_env_combine4 */ + +/* ---------------------- GL_NV_texture_expand_normal ---------------------- */ + +#ifndef GL_NV_texture_expand_normal +#define GL_NV_texture_expand_normal 1 + +#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F + +#define GLEW_NV_texture_expand_normal GLEW_GET_VAR(__GLEW_NV_texture_expand_normal) + +#endif /* GL_NV_texture_expand_normal */ + +/* ----------------------- GL_NV_texture_multisample ----------------------- */ + +#ifndef GL_NV_texture_multisample +#define GL_NV_texture_multisample 1 + +#define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045 +#define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046 + +typedef void (GLAPIENTRY * PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); + +#define glTexImage2DMultisampleCoverageNV GLEW_GET_FUN(__glewTexImage2DMultisampleCoverageNV) +#define glTexImage3DMultisampleCoverageNV GLEW_GET_FUN(__glewTexImage3DMultisampleCoverageNV) +#define glTextureImage2DMultisampleCoverageNV GLEW_GET_FUN(__glewTextureImage2DMultisampleCoverageNV) +#define glTextureImage2DMultisampleNV GLEW_GET_FUN(__glewTextureImage2DMultisampleNV) +#define glTextureImage3DMultisampleCoverageNV GLEW_GET_FUN(__glewTextureImage3DMultisampleCoverageNV) +#define glTextureImage3DMultisampleNV GLEW_GET_FUN(__glewTextureImage3DMultisampleNV) + +#define GLEW_NV_texture_multisample GLEW_GET_VAR(__GLEW_NV_texture_multisample) + +#endif /* GL_NV_texture_multisample */ + +/* ------------------------ GL_NV_texture_rectangle ------------------------ */ + +#ifndef GL_NV_texture_rectangle +#define GL_NV_texture_rectangle 1 + +#define GL_TEXTURE_RECTANGLE_NV 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 + +#define GLEW_NV_texture_rectangle GLEW_GET_VAR(__GLEW_NV_texture_rectangle) + +#endif /* GL_NV_texture_rectangle */ + +/* -------------------------- GL_NV_texture_shader ------------------------- */ + +#ifndef GL_NV_texture_shader +#define GL_NV_texture_shader 1 + +#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C +#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D +#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E +#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#define GL_SHADER_CONSISTENT_NV 0x86DD +#define GL_TEXTURE_SHADER_NV 0x86DE +#define GL_SHADER_OPERATION_NV 0x86DF +#define GL_CULL_MODES_NV 0x86E0 +#define GL_OFFSET_TEXTURE_2D_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_2D_SCALE_NV 0x86E2 +#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 +#define GL_OFFSET_TEXTURE_2D_BIAS_NV 0x86E3 +#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 +#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 +#define GL_CONST_EYE_NV 0x86E5 +#define GL_PASS_THROUGH_NV 0x86E6 +#define GL_CULL_FRAGMENT_NV 0x86E7 +#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 +#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 +#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA +#define GL_DOT_PRODUCT_NV 0x86EC +#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED +#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE +#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 +#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 +#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 +#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 +#define GL_HILO_NV 0x86F4 +#define GL_DSDT_NV 0x86F5 +#define GL_DSDT_MAG_NV 0x86F6 +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#define GL_HILO16_NV 0x86F8 +#define GL_SIGNED_HILO_NV 0x86F9 +#define GL_SIGNED_HILO16_NV 0x86FA +#define GL_SIGNED_RGBA_NV 0x86FB +#define GL_SIGNED_RGBA8_NV 0x86FC +#define GL_SIGNED_RGB_NV 0x86FE +#define GL_SIGNED_RGB8_NV 0x86FF +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#define GL_SIGNED_ALPHA_NV 0x8705 +#define GL_SIGNED_ALPHA8_NV 0x8706 +#define GL_SIGNED_INTENSITY_NV 0x8707 +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#define GL_DSDT8_NV 0x8709 +#define GL_DSDT8_MAG8_NV 0x870A +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D +#define GL_HI_SCALE_NV 0x870E +#define GL_LO_SCALE_NV 0x870F +#define GL_DS_SCALE_NV 0x8710 +#define GL_DT_SCALE_NV 0x8711 +#define GL_MAGNITUDE_SCALE_NV 0x8712 +#define GL_VIBRANCE_SCALE_NV 0x8713 +#define GL_HI_BIAS_NV 0x8714 +#define GL_LO_BIAS_NV 0x8715 +#define GL_DS_BIAS_NV 0x8716 +#define GL_DT_BIAS_NV 0x8717 +#define GL_MAGNITUDE_BIAS_NV 0x8718 +#define GL_VIBRANCE_BIAS_NV 0x8719 +#define GL_TEXTURE_BORDER_VALUES_NV 0x871A +#define GL_TEXTURE_HI_SIZE_NV 0x871B +#define GL_TEXTURE_LO_SIZE_NV 0x871C +#define GL_TEXTURE_DS_SIZE_NV 0x871D +#define GL_TEXTURE_DT_SIZE_NV 0x871E +#define GL_TEXTURE_MAG_SIZE_NV 0x871F + +#define GLEW_NV_texture_shader GLEW_GET_VAR(__GLEW_NV_texture_shader) + +#endif /* GL_NV_texture_shader */ + +/* ------------------------- GL_NV_texture_shader2 ------------------------- */ + +#ifndef GL_NV_texture_shader2 +#define GL_NV_texture_shader2 1 + +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF +#define GL_HILO_NV 0x86F4 +#define GL_DSDT_NV 0x86F5 +#define GL_DSDT_MAG_NV 0x86F6 +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#define GL_HILO16_NV 0x86F8 +#define GL_SIGNED_HILO_NV 0x86F9 +#define GL_SIGNED_HILO16_NV 0x86FA +#define GL_SIGNED_RGBA_NV 0x86FB +#define GL_SIGNED_RGBA8_NV 0x86FC +#define GL_SIGNED_RGB_NV 0x86FE +#define GL_SIGNED_RGB8_NV 0x86FF +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#define GL_SIGNED_ALPHA_NV 0x8705 +#define GL_SIGNED_ALPHA8_NV 0x8706 +#define GL_SIGNED_INTENSITY_NV 0x8707 +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#define GL_DSDT8_NV 0x8709 +#define GL_DSDT8_MAG8_NV 0x870A +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D + +#define GLEW_NV_texture_shader2 GLEW_GET_VAR(__GLEW_NV_texture_shader2) + +#endif /* GL_NV_texture_shader2 */ + +/* ------------------------- GL_NV_texture_shader3 ------------------------- */ + +#ifndef GL_NV_texture_shader3 +#define GL_NV_texture_shader3 1 + +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 +#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 +#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 +#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 +#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 +#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A +#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B +#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C +#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D +#define GL_HILO8_NV 0x885E +#define GL_SIGNED_HILO8_NV 0x885F +#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 + +#define GLEW_NV_texture_shader3 GLEW_GET_VAR(__GLEW_NV_texture_shader3) + +#endif /* GL_NV_texture_shader3 */ + +/* ------------------------ GL_NV_transform_feedback ----------------------- */ + +#ifndef GL_NV_transform_feedback +#define GL_NV_transform_feedback 1 + +#define GL_BACK_PRIMARY_COLOR_NV 0x8C77 +#define GL_BACK_SECONDARY_COLOR_NV 0x8C78 +#define GL_TEXTURE_COORD_NV 0x8C79 +#define GL_CLIP_DISTANCE_NV 0x8C7A +#define GL_VERTEX_ID_NV 0x8C7B +#define GL_PRIMITIVE_ID_NV 0x8C7C +#define GL_GENERIC_ATTRIB_NV 0x8C7D +#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80 +#define GL_ACTIVE_VARYINGS_NV 0x8C81 +#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82 +#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85 +#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86 +#define GL_PRIMITIVES_GENERATED_NV 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 +#define GL_RASTERIZER_DISCARD_NV 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B +#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C +#define GL_SEPARATE_ATTRIBS_NV 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F + +typedef void (GLAPIENTRY * PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name); +typedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode); +typedef void (GLAPIENTRY * PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (GLAPIENTRY * PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +typedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACKNVPROC) (void); +typedef void (GLAPIENTRY * PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location); +typedef GLint (GLAPIENTRY * PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name); +typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode); +typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); + +#define glActiveVaryingNV GLEW_GET_FUN(__glewActiveVaryingNV) +#define glBeginTransformFeedbackNV GLEW_GET_FUN(__glewBeginTransformFeedbackNV) +#define glBindBufferBaseNV GLEW_GET_FUN(__glewBindBufferBaseNV) +#define glBindBufferOffsetNV GLEW_GET_FUN(__glewBindBufferOffsetNV) +#define glBindBufferRangeNV GLEW_GET_FUN(__glewBindBufferRangeNV) +#define glEndTransformFeedbackNV GLEW_GET_FUN(__glewEndTransformFeedbackNV) +#define glGetActiveVaryingNV GLEW_GET_FUN(__glewGetActiveVaryingNV) +#define glGetTransformFeedbackVaryingNV GLEW_GET_FUN(__glewGetTransformFeedbackVaryingNV) +#define glGetVaryingLocationNV GLEW_GET_FUN(__glewGetVaryingLocationNV) +#define glTransformFeedbackAttribsNV GLEW_GET_FUN(__glewTransformFeedbackAttribsNV) +#define glTransformFeedbackVaryingsNV GLEW_GET_FUN(__glewTransformFeedbackVaryingsNV) + +#define GLEW_NV_transform_feedback GLEW_GET_VAR(__GLEW_NV_transform_feedback) + +#endif /* GL_NV_transform_feedback */ + +/* ----------------------- GL_NV_transform_feedback2 ----------------------- */ + +#ifndef GL_NV_transform_feedback2 +#define GL_NV_transform_feedback2 1 + +#define GL_TRANSFORM_FEEDBACK_NV 0x8E22 +#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23 +#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25 + +typedef void (GLAPIENTRY * PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id); +typedef void (GLAPIENTRY * PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint* ids); +typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id); +typedef void (GLAPIENTRY * PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint* ids); +typedef GLboolean (GLAPIENTRY * PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void); +typedef void (GLAPIENTRY * PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void); + +#define glBindTransformFeedbackNV GLEW_GET_FUN(__glewBindTransformFeedbackNV) +#define glDeleteTransformFeedbacksNV GLEW_GET_FUN(__glewDeleteTransformFeedbacksNV) +#define glDrawTransformFeedbackNV GLEW_GET_FUN(__glewDrawTransformFeedbackNV) +#define glGenTransformFeedbacksNV GLEW_GET_FUN(__glewGenTransformFeedbacksNV) +#define glIsTransformFeedbackNV GLEW_GET_FUN(__glewIsTransformFeedbackNV) +#define glPauseTransformFeedbackNV GLEW_GET_FUN(__glewPauseTransformFeedbackNV) +#define glResumeTransformFeedbackNV GLEW_GET_FUN(__glewResumeTransformFeedbackNV) + +#define GLEW_NV_transform_feedback2 GLEW_GET_VAR(__GLEW_NV_transform_feedback2) + +#endif /* GL_NV_transform_feedback2 */ + +/* ------------------ GL_NV_uniform_buffer_unified_memory ------------------ */ + +#ifndef GL_NV_uniform_buffer_unified_memory +#define GL_NV_uniform_buffer_unified_memory 1 + +#define GL_UNIFORM_BUFFER_UNIFIED_NV 0x936E +#define GL_UNIFORM_BUFFER_ADDRESS_NV 0x936F +#define GL_UNIFORM_BUFFER_LENGTH_NV 0x9370 + +#define GLEW_NV_uniform_buffer_unified_memory GLEW_GET_VAR(__GLEW_NV_uniform_buffer_unified_memory) + +#endif /* GL_NV_uniform_buffer_unified_memory */ + +/* -------------------------- GL_NV_vdpau_interop -------------------------- */ + +#ifndef GL_NV_vdpau_interop +#define GL_NV_vdpau_interop 1 + +#define GL_SURFACE_STATE_NV 0x86EB +#define GL_SURFACE_REGISTERED_NV 0x86FD +#define GL_SURFACE_MAPPED_NV 0x8700 +#define GL_WRITE_DISCARD_NV 0x88BE + +typedef GLintptr GLvdpauSurfaceNV; + +typedef void (GLAPIENTRY * PFNGLVDPAUFININVPROC) (void); +typedef void (GLAPIENTRY * PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei* length, GLint *values); +typedef void (GLAPIENTRY * PFNGLVDPAUINITNVPROC) (const void* vdpDevice, const void*getProcAddress); +typedef void (GLAPIENTRY * PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface); +typedef void (GLAPIENTRY * PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV* surfaces); +typedef GLvdpauSurfaceNV (GLAPIENTRY * PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (const void* vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +typedef GLvdpauSurfaceNV (GLAPIENTRY * PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const void* vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +typedef void (GLAPIENTRY * PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access); +typedef void (GLAPIENTRY * PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV* surfaces); +typedef void (GLAPIENTRY * PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface); + +#define glVDPAUFiniNV GLEW_GET_FUN(__glewVDPAUFiniNV) +#define glVDPAUGetSurfaceivNV GLEW_GET_FUN(__glewVDPAUGetSurfaceivNV) +#define glVDPAUInitNV GLEW_GET_FUN(__glewVDPAUInitNV) +#define glVDPAUIsSurfaceNV GLEW_GET_FUN(__glewVDPAUIsSurfaceNV) +#define glVDPAUMapSurfacesNV GLEW_GET_FUN(__glewVDPAUMapSurfacesNV) +#define glVDPAURegisterOutputSurfaceNV GLEW_GET_FUN(__glewVDPAURegisterOutputSurfaceNV) +#define glVDPAURegisterVideoSurfaceNV GLEW_GET_FUN(__glewVDPAURegisterVideoSurfaceNV) +#define glVDPAUSurfaceAccessNV GLEW_GET_FUN(__glewVDPAUSurfaceAccessNV) +#define glVDPAUUnmapSurfacesNV GLEW_GET_FUN(__glewVDPAUUnmapSurfacesNV) +#define glVDPAUUnregisterSurfaceNV GLEW_GET_FUN(__glewVDPAUUnregisterSurfaceNV) + +#define GLEW_NV_vdpau_interop GLEW_GET_VAR(__GLEW_NV_vdpau_interop) + +#endif /* GL_NV_vdpau_interop */ + +/* ------------------------ GL_NV_vertex_array_range ----------------------- */ + +#ifndef GL_NV_vertex_array_range +#define GL_NV_vertex_array_range 1 + +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 + +typedef void (GLAPIENTRY * PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, void *pointer); + +#define glFlushVertexArrayRangeNV GLEW_GET_FUN(__glewFlushVertexArrayRangeNV) +#define glVertexArrayRangeNV GLEW_GET_FUN(__glewVertexArrayRangeNV) + +#define GLEW_NV_vertex_array_range GLEW_GET_VAR(__GLEW_NV_vertex_array_range) + +#endif /* GL_NV_vertex_array_range */ + +/* ----------------------- GL_NV_vertex_array_range2 ----------------------- */ + +#ifndef GL_NV_vertex_array_range2 +#define GL_NV_vertex_array_range2 1 + +#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 + +#define GLEW_NV_vertex_array_range2 GLEW_GET_VAR(__GLEW_NV_vertex_array_range2) + +#endif /* GL_NV_vertex_array_range2 */ + +/* ------------------- GL_NV_vertex_attrib_integer_64bit ------------------- */ + +#ifndef GL_NV_vertex_attrib_integer_64bit +#define GL_NV_vertex_attrib_integer_64bit 1 + +#define GL_INT64_NV 0x140E +#define GL_UNSIGNED_INT64_NV 0x140F + +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT* params); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); + +#define glGetVertexAttribLi64vNV GLEW_GET_FUN(__glewGetVertexAttribLi64vNV) +#define glGetVertexAttribLui64vNV GLEW_GET_FUN(__glewGetVertexAttribLui64vNV) +#define glVertexAttribL1i64NV GLEW_GET_FUN(__glewVertexAttribL1i64NV) +#define glVertexAttribL1i64vNV GLEW_GET_FUN(__glewVertexAttribL1i64vNV) +#define glVertexAttribL1ui64NV GLEW_GET_FUN(__glewVertexAttribL1ui64NV) +#define glVertexAttribL1ui64vNV GLEW_GET_FUN(__glewVertexAttribL1ui64vNV) +#define glVertexAttribL2i64NV GLEW_GET_FUN(__glewVertexAttribL2i64NV) +#define glVertexAttribL2i64vNV GLEW_GET_FUN(__glewVertexAttribL2i64vNV) +#define glVertexAttribL2ui64NV GLEW_GET_FUN(__glewVertexAttribL2ui64NV) +#define glVertexAttribL2ui64vNV GLEW_GET_FUN(__glewVertexAttribL2ui64vNV) +#define glVertexAttribL3i64NV GLEW_GET_FUN(__glewVertexAttribL3i64NV) +#define glVertexAttribL3i64vNV GLEW_GET_FUN(__glewVertexAttribL3i64vNV) +#define glVertexAttribL3ui64NV GLEW_GET_FUN(__glewVertexAttribL3ui64NV) +#define glVertexAttribL3ui64vNV GLEW_GET_FUN(__glewVertexAttribL3ui64vNV) +#define glVertexAttribL4i64NV GLEW_GET_FUN(__glewVertexAttribL4i64NV) +#define glVertexAttribL4i64vNV GLEW_GET_FUN(__glewVertexAttribL4i64vNV) +#define glVertexAttribL4ui64NV GLEW_GET_FUN(__glewVertexAttribL4ui64NV) +#define glVertexAttribL4ui64vNV GLEW_GET_FUN(__glewVertexAttribL4ui64vNV) +#define glVertexAttribLFormatNV GLEW_GET_FUN(__glewVertexAttribLFormatNV) + +#define GLEW_NV_vertex_attrib_integer_64bit GLEW_GET_VAR(__GLEW_NV_vertex_attrib_integer_64bit) + +#endif /* GL_NV_vertex_attrib_integer_64bit */ + +/* ------------------- GL_NV_vertex_buffer_unified_memory ------------------ */ + +#ifndef GL_NV_vertex_buffer_unified_memory +#define GL_NV_vertex_buffer_unified_memory 1 + +#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E +#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F +#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20 +#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21 +#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22 +#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23 +#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24 +#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25 +#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26 +#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27 +#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28 +#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29 +#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A +#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B +#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C +#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D +#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E +#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F +#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30 +#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31 +#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32 +#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33 +#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40 +#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41 +#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42 + +typedef void (GLAPIENTRY * PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length); +typedef void (GLAPIENTRY * PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride); +typedef void (GLAPIENTRY * PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT result[]); +typedef void (GLAPIENTRY * PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); + +#define glBufferAddressRangeNV GLEW_GET_FUN(__glewBufferAddressRangeNV) +#define glColorFormatNV GLEW_GET_FUN(__glewColorFormatNV) +#define glEdgeFlagFormatNV GLEW_GET_FUN(__glewEdgeFlagFormatNV) +#define glFogCoordFormatNV GLEW_GET_FUN(__glewFogCoordFormatNV) +#define glGetIntegerui64i_vNV GLEW_GET_FUN(__glewGetIntegerui64i_vNV) +#define glIndexFormatNV GLEW_GET_FUN(__glewIndexFormatNV) +#define glNormalFormatNV GLEW_GET_FUN(__glewNormalFormatNV) +#define glSecondaryColorFormatNV GLEW_GET_FUN(__glewSecondaryColorFormatNV) +#define glTexCoordFormatNV GLEW_GET_FUN(__glewTexCoordFormatNV) +#define glVertexAttribFormatNV GLEW_GET_FUN(__glewVertexAttribFormatNV) +#define glVertexAttribIFormatNV GLEW_GET_FUN(__glewVertexAttribIFormatNV) +#define glVertexFormatNV GLEW_GET_FUN(__glewVertexFormatNV) + +#define GLEW_NV_vertex_buffer_unified_memory GLEW_GET_VAR(__GLEW_NV_vertex_buffer_unified_memory) + +#endif /* GL_NV_vertex_buffer_unified_memory */ + +/* -------------------------- GL_NV_vertex_program ------------------------- */ + +#ifndef GL_NV_vertex_program +#define GL_NV_vertex_program 1 + +#define GL_VERTEX_PROGRAM_NV 0x8620 +#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 +#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 +#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 +#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 +#define GL_CURRENT_ATTRIB_NV 0x8626 +#define GL_PROGRAM_LENGTH_NV 0x8627 +#define GL_PROGRAM_STRING_NV 0x8628 +#define GL_MODELVIEW_PROJECTION_NV 0x8629 +#define GL_IDENTITY_NV 0x862A +#define GL_INVERSE_NV 0x862B +#define GL_TRANSPOSE_NV 0x862C +#define GL_INVERSE_TRANSPOSE_NV 0x862D +#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E +#define GL_MAX_TRACK_MATRICES_NV 0x862F +#define GL_MATRIX0_NV 0x8630 +#define GL_MATRIX1_NV 0x8631 +#define GL_MATRIX2_NV 0x8632 +#define GL_MATRIX3_NV 0x8633 +#define GL_MATRIX4_NV 0x8634 +#define GL_MATRIX5_NV 0x8635 +#define GL_MATRIX6_NV 0x8636 +#define GL_MATRIX7_NV 0x8637 +#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 +#define GL_CURRENT_MATRIX_NV 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 +#define GL_PROGRAM_PARAMETER_NV 0x8644 +#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 +#define GL_PROGRAM_TARGET_NV 0x8646 +#define GL_PROGRAM_RESIDENT_NV 0x8647 +#define GL_TRACK_MATRIX_NV 0x8648 +#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 +#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A +#define GL_PROGRAM_ERROR_POSITION_NV 0x864B +#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 +#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 +#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 +#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 +#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 +#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 +#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 +#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 +#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 +#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 +#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A +#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B +#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C +#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D +#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E +#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F +#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 +#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 +#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 +#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 +#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 +#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 +#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 +#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 +#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 +#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 +#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A +#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B +#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C +#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D +#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E +#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F +#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 +#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 +#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 +#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 +#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 +#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 +#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 +#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 +#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 +#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 +#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A +#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B +#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C +#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D +#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E +#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F + +typedef GLboolean (GLAPIENTRY * PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint* ids, GLboolean *residences); +typedef void (GLAPIENTRY * PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); +typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint* ids); +typedef void (GLAPIENTRY * PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint* ids); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte* program); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, void** pointer); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMNVPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte* program); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei num, const GLdouble* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei num, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, GLuint* ids); +typedef void (GLAPIENTRY * PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei n, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei n, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei n, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei n, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei n, const GLubyte* v); + +#define glAreProgramsResidentNV GLEW_GET_FUN(__glewAreProgramsResidentNV) +#define glBindProgramNV GLEW_GET_FUN(__glewBindProgramNV) +#define glDeleteProgramsNV GLEW_GET_FUN(__glewDeleteProgramsNV) +#define glExecuteProgramNV GLEW_GET_FUN(__glewExecuteProgramNV) +#define glGenProgramsNV GLEW_GET_FUN(__glewGenProgramsNV) +#define glGetProgramParameterdvNV GLEW_GET_FUN(__glewGetProgramParameterdvNV) +#define glGetProgramParameterfvNV GLEW_GET_FUN(__glewGetProgramParameterfvNV) +#define glGetProgramStringNV GLEW_GET_FUN(__glewGetProgramStringNV) +#define glGetProgramivNV GLEW_GET_FUN(__glewGetProgramivNV) +#define glGetTrackMatrixivNV GLEW_GET_FUN(__glewGetTrackMatrixivNV) +#define glGetVertexAttribPointervNV GLEW_GET_FUN(__glewGetVertexAttribPointervNV) +#define glGetVertexAttribdvNV GLEW_GET_FUN(__glewGetVertexAttribdvNV) +#define glGetVertexAttribfvNV GLEW_GET_FUN(__glewGetVertexAttribfvNV) +#define glGetVertexAttribivNV GLEW_GET_FUN(__glewGetVertexAttribivNV) +#define glIsProgramNV GLEW_GET_FUN(__glewIsProgramNV) +#define glLoadProgramNV GLEW_GET_FUN(__glewLoadProgramNV) +#define glProgramParameter4dNV GLEW_GET_FUN(__glewProgramParameter4dNV) +#define glProgramParameter4dvNV GLEW_GET_FUN(__glewProgramParameter4dvNV) +#define glProgramParameter4fNV GLEW_GET_FUN(__glewProgramParameter4fNV) +#define glProgramParameter4fvNV GLEW_GET_FUN(__glewProgramParameter4fvNV) +#define glProgramParameters4dvNV GLEW_GET_FUN(__glewProgramParameters4dvNV) +#define glProgramParameters4fvNV GLEW_GET_FUN(__glewProgramParameters4fvNV) +#define glRequestResidentProgramsNV GLEW_GET_FUN(__glewRequestResidentProgramsNV) +#define glTrackMatrixNV GLEW_GET_FUN(__glewTrackMatrixNV) +#define glVertexAttrib1dNV GLEW_GET_FUN(__glewVertexAttrib1dNV) +#define glVertexAttrib1dvNV GLEW_GET_FUN(__glewVertexAttrib1dvNV) +#define glVertexAttrib1fNV GLEW_GET_FUN(__glewVertexAttrib1fNV) +#define glVertexAttrib1fvNV GLEW_GET_FUN(__glewVertexAttrib1fvNV) +#define glVertexAttrib1sNV GLEW_GET_FUN(__glewVertexAttrib1sNV) +#define glVertexAttrib1svNV GLEW_GET_FUN(__glewVertexAttrib1svNV) +#define glVertexAttrib2dNV GLEW_GET_FUN(__glewVertexAttrib2dNV) +#define glVertexAttrib2dvNV GLEW_GET_FUN(__glewVertexAttrib2dvNV) +#define glVertexAttrib2fNV GLEW_GET_FUN(__glewVertexAttrib2fNV) +#define glVertexAttrib2fvNV GLEW_GET_FUN(__glewVertexAttrib2fvNV) +#define glVertexAttrib2sNV GLEW_GET_FUN(__glewVertexAttrib2sNV) +#define glVertexAttrib2svNV GLEW_GET_FUN(__glewVertexAttrib2svNV) +#define glVertexAttrib3dNV GLEW_GET_FUN(__glewVertexAttrib3dNV) +#define glVertexAttrib3dvNV GLEW_GET_FUN(__glewVertexAttrib3dvNV) +#define glVertexAttrib3fNV GLEW_GET_FUN(__glewVertexAttrib3fNV) +#define glVertexAttrib3fvNV GLEW_GET_FUN(__glewVertexAttrib3fvNV) +#define glVertexAttrib3sNV GLEW_GET_FUN(__glewVertexAttrib3sNV) +#define glVertexAttrib3svNV GLEW_GET_FUN(__glewVertexAttrib3svNV) +#define glVertexAttrib4dNV GLEW_GET_FUN(__glewVertexAttrib4dNV) +#define glVertexAttrib4dvNV GLEW_GET_FUN(__glewVertexAttrib4dvNV) +#define glVertexAttrib4fNV GLEW_GET_FUN(__glewVertexAttrib4fNV) +#define glVertexAttrib4fvNV GLEW_GET_FUN(__glewVertexAttrib4fvNV) +#define glVertexAttrib4sNV GLEW_GET_FUN(__glewVertexAttrib4sNV) +#define glVertexAttrib4svNV GLEW_GET_FUN(__glewVertexAttrib4svNV) +#define glVertexAttrib4ubNV GLEW_GET_FUN(__glewVertexAttrib4ubNV) +#define glVertexAttrib4ubvNV GLEW_GET_FUN(__glewVertexAttrib4ubvNV) +#define glVertexAttribPointerNV GLEW_GET_FUN(__glewVertexAttribPointerNV) +#define glVertexAttribs1dvNV GLEW_GET_FUN(__glewVertexAttribs1dvNV) +#define glVertexAttribs1fvNV GLEW_GET_FUN(__glewVertexAttribs1fvNV) +#define glVertexAttribs1svNV GLEW_GET_FUN(__glewVertexAttribs1svNV) +#define glVertexAttribs2dvNV GLEW_GET_FUN(__glewVertexAttribs2dvNV) +#define glVertexAttribs2fvNV GLEW_GET_FUN(__glewVertexAttribs2fvNV) +#define glVertexAttribs2svNV GLEW_GET_FUN(__glewVertexAttribs2svNV) +#define glVertexAttribs3dvNV GLEW_GET_FUN(__glewVertexAttribs3dvNV) +#define glVertexAttribs3fvNV GLEW_GET_FUN(__glewVertexAttribs3fvNV) +#define glVertexAttribs3svNV GLEW_GET_FUN(__glewVertexAttribs3svNV) +#define glVertexAttribs4dvNV GLEW_GET_FUN(__glewVertexAttribs4dvNV) +#define glVertexAttribs4fvNV GLEW_GET_FUN(__glewVertexAttribs4fvNV) +#define glVertexAttribs4svNV GLEW_GET_FUN(__glewVertexAttribs4svNV) +#define glVertexAttribs4ubvNV GLEW_GET_FUN(__glewVertexAttribs4ubvNV) + +#define GLEW_NV_vertex_program GLEW_GET_VAR(__GLEW_NV_vertex_program) + +#endif /* GL_NV_vertex_program */ + +/* ------------------------ GL_NV_vertex_program1_1 ------------------------ */ + +#ifndef GL_NV_vertex_program1_1 +#define GL_NV_vertex_program1_1 1 + +#define GLEW_NV_vertex_program1_1 GLEW_GET_VAR(__GLEW_NV_vertex_program1_1) + +#endif /* GL_NV_vertex_program1_1 */ + +/* ------------------------- GL_NV_vertex_program2 ------------------------- */ + +#ifndef GL_NV_vertex_program2 +#define GL_NV_vertex_program2 1 + +#define GLEW_NV_vertex_program2 GLEW_GET_VAR(__GLEW_NV_vertex_program2) + +#endif /* GL_NV_vertex_program2 */ + +/* ---------------------- GL_NV_vertex_program2_option --------------------- */ + +#ifndef GL_NV_vertex_program2_option +#define GL_NV_vertex_program2_option 1 + +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 + +#define GLEW_NV_vertex_program2_option GLEW_GET_VAR(__GLEW_NV_vertex_program2_option) + +#endif /* GL_NV_vertex_program2_option */ + +/* ------------------------- GL_NV_vertex_program3 ------------------------- */ + +#ifndef GL_NV_vertex_program3 +#define GL_NV_vertex_program3 1 + +#define MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C + +#define GLEW_NV_vertex_program3 GLEW_GET_VAR(__GLEW_NV_vertex_program3) + +#endif /* GL_NV_vertex_program3 */ + +/* ------------------------- GL_NV_vertex_program4 ------------------------- */ + +#ifndef GL_NV_vertex_program4 +#define GL_NV_vertex_program4 1 + +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD + +#define GLEW_NV_vertex_program4 GLEW_GET_VAR(__GLEW_NV_vertex_program4) + +#endif /* GL_NV_vertex_program4 */ + +/* -------------------------- GL_NV_video_capture -------------------------- */ + +#ifndef GL_NV_video_capture +#define GL_NV_video_capture 1 + +#define GL_VIDEO_BUFFER_NV 0x9020 +#define GL_VIDEO_BUFFER_BINDING_NV 0x9021 +#define GL_FIELD_UPPER_NV 0x9022 +#define GL_FIELD_LOWER_NV 0x9023 +#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024 +#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025 +#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026 +#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027 +#define GL_VIDEO_BUFFER_PITCH_NV 0x9028 +#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029 +#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A +#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B +#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C +#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D +#define GL_PARTIAL_SUCCESS_NV 0x902E +#define GL_SUCCESS_NV 0x902F +#define GL_FAILURE_NV 0x9030 +#define GL_YCBYCR8_422_NV 0x9031 +#define GL_YCBAYCR8A_4224_NV 0x9032 +#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033 +#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034 +#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035 +#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036 +#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037 +#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038 +#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039 +#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A +#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B +#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C + +typedef void (GLAPIENTRY * PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot); +typedef void (GLAPIENTRY * PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); +typedef void (GLAPIENTRY * PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); +typedef void (GLAPIENTRY * PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot); +typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint* params); +typedef GLenum (GLAPIENTRY * PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint* sequence_num, GLuint64EXT *capture_time); +typedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble* params); +typedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint* params); + +#define glBeginVideoCaptureNV GLEW_GET_FUN(__glewBeginVideoCaptureNV) +#define glBindVideoCaptureStreamBufferNV GLEW_GET_FUN(__glewBindVideoCaptureStreamBufferNV) +#define glBindVideoCaptureStreamTextureNV GLEW_GET_FUN(__glewBindVideoCaptureStreamTextureNV) +#define glEndVideoCaptureNV GLEW_GET_FUN(__glewEndVideoCaptureNV) +#define glGetVideoCaptureStreamdvNV GLEW_GET_FUN(__glewGetVideoCaptureStreamdvNV) +#define glGetVideoCaptureStreamfvNV GLEW_GET_FUN(__glewGetVideoCaptureStreamfvNV) +#define glGetVideoCaptureStreamivNV GLEW_GET_FUN(__glewGetVideoCaptureStreamivNV) +#define glGetVideoCaptureivNV GLEW_GET_FUN(__glewGetVideoCaptureivNV) +#define glVideoCaptureNV GLEW_GET_FUN(__glewVideoCaptureNV) +#define glVideoCaptureStreamParameterdvNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterdvNV) +#define glVideoCaptureStreamParameterfvNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterfvNV) +#define glVideoCaptureStreamParameterivNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterivNV) + +#define GLEW_NV_video_capture GLEW_GET_VAR(__GLEW_NV_video_capture) + +#endif /* GL_NV_video_capture */ + +/* ------------------------- GL_NV_viewport_array2 ------------------------- */ + +#ifndef GL_NV_viewport_array2 +#define GL_NV_viewport_array2 1 + +#define GLEW_NV_viewport_array2 GLEW_GET_VAR(__GLEW_NV_viewport_array2) + +#endif /* GL_NV_viewport_array2 */ + +/* ------------------------ GL_OES_byte_coordinates ------------------------ */ + +#ifndef GL_OES_byte_coordinates +#define GL_OES_byte_coordinates 1 + +#define GLEW_OES_byte_coordinates GLEW_GET_VAR(__GLEW_OES_byte_coordinates) + +#endif /* GL_OES_byte_coordinates */ + +/* ------------------- GL_OES_compressed_paletted_texture ------------------ */ + +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 + +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 + +#define GLEW_OES_compressed_paletted_texture GLEW_GET_VAR(__GLEW_OES_compressed_paletted_texture) + +#endif /* GL_OES_compressed_paletted_texture */ + +/* --------------------------- GL_OES_read_format -------------------------- */ + +#ifndef GL_OES_read_format +#define GL_OES_read_format 1 + +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B + +#define GLEW_OES_read_format GLEW_GET_VAR(__GLEW_OES_read_format) + +#endif /* GL_OES_read_format */ + +/* ------------------------ GL_OES_single_precision ------------------------ */ + +#ifndef GL_OES_single_precision +#define GL_OES_single_precision 1 + +typedef void (GLAPIENTRY * PFNGLCLEARDEPTHFOESPROC) (GLclampf depth); +typedef void (GLAPIENTRY * PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat* equation); +typedef void (GLAPIENTRY * PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f); +typedef void (GLAPIENTRY * PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); +typedef void (GLAPIENTRY * PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat* equation); +typedef void (GLAPIENTRY * PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); + +#define glClearDepthfOES GLEW_GET_FUN(__glewClearDepthfOES) +#define glClipPlanefOES GLEW_GET_FUN(__glewClipPlanefOES) +#define glDepthRangefOES GLEW_GET_FUN(__glewDepthRangefOES) +#define glFrustumfOES GLEW_GET_FUN(__glewFrustumfOES) +#define glGetClipPlanefOES GLEW_GET_FUN(__glewGetClipPlanefOES) +#define glOrthofOES GLEW_GET_FUN(__glewOrthofOES) + +#define GLEW_OES_single_precision GLEW_GET_VAR(__GLEW_OES_single_precision) + +#endif /* GL_OES_single_precision */ + +/* ---------------------------- GL_OML_interlace --------------------------- */ + +#ifndef GL_OML_interlace +#define GL_OML_interlace 1 + +#define GL_INTERLACE_OML 0x8980 +#define GL_INTERLACE_READ_OML 0x8981 + +#define GLEW_OML_interlace GLEW_GET_VAR(__GLEW_OML_interlace) + +#endif /* GL_OML_interlace */ + +/* ---------------------------- GL_OML_resample ---------------------------- */ + +#ifndef GL_OML_resample +#define GL_OML_resample 1 + +#define GL_PACK_RESAMPLE_OML 0x8984 +#define GL_UNPACK_RESAMPLE_OML 0x8985 +#define GL_RESAMPLE_REPLICATE_OML 0x8986 +#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 +#define GL_RESAMPLE_AVERAGE_OML 0x8988 +#define GL_RESAMPLE_DECIMATE_OML 0x8989 + +#define GLEW_OML_resample GLEW_GET_VAR(__GLEW_OML_resample) + +#endif /* GL_OML_resample */ + +/* ---------------------------- GL_OML_subsample --------------------------- */ + +#ifndef GL_OML_subsample +#define GL_OML_subsample 1 + +#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 +#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 + +#define GLEW_OML_subsample GLEW_GET_VAR(__GLEW_OML_subsample) + +#endif /* GL_OML_subsample */ + +/* ---------------------------- GL_OVR_multiview --------------------------- */ + +#ifndef GL_OVR_multiview +#define GL_OVR_multiview 1 + +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 +#define GL_MAX_VIEWS_OVR 0x9631 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 +#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633 + +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); + +#define glFramebufferTextureMultiviewOVR GLEW_GET_FUN(__glewFramebufferTextureMultiviewOVR) + +#define GLEW_OVR_multiview GLEW_GET_VAR(__GLEW_OVR_multiview) + +#endif /* GL_OVR_multiview */ + +/* --------------------------- GL_OVR_multiview2 --------------------------- */ + +#ifndef GL_OVR_multiview2 +#define GL_OVR_multiview2 1 + +#define GLEW_OVR_multiview2 GLEW_GET_VAR(__GLEW_OVR_multiview2) + +#endif /* GL_OVR_multiview2 */ + +/* --------------------------- GL_PGI_misc_hints --------------------------- */ + +#ifndef GL_PGI_misc_hints +#define GL_PGI_misc_hints 1 + +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 107000 +#define GL_CONSERVE_MEMORY_HINT_PGI 107005 +#define GL_RECLAIM_MEMORY_HINT_PGI 107006 +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 107010 +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 107011 +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 107012 +#define GL_ALWAYS_FAST_HINT_PGI 107020 +#define GL_ALWAYS_SOFT_HINT_PGI 107021 +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 107022 +#define GL_ALLOW_DRAW_WIN_HINT_PGI 107023 +#define GL_ALLOW_DRAW_FRG_HINT_PGI 107024 +#define GL_ALLOW_DRAW_MEM_HINT_PGI 107025 +#define GL_STRICT_DEPTHFUNC_HINT_PGI 107030 +#define GL_STRICT_LIGHTING_HINT_PGI 107031 +#define GL_STRICT_SCISSOR_HINT_PGI 107032 +#define GL_FULL_STIPPLE_HINT_PGI 107033 +#define GL_CLIP_NEAR_HINT_PGI 107040 +#define GL_CLIP_FAR_HINT_PGI 107041 +#define GL_WIDE_LINE_HINT_PGI 107042 +#define GL_BACK_NORMALS_HINT_PGI 107043 + +#define GLEW_PGI_misc_hints GLEW_GET_VAR(__GLEW_PGI_misc_hints) + +#endif /* GL_PGI_misc_hints */ + +/* -------------------------- GL_PGI_vertex_hints -------------------------- */ + +#ifndef GL_PGI_vertex_hints +#define GL_PGI_vertex_hints 1 + +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 +#define GL_COLOR3_BIT_PGI 0x00010000 +#define GL_COLOR4_BIT_PGI 0x00020000 +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#define GL_INDEX_BIT_PGI 0x00080000 +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_VERTEX_DATA_HINT_PGI 107050 +#define GL_VERTEX_CONSISTENT_HINT_PGI 107051 +#define GL_MATERIAL_SIDE_HINT_PGI 107052 +#define GL_MAX_VERTEX_HINT_PGI 107053 +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_NORMAL_BIT_PGI 0x08000000 +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#define GL_TEXCOORD4_BIT_PGI 0x80000000 + +#define GLEW_PGI_vertex_hints GLEW_GET_VAR(__GLEW_PGI_vertex_hints) + +#endif /* GL_PGI_vertex_hints */ + +/* ---------------------- GL_REGAL_ES1_0_compatibility --------------------- */ + +#ifndef GL_REGAL_ES1_0_compatibility +#define GL_REGAL_ES1_0_compatibility 1 + +typedef int GLclampx; + +typedef void (GLAPIENTRY * PFNGLALPHAFUNCXPROC) (GLenum func, GLclampx ref); +typedef void (GLAPIENTRY * PFNGLCLEARCOLORXPROC) (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +typedef void (GLAPIENTRY * PFNGLCLEARDEPTHXPROC) (GLclampx depth); +typedef void (GLAPIENTRY * PFNGLCOLOR4XPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (GLAPIENTRY * PFNGLDEPTHRANGEXPROC) (GLclampx zNear, GLclampx zFar); +typedef void (GLAPIENTRY * PFNGLFOGXPROC) (GLenum pname, GLfixed param); +typedef void (GLAPIENTRY * PFNGLFOGXVPROC) (GLenum pname, const GLfixed* params); +typedef void (GLAPIENTRY * PFNGLFRUSTUMFPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +typedef void (GLAPIENTRY * PFNGLFRUSTUMXPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +typedef void (GLAPIENTRY * PFNGLLIGHTMODELXPROC) (GLenum pname, GLfixed param); +typedef void (GLAPIENTRY * PFNGLLIGHTMODELXVPROC) (GLenum pname, const GLfixed* params); +typedef void (GLAPIENTRY * PFNGLLIGHTXPROC) (GLenum light, GLenum pname, GLfixed param); +typedef void (GLAPIENTRY * PFNGLLIGHTXVPROC) (GLenum light, GLenum pname, const GLfixed* params); +typedef void (GLAPIENTRY * PFNGLLINEWIDTHXPROC) (GLfixed width); +typedef void (GLAPIENTRY * PFNGLLOADMATRIXXPROC) (const GLfixed* m); +typedef void (GLAPIENTRY * PFNGLMATERIALXPROC) (GLenum face, GLenum pname, GLfixed param); +typedef void (GLAPIENTRY * PFNGLMATERIALXVPROC) (GLenum face, GLenum pname, const GLfixed* params); +typedef void (GLAPIENTRY * PFNGLMULTMATRIXXPROC) (const GLfixed* m); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4XPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +typedef void (GLAPIENTRY * PFNGLNORMAL3XPROC) (GLfixed nx, GLfixed ny, GLfixed nz); +typedef void (GLAPIENTRY * PFNGLORTHOFPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +typedef void (GLAPIENTRY * PFNGLORTHOXPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +typedef void (GLAPIENTRY * PFNGLPOINTSIZEXPROC) (GLfixed size); +typedef void (GLAPIENTRY * PFNGLPOLYGONOFFSETXPROC) (GLfixed factor, GLfixed units); +typedef void (GLAPIENTRY * PFNGLROTATEXPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +typedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEXPROC) (GLclampx value, GLboolean invert); +typedef void (GLAPIENTRY * PFNGLSCALEXPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (GLAPIENTRY * PFNGLTEXENVXPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (GLAPIENTRY * PFNGLTEXENVXVPROC) (GLenum target, GLenum pname, const GLfixed* params); +typedef void (GLAPIENTRY * PFNGLTEXPARAMETERXPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (GLAPIENTRY * PFNGLTRANSLATEXPROC) (GLfixed x, GLfixed y, GLfixed z); + +#define glAlphaFuncx GLEW_GET_FUN(__glewAlphaFuncx) +#define glClearColorx GLEW_GET_FUN(__glewClearColorx) +#define glClearDepthx GLEW_GET_FUN(__glewClearDepthx) +#define glColor4x GLEW_GET_FUN(__glewColor4x) +#define glDepthRangex GLEW_GET_FUN(__glewDepthRangex) +#define glFogx GLEW_GET_FUN(__glewFogx) +#define glFogxv GLEW_GET_FUN(__glewFogxv) +#define glFrustumf GLEW_GET_FUN(__glewFrustumf) +#define glFrustumx GLEW_GET_FUN(__glewFrustumx) +#define glLightModelx GLEW_GET_FUN(__glewLightModelx) +#define glLightModelxv GLEW_GET_FUN(__glewLightModelxv) +#define glLightx GLEW_GET_FUN(__glewLightx) +#define glLightxv GLEW_GET_FUN(__glewLightxv) +#define glLineWidthx GLEW_GET_FUN(__glewLineWidthx) +#define glLoadMatrixx GLEW_GET_FUN(__glewLoadMatrixx) +#define glMaterialx GLEW_GET_FUN(__glewMaterialx) +#define glMaterialxv GLEW_GET_FUN(__glewMaterialxv) +#define glMultMatrixx GLEW_GET_FUN(__glewMultMatrixx) +#define glMultiTexCoord4x GLEW_GET_FUN(__glewMultiTexCoord4x) +#define glNormal3x GLEW_GET_FUN(__glewNormal3x) +#define glOrthof GLEW_GET_FUN(__glewOrthof) +#define glOrthox GLEW_GET_FUN(__glewOrthox) +#define glPointSizex GLEW_GET_FUN(__glewPointSizex) +#define glPolygonOffsetx GLEW_GET_FUN(__glewPolygonOffsetx) +#define glRotatex GLEW_GET_FUN(__glewRotatex) +#define glSampleCoveragex GLEW_GET_FUN(__glewSampleCoveragex) +#define glScalex GLEW_GET_FUN(__glewScalex) +#define glTexEnvx GLEW_GET_FUN(__glewTexEnvx) +#define glTexEnvxv GLEW_GET_FUN(__glewTexEnvxv) +#define glTexParameterx GLEW_GET_FUN(__glewTexParameterx) +#define glTranslatex GLEW_GET_FUN(__glewTranslatex) + +#define GLEW_REGAL_ES1_0_compatibility GLEW_GET_VAR(__GLEW_REGAL_ES1_0_compatibility) + +#endif /* GL_REGAL_ES1_0_compatibility */ + +/* ---------------------- GL_REGAL_ES1_1_compatibility --------------------- */ + +#ifndef GL_REGAL_ES1_1_compatibility +#define GL_REGAL_ES1_1_compatibility 1 + +typedef void (GLAPIENTRY * PFNGLCLIPPLANEFPROC) (GLenum plane, const GLfloat* equation); +typedef void (GLAPIENTRY * PFNGLCLIPPLANEXPROC) (GLenum plane, const GLfixed* equation); +typedef void (GLAPIENTRY * PFNGLGETCLIPPLANEFPROC) (GLenum pname, GLfloat eqn[4]); +typedef void (GLAPIENTRY * PFNGLGETCLIPPLANEXPROC) (GLenum pname, GLfixed eqn[4]); +typedef void (GLAPIENTRY * PFNGLGETFIXEDVPROC) (GLenum pname, GLfixed* params); +typedef void (GLAPIENTRY * PFNGLGETLIGHTXVPROC) (GLenum light, GLenum pname, GLfixed* params); +typedef void (GLAPIENTRY * PFNGLGETMATERIALXVPROC) (GLenum face, GLenum pname, GLfixed* params); +typedef void (GLAPIENTRY * PFNGLGETTEXENVXVPROC) (GLenum env, GLenum pname, GLfixed* params); +typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERXVPROC) (GLenum target, GLenum pname, GLfixed* params); +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERXPROC) (GLenum pname, GLfixed param); +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERXVPROC) (GLenum pname, const GLfixed* params); +typedef void (GLAPIENTRY * PFNGLPOINTSIZEPOINTEROESPROC) (GLenum type, GLsizei stride, const void *pointer); +typedef void (GLAPIENTRY * PFNGLTEXPARAMETERXVPROC) (GLenum target, GLenum pname, const GLfixed* params); + +#define glClipPlanef GLEW_GET_FUN(__glewClipPlanef) +#define glClipPlanex GLEW_GET_FUN(__glewClipPlanex) +#define glGetClipPlanef GLEW_GET_FUN(__glewGetClipPlanef) +#define glGetClipPlanex GLEW_GET_FUN(__glewGetClipPlanex) +#define glGetFixedv GLEW_GET_FUN(__glewGetFixedv) +#define glGetLightxv GLEW_GET_FUN(__glewGetLightxv) +#define glGetMaterialxv GLEW_GET_FUN(__glewGetMaterialxv) +#define glGetTexEnvxv GLEW_GET_FUN(__glewGetTexEnvxv) +#define glGetTexParameterxv GLEW_GET_FUN(__glewGetTexParameterxv) +#define glPointParameterx GLEW_GET_FUN(__glewPointParameterx) +#define glPointParameterxv GLEW_GET_FUN(__glewPointParameterxv) +#define glPointSizePointerOES GLEW_GET_FUN(__glewPointSizePointerOES) +#define glTexParameterxv GLEW_GET_FUN(__glewTexParameterxv) + +#define GLEW_REGAL_ES1_1_compatibility GLEW_GET_VAR(__GLEW_REGAL_ES1_1_compatibility) + +#endif /* GL_REGAL_ES1_1_compatibility */ + +/* ---------------------------- GL_REGAL_enable ---------------------------- */ + +#ifndef GL_REGAL_enable +#define GL_REGAL_enable 1 + +#define GL_ERROR_REGAL 0x9322 +#define GL_DEBUG_REGAL 0x9323 +#define GL_LOG_REGAL 0x9324 +#define GL_EMULATION_REGAL 0x9325 +#define GL_DRIVER_REGAL 0x9326 +#define GL_MISSING_REGAL 0x9360 +#define GL_TRACE_REGAL 0x9361 +#define GL_CACHE_REGAL 0x9362 +#define GL_CODE_REGAL 0x9363 +#define GL_STATISTICS_REGAL 0x9364 + +#define GLEW_REGAL_enable GLEW_GET_VAR(__GLEW_REGAL_enable) + +#endif /* GL_REGAL_enable */ + +/* ------------------------- GL_REGAL_error_string ------------------------- */ + +#ifndef GL_REGAL_error_string +#define GL_REGAL_error_string 1 + +typedef const GLchar* (GLAPIENTRY * PFNGLERRORSTRINGREGALPROC) (GLenum error); + +#define glErrorStringREGAL GLEW_GET_FUN(__glewErrorStringREGAL) + +#define GLEW_REGAL_error_string GLEW_GET_VAR(__GLEW_REGAL_error_string) + +#endif /* GL_REGAL_error_string */ + +/* ------------------------ GL_REGAL_extension_query ----------------------- */ + +#ifndef GL_REGAL_extension_query +#define GL_REGAL_extension_query 1 + +typedef GLboolean (GLAPIENTRY * PFNGLGETEXTENSIONREGALPROC) (const GLchar* ext); +typedef GLboolean (GLAPIENTRY * PFNGLISSUPPORTEDREGALPROC) (const GLchar* ext); + +#define glGetExtensionREGAL GLEW_GET_FUN(__glewGetExtensionREGAL) +#define glIsSupportedREGAL GLEW_GET_FUN(__glewIsSupportedREGAL) + +#define GLEW_REGAL_extension_query GLEW_GET_VAR(__GLEW_REGAL_extension_query) + +#endif /* GL_REGAL_extension_query */ + +/* ------------------------------ GL_REGAL_log ----------------------------- */ + +#ifndef GL_REGAL_log +#define GL_REGAL_log 1 + +#define GL_LOG_ERROR_REGAL 0x9319 +#define GL_LOG_WARNING_REGAL 0x931A +#define GL_LOG_INFO_REGAL 0x931B +#define GL_LOG_APP_REGAL 0x931C +#define GL_LOG_DRIVER_REGAL 0x931D +#define GL_LOG_INTERNAL_REGAL 0x931E +#define GL_LOG_DEBUG_REGAL 0x931F +#define GL_LOG_STATUS_REGAL 0x9320 +#define GL_LOG_HTTP_REGAL 0x9321 + +typedef void (APIENTRY *GLLOGPROCREGAL)(GLenum stream, GLsizei length, const GLchar *message, void *context); + +typedef void (GLAPIENTRY * PFNGLLOGMESSAGECALLBACKREGALPROC) (GLLOGPROCREGAL callback); + +#define glLogMessageCallbackREGAL GLEW_GET_FUN(__glewLogMessageCallbackREGAL) + +#define GLEW_REGAL_log GLEW_GET_VAR(__GLEW_REGAL_log) + +#endif /* GL_REGAL_log */ + +/* ------------------------- GL_REGAL_proc_address ------------------------- */ + +#ifndef GL_REGAL_proc_address +#define GL_REGAL_proc_address 1 + +typedef void * (GLAPIENTRY * PFNGLGETPROCADDRESSREGALPROC) (const GLchar *name); + +#define glGetProcAddressREGAL GLEW_GET_FUN(__glewGetProcAddressREGAL) + +#define GLEW_REGAL_proc_address GLEW_GET_VAR(__GLEW_REGAL_proc_address) + +#endif /* GL_REGAL_proc_address */ + +/* ----------------------- GL_REND_screen_coordinates ---------------------- */ + +#ifndef GL_REND_screen_coordinates +#define GL_REND_screen_coordinates 1 + +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_INVERTED_SCREEN_W_REND 0x8491 + +#define GLEW_REND_screen_coordinates GLEW_GET_VAR(__GLEW_REND_screen_coordinates) + +#endif /* GL_REND_screen_coordinates */ + +/* ------------------------------- GL_S3_s3tc ------------------------------ */ + +#ifndef GL_S3_s3tc +#define GL_S3_s3tc 1 + +#define GL_RGB_S3TC 0x83A0 +#define GL_RGB4_S3TC 0x83A1 +#define GL_RGBA_S3TC 0x83A2 +#define GL_RGBA4_S3TC 0x83A3 +#define GL_RGBA_DXT5_S3TC 0x83A4 +#define GL_RGBA4_DXT5_S3TC 0x83A5 + +#define GLEW_S3_s3tc GLEW_GET_VAR(__GLEW_S3_s3tc) + +#endif /* GL_S3_s3tc */ + +/* -------------------------- GL_SGIS_color_range -------------------------- */ + +#ifndef GL_SGIS_color_range +#define GL_SGIS_color_range 1 + +#define GL_EXTENDED_RANGE_SGIS 0x85A5 +#define GL_MIN_RED_SGIS 0x85A6 +#define GL_MAX_RED_SGIS 0x85A7 +#define GL_MIN_GREEN_SGIS 0x85A8 +#define GL_MAX_GREEN_SGIS 0x85A9 +#define GL_MIN_BLUE_SGIS 0x85AA +#define GL_MAX_BLUE_SGIS 0x85AB +#define GL_MIN_ALPHA_SGIS 0x85AC +#define GL_MAX_ALPHA_SGIS 0x85AD + +#define GLEW_SGIS_color_range GLEW_GET_VAR(__GLEW_SGIS_color_range) + +#endif /* GL_SGIS_color_range */ + +/* ------------------------- GL_SGIS_detail_texture ------------------------ */ + +#ifndef GL_SGIS_detail_texture +#define GL_SGIS_detail_texture 1 + +typedef void (GLAPIENTRY * PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat* points); +typedef void (GLAPIENTRY * PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat* points); + +#define glDetailTexFuncSGIS GLEW_GET_FUN(__glewDetailTexFuncSGIS) +#define glGetDetailTexFuncSGIS GLEW_GET_FUN(__glewGetDetailTexFuncSGIS) + +#define GLEW_SGIS_detail_texture GLEW_GET_VAR(__GLEW_SGIS_detail_texture) + +#endif /* GL_SGIS_detail_texture */ + +/* -------------------------- GL_SGIS_fog_function ------------------------- */ + +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 + +typedef void (GLAPIENTRY * PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat* points); +typedef void (GLAPIENTRY * PFNGLGETFOGFUNCSGISPROC) (GLfloat* points); + +#define glFogFuncSGIS GLEW_GET_FUN(__glewFogFuncSGIS) +#define glGetFogFuncSGIS GLEW_GET_FUN(__glewGetFogFuncSGIS) + +#define GLEW_SGIS_fog_function GLEW_GET_VAR(__GLEW_SGIS_fog_function) + +#endif /* GL_SGIS_fog_function */ + +/* ------------------------ GL_SGIS_generate_mipmap ------------------------ */ + +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 + +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 + +#define GLEW_SGIS_generate_mipmap GLEW_GET_VAR(__GLEW_SGIS_generate_mipmap) + +#endif /* GL_SGIS_generate_mipmap */ + +/* -------------------------- GL_SGIS_multisample -------------------------- */ + +#ifndef GL_SGIS_multisample +#define GL_SGIS_multisample 1 + +#define GL_MULTISAMPLE_SGIS 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#define GL_1PASS_SGIS 0x80A1 +#define GL_2PASS_0_SGIS 0x80A2 +#define GL_2PASS_1_SGIS 0x80A3 +#define GL_4PASS_0_SGIS 0x80A4 +#define GL_4PASS_1_SGIS 0x80A5 +#define GL_4PASS_2_SGIS 0x80A6 +#define GL_4PASS_3_SGIS 0x80A7 +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#define GL_SAMPLES_SGIS 0x80A9 +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#define GL_SAMPLE_PATTERN_SGIS 0x80AC + +typedef void (GLAPIENTRY * PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); +typedef void (GLAPIENTRY * PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); + +#define glSampleMaskSGIS GLEW_GET_FUN(__glewSampleMaskSGIS) +#define glSamplePatternSGIS GLEW_GET_FUN(__glewSamplePatternSGIS) + +#define GLEW_SGIS_multisample GLEW_GET_VAR(__GLEW_SGIS_multisample) + +#endif /* GL_SGIS_multisample */ + +/* ------------------------- GL_SGIS_pixel_texture ------------------------- */ + +#ifndef GL_SGIS_pixel_texture +#define GL_SGIS_pixel_texture 1 + +#define GLEW_SGIS_pixel_texture GLEW_GET_VAR(__GLEW_SGIS_pixel_texture) + +#endif /* GL_SGIS_pixel_texture */ + +/* ----------------------- GL_SGIS_point_line_texgen ----------------------- */ + +#ifndef GL_SGIS_point_line_texgen +#define GL_SGIS_point_line_texgen 1 + +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#define GL_EYE_POINT_SGIS 0x81F4 +#define GL_OBJECT_POINT_SGIS 0x81F5 +#define GL_EYE_LINE_SGIS 0x81F6 +#define GL_OBJECT_LINE_SGIS 0x81F7 + +#define GLEW_SGIS_point_line_texgen GLEW_GET_VAR(__GLEW_SGIS_point_line_texgen) + +#endif /* GL_SGIS_point_line_texgen */ + +/* ------------------------ GL_SGIS_sharpen_texture ------------------------ */ + +#ifndef GL_SGIS_sharpen_texture +#define GL_SGIS_sharpen_texture 1 + +typedef void (GLAPIENTRY * PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat* points); +typedef void (GLAPIENTRY * PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat* points); + +#define glGetSharpenTexFuncSGIS GLEW_GET_FUN(__glewGetSharpenTexFuncSGIS) +#define glSharpenTexFuncSGIS GLEW_GET_FUN(__glewSharpenTexFuncSGIS) + +#define GLEW_SGIS_sharpen_texture GLEW_GET_VAR(__GLEW_SGIS_sharpen_texture) + +#endif /* GL_SGIS_sharpen_texture */ + +/* --------------------------- GL_SGIS_texture4D --------------------------- */ + +#ifndef GL_SGIS_texture4D +#define GL_SGIS_texture4D 1 + +typedef void (GLAPIENTRY * PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLenum format, GLenum type, const void *pixels); + +#define glTexImage4DSGIS GLEW_GET_FUN(__glewTexImage4DSGIS) +#define glTexSubImage4DSGIS GLEW_GET_FUN(__glewTexSubImage4DSGIS) + +#define GLEW_SGIS_texture4D GLEW_GET_VAR(__GLEW_SGIS_texture4D) + +#endif /* GL_SGIS_texture4D */ + +/* ---------------------- GL_SGIS_texture_border_clamp --------------------- */ + +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 + +#define GL_CLAMP_TO_BORDER_SGIS 0x812D + +#define GLEW_SGIS_texture_border_clamp GLEW_GET_VAR(__GLEW_SGIS_texture_border_clamp) + +#endif /* GL_SGIS_texture_border_clamp */ + +/* ----------------------- GL_SGIS_texture_edge_clamp ---------------------- */ + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 + +#define GL_CLAMP_TO_EDGE_SGIS 0x812F + +#define GLEW_SGIS_texture_edge_clamp GLEW_GET_VAR(__GLEW_SGIS_texture_edge_clamp) + +#endif /* GL_SGIS_texture_edge_clamp */ + +/* ------------------------ GL_SGIS_texture_filter4 ------------------------ */ + +#ifndef GL_SGIS_texture_filter4 +#define GL_SGIS_texture_filter4 1 + +typedef void (GLAPIENTRY * PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat* weights); +typedef void (GLAPIENTRY * PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat* weights); + +#define glGetTexFilterFuncSGIS GLEW_GET_FUN(__glewGetTexFilterFuncSGIS) +#define glTexFilterFuncSGIS GLEW_GET_FUN(__glewTexFilterFuncSGIS) + +#define GLEW_SGIS_texture_filter4 GLEW_GET_VAR(__GLEW_SGIS_texture_filter4) + +#endif /* GL_SGIS_texture_filter4 */ + +/* -------------------------- GL_SGIS_texture_lod -------------------------- */ + +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 + +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D + +#define GLEW_SGIS_texture_lod GLEW_GET_VAR(__GLEW_SGIS_texture_lod) + +#endif /* GL_SGIS_texture_lod */ + +/* ------------------------- GL_SGIS_texture_select ------------------------ */ + +#ifndef GL_SGIS_texture_select +#define GL_SGIS_texture_select 1 + +#define GLEW_SGIS_texture_select GLEW_GET_VAR(__GLEW_SGIS_texture_select) + +#endif /* GL_SGIS_texture_select */ + +/* ----------------------------- GL_SGIX_async ----------------------------- */ + +#ifndef GL_SGIX_async +#define GL_SGIX_async 1 + +#define GL_ASYNC_MARKER_SGIX 0x8329 + +typedef void (GLAPIENTRY * PFNGLASYNCMARKERSGIXPROC) (GLuint marker); +typedef void (GLAPIENTRY * PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); +typedef GLint (GLAPIENTRY * PFNGLFINISHASYNCSGIXPROC) (GLuint* markerp); +typedef GLuint (GLAPIENTRY * PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); +typedef GLboolean (GLAPIENTRY * PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); +typedef GLint (GLAPIENTRY * PFNGLPOLLASYNCSGIXPROC) (GLuint* markerp); + +#define glAsyncMarkerSGIX GLEW_GET_FUN(__glewAsyncMarkerSGIX) +#define glDeleteAsyncMarkersSGIX GLEW_GET_FUN(__glewDeleteAsyncMarkersSGIX) +#define glFinishAsyncSGIX GLEW_GET_FUN(__glewFinishAsyncSGIX) +#define glGenAsyncMarkersSGIX GLEW_GET_FUN(__glewGenAsyncMarkersSGIX) +#define glIsAsyncMarkerSGIX GLEW_GET_FUN(__glewIsAsyncMarkerSGIX) +#define glPollAsyncSGIX GLEW_GET_FUN(__glewPollAsyncSGIX) + +#define GLEW_SGIX_async GLEW_GET_VAR(__GLEW_SGIX_async) + +#endif /* GL_SGIX_async */ + +/* ------------------------ GL_SGIX_async_histogram ------------------------ */ + +#ifndef GL_SGIX_async_histogram +#define GL_SGIX_async_histogram 1 + +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D + +#define GLEW_SGIX_async_histogram GLEW_GET_VAR(__GLEW_SGIX_async_histogram) + +#endif /* GL_SGIX_async_histogram */ + +/* -------------------------- GL_SGIX_async_pixel -------------------------- */ + +#ifndef GL_SGIX_async_pixel +#define GL_SGIX_async_pixel 1 + +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 + +#define GLEW_SGIX_async_pixel GLEW_GET_VAR(__GLEW_SGIX_async_pixel) + +#endif /* GL_SGIX_async_pixel */ + +/* ----------------------- GL_SGIX_blend_alpha_minmax ---------------------- */ + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 + +#define GL_ALPHA_MIN_SGIX 0x8320 +#define GL_ALPHA_MAX_SGIX 0x8321 + +#define GLEW_SGIX_blend_alpha_minmax GLEW_GET_VAR(__GLEW_SGIX_blend_alpha_minmax) + +#endif /* GL_SGIX_blend_alpha_minmax */ + +/* ---------------------------- GL_SGIX_clipmap ---------------------------- */ + +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 + +#define GLEW_SGIX_clipmap GLEW_GET_VAR(__GLEW_SGIX_clipmap) + +#endif /* GL_SGIX_clipmap */ + +/* ---------------------- GL_SGIX_convolution_accuracy --------------------- */ + +#ifndef GL_SGIX_convolution_accuracy +#define GL_SGIX_convolution_accuracy 1 + +#define GL_CONVOLUTION_HINT_SGIX 0x8316 + +#define GLEW_SGIX_convolution_accuracy GLEW_GET_VAR(__GLEW_SGIX_convolution_accuracy) + +#endif /* GL_SGIX_convolution_accuracy */ + +/* ------------------------- GL_SGIX_depth_texture ------------------------- */ + +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 + +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 + +#define GLEW_SGIX_depth_texture GLEW_GET_VAR(__GLEW_SGIX_depth_texture) + +#endif /* GL_SGIX_depth_texture */ + +/* -------------------------- GL_SGIX_flush_raster ------------------------- */ + +#ifndef GL_SGIX_flush_raster +#define GL_SGIX_flush_raster 1 + +typedef void (GLAPIENTRY * PFNGLFLUSHRASTERSGIXPROC) (void); + +#define glFlushRasterSGIX GLEW_GET_FUN(__glewFlushRasterSGIX) + +#define GLEW_SGIX_flush_raster GLEW_GET_VAR(__GLEW_SGIX_flush_raster) + +#endif /* GL_SGIX_flush_raster */ + +/* --------------------------- GL_SGIX_fog_offset -------------------------- */ + +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 + +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 + +#define GLEW_SGIX_fog_offset GLEW_GET_VAR(__GLEW_SGIX_fog_offset) + +#endif /* GL_SGIX_fog_offset */ + +/* -------------------------- GL_SGIX_fog_texture -------------------------- */ + +#ifndef GL_SGIX_fog_texture +#define GL_SGIX_fog_texture 1 + +#define GL_FOG_PATCHY_FACTOR_SGIX 0 +#define GL_FRAGMENT_FOG_SGIX 0 +#define GL_TEXTURE_FOG_SGIX 0 + +typedef void (GLAPIENTRY * PFNGLTEXTUREFOGSGIXPROC) (GLenum pname); + +#define glTextureFogSGIX GLEW_GET_FUN(__glewTextureFogSGIX) + +#define GLEW_SGIX_fog_texture GLEW_GET_VAR(__GLEW_SGIX_fog_texture) + +#endif /* GL_SGIX_fog_texture */ + +/* ------------------- GL_SGIX_fragment_specular_lighting ------------------ */ + +#ifndef GL_SGIX_fragment_specular_lighting +#define GL_SGIX_fragment_specular_lighting 1 + +typedef void (GLAPIENTRY * PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, const GLfloat param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, const GLint param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum value, GLfloat* data); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum value, GLint* data); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat* data); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* data); + +#define glFragmentColorMaterialSGIX GLEW_GET_FUN(__glewFragmentColorMaterialSGIX) +#define glFragmentLightModelfSGIX GLEW_GET_FUN(__glewFragmentLightModelfSGIX) +#define glFragmentLightModelfvSGIX GLEW_GET_FUN(__glewFragmentLightModelfvSGIX) +#define glFragmentLightModeliSGIX GLEW_GET_FUN(__glewFragmentLightModeliSGIX) +#define glFragmentLightModelivSGIX GLEW_GET_FUN(__glewFragmentLightModelivSGIX) +#define glFragmentLightfSGIX GLEW_GET_FUN(__glewFragmentLightfSGIX) +#define glFragmentLightfvSGIX GLEW_GET_FUN(__glewFragmentLightfvSGIX) +#define glFragmentLightiSGIX GLEW_GET_FUN(__glewFragmentLightiSGIX) +#define glFragmentLightivSGIX GLEW_GET_FUN(__glewFragmentLightivSGIX) +#define glFragmentMaterialfSGIX GLEW_GET_FUN(__glewFragmentMaterialfSGIX) +#define glFragmentMaterialfvSGIX GLEW_GET_FUN(__glewFragmentMaterialfvSGIX) +#define glFragmentMaterialiSGIX GLEW_GET_FUN(__glewFragmentMaterialiSGIX) +#define glFragmentMaterialivSGIX GLEW_GET_FUN(__glewFragmentMaterialivSGIX) +#define glGetFragmentLightfvSGIX GLEW_GET_FUN(__glewGetFragmentLightfvSGIX) +#define glGetFragmentLightivSGIX GLEW_GET_FUN(__glewGetFragmentLightivSGIX) +#define glGetFragmentMaterialfvSGIX GLEW_GET_FUN(__glewGetFragmentMaterialfvSGIX) +#define glGetFragmentMaterialivSGIX GLEW_GET_FUN(__glewGetFragmentMaterialivSGIX) + +#define GLEW_SGIX_fragment_specular_lighting GLEW_GET_VAR(__GLEW_SGIX_fragment_specular_lighting) + +#endif /* GL_SGIX_fragment_specular_lighting */ + +/* --------------------------- GL_SGIX_framezoom --------------------------- */ + +#ifndef GL_SGIX_framezoom +#define GL_SGIX_framezoom 1 + +typedef void (GLAPIENTRY * PFNGLFRAMEZOOMSGIXPROC) (GLint factor); + +#define glFrameZoomSGIX GLEW_GET_FUN(__glewFrameZoomSGIX) + +#define GLEW_SGIX_framezoom GLEW_GET_VAR(__GLEW_SGIX_framezoom) + +#endif /* GL_SGIX_framezoom */ + +/* --------------------------- GL_SGIX_interlace --------------------------- */ + +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 + +#define GL_INTERLACE_SGIX 0x8094 + +#define GLEW_SGIX_interlace GLEW_GET_VAR(__GLEW_SGIX_interlace) + +#endif /* GL_SGIX_interlace */ + +/* ------------------------- GL_SGIX_ir_instrument1 ------------------------ */ + +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 + +#define GLEW_SGIX_ir_instrument1 GLEW_GET_VAR(__GLEW_SGIX_ir_instrument1) + +#endif /* GL_SGIX_ir_instrument1 */ + +/* ------------------------- GL_SGIX_list_priority ------------------------- */ + +#ifndef GL_SGIX_list_priority +#define GL_SGIX_list_priority 1 + +#define GLEW_SGIX_list_priority GLEW_GET_VAR(__GLEW_SGIX_list_priority) + +#endif /* GL_SGIX_list_priority */ + +/* ------------------------- GL_SGIX_pixel_texture ------------------------- */ + +#ifndef GL_SGIX_pixel_texture +#define GL_SGIX_pixel_texture 1 + +typedef void (GLAPIENTRY * PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); + +#define glPixelTexGenSGIX GLEW_GET_FUN(__glewPixelTexGenSGIX) + +#define GLEW_SGIX_pixel_texture GLEW_GET_VAR(__GLEW_SGIX_pixel_texture) + +#endif /* GL_SGIX_pixel_texture */ + +/* ----------------------- GL_SGIX_pixel_texture_bits ---------------------- */ + +#ifndef GL_SGIX_pixel_texture_bits +#define GL_SGIX_pixel_texture_bits 1 + +#define GLEW_SGIX_pixel_texture_bits GLEW_GET_VAR(__GLEW_SGIX_pixel_texture_bits) + +#endif /* GL_SGIX_pixel_texture_bits */ + +/* ------------------------ GL_SGIX_reference_plane ------------------------ */ + +#ifndef GL_SGIX_reference_plane +#define GL_SGIX_reference_plane 1 + +typedef void (GLAPIENTRY * PFNGLREFERENCEPLANESGIXPROC) (const GLdouble* equation); + +#define glReferencePlaneSGIX GLEW_GET_FUN(__glewReferencePlaneSGIX) + +#define GLEW_SGIX_reference_plane GLEW_GET_VAR(__GLEW_SGIX_reference_plane) + +#endif /* GL_SGIX_reference_plane */ + +/* ---------------------------- GL_SGIX_resample --------------------------- */ + +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 + +#define GL_PACK_RESAMPLE_SGIX 0x842E +#define GL_UNPACK_RESAMPLE_SGIX 0x842F +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#define GL_RESAMPLE_REPLICATE_SGIX 0x8433 +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x8434 + +#define GLEW_SGIX_resample GLEW_GET_VAR(__GLEW_SGIX_resample) + +#endif /* GL_SGIX_resample */ + +/* ----------------------------- GL_SGIX_shadow ---------------------------- */ + +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 + +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D + +#define GLEW_SGIX_shadow GLEW_GET_VAR(__GLEW_SGIX_shadow) + +#endif /* GL_SGIX_shadow */ + +/* ------------------------- GL_SGIX_shadow_ambient ------------------------ */ + +#ifndef GL_SGIX_shadow_ambient +#define GL_SGIX_shadow_ambient 1 + +#define GL_SHADOW_AMBIENT_SGIX 0x80BF + +#define GLEW_SGIX_shadow_ambient GLEW_GET_VAR(__GLEW_SGIX_shadow_ambient) + +#endif /* GL_SGIX_shadow_ambient */ + +/* ----------------------------- GL_SGIX_sprite ---------------------------- */ + +#ifndef GL_SGIX_sprite +#define GL_SGIX_sprite 1 + +typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, GLint* params); + +#define glSpriteParameterfSGIX GLEW_GET_FUN(__glewSpriteParameterfSGIX) +#define glSpriteParameterfvSGIX GLEW_GET_FUN(__glewSpriteParameterfvSGIX) +#define glSpriteParameteriSGIX GLEW_GET_FUN(__glewSpriteParameteriSGIX) +#define glSpriteParameterivSGIX GLEW_GET_FUN(__glewSpriteParameterivSGIX) + +#define GLEW_SGIX_sprite GLEW_GET_VAR(__GLEW_SGIX_sprite) + +#endif /* GL_SGIX_sprite */ + +/* ----------------------- GL_SGIX_tag_sample_buffer ----------------------- */ + +#ifndef GL_SGIX_tag_sample_buffer +#define GL_SGIX_tag_sample_buffer 1 + +typedef void (GLAPIENTRY * PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); + +#define glTagSampleBufferSGIX GLEW_GET_FUN(__glewTagSampleBufferSGIX) + +#define GLEW_SGIX_tag_sample_buffer GLEW_GET_VAR(__GLEW_SGIX_tag_sample_buffer) + +#endif /* GL_SGIX_tag_sample_buffer */ + +/* ------------------------ GL_SGIX_texture_add_env ------------------------ */ + +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 + +#define GLEW_SGIX_texture_add_env GLEW_GET_VAR(__GLEW_SGIX_texture_add_env) + +#endif /* GL_SGIX_texture_add_env */ + +/* -------------------- GL_SGIX_texture_coordinate_clamp ------------------- */ + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_SGIX_texture_coordinate_clamp 1 + +#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 +#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A +#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B + +#define GLEW_SGIX_texture_coordinate_clamp GLEW_GET_VAR(__GLEW_SGIX_texture_coordinate_clamp) + +#endif /* GL_SGIX_texture_coordinate_clamp */ + +/* ------------------------ GL_SGIX_texture_lod_bias ----------------------- */ + +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 + +#define GLEW_SGIX_texture_lod_bias GLEW_GET_VAR(__GLEW_SGIX_texture_lod_bias) + +#endif /* GL_SGIX_texture_lod_bias */ + +/* ---------------------- GL_SGIX_texture_multi_buffer --------------------- */ + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_SGIX_texture_multi_buffer 1 + +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E + +#define GLEW_SGIX_texture_multi_buffer GLEW_GET_VAR(__GLEW_SGIX_texture_multi_buffer) + +#endif /* GL_SGIX_texture_multi_buffer */ + +/* ------------------------- GL_SGIX_texture_range ------------------------- */ + +#ifndef GL_SGIX_texture_range +#define GL_SGIX_texture_range 1 + +#define GL_RGB_SIGNED_SGIX 0x85E0 +#define GL_RGBA_SIGNED_SGIX 0x85E1 +#define GL_ALPHA_SIGNED_SGIX 0x85E2 +#define GL_LUMINANCE_SIGNED_SGIX 0x85E3 +#define GL_INTENSITY_SIGNED_SGIX 0x85E4 +#define GL_LUMINANCE_ALPHA_SIGNED_SGIX 0x85E5 +#define GL_RGB16_SIGNED_SGIX 0x85E6 +#define GL_RGBA16_SIGNED_SGIX 0x85E7 +#define GL_ALPHA16_SIGNED_SGIX 0x85E8 +#define GL_LUMINANCE16_SIGNED_SGIX 0x85E9 +#define GL_INTENSITY16_SIGNED_SGIX 0x85EA +#define GL_LUMINANCE16_ALPHA16_SIGNED_SGIX 0x85EB +#define GL_RGB_EXTENDED_RANGE_SGIX 0x85EC +#define GL_RGBA_EXTENDED_RANGE_SGIX 0x85ED +#define GL_ALPHA_EXTENDED_RANGE_SGIX 0x85EE +#define GL_LUMINANCE_EXTENDED_RANGE_SGIX 0x85EF +#define GL_INTENSITY_EXTENDED_RANGE_SGIX 0x85F0 +#define GL_LUMINANCE_ALPHA_EXTENDED_RANGE_SGIX 0x85F1 +#define GL_RGB16_EXTENDED_RANGE_SGIX 0x85F2 +#define GL_RGBA16_EXTENDED_RANGE_SGIX 0x85F3 +#define GL_ALPHA16_EXTENDED_RANGE_SGIX 0x85F4 +#define GL_LUMINANCE16_EXTENDED_RANGE_SGIX 0x85F5 +#define GL_INTENSITY16_EXTENDED_RANGE_SGIX 0x85F6 +#define GL_LUMINANCE16_ALPHA16_EXTENDED_RANGE_SGIX 0x85F7 +#define GL_MIN_LUMINANCE_SGIS 0x85F8 +#define GL_MAX_LUMINANCE_SGIS 0x85F9 +#define GL_MIN_INTENSITY_SGIS 0x85FA +#define GL_MAX_INTENSITY_SGIS 0x85FB + +#define GLEW_SGIX_texture_range GLEW_GET_VAR(__GLEW_SGIX_texture_range) + +#endif /* GL_SGIX_texture_range */ + +/* ----------------------- GL_SGIX_texture_scale_bias ---------------------- */ + +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 + +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C + +#define GLEW_SGIX_texture_scale_bias GLEW_GET_VAR(__GLEW_SGIX_texture_scale_bias) + +#endif /* GL_SGIX_texture_scale_bias */ + +/* ------------------------- GL_SGIX_vertex_preclip ------------------------ */ + +#ifndef GL_SGIX_vertex_preclip +#define GL_SGIX_vertex_preclip 1 + +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF + +#define GLEW_SGIX_vertex_preclip GLEW_GET_VAR(__GLEW_SGIX_vertex_preclip) + +#endif /* GL_SGIX_vertex_preclip */ + +/* ---------------------- GL_SGIX_vertex_preclip_hint ---------------------- */ + +#ifndef GL_SGIX_vertex_preclip_hint +#define GL_SGIX_vertex_preclip_hint 1 + +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF + +#define GLEW_SGIX_vertex_preclip_hint GLEW_GET_VAR(__GLEW_SGIX_vertex_preclip_hint) + +#endif /* GL_SGIX_vertex_preclip_hint */ + +/* ----------------------------- GL_SGIX_ycrcb ----------------------------- */ + +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 + +#define GLEW_SGIX_ycrcb GLEW_GET_VAR(__GLEW_SGIX_ycrcb) + +#endif /* GL_SGIX_ycrcb */ + +/* -------------------------- GL_SGI_color_matrix -------------------------- */ + +#ifndef GL_SGI_color_matrix +#define GL_SGI_color_matrix 1 + +#define GL_COLOR_MATRIX_SGI 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB + +#define GLEW_SGI_color_matrix GLEW_GET_VAR(__GLEW_SGI_color_matrix) + +#endif /* GL_SGI_color_matrix */ + +/* --------------------------- GL_SGI_color_table -------------------------- */ + +#ifndef GL_SGI_color_table +#define GL_SGI_color_table 1 + +#define GL_COLOR_TABLE_SGI 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF + +typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); +typedef void (GLAPIENTRY * PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, void *table); + +#define glColorTableParameterfvSGI GLEW_GET_FUN(__glewColorTableParameterfvSGI) +#define glColorTableParameterivSGI GLEW_GET_FUN(__glewColorTableParameterivSGI) +#define glColorTableSGI GLEW_GET_FUN(__glewColorTableSGI) +#define glCopyColorTableSGI GLEW_GET_FUN(__glewCopyColorTableSGI) +#define glGetColorTableParameterfvSGI GLEW_GET_FUN(__glewGetColorTableParameterfvSGI) +#define glGetColorTableParameterivSGI GLEW_GET_FUN(__glewGetColorTableParameterivSGI) +#define glGetColorTableSGI GLEW_GET_FUN(__glewGetColorTableSGI) + +#define GLEW_SGI_color_table GLEW_GET_VAR(__GLEW_SGI_color_table) + +#endif /* GL_SGI_color_table */ + +/* ----------------------- GL_SGI_texture_color_table ---------------------- */ + +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 + +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD + +#define GLEW_SGI_texture_color_table GLEW_GET_VAR(__GLEW_SGI_texture_color_table) + +#endif /* GL_SGI_texture_color_table */ + +/* ------------------------- GL_SUNX_constant_data ------------------------- */ + +#ifndef GL_SUNX_constant_data +#define GL_SUNX_constant_data 1 + +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 + +typedef void (GLAPIENTRY * PFNGLFINISHTEXTURESUNXPROC) (void); + +#define glFinishTextureSUNX GLEW_GET_FUN(__glewFinishTextureSUNX) + +#define GLEW_SUNX_constant_data GLEW_GET_VAR(__GLEW_SUNX_constant_data) + +#endif /* GL_SUNX_constant_data */ + +/* -------------------- GL_SUN_convolution_border_modes -------------------- */ + +#ifndef GL_SUN_convolution_border_modes +#define GL_SUN_convolution_border_modes 1 + +#define GL_WRAP_BORDER_SUN 0x81D4 + +#define GLEW_SUN_convolution_border_modes GLEW_GET_VAR(__GLEW_SUN_convolution_border_modes) + +#endif /* GL_SUN_convolution_border_modes */ + +/* -------------------------- GL_SUN_global_alpha -------------------------- */ + +#ifndef GL_SUN_global_alpha +#define GL_SUN_global_alpha 1 + +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA + +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); + +#define glGlobalAlphaFactorbSUN GLEW_GET_FUN(__glewGlobalAlphaFactorbSUN) +#define glGlobalAlphaFactordSUN GLEW_GET_FUN(__glewGlobalAlphaFactordSUN) +#define glGlobalAlphaFactorfSUN GLEW_GET_FUN(__glewGlobalAlphaFactorfSUN) +#define glGlobalAlphaFactoriSUN GLEW_GET_FUN(__glewGlobalAlphaFactoriSUN) +#define glGlobalAlphaFactorsSUN GLEW_GET_FUN(__glewGlobalAlphaFactorsSUN) +#define glGlobalAlphaFactorubSUN GLEW_GET_FUN(__glewGlobalAlphaFactorubSUN) +#define glGlobalAlphaFactoruiSUN GLEW_GET_FUN(__glewGlobalAlphaFactoruiSUN) +#define glGlobalAlphaFactorusSUN GLEW_GET_FUN(__glewGlobalAlphaFactorusSUN) + +#define GLEW_SUN_global_alpha GLEW_GET_VAR(__GLEW_SUN_global_alpha) + +#endif /* GL_SUN_global_alpha */ + +/* --------------------------- GL_SUN_mesh_array --------------------------- */ + +#ifndef GL_SUN_mesh_array +#define GL_SUN_mesh_array 1 + +#define GL_QUAD_MESH_SUN 0x8614 +#define GL_TRIANGLE_MESH_SUN 0x8615 + +#define GLEW_SUN_mesh_array GLEW_GET_VAR(__GLEW_SUN_mesh_array) + +#endif /* GL_SUN_mesh_array */ + +/* ------------------------ GL_SUN_read_video_pixels ----------------------- */ + +#ifndef GL_SUN_read_video_pixels +#define GL_SUN_read_video_pixels 1 + +typedef void (GLAPIENTRY * PFNGLREADVIDEOPIXELSSUNPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels); + +#define glReadVideoPixelsSUN GLEW_GET_FUN(__glewReadVideoPixelsSUN) + +#define GLEW_SUN_read_video_pixels GLEW_GET_VAR(__GLEW_SUN_read_video_pixels) + +#endif /* GL_SUN_read_video_pixels */ + +/* --------------------------- GL_SUN_slice_accum -------------------------- */ + +#ifndef GL_SUN_slice_accum +#define GL_SUN_slice_accum 1 + +#define GL_SLICE_ACCUM_SUN 0x85CC + +#define GLEW_SUN_slice_accum GLEW_GET_VAR(__GLEW_SUN_slice_accum) + +#endif /* GL_SUN_slice_accum */ + +/* -------------------------- GL_SUN_triangle_list ------------------------- */ + +#ifndef GL_SUN_triangle_list +#define GL_SUN_triangle_list 1 + +#define GL_RESTART_SUN 0x01 +#define GL_REPLACE_MIDDLE_SUN 0x02 +#define GL_REPLACE_OLDEST_SUN 0x03 +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#define GL_R1UI_V3F_SUN 0x85C4 +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB + +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const void *pointer); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte* code); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint* code); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort* code); + +#define glReplacementCodePointerSUN GLEW_GET_FUN(__glewReplacementCodePointerSUN) +#define glReplacementCodeubSUN GLEW_GET_FUN(__glewReplacementCodeubSUN) +#define glReplacementCodeubvSUN GLEW_GET_FUN(__glewReplacementCodeubvSUN) +#define glReplacementCodeuiSUN GLEW_GET_FUN(__glewReplacementCodeuiSUN) +#define glReplacementCodeuivSUN GLEW_GET_FUN(__glewReplacementCodeuivSUN) +#define glReplacementCodeusSUN GLEW_GET_FUN(__glewReplacementCodeusSUN) +#define glReplacementCodeusvSUN GLEW_GET_FUN(__glewReplacementCodeusvSUN) + +#define GLEW_SUN_triangle_list GLEW_GET_VAR(__GLEW_SUN_triangle_list) + +#endif /* GL_SUN_triangle_list */ + +/* ----------------------------- GL_SUN_vertex ----------------------------- */ + +#ifndef GL_SUN_vertex +#define GL_SUN_vertex 1 + +typedef void (GLAPIENTRY * PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat* c, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* c, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte* c, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte* c, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *c, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint* rc, const GLubyte *c, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat* tc, const GLubyte *c, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat* tc, const GLfloat *v); + +#define glColor3fVertex3fSUN GLEW_GET_FUN(__glewColor3fVertex3fSUN) +#define glColor3fVertex3fvSUN GLEW_GET_FUN(__glewColor3fVertex3fvSUN) +#define glColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewColor4fNormal3fVertex3fSUN) +#define glColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewColor4fNormal3fVertex3fvSUN) +#define glColor4ubVertex2fSUN GLEW_GET_FUN(__glewColor4ubVertex2fSUN) +#define glColor4ubVertex2fvSUN GLEW_GET_FUN(__glewColor4ubVertex2fvSUN) +#define glColor4ubVertex3fSUN GLEW_GET_FUN(__glewColor4ubVertex3fSUN) +#define glColor4ubVertex3fvSUN GLEW_GET_FUN(__glewColor4ubVertex3fvSUN) +#define glNormal3fVertex3fSUN GLEW_GET_FUN(__glewNormal3fVertex3fSUN) +#define glNormal3fVertex3fvSUN GLEW_GET_FUN(__glewNormal3fVertex3fvSUN) +#define glReplacementCodeuiColor3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor3fVertex3fSUN) +#define glReplacementCodeuiColor3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor3fVertex3fvSUN) +#define glReplacementCodeuiColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4fNormal3fVertex3fSUN) +#define glReplacementCodeuiColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4fNormal3fVertex3fvSUN) +#define glReplacementCodeuiColor4ubVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4ubVertex3fSUN) +#define glReplacementCodeuiColor4ubVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4ubVertex3fvSUN) +#define glReplacementCodeuiNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiNormal3fVertex3fSUN) +#define glReplacementCodeuiNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiNormal3fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fVertex3fvSUN) +#define glReplacementCodeuiVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiVertex3fSUN) +#define glReplacementCodeuiVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiVertex3fvSUN) +#define glTexCoord2fColor3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor3fVertex3fSUN) +#define glTexCoord2fColor3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor3fVertex3fvSUN) +#define glTexCoord2fColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor4fNormal3fVertex3fSUN) +#define glTexCoord2fColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor4fNormal3fVertex3fvSUN) +#define glTexCoord2fColor4ubVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor4ubVertex3fSUN) +#define glTexCoord2fColor4ubVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor4ubVertex3fvSUN) +#define glTexCoord2fNormal3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fNormal3fVertex3fSUN) +#define glTexCoord2fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fNormal3fVertex3fvSUN) +#define glTexCoord2fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fVertex3fSUN) +#define glTexCoord2fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fVertex3fvSUN) +#define glTexCoord4fColor4fNormal3fVertex4fSUN GLEW_GET_FUN(__glewTexCoord4fColor4fNormal3fVertex4fSUN) +#define glTexCoord4fColor4fNormal3fVertex4fvSUN GLEW_GET_FUN(__glewTexCoord4fColor4fNormal3fVertex4fvSUN) +#define glTexCoord4fVertex4fSUN GLEW_GET_FUN(__glewTexCoord4fVertex4fSUN) +#define glTexCoord4fVertex4fvSUN GLEW_GET_FUN(__glewTexCoord4fVertex4fvSUN) + +#define GLEW_SUN_vertex GLEW_GET_VAR(__GLEW_SUN_vertex) + +#endif /* GL_SUN_vertex */ + +/* -------------------------- GL_WIN_phong_shading ------------------------- */ + +#ifndef GL_WIN_phong_shading +#define GL_WIN_phong_shading 1 + +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB + +#define GLEW_WIN_phong_shading GLEW_GET_VAR(__GLEW_WIN_phong_shading) + +#endif /* GL_WIN_phong_shading */ + +/* -------------------------- GL_WIN_specular_fog -------------------------- */ + +#ifndef GL_WIN_specular_fog +#define GL_WIN_specular_fog 1 + +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC + +#define GLEW_WIN_specular_fog GLEW_GET_VAR(__GLEW_WIN_specular_fog) + +#endif /* GL_WIN_specular_fog */ + +/* ---------------------------- GL_WIN_swap_hint --------------------------- */ + +#ifndef GL_WIN_swap_hint +#define GL_WIN_swap_hint 1 + +typedef void (GLAPIENTRY * PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei width, GLsizei height); + +#define glAddSwapHintRectWIN GLEW_GET_FUN(__glewAddSwapHintRectWIN) + +#define GLEW_WIN_swap_hint GLEW_GET_VAR(__GLEW_WIN_swap_hint) + +#endif /* GL_WIN_swap_hint */ + +/* ------------------------------------------------------------------------- */ + +#if defined(GLEW_MX) && defined(_WIN32) +#define GLEW_FUN_EXPORT +#else +#define GLEW_FUN_EXPORT GLEWAPI +#endif /* GLEW_MX */ + +#if defined(GLEW_MX) +#define GLEW_VAR_EXPORT +#else +#define GLEW_VAR_EXPORT GLEWAPI +#endif /* GLEW_MX */ + +#if defined(GLEW_MX) && defined(_WIN32) +struct GLEWContextStruct +{ +#endif /* GLEW_MX */ + +GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D; +GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements; +GLEW_FUN_EXPORT PFNGLTEXIMAGE3DPROC __glewTexImage3D; +GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DPROC __glewTexSubImage3D; + +GLEW_FUN_EXPORT PFNGLACTIVETEXTUREPROC __glewActiveTexture; +GLEW_FUN_EXPORT PFNGLCLIENTACTIVETEXTUREPROC __glewClientActiveTexture; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE1DPROC __glewCompressedTexImage1D; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE2DPROC __glewCompressedTexImage2D; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE3DPROC __glewCompressedTexImage3D; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC __glewCompressedTexSubImage1D; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC __glewCompressedTexSubImage2D; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC __glewCompressedTexSubImage3D; +GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXIMAGEPROC __glewGetCompressedTexImage; +GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXDPROC __glewLoadTransposeMatrixd; +GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXFPROC __glewLoadTransposeMatrixf; +GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXDPROC __glewMultTransposeMatrixd; +GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXFPROC __glewMultTransposeMatrixf; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DPROC __glewMultiTexCoord1d; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DVPROC __glewMultiTexCoord1dv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FPROC __glewMultiTexCoord1f; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FVPROC __glewMultiTexCoord1fv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IPROC __glewMultiTexCoord1i; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IVPROC __glewMultiTexCoord1iv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SPROC __glewMultiTexCoord1s; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SVPROC __glewMultiTexCoord1sv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DPROC __glewMultiTexCoord2d; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DVPROC __glewMultiTexCoord2dv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FPROC __glewMultiTexCoord2f; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FVPROC __glewMultiTexCoord2fv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IPROC __glewMultiTexCoord2i; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IVPROC __glewMultiTexCoord2iv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SPROC __glewMultiTexCoord2s; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SVPROC __glewMultiTexCoord2sv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DPROC __glewMultiTexCoord3d; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DVPROC __glewMultiTexCoord3dv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FPROC __glewMultiTexCoord3f; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FVPROC __glewMultiTexCoord3fv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IPROC __glewMultiTexCoord3i; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IVPROC __glewMultiTexCoord3iv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SPROC __glewMultiTexCoord3s; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SVPROC __glewMultiTexCoord3sv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DPROC __glewMultiTexCoord4d; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DVPROC __glewMultiTexCoord4dv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FPROC __glewMultiTexCoord4f; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FVPROC __glewMultiTexCoord4fv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IPROC __glewMultiTexCoord4i; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IVPROC __glewMultiTexCoord4iv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SPROC __glewMultiTexCoord4s; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SVPROC __glewMultiTexCoord4sv; +GLEW_FUN_EXPORT PFNGLSAMPLECOVERAGEPROC __glewSampleCoverage; + +GLEW_FUN_EXPORT PFNGLBLENDCOLORPROC __glewBlendColor; +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONPROC __glewBlendEquation; +GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEPROC __glewBlendFuncSeparate; +GLEW_FUN_EXPORT PFNGLFOGCOORDPOINTERPROC __glewFogCoordPointer; +GLEW_FUN_EXPORT PFNGLFOGCOORDDPROC __glewFogCoordd; +GLEW_FUN_EXPORT PFNGLFOGCOORDDVPROC __glewFogCoorddv; +GLEW_FUN_EXPORT PFNGLFOGCOORDFPROC __glewFogCoordf; +GLEW_FUN_EXPORT PFNGLFOGCOORDFVPROC __glewFogCoordfv; +GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSPROC __glewMultiDrawArrays; +GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSPROC __glewMultiDrawElements; +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFPROC __glewPointParameterf; +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVPROC __glewPointParameterfv; +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERIPROC __glewPointParameteri; +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERIVPROC __glewPointParameteriv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BPROC __glewSecondaryColor3b; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BVPROC __glewSecondaryColor3bv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DPROC __glewSecondaryColor3d; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DVPROC __glewSecondaryColor3dv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FPROC __glewSecondaryColor3f; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FVPROC __glewSecondaryColor3fv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IPROC __glewSecondaryColor3i; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IVPROC __glewSecondaryColor3iv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SPROC __glewSecondaryColor3s; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SVPROC __glewSecondaryColor3sv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBPROC __glewSecondaryColor3ub; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBVPROC __glewSecondaryColor3ubv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIPROC __glewSecondaryColor3ui; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIVPROC __glewSecondaryColor3uiv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USPROC __glewSecondaryColor3us; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USVPROC __glewSecondaryColor3usv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTERPROC __glewSecondaryColorPointer; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2DPROC __glewWindowPos2d; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2DVPROC __glewWindowPos2dv; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2FPROC __glewWindowPos2f; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2FVPROC __glewWindowPos2fv; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2IPROC __glewWindowPos2i; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2IVPROC __glewWindowPos2iv; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2SPROC __glewWindowPos2s; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2SVPROC __glewWindowPos2sv; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3DPROC __glewWindowPos3d; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3DVPROC __glewWindowPos3dv; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3FPROC __glewWindowPos3f; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3FVPROC __glewWindowPos3fv; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3IPROC __glewWindowPos3i; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3IVPROC __glewWindowPos3iv; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3SPROC __glewWindowPos3s; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3SVPROC __glewWindowPos3sv; + +GLEW_FUN_EXPORT PFNGLBEGINQUERYPROC __glewBeginQuery; +GLEW_FUN_EXPORT PFNGLBINDBUFFERPROC __glewBindBuffer; +GLEW_FUN_EXPORT PFNGLBUFFERDATAPROC __glewBufferData; +GLEW_FUN_EXPORT PFNGLBUFFERSUBDATAPROC __glewBufferSubData; +GLEW_FUN_EXPORT PFNGLDELETEBUFFERSPROC __glewDeleteBuffers; +GLEW_FUN_EXPORT PFNGLDELETEQUERIESPROC __glewDeleteQueries; +GLEW_FUN_EXPORT PFNGLENDQUERYPROC __glewEndQuery; +GLEW_FUN_EXPORT PFNGLGENBUFFERSPROC __glewGenBuffers; +GLEW_FUN_EXPORT PFNGLGENQUERIESPROC __glewGenQueries; +GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERIVPROC __glewGetBufferParameteriv; +GLEW_FUN_EXPORT PFNGLGETBUFFERPOINTERVPROC __glewGetBufferPointerv; +GLEW_FUN_EXPORT PFNGLGETBUFFERSUBDATAPROC __glewGetBufferSubData; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVPROC __glewGetQueryObjectiv; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVPROC __glewGetQueryObjectuiv; +GLEW_FUN_EXPORT PFNGLGETQUERYIVPROC __glewGetQueryiv; +GLEW_FUN_EXPORT PFNGLISBUFFERPROC __glewIsBuffer; +GLEW_FUN_EXPORT PFNGLISQUERYPROC __glewIsQuery; +GLEW_FUN_EXPORT PFNGLMAPBUFFERPROC __glewMapBuffer; +GLEW_FUN_EXPORT PFNGLUNMAPBUFFERPROC __glewUnmapBuffer; + +GLEW_FUN_EXPORT PFNGLATTACHSHADERPROC __glewAttachShader; +GLEW_FUN_EXPORT PFNGLBINDATTRIBLOCATIONPROC __glewBindAttribLocation; +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEPROC __glewBlendEquationSeparate; +GLEW_FUN_EXPORT PFNGLCOMPILESHADERPROC __glewCompileShader; +GLEW_FUN_EXPORT PFNGLCREATEPROGRAMPROC __glewCreateProgram; +GLEW_FUN_EXPORT PFNGLCREATESHADERPROC __glewCreateShader; +GLEW_FUN_EXPORT PFNGLDELETEPROGRAMPROC __glewDeleteProgram; +GLEW_FUN_EXPORT PFNGLDELETESHADERPROC __glewDeleteShader; +GLEW_FUN_EXPORT PFNGLDETACHSHADERPROC __glewDetachShader; +GLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBARRAYPROC __glewDisableVertexAttribArray; +GLEW_FUN_EXPORT PFNGLDRAWBUFFERSPROC __glewDrawBuffers; +GLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBARRAYPROC __glewEnableVertexAttribArray; +GLEW_FUN_EXPORT PFNGLGETACTIVEATTRIBPROC __glewGetActiveAttrib; +GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMPROC __glewGetActiveUniform; +GLEW_FUN_EXPORT PFNGLGETATTACHEDSHADERSPROC __glewGetAttachedShaders; +GLEW_FUN_EXPORT PFNGLGETATTRIBLOCATIONPROC __glewGetAttribLocation; +GLEW_FUN_EXPORT PFNGLGETPROGRAMINFOLOGPROC __glewGetProgramInfoLog; +GLEW_FUN_EXPORT PFNGLGETPROGRAMIVPROC __glewGetProgramiv; +GLEW_FUN_EXPORT PFNGLGETSHADERINFOLOGPROC __glewGetShaderInfoLog; +GLEW_FUN_EXPORT PFNGLGETSHADERSOURCEPROC __glewGetShaderSource; +GLEW_FUN_EXPORT PFNGLGETSHADERIVPROC __glewGetShaderiv; +GLEW_FUN_EXPORT PFNGLGETUNIFORMLOCATIONPROC __glewGetUniformLocation; +GLEW_FUN_EXPORT PFNGLGETUNIFORMFVPROC __glewGetUniformfv; +GLEW_FUN_EXPORT PFNGLGETUNIFORMIVPROC __glewGetUniformiv; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVPROC __glewGetVertexAttribPointerv; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVPROC __glewGetVertexAttribdv; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVPROC __glewGetVertexAttribfv; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVPROC __glewGetVertexAttribiv; +GLEW_FUN_EXPORT PFNGLISPROGRAMPROC __glewIsProgram; +GLEW_FUN_EXPORT PFNGLISSHADERPROC __glewIsShader; +GLEW_FUN_EXPORT PFNGLLINKPROGRAMPROC __glewLinkProgram; +GLEW_FUN_EXPORT PFNGLSHADERSOURCEPROC __glewShaderSource; +GLEW_FUN_EXPORT PFNGLSTENCILFUNCSEPARATEPROC __glewStencilFuncSeparate; +GLEW_FUN_EXPORT PFNGLSTENCILMASKSEPARATEPROC __glewStencilMaskSeparate; +GLEW_FUN_EXPORT PFNGLSTENCILOPSEPARATEPROC __glewStencilOpSeparate; +GLEW_FUN_EXPORT PFNGLUNIFORM1FPROC __glewUniform1f; +GLEW_FUN_EXPORT PFNGLUNIFORM1FVPROC __glewUniform1fv; +GLEW_FUN_EXPORT PFNGLUNIFORM1IPROC __glewUniform1i; +GLEW_FUN_EXPORT PFNGLUNIFORM1IVPROC __glewUniform1iv; +GLEW_FUN_EXPORT PFNGLUNIFORM2FPROC __glewUniform2f; +GLEW_FUN_EXPORT PFNGLUNIFORM2FVPROC __glewUniform2fv; +GLEW_FUN_EXPORT PFNGLUNIFORM2IPROC __glewUniform2i; +GLEW_FUN_EXPORT PFNGLUNIFORM2IVPROC __glewUniform2iv; +GLEW_FUN_EXPORT PFNGLUNIFORM3FPROC __glewUniform3f; +GLEW_FUN_EXPORT PFNGLUNIFORM3FVPROC __glewUniform3fv; +GLEW_FUN_EXPORT PFNGLUNIFORM3IPROC __glewUniform3i; +GLEW_FUN_EXPORT PFNGLUNIFORM3IVPROC __glewUniform3iv; +GLEW_FUN_EXPORT PFNGLUNIFORM4FPROC __glewUniform4f; +GLEW_FUN_EXPORT PFNGLUNIFORM4FVPROC __glewUniform4fv; +GLEW_FUN_EXPORT PFNGLUNIFORM4IPROC __glewUniform4i; +GLEW_FUN_EXPORT PFNGLUNIFORM4IVPROC __glewUniform4iv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2FVPROC __glewUniformMatrix2fv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3FVPROC __glewUniformMatrix3fv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4FVPROC __glewUniformMatrix4fv; +GLEW_FUN_EXPORT PFNGLUSEPROGRAMPROC __glewUseProgram; +GLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMPROC __glewValidateProgram; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DPROC __glewVertexAttrib1d; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVPROC __glewVertexAttrib1dv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FPROC __glewVertexAttrib1f; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVPROC __glewVertexAttrib1fv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SPROC __glewVertexAttrib1s; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVPROC __glewVertexAttrib1sv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DPROC __glewVertexAttrib2d; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVPROC __glewVertexAttrib2dv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FPROC __glewVertexAttrib2f; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVPROC __glewVertexAttrib2fv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SPROC __glewVertexAttrib2s; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVPROC __glewVertexAttrib2sv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DPROC __glewVertexAttrib3d; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVPROC __glewVertexAttrib3dv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FPROC __glewVertexAttrib3f; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVPROC __glewVertexAttrib3fv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SPROC __glewVertexAttrib3s; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVPROC __glewVertexAttrib3sv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NBVPROC __glewVertexAttrib4Nbv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NIVPROC __glewVertexAttrib4Niv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NSVPROC __glewVertexAttrib4Nsv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBPROC __glewVertexAttrib4Nub; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBVPROC __glewVertexAttrib4Nubv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUIVPROC __glewVertexAttrib4Nuiv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUSVPROC __glewVertexAttrib4Nusv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4BVPROC __glewVertexAttrib4bv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DPROC __glewVertexAttrib4d; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVPROC __glewVertexAttrib4dv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FPROC __glewVertexAttrib4f; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVPROC __glewVertexAttrib4fv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4IVPROC __glewVertexAttrib4iv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SPROC __glewVertexAttrib4s; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVPROC __glewVertexAttrib4sv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVPROC __glewVertexAttrib4ubv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UIVPROC __glewVertexAttrib4uiv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4USVPROC __glewVertexAttrib4usv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERPROC __glewVertexAttribPointer; + +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X3FVPROC __glewUniformMatrix2x3fv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X4FVPROC __glewUniformMatrix2x4fv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X2FVPROC __glewUniformMatrix3x2fv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X4FVPROC __glewUniformMatrix3x4fv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X2FVPROC __glewUniformMatrix4x2fv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X3FVPROC __glewUniformMatrix4x3fv; + +GLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERPROC __glewBeginConditionalRender; +GLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKPROC __glewBeginTransformFeedback; +GLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONPROC __glewBindFragDataLocation; +GLEW_FUN_EXPORT PFNGLCLAMPCOLORPROC __glewClampColor; +GLEW_FUN_EXPORT PFNGLCLEARBUFFERFIPROC __glewClearBufferfi; +GLEW_FUN_EXPORT PFNGLCLEARBUFFERFVPROC __glewClearBufferfv; +GLEW_FUN_EXPORT PFNGLCLEARBUFFERIVPROC __glewClearBufferiv; +GLEW_FUN_EXPORT PFNGLCLEARBUFFERUIVPROC __glewClearBufferuiv; +GLEW_FUN_EXPORT PFNGLCOLORMASKIPROC __glewColorMaski; +GLEW_FUN_EXPORT PFNGLDISABLEIPROC __glewDisablei; +GLEW_FUN_EXPORT PFNGLENABLEIPROC __glewEnablei; +GLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERPROC __glewEndConditionalRender; +GLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKPROC __glewEndTransformFeedback; +GLEW_FUN_EXPORT PFNGLGETBOOLEANI_VPROC __glewGetBooleani_v; +GLEW_FUN_EXPORT PFNGLGETFRAGDATALOCATIONPROC __glewGetFragDataLocation; +GLEW_FUN_EXPORT PFNGLGETSTRINGIPROC __glewGetStringi; +GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIIVPROC __glewGetTexParameterIiv; +GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIUIVPROC __glewGetTexParameterIuiv; +GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGPROC __glewGetTransformFeedbackVarying; +GLEW_FUN_EXPORT PFNGLGETUNIFORMUIVPROC __glewGetUniformuiv; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIIVPROC __glewGetVertexAttribIiv; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIUIVPROC __glewGetVertexAttribIuiv; +GLEW_FUN_EXPORT PFNGLISENABLEDIPROC __glewIsEnabledi; +GLEW_FUN_EXPORT PFNGLTEXPARAMETERIIVPROC __glewTexParameterIiv; +GLEW_FUN_EXPORT PFNGLTEXPARAMETERIUIVPROC __glewTexParameterIuiv; +GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSPROC __glewTransformFeedbackVaryings; +GLEW_FUN_EXPORT PFNGLUNIFORM1UIPROC __glewUniform1ui; +GLEW_FUN_EXPORT PFNGLUNIFORM1UIVPROC __glewUniform1uiv; +GLEW_FUN_EXPORT PFNGLUNIFORM2UIPROC __glewUniform2ui; +GLEW_FUN_EXPORT PFNGLUNIFORM2UIVPROC __glewUniform2uiv; +GLEW_FUN_EXPORT PFNGLUNIFORM3UIPROC __glewUniform3ui; +GLEW_FUN_EXPORT PFNGLUNIFORM3UIVPROC __glewUniform3uiv; +GLEW_FUN_EXPORT PFNGLUNIFORM4UIPROC __glewUniform4ui; +GLEW_FUN_EXPORT PFNGLUNIFORM4UIVPROC __glewUniform4uiv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IPROC __glewVertexAttribI1i; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IVPROC __glewVertexAttribI1iv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIPROC __glewVertexAttribI1ui; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIVPROC __glewVertexAttribI1uiv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IPROC __glewVertexAttribI2i; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IVPROC __glewVertexAttribI2iv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIPROC __glewVertexAttribI2ui; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIVPROC __glewVertexAttribI2uiv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IPROC __glewVertexAttribI3i; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IVPROC __glewVertexAttribI3iv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIPROC __glewVertexAttribI3ui; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIVPROC __glewVertexAttribI3uiv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4BVPROC __glewVertexAttribI4bv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IPROC __glewVertexAttribI4i; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IVPROC __glewVertexAttribI4iv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4SVPROC __glewVertexAttribI4sv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UBVPROC __glewVertexAttribI4ubv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIPROC __glewVertexAttribI4ui; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIVPROC __glewVertexAttribI4uiv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4USVPROC __glewVertexAttribI4usv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBIPOINTERPROC __glewVertexAttribIPointer; + +GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDPROC __glewDrawArraysInstanced; +GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDPROC __glewDrawElementsInstanced; +GLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTINDEXPROC __glewPrimitiveRestartIndex; +GLEW_FUN_EXPORT PFNGLTEXBUFFERPROC __glewTexBuffer; + +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREPROC __glewFramebufferTexture; +GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERI64VPROC __glewGetBufferParameteri64v; +GLEW_FUN_EXPORT PFNGLGETINTEGER64I_VPROC __glewGetInteger64i_v; + +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBDIVISORPROC __glewVertexAttribDivisor; + +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEIPROC __glewBlendEquationSeparatei; +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONIPROC __glewBlendEquationi; +GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEIPROC __glewBlendFuncSeparatei; +GLEW_FUN_EXPORT PFNGLBLENDFUNCIPROC __glewBlendFunci; +GLEW_FUN_EXPORT PFNGLMINSAMPLESHADINGPROC __glewMinSampleShading; + +GLEW_FUN_EXPORT PFNGLGETGRAPHICSRESETSTATUSPROC __glewGetGraphicsResetStatus; +GLEW_FUN_EXPORT PFNGLGETNCOMPRESSEDTEXIMAGEPROC __glewGetnCompressedTexImage; +GLEW_FUN_EXPORT PFNGLGETNTEXIMAGEPROC __glewGetnTexImage; +GLEW_FUN_EXPORT PFNGLGETNUNIFORMDVPROC __glewGetnUniformdv; + +GLEW_FUN_EXPORT PFNGLTBUFFERMASK3DFXPROC __glewTbufferMask3DFX; + +GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKAMDPROC __glewDebugMessageCallbackAMD; +GLEW_FUN_EXPORT PFNGLDEBUGMESSAGEENABLEAMDPROC __glewDebugMessageEnableAMD; +GLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTAMDPROC __glewDebugMessageInsertAMD; +GLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGAMDPROC __glewGetDebugMessageLogAMD; + +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONINDEXEDAMDPROC __glewBlendEquationIndexedAMD; +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC __glewBlendEquationSeparateIndexedAMD; +GLEW_FUN_EXPORT PFNGLBLENDFUNCINDEXEDAMDPROC __glewBlendFuncIndexedAMD; +GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC __glewBlendFuncSeparateIndexedAMD; + +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBPARAMETERIAMDPROC __glewVertexAttribParameteriAMD; + +GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC __glewMultiDrawArraysIndirectAMD; +GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC __glewMultiDrawElementsIndirectAMD; + +GLEW_FUN_EXPORT PFNGLDELETENAMESAMDPROC __glewDeleteNamesAMD; +GLEW_FUN_EXPORT PFNGLGENNAMESAMDPROC __glewGenNamesAMD; +GLEW_FUN_EXPORT PFNGLISNAMEAMDPROC __glewIsNameAMD; + +GLEW_FUN_EXPORT PFNGLQUERYOBJECTPARAMETERUIAMDPROC __glewQueryObjectParameteruiAMD; + +GLEW_FUN_EXPORT PFNGLBEGINPERFMONITORAMDPROC __glewBeginPerfMonitorAMD; +GLEW_FUN_EXPORT PFNGLDELETEPERFMONITORSAMDPROC __glewDeletePerfMonitorsAMD; +GLEW_FUN_EXPORT PFNGLENDPERFMONITORAMDPROC __glewEndPerfMonitorAMD; +GLEW_FUN_EXPORT PFNGLGENPERFMONITORSAMDPROC __glewGenPerfMonitorsAMD; +GLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERDATAAMDPROC __glewGetPerfMonitorCounterDataAMD; +GLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERINFOAMDPROC __glewGetPerfMonitorCounterInfoAMD; +GLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC __glewGetPerfMonitorCounterStringAMD; +GLEW_FUN_EXPORT PFNGLGETPERFMONITORCOUNTERSAMDPROC __glewGetPerfMonitorCountersAMD; +GLEW_FUN_EXPORT PFNGLGETPERFMONITORGROUPSTRINGAMDPROC __glewGetPerfMonitorGroupStringAMD; +GLEW_FUN_EXPORT PFNGLGETPERFMONITORGROUPSAMDPROC __glewGetPerfMonitorGroupsAMD; +GLEW_FUN_EXPORT PFNGLSELECTPERFMONITORCOUNTERSAMDPROC __glewSelectPerfMonitorCountersAMD; + +GLEW_FUN_EXPORT PFNGLSETMULTISAMPLEFVAMDPROC __glewSetMultisamplefvAMD; + +GLEW_FUN_EXPORT PFNGLTEXSTORAGESPARSEAMDPROC __glewTexStorageSparseAMD; +GLEW_FUN_EXPORT PFNGLTEXTURESTORAGESPARSEAMDPROC __glewTextureStorageSparseAMD; + +GLEW_FUN_EXPORT PFNGLSTENCILOPVALUEAMDPROC __glewStencilOpValueAMD; + +GLEW_FUN_EXPORT PFNGLTESSELLATIONFACTORAMDPROC __glewTessellationFactorAMD; +GLEW_FUN_EXPORT PFNGLTESSELLATIONMODEAMDPROC __glewTessellationModeAMD; + +GLEW_FUN_EXPORT PFNGLBLITFRAMEBUFFERANGLEPROC __glewBlitFramebufferANGLE; + +GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC __glewRenderbufferStorageMultisampleANGLE; + +GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDANGLEPROC __glewDrawArraysInstancedANGLE; +GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDANGLEPROC __glewDrawElementsInstancedANGLE; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBDIVISORANGLEPROC __glewVertexAttribDivisorANGLE; + +GLEW_FUN_EXPORT PFNGLBEGINQUERYANGLEPROC __glewBeginQueryANGLE; +GLEW_FUN_EXPORT PFNGLDELETEQUERIESANGLEPROC __glewDeleteQueriesANGLE; +GLEW_FUN_EXPORT PFNGLENDQUERYANGLEPROC __glewEndQueryANGLE; +GLEW_FUN_EXPORT PFNGLGENQUERIESANGLEPROC __glewGenQueriesANGLE; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTI64VANGLEPROC __glewGetQueryObjecti64vANGLE; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVANGLEPROC __glewGetQueryObjectivANGLE; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUI64VANGLEPROC __glewGetQueryObjectui64vANGLE; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVANGLEPROC __glewGetQueryObjectuivANGLE; +GLEW_FUN_EXPORT PFNGLGETQUERYIVANGLEPROC __glewGetQueryivANGLE; +GLEW_FUN_EXPORT PFNGLISQUERYANGLEPROC __glewIsQueryANGLE; +GLEW_FUN_EXPORT PFNGLQUERYCOUNTERANGLEPROC __glewQueryCounterANGLE; + +GLEW_FUN_EXPORT PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC __glewGetTranslatedShaderSourceANGLE; + +GLEW_FUN_EXPORT PFNGLDRAWELEMENTARRAYAPPLEPROC __glewDrawElementArrayAPPLE; +GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC __glewDrawRangeElementArrayAPPLE; +GLEW_FUN_EXPORT PFNGLELEMENTPOINTERAPPLEPROC __glewElementPointerAPPLE; +GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC __glewMultiDrawElementArrayAPPLE; +GLEW_FUN_EXPORT PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC __glewMultiDrawRangeElementArrayAPPLE; + +GLEW_FUN_EXPORT PFNGLDELETEFENCESAPPLEPROC __glewDeleteFencesAPPLE; +GLEW_FUN_EXPORT PFNGLFINISHFENCEAPPLEPROC __glewFinishFenceAPPLE; +GLEW_FUN_EXPORT PFNGLFINISHOBJECTAPPLEPROC __glewFinishObjectAPPLE; +GLEW_FUN_EXPORT PFNGLGENFENCESAPPLEPROC __glewGenFencesAPPLE; +GLEW_FUN_EXPORT PFNGLISFENCEAPPLEPROC __glewIsFenceAPPLE; +GLEW_FUN_EXPORT PFNGLSETFENCEAPPLEPROC __glewSetFenceAPPLE; +GLEW_FUN_EXPORT PFNGLTESTFENCEAPPLEPROC __glewTestFenceAPPLE; +GLEW_FUN_EXPORT PFNGLTESTOBJECTAPPLEPROC __glewTestObjectAPPLE; + +GLEW_FUN_EXPORT PFNGLBUFFERPARAMETERIAPPLEPROC __glewBufferParameteriAPPLE; +GLEW_FUN_EXPORT PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC __glewFlushMappedBufferRangeAPPLE; + +GLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERIVAPPLEPROC __glewGetObjectParameterivAPPLE; +GLEW_FUN_EXPORT PFNGLOBJECTPURGEABLEAPPLEPROC __glewObjectPurgeableAPPLE; +GLEW_FUN_EXPORT PFNGLOBJECTUNPURGEABLEAPPLEPROC __glewObjectUnpurgeableAPPLE; + +GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC __glewGetTexParameterPointervAPPLE; +GLEW_FUN_EXPORT PFNGLTEXTURERANGEAPPLEPROC __glewTextureRangeAPPLE; + +GLEW_FUN_EXPORT PFNGLBINDVERTEXARRAYAPPLEPROC __glewBindVertexArrayAPPLE; +GLEW_FUN_EXPORT PFNGLDELETEVERTEXARRAYSAPPLEPROC __glewDeleteVertexArraysAPPLE; +GLEW_FUN_EXPORT PFNGLGENVERTEXARRAYSAPPLEPROC __glewGenVertexArraysAPPLE; +GLEW_FUN_EXPORT PFNGLISVERTEXARRAYAPPLEPROC __glewIsVertexArrayAPPLE; + +GLEW_FUN_EXPORT PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC __glewFlushVertexArrayRangeAPPLE; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYPARAMETERIAPPLEPROC __glewVertexArrayParameteriAPPLE; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYRANGEAPPLEPROC __glewVertexArrayRangeAPPLE; + +GLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBAPPLEPROC __glewDisableVertexAttribAPPLE; +GLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBAPPLEPROC __glewEnableVertexAttribAPPLE; +GLEW_FUN_EXPORT PFNGLISVERTEXATTRIBENABLEDAPPLEPROC __glewIsVertexAttribEnabledAPPLE; +GLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB1DAPPLEPROC __glewMapVertexAttrib1dAPPLE; +GLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB1FAPPLEPROC __glewMapVertexAttrib1fAPPLE; +GLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB2DAPPLEPROC __glewMapVertexAttrib2dAPPLE; +GLEW_FUN_EXPORT PFNGLMAPVERTEXATTRIB2FAPPLEPROC __glewMapVertexAttrib2fAPPLE; + +GLEW_FUN_EXPORT PFNGLCLEARDEPTHFPROC __glewClearDepthf; +GLEW_FUN_EXPORT PFNGLDEPTHRANGEFPROC __glewDepthRangef; +GLEW_FUN_EXPORT PFNGLGETSHADERPRECISIONFORMATPROC __glewGetShaderPrecisionFormat; +GLEW_FUN_EXPORT PFNGLRELEASESHADERCOMPILERPROC __glewReleaseShaderCompiler; +GLEW_FUN_EXPORT PFNGLSHADERBINARYPROC __glewShaderBinary; + +GLEW_FUN_EXPORT PFNGLMEMORYBARRIERBYREGIONPROC __glewMemoryBarrierByRegion; + +GLEW_FUN_EXPORT PFNGLPRIMITIVEBOUNDINGBOXARBPROC __glewPrimitiveBoundingBoxARB; + +GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC __glewDrawArraysInstancedBaseInstance; +GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC __glewDrawElementsInstancedBaseInstance; +GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC __glewDrawElementsInstancedBaseVertexBaseInstance; + +GLEW_FUN_EXPORT PFNGLGETIMAGEHANDLEARBPROC __glewGetImageHandleARB; +GLEW_FUN_EXPORT PFNGLGETTEXTUREHANDLEARBPROC __glewGetTextureHandleARB; +GLEW_FUN_EXPORT PFNGLGETTEXTURESAMPLERHANDLEARBPROC __glewGetTextureSamplerHandleARB; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLUI64VARBPROC __glewGetVertexAttribLui64vARB; +GLEW_FUN_EXPORT PFNGLISIMAGEHANDLERESIDENTARBPROC __glewIsImageHandleResidentARB; +GLEW_FUN_EXPORT PFNGLISTEXTUREHANDLERESIDENTARBPROC __glewIsTextureHandleResidentARB; +GLEW_FUN_EXPORT PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC __glewMakeImageHandleNonResidentARB; +GLEW_FUN_EXPORT PFNGLMAKEIMAGEHANDLERESIDENTARBPROC __glewMakeImageHandleResidentARB; +GLEW_FUN_EXPORT PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC __glewMakeTextureHandleNonResidentARB; +GLEW_FUN_EXPORT PFNGLMAKETEXTUREHANDLERESIDENTARBPROC __glewMakeTextureHandleResidentARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC __glewProgramUniformHandleui64ARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC __glewProgramUniformHandleui64vARB; +GLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64ARBPROC __glewUniformHandleui64ARB; +GLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64VARBPROC __glewUniformHandleui64vARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1UI64ARBPROC __glewVertexAttribL1ui64ARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1UI64VARBPROC __glewVertexAttribL1ui64vARB; + +GLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONINDEXEDPROC __glewBindFragDataLocationIndexed; +GLEW_FUN_EXPORT PFNGLGETFRAGDATAINDEXPROC __glewGetFragDataIndex; + +GLEW_FUN_EXPORT PFNGLBUFFERSTORAGEPROC __glewBufferStorage; +GLEW_FUN_EXPORT PFNGLNAMEDBUFFERSTORAGEEXTPROC __glewNamedBufferStorageEXT; + +GLEW_FUN_EXPORT PFNGLCREATESYNCFROMCLEVENTARBPROC __glewCreateSyncFromCLeventARB; + +GLEW_FUN_EXPORT PFNGLCLEARBUFFERDATAPROC __glewClearBufferData; +GLEW_FUN_EXPORT PFNGLCLEARBUFFERSUBDATAPROC __glewClearBufferSubData; +GLEW_FUN_EXPORT PFNGLCLEARNAMEDBUFFERDATAEXTPROC __glewClearNamedBufferDataEXT; +GLEW_FUN_EXPORT PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC __glewClearNamedBufferSubDataEXT; + +GLEW_FUN_EXPORT PFNGLCLEARTEXIMAGEPROC __glewClearTexImage; +GLEW_FUN_EXPORT PFNGLCLEARTEXSUBIMAGEPROC __glewClearTexSubImage; + +GLEW_FUN_EXPORT PFNGLCLIPCONTROLPROC __glewClipControl; + +GLEW_FUN_EXPORT PFNGLCLAMPCOLORARBPROC __glewClampColorARB; + +GLEW_FUN_EXPORT PFNGLDISPATCHCOMPUTEPROC __glewDispatchCompute; +GLEW_FUN_EXPORT PFNGLDISPATCHCOMPUTEINDIRECTPROC __glewDispatchComputeIndirect; + +GLEW_FUN_EXPORT PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC __glewDispatchComputeGroupSizeARB; + +GLEW_FUN_EXPORT PFNGLCOPYBUFFERSUBDATAPROC __glewCopyBufferSubData; + +GLEW_FUN_EXPORT PFNGLCOPYIMAGESUBDATAPROC __glewCopyImageSubData; + +GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKARBPROC __glewDebugMessageCallbackARB; +GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECONTROLARBPROC __glewDebugMessageControlARB; +GLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTARBPROC __glewDebugMessageInsertARB; +GLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGARBPROC __glewGetDebugMessageLogARB; + +GLEW_FUN_EXPORT PFNGLBINDTEXTUREUNITPROC __glewBindTextureUnit; +GLEW_FUN_EXPORT PFNGLBLITNAMEDFRAMEBUFFERPROC __glewBlitNamedFramebuffer; +GLEW_FUN_EXPORT PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC __glewCheckNamedFramebufferStatus; +GLEW_FUN_EXPORT PFNGLCLEARNAMEDBUFFERDATAPROC __glewClearNamedBufferData; +GLEW_FUN_EXPORT PFNGLCLEARNAMEDBUFFERSUBDATAPROC __glewClearNamedBufferSubData; +GLEW_FUN_EXPORT PFNGLCLEARNAMEDFRAMEBUFFERFIPROC __glewClearNamedFramebufferfi; +GLEW_FUN_EXPORT PFNGLCLEARNAMEDFRAMEBUFFERFVPROC __glewClearNamedFramebufferfv; +GLEW_FUN_EXPORT PFNGLCLEARNAMEDFRAMEBUFFERIVPROC __glewClearNamedFramebufferiv; +GLEW_FUN_EXPORT PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC __glewClearNamedFramebufferuiv; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC __glewCompressedTextureSubImage1D; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC __glewCompressedTextureSubImage2D; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC __glewCompressedTextureSubImage3D; +GLEW_FUN_EXPORT PFNGLCOPYNAMEDBUFFERSUBDATAPROC __glewCopyNamedBufferSubData; +GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE1DPROC __glewCopyTextureSubImage1D; +GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE2DPROC __glewCopyTextureSubImage2D; +GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE3DPROC __glewCopyTextureSubImage3D; +GLEW_FUN_EXPORT PFNGLCREATEBUFFERSPROC __glewCreateBuffers; +GLEW_FUN_EXPORT PFNGLCREATEFRAMEBUFFERSPROC __glewCreateFramebuffers; +GLEW_FUN_EXPORT PFNGLCREATEPROGRAMPIPELINESPROC __glewCreateProgramPipelines; +GLEW_FUN_EXPORT PFNGLCREATEQUERIESPROC __glewCreateQueries; +GLEW_FUN_EXPORT PFNGLCREATERENDERBUFFERSPROC __glewCreateRenderbuffers; +GLEW_FUN_EXPORT PFNGLCREATESAMPLERSPROC __glewCreateSamplers; +GLEW_FUN_EXPORT PFNGLCREATETEXTURESPROC __glewCreateTextures; +GLEW_FUN_EXPORT PFNGLCREATETRANSFORMFEEDBACKSPROC __glewCreateTransformFeedbacks; +GLEW_FUN_EXPORT PFNGLCREATEVERTEXARRAYSPROC __glewCreateVertexArrays; +GLEW_FUN_EXPORT PFNGLDISABLEVERTEXARRAYATTRIBPROC __glewDisableVertexArrayAttrib; +GLEW_FUN_EXPORT PFNGLENABLEVERTEXARRAYATTRIBPROC __glewEnableVertexArrayAttrib; +GLEW_FUN_EXPORT PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC __glewFlushMappedNamedBufferRange; +GLEW_FUN_EXPORT PFNGLGENERATETEXTUREMIPMAPPROC __glewGenerateTextureMipmap; +GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC __glewGetCompressedTextureImage; +GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPARAMETERI64VPROC __glewGetNamedBufferParameteri64v; +GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPARAMETERIVPROC __glewGetNamedBufferParameteriv; +GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPOINTERVPROC __glewGetNamedBufferPointerv; +GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERSUBDATAPROC __glewGetNamedBufferSubData; +GLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC __glewGetNamedFramebufferAttachmentParameteriv; +GLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC __glewGetNamedFramebufferParameteriv; +GLEW_FUN_EXPORT PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC __glewGetNamedRenderbufferParameteriv; +GLEW_FUN_EXPORT PFNGLGETQUERYBUFFEROBJECTI64VPROC __glewGetQueryBufferObjecti64v; +GLEW_FUN_EXPORT PFNGLGETQUERYBUFFEROBJECTIVPROC __glewGetQueryBufferObjectiv; +GLEW_FUN_EXPORT PFNGLGETQUERYBUFFEROBJECTUI64VPROC __glewGetQueryBufferObjectui64v; +GLEW_FUN_EXPORT PFNGLGETQUERYBUFFEROBJECTUIVPROC __glewGetQueryBufferObjectuiv; +GLEW_FUN_EXPORT PFNGLGETTEXTUREIMAGEPROC __glewGetTextureImage; +GLEW_FUN_EXPORT PFNGLGETTEXTURELEVELPARAMETERFVPROC __glewGetTextureLevelParameterfv; +GLEW_FUN_EXPORT PFNGLGETTEXTURELEVELPARAMETERIVPROC __glewGetTextureLevelParameteriv; +GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIIVPROC __glewGetTextureParameterIiv; +GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIUIVPROC __glewGetTextureParameterIuiv; +GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERFVPROC __glewGetTextureParameterfv; +GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIVPROC __glewGetTextureParameteriv; +GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKI64_VPROC __glewGetTransformFeedbacki64_v; +GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKI_VPROC __glewGetTransformFeedbacki_v; +GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKIVPROC __glewGetTransformFeedbackiv; +GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYINDEXED64IVPROC __glewGetVertexArrayIndexed64iv; +GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYINDEXEDIVPROC __glewGetVertexArrayIndexediv; +GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYIVPROC __glewGetVertexArrayiv; +GLEW_FUN_EXPORT PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC __glewInvalidateNamedFramebufferData; +GLEW_FUN_EXPORT PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC __glewInvalidateNamedFramebufferSubData; +GLEW_FUN_EXPORT PFNGLMAPNAMEDBUFFERPROC __glewMapNamedBuffer; +GLEW_FUN_EXPORT PFNGLMAPNAMEDBUFFERRANGEPROC __glewMapNamedBufferRange; +GLEW_FUN_EXPORT PFNGLNAMEDBUFFERDATAPROC __glewNamedBufferData; +GLEW_FUN_EXPORT PFNGLNAMEDBUFFERSTORAGEPROC __glewNamedBufferStorage; +GLEW_FUN_EXPORT PFNGLNAMEDBUFFERSUBDATAPROC __glewNamedBufferSubData; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC __glewNamedFramebufferDrawBuffer; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC __glewNamedFramebufferDrawBuffers; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC __glewNamedFramebufferParameteri; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC __glewNamedFramebufferReadBuffer; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC __glewNamedFramebufferRenderbuffer; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTUREPROC __glewNamedFramebufferTexture; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC __glewNamedFramebufferTextureLayer; +GLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEPROC __glewNamedRenderbufferStorage; +GLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC __glewNamedRenderbufferStorageMultisample; +GLEW_FUN_EXPORT PFNGLTEXTUREBUFFERPROC __glewTextureBuffer; +GLEW_FUN_EXPORT PFNGLTEXTUREBUFFERRANGEPROC __glewTextureBufferRange; +GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIIVPROC __glewTextureParameterIiv; +GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIUIVPROC __glewTextureParameterIuiv; +GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERFPROC __glewTextureParameterf; +GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERFVPROC __glewTextureParameterfv; +GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIPROC __glewTextureParameteri; +GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIVPROC __glewTextureParameteriv; +GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE1DPROC __glewTextureStorage1D; +GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE2DPROC __glewTextureStorage2D; +GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC __glewTextureStorage2DMultisample; +GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE3DPROC __glewTextureStorage3D; +GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC __glewTextureStorage3DMultisample; +GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE1DPROC __glewTextureSubImage1D; +GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE2DPROC __glewTextureSubImage2D; +GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE3DPROC __glewTextureSubImage3D; +GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC __glewTransformFeedbackBufferBase; +GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC __glewTransformFeedbackBufferRange; +GLEW_FUN_EXPORT PFNGLUNMAPNAMEDBUFFERPROC __glewUnmapNamedBuffer; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYATTRIBBINDINGPROC __glewVertexArrayAttribBinding; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYATTRIBFORMATPROC __glewVertexArrayAttribFormat; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYATTRIBIFORMATPROC __glewVertexArrayAttribIFormat; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYATTRIBLFORMATPROC __glewVertexArrayAttribLFormat; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYBINDINGDIVISORPROC __glewVertexArrayBindingDivisor; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYELEMENTBUFFERPROC __glewVertexArrayElementBuffer; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXBUFFERPROC __glewVertexArrayVertexBuffer; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXBUFFERSPROC __glewVertexArrayVertexBuffers; + +GLEW_FUN_EXPORT PFNGLDRAWBUFFERSARBPROC __glewDrawBuffersARB; + +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEIARBPROC __glewBlendEquationSeparateiARB; +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONIARBPROC __glewBlendEquationiARB; +GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEIARBPROC __glewBlendFuncSeparateiARB; +GLEW_FUN_EXPORT PFNGLBLENDFUNCIARBPROC __glewBlendFunciARB; + +GLEW_FUN_EXPORT PFNGLDRAWELEMENTSBASEVERTEXPROC __glewDrawElementsBaseVertex; +GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC __glewDrawElementsInstancedBaseVertex; +GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC __glewDrawRangeElementsBaseVertex; +GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC __glewMultiDrawElementsBaseVertex; + +GLEW_FUN_EXPORT PFNGLDRAWARRAYSINDIRECTPROC __glewDrawArraysIndirect; +GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINDIRECTPROC __glewDrawElementsIndirect; + +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERPARAMETERIPROC __glewFramebufferParameteri; +GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERPARAMETERIVPROC __glewGetFramebufferParameteriv; +GLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC __glewGetNamedFramebufferParameterivEXT; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC __glewNamedFramebufferParameteriEXT; + +GLEW_FUN_EXPORT PFNGLBINDFRAMEBUFFERPROC __glewBindFramebuffer; +GLEW_FUN_EXPORT PFNGLBINDRENDERBUFFERPROC __glewBindRenderbuffer; +GLEW_FUN_EXPORT PFNGLBLITFRAMEBUFFERPROC __glewBlitFramebuffer; +GLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSPROC __glewCheckFramebufferStatus; +GLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSPROC __glewDeleteFramebuffers; +GLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSPROC __glewDeleteRenderbuffers; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFERPROC __glewFramebufferRenderbuffer; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DPROC __glewFramebufferTexture1D; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DPROC __glewFramebufferTexture2D; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DPROC __glewFramebufferTexture3D; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERPROC __glewFramebufferTextureLayer; +GLEW_FUN_EXPORT PFNGLGENFRAMEBUFFERSPROC __glewGenFramebuffers; +GLEW_FUN_EXPORT PFNGLGENRENDERBUFFERSPROC __glewGenRenderbuffers; +GLEW_FUN_EXPORT PFNGLGENERATEMIPMAPPROC __glewGenerateMipmap; +GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC __glewGetFramebufferAttachmentParameteriv; +GLEW_FUN_EXPORT PFNGLGETRENDERBUFFERPARAMETERIVPROC __glewGetRenderbufferParameteriv; +GLEW_FUN_EXPORT PFNGLISFRAMEBUFFERPROC __glewIsFramebuffer; +GLEW_FUN_EXPORT PFNGLISRENDERBUFFERPROC __glewIsRenderbuffer; +GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEPROC __glewRenderbufferStorage; +GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC __glewRenderbufferStorageMultisample; + +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREARBPROC __glewFramebufferTextureARB; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREFACEARBPROC __glewFramebufferTextureFaceARB; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERARBPROC __glewFramebufferTextureLayerARB; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIARBPROC __glewProgramParameteriARB; + +GLEW_FUN_EXPORT PFNGLGETPROGRAMBINARYPROC __glewGetProgramBinary; +GLEW_FUN_EXPORT PFNGLPROGRAMBINARYPROC __glewProgramBinary; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIPROC __glewProgramParameteri; + +GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC __glewGetCompressedTextureSubImage; +GLEW_FUN_EXPORT PFNGLGETTEXTURESUBIMAGEPROC __glewGetTextureSubImage; + +GLEW_FUN_EXPORT PFNGLGETUNIFORMDVPROC __glewGetUniformdv; +GLEW_FUN_EXPORT PFNGLUNIFORM1DPROC __glewUniform1d; +GLEW_FUN_EXPORT PFNGLUNIFORM1DVPROC __glewUniform1dv; +GLEW_FUN_EXPORT PFNGLUNIFORM2DPROC __glewUniform2d; +GLEW_FUN_EXPORT PFNGLUNIFORM2DVPROC __glewUniform2dv; +GLEW_FUN_EXPORT PFNGLUNIFORM3DPROC __glewUniform3d; +GLEW_FUN_EXPORT PFNGLUNIFORM3DVPROC __glewUniform3dv; +GLEW_FUN_EXPORT PFNGLUNIFORM4DPROC __glewUniform4d; +GLEW_FUN_EXPORT PFNGLUNIFORM4DVPROC __glewUniform4dv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2DVPROC __glewUniformMatrix2dv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X3DVPROC __glewUniformMatrix2x3dv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X4DVPROC __glewUniformMatrix2x4dv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3DVPROC __glewUniformMatrix3dv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X2DVPROC __glewUniformMatrix3x2dv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X4DVPROC __glewUniformMatrix3x4dv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4DVPROC __glewUniformMatrix4dv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X2DVPROC __glewUniformMatrix4x2dv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4X3DVPROC __glewUniformMatrix4x3dv; + +GLEW_FUN_EXPORT PFNGLGETUNIFORMI64VARBPROC __glewGetUniformi64vARB; +GLEW_FUN_EXPORT PFNGLGETUNIFORMUI64VARBPROC __glewGetUniformui64vARB; +GLEW_FUN_EXPORT PFNGLGETNUNIFORMI64VARBPROC __glewGetnUniformi64vARB; +GLEW_FUN_EXPORT PFNGLGETNUNIFORMUI64VARBPROC __glewGetnUniformui64vARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1I64ARBPROC __glewProgramUniform1i64ARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1I64VARBPROC __glewProgramUniform1i64vARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UI64ARBPROC __glewProgramUniform1ui64ARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UI64VARBPROC __glewProgramUniform1ui64vARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2I64ARBPROC __glewProgramUniform2i64ARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2I64VARBPROC __glewProgramUniform2i64vARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UI64ARBPROC __glewProgramUniform2ui64ARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UI64VARBPROC __glewProgramUniform2ui64vARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3I64ARBPROC __glewProgramUniform3i64ARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3I64VARBPROC __glewProgramUniform3i64vARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UI64ARBPROC __glewProgramUniform3ui64ARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UI64VARBPROC __glewProgramUniform3ui64vARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4I64ARBPROC __glewProgramUniform4i64ARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4I64VARBPROC __glewProgramUniform4i64vARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UI64ARBPROC __glewProgramUniform4ui64ARB; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UI64VARBPROC __glewProgramUniform4ui64vARB; +GLEW_FUN_EXPORT PFNGLUNIFORM1I64ARBPROC __glewUniform1i64ARB; +GLEW_FUN_EXPORT PFNGLUNIFORM1I64VARBPROC __glewUniform1i64vARB; +GLEW_FUN_EXPORT PFNGLUNIFORM1UI64ARBPROC __glewUniform1ui64ARB; +GLEW_FUN_EXPORT PFNGLUNIFORM1UI64VARBPROC __glewUniform1ui64vARB; +GLEW_FUN_EXPORT PFNGLUNIFORM2I64ARBPROC __glewUniform2i64ARB; +GLEW_FUN_EXPORT PFNGLUNIFORM2I64VARBPROC __glewUniform2i64vARB; +GLEW_FUN_EXPORT PFNGLUNIFORM2UI64ARBPROC __glewUniform2ui64ARB; +GLEW_FUN_EXPORT PFNGLUNIFORM2UI64VARBPROC __glewUniform2ui64vARB; +GLEW_FUN_EXPORT PFNGLUNIFORM3I64ARBPROC __glewUniform3i64ARB; +GLEW_FUN_EXPORT PFNGLUNIFORM3I64VARBPROC __glewUniform3i64vARB; +GLEW_FUN_EXPORT PFNGLUNIFORM3UI64ARBPROC __glewUniform3ui64ARB; +GLEW_FUN_EXPORT PFNGLUNIFORM3UI64VARBPROC __glewUniform3ui64vARB; +GLEW_FUN_EXPORT PFNGLUNIFORM4I64ARBPROC __glewUniform4i64ARB; +GLEW_FUN_EXPORT PFNGLUNIFORM4I64VARBPROC __glewUniform4i64vARB; +GLEW_FUN_EXPORT PFNGLUNIFORM4UI64ARBPROC __glewUniform4ui64ARB; +GLEW_FUN_EXPORT PFNGLUNIFORM4UI64VARBPROC __glewUniform4ui64vARB; + +GLEW_FUN_EXPORT PFNGLCOLORSUBTABLEPROC __glewColorSubTable; +GLEW_FUN_EXPORT PFNGLCOLORTABLEPROC __glewColorTable; +GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERFVPROC __glewColorTableParameterfv; +GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERIVPROC __glewColorTableParameteriv; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER1DPROC __glewConvolutionFilter1D; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER2DPROC __glewConvolutionFilter2D; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFPROC __glewConvolutionParameterf; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFVPROC __glewConvolutionParameterfv; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIPROC __glewConvolutionParameteri; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIVPROC __glewConvolutionParameteriv; +GLEW_FUN_EXPORT PFNGLCOPYCOLORSUBTABLEPROC __glewCopyColorSubTable; +GLEW_FUN_EXPORT PFNGLCOPYCOLORTABLEPROC __glewCopyColorTable; +GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER1DPROC __glewCopyConvolutionFilter1D; +GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER2DPROC __glewCopyConvolutionFilter2D; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPROC __glewGetColorTable; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVPROC __glewGetColorTableParameterfv; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVPROC __glewGetColorTableParameteriv; +GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONFILTERPROC __glewGetConvolutionFilter; +GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERFVPROC __glewGetConvolutionParameterfv; +GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERIVPROC __glewGetConvolutionParameteriv; +GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPROC __glewGetHistogram; +GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERFVPROC __glewGetHistogramParameterfv; +GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERIVPROC __glewGetHistogramParameteriv; +GLEW_FUN_EXPORT PFNGLGETMINMAXPROC __glewGetMinmax; +GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERFVPROC __glewGetMinmaxParameterfv; +GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERIVPROC __glewGetMinmaxParameteriv; +GLEW_FUN_EXPORT PFNGLGETSEPARABLEFILTERPROC __glewGetSeparableFilter; +GLEW_FUN_EXPORT PFNGLHISTOGRAMPROC __glewHistogram; +GLEW_FUN_EXPORT PFNGLMINMAXPROC __glewMinmax; +GLEW_FUN_EXPORT PFNGLRESETHISTOGRAMPROC __glewResetHistogram; +GLEW_FUN_EXPORT PFNGLRESETMINMAXPROC __glewResetMinmax; +GLEW_FUN_EXPORT PFNGLSEPARABLEFILTER2DPROC __glewSeparableFilter2D; + +GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC __glewMultiDrawArraysIndirectCountARB; +GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC __glewMultiDrawElementsIndirectCountARB; + +GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDARBPROC __glewDrawArraysInstancedARB; +GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDARBPROC __glewDrawElementsInstancedARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBDIVISORARBPROC __glewVertexAttribDivisorARB; + +GLEW_FUN_EXPORT PFNGLGETINTERNALFORMATIVPROC __glewGetInternalformativ; + +GLEW_FUN_EXPORT PFNGLGETINTERNALFORMATI64VPROC __glewGetInternalformati64v; + +GLEW_FUN_EXPORT PFNGLINVALIDATEBUFFERDATAPROC __glewInvalidateBufferData; +GLEW_FUN_EXPORT PFNGLINVALIDATEBUFFERSUBDATAPROC __glewInvalidateBufferSubData; +GLEW_FUN_EXPORT PFNGLINVALIDATEFRAMEBUFFERPROC __glewInvalidateFramebuffer; +GLEW_FUN_EXPORT PFNGLINVALIDATESUBFRAMEBUFFERPROC __glewInvalidateSubFramebuffer; +GLEW_FUN_EXPORT PFNGLINVALIDATETEXIMAGEPROC __glewInvalidateTexImage; +GLEW_FUN_EXPORT PFNGLINVALIDATETEXSUBIMAGEPROC __glewInvalidateTexSubImage; + +GLEW_FUN_EXPORT PFNGLFLUSHMAPPEDBUFFERRANGEPROC __glewFlushMappedBufferRange; +GLEW_FUN_EXPORT PFNGLMAPBUFFERRANGEPROC __glewMapBufferRange; + +GLEW_FUN_EXPORT PFNGLCURRENTPALETTEMATRIXARBPROC __glewCurrentPaletteMatrixARB; +GLEW_FUN_EXPORT PFNGLMATRIXINDEXPOINTERARBPROC __glewMatrixIndexPointerARB; +GLEW_FUN_EXPORT PFNGLMATRIXINDEXUBVARBPROC __glewMatrixIndexubvARB; +GLEW_FUN_EXPORT PFNGLMATRIXINDEXUIVARBPROC __glewMatrixIndexuivARB; +GLEW_FUN_EXPORT PFNGLMATRIXINDEXUSVARBPROC __glewMatrixIndexusvARB; + +GLEW_FUN_EXPORT PFNGLBINDBUFFERSBASEPROC __glewBindBuffersBase; +GLEW_FUN_EXPORT PFNGLBINDBUFFERSRANGEPROC __glewBindBuffersRange; +GLEW_FUN_EXPORT PFNGLBINDIMAGETEXTURESPROC __glewBindImageTextures; +GLEW_FUN_EXPORT PFNGLBINDSAMPLERSPROC __glewBindSamplers; +GLEW_FUN_EXPORT PFNGLBINDTEXTURESPROC __glewBindTextures; +GLEW_FUN_EXPORT PFNGLBINDVERTEXBUFFERSPROC __glewBindVertexBuffers; + +GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTPROC __glewMultiDrawArraysIndirect; +GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTPROC __glewMultiDrawElementsIndirect; + +GLEW_FUN_EXPORT PFNGLSAMPLECOVERAGEARBPROC __glewSampleCoverageARB; + +GLEW_FUN_EXPORT PFNGLACTIVETEXTUREARBPROC __glewActiveTextureARB; +GLEW_FUN_EXPORT PFNGLCLIENTACTIVETEXTUREARBPROC __glewClientActiveTextureARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DARBPROC __glewMultiTexCoord1dARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DVARBPROC __glewMultiTexCoord1dvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FARBPROC __glewMultiTexCoord1fARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FVARBPROC __glewMultiTexCoord1fvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IARBPROC __glewMultiTexCoord1iARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IVARBPROC __glewMultiTexCoord1ivARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SARBPROC __glewMultiTexCoord1sARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SVARBPROC __glewMultiTexCoord1svARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DARBPROC __glewMultiTexCoord2dARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DVARBPROC __glewMultiTexCoord2dvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FARBPROC __glewMultiTexCoord2fARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FVARBPROC __glewMultiTexCoord2fvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IARBPROC __glewMultiTexCoord2iARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IVARBPROC __glewMultiTexCoord2ivARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SARBPROC __glewMultiTexCoord2sARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SVARBPROC __glewMultiTexCoord2svARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DARBPROC __glewMultiTexCoord3dARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DVARBPROC __glewMultiTexCoord3dvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FARBPROC __glewMultiTexCoord3fARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FVARBPROC __glewMultiTexCoord3fvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IARBPROC __glewMultiTexCoord3iARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IVARBPROC __glewMultiTexCoord3ivARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SARBPROC __glewMultiTexCoord3sARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SVARBPROC __glewMultiTexCoord3svARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DARBPROC __glewMultiTexCoord4dARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DVARBPROC __glewMultiTexCoord4dvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FARBPROC __glewMultiTexCoord4fARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FVARBPROC __glewMultiTexCoord4fvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IARBPROC __glewMultiTexCoord4iARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IVARBPROC __glewMultiTexCoord4ivARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SARBPROC __glewMultiTexCoord4sARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SVARBPROC __glewMultiTexCoord4svARB; + +GLEW_FUN_EXPORT PFNGLBEGINQUERYARBPROC __glewBeginQueryARB; +GLEW_FUN_EXPORT PFNGLDELETEQUERIESARBPROC __glewDeleteQueriesARB; +GLEW_FUN_EXPORT PFNGLENDQUERYARBPROC __glewEndQueryARB; +GLEW_FUN_EXPORT PFNGLGENQUERIESARBPROC __glewGenQueriesARB; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVARBPROC __glewGetQueryObjectivARB; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVARBPROC __glewGetQueryObjectuivARB; +GLEW_FUN_EXPORT PFNGLGETQUERYIVARBPROC __glewGetQueryivARB; +GLEW_FUN_EXPORT PFNGLISQUERYARBPROC __glewIsQueryARB; + +GLEW_FUN_EXPORT PFNGLMAXSHADERCOMPILERTHREADSARBPROC __glewMaxShaderCompilerThreadsARB; + +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFARBPROC __glewPointParameterfARB; +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVARBPROC __glewPointParameterfvARB; + +GLEW_FUN_EXPORT PFNGLGETPROGRAMINTERFACEIVPROC __glewGetProgramInterfaceiv; +GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCEINDEXPROC __glewGetProgramResourceIndex; +GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCELOCATIONPROC __glewGetProgramResourceLocation; +GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC __glewGetProgramResourceLocationIndex; +GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCENAMEPROC __glewGetProgramResourceName; +GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCEIVPROC __glewGetProgramResourceiv; + +GLEW_FUN_EXPORT PFNGLPROVOKINGVERTEXPROC __glewProvokingVertex; + +GLEW_FUN_EXPORT PFNGLGETGRAPHICSRESETSTATUSARBPROC __glewGetGraphicsResetStatusARB; +GLEW_FUN_EXPORT PFNGLGETNCOLORTABLEARBPROC __glewGetnColorTableARB; +GLEW_FUN_EXPORT PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC __glewGetnCompressedTexImageARB; +GLEW_FUN_EXPORT PFNGLGETNCONVOLUTIONFILTERARBPROC __glewGetnConvolutionFilterARB; +GLEW_FUN_EXPORT PFNGLGETNHISTOGRAMARBPROC __glewGetnHistogramARB; +GLEW_FUN_EXPORT PFNGLGETNMAPDVARBPROC __glewGetnMapdvARB; +GLEW_FUN_EXPORT PFNGLGETNMAPFVARBPROC __glewGetnMapfvARB; +GLEW_FUN_EXPORT PFNGLGETNMAPIVARBPROC __glewGetnMapivARB; +GLEW_FUN_EXPORT PFNGLGETNMINMAXARBPROC __glewGetnMinmaxARB; +GLEW_FUN_EXPORT PFNGLGETNPIXELMAPFVARBPROC __glewGetnPixelMapfvARB; +GLEW_FUN_EXPORT PFNGLGETNPIXELMAPUIVARBPROC __glewGetnPixelMapuivARB; +GLEW_FUN_EXPORT PFNGLGETNPIXELMAPUSVARBPROC __glewGetnPixelMapusvARB; +GLEW_FUN_EXPORT PFNGLGETNPOLYGONSTIPPLEARBPROC __glewGetnPolygonStippleARB; +GLEW_FUN_EXPORT PFNGLGETNSEPARABLEFILTERARBPROC __glewGetnSeparableFilterARB; +GLEW_FUN_EXPORT PFNGLGETNTEXIMAGEARBPROC __glewGetnTexImageARB; +GLEW_FUN_EXPORT PFNGLGETNUNIFORMDVARBPROC __glewGetnUniformdvARB; +GLEW_FUN_EXPORT PFNGLGETNUNIFORMFVARBPROC __glewGetnUniformfvARB; +GLEW_FUN_EXPORT PFNGLGETNUNIFORMIVARBPROC __glewGetnUniformivARB; +GLEW_FUN_EXPORT PFNGLGETNUNIFORMUIVARBPROC __glewGetnUniformuivARB; +GLEW_FUN_EXPORT PFNGLREADNPIXELSARBPROC __glewReadnPixelsARB; + +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERSAMPLELOCATIONSFVARBPROC __glewFramebufferSampleLocationsfvARB; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVARBPROC __glewNamedFramebufferSampleLocationsfvARB; + +GLEW_FUN_EXPORT PFNGLMINSAMPLESHADINGARBPROC __glewMinSampleShadingARB; + +GLEW_FUN_EXPORT PFNGLBINDSAMPLERPROC __glewBindSampler; +GLEW_FUN_EXPORT PFNGLDELETESAMPLERSPROC __glewDeleteSamplers; +GLEW_FUN_EXPORT PFNGLGENSAMPLERSPROC __glewGenSamplers; +GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIIVPROC __glewGetSamplerParameterIiv; +GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIUIVPROC __glewGetSamplerParameterIuiv; +GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERFVPROC __glewGetSamplerParameterfv; +GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIVPROC __glewGetSamplerParameteriv; +GLEW_FUN_EXPORT PFNGLISSAMPLERPROC __glewIsSampler; +GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIIVPROC __glewSamplerParameterIiv; +GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIUIVPROC __glewSamplerParameterIuiv; +GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERFPROC __glewSamplerParameterf; +GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERFVPROC __glewSamplerParameterfv; +GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIPROC __glewSamplerParameteri; +GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIVPROC __glewSamplerParameteriv; + +GLEW_FUN_EXPORT PFNGLACTIVESHADERPROGRAMPROC __glewActiveShaderProgram; +GLEW_FUN_EXPORT PFNGLBINDPROGRAMPIPELINEPROC __glewBindProgramPipeline; +GLEW_FUN_EXPORT PFNGLCREATESHADERPROGRAMVPROC __glewCreateShaderProgramv; +GLEW_FUN_EXPORT PFNGLDELETEPROGRAMPIPELINESPROC __glewDeleteProgramPipelines; +GLEW_FUN_EXPORT PFNGLGENPROGRAMPIPELINESPROC __glewGenProgramPipelines; +GLEW_FUN_EXPORT PFNGLGETPROGRAMPIPELINEINFOLOGPROC __glewGetProgramPipelineInfoLog; +GLEW_FUN_EXPORT PFNGLGETPROGRAMPIPELINEIVPROC __glewGetProgramPipelineiv; +GLEW_FUN_EXPORT PFNGLISPROGRAMPIPELINEPROC __glewIsProgramPipeline; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DPROC __glewProgramUniform1d; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1DVPROC __glewProgramUniform1dv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FPROC __glewProgramUniform1f; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FVPROC __glewProgramUniform1fv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IPROC __glewProgramUniform1i; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IVPROC __glewProgramUniform1iv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIPROC __glewProgramUniform1ui; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIVPROC __glewProgramUniform1uiv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DPROC __glewProgramUniform2d; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2DVPROC __glewProgramUniform2dv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FPROC __glewProgramUniform2f; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FVPROC __glewProgramUniform2fv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IPROC __glewProgramUniform2i; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IVPROC __glewProgramUniform2iv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIPROC __glewProgramUniform2ui; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIVPROC __glewProgramUniform2uiv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DPROC __glewProgramUniform3d; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3DVPROC __glewProgramUniform3dv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FPROC __glewProgramUniform3f; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FVPROC __glewProgramUniform3fv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IPROC __glewProgramUniform3i; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IVPROC __glewProgramUniform3iv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIPROC __glewProgramUniform3ui; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIVPROC __glewProgramUniform3uiv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DPROC __glewProgramUniform4d; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4DVPROC __glewProgramUniform4dv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FPROC __glewProgramUniform4f; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FVPROC __glewProgramUniform4fv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IPROC __glewProgramUniform4i; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IVPROC __glewProgramUniform4iv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIPROC __glewProgramUniform4ui; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIVPROC __glewProgramUniform4uiv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2DVPROC __glewProgramUniformMatrix2dv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2FVPROC __glewProgramUniformMatrix2fv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC __glewProgramUniformMatrix2x3dv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC __glewProgramUniformMatrix2x3fv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC __glewProgramUniformMatrix2x4dv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC __glewProgramUniformMatrix2x4fv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3DVPROC __glewProgramUniformMatrix3dv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3FVPROC __glewProgramUniformMatrix3fv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC __glewProgramUniformMatrix3x2dv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC __glewProgramUniformMatrix3x2fv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC __glewProgramUniformMatrix3x4dv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC __glewProgramUniformMatrix3x4fv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4DVPROC __glewProgramUniformMatrix4dv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4FVPROC __glewProgramUniformMatrix4fv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC __glewProgramUniformMatrix4x2dv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC __glewProgramUniformMatrix4x2fv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC __glewProgramUniformMatrix4x3dv; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC __glewProgramUniformMatrix4x3fv; +GLEW_FUN_EXPORT PFNGLUSEPROGRAMSTAGESPROC __glewUseProgramStages; +GLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMPIPELINEPROC __glewValidateProgramPipeline; + +GLEW_FUN_EXPORT PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC __glewGetActiveAtomicCounterBufferiv; + +GLEW_FUN_EXPORT PFNGLBINDIMAGETEXTUREPROC __glewBindImageTexture; +GLEW_FUN_EXPORT PFNGLMEMORYBARRIERPROC __glewMemoryBarrier; + +GLEW_FUN_EXPORT PFNGLATTACHOBJECTARBPROC __glewAttachObjectARB; +GLEW_FUN_EXPORT PFNGLCOMPILESHADERARBPROC __glewCompileShaderARB; +GLEW_FUN_EXPORT PFNGLCREATEPROGRAMOBJECTARBPROC __glewCreateProgramObjectARB; +GLEW_FUN_EXPORT PFNGLCREATESHADEROBJECTARBPROC __glewCreateShaderObjectARB; +GLEW_FUN_EXPORT PFNGLDELETEOBJECTARBPROC __glewDeleteObjectARB; +GLEW_FUN_EXPORT PFNGLDETACHOBJECTARBPROC __glewDetachObjectARB; +GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMARBPROC __glewGetActiveUniformARB; +GLEW_FUN_EXPORT PFNGLGETATTACHEDOBJECTSARBPROC __glewGetAttachedObjectsARB; +GLEW_FUN_EXPORT PFNGLGETHANDLEARBPROC __glewGetHandleARB; +GLEW_FUN_EXPORT PFNGLGETINFOLOGARBPROC __glewGetInfoLogARB; +GLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERFVARBPROC __glewGetObjectParameterfvARB; +GLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERIVARBPROC __glewGetObjectParameterivARB; +GLEW_FUN_EXPORT PFNGLGETSHADERSOURCEARBPROC __glewGetShaderSourceARB; +GLEW_FUN_EXPORT PFNGLGETUNIFORMLOCATIONARBPROC __glewGetUniformLocationARB; +GLEW_FUN_EXPORT PFNGLGETUNIFORMFVARBPROC __glewGetUniformfvARB; +GLEW_FUN_EXPORT PFNGLGETUNIFORMIVARBPROC __glewGetUniformivARB; +GLEW_FUN_EXPORT PFNGLLINKPROGRAMARBPROC __glewLinkProgramARB; +GLEW_FUN_EXPORT PFNGLSHADERSOURCEARBPROC __glewShaderSourceARB; +GLEW_FUN_EXPORT PFNGLUNIFORM1FARBPROC __glewUniform1fARB; +GLEW_FUN_EXPORT PFNGLUNIFORM1FVARBPROC __glewUniform1fvARB; +GLEW_FUN_EXPORT PFNGLUNIFORM1IARBPROC __glewUniform1iARB; +GLEW_FUN_EXPORT PFNGLUNIFORM1IVARBPROC __glewUniform1ivARB; +GLEW_FUN_EXPORT PFNGLUNIFORM2FARBPROC __glewUniform2fARB; +GLEW_FUN_EXPORT PFNGLUNIFORM2FVARBPROC __glewUniform2fvARB; +GLEW_FUN_EXPORT PFNGLUNIFORM2IARBPROC __glewUniform2iARB; +GLEW_FUN_EXPORT PFNGLUNIFORM2IVARBPROC __glewUniform2ivARB; +GLEW_FUN_EXPORT PFNGLUNIFORM3FARBPROC __glewUniform3fARB; +GLEW_FUN_EXPORT PFNGLUNIFORM3FVARBPROC __glewUniform3fvARB; +GLEW_FUN_EXPORT PFNGLUNIFORM3IARBPROC __glewUniform3iARB; +GLEW_FUN_EXPORT PFNGLUNIFORM3IVARBPROC __glewUniform3ivARB; +GLEW_FUN_EXPORT PFNGLUNIFORM4FARBPROC __glewUniform4fARB; +GLEW_FUN_EXPORT PFNGLUNIFORM4FVARBPROC __glewUniform4fvARB; +GLEW_FUN_EXPORT PFNGLUNIFORM4IARBPROC __glewUniform4iARB; +GLEW_FUN_EXPORT PFNGLUNIFORM4IVARBPROC __glewUniform4ivARB; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2FVARBPROC __glewUniformMatrix2fvARB; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3FVARBPROC __glewUniformMatrix3fvARB; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4FVARBPROC __glewUniformMatrix4fvARB; +GLEW_FUN_EXPORT PFNGLUSEPROGRAMOBJECTARBPROC __glewUseProgramObjectARB; +GLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMARBPROC __glewValidateProgramARB; + +GLEW_FUN_EXPORT PFNGLSHADERSTORAGEBLOCKBINDINGPROC __glewShaderStorageBlockBinding; + +GLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINENAMEPROC __glewGetActiveSubroutineName; +GLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC __glewGetActiveSubroutineUniformName; +GLEW_FUN_EXPORT PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC __glewGetActiveSubroutineUniformiv; +GLEW_FUN_EXPORT PFNGLGETPROGRAMSTAGEIVPROC __glewGetProgramStageiv; +GLEW_FUN_EXPORT PFNGLGETSUBROUTINEINDEXPROC __glewGetSubroutineIndex; +GLEW_FUN_EXPORT PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC __glewGetSubroutineUniformLocation; +GLEW_FUN_EXPORT PFNGLGETUNIFORMSUBROUTINEUIVPROC __glewGetUniformSubroutineuiv; +GLEW_FUN_EXPORT PFNGLUNIFORMSUBROUTINESUIVPROC __glewUniformSubroutinesuiv; + +GLEW_FUN_EXPORT PFNGLCOMPILESHADERINCLUDEARBPROC __glewCompileShaderIncludeARB; +GLEW_FUN_EXPORT PFNGLDELETENAMEDSTRINGARBPROC __glewDeleteNamedStringARB; +GLEW_FUN_EXPORT PFNGLGETNAMEDSTRINGARBPROC __glewGetNamedStringARB; +GLEW_FUN_EXPORT PFNGLGETNAMEDSTRINGIVARBPROC __glewGetNamedStringivARB; +GLEW_FUN_EXPORT PFNGLISNAMEDSTRINGARBPROC __glewIsNamedStringARB; +GLEW_FUN_EXPORT PFNGLNAMEDSTRINGARBPROC __glewNamedStringARB; + +GLEW_FUN_EXPORT PFNGLBUFFERPAGECOMMITMENTARBPROC __glewBufferPageCommitmentARB; + +GLEW_FUN_EXPORT PFNGLTEXPAGECOMMITMENTARBPROC __glewTexPageCommitmentARB; +GLEW_FUN_EXPORT PFNGLTEXTUREPAGECOMMITMENTEXTPROC __glewTexturePageCommitmentEXT; + +GLEW_FUN_EXPORT PFNGLCLIENTWAITSYNCPROC __glewClientWaitSync; +GLEW_FUN_EXPORT PFNGLDELETESYNCPROC __glewDeleteSync; +GLEW_FUN_EXPORT PFNGLFENCESYNCPROC __glewFenceSync; +GLEW_FUN_EXPORT PFNGLGETINTEGER64VPROC __glewGetInteger64v; +GLEW_FUN_EXPORT PFNGLGETSYNCIVPROC __glewGetSynciv; +GLEW_FUN_EXPORT PFNGLISSYNCPROC __glewIsSync; +GLEW_FUN_EXPORT PFNGLWAITSYNCPROC __glewWaitSync; + +GLEW_FUN_EXPORT PFNGLPATCHPARAMETERFVPROC __glewPatchParameterfv; +GLEW_FUN_EXPORT PFNGLPATCHPARAMETERIPROC __glewPatchParameteri; + +GLEW_FUN_EXPORT PFNGLTEXTUREBARRIERPROC __glewTextureBarrier; + +GLEW_FUN_EXPORT PFNGLTEXBUFFERARBPROC __glewTexBufferARB; + +GLEW_FUN_EXPORT PFNGLTEXBUFFERRANGEPROC __glewTexBufferRange; +GLEW_FUN_EXPORT PFNGLTEXTUREBUFFERRANGEEXTPROC __glewTextureBufferRangeEXT; + +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE1DARBPROC __glewCompressedTexImage1DARB; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE2DARBPROC __glewCompressedTexImage2DARB; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE3DARBPROC __glewCompressedTexImage3DARB; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC __glewCompressedTexSubImage1DARB; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC __glewCompressedTexSubImage2DARB; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC __glewCompressedTexSubImage3DARB; +GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXIMAGEARBPROC __glewGetCompressedTexImageARB; + +GLEW_FUN_EXPORT PFNGLGETMULTISAMPLEFVPROC __glewGetMultisamplefv; +GLEW_FUN_EXPORT PFNGLSAMPLEMASKIPROC __glewSampleMaski; +GLEW_FUN_EXPORT PFNGLTEXIMAGE2DMULTISAMPLEPROC __glewTexImage2DMultisample; +GLEW_FUN_EXPORT PFNGLTEXIMAGE3DMULTISAMPLEPROC __glewTexImage3DMultisample; + +GLEW_FUN_EXPORT PFNGLTEXSTORAGE1DPROC __glewTexStorage1D; +GLEW_FUN_EXPORT PFNGLTEXSTORAGE2DPROC __glewTexStorage2D; +GLEW_FUN_EXPORT PFNGLTEXSTORAGE3DPROC __glewTexStorage3D; +GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE1DEXTPROC __glewTextureStorage1DEXT; +GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE2DEXTPROC __glewTextureStorage2DEXT; +GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE3DEXTPROC __glewTextureStorage3DEXT; + +GLEW_FUN_EXPORT PFNGLTEXSTORAGE2DMULTISAMPLEPROC __glewTexStorage2DMultisample; +GLEW_FUN_EXPORT PFNGLTEXSTORAGE3DMULTISAMPLEPROC __glewTexStorage3DMultisample; +GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC __glewTextureStorage2DMultisampleEXT; +GLEW_FUN_EXPORT PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC __glewTextureStorage3DMultisampleEXT; + +GLEW_FUN_EXPORT PFNGLTEXTUREVIEWPROC __glewTextureView; + +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTI64VPROC __glewGetQueryObjecti64v; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUI64VPROC __glewGetQueryObjectui64v; +GLEW_FUN_EXPORT PFNGLQUERYCOUNTERPROC __glewQueryCounter; + +GLEW_FUN_EXPORT PFNGLBINDTRANSFORMFEEDBACKPROC __glewBindTransformFeedback; +GLEW_FUN_EXPORT PFNGLDELETETRANSFORMFEEDBACKSPROC __glewDeleteTransformFeedbacks; +GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKPROC __glewDrawTransformFeedback; +GLEW_FUN_EXPORT PFNGLGENTRANSFORMFEEDBACKSPROC __glewGenTransformFeedbacks; +GLEW_FUN_EXPORT PFNGLISTRANSFORMFEEDBACKPROC __glewIsTransformFeedback; +GLEW_FUN_EXPORT PFNGLPAUSETRANSFORMFEEDBACKPROC __glewPauseTransformFeedback; +GLEW_FUN_EXPORT PFNGLRESUMETRANSFORMFEEDBACKPROC __glewResumeTransformFeedback; + +GLEW_FUN_EXPORT PFNGLBEGINQUERYINDEXEDPROC __glewBeginQueryIndexed; +GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC __glewDrawTransformFeedbackStream; +GLEW_FUN_EXPORT PFNGLENDQUERYINDEXEDPROC __glewEndQueryIndexed; +GLEW_FUN_EXPORT PFNGLGETQUERYINDEXEDIVPROC __glewGetQueryIndexediv; + +GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC __glewDrawTransformFeedbackInstanced; +GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC __glewDrawTransformFeedbackStreamInstanced; + +GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXDARBPROC __glewLoadTransposeMatrixdARB; +GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXFARBPROC __glewLoadTransposeMatrixfARB; +GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXDARBPROC __glewMultTransposeMatrixdARB; +GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXFARBPROC __glewMultTransposeMatrixfARB; + +GLEW_FUN_EXPORT PFNGLBINDBUFFERBASEPROC __glewBindBufferBase; +GLEW_FUN_EXPORT PFNGLBINDBUFFERRANGEPROC __glewBindBufferRange; +GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC __glewGetActiveUniformBlockName; +GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMBLOCKIVPROC __glewGetActiveUniformBlockiv; +GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMNAMEPROC __glewGetActiveUniformName; +GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMSIVPROC __glewGetActiveUniformsiv; +GLEW_FUN_EXPORT PFNGLGETINTEGERI_VPROC __glewGetIntegeri_v; +GLEW_FUN_EXPORT PFNGLGETUNIFORMBLOCKINDEXPROC __glewGetUniformBlockIndex; +GLEW_FUN_EXPORT PFNGLGETUNIFORMINDICESPROC __glewGetUniformIndices; +GLEW_FUN_EXPORT PFNGLUNIFORMBLOCKBINDINGPROC __glewUniformBlockBinding; + +GLEW_FUN_EXPORT PFNGLBINDVERTEXARRAYPROC __glewBindVertexArray; +GLEW_FUN_EXPORT PFNGLDELETEVERTEXARRAYSPROC __glewDeleteVertexArrays; +GLEW_FUN_EXPORT PFNGLGENVERTEXARRAYSPROC __glewGenVertexArrays; +GLEW_FUN_EXPORT PFNGLISVERTEXARRAYPROC __glewIsVertexArray; + +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLDVPROC __glewGetVertexAttribLdv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DPROC __glewVertexAttribL1d; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DVPROC __glewVertexAttribL1dv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DPROC __glewVertexAttribL2d; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DVPROC __glewVertexAttribL2dv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DPROC __glewVertexAttribL3d; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DVPROC __glewVertexAttribL3dv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DPROC __glewVertexAttribL4d; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DVPROC __glewVertexAttribL4dv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBLPOINTERPROC __glewVertexAttribLPointer; + +GLEW_FUN_EXPORT PFNGLBINDVERTEXBUFFERPROC __glewBindVertexBuffer; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC __glewVertexArrayBindVertexBufferEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC __glewVertexArrayVertexAttribBindingEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC __glewVertexArrayVertexAttribFormatEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC __glewVertexArrayVertexAttribIFormatEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC __glewVertexArrayVertexAttribLFormatEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC __glewVertexArrayVertexBindingDivisorEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBBINDINGPROC __glewVertexAttribBinding; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBFORMATPROC __glewVertexAttribFormat; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBIFORMATPROC __glewVertexAttribIFormat; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBLFORMATPROC __glewVertexAttribLFormat; +GLEW_FUN_EXPORT PFNGLVERTEXBINDINGDIVISORPROC __glewVertexBindingDivisor; + +GLEW_FUN_EXPORT PFNGLVERTEXBLENDARBPROC __glewVertexBlendARB; +GLEW_FUN_EXPORT PFNGLWEIGHTPOINTERARBPROC __glewWeightPointerARB; +GLEW_FUN_EXPORT PFNGLWEIGHTBVARBPROC __glewWeightbvARB; +GLEW_FUN_EXPORT PFNGLWEIGHTDVARBPROC __glewWeightdvARB; +GLEW_FUN_EXPORT PFNGLWEIGHTFVARBPROC __glewWeightfvARB; +GLEW_FUN_EXPORT PFNGLWEIGHTIVARBPROC __glewWeightivARB; +GLEW_FUN_EXPORT PFNGLWEIGHTSVARBPROC __glewWeightsvARB; +GLEW_FUN_EXPORT PFNGLWEIGHTUBVARBPROC __glewWeightubvARB; +GLEW_FUN_EXPORT PFNGLWEIGHTUIVARBPROC __glewWeightuivARB; +GLEW_FUN_EXPORT PFNGLWEIGHTUSVARBPROC __glewWeightusvARB; + +GLEW_FUN_EXPORT PFNGLBINDBUFFERARBPROC __glewBindBufferARB; +GLEW_FUN_EXPORT PFNGLBUFFERDATAARBPROC __glewBufferDataARB; +GLEW_FUN_EXPORT PFNGLBUFFERSUBDATAARBPROC __glewBufferSubDataARB; +GLEW_FUN_EXPORT PFNGLDELETEBUFFERSARBPROC __glewDeleteBuffersARB; +GLEW_FUN_EXPORT PFNGLGENBUFFERSARBPROC __glewGenBuffersARB; +GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERIVARBPROC __glewGetBufferParameterivARB; +GLEW_FUN_EXPORT PFNGLGETBUFFERPOINTERVARBPROC __glewGetBufferPointervARB; +GLEW_FUN_EXPORT PFNGLGETBUFFERSUBDATAARBPROC __glewGetBufferSubDataARB; +GLEW_FUN_EXPORT PFNGLISBUFFERARBPROC __glewIsBufferARB; +GLEW_FUN_EXPORT PFNGLMAPBUFFERARBPROC __glewMapBufferARB; +GLEW_FUN_EXPORT PFNGLUNMAPBUFFERARBPROC __glewUnmapBufferARB; + +GLEW_FUN_EXPORT PFNGLBINDPROGRAMARBPROC __glewBindProgramARB; +GLEW_FUN_EXPORT PFNGLDELETEPROGRAMSARBPROC __glewDeleteProgramsARB; +GLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBARRAYARBPROC __glewDisableVertexAttribArrayARB; +GLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBARRAYARBPROC __glewEnableVertexAttribArrayARB; +GLEW_FUN_EXPORT PFNGLGENPROGRAMSARBPROC __glewGenProgramsARB; +GLEW_FUN_EXPORT PFNGLGETPROGRAMENVPARAMETERDVARBPROC __glewGetProgramEnvParameterdvARB; +GLEW_FUN_EXPORT PFNGLGETPROGRAMENVPARAMETERFVARBPROC __glewGetProgramEnvParameterfvARB; +GLEW_FUN_EXPORT PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC __glewGetProgramLocalParameterdvARB; +GLEW_FUN_EXPORT PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC __glewGetProgramLocalParameterfvARB; +GLEW_FUN_EXPORT PFNGLGETPROGRAMSTRINGARBPROC __glewGetProgramStringARB; +GLEW_FUN_EXPORT PFNGLGETPROGRAMIVARBPROC __glewGetProgramivARB; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVARBPROC __glewGetVertexAttribPointervARB; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVARBPROC __glewGetVertexAttribdvARB; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVARBPROC __glewGetVertexAttribfvARB; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVARBPROC __glewGetVertexAttribivARB; +GLEW_FUN_EXPORT PFNGLISPROGRAMARBPROC __glewIsProgramARB; +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4DARBPROC __glewProgramEnvParameter4dARB; +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4DVARBPROC __glewProgramEnvParameter4dvARB; +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4FARBPROC __glewProgramEnvParameter4fARB; +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4FVARBPROC __glewProgramEnvParameter4fvARB; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4DARBPROC __glewProgramLocalParameter4dARB; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4DVARBPROC __glewProgramLocalParameter4dvARB; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4FARBPROC __glewProgramLocalParameter4fARB; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4FVARBPROC __glewProgramLocalParameter4fvARB; +GLEW_FUN_EXPORT PFNGLPROGRAMSTRINGARBPROC __glewProgramStringARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DARBPROC __glewVertexAttrib1dARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVARBPROC __glewVertexAttrib1dvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FARBPROC __glewVertexAttrib1fARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVARBPROC __glewVertexAttrib1fvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SARBPROC __glewVertexAttrib1sARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVARBPROC __glewVertexAttrib1svARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DARBPROC __glewVertexAttrib2dARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVARBPROC __glewVertexAttrib2dvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FARBPROC __glewVertexAttrib2fARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVARBPROC __glewVertexAttrib2fvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SARBPROC __glewVertexAttrib2sARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVARBPROC __glewVertexAttrib2svARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DARBPROC __glewVertexAttrib3dARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVARBPROC __glewVertexAttrib3dvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FARBPROC __glewVertexAttrib3fARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVARBPROC __glewVertexAttrib3fvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SARBPROC __glewVertexAttrib3sARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVARBPROC __glewVertexAttrib3svARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NBVARBPROC __glewVertexAttrib4NbvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NIVARBPROC __glewVertexAttrib4NivARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NSVARBPROC __glewVertexAttrib4NsvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBARBPROC __glewVertexAttrib4NubARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBVARBPROC __glewVertexAttrib4NubvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUIVARBPROC __glewVertexAttrib4NuivARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUSVARBPROC __glewVertexAttrib4NusvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4BVARBPROC __glewVertexAttrib4bvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DARBPROC __glewVertexAttrib4dARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVARBPROC __glewVertexAttrib4dvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FARBPROC __glewVertexAttrib4fARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVARBPROC __glewVertexAttrib4fvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4IVARBPROC __glewVertexAttrib4ivARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SARBPROC __glewVertexAttrib4sARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVARBPROC __glewVertexAttrib4svARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVARBPROC __glewVertexAttrib4ubvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UIVARBPROC __glewVertexAttrib4uivARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4USVARBPROC __glewVertexAttrib4usvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERARBPROC __glewVertexAttribPointerARB; + +GLEW_FUN_EXPORT PFNGLBINDATTRIBLOCATIONARBPROC __glewBindAttribLocationARB; +GLEW_FUN_EXPORT PFNGLGETACTIVEATTRIBARBPROC __glewGetActiveAttribARB; +GLEW_FUN_EXPORT PFNGLGETATTRIBLOCATIONARBPROC __glewGetAttribLocationARB; + +GLEW_FUN_EXPORT PFNGLCOLORP3UIPROC __glewColorP3ui; +GLEW_FUN_EXPORT PFNGLCOLORP3UIVPROC __glewColorP3uiv; +GLEW_FUN_EXPORT PFNGLCOLORP4UIPROC __glewColorP4ui; +GLEW_FUN_EXPORT PFNGLCOLORP4UIVPROC __glewColorP4uiv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP1UIPROC __glewMultiTexCoordP1ui; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP1UIVPROC __glewMultiTexCoordP1uiv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP2UIPROC __glewMultiTexCoordP2ui; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP2UIVPROC __glewMultiTexCoordP2uiv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP3UIPROC __glewMultiTexCoordP3ui; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP3UIVPROC __glewMultiTexCoordP3uiv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP4UIPROC __glewMultiTexCoordP4ui; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORDP4UIVPROC __glewMultiTexCoordP4uiv; +GLEW_FUN_EXPORT PFNGLNORMALP3UIPROC __glewNormalP3ui; +GLEW_FUN_EXPORT PFNGLNORMALP3UIVPROC __glewNormalP3uiv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLORP3UIPROC __glewSecondaryColorP3ui; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLORP3UIVPROC __glewSecondaryColorP3uiv; +GLEW_FUN_EXPORT PFNGLTEXCOORDP1UIPROC __glewTexCoordP1ui; +GLEW_FUN_EXPORT PFNGLTEXCOORDP1UIVPROC __glewTexCoordP1uiv; +GLEW_FUN_EXPORT PFNGLTEXCOORDP2UIPROC __glewTexCoordP2ui; +GLEW_FUN_EXPORT PFNGLTEXCOORDP2UIVPROC __glewTexCoordP2uiv; +GLEW_FUN_EXPORT PFNGLTEXCOORDP3UIPROC __glewTexCoordP3ui; +GLEW_FUN_EXPORT PFNGLTEXCOORDP3UIVPROC __glewTexCoordP3uiv; +GLEW_FUN_EXPORT PFNGLTEXCOORDP4UIPROC __glewTexCoordP4ui; +GLEW_FUN_EXPORT PFNGLTEXCOORDP4UIVPROC __glewTexCoordP4uiv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP1UIPROC __glewVertexAttribP1ui; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP1UIVPROC __glewVertexAttribP1uiv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP2UIPROC __glewVertexAttribP2ui; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP2UIVPROC __glewVertexAttribP2uiv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP3UIPROC __glewVertexAttribP3ui; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP3UIVPROC __glewVertexAttribP3uiv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP4UIPROC __glewVertexAttribP4ui; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBP4UIVPROC __glewVertexAttribP4uiv; +GLEW_FUN_EXPORT PFNGLVERTEXP2UIPROC __glewVertexP2ui; +GLEW_FUN_EXPORT PFNGLVERTEXP2UIVPROC __glewVertexP2uiv; +GLEW_FUN_EXPORT PFNGLVERTEXP3UIPROC __glewVertexP3ui; +GLEW_FUN_EXPORT PFNGLVERTEXP3UIVPROC __glewVertexP3uiv; +GLEW_FUN_EXPORT PFNGLVERTEXP4UIPROC __glewVertexP4ui; +GLEW_FUN_EXPORT PFNGLVERTEXP4UIVPROC __glewVertexP4uiv; + +GLEW_FUN_EXPORT PFNGLDEPTHRANGEARRAYVPROC __glewDepthRangeArrayv; +GLEW_FUN_EXPORT PFNGLDEPTHRANGEINDEXEDPROC __glewDepthRangeIndexed; +GLEW_FUN_EXPORT PFNGLGETDOUBLEI_VPROC __glewGetDoublei_v; +GLEW_FUN_EXPORT PFNGLGETFLOATI_VPROC __glewGetFloati_v; +GLEW_FUN_EXPORT PFNGLSCISSORARRAYVPROC __glewScissorArrayv; +GLEW_FUN_EXPORT PFNGLSCISSORINDEXEDPROC __glewScissorIndexed; +GLEW_FUN_EXPORT PFNGLSCISSORINDEXEDVPROC __glewScissorIndexedv; +GLEW_FUN_EXPORT PFNGLVIEWPORTARRAYVPROC __glewViewportArrayv; +GLEW_FUN_EXPORT PFNGLVIEWPORTINDEXEDFPROC __glewViewportIndexedf; +GLEW_FUN_EXPORT PFNGLVIEWPORTINDEXEDFVPROC __glewViewportIndexedfv; + +GLEW_FUN_EXPORT PFNGLWINDOWPOS2DARBPROC __glewWindowPos2dARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2DVARBPROC __glewWindowPos2dvARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2FARBPROC __glewWindowPos2fARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2FVARBPROC __glewWindowPos2fvARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2IARBPROC __glewWindowPos2iARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2IVARBPROC __glewWindowPos2ivARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2SARBPROC __glewWindowPos2sARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2SVARBPROC __glewWindowPos2svARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3DARBPROC __glewWindowPos3dARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3DVARBPROC __glewWindowPos3dvARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3FARBPROC __glewWindowPos3fARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3FVARBPROC __glewWindowPos3fvARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3IARBPROC __glewWindowPos3iARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3IVARBPROC __glewWindowPos3ivARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3SARBPROC __glewWindowPos3sARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3SVARBPROC __glewWindowPos3svARB; + +GLEW_FUN_EXPORT PFNGLDRAWBUFFERSATIPROC __glewDrawBuffersATI; + +GLEW_FUN_EXPORT PFNGLDRAWELEMENTARRAYATIPROC __glewDrawElementArrayATI; +GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTARRAYATIPROC __glewDrawRangeElementArrayATI; +GLEW_FUN_EXPORT PFNGLELEMENTPOINTERATIPROC __glewElementPointerATI; + +GLEW_FUN_EXPORT PFNGLGETTEXBUMPPARAMETERFVATIPROC __glewGetTexBumpParameterfvATI; +GLEW_FUN_EXPORT PFNGLGETTEXBUMPPARAMETERIVATIPROC __glewGetTexBumpParameterivATI; +GLEW_FUN_EXPORT PFNGLTEXBUMPPARAMETERFVATIPROC __glewTexBumpParameterfvATI; +GLEW_FUN_EXPORT PFNGLTEXBUMPPARAMETERIVATIPROC __glewTexBumpParameterivATI; + +GLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP1ATIPROC __glewAlphaFragmentOp1ATI; +GLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP2ATIPROC __glewAlphaFragmentOp2ATI; +GLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP3ATIPROC __glewAlphaFragmentOp3ATI; +GLEW_FUN_EXPORT PFNGLBEGINFRAGMENTSHADERATIPROC __glewBeginFragmentShaderATI; +GLEW_FUN_EXPORT PFNGLBINDFRAGMENTSHADERATIPROC __glewBindFragmentShaderATI; +GLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP1ATIPROC __glewColorFragmentOp1ATI; +GLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP2ATIPROC __glewColorFragmentOp2ATI; +GLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP3ATIPROC __glewColorFragmentOp3ATI; +GLEW_FUN_EXPORT PFNGLDELETEFRAGMENTSHADERATIPROC __glewDeleteFragmentShaderATI; +GLEW_FUN_EXPORT PFNGLENDFRAGMENTSHADERATIPROC __glewEndFragmentShaderATI; +GLEW_FUN_EXPORT PFNGLGENFRAGMENTSHADERSATIPROC __glewGenFragmentShadersATI; +GLEW_FUN_EXPORT PFNGLPASSTEXCOORDATIPROC __glewPassTexCoordATI; +GLEW_FUN_EXPORT PFNGLSAMPLEMAPATIPROC __glewSampleMapATI; +GLEW_FUN_EXPORT PFNGLSETFRAGMENTSHADERCONSTANTATIPROC __glewSetFragmentShaderConstantATI; + +GLEW_FUN_EXPORT PFNGLMAPOBJECTBUFFERATIPROC __glewMapObjectBufferATI; +GLEW_FUN_EXPORT PFNGLUNMAPOBJECTBUFFERATIPROC __glewUnmapObjectBufferATI; + +GLEW_FUN_EXPORT PFNGLPNTRIANGLESFATIPROC __glewPNTrianglesfATI; +GLEW_FUN_EXPORT PFNGLPNTRIANGLESIATIPROC __glewPNTrianglesiATI; + +GLEW_FUN_EXPORT PFNGLSTENCILFUNCSEPARATEATIPROC __glewStencilFuncSeparateATI; +GLEW_FUN_EXPORT PFNGLSTENCILOPSEPARATEATIPROC __glewStencilOpSeparateATI; + +GLEW_FUN_EXPORT PFNGLARRAYOBJECTATIPROC __glewArrayObjectATI; +GLEW_FUN_EXPORT PFNGLFREEOBJECTBUFFERATIPROC __glewFreeObjectBufferATI; +GLEW_FUN_EXPORT PFNGLGETARRAYOBJECTFVATIPROC __glewGetArrayObjectfvATI; +GLEW_FUN_EXPORT PFNGLGETARRAYOBJECTIVATIPROC __glewGetArrayObjectivATI; +GLEW_FUN_EXPORT PFNGLGETOBJECTBUFFERFVATIPROC __glewGetObjectBufferfvATI; +GLEW_FUN_EXPORT PFNGLGETOBJECTBUFFERIVATIPROC __glewGetObjectBufferivATI; +GLEW_FUN_EXPORT PFNGLGETVARIANTARRAYOBJECTFVATIPROC __glewGetVariantArrayObjectfvATI; +GLEW_FUN_EXPORT PFNGLGETVARIANTARRAYOBJECTIVATIPROC __glewGetVariantArrayObjectivATI; +GLEW_FUN_EXPORT PFNGLISOBJECTBUFFERATIPROC __glewIsObjectBufferATI; +GLEW_FUN_EXPORT PFNGLNEWOBJECTBUFFERATIPROC __glewNewObjectBufferATI; +GLEW_FUN_EXPORT PFNGLUPDATEOBJECTBUFFERATIPROC __glewUpdateObjectBufferATI; +GLEW_FUN_EXPORT PFNGLVARIANTARRAYOBJECTATIPROC __glewVariantArrayObjectATI; + +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC __glewGetVertexAttribArrayObjectfvATI; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC __glewGetVertexAttribArrayObjectivATI; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBARRAYOBJECTATIPROC __glewVertexAttribArrayObjectATI; + +GLEW_FUN_EXPORT PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC __glewClientActiveVertexStreamATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3BATIPROC __glewNormalStream3bATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3BVATIPROC __glewNormalStream3bvATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3DATIPROC __glewNormalStream3dATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3DVATIPROC __glewNormalStream3dvATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3FATIPROC __glewNormalStream3fATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3FVATIPROC __glewNormalStream3fvATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3IATIPROC __glewNormalStream3iATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3IVATIPROC __glewNormalStream3ivATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3SATIPROC __glewNormalStream3sATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3SVATIPROC __glewNormalStream3svATI; +GLEW_FUN_EXPORT PFNGLVERTEXBLENDENVFATIPROC __glewVertexBlendEnvfATI; +GLEW_FUN_EXPORT PFNGLVERTEXBLENDENVIATIPROC __glewVertexBlendEnviATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1DATIPROC __glewVertexStream1dATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1DVATIPROC __glewVertexStream1dvATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1FATIPROC __glewVertexStream1fATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1FVATIPROC __glewVertexStream1fvATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1IATIPROC __glewVertexStream1iATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1IVATIPROC __glewVertexStream1ivATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1SATIPROC __glewVertexStream1sATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM1SVATIPROC __glewVertexStream1svATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2DATIPROC __glewVertexStream2dATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2DVATIPROC __glewVertexStream2dvATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2FATIPROC __glewVertexStream2fATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2FVATIPROC __glewVertexStream2fvATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2IATIPROC __glewVertexStream2iATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2IVATIPROC __glewVertexStream2ivATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2SATIPROC __glewVertexStream2sATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2SVATIPROC __glewVertexStream2svATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3DATIPROC __glewVertexStream3dATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3DVATIPROC __glewVertexStream3dvATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3FATIPROC __glewVertexStream3fATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3FVATIPROC __glewVertexStream3fvATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3IATIPROC __glewVertexStream3iATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3IVATIPROC __glewVertexStream3ivATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3SATIPROC __glewVertexStream3sATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3SVATIPROC __glewVertexStream3svATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4DATIPROC __glewVertexStream4dATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4DVATIPROC __glewVertexStream4dvATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4FATIPROC __glewVertexStream4fATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4FVATIPROC __glewVertexStream4fvATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4IATIPROC __glewVertexStream4iATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4IVATIPROC __glewVertexStream4ivATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4SATIPROC __glewVertexStream4sATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4SVATIPROC __glewVertexStream4svATI; + +GLEW_FUN_EXPORT PFNGLGETUNIFORMBUFFERSIZEEXTPROC __glewGetUniformBufferSizeEXT; +GLEW_FUN_EXPORT PFNGLGETUNIFORMOFFSETEXTPROC __glewGetUniformOffsetEXT; +GLEW_FUN_EXPORT PFNGLUNIFORMBUFFEREXTPROC __glewUniformBufferEXT; + +GLEW_FUN_EXPORT PFNGLBLENDCOLOREXTPROC __glewBlendColorEXT; + +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEEXTPROC __glewBlendEquationSeparateEXT; + +GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEEXTPROC __glewBlendFuncSeparateEXT; + +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONEXTPROC __glewBlendEquationEXT; + +GLEW_FUN_EXPORT PFNGLCOLORSUBTABLEEXTPROC __glewColorSubTableEXT; +GLEW_FUN_EXPORT PFNGLCOPYCOLORSUBTABLEEXTPROC __glewCopyColorSubTableEXT; + +GLEW_FUN_EXPORT PFNGLLOCKARRAYSEXTPROC __glewLockArraysEXT; +GLEW_FUN_EXPORT PFNGLUNLOCKARRAYSEXTPROC __glewUnlockArraysEXT; + +GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER1DEXTPROC __glewConvolutionFilter1DEXT; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER2DEXTPROC __glewConvolutionFilter2DEXT; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFEXTPROC __glewConvolutionParameterfEXT; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFVEXTPROC __glewConvolutionParameterfvEXT; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIEXTPROC __glewConvolutionParameteriEXT; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIVEXTPROC __glewConvolutionParameterivEXT; +GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC __glewCopyConvolutionFilter1DEXT; +GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC __glewCopyConvolutionFilter2DEXT; +GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONFILTEREXTPROC __glewGetConvolutionFilterEXT; +GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC __glewGetConvolutionParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC __glewGetConvolutionParameterivEXT; +GLEW_FUN_EXPORT PFNGLGETSEPARABLEFILTEREXTPROC __glewGetSeparableFilterEXT; +GLEW_FUN_EXPORT PFNGLSEPARABLEFILTER2DEXTPROC __glewSeparableFilter2DEXT; + +GLEW_FUN_EXPORT PFNGLBINORMALPOINTEREXTPROC __glewBinormalPointerEXT; +GLEW_FUN_EXPORT PFNGLTANGENTPOINTEREXTPROC __glewTangentPointerEXT; + +GLEW_FUN_EXPORT PFNGLCOPYTEXIMAGE1DEXTPROC __glewCopyTexImage1DEXT; +GLEW_FUN_EXPORT PFNGLCOPYTEXIMAGE2DEXTPROC __glewCopyTexImage2DEXT; +GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE1DEXTPROC __glewCopyTexSubImage1DEXT; +GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE2DEXTPROC __glewCopyTexSubImage2DEXT; +GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DEXTPROC __glewCopyTexSubImage3DEXT; + +GLEW_FUN_EXPORT PFNGLCULLPARAMETERDVEXTPROC __glewCullParameterdvEXT; +GLEW_FUN_EXPORT PFNGLCULLPARAMETERFVEXTPROC __glewCullParameterfvEXT; + +GLEW_FUN_EXPORT PFNGLGETOBJECTLABELEXTPROC __glewGetObjectLabelEXT; +GLEW_FUN_EXPORT PFNGLLABELOBJECTEXTPROC __glewLabelObjectEXT; + +GLEW_FUN_EXPORT PFNGLINSERTEVENTMARKEREXTPROC __glewInsertEventMarkerEXT; +GLEW_FUN_EXPORT PFNGLPOPGROUPMARKEREXTPROC __glewPopGroupMarkerEXT; +GLEW_FUN_EXPORT PFNGLPUSHGROUPMARKEREXTPROC __glewPushGroupMarkerEXT; + +GLEW_FUN_EXPORT PFNGLDEPTHBOUNDSEXTPROC __glewDepthBoundsEXT; + +GLEW_FUN_EXPORT PFNGLBINDMULTITEXTUREEXTPROC __glewBindMultiTextureEXT; +GLEW_FUN_EXPORT PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC __glewCheckNamedFramebufferStatusEXT; +GLEW_FUN_EXPORT PFNGLCLIENTATTRIBDEFAULTEXTPROC __glewClientAttribDefaultEXT; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC __glewCompressedMultiTexImage1DEXT; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC __glewCompressedMultiTexImage2DEXT; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC __glewCompressedMultiTexImage3DEXT; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC __glewCompressedMultiTexSubImage1DEXT; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC __glewCompressedMultiTexSubImage2DEXT; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC __glewCompressedMultiTexSubImage3DEXT; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC __glewCompressedTextureImage1DEXT; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC __glewCompressedTextureImage2DEXT; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC __glewCompressedTextureImage3DEXT; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC __glewCompressedTextureSubImage1DEXT; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC __glewCompressedTextureSubImage2DEXT; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC __glewCompressedTextureSubImage3DEXT; +GLEW_FUN_EXPORT PFNGLCOPYMULTITEXIMAGE1DEXTPROC __glewCopyMultiTexImage1DEXT; +GLEW_FUN_EXPORT PFNGLCOPYMULTITEXIMAGE2DEXTPROC __glewCopyMultiTexImage2DEXT; +GLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC __glewCopyMultiTexSubImage1DEXT; +GLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC __glewCopyMultiTexSubImage2DEXT; +GLEW_FUN_EXPORT PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC __glewCopyMultiTexSubImage3DEXT; +GLEW_FUN_EXPORT PFNGLCOPYTEXTUREIMAGE1DEXTPROC __glewCopyTextureImage1DEXT; +GLEW_FUN_EXPORT PFNGLCOPYTEXTUREIMAGE2DEXTPROC __glewCopyTextureImage2DEXT; +GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC __glewCopyTextureSubImage1DEXT; +GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC __glewCopyTextureSubImage2DEXT; +GLEW_FUN_EXPORT PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC __glewCopyTextureSubImage3DEXT; +GLEW_FUN_EXPORT PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC __glewDisableClientStateIndexedEXT; +GLEW_FUN_EXPORT PFNGLDISABLECLIENTSTATEIEXTPROC __glewDisableClientStateiEXT; +GLEW_FUN_EXPORT PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC __glewDisableVertexArrayAttribEXT; +GLEW_FUN_EXPORT PFNGLDISABLEVERTEXARRAYEXTPROC __glewDisableVertexArrayEXT; +GLEW_FUN_EXPORT PFNGLENABLECLIENTSTATEINDEXEDEXTPROC __glewEnableClientStateIndexedEXT; +GLEW_FUN_EXPORT PFNGLENABLECLIENTSTATEIEXTPROC __glewEnableClientStateiEXT; +GLEW_FUN_EXPORT PFNGLENABLEVERTEXARRAYATTRIBEXTPROC __glewEnableVertexArrayAttribEXT; +GLEW_FUN_EXPORT PFNGLENABLEVERTEXARRAYEXTPROC __glewEnableVertexArrayEXT; +GLEW_FUN_EXPORT PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC __glewFlushMappedNamedBufferRangeEXT; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC __glewFramebufferDrawBufferEXT; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC __glewFramebufferDrawBuffersEXT; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERREADBUFFEREXTPROC __glewFramebufferReadBufferEXT; +GLEW_FUN_EXPORT PFNGLGENERATEMULTITEXMIPMAPEXTPROC __glewGenerateMultiTexMipmapEXT; +GLEW_FUN_EXPORT PFNGLGENERATETEXTUREMIPMAPEXTPROC __glewGenerateTextureMipmapEXT; +GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC __glewGetCompressedMultiTexImageEXT; +GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC __glewGetCompressedTextureImageEXT; +GLEW_FUN_EXPORT PFNGLGETDOUBLEINDEXEDVEXTPROC __glewGetDoubleIndexedvEXT; +GLEW_FUN_EXPORT PFNGLGETDOUBLEI_VEXTPROC __glewGetDoublei_vEXT; +GLEW_FUN_EXPORT PFNGLGETFLOATINDEXEDVEXTPROC __glewGetFloatIndexedvEXT; +GLEW_FUN_EXPORT PFNGLGETFLOATI_VEXTPROC __glewGetFloati_vEXT; +GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC __glewGetFramebufferParameterivEXT; +GLEW_FUN_EXPORT PFNGLGETMULTITEXENVFVEXTPROC __glewGetMultiTexEnvfvEXT; +GLEW_FUN_EXPORT PFNGLGETMULTITEXENVIVEXTPROC __glewGetMultiTexEnvivEXT; +GLEW_FUN_EXPORT PFNGLGETMULTITEXGENDVEXTPROC __glewGetMultiTexGendvEXT; +GLEW_FUN_EXPORT PFNGLGETMULTITEXGENFVEXTPROC __glewGetMultiTexGenfvEXT; +GLEW_FUN_EXPORT PFNGLGETMULTITEXGENIVEXTPROC __glewGetMultiTexGenivEXT; +GLEW_FUN_EXPORT PFNGLGETMULTITEXIMAGEEXTPROC __glewGetMultiTexImageEXT; +GLEW_FUN_EXPORT PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC __glewGetMultiTexLevelParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC __glewGetMultiTexLevelParameterivEXT; +GLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIIVEXTPROC __glewGetMultiTexParameterIivEXT; +GLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIUIVEXTPROC __glewGetMultiTexParameterIuivEXT; +GLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERFVEXTPROC __glewGetMultiTexParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETMULTITEXPARAMETERIVEXTPROC __glewGetMultiTexParameterivEXT; +GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC __glewGetNamedBufferParameterivEXT; +GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPOINTERVEXTPROC __glewGetNamedBufferPointervEXT; +GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERSUBDATAEXTPROC __glewGetNamedBufferSubDataEXT; +GLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetNamedFramebufferAttachmentParameterivEXT; +GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC __glewGetNamedProgramLocalParameterIivEXT; +GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC __glewGetNamedProgramLocalParameterIuivEXT; +GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC __glewGetNamedProgramLocalParameterdvEXT; +GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC __glewGetNamedProgramLocalParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMSTRINGEXTPROC __glewGetNamedProgramStringEXT; +GLEW_FUN_EXPORT PFNGLGETNAMEDPROGRAMIVEXTPROC __glewGetNamedProgramivEXT; +GLEW_FUN_EXPORT PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC __glewGetNamedRenderbufferParameterivEXT; +GLEW_FUN_EXPORT PFNGLGETPOINTERINDEXEDVEXTPROC __glewGetPointerIndexedvEXT; +GLEW_FUN_EXPORT PFNGLGETPOINTERI_VEXTPROC __glewGetPointeri_vEXT; +GLEW_FUN_EXPORT PFNGLGETTEXTUREIMAGEEXTPROC __glewGetTextureImageEXT; +GLEW_FUN_EXPORT PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC __glewGetTextureLevelParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC __glewGetTextureLevelParameterivEXT; +GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIIVEXTPROC __glewGetTextureParameterIivEXT; +GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIUIVEXTPROC __glewGetTextureParameterIuivEXT; +GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERFVEXTPROC __glewGetTextureParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETTEXTUREPARAMETERIVEXTPROC __glewGetTextureParameterivEXT; +GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC __glewGetVertexArrayIntegeri_vEXT; +GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYINTEGERVEXTPROC __glewGetVertexArrayIntegervEXT; +GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC __glewGetVertexArrayPointeri_vEXT; +GLEW_FUN_EXPORT PFNGLGETVERTEXARRAYPOINTERVEXTPROC __glewGetVertexArrayPointervEXT; +GLEW_FUN_EXPORT PFNGLMAPNAMEDBUFFEREXTPROC __glewMapNamedBufferEXT; +GLEW_FUN_EXPORT PFNGLMAPNAMEDBUFFERRANGEEXTPROC __glewMapNamedBufferRangeEXT; +GLEW_FUN_EXPORT PFNGLMATRIXFRUSTUMEXTPROC __glewMatrixFrustumEXT; +GLEW_FUN_EXPORT PFNGLMATRIXLOADIDENTITYEXTPROC __glewMatrixLoadIdentityEXT; +GLEW_FUN_EXPORT PFNGLMATRIXLOADTRANSPOSEDEXTPROC __glewMatrixLoadTransposedEXT; +GLEW_FUN_EXPORT PFNGLMATRIXLOADTRANSPOSEFEXTPROC __glewMatrixLoadTransposefEXT; +GLEW_FUN_EXPORT PFNGLMATRIXLOADDEXTPROC __glewMatrixLoaddEXT; +GLEW_FUN_EXPORT PFNGLMATRIXLOADFEXTPROC __glewMatrixLoadfEXT; +GLEW_FUN_EXPORT PFNGLMATRIXMULTTRANSPOSEDEXTPROC __glewMatrixMultTransposedEXT; +GLEW_FUN_EXPORT PFNGLMATRIXMULTTRANSPOSEFEXTPROC __glewMatrixMultTransposefEXT; +GLEW_FUN_EXPORT PFNGLMATRIXMULTDEXTPROC __glewMatrixMultdEXT; +GLEW_FUN_EXPORT PFNGLMATRIXMULTFEXTPROC __glewMatrixMultfEXT; +GLEW_FUN_EXPORT PFNGLMATRIXORTHOEXTPROC __glewMatrixOrthoEXT; +GLEW_FUN_EXPORT PFNGLMATRIXPOPEXTPROC __glewMatrixPopEXT; +GLEW_FUN_EXPORT PFNGLMATRIXPUSHEXTPROC __glewMatrixPushEXT; +GLEW_FUN_EXPORT PFNGLMATRIXROTATEDEXTPROC __glewMatrixRotatedEXT; +GLEW_FUN_EXPORT PFNGLMATRIXROTATEFEXTPROC __glewMatrixRotatefEXT; +GLEW_FUN_EXPORT PFNGLMATRIXSCALEDEXTPROC __glewMatrixScaledEXT; +GLEW_FUN_EXPORT PFNGLMATRIXSCALEFEXTPROC __glewMatrixScalefEXT; +GLEW_FUN_EXPORT PFNGLMATRIXTRANSLATEDEXTPROC __glewMatrixTranslatedEXT; +GLEW_FUN_EXPORT PFNGLMATRIXTRANSLATEFEXTPROC __glewMatrixTranslatefEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXBUFFEREXTPROC __glewMultiTexBufferEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORDPOINTEREXTPROC __glewMultiTexCoordPointerEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXENVFEXTPROC __glewMultiTexEnvfEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXENVFVEXTPROC __glewMultiTexEnvfvEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXENVIEXTPROC __glewMultiTexEnviEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXENVIVEXTPROC __glewMultiTexEnvivEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXGENDEXTPROC __glewMultiTexGendEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXGENDVEXTPROC __glewMultiTexGendvEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXGENFEXTPROC __glewMultiTexGenfEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXGENFVEXTPROC __glewMultiTexGenfvEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXGENIEXTPROC __glewMultiTexGeniEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXGENIVEXTPROC __glewMultiTexGenivEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXIMAGE1DEXTPROC __glewMultiTexImage1DEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXIMAGE2DEXTPROC __glewMultiTexImage2DEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXIMAGE3DEXTPROC __glewMultiTexImage3DEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIIVEXTPROC __glewMultiTexParameterIivEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIUIVEXTPROC __glewMultiTexParameterIuivEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERFEXTPROC __glewMultiTexParameterfEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERFVEXTPROC __glewMultiTexParameterfvEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIEXTPROC __glewMultiTexParameteriEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXPARAMETERIVEXTPROC __glewMultiTexParameterivEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXRENDERBUFFEREXTPROC __glewMultiTexRenderbufferEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE1DEXTPROC __glewMultiTexSubImage1DEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE2DEXTPROC __glewMultiTexSubImage2DEXT; +GLEW_FUN_EXPORT PFNGLMULTITEXSUBIMAGE3DEXTPROC __glewMultiTexSubImage3DEXT; +GLEW_FUN_EXPORT PFNGLNAMEDBUFFERDATAEXTPROC __glewNamedBufferDataEXT; +GLEW_FUN_EXPORT PFNGLNAMEDBUFFERSUBDATAEXTPROC __glewNamedBufferSubDataEXT; +GLEW_FUN_EXPORT PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC __glewNamedCopyBufferSubDataEXT; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC __glewNamedFramebufferRenderbufferEXT; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC __glewNamedFramebufferTexture1DEXT; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC __glewNamedFramebufferTexture2DEXT; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC __glewNamedFramebufferTexture3DEXT; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC __glewNamedFramebufferTextureEXT; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC __glewNamedFramebufferTextureFaceEXT; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC __glewNamedFramebufferTextureLayerEXT; +GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC __glewNamedProgramLocalParameter4dEXT; +GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC __glewNamedProgramLocalParameter4dvEXT; +GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC __glewNamedProgramLocalParameter4fEXT; +GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC __glewNamedProgramLocalParameter4fvEXT; +GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC __glewNamedProgramLocalParameterI4iEXT; +GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC __glewNamedProgramLocalParameterI4ivEXT; +GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC __glewNamedProgramLocalParameterI4uiEXT; +GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC __glewNamedProgramLocalParameterI4uivEXT; +GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC __glewNamedProgramLocalParameters4fvEXT; +GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC __glewNamedProgramLocalParametersI4ivEXT; +GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC __glewNamedProgramLocalParametersI4uivEXT; +GLEW_FUN_EXPORT PFNGLNAMEDPROGRAMSTRINGEXTPROC __glewNamedProgramStringEXT; +GLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC __glewNamedRenderbufferStorageEXT; +GLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC __glewNamedRenderbufferStorageMultisampleCoverageEXT; +GLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewNamedRenderbufferStorageMultisampleEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FEXTPROC __glewProgramUniform1fEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1FVEXTPROC __glewProgramUniform1fvEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IEXTPROC __glewProgramUniform1iEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1IVEXTPROC __glewProgramUniform1ivEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIEXTPROC __glewProgramUniform1uiEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UIVEXTPROC __glewProgramUniform1uivEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FEXTPROC __glewProgramUniform2fEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2FVEXTPROC __glewProgramUniform2fvEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IEXTPROC __glewProgramUniform2iEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2IVEXTPROC __glewProgramUniform2ivEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIEXTPROC __glewProgramUniform2uiEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UIVEXTPROC __glewProgramUniform2uivEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FEXTPROC __glewProgramUniform3fEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3FVEXTPROC __glewProgramUniform3fvEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IEXTPROC __glewProgramUniform3iEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3IVEXTPROC __glewProgramUniform3ivEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIEXTPROC __glewProgramUniform3uiEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UIVEXTPROC __glewProgramUniform3uivEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FEXTPROC __glewProgramUniform4fEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4FVEXTPROC __glewProgramUniform4fvEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IEXTPROC __glewProgramUniform4iEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4IVEXTPROC __glewProgramUniform4ivEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIEXTPROC __glewProgramUniform4uiEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UIVEXTPROC __glewProgramUniform4uivEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC __glewProgramUniformMatrix2fvEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC __glewProgramUniformMatrix2x3fvEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC __glewProgramUniformMatrix2x4fvEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC __glewProgramUniformMatrix3fvEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC __glewProgramUniformMatrix3x2fvEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC __glewProgramUniformMatrix3x4fvEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC __glewProgramUniformMatrix4fvEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC __glewProgramUniformMatrix4x2fvEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC __glewProgramUniformMatrix4x3fvEXT; +GLEW_FUN_EXPORT PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC __glewPushClientAttribDefaultEXT; +GLEW_FUN_EXPORT PFNGLTEXTUREBUFFEREXTPROC __glewTextureBufferEXT; +GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE1DEXTPROC __glewTextureImage1DEXT; +GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DEXTPROC __glewTextureImage2DEXT; +GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DEXTPROC __glewTextureImage3DEXT; +GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIIVEXTPROC __glewTextureParameterIivEXT; +GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIUIVEXTPROC __glewTextureParameterIuivEXT; +GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERFEXTPROC __glewTextureParameterfEXT; +GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERFVEXTPROC __glewTextureParameterfvEXT; +GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIEXTPROC __glewTextureParameteriEXT; +GLEW_FUN_EXPORT PFNGLTEXTUREPARAMETERIVEXTPROC __glewTextureParameterivEXT; +GLEW_FUN_EXPORT PFNGLTEXTURERENDERBUFFEREXTPROC __glewTextureRenderbufferEXT; +GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE1DEXTPROC __glewTextureSubImage1DEXT; +GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE2DEXTPROC __glewTextureSubImage2DEXT; +GLEW_FUN_EXPORT PFNGLTEXTURESUBIMAGE3DEXTPROC __glewTextureSubImage3DEXT; +GLEW_FUN_EXPORT PFNGLUNMAPNAMEDBUFFEREXTPROC __glewUnmapNamedBufferEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYCOLOROFFSETEXTPROC __glewVertexArrayColorOffsetEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC __glewVertexArrayEdgeFlagOffsetEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC __glewVertexArrayFogCoordOffsetEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYINDEXOFFSETEXTPROC __glewVertexArrayIndexOffsetEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC __glewVertexArrayMultiTexCoordOffsetEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYNORMALOFFSETEXTPROC __glewVertexArrayNormalOffsetEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC __glewVertexArraySecondaryColorOffsetEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC __glewVertexArrayTexCoordOffsetEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC __glewVertexArrayVertexAttribDivisorEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC __glewVertexArrayVertexAttribIOffsetEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC __glewVertexArrayVertexAttribOffsetEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC __glewVertexArrayVertexOffsetEXT; + +GLEW_FUN_EXPORT PFNGLCOLORMASKINDEXEDEXTPROC __glewColorMaskIndexedEXT; +GLEW_FUN_EXPORT PFNGLDISABLEINDEXEDEXTPROC __glewDisableIndexedEXT; +GLEW_FUN_EXPORT PFNGLENABLEINDEXEDEXTPROC __glewEnableIndexedEXT; +GLEW_FUN_EXPORT PFNGLGETBOOLEANINDEXEDVEXTPROC __glewGetBooleanIndexedvEXT; +GLEW_FUN_EXPORT PFNGLGETINTEGERINDEXEDVEXTPROC __glewGetIntegerIndexedvEXT; +GLEW_FUN_EXPORT PFNGLISENABLEDINDEXEDEXTPROC __glewIsEnabledIndexedEXT; + +GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDEXTPROC __glewDrawArraysInstancedEXT; +GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDEXTPROC __glewDrawElementsInstancedEXT; + +GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSEXTPROC __glewDrawRangeElementsEXT; + +GLEW_FUN_EXPORT PFNGLFOGCOORDPOINTEREXTPROC __glewFogCoordPointerEXT; +GLEW_FUN_EXPORT PFNGLFOGCOORDDEXTPROC __glewFogCoorddEXT; +GLEW_FUN_EXPORT PFNGLFOGCOORDDVEXTPROC __glewFogCoorddvEXT; +GLEW_FUN_EXPORT PFNGLFOGCOORDFEXTPROC __glewFogCoordfEXT; +GLEW_FUN_EXPORT PFNGLFOGCOORDFVEXTPROC __glewFogCoordfvEXT; + +GLEW_FUN_EXPORT PFNGLFRAGMENTCOLORMATERIALEXTPROC __glewFragmentColorMaterialEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFEXTPROC __glewFragmentLightModelfEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFVEXTPROC __glewFragmentLightModelfvEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIEXTPROC __glewFragmentLightModeliEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIVEXTPROC __glewFragmentLightModelivEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFEXTPROC __glewFragmentLightfEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFVEXTPROC __glewFragmentLightfvEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIEXTPROC __glewFragmentLightiEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIVEXTPROC __glewFragmentLightivEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFEXTPROC __glewFragmentMaterialfEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFVEXTPROC __glewFragmentMaterialfvEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIEXTPROC __glewFragmentMaterialiEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIVEXTPROC __glewFragmentMaterialivEXT; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTFVEXTPROC __glewGetFragmentLightfvEXT; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTIVEXTPROC __glewGetFragmentLightivEXT; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALFVEXTPROC __glewGetFragmentMaterialfvEXT; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALIVEXTPROC __glewGetFragmentMaterialivEXT; +GLEW_FUN_EXPORT PFNGLLIGHTENVIEXTPROC __glewLightEnviEXT; + +GLEW_FUN_EXPORT PFNGLBLITFRAMEBUFFEREXTPROC __glewBlitFramebufferEXT; + +GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewRenderbufferStorageMultisampleEXT; + +GLEW_FUN_EXPORT PFNGLBINDFRAMEBUFFEREXTPROC __glewBindFramebufferEXT; +GLEW_FUN_EXPORT PFNGLBINDRENDERBUFFEREXTPROC __glewBindRenderbufferEXT; +GLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC __glewCheckFramebufferStatusEXT; +GLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSEXTPROC __glewDeleteFramebuffersEXT; +GLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSEXTPROC __glewDeleteRenderbuffersEXT; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC __glewFramebufferRenderbufferEXT; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DEXTPROC __glewFramebufferTexture1DEXT; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DEXTPROC __glewFramebufferTexture2DEXT; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DEXTPROC __glewFramebufferTexture3DEXT; +GLEW_FUN_EXPORT PFNGLGENFRAMEBUFFERSEXTPROC __glewGenFramebuffersEXT; +GLEW_FUN_EXPORT PFNGLGENRENDERBUFFERSEXTPROC __glewGenRenderbuffersEXT; +GLEW_FUN_EXPORT PFNGLGENERATEMIPMAPEXTPROC __glewGenerateMipmapEXT; +GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetFramebufferAttachmentParameterivEXT; +GLEW_FUN_EXPORT PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC __glewGetRenderbufferParameterivEXT; +GLEW_FUN_EXPORT PFNGLISFRAMEBUFFEREXTPROC __glewIsFramebufferEXT; +GLEW_FUN_EXPORT PFNGLISRENDERBUFFEREXTPROC __glewIsRenderbufferEXT; +GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEEXTPROC __glewRenderbufferStorageEXT; + +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREEXTPROC __glewFramebufferTextureEXT; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC __glewFramebufferTextureFaceEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIEXTPROC __glewProgramParameteriEXT; + +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERS4FVEXTPROC __glewProgramEnvParameters4fvEXT; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC __glewProgramLocalParameters4fvEXT; + +GLEW_FUN_EXPORT PFNGLBINDFRAGDATALOCATIONEXTPROC __glewBindFragDataLocationEXT; +GLEW_FUN_EXPORT PFNGLGETFRAGDATALOCATIONEXTPROC __glewGetFragDataLocationEXT; +GLEW_FUN_EXPORT PFNGLGETUNIFORMUIVEXTPROC __glewGetUniformuivEXT; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIIVEXTPROC __glewGetVertexAttribIivEXT; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIUIVEXTPROC __glewGetVertexAttribIuivEXT; +GLEW_FUN_EXPORT PFNGLUNIFORM1UIEXTPROC __glewUniform1uiEXT; +GLEW_FUN_EXPORT PFNGLUNIFORM1UIVEXTPROC __glewUniform1uivEXT; +GLEW_FUN_EXPORT PFNGLUNIFORM2UIEXTPROC __glewUniform2uiEXT; +GLEW_FUN_EXPORT PFNGLUNIFORM2UIVEXTPROC __glewUniform2uivEXT; +GLEW_FUN_EXPORT PFNGLUNIFORM3UIEXTPROC __glewUniform3uiEXT; +GLEW_FUN_EXPORT PFNGLUNIFORM3UIVEXTPROC __glewUniform3uivEXT; +GLEW_FUN_EXPORT PFNGLUNIFORM4UIEXTPROC __glewUniform4uiEXT; +GLEW_FUN_EXPORT PFNGLUNIFORM4UIVEXTPROC __glewUniform4uivEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IEXTPROC __glewVertexAttribI1iEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1IVEXTPROC __glewVertexAttribI1ivEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIEXTPROC __glewVertexAttribI1uiEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI1UIVEXTPROC __glewVertexAttribI1uivEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IEXTPROC __glewVertexAttribI2iEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2IVEXTPROC __glewVertexAttribI2ivEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIEXTPROC __glewVertexAttribI2uiEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI2UIVEXTPROC __glewVertexAttribI2uivEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IEXTPROC __glewVertexAttribI3iEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3IVEXTPROC __glewVertexAttribI3ivEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIEXTPROC __glewVertexAttribI3uiEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI3UIVEXTPROC __glewVertexAttribI3uivEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4BVEXTPROC __glewVertexAttribI4bvEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IEXTPROC __glewVertexAttribI4iEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4IVEXTPROC __glewVertexAttribI4ivEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4SVEXTPROC __glewVertexAttribI4svEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UBVEXTPROC __glewVertexAttribI4ubvEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIEXTPROC __glewVertexAttribI4uiEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4UIVEXTPROC __glewVertexAttribI4uivEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBI4USVEXTPROC __glewVertexAttribI4usvEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBIPOINTEREXTPROC __glewVertexAttribIPointerEXT; + +GLEW_FUN_EXPORT PFNGLGETHISTOGRAMEXTPROC __glewGetHistogramEXT; +GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERFVEXTPROC __glewGetHistogramParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERIVEXTPROC __glewGetHistogramParameterivEXT; +GLEW_FUN_EXPORT PFNGLGETMINMAXEXTPROC __glewGetMinmaxEXT; +GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERFVEXTPROC __glewGetMinmaxParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERIVEXTPROC __glewGetMinmaxParameterivEXT; +GLEW_FUN_EXPORT PFNGLHISTOGRAMEXTPROC __glewHistogramEXT; +GLEW_FUN_EXPORT PFNGLMINMAXEXTPROC __glewMinmaxEXT; +GLEW_FUN_EXPORT PFNGLRESETHISTOGRAMEXTPROC __glewResetHistogramEXT; +GLEW_FUN_EXPORT PFNGLRESETMINMAXEXTPROC __glewResetMinmaxEXT; + +GLEW_FUN_EXPORT PFNGLINDEXFUNCEXTPROC __glewIndexFuncEXT; + +GLEW_FUN_EXPORT PFNGLINDEXMATERIALEXTPROC __glewIndexMaterialEXT; + +GLEW_FUN_EXPORT PFNGLAPPLYTEXTUREEXTPROC __glewApplyTextureEXT; +GLEW_FUN_EXPORT PFNGLTEXTURELIGHTEXTPROC __glewTextureLightEXT; +GLEW_FUN_EXPORT PFNGLTEXTUREMATERIALEXTPROC __glewTextureMaterialEXT; + +GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSEXTPROC __glewMultiDrawArraysEXT; +GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSEXTPROC __glewMultiDrawElementsEXT; + +GLEW_FUN_EXPORT PFNGLSAMPLEMASKEXTPROC __glewSampleMaskEXT; +GLEW_FUN_EXPORT PFNGLSAMPLEPATTERNEXTPROC __glewSamplePatternEXT; + +GLEW_FUN_EXPORT PFNGLCOLORTABLEEXTPROC __glewColorTableEXT; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEEXTPROC __glewGetColorTableEXT; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVEXTPROC __glewGetColorTableParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVEXTPROC __glewGetColorTableParameterivEXT; + +GLEW_FUN_EXPORT PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC __glewGetPixelTransformParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC __glewGetPixelTransformParameterivEXT; +GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERFEXTPROC __glewPixelTransformParameterfEXT; +GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC __glewPixelTransformParameterfvEXT; +GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERIEXTPROC __glewPixelTransformParameteriEXT; +GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC __glewPixelTransformParameterivEXT; + +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFEXTPROC __glewPointParameterfEXT; +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVEXTPROC __glewPointParameterfvEXT; + +GLEW_FUN_EXPORT PFNGLPOLYGONOFFSETEXTPROC __glewPolygonOffsetEXT; + +GLEW_FUN_EXPORT PFNGLPOLYGONOFFSETCLAMPEXTPROC __glewPolygonOffsetClampEXT; + +GLEW_FUN_EXPORT PFNGLPROVOKINGVERTEXEXTPROC __glewProvokingVertexEXT; + +GLEW_FUN_EXPORT PFNGLCOVERAGEMODULATIONNVPROC __glewCoverageModulationNV; +GLEW_FUN_EXPORT PFNGLCOVERAGEMODULATIONTABLENVPROC __glewCoverageModulationTableNV; +GLEW_FUN_EXPORT PFNGLGETCOVERAGEMODULATIONTABLENVPROC __glewGetCoverageModulationTableNV; +GLEW_FUN_EXPORT PFNGLRASTERSAMPLESEXTPROC __glewRasterSamplesEXT; + +GLEW_FUN_EXPORT PFNGLBEGINSCENEEXTPROC __glewBeginSceneEXT; +GLEW_FUN_EXPORT PFNGLENDSCENEEXTPROC __glewEndSceneEXT; + +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BEXTPROC __glewSecondaryColor3bEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BVEXTPROC __glewSecondaryColor3bvEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DEXTPROC __glewSecondaryColor3dEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DVEXTPROC __glewSecondaryColor3dvEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FEXTPROC __glewSecondaryColor3fEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FVEXTPROC __glewSecondaryColor3fvEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IEXTPROC __glewSecondaryColor3iEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IVEXTPROC __glewSecondaryColor3ivEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SEXTPROC __glewSecondaryColor3sEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SVEXTPROC __glewSecondaryColor3svEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBEXTPROC __glewSecondaryColor3ubEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBVEXTPROC __glewSecondaryColor3ubvEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIEXTPROC __glewSecondaryColor3uiEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIVEXTPROC __glewSecondaryColor3uivEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USEXTPROC __glewSecondaryColor3usEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USVEXTPROC __glewSecondaryColor3usvEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTEREXTPROC __glewSecondaryColorPointerEXT; + +GLEW_FUN_EXPORT PFNGLACTIVEPROGRAMEXTPROC __glewActiveProgramEXT; +GLEW_FUN_EXPORT PFNGLCREATESHADERPROGRAMEXTPROC __glewCreateShaderProgramEXT; +GLEW_FUN_EXPORT PFNGLUSESHADERPROGRAMEXTPROC __glewUseShaderProgramEXT; + +GLEW_FUN_EXPORT PFNGLBINDIMAGETEXTUREEXTPROC __glewBindImageTextureEXT; +GLEW_FUN_EXPORT PFNGLMEMORYBARRIEREXTPROC __glewMemoryBarrierEXT; + +GLEW_FUN_EXPORT PFNGLACTIVESTENCILFACEEXTPROC __glewActiveStencilFaceEXT; + +GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE1DEXTPROC __glewTexSubImage1DEXT; +GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE2DEXTPROC __glewTexSubImage2DEXT; +GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DEXTPROC __glewTexSubImage3DEXT; + +GLEW_FUN_EXPORT PFNGLTEXIMAGE3DEXTPROC __glewTexImage3DEXT; + +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC __glewFramebufferTextureLayerEXT; + +GLEW_FUN_EXPORT PFNGLTEXBUFFEREXTPROC __glewTexBufferEXT; + +GLEW_FUN_EXPORT PFNGLCLEARCOLORIIEXTPROC __glewClearColorIiEXT; +GLEW_FUN_EXPORT PFNGLCLEARCOLORIUIEXTPROC __glewClearColorIuiEXT; +GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIIVEXTPROC __glewGetTexParameterIivEXT; +GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIUIVEXTPROC __glewGetTexParameterIuivEXT; +GLEW_FUN_EXPORT PFNGLTEXPARAMETERIIVEXTPROC __glewTexParameterIivEXT; +GLEW_FUN_EXPORT PFNGLTEXPARAMETERIUIVEXTPROC __glewTexParameterIuivEXT; + +GLEW_FUN_EXPORT PFNGLARETEXTURESRESIDENTEXTPROC __glewAreTexturesResidentEXT; +GLEW_FUN_EXPORT PFNGLBINDTEXTUREEXTPROC __glewBindTextureEXT; +GLEW_FUN_EXPORT PFNGLDELETETEXTURESEXTPROC __glewDeleteTexturesEXT; +GLEW_FUN_EXPORT PFNGLGENTEXTURESEXTPROC __glewGenTexturesEXT; +GLEW_FUN_EXPORT PFNGLISTEXTUREEXTPROC __glewIsTextureEXT; +GLEW_FUN_EXPORT PFNGLPRIORITIZETEXTURESEXTPROC __glewPrioritizeTexturesEXT; + +GLEW_FUN_EXPORT PFNGLTEXTURENORMALEXTPROC __glewTextureNormalEXT; + +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTI64VEXTPROC __glewGetQueryObjecti64vEXT; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUI64VEXTPROC __glewGetQueryObjectui64vEXT; + +GLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKEXTPROC __glewBeginTransformFeedbackEXT; +GLEW_FUN_EXPORT PFNGLBINDBUFFERBASEEXTPROC __glewBindBufferBaseEXT; +GLEW_FUN_EXPORT PFNGLBINDBUFFEROFFSETEXTPROC __glewBindBufferOffsetEXT; +GLEW_FUN_EXPORT PFNGLBINDBUFFERRANGEEXTPROC __glewBindBufferRangeEXT; +GLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKEXTPROC __glewEndTransformFeedbackEXT; +GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC __glewGetTransformFeedbackVaryingEXT; +GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC __glewTransformFeedbackVaryingsEXT; + +GLEW_FUN_EXPORT PFNGLARRAYELEMENTEXTPROC __glewArrayElementEXT; +GLEW_FUN_EXPORT PFNGLCOLORPOINTEREXTPROC __glewColorPointerEXT; +GLEW_FUN_EXPORT PFNGLDRAWARRAYSEXTPROC __glewDrawArraysEXT; +GLEW_FUN_EXPORT PFNGLEDGEFLAGPOINTEREXTPROC __glewEdgeFlagPointerEXT; +GLEW_FUN_EXPORT PFNGLINDEXPOINTEREXTPROC __glewIndexPointerEXT; +GLEW_FUN_EXPORT PFNGLNORMALPOINTEREXTPROC __glewNormalPointerEXT; +GLEW_FUN_EXPORT PFNGLTEXCOORDPOINTEREXTPROC __glewTexCoordPointerEXT; +GLEW_FUN_EXPORT PFNGLVERTEXPOINTEREXTPROC __glewVertexPointerEXT; + +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLDVEXTPROC __glewGetVertexAttribLdvEXT; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC __glewVertexArrayVertexAttribLOffsetEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DEXTPROC __glewVertexAttribL1dEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1DVEXTPROC __glewVertexAttribL1dvEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DEXTPROC __glewVertexAttribL2dEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2DVEXTPROC __glewVertexAttribL2dvEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DEXTPROC __glewVertexAttribL3dEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3DVEXTPROC __glewVertexAttribL3dvEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DEXTPROC __glewVertexAttribL4dEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4DVEXTPROC __glewVertexAttribL4dvEXT; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBLPOINTEREXTPROC __glewVertexAttribLPointerEXT; + +GLEW_FUN_EXPORT PFNGLBEGINVERTEXSHADEREXTPROC __glewBeginVertexShaderEXT; +GLEW_FUN_EXPORT PFNGLBINDLIGHTPARAMETEREXTPROC __glewBindLightParameterEXT; +GLEW_FUN_EXPORT PFNGLBINDMATERIALPARAMETEREXTPROC __glewBindMaterialParameterEXT; +GLEW_FUN_EXPORT PFNGLBINDPARAMETEREXTPROC __glewBindParameterEXT; +GLEW_FUN_EXPORT PFNGLBINDTEXGENPARAMETEREXTPROC __glewBindTexGenParameterEXT; +GLEW_FUN_EXPORT PFNGLBINDTEXTUREUNITPARAMETEREXTPROC __glewBindTextureUnitParameterEXT; +GLEW_FUN_EXPORT PFNGLBINDVERTEXSHADEREXTPROC __glewBindVertexShaderEXT; +GLEW_FUN_EXPORT PFNGLDELETEVERTEXSHADEREXTPROC __glewDeleteVertexShaderEXT; +GLEW_FUN_EXPORT PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC __glewDisableVariantClientStateEXT; +GLEW_FUN_EXPORT PFNGLENABLEVARIANTCLIENTSTATEEXTPROC __glewEnableVariantClientStateEXT; +GLEW_FUN_EXPORT PFNGLENDVERTEXSHADEREXTPROC __glewEndVertexShaderEXT; +GLEW_FUN_EXPORT PFNGLEXTRACTCOMPONENTEXTPROC __glewExtractComponentEXT; +GLEW_FUN_EXPORT PFNGLGENSYMBOLSEXTPROC __glewGenSymbolsEXT; +GLEW_FUN_EXPORT PFNGLGENVERTEXSHADERSEXTPROC __glewGenVertexShadersEXT; +GLEW_FUN_EXPORT PFNGLGETINVARIANTBOOLEANVEXTPROC __glewGetInvariantBooleanvEXT; +GLEW_FUN_EXPORT PFNGLGETINVARIANTFLOATVEXTPROC __glewGetInvariantFloatvEXT; +GLEW_FUN_EXPORT PFNGLGETINVARIANTINTEGERVEXTPROC __glewGetInvariantIntegervEXT; +GLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC __glewGetLocalConstantBooleanvEXT; +GLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTFLOATVEXTPROC __glewGetLocalConstantFloatvEXT; +GLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTINTEGERVEXTPROC __glewGetLocalConstantIntegervEXT; +GLEW_FUN_EXPORT PFNGLGETVARIANTBOOLEANVEXTPROC __glewGetVariantBooleanvEXT; +GLEW_FUN_EXPORT PFNGLGETVARIANTFLOATVEXTPROC __glewGetVariantFloatvEXT; +GLEW_FUN_EXPORT PFNGLGETVARIANTINTEGERVEXTPROC __glewGetVariantIntegervEXT; +GLEW_FUN_EXPORT PFNGLGETVARIANTPOINTERVEXTPROC __glewGetVariantPointervEXT; +GLEW_FUN_EXPORT PFNGLINSERTCOMPONENTEXTPROC __glewInsertComponentEXT; +GLEW_FUN_EXPORT PFNGLISVARIANTENABLEDEXTPROC __glewIsVariantEnabledEXT; +GLEW_FUN_EXPORT PFNGLSETINVARIANTEXTPROC __glewSetInvariantEXT; +GLEW_FUN_EXPORT PFNGLSETLOCALCONSTANTEXTPROC __glewSetLocalConstantEXT; +GLEW_FUN_EXPORT PFNGLSHADEROP1EXTPROC __glewShaderOp1EXT; +GLEW_FUN_EXPORT PFNGLSHADEROP2EXTPROC __glewShaderOp2EXT; +GLEW_FUN_EXPORT PFNGLSHADEROP3EXTPROC __glewShaderOp3EXT; +GLEW_FUN_EXPORT PFNGLSWIZZLEEXTPROC __glewSwizzleEXT; +GLEW_FUN_EXPORT PFNGLVARIANTPOINTEREXTPROC __glewVariantPointerEXT; +GLEW_FUN_EXPORT PFNGLVARIANTBVEXTPROC __glewVariantbvEXT; +GLEW_FUN_EXPORT PFNGLVARIANTDVEXTPROC __glewVariantdvEXT; +GLEW_FUN_EXPORT PFNGLVARIANTFVEXTPROC __glewVariantfvEXT; +GLEW_FUN_EXPORT PFNGLVARIANTIVEXTPROC __glewVariantivEXT; +GLEW_FUN_EXPORT PFNGLVARIANTSVEXTPROC __glewVariantsvEXT; +GLEW_FUN_EXPORT PFNGLVARIANTUBVEXTPROC __glewVariantubvEXT; +GLEW_FUN_EXPORT PFNGLVARIANTUIVEXTPROC __glewVariantuivEXT; +GLEW_FUN_EXPORT PFNGLVARIANTUSVEXTPROC __glewVariantusvEXT; +GLEW_FUN_EXPORT PFNGLWRITEMASKEXTPROC __glewWriteMaskEXT; + +GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTPOINTEREXTPROC __glewVertexWeightPointerEXT; +GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFEXTPROC __glewVertexWeightfEXT; +GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFVEXTPROC __glewVertexWeightfvEXT; + +GLEW_FUN_EXPORT PFNGLIMPORTSYNCEXTPROC __glewImportSyncEXT; + +GLEW_FUN_EXPORT PFNGLFRAMETERMINATORGREMEDYPROC __glewFrameTerminatorGREMEDY; + +GLEW_FUN_EXPORT PFNGLSTRINGMARKERGREMEDYPROC __glewStringMarkerGREMEDY; + +GLEW_FUN_EXPORT PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC __glewGetImageTransformParameterfvHP; +GLEW_FUN_EXPORT PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC __glewGetImageTransformParameterivHP; +GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERFHPPROC __glewImageTransformParameterfHP; +GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERFVHPPROC __glewImageTransformParameterfvHP; +GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERIHPPROC __glewImageTransformParameteriHP; +GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERIVHPPROC __glewImageTransformParameterivHP; + +GLEW_FUN_EXPORT PFNGLMULTIMODEDRAWARRAYSIBMPROC __glewMultiModeDrawArraysIBM; +GLEW_FUN_EXPORT PFNGLMULTIMODEDRAWELEMENTSIBMPROC __glewMultiModeDrawElementsIBM; + +GLEW_FUN_EXPORT PFNGLCOLORPOINTERLISTIBMPROC __glewColorPointerListIBM; +GLEW_FUN_EXPORT PFNGLEDGEFLAGPOINTERLISTIBMPROC __glewEdgeFlagPointerListIBM; +GLEW_FUN_EXPORT PFNGLFOGCOORDPOINTERLISTIBMPROC __glewFogCoordPointerListIBM; +GLEW_FUN_EXPORT PFNGLINDEXPOINTERLISTIBMPROC __glewIndexPointerListIBM; +GLEW_FUN_EXPORT PFNGLNORMALPOINTERLISTIBMPROC __glewNormalPointerListIBM; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTERLISTIBMPROC __glewSecondaryColorPointerListIBM; +GLEW_FUN_EXPORT PFNGLTEXCOORDPOINTERLISTIBMPROC __glewTexCoordPointerListIBM; +GLEW_FUN_EXPORT PFNGLVERTEXPOINTERLISTIBMPROC __glewVertexPointerListIBM; + +GLEW_FUN_EXPORT PFNGLMAPTEXTURE2DINTELPROC __glewMapTexture2DINTEL; +GLEW_FUN_EXPORT PFNGLSYNCTEXTUREINTELPROC __glewSyncTextureINTEL; +GLEW_FUN_EXPORT PFNGLUNMAPTEXTURE2DINTELPROC __glewUnmapTexture2DINTEL; + +GLEW_FUN_EXPORT PFNGLCOLORPOINTERVINTELPROC __glewColorPointervINTEL; +GLEW_FUN_EXPORT PFNGLNORMALPOINTERVINTELPROC __glewNormalPointervINTEL; +GLEW_FUN_EXPORT PFNGLTEXCOORDPOINTERVINTELPROC __glewTexCoordPointervINTEL; +GLEW_FUN_EXPORT PFNGLVERTEXPOINTERVINTELPROC __glewVertexPointervINTEL; + +GLEW_FUN_EXPORT PFNGLBEGINPERFQUERYINTELPROC __glewBeginPerfQueryINTEL; +GLEW_FUN_EXPORT PFNGLCREATEPERFQUERYINTELPROC __glewCreatePerfQueryINTEL; +GLEW_FUN_EXPORT PFNGLDELETEPERFQUERYINTELPROC __glewDeletePerfQueryINTEL; +GLEW_FUN_EXPORT PFNGLENDPERFQUERYINTELPROC __glewEndPerfQueryINTEL; +GLEW_FUN_EXPORT PFNGLGETFIRSTPERFQUERYIDINTELPROC __glewGetFirstPerfQueryIdINTEL; +GLEW_FUN_EXPORT PFNGLGETNEXTPERFQUERYIDINTELPROC __glewGetNextPerfQueryIdINTEL; +GLEW_FUN_EXPORT PFNGLGETPERFCOUNTERINFOINTELPROC __glewGetPerfCounterInfoINTEL; +GLEW_FUN_EXPORT PFNGLGETPERFQUERYDATAINTELPROC __glewGetPerfQueryDataINTEL; +GLEW_FUN_EXPORT PFNGLGETPERFQUERYIDBYNAMEINTELPROC __glewGetPerfQueryIdByNameINTEL; +GLEW_FUN_EXPORT PFNGLGETPERFQUERYINFOINTELPROC __glewGetPerfQueryInfoINTEL; + +GLEW_FUN_EXPORT PFNGLTEXSCISSORFUNCINTELPROC __glewTexScissorFuncINTEL; +GLEW_FUN_EXPORT PFNGLTEXSCISSORINTELPROC __glewTexScissorINTEL; + +GLEW_FUN_EXPORT PFNGLBLENDBARRIERKHRPROC __glewBlendBarrierKHR; + +GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECALLBACKPROC __glewDebugMessageCallback; +GLEW_FUN_EXPORT PFNGLDEBUGMESSAGECONTROLPROC __glewDebugMessageControl; +GLEW_FUN_EXPORT PFNGLDEBUGMESSAGEINSERTPROC __glewDebugMessageInsert; +GLEW_FUN_EXPORT PFNGLGETDEBUGMESSAGELOGPROC __glewGetDebugMessageLog; +GLEW_FUN_EXPORT PFNGLGETOBJECTLABELPROC __glewGetObjectLabel; +GLEW_FUN_EXPORT PFNGLGETOBJECTPTRLABELPROC __glewGetObjectPtrLabel; +GLEW_FUN_EXPORT PFNGLOBJECTLABELPROC __glewObjectLabel; +GLEW_FUN_EXPORT PFNGLOBJECTPTRLABELPROC __glewObjectPtrLabel; +GLEW_FUN_EXPORT PFNGLPOPDEBUGGROUPPROC __glewPopDebugGroup; +GLEW_FUN_EXPORT PFNGLPUSHDEBUGGROUPPROC __glewPushDebugGroup; + +GLEW_FUN_EXPORT PFNGLGETNUNIFORMFVPROC __glewGetnUniformfv; +GLEW_FUN_EXPORT PFNGLGETNUNIFORMIVPROC __glewGetnUniformiv; +GLEW_FUN_EXPORT PFNGLGETNUNIFORMUIVPROC __glewGetnUniformuiv; +GLEW_FUN_EXPORT PFNGLREADNPIXELSPROC __glewReadnPixels; + +GLEW_FUN_EXPORT PFNGLBUFFERREGIONENABLEDPROC __glewBufferRegionEnabled; +GLEW_FUN_EXPORT PFNGLDELETEBUFFERREGIONPROC __glewDeleteBufferRegion; +GLEW_FUN_EXPORT PFNGLDRAWBUFFERREGIONPROC __glewDrawBufferRegion; +GLEW_FUN_EXPORT PFNGLNEWBUFFERREGIONPROC __glewNewBufferRegion; +GLEW_FUN_EXPORT PFNGLREADBUFFERREGIONPROC __glewReadBufferRegion; + +GLEW_FUN_EXPORT PFNGLRESIZEBUFFERSMESAPROC __glewResizeBuffersMESA; + +GLEW_FUN_EXPORT PFNGLWINDOWPOS2DMESAPROC __glewWindowPos2dMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2DVMESAPROC __glewWindowPos2dvMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2FMESAPROC __glewWindowPos2fMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2FVMESAPROC __glewWindowPos2fvMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2IMESAPROC __glewWindowPos2iMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2IVMESAPROC __glewWindowPos2ivMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2SMESAPROC __glewWindowPos2sMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2SVMESAPROC __glewWindowPos2svMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3DMESAPROC __glewWindowPos3dMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3DVMESAPROC __glewWindowPos3dvMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3FMESAPROC __glewWindowPos3fMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3FVMESAPROC __glewWindowPos3fvMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3IMESAPROC __glewWindowPos3iMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3IVMESAPROC __glewWindowPos3ivMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3SMESAPROC __glewWindowPos3sMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3SVMESAPROC __glewWindowPos3svMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4DMESAPROC __glewWindowPos4dMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4DVMESAPROC __glewWindowPos4dvMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4FMESAPROC __glewWindowPos4fMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4FVMESAPROC __glewWindowPos4fvMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4IMESAPROC __glewWindowPos4iMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4IVMESAPROC __glewWindowPos4ivMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4SMESAPROC __glewWindowPos4sMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4SVMESAPROC __glewWindowPos4svMESA; + +GLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERNVXPROC __glewBeginConditionalRenderNVX; +GLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERNVXPROC __glewEndConditionalRenderNVX; + +GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC __glewMultiDrawArraysIndirectBindlessNV; +GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC __glewMultiDrawElementsIndirectBindlessNV; + +GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC __glewMultiDrawArraysIndirectBindlessCountNV; +GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC __glewMultiDrawElementsIndirectBindlessCountNV; + +GLEW_FUN_EXPORT PFNGLGETIMAGEHANDLENVPROC __glewGetImageHandleNV; +GLEW_FUN_EXPORT PFNGLGETTEXTUREHANDLENVPROC __glewGetTextureHandleNV; +GLEW_FUN_EXPORT PFNGLGETTEXTURESAMPLERHANDLENVPROC __glewGetTextureSamplerHandleNV; +GLEW_FUN_EXPORT PFNGLISIMAGEHANDLERESIDENTNVPROC __glewIsImageHandleResidentNV; +GLEW_FUN_EXPORT PFNGLISTEXTUREHANDLERESIDENTNVPROC __glewIsTextureHandleResidentNV; +GLEW_FUN_EXPORT PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC __glewMakeImageHandleNonResidentNV; +GLEW_FUN_EXPORT PFNGLMAKEIMAGEHANDLERESIDENTNVPROC __glewMakeImageHandleResidentNV; +GLEW_FUN_EXPORT PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC __glewMakeTextureHandleNonResidentNV; +GLEW_FUN_EXPORT PFNGLMAKETEXTUREHANDLERESIDENTNVPROC __glewMakeTextureHandleResidentNV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC __glewProgramUniformHandleui64NV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC __glewProgramUniformHandleui64vNV; +GLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64NVPROC __glewUniformHandleui64NV; +GLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64VNVPROC __glewUniformHandleui64vNV; + +GLEW_FUN_EXPORT PFNGLBLENDBARRIERNVPROC __glewBlendBarrierNV; +GLEW_FUN_EXPORT PFNGLBLENDPARAMETERINVPROC __glewBlendParameteriNV; + +GLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERNVPROC __glewBeginConditionalRenderNV; +GLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERNVPROC __glewEndConditionalRenderNV; + +GLEW_FUN_EXPORT PFNGLSUBPIXELPRECISIONBIASNVPROC __glewSubpixelPrecisionBiasNV; + +GLEW_FUN_EXPORT PFNGLCONSERVATIVERASTERPARAMETERFNVPROC __glewConservativeRasterParameterfNV; + +GLEW_FUN_EXPORT PFNGLCOPYIMAGESUBDATANVPROC __glewCopyImageSubDataNV; + +GLEW_FUN_EXPORT PFNGLCLEARDEPTHDNVPROC __glewClearDepthdNV; +GLEW_FUN_EXPORT PFNGLDEPTHBOUNDSDNVPROC __glewDepthBoundsdNV; +GLEW_FUN_EXPORT PFNGLDEPTHRANGEDNVPROC __glewDepthRangedNV; + +GLEW_FUN_EXPORT PFNGLDRAWTEXTURENVPROC __glewDrawTextureNV; + +GLEW_FUN_EXPORT PFNGLEVALMAPSNVPROC __glewEvalMapsNV; +GLEW_FUN_EXPORT PFNGLGETMAPATTRIBPARAMETERFVNVPROC __glewGetMapAttribParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETMAPATTRIBPARAMETERIVNVPROC __glewGetMapAttribParameterivNV; +GLEW_FUN_EXPORT PFNGLGETMAPCONTROLPOINTSNVPROC __glewGetMapControlPointsNV; +GLEW_FUN_EXPORT PFNGLGETMAPPARAMETERFVNVPROC __glewGetMapParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETMAPPARAMETERIVNVPROC __glewGetMapParameterivNV; +GLEW_FUN_EXPORT PFNGLMAPCONTROLPOINTSNVPROC __glewMapControlPointsNV; +GLEW_FUN_EXPORT PFNGLMAPPARAMETERFVNVPROC __glewMapParameterfvNV; +GLEW_FUN_EXPORT PFNGLMAPPARAMETERIVNVPROC __glewMapParameterivNV; + +GLEW_FUN_EXPORT PFNGLGETMULTISAMPLEFVNVPROC __glewGetMultisamplefvNV; +GLEW_FUN_EXPORT PFNGLSAMPLEMASKINDEXEDNVPROC __glewSampleMaskIndexedNV; +GLEW_FUN_EXPORT PFNGLTEXRENDERBUFFERNVPROC __glewTexRenderbufferNV; + +GLEW_FUN_EXPORT PFNGLDELETEFENCESNVPROC __glewDeleteFencesNV; +GLEW_FUN_EXPORT PFNGLFINISHFENCENVPROC __glewFinishFenceNV; +GLEW_FUN_EXPORT PFNGLGENFENCESNVPROC __glewGenFencesNV; +GLEW_FUN_EXPORT PFNGLGETFENCEIVNVPROC __glewGetFenceivNV; +GLEW_FUN_EXPORT PFNGLISFENCENVPROC __glewIsFenceNV; +GLEW_FUN_EXPORT PFNGLSETFENCENVPROC __glewSetFenceNV; +GLEW_FUN_EXPORT PFNGLTESTFENCENVPROC __glewTestFenceNV; + +GLEW_FUN_EXPORT PFNGLFRAGMENTCOVERAGECOLORNVPROC __glewFragmentCoverageColorNV; + +GLEW_FUN_EXPORT PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC __glewGetProgramNamedParameterdvNV; +GLEW_FUN_EXPORT PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC __glewGetProgramNamedParameterfvNV; +GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4DNVPROC __glewProgramNamedParameter4dNV; +GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC __glewProgramNamedParameter4dvNV; +GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4FNVPROC __glewProgramNamedParameter4fNV; +GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC __glewProgramNamedParameter4fvNV; + +GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC __glewRenderbufferStorageMultisampleCoverageNV; + +GLEW_FUN_EXPORT PFNGLPROGRAMVERTEXLIMITNVPROC __glewProgramVertexLimitNV; + +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4INVPROC __glewProgramEnvParameterI4iNV; +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4IVNVPROC __glewProgramEnvParameterI4ivNV; +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4UINVPROC __glewProgramEnvParameterI4uiNV; +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4UIVNVPROC __glewProgramEnvParameterI4uivNV; +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERSI4IVNVPROC __glewProgramEnvParametersI4ivNV; +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC __glewProgramEnvParametersI4uivNV; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4INVPROC __glewProgramLocalParameterI4iNV; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC __glewProgramLocalParameterI4ivNV; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4UINVPROC __glewProgramLocalParameterI4uiNV; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC __glewProgramLocalParameterI4uivNV; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC __glewProgramLocalParametersI4ivNV; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC __glewProgramLocalParametersI4uivNV; + +GLEW_FUN_EXPORT PFNGLGETUNIFORMI64VNVPROC __glewGetUniformi64vNV; +GLEW_FUN_EXPORT PFNGLGETUNIFORMUI64VNVPROC __glewGetUniformui64vNV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1I64NVPROC __glewProgramUniform1i64NV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1I64VNVPROC __glewProgramUniform1i64vNV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UI64NVPROC __glewProgramUniform1ui64NV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM1UI64VNVPROC __glewProgramUniform1ui64vNV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2I64NVPROC __glewProgramUniform2i64NV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2I64VNVPROC __glewProgramUniform2i64vNV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UI64NVPROC __glewProgramUniform2ui64NV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM2UI64VNVPROC __glewProgramUniform2ui64vNV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3I64NVPROC __glewProgramUniform3i64NV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3I64VNVPROC __glewProgramUniform3i64vNV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UI64NVPROC __glewProgramUniform3ui64NV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM3UI64VNVPROC __glewProgramUniform3ui64vNV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4I64NVPROC __glewProgramUniform4i64NV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4I64VNVPROC __glewProgramUniform4i64vNV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UI64NVPROC __glewProgramUniform4ui64NV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORM4UI64VNVPROC __glewProgramUniform4ui64vNV; +GLEW_FUN_EXPORT PFNGLUNIFORM1I64NVPROC __glewUniform1i64NV; +GLEW_FUN_EXPORT PFNGLUNIFORM1I64VNVPROC __glewUniform1i64vNV; +GLEW_FUN_EXPORT PFNGLUNIFORM1UI64NVPROC __glewUniform1ui64NV; +GLEW_FUN_EXPORT PFNGLUNIFORM1UI64VNVPROC __glewUniform1ui64vNV; +GLEW_FUN_EXPORT PFNGLUNIFORM2I64NVPROC __glewUniform2i64NV; +GLEW_FUN_EXPORT PFNGLUNIFORM2I64VNVPROC __glewUniform2i64vNV; +GLEW_FUN_EXPORT PFNGLUNIFORM2UI64NVPROC __glewUniform2ui64NV; +GLEW_FUN_EXPORT PFNGLUNIFORM2UI64VNVPROC __glewUniform2ui64vNV; +GLEW_FUN_EXPORT PFNGLUNIFORM3I64NVPROC __glewUniform3i64NV; +GLEW_FUN_EXPORT PFNGLUNIFORM3I64VNVPROC __glewUniform3i64vNV; +GLEW_FUN_EXPORT PFNGLUNIFORM3UI64NVPROC __glewUniform3ui64NV; +GLEW_FUN_EXPORT PFNGLUNIFORM3UI64VNVPROC __glewUniform3ui64vNV; +GLEW_FUN_EXPORT PFNGLUNIFORM4I64NVPROC __glewUniform4i64NV; +GLEW_FUN_EXPORT PFNGLUNIFORM4I64VNVPROC __glewUniform4i64vNV; +GLEW_FUN_EXPORT PFNGLUNIFORM4UI64NVPROC __glewUniform4ui64NV; +GLEW_FUN_EXPORT PFNGLUNIFORM4UI64VNVPROC __glewUniform4ui64vNV; + +GLEW_FUN_EXPORT PFNGLCOLOR3HNVPROC __glewColor3hNV; +GLEW_FUN_EXPORT PFNGLCOLOR3HVNVPROC __glewColor3hvNV; +GLEW_FUN_EXPORT PFNGLCOLOR4HNVPROC __glewColor4hNV; +GLEW_FUN_EXPORT PFNGLCOLOR4HVNVPROC __glewColor4hvNV; +GLEW_FUN_EXPORT PFNGLFOGCOORDHNVPROC __glewFogCoordhNV; +GLEW_FUN_EXPORT PFNGLFOGCOORDHVNVPROC __glewFogCoordhvNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1HNVPROC __glewMultiTexCoord1hNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1HVNVPROC __glewMultiTexCoord1hvNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2HNVPROC __glewMultiTexCoord2hNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2HVNVPROC __glewMultiTexCoord2hvNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3HNVPROC __glewMultiTexCoord3hNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3HVNVPROC __glewMultiTexCoord3hvNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4HNVPROC __glewMultiTexCoord4hNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4HVNVPROC __glewMultiTexCoord4hvNV; +GLEW_FUN_EXPORT PFNGLNORMAL3HNVPROC __glewNormal3hNV; +GLEW_FUN_EXPORT PFNGLNORMAL3HVNVPROC __glewNormal3hvNV; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3HNVPROC __glewSecondaryColor3hNV; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3HVNVPROC __glewSecondaryColor3hvNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD1HNVPROC __glewTexCoord1hNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD1HVNVPROC __glewTexCoord1hvNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD2HNVPROC __glewTexCoord2hNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD2HVNVPROC __glewTexCoord2hvNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD3HNVPROC __glewTexCoord3hNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD3HVNVPROC __glewTexCoord3hvNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD4HNVPROC __glewTexCoord4hNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD4HVNVPROC __glewTexCoord4hvNV; +GLEW_FUN_EXPORT PFNGLVERTEX2HNVPROC __glewVertex2hNV; +GLEW_FUN_EXPORT PFNGLVERTEX2HVNVPROC __glewVertex2hvNV; +GLEW_FUN_EXPORT PFNGLVERTEX3HNVPROC __glewVertex3hNV; +GLEW_FUN_EXPORT PFNGLVERTEX3HVNVPROC __glewVertex3hvNV; +GLEW_FUN_EXPORT PFNGLVERTEX4HNVPROC __glewVertex4hNV; +GLEW_FUN_EXPORT PFNGLVERTEX4HVNVPROC __glewVertex4hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1HNVPROC __glewVertexAttrib1hNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1HVNVPROC __glewVertexAttrib1hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2HNVPROC __glewVertexAttrib2hNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2HVNVPROC __glewVertexAttrib2hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3HNVPROC __glewVertexAttrib3hNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3HVNVPROC __glewVertexAttrib3hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4HNVPROC __glewVertexAttrib4hNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4HVNVPROC __glewVertexAttrib4hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1HVNVPROC __glewVertexAttribs1hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2HVNVPROC __glewVertexAttribs2hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3HVNVPROC __glewVertexAttribs3hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4HVNVPROC __glewVertexAttribs4hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTHNVPROC __glewVertexWeighthNV; +GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTHVNVPROC __glewVertexWeighthvNV; + +GLEW_FUN_EXPORT PFNGLGETINTERNALFORMATSAMPLEIVNVPROC __glewGetInternalformatSampleivNV; + +GLEW_FUN_EXPORT PFNGLBEGINOCCLUSIONQUERYNVPROC __glewBeginOcclusionQueryNV; +GLEW_FUN_EXPORT PFNGLDELETEOCCLUSIONQUERIESNVPROC __glewDeleteOcclusionQueriesNV; +GLEW_FUN_EXPORT PFNGLENDOCCLUSIONQUERYNVPROC __glewEndOcclusionQueryNV; +GLEW_FUN_EXPORT PFNGLGENOCCLUSIONQUERIESNVPROC __glewGenOcclusionQueriesNV; +GLEW_FUN_EXPORT PFNGLGETOCCLUSIONQUERYIVNVPROC __glewGetOcclusionQueryivNV; +GLEW_FUN_EXPORT PFNGLGETOCCLUSIONQUERYUIVNVPROC __glewGetOcclusionQueryuivNV; +GLEW_FUN_EXPORT PFNGLISOCCLUSIONQUERYNVPROC __glewIsOcclusionQueryNV; + +GLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC __glewProgramBufferParametersIivNV; +GLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC __glewProgramBufferParametersIuivNV; +GLEW_FUN_EXPORT PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC __glewProgramBufferParametersfvNV; + +GLEW_FUN_EXPORT PFNGLCOPYPATHNVPROC __glewCopyPathNV; +GLEW_FUN_EXPORT PFNGLCOVERFILLPATHINSTANCEDNVPROC __glewCoverFillPathInstancedNV; +GLEW_FUN_EXPORT PFNGLCOVERFILLPATHNVPROC __glewCoverFillPathNV; +GLEW_FUN_EXPORT PFNGLCOVERSTROKEPATHINSTANCEDNVPROC __glewCoverStrokePathInstancedNV; +GLEW_FUN_EXPORT PFNGLCOVERSTROKEPATHNVPROC __glewCoverStrokePathNV; +GLEW_FUN_EXPORT PFNGLDELETEPATHSNVPROC __glewDeletePathsNV; +GLEW_FUN_EXPORT PFNGLGENPATHSNVPROC __glewGenPathsNV; +GLEW_FUN_EXPORT PFNGLGETPATHCOLORGENFVNVPROC __glewGetPathColorGenfvNV; +GLEW_FUN_EXPORT PFNGLGETPATHCOLORGENIVNVPROC __glewGetPathColorGenivNV; +GLEW_FUN_EXPORT PFNGLGETPATHCOMMANDSNVPROC __glewGetPathCommandsNV; +GLEW_FUN_EXPORT PFNGLGETPATHCOORDSNVPROC __glewGetPathCoordsNV; +GLEW_FUN_EXPORT PFNGLGETPATHDASHARRAYNVPROC __glewGetPathDashArrayNV; +GLEW_FUN_EXPORT PFNGLGETPATHLENGTHNVPROC __glewGetPathLengthNV; +GLEW_FUN_EXPORT PFNGLGETPATHMETRICRANGENVPROC __glewGetPathMetricRangeNV; +GLEW_FUN_EXPORT PFNGLGETPATHMETRICSNVPROC __glewGetPathMetricsNV; +GLEW_FUN_EXPORT PFNGLGETPATHPARAMETERFVNVPROC __glewGetPathParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETPATHPARAMETERIVNVPROC __glewGetPathParameterivNV; +GLEW_FUN_EXPORT PFNGLGETPATHSPACINGNVPROC __glewGetPathSpacingNV; +GLEW_FUN_EXPORT PFNGLGETPATHTEXGENFVNVPROC __glewGetPathTexGenfvNV; +GLEW_FUN_EXPORT PFNGLGETPATHTEXGENIVNVPROC __glewGetPathTexGenivNV; +GLEW_FUN_EXPORT PFNGLGETPROGRAMRESOURCEFVNVPROC __glewGetProgramResourcefvNV; +GLEW_FUN_EXPORT PFNGLINTERPOLATEPATHSNVPROC __glewInterpolatePathsNV; +GLEW_FUN_EXPORT PFNGLISPATHNVPROC __glewIsPathNV; +GLEW_FUN_EXPORT PFNGLISPOINTINFILLPATHNVPROC __glewIsPointInFillPathNV; +GLEW_FUN_EXPORT PFNGLISPOINTINSTROKEPATHNVPROC __glewIsPointInStrokePathNV; +GLEW_FUN_EXPORT PFNGLMATRIXLOAD3X2FNVPROC __glewMatrixLoad3x2fNV; +GLEW_FUN_EXPORT PFNGLMATRIXLOAD3X3FNVPROC __glewMatrixLoad3x3fNV; +GLEW_FUN_EXPORT PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC __glewMatrixLoadTranspose3x3fNV; +GLEW_FUN_EXPORT PFNGLMATRIXMULT3X2FNVPROC __glewMatrixMult3x2fNV; +GLEW_FUN_EXPORT PFNGLMATRIXMULT3X3FNVPROC __glewMatrixMult3x3fNV; +GLEW_FUN_EXPORT PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC __glewMatrixMultTranspose3x3fNV; +GLEW_FUN_EXPORT PFNGLPATHCOLORGENNVPROC __glewPathColorGenNV; +GLEW_FUN_EXPORT PFNGLPATHCOMMANDSNVPROC __glewPathCommandsNV; +GLEW_FUN_EXPORT PFNGLPATHCOORDSNVPROC __glewPathCoordsNV; +GLEW_FUN_EXPORT PFNGLPATHCOVERDEPTHFUNCNVPROC __glewPathCoverDepthFuncNV; +GLEW_FUN_EXPORT PFNGLPATHDASHARRAYNVPROC __glewPathDashArrayNV; +GLEW_FUN_EXPORT PFNGLPATHFOGGENNVPROC __glewPathFogGenNV; +GLEW_FUN_EXPORT PFNGLPATHGLYPHINDEXARRAYNVPROC __glewPathGlyphIndexArrayNV; +GLEW_FUN_EXPORT PFNGLPATHGLYPHINDEXRANGENVPROC __glewPathGlyphIndexRangeNV; +GLEW_FUN_EXPORT PFNGLPATHGLYPHRANGENVPROC __glewPathGlyphRangeNV; +GLEW_FUN_EXPORT PFNGLPATHGLYPHSNVPROC __glewPathGlyphsNV; +GLEW_FUN_EXPORT PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC __glewPathMemoryGlyphIndexArrayNV; +GLEW_FUN_EXPORT PFNGLPATHPARAMETERFNVPROC __glewPathParameterfNV; +GLEW_FUN_EXPORT PFNGLPATHPARAMETERFVNVPROC __glewPathParameterfvNV; +GLEW_FUN_EXPORT PFNGLPATHPARAMETERINVPROC __glewPathParameteriNV; +GLEW_FUN_EXPORT PFNGLPATHPARAMETERIVNVPROC __glewPathParameterivNV; +GLEW_FUN_EXPORT PFNGLPATHSTENCILDEPTHOFFSETNVPROC __glewPathStencilDepthOffsetNV; +GLEW_FUN_EXPORT PFNGLPATHSTENCILFUNCNVPROC __glewPathStencilFuncNV; +GLEW_FUN_EXPORT PFNGLPATHSTRINGNVPROC __glewPathStringNV; +GLEW_FUN_EXPORT PFNGLPATHSUBCOMMANDSNVPROC __glewPathSubCommandsNV; +GLEW_FUN_EXPORT PFNGLPATHSUBCOORDSNVPROC __glewPathSubCoordsNV; +GLEW_FUN_EXPORT PFNGLPATHTEXGENNVPROC __glewPathTexGenNV; +GLEW_FUN_EXPORT PFNGLPOINTALONGPATHNVPROC __glewPointAlongPathNV; +GLEW_FUN_EXPORT PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC __glewProgramPathFragmentInputGenNV; +GLEW_FUN_EXPORT PFNGLSTENCILFILLPATHINSTANCEDNVPROC __glewStencilFillPathInstancedNV; +GLEW_FUN_EXPORT PFNGLSTENCILFILLPATHNVPROC __glewStencilFillPathNV; +GLEW_FUN_EXPORT PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC __glewStencilStrokePathInstancedNV; +GLEW_FUN_EXPORT PFNGLSTENCILSTROKEPATHNVPROC __glewStencilStrokePathNV; +GLEW_FUN_EXPORT PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC __glewStencilThenCoverFillPathInstancedNV; +GLEW_FUN_EXPORT PFNGLSTENCILTHENCOVERFILLPATHNVPROC __glewStencilThenCoverFillPathNV; +GLEW_FUN_EXPORT PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC __glewStencilThenCoverStrokePathInstancedNV; +GLEW_FUN_EXPORT PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC __glewStencilThenCoverStrokePathNV; +GLEW_FUN_EXPORT PFNGLTRANSFORMPATHNVPROC __glewTransformPathNV; +GLEW_FUN_EXPORT PFNGLWEIGHTPATHSNVPROC __glewWeightPathsNV; + +GLEW_FUN_EXPORT PFNGLFLUSHPIXELDATARANGENVPROC __glewFlushPixelDataRangeNV; +GLEW_FUN_EXPORT PFNGLPIXELDATARANGENVPROC __glewPixelDataRangeNV; + +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERINVPROC __glewPointParameteriNV; +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERIVNVPROC __glewPointParameterivNV; + +GLEW_FUN_EXPORT PFNGLGETVIDEOI64VNVPROC __glewGetVideoi64vNV; +GLEW_FUN_EXPORT PFNGLGETVIDEOIVNVPROC __glewGetVideoivNV; +GLEW_FUN_EXPORT PFNGLGETVIDEOUI64VNVPROC __glewGetVideoui64vNV; +GLEW_FUN_EXPORT PFNGLGETVIDEOUIVNVPROC __glewGetVideouivNV; +GLEW_FUN_EXPORT PFNGLPRESENTFRAMEDUALFILLNVPROC __glewPresentFrameDualFillNV; +GLEW_FUN_EXPORT PFNGLPRESENTFRAMEKEYEDNVPROC __glewPresentFrameKeyedNV; + +GLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTINDEXNVPROC __glewPrimitiveRestartIndexNV; +GLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTNVPROC __glewPrimitiveRestartNV; + +GLEW_FUN_EXPORT PFNGLCOMBINERINPUTNVPROC __glewCombinerInputNV; +GLEW_FUN_EXPORT PFNGLCOMBINEROUTPUTNVPROC __glewCombinerOutputNV; +GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERFNVPROC __glewCombinerParameterfNV; +GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERFVNVPROC __glewCombinerParameterfvNV; +GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERINVPROC __glewCombinerParameteriNV; +GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERIVNVPROC __glewCombinerParameterivNV; +GLEW_FUN_EXPORT PFNGLFINALCOMBINERINPUTNVPROC __glewFinalCombinerInputNV; +GLEW_FUN_EXPORT PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC __glewGetCombinerInputParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC __glewGetCombinerInputParameterivNV; +GLEW_FUN_EXPORT PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC __glewGetCombinerOutputParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC __glewGetCombinerOutputParameterivNV; +GLEW_FUN_EXPORT PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC __glewGetFinalCombinerInputParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC __glewGetFinalCombinerInputParameterivNV; + +GLEW_FUN_EXPORT PFNGLCOMBINERSTAGEPARAMETERFVNVPROC __glewCombinerStageParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC __glewGetCombinerStageParameterfvNV; + +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC __glewFramebufferSampleLocationsfvNV; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC __glewNamedFramebufferSampleLocationsfvNV; + +GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERUI64VNVPROC __glewGetBufferParameterui64vNV; +GLEW_FUN_EXPORT PFNGLGETINTEGERUI64VNVPROC __glewGetIntegerui64vNV; +GLEW_FUN_EXPORT PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC __glewGetNamedBufferParameterui64vNV; +GLEW_FUN_EXPORT PFNGLISBUFFERRESIDENTNVPROC __glewIsBufferResidentNV; +GLEW_FUN_EXPORT PFNGLISNAMEDBUFFERRESIDENTNVPROC __glewIsNamedBufferResidentNV; +GLEW_FUN_EXPORT PFNGLMAKEBUFFERNONRESIDENTNVPROC __glewMakeBufferNonResidentNV; +GLEW_FUN_EXPORT PFNGLMAKEBUFFERRESIDENTNVPROC __glewMakeBufferResidentNV; +GLEW_FUN_EXPORT PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC __glewMakeNamedBufferNonResidentNV; +GLEW_FUN_EXPORT PFNGLMAKENAMEDBUFFERRESIDENTNVPROC __glewMakeNamedBufferResidentNV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMUI64NVPROC __glewProgramUniformui64NV; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMUI64VNVPROC __glewProgramUniformui64vNV; +GLEW_FUN_EXPORT PFNGLUNIFORMUI64NVPROC __glewUniformui64NV; +GLEW_FUN_EXPORT PFNGLUNIFORMUI64VNVPROC __glewUniformui64vNV; + +GLEW_FUN_EXPORT PFNGLTEXTUREBARRIERNVPROC __glewTextureBarrierNV; + +GLEW_FUN_EXPORT PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTexImage2DMultisampleCoverageNV; +GLEW_FUN_EXPORT PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTexImage3DMultisampleCoverageNV; +GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTextureImage2DMultisampleCoverageNV; +GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC __glewTextureImage2DMultisampleNV; +GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTextureImage3DMultisampleCoverageNV; +GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC __glewTextureImage3DMultisampleNV; + +GLEW_FUN_EXPORT PFNGLACTIVEVARYINGNVPROC __glewActiveVaryingNV; +GLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKNVPROC __glewBeginTransformFeedbackNV; +GLEW_FUN_EXPORT PFNGLBINDBUFFERBASENVPROC __glewBindBufferBaseNV; +GLEW_FUN_EXPORT PFNGLBINDBUFFEROFFSETNVPROC __glewBindBufferOffsetNV; +GLEW_FUN_EXPORT PFNGLBINDBUFFERRANGENVPROC __glewBindBufferRangeNV; +GLEW_FUN_EXPORT PFNGLENDTRANSFORMFEEDBACKNVPROC __glewEndTransformFeedbackNV; +GLEW_FUN_EXPORT PFNGLGETACTIVEVARYINGNVPROC __glewGetActiveVaryingNV; +GLEW_FUN_EXPORT PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC __glewGetTransformFeedbackVaryingNV; +GLEW_FUN_EXPORT PFNGLGETVARYINGLOCATIONNVPROC __glewGetVaryingLocationNV; +GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC __glewTransformFeedbackAttribsNV; +GLEW_FUN_EXPORT PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC __glewTransformFeedbackVaryingsNV; + +GLEW_FUN_EXPORT PFNGLBINDTRANSFORMFEEDBACKNVPROC __glewBindTransformFeedbackNV; +GLEW_FUN_EXPORT PFNGLDELETETRANSFORMFEEDBACKSNVPROC __glewDeleteTransformFeedbacksNV; +GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKNVPROC __glewDrawTransformFeedbackNV; +GLEW_FUN_EXPORT PFNGLGENTRANSFORMFEEDBACKSNVPROC __glewGenTransformFeedbacksNV; +GLEW_FUN_EXPORT PFNGLISTRANSFORMFEEDBACKNVPROC __glewIsTransformFeedbackNV; +GLEW_FUN_EXPORT PFNGLPAUSETRANSFORMFEEDBACKNVPROC __glewPauseTransformFeedbackNV; +GLEW_FUN_EXPORT PFNGLRESUMETRANSFORMFEEDBACKNVPROC __glewResumeTransformFeedbackNV; + +GLEW_FUN_EXPORT PFNGLVDPAUFININVPROC __glewVDPAUFiniNV; +GLEW_FUN_EXPORT PFNGLVDPAUGETSURFACEIVNVPROC __glewVDPAUGetSurfaceivNV; +GLEW_FUN_EXPORT PFNGLVDPAUINITNVPROC __glewVDPAUInitNV; +GLEW_FUN_EXPORT PFNGLVDPAUISSURFACENVPROC __glewVDPAUIsSurfaceNV; +GLEW_FUN_EXPORT PFNGLVDPAUMAPSURFACESNVPROC __glewVDPAUMapSurfacesNV; +GLEW_FUN_EXPORT PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC __glewVDPAURegisterOutputSurfaceNV; +GLEW_FUN_EXPORT PFNGLVDPAUREGISTERVIDEOSURFACENVPROC __glewVDPAURegisterVideoSurfaceNV; +GLEW_FUN_EXPORT PFNGLVDPAUSURFACEACCESSNVPROC __glewVDPAUSurfaceAccessNV; +GLEW_FUN_EXPORT PFNGLVDPAUUNMAPSURFACESNVPROC __glewVDPAUUnmapSurfacesNV; +GLEW_FUN_EXPORT PFNGLVDPAUUNREGISTERSURFACENVPROC __glewVDPAUUnregisterSurfaceNV; + +GLEW_FUN_EXPORT PFNGLFLUSHVERTEXARRAYRANGENVPROC __glewFlushVertexArrayRangeNV; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYRANGENVPROC __glewVertexArrayRangeNV; + +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLI64VNVPROC __glewGetVertexAttribLi64vNV; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBLUI64VNVPROC __glewGetVertexAttribLui64vNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1I64NVPROC __glewVertexAttribL1i64NV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1I64VNVPROC __glewVertexAttribL1i64vNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1UI64NVPROC __glewVertexAttribL1ui64NV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL1UI64VNVPROC __glewVertexAttribL1ui64vNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2I64NVPROC __glewVertexAttribL2i64NV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2I64VNVPROC __glewVertexAttribL2i64vNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2UI64NVPROC __glewVertexAttribL2ui64NV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL2UI64VNVPROC __glewVertexAttribL2ui64vNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3I64NVPROC __glewVertexAttribL3i64NV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3I64VNVPROC __glewVertexAttribL3i64vNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3UI64NVPROC __glewVertexAttribL3ui64NV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL3UI64VNVPROC __glewVertexAttribL3ui64vNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4I64NVPROC __glewVertexAttribL4i64NV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4I64VNVPROC __glewVertexAttribL4i64vNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4UI64NVPROC __glewVertexAttribL4ui64NV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBL4UI64VNVPROC __glewVertexAttribL4ui64vNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBLFORMATNVPROC __glewVertexAttribLFormatNV; + +GLEW_FUN_EXPORT PFNGLBUFFERADDRESSRANGENVPROC __glewBufferAddressRangeNV; +GLEW_FUN_EXPORT PFNGLCOLORFORMATNVPROC __glewColorFormatNV; +GLEW_FUN_EXPORT PFNGLEDGEFLAGFORMATNVPROC __glewEdgeFlagFormatNV; +GLEW_FUN_EXPORT PFNGLFOGCOORDFORMATNVPROC __glewFogCoordFormatNV; +GLEW_FUN_EXPORT PFNGLGETINTEGERUI64I_VNVPROC __glewGetIntegerui64i_vNV; +GLEW_FUN_EXPORT PFNGLINDEXFORMATNVPROC __glewIndexFormatNV; +GLEW_FUN_EXPORT PFNGLNORMALFORMATNVPROC __glewNormalFormatNV; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLORFORMATNVPROC __glewSecondaryColorFormatNV; +GLEW_FUN_EXPORT PFNGLTEXCOORDFORMATNVPROC __glewTexCoordFormatNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBFORMATNVPROC __glewVertexAttribFormatNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBIFORMATNVPROC __glewVertexAttribIFormatNV; +GLEW_FUN_EXPORT PFNGLVERTEXFORMATNVPROC __glewVertexFormatNV; + +GLEW_FUN_EXPORT PFNGLAREPROGRAMSRESIDENTNVPROC __glewAreProgramsResidentNV; +GLEW_FUN_EXPORT PFNGLBINDPROGRAMNVPROC __glewBindProgramNV; +GLEW_FUN_EXPORT PFNGLDELETEPROGRAMSNVPROC __glewDeleteProgramsNV; +GLEW_FUN_EXPORT PFNGLEXECUTEPROGRAMNVPROC __glewExecuteProgramNV; +GLEW_FUN_EXPORT PFNGLGENPROGRAMSNVPROC __glewGenProgramsNV; +GLEW_FUN_EXPORT PFNGLGETPROGRAMPARAMETERDVNVPROC __glewGetProgramParameterdvNV; +GLEW_FUN_EXPORT PFNGLGETPROGRAMPARAMETERFVNVPROC __glewGetProgramParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETPROGRAMSTRINGNVPROC __glewGetProgramStringNV; +GLEW_FUN_EXPORT PFNGLGETPROGRAMIVNVPROC __glewGetProgramivNV; +GLEW_FUN_EXPORT PFNGLGETTRACKMATRIXIVNVPROC __glewGetTrackMatrixivNV; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVNVPROC __glewGetVertexAttribPointervNV; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVNVPROC __glewGetVertexAttribdvNV; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVNVPROC __glewGetVertexAttribfvNV; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVNVPROC __glewGetVertexAttribivNV; +GLEW_FUN_EXPORT PFNGLISPROGRAMNVPROC __glewIsProgramNV; +GLEW_FUN_EXPORT PFNGLLOADPROGRAMNVPROC __glewLoadProgramNV; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4DNVPROC __glewProgramParameter4dNV; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4DVNVPROC __glewProgramParameter4dvNV; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4FNVPROC __glewProgramParameter4fNV; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4FVNVPROC __glewProgramParameter4fvNV; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERS4DVNVPROC __glewProgramParameters4dvNV; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERS4FVNVPROC __glewProgramParameters4fvNV; +GLEW_FUN_EXPORT PFNGLREQUESTRESIDENTPROGRAMSNVPROC __glewRequestResidentProgramsNV; +GLEW_FUN_EXPORT PFNGLTRACKMATRIXNVPROC __glewTrackMatrixNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DNVPROC __glewVertexAttrib1dNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVNVPROC __glewVertexAttrib1dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FNVPROC __glewVertexAttrib1fNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVNVPROC __glewVertexAttrib1fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SNVPROC __glewVertexAttrib1sNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVNVPROC __glewVertexAttrib1svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DNVPROC __glewVertexAttrib2dNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVNVPROC __glewVertexAttrib2dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FNVPROC __glewVertexAttrib2fNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVNVPROC __glewVertexAttrib2fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SNVPROC __glewVertexAttrib2sNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVNVPROC __glewVertexAttrib2svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DNVPROC __glewVertexAttrib3dNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVNVPROC __glewVertexAttrib3dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FNVPROC __glewVertexAttrib3fNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVNVPROC __glewVertexAttrib3fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SNVPROC __glewVertexAttrib3sNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVNVPROC __glewVertexAttrib3svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DNVPROC __glewVertexAttrib4dNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVNVPROC __glewVertexAttrib4dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FNVPROC __glewVertexAttrib4fNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVNVPROC __glewVertexAttrib4fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SNVPROC __glewVertexAttrib4sNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVNVPROC __glewVertexAttrib4svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBNVPROC __glewVertexAttrib4ubNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVNVPROC __glewVertexAttrib4ubvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERNVPROC __glewVertexAttribPointerNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1DVNVPROC __glewVertexAttribs1dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1FVNVPROC __glewVertexAttribs1fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1SVNVPROC __glewVertexAttribs1svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2DVNVPROC __glewVertexAttribs2dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2FVNVPROC __glewVertexAttribs2fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2SVNVPROC __glewVertexAttribs2svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3DVNVPROC __glewVertexAttribs3dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3FVNVPROC __glewVertexAttribs3fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3SVNVPROC __glewVertexAttribs3svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4DVNVPROC __glewVertexAttribs4dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4FVNVPROC __glewVertexAttribs4fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4SVNVPROC __glewVertexAttribs4svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4UBVNVPROC __glewVertexAttribs4ubvNV; + +GLEW_FUN_EXPORT PFNGLBEGINVIDEOCAPTURENVPROC __glewBeginVideoCaptureNV; +GLEW_FUN_EXPORT PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC __glewBindVideoCaptureStreamBufferNV; +GLEW_FUN_EXPORT PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC __glewBindVideoCaptureStreamTextureNV; +GLEW_FUN_EXPORT PFNGLENDVIDEOCAPTURENVPROC __glewEndVideoCaptureNV; +GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMDVNVPROC __glewGetVideoCaptureStreamdvNV; +GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMFVNVPROC __glewGetVideoCaptureStreamfvNV; +GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMIVNVPROC __glewGetVideoCaptureStreamivNV; +GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTUREIVNVPROC __glewGetVideoCaptureivNV; +GLEW_FUN_EXPORT PFNGLVIDEOCAPTURENVPROC __glewVideoCaptureNV; +GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC __glewVideoCaptureStreamParameterdvNV; +GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC __glewVideoCaptureStreamParameterfvNV; +GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC __glewVideoCaptureStreamParameterivNV; + +GLEW_FUN_EXPORT PFNGLCLEARDEPTHFOESPROC __glewClearDepthfOES; +GLEW_FUN_EXPORT PFNGLCLIPPLANEFOESPROC __glewClipPlanefOES; +GLEW_FUN_EXPORT PFNGLDEPTHRANGEFOESPROC __glewDepthRangefOES; +GLEW_FUN_EXPORT PFNGLFRUSTUMFOESPROC __glewFrustumfOES; +GLEW_FUN_EXPORT PFNGLGETCLIPPLANEFOESPROC __glewGetClipPlanefOES; +GLEW_FUN_EXPORT PFNGLORTHOFOESPROC __glewOrthofOES; + +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC __glewFramebufferTextureMultiviewOVR; + +GLEW_FUN_EXPORT PFNGLALPHAFUNCXPROC __glewAlphaFuncx; +GLEW_FUN_EXPORT PFNGLCLEARCOLORXPROC __glewClearColorx; +GLEW_FUN_EXPORT PFNGLCLEARDEPTHXPROC __glewClearDepthx; +GLEW_FUN_EXPORT PFNGLCOLOR4XPROC __glewColor4x; +GLEW_FUN_EXPORT PFNGLDEPTHRANGEXPROC __glewDepthRangex; +GLEW_FUN_EXPORT PFNGLFOGXPROC __glewFogx; +GLEW_FUN_EXPORT PFNGLFOGXVPROC __glewFogxv; +GLEW_FUN_EXPORT PFNGLFRUSTUMFPROC __glewFrustumf; +GLEW_FUN_EXPORT PFNGLFRUSTUMXPROC __glewFrustumx; +GLEW_FUN_EXPORT PFNGLLIGHTMODELXPROC __glewLightModelx; +GLEW_FUN_EXPORT PFNGLLIGHTMODELXVPROC __glewLightModelxv; +GLEW_FUN_EXPORT PFNGLLIGHTXPROC __glewLightx; +GLEW_FUN_EXPORT PFNGLLIGHTXVPROC __glewLightxv; +GLEW_FUN_EXPORT PFNGLLINEWIDTHXPROC __glewLineWidthx; +GLEW_FUN_EXPORT PFNGLLOADMATRIXXPROC __glewLoadMatrixx; +GLEW_FUN_EXPORT PFNGLMATERIALXPROC __glewMaterialx; +GLEW_FUN_EXPORT PFNGLMATERIALXVPROC __glewMaterialxv; +GLEW_FUN_EXPORT PFNGLMULTMATRIXXPROC __glewMultMatrixx; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4XPROC __glewMultiTexCoord4x; +GLEW_FUN_EXPORT PFNGLNORMAL3XPROC __glewNormal3x; +GLEW_FUN_EXPORT PFNGLORTHOFPROC __glewOrthof; +GLEW_FUN_EXPORT PFNGLORTHOXPROC __glewOrthox; +GLEW_FUN_EXPORT PFNGLPOINTSIZEXPROC __glewPointSizex; +GLEW_FUN_EXPORT PFNGLPOLYGONOFFSETXPROC __glewPolygonOffsetx; +GLEW_FUN_EXPORT PFNGLROTATEXPROC __glewRotatex; +GLEW_FUN_EXPORT PFNGLSAMPLECOVERAGEXPROC __glewSampleCoveragex; +GLEW_FUN_EXPORT PFNGLSCALEXPROC __glewScalex; +GLEW_FUN_EXPORT PFNGLTEXENVXPROC __glewTexEnvx; +GLEW_FUN_EXPORT PFNGLTEXENVXVPROC __glewTexEnvxv; +GLEW_FUN_EXPORT PFNGLTEXPARAMETERXPROC __glewTexParameterx; +GLEW_FUN_EXPORT PFNGLTRANSLATEXPROC __glewTranslatex; + +GLEW_FUN_EXPORT PFNGLCLIPPLANEFPROC __glewClipPlanef; +GLEW_FUN_EXPORT PFNGLCLIPPLANEXPROC __glewClipPlanex; +GLEW_FUN_EXPORT PFNGLGETCLIPPLANEFPROC __glewGetClipPlanef; +GLEW_FUN_EXPORT PFNGLGETCLIPPLANEXPROC __glewGetClipPlanex; +GLEW_FUN_EXPORT PFNGLGETFIXEDVPROC __glewGetFixedv; +GLEW_FUN_EXPORT PFNGLGETLIGHTXVPROC __glewGetLightxv; +GLEW_FUN_EXPORT PFNGLGETMATERIALXVPROC __glewGetMaterialxv; +GLEW_FUN_EXPORT PFNGLGETTEXENVXVPROC __glewGetTexEnvxv; +GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERXVPROC __glewGetTexParameterxv; +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERXPROC __glewPointParameterx; +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERXVPROC __glewPointParameterxv; +GLEW_FUN_EXPORT PFNGLPOINTSIZEPOINTEROESPROC __glewPointSizePointerOES; +GLEW_FUN_EXPORT PFNGLTEXPARAMETERXVPROC __glewTexParameterxv; + +GLEW_FUN_EXPORT PFNGLERRORSTRINGREGALPROC __glewErrorStringREGAL; + +GLEW_FUN_EXPORT PFNGLGETEXTENSIONREGALPROC __glewGetExtensionREGAL; +GLEW_FUN_EXPORT PFNGLISSUPPORTEDREGALPROC __glewIsSupportedREGAL; + +GLEW_FUN_EXPORT PFNGLLOGMESSAGECALLBACKREGALPROC __glewLogMessageCallbackREGAL; + +GLEW_FUN_EXPORT PFNGLGETPROCADDRESSREGALPROC __glewGetProcAddressREGAL; + +GLEW_FUN_EXPORT PFNGLDETAILTEXFUNCSGISPROC __glewDetailTexFuncSGIS; +GLEW_FUN_EXPORT PFNGLGETDETAILTEXFUNCSGISPROC __glewGetDetailTexFuncSGIS; + +GLEW_FUN_EXPORT PFNGLFOGFUNCSGISPROC __glewFogFuncSGIS; +GLEW_FUN_EXPORT PFNGLGETFOGFUNCSGISPROC __glewGetFogFuncSGIS; + +GLEW_FUN_EXPORT PFNGLSAMPLEMASKSGISPROC __glewSampleMaskSGIS; +GLEW_FUN_EXPORT PFNGLSAMPLEPATTERNSGISPROC __glewSamplePatternSGIS; + +GLEW_FUN_EXPORT PFNGLGETSHARPENTEXFUNCSGISPROC __glewGetSharpenTexFuncSGIS; +GLEW_FUN_EXPORT PFNGLSHARPENTEXFUNCSGISPROC __glewSharpenTexFuncSGIS; + +GLEW_FUN_EXPORT PFNGLTEXIMAGE4DSGISPROC __glewTexImage4DSGIS; +GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE4DSGISPROC __glewTexSubImage4DSGIS; + +GLEW_FUN_EXPORT PFNGLGETTEXFILTERFUNCSGISPROC __glewGetTexFilterFuncSGIS; +GLEW_FUN_EXPORT PFNGLTEXFILTERFUNCSGISPROC __glewTexFilterFuncSGIS; + +GLEW_FUN_EXPORT PFNGLASYNCMARKERSGIXPROC __glewAsyncMarkerSGIX; +GLEW_FUN_EXPORT PFNGLDELETEASYNCMARKERSSGIXPROC __glewDeleteAsyncMarkersSGIX; +GLEW_FUN_EXPORT PFNGLFINISHASYNCSGIXPROC __glewFinishAsyncSGIX; +GLEW_FUN_EXPORT PFNGLGENASYNCMARKERSSGIXPROC __glewGenAsyncMarkersSGIX; +GLEW_FUN_EXPORT PFNGLISASYNCMARKERSGIXPROC __glewIsAsyncMarkerSGIX; +GLEW_FUN_EXPORT PFNGLPOLLASYNCSGIXPROC __glewPollAsyncSGIX; + +GLEW_FUN_EXPORT PFNGLFLUSHRASTERSGIXPROC __glewFlushRasterSGIX; + +GLEW_FUN_EXPORT PFNGLTEXTUREFOGSGIXPROC __glewTextureFogSGIX; + +GLEW_FUN_EXPORT PFNGLFRAGMENTCOLORMATERIALSGIXPROC __glewFragmentColorMaterialSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFSGIXPROC __glewFragmentLightModelfSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFVSGIXPROC __glewFragmentLightModelfvSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELISGIXPROC __glewFragmentLightModeliSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIVSGIXPROC __glewFragmentLightModelivSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFSGIXPROC __glewFragmentLightfSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFVSGIXPROC __glewFragmentLightfvSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTISGIXPROC __glewFragmentLightiSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIVSGIXPROC __glewFragmentLightivSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFSGIXPROC __glewFragmentMaterialfSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFVSGIXPROC __glewFragmentMaterialfvSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALISGIXPROC __glewFragmentMaterialiSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIVSGIXPROC __glewFragmentMaterialivSGIX; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTFVSGIXPROC __glewGetFragmentLightfvSGIX; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTIVSGIXPROC __glewGetFragmentLightivSGIX; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALFVSGIXPROC __glewGetFragmentMaterialfvSGIX; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALIVSGIXPROC __glewGetFragmentMaterialivSGIX; + +GLEW_FUN_EXPORT PFNGLFRAMEZOOMSGIXPROC __glewFrameZoomSGIX; + +GLEW_FUN_EXPORT PFNGLPIXELTEXGENSGIXPROC __glewPixelTexGenSGIX; + +GLEW_FUN_EXPORT PFNGLREFERENCEPLANESGIXPROC __glewReferencePlaneSGIX; + +GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERFSGIXPROC __glewSpriteParameterfSGIX; +GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERFVSGIXPROC __glewSpriteParameterfvSGIX; +GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERISGIXPROC __glewSpriteParameteriSGIX; +GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERIVSGIXPROC __glewSpriteParameterivSGIX; + +GLEW_FUN_EXPORT PFNGLTAGSAMPLEBUFFERSGIXPROC __glewTagSampleBufferSGIX; + +GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERFVSGIPROC __glewColorTableParameterfvSGI; +GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERIVSGIPROC __glewColorTableParameterivSGI; +GLEW_FUN_EXPORT PFNGLCOLORTABLESGIPROC __glewColorTableSGI; +GLEW_FUN_EXPORT PFNGLCOPYCOLORTABLESGIPROC __glewCopyColorTableSGI; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVSGIPROC __glewGetColorTableParameterfvSGI; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVSGIPROC __glewGetColorTableParameterivSGI; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLESGIPROC __glewGetColorTableSGI; + +GLEW_FUN_EXPORT PFNGLFINISHTEXTURESUNXPROC __glewFinishTextureSUNX; + +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORBSUNPROC __glewGlobalAlphaFactorbSUN; +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORDSUNPROC __glewGlobalAlphaFactordSUN; +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORFSUNPROC __glewGlobalAlphaFactorfSUN; +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORISUNPROC __glewGlobalAlphaFactoriSUN; +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORSSUNPROC __glewGlobalAlphaFactorsSUN; +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUBSUNPROC __glewGlobalAlphaFactorubSUN; +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUISUNPROC __glewGlobalAlphaFactoruiSUN; +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUSSUNPROC __glewGlobalAlphaFactorusSUN; + +GLEW_FUN_EXPORT PFNGLREADVIDEOPIXELSSUNPROC __glewReadVideoPixelsSUN; + +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEPOINTERSUNPROC __glewReplacementCodePointerSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUBSUNPROC __glewReplacementCodeubSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUBVSUNPROC __glewReplacementCodeubvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUISUNPROC __glewReplacementCodeuiSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVSUNPROC __glewReplacementCodeuivSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUSSUNPROC __glewReplacementCodeusSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUSVSUNPROC __glewReplacementCodeusvSUN; + +GLEW_FUN_EXPORT PFNGLCOLOR3FVERTEX3FSUNPROC __glewColor3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLCOLOR3FVERTEX3FVSUNPROC __glewColor3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewColor4fNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewColor4fNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX2FSUNPROC __glewColor4ubVertex2fSUN; +GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX2FVSUNPROC __glewColor4ubVertex2fvSUN; +GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX3FSUNPROC __glewColor4ubVertex3fSUN; +GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX3FVSUNPROC __glewColor4ubVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLNORMAL3FVERTEX3FSUNPROC __glewNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLNORMAL3FVERTEX3FVSUNPROC __glewNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC __glewReplacementCodeuiColor3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC __glewReplacementCodeuiColor4ubVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC __glewReplacementCodeuiColor4ubVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC __glewReplacementCodeuiVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC __glewReplacementCodeuiVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC __glewTexCoord2fColor3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC __glewTexCoord2fColor3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC __glewTexCoord2fColor4ubVertex3fSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC __glewTexCoord2fColor4ubVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FVERTEX3FSUNPROC __glewTexCoord2fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FVERTEX3FVSUNPROC __glewTexCoord2fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fvSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD4FVERTEX4FSUNPROC __glewTexCoord4fVertex4fSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD4FVERTEX4FVSUNPROC __glewTexCoord4fVertex4fvSUN; + +GLEW_FUN_EXPORT PFNGLADDSWAPHINTRECTWINPROC __glewAddSwapHintRectWIN; + +#if defined(GLEW_MX) && !defined(_WIN32) +struct GLEWContextStruct +{ +#endif /* GLEW_MX */ + +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_1; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2_1; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_3; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_4; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_5; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_2_0; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_2_1; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_0; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_1; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_2; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_3; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_0; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_1; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_2; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_3; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_4; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_5; +GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_tbuffer; +GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_texture_compression_FXT1; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_blend_minmax_factor; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_conservative_depth; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_debug_output; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_depth_clamp_separate; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_draw_buffers_blend; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_gcn_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_gpu_shader_int64; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_interleaved_elements; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_multi_draw_indirect; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_name_gen_delete; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_occlusion_query_event; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_performance_monitor; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_pinned_memory; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_query_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_sample_positions; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_seamless_cubemap_per_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_atomic_counter_ops; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_stencil_export; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_stencil_value_export; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_trinary_minmax; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_sparse_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_stencil_operation_extended; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_texture_texture4; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_transform_feedback3_lines_triangles; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_transform_feedback4; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_layer; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_tessellator; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_vertex_shader_viewport_index; +GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_depth_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_framebuffer_blit; +GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_framebuffer_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_instanced_arrays; +GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_pack_reverse_row_order; +GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_program_binary; +GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_texture_compression_dxt1; +GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_texture_compression_dxt3; +GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_texture_compression_dxt5; +GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_texture_usage; +GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_timer_query; +GLEW_VAR_EXPORT GLboolean __GLEW_ANGLE_translated_shader_source; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_aux_depth_stencil; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_client_storage; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_element_array; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_fence; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_float_pixels; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_flush_buffer_range; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_object_purgeable; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_pixel_buffer; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_rgb_422; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_row_bytes; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_specular_vector; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_texture_range; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_transform_hint; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_array_object; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_array_range; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_program_evaluators; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_ycbcr_422; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_ES2_compatibility; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_ES3_1_compatibility; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_ES3_2_compatibility; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_ES3_compatibility; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_arrays_of_arrays; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_base_instance; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_bindless_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_blend_func_extended; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_buffer_storage; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_cl_event; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_clear_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_clear_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_clip_control; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_color_buffer_float; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_compatibility; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_compressed_texture_pixel_storage; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_compute_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_compute_variable_group_size; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_conditional_render_inverted; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_conservative_depth; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_copy_buffer; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_copy_image; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_cull_distance; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_debug_output; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_buffer_float; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_derivative_control; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_direct_state_access; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_buffers; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_buffers_blend; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_elements_base_vertex; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_indirect; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_instanced; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_enhanced_layouts; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_explicit_attrib_location; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_explicit_uniform_location; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_coord_conventions; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_layer_viewport; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_program; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_program_shadow; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_shader_interlock; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_no_attachments; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_framebuffer_sRGB; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_geometry_shader4; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_get_program_binary; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_get_texture_sub_image; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_gpu_shader5; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_gpu_shader_fp64; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_gpu_shader_int64; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_half_float_pixel; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_half_float_vertex; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_imaging; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_indirect_parameters; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_instanced_arrays; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_internalformat_query; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_internalformat_query2; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_invalidate_subdata; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_map_buffer_alignment; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_map_buffer_range; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_matrix_palette; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_multi_bind; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_multi_draw_indirect; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_multitexture; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_occlusion_query; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_occlusion_query2; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_parallel_shader_compile; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_pipeline_statistics_query; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_pixel_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_point_parameters; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_point_sprite; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_post_depth_coverage; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_program_interface_query; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_provoking_vertex; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_query_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_robust_buffer_access_behavior; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness_application_isolation; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_robustness_share_group_isolation; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sample_locations; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sample_shading; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sampler_objects; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_seamless_cube_map; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_seamless_cubemap_per_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_separate_shader_objects; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_atomic_counter_ops; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_atomic_counters; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_ballot; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_bit_encoding; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_clock; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_draw_parameters; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_group_vote; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_image_load_store; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_image_size; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_objects; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_precision; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_stencil_export; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_storage_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_subroutine; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_texture_image_samples; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_texture_lod; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_viewport_layer_array; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_100; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_420pack; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_include; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_packing; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shadow; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shadow_ambient; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sparse_buffer; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sparse_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sparse_texture2; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sparse_texture_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_stencil_texturing; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_sync; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_tessellation_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_barrier; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_border_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_object_rgb32; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_buffer_range; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression_bptc; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression_rgtc; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_cube_map; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_cube_map_array; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_add; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_combine; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_crossbar; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_dot3; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_filter_minmax; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_float; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_gather; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_mirror_clamp_to_edge; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_mirrored_repeat; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_non_power_of_two; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_query_levels; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_query_lod; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rectangle; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rg; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rgb10_a2ui; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_stencil8; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_storage; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_storage_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_swizzle; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_view; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_timer_query; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback2; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback3; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback_instanced; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transform_feedback_overflow_query; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transpose_matrix; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_uniform_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_array_bgra; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_array_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_attrib_64bit; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_attrib_binding; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_blend; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_program; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_type_10f_11f_11f_rev; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_type_2_10_10_10_rev; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_viewport_array; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_window_pos; +GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_point_sprites; +GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_texture_env_combine3; +GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_texture_env_route; +GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_vertex_shader_output_point_size; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_draw_buffers; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_element_array; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_envmap_bumpmap; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_fragment_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_map_object_buffer; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_meminfo; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_pn_triangles; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_separate_stencil; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_shader_texture_lod; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_text_fragment_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_compression_3dc; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_env_combine3; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_float; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_mirror_once; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_array_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_attrib_array_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_streams; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_422_pixels; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_Cg_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_abgr; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_bgra; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_bindable_uniform; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_color; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_equation_separate; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_func_separate; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_logic_op; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_minmax; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_subtract; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_clip_volume_hint; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_cmyka; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_color_subtable; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_compiled_vertex_array; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_convolution; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_coordinate_frame; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_copy_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_cull_vertex; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_debug_label; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_debug_marker; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_depth_bounds_test; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_direct_state_access; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_buffers2; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_instanced; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_range_elements; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_fog_coord; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_fragment_lighting; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_blit; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_multisample_blit_scaled; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_sRGB; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_geometry_shader4; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_gpu_program_parameters; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_gpu_shader4; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_histogram; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_array_formats; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_func; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_material; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_light_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_misc_attribute; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multi_draw_arrays; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_depth_stencil; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_float; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_pixels; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_paletted_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_transform; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_transform_color_table; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_point_parameters; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_polygon_offset; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_polygon_offset_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_post_depth_coverage; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_provoking_vertex; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_raster_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_rescale_normal; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_scene_marker; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_secondary_color; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_separate_shader_objects; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_separate_specular_color; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shader_image_load_formatted; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shader_image_load_store; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shader_integer_mix; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shadow_funcs; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shared_texture_palette; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_sparse_texture2; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_clear_tag; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_two_side; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_wrap; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_subtexture; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture3D; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_array; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_dxt1; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_latc; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_rgtc; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_s3tc; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_cube_map; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_edge_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_add; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_combine; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_dot3; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_filter_anisotropic; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_filter_minmax; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_integer; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_lod_bias; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_mirror_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_object; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_perturb_normal; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_rectangle; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB_decode; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_shared_exponent; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_snorm; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_swizzle; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_timer_query; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_transform_feedback; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_array; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_array_bgra; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_attrib_64bit; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_weighting; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_x11_sync_object; +GLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_frame_terminator; +GLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_string_marker; +GLEW_VAR_EXPORT GLboolean __GLEW_HP_convolution_border_modes; +GLEW_VAR_EXPORT GLboolean __GLEW_HP_image_transform; +GLEW_VAR_EXPORT GLboolean __GLEW_HP_occlusion_test; +GLEW_VAR_EXPORT GLboolean __GLEW_HP_texture_lighting; +GLEW_VAR_EXPORT GLboolean __GLEW_IBM_cull_vertex; +GLEW_VAR_EXPORT GLboolean __GLEW_IBM_multimode_draw_arrays; +GLEW_VAR_EXPORT GLboolean __GLEW_IBM_rasterpos_clip; +GLEW_VAR_EXPORT GLboolean __GLEW_IBM_static_data; +GLEW_VAR_EXPORT GLboolean __GLEW_IBM_texture_mirrored_repeat; +GLEW_VAR_EXPORT GLboolean __GLEW_IBM_vertex_array_lists; +GLEW_VAR_EXPORT GLboolean __GLEW_INGR_color_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_INGR_interlace_read; +GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_fragment_shader_ordering; +GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_framebuffer_CMAA; +GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_map_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_parallel_arrays; +GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_performance_query; +GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_texture_scissor; +GLEW_VAR_EXPORT GLboolean __GLEW_KHR_blend_equation_advanced; +GLEW_VAR_EXPORT GLboolean __GLEW_KHR_blend_equation_advanced_coherent; +GLEW_VAR_EXPORT GLboolean __GLEW_KHR_context_flush_control; +GLEW_VAR_EXPORT GLboolean __GLEW_KHR_debug; +GLEW_VAR_EXPORT GLboolean __GLEW_KHR_no_error; +GLEW_VAR_EXPORT GLboolean __GLEW_KHR_robust_buffer_access_behavior; +GLEW_VAR_EXPORT GLboolean __GLEW_KHR_robustness; +GLEW_VAR_EXPORT GLboolean __GLEW_KHR_texture_compression_astc_hdr; +GLEW_VAR_EXPORT GLboolean __GLEW_KHR_texture_compression_astc_ldr; +GLEW_VAR_EXPORT GLboolean __GLEW_KTX_buffer_region; +GLEW_VAR_EXPORT GLboolean __GLEW_MESAX_texture_stack; +GLEW_VAR_EXPORT GLboolean __GLEW_MESA_pack_invert; +GLEW_VAR_EXPORT GLboolean __GLEW_MESA_resize_buffers; +GLEW_VAR_EXPORT GLboolean __GLEW_MESA_window_pos; +GLEW_VAR_EXPORT GLboolean __GLEW_MESA_ycbcr_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_NVX_conditional_render; +GLEW_VAR_EXPORT GLboolean __GLEW_NVX_gpu_memory_info; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_bindless_multi_draw_indirect; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_bindless_multi_draw_indirect_count; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_bindless_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_blend_equation_advanced; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_blend_equation_advanced_coherent; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_blend_square; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_compute_program5; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_conditional_render; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_conservative_raster; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_conservative_raster_dilate; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_copy_depth_to_color; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_copy_image; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_deep_texture3D; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_buffer_float; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_range_unclamped; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_draw_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_evaluators; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_explicit_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fence; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fill_rectangle; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_float_buffer; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fog_distance; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_coverage_to_color; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program2; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program4; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program_option; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_shader_interlock; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_framebuffer_mixed_samples; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_framebuffer_multisample_coverage; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_geometry_program4; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_geometry_shader4; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_geometry_shader_passthrough; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program4; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program5; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program5_mem_extended; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_program_fp64; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_gpu_shader5; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_half_float; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_internalformat_sample_query; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_light_max_exponent; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_multisample_coverage; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_multisample_filter_hint; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_occlusion_query; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_packed_depth_stencil; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_parameter_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_parameter_buffer_object2; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_path_rendering; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_path_rendering_shared_edge; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_pixel_data_range; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_point_sprite; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_present_video; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_primitive_restart; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_register_combiners; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_register_combiners2; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_sample_locations; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_sample_mask_override_coverage; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_counters; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_float; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_fp16_vector; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_int64; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_buffer_load; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_storage_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_thread_group; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_thread_shuffle; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_tessellation_program5; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texgen_emboss; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texgen_reflection; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_barrier; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_compression_vtc; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_env_combine4; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_expand_normal; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_rectangle; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader2; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader3; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_transform_feedback; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_transform_feedback2; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_uniform_buffer_unified_memory; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vdpau_interop; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_array_range; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_array_range2; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_attrib_integer_64bit; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_buffer_unified_memory; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program1_1; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program2; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program2_option; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program3; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program4; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_video_capture; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_viewport_array2; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_byte_coordinates; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_compressed_paletted_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_read_format; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_single_precision; +GLEW_VAR_EXPORT GLboolean __GLEW_OML_interlace; +GLEW_VAR_EXPORT GLboolean __GLEW_OML_resample; +GLEW_VAR_EXPORT GLboolean __GLEW_OML_subsample; +GLEW_VAR_EXPORT GLboolean __GLEW_OVR_multiview; +GLEW_VAR_EXPORT GLboolean __GLEW_OVR_multiview2; +GLEW_VAR_EXPORT GLboolean __GLEW_PGI_misc_hints; +GLEW_VAR_EXPORT GLboolean __GLEW_PGI_vertex_hints; +GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_ES1_0_compatibility; +GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_ES1_1_compatibility; +GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_enable; +GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_error_string; +GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_extension_query; +GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_log; +GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_proc_address; +GLEW_VAR_EXPORT GLboolean __GLEW_REND_screen_coordinates; +GLEW_VAR_EXPORT GLboolean __GLEW_S3_s3tc; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_color_range; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_detail_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_fog_function; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_generate_mipmap; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_pixel_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_point_line_texgen; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_sharpen_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture4D; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_border_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_edge_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_filter4; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_lod; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_select; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async_histogram; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async_pixel; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_blend_alpha_minmax; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_clipmap; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_convolution_accuracy; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_depth_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_flush_raster; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fog_offset; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fog_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fragment_specular_lighting; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_framezoom; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_interlace; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_ir_instrument1; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_list_priority; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_pixel_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_pixel_texture_bits; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_reference_plane; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_resample; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_shadow; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_shadow_ambient; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_sprite; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_tag_sample_buffer; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_add_env; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_coordinate_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_lod_bias; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_multi_buffer; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_range; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_scale_bias; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_vertex_preclip; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_vertex_preclip_hint; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_ycrcb; +GLEW_VAR_EXPORT GLboolean __GLEW_SGI_color_matrix; +GLEW_VAR_EXPORT GLboolean __GLEW_SGI_color_table; +GLEW_VAR_EXPORT GLboolean __GLEW_SGI_texture_color_table; +GLEW_VAR_EXPORT GLboolean __GLEW_SUNX_constant_data; +GLEW_VAR_EXPORT GLboolean __GLEW_SUN_convolution_border_modes; +GLEW_VAR_EXPORT GLboolean __GLEW_SUN_global_alpha; +GLEW_VAR_EXPORT GLboolean __GLEW_SUN_mesh_array; +GLEW_VAR_EXPORT GLboolean __GLEW_SUN_read_video_pixels; +GLEW_VAR_EXPORT GLboolean __GLEW_SUN_slice_accum; +GLEW_VAR_EXPORT GLboolean __GLEW_SUN_triangle_list; +GLEW_VAR_EXPORT GLboolean __GLEW_SUN_vertex; +GLEW_VAR_EXPORT GLboolean __GLEW_WIN_phong_shading; +GLEW_VAR_EXPORT GLboolean __GLEW_WIN_specular_fog; +GLEW_VAR_EXPORT GLboolean __GLEW_WIN_swap_hint; + +#ifdef GLEW_MX +}; /* GLEWContextStruct */ +#endif /* GLEW_MX */ + +/* ------------------------------------------------------------------------- */ + +/* error codes */ +#define GLEW_OK 0 +#define GLEW_NO_ERROR 0 +#define GLEW_ERROR_NO_GL_VERSION 1 /* missing GL version */ +#define GLEW_ERROR_GL_VERSION_10_ONLY 2 /* Need at least OpenGL 1.1 */ +#define GLEW_ERROR_GLX_VERSION_11_ONLY 3 /* Need at least GLX 1.2 */ + +/* string codes */ +#define GLEW_VERSION 1 +#define GLEW_VERSION_MAJOR 2 +#define GLEW_VERSION_MINOR 3 +#define GLEW_VERSION_MICRO 4 + +/* ------------------------------------------------------------------------- */ + +/* GLEW version info */ + +/* +VERSION 1.13.0 +VERSION_MAJOR 1 +VERSION_MINOR 13 +VERSION_MICRO 0 +*/ + +/* API */ +#ifdef GLEW_MX + +typedef struct GLEWContextStruct GLEWContext; +GLEWAPI GLenum GLEWAPIENTRY glewContextInit (GLEWContext *ctx); +GLEWAPI GLboolean GLEWAPIENTRY glewContextIsSupported (const GLEWContext *ctx, const char *name); + +#define glewInit() glewContextInit(glewGetContext()) +#define glewIsSupported(x) glewContextIsSupported(glewGetContext(), x) +#define glewIsExtensionSupported(x) glewIsSupported(x) + +#define GLEW_GET_VAR(x) (*(const GLboolean*)&(glewGetContext()->x)) +#ifdef _WIN32 +# define GLEW_GET_FUN(x) glewGetContext()->x +#else +# define GLEW_GET_FUN(x) x +#endif + +#else /* GLEW_MX */ + +GLEWAPI GLenum GLEWAPIENTRY glewInit (void); +GLEWAPI GLboolean GLEWAPIENTRY glewIsSupported (const char *name); +#define glewIsExtensionSupported(x) glewIsSupported(x) + +#define GLEW_GET_VAR(x) (*(const GLboolean*)&x) +#define GLEW_GET_FUN(x) x + +#endif /* GLEW_MX */ + +GLEWAPI GLboolean glewExperimental; +GLEWAPI GLboolean GLEWAPIENTRY glewGetExtension (const char *name); +GLEWAPI const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error); +GLEWAPI const GLubyte * GLEWAPIENTRY glewGetString (GLenum name); + +#ifdef __cplusplus +} +#endif + +#ifdef GLEW_APIENTRY_DEFINED +#undef GLEW_APIENTRY_DEFINED +#undef APIENTRY +#endif + +#ifdef GLEW_CALLBACK_DEFINED +#undef GLEW_CALLBACK_DEFINED +#undef CALLBACK +#endif + +#ifdef GLEW_WINGDIAPI_DEFINED +#undef GLEW_WINGDIAPI_DEFINED +#undef WINGDIAPI +#endif + +#undef GLAPI +/* #undef GLEWAPI */ + +#endif /* __glew_h__ */ diff --git a/engine/third_party/physx/snippets/graphics/include/GL/glxew.h b/engine/third_party/physx/snippets/graphics/include/GL/glxew.h new file mode 100644 index 00000000..d803d260 --- /dev/null +++ b/engine/third_party/physx/snippets/graphics/include/GL/glxew.h @@ -0,0 +1,1772 @@ +/* +** The OpenGL Extension Wrangler Library +** Copyright (C) 2008-2015, Nigel Stewart +** Copyright (C) 2002-2008, Milan Ikits +** Copyright (C) 2002-2008, Marcelo E. Magallon +** Copyright (C) 2002, Lev Povalahev +** 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. +** * The name of the author may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +** THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Mesa 3-D graphics library + * Version: 7.0 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* +** Copyright (c) 2007 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#ifndef __glxew_h__ +#define __glxew_h__ +#define __GLXEW_H__ + +#ifdef __glxext_h_ +#error glxext.h included before glxew.h +#endif + +#if defined(GLX_H) || defined(__GLX_glx_h__) || defined(__glx_h__) +#error glx.h included before glxew.h +#endif + +#define __glxext_h_ + +#define GLX_H +#define __GLX_glx_h__ +#define __glx_h__ + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ---------------------------- GLX_VERSION_1_0 --------------------------- */ + +#ifndef GLX_VERSION_1_0 +#define GLX_VERSION_1_0 1 + +#define GLX_USE_GL 1 +#define GLX_BUFFER_SIZE 2 +#define GLX_LEVEL 3 +#define GLX_RGBA 4 +#define GLX_DOUBLEBUFFER 5 +#define GLX_STEREO 6 +#define GLX_AUX_BUFFERS 7 +#define GLX_RED_SIZE 8 +#define GLX_GREEN_SIZE 9 +#define GLX_BLUE_SIZE 10 +#define GLX_ALPHA_SIZE 11 +#define GLX_DEPTH_SIZE 12 +#define GLX_STENCIL_SIZE 13 +#define GLX_ACCUM_RED_SIZE 14 +#define GLX_ACCUM_GREEN_SIZE 15 +#define GLX_ACCUM_BLUE_SIZE 16 +#define GLX_ACCUM_ALPHA_SIZE 17 +#define GLX_BAD_SCREEN 1 +#define GLX_BAD_ATTRIBUTE 2 +#define GLX_NO_EXTENSION 3 +#define GLX_BAD_VISUAL 4 +#define GLX_BAD_CONTEXT 5 +#define GLX_BAD_VALUE 6 +#define GLX_BAD_ENUM 7 + +typedef XID GLXDrawable; +typedef XID GLXPixmap; +#ifdef __sun +typedef struct __glXContextRec *GLXContext; +#else +typedef struct __GLXcontextRec *GLXContext; +#endif + +typedef unsigned int GLXVideoDeviceNV; + +extern Bool glXQueryExtension (Display *dpy, int *errorBase, int *eventBase); +extern Bool glXQueryVersion (Display *dpy, int *major, int *minor); +extern int glXGetConfig (Display *dpy, XVisualInfo *vis, int attrib, int *value); +extern XVisualInfo* glXChooseVisual (Display *dpy, int screen, int *attribList); +extern GLXPixmap glXCreateGLXPixmap (Display *dpy, XVisualInfo *vis, Pixmap pixmap); +extern void glXDestroyGLXPixmap (Display *dpy, GLXPixmap pix); +extern GLXContext glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct); +extern void glXDestroyContext (Display *dpy, GLXContext ctx); +extern Bool glXIsDirect (Display *dpy, GLXContext ctx); +extern void glXCopyContext (Display *dpy, GLXContext src, GLXContext dst, GLulong mask); +extern Bool glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx); +extern GLXContext glXGetCurrentContext (void); +extern GLXDrawable glXGetCurrentDrawable (void); +extern void glXWaitGL (void); +extern void glXWaitX (void); +extern void glXSwapBuffers (Display *dpy, GLXDrawable drawable); +extern void glXUseXFont (Font font, int first, int count, int listBase); + +#define GLXEW_VERSION_1_0 GLXEW_GET_VAR(__GLXEW_VERSION_1_0) + +#endif /* GLX_VERSION_1_0 */ + +/* ---------------------------- GLX_VERSION_1_1 --------------------------- */ + +#ifndef GLX_VERSION_1_1 +#define GLX_VERSION_1_1 + +#define GLX_VENDOR 0x1 +#define GLX_VERSION 0x2 +#define GLX_EXTENSIONS 0x3 + +extern const char* glXQueryExtensionsString (Display *dpy, int screen); +extern const char* glXGetClientString (Display *dpy, int name); +extern const char* glXQueryServerString (Display *dpy, int screen, int name); + +#define GLXEW_VERSION_1_1 GLXEW_GET_VAR(__GLXEW_VERSION_1_1) + +#endif /* GLX_VERSION_1_1 */ + +/* ---------------------------- GLX_VERSION_1_2 ---------------------------- */ + +#ifndef GLX_VERSION_1_2 +#define GLX_VERSION_1_2 1 + +typedef Display* ( * PFNGLXGETCURRENTDISPLAYPROC) (void); + +#define glXGetCurrentDisplay GLXEW_GET_FUN(__glewXGetCurrentDisplay) + +#define GLXEW_VERSION_1_2 GLXEW_GET_VAR(__GLXEW_VERSION_1_2) + +#endif /* GLX_VERSION_1_2 */ + +/* ---------------------------- GLX_VERSION_1_3 ---------------------------- */ + +#ifndef GLX_VERSION_1_3 +#define GLX_VERSION_1_3 1 + +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_RGBA_BIT 0x00000001 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_CONFIG_CAVEAT 0x20 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_VISUAL_ID 0x800B +#define GLX_SCREEN 0x800C +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_PBUFFER_HEIGHT 0x8040 +#define GLX_PBUFFER_WIDTH 0x8041 +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 +#define GLX_DONT_CARE 0xFFFFFFFF + +typedef XID GLXFBConfigID; +typedef XID GLXPbuffer; +typedef XID GLXWindow; +typedef struct __GLXFBConfigRec *GLXFBConfig; + +typedef struct { + int event_type; + int draw_type; + unsigned long serial; + Bool send_event; + Display *display; + GLXDrawable drawable; + unsigned int buffer_mask; + unsigned int aux_buffer; + int x, y; + int width, height; + int count; +} GLXPbufferClobberEvent; +typedef union __GLXEvent { + GLXPbufferClobberEvent glxpbufferclobber; + long pad[24]; +} GLXEvent; + +typedef GLXFBConfig* ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); +typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); +typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); +typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); +typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); +typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); +typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void); +typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); +typedef GLXFBConfig* ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); +typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); +typedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); +typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); +typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); +typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); + +#define glXChooseFBConfig GLXEW_GET_FUN(__glewXChooseFBConfig) +#define glXCreateNewContext GLXEW_GET_FUN(__glewXCreateNewContext) +#define glXCreatePbuffer GLXEW_GET_FUN(__glewXCreatePbuffer) +#define glXCreatePixmap GLXEW_GET_FUN(__glewXCreatePixmap) +#define glXCreateWindow GLXEW_GET_FUN(__glewXCreateWindow) +#define glXDestroyPbuffer GLXEW_GET_FUN(__glewXDestroyPbuffer) +#define glXDestroyPixmap GLXEW_GET_FUN(__glewXDestroyPixmap) +#define glXDestroyWindow GLXEW_GET_FUN(__glewXDestroyWindow) +#define glXGetCurrentReadDrawable GLXEW_GET_FUN(__glewXGetCurrentReadDrawable) +#define glXGetFBConfigAttrib GLXEW_GET_FUN(__glewXGetFBConfigAttrib) +#define glXGetFBConfigs GLXEW_GET_FUN(__glewXGetFBConfigs) +#define glXGetSelectedEvent GLXEW_GET_FUN(__glewXGetSelectedEvent) +#define glXGetVisualFromFBConfig GLXEW_GET_FUN(__glewXGetVisualFromFBConfig) +#define glXMakeContextCurrent GLXEW_GET_FUN(__glewXMakeContextCurrent) +#define glXQueryContext GLXEW_GET_FUN(__glewXQueryContext) +#define glXQueryDrawable GLXEW_GET_FUN(__glewXQueryDrawable) +#define glXSelectEvent GLXEW_GET_FUN(__glewXSelectEvent) + +#define GLXEW_VERSION_1_3 GLXEW_GET_VAR(__GLXEW_VERSION_1_3) + +#endif /* GLX_VERSION_1_3 */ + +/* ---------------------------- GLX_VERSION_1_4 ---------------------------- */ + +#ifndef GLX_VERSION_1_4 +#define GLX_VERSION_1_4 1 + +#define GLX_SAMPLE_BUFFERS 100000 +#define GLX_SAMPLES 100001 + +extern void ( * glXGetProcAddress (const GLubyte *procName)) (void); + +#define GLXEW_VERSION_1_4 GLXEW_GET_VAR(__GLXEW_VERSION_1_4) + +#endif /* GLX_VERSION_1_4 */ + +/* -------------------------- GLX_3DFX_multisample ------------------------- */ + +#ifndef GLX_3DFX_multisample +#define GLX_3DFX_multisample 1 + +#define GLX_SAMPLE_BUFFERS_3DFX 0x8050 +#define GLX_SAMPLES_3DFX 0x8051 + +#define GLXEW_3DFX_multisample GLXEW_GET_VAR(__GLXEW_3DFX_multisample) + +#endif /* GLX_3DFX_multisample */ + +/* ------------------------ GLX_AMD_gpu_association ------------------------ */ + +#ifndef GLX_AMD_gpu_association +#define GLX_AMD_gpu_association 1 + +#define GLX_GPU_VENDOR_AMD 0x1F00 +#define GLX_GPU_RENDERER_STRING_AMD 0x1F01 +#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 +#define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 +#define GLX_GPU_RAM_AMD 0x21A3 +#define GLX_GPU_CLOCK_AMD 0x21A4 +#define GLX_GPU_NUM_PIPES_AMD 0x21A5 +#define GLX_GPU_NUM_SIMD_AMD 0x21A6 +#define GLX_GPU_NUM_RB_AMD 0x21A7 +#define GLX_GPU_NUM_SPI_AMD 0x21A8 + +typedef void ( * PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC) (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef GLXContext ( * PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC) (unsigned int id, GLXContext share_list); +typedef GLXContext ( * PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (unsigned int id, GLXContext share_context, const int* attribList); +typedef Bool ( * PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC) (GLXContext ctx); +typedef unsigned int ( * PFNGLXGETCONTEXTGPUIDAMDPROC) (GLXContext ctx); +typedef GLXContext ( * PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); +typedef unsigned int ( * PFNGLXGETGPUIDSAMDPROC) (unsigned int maxCount, unsigned int* ids); +typedef int ( * PFNGLXGETGPUINFOAMDPROC) (unsigned int id, int property, GLenum dataType, unsigned int size, void* data); +typedef Bool ( * PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (GLXContext ctx); + +#define glXBlitContextFramebufferAMD GLXEW_GET_FUN(__glewXBlitContextFramebufferAMD) +#define glXCreateAssociatedContextAMD GLXEW_GET_FUN(__glewXCreateAssociatedContextAMD) +#define glXCreateAssociatedContextAttribsAMD GLXEW_GET_FUN(__glewXCreateAssociatedContextAttribsAMD) +#define glXDeleteAssociatedContextAMD GLXEW_GET_FUN(__glewXDeleteAssociatedContextAMD) +#define glXGetContextGPUIDAMD GLXEW_GET_FUN(__glewXGetContextGPUIDAMD) +#define glXGetCurrentAssociatedContextAMD GLXEW_GET_FUN(__glewXGetCurrentAssociatedContextAMD) +#define glXGetGPUIDsAMD GLXEW_GET_FUN(__glewXGetGPUIDsAMD) +#define glXGetGPUInfoAMD GLXEW_GET_FUN(__glewXGetGPUInfoAMD) +#define glXMakeAssociatedContextCurrentAMD GLXEW_GET_FUN(__glewXMakeAssociatedContextCurrentAMD) + +#define GLXEW_AMD_gpu_association GLXEW_GET_VAR(__GLXEW_AMD_gpu_association) + +#endif /* GLX_AMD_gpu_association */ + +/* --------------------- GLX_ARB_context_flush_control --------------------- */ + +#ifndef GLX_ARB_context_flush_control +#define GLX_ARB_context_flush_control 1 + +#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0x0000 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 + +#define GLXEW_ARB_context_flush_control GLXEW_GET_VAR(__GLXEW_ARB_context_flush_control) + +#endif /* GLX_ARB_context_flush_control */ + +/* ------------------------- GLX_ARB_create_context ------------------------ */ + +#ifndef GLX_ARB_create_context +#define GLX_ARB_create_context 1 + +#define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001 +#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 +#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define GLX_CONTEXT_FLAGS_ARB 0x2094 + +typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display* dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); + +#define glXCreateContextAttribsARB GLXEW_GET_FUN(__glewXCreateContextAttribsARB) + +#define GLXEW_ARB_create_context GLXEW_GET_VAR(__GLXEW_ARB_create_context) + +#endif /* GLX_ARB_create_context */ + +/* --------------------- GLX_ARB_create_context_profile -------------------- */ + +#ifndef GLX_ARB_create_context_profile +#define GLX_ARB_create_context_profile 1 + +#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 + +#define GLXEW_ARB_create_context_profile GLXEW_GET_VAR(__GLXEW_ARB_create_context_profile) + +#endif /* GLX_ARB_create_context_profile */ + +/* ------------------- GLX_ARB_create_context_robustness ------------------- */ + +#ifndef GLX_ARB_create_context_robustness +#define GLX_ARB_create_context_robustness 1 + +#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261 + +#define GLXEW_ARB_create_context_robustness GLXEW_GET_VAR(__GLXEW_ARB_create_context_robustness) + +#endif /* GLX_ARB_create_context_robustness */ + +/* ------------------------- GLX_ARB_fbconfig_float ------------------------ */ + +#ifndef GLX_ARB_fbconfig_float +#define GLX_ARB_fbconfig_float 1 + +#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004 +#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9 + +#define GLXEW_ARB_fbconfig_float GLXEW_GET_VAR(__GLXEW_ARB_fbconfig_float) + +#endif /* GLX_ARB_fbconfig_float */ + +/* ------------------------ GLX_ARB_framebuffer_sRGB ----------------------- */ + +#ifndef GLX_ARB_framebuffer_sRGB +#define GLX_ARB_framebuffer_sRGB 1 + +#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2 + +#define GLXEW_ARB_framebuffer_sRGB GLXEW_GET_VAR(__GLXEW_ARB_framebuffer_sRGB) + +#endif /* GLX_ARB_framebuffer_sRGB */ + +/* ------------------------ GLX_ARB_get_proc_address ----------------------- */ + +#ifndef GLX_ARB_get_proc_address +#define GLX_ARB_get_proc_address 1 + +extern void ( * glXGetProcAddressARB (const GLubyte *procName)) (void); + +#define GLXEW_ARB_get_proc_address GLXEW_GET_VAR(__GLXEW_ARB_get_proc_address) + +#endif /* GLX_ARB_get_proc_address */ + +/* -------------------------- GLX_ARB_multisample -------------------------- */ + +#ifndef GLX_ARB_multisample +#define GLX_ARB_multisample 1 + +#define GLX_SAMPLE_BUFFERS_ARB 100000 +#define GLX_SAMPLES_ARB 100001 + +#define GLXEW_ARB_multisample GLXEW_GET_VAR(__GLXEW_ARB_multisample) + +#endif /* GLX_ARB_multisample */ + +/* ---------------- GLX_ARB_robustness_application_isolation --------------- */ + +#ifndef GLX_ARB_robustness_application_isolation +#define GLX_ARB_robustness_application_isolation 1 + +#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 + +#define GLXEW_ARB_robustness_application_isolation GLXEW_GET_VAR(__GLXEW_ARB_robustness_application_isolation) + +#endif /* GLX_ARB_robustness_application_isolation */ + +/* ---------------- GLX_ARB_robustness_share_group_isolation --------------- */ + +#ifndef GLX_ARB_robustness_share_group_isolation +#define GLX_ARB_robustness_share_group_isolation 1 + +#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 + +#define GLXEW_ARB_robustness_share_group_isolation GLXEW_GET_VAR(__GLXEW_ARB_robustness_share_group_isolation) + +#endif /* GLX_ARB_robustness_share_group_isolation */ + +/* ---------------------- GLX_ARB_vertex_buffer_object --------------------- */ + +#ifndef GLX_ARB_vertex_buffer_object +#define GLX_ARB_vertex_buffer_object 1 + +#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095 + +#define GLXEW_ARB_vertex_buffer_object GLXEW_GET_VAR(__GLXEW_ARB_vertex_buffer_object) + +#endif /* GLX_ARB_vertex_buffer_object */ + +/* ----------------------- GLX_ATI_pixel_format_float ---------------------- */ + +#ifndef GLX_ATI_pixel_format_float +#define GLX_ATI_pixel_format_float 1 + +#define GLX_RGBA_FLOAT_ATI_BIT 0x00000100 + +#define GLXEW_ATI_pixel_format_float GLXEW_GET_VAR(__GLXEW_ATI_pixel_format_float) + +#endif /* GLX_ATI_pixel_format_float */ + +/* ------------------------- GLX_ATI_render_texture ------------------------ */ + +#ifndef GLX_ATI_render_texture +#define GLX_ATI_render_texture 1 + +#define GLX_BIND_TO_TEXTURE_RGB_ATI 0x9800 +#define GLX_BIND_TO_TEXTURE_RGBA_ATI 0x9801 +#define GLX_TEXTURE_FORMAT_ATI 0x9802 +#define GLX_TEXTURE_TARGET_ATI 0x9803 +#define GLX_MIPMAP_TEXTURE_ATI 0x9804 +#define GLX_TEXTURE_RGB_ATI 0x9805 +#define GLX_TEXTURE_RGBA_ATI 0x9806 +#define GLX_NO_TEXTURE_ATI 0x9807 +#define GLX_TEXTURE_CUBE_MAP_ATI 0x9808 +#define GLX_TEXTURE_1D_ATI 0x9809 +#define GLX_TEXTURE_2D_ATI 0x980A +#define GLX_MIPMAP_LEVEL_ATI 0x980B +#define GLX_CUBE_MAP_FACE_ATI 0x980C +#define GLX_TEXTURE_CUBE_MAP_POSITIVE_X_ATI 0x980D +#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_X_ATI 0x980E +#define GLX_TEXTURE_CUBE_MAP_POSITIVE_Y_ATI 0x980F +#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Y_ATI 0x9810 +#define GLX_TEXTURE_CUBE_MAP_POSITIVE_Z_ATI 0x9811 +#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Z_ATI 0x9812 +#define GLX_FRONT_LEFT_ATI 0x9813 +#define GLX_FRONT_RIGHT_ATI 0x9814 +#define GLX_BACK_LEFT_ATI 0x9815 +#define GLX_BACK_RIGHT_ATI 0x9816 +#define GLX_AUX0_ATI 0x9817 +#define GLX_AUX1_ATI 0x9818 +#define GLX_AUX2_ATI 0x9819 +#define GLX_AUX3_ATI 0x981A +#define GLX_AUX4_ATI 0x981B +#define GLX_AUX5_ATI 0x981C +#define GLX_AUX6_ATI 0x981D +#define GLX_AUX7_ATI 0x981E +#define GLX_AUX8_ATI 0x981F +#define GLX_AUX9_ATI 0x9820 +#define GLX_BIND_TO_TEXTURE_LUMINANCE_ATI 0x9821 +#define GLX_BIND_TO_TEXTURE_INTENSITY_ATI 0x9822 + +typedef void ( * PFNGLXBINDTEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer); +typedef void ( * PFNGLXDRAWABLEATTRIBATIPROC) (Display *dpy, GLXDrawable draw, const int *attrib_list); +typedef void ( * PFNGLXRELEASETEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer); + +#define glXBindTexImageATI GLXEW_GET_FUN(__glewXBindTexImageATI) +#define glXDrawableAttribATI GLXEW_GET_FUN(__glewXDrawableAttribATI) +#define glXReleaseTexImageATI GLXEW_GET_FUN(__glewXReleaseTexImageATI) + +#define GLXEW_ATI_render_texture GLXEW_GET_VAR(__GLXEW_ATI_render_texture) + +#endif /* GLX_ATI_render_texture */ + +/* --------------------------- GLX_EXT_buffer_age -------------------------- */ + +#ifndef GLX_EXT_buffer_age +#define GLX_EXT_buffer_age 1 + +#define GLX_BACK_BUFFER_AGE_EXT 0x20F4 + +#define GLXEW_EXT_buffer_age GLXEW_GET_VAR(__GLXEW_EXT_buffer_age) + +#endif /* GLX_EXT_buffer_age */ + +/* ------------------- GLX_EXT_create_context_es2_profile ------------------ */ + +#ifndef GLX_EXT_create_context_es2_profile +#define GLX_EXT_create_context_es2_profile 1 + +#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 + +#define GLXEW_EXT_create_context_es2_profile GLXEW_GET_VAR(__GLXEW_EXT_create_context_es2_profile) + +#endif /* GLX_EXT_create_context_es2_profile */ + +/* ------------------- GLX_EXT_create_context_es_profile ------------------- */ + +#ifndef GLX_EXT_create_context_es_profile +#define GLX_EXT_create_context_es_profile 1 + +#define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 + +#define GLXEW_EXT_create_context_es_profile GLXEW_GET_VAR(__GLXEW_EXT_create_context_es_profile) + +#endif /* GLX_EXT_create_context_es_profile */ + +/* --------------------- GLX_EXT_fbconfig_packed_float --------------------- */ + +#ifndef GLX_EXT_fbconfig_packed_float +#define GLX_EXT_fbconfig_packed_float 1 + +#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008 +#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1 + +#define GLXEW_EXT_fbconfig_packed_float GLXEW_GET_VAR(__GLXEW_EXT_fbconfig_packed_float) + +#endif /* GLX_EXT_fbconfig_packed_float */ + +/* ------------------------ GLX_EXT_framebuffer_sRGB ----------------------- */ + +#ifndef GLX_EXT_framebuffer_sRGB +#define GLX_EXT_framebuffer_sRGB 1 + +#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2 + +#define GLXEW_EXT_framebuffer_sRGB GLXEW_GET_VAR(__GLXEW_EXT_framebuffer_sRGB) + +#endif /* GLX_EXT_framebuffer_sRGB */ + +/* ------------------------- GLX_EXT_import_context ------------------------ */ + +#ifndef GLX_EXT_import_context +#define GLX_EXT_import_context 1 + +#define GLX_SHARE_CONTEXT_EXT 0x800A +#define GLX_VISUAL_ID_EXT 0x800B +#define GLX_SCREEN_EXT 0x800C + +typedef XID GLXContextID; + +typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display* dpy, GLXContext context); +typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context); +typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display* dpy, GLXContextID contextID); +typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display* dpy, GLXContext context, int attribute,int *value); + +#define glXFreeContextEXT GLXEW_GET_FUN(__glewXFreeContextEXT) +#define glXGetContextIDEXT GLXEW_GET_FUN(__glewXGetContextIDEXT) +#define glXImportContextEXT GLXEW_GET_FUN(__glewXImportContextEXT) +#define glXQueryContextInfoEXT GLXEW_GET_FUN(__glewXQueryContextInfoEXT) + +#define GLXEW_EXT_import_context GLXEW_GET_VAR(__GLXEW_EXT_import_context) + +#endif /* GLX_EXT_import_context */ + +/* -------------------------- GLX_EXT_scene_marker ------------------------- */ + +#ifndef GLX_EXT_scene_marker +#define GLX_EXT_scene_marker 1 + +#define GLXEW_EXT_scene_marker GLXEW_GET_VAR(__GLXEW_EXT_scene_marker) + +#endif /* GLX_EXT_scene_marker */ + +/* -------------------------- GLX_EXT_stereo_tree -------------------------- */ + +#ifndef GLX_EXT_stereo_tree +#define GLX_EXT_stereo_tree 1 + +#define GLX_STEREO_NOTIFY_EXT 0x00000000 +#define GLX_STEREO_NOTIFY_MASK_EXT 0x00000001 +#define GLX_STEREO_TREE_EXT 0x20F5 + +#define GLXEW_EXT_stereo_tree GLXEW_GET_VAR(__GLXEW_EXT_stereo_tree) + +#endif /* GLX_EXT_stereo_tree */ + +/* -------------------------- GLX_EXT_swap_control ------------------------- */ + +#ifndef GLX_EXT_swap_control +#define GLX_EXT_swap_control 1 + +#define GLX_SWAP_INTERVAL_EXT 0x20F1 +#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2 + +typedef void ( * PFNGLXSWAPINTERVALEXTPROC) (Display* dpy, GLXDrawable drawable, int interval); + +#define glXSwapIntervalEXT GLXEW_GET_FUN(__glewXSwapIntervalEXT) + +#define GLXEW_EXT_swap_control GLXEW_GET_VAR(__GLXEW_EXT_swap_control) + +#endif /* GLX_EXT_swap_control */ + +/* ----------------------- GLX_EXT_swap_control_tear ----------------------- */ + +#ifndef GLX_EXT_swap_control_tear +#define GLX_EXT_swap_control_tear 1 + +#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3 + +#define GLXEW_EXT_swap_control_tear GLXEW_GET_VAR(__GLXEW_EXT_swap_control_tear) + +#endif /* GLX_EXT_swap_control_tear */ + +/* ---------------------- GLX_EXT_texture_from_pixmap ---------------------- */ + +#ifndef GLX_EXT_texture_from_pixmap +#define GLX_EXT_texture_from_pixmap 1 + +#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 +#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 +#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 +#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 +#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 +#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 +#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 +#define GLX_Y_INVERTED_EXT 0x20D4 +#define GLX_TEXTURE_FORMAT_EXT 0x20D5 +#define GLX_TEXTURE_TARGET_EXT 0x20D6 +#define GLX_MIPMAP_TEXTURE_EXT 0x20D7 +#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 +#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 +#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA +#define GLX_TEXTURE_1D_EXT 0x20DB +#define GLX_TEXTURE_2D_EXT 0x20DC +#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD +#define GLX_FRONT_LEFT_EXT 0x20DE +#define GLX_FRONT_RIGHT_EXT 0x20DF +#define GLX_BACK_LEFT_EXT 0x20E0 +#define GLX_BACK_RIGHT_EXT 0x20E1 +#define GLX_AUX0_EXT 0x20E2 +#define GLX_AUX1_EXT 0x20E3 +#define GLX_AUX2_EXT 0x20E4 +#define GLX_AUX3_EXT 0x20E5 +#define GLX_AUX4_EXT 0x20E6 +#define GLX_AUX5_EXT 0x20E7 +#define GLX_AUX6_EXT 0x20E8 +#define GLX_AUX7_EXT 0x20E9 +#define GLX_AUX8_EXT 0x20EA +#define GLX_AUX9_EXT 0x20EB + +typedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer, const int *attrib_list); +typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer); + +#define glXBindTexImageEXT GLXEW_GET_FUN(__glewXBindTexImageEXT) +#define glXReleaseTexImageEXT GLXEW_GET_FUN(__glewXReleaseTexImageEXT) + +#define GLXEW_EXT_texture_from_pixmap GLXEW_GET_VAR(__GLXEW_EXT_texture_from_pixmap) + +#endif /* GLX_EXT_texture_from_pixmap */ + +/* -------------------------- GLX_EXT_visual_info -------------------------- */ + +#ifndef GLX_EXT_visual_info +#define GLX_EXT_visual_info 1 + +#define GLX_X_VISUAL_TYPE_EXT 0x22 +#define GLX_TRANSPARENT_TYPE_EXT 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 +#define GLX_NONE_EXT 0x8000 +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 + +#define GLXEW_EXT_visual_info GLXEW_GET_VAR(__GLXEW_EXT_visual_info) + +#endif /* GLX_EXT_visual_info */ + +/* ------------------------- GLX_EXT_visual_rating ------------------------- */ + +#ifndef GLX_EXT_visual_rating +#define GLX_EXT_visual_rating 1 + +#define GLX_VISUAL_CAVEAT_EXT 0x20 +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D + +#define GLXEW_EXT_visual_rating GLXEW_GET_VAR(__GLXEW_EXT_visual_rating) + +#endif /* GLX_EXT_visual_rating */ + +/* -------------------------- GLX_INTEL_swap_event ------------------------- */ + +#ifndef GLX_INTEL_swap_event +#define GLX_INTEL_swap_event 1 + +#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180 +#define GLX_COPY_COMPLETE_INTEL 0x8181 +#define GLX_FLIP_COMPLETE_INTEL 0x8182 +#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000 + +#define GLXEW_INTEL_swap_event GLXEW_GET_VAR(__GLXEW_INTEL_swap_event) + +#endif /* GLX_INTEL_swap_event */ + +/* -------------------------- GLX_MESA_agp_offset -------------------------- */ + +#ifndef GLX_MESA_agp_offset +#define GLX_MESA_agp_offset 1 + +typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void* pointer); + +#define glXGetAGPOffsetMESA GLXEW_GET_FUN(__glewXGetAGPOffsetMESA) + +#define GLXEW_MESA_agp_offset GLXEW_GET_VAR(__GLXEW_MESA_agp_offset) + +#endif /* GLX_MESA_agp_offset */ + +/* ------------------------ GLX_MESA_copy_sub_buffer ----------------------- */ + +#ifndef GLX_MESA_copy_sub_buffer +#define GLX_MESA_copy_sub_buffer 1 + +typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display* dpy, GLXDrawable drawable, int x, int y, int width, int height); + +#define glXCopySubBufferMESA GLXEW_GET_FUN(__glewXCopySubBufferMESA) + +#define GLXEW_MESA_copy_sub_buffer GLXEW_GET_VAR(__GLXEW_MESA_copy_sub_buffer) + +#endif /* GLX_MESA_copy_sub_buffer */ + +/* ------------------------ GLX_MESA_pixmap_colormap ----------------------- */ + +#ifndef GLX_MESA_pixmap_colormap +#define GLX_MESA_pixmap_colormap 1 + +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display* dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); + +#define glXCreateGLXPixmapMESA GLXEW_GET_FUN(__glewXCreateGLXPixmapMESA) + +#define GLXEW_MESA_pixmap_colormap GLXEW_GET_VAR(__GLXEW_MESA_pixmap_colormap) + +#endif /* GLX_MESA_pixmap_colormap */ + +/* ------------------------ GLX_MESA_query_renderer ------------------------ */ + +#ifndef GLX_MESA_query_renderer +#define GLX_MESA_query_renderer 1 + +#define GLX_RENDERER_VENDOR_ID_MESA 0x8183 +#define GLX_RENDERER_DEVICE_ID_MESA 0x8184 +#define GLX_RENDERER_VERSION_MESA 0x8185 +#define GLX_RENDERER_ACCELERATED_MESA 0x8186 +#define GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187 +#define GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188 +#define GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189 +#define GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A +#define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B +#define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C +#define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D +#define GLX_RENDERER_ID_MESA 0x818E + +typedef Bool ( * PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int* value); +typedef const char* ( * PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC) (int attribute); +typedef Bool ( * PFNGLXQUERYRENDERERINTEGERMESAPROC) (Display* dpy, int screen, int renderer, int attribute, unsigned int *value); +typedef const char* ( * PFNGLXQUERYRENDERERSTRINGMESAPROC) (Display *dpy, int screen, int renderer, int attribute); + +#define glXQueryCurrentRendererIntegerMESA GLXEW_GET_FUN(__glewXQueryCurrentRendererIntegerMESA) +#define glXQueryCurrentRendererStringMESA GLXEW_GET_FUN(__glewXQueryCurrentRendererStringMESA) +#define glXQueryRendererIntegerMESA GLXEW_GET_FUN(__glewXQueryRendererIntegerMESA) +#define glXQueryRendererStringMESA GLXEW_GET_FUN(__glewXQueryRendererStringMESA) + +#define GLXEW_MESA_query_renderer GLXEW_GET_VAR(__GLXEW_MESA_query_renderer) + +#endif /* GLX_MESA_query_renderer */ + +/* ------------------------ GLX_MESA_release_buffers ----------------------- */ + +#ifndef GLX_MESA_release_buffers +#define GLX_MESA_release_buffers 1 + +typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display* dpy, GLXDrawable d); + +#define glXReleaseBuffersMESA GLXEW_GET_FUN(__glewXReleaseBuffersMESA) + +#define GLXEW_MESA_release_buffers GLXEW_GET_VAR(__GLXEW_MESA_release_buffers) + +#endif /* GLX_MESA_release_buffers */ + +/* ------------------------- GLX_MESA_set_3dfx_mode ------------------------ */ + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_MESA_set_3dfx_mode 1 + +#define GLX_3DFX_WINDOW_MODE_MESA 0x1 +#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 + +typedef GLboolean ( * PFNGLXSET3DFXMODEMESAPROC) (GLint mode); + +#define glXSet3DfxModeMESA GLXEW_GET_FUN(__glewXSet3DfxModeMESA) + +#define GLXEW_MESA_set_3dfx_mode GLXEW_GET_VAR(__GLXEW_MESA_set_3dfx_mode) + +#endif /* GLX_MESA_set_3dfx_mode */ + +/* ------------------------- GLX_MESA_swap_control ------------------------- */ + +#ifndef GLX_MESA_swap_control +#define GLX_MESA_swap_control 1 + +typedef int ( * PFNGLXGETSWAPINTERVALMESAPROC) (void); +typedef int ( * PFNGLXSWAPINTERVALMESAPROC) (unsigned int interval); + +#define glXGetSwapIntervalMESA GLXEW_GET_FUN(__glewXGetSwapIntervalMESA) +#define glXSwapIntervalMESA GLXEW_GET_FUN(__glewXSwapIntervalMESA) + +#define GLXEW_MESA_swap_control GLXEW_GET_VAR(__GLXEW_MESA_swap_control) + +#endif /* GLX_MESA_swap_control */ + +/* --------------------------- GLX_NV_copy_buffer -------------------------- */ + +#ifndef GLX_NV_copy_buffer +#define GLX_NV_copy_buffer 1 + +typedef void ( * PFNGLXCOPYBUFFERSUBDATANVPROC) (Display* dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void ( * PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display* dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); + +#define glXCopyBufferSubDataNV GLXEW_GET_FUN(__glewXCopyBufferSubDataNV) +#define glXNamedCopyBufferSubDataNV GLXEW_GET_FUN(__glewXNamedCopyBufferSubDataNV) + +#define GLXEW_NV_copy_buffer GLXEW_GET_VAR(__GLXEW_NV_copy_buffer) + +#endif /* GLX_NV_copy_buffer */ + +/* --------------------------- GLX_NV_copy_image --------------------------- */ + +#ifndef GLX_NV_copy_image +#define GLX_NV_copy_image 1 + +typedef void ( * PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); + +#define glXCopyImageSubDataNV GLXEW_GET_FUN(__glewXCopyImageSubDataNV) + +#define GLXEW_NV_copy_image GLXEW_GET_VAR(__GLXEW_NV_copy_image) + +#endif /* GLX_NV_copy_image */ + +/* ------------------------ GLX_NV_delay_before_swap ----------------------- */ + +#ifndef GLX_NV_delay_before_swap +#define GLX_NV_delay_before_swap 1 + +typedef Bool ( * PFNGLXDELAYBEFORESWAPNVPROC) (Display* dpy, GLXDrawable drawable, GLfloat seconds); + +#define glXDelayBeforeSwapNV GLXEW_GET_FUN(__glewXDelayBeforeSwapNV) + +#define GLXEW_NV_delay_before_swap GLXEW_GET_VAR(__GLXEW_NV_delay_before_swap) + +#endif /* GLX_NV_delay_before_swap */ + +/* -------------------------- GLX_NV_float_buffer -------------------------- */ + +#ifndef GLX_NV_float_buffer +#define GLX_NV_float_buffer 1 + +#define GLX_FLOAT_COMPONENTS_NV 0x20B0 + +#define GLXEW_NV_float_buffer GLXEW_GET_VAR(__GLXEW_NV_float_buffer) + +#endif /* GLX_NV_float_buffer */ + +/* ---------------------- GLX_NV_multisample_coverage ---------------------- */ + +#ifndef GLX_NV_multisample_coverage +#define GLX_NV_multisample_coverage 1 + +#define GLX_COLOR_SAMPLES_NV 0x20B3 +#define GLX_COVERAGE_SAMPLES_NV 100001 + +#define GLXEW_NV_multisample_coverage GLXEW_GET_VAR(__GLXEW_NV_multisample_coverage) + +#endif /* GLX_NV_multisample_coverage */ + +/* -------------------------- GLX_NV_present_video ------------------------- */ + +#ifndef GLX_NV_present_video +#define GLX_NV_present_video 1 + +#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0 + +typedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display* dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list); +typedef unsigned int* ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements); + +#define glXBindVideoDeviceNV GLXEW_GET_FUN(__glewXBindVideoDeviceNV) +#define glXEnumerateVideoDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoDevicesNV) + +#define GLXEW_NV_present_video GLXEW_GET_VAR(__GLXEW_NV_present_video) + +#endif /* GLX_NV_present_video */ + +/* --------------------------- GLX_NV_swap_group --------------------------- */ + +#ifndef GLX_NV_swap_group +#define GLX_NV_swap_group 1 + +typedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display* dpy, GLuint group, GLuint barrier); +typedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint group); +typedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display* dpy, int screen, GLuint *count); +typedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display* dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers); +typedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier); +typedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display* dpy, int screen); + +#define glXBindSwapBarrierNV GLXEW_GET_FUN(__glewXBindSwapBarrierNV) +#define glXJoinSwapGroupNV GLXEW_GET_FUN(__glewXJoinSwapGroupNV) +#define glXQueryFrameCountNV GLXEW_GET_FUN(__glewXQueryFrameCountNV) +#define glXQueryMaxSwapGroupsNV GLXEW_GET_FUN(__glewXQueryMaxSwapGroupsNV) +#define glXQuerySwapGroupNV GLXEW_GET_FUN(__glewXQuerySwapGroupNV) +#define glXResetFrameCountNV GLXEW_GET_FUN(__glewXResetFrameCountNV) + +#define GLXEW_NV_swap_group GLXEW_GET_VAR(__GLXEW_NV_swap_group) + +#endif /* GLX_NV_swap_group */ + +/* ----------------------- GLX_NV_vertex_array_range ----------------------- */ + +#ifndef GLX_NV_vertex_array_range +#define GLX_NV_vertex_array_range 1 + +typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority); +typedef void ( * PFNGLXFREEMEMORYNVPROC) (void *pointer); + +#define glXAllocateMemoryNV GLXEW_GET_FUN(__glewXAllocateMemoryNV) +#define glXFreeMemoryNV GLXEW_GET_FUN(__glewXFreeMemoryNV) + +#define GLXEW_NV_vertex_array_range GLXEW_GET_VAR(__GLXEW_NV_vertex_array_range) + +#endif /* GLX_NV_vertex_array_range */ + +/* -------------------------- GLX_NV_video_capture ------------------------- */ + +#ifndef GLX_NV_video_capture +#define GLX_NV_video_capture 1 + +#define GLX_DEVICE_ID_NV 0x20CD +#define GLX_UNIQUE_ID_NV 0x20CE +#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF + +typedef XID GLXVideoCaptureDeviceNV; + +typedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display* dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device); +typedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display* dpy, int screen, int *nelements); +typedef void ( * PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device); +typedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value); +typedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device); + +#define glXBindVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXBindVideoCaptureDeviceNV) +#define glXEnumerateVideoCaptureDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoCaptureDevicesNV) +#define glXLockVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXLockVideoCaptureDeviceNV) +#define glXQueryVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXQueryVideoCaptureDeviceNV) +#define glXReleaseVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoCaptureDeviceNV) + +#define GLXEW_NV_video_capture GLXEW_GET_VAR(__GLXEW_NV_video_capture) + +#endif /* GLX_NV_video_capture */ + +/* ---------------------------- GLX_NV_video_out --------------------------- */ + +#ifndef GLX_NV_video_out +#define GLX_NV_video_out 1 + +#define GLX_VIDEO_OUT_COLOR_NV 0x20C3 +#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4 +#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5 +#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 +#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 +#define GLX_VIDEO_OUT_FRAME_NV 0x20C8 +#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9 +#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA +#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB +#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC + +typedef int ( * PFNGLXBINDVIDEOIMAGENVPROC) (Display* dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer); +typedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display* dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice); +typedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +typedef int ( * PFNGLXRELEASEVIDEODEVICENVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice); +typedef int ( * PFNGLXRELEASEVIDEOIMAGENVPROC) (Display* dpy, GLXPbuffer pbuf); +typedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display* dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock); + +#define glXBindVideoImageNV GLXEW_GET_FUN(__glewXBindVideoImageNV) +#define glXGetVideoDeviceNV GLXEW_GET_FUN(__glewXGetVideoDeviceNV) +#define glXGetVideoInfoNV GLXEW_GET_FUN(__glewXGetVideoInfoNV) +#define glXReleaseVideoDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoDeviceNV) +#define glXReleaseVideoImageNV GLXEW_GET_FUN(__glewXReleaseVideoImageNV) +#define glXSendPbufferToVideoNV GLXEW_GET_FUN(__glewXSendPbufferToVideoNV) + +#define GLXEW_NV_video_out GLXEW_GET_VAR(__GLXEW_NV_video_out) + +#endif /* GLX_NV_video_out */ + +/* -------------------------- GLX_OML_swap_method -------------------------- */ + +#ifndef GLX_OML_swap_method +#define GLX_OML_swap_method 1 + +#define GLX_SWAP_METHOD_OML 0x8060 +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 + +#define GLXEW_OML_swap_method GLXEW_GET_VAR(__GLXEW_OML_swap_method) + +#endif /* GLX_OML_swap_method */ + +/* -------------------------- GLX_OML_sync_control ------------------------- */ + +#ifndef GLX_OML_sync_control +#define GLX_OML_sync_control 1 + +typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display* dpy, GLXDrawable drawable, int32_t* numerator, int32_t* denominator); +typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t* ust, int64_t* msc, int64_t* sbc); +typedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); +typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t* ust, int64_t* msc, int64_t* sbc); +typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_sbc, int64_t* ust, int64_t* msc, int64_t* sbc); + +#define glXGetMscRateOML GLXEW_GET_FUN(__glewXGetMscRateOML) +#define glXGetSyncValuesOML GLXEW_GET_FUN(__glewXGetSyncValuesOML) +#define glXSwapBuffersMscOML GLXEW_GET_FUN(__glewXSwapBuffersMscOML) +#define glXWaitForMscOML GLXEW_GET_FUN(__glewXWaitForMscOML) +#define glXWaitForSbcOML GLXEW_GET_FUN(__glewXWaitForSbcOML) + +#define GLXEW_OML_sync_control GLXEW_GET_VAR(__GLXEW_OML_sync_control) + +#endif /* GLX_OML_sync_control */ + +/* ------------------------ GLX_SGIS_blended_overlay ----------------------- */ + +#ifndef GLX_SGIS_blended_overlay +#define GLX_SGIS_blended_overlay 1 + +#define GLX_BLENDED_RGBA_SGIS 0x8025 + +#define GLXEW_SGIS_blended_overlay GLXEW_GET_VAR(__GLXEW_SGIS_blended_overlay) + +#endif /* GLX_SGIS_blended_overlay */ + +/* -------------------------- GLX_SGIS_color_range ------------------------- */ + +#ifndef GLX_SGIS_color_range +#define GLX_SGIS_color_range 1 + +#define GLXEW_SGIS_color_range GLXEW_GET_VAR(__GLXEW_SGIS_color_range) + +#endif /* GLX_SGIS_color_range */ + +/* -------------------------- GLX_SGIS_multisample ------------------------- */ + +#ifndef GLX_SGIS_multisample +#define GLX_SGIS_multisample 1 + +#define GLX_SAMPLE_BUFFERS_SGIS 100000 +#define GLX_SAMPLES_SGIS 100001 + +#define GLXEW_SGIS_multisample GLXEW_GET_VAR(__GLXEW_SGIS_multisample) + +#endif /* GLX_SGIS_multisample */ + +/* ---------------------- GLX_SGIS_shared_multisample ---------------------- */ + +#ifndef GLX_SGIS_shared_multisample +#define GLX_SGIS_shared_multisample 1 + +#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 +#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 + +#define GLXEW_SGIS_shared_multisample GLXEW_GET_VAR(__GLXEW_SGIS_shared_multisample) + +#endif /* GLX_SGIS_shared_multisample */ + +/* --------------------------- GLX_SGIX_fbconfig --------------------------- */ + +#ifndef GLX_SGIX_fbconfig +#define GLX_SGIX_fbconfig 1 + +#define GLX_RGBA_BIT_SGIX 0x00000001 +#define GLX_WINDOW_BIT_SGIX 0x00000001 +#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 +#define GLX_PIXMAP_BIT_SGIX 0x00000002 +#define GLX_SCREEN_EXT 0x800C +#define GLX_DRAWABLE_TYPE_SGIX 0x8010 +#define GLX_RENDER_TYPE_SGIX 0x8011 +#define GLX_X_RENDERABLE_SGIX 0x8012 +#define GLX_FBCONFIG_ID_SGIX 0x8013 +#define GLX_RGBA_TYPE_SGIX 0x8014 +#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 + +typedef XID GLXFBConfigIDSGIX; +typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; + +typedef GLXFBConfigSGIX* ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); +typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, Pixmap pixmap); +typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display* dpy, GLXFBConfigSGIX config, int attribute, int *value); +typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display* dpy, XVisualInfo *vis); +typedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfig config); + +#define glXChooseFBConfigSGIX GLXEW_GET_FUN(__glewXChooseFBConfigSGIX) +#define glXCreateContextWithConfigSGIX GLXEW_GET_FUN(__glewXCreateContextWithConfigSGIX) +#define glXCreateGLXPixmapWithConfigSGIX GLXEW_GET_FUN(__glewXCreateGLXPixmapWithConfigSGIX) +#define glXGetFBConfigAttribSGIX GLXEW_GET_FUN(__glewXGetFBConfigAttribSGIX) +#define glXGetFBConfigFromVisualSGIX GLXEW_GET_FUN(__glewXGetFBConfigFromVisualSGIX) +#define glXGetVisualFromFBConfigSGIX GLXEW_GET_FUN(__glewXGetVisualFromFBConfigSGIX) + +#define GLXEW_SGIX_fbconfig GLXEW_GET_VAR(__GLXEW_SGIX_fbconfig) + +#endif /* GLX_SGIX_fbconfig */ + +/* --------------------------- GLX_SGIX_hyperpipe -------------------------- */ + +#ifndef GLX_SGIX_hyperpipe +#define GLX_SGIX_hyperpipe 1 + +#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001 +#define GLX_PIPE_RECT_SGIX 0x00000001 +#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002 +#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002 +#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003 +#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004 +#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80 +#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91 +#define GLX_BAD_HYPERPIPE_SGIX 92 +#define GLX_HYPERPIPE_ID_SGIX 0x8030 + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int networkId; +} GLXHyperpipeNetworkSGIX; +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int XOrigin; + int YOrigin; + int maxHeight; + int maxWidth; +} GLXPipeRectLimits; +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int channel; + unsigned int participationType; + int timeSlice; +} GLXHyperpipeConfigSGIX; +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int srcXOrigin; + int srcYOrigin; + int srcWidth; + int srcHeight; + int destXOrigin; + int destYOrigin; + int destWidth; + int destHeight; +} GLXPipeRect; + +typedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId); +typedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId); +typedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList); +typedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId); +typedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList); +typedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList); +typedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes); +typedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes); + +#define glXBindHyperpipeSGIX GLXEW_GET_FUN(__glewXBindHyperpipeSGIX) +#define glXDestroyHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXDestroyHyperpipeConfigSGIX) +#define glXHyperpipeAttribSGIX GLXEW_GET_FUN(__glewXHyperpipeAttribSGIX) +#define glXHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXHyperpipeConfigSGIX) +#define glXQueryHyperpipeAttribSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeAttribSGIX) +#define glXQueryHyperpipeBestAttribSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeBestAttribSGIX) +#define glXQueryHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeConfigSGIX) +#define glXQueryHyperpipeNetworkSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeNetworkSGIX) + +#define GLXEW_SGIX_hyperpipe GLXEW_GET_VAR(__GLXEW_SGIX_hyperpipe) + +#endif /* GLX_SGIX_hyperpipe */ + +/* ---------------------------- GLX_SGIX_pbuffer --------------------------- */ + +#ifndef GLX_SGIX_pbuffer +#define GLX_SGIX_pbuffer 1 + +#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 +#define GLX_PBUFFER_BIT_SGIX 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 +#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 +#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 +#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 +#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 +#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 +#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 +#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 +#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 +#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A +#define GLX_PRESERVED_CONTENTS_SGIX 0x801B +#define GLX_LARGEST_PBUFFER_SGIX 0x801C +#define GLX_WIDTH_SGIX 0x801D +#define GLX_HEIGHT_SGIX 0x801E +#define GLX_EVENT_MASK_SGIX 0x801F +#define GLX_DAMAGED_SGIX 0x8020 +#define GLX_SAVED_SGIX 0x8021 +#define GLX_WINDOW_SGIX 0x8022 +#define GLX_PBUFFER_SGIX 0x8023 +#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 + +typedef XID GLXPbufferSGIX; +typedef struct { int type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; int event_type; int draw_type; unsigned int mask; int x, y; int width, height; int count; } GLXBufferClobberEventSGIX; + +typedef GLXPbuffer ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display* dpy, GLXFBConfig config, unsigned int width, unsigned int height, int *attrib_list); +typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf); +typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long *mask); +typedef void ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf, int attribute, unsigned int *value); +typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long mask); + +#define glXCreateGLXPbufferSGIX GLXEW_GET_FUN(__glewXCreateGLXPbufferSGIX) +#define glXDestroyGLXPbufferSGIX GLXEW_GET_FUN(__glewXDestroyGLXPbufferSGIX) +#define glXGetSelectedEventSGIX GLXEW_GET_FUN(__glewXGetSelectedEventSGIX) +#define glXQueryGLXPbufferSGIX GLXEW_GET_FUN(__glewXQueryGLXPbufferSGIX) +#define glXSelectEventSGIX GLXEW_GET_FUN(__glewXSelectEventSGIX) + +#define GLXEW_SGIX_pbuffer GLXEW_GET_VAR(__GLXEW_SGIX_pbuffer) + +#endif /* GLX_SGIX_pbuffer */ + +/* ------------------------- GLX_SGIX_swap_barrier ------------------------- */ + +#ifndef GLX_SGIX_swap_barrier +#define GLX_SGIX_swap_barrier 1 + +typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); +typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); + +#define glXBindSwapBarrierSGIX GLXEW_GET_FUN(__glewXBindSwapBarrierSGIX) +#define glXQueryMaxSwapBarriersSGIX GLXEW_GET_FUN(__glewXQueryMaxSwapBarriersSGIX) + +#define GLXEW_SGIX_swap_barrier GLXEW_GET_VAR(__GLXEW_SGIX_swap_barrier) + +#endif /* GLX_SGIX_swap_barrier */ + +/* -------------------------- GLX_SGIX_swap_group -------------------------- */ + +#ifndef GLX_SGIX_swap_group +#define GLX_SGIX_swap_group 1 + +typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); + +#define glXJoinSwapGroupSGIX GLXEW_GET_FUN(__glewXJoinSwapGroupSGIX) + +#define GLXEW_SGIX_swap_group GLXEW_GET_VAR(__GLXEW_SGIX_swap_group) + +#endif /* GLX_SGIX_swap_group */ + +/* ------------------------- GLX_SGIX_video_resize ------------------------- */ + +#ifndef GLX_SGIX_video_resize +#define GLX_SGIX_video_resize 1 + +#define GLX_SYNC_FRAME_SGIX 0x00000000 +#define GLX_SYNC_SWAP_SGIX 0x00000001 + +typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display* display, int screen, int channel, Window window); +typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int x, int y, int w, int h); +typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display* display, int screen, int channel, GLenum synctype); +typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display* display, int screen, int channel, int *x, int *y, int *w, int *h); +typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); + +#define glXBindChannelToWindowSGIX GLXEW_GET_FUN(__glewXBindChannelToWindowSGIX) +#define glXChannelRectSGIX GLXEW_GET_FUN(__glewXChannelRectSGIX) +#define glXChannelRectSyncSGIX GLXEW_GET_FUN(__glewXChannelRectSyncSGIX) +#define glXQueryChannelDeltasSGIX GLXEW_GET_FUN(__glewXQueryChannelDeltasSGIX) +#define glXQueryChannelRectSGIX GLXEW_GET_FUN(__glewXQueryChannelRectSGIX) + +#define GLXEW_SGIX_video_resize GLXEW_GET_VAR(__GLXEW_SGIX_video_resize) + +#endif /* GLX_SGIX_video_resize */ + +/* ---------------------- GLX_SGIX_visual_select_group --------------------- */ + +#ifndef GLX_SGIX_visual_select_group +#define GLX_SGIX_visual_select_group 1 + +#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 + +#define GLXEW_SGIX_visual_select_group GLXEW_GET_VAR(__GLXEW_SGIX_visual_select_group) + +#endif /* GLX_SGIX_visual_select_group */ + +/* ---------------------------- GLX_SGI_cushion ---------------------------- */ + +#ifndef GLX_SGI_cushion +#define GLX_SGI_cushion 1 + +typedef void ( * PFNGLXCUSHIONSGIPROC) (Display* dpy, Window window, float cushion); + +#define glXCushionSGI GLXEW_GET_FUN(__glewXCushionSGI) + +#define GLXEW_SGI_cushion GLXEW_GET_VAR(__GLXEW_SGI_cushion) + +#endif /* GLX_SGI_cushion */ + +/* ----------------------- GLX_SGI_make_current_read ----------------------- */ + +#ifndef GLX_SGI_make_current_read +#define GLX_SGI_make_current_read 1 + +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void); +typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display* dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); + +#define glXGetCurrentReadDrawableSGI GLXEW_GET_FUN(__glewXGetCurrentReadDrawableSGI) +#define glXMakeCurrentReadSGI GLXEW_GET_FUN(__glewXMakeCurrentReadSGI) + +#define GLXEW_SGI_make_current_read GLXEW_GET_VAR(__GLXEW_SGI_make_current_read) + +#endif /* GLX_SGI_make_current_read */ + +/* -------------------------- GLX_SGI_swap_control ------------------------- */ + +#ifndef GLX_SGI_swap_control +#define GLX_SGI_swap_control 1 + +typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval); + +#define glXSwapIntervalSGI GLXEW_GET_FUN(__glewXSwapIntervalSGI) + +#define GLXEW_SGI_swap_control GLXEW_GET_VAR(__GLXEW_SGI_swap_control) + +#endif /* GLX_SGI_swap_control */ + +/* --------------------------- GLX_SGI_video_sync -------------------------- */ + +#ifndef GLX_SGI_video_sync +#define GLX_SGI_video_sync 1 + +typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int* count); +typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int* count); + +#define glXGetVideoSyncSGI GLXEW_GET_FUN(__glewXGetVideoSyncSGI) +#define glXWaitVideoSyncSGI GLXEW_GET_FUN(__glewXWaitVideoSyncSGI) + +#define GLXEW_SGI_video_sync GLXEW_GET_VAR(__GLXEW_SGI_video_sync) + +#endif /* GLX_SGI_video_sync */ + +/* --------------------- GLX_SUN_get_transparent_index --------------------- */ + +#ifndef GLX_SUN_get_transparent_index +#define GLX_SUN_get_transparent_index 1 + +typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display* dpy, Window overlay, Window underlay, unsigned long *pTransparentIndex); + +#define glXGetTransparentIndexSUN GLXEW_GET_FUN(__glewXGetTransparentIndexSUN) + +#define GLXEW_SUN_get_transparent_index GLXEW_GET_VAR(__GLXEW_SUN_get_transparent_index) + +#endif /* GLX_SUN_get_transparent_index */ + +/* -------------------------- GLX_SUN_video_resize ------------------------- */ + +#ifndef GLX_SUN_video_resize +#define GLX_SUN_video_resize 1 + +#define GLX_VIDEO_RESIZE_SUN 0x8171 +#define GL_VIDEO_RESIZE_COMPENSATION_SUN 0x85CD + +typedef int ( * PFNGLXGETVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float* factor); +typedef int ( * PFNGLXVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float factor); + +#define glXGetVideoResizeSUN GLXEW_GET_FUN(__glewXGetVideoResizeSUN) +#define glXVideoResizeSUN GLXEW_GET_FUN(__glewXVideoResizeSUN) + +#define GLXEW_SUN_video_resize GLXEW_GET_VAR(__GLXEW_SUN_video_resize) + +#endif /* GLX_SUN_video_resize */ + +/* ------------------------------------------------------------------------- */ + +#ifdef GLEW_MX +#define GLXEW_FUN_EXPORT GLEW_FUN_EXPORT +#define GLXEW_VAR_EXPORT +#else +#define GLXEW_FUN_EXPORT GLEW_FUN_EXPORT +#define GLXEW_VAR_EXPORT GLEW_VAR_EXPORT +#endif /* GLEW_MX */ + +GLXEW_FUN_EXPORT PFNGLXGETCURRENTDISPLAYPROC __glewXGetCurrentDisplay; + +GLXEW_FUN_EXPORT PFNGLXCHOOSEFBCONFIGPROC __glewXChooseFBConfig; +GLXEW_FUN_EXPORT PFNGLXCREATENEWCONTEXTPROC __glewXCreateNewContext; +GLXEW_FUN_EXPORT PFNGLXCREATEPBUFFERPROC __glewXCreatePbuffer; +GLXEW_FUN_EXPORT PFNGLXCREATEPIXMAPPROC __glewXCreatePixmap; +GLXEW_FUN_EXPORT PFNGLXCREATEWINDOWPROC __glewXCreateWindow; +GLXEW_FUN_EXPORT PFNGLXDESTROYPBUFFERPROC __glewXDestroyPbuffer; +GLXEW_FUN_EXPORT PFNGLXDESTROYPIXMAPPROC __glewXDestroyPixmap; +GLXEW_FUN_EXPORT PFNGLXDESTROYWINDOWPROC __glewXDestroyWindow; +GLXEW_FUN_EXPORT PFNGLXGETCURRENTREADDRAWABLEPROC __glewXGetCurrentReadDrawable; +GLXEW_FUN_EXPORT PFNGLXGETFBCONFIGATTRIBPROC __glewXGetFBConfigAttrib; +GLXEW_FUN_EXPORT PFNGLXGETFBCONFIGSPROC __glewXGetFBConfigs; +GLXEW_FUN_EXPORT PFNGLXGETSELECTEDEVENTPROC __glewXGetSelectedEvent; +GLXEW_FUN_EXPORT PFNGLXGETVISUALFROMFBCONFIGPROC __glewXGetVisualFromFBConfig; +GLXEW_FUN_EXPORT PFNGLXMAKECONTEXTCURRENTPROC __glewXMakeContextCurrent; +GLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTPROC __glewXQueryContext; +GLXEW_FUN_EXPORT PFNGLXQUERYDRAWABLEPROC __glewXQueryDrawable; +GLXEW_FUN_EXPORT PFNGLXSELECTEVENTPROC __glewXSelectEvent; + +GLXEW_FUN_EXPORT PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC __glewXBlitContextFramebufferAMD; +GLXEW_FUN_EXPORT PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC __glewXCreateAssociatedContextAMD; +GLXEW_FUN_EXPORT PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __glewXCreateAssociatedContextAttribsAMD; +GLXEW_FUN_EXPORT PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC __glewXDeleteAssociatedContextAMD; +GLXEW_FUN_EXPORT PFNGLXGETCONTEXTGPUIDAMDPROC __glewXGetContextGPUIDAMD; +GLXEW_FUN_EXPORT PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC __glewXGetCurrentAssociatedContextAMD; +GLXEW_FUN_EXPORT PFNGLXGETGPUIDSAMDPROC __glewXGetGPUIDsAMD; +GLXEW_FUN_EXPORT PFNGLXGETGPUINFOAMDPROC __glewXGetGPUInfoAMD; +GLXEW_FUN_EXPORT PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __glewXMakeAssociatedContextCurrentAMD; + +GLXEW_FUN_EXPORT PFNGLXCREATECONTEXTATTRIBSARBPROC __glewXCreateContextAttribsARB; + +GLXEW_FUN_EXPORT PFNGLXBINDTEXIMAGEATIPROC __glewXBindTexImageATI; +GLXEW_FUN_EXPORT PFNGLXDRAWABLEATTRIBATIPROC __glewXDrawableAttribATI; +GLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEATIPROC __glewXReleaseTexImageATI; + +GLXEW_FUN_EXPORT PFNGLXFREECONTEXTEXTPROC __glewXFreeContextEXT; +GLXEW_FUN_EXPORT PFNGLXGETCONTEXTIDEXTPROC __glewXGetContextIDEXT; +GLXEW_FUN_EXPORT PFNGLXIMPORTCONTEXTEXTPROC __glewXImportContextEXT; +GLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTINFOEXTPROC __glewXQueryContextInfoEXT; + +GLXEW_FUN_EXPORT PFNGLXSWAPINTERVALEXTPROC __glewXSwapIntervalEXT; + +GLXEW_FUN_EXPORT PFNGLXBINDTEXIMAGEEXTPROC __glewXBindTexImageEXT; +GLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEEXTPROC __glewXReleaseTexImageEXT; + +GLXEW_FUN_EXPORT PFNGLXGETAGPOFFSETMESAPROC __glewXGetAGPOffsetMESA; + +GLXEW_FUN_EXPORT PFNGLXCOPYSUBBUFFERMESAPROC __glewXCopySubBufferMESA; + +GLXEW_FUN_EXPORT PFNGLXCREATEGLXPIXMAPMESAPROC __glewXCreateGLXPixmapMESA; + +GLXEW_FUN_EXPORT PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC __glewXQueryCurrentRendererIntegerMESA; +GLXEW_FUN_EXPORT PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC __glewXQueryCurrentRendererStringMESA; +GLXEW_FUN_EXPORT PFNGLXQUERYRENDERERINTEGERMESAPROC __glewXQueryRendererIntegerMESA; +GLXEW_FUN_EXPORT PFNGLXQUERYRENDERERSTRINGMESAPROC __glewXQueryRendererStringMESA; + +GLXEW_FUN_EXPORT PFNGLXRELEASEBUFFERSMESAPROC __glewXReleaseBuffersMESA; + +GLXEW_FUN_EXPORT PFNGLXSET3DFXMODEMESAPROC __glewXSet3DfxModeMESA; + +GLXEW_FUN_EXPORT PFNGLXGETSWAPINTERVALMESAPROC __glewXGetSwapIntervalMESA; +GLXEW_FUN_EXPORT PFNGLXSWAPINTERVALMESAPROC __glewXSwapIntervalMESA; + +GLXEW_FUN_EXPORT PFNGLXCOPYBUFFERSUBDATANVPROC __glewXCopyBufferSubDataNV; +GLXEW_FUN_EXPORT PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC __glewXNamedCopyBufferSubDataNV; + +GLXEW_FUN_EXPORT PFNGLXCOPYIMAGESUBDATANVPROC __glewXCopyImageSubDataNV; + +GLXEW_FUN_EXPORT PFNGLXDELAYBEFORESWAPNVPROC __glewXDelayBeforeSwapNV; + +GLXEW_FUN_EXPORT PFNGLXBINDVIDEODEVICENVPROC __glewXBindVideoDeviceNV; +GLXEW_FUN_EXPORT PFNGLXENUMERATEVIDEODEVICESNVPROC __glewXEnumerateVideoDevicesNV; + +GLXEW_FUN_EXPORT PFNGLXBINDSWAPBARRIERNVPROC __glewXBindSwapBarrierNV; +GLXEW_FUN_EXPORT PFNGLXJOINSWAPGROUPNVPROC __glewXJoinSwapGroupNV; +GLXEW_FUN_EXPORT PFNGLXQUERYFRAMECOUNTNVPROC __glewXQueryFrameCountNV; +GLXEW_FUN_EXPORT PFNGLXQUERYMAXSWAPGROUPSNVPROC __glewXQueryMaxSwapGroupsNV; +GLXEW_FUN_EXPORT PFNGLXQUERYSWAPGROUPNVPROC __glewXQuerySwapGroupNV; +GLXEW_FUN_EXPORT PFNGLXRESETFRAMECOUNTNVPROC __glewXResetFrameCountNV; + +GLXEW_FUN_EXPORT PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV; +GLXEW_FUN_EXPORT PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV; + +GLXEW_FUN_EXPORT PFNGLXBINDVIDEOCAPTUREDEVICENVPROC __glewXBindVideoCaptureDeviceNV; +GLXEW_FUN_EXPORT PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC __glewXEnumerateVideoCaptureDevicesNV; +GLXEW_FUN_EXPORT PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC __glewXLockVideoCaptureDeviceNV; +GLXEW_FUN_EXPORT PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC __glewXQueryVideoCaptureDeviceNV; +GLXEW_FUN_EXPORT PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC __glewXReleaseVideoCaptureDeviceNV; + +GLXEW_FUN_EXPORT PFNGLXBINDVIDEOIMAGENVPROC __glewXBindVideoImageNV; +GLXEW_FUN_EXPORT PFNGLXGETVIDEODEVICENVPROC __glewXGetVideoDeviceNV; +GLXEW_FUN_EXPORT PFNGLXGETVIDEOINFONVPROC __glewXGetVideoInfoNV; +GLXEW_FUN_EXPORT PFNGLXRELEASEVIDEODEVICENVPROC __glewXReleaseVideoDeviceNV; +GLXEW_FUN_EXPORT PFNGLXRELEASEVIDEOIMAGENVPROC __glewXReleaseVideoImageNV; +GLXEW_FUN_EXPORT PFNGLXSENDPBUFFERTOVIDEONVPROC __glewXSendPbufferToVideoNV; + +GLXEW_FUN_EXPORT PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML; +GLXEW_FUN_EXPORT PFNGLXGETSYNCVALUESOMLPROC __glewXGetSyncValuesOML; +GLXEW_FUN_EXPORT PFNGLXSWAPBUFFERSMSCOMLPROC __glewXSwapBuffersMscOML; +GLXEW_FUN_EXPORT PFNGLXWAITFORMSCOMLPROC __glewXWaitForMscOML; +GLXEW_FUN_EXPORT PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML; + +GLXEW_FUN_EXPORT PFNGLXCHOOSEFBCONFIGSGIXPROC __glewXChooseFBConfigSGIX; +GLXEW_FUN_EXPORT PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC __glewXCreateContextWithConfigSGIX; +GLXEW_FUN_EXPORT PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC __glewXCreateGLXPixmapWithConfigSGIX; +GLXEW_FUN_EXPORT PFNGLXGETFBCONFIGATTRIBSGIXPROC __glewXGetFBConfigAttribSGIX; +GLXEW_FUN_EXPORT PFNGLXGETFBCONFIGFROMVISUALSGIXPROC __glewXGetFBConfigFromVisualSGIX; +GLXEW_FUN_EXPORT PFNGLXGETVISUALFROMFBCONFIGSGIXPROC __glewXGetVisualFromFBConfigSGIX; + +GLXEW_FUN_EXPORT PFNGLXBINDHYPERPIPESGIXPROC __glewXBindHyperpipeSGIX; +GLXEW_FUN_EXPORT PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC __glewXDestroyHyperpipeConfigSGIX; +GLXEW_FUN_EXPORT PFNGLXHYPERPIPEATTRIBSGIXPROC __glewXHyperpipeAttribSGIX; +GLXEW_FUN_EXPORT PFNGLXHYPERPIPECONFIGSGIXPROC __glewXHyperpipeConfigSGIX; +GLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC __glewXQueryHyperpipeAttribSGIX; +GLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC __glewXQueryHyperpipeBestAttribSGIX; +GLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPECONFIGSGIXPROC __glewXQueryHyperpipeConfigSGIX; +GLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPENETWORKSGIXPROC __glewXQueryHyperpipeNetworkSGIX; + +GLXEW_FUN_EXPORT PFNGLXCREATEGLXPBUFFERSGIXPROC __glewXCreateGLXPbufferSGIX; +GLXEW_FUN_EXPORT PFNGLXDESTROYGLXPBUFFERSGIXPROC __glewXDestroyGLXPbufferSGIX; +GLXEW_FUN_EXPORT PFNGLXGETSELECTEDEVENTSGIXPROC __glewXGetSelectedEventSGIX; +GLXEW_FUN_EXPORT PFNGLXQUERYGLXPBUFFERSGIXPROC __glewXQueryGLXPbufferSGIX; +GLXEW_FUN_EXPORT PFNGLXSELECTEVENTSGIXPROC __glewXSelectEventSGIX; + +GLXEW_FUN_EXPORT PFNGLXBINDSWAPBARRIERSGIXPROC __glewXBindSwapBarrierSGIX; +GLXEW_FUN_EXPORT PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC __glewXQueryMaxSwapBarriersSGIX; + +GLXEW_FUN_EXPORT PFNGLXJOINSWAPGROUPSGIXPROC __glewXJoinSwapGroupSGIX; + +GLXEW_FUN_EXPORT PFNGLXBINDCHANNELTOWINDOWSGIXPROC __glewXBindChannelToWindowSGIX; +GLXEW_FUN_EXPORT PFNGLXCHANNELRECTSGIXPROC __glewXChannelRectSGIX; +GLXEW_FUN_EXPORT PFNGLXCHANNELRECTSYNCSGIXPROC __glewXChannelRectSyncSGIX; +GLXEW_FUN_EXPORT PFNGLXQUERYCHANNELDELTASSGIXPROC __glewXQueryChannelDeltasSGIX; +GLXEW_FUN_EXPORT PFNGLXQUERYCHANNELRECTSGIXPROC __glewXQueryChannelRectSGIX; + +GLXEW_FUN_EXPORT PFNGLXCUSHIONSGIPROC __glewXCushionSGI; + +GLXEW_FUN_EXPORT PFNGLXGETCURRENTREADDRAWABLESGIPROC __glewXGetCurrentReadDrawableSGI; +GLXEW_FUN_EXPORT PFNGLXMAKECURRENTREADSGIPROC __glewXMakeCurrentReadSGI; + +GLXEW_FUN_EXPORT PFNGLXSWAPINTERVALSGIPROC __glewXSwapIntervalSGI; + +GLXEW_FUN_EXPORT PFNGLXGETVIDEOSYNCSGIPROC __glewXGetVideoSyncSGI; +GLXEW_FUN_EXPORT PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI; + +GLXEW_FUN_EXPORT PFNGLXGETTRANSPARENTINDEXSUNPROC __glewXGetTransparentIndexSUN; + +GLXEW_FUN_EXPORT PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN; +GLXEW_FUN_EXPORT PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN; + +#if defined(GLEW_MX) +struct GLXEWContextStruct +{ +#endif /* GLEW_MX */ + +GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_0; +GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_1; +GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_2; +GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_3; +GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_4; +GLXEW_VAR_EXPORT GLboolean __GLXEW_3DFX_multisample; +GLXEW_VAR_EXPORT GLboolean __GLXEW_AMD_gpu_association; +GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_context_flush_control; +GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context; +GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context_profile; +GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context_robustness; +GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_fbconfig_float; +GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_framebuffer_sRGB; +GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_get_proc_address; +GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_multisample; +GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_robustness_application_isolation; +GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_robustness_share_group_isolation; +GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_vertex_buffer_object; +GLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_pixel_format_float; +GLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_render_texture; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_buffer_age; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es2_profile; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es_profile; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_fbconfig_packed_float; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_framebuffer_sRGB; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_import_context; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_scene_marker; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_stereo_tree; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control_tear; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_texture_from_pixmap; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_visual_info; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_visual_rating; +GLXEW_VAR_EXPORT GLboolean __GLXEW_INTEL_swap_event; +GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_agp_offset; +GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_copy_sub_buffer; +GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_pixmap_colormap; +GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_query_renderer; +GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_release_buffers; +GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_set_3dfx_mode; +GLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_swap_control; +GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_copy_buffer; +GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_copy_image; +GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_delay_before_swap; +GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_float_buffer; +GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_multisample_coverage; +GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_present_video; +GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_swap_group; +GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_vertex_array_range; +GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_video_capture; +GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_video_out; +GLXEW_VAR_EXPORT GLboolean __GLXEW_OML_swap_method; +GLXEW_VAR_EXPORT GLboolean __GLXEW_OML_sync_control; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_blended_overlay; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_color_range; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_multisample; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_shared_multisample; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_fbconfig; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_hyperpipe; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_pbuffer; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_swap_barrier; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_swap_group; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_video_resize; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_visual_select_group; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_cushion; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_make_current_read; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_swap_control; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_video_sync; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_get_transparent_index; +GLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_video_resize; + +#ifdef GLEW_MX +}; /* GLXEWContextStruct */ +#endif /* GLEW_MX */ + +/* ------------------------------------------------------------------------ */ + +#ifdef GLEW_MX + +typedef struct GLXEWContextStruct GLXEWContext; +GLEWAPI GLenum GLEWAPIENTRY glxewContextInit (GLXEWContext *ctx); +GLEWAPI GLboolean GLEWAPIENTRY glxewContextIsSupported (const GLXEWContext *ctx, const char *name); + +#define glxewInit() glxewContextInit(glxewGetContext()) +#define glxewIsSupported(x) glxewContextIsSupported(glxewGetContext(), x) + +#define GLXEW_GET_VAR(x) (*(const GLboolean*)&(glxewGetContext()->x)) +#define GLXEW_GET_FUN(x) x + +#else /* GLEW_MX */ + +GLEWAPI GLenum GLEWAPIENTRY glxewInit (); +GLEWAPI GLboolean GLEWAPIENTRY glxewIsSupported (const char *name); + +#define GLXEW_GET_VAR(x) (*(const GLboolean*)&x) +#define GLXEW_GET_FUN(x) x + +#endif /* GLEW_MX */ + +GLEWAPI GLboolean GLEWAPIENTRY glxewGetExtension (const char *name); + +#ifdef __cplusplus +} +#endif + +#endif /* __glxew_h__ */ diff --git a/engine/third_party/physx/snippets/graphics/include/GL/wglew.h b/engine/third_party/physx/snippets/graphics/include/GL/wglew.h new file mode 100644 index 00000000..23e4d3fb --- /dev/null +++ b/engine/third_party/physx/snippets/graphics/include/GL/wglew.h @@ -0,0 +1,1453 @@ +/* +** The OpenGL Extension Wrangler Library +** Copyright (C) 2008-2015, Nigel Stewart +** Copyright (C) 2002-2008, Milan Ikits +** Copyright (C) 2002-2008, Marcelo E. Magallon +** Copyright (C) 2002, Lev Povalahev +** 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. +** * The name of the author may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +** THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* +** Copyright (c) 2007 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#ifndef __wglew_h__ +#define __wglew_h__ +#define __WGLEW_H__ + +#ifdef __wglext_h_ +#error wglext.h included before wglew.h +#endif + +#define __wglext_h_ + +#if !defined(WINAPI) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif +#include +# undef WIN32_LEAN_AND_MEAN +#endif + +/* + * GLEW_STATIC needs to be set when using the static version. + * GLEW_BUILD is set when building the DLL version. + */ +#ifdef GLEW_STATIC +# define GLEWAPI extern +#else +# ifdef GLEW_BUILD +# define GLEWAPI extern __declspec(dllexport) +# else +# define GLEWAPI extern __declspec(dllimport) +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* -------------------------- WGL_3DFX_multisample ------------------------- */ + +#ifndef WGL_3DFX_multisample +#define WGL_3DFX_multisample 1 + +#define WGL_SAMPLE_BUFFERS_3DFX 0x2060 +#define WGL_SAMPLES_3DFX 0x2061 + +#define WGLEW_3DFX_multisample WGLEW_GET_VAR(__WGLEW_3DFX_multisample) + +#endif /* WGL_3DFX_multisample */ + +/* ------------------------- WGL_3DL_stereo_control ------------------------ */ + +#ifndef WGL_3DL_stereo_control +#define WGL_3DL_stereo_control 1 + +#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055 +#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056 +#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057 +#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058 + +typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState); + +#define wglSetStereoEmitterState3DL WGLEW_GET_FUN(__wglewSetStereoEmitterState3DL) + +#define WGLEW_3DL_stereo_control WGLEW_GET_VAR(__WGLEW_3DL_stereo_control) + +#endif /* WGL_3DL_stereo_control */ + +/* ------------------------ WGL_AMD_gpu_association ------------------------ */ + +#ifndef WGL_AMD_gpu_association +#define WGL_AMD_gpu_association 1 + +#define WGL_GPU_VENDOR_AMD 0x1F00 +#define WGL_GPU_RENDERER_STRING_AMD 0x1F01 +#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 +#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 +#define WGL_GPU_RAM_AMD 0x21A3 +#define WGL_GPU_CLOCK_AMD 0x21A4 +#define WGL_GPU_NUM_PIPES_AMD 0x21A5 +#define WGL_GPU_NUM_SIMD_AMD 0x21A6 +#define WGL_GPU_NUM_RB_AMD 0x21A7 +#define WGL_GPU_NUM_SPI_AMD 0x21A8 + +typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id); +typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int* attribList); +typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc); +typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc); +typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); +typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT* ids); +typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void* data); +typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc); + +#define wglBlitContextFramebufferAMD WGLEW_GET_FUN(__wglewBlitContextFramebufferAMD) +#define wglCreateAssociatedContextAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAMD) +#define wglCreateAssociatedContextAttribsAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAttribsAMD) +#define wglDeleteAssociatedContextAMD WGLEW_GET_FUN(__wglewDeleteAssociatedContextAMD) +#define wglGetContextGPUIDAMD WGLEW_GET_FUN(__wglewGetContextGPUIDAMD) +#define wglGetCurrentAssociatedContextAMD WGLEW_GET_FUN(__wglewGetCurrentAssociatedContextAMD) +#define wglGetGPUIDsAMD WGLEW_GET_FUN(__wglewGetGPUIDsAMD) +#define wglGetGPUInfoAMD WGLEW_GET_FUN(__wglewGetGPUInfoAMD) +#define wglMakeAssociatedContextCurrentAMD WGLEW_GET_FUN(__wglewMakeAssociatedContextCurrentAMD) + +#define WGLEW_AMD_gpu_association WGLEW_GET_VAR(__WGLEW_AMD_gpu_association) + +#endif /* WGL_AMD_gpu_association */ + +/* ------------------------- WGL_ARB_buffer_region ------------------------- */ + +#ifndef WGL_ARB_buffer_region +#define WGL_ARB_buffer_region 1 + +#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 +#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 +#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 +#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 + +typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); +typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); +typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); +typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); + +#define wglCreateBufferRegionARB WGLEW_GET_FUN(__wglewCreateBufferRegionARB) +#define wglDeleteBufferRegionARB WGLEW_GET_FUN(__wglewDeleteBufferRegionARB) +#define wglRestoreBufferRegionARB WGLEW_GET_FUN(__wglewRestoreBufferRegionARB) +#define wglSaveBufferRegionARB WGLEW_GET_FUN(__wglewSaveBufferRegionARB) + +#define WGLEW_ARB_buffer_region WGLEW_GET_VAR(__WGLEW_ARB_buffer_region) + +#endif /* WGL_ARB_buffer_region */ + +/* --------------------- WGL_ARB_context_flush_control --------------------- */ + +#ifndef WGL_ARB_context_flush_control +#define WGL_ARB_context_flush_control 1 + +#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0x0000 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 + +#define WGLEW_ARB_context_flush_control WGLEW_GET_VAR(__WGLEW_ARB_context_flush_control) + +#endif /* WGL_ARB_context_flush_control */ + +/* ------------------------- WGL_ARB_create_context ------------------------ */ + +#ifndef WGL_ARB_create_context +#define WGL_ARB_create_context 1 + +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 +#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 +#define WGL_CONTEXT_FLAGS_ARB 0x2094 +#define ERROR_INVALID_VERSION_ARB 0x2095 +#define ERROR_INVALID_PROFILE_ARB 0x2096 + +typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int* attribList); + +#define wglCreateContextAttribsARB WGLEW_GET_FUN(__wglewCreateContextAttribsARB) + +#define WGLEW_ARB_create_context WGLEW_GET_VAR(__WGLEW_ARB_create_context) + +#endif /* WGL_ARB_create_context */ + +/* --------------------- WGL_ARB_create_context_profile -------------------- */ + +#ifndef WGL_ARB_create_context_profile +#define WGL_ARB_create_context_profile 1 + +#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 + +#define WGLEW_ARB_create_context_profile WGLEW_GET_VAR(__WGLEW_ARB_create_context_profile) + +#endif /* WGL_ARB_create_context_profile */ + +/* ------------------- WGL_ARB_create_context_robustness ------------------- */ + +#ifndef WGL_ARB_create_context_robustness +#define WGL_ARB_create_context_robustness 1 + +#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 + +#define WGLEW_ARB_create_context_robustness WGLEW_GET_VAR(__WGLEW_ARB_create_context_robustness) + +#endif /* WGL_ARB_create_context_robustness */ + +/* ----------------------- WGL_ARB_extensions_string ----------------------- */ + +#ifndef WGL_ARB_extensions_string +#define WGL_ARB_extensions_string 1 + +typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); + +#define wglGetExtensionsStringARB WGLEW_GET_FUN(__wglewGetExtensionsStringARB) + +#define WGLEW_ARB_extensions_string WGLEW_GET_VAR(__WGLEW_ARB_extensions_string) + +#endif /* WGL_ARB_extensions_string */ + +/* ------------------------ WGL_ARB_framebuffer_sRGB ----------------------- */ + +#ifndef WGL_ARB_framebuffer_sRGB +#define WGL_ARB_framebuffer_sRGB 1 + +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 + +#define WGLEW_ARB_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_ARB_framebuffer_sRGB) + +#endif /* WGL_ARB_framebuffer_sRGB */ + +/* ----------------------- WGL_ARB_make_current_read ----------------------- */ + +#ifndef WGL_ARB_make_current_read +#define WGL_ARB_make_current_read 1 + +#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 +#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 + +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (VOID); +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); + +#define wglGetCurrentReadDCARB WGLEW_GET_FUN(__wglewGetCurrentReadDCARB) +#define wglMakeContextCurrentARB WGLEW_GET_FUN(__wglewMakeContextCurrentARB) + +#define WGLEW_ARB_make_current_read WGLEW_GET_VAR(__WGLEW_ARB_make_current_read) + +#endif /* WGL_ARB_make_current_read */ + +/* -------------------------- WGL_ARB_multisample -------------------------- */ + +#ifndef WGL_ARB_multisample +#define WGL_ARB_multisample 1 + +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 + +#define WGLEW_ARB_multisample WGLEW_GET_VAR(__WGLEW_ARB_multisample) + +#endif /* WGL_ARB_multisample */ + +/* ---------------------------- WGL_ARB_pbuffer ---------------------------- */ + +#ifndef WGL_ARB_pbuffer +#define WGL_ARB_pbuffer 1 + +#define WGL_DRAW_TO_PBUFFER_ARB 0x202D +#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E +#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 +#define WGL_PBUFFER_LARGEST_ARB 0x2033 +#define WGL_PBUFFER_WIDTH_ARB 0x2034 +#define WGL_PBUFFER_HEIGHT_ARB 0x2035 +#define WGL_PBUFFER_LOST_ARB 0x2036 + +DECLARE_HANDLE(HPBUFFERARB); + +typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); + +#define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB) +#define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB) +#define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB) +#define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB) +#define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB) + +#define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer) + +#endif /* WGL_ARB_pbuffer */ + +/* -------------------------- WGL_ARB_pixel_format ------------------------- */ + +#ifndef WGL_ARB_pixel_format +#define WGL_ARB_pixel_format 1 + +#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 +#define WGL_DRAW_TO_WINDOW_ARB 0x2001 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002 +#define WGL_ACCELERATION_ARB 0x2003 +#define WGL_NEED_PALETTE_ARB 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 +#define WGL_SWAP_METHOD_ARB 0x2007 +#define WGL_NUMBER_OVERLAYS_ARB 0x2008 +#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 +#define WGL_TRANSPARENT_ARB 0x200A +#define WGL_SHARE_DEPTH_ARB 0x200C +#define WGL_SHARE_STENCIL_ARB 0x200D +#define WGL_SHARE_ACCUM_ARB 0x200E +#define WGL_SUPPORT_GDI_ARB 0x200F +#define WGL_SUPPORT_OPENGL_ARB 0x2010 +#define WGL_DOUBLE_BUFFER_ARB 0x2011 +#define WGL_STEREO_ARB 0x2012 +#define WGL_PIXEL_TYPE_ARB 0x2013 +#define WGL_COLOR_BITS_ARB 0x2014 +#define WGL_RED_BITS_ARB 0x2015 +#define WGL_RED_SHIFT_ARB 0x2016 +#define WGL_GREEN_BITS_ARB 0x2017 +#define WGL_GREEN_SHIFT_ARB 0x2018 +#define WGL_BLUE_BITS_ARB 0x2019 +#define WGL_BLUE_SHIFT_ARB 0x201A +#define WGL_ALPHA_BITS_ARB 0x201B +#define WGL_ALPHA_SHIFT_ARB 0x201C +#define WGL_ACCUM_BITS_ARB 0x201D +#define WGL_ACCUM_RED_BITS_ARB 0x201E +#define WGL_ACCUM_GREEN_BITS_ARB 0x201F +#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 +#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 +#define WGL_DEPTH_BITS_ARB 0x2022 +#define WGL_STENCIL_BITS_ARB 0x2023 +#define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_NO_ACCELERATION_ARB 0x2025 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026 +#define WGL_FULL_ACCELERATION_ARB 0x2027 +#define WGL_SWAP_EXCHANGE_ARB 0x2028 +#define WGL_SWAP_COPY_ARB 0x2029 +#define WGL_SWAP_UNDEFINED_ARB 0x202A +#define WGL_TYPE_RGBA_ARB 0x202B +#define WGL_TYPE_COLORINDEX_ARB 0x202C +#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 +#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 +#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 +#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A +#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B + +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int *piValues); + +#define wglChoosePixelFormatARB WGLEW_GET_FUN(__wglewChoosePixelFormatARB) +#define wglGetPixelFormatAttribfvARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvARB) +#define wglGetPixelFormatAttribivARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribivARB) + +#define WGLEW_ARB_pixel_format WGLEW_GET_VAR(__WGLEW_ARB_pixel_format) + +#endif /* WGL_ARB_pixel_format */ + +/* ----------------------- WGL_ARB_pixel_format_float ---------------------- */ + +#ifndef WGL_ARB_pixel_format_float +#define WGL_ARB_pixel_format_float 1 + +#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 + +#define WGLEW_ARB_pixel_format_float WGLEW_GET_VAR(__WGLEW_ARB_pixel_format_float) + +#endif /* WGL_ARB_pixel_format_float */ + +/* ------------------------- WGL_ARB_render_texture ------------------------ */ + +#ifndef WGL_ARB_render_texture +#define WGL_ARB_render_texture 1 + +#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 +#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 +#define WGL_TEXTURE_FORMAT_ARB 0x2072 +#define WGL_TEXTURE_TARGET_ARB 0x2073 +#define WGL_MIPMAP_TEXTURE_ARB 0x2074 +#define WGL_TEXTURE_RGB_ARB 0x2075 +#define WGL_TEXTURE_RGBA_ARB 0x2076 +#define WGL_NO_TEXTURE_ARB 0x2077 +#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 +#define WGL_TEXTURE_1D_ARB 0x2079 +#define WGL_TEXTURE_2D_ARB 0x207A +#define WGL_MIPMAP_LEVEL_ARB 0x207B +#define WGL_CUBE_MAP_FACE_ARB 0x207C +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 +#define WGL_FRONT_LEFT_ARB 0x2083 +#define WGL_FRONT_RIGHT_ARB 0x2084 +#define WGL_BACK_LEFT_ARB 0x2085 +#define WGL_BACK_RIGHT_ARB 0x2086 +#define WGL_AUX0_ARB 0x2087 +#define WGL_AUX1_ARB 0x2088 +#define WGL_AUX2_ARB 0x2089 +#define WGL_AUX3_ARB 0x208A +#define WGL_AUX4_ARB 0x208B +#define WGL_AUX5_ARB 0x208C +#define WGL_AUX6_ARB 0x208D +#define WGL_AUX7_ARB 0x208E +#define WGL_AUX8_ARB 0x208F +#define WGL_AUX9_ARB 0x2090 + +typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int* piAttribList); + +#define wglBindTexImageARB WGLEW_GET_FUN(__wglewBindTexImageARB) +#define wglReleaseTexImageARB WGLEW_GET_FUN(__wglewReleaseTexImageARB) +#define wglSetPbufferAttribARB WGLEW_GET_FUN(__wglewSetPbufferAttribARB) + +#define WGLEW_ARB_render_texture WGLEW_GET_VAR(__WGLEW_ARB_render_texture) + +#endif /* WGL_ARB_render_texture */ + +/* ---------------- WGL_ARB_robustness_application_isolation --------------- */ + +#ifndef WGL_ARB_robustness_application_isolation +#define WGL_ARB_robustness_application_isolation 1 + +#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 + +#define WGLEW_ARB_robustness_application_isolation WGLEW_GET_VAR(__WGLEW_ARB_robustness_application_isolation) + +#endif /* WGL_ARB_robustness_application_isolation */ + +/* ---------------- WGL_ARB_robustness_share_group_isolation --------------- */ + +#ifndef WGL_ARB_robustness_share_group_isolation +#define WGL_ARB_robustness_share_group_isolation 1 + +#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 + +#define WGLEW_ARB_robustness_share_group_isolation WGLEW_GET_VAR(__WGLEW_ARB_robustness_share_group_isolation) + +#endif /* WGL_ARB_robustness_share_group_isolation */ + +/* ----------------------- WGL_ATI_pixel_format_float ---------------------- */ + +#ifndef WGL_ATI_pixel_format_float +#define WGL_ATI_pixel_format_float 1 + +#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 +#define GL_RGBA_FLOAT_MODE_ATI 0x8820 +#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 + +#define WGLEW_ATI_pixel_format_float WGLEW_GET_VAR(__WGLEW_ATI_pixel_format_float) + +#endif /* WGL_ATI_pixel_format_float */ + +/* -------------------- WGL_ATI_render_texture_rectangle ------------------- */ + +#ifndef WGL_ATI_render_texture_rectangle +#define WGL_ATI_render_texture_rectangle 1 + +#define WGL_TEXTURE_RECTANGLE_ATI 0x21A5 + +#define WGLEW_ATI_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_ATI_render_texture_rectangle) + +#endif /* WGL_ATI_render_texture_rectangle */ + +/* ------------------- WGL_EXT_create_context_es2_profile ------------------ */ + +#ifndef WGL_EXT_create_context_es2_profile +#define WGL_EXT_create_context_es2_profile 1 + +#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 + +#define WGLEW_EXT_create_context_es2_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es2_profile) + +#endif /* WGL_EXT_create_context_es2_profile */ + +/* ------------------- WGL_EXT_create_context_es_profile ------------------- */ + +#ifndef WGL_EXT_create_context_es_profile +#define WGL_EXT_create_context_es_profile 1 + +#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 + +#define WGLEW_EXT_create_context_es_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es_profile) + +#endif /* WGL_EXT_create_context_es_profile */ + +/* -------------------------- WGL_EXT_depth_float -------------------------- */ + +#ifndef WGL_EXT_depth_float +#define WGL_EXT_depth_float 1 + +#define WGL_DEPTH_FLOAT_EXT 0x2040 + +#define WGLEW_EXT_depth_float WGLEW_GET_VAR(__WGLEW_EXT_depth_float) + +#endif /* WGL_EXT_depth_float */ + +/* ---------------------- WGL_EXT_display_color_table ---------------------- */ + +#ifndef WGL_EXT_display_color_table +#define WGL_EXT_display_color_table 1 + +typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef void (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (GLushort* table, GLuint length); + +#define wglBindDisplayColorTableEXT WGLEW_GET_FUN(__wglewBindDisplayColorTableEXT) +#define wglCreateDisplayColorTableEXT WGLEW_GET_FUN(__wglewCreateDisplayColorTableEXT) +#define wglDestroyDisplayColorTableEXT WGLEW_GET_FUN(__wglewDestroyDisplayColorTableEXT) +#define wglLoadDisplayColorTableEXT WGLEW_GET_FUN(__wglewLoadDisplayColorTableEXT) + +#define WGLEW_EXT_display_color_table WGLEW_GET_VAR(__WGLEW_EXT_display_color_table) + +#endif /* WGL_EXT_display_color_table */ + +/* ----------------------- WGL_EXT_extensions_string ----------------------- */ + +#ifndef WGL_EXT_extensions_string +#define WGL_EXT_extensions_string 1 + +typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); + +#define wglGetExtensionsStringEXT WGLEW_GET_FUN(__wglewGetExtensionsStringEXT) + +#define WGLEW_EXT_extensions_string WGLEW_GET_VAR(__WGLEW_EXT_extensions_string) + +#endif /* WGL_EXT_extensions_string */ + +/* ------------------------ WGL_EXT_framebuffer_sRGB ----------------------- */ + +#ifndef WGL_EXT_framebuffer_sRGB +#define WGL_EXT_framebuffer_sRGB 1 + +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9 + +#define WGLEW_EXT_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_EXT_framebuffer_sRGB) + +#endif /* WGL_EXT_framebuffer_sRGB */ + +/* ----------------------- WGL_EXT_make_current_read ----------------------- */ + +#ifndef WGL_EXT_make_current_read +#define WGL_EXT_make_current_read 1 + +#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 + +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (VOID); +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); + +#define wglGetCurrentReadDCEXT WGLEW_GET_FUN(__wglewGetCurrentReadDCEXT) +#define wglMakeContextCurrentEXT WGLEW_GET_FUN(__wglewMakeContextCurrentEXT) + +#define WGLEW_EXT_make_current_read WGLEW_GET_VAR(__WGLEW_EXT_make_current_read) + +#endif /* WGL_EXT_make_current_read */ + +/* -------------------------- WGL_EXT_multisample -------------------------- */ + +#ifndef WGL_EXT_multisample +#define WGL_EXT_multisample 1 + +#define WGL_SAMPLE_BUFFERS_EXT 0x2041 +#define WGL_SAMPLES_EXT 0x2042 + +#define WGLEW_EXT_multisample WGLEW_GET_VAR(__WGLEW_EXT_multisample) + +#endif /* WGL_EXT_multisample */ + +/* ---------------------------- WGL_EXT_pbuffer ---------------------------- */ + +#ifndef WGL_EXT_pbuffer +#define WGL_EXT_pbuffer 1 + +#define WGL_DRAW_TO_PBUFFER_EXT 0x202D +#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E +#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 +#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 +#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 +#define WGL_PBUFFER_LARGEST_EXT 0x2033 +#define WGL_PBUFFER_WIDTH_EXT 0x2034 +#define WGL_PBUFFER_HEIGHT_EXT 0x2035 + +DECLARE_HANDLE(HPBUFFEREXT); + +typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int* piValue); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); + +#define wglCreatePbufferEXT WGLEW_GET_FUN(__wglewCreatePbufferEXT) +#define wglDestroyPbufferEXT WGLEW_GET_FUN(__wglewDestroyPbufferEXT) +#define wglGetPbufferDCEXT WGLEW_GET_FUN(__wglewGetPbufferDCEXT) +#define wglQueryPbufferEXT WGLEW_GET_FUN(__wglewQueryPbufferEXT) +#define wglReleasePbufferDCEXT WGLEW_GET_FUN(__wglewReleasePbufferDCEXT) + +#define WGLEW_EXT_pbuffer WGLEW_GET_VAR(__WGLEW_EXT_pbuffer) + +#endif /* WGL_EXT_pbuffer */ + +/* -------------------------- WGL_EXT_pixel_format ------------------------- */ + +#ifndef WGL_EXT_pixel_format +#define WGL_EXT_pixel_format 1 + +#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 +#define WGL_DRAW_TO_WINDOW_EXT 0x2001 +#define WGL_DRAW_TO_BITMAP_EXT 0x2002 +#define WGL_ACCELERATION_EXT 0x2003 +#define WGL_NEED_PALETTE_EXT 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 +#define WGL_SWAP_METHOD_EXT 0x2007 +#define WGL_NUMBER_OVERLAYS_EXT 0x2008 +#define WGL_NUMBER_UNDERLAYS_EXT 0x2009 +#define WGL_TRANSPARENT_EXT 0x200A +#define WGL_TRANSPARENT_VALUE_EXT 0x200B +#define WGL_SHARE_DEPTH_EXT 0x200C +#define WGL_SHARE_STENCIL_EXT 0x200D +#define WGL_SHARE_ACCUM_EXT 0x200E +#define WGL_SUPPORT_GDI_EXT 0x200F +#define WGL_SUPPORT_OPENGL_EXT 0x2010 +#define WGL_DOUBLE_BUFFER_EXT 0x2011 +#define WGL_STEREO_EXT 0x2012 +#define WGL_PIXEL_TYPE_EXT 0x2013 +#define WGL_COLOR_BITS_EXT 0x2014 +#define WGL_RED_BITS_EXT 0x2015 +#define WGL_RED_SHIFT_EXT 0x2016 +#define WGL_GREEN_BITS_EXT 0x2017 +#define WGL_GREEN_SHIFT_EXT 0x2018 +#define WGL_BLUE_BITS_EXT 0x2019 +#define WGL_BLUE_SHIFT_EXT 0x201A +#define WGL_ALPHA_BITS_EXT 0x201B +#define WGL_ALPHA_SHIFT_EXT 0x201C +#define WGL_ACCUM_BITS_EXT 0x201D +#define WGL_ACCUM_RED_BITS_EXT 0x201E +#define WGL_ACCUM_GREEN_BITS_EXT 0x201F +#define WGL_ACCUM_BLUE_BITS_EXT 0x2020 +#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 +#define WGL_DEPTH_BITS_EXT 0x2022 +#define WGL_STENCIL_BITS_EXT 0x2023 +#define WGL_AUX_BUFFERS_EXT 0x2024 +#define WGL_NO_ACCELERATION_EXT 0x2025 +#define WGL_GENERIC_ACCELERATION_EXT 0x2026 +#define WGL_FULL_ACCELERATION_EXT 0x2027 +#define WGL_SWAP_EXCHANGE_EXT 0x2028 +#define WGL_SWAP_COPY_EXT 0x2029 +#define WGL_SWAP_UNDEFINED_EXT 0x202A +#define WGL_TYPE_RGBA_EXT 0x202B +#define WGL_TYPE_COLORINDEX_EXT 0x202C + +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues); + +#define wglChoosePixelFormatEXT WGLEW_GET_FUN(__wglewChoosePixelFormatEXT) +#define wglGetPixelFormatAttribfvEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvEXT) +#define wglGetPixelFormatAttribivEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribivEXT) + +#define WGLEW_EXT_pixel_format WGLEW_GET_VAR(__WGLEW_EXT_pixel_format) + +#endif /* WGL_EXT_pixel_format */ + +/* ------------------- WGL_EXT_pixel_format_packed_float ------------------- */ + +#ifndef WGL_EXT_pixel_format_packed_float +#define WGL_EXT_pixel_format_packed_float 1 + +#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 + +#define WGLEW_EXT_pixel_format_packed_float WGLEW_GET_VAR(__WGLEW_EXT_pixel_format_packed_float) + +#endif /* WGL_EXT_pixel_format_packed_float */ + +/* -------------------------- WGL_EXT_swap_control ------------------------- */ + +#ifndef WGL_EXT_swap_control +#define WGL_EXT_swap_control 1 + +typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); +typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); + +#define wglGetSwapIntervalEXT WGLEW_GET_FUN(__wglewGetSwapIntervalEXT) +#define wglSwapIntervalEXT WGLEW_GET_FUN(__wglewSwapIntervalEXT) + +#define WGLEW_EXT_swap_control WGLEW_GET_VAR(__WGLEW_EXT_swap_control) + +#endif /* WGL_EXT_swap_control */ + +/* ----------------------- WGL_EXT_swap_control_tear ----------------------- */ + +#ifndef WGL_EXT_swap_control_tear +#define WGL_EXT_swap_control_tear 1 + +#define WGLEW_EXT_swap_control_tear WGLEW_GET_VAR(__WGLEW_EXT_swap_control_tear) + +#endif /* WGL_EXT_swap_control_tear */ + +/* --------------------- WGL_I3D_digital_video_control --------------------- */ + +#ifndef WGL_I3D_digital_video_control +#define WGL_I3D_digital_video_control 1 + +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 +#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 +#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 + +typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue); +typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue); + +#define wglGetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewGetDigitalVideoParametersI3D) +#define wglSetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewSetDigitalVideoParametersI3D) + +#define WGLEW_I3D_digital_video_control WGLEW_GET_VAR(__WGLEW_I3D_digital_video_control) + +#endif /* WGL_I3D_digital_video_control */ + +/* ----------------------------- WGL_I3D_gamma ----------------------------- */ + +#ifndef WGL_I3D_gamma +#define WGL_I3D_gamma 1 + +#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E +#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F + +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT *puGreen, USHORT *puBlue); +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT *puGreen, const USHORT *puBlue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue); + +#define wglGetGammaTableI3D WGLEW_GET_FUN(__wglewGetGammaTableI3D) +#define wglGetGammaTableParametersI3D WGLEW_GET_FUN(__wglewGetGammaTableParametersI3D) +#define wglSetGammaTableI3D WGLEW_GET_FUN(__wglewSetGammaTableI3D) +#define wglSetGammaTableParametersI3D WGLEW_GET_FUN(__wglewSetGammaTableParametersI3D) + +#define WGLEW_I3D_gamma WGLEW_GET_VAR(__WGLEW_I3D_gamma) + +#endif /* WGL_I3D_gamma */ + +/* ---------------------------- WGL_I3D_genlock ---------------------------- */ + +#ifndef WGL_I3D_genlock +#define WGL_I3D_genlock 1 + +#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 +#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045 +#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046 +#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047 +#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 +#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 +#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A +#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B +#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C + +typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT* uRate); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT* uDelay); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT* uEdge); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT* uSource); +typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL* pFlag); +typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT *uMaxPixelDelay); + +#define wglDisableGenlockI3D WGLEW_GET_FUN(__wglewDisableGenlockI3D) +#define wglEnableGenlockI3D WGLEW_GET_FUN(__wglewEnableGenlockI3D) +#define wglGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGenlockSampleRateI3D) +#define wglGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGenlockSourceDelayI3D) +#define wglGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGenlockSourceEdgeI3D) +#define wglGenlockSourceI3D WGLEW_GET_FUN(__wglewGenlockSourceI3D) +#define wglGetGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGetGenlockSampleRateI3D) +#define wglGetGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGetGenlockSourceDelayI3D) +#define wglGetGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGetGenlockSourceEdgeI3D) +#define wglGetGenlockSourceI3D WGLEW_GET_FUN(__wglewGetGenlockSourceI3D) +#define wglIsEnabledGenlockI3D WGLEW_GET_FUN(__wglewIsEnabledGenlockI3D) +#define wglQueryGenlockMaxSourceDelayI3D WGLEW_GET_FUN(__wglewQueryGenlockMaxSourceDelayI3D) + +#define WGLEW_I3D_genlock WGLEW_GET_VAR(__WGLEW_I3D_genlock) + +#endif /* WGL_I3D_genlock */ + +/* -------------------------- WGL_I3D_image_buffer ------------------------- */ + +#ifndef WGL_I3D_image_buffer +#define WGL_I3D_image_buffer 1 + +#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 +#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 + +typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, HANDLE* pEvent, LPVOID *pAddress, DWORD *pSize, UINT count); +typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); +typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); +typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* pAddress, UINT count); + +#define wglAssociateImageBufferEventsI3D WGLEW_GET_FUN(__wglewAssociateImageBufferEventsI3D) +#define wglCreateImageBufferI3D WGLEW_GET_FUN(__wglewCreateImageBufferI3D) +#define wglDestroyImageBufferI3D WGLEW_GET_FUN(__wglewDestroyImageBufferI3D) +#define wglReleaseImageBufferEventsI3D WGLEW_GET_FUN(__wglewReleaseImageBufferEventsI3D) + +#define WGLEW_I3D_image_buffer WGLEW_GET_VAR(__WGLEW_I3D_image_buffer) + +#endif /* WGL_I3D_image_buffer */ + +/* ------------------------ WGL_I3D_swap_frame_lock ------------------------ */ + +#ifndef WGL_I3D_swap_frame_lock +#define WGL_I3D_swap_frame_lock 1 + +typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (VOID); +typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (VOID); +typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL* pFlag); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag); + +#define wglDisableFrameLockI3D WGLEW_GET_FUN(__wglewDisableFrameLockI3D) +#define wglEnableFrameLockI3D WGLEW_GET_FUN(__wglewEnableFrameLockI3D) +#define wglIsEnabledFrameLockI3D WGLEW_GET_FUN(__wglewIsEnabledFrameLockI3D) +#define wglQueryFrameLockMasterI3D WGLEW_GET_FUN(__wglewQueryFrameLockMasterI3D) + +#define WGLEW_I3D_swap_frame_lock WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_lock) + +#endif /* WGL_I3D_swap_frame_lock */ + +/* ------------------------ WGL_I3D_swap_frame_usage ----------------------- */ + +#ifndef WGL_I3D_swap_frame_usage +#define WGL_I3D_swap_frame_usage 1 + +typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float* pUsage); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); + +#define wglBeginFrameTrackingI3D WGLEW_GET_FUN(__wglewBeginFrameTrackingI3D) +#define wglEndFrameTrackingI3D WGLEW_GET_FUN(__wglewEndFrameTrackingI3D) +#define wglGetFrameUsageI3D WGLEW_GET_FUN(__wglewGetFrameUsageI3D) +#define wglQueryFrameTrackingI3D WGLEW_GET_FUN(__wglewQueryFrameTrackingI3D) + +#define WGLEW_I3D_swap_frame_usage WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_usage) + +#endif /* WGL_I3D_swap_frame_usage */ + +/* --------------------------- WGL_NV_DX_interop --------------------------- */ + +#ifndef WGL_NV_DX_interop +#define WGL_NV_DX_interop 1 + +#define WGL_ACCESS_READ_ONLY_NV 0x0000 +#define WGL_ACCESS_READ_WRITE_NV 0x0001 +#define WGL_ACCESS_WRITE_DISCARD_NV 0x0002 + +typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice); +typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects); +typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access); +typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void* dxDevice); +typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void* dxObject, GLuint name, GLenum type, GLenum access); +typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void* dxObject, HANDLE shareHandle); +typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects); +typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject); + +#define wglDXCloseDeviceNV WGLEW_GET_FUN(__wglewDXCloseDeviceNV) +#define wglDXLockObjectsNV WGLEW_GET_FUN(__wglewDXLockObjectsNV) +#define wglDXObjectAccessNV WGLEW_GET_FUN(__wglewDXObjectAccessNV) +#define wglDXOpenDeviceNV WGLEW_GET_FUN(__wglewDXOpenDeviceNV) +#define wglDXRegisterObjectNV WGLEW_GET_FUN(__wglewDXRegisterObjectNV) +#define wglDXSetResourceShareHandleNV WGLEW_GET_FUN(__wglewDXSetResourceShareHandleNV) +#define wglDXUnlockObjectsNV WGLEW_GET_FUN(__wglewDXUnlockObjectsNV) +#define wglDXUnregisterObjectNV WGLEW_GET_FUN(__wglewDXUnregisterObjectNV) + +#define WGLEW_NV_DX_interop WGLEW_GET_VAR(__WGLEW_NV_DX_interop) + +#endif /* WGL_NV_DX_interop */ + +/* --------------------------- WGL_NV_DX_interop2 -------------------------- */ + +#ifndef WGL_NV_DX_interop2 +#define WGL_NV_DX_interop2 1 + +#define WGLEW_NV_DX_interop2 WGLEW_GET_VAR(__WGLEW_NV_DX_interop2) + +#endif /* WGL_NV_DX_interop2 */ + +/* --------------------------- WGL_NV_copy_image --------------------------- */ + +#ifndef WGL_NV_copy_image +#define WGL_NV_copy_image 1 + +typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); + +#define wglCopyImageSubDataNV WGLEW_GET_FUN(__wglewCopyImageSubDataNV) + +#define WGLEW_NV_copy_image WGLEW_GET_VAR(__WGLEW_NV_copy_image) + +#endif /* WGL_NV_copy_image */ + +/* ------------------------ WGL_NV_delay_before_swap ----------------------- */ + +#ifndef WGL_NV_delay_before_swap +#define WGL_NV_delay_before_swap 1 + +typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds); + +#define wglDelayBeforeSwapNV WGLEW_GET_FUN(__wglewDelayBeforeSwapNV) + +#define WGLEW_NV_delay_before_swap WGLEW_GET_VAR(__WGLEW_NV_delay_before_swap) + +#endif /* WGL_NV_delay_before_swap */ + +/* -------------------------- WGL_NV_float_buffer -------------------------- */ + +#ifndef WGL_NV_float_buffer +#define WGL_NV_float_buffer 1 + +#define WGL_FLOAT_COMPONENTS_NV 0x20B0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 +#define WGL_TEXTURE_FLOAT_R_NV 0x20B5 +#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 +#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 +#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 + +#define WGLEW_NV_float_buffer WGLEW_GET_VAR(__WGLEW_NV_float_buffer) + +#endif /* WGL_NV_float_buffer */ + +/* -------------------------- WGL_NV_gpu_affinity -------------------------- */ + +#ifndef WGL_NV_gpu_affinity +#define WGL_NV_gpu_affinity 1 + +#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0 +#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1 + +DECLARE_HANDLE(HGPUNV); +typedef struct _GPU_DEVICE { + DWORD cb; + CHAR DeviceName[32]; + CHAR DeviceString[128]; + DWORD Flags; + RECT rcVirtualScreen; +} GPU_DEVICE, *PGPU_DEVICE; + +typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList); +typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc); +typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); +typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); +typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu); + +#define wglCreateAffinityDCNV WGLEW_GET_FUN(__wglewCreateAffinityDCNV) +#define wglDeleteDCNV WGLEW_GET_FUN(__wglewDeleteDCNV) +#define wglEnumGpuDevicesNV WGLEW_GET_FUN(__wglewEnumGpuDevicesNV) +#define wglEnumGpusFromAffinityDCNV WGLEW_GET_FUN(__wglewEnumGpusFromAffinityDCNV) +#define wglEnumGpusNV WGLEW_GET_FUN(__wglewEnumGpusNV) + +#define WGLEW_NV_gpu_affinity WGLEW_GET_VAR(__WGLEW_NV_gpu_affinity) + +#endif /* WGL_NV_gpu_affinity */ + +/* ---------------------- WGL_NV_multisample_coverage ---------------------- */ + +#ifndef WGL_NV_multisample_coverage +#define WGL_NV_multisample_coverage 1 + +#define WGL_COVERAGE_SAMPLES_NV 0x2042 +#define WGL_COLOR_SAMPLES_NV 0x20B9 + +#define WGLEW_NV_multisample_coverage WGLEW_GET_VAR(__WGLEW_NV_multisample_coverage) + +#endif /* WGL_NV_multisample_coverage */ + +/* -------------------------- WGL_NV_present_video ------------------------- */ + +#ifndef WGL_NV_present_video +#define WGL_NV_present_video 1 + +#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 + +DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); + +typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int* piAttribList); +typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV* phDeviceList); +typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int* piValue); + +#define wglBindVideoDeviceNV WGLEW_GET_FUN(__wglewBindVideoDeviceNV) +#define wglEnumerateVideoDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoDevicesNV) +#define wglQueryCurrentContextNV WGLEW_GET_FUN(__wglewQueryCurrentContextNV) + +#define WGLEW_NV_present_video WGLEW_GET_VAR(__WGLEW_NV_present_video) + +#endif /* WGL_NV_present_video */ + +/* ---------------------- WGL_NV_render_depth_texture ---------------------- */ + +#ifndef WGL_NV_render_depth_texture +#define WGL_NV_render_depth_texture 1 + +#define WGL_NO_TEXTURE_ARB 0x2077 +#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 +#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 +#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 +#define WGL_DEPTH_COMPONENT_NV 0x20A7 + +#define WGLEW_NV_render_depth_texture WGLEW_GET_VAR(__WGLEW_NV_render_depth_texture) + +#endif /* WGL_NV_render_depth_texture */ + +/* -------------------- WGL_NV_render_texture_rectangle -------------------- */ + +#ifndef WGL_NV_render_texture_rectangle +#define WGL_NV_render_texture_rectangle 1 + +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 +#define WGL_TEXTURE_RECTANGLE_NV 0x20A2 + +#define WGLEW_NV_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_NV_render_texture_rectangle) + +#endif /* WGL_NV_render_texture_rectangle */ + +/* --------------------------- WGL_NV_swap_group --------------------------- */ + +#ifndef WGL_NV_swap_group +#define WGL_NV_swap_group 1 + +typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier); +typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint* count); +typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint* maxGroups, GLuint *maxBarriers); +typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint* group, GLuint *barrier); +typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC); + +#define wglBindSwapBarrierNV WGLEW_GET_FUN(__wglewBindSwapBarrierNV) +#define wglJoinSwapGroupNV WGLEW_GET_FUN(__wglewJoinSwapGroupNV) +#define wglQueryFrameCountNV WGLEW_GET_FUN(__wglewQueryFrameCountNV) +#define wglQueryMaxSwapGroupsNV WGLEW_GET_FUN(__wglewQueryMaxSwapGroupsNV) +#define wglQuerySwapGroupNV WGLEW_GET_FUN(__wglewQuerySwapGroupNV) +#define wglResetFrameCountNV WGLEW_GET_FUN(__wglewResetFrameCountNV) + +#define WGLEW_NV_swap_group WGLEW_GET_VAR(__WGLEW_NV_swap_group) + +#endif /* WGL_NV_swap_group */ + +/* ----------------------- WGL_NV_vertex_array_range ----------------------- */ + +#ifndef WGL_NV_vertex_array_range +#define WGL_NV_vertex_array_range 1 + +typedef void * (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority); +typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); + +#define wglAllocateMemoryNV WGLEW_GET_FUN(__wglewAllocateMemoryNV) +#define wglFreeMemoryNV WGLEW_GET_FUN(__wglewFreeMemoryNV) + +#define WGLEW_NV_vertex_array_range WGLEW_GET_VAR(__WGLEW_NV_vertex_array_range) + +#endif /* WGL_NV_vertex_array_range */ + +/* -------------------------- WGL_NV_video_capture ------------------------- */ + +#ifndef WGL_NV_video_capture +#define WGL_NV_video_capture 1 + +#define WGL_UNIQUE_ID_NV 0x20CE +#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF + +DECLARE_HANDLE(HVIDEOINPUTDEVICENV); + +typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); +typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV* phDeviceList); +typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int* piValue); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); + +#define wglBindVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewBindVideoCaptureDeviceNV) +#define wglEnumerateVideoCaptureDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoCaptureDevicesNV) +#define wglLockVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewLockVideoCaptureDeviceNV) +#define wglQueryVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewQueryVideoCaptureDeviceNV) +#define wglReleaseVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoCaptureDeviceNV) + +#define WGLEW_NV_video_capture WGLEW_GET_VAR(__WGLEW_NV_video_capture) + +#endif /* WGL_NV_video_capture */ + +/* -------------------------- WGL_NV_video_output -------------------------- */ + +#ifndef WGL_NV_video_output +#define WGL_NV_video_output 1 + +#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0 +#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1 +#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2 +#define WGL_VIDEO_OUT_COLOR_NV 0x20C3 +#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4 +#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5 +#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 +#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 +#define WGL_VIDEO_OUT_FRAME 0x20C8 +#define WGL_VIDEO_OUT_FIELD_1 0x20C9 +#define WGL_VIDEO_OUT_FIELD_2 0x20CA +#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB +#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC + +DECLARE_HANDLE(HPVIDEODEV); + +typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); +typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV* hVideoDevice); +typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long* pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer); +typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long* pulCounterPbuffer, BOOL bBlock); + +#define wglBindVideoImageNV WGLEW_GET_FUN(__wglewBindVideoImageNV) +#define wglGetVideoDeviceNV WGLEW_GET_FUN(__wglewGetVideoDeviceNV) +#define wglGetVideoInfoNV WGLEW_GET_FUN(__wglewGetVideoInfoNV) +#define wglReleaseVideoDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoDeviceNV) +#define wglReleaseVideoImageNV WGLEW_GET_FUN(__wglewReleaseVideoImageNV) +#define wglSendPbufferToVideoNV WGLEW_GET_FUN(__wglewSendPbufferToVideoNV) + +#define WGLEW_NV_video_output WGLEW_GET_VAR(__WGLEW_NV_video_output) + +#endif /* WGL_NV_video_output */ + +/* -------------------------- WGL_OML_sync_control ------------------------- */ + +#ifndef WGL_OML_sync_control +#define WGL_OML_sync_control 1 + +typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32 *denominator); +typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64 *msc, INT64 *sbc); +typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64 *msc, INT64 *sbc); + +#define wglGetMscRateOML WGLEW_GET_FUN(__wglewGetMscRateOML) +#define wglGetSyncValuesOML WGLEW_GET_FUN(__wglewGetSyncValuesOML) +#define wglSwapBuffersMscOML WGLEW_GET_FUN(__wglewSwapBuffersMscOML) +#define wglSwapLayerBuffersMscOML WGLEW_GET_FUN(__wglewSwapLayerBuffersMscOML) +#define wglWaitForMscOML WGLEW_GET_FUN(__wglewWaitForMscOML) +#define wglWaitForSbcOML WGLEW_GET_FUN(__wglewWaitForSbcOML) + +#define WGLEW_OML_sync_control WGLEW_GET_VAR(__WGLEW_OML_sync_control) + +#endif /* WGL_OML_sync_control */ + +/* ------------------------------------------------------------------------- */ + +#ifdef GLEW_MX +#define WGLEW_FUN_EXPORT +#define WGLEW_VAR_EXPORT +#else +#define WGLEW_FUN_EXPORT GLEW_FUN_EXPORT +#define WGLEW_VAR_EXPORT GLEW_VAR_EXPORT +#endif /* GLEW_MX */ + +#ifdef GLEW_MX +struct WGLEWContextStruct +{ +#endif /* GLEW_MX */ + +WGLEW_FUN_EXPORT PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL; + +WGLEW_FUN_EXPORT PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD; +WGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC __wglewCreateAssociatedContextAMD; +WGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __wglewCreateAssociatedContextAttribsAMD; +WGLEW_FUN_EXPORT PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD; +WGLEW_FUN_EXPORT PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD; +WGLEW_FUN_EXPORT PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD; +WGLEW_FUN_EXPORT PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD; +WGLEW_FUN_EXPORT PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD; +WGLEW_FUN_EXPORT PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD; + +WGLEW_FUN_EXPORT PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB; +WGLEW_FUN_EXPORT PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB; +WGLEW_FUN_EXPORT PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB; +WGLEW_FUN_EXPORT PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB; + +WGLEW_FUN_EXPORT PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB; + +WGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB; + +WGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB; +WGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB; + +WGLEW_FUN_EXPORT PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB; +WGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB; +WGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB; +WGLEW_FUN_EXPORT PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB; +WGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB; + +WGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB; +WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB; +WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB; + +WGLEW_FUN_EXPORT PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB; +WGLEW_FUN_EXPORT PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB; +WGLEW_FUN_EXPORT PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB; + +WGLEW_FUN_EXPORT PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT; +WGLEW_FUN_EXPORT PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT; +WGLEW_FUN_EXPORT PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT; +WGLEW_FUN_EXPORT PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT; + +WGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT; + +WGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT; +WGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT; + +WGLEW_FUN_EXPORT PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT; +WGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT; +WGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT; +WGLEW_FUN_EXPORT PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT; +WGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT; + +WGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT; +WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT; +WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT; + +WGLEW_FUN_EXPORT PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT; +WGLEW_FUN_EXPORT PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT; + +WGLEW_FUN_EXPORT PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D; +WGLEW_FUN_EXPORT PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D; + +WGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D; +WGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D; +WGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D; +WGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D; + +WGLEW_FUN_EXPORT PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D; +WGLEW_FUN_EXPORT PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D; +WGLEW_FUN_EXPORT PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D; +WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D; +WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D; +WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D; +WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D; +WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D; +WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D; +WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D; +WGLEW_FUN_EXPORT PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D; +WGLEW_FUN_EXPORT PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D; + +WGLEW_FUN_EXPORT PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D; +WGLEW_FUN_EXPORT PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D; +WGLEW_FUN_EXPORT PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D; +WGLEW_FUN_EXPORT PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D; + +WGLEW_FUN_EXPORT PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D; +WGLEW_FUN_EXPORT PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D; +WGLEW_FUN_EXPORT PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D; +WGLEW_FUN_EXPORT PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D; + +WGLEW_FUN_EXPORT PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D; +WGLEW_FUN_EXPORT PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D; +WGLEW_FUN_EXPORT PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D; +WGLEW_FUN_EXPORT PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D; + +WGLEW_FUN_EXPORT PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV; +WGLEW_FUN_EXPORT PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV; +WGLEW_FUN_EXPORT PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV; +WGLEW_FUN_EXPORT PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV; +WGLEW_FUN_EXPORT PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV; +WGLEW_FUN_EXPORT PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV; +WGLEW_FUN_EXPORT PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV; +WGLEW_FUN_EXPORT PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV; + +WGLEW_FUN_EXPORT PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV; + +WGLEW_FUN_EXPORT PFNWGLDELAYBEFORESWAPNVPROC __wglewDelayBeforeSwapNV; + +WGLEW_FUN_EXPORT PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV; +WGLEW_FUN_EXPORT PFNWGLDELETEDCNVPROC __wglewDeleteDCNV; +WGLEW_FUN_EXPORT PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV; +WGLEW_FUN_EXPORT PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV; +WGLEW_FUN_EXPORT PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV; + +WGLEW_FUN_EXPORT PFNWGLBINDVIDEODEVICENVPROC __wglewBindVideoDeviceNV; +WGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEODEVICESNVPROC __wglewEnumerateVideoDevicesNV; +WGLEW_FUN_EXPORT PFNWGLQUERYCURRENTCONTEXTNVPROC __wglewQueryCurrentContextNV; + +WGLEW_FUN_EXPORT PFNWGLBINDSWAPBARRIERNVPROC __wglewBindSwapBarrierNV; +WGLEW_FUN_EXPORT PFNWGLJOINSWAPGROUPNVPROC __wglewJoinSwapGroupNV; +WGLEW_FUN_EXPORT PFNWGLQUERYFRAMECOUNTNVPROC __wglewQueryFrameCountNV; +WGLEW_FUN_EXPORT PFNWGLQUERYMAXSWAPGROUPSNVPROC __wglewQueryMaxSwapGroupsNV; +WGLEW_FUN_EXPORT PFNWGLQUERYSWAPGROUPNVPROC __wglewQuerySwapGroupNV; +WGLEW_FUN_EXPORT PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV; + +WGLEW_FUN_EXPORT PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV; +WGLEW_FUN_EXPORT PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV; + +WGLEW_FUN_EXPORT PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV; +WGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV; +WGLEW_FUN_EXPORT PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV; +WGLEW_FUN_EXPORT PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV; +WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV; + +WGLEW_FUN_EXPORT PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV; +WGLEW_FUN_EXPORT PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV; +WGLEW_FUN_EXPORT PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV; +WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEODEVICENVPROC __wglewReleaseVideoDeviceNV; +WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOIMAGENVPROC __wglewReleaseVideoImageNV; +WGLEW_FUN_EXPORT PFNWGLSENDPBUFFERTOVIDEONVPROC __wglewSendPbufferToVideoNV; + +WGLEW_FUN_EXPORT PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML; +WGLEW_FUN_EXPORT PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML; +WGLEW_FUN_EXPORT PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML; +WGLEW_FUN_EXPORT PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML; +WGLEW_FUN_EXPORT PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML; +WGLEW_FUN_EXPORT PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML; +WGLEW_VAR_EXPORT GLboolean __WGLEW_3DFX_multisample; +WGLEW_VAR_EXPORT GLboolean __WGLEW_3DL_stereo_control; +WGLEW_VAR_EXPORT GLboolean __WGLEW_AMD_gpu_association; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_buffer_region; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_context_flush_control; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_profile; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_robustness; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_extensions_string; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_framebuffer_sRGB; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_make_current_read; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_multisample; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pbuffer; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format_float; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_render_texture; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_robustness_application_isolation; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_robustness_share_group_isolation; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_pixel_format_float; +WGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_render_texture_rectangle; +WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es2_profile; +WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es_profile; +WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_depth_float; +WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_display_color_table; +WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_extensions_string; +WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_framebuffer_sRGB; +WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_make_current_read; +WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_multisample; +WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pbuffer; +WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format; +WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format_packed_float; +WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control; +WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control_tear; +WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_digital_video_control; +WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_gamma; +WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_genlock; +WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_image_buffer; +WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_lock; +WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_usage; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop2; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_copy_image; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_delay_before_swap; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_float_buffer; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_gpu_affinity; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_multisample_coverage; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_present_video; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_depth_texture; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_texture_rectangle; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_swap_group; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_vertex_array_range; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_capture; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_output; +WGLEW_VAR_EXPORT GLboolean __WGLEW_OML_sync_control; + +#ifdef GLEW_MX +}; /* WGLEWContextStruct */ +#endif /* GLEW_MX */ + +/* ------------------------------------------------------------------------- */ + +#ifdef GLEW_MX + +typedef struct WGLEWContextStruct WGLEWContext; +GLEWAPI GLenum GLEWAPIENTRY wglewContextInit (WGLEWContext *ctx); +GLEWAPI GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext *ctx, const char *name); + +#define wglewInit() wglewContextInit(wglewGetContext()) +#define wglewIsSupported(x) wglewContextIsSupported(wglewGetContext(), x) + +#define WGLEW_GET_VAR(x) (*(const GLboolean*)&(wglewGetContext()->x)) +#define WGLEW_GET_FUN(x) wglewGetContext()->x + +#else /* GLEW_MX */ + +GLEWAPI GLenum GLEWAPIENTRY wglewInit (); +GLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name); + +#define WGLEW_GET_VAR(x) (*(const GLboolean*)&x) +#define WGLEW_GET_FUN(x) x + +#endif /* GLEW_MX */ + +GLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name); + +#ifdef __cplusplus +} +#endif + +#undef GLEWAPI + +#endif /* __wglew_h__ */ diff --git a/engine/third_party/physx/snippets/graphics/src/glew.c b/engine/third_party/physx/snippets/graphics/src/glew.c new file mode 100644 index 00000000..0ed5520d --- /dev/null +++ b/engine/third_party/physx/snippets/graphics/src/glew.c @@ -0,0 +1,18607 @@ +/* +** The OpenGL Extension Wrangler Library +** Copyright (C) 2008-2015, Nigel Stewart +** Copyright (C) 2002-2008, Milan Ikits +** Copyright (C) 2002-2008, Marcelo E. Magallon +** Copyright (C) 2002, Lev Povalahev +** 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. +** * The name of the author may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +** THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#if defined(_WIN32) +# include +#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) +# include +#endif + +#include /* For size_t */ + +/* + * Define glewGetContext and related helper macros. + */ +#ifdef GLEW_MX +# define glewGetContext() ctx +# ifdef _WIN32 +# define GLEW_CONTEXT_ARG_DEF_INIT GLEWContext* ctx +# define GLEW_CONTEXT_ARG_VAR_INIT ctx +# define wglewGetContext() ctx +# define WGLEW_CONTEXT_ARG_DEF_INIT WGLEWContext* ctx +# define WGLEW_CONTEXT_ARG_DEF_LIST WGLEWContext* ctx +# else /* _WIN32 */ +# define GLEW_CONTEXT_ARG_DEF_INIT void +# define GLEW_CONTEXT_ARG_VAR_INIT +# define glxewGetContext() ctx +# define GLXEW_CONTEXT_ARG_DEF_INIT void +# define GLXEW_CONTEXT_ARG_DEF_LIST GLXEWContext* ctx +# endif /* _WIN32 */ +# define GLEW_CONTEXT_ARG_DEF_LIST GLEWContext* ctx +#else /* GLEW_MX */ +# define GLEW_CONTEXT_ARG_DEF_INIT void +# define GLEW_CONTEXT_ARG_VAR_INIT +# define GLEW_CONTEXT_ARG_DEF_LIST void +# define WGLEW_CONTEXT_ARG_DEF_INIT void +# define WGLEW_CONTEXT_ARG_DEF_LIST void +# define GLXEW_CONTEXT_ARG_DEF_INIT void +# define GLXEW_CONTEXT_ARG_DEF_LIST void +#endif /* GLEW_MX */ + +#if defined(GLEW_REGAL) + +/* In GLEW_REGAL mode we call direcly into the linked + libRegal.so glGetProcAddressREGAL for looking up + the GL function pointers. */ + +# undef glGetProcAddressREGAL +# ifdef WIN32 +extern void * __stdcall glGetProcAddressREGAL(const GLchar *name); +static void * (__stdcall * regalGetProcAddress) (const GLchar *) = glGetProcAddressREGAL; +# else +extern void * glGetProcAddressREGAL(const GLchar *name); +static void * (*regalGetProcAddress) (const GLchar *) = glGetProcAddressREGAL; +# endif +# define glGetProcAddressREGAL GLEW_GET_FUN(__glewGetProcAddressREGAL) + +#elif defined(__sgi) || defined (__sun) || defined(__HAIKU__) || defined(GLEW_APPLE_GLX) +#include +#include +#include + +void* dlGetProcAddress (const GLubyte* name) +{ + static void* h = NULL; + static void* gpa; + + if (h == NULL) + { + if ((h = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL)) == NULL) return NULL; + gpa = dlsym(h, "glXGetProcAddress"); + } + + if (gpa != NULL) + return ((void*(*)(const GLubyte*))gpa)(name); + else + return dlsym(h, (const char*)name); +} +#endif /* __sgi || __sun || GLEW_APPLE_GLX */ + +#if defined(__APPLE__) +#include +#include +#include + +#ifdef MAC_OS_X_VERSION_10_3 + +#include + +void* NSGLGetProcAddress (const GLubyte *name) +{ + static void* image = NULL; + void* addr; + if (NULL == image) + { + image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY); + } + if( !image ) return NULL; + addr = dlsym(image, (const char*)name); + if( addr ) return addr; +#ifdef GLEW_APPLE_GLX + return dlGetProcAddress( name ); // try next for glx symbols +#else + return NULL; +#endif +} +#else + +#include + +void* NSGLGetProcAddress (const GLubyte *name) +{ + static const struct mach_header* image = NULL; + NSSymbol symbol; + char* symbolName; + if (NULL == image) + { + image = NSAddImage("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", NSADDIMAGE_OPTION_RETURN_ON_ERROR); + } + /* prepend a '_' for the Unix C symbol mangling convention */ + symbolName = malloc(strlen((const char*)name) + 2); + strcpy(symbolName+1, (const char*)name); + symbolName[0] = '_'; + symbol = NULL; + /* if (NSIsSymbolNameDefined(symbolName)) + symbol = NSLookupAndBindSymbol(symbolName); */ + symbol = image ? NSLookupSymbolInImage(image, symbolName, NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) : NULL; + free(symbolName); + if( symbol ) return NSAddressOfSymbol(symbol); +#ifdef GLEW_APPLE_GLX + return dlGetProcAddress( name ); // try next for glx symbols +#else + return NULL; +#endif +} +#endif /* MAC_OS_X_VERSION_10_3 */ +#endif /* __APPLE__ */ + +/* + * Define glewGetProcAddress. + */ +#if defined(GLEW_REGAL) +# define glewGetProcAddress(name) regalGetProcAddress((const GLchar *) name) +#elif defined(_WIN32) +# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name) +#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX) +# define glewGetProcAddress(name) NSGLGetProcAddress(name) +#elif defined(__sgi) || defined(__sun) || defined(__HAIKU__) +# define glewGetProcAddress(name) dlGetProcAddress(name) +#elif defined(__ANDROID__) +# define glewGetProcAddress(name) NULL /* TODO */ +#elif defined(__native_client__) +# define glewGetProcAddress(name) NULL /* TODO */ +#else /* __linux */ +# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name) +#endif + +/* + * Redefine GLEW_GET_VAR etc without const cast + */ + +#undef GLEW_GET_VAR +#ifdef GLEW_MX +# define GLEW_GET_VAR(x) (glewGetContext()->x) +#else /* GLEW_MX */ +# define GLEW_GET_VAR(x) (x) +#endif /* GLEW_MX */ + +#ifdef WGLEW_GET_VAR +# undef WGLEW_GET_VAR +# ifdef GLEW_MX +# define WGLEW_GET_VAR(x) (wglewGetContext()->x) +# else /* GLEW_MX */ +# define WGLEW_GET_VAR(x) (x) +# endif /* GLEW_MX */ +#endif /* WGLEW_GET_VAR */ + +#ifdef GLXEW_GET_VAR +# undef GLXEW_GET_VAR +# ifdef GLEW_MX +# define GLXEW_GET_VAR(x) (glxewGetContext()->x) +# else /* GLEW_MX */ +# define GLXEW_GET_VAR(x) (x) +# endif /* GLEW_MX */ +#endif /* GLXEW_GET_VAR */ + +/* + * GLEW, just like OpenGL or GLU, does not rely on the standard C library. + * These functions implement the functionality required in this file. + */ +static GLuint _glewStrLen (const GLubyte* s) +{ + GLuint i=0; + if (s == NULL) return 0; + while (s[i] != '\0') i++; + return i; +} + +static GLuint _glewStrCLen (const GLubyte* s, GLubyte c) +{ + GLuint i=0; + if (s == NULL) return 0; + while (s[i] != '\0' && s[i] != c) i++; + return (s[i] == '\0' || s[i] == c) ? i : 0; +} + +static GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n) +{ + GLuint i=0; + if(a == NULL || b == NULL) + return (a == NULL && b == NULL && n == 0) ? GL_TRUE : GL_FALSE; + while (i < n && a[i] != '\0' && b[i] != '\0' && a[i] == b[i]) i++; + return i == n ? GL_TRUE : GL_FALSE; +} + +static GLboolean _glewStrSame1 (const GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb) +{ + while (*na > 0 && (**a == ' ' || **a == '\n' || **a == '\r' || **a == '\t')) + { + (*a)++; + (*na)--; + } + if(*na >= nb) + { + GLuint i=0; + while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++; + if(i == nb) + { + *a = *a + nb; + *na = *na - nb; + return GL_TRUE; + } + } + return GL_FALSE; +} + +static GLboolean _glewStrSame2 (const GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb) +{ + if(*na >= nb) + { + GLuint i=0; + while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++; + if(i == nb) + { + *a = *a + nb; + *na = *na - nb; + return GL_TRUE; + } + } + return GL_FALSE; +} + +static GLboolean _glewStrSame3 (const GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb) +{ + if(*na >= nb) + { + GLuint i=0; + while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++; + if (i == nb && (*na == nb || (*a)[i] == ' ' || (*a)[i] == '\n' || (*a)[i] == '\r' || (*a)[i] == '\t')) + { + *a = *a + nb; + *na = *na - nb; + return GL_TRUE; + } + } + return GL_FALSE; +} + +/* + * Search for name in the extensions string. Use of strstr() + * is not sufficient because extension names can be prefixes of + * other extension names. Could use strtok() but the constant + * string returned by glGetString might be in read-only memory. + */ +static GLboolean _glewSearchExtension (const char* name, const GLubyte *start, const GLubyte *end) +{ + const GLubyte* p; + GLuint len = _glewStrLen((const GLubyte*)name); + p = start; + while (p < end) + { + GLuint n = _glewStrCLen(p, ' '); + if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE; + p += n+1; + } + return GL_FALSE; +} + +#if !defined(_WIN32) || !defined(GLEW_MX) + +PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D = NULL; +PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements = NULL; +PFNGLTEXIMAGE3DPROC __glewTexImage3D = NULL; +PFNGLTEXSUBIMAGE3DPROC __glewTexSubImage3D = NULL; + +PFNGLACTIVETEXTUREPROC __glewActiveTexture = NULL; +PFNGLCLIENTACTIVETEXTUREPROC __glewClientActiveTexture = NULL; +PFNGLCOMPRESSEDTEXIMAGE1DPROC __glewCompressedTexImage1D = NULL; +PFNGLCOMPRESSEDTEXIMAGE2DPROC __glewCompressedTexImage2D = NULL; +PFNGLCOMPRESSEDTEXIMAGE3DPROC __glewCompressedTexImage3D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC __glewCompressedTexSubImage1D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC __glewCompressedTexSubImage2D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC __glewCompressedTexSubImage3D = NULL; +PFNGLGETCOMPRESSEDTEXIMAGEPROC __glewGetCompressedTexImage = NULL; +PFNGLLOADTRANSPOSEMATRIXDPROC __glewLoadTransposeMatrixd = NULL; +PFNGLLOADTRANSPOSEMATRIXFPROC __glewLoadTransposeMatrixf = NULL; +PFNGLMULTTRANSPOSEMATRIXDPROC __glewMultTransposeMatrixd = NULL; +PFNGLMULTTRANSPOSEMATRIXFPROC __glewMultTransposeMatrixf = NULL; +PFNGLMULTITEXCOORD1DPROC __glewMultiTexCoord1d = NULL; +PFNGLMULTITEXCOORD1DVPROC __glewMultiTexCoord1dv = NULL; +PFNGLMULTITEXCOORD1FPROC __glewMultiTexCoord1f = NULL; +PFNGLMULTITEXCOORD1FVPROC __glewMultiTexCoord1fv = NULL; +PFNGLMULTITEXCOORD1IPROC __glewMultiTexCoord1i = NULL; +PFNGLMULTITEXCOORD1IVPROC __glewMultiTexCoord1iv = NULL; +PFNGLMULTITEXCOORD1SPROC __glewMultiTexCoord1s = NULL; +PFNGLMULTITEXCOORD1SVPROC __glewMultiTexCoord1sv = NULL; +PFNGLMULTITEXCOORD2DPROC __glewMultiTexCoord2d = NULL; +PFNGLMULTITEXCOORD2DVPROC __glewMultiTexCoord2dv = NULL; +PFNGLMULTITEXCOORD2FPROC __glewMultiTexCoord2f = NULL; +PFNGLMULTITEXCOORD2FVPROC __glewMultiTexCoord2fv = NULL; +PFNGLMULTITEXCOORD2IPROC __glewMultiTexCoord2i = NULL; +PFNGLMULTITEXCOORD2IVPROC __glewMultiTexCoord2iv = NULL; +PFNGLMULTITEXCOORD2SPROC __glewMultiTexCoord2s = NULL; +PFNGLMULTITEXCOORD2SVPROC __glewMultiTexCoord2sv = NULL; +PFNGLMULTITEXCOORD3DPROC __glewMultiTexCoord3d = NULL; +PFNGLMULTITEXCOORD3DVPROC __glewMultiTexCoord3dv = NULL; +PFNGLMULTITEXCOORD3FPROC __glewMultiTexCoord3f = NULL; +PFNGLMULTITEXCOORD3FVPROC __glewMultiTexCoord3fv = NULL; +PFNGLMULTITEXCOORD3IPROC __glewMultiTexCoord3i = NULL; +PFNGLMULTITEXCOORD3IVPROC __glewMultiTexCoord3iv = NULL; +PFNGLMULTITEXCOORD3SPROC __glewMultiTexCoord3s = NULL; +PFNGLMULTITEXCOORD3SVPROC __glewMultiTexCoord3sv = NULL; +PFNGLMULTITEXCOORD4DPROC __glewMultiTexCoord4d = NULL; +PFNGLMULTITEXCOORD4DVPROC __glewMultiTexCoord4dv = NULL; +PFNGLMULTITEXCOORD4FPROC __glewMultiTexCoord4f = NULL; +PFNGLMULTITEXCOORD4FVPROC __glewMultiTexCoord4fv = NULL; +PFNGLMULTITEXCOORD4IPROC __glewMultiTexCoord4i = NULL; +PFNGLMULTITEXCOORD4IVPROC __glewMultiTexCoord4iv = NULL; +PFNGLMULTITEXCOORD4SPROC __glewMultiTexCoord4s = NULL; +PFNGLMULTITEXCOORD4SVPROC __glewMultiTexCoord4sv = NULL; +PFNGLSAMPLECOVERAGEPROC __glewSampleCoverage = NULL; + +PFNGLBLENDCOLORPROC __glewBlendColor = NULL; +PFNGLBLENDEQUATIONPROC __glewBlendEquation = NULL; +PFNGLBLENDFUNCSEPARATEPROC __glewBlendFuncSeparate = NULL; +PFNGLFOGCOORDPOINTERPROC __glewFogCoordPointer = NULL; +PFNGLFOGCOORDDPROC __glewFogCoordd = NULL; +PFNGLFOGCOORDDVPROC __glewFogCoorddv = NULL; +PFNGLFOGCOORDFPROC __glewFogCoordf = NULL; +PFNGLFOGCOORDFVPROC __glewFogCoordfv = NULL; +PFNGLMULTIDRAWARRAYSPROC __glewMultiDrawArrays = NULL; +PFNGLMULTIDRAWELEMENTSPROC __glewMultiDrawElements = NULL; +PFNGLPOINTPARAMETERFPROC __glewPointParameterf = NULL; +PFNGLPOINTPARAMETERFVPROC __glewPointParameterfv = NULL; +PFNGLPOINTPARAMETERIPROC __glewPointParameteri = NULL; +PFNGLPOINTPARAMETERIVPROC __glewPointParameteriv = NULL; +PFNGLSECONDARYCOLOR3BPROC __glewSecondaryColor3b = NULL; +PFNGLSECONDARYCOLOR3BVPROC __glewSecondaryColor3bv = NULL; +PFNGLSECONDARYCOLOR3DPROC __glewSecondaryColor3d = NULL; +PFNGLSECONDARYCOLOR3DVPROC __glewSecondaryColor3dv = NULL; +PFNGLSECONDARYCOLOR3FPROC __glewSecondaryColor3f = NULL; +PFNGLSECONDARYCOLOR3FVPROC __glewSecondaryColor3fv = NULL; +PFNGLSECONDARYCOLOR3IPROC __glewSecondaryColor3i = NULL; +PFNGLSECONDARYCOLOR3IVPROC __glewSecondaryColor3iv = NULL; +PFNGLSECONDARYCOLOR3SPROC __glewSecondaryColor3s = NULL; +PFNGLSECONDARYCOLOR3SVPROC __glewSecondaryColor3sv = NULL; +PFNGLSECONDARYCOLOR3UBPROC __glewSecondaryColor3ub = NULL; +PFNGLSECONDARYCOLOR3UBVPROC __glewSecondaryColor3ubv = NULL; +PFNGLSECONDARYCOLOR3UIPROC __glewSecondaryColor3ui = NULL; +PFNGLSECONDARYCOLOR3UIVPROC __glewSecondaryColor3uiv = NULL; +PFNGLSECONDARYCOLOR3USPROC __glewSecondaryColor3us = NULL; +PFNGLSECONDARYCOLOR3USVPROC __glewSecondaryColor3usv = NULL; +PFNGLSECONDARYCOLORPOINTERPROC __glewSecondaryColorPointer = NULL; +PFNGLWINDOWPOS2DPROC __glewWindowPos2d = NULL; +PFNGLWINDOWPOS2DVPROC __glewWindowPos2dv = NULL; +PFNGLWINDOWPOS2FPROC __glewWindowPos2f = NULL; +PFNGLWINDOWPOS2FVPROC __glewWindowPos2fv = NULL; +PFNGLWINDOWPOS2IPROC __glewWindowPos2i = NULL; +PFNGLWINDOWPOS2IVPROC __glewWindowPos2iv = NULL; +PFNGLWINDOWPOS2SPROC __glewWindowPos2s = NULL; +PFNGLWINDOWPOS2SVPROC __glewWindowPos2sv = NULL; +PFNGLWINDOWPOS3DPROC __glewWindowPos3d = NULL; +PFNGLWINDOWPOS3DVPROC __glewWindowPos3dv = NULL; +PFNGLWINDOWPOS3FPROC __glewWindowPos3f = NULL; +PFNGLWINDOWPOS3FVPROC __glewWindowPos3fv = NULL; +PFNGLWINDOWPOS3IPROC __glewWindowPos3i = NULL; +PFNGLWINDOWPOS3IVPROC __glewWindowPos3iv = NULL; +PFNGLWINDOWPOS3SPROC __glewWindowPos3s = NULL; +PFNGLWINDOWPOS3SVPROC __glewWindowPos3sv = NULL; + +PFNGLBEGINQUERYPROC __glewBeginQuery = NULL; +PFNGLBINDBUFFERPROC __glewBindBuffer = NULL; +PFNGLBUFFERDATAPROC __glewBufferData = NULL; +PFNGLBUFFERSUBDATAPROC __glewBufferSubData = NULL; +PFNGLDELETEBUFFERSPROC __glewDeleteBuffers = NULL; +PFNGLDELETEQUERIESPROC __glewDeleteQueries = NULL; +PFNGLENDQUERYPROC __glewEndQuery = NULL; +PFNGLGENBUFFERSPROC __glewGenBuffers = NULL; +PFNGLGENQUERIESPROC __glewGenQueries = NULL; +PFNGLGETBUFFERPARAMETERIVPROC __glewGetBufferParameteriv = NULL; +PFNGLGETBUFFERPOINTERVPROC __glewGetBufferPointerv = NULL; +PFNGLGETBUFFERSUBDATAPROC __glewGetBufferSubData = NULL; +PFNGLGETQUERYOBJECTIVPROC __glewGetQueryObjectiv = NULL; +PFNGLGETQUERYOBJECTUIVPROC __glewGetQueryObjectuiv = NULL; +PFNGLGETQUERYIVPROC __glewGetQueryiv = NULL; +PFNGLISBUFFERPROC __glewIsBuffer = NULL; +PFNGLISQUERYPROC __glewIsQuery = NULL; +PFNGLMAPBUFFERPROC __glewMapBuffer = NULL; +PFNGLUNMAPBUFFERPROC __glewUnmapBuffer = NULL; + +PFNGLATTACHSHADERPROC __glewAttachShader = NULL; +PFNGLBINDATTRIBLOCATIONPROC __glewBindAttribLocation = NULL; +PFNGLBLENDEQUATIONSEPARATEPROC __glewBlendEquationSeparate = NULL; +PFNGLCOMPILESHADERPROC __glewCompileShader = NULL; +PFNGLCREATEPROGRAMPROC __glewCreateProgram = NULL; +PFNGLCREATESHADERPROC __glewCreateShader = NULL; +PFNGLDELETEPROGRAMPROC __glewDeleteProgram = NULL; +PFNGLDELETESHADERPROC __glewDeleteShader = NULL; +PFNGLDETACHSHADERPROC __glewDetachShader = NULL; +PFNGLDISABLEVERTEXATTRIBARRAYPROC __glewDisableVertexAttribArray = NULL; +PFNGLDRAWBUFFERSPROC __glewDrawBuffers = NULL; +PFNGLENABLEVERTEXATTRIBARRAYPROC __glewEnableVertexAttribArray = NULL; +PFNGLGETACTIVEATTRIBPROC __glewGetActiveAttrib = NULL; +PFNGLGETACTIVEUNIFORMPROC __glewGetActiveUniform = NULL; +PFNGLGETATTACHEDSHADERSPROC __glewGetAttachedShaders = NULL; +PFNGLGETATTRIBLOCATIONPROC __glewGetAttribLocation = NULL; +PFNGLGETPROGRAMINFOLOGPROC __glewGetProgramInfoLog = NULL; +PFNGLGETPROGRAMIVPROC __glewGetProgramiv = NULL; +PFNGLGETSHADERINFOLOGPROC __glewGetShaderInfoLog = NULL; +PFNGLGETSHADERSOURCEPROC __glewGetShaderSource = NULL; +PFNGLGETSHADERIVPROC __glewGetShaderiv = NULL; +PFNGLGETUNIFORMLOCATIONPROC __glewGetUniformLocation = NULL; +PFNGLGETUNIFORMFVPROC __glewGetUniformfv = NULL; +PFNGLGETUNIFORMIVPROC __glewGetUniformiv = NULL; +PFNGLGETVERTEXATTRIBPOINTERVPROC __glewGetVertexAttribPointerv = NULL; +PFNGLGETVERTEXATTRIBDVPROC __glewGetVertexAttribdv = NULL; +PFNGLGETVERTEXATTRIBFVPROC __glewGetVertexAttribfv = NULL; +PFNGLGETVERTEXATTRIBIVPROC __glewGetVertexAttribiv = NULL; +PFNGLISPROGRAMPROC __glewIsProgram = NULL; +PFNGLISSHADERPROC __glewIsShader = NULL; +PFNGLLINKPROGRAMPROC __glewLinkProgram = NULL; +PFNGLSHADERSOURCEPROC __glewShaderSource = NULL; +PFNGLSTENCILFUNCSEPARATEPROC __glewStencilFuncSeparate = NULL; +PFNGLSTENCILMASKSEPARATEPROC __glewStencilMaskSeparate = NULL; +PFNGLSTENCILOPSEPARATEPROC __glewStencilOpSeparate = NULL; +PFNGLUNIFORM1FPROC __glewUniform1f = NULL; +PFNGLUNIFORM1FVPROC __glewUniform1fv = NULL; +PFNGLUNIFORM1IPROC __glewUniform1i = NULL; +PFNGLUNIFORM1IVPROC __glewUniform1iv = NULL; +PFNGLUNIFORM2FPROC __glewUniform2f = NULL; +PFNGLUNIFORM2FVPROC __glewUniform2fv = NULL; +PFNGLUNIFORM2IPROC __glewUniform2i = NULL; +PFNGLUNIFORM2IVPROC __glewUniform2iv = NULL; +PFNGLUNIFORM3FPROC __glewUniform3f = NULL; +PFNGLUNIFORM3FVPROC __glewUniform3fv = NULL; +PFNGLUNIFORM3IPROC __glewUniform3i = NULL; +PFNGLUNIFORM3IVPROC __glewUniform3iv = NULL; +PFNGLUNIFORM4FPROC __glewUniform4f = NULL; +PFNGLUNIFORM4FVPROC __glewUniform4fv = NULL; +PFNGLUNIFORM4IPROC __glewUniform4i = NULL; +PFNGLUNIFORM4IVPROC __glewUniform4iv = NULL; +PFNGLUNIFORMMATRIX2FVPROC __glewUniformMatrix2fv = NULL; +PFNGLUNIFORMMATRIX3FVPROC __glewUniformMatrix3fv = NULL; +PFNGLUNIFORMMATRIX4FVPROC __glewUniformMatrix4fv = NULL; +PFNGLUSEPROGRAMPROC __glewUseProgram = NULL; +PFNGLVALIDATEPROGRAMPROC __glewValidateProgram = NULL; +PFNGLVERTEXATTRIB1DPROC __glewVertexAttrib1d = NULL; +PFNGLVERTEXATTRIB1DVPROC __glewVertexAttrib1dv = NULL; +PFNGLVERTEXATTRIB1FPROC __glewVertexAttrib1f = NULL; +PFNGLVERTEXATTRIB1FVPROC __glewVertexAttrib1fv = NULL; +PFNGLVERTEXATTRIB1SPROC __glewVertexAttrib1s = NULL; +PFNGLVERTEXATTRIB1SVPROC __glewVertexAttrib1sv = NULL; +PFNGLVERTEXATTRIB2DPROC __glewVertexAttrib2d = NULL; +PFNGLVERTEXATTRIB2DVPROC __glewVertexAttrib2dv = NULL; +PFNGLVERTEXATTRIB2FPROC __glewVertexAttrib2f = NULL; +PFNGLVERTEXATTRIB2FVPROC __glewVertexAttrib2fv = NULL; +PFNGLVERTEXATTRIB2SPROC __glewVertexAttrib2s = NULL; +PFNGLVERTEXATTRIB2SVPROC __glewVertexAttrib2sv = NULL; +PFNGLVERTEXATTRIB3DPROC __glewVertexAttrib3d = NULL; +PFNGLVERTEXATTRIB3DVPROC __glewVertexAttrib3dv = NULL; +PFNGLVERTEXATTRIB3FPROC __glewVertexAttrib3f = NULL; +PFNGLVERTEXATTRIB3FVPROC __glewVertexAttrib3fv = NULL; +PFNGLVERTEXATTRIB3SPROC __glewVertexAttrib3s = NULL; +PFNGLVERTEXATTRIB3SVPROC __glewVertexAttrib3sv = NULL; +PFNGLVERTEXATTRIB4NBVPROC __glewVertexAttrib4Nbv = NULL; +PFNGLVERTEXATTRIB4NIVPROC __glewVertexAttrib4Niv = NULL; +PFNGLVERTEXATTRIB4NSVPROC __glewVertexAttrib4Nsv = NULL; +PFNGLVERTEXATTRIB4NUBPROC __glewVertexAttrib4Nub = NULL; +PFNGLVERTEXATTRIB4NUBVPROC __glewVertexAttrib4Nubv = NULL; +PFNGLVERTEXATTRIB4NUIVPROC __glewVertexAttrib4Nuiv = NULL; +PFNGLVERTEXATTRIB4NUSVPROC __glewVertexAttrib4Nusv = NULL; +PFNGLVERTEXATTRIB4BVPROC __glewVertexAttrib4bv = NULL; +PFNGLVERTEXATTRIB4DPROC __glewVertexAttrib4d = NULL; +PFNGLVERTEXATTRIB4DVPROC __glewVertexAttrib4dv = NULL; +PFNGLVERTEXATTRIB4FPROC __glewVertexAttrib4f = NULL; +PFNGLVERTEXATTRIB4FVPROC __glewVertexAttrib4fv = NULL; +PFNGLVERTEXATTRIB4IVPROC __glewVertexAttrib4iv = NULL; +PFNGLVERTEXATTRIB4SPROC __glewVertexAttrib4s = NULL; +PFNGLVERTEXATTRIB4SVPROC __glewVertexAttrib4sv = NULL; +PFNGLVERTEXATTRIB4UBVPROC __glewVertexAttrib4ubv = NULL; +PFNGLVERTEXATTRIB4UIVPROC __glewVertexAttrib4uiv = NULL; +PFNGLVERTEXATTRIB4USVPROC __glewVertexAttrib4usv = NULL; +PFNGLVERTEXATTRIBPOINTERPROC __glewVertexAttribPointer = NULL; + +PFNGLUNIFORMMATRIX2X3FVPROC __glewUniformMatrix2x3fv = NULL; +PFNGLUNIFORMMATRIX2X4FVPROC __glewUniformMatrix2x4fv = NULL; +PFNGLUNIFORMMATRIX3X2FVPROC __glewUniformMatrix3x2fv = NULL; +PFNGLUNIFORMMATRIX3X4FVPROC __glewUniformMatrix3x4fv = NULL; +PFNGLUNIFORMMATRIX4X2FVPROC __glewUniformMatrix4x2fv = NULL; +PFNGLUNIFORMMATRIX4X3FVPROC __glewUniformMatrix4x3fv = NULL; + +PFNGLBEGINCONDITIONALRENDERPROC __glewBeginConditionalRender = NULL; +PFNGLBEGINTRANSFORMFEEDBACKPROC __glewBeginTransformFeedback = NULL; +PFNGLBINDFRAGDATALOCATIONPROC __glewBindFragDataLocation = NULL; +PFNGLCLAMPCOLORPROC __glewClampColor = NULL; +PFNGLCLEARBUFFERFIPROC __glewClearBufferfi = NULL; +PFNGLCLEARBUFFERFVPROC __glewClearBufferfv = NULL; +PFNGLCLEARBUFFERIVPROC __glewClearBufferiv = NULL; +PFNGLCLEARBUFFERUIVPROC __glewClearBufferuiv = NULL; +PFNGLCOLORMASKIPROC __glewColorMaski = NULL; +PFNGLDISABLEIPROC __glewDisablei = NULL; +PFNGLENABLEIPROC __glewEnablei = NULL; +PFNGLENDCONDITIONALRENDERPROC __glewEndConditionalRender = NULL; +PFNGLENDTRANSFORMFEEDBACKPROC __glewEndTransformFeedback = NULL; +PFNGLGETBOOLEANI_VPROC __glewGetBooleani_v = NULL; +PFNGLGETFRAGDATALOCATIONPROC __glewGetFragDataLocation = NULL; +PFNGLGETSTRINGIPROC __glewGetStringi = NULL; +PFNGLGETTEXPARAMETERIIVPROC __glewGetTexParameterIiv = NULL; +PFNGLGETTEXPARAMETERIUIVPROC __glewGetTexParameterIuiv = NULL; +PFNGLGETTRANSFORMFEEDBACKVARYINGPROC __glewGetTransformFeedbackVarying = NULL; +PFNGLGETUNIFORMUIVPROC __glewGetUniformuiv = NULL; +PFNGLGETVERTEXATTRIBIIVPROC __glewGetVertexAttribIiv = NULL; +PFNGLGETVERTEXATTRIBIUIVPROC __glewGetVertexAttribIuiv = NULL; +PFNGLISENABLEDIPROC __glewIsEnabledi = NULL; +PFNGLTEXPARAMETERIIVPROC __glewTexParameterIiv = NULL; +PFNGLTEXPARAMETERIUIVPROC __glewTexParameterIuiv = NULL; +PFNGLTRANSFORMFEEDBACKVARYINGSPROC __glewTransformFeedbackVaryings = NULL; +PFNGLUNIFORM1UIPROC __glewUniform1ui = NULL; +PFNGLUNIFORM1UIVPROC __glewUniform1uiv = NULL; +PFNGLUNIFORM2UIPROC __glewUniform2ui = NULL; +PFNGLUNIFORM2UIVPROC __glewUniform2uiv = NULL; +PFNGLUNIFORM3UIPROC __glewUniform3ui = NULL; +PFNGLUNIFORM3UIVPROC __glewUniform3uiv = NULL; +PFNGLUNIFORM4UIPROC __glewUniform4ui = NULL; +PFNGLUNIFORM4UIVPROC __glewUniform4uiv = NULL; +PFNGLVERTEXATTRIBI1IPROC __glewVertexAttribI1i = NULL; +PFNGLVERTEXATTRIBI1IVPROC __glewVertexAttribI1iv = NULL; +PFNGLVERTEXATTRIBI1UIPROC __glewVertexAttribI1ui = NULL; +PFNGLVERTEXATTRIBI1UIVPROC __glewVertexAttribI1uiv = NULL; +PFNGLVERTEXATTRIBI2IPROC __glewVertexAttribI2i = NULL; +PFNGLVERTEXATTRIBI2IVPROC __glewVertexAttribI2iv = NULL; +PFNGLVERTEXATTRIBI2UIPROC __glewVertexAttribI2ui = NULL; +PFNGLVERTEXATTRIBI2UIVPROC __glewVertexAttribI2uiv = NULL; +PFNGLVERTEXATTRIBI3IPROC __glewVertexAttribI3i = NULL; +PFNGLVERTEXATTRIBI3IVPROC __glewVertexAttribI3iv = NULL; +PFNGLVERTEXATTRIBI3UIPROC __glewVertexAttribI3ui = NULL; +PFNGLVERTEXATTRIBI3UIVPROC __glewVertexAttribI3uiv = NULL; +PFNGLVERTEXATTRIBI4BVPROC __glewVertexAttribI4bv = NULL; +PFNGLVERTEXATTRIBI4IPROC __glewVertexAttribI4i = NULL; +PFNGLVERTEXATTRIBI4IVPROC __glewVertexAttribI4iv = NULL; +PFNGLVERTEXATTRIBI4SVPROC __glewVertexAttribI4sv = NULL; +PFNGLVERTEXATTRIBI4UBVPROC __glewVertexAttribI4ubv = NULL; +PFNGLVERTEXATTRIBI4UIPROC __glewVertexAttribI4ui = NULL; +PFNGLVERTEXATTRIBI4UIVPROC __glewVertexAttribI4uiv = NULL; +PFNGLVERTEXATTRIBI4USVPROC __glewVertexAttribI4usv = NULL; +PFNGLVERTEXATTRIBIPOINTERPROC __glewVertexAttribIPointer = NULL; + +PFNGLDRAWARRAYSINSTANCEDPROC __glewDrawArraysInstanced = NULL; +PFNGLDRAWELEMENTSINSTANCEDPROC __glewDrawElementsInstanced = NULL; +PFNGLPRIMITIVERESTARTINDEXPROC __glewPrimitiveRestartIndex = NULL; +PFNGLTEXBUFFERPROC __glewTexBuffer = NULL; + +PFNGLFRAMEBUFFERTEXTUREPROC __glewFramebufferTexture = NULL; +PFNGLGETBUFFERPARAMETERI64VPROC __glewGetBufferParameteri64v = NULL; +PFNGLGETINTEGER64I_VPROC __glewGetInteger64i_v = NULL; + +PFNGLVERTEXATTRIBDIVISORPROC __glewVertexAttribDivisor = NULL; + +PFNGLBLENDEQUATIONSEPARATEIPROC __glewBlendEquationSeparatei = NULL; +PFNGLBLENDEQUATIONIPROC __glewBlendEquationi = NULL; +PFNGLBLENDFUNCSEPARATEIPROC __glewBlendFuncSeparatei = NULL; +PFNGLBLENDFUNCIPROC __glewBlendFunci = NULL; +PFNGLMINSAMPLESHADINGPROC __glewMinSampleShading = NULL; + +PFNGLGETGRAPHICSRESETSTATUSPROC __glewGetGraphicsResetStatus = NULL; +PFNGLGETNCOMPRESSEDTEXIMAGEPROC __glewGetnCompressedTexImage = NULL; +PFNGLGETNTEXIMAGEPROC __glewGetnTexImage = NULL; +PFNGLGETNUNIFORMDVPROC __glewGetnUniformdv = NULL; + +PFNGLTBUFFERMASK3DFXPROC __glewTbufferMask3DFX = NULL; + +PFNGLDEBUGMESSAGECALLBACKAMDPROC __glewDebugMessageCallbackAMD = NULL; +PFNGLDEBUGMESSAGEENABLEAMDPROC __glewDebugMessageEnableAMD = NULL; +PFNGLDEBUGMESSAGEINSERTAMDPROC __glewDebugMessageInsertAMD = NULL; +PFNGLGETDEBUGMESSAGELOGAMDPROC __glewGetDebugMessageLogAMD = NULL; + +PFNGLBLENDEQUATIONINDEXEDAMDPROC __glewBlendEquationIndexedAMD = NULL; +PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC __glewBlendEquationSeparateIndexedAMD = NULL; +PFNGLBLENDFUNCINDEXEDAMDPROC __glewBlendFuncIndexedAMD = NULL; +PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC __glewBlendFuncSeparateIndexedAMD = NULL; + +PFNGLVERTEXATTRIBPARAMETERIAMDPROC __glewVertexAttribParameteriAMD = NULL; + +PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC __glewMultiDrawArraysIndirectAMD = NULL; +PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC __glewMultiDrawElementsIndirectAMD = NULL; + +PFNGLDELETENAMESAMDPROC __glewDeleteNamesAMD = NULL; +PFNGLGENNAMESAMDPROC __glewGenNamesAMD = NULL; +PFNGLISNAMEAMDPROC __glewIsNameAMD = NULL; + +PFNGLQUERYOBJECTPARAMETERUIAMDPROC __glewQueryObjectParameteruiAMD = NULL; + +PFNGLBEGINPERFMONITORAMDPROC __glewBeginPerfMonitorAMD = NULL; +PFNGLDELETEPERFMONITORSAMDPROC __glewDeletePerfMonitorsAMD = NULL; +PFNGLENDPERFMONITORAMDPROC __glewEndPerfMonitorAMD = NULL; +PFNGLGENPERFMONITORSAMDPROC __glewGenPerfMonitorsAMD = NULL; +PFNGLGETPERFMONITORCOUNTERDATAAMDPROC __glewGetPerfMonitorCounterDataAMD = NULL; +PFNGLGETPERFMONITORCOUNTERINFOAMDPROC __glewGetPerfMonitorCounterInfoAMD = NULL; +PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC __glewGetPerfMonitorCounterStringAMD = NULL; +PFNGLGETPERFMONITORCOUNTERSAMDPROC __glewGetPerfMonitorCountersAMD = NULL; +PFNGLGETPERFMONITORGROUPSTRINGAMDPROC __glewGetPerfMonitorGroupStringAMD = NULL; +PFNGLGETPERFMONITORGROUPSAMDPROC __glewGetPerfMonitorGroupsAMD = NULL; +PFNGLSELECTPERFMONITORCOUNTERSAMDPROC __glewSelectPerfMonitorCountersAMD = NULL; + +PFNGLSETMULTISAMPLEFVAMDPROC __glewSetMultisamplefvAMD = NULL; + +PFNGLTEXSTORAGESPARSEAMDPROC __glewTexStorageSparseAMD = NULL; +PFNGLTEXTURESTORAGESPARSEAMDPROC __glewTextureStorageSparseAMD = NULL; + +PFNGLSTENCILOPVALUEAMDPROC __glewStencilOpValueAMD = NULL; + +PFNGLTESSELLATIONFACTORAMDPROC __glewTessellationFactorAMD = NULL; +PFNGLTESSELLATIONMODEAMDPROC __glewTessellationModeAMD = NULL; + +PFNGLBLITFRAMEBUFFERANGLEPROC __glewBlitFramebufferANGLE = NULL; + +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC __glewRenderbufferStorageMultisampleANGLE = NULL; + +PFNGLDRAWARRAYSINSTANCEDANGLEPROC __glewDrawArraysInstancedANGLE = NULL; +PFNGLDRAWELEMENTSINSTANCEDANGLEPROC __glewDrawElementsInstancedANGLE = NULL; +PFNGLVERTEXATTRIBDIVISORANGLEPROC __glewVertexAttribDivisorANGLE = NULL; + +PFNGLBEGINQUERYANGLEPROC __glewBeginQueryANGLE = NULL; +PFNGLDELETEQUERIESANGLEPROC __glewDeleteQueriesANGLE = NULL; +PFNGLENDQUERYANGLEPROC __glewEndQueryANGLE = NULL; +PFNGLGENQUERIESANGLEPROC __glewGenQueriesANGLE = NULL; +PFNGLGETQUERYOBJECTI64VANGLEPROC __glewGetQueryObjecti64vANGLE = NULL; +PFNGLGETQUERYOBJECTIVANGLEPROC __glewGetQueryObjectivANGLE = NULL; +PFNGLGETQUERYOBJECTUI64VANGLEPROC __glewGetQueryObjectui64vANGLE = NULL; +PFNGLGETQUERYOBJECTUIVANGLEPROC __glewGetQueryObjectuivANGLE = NULL; +PFNGLGETQUERYIVANGLEPROC __glewGetQueryivANGLE = NULL; +PFNGLISQUERYANGLEPROC __glewIsQueryANGLE = NULL; +PFNGLQUERYCOUNTERANGLEPROC __glewQueryCounterANGLE = NULL; + +PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC __glewGetTranslatedShaderSourceANGLE = NULL; + +PFNGLDRAWELEMENTARRAYAPPLEPROC __glewDrawElementArrayAPPLE = NULL; +PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC __glewDrawRangeElementArrayAPPLE = NULL; +PFNGLELEMENTPOINTERAPPLEPROC __glewElementPointerAPPLE = NULL; +PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC __glewMultiDrawElementArrayAPPLE = NULL; +PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC __glewMultiDrawRangeElementArrayAPPLE = NULL; + +PFNGLDELETEFENCESAPPLEPROC __glewDeleteFencesAPPLE = NULL; +PFNGLFINISHFENCEAPPLEPROC __glewFinishFenceAPPLE = NULL; +PFNGLFINISHOBJECTAPPLEPROC __glewFinishObjectAPPLE = NULL; +PFNGLGENFENCESAPPLEPROC __glewGenFencesAPPLE = NULL; +PFNGLISFENCEAPPLEPROC __glewIsFenceAPPLE = NULL; +PFNGLSETFENCEAPPLEPROC __glewSetFenceAPPLE = NULL; +PFNGLTESTFENCEAPPLEPROC __glewTestFenceAPPLE = NULL; +PFNGLTESTOBJECTAPPLEPROC __glewTestObjectAPPLE = NULL; + +PFNGLBUFFERPARAMETERIAPPLEPROC __glewBufferParameteriAPPLE = NULL; +PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC __glewFlushMappedBufferRangeAPPLE = NULL; + +PFNGLGETOBJECTPARAMETERIVAPPLEPROC __glewGetObjectParameterivAPPLE = NULL; +PFNGLOBJECTPURGEABLEAPPLEPROC __glewObjectPurgeableAPPLE = NULL; +PFNGLOBJECTUNPURGEABLEAPPLEPROC __glewObjectUnpurgeableAPPLE = NULL; + +PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC __glewGetTexParameterPointervAPPLE = NULL; +PFNGLTEXTURERANGEAPPLEPROC __glewTextureRangeAPPLE = NULL; + +PFNGLBINDVERTEXARRAYAPPLEPROC __glewBindVertexArrayAPPLE = NULL; +PFNGLDELETEVERTEXARRAYSAPPLEPROC __glewDeleteVertexArraysAPPLE = NULL; +PFNGLGENVERTEXARRAYSAPPLEPROC __glewGenVertexArraysAPPLE = NULL; +PFNGLISVERTEXARRAYAPPLEPROC __glewIsVertexArrayAPPLE = NULL; + +PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC __glewFlushVertexArrayRangeAPPLE = NULL; +PFNGLVERTEXARRAYPARAMETERIAPPLEPROC __glewVertexArrayParameteriAPPLE = NULL; +PFNGLVERTEXARRAYRANGEAPPLEPROC __glewVertexArrayRangeAPPLE = NULL; + +PFNGLDISABLEVERTEXATTRIBAPPLEPROC __glewDisableVertexAttribAPPLE = NULL; +PFNGLENABLEVERTEXATTRIBAPPLEPROC __glewEnableVertexAttribAPPLE = NULL; +PFNGLISVERTEXATTRIBENABLEDAPPLEPROC __glewIsVertexAttribEnabledAPPLE = NULL; +PFNGLMAPVERTEXATTRIB1DAPPLEPROC __glewMapVertexAttrib1dAPPLE = NULL; +PFNGLMAPVERTEXATTRIB1FAPPLEPROC __glewMapVertexAttrib1fAPPLE = NULL; +PFNGLMAPVERTEXATTRIB2DAPPLEPROC __glewMapVertexAttrib2dAPPLE = NULL; +PFNGLMAPVERTEXATTRIB2FAPPLEPROC __glewMapVertexAttrib2fAPPLE = NULL; + +PFNGLCLEARDEPTHFPROC __glewClearDepthf = NULL; +PFNGLDEPTHRANGEFPROC __glewDepthRangef = NULL; +PFNGLGETSHADERPRECISIONFORMATPROC __glewGetShaderPrecisionFormat = NULL; +PFNGLRELEASESHADERCOMPILERPROC __glewReleaseShaderCompiler = NULL; +PFNGLSHADERBINARYPROC __glewShaderBinary = NULL; + +PFNGLMEMORYBARRIERBYREGIONPROC __glewMemoryBarrierByRegion = NULL; + +PFNGLPRIMITIVEBOUNDINGBOXARBPROC __glewPrimitiveBoundingBoxARB = NULL; + +PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC __glewDrawArraysInstancedBaseInstance = NULL; +PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC __glewDrawElementsInstancedBaseInstance = NULL; +PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC __glewDrawElementsInstancedBaseVertexBaseInstance = NULL; + +PFNGLGETIMAGEHANDLEARBPROC __glewGetImageHandleARB = NULL; +PFNGLGETTEXTUREHANDLEARBPROC __glewGetTextureHandleARB = NULL; +PFNGLGETTEXTURESAMPLERHANDLEARBPROC __glewGetTextureSamplerHandleARB = NULL; +PFNGLGETVERTEXATTRIBLUI64VARBPROC __glewGetVertexAttribLui64vARB = NULL; +PFNGLISIMAGEHANDLERESIDENTARBPROC __glewIsImageHandleResidentARB = NULL; +PFNGLISTEXTUREHANDLERESIDENTARBPROC __glewIsTextureHandleResidentARB = NULL; +PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC __glewMakeImageHandleNonResidentARB = NULL; +PFNGLMAKEIMAGEHANDLERESIDENTARBPROC __glewMakeImageHandleResidentARB = NULL; +PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC __glewMakeTextureHandleNonResidentARB = NULL; +PFNGLMAKETEXTUREHANDLERESIDENTARBPROC __glewMakeTextureHandleResidentARB = NULL; +PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC __glewProgramUniformHandleui64ARB = NULL; +PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC __glewProgramUniformHandleui64vARB = NULL; +PFNGLUNIFORMHANDLEUI64ARBPROC __glewUniformHandleui64ARB = NULL; +PFNGLUNIFORMHANDLEUI64VARBPROC __glewUniformHandleui64vARB = NULL; +PFNGLVERTEXATTRIBL1UI64ARBPROC __glewVertexAttribL1ui64ARB = NULL; +PFNGLVERTEXATTRIBL1UI64VARBPROC __glewVertexAttribL1ui64vARB = NULL; + +PFNGLBINDFRAGDATALOCATIONINDEXEDPROC __glewBindFragDataLocationIndexed = NULL; +PFNGLGETFRAGDATAINDEXPROC __glewGetFragDataIndex = NULL; + +PFNGLBUFFERSTORAGEPROC __glewBufferStorage = NULL; +PFNGLNAMEDBUFFERSTORAGEEXTPROC __glewNamedBufferStorageEXT = NULL; + +PFNGLCREATESYNCFROMCLEVENTARBPROC __glewCreateSyncFromCLeventARB = NULL; + +PFNGLCLEARBUFFERDATAPROC __glewClearBufferData = NULL; +PFNGLCLEARBUFFERSUBDATAPROC __glewClearBufferSubData = NULL; +PFNGLCLEARNAMEDBUFFERDATAEXTPROC __glewClearNamedBufferDataEXT = NULL; +PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC __glewClearNamedBufferSubDataEXT = NULL; + +PFNGLCLEARTEXIMAGEPROC __glewClearTexImage = NULL; +PFNGLCLEARTEXSUBIMAGEPROC __glewClearTexSubImage = NULL; + +PFNGLCLIPCONTROLPROC __glewClipControl = NULL; + +PFNGLCLAMPCOLORARBPROC __glewClampColorARB = NULL; + +PFNGLDISPATCHCOMPUTEPROC __glewDispatchCompute = NULL; +PFNGLDISPATCHCOMPUTEINDIRECTPROC __glewDispatchComputeIndirect = NULL; + +PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC __glewDispatchComputeGroupSizeARB = NULL; + +PFNGLCOPYBUFFERSUBDATAPROC __glewCopyBufferSubData = NULL; + +PFNGLCOPYIMAGESUBDATAPROC __glewCopyImageSubData = NULL; + +PFNGLDEBUGMESSAGECALLBACKARBPROC __glewDebugMessageCallbackARB = NULL; +PFNGLDEBUGMESSAGECONTROLARBPROC __glewDebugMessageControlARB = NULL; +PFNGLDEBUGMESSAGEINSERTARBPROC __glewDebugMessageInsertARB = NULL; +PFNGLGETDEBUGMESSAGELOGARBPROC __glewGetDebugMessageLogARB = NULL; + +PFNGLBINDTEXTUREUNITPROC __glewBindTextureUnit = NULL; +PFNGLBLITNAMEDFRAMEBUFFERPROC __glewBlitNamedFramebuffer = NULL; +PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC __glewCheckNamedFramebufferStatus = NULL; +PFNGLCLEARNAMEDBUFFERDATAPROC __glewClearNamedBufferData = NULL; +PFNGLCLEARNAMEDBUFFERSUBDATAPROC __glewClearNamedBufferSubData = NULL; +PFNGLCLEARNAMEDFRAMEBUFFERFIPROC __glewClearNamedFramebufferfi = NULL; +PFNGLCLEARNAMEDFRAMEBUFFERFVPROC __glewClearNamedFramebufferfv = NULL; +PFNGLCLEARNAMEDFRAMEBUFFERIVPROC __glewClearNamedFramebufferiv = NULL; +PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC __glewClearNamedFramebufferuiv = NULL; +PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC __glewCompressedTextureSubImage1D = NULL; +PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC __glewCompressedTextureSubImage2D = NULL; +PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC __glewCompressedTextureSubImage3D = NULL; +PFNGLCOPYNAMEDBUFFERSUBDATAPROC __glewCopyNamedBufferSubData = NULL; +PFNGLCOPYTEXTURESUBIMAGE1DPROC __glewCopyTextureSubImage1D = NULL; +PFNGLCOPYTEXTURESUBIMAGE2DPROC __glewCopyTextureSubImage2D = NULL; +PFNGLCOPYTEXTURESUBIMAGE3DPROC __glewCopyTextureSubImage3D = NULL; +PFNGLCREATEBUFFERSPROC __glewCreateBuffers = NULL; +PFNGLCREATEFRAMEBUFFERSPROC __glewCreateFramebuffers = NULL; +PFNGLCREATEPROGRAMPIPELINESPROC __glewCreateProgramPipelines = NULL; +PFNGLCREATEQUERIESPROC __glewCreateQueries = NULL; +PFNGLCREATERENDERBUFFERSPROC __glewCreateRenderbuffers = NULL; +PFNGLCREATESAMPLERSPROC __glewCreateSamplers = NULL; +PFNGLCREATETEXTURESPROC __glewCreateTextures = NULL; +PFNGLCREATETRANSFORMFEEDBACKSPROC __glewCreateTransformFeedbacks = NULL; +PFNGLCREATEVERTEXARRAYSPROC __glewCreateVertexArrays = NULL; +PFNGLDISABLEVERTEXARRAYATTRIBPROC __glewDisableVertexArrayAttrib = NULL; +PFNGLENABLEVERTEXARRAYATTRIBPROC __glewEnableVertexArrayAttrib = NULL; +PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC __glewFlushMappedNamedBufferRange = NULL; +PFNGLGENERATETEXTUREMIPMAPPROC __glewGenerateTextureMipmap = NULL; +PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC __glewGetCompressedTextureImage = NULL; +PFNGLGETNAMEDBUFFERPARAMETERI64VPROC __glewGetNamedBufferParameteri64v = NULL; +PFNGLGETNAMEDBUFFERPARAMETERIVPROC __glewGetNamedBufferParameteriv = NULL; +PFNGLGETNAMEDBUFFERPOINTERVPROC __glewGetNamedBufferPointerv = NULL; +PFNGLGETNAMEDBUFFERSUBDATAPROC __glewGetNamedBufferSubData = NULL; +PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC __glewGetNamedFramebufferAttachmentParameteriv = NULL; +PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC __glewGetNamedFramebufferParameteriv = NULL; +PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC __glewGetNamedRenderbufferParameteriv = NULL; +PFNGLGETQUERYBUFFEROBJECTI64VPROC __glewGetQueryBufferObjecti64v = NULL; +PFNGLGETQUERYBUFFEROBJECTIVPROC __glewGetQueryBufferObjectiv = NULL; +PFNGLGETQUERYBUFFEROBJECTUI64VPROC __glewGetQueryBufferObjectui64v = NULL; +PFNGLGETQUERYBUFFEROBJECTUIVPROC __glewGetQueryBufferObjectuiv = NULL; +PFNGLGETTEXTUREIMAGEPROC __glewGetTextureImage = NULL; +PFNGLGETTEXTURELEVELPARAMETERFVPROC __glewGetTextureLevelParameterfv = NULL; +PFNGLGETTEXTURELEVELPARAMETERIVPROC __glewGetTextureLevelParameteriv = NULL; +PFNGLGETTEXTUREPARAMETERIIVPROC __glewGetTextureParameterIiv = NULL; +PFNGLGETTEXTUREPARAMETERIUIVPROC __glewGetTextureParameterIuiv = NULL; +PFNGLGETTEXTUREPARAMETERFVPROC __glewGetTextureParameterfv = NULL; +PFNGLGETTEXTUREPARAMETERIVPROC __glewGetTextureParameteriv = NULL; +PFNGLGETTRANSFORMFEEDBACKI64_VPROC __glewGetTransformFeedbacki64_v = NULL; +PFNGLGETTRANSFORMFEEDBACKI_VPROC __glewGetTransformFeedbacki_v = NULL; +PFNGLGETTRANSFORMFEEDBACKIVPROC __glewGetTransformFeedbackiv = NULL; +PFNGLGETVERTEXARRAYINDEXED64IVPROC __glewGetVertexArrayIndexed64iv = NULL; +PFNGLGETVERTEXARRAYINDEXEDIVPROC __glewGetVertexArrayIndexediv = NULL; +PFNGLGETVERTEXARRAYIVPROC __glewGetVertexArrayiv = NULL; +PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC __glewInvalidateNamedFramebufferData = NULL; +PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC __glewInvalidateNamedFramebufferSubData = NULL; +PFNGLMAPNAMEDBUFFERPROC __glewMapNamedBuffer = NULL; +PFNGLMAPNAMEDBUFFERRANGEPROC __glewMapNamedBufferRange = NULL; +PFNGLNAMEDBUFFERDATAPROC __glewNamedBufferData = NULL; +PFNGLNAMEDBUFFERSTORAGEPROC __glewNamedBufferStorage = NULL; +PFNGLNAMEDBUFFERSUBDATAPROC __glewNamedBufferSubData = NULL; +PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC __glewNamedFramebufferDrawBuffer = NULL; +PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC __glewNamedFramebufferDrawBuffers = NULL; +PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC __glewNamedFramebufferParameteri = NULL; +PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC __glewNamedFramebufferReadBuffer = NULL; +PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC __glewNamedFramebufferRenderbuffer = NULL; +PFNGLNAMEDFRAMEBUFFERTEXTUREPROC __glewNamedFramebufferTexture = NULL; +PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC __glewNamedFramebufferTextureLayer = NULL; +PFNGLNAMEDRENDERBUFFERSTORAGEPROC __glewNamedRenderbufferStorage = NULL; +PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC __glewNamedRenderbufferStorageMultisample = NULL; +PFNGLTEXTUREBUFFERPROC __glewTextureBuffer = NULL; +PFNGLTEXTUREBUFFERRANGEPROC __glewTextureBufferRange = NULL; +PFNGLTEXTUREPARAMETERIIVPROC __glewTextureParameterIiv = NULL; +PFNGLTEXTUREPARAMETERIUIVPROC __glewTextureParameterIuiv = NULL; +PFNGLTEXTUREPARAMETERFPROC __glewTextureParameterf = NULL; +PFNGLTEXTUREPARAMETERFVPROC __glewTextureParameterfv = NULL; +PFNGLTEXTUREPARAMETERIPROC __glewTextureParameteri = NULL; +PFNGLTEXTUREPARAMETERIVPROC __glewTextureParameteriv = NULL; +PFNGLTEXTURESTORAGE1DPROC __glewTextureStorage1D = NULL; +PFNGLTEXTURESTORAGE2DPROC __glewTextureStorage2D = NULL; +PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC __glewTextureStorage2DMultisample = NULL; +PFNGLTEXTURESTORAGE3DPROC __glewTextureStorage3D = NULL; +PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC __glewTextureStorage3DMultisample = NULL; +PFNGLTEXTURESUBIMAGE1DPROC __glewTextureSubImage1D = NULL; +PFNGLTEXTURESUBIMAGE2DPROC __glewTextureSubImage2D = NULL; +PFNGLTEXTURESUBIMAGE3DPROC __glewTextureSubImage3D = NULL; +PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC __glewTransformFeedbackBufferBase = NULL; +PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC __glewTransformFeedbackBufferRange = NULL; +PFNGLUNMAPNAMEDBUFFERPROC __glewUnmapNamedBuffer = NULL; +PFNGLVERTEXARRAYATTRIBBINDINGPROC __glewVertexArrayAttribBinding = NULL; +PFNGLVERTEXARRAYATTRIBFORMATPROC __glewVertexArrayAttribFormat = NULL; +PFNGLVERTEXARRAYATTRIBIFORMATPROC __glewVertexArrayAttribIFormat = NULL; +PFNGLVERTEXARRAYATTRIBLFORMATPROC __glewVertexArrayAttribLFormat = NULL; +PFNGLVERTEXARRAYBINDINGDIVISORPROC __glewVertexArrayBindingDivisor = NULL; +PFNGLVERTEXARRAYELEMENTBUFFERPROC __glewVertexArrayElementBuffer = NULL; +PFNGLVERTEXARRAYVERTEXBUFFERPROC __glewVertexArrayVertexBuffer = NULL; +PFNGLVERTEXARRAYVERTEXBUFFERSPROC __glewVertexArrayVertexBuffers = NULL; + +PFNGLDRAWBUFFERSARBPROC __glewDrawBuffersARB = NULL; + +PFNGLBLENDEQUATIONSEPARATEIARBPROC __glewBlendEquationSeparateiARB = NULL; +PFNGLBLENDEQUATIONIARBPROC __glewBlendEquationiARB = NULL; +PFNGLBLENDFUNCSEPARATEIARBPROC __glewBlendFuncSeparateiARB = NULL; +PFNGLBLENDFUNCIARBPROC __glewBlendFunciARB = NULL; + +PFNGLDRAWELEMENTSBASEVERTEXPROC __glewDrawElementsBaseVertex = NULL; +PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC __glewDrawElementsInstancedBaseVertex = NULL; +PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC __glewDrawRangeElementsBaseVertex = NULL; +PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC __glewMultiDrawElementsBaseVertex = NULL; + +PFNGLDRAWARRAYSINDIRECTPROC __glewDrawArraysIndirect = NULL; +PFNGLDRAWELEMENTSINDIRECTPROC __glewDrawElementsIndirect = NULL; + +PFNGLFRAMEBUFFERPARAMETERIPROC __glewFramebufferParameteri = NULL; +PFNGLGETFRAMEBUFFERPARAMETERIVPROC __glewGetFramebufferParameteriv = NULL; +PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC __glewGetNamedFramebufferParameterivEXT = NULL; +PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC __glewNamedFramebufferParameteriEXT = NULL; + +PFNGLBINDFRAMEBUFFERPROC __glewBindFramebuffer = NULL; +PFNGLBINDRENDERBUFFERPROC __glewBindRenderbuffer = NULL; +PFNGLBLITFRAMEBUFFERPROC __glewBlitFramebuffer = NULL; +PFNGLCHECKFRAMEBUFFERSTATUSPROC __glewCheckFramebufferStatus = NULL; +PFNGLDELETEFRAMEBUFFERSPROC __glewDeleteFramebuffers = NULL; +PFNGLDELETERENDERBUFFERSPROC __glewDeleteRenderbuffers = NULL; +PFNGLFRAMEBUFFERRENDERBUFFERPROC __glewFramebufferRenderbuffer = NULL; +PFNGLFRAMEBUFFERTEXTURE1DPROC __glewFramebufferTexture1D = NULL; +PFNGLFRAMEBUFFERTEXTURE2DPROC __glewFramebufferTexture2D = NULL; +PFNGLFRAMEBUFFERTEXTURE3DPROC __glewFramebufferTexture3D = NULL; +PFNGLFRAMEBUFFERTEXTURELAYERPROC __glewFramebufferTextureLayer = NULL; +PFNGLGENFRAMEBUFFERSPROC __glewGenFramebuffers = NULL; +PFNGLGENRENDERBUFFERSPROC __glewGenRenderbuffers = NULL; +PFNGLGENERATEMIPMAPPROC __glewGenerateMipmap = NULL; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC __glewGetFramebufferAttachmentParameteriv = NULL; +PFNGLGETRENDERBUFFERPARAMETERIVPROC __glewGetRenderbufferParameteriv = NULL; +PFNGLISFRAMEBUFFERPROC __glewIsFramebuffer = NULL; +PFNGLISRENDERBUFFERPROC __glewIsRenderbuffer = NULL; +PFNGLRENDERBUFFERSTORAGEPROC __glewRenderbufferStorage = NULL; +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC __glewRenderbufferStorageMultisample = NULL; + +PFNGLFRAMEBUFFERTEXTUREARBPROC __glewFramebufferTextureARB = NULL; +PFNGLFRAMEBUFFERTEXTUREFACEARBPROC __glewFramebufferTextureFaceARB = NULL; +PFNGLFRAMEBUFFERTEXTURELAYERARBPROC __glewFramebufferTextureLayerARB = NULL; +PFNGLPROGRAMPARAMETERIARBPROC __glewProgramParameteriARB = NULL; + +PFNGLGETPROGRAMBINARYPROC __glewGetProgramBinary = NULL; +PFNGLPROGRAMBINARYPROC __glewProgramBinary = NULL; +PFNGLPROGRAMPARAMETERIPROC __glewProgramParameteri = NULL; + +PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC __glewGetCompressedTextureSubImage = NULL; +PFNGLGETTEXTURESUBIMAGEPROC __glewGetTextureSubImage = NULL; + +PFNGLGETUNIFORMDVPROC __glewGetUniformdv = NULL; +PFNGLUNIFORM1DPROC __glewUniform1d = NULL; +PFNGLUNIFORM1DVPROC __glewUniform1dv = NULL; +PFNGLUNIFORM2DPROC __glewUniform2d = NULL; +PFNGLUNIFORM2DVPROC __glewUniform2dv = NULL; +PFNGLUNIFORM3DPROC __glewUniform3d = NULL; +PFNGLUNIFORM3DVPROC __glewUniform3dv = NULL; +PFNGLUNIFORM4DPROC __glewUniform4d = NULL; +PFNGLUNIFORM4DVPROC __glewUniform4dv = NULL; +PFNGLUNIFORMMATRIX2DVPROC __glewUniformMatrix2dv = NULL; +PFNGLUNIFORMMATRIX2X3DVPROC __glewUniformMatrix2x3dv = NULL; +PFNGLUNIFORMMATRIX2X4DVPROC __glewUniformMatrix2x4dv = NULL; +PFNGLUNIFORMMATRIX3DVPROC __glewUniformMatrix3dv = NULL; +PFNGLUNIFORMMATRIX3X2DVPROC __glewUniformMatrix3x2dv = NULL; +PFNGLUNIFORMMATRIX3X4DVPROC __glewUniformMatrix3x4dv = NULL; +PFNGLUNIFORMMATRIX4DVPROC __glewUniformMatrix4dv = NULL; +PFNGLUNIFORMMATRIX4X2DVPROC __glewUniformMatrix4x2dv = NULL; +PFNGLUNIFORMMATRIX4X3DVPROC __glewUniformMatrix4x3dv = NULL; + +PFNGLGETUNIFORMI64VARBPROC __glewGetUniformi64vARB = NULL; +PFNGLGETUNIFORMUI64VARBPROC __glewGetUniformui64vARB = NULL; +PFNGLGETNUNIFORMI64VARBPROC __glewGetnUniformi64vARB = NULL; +PFNGLGETNUNIFORMUI64VARBPROC __glewGetnUniformui64vARB = NULL; +PFNGLPROGRAMUNIFORM1I64ARBPROC __glewProgramUniform1i64ARB = NULL; +PFNGLPROGRAMUNIFORM1I64VARBPROC __glewProgramUniform1i64vARB = NULL; +PFNGLPROGRAMUNIFORM1UI64ARBPROC __glewProgramUniform1ui64ARB = NULL; +PFNGLPROGRAMUNIFORM1UI64VARBPROC __glewProgramUniform1ui64vARB = NULL; +PFNGLPROGRAMUNIFORM2I64ARBPROC __glewProgramUniform2i64ARB = NULL; +PFNGLPROGRAMUNIFORM2I64VARBPROC __glewProgramUniform2i64vARB = NULL; +PFNGLPROGRAMUNIFORM2UI64ARBPROC __glewProgramUniform2ui64ARB = NULL; +PFNGLPROGRAMUNIFORM2UI64VARBPROC __glewProgramUniform2ui64vARB = NULL; +PFNGLPROGRAMUNIFORM3I64ARBPROC __glewProgramUniform3i64ARB = NULL; +PFNGLPROGRAMUNIFORM3I64VARBPROC __glewProgramUniform3i64vARB = NULL; +PFNGLPROGRAMUNIFORM3UI64ARBPROC __glewProgramUniform3ui64ARB = NULL; +PFNGLPROGRAMUNIFORM3UI64VARBPROC __glewProgramUniform3ui64vARB = NULL; +PFNGLPROGRAMUNIFORM4I64ARBPROC __glewProgramUniform4i64ARB = NULL; +PFNGLPROGRAMUNIFORM4I64VARBPROC __glewProgramUniform4i64vARB = NULL; +PFNGLPROGRAMUNIFORM4UI64ARBPROC __glewProgramUniform4ui64ARB = NULL; +PFNGLPROGRAMUNIFORM4UI64VARBPROC __glewProgramUniform4ui64vARB = NULL; +PFNGLUNIFORM1I64ARBPROC __glewUniform1i64ARB = NULL; +PFNGLUNIFORM1I64VARBPROC __glewUniform1i64vARB = NULL; +PFNGLUNIFORM1UI64ARBPROC __glewUniform1ui64ARB = NULL; +PFNGLUNIFORM1UI64VARBPROC __glewUniform1ui64vARB = NULL; +PFNGLUNIFORM2I64ARBPROC __glewUniform2i64ARB = NULL; +PFNGLUNIFORM2I64VARBPROC __glewUniform2i64vARB = NULL; +PFNGLUNIFORM2UI64ARBPROC __glewUniform2ui64ARB = NULL; +PFNGLUNIFORM2UI64VARBPROC __glewUniform2ui64vARB = NULL; +PFNGLUNIFORM3I64ARBPROC __glewUniform3i64ARB = NULL; +PFNGLUNIFORM3I64VARBPROC __glewUniform3i64vARB = NULL; +PFNGLUNIFORM3UI64ARBPROC __glewUniform3ui64ARB = NULL; +PFNGLUNIFORM3UI64VARBPROC __glewUniform3ui64vARB = NULL; +PFNGLUNIFORM4I64ARBPROC __glewUniform4i64ARB = NULL; +PFNGLUNIFORM4I64VARBPROC __glewUniform4i64vARB = NULL; +PFNGLUNIFORM4UI64ARBPROC __glewUniform4ui64ARB = NULL; +PFNGLUNIFORM4UI64VARBPROC __glewUniform4ui64vARB = NULL; + +PFNGLCOLORSUBTABLEPROC __glewColorSubTable = NULL; +PFNGLCOLORTABLEPROC __glewColorTable = NULL; +PFNGLCOLORTABLEPARAMETERFVPROC __glewColorTableParameterfv = NULL; +PFNGLCOLORTABLEPARAMETERIVPROC __glewColorTableParameteriv = NULL; +PFNGLCONVOLUTIONFILTER1DPROC __glewConvolutionFilter1D = NULL; +PFNGLCONVOLUTIONFILTER2DPROC __glewConvolutionFilter2D = NULL; +PFNGLCONVOLUTIONPARAMETERFPROC __glewConvolutionParameterf = NULL; +PFNGLCONVOLUTIONPARAMETERFVPROC __glewConvolutionParameterfv = NULL; +PFNGLCONVOLUTIONPARAMETERIPROC __glewConvolutionParameteri = NULL; +PFNGLCONVOLUTIONPARAMETERIVPROC __glewConvolutionParameteriv = NULL; +PFNGLCOPYCOLORSUBTABLEPROC __glewCopyColorSubTable = NULL; +PFNGLCOPYCOLORTABLEPROC __glewCopyColorTable = NULL; +PFNGLCOPYCONVOLUTIONFILTER1DPROC __glewCopyConvolutionFilter1D = NULL; +PFNGLCOPYCONVOLUTIONFILTER2DPROC __glewCopyConvolutionFilter2D = NULL; +PFNGLGETCOLORTABLEPROC __glewGetColorTable = NULL; +PFNGLGETCOLORTABLEPARAMETERFVPROC __glewGetColorTableParameterfv = NULL; +PFNGLGETCOLORTABLEPARAMETERIVPROC __glewGetColorTableParameteriv = NULL; +PFNGLGETCONVOLUTIONFILTERPROC __glewGetConvolutionFilter = NULL; +PFNGLGETCONVOLUTIONPARAMETERFVPROC __glewGetConvolutionParameterfv = NULL; +PFNGLGETCONVOLUTIONPARAMETERIVPROC __glewGetConvolutionParameteriv = NULL; +PFNGLGETHISTOGRAMPROC __glewGetHistogram = NULL; +PFNGLGETHISTOGRAMPARAMETERFVPROC __glewGetHistogramParameterfv = NULL; +PFNGLGETHISTOGRAMPARAMETERIVPROC __glewGetHistogramParameteriv = NULL; +PFNGLGETMINMAXPROC __glewGetMinmax = NULL; +PFNGLGETMINMAXPARAMETERFVPROC __glewGetMinmaxParameterfv = NULL; +PFNGLGETMINMAXPARAMETERIVPROC __glewGetMinmaxParameteriv = NULL; +PFNGLGETSEPARABLEFILTERPROC __glewGetSeparableFilter = NULL; +PFNGLHISTOGRAMPROC __glewHistogram = NULL; +PFNGLMINMAXPROC __glewMinmax = NULL; +PFNGLRESETHISTOGRAMPROC __glewResetHistogram = NULL; +PFNGLRESETMINMAXPROC __glewResetMinmax = NULL; +PFNGLSEPARABLEFILTER2DPROC __glewSeparableFilter2D = NULL; + +PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC __glewMultiDrawArraysIndirectCountARB = NULL; +PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC __glewMultiDrawElementsIndirectCountARB = NULL; + +PFNGLDRAWARRAYSINSTANCEDARBPROC __glewDrawArraysInstancedARB = NULL; +PFNGLDRAWELEMENTSINSTANCEDARBPROC __glewDrawElementsInstancedARB = NULL; +PFNGLVERTEXATTRIBDIVISORARBPROC __glewVertexAttribDivisorARB = NULL; + +PFNGLGETINTERNALFORMATIVPROC __glewGetInternalformativ = NULL; + +PFNGLGETINTERNALFORMATI64VPROC __glewGetInternalformati64v = NULL; + +PFNGLINVALIDATEBUFFERDATAPROC __glewInvalidateBufferData = NULL; +PFNGLINVALIDATEBUFFERSUBDATAPROC __glewInvalidateBufferSubData = NULL; +PFNGLINVALIDATEFRAMEBUFFERPROC __glewInvalidateFramebuffer = NULL; +PFNGLINVALIDATESUBFRAMEBUFFERPROC __glewInvalidateSubFramebuffer = NULL; +PFNGLINVALIDATETEXIMAGEPROC __glewInvalidateTexImage = NULL; +PFNGLINVALIDATETEXSUBIMAGEPROC __glewInvalidateTexSubImage = NULL; + +PFNGLFLUSHMAPPEDBUFFERRANGEPROC __glewFlushMappedBufferRange = NULL; +PFNGLMAPBUFFERRANGEPROC __glewMapBufferRange = NULL; + +PFNGLCURRENTPALETTEMATRIXARBPROC __glewCurrentPaletteMatrixARB = NULL; +PFNGLMATRIXINDEXPOINTERARBPROC __glewMatrixIndexPointerARB = NULL; +PFNGLMATRIXINDEXUBVARBPROC __glewMatrixIndexubvARB = NULL; +PFNGLMATRIXINDEXUIVARBPROC __glewMatrixIndexuivARB = NULL; +PFNGLMATRIXINDEXUSVARBPROC __glewMatrixIndexusvARB = NULL; + +PFNGLBINDBUFFERSBASEPROC __glewBindBuffersBase = NULL; +PFNGLBINDBUFFERSRANGEPROC __glewBindBuffersRange = NULL; +PFNGLBINDIMAGETEXTURESPROC __glewBindImageTextures = NULL; +PFNGLBINDSAMPLERSPROC __glewBindSamplers = NULL; +PFNGLBINDTEXTURESPROC __glewBindTextures = NULL; +PFNGLBINDVERTEXBUFFERSPROC __glewBindVertexBuffers = NULL; + +PFNGLMULTIDRAWARRAYSINDIRECTPROC __glewMultiDrawArraysIndirect = NULL; +PFNGLMULTIDRAWELEMENTSINDIRECTPROC __glewMultiDrawElementsIndirect = NULL; + +PFNGLSAMPLECOVERAGEARBPROC __glewSampleCoverageARB = NULL; + +PFNGLACTIVETEXTUREARBPROC __glewActiveTextureARB = NULL; +PFNGLCLIENTACTIVETEXTUREARBPROC __glewClientActiveTextureARB = NULL; +PFNGLMULTITEXCOORD1DARBPROC __glewMultiTexCoord1dARB = NULL; +PFNGLMULTITEXCOORD1DVARBPROC __glewMultiTexCoord1dvARB = NULL; +PFNGLMULTITEXCOORD1FARBPROC __glewMultiTexCoord1fARB = NULL; +PFNGLMULTITEXCOORD1FVARBPROC __glewMultiTexCoord1fvARB = NULL; +PFNGLMULTITEXCOORD1IARBPROC __glewMultiTexCoord1iARB = NULL; +PFNGLMULTITEXCOORD1IVARBPROC __glewMultiTexCoord1ivARB = NULL; +PFNGLMULTITEXCOORD1SARBPROC __glewMultiTexCoord1sARB = NULL; +PFNGLMULTITEXCOORD1SVARBPROC __glewMultiTexCoord1svARB = NULL; +PFNGLMULTITEXCOORD2DARBPROC __glewMultiTexCoord2dARB = NULL; +PFNGLMULTITEXCOORD2DVARBPROC __glewMultiTexCoord2dvARB = NULL; +PFNGLMULTITEXCOORD2FARBPROC __glewMultiTexCoord2fARB = NULL; +PFNGLMULTITEXCOORD2FVARBPROC __glewMultiTexCoord2fvARB = NULL; +PFNGLMULTITEXCOORD2IARBPROC __glewMultiTexCoord2iARB = NULL; +PFNGLMULTITEXCOORD2IVARBPROC __glewMultiTexCoord2ivARB = NULL; +PFNGLMULTITEXCOORD2SARBPROC __glewMultiTexCoord2sARB = NULL; +PFNGLMULTITEXCOORD2SVARBPROC __glewMultiTexCoord2svARB = NULL; +PFNGLMULTITEXCOORD3DARBPROC __glewMultiTexCoord3dARB = NULL; +PFNGLMULTITEXCOORD3DVARBPROC __glewMultiTexCoord3dvARB = NULL; +PFNGLMULTITEXCOORD3FARBPROC __glewMultiTexCoord3fARB = NULL; +PFNGLMULTITEXCOORD3FVARBPROC __glewMultiTexCoord3fvARB = NULL; +PFNGLMULTITEXCOORD3IARBPROC __glewMultiTexCoord3iARB = NULL; +PFNGLMULTITEXCOORD3IVARBPROC __glewMultiTexCoord3ivARB = NULL; +PFNGLMULTITEXCOORD3SARBPROC __glewMultiTexCoord3sARB = NULL; +PFNGLMULTITEXCOORD3SVARBPROC __glewMultiTexCoord3svARB = NULL; +PFNGLMULTITEXCOORD4DARBPROC __glewMultiTexCoord4dARB = NULL; +PFNGLMULTITEXCOORD4DVARBPROC __glewMultiTexCoord4dvARB = NULL; +PFNGLMULTITEXCOORD4FARBPROC __glewMultiTexCoord4fARB = NULL; +PFNGLMULTITEXCOORD4FVARBPROC __glewMultiTexCoord4fvARB = NULL; +PFNGLMULTITEXCOORD4IARBPROC __glewMultiTexCoord4iARB = NULL; +PFNGLMULTITEXCOORD4IVARBPROC __glewMultiTexCoord4ivARB = NULL; +PFNGLMULTITEXCOORD4SARBPROC __glewMultiTexCoord4sARB = NULL; +PFNGLMULTITEXCOORD4SVARBPROC __glewMultiTexCoord4svARB = NULL; + +PFNGLBEGINQUERYARBPROC __glewBeginQueryARB = NULL; +PFNGLDELETEQUERIESARBPROC __glewDeleteQueriesARB = NULL; +PFNGLENDQUERYARBPROC __glewEndQueryARB = NULL; +PFNGLGENQUERIESARBPROC __glewGenQueriesARB = NULL; +PFNGLGETQUERYOBJECTIVARBPROC __glewGetQueryObjectivARB = NULL; +PFNGLGETQUERYOBJECTUIVARBPROC __glewGetQueryObjectuivARB = NULL; +PFNGLGETQUERYIVARBPROC __glewGetQueryivARB = NULL; +PFNGLISQUERYARBPROC __glewIsQueryARB = NULL; + +PFNGLMAXSHADERCOMPILERTHREADSARBPROC __glewMaxShaderCompilerThreadsARB = NULL; + +PFNGLPOINTPARAMETERFARBPROC __glewPointParameterfARB = NULL; +PFNGLPOINTPARAMETERFVARBPROC __glewPointParameterfvARB = NULL; + +PFNGLGETPROGRAMINTERFACEIVPROC __glewGetProgramInterfaceiv = NULL; +PFNGLGETPROGRAMRESOURCEINDEXPROC __glewGetProgramResourceIndex = NULL; +PFNGLGETPROGRAMRESOURCELOCATIONPROC __glewGetProgramResourceLocation = NULL; +PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC __glewGetProgramResourceLocationIndex = NULL; +PFNGLGETPROGRAMRESOURCENAMEPROC __glewGetProgramResourceName = NULL; +PFNGLGETPROGRAMRESOURCEIVPROC __glewGetProgramResourceiv = NULL; + +PFNGLPROVOKINGVERTEXPROC __glewProvokingVertex = NULL; + +PFNGLGETGRAPHICSRESETSTATUSARBPROC __glewGetGraphicsResetStatusARB = NULL; +PFNGLGETNCOLORTABLEARBPROC __glewGetnColorTableARB = NULL; +PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC __glewGetnCompressedTexImageARB = NULL; +PFNGLGETNCONVOLUTIONFILTERARBPROC __glewGetnConvolutionFilterARB = NULL; +PFNGLGETNHISTOGRAMARBPROC __glewGetnHistogramARB = NULL; +PFNGLGETNMAPDVARBPROC __glewGetnMapdvARB = NULL; +PFNGLGETNMAPFVARBPROC __glewGetnMapfvARB = NULL; +PFNGLGETNMAPIVARBPROC __glewGetnMapivARB = NULL; +PFNGLGETNMINMAXARBPROC __glewGetnMinmaxARB = NULL; +PFNGLGETNPIXELMAPFVARBPROC __glewGetnPixelMapfvARB = NULL; +PFNGLGETNPIXELMAPUIVARBPROC __glewGetnPixelMapuivARB = NULL; +PFNGLGETNPIXELMAPUSVARBPROC __glewGetnPixelMapusvARB = NULL; +PFNGLGETNPOLYGONSTIPPLEARBPROC __glewGetnPolygonStippleARB = NULL; +PFNGLGETNSEPARABLEFILTERARBPROC __glewGetnSeparableFilterARB = NULL; +PFNGLGETNTEXIMAGEARBPROC __glewGetnTexImageARB = NULL; +PFNGLGETNUNIFORMDVARBPROC __glewGetnUniformdvARB = NULL; +PFNGLGETNUNIFORMFVARBPROC __glewGetnUniformfvARB = NULL; +PFNGLGETNUNIFORMIVARBPROC __glewGetnUniformivARB = NULL; +PFNGLGETNUNIFORMUIVARBPROC __glewGetnUniformuivARB = NULL; +PFNGLREADNPIXELSARBPROC __glewReadnPixelsARB = NULL; + +PFNGLFRAMEBUFFERSAMPLELOCATIONSFVARBPROC __glewFramebufferSampleLocationsfvARB = NULL; +PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVARBPROC __glewNamedFramebufferSampleLocationsfvARB = NULL; + +PFNGLMINSAMPLESHADINGARBPROC __glewMinSampleShadingARB = NULL; + +PFNGLBINDSAMPLERPROC __glewBindSampler = NULL; +PFNGLDELETESAMPLERSPROC __glewDeleteSamplers = NULL; +PFNGLGENSAMPLERSPROC __glewGenSamplers = NULL; +PFNGLGETSAMPLERPARAMETERIIVPROC __glewGetSamplerParameterIiv = NULL; +PFNGLGETSAMPLERPARAMETERIUIVPROC __glewGetSamplerParameterIuiv = NULL; +PFNGLGETSAMPLERPARAMETERFVPROC __glewGetSamplerParameterfv = NULL; +PFNGLGETSAMPLERPARAMETERIVPROC __glewGetSamplerParameteriv = NULL; +PFNGLISSAMPLERPROC __glewIsSampler = NULL; +PFNGLSAMPLERPARAMETERIIVPROC __glewSamplerParameterIiv = NULL; +PFNGLSAMPLERPARAMETERIUIVPROC __glewSamplerParameterIuiv = NULL; +PFNGLSAMPLERPARAMETERFPROC __glewSamplerParameterf = NULL; +PFNGLSAMPLERPARAMETERFVPROC __glewSamplerParameterfv = NULL; +PFNGLSAMPLERPARAMETERIPROC __glewSamplerParameteri = NULL; +PFNGLSAMPLERPARAMETERIVPROC __glewSamplerParameteriv = NULL; + +PFNGLACTIVESHADERPROGRAMPROC __glewActiveShaderProgram = NULL; +PFNGLBINDPROGRAMPIPELINEPROC __glewBindProgramPipeline = NULL; +PFNGLCREATESHADERPROGRAMVPROC __glewCreateShaderProgramv = NULL; +PFNGLDELETEPROGRAMPIPELINESPROC __glewDeleteProgramPipelines = NULL; +PFNGLGENPROGRAMPIPELINESPROC __glewGenProgramPipelines = NULL; +PFNGLGETPROGRAMPIPELINEINFOLOGPROC __glewGetProgramPipelineInfoLog = NULL; +PFNGLGETPROGRAMPIPELINEIVPROC __glewGetProgramPipelineiv = NULL; +PFNGLISPROGRAMPIPELINEPROC __glewIsProgramPipeline = NULL; +PFNGLPROGRAMUNIFORM1DPROC __glewProgramUniform1d = NULL; +PFNGLPROGRAMUNIFORM1DVPROC __glewProgramUniform1dv = NULL; +PFNGLPROGRAMUNIFORM1FPROC __glewProgramUniform1f = NULL; +PFNGLPROGRAMUNIFORM1FVPROC __glewProgramUniform1fv = NULL; +PFNGLPROGRAMUNIFORM1IPROC __glewProgramUniform1i = NULL; +PFNGLPROGRAMUNIFORM1IVPROC __glewProgramUniform1iv = NULL; +PFNGLPROGRAMUNIFORM1UIPROC __glewProgramUniform1ui = NULL; +PFNGLPROGRAMUNIFORM1UIVPROC __glewProgramUniform1uiv = NULL; +PFNGLPROGRAMUNIFORM2DPROC __glewProgramUniform2d = NULL; +PFNGLPROGRAMUNIFORM2DVPROC __glewProgramUniform2dv = NULL; +PFNGLPROGRAMUNIFORM2FPROC __glewProgramUniform2f = NULL; +PFNGLPROGRAMUNIFORM2FVPROC __glewProgramUniform2fv = NULL; +PFNGLPROGRAMUNIFORM2IPROC __glewProgramUniform2i = NULL; +PFNGLPROGRAMUNIFORM2IVPROC __glewProgramUniform2iv = NULL; +PFNGLPROGRAMUNIFORM2UIPROC __glewProgramUniform2ui = NULL; +PFNGLPROGRAMUNIFORM2UIVPROC __glewProgramUniform2uiv = NULL; +PFNGLPROGRAMUNIFORM3DPROC __glewProgramUniform3d = NULL; +PFNGLPROGRAMUNIFORM3DVPROC __glewProgramUniform3dv = NULL; +PFNGLPROGRAMUNIFORM3FPROC __glewProgramUniform3f = NULL; +PFNGLPROGRAMUNIFORM3FVPROC __glewProgramUniform3fv = NULL; +PFNGLPROGRAMUNIFORM3IPROC __glewProgramUniform3i = NULL; +PFNGLPROGRAMUNIFORM3IVPROC __glewProgramUniform3iv = NULL; +PFNGLPROGRAMUNIFORM3UIPROC __glewProgramUniform3ui = NULL; +PFNGLPROGRAMUNIFORM3UIVPROC __glewProgramUniform3uiv = NULL; +PFNGLPROGRAMUNIFORM4DPROC __glewProgramUniform4d = NULL; +PFNGLPROGRAMUNIFORM4DVPROC __glewProgramUniform4dv = NULL; +PFNGLPROGRAMUNIFORM4FPROC __glewProgramUniform4f = NULL; +PFNGLPROGRAMUNIFORM4FVPROC __glewProgramUniform4fv = NULL; +PFNGLPROGRAMUNIFORM4IPROC __glewProgramUniform4i = NULL; +PFNGLPROGRAMUNIFORM4IVPROC __glewProgramUniform4iv = NULL; +PFNGLPROGRAMUNIFORM4UIPROC __glewProgramUniform4ui = NULL; +PFNGLPROGRAMUNIFORM4UIVPROC __glewProgramUniform4uiv = NULL; +PFNGLPROGRAMUNIFORMMATRIX2DVPROC __glewProgramUniformMatrix2dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX2FVPROC __glewProgramUniformMatrix2fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC __glewProgramUniformMatrix2x3dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC __glewProgramUniformMatrix2x3fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC __glewProgramUniformMatrix2x4dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC __glewProgramUniformMatrix2x4fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX3DVPROC __glewProgramUniformMatrix3dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX3FVPROC __glewProgramUniformMatrix3fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC __glewProgramUniformMatrix3x2dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC __glewProgramUniformMatrix3x2fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC __glewProgramUniformMatrix3x4dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC __glewProgramUniformMatrix3x4fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX4DVPROC __glewProgramUniformMatrix4dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX4FVPROC __glewProgramUniformMatrix4fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC __glewProgramUniformMatrix4x2dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC __glewProgramUniformMatrix4x2fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC __glewProgramUniformMatrix4x3dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC __glewProgramUniformMatrix4x3fv = NULL; +PFNGLUSEPROGRAMSTAGESPROC __glewUseProgramStages = NULL; +PFNGLVALIDATEPROGRAMPIPELINEPROC __glewValidateProgramPipeline = NULL; + +PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC __glewGetActiveAtomicCounterBufferiv = NULL; + +PFNGLBINDIMAGETEXTUREPROC __glewBindImageTexture = NULL; +PFNGLMEMORYBARRIERPROC __glewMemoryBarrier = NULL; + +PFNGLATTACHOBJECTARBPROC __glewAttachObjectARB = NULL; +PFNGLCOMPILESHADERARBPROC __glewCompileShaderARB = NULL; +PFNGLCREATEPROGRAMOBJECTARBPROC __glewCreateProgramObjectARB = NULL; +PFNGLCREATESHADEROBJECTARBPROC __glewCreateShaderObjectARB = NULL; +PFNGLDELETEOBJECTARBPROC __glewDeleteObjectARB = NULL; +PFNGLDETACHOBJECTARBPROC __glewDetachObjectARB = NULL; +PFNGLGETACTIVEUNIFORMARBPROC __glewGetActiveUniformARB = NULL; +PFNGLGETATTACHEDOBJECTSARBPROC __glewGetAttachedObjectsARB = NULL; +PFNGLGETHANDLEARBPROC __glewGetHandleARB = NULL; +PFNGLGETINFOLOGARBPROC __glewGetInfoLogARB = NULL; +PFNGLGETOBJECTPARAMETERFVARBPROC __glewGetObjectParameterfvARB = NULL; +PFNGLGETOBJECTPARAMETERIVARBPROC __glewGetObjectParameterivARB = NULL; +PFNGLGETSHADERSOURCEARBPROC __glewGetShaderSourceARB = NULL; +PFNGLGETUNIFORMLOCATIONARBPROC __glewGetUniformLocationARB = NULL; +PFNGLGETUNIFORMFVARBPROC __glewGetUniformfvARB = NULL; +PFNGLGETUNIFORMIVARBPROC __glewGetUniformivARB = NULL; +PFNGLLINKPROGRAMARBPROC __glewLinkProgramARB = NULL; +PFNGLSHADERSOURCEARBPROC __glewShaderSourceARB = NULL; +PFNGLUNIFORM1FARBPROC __glewUniform1fARB = NULL; +PFNGLUNIFORM1FVARBPROC __glewUniform1fvARB = NULL; +PFNGLUNIFORM1IARBPROC __glewUniform1iARB = NULL; +PFNGLUNIFORM1IVARBPROC __glewUniform1ivARB = NULL; +PFNGLUNIFORM2FARBPROC __glewUniform2fARB = NULL; +PFNGLUNIFORM2FVARBPROC __glewUniform2fvARB = NULL; +PFNGLUNIFORM2IARBPROC __glewUniform2iARB = NULL; +PFNGLUNIFORM2IVARBPROC __glewUniform2ivARB = NULL; +PFNGLUNIFORM3FARBPROC __glewUniform3fARB = NULL; +PFNGLUNIFORM3FVARBPROC __glewUniform3fvARB = NULL; +PFNGLUNIFORM3IARBPROC __glewUniform3iARB = NULL; +PFNGLUNIFORM3IVARBPROC __glewUniform3ivARB = NULL; +PFNGLUNIFORM4FARBPROC __glewUniform4fARB = NULL; +PFNGLUNIFORM4FVARBPROC __glewUniform4fvARB = NULL; +PFNGLUNIFORM4IARBPROC __glewUniform4iARB = NULL; +PFNGLUNIFORM4IVARBPROC __glewUniform4ivARB = NULL; +PFNGLUNIFORMMATRIX2FVARBPROC __glewUniformMatrix2fvARB = NULL; +PFNGLUNIFORMMATRIX3FVARBPROC __glewUniformMatrix3fvARB = NULL; +PFNGLUNIFORMMATRIX4FVARBPROC __glewUniformMatrix4fvARB = NULL; +PFNGLUSEPROGRAMOBJECTARBPROC __glewUseProgramObjectARB = NULL; +PFNGLVALIDATEPROGRAMARBPROC __glewValidateProgramARB = NULL; + +PFNGLSHADERSTORAGEBLOCKBINDINGPROC __glewShaderStorageBlockBinding = NULL; + +PFNGLGETACTIVESUBROUTINENAMEPROC __glewGetActiveSubroutineName = NULL; +PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC __glewGetActiveSubroutineUniformName = NULL; +PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC __glewGetActiveSubroutineUniformiv = NULL; +PFNGLGETPROGRAMSTAGEIVPROC __glewGetProgramStageiv = NULL; +PFNGLGETSUBROUTINEINDEXPROC __glewGetSubroutineIndex = NULL; +PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC __glewGetSubroutineUniformLocation = NULL; +PFNGLGETUNIFORMSUBROUTINEUIVPROC __glewGetUniformSubroutineuiv = NULL; +PFNGLUNIFORMSUBROUTINESUIVPROC __glewUniformSubroutinesuiv = NULL; + +PFNGLCOMPILESHADERINCLUDEARBPROC __glewCompileShaderIncludeARB = NULL; +PFNGLDELETENAMEDSTRINGARBPROC __glewDeleteNamedStringARB = NULL; +PFNGLGETNAMEDSTRINGARBPROC __glewGetNamedStringARB = NULL; +PFNGLGETNAMEDSTRINGIVARBPROC __glewGetNamedStringivARB = NULL; +PFNGLISNAMEDSTRINGARBPROC __glewIsNamedStringARB = NULL; +PFNGLNAMEDSTRINGARBPROC __glewNamedStringARB = NULL; + +PFNGLBUFFERPAGECOMMITMENTARBPROC __glewBufferPageCommitmentARB = NULL; + +PFNGLTEXPAGECOMMITMENTARBPROC __glewTexPageCommitmentARB = NULL; +PFNGLTEXTUREPAGECOMMITMENTEXTPROC __glewTexturePageCommitmentEXT = NULL; + +PFNGLCLIENTWAITSYNCPROC __glewClientWaitSync = NULL; +PFNGLDELETESYNCPROC __glewDeleteSync = NULL; +PFNGLFENCESYNCPROC __glewFenceSync = NULL; +PFNGLGETINTEGER64VPROC __glewGetInteger64v = NULL; +PFNGLGETSYNCIVPROC __glewGetSynciv = NULL; +PFNGLISSYNCPROC __glewIsSync = NULL; +PFNGLWAITSYNCPROC __glewWaitSync = NULL; + +PFNGLPATCHPARAMETERFVPROC __glewPatchParameterfv = NULL; +PFNGLPATCHPARAMETERIPROC __glewPatchParameteri = NULL; + +PFNGLTEXTUREBARRIERPROC __glewTextureBarrier = NULL; + +PFNGLTEXBUFFERARBPROC __glewTexBufferARB = NULL; + +PFNGLTEXBUFFERRANGEPROC __glewTexBufferRange = NULL; +PFNGLTEXTUREBUFFERRANGEEXTPROC __glewTextureBufferRangeEXT = NULL; + +PFNGLCOMPRESSEDTEXIMAGE1DARBPROC __glewCompressedTexImage1DARB = NULL; +PFNGLCOMPRESSEDTEXIMAGE2DARBPROC __glewCompressedTexImage2DARB = NULL; +PFNGLCOMPRESSEDTEXIMAGE3DARBPROC __glewCompressedTexImage3DARB = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC __glewCompressedTexSubImage1DARB = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC __glewCompressedTexSubImage2DARB = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC __glewCompressedTexSubImage3DARB = NULL; +PFNGLGETCOMPRESSEDTEXIMAGEARBPROC __glewGetCompressedTexImageARB = NULL; + +PFNGLGETMULTISAMPLEFVPROC __glewGetMultisamplefv = NULL; +PFNGLSAMPLEMASKIPROC __glewSampleMaski = NULL; +PFNGLTEXIMAGE2DMULTISAMPLEPROC __glewTexImage2DMultisample = NULL; +PFNGLTEXIMAGE3DMULTISAMPLEPROC __glewTexImage3DMultisample = NULL; + +PFNGLTEXSTORAGE1DPROC __glewTexStorage1D = NULL; +PFNGLTEXSTORAGE2DPROC __glewTexStorage2D = NULL; +PFNGLTEXSTORAGE3DPROC __glewTexStorage3D = NULL; +PFNGLTEXTURESTORAGE1DEXTPROC __glewTextureStorage1DEXT = NULL; +PFNGLTEXTURESTORAGE2DEXTPROC __glewTextureStorage2DEXT = NULL; +PFNGLTEXTURESTORAGE3DEXTPROC __glewTextureStorage3DEXT = NULL; + +PFNGLTEXSTORAGE2DMULTISAMPLEPROC __glewTexStorage2DMultisample = NULL; +PFNGLTEXSTORAGE3DMULTISAMPLEPROC __glewTexStorage3DMultisample = NULL; +PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC __glewTextureStorage2DMultisampleEXT = NULL; +PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC __glewTextureStorage3DMultisampleEXT = NULL; + +PFNGLTEXTUREVIEWPROC __glewTextureView = NULL; + +PFNGLGETQUERYOBJECTI64VPROC __glewGetQueryObjecti64v = NULL; +PFNGLGETQUERYOBJECTUI64VPROC __glewGetQueryObjectui64v = NULL; +PFNGLQUERYCOUNTERPROC __glewQueryCounter = NULL; + +PFNGLBINDTRANSFORMFEEDBACKPROC __glewBindTransformFeedback = NULL; +PFNGLDELETETRANSFORMFEEDBACKSPROC __glewDeleteTransformFeedbacks = NULL; +PFNGLDRAWTRANSFORMFEEDBACKPROC __glewDrawTransformFeedback = NULL; +PFNGLGENTRANSFORMFEEDBACKSPROC __glewGenTransformFeedbacks = NULL; +PFNGLISTRANSFORMFEEDBACKPROC __glewIsTransformFeedback = NULL; +PFNGLPAUSETRANSFORMFEEDBACKPROC __glewPauseTransformFeedback = NULL; +PFNGLRESUMETRANSFORMFEEDBACKPROC __glewResumeTransformFeedback = NULL; + +PFNGLBEGINQUERYINDEXEDPROC __glewBeginQueryIndexed = NULL; +PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC __glewDrawTransformFeedbackStream = NULL; +PFNGLENDQUERYINDEXEDPROC __glewEndQueryIndexed = NULL; +PFNGLGETQUERYINDEXEDIVPROC __glewGetQueryIndexediv = NULL; + +PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC __glewDrawTransformFeedbackInstanced = NULL; +PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC __glewDrawTransformFeedbackStreamInstanced = NULL; + +PFNGLLOADTRANSPOSEMATRIXDARBPROC __glewLoadTransposeMatrixdARB = NULL; +PFNGLLOADTRANSPOSEMATRIXFARBPROC __glewLoadTransposeMatrixfARB = NULL; +PFNGLMULTTRANSPOSEMATRIXDARBPROC __glewMultTransposeMatrixdARB = NULL; +PFNGLMULTTRANSPOSEMATRIXFARBPROC __glewMultTransposeMatrixfARB = NULL; + +PFNGLBINDBUFFERBASEPROC __glewBindBufferBase = NULL; +PFNGLBINDBUFFERRANGEPROC __glewBindBufferRange = NULL; +PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC __glewGetActiveUniformBlockName = NULL; +PFNGLGETACTIVEUNIFORMBLOCKIVPROC __glewGetActiveUniformBlockiv = NULL; +PFNGLGETACTIVEUNIFORMNAMEPROC __glewGetActiveUniformName = NULL; +PFNGLGETACTIVEUNIFORMSIVPROC __glewGetActiveUniformsiv = NULL; +PFNGLGETINTEGERI_VPROC __glewGetIntegeri_v = NULL; +PFNGLGETUNIFORMBLOCKINDEXPROC __glewGetUniformBlockIndex = NULL; +PFNGLGETUNIFORMINDICESPROC __glewGetUniformIndices = NULL; +PFNGLUNIFORMBLOCKBINDINGPROC __glewUniformBlockBinding = NULL; + +PFNGLBINDVERTEXARRAYPROC __glewBindVertexArray = NULL; +PFNGLDELETEVERTEXARRAYSPROC __glewDeleteVertexArrays = NULL; +PFNGLGENVERTEXARRAYSPROC __glewGenVertexArrays = NULL; +PFNGLISVERTEXARRAYPROC __glewIsVertexArray = NULL; + +PFNGLGETVERTEXATTRIBLDVPROC __glewGetVertexAttribLdv = NULL; +PFNGLVERTEXATTRIBL1DPROC __glewVertexAttribL1d = NULL; +PFNGLVERTEXATTRIBL1DVPROC __glewVertexAttribL1dv = NULL; +PFNGLVERTEXATTRIBL2DPROC __glewVertexAttribL2d = NULL; +PFNGLVERTEXATTRIBL2DVPROC __glewVertexAttribL2dv = NULL; +PFNGLVERTEXATTRIBL3DPROC __glewVertexAttribL3d = NULL; +PFNGLVERTEXATTRIBL3DVPROC __glewVertexAttribL3dv = NULL; +PFNGLVERTEXATTRIBL4DPROC __glewVertexAttribL4d = NULL; +PFNGLVERTEXATTRIBL4DVPROC __glewVertexAttribL4dv = NULL; +PFNGLVERTEXATTRIBLPOINTERPROC __glewVertexAttribLPointer = NULL; + +PFNGLBINDVERTEXBUFFERPROC __glewBindVertexBuffer = NULL; +PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC __glewVertexArrayBindVertexBufferEXT = NULL; +PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC __glewVertexArrayVertexAttribBindingEXT = NULL; +PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC __glewVertexArrayVertexAttribFormatEXT = NULL; +PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC __glewVertexArrayVertexAttribIFormatEXT = NULL; +PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC __glewVertexArrayVertexAttribLFormatEXT = NULL; +PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC __glewVertexArrayVertexBindingDivisorEXT = NULL; +PFNGLVERTEXATTRIBBINDINGPROC __glewVertexAttribBinding = NULL; +PFNGLVERTEXATTRIBFORMATPROC __glewVertexAttribFormat = NULL; +PFNGLVERTEXATTRIBIFORMATPROC __glewVertexAttribIFormat = NULL; +PFNGLVERTEXATTRIBLFORMATPROC __glewVertexAttribLFormat = NULL; +PFNGLVERTEXBINDINGDIVISORPROC __glewVertexBindingDivisor = NULL; + +PFNGLVERTEXBLENDARBPROC __glewVertexBlendARB = NULL; +PFNGLWEIGHTPOINTERARBPROC __glewWeightPointerARB = NULL; +PFNGLWEIGHTBVARBPROC __glewWeightbvARB = NULL; +PFNGLWEIGHTDVARBPROC __glewWeightdvARB = NULL; +PFNGLWEIGHTFVARBPROC __glewWeightfvARB = NULL; +PFNGLWEIGHTIVARBPROC __glewWeightivARB = NULL; +PFNGLWEIGHTSVARBPROC __glewWeightsvARB = NULL; +PFNGLWEIGHTUBVARBPROC __glewWeightubvARB = NULL; +PFNGLWEIGHTUIVARBPROC __glewWeightuivARB = NULL; +PFNGLWEIGHTUSVARBPROC __glewWeightusvARB = NULL; + +PFNGLBINDBUFFERARBPROC __glewBindBufferARB = NULL; +PFNGLBUFFERDATAARBPROC __glewBufferDataARB = NULL; +PFNGLBUFFERSUBDATAARBPROC __glewBufferSubDataARB = NULL; +PFNGLDELETEBUFFERSARBPROC __glewDeleteBuffersARB = NULL; +PFNGLGENBUFFERSARBPROC __glewGenBuffersARB = NULL; +PFNGLGETBUFFERPARAMETERIVARBPROC __glewGetBufferParameterivARB = NULL; +PFNGLGETBUFFERPOINTERVARBPROC __glewGetBufferPointervARB = NULL; +PFNGLGETBUFFERSUBDATAARBPROC __glewGetBufferSubDataARB = NULL; +PFNGLISBUFFERARBPROC __glewIsBufferARB = NULL; +PFNGLMAPBUFFERARBPROC __glewMapBufferARB = NULL; +PFNGLUNMAPBUFFERARBPROC __glewUnmapBufferARB = NULL; + +PFNGLBINDPROGRAMARBPROC __glewBindProgramARB = NULL; +PFNGLDELETEPROGRAMSARBPROC __glewDeleteProgramsARB = NULL; +PFNGLDISABLEVERTEXATTRIBARRAYARBPROC __glewDisableVertexAttribArrayARB = NULL; +PFNGLENABLEVERTEXATTRIBARRAYARBPROC __glewEnableVertexAttribArrayARB = NULL; +PFNGLGENPROGRAMSARBPROC __glewGenProgramsARB = NULL; +PFNGLGETPROGRAMENVPARAMETERDVARBPROC __glewGetProgramEnvParameterdvARB = NULL; +PFNGLGETPROGRAMENVPARAMETERFVARBPROC __glewGetProgramEnvParameterfvARB = NULL; +PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC __glewGetProgramLocalParameterdvARB = NULL; +PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC __glewGetProgramLocalParameterfvARB = NULL; +PFNGLGETPROGRAMSTRINGARBPROC __glewGetProgramStringARB = NULL; +PFNGLGETPROGRAMIVARBPROC __glewGetProgramivARB = NULL; +PFNGLGETVERTEXATTRIBPOINTERVARBPROC __glewGetVertexAttribPointervARB = NULL; +PFNGLGETVERTEXATTRIBDVARBPROC __glewGetVertexAttribdvARB = NULL; +PFNGLGETVERTEXATTRIBFVARBPROC __glewGetVertexAttribfvARB = NULL; +PFNGLGETVERTEXATTRIBIVARBPROC __glewGetVertexAttribivARB = NULL; +PFNGLISPROGRAMARBPROC __glewIsProgramARB = NULL; +PFNGLPROGRAMENVPARAMETER4DARBPROC __glewProgramEnvParameter4dARB = NULL; +PFNGLPROGRAMENVPARAMETER4DVARBPROC __glewProgramEnvParameter4dvARB = NULL; +PFNGLPROGRAMENVPARAMETER4FARBPROC __glewProgramEnvParameter4fARB = NULL; +PFNGLPROGRAMENVPARAMETER4FVARBPROC __glewProgramEnvParameter4fvARB = NULL; +PFNGLPROGRAMLOCALPARAMETER4DARBPROC __glewProgramLocalParameter4dARB = NULL; +PFNGLPROGRAMLOCALPARAMETER4DVARBPROC __glewProgramLocalParameter4dvARB = NULL; +PFNGLPROGRAMLOCALPARAMETER4FARBPROC __glewProgramLocalParameter4fARB = NULL; +PFNGLPROGRAMLOCALPARAMETER4FVARBPROC __glewProgramLocalParameter4fvARB = NULL; +PFNGLPROGRAMSTRINGARBPROC __glewProgramStringARB = NULL; +PFNGLVERTEXATTRIB1DARBPROC __glewVertexAttrib1dARB = NULL; +PFNGLVERTEXATTRIB1DVARBPROC __glewVertexAttrib1dvARB = NULL; +PFNGLVERTEXATTRIB1FARBPROC __glewVertexAttrib1fARB = NULL; +PFNGLVERTEXATTRIB1FVARBPROC __glewVertexAttrib1fvARB = NULL; +PFNGLVERTEXATTRIB1SARBPROC __glewVertexAttrib1sARB = NULL; +PFNGLVERTEXATTRIB1SVARBPROC __glewVertexAttrib1svARB = NULL; +PFNGLVERTEXATTRIB2DARBPROC __glewVertexAttrib2dARB = NULL; +PFNGLVERTEXATTRIB2DVARBPROC __glewVertexAttrib2dvARB = NULL; +PFNGLVERTEXATTRIB2FARBPROC __glewVertexAttrib2fARB = NULL; +PFNGLVERTEXATTRIB2FVARBPROC __glewVertexAttrib2fvARB = NULL; +PFNGLVERTEXATTRIB2SARBPROC __glewVertexAttrib2sARB = NULL; +PFNGLVERTEXATTRIB2SVARBPROC __glewVertexAttrib2svARB = NULL; +PFNGLVERTEXATTRIB3DARBPROC __glewVertexAttrib3dARB = NULL; +PFNGLVERTEXATTRIB3DVARBPROC __glewVertexAttrib3dvARB = NULL; +PFNGLVERTEXATTRIB3FARBPROC __glewVertexAttrib3fARB = NULL; +PFNGLVERTEXATTRIB3FVARBPROC __glewVertexAttrib3fvARB = NULL; +PFNGLVERTEXATTRIB3SARBPROC __glewVertexAttrib3sARB = NULL; +PFNGLVERTEXATTRIB3SVARBPROC __glewVertexAttrib3svARB = NULL; +PFNGLVERTEXATTRIB4NBVARBPROC __glewVertexAttrib4NbvARB = NULL; +PFNGLVERTEXATTRIB4NIVARBPROC __glewVertexAttrib4NivARB = NULL; +PFNGLVERTEXATTRIB4NSVARBPROC __glewVertexAttrib4NsvARB = NULL; +PFNGLVERTEXATTRIB4NUBARBPROC __glewVertexAttrib4NubARB = NULL; +PFNGLVERTEXATTRIB4NUBVARBPROC __glewVertexAttrib4NubvARB = NULL; +PFNGLVERTEXATTRIB4NUIVARBPROC __glewVertexAttrib4NuivARB = NULL; +PFNGLVERTEXATTRIB4NUSVARBPROC __glewVertexAttrib4NusvARB = NULL; +PFNGLVERTEXATTRIB4BVARBPROC __glewVertexAttrib4bvARB = NULL; +PFNGLVERTEXATTRIB4DARBPROC __glewVertexAttrib4dARB = NULL; +PFNGLVERTEXATTRIB4DVARBPROC __glewVertexAttrib4dvARB = NULL; +PFNGLVERTEXATTRIB4FARBPROC __glewVertexAttrib4fARB = NULL; +PFNGLVERTEXATTRIB4FVARBPROC __glewVertexAttrib4fvARB = NULL; +PFNGLVERTEXATTRIB4IVARBPROC __glewVertexAttrib4ivARB = NULL; +PFNGLVERTEXATTRIB4SARBPROC __glewVertexAttrib4sARB = NULL; +PFNGLVERTEXATTRIB4SVARBPROC __glewVertexAttrib4svARB = NULL; +PFNGLVERTEXATTRIB4UBVARBPROC __glewVertexAttrib4ubvARB = NULL; +PFNGLVERTEXATTRIB4UIVARBPROC __glewVertexAttrib4uivARB = NULL; +PFNGLVERTEXATTRIB4USVARBPROC __glewVertexAttrib4usvARB = NULL; +PFNGLVERTEXATTRIBPOINTERARBPROC __glewVertexAttribPointerARB = NULL; + +PFNGLBINDATTRIBLOCATIONARBPROC __glewBindAttribLocationARB = NULL; +PFNGLGETACTIVEATTRIBARBPROC __glewGetActiveAttribARB = NULL; +PFNGLGETATTRIBLOCATIONARBPROC __glewGetAttribLocationARB = NULL; + +PFNGLCOLORP3UIPROC __glewColorP3ui = NULL; +PFNGLCOLORP3UIVPROC __glewColorP3uiv = NULL; +PFNGLCOLORP4UIPROC __glewColorP4ui = NULL; +PFNGLCOLORP4UIVPROC __glewColorP4uiv = NULL; +PFNGLMULTITEXCOORDP1UIPROC __glewMultiTexCoordP1ui = NULL; +PFNGLMULTITEXCOORDP1UIVPROC __glewMultiTexCoordP1uiv = NULL; +PFNGLMULTITEXCOORDP2UIPROC __glewMultiTexCoordP2ui = NULL; +PFNGLMULTITEXCOORDP2UIVPROC __glewMultiTexCoordP2uiv = NULL; +PFNGLMULTITEXCOORDP3UIPROC __glewMultiTexCoordP3ui = NULL; +PFNGLMULTITEXCOORDP3UIVPROC __glewMultiTexCoordP3uiv = NULL; +PFNGLMULTITEXCOORDP4UIPROC __glewMultiTexCoordP4ui = NULL; +PFNGLMULTITEXCOORDP4UIVPROC __glewMultiTexCoordP4uiv = NULL; +PFNGLNORMALP3UIPROC __glewNormalP3ui = NULL; +PFNGLNORMALP3UIVPROC __glewNormalP3uiv = NULL; +PFNGLSECONDARYCOLORP3UIPROC __glewSecondaryColorP3ui = NULL; +PFNGLSECONDARYCOLORP3UIVPROC __glewSecondaryColorP3uiv = NULL; +PFNGLTEXCOORDP1UIPROC __glewTexCoordP1ui = NULL; +PFNGLTEXCOORDP1UIVPROC __glewTexCoordP1uiv = NULL; +PFNGLTEXCOORDP2UIPROC __glewTexCoordP2ui = NULL; +PFNGLTEXCOORDP2UIVPROC __glewTexCoordP2uiv = NULL; +PFNGLTEXCOORDP3UIPROC __glewTexCoordP3ui = NULL; +PFNGLTEXCOORDP3UIVPROC __glewTexCoordP3uiv = NULL; +PFNGLTEXCOORDP4UIPROC __glewTexCoordP4ui = NULL; +PFNGLTEXCOORDP4UIVPROC __glewTexCoordP4uiv = NULL; +PFNGLVERTEXATTRIBP1UIPROC __glewVertexAttribP1ui = NULL; +PFNGLVERTEXATTRIBP1UIVPROC __glewVertexAttribP1uiv = NULL; +PFNGLVERTEXATTRIBP2UIPROC __glewVertexAttribP2ui = NULL; +PFNGLVERTEXATTRIBP2UIVPROC __glewVertexAttribP2uiv = NULL; +PFNGLVERTEXATTRIBP3UIPROC __glewVertexAttribP3ui = NULL; +PFNGLVERTEXATTRIBP3UIVPROC __glewVertexAttribP3uiv = NULL; +PFNGLVERTEXATTRIBP4UIPROC __glewVertexAttribP4ui = NULL; +PFNGLVERTEXATTRIBP4UIVPROC __glewVertexAttribP4uiv = NULL; +PFNGLVERTEXP2UIPROC __glewVertexP2ui = NULL; +PFNGLVERTEXP2UIVPROC __glewVertexP2uiv = NULL; +PFNGLVERTEXP3UIPROC __glewVertexP3ui = NULL; +PFNGLVERTEXP3UIVPROC __glewVertexP3uiv = NULL; +PFNGLVERTEXP4UIPROC __glewVertexP4ui = NULL; +PFNGLVERTEXP4UIVPROC __glewVertexP4uiv = NULL; + +PFNGLDEPTHRANGEARRAYVPROC __glewDepthRangeArrayv = NULL; +PFNGLDEPTHRANGEINDEXEDPROC __glewDepthRangeIndexed = NULL; +PFNGLGETDOUBLEI_VPROC __glewGetDoublei_v = NULL; +PFNGLGETFLOATI_VPROC __glewGetFloati_v = NULL; +PFNGLSCISSORARRAYVPROC __glewScissorArrayv = NULL; +PFNGLSCISSORINDEXEDPROC __glewScissorIndexed = NULL; +PFNGLSCISSORINDEXEDVPROC __glewScissorIndexedv = NULL; +PFNGLVIEWPORTARRAYVPROC __glewViewportArrayv = NULL; +PFNGLVIEWPORTINDEXEDFPROC __glewViewportIndexedf = NULL; +PFNGLVIEWPORTINDEXEDFVPROC __glewViewportIndexedfv = NULL; + +PFNGLWINDOWPOS2DARBPROC __glewWindowPos2dARB = NULL; +PFNGLWINDOWPOS2DVARBPROC __glewWindowPos2dvARB = NULL; +PFNGLWINDOWPOS2FARBPROC __glewWindowPos2fARB = NULL; +PFNGLWINDOWPOS2FVARBPROC __glewWindowPos2fvARB = NULL; +PFNGLWINDOWPOS2IARBPROC __glewWindowPos2iARB = NULL; +PFNGLWINDOWPOS2IVARBPROC __glewWindowPos2ivARB = NULL; +PFNGLWINDOWPOS2SARBPROC __glewWindowPos2sARB = NULL; +PFNGLWINDOWPOS2SVARBPROC __glewWindowPos2svARB = NULL; +PFNGLWINDOWPOS3DARBPROC __glewWindowPos3dARB = NULL; +PFNGLWINDOWPOS3DVARBPROC __glewWindowPos3dvARB = NULL; +PFNGLWINDOWPOS3FARBPROC __glewWindowPos3fARB = NULL; +PFNGLWINDOWPOS3FVARBPROC __glewWindowPos3fvARB = NULL; +PFNGLWINDOWPOS3IARBPROC __glewWindowPos3iARB = NULL; +PFNGLWINDOWPOS3IVARBPROC __glewWindowPos3ivARB = NULL; +PFNGLWINDOWPOS3SARBPROC __glewWindowPos3sARB = NULL; +PFNGLWINDOWPOS3SVARBPROC __glewWindowPos3svARB = NULL; + +PFNGLDRAWBUFFERSATIPROC __glewDrawBuffersATI = NULL; + +PFNGLDRAWELEMENTARRAYATIPROC __glewDrawElementArrayATI = NULL; +PFNGLDRAWRANGEELEMENTARRAYATIPROC __glewDrawRangeElementArrayATI = NULL; +PFNGLELEMENTPOINTERATIPROC __glewElementPointerATI = NULL; + +PFNGLGETTEXBUMPPARAMETERFVATIPROC __glewGetTexBumpParameterfvATI = NULL; +PFNGLGETTEXBUMPPARAMETERIVATIPROC __glewGetTexBumpParameterivATI = NULL; +PFNGLTEXBUMPPARAMETERFVATIPROC __glewTexBumpParameterfvATI = NULL; +PFNGLTEXBUMPPARAMETERIVATIPROC __glewTexBumpParameterivATI = NULL; + +PFNGLALPHAFRAGMENTOP1ATIPROC __glewAlphaFragmentOp1ATI = NULL; +PFNGLALPHAFRAGMENTOP2ATIPROC __glewAlphaFragmentOp2ATI = NULL; +PFNGLALPHAFRAGMENTOP3ATIPROC __glewAlphaFragmentOp3ATI = NULL; +PFNGLBEGINFRAGMENTSHADERATIPROC __glewBeginFragmentShaderATI = NULL; +PFNGLBINDFRAGMENTSHADERATIPROC __glewBindFragmentShaderATI = NULL; +PFNGLCOLORFRAGMENTOP1ATIPROC __glewColorFragmentOp1ATI = NULL; +PFNGLCOLORFRAGMENTOP2ATIPROC __glewColorFragmentOp2ATI = NULL; +PFNGLCOLORFRAGMENTOP3ATIPROC __glewColorFragmentOp3ATI = NULL; +PFNGLDELETEFRAGMENTSHADERATIPROC __glewDeleteFragmentShaderATI = NULL; +PFNGLENDFRAGMENTSHADERATIPROC __glewEndFragmentShaderATI = NULL; +PFNGLGENFRAGMENTSHADERSATIPROC __glewGenFragmentShadersATI = NULL; +PFNGLPASSTEXCOORDATIPROC __glewPassTexCoordATI = NULL; +PFNGLSAMPLEMAPATIPROC __glewSampleMapATI = NULL; +PFNGLSETFRAGMENTSHADERCONSTANTATIPROC __glewSetFragmentShaderConstantATI = NULL; + +PFNGLMAPOBJECTBUFFERATIPROC __glewMapObjectBufferATI = NULL; +PFNGLUNMAPOBJECTBUFFERATIPROC __glewUnmapObjectBufferATI = NULL; + +PFNGLPNTRIANGLESFATIPROC __glewPNTrianglesfATI = NULL; +PFNGLPNTRIANGLESIATIPROC __glewPNTrianglesiATI = NULL; + +PFNGLSTENCILFUNCSEPARATEATIPROC __glewStencilFuncSeparateATI = NULL; +PFNGLSTENCILOPSEPARATEATIPROC __glewStencilOpSeparateATI = NULL; + +PFNGLARRAYOBJECTATIPROC __glewArrayObjectATI = NULL; +PFNGLFREEOBJECTBUFFERATIPROC __glewFreeObjectBufferATI = NULL; +PFNGLGETARRAYOBJECTFVATIPROC __glewGetArrayObjectfvATI = NULL; +PFNGLGETARRAYOBJECTIVATIPROC __glewGetArrayObjectivATI = NULL; +PFNGLGETOBJECTBUFFERFVATIPROC __glewGetObjectBufferfvATI = NULL; +PFNGLGETOBJECTBUFFERIVATIPROC __glewGetObjectBufferivATI = NULL; +PFNGLGETVARIANTARRAYOBJECTFVATIPROC __glewGetVariantArrayObjectfvATI = NULL; +PFNGLGETVARIANTARRAYOBJECTIVATIPROC __glewGetVariantArrayObjectivATI = NULL; +PFNGLISOBJECTBUFFERATIPROC __glewIsObjectBufferATI = NULL; +PFNGLNEWOBJECTBUFFERATIPROC __glewNewObjectBufferATI = NULL; +PFNGLUPDATEOBJECTBUFFERATIPROC __glewUpdateObjectBufferATI = NULL; +PFNGLVARIANTARRAYOBJECTATIPROC __glewVariantArrayObjectATI = NULL; + +PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC __glewGetVertexAttribArrayObjectfvATI = NULL; +PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC __glewGetVertexAttribArrayObjectivATI = NULL; +PFNGLVERTEXATTRIBARRAYOBJECTATIPROC __glewVertexAttribArrayObjectATI = NULL; + +PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC __glewClientActiveVertexStreamATI = NULL; +PFNGLNORMALSTREAM3BATIPROC __glewNormalStream3bATI = NULL; +PFNGLNORMALSTREAM3BVATIPROC __glewNormalStream3bvATI = NULL; +PFNGLNORMALSTREAM3DATIPROC __glewNormalStream3dATI = NULL; +PFNGLNORMALSTREAM3DVATIPROC __glewNormalStream3dvATI = NULL; +PFNGLNORMALSTREAM3FATIPROC __glewNormalStream3fATI = NULL; +PFNGLNORMALSTREAM3FVATIPROC __glewNormalStream3fvATI = NULL; +PFNGLNORMALSTREAM3IATIPROC __glewNormalStream3iATI = NULL; +PFNGLNORMALSTREAM3IVATIPROC __glewNormalStream3ivATI = NULL; +PFNGLNORMALSTREAM3SATIPROC __glewNormalStream3sATI = NULL; +PFNGLNORMALSTREAM3SVATIPROC __glewNormalStream3svATI = NULL; +PFNGLVERTEXBLENDENVFATIPROC __glewVertexBlendEnvfATI = NULL; +PFNGLVERTEXBLENDENVIATIPROC __glewVertexBlendEnviATI = NULL; +PFNGLVERTEXSTREAM1DATIPROC __glewVertexStream1dATI = NULL; +PFNGLVERTEXSTREAM1DVATIPROC __glewVertexStream1dvATI = NULL; +PFNGLVERTEXSTREAM1FATIPROC __glewVertexStream1fATI = NULL; +PFNGLVERTEXSTREAM1FVATIPROC __glewVertexStream1fvATI = NULL; +PFNGLVERTEXSTREAM1IATIPROC __glewVertexStream1iATI = NULL; +PFNGLVERTEXSTREAM1IVATIPROC __glewVertexStream1ivATI = NULL; +PFNGLVERTEXSTREAM1SATIPROC __glewVertexStream1sATI = NULL; +PFNGLVERTEXSTREAM1SVATIPROC __glewVertexStream1svATI = NULL; +PFNGLVERTEXSTREAM2DATIPROC __glewVertexStream2dATI = NULL; +PFNGLVERTEXSTREAM2DVATIPROC __glewVertexStream2dvATI = NULL; +PFNGLVERTEXSTREAM2FATIPROC __glewVertexStream2fATI = NULL; +PFNGLVERTEXSTREAM2FVATIPROC __glewVertexStream2fvATI = NULL; +PFNGLVERTEXSTREAM2IATIPROC __glewVertexStream2iATI = NULL; +PFNGLVERTEXSTREAM2IVATIPROC __glewVertexStream2ivATI = NULL; +PFNGLVERTEXSTREAM2SATIPROC __glewVertexStream2sATI = NULL; +PFNGLVERTEXSTREAM2SVATIPROC __glewVertexStream2svATI = NULL; +PFNGLVERTEXSTREAM3DATIPROC __glewVertexStream3dATI = NULL; +PFNGLVERTEXSTREAM3DVATIPROC __glewVertexStream3dvATI = NULL; +PFNGLVERTEXSTREAM3FATIPROC __glewVertexStream3fATI = NULL; +PFNGLVERTEXSTREAM3FVATIPROC __glewVertexStream3fvATI = NULL; +PFNGLVERTEXSTREAM3IATIPROC __glewVertexStream3iATI = NULL; +PFNGLVERTEXSTREAM3IVATIPROC __glewVertexStream3ivATI = NULL; +PFNGLVERTEXSTREAM3SATIPROC __glewVertexStream3sATI = NULL; +PFNGLVERTEXSTREAM3SVATIPROC __glewVertexStream3svATI = NULL; +PFNGLVERTEXSTREAM4DATIPROC __glewVertexStream4dATI = NULL; +PFNGLVERTEXSTREAM4DVATIPROC __glewVertexStream4dvATI = NULL; +PFNGLVERTEXSTREAM4FATIPROC __glewVertexStream4fATI = NULL; +PFNGLVERTEXSTREAM4FVATIPROC __glewVertexStream4fvATI = NULL; +PFNGLVERTEXSTREAM4IATIPROC __glewVertexStream4iATI = NULL; +PFNGLVERTEXSTREAM4IVATIPROC __glewVertexStream4ivATI = NULL; +PFNGLVERTEXSTREAM4SATIPROC __glewVertexStream4sATI = NULL; +PFNGLVERTEXSTREAM4SVATIPROC __glewVertexStream4svATI = NULL; + +PFNGLGETUNIFORMBUFFERSIZEEXTPROC __glewGetUniformBufferSizeEXT = NULL; +PFNGLGETUNIFORMOFFSETEXTPROC __glewGetUniformOffsetEXT = NULL; +PFNGLUNIFORMBUFFEREXTPROC __glewUniformBufferEXT = NULL; + +PFNGLBLENDCOLOREXTPROC __glewBlendColorEXT = NULL; + +PFNGLBLENDEQUATIONSEPARATEEXTPROC __glewBlendEquationSeparateEXT = NULL; + +PFNGLBLENDFUNCSEPARATEEXTPROC __glewBlendFuncSeparateEXT = NULL; + +PFNGLBLENDEQUATIONEXTPROC __glewBlendEquationEXT = NULL; + +PFNGLCOLORSUBTABLEEXTPROC __glewColorSubTableEXT = NULL; +PFNGLCOPYCOLORSUBTABLEEXTPROC __glewCopyColorSubTableEXT = NULL; + +PFNGLLOCKARRAYSEXTPROC __glewLockArraysEXT = NULL; +PFNGLUNLOCKARRAYSEXTPROC __glewUnlockArraysEXT = NULL; + +PFNGLCONVOLUTIONFILTER1DEXTPROC __glewConvolutionFilter1DEXT = NULL; +PFNGLCONVOLUTIONFILTER2DEXTPROC __glewConvolutionFilter2DEXT = NULL; +PFNGLCONVOLUTIONPARAMETERFEXTPROC __glewConvolutionParameterfEXT = NULL; +PFNGLCONVOLUTIONPARAMETERFVEXTPROC __glewConvolutionParameterfvEXT = NULL; +PFNGLCONVOLUTIONPARAMETERIEXTPROC __glewConvolutionParameteriEXT = NULL; +PFNGLCONVOLUTIONPARAMETERIVEXTPROC __glewConvolutionParameterivEXT = NULL; +PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC __glewCopyConvolutionFilter1DEXT = NULL; +PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC __glewCopyConvolutionFilter2DEXT = NULL; +PFNGLGETCONVOLUTIONFILTEREXTPROC __glewGetConvolutionFilterEXT = NULL; +PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC __glewGetConvolutionParameterfvEXT = NULL; +PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC __glewGetConvolutionParameterivEXT = NULL; +PFNGLGETSEPARABLEFILTEREXTPROC __glewGetSeparableFilterEXT = NULL; +PFNGLSEPARABLEFILTER2DEXTPROC __glewSeparableFilter2DEXT = NULL; + +PFNGLBINORMALPOINTEREXTPROC __glewBinormalPointerEXT = NULL; +PFNGLTANGENTPOINTEREXTPROC __glewTangentPointerEXT = NULL; + +PFNGLCOPYTEXIMAGE1DEXTPROC __glewCopyTexImage1DEXT = NULL; +PFNGLCOPYTEXIMAGE2DEXTPROC __glewCopyTexImage2DEXT = NULL; +PFNGLCOPYTEXSUBIMAGE1DEXTPROC __glewCopyTexSubImage1DEXT = NULL; +PFNGLCOPYTEXSUBIMAGE2DEXTPROC __glewCopyTexSubImage2DEXT = NULL; +PFNGLCOPYTEXSUBIMAGE3DEXTPROC __glewCopyTexSubImage3DEXT = NULL; + +PFNGLCULLPARAMETERDVEXTPROC __glewCullParameterdvEXT = NULL; +PFNGLCULLPARAMETERFVEXTPROC __glewCullParameterfvEXT = NULL; + +PFNGLGETOBJECTLABELEXTPROC __glewGetObjectLabelEXT = NULL; +PFNGLLABELOBJECTEXTPROC __glewLabelObjectEXT = NULL; + +PFNGLINSERTEVENTMARKEREXTPROC __glewInsertEventMarkerEXT = NULL; +PFNGLPOPGROUPMARKEREXTPROC __glewPopGroupMarkerEXT = NULL; +PFNGLPUSHGROUPMARKEREXTPROC __glewPushGroupMarkerEXT = NULL; + +PFNGLDEPTHBOUNDSEXTPROC __glewDepthBoundsEXT = NULL; + +PFNGLBINDMULTITEXTUREEXTPROC __glewBindMultiTextureEXT = NULL; +PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC __glewCheckNamedFramebufferStatusEXT = NULL; +PFNGLCLIENTATTRIBDEFAULTEXTPROC __glewClientAttribDefaultEXT = NULL; +PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC __glewCompressedMultiTexImage1DEXT = NULL; +PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC __glewCompressedMultiTexImage2DEXT = NULL; +PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC __glewCompressedMultiTexImage3DEXT = NULL; +PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC __glewCompressedMultiTexSubImage1DEXT = NULL; +PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC __glewCompressedMultiTexSubImage2DEXT = NULL; +PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC __glewCompressedMultiTexSubImage3DEXT = NULL; +PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC __glewCompressedTextureImage1DEXT = NULL; +PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC __glewCompressedTextureImage2DEXT = NULL; +PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC __glewCompressedTextureImage3DEXT = NULL; +PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC __glewCompressedTextureSubImage1DEXT = NULL; +PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC __glewCompressedTextureSubImage2DEXT = NULL; +PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC __glewCompressedTextureSubImage3DEXT = NULL; +PFNGLCOPYMULTITEXIMAGE1DEXTPROC __glewCopyMultiTexImage1DEXT = NULL; +PFNGLCOPYMULTITEXIMAGE2DEXTPROC __glewCopyMultiTexImage2DEXT = NULL; +PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC __glewCopyMultiTexSubImage1DEXT = NULL; +PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC __glewCopyMultiTexSubImage2DEXT = NULL; +PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC __glewCopyMultiTexSubImage3DEXT = NULL; +PFNGLCOPYTEXTUREIMAGE1DEXTPROC __glewCopyTextureImage1DEXT = NULL; +PFNGLCOPYTEXTUREIMAGE2DEXTPROC __glewCopyTextureImage2DEXT = NULL; +PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC __glewCopyTextureSubImage1DEXT = NULL; +PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC __glewCopyTextureSubImage2DEXT = NULL; +PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC __glewCopyTextureSubImage3DEXT = NULL; +PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC __glewDisableClientStateIndexedEXT = NULL; +PFNGLDISABLECLIENTSTATEIEXTPROC __glewDisableClientStateiEXT = NULL; +PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC __glewDisableVertexArrayAttribEXT = NULL; +PFNGLDISABLEVERTEXARRAYEXTPROC __glewDisableVertexArrayEXT = NULL; +PFNGLENABLECLIENTSTATEINDEXEDEXTPROC __glewEnableClientStateIndexedEXT = NULL; +PFNGLENABLECLIENTSTATEIEXTPROC __glewEnableClientStateiEXT = NULL; +PFNGLENABLEVERTEXARRAYATTRIBEXTPROC __glewEnableVertexArrayAttribEXT = NULL; +PFNGLENABLEVERTEXARRAYEXTPROC __glewEnableVertexArrayEXT = NULL; +PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC __glewFlushMappedNamedBufferRangeEXT = NULL; +PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC __glewFramebufferDrawBufferEXT = NULL; +PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC __glewFramebufferDrawBuffersEXT = NULL; +PFNGLFRAMEBUFFERREADBUFFEREXTPROC __glewFramebufferReadBufferEXT = NULL; +PFNGLGENERATEMULTITEXMIPMAPEXTPROC __glewGenerateMultiTexMipmapEXT = NULL; +PFNGLGENERATETEXTUREMIPMAPEXTPROC __glewGenerateTextureMipmapEXT = NULL; +PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC __glewGetCompressedMultiTexImageEXT = NULL; +PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC __glewGetCompressedTextureImageEXT = NULL; +PFNGLGETDOUBLEINDEXEDVEXTPROC __glewGetDoubleIndexedvEXT = NULL; +PFNGLGETDOUBLEI_VEXTPROC __glewGetDoublei_vEXT = NULL; +PFNGLGETFLOATINDEXEDVEXTPROC __glewGetFloatIndexedvEXT = NULL; +PFNGLGETFLOATI_VEXTPROC __glewGetFloati_vEXT = NULL; +PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC __glewGetFramebufferParameterivEXT = NULL; +PFNGLGETMULTITEXENVFVEXTPROC __glewGetMultiTexEnvfvEXT = NULL; +PFNGLGETMULTITEXENVIVEXTPROC __glewGetMultiTexEnvivEXT = NULL; +PFNGLGETMULTITEXGENDVEXTPROC __glewGetMultiTexGendvEXT = NULL; +PFNGLGETMULTITEXGENFVEXTPROC __glewGetMultiTexGenfvEXT = NULL; +PFNGLGETMULTITEXGENIVEXTPROC __glewGetMultiTexGenivEXT = NULL; +PFNGLGETMULTITEXIMAGEEXTPROC __glewGetMultiTexImageEXT = NULL; +PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC __glewGetMultiTexLevelParameterfvEXT = NULL; +PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC __glewGetMultiTexLevelParameterivEXT = NULL; +PFNGLGETMULTITEXPARAMETERIIVEXTPROC __glewGetMultiTexParameterIivEXT = NULL; +PFNGLGETMULTITEXPARAMETERIUIVEXTPROC __glewGetMultiTexParameterIuivEXT = NULL; +PFNGLGETMULTITEXPARAMETERFVEXTPROC __glewGetMultiTexParameterfvEXT = NULL; +PFNGLGETMULTITEXPARAMETERIVEXTPROC __glewGetMultiTexParameterivEXT = NULL; +PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC __glewGetNamedBufferParameterivEXT = NULL; +PFNGLGETNAMEDBUFFERPOINTERVEXTPROC __glewGetNamedBufferPointervEXT = NULL; +PFNGLGETNAMEDBUFFERSUBDATAEXTPROC __glewGetNamedBufferSubDataEXT = NULL; +PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetNamedFramebufferAttachmentParameterivEXT = NULL; +PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC __glewGetNamedProgramLocalParameterIivEXT = NULL; +PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC __glewGetNamedProgramLocalParameterIuivEXT = NULL; +PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC __glewGetNamedProgramLocalParameterdvEXT = NULL; +PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC __glewGetNamedProgramLocalParameterfvEXT = NULL; +PFNGLGETNAMEDPROGRAMSTRINGEXTPROC __glewGetNamedProgramStringEXT = NULL; +PFNGLGETNAMEDPROGRAMIVEXTPROC __glewGetNamedProgramivEXT = NULL; +PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC __glewGetNamedRenderbufferParameterivEXT = NULL; +PFNGLGETPOINTERINDEXEDVEXTPROC __glewGetPointerIndexedvEXT = NULL; +PFNGLGETPOINTERI_VEXTPROC __glewGetPointeri_vEXT = NULL; +PFNGLGETTEXTUREIMAGEEXTPROC __glewGetTextureImageEXT = NULL; +PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC __glewGetTextureLevelParameterfvEXT = NULL; +PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC __glewGetTextureLevelParameterivEXT = NULL; +PFNGLGETTEXTUREPARAMETERIIVEXTPROC __glewGetTextureParameterIivEXT = NULL; +PFNGLGETTEXTUREPARAMETERIUIVEXTPROC __glewGetTextureParameterIuivEXT = NULL; +PFNGLGETTEXTUREPARAMETERFVEXTPROC __glewGetTextureParameterfvEXT = NULL; +PFNGLGETTEXTUREPARAMETERIVEXTPROC __glewGetTextureParameterivEXT = NULL; +PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC __glewGetVertexArrayIntegeri_vEXT = NULL; +PFNGLGETVERTEXARRAYINTEGERVEXTPROC __glewGetVertexArrayIntegervEXT = NULL; +PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC __glewGetVertexArrayPointeri_vEXT = NULL; +PFNGLGETVERTEXARRAYPOINTERVEXTPROC __glewGetVertexArrayPointervEXT = NULL; +PFNGLMAPNAMEDBUFFEREXTPROC __glewMapNamedBufferEXT = NULL; +PFNGLMAPNAMEDBUFFERRANGEEXTPROC __glewMapNamedBufferRangeEXT = NULL; +PFNGLMATRIXFRUSTUMEXTPROC __glewMatrixFrustumEXT = NULL; +PFNGLMATRIXLOADIDENTITYEXTPROC __glewMatrixLoadIdentityEXT = NULL; +PFNGLMATRIXLOADTRANSPOSEDEXTPROC __glewMatrixLoadTransposedEXT = NULL; +PFNGLMATRIXLOADTRANSPOSEFEXTPROC __glewMatrixLoadTransposefEXT = NULL; +PFNGLMATRIXLOADDEXTPROC __glewMatrixLoaddEXT = NULL; +PFNGLMATRIXLOADFEXTPROC __glewMatrixLoadfEXT = NULL; +PFNGLMATRIXMULTTRANSPOSEDEXTPROC __glewMatrixMultTransposedEXT = NULL; +PFNGLMATRIXMULTTRANSPOSEFEXTPROC __glewMatrixMultTransposefEXT = NULL; +PFNGLMATRIXMULTDEXTPROC __glewMatrixMultdEXT = NULL; +PFNGLMATRIXMULTFEXTPROC __glewMatrixMultfEXT = NULL; +PFNGLMATRIXORTHOEXTPROC __glewMatrixOrthoEXT = NULL; +PFNGLMATRIXPOPEXTPROC __glewMatrixPopEXT = NULL; +PFNGLMATRIXPUSHEXTPROC __glewMatrixPushEXT = NULL; +PFNGLMATRIXROTATEDEXTPROC __glewMatrixRotatedEXT = NULL; +PFNGLMATRIXROTATEFEXTPROC __glewMatrixRotatefEXT = NULL; +PFNGLMATRIXSCALEDEXTPROC __glewMatrixScaledEXT = NULL; +PFNGLMATRIXSCALEFEXTPROC __glewMatrixScalefEXT = NULL; +PFNGLMATRIXTRANSLATEDEXTPROC __glewMatrixTranslatedEXT = NULL; +PFNGLMATRIXTRANSLATEFEXTPROC __glewMatrixTranslatefEXT = NULL; +PFNGLMULTITEXBUFFEREXTPROC __glewMultiTexBufferEXT = NULL; +PFNGLMULTITEXCOORDPOINTEREXTPROC __glewMultiTexCoordPointerEXT = NULL; +PFNGLMULTITEXENVFEXTPROC __glewMultiTexEnvfEXT = NULL; +PFNGLMULTITEXENVFVEXTPROC __glewMultiTexEnvfvEXT = NULL; +PFNGLMULTITEXENVIEXTPROC __glewMultiTexEnviEXT = NULL; +PFNGLMULTITEXENVIVEXTPROC __glewMultiTexEnvivEXT = NULL; +PFNGLMULTITEXGENDEXTPROC __glewMultiTexGendEXT = NULL; +PFNGLMULTITEXGENDVEXTPROC __glewMultiTexGendvEXT = NULL; +PFNGLMULTITEXGENFEXTPROC __glewMultiTexGenfEXT = NULL; +PFNGLMULTITEXGENFVEXTPROC __glewMultiTexGenfvEXT = NULL; +PFNGLMULTITEXGENIEXTPROC __glewMultiTexGeniEXT = NULL; +PFNGLMULTITEXGENIVEXTPROC __glewMultiTexGenivEXT = NULL; +PFNGLMULTITEXIMAGE1DEXTPROC __glewMultiTexImage1DEXT = NULL; +PFNGLMULTITEXIMAGE2DEXTPROC __glewMultiTexImage2DEXT = NULL; +PFNGLMULTITEXIMAGE3DEXTPROC __glewMultiTexImage3DEXT = NULL; +PFNGLMULTITEXPARAMETERIIVEXTPROC __glewMultiTexParameterIivEXT = NULL; +PFNGLMULTITEXPARAMETERIUIVEXTPROC __glewMultiTexParameterIuivEXT = NULL; +PFNGLMULTITEXPARAMETERFEXTPROC __glewMultiTexParameterfEXT = NULL; +PFNGLMULTITEXPARAMETERFVEXTPROC __glewMultiTexParameterfvEXT = NULL; +PFNGLMULTITEXPARAMETERIEXTPROC __glewMultiTexParameteriEXT = NULL; +PFNGLMULTITEXPARAMETERIVEXTPROC __glewMultiTexParameterivEXT = NULL; +PFNGLMULTITEXRENDERBUFFEREXTPROC __glewMultiTexRenderbufferEXT = NULL; +PFNGLMULTITEXSUBIMAGE1DEXTPROC __glewMultiTexSubImage1DEXT = NULL; +PFNGLMULTITEXSUBIMAGE2DEXTPROC __glewMultiTexSubImage2DEXT = NULL; +PFNGLMULTITEXSUBIMAGE3DEXTPROC __glewMultiTexSubImage3DEXT = NULL; +PFNGLNAMEDBUFFERDATAEXTPROC __glewNamedBufferDataEXT = NULL; +PFNGLNAMEDBUFFERSUBDATAEXTPROC __glewNamedBufferSubDataEXT = NULL; +PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC __glewNamedCopyBufferSubDataEXT = NULL; +PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC __glewNamedFramebufferRenderbufferEXT = NULL; +PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC __glewNamedFramebufferTexture1DEXT = NULL; +PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC __glewNamedFramebufferTexture2DEXT = NULL; +PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC __glewNamedFramebufferTexture3DEXT = NULL; +PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC __glewNamedFramebufferTextureEXT = NULL; +PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC __glewNamedFramebufferTextureFaceEXT = NULL; +PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC __glewNamedFramebufferTextureLayerEXT = NULL; +PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC __glewNamedProgramLocalParameter4dEXT = NULL; +PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC __glewNamedProgramLocalParameter4dvEXT = NULL; +PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC __glewNamedProgramLocalParameter4fEXT = NULL; +PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC __glewNamedProgramLocalParameter4fvEXT = NULL; +PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC __glewNamedProgramLocalParameterI4iEXT = NULL; +PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC __glewNamedProgramLocalParameterI4ivEXT = NULL; +PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC __glewNamedProgramLocalParameterI4uiEXT = NULL; +PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC __glewNamedProgramLocalParameterI4uivEXT = NULL; +PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC __glewNamedProgramLocalParameters4fvEXT = NULL; +PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC __glewNamedProgramLocalParametersI4ivEXT = NULL; +PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC __glewNamedProgramLocalParametersI4uivEXT = NULL; +PFNGLNAMEDPROGRAMSTRINGEXTPROC __glewNamedProgramStringEXT = NULL; +PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC __glewNamedRenderbufferStorageEXT = NULL; +PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC __glewNamedRenderbufferStorageMultisampleCoverageEXT = NULL; +PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewNamedRenderbufferStorageMultisampleEXT = NULL; +PFNGLPROGRAMUNIFORM1FEXTPROC __glewProgramUniform1fEXT = NULL; +PFNGLPROGRAMUNIFORM1FVEXTPROC __glewProgramUniform1fvEXT = NULL; +PFNGLPROGRAMUNIFORM1IEXTPROC __glewProgramUniform1iEXT = NULL; +PFNGLPROGRAMUNIFORM1IVEXTPROC __glewProgramUniform1ivEXT = NULL; +PFNGLPROGRAMUNIFORM1UIEXTPROC __glewProgramUniform1uiEXT = NULL; +PFNGLPROGRAMUNIFORM1UIVEXTPROC __glewProgramUniform1uivEXT = NULL; +PFNGLPROGRAMUNIFORM2FEXTPROC __glewProgramUniform2fEXT = NULL; +PFNGLPROGRAMUNIFORM2FVEXTPROC __glewProgramUniform2fvEXT = NULL; +PFNGLPROGRAMUNIFORM2IEXTPROC __glewProgramUniform2iEXT = NULL; +PFNGLPROGRAMUNIFORM2IVEXTPROC __glewProgramUniform2ivEXT = NULL; +PFNGLPROGRAMUNIFORM2UIEXTPROC __glewProgramUniform2uiEXT = NULL; +PFNGLPROGRAMUNIFORM2UIVEXTPROC __glewProgramUniform2uivEXT = NULL; +PFNGLPROGRAMUNIFORM3FEXTPROC __glewProgramUniform3fEXT = NULL; +PFNGLPROGRAMUNIFORM3FVEXTPROC __glewProgramUniform3fvEXT = NULL; +PFNGLPROGRAMUNIFORM3IEXTPROC __glewProgramUniform3iEXT = NULL; +PFNGLPROGRAMUNIFORM3IVEXTPROC __glewProgramUniform3ivEXT = NULL; +PFNGLPROGRAMUNIFORM3UIEXTPROC __glewProgramUniform3uiEXT = NULL; +PFNGLPROGRAMUNIFORM3UIVEXTPROC __glewProgramUniform3uivEXT = NULL; +PFNGLPROGRAMUNIFORM4FEXTPROC __glewProgramUniform4fEXT = NULL; +PFNGLPROGRAMUNIFORM4FVEXTPROC __glewProgramUniform4fvEXT = NULL; +PFNGLPROGRAMUNIFORM4IEXTPROC __glewProgramUniform4iEXT = NULL; +PFNGLPROGRAMUNIFORM4IVEXTPROC __glewProgramUniform4ivEXT = NULL; +PFNGLPROGRAMUNIFORM4UIEXTPROC __glewProgramUniform4uiEXT = NULL; +PFNGLPROGRAMUNIFORM4UIVEXTPROC __glewProgramUniform4uivEXT = NULL; +PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC __glewProgramUniformMatrix2fvEXT = NULL; +PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC __glewProgramUniformMatrix2x3fvEXT = NULL; +PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC __glewProgramUniformMatrix2x4fvEXT = NULL; +PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC __glewProgramUniformMatrix3fvEXT = NULL; +PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC __glewProgramUniformMatrix3x2fvEXT = NULL; +PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC __glewProgramUniformMatrix3x4fvEXT = NULL; +PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC __glewProgramUniformMatrix4fvEXT = NULL; +PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC __glewProgramUniformMatrix4x2fvEXT = NULL; +PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC __glewProgramUniformMatrix4x3fvEXT = NULL; +PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC __glewPushClientAttribDefaultEXT = NULL; +PFNGLTEXTUREBUFFEREXTPROC __glewTextureBufferEXT = NULL; +PFNGLTEXTUREIMAGE1DEXTPROC __glewTextureImage1DEXT = NULL; +PFNGLTEXTUREIMAGE2DEXTPROC __glewTextureImage2DEXT = NULL; +PFNGLTEXTUREIMAGE3DEXTPROC __glewTextureImage3DEXT = NULL; +PFNGLTEXTUREPARAMETERIIVEXTPROC __glewTextureParameterIivEXT = NULL; +PFNGLTEXTUREPARAMETERIUIVEXTPROC __glewTextureParameterIuivEXT = NULL; +PFNGLTEXTUREPARAMETERFEXTPROC __glewTextureParameterfEXT = NULL; +PFNGLTEXTUREPARAMETERFVEXTPROC __glewTextureParameterfvEXT = NULL; +PFNGLTEXTUREPARAMETERIEXTPROC __glewTextureParameteriEXT = NULL; +PFNGLTEXTUREPARAMETERIVEXTPROC __glewTextureParameterivEXT = NULL; +PFNGLTEXTURERENDERBUFFEREXTPROC __glewTextureRenderbufferEXT = NULL; +PFNGLTEXTURESUBIMAGE1DEXTPROC __glewTextureSubImage1DEXT = NULL; +PFNGLTEXTURESUBIMAGE2DEXTPROC __glewTextureSubImage2DEXT = NULL; +PFNGLTEXTURESUBIMAGE3DEXTPROC __glewTextureSubImage3DEXT = NULL; +PFNGLUNMAPNAMEDBUFFEREXTPROC __glewUnmapNamedBufferEXT = NULL; +PFNGLVERTEXARRAYCOLOROFFSETEXTPROC __glewVertexArrayColorOffsetEXT = NULL; +PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC __glewVertexArrayEdgeFlagOffsetEXT = NULL; +PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC __glewVertexArrayFogCoordOffsetEXT = NULL; +PFNGLVERTEXARRAYINDEXOFFSETEXTPROC __glewVertexArrayIndexOffsetEXT = NULL; +PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC __glewVertexArrayMultiTexCoordOffsetEXT = NULL; +PFNGLVERTEXARRAYNORMALOFFSETEXTPROC __glewVertexArrayNormalOffsetEXT = NULL; +PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC __glewVertexArraySecondaryColorOffsetEXT = NULL; +PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC __glewVertexArrayTexCoordOffsetEXT = NULL; +PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC __glewVertexArrayVertexAttribDivisorEXT = NULL; +PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC __glewVertexArrayVertexAttribIOffsetEXT = NULL; +PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC __glewVertexArrayVertexAttribOffsetEXT = NULL; +PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC __glewVertexArrayVertexOffsetEXT = NULL; + +PFNGLCOLORMASKINDEXEDEXTPROC __glewColorMaskIndexedEXT = NULL; +PFNGLDISABLEINDEXEDEXTPROC __glewDisableIndexedEXT = NULL; +PFNGLENABLEINDEXEDEXTPROC __glewEnableIndexedEXT = NULL; +PFNGLGETBOOLEANINDEXEDVEXTPROC __glewGetBooleanIndexedvEXT = NULL; +PFNGLGETINTEGERINDEXEDVEXTPROC __glewGetIntegerIndexedvEXT = NULL; +PFNGLISENABLEDINDEXEDEXTPROC __glewIsEnabledIndexedEXT = NULL; + +PFNGLDRAWARRAYSINSTANCEDEXTPROC __glewDrawArraysInstancedEXT = NULL; +PFNGLDRAWELEMENTSINSTANCEDEXTPROC __glewDrawElementsInstancedEXT = NULL; + +PFNGLDRAWRANGEELEMENTSEXTPROC __glewDrawRangeElementsEXT = NULL; + +PFNGLFOGCOORDPOINTEREXTPROC __glewFogCoordPointerEXT = NULL; +PFNGLFOGCOORDDEXTPROC __glewFogCoorddEXT = NULL; +PFNGLFOGCOORDDVEXTPROC __glewFogCoorddvEXT = NULL; +PFNGLFOGCOORDFEXTPROC __glewFogCoordfEXT = NULL; +PFNGLFOGCOORDFVEXTPROC __glewFogCoordfvEXT = NULL; + +PFNGLFRAGMENTCOLORMATERIALEXTPROC __glewFragmentColorMaterialEXT = NULL; +PFNGLFRAGMENTLIGHTMODELFEXTPROC __glewFragmentLightModelfEXT = NULL; +PFNGLFRAGMENTLIGHTMODELFVEXTPROC __glewFragmentLightModelfvEXT = NULL; +PFNGLFRAGMENTLIGHTMODELIEXTPROC __glewFragmentLightModeliEXT = NULL; +PFNGLFRAGMENTLIGHTMODELIVEXTPROC __glewFragmentLightModelivEXT = NULL; +PFNGLFRAGMENTLIGHTFEXTPROC __glewFragmentLightfEXT = NULL; +PFNGLFRAGMENTLIGHTFVEXTPROC __glewFragmentLightfvEXT = NULL; +PFNGLFRAGMENTLIGHTIEXTPROC __glewFragmentLightiEXT = NULL; +PFNGLFRAGMENTLIGHTIVEXTPROC __glewFragmentLightivEXT = NULL; +PFNGLFRAGMENTMATERIALFEXTPROC __glewFragmentMaterialfEXT = NULL; +PFNGLFRAGMENTMATERIALFVEXTPROC __glewFragmentMaterialfvEXT = NULL; +PFNGLFRAGMENTMATERIALIEXTPROC __glewFragmentMaterialiEXT = NULL; +PFNGLFRAGMENTMATERIALIVEXTPROC __glewFragmentMaterialivEXT = NULL; +PFNGLGETFRAGMENTLIGHTFVEXTPROC __glewGetFragmentLightfvEXT = NULL; +PFNGLGETFRAGMENTLIGHTIVEXTPROC __glewGetFragmentLightivEXT = NULL; +PFNGLGETFRAGMENTMATERIALFVEXTPROC __glewGetFragmentMaterialfvEXT = NULL; +PFNGLGETFRAGMENTMATERIALIVEXTPROC __glewGetFragmentMaterialivEXT = NULL; +PFNGLLIGHTENVIEXTPROC __glewLightEnviEXT = NULL; + +PFNGLBLITFRAMEBUFFEREXTPROC __glewBlitFramebufferEXT = NULL; + +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewRenderbufferStorageMultisampleEXT = NULL; + +PFNGLBINDFRAMEBUFFEREXTPROC __glewBindFramebufferEXT = NULL; +PFNGLBINDRENDERBUFFEREXTPROC __glewBindRenderbufferEXT = NULL; +PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC __glewCheckFramebufferStatusEXT = NULL; +PFNGLDELETEFRAMEBUFFERSEXTPROC __glewDeleteFramebuffersEXT = NULL; +PFNGLDELETERENDERBUFFERSEXTPROC __glewDeleteRenderbuffersEXT = NULL; +PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC __glewFramebufferRenderbufferEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE1DEXTPROC __glewFramebufferTexture1DEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE2DEXTPROC __glewFramebufferTexture2DEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE3DEXTPROC __glewFramebufferTexture3DEXT = NULL; +PFNGLGENFRAMEBUFFERSEXTPROC __glewGenFramebuffersEXT = NULL; +PFNGLGENRENDERBUFFERSEXTPROC __glewGenRenderbuffersEXT = NULL; +PFNGLGENERATEMIPMAPEXTPROC __glewGenerateMipmapEXT = NULL; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetFramebufferAttachmentParameterivEXT = NULL; +PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC __glewGetRenderbufferParameterivEXT = NULL; +PFNGLISFRAMEBUFFEREXTPROC __glewIsFramebufferEXT = NULL; +PFNGLISRENDERBUFFEREXTPROC __glewIsRenderbufferEXT = NULL; +PFNGLRENDERBUFFERSTORAGEEXTPROC __glewRenderbufferStorageEXT = NULL; + +PFNGLFRAMEBUFFERTEXTUREEXTPROC __glewFramebufferTextureEXT = NULL; +PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC __glewFramebufferTextureFaceEXT = NULL; +PFNGLPROGRAMPARAMETERIEXTPROC __glewProgramParameteriEXT = NULL; + +PFNGLPROGRAMENVPARAMETERS4FVEXTPROC __glewProgramEnvParameters4fvEXT = NULL; +PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC __glewProgramLocalParameters4fvEXT = NULL; + +PFNGLBINDFRAGDATALOCATIONEXTPROC __glewBindFragDataLocationEXT = NULL; +PFNGLGETFRAGDATALOCATIONEXTPROC __glewGetFragDataLocationEXT = NULL; +PFNGLGETUNIFORMUIVEXTPROC __glewGetUniformuivEXT = NULL; +PFNGLGETVERTEXATTRIBIIVEXTPROC __glewGetVertexAttribIivEXT = NULL; +PFNGLGETVERTEXATTRIBIUIVEXTPROC __glewGetVertexAttribIuivEXT = NULL; +PFNGLUNIFORM1UIEXTPROC __glewUniform1uiEXT = NULL; +PFNGLUNIFORM1UIVEXTPROC __glewUniform1uivEXT = NULL; +PFNGLUNIFORM2UIEXTPROC __glewUniform2uiEXT = NULL; +PFNGLUNIFORM2UIVEXTPROC __glewUniform2uivEXT = NULL; +PFNGLUNIFORM3UIEXTPROC __glewUniform3uiEXT = NULL; +PFNGLUNIFORM3UIVEXTPROC __glewUniform3uivEXT = NULL; +PFNGLUNIFORM4UIEXTPROC __glewUniform4uiEXT = NULL; +PFNGLUNIFORM4UIVEXTPROC __glewUniform4uivEXT = NULL; +PFNGLVERTEXATTRIBI1IEXTPROC __glewVertexAttribI1iEXT = NULL; +PFNGLVERTEXATTRIBI1IVEXTPROC __glewVertexAttribI1ivEXT = NULL; +PFNGLVERTEXATTRIBI1UIEXTPROC __glewVertexAttribI1uiEXT = NULL; +PFNGLVERTEXATTRIBI1UIVEXTPROC __glewVertexAttribI1uivEXT = NULL; +PFNGLVERTEXATTRIBI2IEXTPROC __glewVertexAttribI2iEXT = NULL; +PFNGLVERTEXATTRIBI2IVEXTPROC __glewVertexAttribI2ivEXT = NULL; +PFNGLVERTEXATTRIBI2UIEXTPROC __glewVertexAttribI2uiEXT = NULL; +PFNGLVERTEXATTRIBI2UIVEXTPROC __glewVertexAttribI2uivEXT = NULL; +PFNGLVERTEXATTRIBI3IEXTPROC __glewVertexAttribI3iEXT = NULL; +PFNGLVERTEXATTRIBI3IVEXTPROC __glewVertexAttribI3ivEXT = NULL; +PFNGLVERTEXATTRIBI3UIEXTPROC __glewVertexAttribI3uiEXT = NULL; +PFNGLVERTEXATTRIBI3UIVEXTPROC __glewVertexAttribI3uivEXT = NULL; +PFNGLVERTEXATTRIBI4BVEXTPROC __glewVertexAttribI4bvEXT = NULL; +PFNGLVERTEXATTRIBI4IEXTPROC __glewVertexAttribI4iEXT = NULL; +PFNGLVERTEXATTRIBI4IVEXTPROC __glewVertexAttribI4ivEXT = NULL; +PFNGLVERTEXATTRIBI4SVEXTPROC __glewVertexAttribI4svEXT = NULL; +PFNGLVERTEXATTRIBI4UBVEXTPROC __glewVertexAttribI4ubvEXT = NULL; +PFNGLVERTEXATTRIBI4UIEXTPROC __glewVertexAttribI4uiEXT = NULL; +PFNGLVERTEXATTRIBI4UIVEXTPROC __glewVertexAttribI4uivEXT = NULL; +PFNGLVERTEXATTRIBI4USVEXTPROC __glewVertexAttribI4usvEXT = NULL; +PFNGLVERTEXATTRIBIPOINTEREXTPROC __glewVertexAttribIPointerEXT = NULL; + +PFNGLGETHISTOGRAMEXTPROC __glewGetHistogramEXT = NULL; +PFNGLGETHISTOGRAMPARAMETERFVEXTPROC __glewGetHistogramParameterfvEXT = NULL; +PFNGLGETHISTOGRAMPARAMETERIVEXTPROC __glewGetHistogramParameterivEXT = NULL; +PFNGLGETMINMAXEXTPROC __glewGetMinmaxEXT = NULL; +PFNGLGETMINMAXPARAMETERFVEXTPROC __glewGetMinmaxParameterfvEXT = NULL; +PFNGLGETMINMAXPARAMETERIVEXTPROC __glewGetMinmaxParameterivEXT = NULL; +PFNGLHISTOGRAMEXTPROC __glewHistogramEXT = NULL; +PFNGLMINMAXEXTPROC __glewMinmaxEXT = NULL; +PFNGLRESETHISTOGRAMEXTPROC __glewResetHistogramEXT = NULL; +PFNGLRESETMINMAXEXTPROC __glewResetMinmaxEXT = NULL; + +PFNGLINDEXFUNCEXTPROC __glewIndexFuncEXT = NULL; + +PFNGLINDEXMATERIALEXTPROC __glewIndexMaterialEXT = NULL; + +PFNGLAPPLYTEXTUREEXTPROC __glewApplyTextureEXT = NULL; +PFNGLTEXTURELIGHTEXTPROC __glewTextureLightEXT = NULL; +PFNGLTEXTUREMATERIALEXTPROC __glewTextureMaterialEXT = NULL; + +PFNGLMULTIDRAWARRAYSEXTPROC __glewMultiDrawArraysEXT = NULL; +PFNGLMULTIDRAWELEMENTSEXTPROC __glewMultiDrawElementsEXT = NULL; + +PFNGLSAMPLEMASKEXTPROC __glewSampleMaskEXT = NULL; +PFNGLSAMPLEPATTERNEXTPROC __glewSamplePatternEXT = NULL; + +PFNGLCOLORTABLEEXTPROC __glewColorTableEXT = NULL; +PFNGLGETCOLORTABLEEXTPROC __glewGetColorTableEXT = NULL; +PFNGLGETCOLORTABLEPARAMETERFVEXTPROC __glewGetColorTableParameterfvEXT = NULL; +PFNGLGETCOLORTABLEPARAMETERIVEXTPROC __glewGetColorTableParameterivEXT = NULL; + +PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC __glewGetPixelTransformParameterfvEXT = NULL; +PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC __glewGetPixelTransformParameterivEXT = NULL; +PFNGLPIXELTRANSFORMPARAMETERFEXTPROC __glewPixelTransformParameterfEXT = NULL; +PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC __glewPixelTransformParameterfvEXT = NULL; +PFNGLPIXELTRANSFORMPARAMETERIEXTPROC __glewPixelTransformParameteriEXT = NULL; +PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC __glewPixelTransformParameterivEXT = NULL; + +PFNGLPOINTPARAMETERFEXTPROC __glewPointParameterfEXT = NULL; +PFNGLPOINTPARAMETERFVEXTPROC __glewPointParameterfvEXT = NULL; + +PFNGLPOLYGONOFFSETEXTPROC __glewPolygonOffsetEXT = NULL; + +PFNGLPOLYGONOFFSETCLAMPEXTPROC __glewPolygonOffsetClampEXT = NULL; + +PFNGLPROVOKINGVERTEXEXTPROC __glewProvokingVertexEXT = NULL; + +PFNGLCOVERAGEMODULATIONNVPROC __glewCoverageModulationNV = NULL; +PFNGLCOVERAGEMODULATIONTABLENVPROC __glewCoverageModulationTableNV = NULL; +PFNGLGETCOVERAGEMODULATIONTABLENVPROC __glewGetCoverageModulationTableNV = NULL; +PFNGLRASTERSAMPLESEXTPROC __glewRasterSamplesEXT = NULL; + +PFNGLBEGINSCENEEXTPROC __glewBeginSceneEXT = NULL; +PFNGLENDSCENEEXTPROC __glewEndSceneEXT = NULL; + +PFNGLSECONDARYCOLOR3BEXTPROC __glewSecondaryColor3bEXT = NULL; +PFNGLSECONDARYCOLOR3BVEXTPROC __glewSecondaryColor3bvEXT = NULL; +PFNGLSECONDARYCOLOR3DEXTPROC __glewSecondaryColor3dEXT = NULL; +PFNGLSECONDARYCOLOR3DVEXTPROC __glewSecondaryColor3dvEXT = NULL; +PFNGLSECONDARYCOLOR3FEXTPROC __glewSecondaryColor3fEXT = NULL; +PFNGLSECONDARYCOLOR3FVEXTPROC __glewSecondaryColor3fvEXT = NULL; +PFNGLSECONDARYCOLOR3IEXTPROC __glewSecondaryColor3iEXT = NULL; +PFNGLSECONDARYCOLOR3IVEXTPROC __glewSecondaryColor3ivEXT = NULL; +PFNGLSECONDARYCOLOR3SEXTPROC __glewSecondaryColor3sEXT = NULL; +PFNGLSECONDARYCOLOR3SVEXTPROC __glewSecondaryColor3svEXT = NULL; +PFNGLSECONDARYCOLOR3UBEXTPROC __glewSecondaryColor3ubEXT = NULL; +PFNGLSECONDARYCOLOR3UBVEXTPROC __glewSecondaryColor3ubvEXT = NULL; +PFNGLSECONDARYCOLOR3UIEXTPROC __glewSecondaryColor3uiEXT = NULL; +PFNGLSECONDARYCOLOR3UIVEXTPROC __glewSecondaryColor3uivEXT = NULL; +PFNGLSECONDARYCOLOR3USEXTPROC __glewSecondaryColor3usEXT = NULL; +PFNGLSECONDARYCOLOR3USVEXTPROC __glewSecondaryColor3usvEXT = NULL; +PFNGLSECONDARYCOLORPOINTEREXTPROC __glewSecondaryColorPointerEXT = NULL; + +PFNGLACTIVEPROGRAMEXTPROC __glewActiveProgramEXT = NULL; +PFNGLCREATESHADERPROGRAMEXTPROC __glewCreateShaderProgramEXT = NULL; +PFNGLUSESHADERPROGRAMEXTPROC __glewUseShaderProgramEXT = NULL; + +PFNGLBINDIMAGETEXTUREEXTPROC __glewBindImageTextureEXT = NULL; +PFNGLMEMORYBARRIEREXTPROC __glewMemoryBarrierEXT = NULL; + +PFNGLACTIVESTENCILFACEEXTPROC __glewActiveStencilFaceEXT = NULL; + +PFNGLTEXSUBIMAGE1DEXTPROC __glewTexSubImage1DEXT = NULL; +PFNGLTEXSUBIMAGE2DEXTPROC __glewTexSubImage2DEXT = NULL; +PFNGLTEXSUBIMAGE3DEXTPROC __glewTexSubImage3DEXT = NULL; + +PFNGLTEXIMAGE3DEXTPROC __glewTexImage3DEXT = NULL; + +PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC __glewFramebufferTextureLayerEXT = NULL; + +PFNGLTEXBUFFEREXTPROC __glewTexBufferEXT = NULL; + +PFNGLCLEARCOLORIIEXTPROC __glewClearColorIiEXT = NULL; +PFNGLCLEARCOLORIUIEXTPROC __glewClearColorIuiEXT = NULL; +PFNGLGETTEXPARAMETERIIVEXTPROC __glewGetTexParameterIivEXT = NULL; +PFNGLGETTEXPARAMETERIUIVEXTPROC __glewGetTexParameterIuivEXT = NULL; +PFNGLTEXPARAMETERIIVEXTPROC __glewTexParameterIivEXT = NULL; +PFNGLTEXPARAMETERIUIVEXTPROC __glewTexParameterIuivEXT = NULL; + +PFNGLARETEXTURESRESIDENTEXTPROC __glewAreTexturesResidentEXT = NULL; +PFNGLBINDTEXTUREEXTPROC __glewBindTextureEXT = NULL; +PFNGLDELETETEXTURESEXTPROC __glewDeleteTexturesEXT = NULL; +PFNGLGENTEXTURESEXTPROC __glewGenTexturesEXT = NULL; +PFNGLISTEXTUREEXTPROC __glewIsTextureEXT = NULL; +PFNGLPRIORITIZETEXTURESEXTPROC __glewPrioritizeTexturesEXT = NULL; + +PFNGLTEXTURENORMALEXTPROC __glewTextureNormalEXT = NULL; + +PFNGLGETQUERYOBJECTI64VEXTPROC __glewGetQueryObjecti64vEXT = NULL; +PFNGLGETQUERYOBJECTUI64VEXTPROC __glewGetQueryObjectui64vEXT = NULL; + +PFNGLBEGINTRANSFORMFEEDBACKEXTPROC __glewBeginTransformFeedbackEXT = NULL; +PFNGLBINDBUFFERBASEEXTPROC __glewBindBufferBaseEXT = NULL; +PFNGLBINDBUFFEROFFSETEXTPROC __glewBindBufferOffsetEXT = NULL; +PFNGLBINDBUFFERRANGEEXTPROC __glewBindBufferRangeEXT = NULL; +PFNGLENDTRANSFORMFEEDBACKEXTPROC __glewEndTransformFeedbackEXT = NULL; +PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC __glewGetTransformFeedbackVaryingEXT = NULL; +PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC __glewTransformFeedbackVaryingsEXT = NULL; + +PFNGLARRAYELEMENTEXTPROC __glewArrayElementEXT = NULL; +PFNGLCOLORPOINTEREXTPROC __glewColorPointerEXT = NULL; +PFNGLDRAWARRAYSEXTPROC __glewDrawArraysEXT = NULL; +PFNGLEDGEFLAGPOINTEREXTPROC __glewEdgeFlagPointerEXT = NULL; +PFNGLINDEXPOINTEREXTPROC __glewIndexPointerEXT = NULL; +PFNGLNORMALPOINTEREXTPROC __glewNormalPointerEXT = NULL; +PFNGLTEXCOORDPOINTEREXTPROC __glewTexCoordPointerEXT = NULL; +PFNGLVERTEXPOINTEREXTPROC __glewVertexPointerEXT = NULL; + +PFNGLGETVERTEXATTRIBLDVEXTPROC __glewGetVertexAttribLdvEXT = NULL; +PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC __glewVertexArrayVertexAttribLOffsetEXT = NULL; +PFNGLVERTEXATTRIBL1DEXTPROC __glewVertexAttribL1dEXT = NULL; +PFNGLVERTEXATTRIBL1DVEXTPROC __glewVertexAttribL1dvEXT = NULL; +PFNGLVERTEXATTRIBL2DEXTPROC __glewVertexAttribL2dEXT = NULL; +PFNGLVERTEXATTRIBL2DVEXTPROC __glewVertexAttribL2dvEXT = NULL; +PFNGLVERTEXATTRIBL3DEXTPROC __glewVertexAttribL3dEXT = NULL; +PFNGLVERTEXATTRIBL3DVEXTPROC __glewVertexAttribL3dvEXT = NULL; +PFNGLVERTEXATTRIBL4DEXTPROC __glewVertexAttribL4dEXT = NULL; +PFNGLVERTEXATTRIBL4DVEXTPROC __glewVertexAttribL4dvEXT = NULL; +PFNGLVERTEXATTRIBLPOINTEREXTPROC __glewVertexAttribLPointerEXT = NULL; + +PFNGLBEGINVERTEXSHADEREXTPROC __glewBeginVertexShaderEXT = NULL; +PFNGLBINDLIGHTPARAMETEREXTPROC __glewBindLightParameterEXT = NULL; +PFNGLBINDMATERIALPARAMETEREXTPROC __glewBindMaterialParameterEXT = NULL; +PFNGLBINDPARAMETEREXTPROC __glewBindParameterEXT = NULL; +PFNGLBINDTEXGENPARAMETEREXTPROC __glewBindTexGenParameterEXT = NULL; +PFNGLBINDTEXTUREUNITPARAMETEREXTPROC __glewBindTextureUnitParameterEXT = NULL; +PFNGLBINDVERTEXSHADEREXTPROC __glewBindVertexShaderEXT = NULL; +PFNGLDELETEVERTEXSHADEREXTPROC __glewDeleteVertexShaderEXT = NULL; +PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC __glewDisableVariantClientStateEXT = NULL; +PFNGLENABLEVARIANTCLIENTSTATEEXTPROC __glewEnableVariantClientStateEXT = NULL; +PFNGLENDVERTEXSHADEREXTPROC __glewEndVertexShaderEXT = NULL; +PFNGLEXTRACTCOMPONENTEXTPROC __glewExtractComponentEXT = NULL; +PFNGLGENSYMBOLSEXTPROC __glewGenSymbolsEXT = NULL; +PFNGLGENVERTEXSHADERSEXTPROC __glewGenVertexShadersEXT = NULL; +PFNGLGETINVARIANTBOOLEANVEXTPROC __glewGetInvariantBooleanvEXT = NULL; +PFNGLGETINVARIANTFLOATVEXTPROC __glewGetInvariantFloatvEXT = NULL; +PFNGLGETINVARIANTINTEGERVEXTPROC __glewGetInvariantIntegervEXT = NULL; +PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC __glewGetLocalConstantBooleanvEXT = NULL; +PFNGLGETLOCALCONSTANTFLOATVEXTPROC __glewGetLocalConstantFloatvEXT = NULL; +PFNGLGETLOCALCONSTANTINTEGERVEXTPROC __glewGetLocalConstantIntegervEXT = NULL; +PFNGLGETVARIANTBOOLEANVEXTPROC __glewGetVariantBooleanvEXT = NULL; +PFNGLGETVARIANTFLOATVEXTPROC __glewGetVariantFloatvEXT = NULL; +PFNGLGETVARIANTINTEGERVEXTPROC __glewGetVariantIntegervEXT = NULL; +PFNGLGETVARIANTPOINTERVEXTPROC __glewGetVariantPointervEXT = NULL; +PFNGLINSERTCOMPONENTEXTPROC __glewInsertComponentEXT = NULL; +PFNGLISVARIANTENABLEDEXTPROC __glewIsVariantEnabledEXT = NULL; +PFNGLSETINVARIANTEXTPROC __glewSetInvariantEXT = NULL; +PFNGLSETLOCALCONSTANTEXTPROC __glewSetLocalConstantEXT = NULL; +PFNGLSHADEROP1EXTPROC __glewShaderOp1EXT = NULL; +PFNGLSHADEROP2EXTPROC __glewShaderOp2EXT = NULL; +PFNGLSHADEROP3EXTPROC __glewShaderOp3EXT = NULL; +PFNGLSWIZZLEEXTPROC __glewSwizzleEXT = NULL; +PFNGLVARIANTPOINTEREXTPROC __glewVariantPointerEXT = NULL; +PFNGLVARIANTBVEXTPROC __glewVariantbvEXT = NULL; +PFNGLVARIANTDVEXTPROC __glewVariantdvEXT = NULL; +PFNGLVARIANTFVEXTPROC __glewVariantfvEXT = NULL; +PFNGLVARIANTIVEXTPROC __glewVariantivEXT = NULL; +PFNGLVARIANTSVEXTPROC __glewVariantsvEXT = NULL; +PFNGLVARIANTUBVEXTPROC __glewVariantubvEXT = NULL; +PFNGLVARIANTUIVEXTPROC __glewVariantuivEXT = NULL; +PFNGLVARIANTUSVEXTPROC __glewVariantusvEXT = NULL; +PFNGLWRITEMASKEXTPROC __glewWriteMaskEXT = NULL; + +PFNGLVERTEXWEIGHTPOINTEREXTPROC __glewVertexWeightPointerEXT = NULL; +PFNGLVERTEXWEIGHTFEXTPROC __glewVertexWeightfEXT = NULL; +PFNGLVERTEXWEIGHTFVEXTPROC __glewVertexWeightfvEXT = NULL; + +PFNGLIMPORTSYNCEXTPROC __glewImportSyncEXT = NULL; + +PFNGLFRAMETERMINATORGREMEDYPROC __glewFrameTerminatorGREMEDY = NULL; + +PFNGLSTRINGMARKERGREMEDYPROC __glewStringMarkerGREMEDY = NULL; + +PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC __glewGetImageTransformParameterfvHP = NULL; +PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC __glewGetImageTransformParameterivHP = NULL; +PFNGLIMAGETRANSFORMPARAMETERFHPPROC __glewImageTransformParameterfHP = NULL; +PFNGLIMAGETRANSFORMPARAMETERFVHPPROC __glewImageTransformParameterfvHP = NULL; +PFNGLIMAGETRANSFORMPARAMETERIHPPROC __glewImageTransformParameteriHP = NULL; +PFNGLIMAGETRANSFORMPARAMETERIVHPPROC __glewImageTransformParameterivHP = NULL; + +PFNGLMULTIMODEDRAWARRAYSIBMPROC __glewMultiModeDrawArraysIBM = NULL; +PFNGLMULTIMODEDRAWELEMENTSIBMPROC __glewMultiModeDrawElementsIBM = NULL; + +PFNGLCOLORPOINTERLISTIBMPROC __glewColorPointerListIBM = NULL; +PFNGLEDGEFLAGPOINTERLISTIBMPROC __glewEdgeFlagPointerListIBM = NULL; +PFNGLFOGCOORDPOINTERLISTIBMPROC __glewFogCoordPointerListIBM = NULL; +PFNGLINDEXPOINTERLISTIBMPROC __glewIndexPointerListIBM = NULL; +PFNGLNORMALPOINTERLISTIBMPROC __glewNormalPointerListIBM = NULL; +PFNGLSECONDARYCOLORPOINTERLISTIBMPROC __glewSecondaryColorPointerListIBM = NULL; +PFNGLTEXCOORDPOINTERLISTIBMPROC __glewTexCoordPointerListIBM = NULL; +PFNGLVERTEXPOINTERLISTIBMPROC __glewVertexPointerListIBM = NULL; + +PFNGLMAPTEXTURE2DINTELPROC __glewMapTexture2DINTEL = NULL; +PFNGLSYNCTEXTUREINTELPROC __glewSyncTextureINTEL = NULL; +PFNGLUNMAPTEXTURE2DINTELPROC __glewUnmapTexture2DINTEL = NULL; + +PFNGLCOLORPOINTERVINTELPROC __glewColorPointervINTEL = NULL; +PFNGLNORMALPOINTERVINTELPROC __glewNormalPointervINTEL = NULL; +PFNGLTEXCOORDPOINTERVINTELPROC __glewTexCoordPointervINTEL = NULL; +PFNGLVERTEXPOINTERVINTELPROC __glewVertexPointervINTEL = NULL; + +PFNGLBEGINPERFQUERYINTELPROC __glewBeginPerfQueryINTEL = NULL; +PFNGLCREATEPERFQUERYINTELPROC __glewCreatePerfQueryINTEL = NULL; +PFNGLDELETEPERFQUERYINTELPROC __glewDeletePerfQueryINTEL = NULL; +PFNGLENDPERFQUERYINTELPROC __glewEndPerfQueryINTEL = NULL; +PFNGLGETFIRSTPERFQUERYIDINTELPROC __glewGetFirstPerfQueryIdINTEL = NULL; +PFNGLGETNEXTPERFQUERYIDINTELPROC __glewGetNextPerfQueryIdINTEL = NULL; +PFNGLGETPERFCOUNTERINFOINTELPROC __glewGetPerfCounterInfoINTEL = NULL; +PFNGLGETPERFQUERYDATAINTELPROC __glewGetPerfQueryDataINTEL = NULL; +PFNGLGETPERFQUERYIDBYNAMEINTELPROC __glewGetPerfQueryIdByNameINTEL = NULL; +PFNGLGETPERFQUERYINFOINTELPROC __glewGetPerfQueryInfoINTEL = NULL; + +PFNGLTEXSCISSORFUNCINTELPROC __glewTexScissorFuncINTEL = NULL; +PFNGLTEXSCISSORINTELPROC __glewTexScissorINTEL = NULL; + +PFNGLBLENDBARRIERKHRPROC __glewBlendBarrierKHR = NULL; + +PFNGLDEBUGMESSAGECALLBACKPROC __glewDebugMessageCallback = NULL; +PFNGLDEBUGMESSAGECONTROLPROC __glewDebugMessageControl = NULL; +PFNGLDEBUGMESSAGEINSERTPROC __glewDebugMessageInsert = NULL; +PFNGLGETDEBUGMESSAGELOGPROC __glewGetDebugMessageLog = NULL; +PFNGLGETOBJECTLABELPROC __glewGetObjectLabel = NULL; +PFNGLGETOBJECTPTRLABELPROC __glewGetObjectPtrLabel = NULL; +PFNGLOBJECTLABELPROC __glewObjectLabel = NULL; +PFNGLOBJECTPTRLABELPROC __glewObjectPtrLabel = NULL; +PFNGLPOPDEBUGGROUPPROC __glewPopDebugGroup = NULL; +PFNGLPUSHDEBUGGROUPPROC __glewPushDebugGroup = NULL; + +PFNGLGETNUNIFORMFVPROC __glewGetnUniformfv = NULL; +PFNGLGETNUNIFORMIVPROC __glewGetnUniformiv = NULL; +PFNGLGETNUNIFORMUIVPROC __glewGetnUniformuiv = NULL; +PFNGLREADNPIXELSPROC __glewReadnPixels = NULL; + +PFNGLBUFFERREGIONENABLEDPROC __glewBufferRegionEnabled = NULL; +PFNGLDELETEBUFFERREGIONPROC __glewDeleteBufferRegion = NULL; +PFNGLDRAWBUFFERREGIONPROC __glewDrawBufferRegion = NULL; +PFNGLNEWBUFFERREGIONPROC __glewNewBufferRegion = NULL; +PFNGLREADBUFFERREGIONPROC __glewReadBufferRegion = NULL; + +PFNGLRESIZEBUFFERSMESAPROC __glewResizeBuffersMESA = NULL; + +PFNGLWINDOWPOS2DMESAPROC __glewWindowPos2dMESA = NULL; +PFNGLWINDOWPOS2DVMESAPROC __glewWindowPos2dvMESA = NULL; +PFNGLWINDOWPOS2FMESAPROC __glewWindowPos2fMESA = NULL; +PFNGLWINDOWPOS2FVMESAPROC __glewWindowPos2fvMESA = NULL; +PFNGLWINDOWPOS2IMESAPROC __glewWindowPos2iMESA = NULL; +PFNGLWINDOWPOS2IVMESAPROC __glewWindowPos2ivMESA = NULL; +PFNGLWINDOWPOS2SMESAPROC __glewWindowPos2sMESA = NULL; +PFNGLWINDOWPOS2SVMESAPROC __glewWindowPos2svMESA = NULL; +PFNGLWINDOWPOS3DMESAPROC __glewWindowPos3dMESA = NULL; +PFNGLWINDOWPOS3DVMESAPROC __glewWindowPos3dvMESA = NULL; +PFNGLWINDOWPOS3FMESAPROC __glewWindowPos3fMESA = NULL; +PFNGLWINDOWPOS3FVMESAPROC __glewWindowPos3fvMESA = NULL; +PFNGLWINDOWPOS3IMESAPROC __glewWindowPos3iMESA = NULL; +PFNGLWINDOWPOS3IVMESAPROC __glewWindowPos3ivMESA = NULL; +PFNGLWINDOWPOS3SMESAPROC __glewWindowPos3sMESA = NULL; +PFNGLWINDOWPOS3SVMESAPROC __glewWindowPos3svMESA = NULL; +PFNGLWINDOWPOS4DMESAPROC __glewWindowPos4dMESA = NULL; +PFNGLWINDOWPOS4DVMESAPROC __glewWindowPos4dvMESA = NULL; +PFNGLWINDOWPOS4FMESAPROC __glewWindowPos4fMESA = NULL; +PFNGLWINDOWPOS4FVMESAPROC __glewWindowPos4fvMESA = NULL; +PFNGLWINDOWPOS4IMESAPROC __glewWindowPos4iMESA = NULL; +PFNGLWINDOWPOS4IVMESAPROC __glewWindowPos4ivMESA = NULL; +PFNGLWINDOWPOS4SMESAPROC __glewWindowPos4sMESA = NULL; +PFNGLWINDOWPOS4SVMESAPROC __glewWindowPos4svMESA = NULL; + +PFNGLBEGINCONDITIONALRENDERNVXPROC __glewBeginConditionalRenderNVX = NULL; +PFNGLENDCONDITIONALRENDERNVXPROC __glewEndConditionalRenderNVX = NULL; + +PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC __glewMultiDrawArraysIndirectBindlessNV = NULL; +PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC __glewMultiDrawElementsIndirectBindlessNV = NULL; + +PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC __glewMultiDrawArraysIndirectBindlessCountNV = NULL; +PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC __glewMultiDrawElementsIndirectBindlessCountNV = NULL; + +PFNGLGETIMAGEHANDLENVPROC __glewGetImageHandleNV = NULL; +PFNGLGETTEXTUREHANDLENVPROC __glewGetTextureHandleNV = NULL; +PFNGLGETTEXTURESAMPLERHANDLENVPROC __glewGetTextureSamplerHandleNV = NULL; +PFNGLISIMAGEHANDLERESIDENTNVPROC __glewIsImageHandleResidentNV = NULL; +PFNGLISTEXTUREHANDLERESIDENTNVPROC __glewIsTextureHandleResidentNV = NULL; +PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC __glewMakeImageHandleNonResidentNV = NULL; +PFNGLMAKEIMAGEHANDLERESIDENTNVPROC __glewMakeImageHandleResidentNV = NULL; +PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC __glewMakeTextureHandleNonResidentNV = NULL; +PFNGLMAKETEXTUREHANDLERESIDENTNVPROC __glewMakeTextureHandleResidentNV = NULL; +PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC __glewProgramUniformHandleui64NV = NULL; +PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC __glewProgramUniformHandleui64vNV = NULL; +PFNGLUNIFORMHANDLEUI64NVPROC __glewUniformHandleui64NV = NULL; +PFNGLUNIFORMHANDLEUI64VNVPROC __glewUniformHandleui64vNV = NULL; + +PFNGLBLENDBARRIERNVPROC __glewBlendBarrierNV = NULL; +PFNGLBLENDPARAMETERINVPROC __glewBlendParameteriNV = NULL; + +PFNGLBEGINCONDITIONALRENDERNVPROC __glewBeginConditionalRenderNV = NULL; +PFNGLENDCONDITIONALRENDERNVPROC __glewEndConditionalRenderNV = NULL; + +PFNGLSUBPIXELPRECISIONBIASNVPROC __glewSubpixelPrecisionBiasNV = NULL; + +PFNGLCONSERVATIVERASTERPARAMETERFNVPROC __glewConservativeRasterParameterfNV = NULL; + +PFNGLCOPYIMAGESUBDATANVPROC __glewCopyImageSubDataNV = NULL; + +PFNGLCLEARDEPTHDNVPROC __glewClearDepthdNV = NULL; +PFNGLDEPTHBOUNDSDNVPROC __glewDepthBoundsdNV = NULL; +PFNGLDEPTHRANGEDNVPROC __glewDepthRangedNV = NULL; + +PFNGLDRAWTEXTURENVPROC __glewDrawTextureNV = NULL; + +PFNGLEVALMAPSNVPROC __glewEvalMapsNV = NULL; +PFNGLGETMAPATTRIBPARAMETERFVNVPROC __glewGetMapAttribParameterfvNV = NULL; +PFNGLGETMAPATTRIBPARAMETERIVNVPROC __glewGetMapAttribParameterivNV = NULL; +PFNGLGETMAPCONTROLPOINTSNVPROC __glewGetMapControlPointsNV = NULL; +PFNGLGETMAPPARAMETERFVNVPROC __glewGetMapParameterfvNV = NULL; +PFNGLGETMAPPARAMETERIVNVPROC __glewGetMapParameterivNV = NULL; +PFNGLMAPCONTROLPOINTSNVPROC __glewMapControlPointsNV = NULL; +PFNGLMAPPARAMETERFVNVPROC __glewMapParameterfvNV = NULL; +PFNGLMAPPARAMETERIVNVPROC __glewMapParameterivNV = NULL; + +PFNGLGETMULTISAMPLEFVNVPROC __glewGetMultisamplefvNV = NULL; +PFNGLSAMPLEMASKINDEXEDNVPROC __glewSampleMaskIndexedNV = NULL; +PFNGLTEXRENDERBUFFERNVPROC __glewTexRenderbufferNV = NULL; + +PFNGLDELETEFENCESNVPROC __glewDeleteFencesNV = NULL; +PFNGLFINISHFENCENVPROC __glewFinishFenceNV = NULL; +PFNGLGENFENCESNVPROC __glewGenFencesNV = NULL; +PFNGLGETFENCEIVNVPROC __glewGetFenceivNV = NULL; +PFNGLISFENCENVPROC __glewIsFenceNV = NULL; +PFNGLSETFENCENVPROC __glewSetFenceNV = NULL; +PFNGLTESTFENCENVPROC __glewTestFenceNV = NULL; + +PFNGLFRAGMENTCOVERAGECOLORNVPROC __glewFragmentCoverageColorNV = NULL; + +PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC __glewGetProgramNamedParameterdvNV = NULL; +PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC __glewGetProgramNamedParameterfvNV = NULL; +PFNGLPROGRAMNAMEDPARAMETER4DNVPROC __glewProgramNamedParameter4dNV = NULL; +PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC __glewProgramNamedParameter4dvNV = NULL; +PFNGLPROGRAMNAMEDPARAMETER4FNVPROC __glewProgramNamedParameter4fNV = NULL; +PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC __glewProgramNamedParameter4fvNV = NULL; + +PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC __glewRenderbufferStorageMultisampleCoverageNV = NULL; + +PFNGLPROGRAMVERTEXLIMITNVPROC __glewProgramVertexLimitNV = NULL; + +PFNGLPROGRAMENVPARAMETERI4INVPROC __glewProgramEnvParameterI4iNV = NULL; +PFNGLPROGRAMENVPARAMETERI4IVNVPROC __glewProgramEnvParameterI4ivNV = NULL; +PFNGLPROGRAMENVPARAMETERI4UINVPROC __glewProgramEnvParameterI4uiNV = NULL; +PFNGLPROGRAMENVPARAMETERI4UIVNVPROC __glewProgramEnvParameterI4uivNV = NULL; +PFNGLPROGRAMENVPARAMETERSI4IVNVPROC __glewProgramEnvParametersI4ivNV = NULL; +PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC __glewProgramEnvParametersI4uivNV = NULL; +PFNGLPROGRAMLOCALPARAMETERI4INVPROC __glewProgramLocalParameterI4iNV = NULL; +PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC __glewProgramLocalParameterI4ivNV = NULL; +PFNGLPROGRAMLOCALPARAMETERI4UINVPROC __glewProgramLocalParameterI4uiNV = NULL; +PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC __glewProgramLocalParameterI4uivNV = NULL; +PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC __glewProgramLocalParametersI4ivNV = NULL; +PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC __glewProgramLocalParametersI4uivNV = NULL; + +PFNGLGETUNIFORMI64VNVPROC __glewGetUniformi64vNV = NULL; +PFNGLGETUNIFORMUI64VNVPROC __glewGetUniformui64vNV = NULL; +PFNGLPROGRAMUNIFORM1I64NVPROC __glewProgramUniform1i64NV = NULL; +PFNGLPROGRAMUNIFORM1I64VNVPROC __glewProgramUniform1i64vNV = NULL; +PFNGLPROGRAMUNIFORM1UI64NVPROC __glewProgramUniform1ui64NV = NULL; +PFNGLPROGRAMUNIFORM1UI64VNVPROC __glewProgramUniform1ui64vNV = NULL; +PFNGLPROGRAMUNIFORM2I64NVPROC __glewProgramUniform2i64NV = NULL; +PFNGLPROGRAMUNIFORM2I64VNVPROC __glewProgramUniform2i64vNV = NULL; +PFNGLPROGRAMUNIFORM2UI64NVPROC __glewProgramUniform2ui64NV = NULL; +PFNGLPROGRAMUNIFORM2UI64VNVPROC __glewProgramUniform2ui64vNV = NULL; +PFNGLPROGRAMUNIFORM3I64NVPROC __glewProgramUniform3i64NV = NULL; +PFNGLPROGRAMUNIFORM3I64VNVPROC __glewProgramUniform3i64vNV = NULL; +PFNGLPROGRAMUNIFORM3UI64NVPROC __glewProgramUniform3ui64NV = NULL; +PFNGLPROGRAMUNIFORM3UI64VNVPROC __glewProgramUniform3ui64vNV = NULL; +PFNGLPROGRAMUNIFORM4I64NVPROC __glewProgramUniform4i64NV = NULL; +PFNGLPROGRAMUNIFORM4I64VNVPROC __glewProgramUniform4i64vNV = NULL; +PFNGLPROGRAMUNIFORM4UI64NVPROC __glewProgramUniform4ui64NV = NULL; +PFNGLPROGRAMUNIFORM4UI64VNVPROC __glewProgramUniform4ui64vNV = NULL; +PFNGLUNIFORM1I64NVPROC __glewUniform1i64NV = NULL; +PFNGLUNIFORM1I64VNVPROC __glewUniform1i64vNV = NULL; +PFNGLUNIFORM1UI64NVPROC __glewUniform1ui64NV = NULL; +PFNGLUNIFORM1UI64VNVPROC __glewUniform1ui64vNV = NULL; +PFNGLUNIFORM2I64NVPROC __glewUniform2i64NV = NULL; +PFNGLUNIFORM2I64VNVPROC __glewUniform2i64vNV = NULL; +PFNGLUNIFORM2UI64NVPROC __glewUniform2ui64NV = NULL; +PFNGLUNIFORM2UI64VNVPROC __glewUniform2ui64vNV = NULL; +PFNGLUNIFORM3I64NVPROC __glewUniform3i64NV = NULL; +PFNGLUNIFORM3I64VNVPROC __glewUniform3i64vNV = NULL; +PFNGLUNIFORM3UI64NVPROC __glewUniform3ui64NV = NULL; +PFNGLUNIFORM3UI64VNVPROC __glewUniform3ui64vNV = NULL; +PFNGLUNIFORM4I64NVPROC __glewUniform4i64NV = NULL; +PFNGLUNIFORM4I64VNVPROC __glewUniform4i64vNV = NULL; +PFNGLUNIFORM4UI64NVPROC __glewUniform4ui64NV = NULL; +PFNGLUNIFORM4UI64VNVPROC __glewUniform4ui64vNV = NULL; + +PFNGLCOLOR3HNVPROC __glewColor3hNV = NULL; +PFNGLCOLOR3HVNVPROC __glewColor3hvNV = NULL; +PFNGLCOLOR4HNVPROC __glewColor4hNV = NULL; +PFNGLCOLOR4HVNVPROC __glewColor4hvNV = NULL; +PFNGLFOGCOORDHNVPROC __glewFogCoordhNV = NULL; +PFNGLFOGCOORDHVNVPROC __glewFogCoordhvNV = NULL; +PFNGLMULTITEXCOORD1HNVPROC __glewMultiTexCoord1hNV = NULL; +PFNGLMULTITEXCOORD1HVNVPROC __glewMultiTexCoord1hvNV = NULL; +PFNGLMULTITEXCOORD2HNVPROC __glewMultiTexCoord2hNV = NULL; +PFNGLMULTITEXCOORD2HVNVPROC __glewMultiTexCoord2hvNV = NULL; +PFNGLMULTITEXCOORD3HNVPROC __glewMultiTexCoord3hNV = NULL; +PFNGLMULTITEXCOORD3HVNVPROC __glewMultiTexCoord3hvNV = NULL; +PFNGLMULTITEXCOORD4HNVPROC __glewMultiTexCoord4hNV = NULL; +PFNGLMULTITEXCOORD4HVNVPROC __glewMultiTexCoord4hvNV = NULL; +PFNGLNORMAL3HNVPROC __glewNormal3hNV = NULL; +PFNGLNORMAL3HVNVPROC __glewNormal3hvNV = NULL; +PFNGLSECONDARYCOLOR3HNVPROC __glewSecondaryColor3hNV = NULL; +PFNGLSECONDARYCOLOR3HVNVPROC __glewSecondaryColor3hvNV = NULL; +PFNGLTEXCOORD1HNVPROC __glewTexCoord1hNV = NULL; +PFNGLTEXCOORD1HVNVPROC __glewTexCoord1hvNV = NULL; +PFNGLTEXCOORD2HNVPROC __glewTexCoord2hNV = NULL; +PFNGLTEXCOORD2HVNVPROC __glewTexCoord2hvNV = NULL; +PFNGLTEXCOORD3HNVPROC __glewTexCoord3hNV = NULL; +PFNGLTEXCOORD3HVNVPROC __glewTexCoord3hvNV = NULL; +PFNGLTEXCOORD4HNVPROC __glewTexCoord4hNV = NULL; +PFNGLTEXCOORD4HVNVPROC __glewTexCoord4hvNV = NULL; +PFNGLVERTEX2HNVPROC __glewVertex2hNV = NULL; +PFNGLVERTEX2HVNVPROC __glewVertex2hvNV = NULL; +PFNGLVERTEX3HNVPROC __glewVertex3hNV = NULL; +PFNGLVERTEX3HVNVPROC __glewVertex3hvNV = NULL; +PFNGLVERTEX4HNVPROC __glewVertex4hNV = NULL; +PFNGLVERTEX4HVNVPROC __glewVertex4hvNV = NULL; +PFNGLVERTEXATTRIB1HNVPROC __glewVertexAttrib1hNV = NULL; +PFNGLVERTEXATTRIB1HVNVPROC __glewVertexAttrib1hvNV = NULL; +PFNGLVERTEXATTRIB2HNVPROC __glewVertexAttrib2hNV = NULL; +PFNGLVERTEXATTRIB2HVNVPROC __glewVertexAttrib2hvNV = NULL; +PFNGLVERTEXATTRIB3HNVPROC __glewVertexAttrib3hNV = NULL; +PFNGLVERTEXATTRIB3HVNVPROC __glewVertexAttrib3hvNV = NULL; +PFNGLVERTEXATTRIB4HNVPROC __glewVertexAttrib4hNV = NULL; +PFNGLVERTEXATTRIB4HVNVPROC __glewVertexAttrib4hvNV = NULL; +PFNGLVERTEXATTRIBS1HVNVPROC __glewVertexAttribs1hvNV = NULL; +PFNGLVERTEXATTRIBS2HVNVPROC __glewVertexAttribs2hvNV = NULL; +PFNGLVERTEXATTRIBS3HVNVPROC __glewVertexAttribs3hvNV = NULL; +PFNGLVERTEXATTRIBS4HVNVPROC __glewVertexAttribs4hvNV = NULL; +PFNGLVERTEXWEIGHTHNVPROC __glewVertexWeighthNV = NULL; +PFNGLVERTEXWEIGHTHVNVPROC __glewVertexWeighthvNV = NULL; + +PFNGLGETINTERNALFORMATSAMPLEIVNVPROC __glewGetInternalformatSampleivNV = NULL; + +PFNGLBEGINOCCLUSIONQUERYNVPROC __glewBeginOcclusionQueryNV = NULL; +PFNGLDELETEOCCLUSIONQUERIESNVPROC __glewDeleteOcclusionQueriesNV = NULL; +PFNGLENDOCCLUSIONQUERYNVPROC __glewEndOcclusionQueryNV = NULL; +PFNGLGENOCCLUSIONQUERIESNVPROC __glewGenOcclusionQueriesNV = NULL; +PFNGLGETOCCLUSIONQUERYIVNVPROC __glewGetOcclusionQueryivNV = NULL; +PFNGLGETOCCLUSIONQUERYUIVNVPROC __glewGetOcclusionQueryuivNV = NULL; +PFNGLISOCCLUSIONQUERYNVPROC __glewIsOcclusionQueryNV = NULL; + +PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC __glewProgramBufferParametersIivNV = NULL; +PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC __glewProgramBufferParametersIuivNV = NULL; +PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC __glewProgramBufferParametersfvNV = NULL; + +PFNGLCOPYPATHNVPROC __glewCopyPathNV = NULL; +PFNGLCOVERFILLPATHINSTANCEDNVPROC __glewCoverFillPathInstancedNV = NULL; +PFNGLCOVERFILLPATHNVPROC __glewCoverFillPathNV = NULL; +PFNGLCOVERSTROKEPATHINSTANCEDNVPROC __glewCoverStrokePathInstancedNV = NULL; +PFNGLCOVERSTROKEPATHNVPROC __glewCoverStrokePathNV = NULL; +PFNGLDELETEPATHSNVPROC __glewDeletePathsNV = NULL; +PFNGLGENPATHSNVPROC __glewGenPathsNV = NULL; +PFNGLGETPATHCOLORGENFVNVPROC __glewGetPathColorGenfvNV = NULL; +PFNGLGETPATHCOLORGENIVNVPROC __glewGetPathColorGenivNV = NULL; +PFNGLGETPATHCOMMANDSNVPROC __glewGetPathCommandsNV = NULL; +PFNGLGETPATHCOORDSNVPROC __glewGetPathCoordsNV = NULL; +PFNGLGETPATHDASHARRAYNVPROC __glewGetPathDashArrayNV = NULL; +PFNGLGETPATHLENGTHNVPROC __glewGetPathLengthNV = NULL; +PFNGLGETPATHMETRICRANGENVPROC __glewGetPathMetricRangeNV = NULL; +PFNGLGETPATHMETRICSNVPROC __glewGetPathMetricsNV = NULL; +PFNGLGETPATHPARAMETERFVNVPROC __glewGetPathParameterfvNV = NULL; +PFNGLGETPATHPARAMETERIVNVPROC __glewGetPathParameterivNV = NULL; +PFNGLGETPATHSPACINGNVPROC __glewGetPathSpacingNV = NULL; +PFNGLGETPATHTEXGENFVNVPROC __glewGetPathTexGenfvNV = NULL; +PFNGLGETPATHTEXGENIVNVPROC __glewGetPathTexGenivNV = NULL; +PFNGLGETPROGRAMRESOURCEFVNVPROC __glewGetProgramResourcefvNV = NULL; +PFNGLINTERPOLATEPATHSNVPROC __glewInterpolatePathsNV = NULL; +PFNGLISPATHNVPROC __glewIsPathNV = NULL; +PFNGLISPOINTINFILLPATHNVPROC __glewIsPointInFillPathNV = NULL; +PFNGLISPOINTINSTROKEPATHNVPROC __glewIsPointInStrokePathNV = NULL; +PFNGLMATRIXLOAD3X2FNVPROC __glewMatrixLoad3x2fNV = NULL; +PFNGLMATRIXLOAD3X3FNVPROC __glewMatrixLoad3x3fNV = NULL; +PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC __glewMatrixLoadTranspose3x3fNV = NULL; +PFNGLMATRIXMULT3X2FNVPROC __glewMatrixMult3x2fNV = NULL; +PFNGLMATRIXMULT3X3FNVPROC __glewMatrixMult3x3fNV = NULL; +PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC __glewMatrixMultTranspose3x3fNV = NULL; +PFNGLPATHCOLORGENNVPROC __glewPathColorGenNV = NULL; +PFNGLPATHCOMMANDSNVPROC __glewPathCommandsNV = NULL; +PFNGLPATHCOORDSNVPROC __glewPathCoordsNV = NULL; +PFNGLPATHCOVERDEPTHFUNCNVPROC __glewPathCoverDepthFuncNV = NULL; +PFNGLPATHDASHARRAYNVPROC __glewPathDashArrayNV = NULL; +PFNGLPATHFOGGENNVPROC __glewPathFogGenNV = NULL; +PFNGLPATHGLYPHINDEXARRAYNVPROC __glewPathGlyphIndexArrayNV = NULL; +PFNGLPATHGLYPHINDEXRANGENVPROC __glewPathGlyphIndexRangeNV = NULL; +PFNGLPATHGLYPHRANGENVPROC __glewPathGlyphRangeNV = NULL; +PFNGLPATHGLYPHSNVPROC __glewPathGlyphsNV = NULL; +PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC __glewPathMemoryGlyphIndexArrayNV = NULL; +PFNGLPATHPARAMETERFNVPROC __glewPathParameterfNV = NULL; +PFNGLPATHPARAMETERFVNVPROC __glewPathParameterfvNV = NULL; +PFNGLPATHPARAMETERINVPROC __glewPathParameteriNV = NULL; +PFNGLPATHPARAMETERIVNVPROC __glewPathParameterivNV = NULL; +PFNGLPATHSTENCILDEPTHOFFSETNVPROC __glewPathStencilDepthOffsetNV = NULL; +PFNGLPATHSTENCILFUNCNVPROC __glewPathStencilFuncNV = NULL; +PFNGLPATHSTRINGNVPROC __glewPathStringNV = NULL; +PFNGLPATHSUBCOMMANDSNVPROC __glewPathSubCommandsNV = NULL; +PFNGLPATHSUBCOORDSNVPROC __glewPathSubCoordsNV = NULL; +PFNGLPATHTEXGENNVPROC __glewPathTexGenNV = NULL; +PFNGLPOINTALONGPATHNVPROC __glewPointAlongPathNV = NULL; +PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC __glewProgramPathFragmentInputGenNV = NULL; +PFNGLSTENCILFILLPATHINSTANCEDNVPROC __glewStencilFillPathInstancedNV = NULL; +PFNGLSTENCILFILLPATHNVPROC __glewStencilFillPathNV = NULL; +PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC __glewStencilStrokePathInstancedNV = NULL; +PFNGLSTENCILSTROKEPATHNVPROC __glewStencilStrokePathNV = NULL; +PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC __glewStencilThenCoverFillPathInstancedNV = NULL; +PFNGLSTENCILTHENCOVERFILLPATHNVPROC __glewStencilThenCoverFillPathNV = NULL; +PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC __glewStencilThenCoverStrokePathInstancedNV = NULL; +PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC __glewStencilThenCoverStrokePathNV = NULL; +PFNGLTRANSFORMPATHNVPROC __glewTransformPathNV = NULL; +PFNGLWEIGHTPATHSNVPROC __glewWeightPathsNV = NULL; + +PFNGLFLUSHPIXELDATARANGENVPROC __glewFlushPixelDataRangeNV = NULL; +PFNGLPIXELDATARANGENVPROC __glewPixelDataRangeNV = NULL; + +PFNGLPOINTPARAMETERINVPROC __glewPointParameteriNV = NULL; +PFNGLPOINTPARAMETERIVNVPROC __glewPointParameterivNV = NULL; + +PFNGLGETVIDEOI64VNVPROC __glewGetVideoi64vNV = NULL; +PFNGLGETVIDEOIVNVPROC __glewGetVideoivNV = NULL; +PFNGLGETVIDEOUI64VNVPROC __glewGetVideoui64vNV = NULL; +PFNGLGETVIDEOUIVNVPROC __glewGetVideouivNV = NULL; +PFNGLPRESENTFRAMEDUALFILLNVPROC __glewPresentFrameDualFillNV = NULL; +PFNGLPRESENTFRAMEKEYEDNVPROC __glewPresentFrameKeyedNV = NULL; + +PFNGLPRIMITIVERESTARTINDEXNVPROC __glewPrimitiveRestartIndexNV = NULL; +PFNGLPRIMITIVERESTARTNVPROC __glewPrimitiveRestartNV = NULL; + +PFNGLCOMBINERINPUTNVPROC __glewCombinerInputNV = NULL; +PFNGLCOMBINEROUTPUTNVPROC __glewCombinerOutputNV = NULL; +PFNGLCOMBINERPARAMETERFNVPROC __glewCombinerParameterfNV = NULL; +PFNGLCOMBINERPARAMETERFVNVPROC __glewCombinerParameterfvNV = NULL; +PFNGLCOMBINERPARAMETERINVPROC __glewCombinerParameteriNV = NULL; +PFNGLCOMBINERPARAMETERIVNVPROC __glewCombinerParameterivNV = NULL; +PFNGLFINALCOMBINERINPUTNVPROC __glewFinalCombinerInputNV = NULL; +PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC __glewGetCombinerInputParameterfvNV = NULL; +PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC __glewGetCombinerInputParameterivNV = NULL; +PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC __glewGetCombinerOutputParameterfvNV = NULL; +PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC __glewGetCombinerOutputParameterivNV = NULL; +PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC __glewGetFinalCombinerInputParameterfvNV = NULL; +PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC __glewGetFinalCombinerInputParameterivNV = NULL; + +PFNGLCOMBINERSTAGEPARAMETERFVNVPROC __glewCombinerStageParameterfvNV = NULL; +PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC __glewGetCombinerStageParameterfvNV = NULL; + +PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC __glewFramebufferSampleLocationsfvNV = NULL; +PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC __glewNamedFramebufferSampleLocationsfvNV = NULL; + +PFNGLGETBUFFERPARAMETERUI64VNVPROC __glewGetBufferParameterui64vNV = NULL; +PFNGLGETINTEGERUI64VNVPROC __glewGetIntegerui64vNV = NULL; +PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC __glewGetNamedBufferParameterui64vNV = NULL; +PFNGLISBUFFERRESIDENTNVPROC __glewIsBufferResidentNV = NULL; +PFNGLISNAMEDBUFFERRESIDENTNVPROC __glewIsNamedBufferResidentNV = NULL; +PFNGLMAKEBUFFERNONRESIDENTNVPROC __glewMakeBufferNonResidentNV = NULL; +PFNGLMAKEBUFFERRESIDENTNVPROC __glewMakeBufferResidentNV = NULL; +PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC __glewMakeNamedBufferNonResidentNV = NULL; +PFNGLMAKENAMEDBUFFERRESIDENTNVPROC __glewMakeNamedBufferResidentNV = NULL; +PFNGLPROGRAMUNIFORMUI64NVPROC __glewProgramUniformui64NV = NULL; +PFNGLPROGRAMUNIFORMUI64VNVPROC __glewProgramUniformui64vNV = NULL; +PFNGLUNIFORMUI64NVPROC __glewUniformui64NV = NULL; +PFNGLUNIFORMUI64VNVPROC __glewUniformui64vNV = NULL; + +PFNGLTEXTUREBARRIERNVPROC __glewTextureBarrierNV = NULL; + +PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTexImage2DMultisampleCoverageNV = NULL; +PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTexImage3DMultisampleCoverageNV = NULL; +PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTextureImage2DMultisampleCoverageNV = NULL; +PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC __glewTextureImage2DMultisampleNV = NULL; +PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTextureImage3DMultisampleCoverageNV = NULL; +PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC __glewTextureImage3DMultisampleNV = NULL; + +PFNGLACTIVEVARYINGNVPROC __glewActiveVaryingNV = NULL; +PFNGLBEGINTRANSFORMFEEDBACKNVPROC __glewBeginTransformFeedbackNV = NULL; +PFNGLBINDBUFFERBASENVPROC __glewBindBufferBaseNV = NULL; +PFNGLBINDBUFFEROFFSETNVPROC __glewBindBufferOffsetNV = NULL; +PFNGLBINDBUFFERRANGENVPROC __glewBindBufferRangeNV = NULL; +PFNGLENDTRANSFORMFEEDBACKNVPROC __glewEndTransformFeedbackNV = NULL; +PFNGLGETACTIVEVARYINGNVPROC __glewGetActiveVaryingNV = NULL; +PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC __glewGetTransformFeedbackVaryingNV = NULL; +PFNGLGETVARYINGLOCATIONNVPROC __glewGetVaryingLocationNV = NULL; +PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC __glewTransformFeedbackAttribsNV = NULL; +PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC __glewTransformFeedbackVaryingsNV = NULL; + +PFNGLBINDTRANSFORMFEEDBACKNVPROC __glewBindTransformFeedbackNV = NULL; +PFNGLDELETETRANSFORMFEEDBACKSNVPROC __glewDeleteTransformFeedbacksNV = NULL; +PFNGLDRAWTRANSFORMFEEDBACKNVPROC __glewDrawTransformFeedbackNV = NULL; +PFNGLGENTRANSFORMFEEDBACKSNVPROC __glewGenTransformFeedbacksNV = NULL; +PFNGLISTRANSFORMFEEDBACKNVPROC __glewIsTransformFeedbackNV = NULL; +PFNGLPAUSETRANSFORMFEEDBACKNVPROC __glewPauseTransformFeedbackNV = NULL; +PFNGLRESUMETRANSFORMFEEDBACKNVPROC __glewResumeTransformFeedbackNV = NULL; + +PFNGLVDPAUFININVPROC __glewVDPAUFiniNV = NULL; +PFNGLVDPAUGETSURFACEIVNVPROC __glewVDPAUGetSurfaceivNV = NULL; +PFNGLVDPAUINITNVPROC __glewVDPAUInitNV = NULL; +PFNGLVDPAUISSURFACENVPROC __glewVDPAUIsSurfaceNV = NULL; +PFNGLVDPAUMAPSURFACESNVPROC __glewVDPAUMapSurfacesNV = NULL; +PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC __glewVDPAURegisterOutputSurfaceNV = NULL; +PFNGLVDPAUREGISTERVIDEOSURFACENVPROC __glewVDPAURegisterVideoSurfaceNV = NULL; +PFNGLVDPAUSURFACEACCESSNVPROC __glewVDPAUSurfaceAccessNV = NULL; +PFNGLVDPAUUNMAPSURFACESNVPROC __glewVDPAUUnmapSurfacesNV = NULL; +PFNGLVDPAUUNREGISTERSURFACENVPROC __glewVDPAUUnregisterSurfaceNV = NULL; + +PFNGLFLUSHVERTEXARRAYRANGENVPROC __glewFlushVertexArrayRangeNV = NULL; +PFNGLVERTEXARRAYRANGENVPROC __glewVertexArrayRangeNV = NULL; + +PFNGLGETVERTEXATTRIBLI64VNVPROC __glewGetVertexAttribLi64vNV = NULL; +PFNGLGETVERTEXATTRIBLUI64VNVPROC __glewGetVertexAttribLui64vNV = NULL; +PFNGLVERTEXATTRIBL1I64NVPROC __glewVertexAttribL1i64NV = NULL; +PFNGLVERTEXATTRIBL1I64VNVPROC __glewVertexAttribL1i64vNV = NULL; +PFNGLVERTEXATTRIBL1UI64NVPROC __glewVertexAttribL1ui64NV = NULL; +PFNGLVERTEXATTRIBL1UI64VNVPROC __glewVertexAttribL1ui64vNV = NULL; +PFNGLVERTEXATTRIBL2I64NVPROC __glewVertexAttribL2i64NV = NULL; +PFNGLVERTEXATTRIBL2I64VNVPROC __glewVertexAttribL2i64vNV = NULL; +PFNGLVERTEXATTRIBL2UI64NVPROC __glewVertexAttribL2ui64NV = NULL; +PFNGLVERTEXATTRIBL2UI64VNVPROC __glewVertexAttribL2ui64vNV = NULL; +PFNGLVERTEXATTRIBL3I64NVPROC __glewVertexAttribL3i64NV = NULL; +PFNGLVERTEXATTRIBL3I64VNVPROC __glewVertexAttribL3i64vNV = NULL; +PFNGLVERTEXATTRIBL3UI64NVPROC __glewVertexAttribL3ui64NV = NULL; +PFNGLVERTEXATTRIBL3UI64VNVPROC __glewVertexAttribL3ui64vNV = NULL; +PFNGLVERTEXATTRIBL4I64NVPROC __glewVertexAttribL4i64NV = NULL; +PFNGLVERTEXATTRIBL4I64VNVPROC __glewVertexAttribL4i64vNV = NULL; +PFNGLVERTEXATTRIBL4UI64NVPROC __glewVertexAttribL4ui64NV = NULL; +PFNGLVERTEXATTRIBL4UI64VNVPROC __glewVertexAttribL4ui64vNV = NULL; +PFNGLVERTEXATTRIBLFORMATNVPROC __glewVertexAttribLFormatNV = NULL; + +PFNGLBUFFERADDRESSRANGENVPROC __glewBufferAddressRangeNV = NULL; +PFNGLCOLORFORMATNVPROC __glewColorFormatNV = NULL; +PFNGLEDGEFLAGFORMATNVPROC __glewEdgeFlagFormatNV = NULL; +PFNGLFOGCOORDFORMATNVPROC __glewFogCoordFormatNV = NULL; +PFNGLGETINTEGERUI64I_VNVPROC __glewGetIntegerui64i_vNV = NULL; +PFNGLINDEXFORMATNVPROC __glewIndexFormatNV = NULL; +PFNGLNORMALFORMATNVPROC __glewNormalFormatNV = NULL; +PFNGLSECONDARYCOLORFORMATNVPROC __glewSecondaryColorFormatNV = NULL; +PFNGLTEXCOORDFORMATNVPROC __glewTexCoordFormatNV = NULL; +PFNGLVERTEXATTRIBFORMATNVPROC __glewVertexAttribFormatNV = NULL; +PFNGLVERTEXATTRIBIFORMATNVPROC __glewVertexAttribIFormatNV = NULL; +PFNGLVERTEXFORMATNVPROC __glewVertexFormatNV = NULL; + +PFNGLAREPROGRAMSRESIDENTNVPROC __glewAreProgramsResidentNV = NULL; +PFNGLBINDPROGRAMNVPROC __glewBindProgramNV = NULL; +PFNGLDELETEPROGRAMSNVPROC __glewDeleteProgramsNV = NULL; +PFNGLEXECUTEPROGRAMNVPROC __glewExecuteProgramNV = NULL; +PFNGLGENPROGRAMSNVPROC __glewGenProgramsNV = NULL; +PFNGLGETPROGRAMPARAMETERDVNVPROC __glewGetProgramParameterdvNV = NULL; +PFNGLGETPROGRAMPARAMETERFVNVPROC __glewGetProgramParameterfvNV = NULL; +PFNGLGETPROGRAMSTRINGNVPROC __glewGetProgramStringNV = NULL; +PFNGLGETPROGRAMIVNVPROC __glewGetProgramivNV = NULL; +PFNGLGETTRACKMATRIXIVNVPROC __glewGetTrackMatrixivNV = NULL; +PFNGLGETVERTEXATTRIBPOINTERVNVPROC __glewGetVertexAttribPointervNV = NULL; +PFNGLGETVERTEXATTRIBDVNVPROC __glewGetVertexAttribdvNV = NULL; +PFNGLGETVERTEXATTRIBFVNVPROC __glewGetVertexAttribfvNV = NULL; +PFNGLGETVERTEXATTRIBIVNVPROC __glewGetVertexAttribivNV = NULL; +PFNGLISPROGRAMNVPROC __glewIsProgramNV = NULL; +PFNGLLOADPROGRAMNVPROC __glewLoadProgramNV = NULL; +PFNGLPROGRAMPARAMETER4DNVPROC __glewProgramParameter4dNV = NULL; +PFNGLPROGRAMPARAMETER4DVNVPROC __glewProgramParameter4dvNV = NULL; +PFNGLPROGRAMPARAMETER4FNVPROC __glewProgramParameter4fNV = NULL; +PFNGLPROGRAMPARAMETER4FVNVPROC __glewProgramParameter4fvNV = NULL; +PFNGLPROGRAMPARAMETERS4DVNVPROC __glewProgramParameters4dvNV = NULL; +PFNGLPROGRAMPARAMETERS4FVNVPROC __glewProgramParameters4fvNV = NULL; +PFNGLREQUESTRESIDENTPROGRAMSNVPROC __glewRequestResidentProgramsNV = NULL; +PFNGLTRACKMATRIXNVPROC __glewTrackMatrixNV = NULL; +PFNGLVERTEXATTRIB1DNVPROC __glewVertexAttrib1dNV = NULL; +PFNGLVERTEXATTRIB1DVNVPROC __glewVertexAttrib1dvNV = NULL; +PFNGLVERTEXATTRIB1FNVPROC __glewVertexAttrib1fNV = NULL; +PFNGLVERTEXATTRIB1FVNVPROC __glewVertexAttrib1fvNV = NULL; +PFNGLVERTEXATTRIB1SNVPROC __glewVertexAttrib1sNV = NULL; +PFNGLVERTEXATTRIB1SVNVPROC __glewVertexAttrib1svNV = NULL; +PFNGLVERTEXATTRIB2DNVPROC __glewVertexAttrib2dNV = NULL; +PFNGLVERTEXATTRIB2DVNVPROC __glewVertexAttrib2dvNV = NULL; +PFNGLVERTEXATTRIB2FNVPROC __glewVertexAttrib2fNV = NULL; +PFNGLVERTEXATTRIB2FVNVPROC __glewVertexAttrib2fvNV = NULL; +PFNGLVERTEXATTRIB2SNVPROC __glewVertexAttrib2sNV = NULL; +PFNGLVERTEXATTRIB2SVNVPROC __glewVertexAttrib2svNV = NULL; +PFNGLVERTEXATTRIB3DNVPROC __glewVertexAttrib3dNV = NULL; +PFNGLVERTEXATTRIB3DVNVPROC __glewVertexAttrib3dvNV = NULL; +PFNGLVERTEXATTRIB3FNVPROC __glewVertexAttrib3fNV = NULL; +PFNGLVERTEXATTRIB3FVNVPROC __glewVertexAttrib3fvNV = NULL; +PFNGLVERTEXATTRIB3SNVPROC __glewVertexAttrib3sNV = NULL; +PFNGLVERTEXATTRIB3SVNVPROC __glewVertexAttrib3svNV = NULL; +PFNGLVERTEXATTRIB4DNVPROC __glewVertexAttrib4dNV = NULL; +PFNGLVERTEXATTRIB4DVNVPROC __glewVertexAttrib4dvNV = NULL; +PFNGLVERTEXATTRIB4FNVPROC __glewVertexAttrib4fNV = NULL; +PFNGLVERTEXATTRIB4FVNVPROC __glewVertexAttrib4fvNV = NULL; +PFNGLVERTEXATTRIB4SNVPROC __glewVertexAttrib4sNV = NULL; +PFNGLVERTEXATTRIB4SVNVPROC __glewVertexAttrib4svNV = NULL; +PFNGLVERTEXATTRIB4UBNVPROC __glewVertexAttrib4ubNV = NULL; +PFNGLVERTEXATTRIB4UBVNVPROC __glewVertexAttrib4ubvNV = NULL; +PFNGLVERTEXATTRIBPOINTERNVPROC __glewVertexAttribPointerNV = NULL; +PFNGLVERTEXATTRIBS1DVNVPROC __glewVertexAttribs1dvNV = NULL; +PFNGLVERTEXATTRIBS1FVNVPROC __glewVertexAttribs1fvNV = NULL; +PFNGLVERTEXATTRIBS1SVNVPROC __glewVertexAttribs1svNV = NULL; +PFNGLVERTEXATTRIBS2DVNVPROC __glewVertexAttribs2dvNV = NULL; +PFNGLVERTEXATTRIBS2FVNVPROC __glewVertexAttribs2fvNV = NULL; +PFNGLVERTEXATTRIBS2SVNVPROC __glewVertexAttribs2svNV = NULL; +PFNGLVERTEXATTRIBS3DVNVPROC __glewVertexAttribs3dvNV = NULL; +PFNGLVERTEXATTRIBS3FVNVPROC __glewVertexAttribs3fvNV = NULL; +PFNGLVERTEXATTRIBS3SVNVPROC __glewVertexAttribs3svNV = NULL; +PFNGLVERTEXATTRIBS4DVNVPROC __glewVertexAttribs4dvNV = NULL; +PFNGLVERTEXATTRIBS4FVNVPROC __glewVertexAttribs4fvNV = NULL; +PFNGLVERTEXATTRIBS4SVNVPROC __glewVertexAttribs4svNV = NULL; +PFNGLVERTEXATTRIBS4UBVNVPROC __glewVertexAttribs4ubvNV = NULL; + +PFNGLBEGINVIDEOCAPTURENVPROC __glewBeginVideoCaptureNV = NULL; +PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC __glewBindVideoCaptureStreamBufferNV = NULL; +PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC __glewBindVideoCaptureStreamTextureNV = NULL; +PFNGLENDVIDEOCAPTURENVPROC __glewEndVideoCaptureNV = NULL; +PFNGLGETVIDEOCAPTURESTREAMDVNVPROC __glewGetVideoCaptureStreamdvNV = NULL; +PFNGLGETVIDEOCAPTURESTREAMFVNVPROC __glewGetVideoCaptureStreamfvNV = NULL; +PFNGLGETVIDEOCAPTURESTREAMIVNVPROC __glewGetVideoCaptureStreamivNV = NULL; +PFNGLGETVIDEOCAPTUREIVNVPROC __glewGetVideoCaptureivNV = NULL; +PFNGLVIDEOCAPTURENVPROC __glewVideoCaptureNV = NULL; +PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC __glewVideoCaptureStreamParameterdvNV = NULL; +PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC __glewVideoCaptureStreamParameterfvNV = NULL; +PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC __glewVideoCaptureStreamParameterivNV = NULL; + +PFNGLCLEARDEPTHFOESPROC __glewClearDepthfOES = NULL; +PFNGLCLIPPLANEFOESPROC __glewClipPlanefOES = NULL; +PFNGLDEPTHRANGEFOESPROC __glewDepthRangefOES = NULL; +PFNGLFRUSTUMFOESPROC __glewFrustumfOES = NULL; +PFNGLGETCLIPPLANEFOESPROC __glewGetClipPlanefOES = NULL; +PFNGLORTHOFOESPROC __glewOrthofOES = NULL; + +PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC __glewFramebufferTextureMultiviewOVR = NULL; + +PFNGLALPHAFUNCXPROC __glewAlphaFuncx = NULL; +PFNGLCLEARCOLORXPROC __glewClearColorx = NULL; +PFNGLCLEARDEPTHXPROC __glewClearDepthx = NULL; +PFNGLCOLOR4XPROC __glewColor4x = NULL; +PFNGLDEPTHRANGEXPROC __glewDepthRangex = NULL; +PFNGLFOGXPROC __glewFogx = NULL; +PFNGLFOGXVPROC __glewFogxv = NULL; +PFNGLFRUSTUMFPROC __glewFrustumf = NULL; +PFNGLFRUSTUMXPROC __glewFrustumx = NULL; +PFNGLLIGHTMODELXPROC __glewLightModelx = NULL; +PFNGLLIGHTMODELXVPROC __glewLightModelxv = NULL; +PFNGLLIGHTXPROC __glewLightx = NULL; +PFNGLLIGHTXVPROC __glewLightxv = NULL; +PFNGLLINEWIDTHXPROC __glewLineWidthx = NULL; +PFNGLLOADMATRIXXPROC __glewLoadMatrixx = NULL; +PFNGLMATERIALXPROC __glewMaterialx = NULL; +PFNGLMATERIALXVPROC __glewMaterialxv = NULL; +PFNGLMULTMATRIXXPROC __glewMultMatrixx = NULL; +PFNGLMULTITEXCOORD4XPROC __glewMultiTexCoord4x = NULL; +PFNGLNORMAL3XPROC __glewNormal3x = NULL; +PFNGLORTHOFPROC __glewOrthof = NULL; +PFNGLORTHOXPROC __glewOrthox = NULL; +PFNGLPOINTSIZEXPROC __glewPointSizex = NULL; +PFNGLPOLYGONOFFSETXPROC __glewPolygonOffsetx = NULL; +PFNGLROTATEXPROC __glewRotatex = NULL; +PFNGLSAMPLECOVERAGEXPROC __glewSampleCoveragex = NULL; +PFNGLSCALEXPROC __glewScalex = NULL; +PFNGLTEXENVXPROC __glewTexEnvx = NULL; +PFNGLTEXENVXVPROC __glewTexEnvxv = NULL; +PFNGLTEXPARAMETERXPROC __glewTexParameterx = NULL; +PFNGLTRANSLATEXPROC __glewTranslatex = NULL; + +PFNGLCLIPPLANEFPROC __glewClipPlanef = NULL; +PFNGLCLIPPLANEXPROC __glewClipPlanex = NULL; +PFNGLGETCLIPPLANEFPROC __glewGetClipPlanef = NULL; +PFNGLGETCLIPPLANEXPROC __glewGetClipPlanex = NULL; +PFNGLGETFIXEDVPROC __glewGetFixedv = NULL; +PFNGLGETLIGHTXVPROC __glewGetLightxv = NULL; +PFNGLGETMATERIALXVPROC __glewGetMaterialxv = NULL; +PFNGLGETTEXENVXVPROC __glewGetTexEnvxv = NULL; +PFNGLGETTEXPARAMETERXVPROC __glewGetTexParameterxv = NULL; +PFNGLPOINTPARAMETERXPROC __glewPointParameterx = NULL; +PFNGLPOINTPARAMETERXVPROC __glewPointParameterxv = NULL; +PFNGLPOINTSIZEPOINTEROESPROC __glewPointSizePointerOES = NULL; +PFNGLTEXPARAMETERXVPROC __glewTexParameterxv = NULL; + +PFNGLERRORSTRINGREGALPROC __glewErrorStringREGAL = NULL; + +PFNGLGETEXTENSIONREGALPROC __glewGetExtensionREGAL = NULL; +PFNGLISSUPPORTEDREGALPROC __glewIsSupportedREGAL = NULL; + +PFNGLLOGMESSAGECALLBACKREGALPROC __glewLogMessageCallbackREGAL = NULL; + +PFNGLGETPROCADDRESSREGALPROC __glewGetProcAddressREGAL = NULL; + +PFNGLDETAILTEXFUNCSGISPROC __glewDetailTexFuncSGIS = NULL; +PFNGLGETDETAILTEXFUNCSGISPROC __glewGetDetailTexFuncSGIS = NULL; + +PFNGLFOGFUNCSGISPROC __glewFogFuncSGIS = NULL; +PFNGLGETFOGFUNCSGISPROC __glewGetFogFuncSGIS = NULL; + +PFNGLSAMPLEMASKSGISPROC __glewSampleMaskSGIS = NULL; +PFNGLSAMPLEPATTERNSGISPROC __glewSamplePatternSGIS = NULL; + +PFNGLGETSHARPENTEXFUNCSGISPROC __glewGetSharpenTexFuncSGIS = NULL; +PFNGLSHARPENTEXFUNCSGISPROC __glewSharpenTexFuncSGIS = NULL; + +PFNGLTEXIMAGE4DSGISPROC __glewTexImage4DSGIS = NULL; +PFNGLTEXSUBIMAGE4DSGISPROC __glewTexSubImage4DSGIS = NULL; + +PFNGLGETTEXFILTERFUNCSGISPROC __glewGetTexFilterFuncSGIS = NULL; +PFNGLTEXFILTERFUNCSGISPROC __glewTexFilterFuncSGIS = NULL; + +PFNGLASYNCMARKERSGIXPROC __glewAsyncMarkerSGIX = NULL; +PFNGLDELETEASYNCMARKERSSGIXPROC __glewDeleteAsyncMarkersSGIX = NULL; +PFNGLFINISHASYNCSGIXPROC __glewFinishAsyncSGIX = NULL; +PFNGLGENASYNCMARKERSSGIXPROC __glewGenAsyncMarkersSGIX = NULL; +PFNGLISASYNCMARKERSGIXPROC __glewIsAsyncMarkerSGIX = NULL; +PFNGLPOLLASYNCSGIXPROC __glewPollAsyncSGIX = NULL; + +PFNGLFLUSHRASTERSGIXPROC __glewFlushRasterSGIX = NULL; + +PFNGLTEXTUREFOGSGIXPROC __glewTextureFogSGIX = NULL; + +PFNGLFRAGMENTCOLORMATERIALSGIXPROC __glewFragmentColorMaterialSGIX = NULL; +PFNGLFRAGMENTLIGHTMODELFSGIXPROC __glewFragmentLightModelfSGIX = NULL; +PFNGLFRAGMENTLIGHTMODELFVSGIXPROC __glewFragmentLightModelfvSGIX = NULL; +PFNGLFRAGMENTLIGHTMODELISGIXPROC __glewFragmentLightModeliSGIX = NULL; +PFNGLFRAGMENTLIGHTMODELIVSGIXPROC __glewFragmentLightModelivSGIX = NULL; +PFNGLFRAGMENTLIGHTFSGIXPROC __glewFragmentLightfSGIX = NULL; +PFNGLFRAGMENTLIGHTFVSGIXPROC __glewFragmentLightfvSGIX = NULL; +PFNGLFRAGMENTLIGHTISGIXPROC __glewFragmentLightiSGIX = NULL; +PFNGLFRAGMENTLIGHTIVSGIXPROC __glewFragmentLightivSGIX = NULL; +PFNGLFRAGMENTMATERIALFSGIXPROC __glewFragmentMaterialfSGIX = NULL; +PFNGLFRAGMENTMATERIALFVSGIXPROC __glewFragmentMaterialfvSGIX = NULL; +PFNGLFRAGMENTMATERIALISGIXPROC __glewFragmentMaterialiSGIX = NULL; +PFNGLFRAGMENTMATERIALIVSGIXPROC __glewFragmentMaterialivSGIX = NULL; +PFNGLGETFRAGMENTLIGHTFVSGIXPROC __glewGetFragmentLightfvSGIX = NULL; +PFNGLGETFRAGMENTLIGHTIVSGIXPROC __glewGetFragmentLightivSGIX = NULL; +PFNGLGETFRAGMENTMATERIALFVSGIXPROC __glewGetFragmentMaterialfvSGIX = NULL; +PFNGLGETFRAGMENTMATERIALIVSGIXPROC __glewGetFragmentMaterialivSGIX = NULL; + +PFNGLFRAMEZOOMSGIXPROC __glewFrameZoomSGIX = NULL; + +PFNGLPIXELTEXGENSGIXPROC __glewPixelTexGenSGIX = NULL; + +PFNGLREFERENCEPLANESGIXPROC __glewReferencePlaneSGIX = NULL; + +PFNGLSPRITEPARAMETERFSGIXPROC __glewSpriteParameterfSGIX = NULL; +PFNGLSPRITEPARAMETERFVSGIXPROC __glewSpriteParameterfvSGIX = NULL; +PFNGLSPRITEPARAMETERISGIXPROC __glewSpriteParameteriSGIX = NULL; +PFNGLSPRITEPARAMETERIVSGIXPROC __glewSpriteParameterivSGIX = NULL; + +PFNGLTAGSAMPLEBUFFERSGIXPROC __glewTagSampleBufferSGIX = NULL; + +PFNGLCOLORTABLEPARAMETERFVSGIPROC __glewColorTableParameterfvSGI = NULL; +PFNGLCOLORTABLEPARAMETERIVSGIPROC __glewColorTableParameterivSGI = NULL; +PFNGLCOLORTABLESGIPROC __glewColorTableSGI = NULL; +PFNGLCOPYCOLORTABLESGIPROC __glewCopyColorTableSGI = NULL; +PFNGLGETCOLORTABLEPARAMETERFVSGIPROC __glewGetColorTableParameterfvSGI = NULL; +PFNGLGETCOLORTABLEPARAMETERIVSGIPROC __glewGetColorTableParameterivSGI = NULL; +PFNGLGETCOLORTABLESGIPROC __glewGetColorTableSGI = NULL; + +PFNGLFINISHTEXTURESUNXPROC __glewFinishTextureSUNX = NULL; + +PFNGLGLOBALALPHAFACTORBSUNPROC __glewGlobalAlphaFactorbSUN = NULL; +PFNGLGLOBALALPHAFACTORDSUNPROC __glewGlobalAlphaFactordSUN = NULL; +PFNGLGLOBALALPHAFACTORFSUNPROC __glewGlobalAlphaFactorfSUN = NULL; +PFNGLGLOBALALPHAFACTORISUNPROC __glewGlobalAlphaFactoriSUN = NULL; +PFNGLGLOBALALPHAFACTORSSUNPROC __glewGlobalAlphaFactorsSUN = NULL; +PFNGLGLOBALALPHAFACTORUBSUNPROC __glewGlobalAlphaFactorubSUN = NULL; +PFNGLGLOBALALPHAFACTORUISUNPROC __glewGlobalAlphaFactoruiSUN = NULL; +PFNGLGLOBALALPHAFACTORUSSUNPROC __glewGlobalAlphaFactorusSUN = NULL; + +PFNGLREADVIDEOPIXELSSUNPROC __glewReadVideoPixelsSUN = NULL; + +PFNGLREPLACEMENTCODEPOINTERSUNPROC __glewReplacementCodePointerSUN = NULL; +PFNGLREPLACEMENTCODEUBSUNPROC __glewReplacementCodeubSUN = NULL; +PFNGLREPLACEMENTCODEUBVSUNPROC __glewReplacementCodeubvSUN = NULL; +PFNGLREPLACEMENTCODEUISUNPROC __glewReplacementCodeuiSUN = NULL; +PFNGLREPLACEMENTCODEUIVSUNPROC __glewReplacementCodeuivSUN = NULL; +PFNGLREPLACEMENTCODEUSSUNPROC __glewReplacementCodeusSUN = NULL; +PFNGLREPLACEMENTCODEUSVSUNPROC __glewReplacementCodeusvSUN = NULL; + +PFNGLCOLOR3FVERTEX3FSUNPROC __glewColor3fVertex3fSUN = NULL; +PFNGLCOLOR3FVERTEX3FVSUNPROC __glewColor3fVertex3fvSUN = NULL; +PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewColor4fNormal3fVertex3fSUN = NULL; +PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewColor4fNormal3fVertex3fvSUN = NULL; +PFNGLCOLOR4UBVERTEX2FSUNPROC __glewColor4ubVertex2fSUN = NULL; +PFNGLCOLOR4UBVERTEX2FVSUNPROC __glewColor4ubVertex2fvSUN = NULL; +PFNGLCOLOR4UBVERTEX3FSUNPROC __glewColor4ubVertex3fSUN = NULL; +PFNGLCOLOR4UBVERTEX3FVSUNPROC __glewColor4ubVertex3fvSUN = NULL; +PFNGLNORMAL3FVERTEX3FSUNPROC __glewNormal3fVertex3fSUN = NULL; +PFNGLNORMAL3FVERTEX3FVSUNPROC __glewNormal3fVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC __glewReplacementCodeuiColor3fVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor3fVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC __glewReplacementCodeuiColor4ubVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC __glewReplacementCodeuiColor4ubVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiNormal3fVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiNormal3fVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC __glewReplacementCodeuiVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC __glewReplacementCodeuiVertex3fvSUN = NULL; +PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC __glewTexCoord2fColor3fVertex3fSUN = NULL; +PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC __glewTexCoord2fColor3fVertex3fvSUN = NULL; +PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fSUN = NULL; +PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fvSUN = NULL; +PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC __glewTexCoord2fColor4ubVertex3fSUN = NULL; +PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC __glewTexCoord2fColor4ubVertex3fvSUN = NULL; +PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fNormal3fVertex3fSUN = NULL; +PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fNormal3fVertex3fvSUN = NULL; +PFNGLTEXCOORD2FVERTEX3FSUNPROC __glewTexCoord2fVertex3fSUN = NULL; +PFNGLTEXCOORD2FVERTEX3FVSUNPROC __glewTexCoord2fVertex3fvSUN = NULL; +PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fSUN = NULL; +PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fvSUN = NULL; +PFNGLTEXCOORD4FVERTEX4FSUNPROC __glewTexCoord4fVertex4fSUN = NULL; +PFNGLTEXCOORD4FVERTEX4FVSUNPROC __glewTexCoord4fVertex4fvSUN = NULL; + +PFNGLADDSWAPHINTRECTWINPROC __glewAddSwapHintRectWIN = NULL; + +#endif /* !WIN32 || !GLEW_MX */ + +#if !defined(GLEW_MX) + +GLboolean __GLEW_VERSION_1_1 = GL_FALSE; +GLboolean __GLEW_VERSION_1_2 = GL_FALSE; +GLboolean __GLEW_VERSION_1_2_1 = GL_FALSE; +GLboolean __GLEW_VERSION_1_3 = GL_FALSE; +GLboolean __GLEW_VERSION_1_4 = GL_FALSE; +GLboolean __GLEW_VERSION_1_5 = GL_FALSE; +GLboolean __GLEW_VERSION_2_0 = GL_FALSE; +GLboolean __GLEW_VERSION_2_1 = GL_FALSE; +GLboolean __GLEW_VERSION_3_0 = GL_FALSE; +GLboolean __GLEW_VERSION_3_1 = GL_FALSE; +GLboolean __GLEW_VERSION_3_2 = GL_FALSE; +GLboolean __GLEW_VERSION_3_3 = GL_FALSE; +GLboolean __GLEW_VERSION_4_0 = GL_FALSE; +GLboolean __GLEW_VERSION_4_1 = GL_FALSE; +GLboolean __GLEW_VERSION_4_2 = GL_FALSE; +GLboolean __GLEW_VERSION_4_3 = GL_FALSE; +GLboolean __GLEW_VERSION_4_4 = GL_FALSE; +GLboolean __GLEW_VERSION_4_5 = GL_FALSE; +GLboolean __GLEW_3DFX_multisample = GL_FALSE; +GLboolean __GLEW_3DFX_tbuffer = GL_FALSE; +GLboolean __GLEW_3DFX_texture_compression_FXT1 = GL_FALSE; +GLboolean __GLEW_AMD_blend_minmax_factor = GL_FALSE; +GLboolean __GLEW_AMD_conservative_depth = GL_FALSE; +GLboolean __GLEW_AMD_debug_output = GL_FALSE; +GLboolean __GLEW_AMD_depth_clamp_separate = GL_FALSE; +GLboolean __GLEW_AMD_draw_buffers_blend = GL_FALSE; +GLboolean __GLEW_AMD_gcn_shader = GL_FALSE; +GLboolean __GLEW_AMD_gpu_shader_int64 = GL_FALSE; +GLboolean __GLEW_AMD_interleaved_elements = GL_FALSE; +GLboolean __GLEW_AMD_multi_draw_indirect = GL_FALSE; +GLboolean __GLEW_AMD_name_gen_delete = GL_FALSE; +GLboolean __GLEW_AMD_occlusion_query_event = GL_FALSE; +GLboolean __GLEW_AMD_performance_monitor = GL_FALSE; +GLboolean __GLEW_AMD_pinned_memory = GL_FALSE; +GLboolean __GLEW_AMD_query_buffer_object = GL_FALSE; +GLboolean __GLEW_AMD_sample_positions = GL_FALSE; +GLboolean __GLEW_AMD_seamless_cubemap_per_texture = GL_FALSE; +GLboolean __GLEW_AMD_shader_atomic_counter_ops = GL_FALSE; +GLboolean __GLEW_AMD_shader_stencil_export = GL_FALSE; +GLboolean __GLEW_AMD_shader_stencil_value_export = GL_FALSE; +GLboolean __GLEW_AMD_shader_trinary_minmax = GL_FALSE; +GLboolean __GLEW_AMD_sparse_texture = GL_FALSE; +GLboolean __GLEW_AMD_stencil_operation_extended = GL_FALSE; +GLboolean __GLEW_AMD_texture_texture4 = GL_FALSE; +GLboolean __GLEW_AMD_transform_feedback3_lines_triangles = GL_FALSE; +GLboolean __GLEW_AMD_transform_feedback4 = GL_FALSE; +GLboolean __GLEW_AMD_vertex_shader_layer = GL_FALSE; +GLboolean __GLEW_AMD_vertex_shader_tessellator = GL_FALSE; +GLboolean __GLEW_AMD_vertex_shader_viewport_index = GL_FALSE; +GLboolean __GLEW_ANGLE_depth_texture = GL_FALSE; +GLboolean __GLEW_ANGLE_framebuffer_blit = GL_FALSE; +GLboolean __GLEW_ANGLE_framebuffer_multisample = GL_FALSE; +GLboolean __GLEW_ANGLE_instanced_arrays = GL_FALSE; +GLboolean __GLEW_ANGLE_pack_reverse_row_order = GL_FALSE; +GLboolean __GLEW_ANGLE_program_binary = GL_FALSE; +GLboolean __GLEW_ANGLE_texture_compression_dxt1 = GL_FALSE; +GLboolean __GLEW_ANGLE_texture_compression_dxt3 = GL_FALSE; +GLboolean __GLEW_ANGLE_texture_compression_dxt5 = GL_FALSE; +GLboolean __GLEW_ANGLE_texture_usage = GL_FALSE; +GLboolean __GLEW_ANGLE_timer_query = GL_FALSE; +GLboolean __GLEW_ANGLE_translated_shader_source = GL_FALSE; +GLboolean __GLEW_APPLE_aux_depth_stencil = GL_FALSE; +GLboolean __GLEW_APPLE_client_storage = GL_FALSE; +GLboolean __GLEW_APPLE_element_array = GL_FALSE; +GLboolean __GLEW_APPLE_fence = GL_FALSE; +GLboolean __GLEW_APPLE_float_pixels = GL_FALSE; +GLboolean __GLEW_APPLE_flush_buffer_range = GL_FALSE; +GLboolean __GLEW_APPLE_object_purgeable = GL_FALSE; +GLboolean __GLEW_APPLE_pixel_buffer = GL_FALSE; +GLboolean __GLEW_APPLE_rgb_422 = GL_FALSE; +GLboolean __GLEW_APPLE_row_bytes = GL_FALSE; +GLboolean __GLEW_APPLE_specular_vector = GL_FALSE; +GLboolean __GLEW_APPLE_texture_range = GL_FALSE; +GLboolean __GLEW_APPLE_transform_hint = GL_FALSE; +GLboolean __GLEW_APPLE_vertex_array_object = GL_FALSE; +GLboolean __GLEW_APPLE_vertex_array_range = GL_FALSE; +GLboolean __GLEW_APPLE_vertex_program_evaluators = GL_FALSE; +GLboolean __GLEW_APPLE_ycbcr_422 = GL_FALSE; +GLboolean __GLEW_ARB_ES2_compatibility = GL_FALSE; +GLboolean __GLEW_ARB_ES3_1_compatibility = GL_FALSE; +GLboolean __GLEW_ARB_ES3_2_compatibility = GL_FALSE; +GLboolean __GLEW_ARB_ES3_compatibility = GL_FALSE; +GLboolean __GLEW_ARB_arrays_of_arrays = GL_FALSE; +GLboolean __GLEW_ARB_base_instance = GL_FALSE; +GLboolean __GLEW_ARB_bindless_texture = GL_FALSE; +GLboolean __GLEW_ARB_blend_func_extended = GL_FALSE; +GLboolean __GLEW_ARB_buffer_storage = GL_FALSE; +GLboolean __GLEW_ARB_cl_event = GL_FALSE; +GLboolean __GLEW_ARB_clear_buffer_object = GL_FALSE; +GLboolean __GLEW_ARB_clear_texture = GL_FALSE; +GLboolean __GLEW_ARB_clip_control = GL_FALSE; +GLboolean __GLEW_ARB_color_buffer_float = GL_FALSE; +GLboolean __GLEW_ARB_compatibility = GL_FALSE; +GLboolean __GLEW_ARB_compressed_texture_pixel_storage = GL_FALSE; +GLboolean __GLEW_ARB_compute_shader = GL_FALSE; +GLboolean __GLEW_ARB_compute_variable_group_size = GL_FALSE; +GLboolean __GLEW_ARB_conditional_render_inverted = GL_FALSE; +GLboolean __GLEW_ARB_conservative_depth = GL_FALSE; +GLboolean __GLEW_ARB_copy_buffer = GL_FALSE; +GLboolean __GLEW_ARB_copy_image = GL_FALSE; +GLboolean __GLEW_ARB_cull_distance = GL_FALSE; +GLboolean __GLEW_ARB_debug_output = GL_FALSE; +GLboolean __GLEW_ARB_depth_buffer_float = GL_FALSE; +GLboolean __GLEW_ARB_depth_clamp = GL_FALSE; +GLboolean __GLEW_ARB_depth_texture = GL_FALSE; +GLboolean __GLEW_ARB_derivative_control = GL_FALSE; +GLboolean __GLEW_ARB_direct_state_access = GL_FALSE; +GLboolean __GLEW_ARB_draw_buffers = GL_FALSE; +GLboolean __GLEW_ARB_draw_buffers_blend = GL_FALSE; +GLboolean __GLEW_ARB_draw_elements_base_vertex = GL_FALSE; +GLboolean __GLEW_ARB_draw_indirect = GL_FALSE; +GLboolean __GLEW_ARB_draw_instanced = GL_FALSE; +GLboolean __GLEW_ARB_enhanced_layouts = GL_FALSE; +GLboolean __GLEW_ARB_explicit_attrib_location = GL_FALSE; +GLboolean __GLEW_ARB_explicit_uniform_location = GL_FALSE; +GLboolean __GLEW_ARB_fragment_coord_conventions = GL_FALSE; +GLboolean __GLEW_ARB_fragment_layer_viewport = GL_FALSE; +GLboolean __GLEW_ARB_fragment_program = GL_FALSE; +GLboolean __GLEW_ARB_fragment_program_shadow = GL_FALSE; +GLboolean __GLEW_ARB_fragment_shader = GL_FALSE; +GLboolean __GLEW_ARB_fragment_shader_interlock = GL_FALSE; +GLboolean __GLEW_ARB_framebuffer_no_attachments = GL_FALSE; +GLboolean __GLEW_ARB_framebuffer_object = GL_FALSE; +GLboolean __GLEW_ARB_framebuffer_sRGB = GL_FALSE; +GLboolean __GLEW_ARB_geometry_shader4 = GL_FALSE; +GLboolean __GLEW_ARB_get_program_binary = GL_FALSE; +GLboolean __GLEW_ARB_get_texture_sub_image = GL_FALSE; +GLboolean __GLEW_ARB_gpu_shader5 = GL_FALSE; +GLboolean __GLEW_ARB_gpu_shader_fp64 = GL_FALSE; +GLboolean __GLEW_ARB_gpu_shader_int64 = GL_FALSE; +GLboolean __GLEW_ARB_half_float_pixel = GL_FALSE; +GLboolean __GLEW_ARB_half_float_vertex = GL_FALSE; +GLboolean __GLEW_ARB_imaging = GL_FALSE; +GLboolean __GLEW_ARB_indirect_parameters = GL_FALSE; +GLboolean __GLEW_ARB_instanced_arrays = GL_FALSE; +GLboolean __GLEW_ARB_internalformat_query = GL_FALSE; +GLboolean __GLEW_ARB_internalformat_query2 = GL_FALSE; +GLboolean __GLEW_ARB_invalidate_subdata = GL_FALSE; +GLboolean __GLEW_ARB_map_buffer_alignment = GL_FALSE; +GLboolean __GLEW_ARB_map_buffer_range = GL_FALSE; +GLboolean __GLEW_ARB_matrix_palette = GL_FALSE; +GLboolean __GLEW_ARB_multi_bind = GL_FALSE; +GLboolean __GLEW_ARB_multi_draw_indirect = GL_FALSE; +GLboolean __GLEW_ARB_multisample = GL_FALSE; +GLboolean __GLEW_ARB_multitexture = GL_FALSE; +GLboolean __GLEW_ARB_occlusion_query = GL_FALSE; +GLboolean __GLEW_ARB_occlusion_query2 = GL_FALSE; +GLboolean __GLEW_ARB_parallel_shader_compile = GL_FALSE; +GLboolean __GLEW_ARB_pipeline_statistics_query = GL_FALSE; +GLboolean __GLEW_ARB_pixel_buffer_object = GL_FALSE; +GLboolean __GLEW_ARB_point_parameters = GL_FALSE; +GLboolean __GLEW_ARB_point_sprite = GL_FALSE; +GLboolean __GLEW_ARB_post_depth_coverage = GL_FALSE; +GLboolean __GLEW_ARB_program_interface_query = GL_FALSE; +GLboolean __GLEW_ARB_provoking_vertex = GL_FALSE; +GLboolean __GLEW_ARB_query_buffer_object = GL_FALSE; +GLboolean __GLEW_ARB_robust_buffer_access_behavior = GL_FALSE; +GLboolean __GLEW_ARB_robustness = GL_FALSE; +GLboolean __GLEW_ARB_robustness_application_isolation = GL_FALSE; +GLboolean __GLEW_ARB_robustness_share_group_isolation = GL_FALSE; +GLboolean __GLEW_ARB_sample_locations = GL_FALSE; +GLboolean __GLEW_ARB_sample_shading = GL_FALSE; +GLboolean __GLEW_ARB_sampler_objects = GL_FALSE; +GLboolean __GLEW_ARB_seamless_cube_map = GL_FALSE; +GLboolean __GLEW_ARB_seamless_cubemap_per_texture = GL_FALSE; +GLboolean __GLEW_ARB_separate_shader_objects = GL_FALSE; +GLboolean __GLEW_ARB_shader_atomic_counter_ops = GL_FALSE; +GLboolean __GLEW_ARB_shader_atomic_counters = GL_FALSE; +GLboolean __GLEW_ARB_shader_ballot = GL_FALSE; +GLboolean __GLEW_ARB_shader_bit_encoding = GL_FALSE; +GLboolean __GLEW_ARB_shader_clock = GL_FALSE; +GLboolean __GLEW_ARB_shader_draw_parameters = GL_FALSE; +GLboolean __GLEW_ARB_shader_group_vote = GL_FALSE; +GLboolean __GLEW_ARB_shader_image_load_store = GL_FALSE; +GLboolean __GLEW_ARB_shader_image_size = GL_FALSE; +GLboolean __GLEW_ARB_shader_objects = GL_FALSE; +GLboolean __GLEW_ARB_shader_precision = GL_FALSE; +GLboolean __GLEW_ARB_shader_stencil_export = GL_FALSE; +GLboolean __GLEW_ARB_shader_storage_buffer_object = GL_FALSE; +GLboolean __GLEW_ARB_shader_subroutine = GL_FALSE; +GLboolean __GLEW_ARB_shader_texture_image_samples = GL_FALSE; +GLboolean __GLEW_ARB_shader_texture_lod = GL_FALSE; +GLboolean __GLEW_ARB_shader_viewport_layer_array = GL_FALSE; +GLboolean __GLEW_ARB_shading_language_100 = GL_FALSE; +GLboolean __GLEW_ARB_shading_language_420pack = GL_FALSE; +GLboolean __GLEW_ARB_shading_language_include = GL_FALSE; +GLboolean __GLEW_ARB_shading_language_packing = GL_FALSE; +GLboolean __GLEW_ARB_shadow = GL_FALSE; +GLboolean __GLEW_ARB_shadow_ambient = GL_FALSE; +GLboolean __GLEW_ARB_sparse_buffer = GL_FALSE; +GLboolean __GLEW_ARB_sparse_texture = GL_FALSE; +GLboolean __GLEW_ARB_sparse_texture2 = GL_FALSE; +GLboolean __GLEW_ARB_sparse_texture_clamp = GL_FALSE; +GLboolean __GLEW_ARB_stencil_texturing = GL_FALSE; +GLboolean __GLEW_ARB_sync = GL_FALSE; +GLboolean __GLEW_ARB_tessellation_shader = GL_FALSE; +GLboolean __GLEW_ARB_texture_barrier = GL_FALSE; +GLboolean __GLEW_ARB_texture_border_clamp = GL_FALSE; +GLboolean __GLEW_ARB_texture_buffer_object = GL_FALSE; +GLboolean __GLEW_ARB_texture_buffer_object_rgb32 = GL_FALSE; +GLboolean __GLEW_ARB_texture_buffer_range = GL_FALSE; +GLboolean __GLEW_ARB_texture_compression = GL_FALSE; +GLboolean __GLEW_ARB_texture_compression_bptc = GL_FALSE; +GLboolean __GLEW_ARB_texture_compression_rgtc = GL_FALSE; +GLboolean __GLEW_ARB_texture_cube_map = GL_FALSE; +GLboolean __GLEW_ARB_texture_cube_map_array = GL_FALSE; +GLboolean __GLEW_ARB_texture_env_add = GL_FALSE; +GLboolean __GLEW_ARB_texture_env_combine = GL_FALSE; +GLboolean __GLEW_ARB_texture_env_crossbar = GL_FALSE; +GLboolean __GLEW_ARB_texture_env_dot3 = GL_FALSE; +GLboolean __GLEW_ARB_texture_filter_minmax = GL_FALSE; +GLboolean __GLEW_ARB_texture_float = GL_FALSE; +GLboolean __GLEW_ARB_texture_gather = GL_FALSE; +GLboolean __GLEW_ARB_texture_mirror_clamp_to_edge = GL_FALSE; +GLboolean __GLEW_ARB_texture_mirrored_repeat = GL_FALSE; +GLboolean __GLEW_ARB_texture_multisample = GL_FALSE; +GLboolean __GLEW_ARB_texture_non_power_of_two = GL_FALSE; +GLboolean __GLEW_ARB_texture_query_levels = GL_FALSE; +GLboolean __GLEW_ARB_texture_query_lod = GL_FALSE; +GLboolean __GLEW_ARB_texture_rectangle = GL_FALSE; +GLboolean __GLEW_ARB_texture_rg = GL_FALSE; +GLboolean __GLEW_ARB_texture_rgb10_a2ui = GL_FALSE; +GLboolean __GLEW_ARB_texture_stencil8 = GL_FALSE; +GLboolean __GLEW_ARB_texture_storage = GL_FALSE; +GLboolean __GLEW_ARB_texture_storage_multisample = GL_FALSE; +GLboolean __GLEW_ARB_texture_swizzle = GL_FALSE; +GLboolean __GLEW_ARB_texture_view = GL_FALSE; +GLboolean __GLEW_ARB_timer_query = GL_FALSE; +GLboolean __GLEW_ARB_transform_feedback2 = GL_FALSE; +GLboolean __GLEW_ARB_transform_feedback3 = GL_FALSE; +GLboolean __GLEW_ARB_transform_feedback_instanced = GL_FALSE; +GLboolean __GLEW_ARB_transform_feedback_overflow_query = GL_FALSE; +GLboolean __GLEW_ARB_transpose_matrix = GL_FALSE; +GLboolean __GLEW_ARB_uniform_buffer_object = GL_FALSE; +GLboolean __GLEW_ARB_vertex_array_bgra = GL_FALSE; +GLboolean __GLEW_ARB_vertex_array_object = GL_FALSE; +GLboolean __GLEW_ARB_vertex_attrib_64bit = GL_FALSE; +GLboolean __GLEW_ARB_vertex_attrib_binding = GL_FALSE; +GLboolean __GLEW_ARB_vertex_blend = GL_FALSE; +GLboolean __GLEW_ARB_vertex_buffer_object = GL_FALSE; +GLboolean __GLEW_ARB_vertex_program = GL_FALSE; +GLboolean __GLEW_ARB_vertex_shader = GL_FALSE; +GLboolean __GLEW_ARB_vertex_type_10f_11f_11f_rev = GL_FALSE; +GLboolean __GLEW_ARB_vertex_type_2_10_10_10_rev = GL_FALSE; +GLboolean __GLEW_ARB_viewport_array = GL_FALSE; +GLboolean __GLEW_ARB_window_pos = GL_FALSE; +GLboolean __GLEW_ATIX_point_sprites = GL_FALSE; +GLboolean __GLEW_ATIX_texture_env_combine3 = GL_FALSE; +GLboolean __GLEW_ATIX_texture_env_route = GL_FALSE; +GLboolean __GLEW_ATIX_vertex_shader_output_point_size = GL_FALSE; +GLboolean __GLEW_ATI_draw_buffers = GL_FALSE; +GLboolean __GLEW_ATI_element_array = GL_FALSE; +GLboolean __GLEW_ATI_envmap_bumpmap = GL_FALSE; +GLboolean __GLEW_ATI_fragment_shader = GL_FALSE; +GLboolean __GLEW_ATI_map_object_buffer = GL_FALSE; +GLboolean __GLEW_ATI_meminfo = GL_FALSE; +GLboolean __GLEW_ATI_pn_triangles = GL_FALSE; +GLboolean __GLEW_ATI_separate_stencil = GL_FALSE; +GLboolean __GLEW_ATI_shader_texture_lod = GL_FALSE; +GLboolean __GLEW_ATI_text_fragment_shader = GL_FALSE; +GLboolean __GLEW_ATI_texture_compression_3dc = GL_FALSE; +GLboolean __GLEW_ATI_texture_env_combine3 = GL_FALSE; +GLboolean __GLEW_ATI_texture_float = GL_FALSE; +GLboolean __GLEW_ATI_texture_mirror_once = GL_FALSE; +GLboolean __GLEW_ATI_vertex_array_object = GL_FALSE; +GLboolean __GLEW_ATI_vertex_attrib_array_object = GL_FALSE; +GLboolean __GLEW_ATI_vertex_streams = GL_FALSE; +GLboolean __GLEW_EXT_422_pixels = GL_FALSE; +GLboolean __GLEW_EXT_Cg_shader = GL_FALSE; +GLboolean __GLEW_EXT_abgr = GL_FALSE; +GLboolean __GLEW_EXT_bgra = GL_FALSE; +GLboolean __GLEW_EXT_bindable_uniform = GL_FALSE; +GLboolean __GLEW_EXT_blend_color = GL_FALSE; +GLboolean __GLEW_EXT_blend_equation_separate = GL_FALSE; +GLboolean __GLEW_EXT_blend_func_separate = GL_FALSE; +GLboolean __GLEW_EXT_blend_logic_op = GL_FALSE; +GLboolean __GLEW_EXT_blend_minmax = GL_FALSE; +GLboolean __GLEW_EXT_blend_subtract = GL_FALSE; +GLboolean __GLEW_EXT_clip_volume_hint = GL_FALSE; +GLboolean __GLEW_EXT_cmyka = GL_FALSE; +GLboolean __GLEW_EXT_color_subtable = GL_FALSE; +GLboolean __GLEW_EXT_compiled_vertex_array = GL_FALSE; +GLboolean __GLEW_EXT_convolution = GL_FALSE; +GLboolean __GLEW_EXT_coordinate_frame = GL_FALSE; +GLboolean __GLEW_EXT_copy_texture = GL_FALSE; +GLboolean __GLEW_EXT_cull_vertex = GL_FALSE; +GLboolean __GLEW_EXT_debug_label = GL_FALSE; +GLboolean __GLEW_EXT_debug_marker = GL_FALSE; +GLboolean __GLEW_EXT_depth_bounds_test = GL_FALSE; +GLboolean __GLEW_EXT_direct_state_access = GL_FALSE; +GLboolean __GLEW_EXT_draw_buffers2 = GL_FALSE; +GLboolean __GLEW_EXT_draw_instanced = GL_FALSE; +GLboolean __GLEW_EXT_draw_range_elements = GL_FALSE; +GLboolean __GLEW_EXT_fog_coord = GL_FALSE; +GLboolean __GLEW_EXT_fragment_lighting = GL_FALSE; +GLboolean __GLEW_EXT_framebuffer_blit = GL_FALSE; +GLboolean __GLEW_EXT_framebuffer_multisample = GL_FALSE; +GLboolean __GLEW_EXT_framebuffer_multisample_blit_scaled = GL_FALSE; +GLboolean __GLEW_EXT_framebuffer_object = GL_FALSE; +GLboolean __GLEW_EXT_framebuffer_sRGB = GL_FALSE; +GLboolean __GLEW_EXT_geometry_shader4 = GL_FALSE; +GLboolean __GLEW_EXT_gpu_program_parameters = GL_FALSE; +GLboolean __GLEW_EXT_gpu_shader4 = GL_FALSE; +GLboolean __GLEW_EXT_histogram = GL_FALSE; +GLboolean __GLEW_EXT_index_array_formats = GL_FALSE; +GLboolean __GLEW_EXT_index_func = GL_FALSE; +GLboolean __GLEW_EXT_index_material = GL_FALSE; +GLboolean __GLEW_EXT_index_texture = GL_FALSE; +GLboolean __GLEW_EXT_light_texture = GL_FALSE; +GLboolean __GLEW_EXT_misc_attribute = GL_FALSE; +GLboolean __GLEW_EXT_multi_draw_arrays = GL_FALSE; +GLboolean __GLEW_EXT_multisample = GL_FALSE; +GLboolean __GLEW_EXT_packed_depth_stencil = GL_FALSE; +GLboolean __GLEW_EXT_packed_float = GL_FALSE; +GLboolean __GLEW_EXT_packed_pixels = GL_FALSE; +GLboolean __GLEW_EXT_paletted_texture = GL_FALSE; +GLboolean __GLEW_EXT_pixel_buffer_object = GL_FALSE; +GLboolean __GLEW_EXT_pixel_transform = GL_FALSE; +GLboolean __GLEW_EXT_pixel_transform_color_table = GL_FALSE; +GLboolean __GLEW_EXT_point_parameters = GL_FALSE; +GLboolean __GLEW_EXT_polygon_offset = GL_FALSE; +GLboolean __GLEW_EXT_polygon_offset_clamp = GL_FALSE; +GLboolean __GLEW_EXT_post_depth_coverage = GL_FALSE; +GLboolean __GLEW_EXT_provoking_vertex = GL_FALSE; +GLboolean __GLEW_EXT_raster_multisample = GL_FALSE; +GLboolean __GLEW_EXT_rescale_normal = GL_FALSE; +GLboolean __GLEW_EXT_scene_marker = GL_FALSE; +GLboolean __GLEW_EXT_secondary_color = GL_FALSE; +GLboolean __GLEW_EXT_separate_shader_objects = GL_FALSE; +GLboolean __GLEW_EXT_separate_specular_color = GL_FALSE; +GLboolean __GLEW_EXT_shader_image_load_formatted = GL_FALSE; +GLboolean __GLEW_EXT_shader_image_load_store = GL_FALSE; +GLboolean __GLEW_EXT_shader_integer_mix = GL_FALSE; +GLboolean __GLEW_EXT_shadow_funcs = GL_FALSE; +GLboolean __GLEW_EXT_shared_texture_palette = GL_FALSE; +GLboolean __GLEW_EXT_sparse_texture2 = GL_FALSE; +GLboolean __GLEW_EXT_stencil_clear_tag = GL_FALSE; +GLboolean __GLEW_EXT_stencil_two_side = GL_FALSE; +GLboolean __GLEW_EXT_stencil_wrap = GL_FALSE; +GLboolean __GLEW_EXT_subtexture = GL_FALSE; +GLboolean __GLEW_EXT_texture = GL_FALSE; +GLboolean __GLEW_EXT_texture3D = GL_FALSE; +GLboolean __GLEW_EXT_texture_array = GL_FALSE; +GLboolean __GLEW_EXT_texture_buffer_object = GL_FALSE; +GLboolean __GLEW_EXT_texture_compression_dxt1 = GL_FALSE; +GLboolean __GLEW_EXT_texture_compression_latc = GL_FALSE; +GLboolean __GLEW_EXT_texture_compression_rgtc = GL_FALSE; +GLboolean __GLEW_EXT_texture_compression_s3tc = GL_FALSE; +GLboolean __GLEW_EXT_texture_cube_map = GL_FALSE; +GLboolean __GLEW_EXT_texture_edge_clamp = GL_FALSE; +GLboolean __GLEW_EXT_texture_env = GL_FALSE; +GLboolean __GLEW_EXT_texture_env_add = GL_FALSE; +GLboolean __GLEW_EXT_texture_env_combine = GL_FALSE; +GLboolean __GLEW_EXT_texture_env_dot3 = GL_FALSE; +GLboolean __GLEW_EXT_texture_filter_anisotropic = GL_FALSE; +GLboolean __GLEW_EXT_texture_filter_minmax = GL_FALSE; +GLboolean __GLEW_EXT_texture_integer = GL_FALSE; +GLboolean __GLEW_EXT_texture_lod_bias = GL_FALSE; +GLboolean __GLEW_EXT_texture_mirror_clamp = GL_FALSE; +GLboolean __GLEW_EXT_texture_object = GL_FALSE; +GLboolean __GLEW_EXT_texture_perturb_normal = GL_FALSE; +GLboolean __GLEW_EXT_texture_rectangle = GL_FALSE; +GLboolean __GLEW_EXT_texture_sRGB = GL_FALSE; +GLboolean __GLEW_EXT_texture_sRGB_decode = GL_FALSE; +GLboolean __GLEW_EXT_texture_shared_exponent = GL_FALSE; +GLboolean __GLEW_EXT_texture_snorm = GL_FALSE; +GLboolean __GLEW_EXT_texture_swizzle = GL_FALSE; +GLboolean __GLEW_EXT_timer_query = GL_FALSE; +GLboolean __GLEW_EXT_transform_feedback = GL_FALSE; +GLboolean __GLEW_EXT_vertex_array = GL_FALSE; +GLboolean __GLEW_EXT_vertex_array_bgra = GL_FALSE; +GLboolean __GLEW_EXT_vertex_attrib_64bit = GL_FALSE; +GLboolean __GLEW_EXT_vertex_shader = GL_FALSE; +GLboolean __GLEW_EXT_vertex_weighting = GL_FALSE; +GLboolean __GLEW_EXT_x11_sync_object = GL_FALSE; +GLboolean __GLEW_GREMEDY_frame_terminator = GL_FALSE; +GLboolean __GLEW_GREMEDY_string_marker = GL_FALSE; +GLboolean __GLEW_HP_convolution_border_modes = GL_FALSE; +GLboolean __GLEW_HP_image_transform = GL_FALSE; +GLboolean __GLEW_HP_occlusion_test = GL_FALSE; +GLboolean __GLEW_HP_texture_lighting = GL_FALSE; +GLboolean __GLEW_IBM_cull_vertex = GL_FALSE; +GLboolean __GLEW_IBM_multimode_draw_arrays = GL_FALSE; +GLboolean __GLEW_IBM_rasterpos_clip = GL_FALSE; +GLboolean __GLEW_IBM_static_data = GL_FALSE; +GLboolean __GLEW_IBM_texture_mirrored_repeat = GL_FALSE; +GLboolean __GLEW_IBM_vertex_array_lists = GL_FALSE; +GLboolean __GLEW_INGR_color_clamp = GL_FALSE; +GLboolean __GLEW_INGR_interlace_read = GL_FALSE; +GLboolean __GLEW_INTEL_fragment_shader_ordering = GL_FALSE; +GLboolean __GLEW_INTEL_framebuffer_CMAA = GL_FALSE; +GLboolean __GLEW_INTEL_map_texture = GL_FALSE; +GLboolean __GLEW_INTEL_parallel_arrays = GL_FALSE; +GLboolean __GLEW_INTEL_performance_query = GL_FALSE; +GLboolean __GLEW_INTEL_texture_scissor = GL_FALSE; +GLboolean __GLEW_KHR_blend_equation_advanced = GL_FALSE; +GLboolean __GLEW_KHR_blend_equation_advanced_coherent = GL_FALSE; +GLboolean __GLEW_KHR_context_flush_control = GL_FALSE; +GLboolean __GLEW_KHR_debug = GL_FALSE; +GLboolean __GLEW_KHR_no_error = GL_FALSE; +GLboolean __GLEW_KHR_robust_buffer_access_behavior = GL_FALSE; +GLboolean __GLEW_KHR_robustness = GL_FALSE; +GLboolean __GLEW_KHR_texture_compression_astc_hdr = GL_FALSE; +GLboolean __GLEW_KHR_texture_compression_astc_ldr = GL_FALSE; +GLboolean __GLEW_KTX_buffer_region = GL_FALSE; +GLboolean __GLEW_MESAX_texture_stack = GL_FALSE; +GLboolean __GLEW_MESA_pack_invert = GL_FALSE; +GLboolean __GLEW_MESA_resize_buffers = GL_FALSE; +GLboolean __GLEW_MESA_window_pos = GL_FALSE; +GLboolean __GLEW_MESA_ycbcr_texture = GL_FALSE; +GLboolean __GLEW_NVX_conditional_render = GL_FALSE; +GLboolean __GLEW_NVX_gpu_memory_info = GL_FALSE; +GLboolean __GLEW_NV_bindless_multi_draw_indirect = GL_FALSE; +GLboolean __GLEW_NV_bindless_multi_draw_indirect_count = GL_FALSE; +GLboolean __GLEW_NV_bindless_texture = GL_FALSE; +GLboolean __GLEW_NV_blend_equation_advanced = GL_FALSE; +GLboolean __GLEW_NV_blend_equation_advanced_coherent = GL_FALSE; +GLboolean __GLEW_NV_blend_square = GL_FALSE; +GLboolean __GLEW_NV_compute_program5 = GL_FALSE; +GLboolean __GLEW_NV_conditional_render = GL_FALSE; +GLboolean __GLEW_NV_conservative_raster = GL_FALSE; +GLboolean __GLEW_NV_conservative_raster_dilate = GL_FALSE; +GLboolean __GLEW_NV_copy_depth_to_color = GL_FALSE; +GLboolean __GLEW_NV_copy_image = GL_FALSE; +GLboolean __GLEW_NV_deep_texture3D = GL_FALSE; +GLboolean __GLEW_NV_depth_buffer_float = GL_FALSE; +GLboolean __GLEW_NV_depth_clamp = GL_FALSE; +GLboolean __GLEW_NV_depth_range_unclamped = GL_FALSE; +GLboolean __GLEW_NV_draw_texture = GL_FALSE; +GLboolean __GLEW_NV_evaluators = GL_FALSE; +GLboolean __GLEW_NV_explicit_multisample = GL_FALSE; +GLboolean __GLEW_NV_fence = GL_FALSE; +GLboolean __GLEW_NV_fill_rectangle = GL_FALSE; +GLboolean __GLEW_NV_float_buffer = GL_FALSE; +GLboolean __GLEW_NV_fog_distance = GL_FALSE; +GLboolean __GLEW_NV_fragment_coverage_to_color = GL_FALSE; +GLboolean __GLEW_NV_fragment_program = GL_FALSE; +GLboolean __GLEW_NV_fragment_program2 = GL_FALSE; +GLboolean __GLEW_NV_fragment_program4 = GL_FALSE; +GLboolean __GLEW_NV_fragment_program_option = GL_FALSE; +GLboolean __GLEW_NV_fragment_shader_interlock = GL_FALSE; +GLboolean __GLEW_NV_framebuffer_mixed_samples = GL_FALSE; +GLboolean __GLEW_NV_framebuffer_multisample_coverage = GL_FALSE; +GLboolean __GLEW_NV_geometry_program4 = GL_FALSE; +GLboolean __GLEW_NV_geometry_shader4 = GL_FALSE; +GLboolean __GLEW_NV_geometry_shader_passthrough = GL_FALSE; +GLboolean __GLEW_NV_gpu_program4 = GL_FALSE; +GLboolean __GLEW_NV_gpu_program5 = GL_FALSE; +GLboolean __GLEW_NV_gpu_program5_mem_extended = GL_FALSE; +GLboolean __GLEW_NV_gpu_program_fp64 = GL_FALSE; +GLboolean __GLEW_NV_gpu_shader5 = GL_FALSE; +GLboolean __GLEW_NV_half_float = GL_FALSE; +GLboolean __GLEW_NV_internalformat_sample_query = GL_FALSE; +GLboolean __GLEW_NV_light_max_exponent = GL_FALSE; +GLboolean __GLEW_NV_multisample_coverage = GL_FALSE; +GLboolean __GLEW_NV_multisample_filter_hint = GL_FALSE; +GLboolean __GLEW_NV_occlusion_query = GL_FALSE; +GLboolean __GLEW_NV_packed_depth_stencil = GL_FALSE; +GLboolean __GLEW_NV_parameter_buffer_object = GL_FALSE; +GLboolean __GLEW_NV_parameter_buffer_object2 = GL_FALSE; +GLboolean __GLEW_NV_path_rendering = GL_FALSE; +GLboolean __GLEW_NV_path_rendering_shared_edge = GL_FALSE; +GLboolean __GLEW_NV_pixel_data_range = GL_FALSE; +GLboolean __GLEW_NV_point_sprite = GL_FALSE; +GLboolean __GLEW_NV_present_video = GL_FALSE; +GLboolean __GLEW_NV_primitive_restart = GL_FALSE; +GLboolean __GLEW_NV_register_combiners = GL_FALSE; +GLboolean __GLEW_NV_register_combiners2 = GL_FALSE; +GLboolean __GLEW_NV_sample_locations = GL_FALSE; +GLboolean __GLEW_NV_sample_mask_override_coverage = GL_FALSE; +GLboolean __GLEW_NV_shader_atomic_counters = GL_FALSE; +GLboolean __GLEW_NV_shader_atomic_float = GL_FALSE; +GLboolean __GLEW_NV_shader_atomic_fp16_vector = GL_FALSE; +GLboolean __GLEW_NV_shader_atomic_int64 = GL_FALSE; +GLboolean __GLEW_NV_shader_buffer_load = GL_FALSE; +GLboolean __GLEW_NV_shader_storage_buffer_object = GL_FALSE; +GLboolean __GLEW_NV_shader_thread_group = GL_FALSE; +GLboolean __GLEW_NV_shader_thread_shuffle = GL_FALSE; +GLboolean __GLEW_NV_tessellation_program5 = GL_FALSE; +GLboolean __GLEW_NV_texgen_emboss = GL_FALSE; +GLboolean __GLEW_NV_texgen_reflection = GL_FALSE; +GLboolean __GLEW_NV_texture_barrier = GL_FALSE; +GLboolean __GLEW_NV_texture_compression_vtc = GL_FALSE; +GLboolean __GLEW_NV_texture_env_combine4 = GL_FALSE; +GLboolean __GLEW_NV_texture_expand_normal = GL_FALSE; +GLboolean __GLEW_NV_texture_multisample = GL_FALSE; +GLboolean __GLEW_NV_texture_rectangle = GL_FALSE; +GLboolean __GLEW_NV_texture_shader = GL_FALSE; +GLboolean __GLEW_NV_texture_shader2 = GL_FALSE; +GLboolean __GLEW_NV_texture_shader3 = GL_FALSE; +GLboolean __GLEW_NV_transform_feedback = GL_FALSE; +GLboolean __GLEW_NV_transform_feedback2 = GL_FALSE; +GLboolean __GLEW_NV_uniform_buffer_unified_memory = GL_FALSE; +GLboolean __GLEW_NV_vdpau_interop = GL_FALSE; +GLboolean __GLEW_NV_vertex_array_range = GL_FALSE; +GLboolean __GLEW_NV_vertex_array_range2 = GL_FALSE; +GLboolean __GLEW_NV_vertex_attrib_integer_64bit = GL_FALSE; +GLboolean __GLEW_NV_vertex_buffer_unified_memory = GL_FALSE; +GLboolean __GLEW_NV_vertex_program = GL_FALSE; +GLboolean __GLEW_NV_vertex_program1_1 = GL_FALSE; +GLboolean __GLEW_NV_vertex_program2 = GL_FALSE; +GLboolean __GLEW_NV_vertex_program2_option = GL_FALSE; +GLboolean __GLEW_NV_vertex_program3 = GL_FALSE; +GLboolean __GLEW_NV_vertex_program4 = GL_FALSE; +GLboolean __GLEW_NV_video_capture = GL_FALSE; +GLboolean __GLEW_NV_viewport_array2 = GL_FALSE; +GLboolean __GLEW_OES_byte_coordinates = GL_FALSE; +GLboolean __GLEW_OES_compressed_paletted_texture = GL_FALSE; +GLboolean __GLEW_OES_read_format = GL_FALSE; +GLboolean __GLEW_OES_single_precision = GL_FALSE; +GLboolean __GLEW_OML_interlace = GL_FALSE; +GLboolean __GLEW_OML_resample = GL_FALSE; +GLboolean __GLEW_OML_subsample = GL_FALSE; +GLboolean __GLEW_OVR_multiview = GL_FALSE; +GLboolean __GLEW_OVR_multiview2 = GL_FALSE; +GLboolean __GLEW_PGI_misc_hints = GL_FALSE; +GLboolean __GLEW_PGI_vertex_hints = GL_FALSE; +GLboolean __GLEW_REGAL_ES1_0_compatibility = GL_FALSE; +GLboolean __GLEW_REGAL_ES1_1_compatibility = GL_FALSE; +GLboolean __GLEW_REGAL_enable = GL_FALSE; +GLboolean __GLEW_REGAL_error_string = GL_FALSE; +GLboolean __GLEW_REGAL_extension_query = GL_FALSE; +GLboolean __GLEW_REGAL_log = GL_FALSE; +GLboolean __GLEW_REGAL_proc_address = GL_FALSE; +GLboolean __GLEW_REND_screen_coordinates = GL_FALSE; +GLboolean __GLEW_S3_s3tc = GL_FALSE; +GLboolean __GLEW_SGIS_color_range = GL_FALSE; +GLboolean __GLEW_SGIS_detail_texture = GL_FALSE; +GLboolean __GLEW_SGIS_fog_function = GL_FALSE; +GLboolean __GLEW_SGIS_generate_mipmap = GL_FALSE; +GLboolean __GLEW_SGIS_multisample = GL_FALSE; +GLboolean __GLEW_SGIS_pixel_texture = GL_FALSE; +GLboolean __GLEW_SGIS_point_line_texgen = GL_FALSE; +GLboolean __GLEW_SGIS_sharpen_texture = GL_FALSE; +GLboolean __GLEW_SGIS_texture4D = GL_FALSE; +GLboolean __GLEW_SGIS_texture_border_clamp = GL_FALSE; +GLboolean __GLEW_SGIS_texture_edge_clamp = GL_FALSE; +GLboolean __GLEW_SGIS_texture_filter4 = GL_FALSE; +GLboolean __GLEW_SGIS_texture_lod = GL_FALSE; +GLboolean __GLEW_SGIS_texture_select = GL_FALSE; +GLboolean __GLEW_SGIX_async = GL_FALSE; +GLboolean __GLEW_SGIX_async_histogram = GL_FALSE; +GLboolean __GLEW_SGIX_async_pixel = GL_FALSE; +GLboolean __GLEW_SGIX_blend_alpha_minmax = GL_FALSE; +GLboolean __GLEW_SGIX_clipmap = GL_FALSE; +GLboolean __GLEW_SGIX_convolution_accuracy = GL_FALSE; +GLboolean __GLEW_SGIX_depth_texture = GL_FALSE; +GLboolean __GLEW_SGIX_flush_raster = GL_FALSE; +GLboolean __GLEW_SGIX_fog_offset = GL_FALSE; +GLboolean __GLEW_SGIX_fog_texture = GL_FALSE; +GLboolean __GLEW_SGIX_fragment_specular_lighting = GL_FALSE; +GLboolean __GLEW_SGIX_framezoom = GL_FALSE; +GLboolean __GLEW_SGIX_interlace = GL_FALSE; +GLboolean __GLEW_SGIX_ir_instrument1 = GL_FALSE; +GLboolean __GLEW_SGIX_list_priority = GL_FALSE; +GLboolean __GLEW_SGIX_pixel_texture = GL_FALSE; +GLboolean __GLEW_SGIX_pixel_texture_bits = GL_FALSE; +GLboolean __GLEW_SGIX_reference_plane = GL_FALSE; +GLboolean __GLEW_SGIX_resample = GL_FALSE; +GLboolean __GLEW_SGIX_shadow = GL_FALSE; +GLboolean __GLEW_SGIX_shadow_ambient = GL_FALSE; +GLboolean __GLEW_SGIX_sprite = GL_FALSE; +GLboolean __GLEW_SGIX_tag_sample_buffer = GL_FALSE; +GLboolean __GLEW_SGIX_texture_add_env = GL_FALSE; +GLboolean __GLEW_SGIX_texture_coordinate_clamp = GL_FALSE; +GLboolean __GLEW_SGIX_texture_lod_bias = GL_FALSE; +GLboolean __GLEW_SGIX_texture_multi_buffer = GL_FALSE; +GLboolean __GLEW_SGIX_texture_range = GL_FALSE; +GLboolean __GLEW_SGIX_texture_scale_bias = GL_FALSE; +GLboolean __GLEW_SGIX_vertex_preclip = GL_FALSE; +GLboolean __GLEW_SGIX_vertex_preclip_hint = GL_FALSE; +GLboolean __GLEW_SGIX_ycrcb = GL_FALSE; +GLboolean __GLEW_SGI_color_matrix = GL_FALSE; +GLboolean __GLEW_SGI_color_table = GL_FALSE; +GLboolean __GLEW_SGI_texture_color_table = GL_FALSE; +GLboolean __GLEW_SUNX_constant_data = GL_FALSE; +GLboolean __GLEW_SUN_convolution_border_modes = GL_FALSE; +GLboolean __GLEW_SUN_global_alpha = GL_FALSE; +GLboolean __GLEW_SUN_mesh_array = GL_FALSE; +GLboolean __GLEW_SUN_read_video_pixels = GL_FALSE; +GLboolean __GLEW_SUN_slice_accum = GL_FALSE; +GLboolean __GLEW_SUN_triangle_list = GL_FALSE; +GLboolean __GLEW_SUN_vertex = GL_FALSE; +GLboolean __GLEW_WIN_phong_shading = GL_FALSE; +GLboolean __GLEW_WIN_specular_fog = GL_FALSE; +GLboolean __GLEW_WIN_swap_hint = GL_FALSE; + +#endif /* !GLEW_MX */ + +#ifdef GL_VERSION_1_2 + +static GLboolean _glewInit_GL_VERSION_1_2 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage3D")) == NULL) || r; + r = ((glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElements")) == NULL) || r; + r = ((glTexImage3D = (PFNGLTEXIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTexImage3D")) == NULL) || r; + r = ((glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage3D")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_1_2 */ + +#ifdef GL_VERSION_1_3 + +static GLboolean _glewInit_GL_VERSION_1_3 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glActiveTexture = (PFNGLACTIVETEXTUREPROC)glewGetProcAddress((const GLubyte*)"glActiveTexture")) == NULL) || r; + r = ((glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)glewGetProcAddress((const GLubyte*)"glClientActiveTexture")) == NULL) || r; + r = ((glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage1D")) == NULL) || r; + r = ((glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage2D")) == NULL) || r; + r = ((glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage3D")) == NULL) || r; + r = ((glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage1D")) == NULL) || r; + r = ((glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage2D")) == NULL) || r; + r = ((glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage3D")) == NULL) || r; + r = ((glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTexImage")) == NULL) || r; + r = ((glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixd")) == NULL) || r; + r = ((glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixf")) == NULL) || r; + r = ((glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixd")) == NULL) || r; + r = ((glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixf")) == NULL) || r; + r = ((glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1d")) == NULL) || r; + r = ((glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1dv")) == NULL) || r; + r = ((glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1f")) == NULL) || r; + r = ((glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1fv")) == NULL) || r; + r = ((glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1i")) == NULL) || r; + r = ((glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1iv")) == NULL) || r; + r = ((glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1s")) == NULL) || r; + r = ((glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1sv")) == NULL) || r; + r = ((glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2d")) == NULL) || r; + r = ((glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2dv")) == NULL) || r; + r = ((glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2f")) == NULL) || r; + r = ((glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2fv")) == NULL) || r; + r = ((glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2i")) == NULL) || r; + r = ((glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2iv")) == NULL) || r; + r = ((glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2s")) == NULL) || r; + r = ((glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2sv")) == NULL) || r; + r = ((glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3d")) == NULL) || r; + r = ((glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3dv")) == NULL) || r; + r = ((glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3f")) == NULL) || r; + r = ((glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3fv")) == NULL) || r; + r = ((glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3i")) == NULL) || r; + r = ((glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3iv")) == NULL) || r; + r = ((glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3s")) == NULL) || r; + r = ((glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3sv")) == NULL) || r; + r = ((glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4d")) == NULL) || r; + r = ((glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4dv")) == NULL) || r; + r = ((glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4f")) == NULL) || r; + r = ((glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4fv")) == NULL) || r; + r = ((glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4i")) == NULL) || r; + r = ((glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4iv")) == NULL) || r; + r = ((glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4s")) == NULL) || r; + r = ((glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4sv")) == NULL) || r; + r = ((glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)glewGetProcAddress((const GLubyte*)"glSampleCoverage")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_1_3 */ + +#ifdef GL_VERSION_1_4 + +static GLboolean _glewInit_GL_VERSION_1_4 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendColor = (PFNGLBLENDCOLORPROC)glewGetProcAddress((const GLubyte*)"glBlendColor")) == NULL) || r; + r = ((glBlendEquation = (PFNGLBLENDEQUATIONPROC)glewGetProcAddress((const GLubyte*)"glBlendEquation")) == NULL) || r; + r = ((glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparate")) == NULL) || r; + r = ((glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC)glewGetProcAddress((const GLubyte*)"glFogCoordPointer")) == NULL) || r; + r = ((glFogCoordd = (PFNGLFOGCOORDDPROC)glewGetProcAddress((const GLubyte*)"glFogCoordd")) == NULL) || r; + r = ((glFogCoorddv = (PFNGLFOGCOORDDVPROC)glewGetProcAddress((const GLubyte*)"glFogCoorddv")) == NULL) || r; + r = ((glFogCoordf = (PFNGLFOGCOORDFPROC)glewGetProcAddress((const GLubyte*)"glFogCoordf")) == NULL) || r; + r = ((glFogCoordfv = (PFNGLFOGCOORDFVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordfv")) == NULL) || r; + r = ((glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArrays")) == NULL) || r; + r = ((glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElements")) == NULL) || r; + r = ((glPointParameterf = (PFNGLPOINTPARAMETERFPROC)glewGetProcAddress((const GLubyte*)"glPointParameterf")) == NULL) || r; + r = ((glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfv")) == NULL) || r; + r = ((glPointParameteri = (PFNGLPOINTPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glPointParameteri")) == NULL) || r; + r = ((glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glPointParameteriv")) == NULL) || r; + r = ((glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3b")) == NULL) || r; + r = ((glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3bv")) == NULL) || r; + r = ((glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3d")) == NULL) || r; + r = ((glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3dv")) == NULL) || r; + r = ((glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3f")) == NULL) || r; + r = ((glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3fv")) == NULL) || r; + r = ((glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3i")) == NULL) || r; + r = ((glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3iv")) == NULL) || r; + r = ((glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3s")) == NULL) || r; + r = ((glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3sv")) == NULL) || r; + r = ((glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ub")) == NULL) || r; + r = ((glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ubv")) == NULL) || r; + r = ((glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ui")) == NULL) || r; + r = ((glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3uiv")) == NULL) || r; + r = ((glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3us")) == NULL) || r; + r = ((glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3usv")) == NULL) || r; + r = ((glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorPointer")) == NULL) || r; + r = ((glWindowPos2d = (PFNGLWINDOWPOS2DPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2d")) == NULL) || r; + r = ((glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dv")) == NULL) || r; + r = ((glWindowPos2f = (PFNGLWINDOWPOS2FPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2f")) == NULL) || r; + r = ((glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fv")) == NULL) || r; + r = ((glWindowPos2i = (PFNGLWINDOWPOS2IPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2i")) == NULL) || r; + r = ((glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2iv")) == NULL) || r; + r = ((glWindowPos2s = (PFNGLWINDOWPOS2SPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2s")) == NULL) || r; + r = ((glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2sv")) == NULL) || r; + r = ((glWindowPos3d = (PFNGLWINDOWPOS3DPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3d")) == NULL) || r; + r = ((glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dv")) == NULL) || r; + r = ((glWindowPos3f = (PFNGLWINDOWPOS3FPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3f")) == NULL) || r; + r = ((glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fv")) == NULL) || r; + r = ((glWindowPos3i = (PFNGLWINDOWPOS3IPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3i")) == NULL) || r; + r = ((glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3iv")) == NULL) || r; + r = ((glWindowPos3s = (PFNGLWINDOWPOS3SPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3s")) == NULL) || r; + r = ((glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3sv")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_1_4 */ + +#ifdef GL_VERSION_1_5 + +static GLboolean _glewInit_GL_VERSION_1_5 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginQuery = (PFNGLBEGINQUERYPROC)glewGetProcAddress((const GLubyte*)"glBeginQuery")) == NULL) || r; + r = ((glBindBuffer = (PFNGLBINDBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBindBuffer")) == NULL) || r; + r = ((glBufferData = (PFNGLBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glBufferData")) == NULL) || r; + r = ((glBufferSubData = (PFNGLBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glBufferSubData")) == NULL) || r; + r = ((glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteBuffers")) == NULL) || r; + r = ((glDeleteQueries = (PFNGLDELETEQUERIESPROC)glewGetProcAddress((const GLubyte*)"glDeleteQueries")) == NULL) || r; + r = ((glEndQuery = (PFNGLENDQUERYPROC)glewGetProcAddress((const GLubyte*)"glEndQuery")) == NULL) || r; + r = ((glGenBuffers = (PFNGLGENBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glGenBuffers")) == NULL) || r; + r = ((glGenQueries = (PFNGLGENQUERIESPROC)glewGetProcAddress((const GLubyte*)"glGenQueries")) == NULL) || r; + r = ((glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetBufferParameteriv")) == NULL) || r; + r = ((glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)glewGetProcAddress((const GLubyte*)"glGetBufferPointerv")) == NULL) || r; + r = ((glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glGetBufferSubData")) == NULL) || r; + r = ((glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectiv")) == NULL) || r; + r = ((glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectuiv")) == NULL) || r; + r = ((glGetQueryiv = (PFNGLGETQUERYIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryiv")) == NULL) || r; + r = ((glIsBuffer = (PFNGLISBUFFERPROC)glewGetProcAddress((const GLubyte*)"glIsBuffer")) == NULL) || r; + r = ((glIsQuery = (PFNGLISQUERYPROC)glewGetProcAddress((const GLubyte*)"glIsQuery")) == NULL) || r; + r = ((glMapBuffer = (PFNGLMAPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glMapBuffer")) == NULL) || r; + r = ((glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glUnmapBuffer")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_1_5 */ + +#ifdef GL_VERSION_2_0 + +static GLboolean _glewInit_GL_VERSION_2_0 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAttachShader = (PFNGLATTACHSHADERPROC)glewGetProcAddress((const GLubyte*)"glAttachShader")) == NULL) || r; + r = ((glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glBindAttribLocation")) == NULL) || r; + r = ((glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparate")) == NULL) || r; + r = ((glCompileShader = (PFNGLCOMPILESHADERPROC)glewGetProcAddress((const GLubyte*)"glCompileShader")) == NULL) || r; + r = ((glCreateProgram = (PFNGLCREATEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glCreateProgram")) == NULL) || r; + r = ((glCreateShader = (PFNGLCREATESHADERPROC)glewGetProcAddress((const GLubyte*)"glCreateShader")) == NULL) || r; + r = ((glDeleteProgram = (PFNGLDELETEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgram")) == NULL) || r; + r = ((glDeleteShader = (PFNGLDELETESHADERPROC)glewGetProcAddress((const GLubyte*)"glDeleteShader")) == NULL) || r; + r = ((glDetachShader = (PFNGLDETACHSHADERPROC)glewGetProcAddress((const GLubyte*)"glDetachShader")) == NULL) || r; + r = ((glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexAttribArray")) == NULL) || r; + r = ((glDrawBuffers = (PFNGLDRAWBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDrawBuffers")) == NULL) || r; + r = ((glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexAttribArray")) == NULL) || r; + r = ((glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)glewGetProcAddress((const GLubyte*)"glGetActiveAttrib")) == NULL) || r; + r = ((glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniform")) == NULL) || r; + r = ((glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)glewGetProcAddress((const GLubyte*)"glGetAttachedShaders")) == NULL) || r; + r = ((glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetAttribLocation")) == NULL) || r; + r = ((glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)glewGetProcAddress((const GLubyte*)"glGetProgramInfoLog")) == NULL) || r; + r = ((glGetProgramiv = (PFNGLGETPROGRAMIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramiv")) == NULL) || r; + r = ((glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)glewGetProcAddress((const GLubyte*)"glGetShaderInfoLog")) == NULL) || r; + r = ((glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)glewGetProcAddress((const GLubyte*)"glGetShaderSource")) == NULL) || r; + r = ((glGetShaderiv = (PFNGLGETSHADERIVPROC)glewGetProcAddress((const GLubyte*)"glGetShaderiv")) == NULL) || r; + r = ((glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetUniformLocation")) == NULL) || r; + r = ((glGetUniformfv = (PFNGLGETUNIFORMFVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformfv")) == NULL) || r; + r = ((glGetUniformiv = (PFNGLGETUNIFORMIVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformiv")) == NULL) || r; + r = ((glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribPointerv")) == NULL) || r; + r = ((glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribdv")) == NULL) || r; + r = ((glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribfv")) == NULL) || r; + r = ((glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribiv")) == NULL) || r; + r = ((glIsProgram = (PFNGLISPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glIsProgram")) == NULL) || r; + r = ((glIsShader = (PFNGLISSHADERPROC)glewGetProcAddress((const GLubyte*)"glIsShader")) == NULL) || r; + r = ((glLinkProgram = (PFNGLLINKPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glLinkProgram")) == NULL) || r; + r = ((glShaderSource = (PFNGLSHADERSOURCEPROC)glewGetProcAddress((const GLubyte*)"glShaderSource")) == NULL) || r; + r = ((glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glStencilFuncSeparate")) == NULL) || r; + r = ((glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glStencilMaskSeparate")) == NULL) || r; + r = ((glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glStencilOpSeparate")) == NULL) || r; + r = ((glUniform1f = (PFNGLUNIFORM1FPROC)glewGetProcAddress((const GLubyte*)"glUniform1f")) == NULL) || r; + r = ((glUniform1fv = (PFNGLUNIFORM1FVPROC)glewGetProcAddress((const GLubyte*)"glUniform1fv")) == NULL) || r; + r = ((glUniform1i = (PFNGLUNIFORM1IPROC)glewGetProcAddress((const GLubyte*)"glUniform1i")) == NULL) || r; + r = ((glUniform1iv = (PFNGLUNIFORM1IVPROC)glewGetProcAddress((const GLubyte*)"glUniform1iv")) == NULL) || r; + r = ((glUniform2f = (PFNGLUNIFORM2FPROC)glewGetProcAddress((const GLubyte*)"glUniform2f")) == NULL) || r; + r = ((glUniform2fv = (PFNGLUNIFORM2FVPROC)glewGetProcAddress((const GLubyte*)"glUniform2fv")) == NULL) || r; + r = ((glUniform2i = (PFNGLUNIFORM2IPROC)glewGetProcAddress((const GLubyte*)"glUniform2i")) == NULL) || r; + r = ((glUniform2iv = (PFNGLUNIFORM2IVPROC)glewGetProcAddress((const GLubyte*)"glUniform2iv")) == NULL) || r; + r = ((glUniform3f = (PFNGLUNIFORM3FPROC)glewGetProcAddress((const GLubyte*)"glUniform3f")) == NULL) || r; + r = ((glUniform3fv = (PFNGLUNIFORM3FVPROC)glewGetProcAddress((const GLubyte*)"glUniform3fv")) == NULL) || r; + r = ((glUniform3i = (PFNGLUNIFORM3IPROC)glewGetProcAddress((const GLubyte*)"glUniform3i")) == NULL) || r; + r = ((glUniform3iv = (PFNGLUNIFORM3IVPROC)glewGetProcAddress((const GLubyte*)"glUniform3iv")) == NULL) || r; + r = ((glUniform4f = (PFNGLUNIFORM4FPROC)glewGetProcAddress((const GLubyte*)"glUniform4f")) == NULL) || r; + r = ((glUniform4fv = (PFNGLUNIFORM4FVPROC)glewGetProcAddress((const GLubyte*)"glUniform4fv")) == NULL) || r; + r = ((glUniform4i = (PFNGLUNIFORM4IPROC)glewGetProcAddress((const GLubyte*)"glUniform4i")) == NULL) || r; + r = ((glUniform4iv = (PFNGLUNIFORM4IVPROC)glewGetProcAddress((const GLubyte*)"glUniform4iv")) == NULL) || r; + r = ((glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2fv")) == NULL) || r; + r = ((glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3fv")) == NULL) || r; + r = ((glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4fv")) == NULL) || r; + r = ((glUseProgram = (PFNGLUSEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glUseProgram")) == NULL) || r; + r = ((glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glValidateProgram")) == NULL) || r; + r = ((glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1d")) == NULL) || r; + r = ((glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dv")) == NULL) || r; + r = ((glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1f")) == NULL) || r; + r = ((glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fv")) == NULL) || r; + r = ((glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1s")) == NULL) || r; + r = ((glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1sv")) == NULL) || r; + r = ((glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2d")) == NULL) || r; + r = ((glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dv")) == NULL) || r; + r = ((glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2f")) == NULL) || r; + r = ((glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fv")) == NULL) || r; + r = ((glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2s")) == NULL) || r; + r = ((glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2sv")) == NULL) || r; + r = ((glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3d")) == NULL) || r; + r = ((glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dv")) == NULL) || r; + r = ((glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3f")) == NULL) || r; + r = ((glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fv")) == NULL) || r; + r = ((glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3s")) == NULL) || r; + r = ((glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3sv")) == NULL) || r; + r = ((glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nbv")) == NULL) || r; + r = ((glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Niv")) == NULL) || r; + r = ((glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nsv")) == NULL) || r; + r = ((glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nub")) == NULL) || r; + r = ((glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nubv")) == NULL) || r; + r = ((glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nuiv")) == NULL) || r; + r = ((glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nusv")) == NULL) || r; + r = ((glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4bv")) == NULL) || r; + r = ((glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4d")) == NULL) || r; + r = ((glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dv")) == NULL) || r; + r = ((glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4f")) == NULL) || r; + r = ((glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fv")) == NULL) || r; + r = ((glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4iv")) == NULL) || r; + r = ((glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4s")) == NULL) || r; + r = ((glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4sv")) == NULL) || r; + r = ((glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubv")) == NULL) || r; + r = ((glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4uiv")) == NULL) || r; + r = ((glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4usv")) == NULL) || r; + r = ((glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointer")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_2_0 */ + +#ifdef GL_VERSION_2_1 + +static GLboolean _glewInit_GL_VERSION_2_1 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2x3fv")) == NULL) || r; + r = ((glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2x4fv")) == NULL) || r; + r = ((glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3x2fv")) == NULL) || r; + r = ((glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3x4fv")) == NULL) || r; + r = ((glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4x2fv")) == NULL) || r; + r = ((glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4x3fv")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_2_1 */ + +#ifdef GL_VERSION_3_0 + +static GLboolean _glewInit_GL_VERSION_3_0 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC)glewGetProcAddress((const GLubyte*)"glBeginConditionalRender")) == NULL) || r; + r = ((glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glBeginTransformFeedback")) == NULL) || r; + r = ((glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC)glewGetProcAddress((const GLubyte*)"glBindFragDataLocation")) == NULL) || r; + r = ((glClampColor = (PFNGLCLAMPCOLORPROC)glewGetProcAddress((const GLubyte*)"glClampColor")) == NULL) || r; + r = ((glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)glewGetProcAddress((const GLubyte*)"glClearBufferfi")) == NULL) || r; + r = ((glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)glewGetProcAddress((const GLubyte*)"glClearBufferfv")) == NULL) || r; + r = ((glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)glewGetProcAddress((const GLubyte*)"glClearBufferiv")) == NULL) || r; + r = ((glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)glewGetProcAddress((const GLubyte*)"glClearBufferuiv")) == NULL) || r; + r = ((glColorMaski = (PFNGLCOLORMASKIPROC)glewGetProcAddress((const GLubyte*)"glColorMaski")) == NULL) || r; + r = ((glDisablei = (PFNGLDISABLEIPROC)glewGetProcAddress((const GLubyte*)"glDisablei")) == NULL) || r; + r = ((glEnablei = (PFNGLENABLEIPROC)glewGetProcAddress((const GLubyte*)"glEnablei")) == NULL) || r; + r = ((glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC)glewGetProcAddress((const GLubyte*)"glEndConditionalRender")) == NULL) || r; + r = ((glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glEndTransformFeedback")) == NULL) || r; + r = ((glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)glewGetProcAddress((const GLubyte*)"glGetBooleani_v")) == NULL) || r; + r = ((glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetFragDataLocation")) == NULL) || r; + r = ((glGetStringi = (PFNGLGETSTRINGIPROC)glewGetProcAddress((const GLubyte*)"glGetStringi")) == NULL) || r; + r = ((glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterIiv")) == NULL) || r; + r = ((glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterIuiv")) == NULL) || r; + r = ((glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbackVarying")) == NULL) || r; + r = ((glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformuiv")) == NULL) || r; + r = ((glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribIiv")) == NULL) || r; + r = ((glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribIuiv")) == NULL) || r; + r = ((glIsEnabledi = (PFNGLISENABLEDIPROC)glewGetProcAddress((const GLubyte*)"glIsEnabledi")) == NULL) || r; + r = ((glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glTexParameterIiv")) == NULL) || r; + r = ((glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glTexParameterIuiv")) == NULL) || r; + r = ((glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackVaryings")) == NULL) || r; + r = ((glUniform1ui = (PFNGLUNIFORM1UIPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui")) == NULL) || r; + r = ((glUniform1uiv = (PFNGLUNIFORM1UIVPROC)glewGetProcAddress((const GLubyte*)"glUniform1uiv")) == NULL) || r; + r = ((glUniform2ui = (PFNGLUNIFORM2UIPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui")) == NULL) || r; + r = ((glUniform2uiv = (PFNGLUNIFORM2UIVPROC)glewGetProcAddress((const GLubyte*)"glUniform2uiv")) == NULL) || r; + r = ((glUniform3ui = (PFNGLUNIFORM3UIPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui")) == NULL) || r; + r = ((glUniform3uiv = (PFNGLUNIFORM3UIVPROC)glewGetProcAddress((const GLubyte*)"glUniform3uiv")) == NULL) || r; + r = ((glUniform4ui = (PFNGLUNIFORM4UIPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui")) == NULL) || r; + r = ((glUniform4uiv = (PFNGLUNIFORM4UIVPROC)glewGetProcAddress((const GLubyte*)"glUniform4uiv")) == NULL) || r; + r = ((glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1i")) == NULL) || r; + r = ((glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1iv")) == NULL) || r; + r = ((glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1ui")) == NULL) || r; + r = ((glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1uiv")) == NULL) || r; + r = ((glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2i")) == NULL) || r; + r = ((glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2iv")) == NULL) || r; + r = ((glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2ui")) == NULL) || r; + r = ((glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2uiv")) == NULL) || r; + r = ((glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3i")) == NULL) || r; + r = ((glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3iv")) == NULL) || r; + r = ((glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3ui")) == NULL) || r; + r = ((glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3uiv")) == NULL) || r; + r = ((glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4bv")) == NULL) || r; + r = ((glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4i")) == NULL) || r; + r = ((glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4iv")) == NULL) || r; + r = ((glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4sv")) == NULL) || r; + r = ((glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4ubv")) == NULL) || r; + r = ((glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4ui")) == NULL) || r; + r = ((glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4uiv")) == NULL) || r; + r = ((glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4usv")) == NULL) || r; + r = ((glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribIPointer")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_3_0 */ + +#ifdef GL_VERSION_3_1 + +static GLboolean _glewInit_GL_VERSION_3_1 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstanced")) == NULL) || r; + r = ((glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstanced")) == NULL) || r; + r = ((glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)glewGetProcAddress((const GLubyte*)"glPrimitiveRestartIndex")) == NULL) || r; + r = ((glTexBuffer = (PFNGLTEXBUFFERPROC)glewGetProcAddress((const GLubyte*)"glTexBuffer")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_3_1 */ + +#ifdef GL_VERSION_3_2 + +static GLboolean _glewInit_GL_VERSION_3_2 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture")) == NULL) || r; + r = ((glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)glewGetProcAddress((const GLubyte*)"glGetBufferParameteri64v")) == NULL) || r; + r = ((glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)glewGetProcAddress((const GLubyte*)"glGetInteger64i_v")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_3_2 */ + +#ifdef GL_VERSION_3_3 + +static GLboolean _glewInit_GL_VERSION_3_3 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribDivisor")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_3_3 */ + +#ifdef GL_VERSION_4_0 + +static GLboolean _glewInit_GL_VERSION_4_0 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendEquationSeparatei = (PFNGLBLENDEQUATIONSEPARATEIPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparatei")) == NULL) || r; + r = ((glBlendEquationi = (PFNGLBLENDEQUATIONIPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationi")) == NULL) || r; + r = ((glBlendFuncSeparatei = (PFNGLBLENDFUNCSEPARATEIPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparatei")) == NULL) || r; + r = ((glBlendFunci = (PFNGLBLENDFUNCIPROC)glewGetProcAddress((const GLubyte*)"glBlendFunci")) == NULL) || r; + r = ((glMinSampleShading = (PFNGLMINSAMPLESHADINGPROC)glewGetProcAddress((const GLubyte*)"glMinSampleShading")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_4_0 */ + +#ifdef GL_VERSION_4_5 + +static GLboolean _glewInit_GL_VERSION_4_5 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetGraphicsResetStatus = (PFNGLGETGRAPHICSRESETSTATUSPROC)glewGetProcAddress((const GLubyte*)"glGetGraphicsResetStatus")) == NULL) || r; + r = ((glGetnCompressedTexImage = (PFNGLGETNCOMPRESSEDTEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetnCompressedTexImage")) == NULL) || r; + r = ((glGetnTexImage = (PFNGLGETNTEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetnTexImage")) == NULL) || r; + r = ((glGetnUniformdv = (PFNGLGETNUNIFORMDVPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformdv")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_4_5 */ + +#ifdef GL_3DFX_tbuffer + +static GLboolean _glewInit_GL_3DFX_tbuffer (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTbufferMask3DFX = (PFNGLTBUFFERMASK3DFXPROC)glewGetProcAddress((const GLubyte*)"glTbufferMask3DFX")) == NULL) || r; + + return r; +} + +#endif /* GL_3DFX_tbuffer */ + +#ifdef GL_AMD_debug_output + +static GLboolean _glewInit_GL_AMD_debug_output (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDebugMessageCallbackAMD = (PFNGLDEBUGMESSAGECALLBACKAMDPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageCallbackAMD")) == NULL) || r; + r = ((glDebugMessageEnableAMD = (PFNGLDEBUGMESSAGEENABLEAMDPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageEnableAMD")) == NULL) || r; + r = ((glDebugMessageInsertAMD = (PFNGLDEBUGMESSAGEINSERTAMDPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageInsertAMD")) == NULL) || r; + r = ((glGetDebugMessageLogAMD = (PFNGLGETDEBUGMESSAGELOGAMDPROC)glewGetProcAddress((const GLubyte*)"glGetDebugMessageLogAMD")) == NULL) || r; + + return r; +} + +#endif /* GL_AMD_debug_output */ + +#ifdef GL_AMD_draw_buffers_blend + +static GLboolean _glewInit_GL_AMD_draw_buffers_blend (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendEquationIndexedAMD = (PFNGLBLENDEQUATIONINDEXEDAMDPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationIndexedAMD")) == NULL) || r; + r = ((glBlendEquationSeparateIndexedAMD = (PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparateIndexedAMD")) == NULL) || r; + r = ((glBlendFuncIndexedAMD = (PFNGLBLENDFUNCINDEXEDAMDPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncIndexedAMD")) == NULL) || r; + r = ((glBlendFuncSeparateIndexedAMD = (PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparateIndexedAMD")) == NULL) || r; + + return r; +} + +#endif /* GL_AMD_draw_buffers_blend */ + +#ifdef GL_AMD_interleaved_elements + +static GLboolean _glewInit_GL_AMD_interleaved_elements (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glVertexAttribParameteriAMD = (PFNGLVERTEXATTRIBPARAMETERIAMDPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribParameteriAMD")) == NULL) || r; + + return r; +} + +#endif /* GL_AMD_interleaved_elements */ + +#ifdef GL_AMD_multi_draw_indirect + +static GLboolean _glewInit_GL_AMD_multi_draw_indirect (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMultiDrawArraysIndirectAMD = (PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirectAMD")) == NULL) || r; + r = ((glMultiDrawElementsIndirectAMD = (PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirectAMD")) == NULL) || r; + + return r; +} + +#endif /* GL_AMD_multi_draw_indirect */ + +#ifdef GL_AMD_name_gen_delete + +static GLboolean _glewInit_GL_AMD_name_gen_delete (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDeleteNamesAMD = (PFNGLDELETENAMESAMDPROC)glewGetProcAddress((const GLubyte*)"glDeleteNamesAMD")) == NULL) || r; + r = ((glGenNamesAMD = (PFNGLGENNAMESAMDPROC)glewGetProcAddress((const GLubyte*)"glGenNamesAMD")) == NULL) || r; + r = ((glIsNameAMD = (PFNGLISNAMEAMDPROC)glewGetProcAddress((const GLubyte*)"glIsNameAMD")) == NULL) || r; + + return r; +} + +#endif /* GL_AMD_name_gen_delete */ + +#ifdef GL_AMD_occlusion_query_event + +static GLboolean _glewInit_GL_AMD_occlusion_query_event (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glQueryObjectParameteruiAMD = (PFNGLQUERYOBJECTPARAMETERUIAMDPROC)glewGetProcAddress((const GLubyte*)"glQueryObjectParameteruiAMD")) == NULL) || r; + + return r; +} + +#endif /* GL_AMD_occlusion_query_event */ + +#ifdef GL_AMD_performance_monitor + +static GLboolean _glewInit_GL_AMD_performance_monitor (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginPerfMonitorAMD = (PFNGLBEGINPERFMONITORAMDPROC)glewGetProcAddress((const GLubyte*)"glBeginPerfMonitorAMD")) == NULL) || r; + r = ((glDeletePerfMonitorsAMD = (PFNGLDELETEPERFMONITORSAMDPROC)glewGetProcAddress((const GLubyte*)"glDeletePerfMonitorsAMD")) == NULL) || r; + r = ((glEndPerfMonitorAMD = (PFNGLENDPERFMONITORAMDPROC)glewGetProcAddress((const GLubyte*)"glEndPerfMonitorAMD")) == NULL) || r; + r = ((glGenPerfMonitorsAMD = (PFNGLGENPERFMONITORSAMDPROC)glewGetProcAddress((const GLubyte*)"glGenPerfMonitorsAMD")) == NULL) || r; + r = ((glGetPerfMonitorCounterDataAMD = (PFNGLGETPERFMONITORCOUNTERDATAAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorCounterDataAMD")) == NULL) || r; + r = ((glGetPerfMonitorCounterInfoAMD = (PFNGLGETPERFMONITORCOUNTERINFOAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorCounterInfoAMD")) == NULL) || r; + r = ((glGetPerfMonitorCounterStringAMD = (PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorCounterStringAMD")) == NULL) || r; + r = ((glGetPerfMonitorCountersAMD = (PFNGLGETPERFMONITORCOUNTERSAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorCountersAMD")) == NULL) || r; + r = ((glGetPerfMonitorGroupStringAMD = (PFNGLGETPERFMONITORGROUPSTRINGAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorGroupStringAMD")) == NULL) || r; + r = ((glGetPerfMonitorGroupsAMD = (PFNGLGETPERFMONITORGROUPSAMDPROC)glewGetProcAddress((const GLubyte*)"glGetPerfMonitorGroupsAMD")) == NULL) || r; + r = ((glSelectPerfMonitorCountersAMD = (PFNGLSELECTPERFMONITORCOUNTERSAMDPROC)glewGetProcAddress((const GLubyte*)"glSelectPerfMonitorCountersAMD")) == NULL) || r; + + return r; +} + +#endif /* GL_AMD_performance_monitor */ + +#ifdef GL_AMD_sample_positions + +static GLboolean _glewInit_GL_AMD_sample_positions (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glSetMultisamplefvAMD = (PFNGLSETMULTISAMPLEFVAMDPROC)glewGetProcAddress((const GLubyte*)"glSetMultisamplefvAMD")) == NULL) || r; + + return r; +} + +#endif /* GL_AMD_sample_positions */ + +#ifdef GL_AMD_sparse_texture + +static GLboolean _glewInit_GL_AMD_sparse_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexStorageSparseAMD = (PFNGLTEXSTORAGESPARSEAMDPROC)glewGetProcAddress((const GLubyte*)"glTexStorageSparseAMD")) == NULL) || r; + r = ((glTextureStorageSparseAMD = (PFNGLTEXTURESTORAGESPARSEAMDPROC)glewGetProcAddress((const GLubyte*)"glTextureStorageSparseAMD")) == NULL) || r; + + return r; +} + +#endif /* GL_AMD_sparse_texture */ + +#ifdef GL_AMD_stencil_operation_extended + +static GLboolean _glewInit_GL_AMD_stencil_operation_extended (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glStencilOpValueAMD = (PFNGLSTENCILOPVALUEAMDPROC)glewGetProcAddress((const GLubyte*)"glStencilOpValueAMD")) == NULL) || r; + + return r; +} + +#endif /* GL_AMD_stencil_operation_extended */ + +#ifdef GL_AMD_vertex_shader_tessellator + +static GLboolean _glewInit_GL_AMD_vertex_shader_tessellator (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTessellationFactorAMD = (PFNGLTESSELLATIONFACTORAMDPROC)glewGetProcAddress((const GLubyte*)"glTessellationFactorAMD")) == NULL) || r; + r = ((glTessellationModeAMD = (PFNGLTESSELLATIONMODEAMDPROC)glewGetProcAddress((const GLubyte*)"glTessellationModeAMD")) == NULL) || r; + + return r; +} + +#endif /* GL_AMD_vertex_shader_tessellator */ + +#ifdef GL_ANGLE_framebuffer_blit + +static GLboolean _glewInit_GL_ANGLE_framebuffer_blit (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlitFramebufferANGLE = (PFNGLBLITFRAMEBUFFERANGLEPROC)glewGetProcAddress((const GLubyte*)"glBlitFramebufferANGLE")) == NULL) || r; + + return r; +} + +#endif /* GL_ANGLE_framebuffer_blit */ + +#ifdef GL_ANGLE_framebuffer_multisample + +static GLboolean _glewInit_GL_ANGLE_framebuffer_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glRenderbufferStorageMultisampleANGLE = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageMultisampleANGLE")) == NULL) || r; + + return r; +} + +#endif /* GL_ANGLE_framebuffer_multisample */ + +#ifdef GL_ANGLE_instanced_arrays + +static GLboolean _glewInit_GL_ANGLE_instanced_arrays (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawArraysInstancedANGLE = (PFNGLDRAWARRAYSINSTANCEDANGLEPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstancedANGLE")) == NULL) || r; + r = ((glDrawElementsInstancedANGLE = (PFNGLDRAWELEMENTSINSTANCEDANGLEPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedANGLE")) == NULL) || r; + r = ((glVertexAttribDivisorANGLE = (PFNGLVERTEXATTRIBDIVISORANGLEPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribDivisorANGLE")) == NULL) || r; + + return r; +} + +#endif /* GL_ANGLE_instanced_arrays */ + +#ifdef GL_ANGLE_timer_query + +static GLboolean _glewInit_GL_ANGLE_timer_query (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginQueryANGLE = (PFNGLBEGINQUERYANGLEPROC)glewGetProcAddress((const GLubyte*)"glBeginQueryANGLE")) == NULL) || r; + r = ((glDeleteQueriesANGLE = (PFNGLDELETEQUERIESANGLEPROC)glewGetProcAddress((const GLubyte*)"glDeleteQueriesANGLE")) == NULL) || r; + r = ((glEndQueryANGLE = (PFNGLENDQUERYANGLEPROC)glewGetProcAddress((const GLubyte*)"glEndQueryANGLE")) == NULL) || r; + r = ((glGenQueriesANGLE = (PFNGLGENQUERIESANGLEPROC)glewGetProcAddress((const GLubyte*)"glGenQueriesANGLE")) == NULL) || r; + r = ((glGetQueryObjecti64vANGLE = (PFNGLGETQUERYOBJECTI64VANGLEPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjecti64vANGLE")) == NULL) || r; + r = ((glGetQueryObjectivANGLE = (PFNGLGETQUERYOBJECTIVANGLEPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectivANGLE")) == NULL) || r; + r = ((glGetQueryObjectui64vANGLE = (PFNGLGETQUERYOBJECTUI64VANGLEPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectui64vANGLE")) == NULL) || r; + r = ((glGetQueryObjectuivANGLE = (PFNGLGETQUERYOBJECTUIVANGLEPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectuivANGLE")) == NULL) || r; + r = ((glGetQueryivANGLE = (PFNGLGETQUERYIVANGLEPROC)glewGetProcAddress((const GLubyte*)"glGetQueryivANGLE")) == NULL) || r; + r = ((glIsQueryANGLE = (PFNGLISQUERYANGLEPROC)glewGetProcAddress((const GLubyte*)"glIsQueryANGLE")) == NULL) || r; + r = ((glQueryCounterANGLE = (PFNGLQUERYCOUNTERANGLEPROC)glewGetProcAddress((const GLubyte*)"glQueryCounterANGLE")) == NULL) || r; + + return r; +} + +#endif /* GL_ANGLE_timer_query */ + +#ifdef GL_ANGLE_translated_shader_source + +static GLboolean _glewInit_GL_ANGLE_translated_shader_source (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetTranslatedShaderSourceANGLE = (PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC)glewGetProcAddress((const GLubyte*)"glGetTranslatedShaderSourceANGLE")) == NULL) || r; + + return r; +} + +#endif /* GL_ANGLE_translated_shader_source */ + +#ifdef GL_APPLE_element_array + +static GLboolean _glewInit_GL_APPLE_element_array (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawElementArrayAPPLE = (PFNGLDRAWELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDrawElementArrayAPPLE")) == NULL) || r; + r = ((glDrawRangeElementArrayAPPLE = (PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementArrayAPPLE")) == NULL) || r; + r = ((glElementPointerAPPLE = (PFNGLELEMENTPOINTERAPPLEPROC)glewGetProcAddress((const GLubyte*)"glElementPointerAPPLE")) == NULL) || r; + r = ((glMultiDrawElementArrayAPPLE = (PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementArrayAPPLE")) == NULL) || r; + r = ((glMultiDrawRangeElementArrayAPPLE = (PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawRangeElementArrayAPPLE")) == NULL) || r; + + return r; +} + +#endif /* GL_APPLE_element_array */ + +#ifdef GL_APPLE_fence + +static GLboolean _glewInit_GL_APPLE_fence (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDeleteFencesAPPLE = (PFNGLDELETEFENCESAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDeleteFencesAPPLE")) == NULL) || r; + r = ((glFinishFenceAPPLE = (PFNGLFINISHFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFinishFenceAPPLE")) == NULL) || r; + r = ((glFinishObjectAPPLE = (PFNGLFINISHOBJECTAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFinishObjectAPPLE")) == NULL) || r; + r = ((glGenFencesAPPLE = (PFNGLGENFENCESAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGenFencesAPPLE")) == NULL) || r; + r = ((glIsFenceAPPLE = (PFNGLISFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glIsFenceAPPLE")) == NULL) || r; + r = ((glSetFenceAPPLE = (PFNGLSETFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glSetFenceAPPLE")) == NULL) || r; + r = ((glTestFenceAPPLE = (PFNGLTESTFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glTestFenceAPPLE")) == NULL) || r; + r = ((glTestObjectAPPLE = (PFNGLTESTOBJECTAPPLEPROC)glewGetProcAddress((const GLubyte*)"glTestObjectAPPLE")) == NULL) || r; + + return r; +} + +#endif /* GL_APPLE_fence */ + +#ifdef GL_APPLE_flush_buffer_range + +static GLboolean _glewInit_GL_APPLE_flush_buffer_range (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBufferParameteriAPPLE = (PFNGLBUFFERPARAMETERIAPPLEPROC)glewGetProcAddress((const GLubyte*)"glBufferParameteriAPPLE")) == NULL) || r; + r = ((glFlushMappedBufferRangeAPPLE = (PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFlushMappedBufferRangeAPPLE")) == NULL) || r; + + return r; +} + +#endif /* GL_APPLE_flush_buffer_range */ + +#ifdef GL_APPLE_object_purgeable + +static GLboolean _glewInit_GL_APPLE_object_purgeable (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetObjectParameterivAPPLE = (PFNGLGETOBJECTPARAMETERIVAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGetObjectParameterivAPPLE")) == NULL) || r; + r = ((glObjectPurgeableAPPLE = (PFNGLOBJECTPURGEABLEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glObjectPurgeableAPPLE")) == NULL) || r; + r = ((glObjectUnpurgeableAPPLE = (PFNGLOBJECTUNPURGEABLEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glObjectUnpurgeableAPPLE")) == NULL) || r; + + return r; +} + +#endif /* GL_APPLE_object_purgeable */ + +#ifdef GL_APPLE_texture_range + +static GLboolean _glewInit_GL_APPLE_texture_range (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetTexParameterPointervAPPLE = (PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterPointervAPPLE")) == NULL) || r; + r = ((glTextureRangeAPPLE = (PFNGLTEXTURERANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glTextureRangeAPPLE")) == NULL) || r; + + return r; +} + +#endif /* GL_APPLE_texture_range */ + +#ifdef GL_APPLE_vertex_array_object + +static GLboolean _glewInit_GL_APPLE_vertex_array_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindVertexArrayAPPLE = (PFNGLBINDVERTEXARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glBindVertexArrayAPPLE")) == NULL) || r; + r = ((glDeleteVertexArraysAPPLE = (PFNGLDELETEVERTEXARRAYSAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDeleteVertexArraysAPPLE")) == NULL) || r; + r = ((glGenVertexArraysAPPLE = (PFNGLGENVERTEXARRAYSAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGenVertexArraysAPPLE")) == NULL) || r; + r = ((glIsVertexArrayAPPLE = (PFNGLISVERTEXARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glIsVertexArrayAPPLE")) == NULL) || r; + + return r; +} + +#endif /* GL_APPLE_vertex_array_object */ + +#ifdef GL_APPLE_vertex_array_range + +static GLboolean _glewInit_GL_APPLE_vertex_array_range (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFlushVertexArrayRangeAPPLE = (PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFlushVertexArrayRangeAPPLE")) == NULL) || r; + r = ((glVertexArrayParameteriAPPLE = (PFNGLVERTEXARRAYPARAMETERIAPPLEPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayParameteriAPPLE")) == NULL) || r; + r = ((glVertexArrayRangeAPPLE = (PFNGLVERTEXARRAYRANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayRangeAPPLE")) == NULL) || r; + + return r; +} + +#endif /* GL_APPLE_vertex_array_range */ + +#ifdef GL_APPLE_vertex_program_evaluators + +static GLboolean _glewInit_GL_APPLE_vertex_program_evaluators (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDisableVertexAttribAPPLE = (PFNGLDISABLEVERTEXATTRIBAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexAttribAPPLE")) == NULL) || r; + r = ((glEnableVertexAttribAPPLE = (PFNGLENABLEVERTEXATTRIBAPPLEPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexAttribAPPLE")) == NULL) || r; + r = ((glIsVertexAttribEnabledAPPLE = (PFNGLISVERTEXATTRIBENABLEDAPPLEPROC)glewGetProcAddress((const GLubyte*)"glIsVertexAttribEnabledAPPLE")) == NULL) || r; + r = ((glMapVertexAttrib1dAPPLE = (PFNGLMAPVERTEXATTRIB1DAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMapVertexAttrib1dAPPLE")) == NULL) || r; + r = ((glMapVertexAttrib1fAPPLE = (PFNGLMAPVERTEXATTRIB1FAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMapVertexAttrib1fAPPLE")) == NULL) || r; + r = ((glMapVertexAttrib2dAPPLE = (PFNGLMAPVERTEXATTRIB2DAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMapVertexAttrib2dAPPLE")) == NULL) || r; + r = ((glMapVertexAttrib2fAPPLE = (PFNGLMAPVERTEXATTRIB2FAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMapVertexAttrib2fAPPLE")) == NULL) || r; + + return r; +} + +#endif /* GL_APPLE_vertex_program_evaluators */ + +#ifdef GL_ARB_ES2_compatibility + +static GLboolean _glewInit_GL_ARB_ES2_compatibility (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glClearDepthf = (PFNGLCLEARDEPTHFPROC)glewGetProcAddress((const GLubyte*)"glClearDepthf")) == NULL) || r; + r = ((glDepthRangef = (PFNGLDEPTHRANGEFPROC)glewGetProcAddress((const GLubyte*)"glDepthRangef")) == NULL) || r; + r = ((glGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC)glewGetProcAddress((const GLubyte*)"glGetShaderPrecisionFormat")) == NULL) || r; + r = ((glReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC)glewGetProcAddress((const GLubyte*)"glReleaseShaderCompiler")) == NULL) || r; + r = ((glShaderBinary = (PFNGLSHADERBINARYPROC)glewGetProcAddress((const GLubyte*)"glShaderBinary")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_ES2_compatibility */ + +#ifdef GL_ARB_ES3_1_compatibility + +static GLboolean _glewInit_GL_ARB_ES3_1_compatibility (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMemoryBarrierByRegion = (PFNGLMEMORYBARRIERBYREGIONPROC)glewGetProcAddress((const GLubyte*)"glMemoryBarrierByRegion")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_ES3_1_compatibility */ + +#ifdef GL_ARB_ES3_2_compatibility + +static GLboolean _glewInit_GL_ARB_ES3_2_compatibility (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPrimitiveBoundingBoxARB = (PFNGLPRIMITIVEBOUNDINGBOXARBPROC)glewGetProcAddress((const GLubyte*)"glPrimitiveBoundingBoxARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_ES3_2_compatibility */ + +#ifdef GL_ARB_base_instance + +static GLboolean _glewInit_GL_ARB_base_instance (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawArraysInstancedBaseInstance = (PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstancedBaseInstance")) == NULL) || r; + r = ((glDrawElementsInstancedBaseInstance = (PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedBaseInstance")) == NULL) || r; + r = ((glDrawElementsInstancedBaseVertexBaseInstance = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedBaseVertexBaseInstance")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_base_instance */ + +#ifdef GL_ARB_bindless_texture + +static GLboolean _glewInit_GL_ARB_bindless_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetImageHandleARB = (PFNGLGETIMAGEHANDLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetImageHandleARB")) == NULL) || r; + r = ((glGetTextureHandleARB = (PFNGLGETTEXTUREHANDLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetTextureHandleARB")) == NULL) || r; + r = ((glGetTextureSamplerHandleARB = (PFNGLGETTEXTURESAMPLERHANDLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetTextureSamplerHandleARB")) == NULL) || r; + r = ((glGetVertexAttribLui64vARB = (PFNGLGETVERTEXATTRIBLUI64VARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribLui64vARB")) == NULL) || r; + r = ((glIsImageHandleResidentARB = (PFNGLISIMAGEHANDLERESIDENTARBPROC)glewGetProcAddress((const GLubyte*)"glIsImageHandleResidentARB")) == NULL) || r; + r = ((glIsTextureHandleResidentARB = (PFNGLISTEXTUREHANDLERESIDENTARBPROC)glewGetProcAddress((const GLubyte*)"glIsTextureHandleResidentARB")) == NULL) || r; + r = ((glMakeImageHandleNonResidentARB = (PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC)glewGetProcAddress((const GLubyte*)"glMakeImageHandleNonResidentARB")) == NULL) || r; + r = ((glMakeImageHandleResidentARB = (PFNGLMAKEIMAGEHANDLERESIDENTARBPROC)glewGetProcAddress((const GLubyte*)"glMakeImageHandleResidentARB")) == NULL) || r; + r = ((glMakeTextureHandleNonResidentARB = (PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC)glewGetProcAddress((const GLubyte*)"glMakeTextureHandleNonResidentARB")) == NULL) || r; + r = ((glMakeTextureHandleResidentARB = (PFNGLMAKETEXTUREHANDLERESIDENTARBPROC)glewGetProcAddress((const GLubyte*)"glMakeTextureHandleResidentARB")) == NULL) || r; + r = ((glProgramUniformHandleui64ARB = (PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformHandleui64ARB")) == NULL) || r; + r = ((glProgramUniformHandleui64vARB = (PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformHandleui64vARB")) == NULL) || r; + r = ((glUniformHandleui64ARB = (PFNGLUNIFORMHANDLEUI64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniformHandleui64ARB")) == NULL) || r; + r = ((glUniformHandleui64vARB = (PFNGLUNIFORMHANDLEUI64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniformHandleui64vARB")) == NULL) || r; + r = ((glVertexAttribL1ui64ARB = (PFNGLVERTEXATTRIBL1UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1ui64ARB")) == NULL) || r; + r = ((glVertexAttribL1ui64vARB = (PFNGLVERTEXATTRIBL1UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1ui64vARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_bindless_texture */ + +#ifdef GL_ARB_blend_func_extended + +static GLboolean _glewInit_GL_ARB_blend_func_extended (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glBindFragDataLocationIndexed")) == NULL) || r; + r = ((glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetFragDataIndex")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_blend_func_extended */ + +#ifdef GL_ARB_buffer_storage + +static GLboolean _glewInit_GL_ARB_buffer_storage (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBufferStorage = (PFNGLBUFFERSTORAGEPROC)glewGetProcAddress((const GLubyte*)"glBufferStorage")) == NULL) || r; + r = ((glNamedBufferStorageEXT = (PFNGLNAMEDBUFFERSTORAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferStorageEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_buffer_storage */ + +#ifdef GL_ARB_cl_event + +static GLboolean _glewInit_GL_ARB_cl_event (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCreateSyncFromCLeventARB = (PFNGLCREATESYNCFROMCLEVENTARBPROC)glewGetProcAddress((const GLubyte*)"glCreateSyncFromCLeventARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_cl_event */ + +#ifdef GL_ARB_clear_buffer_object + +static GLboolean _glewInit_GL_ARB_clear_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glClearBufferData = (PFNGLCLEARBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glClearBufferData")) == NULL) || r; + r = ((glClearBufferSubData = (PFNGLCLEARBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glClearBufferSubData")) == NULL) || r; + r = ((glClearNamedBufferDataEXT = (PFNGLCLEARNAMEDBUFFERDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glClearNamedBufferDataEXT")) == NULL) || r; + r = ((glClearNamedBufferSubDataEXT = (PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glClearNamedBufferSubDataEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_clear_buffer_object */ + +#ifdef GL_ARB_clear_texture + +static GLboolean _glewInit_GL_ARB_clear_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glClearTexImage = (PFNGLCLEARTEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glClearTexImage")) == NULL) || r; + r = ((glClearTexSubImage = (PFNGLCLEARTEXSUBIMAGEPROC)glewGetProcAddress((const GLubyte*)"glClearTexSubImage")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_clear_texture */ + +#ifdef GL_ARB_clip_control + +static GLboolean _glewInit_GL_ARB_clip_control (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glClipControl = (PFNGLCLIPCONTROLPROC)glewGetProcAddress((const GLubyte*)"glClipControl")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_clip_control */ + +#ifdef GL_ARB_color_buffer_float + +static GLboolean _glewInit_GL_ARB_color_buffer_float (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glClampColorARB = (PFNGLCLAMPCOLORARBPROC)glewGetProcAddress((const GLubyte*)"glClampColorARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_color_buffer_float */ + +#ifdef GL_ARB_compute_shader + +static GLboolean _glewInit_GL_ARB_compute_shader (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDispatchCompute = (PFNGLDISPATCHCOMPUTEPROC)glewGetProcAddress((const GLubyte*)"glDispatchCompute")) == NULL) || r; + r = ((glDispatchComputeIndirect = (PFNGLDISPATCHCOMPUTEINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glDispatchComputeIndirect")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_compute_shader */ + +#ifdef GL_ARB_compute_variable_group_size + +static GLboolean _glewInit_GL_ARB_compute_variable_group_size (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDispatchComputeGroupSizeARB = (PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC)glewGetProcAddress((const GLubyte*)"glDispatchComputeGroupSizeARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_compute_variable_group_size */ + +#ifdef GL_ARB_copy_buffer + +static GLboolean _glewInit_GL_ARB_copy_buffer (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glCopyBufferSubData")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_copy_buffer */ + +#ifdef GL_ARB_copy_image + +static GLboolean _glewInit_GL_ARB_copy_image (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCopyImageSubData = (PFNGLCOPYIMAGESUBDATAPROC)glewGetProcAddress((const GLubyte*)"glCopyImageSubData")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_copy_image */ + +#ifdef GL_ARB_debug_output + +static GLboolean _glewInit_GL_ARB_debug_output (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageCallbackARB")) == NULL) || r; + r = ((glDebugMessageControlARB = (PFNGLDEBUGMESSAGECONTROLARBPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageControlARB")) == NULL) || r; + r = ((glDebugMessageInsertARB = (PFNGLDEBUGMESSAGEINSERTARBPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageInsertARB")) == NULL) || r; + r = ((glGetDebugMessageLogARB = (PFNGLGETDEBUGMESSAGELOGARBPROC)glewGetProcAddress((const GLubyte*)"glGetDebugMessageLogARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_debug_output */ + +#ifdef GL_ARB_direct_state_access + +static GLboolean _glewInit_GL_ARB_direct_state_access (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindTextureUnit = (PFNGLBINDTEXTUREUNITPROC)glewGetProcAddress((const GLubyte*)"glBindTextureUnit")) == NULL) || r; + r = ((glBlitNamedFramebuffer = (PFNGLBLITNAMEDFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBlitNamedFramebuffer")) == NULL) || r; + r = ((glCheckNamedFramebufferStatus = (PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC)glewGetProcAddress((const GLubyte*)"glCheckNamedFramebufferStatus")) == NULL) || r; + r = ((glClearNamedBufferData = (PFNGLCLEARNAMEDBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glClearNamedBufferData")) == NULL) || r; + r = ((glClearNamedBufferSubData = (PFNGLCLEARNAMEDBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glClearNamedBufferSubData")) == NULL) || r; + r = ((glClearNamedFramebufferfi = (PFNGLCLEARNAMEDFRAMEBUFFERFIPROC)glewGetProcAddress((const GLubyte*)"glClearNamedFramebufferfi")) == NULL) || r; + r = ((glClearNamedFramebufferfv = (PFNGLCLEARNAMEDFRAMEBUFFERFVPROC)glewGetProcAddress((const GLubyte*)"glClearNamedFramebufferfv")) == NULL) || r; + r = ((glClearNamedFramebufferiv = (PFNGLCLEARNAMEDFRAMEBUFFERIVPROC)glewGetProcAddress((const GLubyte*)"glClearNamedFramebufferiv")) == NULL) || r; + r = ((glClearNamedFramebufferuiv = (PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC)glewGetProcAddress((const GLubyte*)"glClearNamedFramebufferuiv")) == NULL) || r; + r = ((glCompressedTextureSubImage1D = (PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage1D")) == NULL) || r; + r = ((glCompressedTextureSubImage2D = (PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage2D")) == NULL) || r; + r = ((glCompressedTextureSubImage3D = (PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage3D")) == NULL) || r; + r = ((glCopyNamedBufferSubData = (PFNGLCOPYNAMEDBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glCopyNamedBufferSubData")) == NULL) || r; + r = ((glCopyTextureSubImage1D = (PFNGLCOPYTEXTURESUBIMAGE1DPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage1D")) == NULL) || r; + r = ((glCopyTextureSubImage2D = (PFNGLCOPYTEXTURESUBIMAGE2DPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage2D")) == NULL) || r; + r = ((glCopyTextureSubImage3D = (PFNGLCOPYTEXTURESUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage3D")) == NULL) || r; + r = ((glCreateBuffers = (PFNGLCREATEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glCreateBuffers")) == NULL) || r; + r = ((glCreateFramebuffers = (PFNGLCREATEFRAMEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glCreateFramebuffers")) == NULL) || r; + r = ((glCreateProgramPipelines = (PFNGLCREATEPROGRAMPIPELINESPROC)glewGetProcAddress((const GLubyte*)"glCreateProgramPipelines")) == NULL) || r; + r = ((glCreateQueries = (PFNGLCREATEQUERIESPROC)glewGetProcAddress((const GLubyte*)"glCreateQueries")) == NULL) || r; + r = ((glCreateRenderbuffers = (PFNGLCREATERENDERBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glCreateRenderbuffers")) == NULL) || r; + r = ((glCreateSamplers = (PFNGLCREATESAMPLERSPROC)glewGetProcAddress((const GLubyte*)"glCreateSamplers")) == NULL) || r; + r = ((glCreateTextures = (PFNGLCREATETEXTURESPROC)glewGetProcAddress((const GLubyte*)"glCreateTextures")) == NULL) || r; + r = ((glCreateTransformFeedbacks = (PFNGLCREATETRANSFORMFEEDBACKSPROC)glewGetProcAddress((const GLubyte*)"glCreateTransformFeedbacks")) == NULL) || r; + r = ((glCreateVertexArrays = (PFNGLCREATEVERTEXARRAYSPROC)glewGetProcAddress((const GLubyte*)"glCreateVertexArrays")) == NULL) || r; + r = ((glDisableVertexArrayAttrib = (PFNGLDISABLEVERTEXARRAYATTRIBPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexArrayAttrib")) == NULL) || r; + r = ((glEnableVertexArrayAttrib = (PFNGLENABLEVERTEXARRAYATTRIBPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexArrayAttrib")) == NULL) || r; + r = ((glFlushMappedNamedBufferRange = (PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glFlushMappedNamedBufferRange")) == NULL) || r; + r = ((glGenerateTextureMipmap = (PFNGLGENERATETEXTUREMIPMAPPROC)glewGetProcAddress((const GLubyte*)"glGenerateTextureMipmap")) == NULL) || r; + r = ((glGetCompressedTextureImage = (PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTextureImage")) == NULL) || r; + r = ((glGetNamedBufferParameteri64v = (PFNGLGETNAMEDBUFFERPARAMETERI64VPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferParameteri64v")) == NULL) || r; + r = ((glGetNamedBufferParameteriv = (PFNGLGETNAMEDBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferParameteriv")) == NULL) || r; + r = ((glGetNamedBufferPointerv = (PFNGLGETNAMEDBUFFERPOINTERVPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferPointerv")) == NULL) || r; + r = ((glGetNamedBufferSubData = (PFNGLGETNAMEDBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferSubData")) == NULL) || r; + r = ((glGetNamedFramebufferAttachmentParameteriv = (PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetNamedFramebufferAttachmentParameteriv")) == NULL) || r; + r = ((glGetNamedFramebufferParameteriv = (PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetNamedFramebufferParameteriv")) == NULL) || r; + r = ((glGetNamedRenderbufferParameteriv = (PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetNamedRenderbufferParameteriv")) == NULL) || r; + r = ((glGetQueryBufferObjecti64v = (PFNGLGETQUERYBUFFEROBJECTI64VPROC)glewGetProcAddress((const GLubyte*)"glGetQueryBufferObjecti64v")) == NULL) || r; + r = ((glGetQueryBufferObjectiv = (PFNGLGETQUERYBUFFEROBJECTIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryBufferObjectiv")) == NULL) || r; + r = ((glGetQueryBufferObjectui64v = (PFNGLGETQUERYBUFFEROBJECTUI64VPROC)glewGetProcAddress((const GLubyte*)"glGetQueryBufferObjectui64v")) == NULL) || r; + r = ((glGetQueryBufferObjectuiv = (PFNGLGETQUERYBUFFEROBJECTUIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryBufferObjectuiv")) == NULL) || r; + r = ((glGetTextureImage = (PFNGLGETTEXTUREIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetTextureImage")) == NULL) || r; + r = ((glGetTextureLevelParameterfv = (PFNGLGETTEXTURELEVELPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureLevelParameterfv")) == NULL) || r; + r = ((glGetTextureLevelParameteriv = (PFNGLGETTEXTURELEVELPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureLevelParameteriv")) == NULL) || r; + r = ((glGetTextureParameterIiv = (PFNGLGETTEXTUREPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterIiv")) == NULL) || r; + r = ((glGetTextureParameterIuiv = (PFNGLGETTEXTUREPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterIuiv")) == NULL) || r; + r = ((glGetTextureParameterfv = (PFNGLGETTEXTUREPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterfv")) == NULL) || r; + r = ((glGetTextureParameteriv = (PFNGLGETTEXTUREPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameteriv")) == NULL) || r; + r = ((glGetTransformFeedbacki64_v = (PFNGLGETTRANSFORMFEEDBACKI64_VPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbacki64_v")) == NULL) || r; + r = ((glGetTransformFeedbacki_v = (PFNGLGETTRANSFORMFEEDBACKI_VPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbacki_v")) == NULL) || r; + r = ((glGetTransformFeedbackiv = (PFNGLGETTRANSFORMFEEDBACKIVPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbackiv")) == NULL) || r; + r = ((glGetVertexArrayIndexed64iv = (PFNGLGETVERTEXARRAYINDEXED64IVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayIndexed64iv")) == NULL) || r; + r = ((glGetVertexArrayIndexediv = (PFNGLGETVERTEXARRAYINDEXEDIVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayIndexediv")) == NULL) || r; + r = ((glGetVertexArrayiv = (PFNGLGETVERTEXARRAYIVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayiv")) == NULL) || r; + r = ((glInvalidateNamedFramebufferData = (PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glInvalidateNamedFramebufferData")) == NULL) || r; + r = ((glInvalidateNamedFramebufferSubData = (PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glInvalidateNamedFramebufferSubData")) == NULL) || r; + r = ((glMapNamedBuffer = (PFNGLMAPNAMEDBUFFERPROC)glewGetProcAddress((const GLubyte*)"glMapNamedBuffer")) == NULL) || r; + r = ((glMapNamedBufferRange = (PFNGLMAPNAMEDBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glMapNamedBufferRange")) == NULL) || r; + r = ((glNamedBufferData = (PFNGLNAMEDBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferData")) == NULL) || r; + r = ((glNamedBufferStorage = (PFNGLNAMEDBUFFERSTORAGEPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferStorage")) == NULL) || r; + r = ((glNamedBufferSubData = (PFNGLNAMEDBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferSubData")) == NULL) || r; + r = ((glNamedFramebufferDrawBuffer = (PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferDrawBuffer")) == NULL) || r; + r = ((glNamedFramebufferDrawBuffers = (PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferDrawBuffers")) == NULL) || r; + r = ((glNamedFramebufferParameteri = (PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferParameteri")) == NULL) || r; + r = ((glNamedFramebufferReadBuffer = (PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferReadBuffer")) == NULL) || r; + r = ((glNamedFramebufferRenderbuffer = (PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferRenderbuffer")) == NULL) || r; + r = ((glNamedFramebufferTexture = (PFNGLNAMEDFRAMEBUFFERTEXTUREPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTexture")) == NULL) || r; + r = ((glNamedFramebufferTextureLayer = (PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTextureLayer")) == NULL) || r; + r = ((glNamedRenderbufferStorage = (PFNGLNAMEDRENDERBUFFERSTORAGEPROC)glewGetProcAddress((const GLubyte*)"glNamedRenderbufferStorage")) == NULL) || r; + r = ((glNamedRenderbufferStorageMultisample = (PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glNamedRenderbufferStorageMultisample")) == NULL) || r; + r = ((glTextureBuffer = (PFNGLTEXTUREBUFFERPROC)glewGetProcAddress((const GLubyte*)"glTextureBuffer")) == NULL) || r; + r = ((glTextureBufferRange = (PFNGLTEXTUREBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glTextureBufferRange")) == NULL) || r; + r = ((glTextureParameterIiv = (PFNGLTEXTUREPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterIiv")) == NULL) || r; + r = ((glTextureParameterIuiv = (PFNGLTEXTUREPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterIuiv")) == NULL) || r; + r = ((glTextureParameterf = (PFNGLTEXTUREPARAMETERFPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterf")) == NULL) || r; + r = ((glTextureParameterfv = (PFNGLTEXTUREPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterfv")) == NULL) || r; + r = ((glTextureParameteri = (PFNGLTEXTUREPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glTextureParameteri")) == NULL) || r; + r = ((glTextureParameteriv = (PFNGLTEXTUREPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glTextureParameteriv")) == NULL) || r; + r = ((glTextureStorage1D = (PFNGLTEXTURESTORAGE1DPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage1D")) == NULL) || r; + r = ((glTextureStorage2D = (PFNGLTEXTURESTORAGE2DPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage2D")) == NULL) || r; + r = ((glTextureStorage2DMultisample = (PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage2DMultisample")) == NULL) || r; + r = ((glTextureStorage3D = (PFNGLTEXTURESTORAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage3D")) == NULL) || r; + r = ((glTextureStorage3DMultisample = (PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage3DMultisample")) == NULL) || r; + r = ((glTextureSubImage1D = (PFNGLTEXTURESUBIMAGE1DPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage1D")) == NULL) || r; + r = ((glTextureSubImage2D = (PFNGLTEXTURESUBIMAGE2DPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage2D")) == NULL) || r; + r = ((glTextureSubImage3D = (PFNGLTEXTURESUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage3D")) == NULL) || r; + r = ((glTransformFeedbackBufferBase = (PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackBufferBase")) == NULL) || r; + r = ((glTransformFeedbackBufferRange = (PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackBufferRange")) == NULL) || r; + r = ((glUnmapNamedBuffer = (PFNGLUNMAPNAMEDBUFFERPROC)glewGetProcAddress((const GLubyte*)"glUnmapNamedBuffer")) == NULL) || r; + r = ((glVertexArrayAttribBinding = (PFNGLVERTEXARRAYATTRIBBINDINGPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayAttribBinding")) == NULL) || r; + r = ((glVertexArrayAttribFormat = (PFNGLVERTEXARRAYATTRIBFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayAttribFormat")) == NULL) || r; + r = ((glVertexArrayAttribIFormat = (PFNGLVERTEXARRAYATTRIBIFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayAttribIFormat")) == NULL) || r; + r = ((glVertexArrayAttribLFormat = (PFNGLVERTEXARRAYATTRIBLFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayAttribLFormat")) == NULL) || r; + r = ((glVertexArrayBindingDivisor = (PFNGLVERTEXARRAYBINDINGDIVISORPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayBindingDivisor")) == NULL) || r; + r = ((glVertexArrayElementBuffer = (PFNGLVERTEXARRAYELEMENTBUFFERPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayElementBuffer")) == NULL) || r; + r = ((glVertexArrayVertexBuffer = (PFNGLVERTEXARRAYVERTEXBUFFERPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexBuffer")) == NULL) || r; + r = ((glVertexArrayVertexBuffers = (PFNGLVERTEXARRAYVERTEXBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexBuffers")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_direct_state_access */ + +#ifdef GL_ARB_draw_buffers + +static GLboolean _glewInit_GL_ARB_draw_buffers (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawBuffersARB = (PFNGLDRAWBUFFERSARBPROC)glewGetProcAddress((const GLubyte*)"glDrawBuffersARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_draw_buffers */ + +#ifdef GL_ARB_draw_buffers_blend + +static GLboolean _glewInit_GL_ARB_draw_buffers_blend (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendEquationSeparateiARB = (PFNGLBLENDEQUATIONSEPARATEIARBPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparateiARB")) == NULL) || r; + r = ((glBlendEquationiARB = (PFNGLBLENDEQUATIONIARBPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationiARB")) == NULL) || r; + r = ((glBlendFuncSeparateiARB = (PFNGLBLENDFUNCSEPARATEIARBPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparateiARB")) == NULL) || r; + r = ((glBlendFunciARB = (PFNGLBLENDFUNCIARBPROC)glewGetProcAddress((const GLubyte*)"glBlendFunciARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_draw_buffers_blend */ + +#ifdef GL_ARB_draw_elements_base_vertex + +static GLboolean _glewInit_GL_ARB_draw_elements_base_vertex (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsBaseVertex")) == NULL) || r; + r = ((glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedBaseVertex")) == NULL) || r; + r = ((glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementsBaseVertex")) == NULL) || r; + r = ((glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsBaseVertex")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_draw_elements_base_vertex */ + +#ifdef GL_ARB_draw_indirect + +static GLboolean _glewInit_GL_ARB_draw_indirect (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawArraysIndirect = (PFNGLDRAWARRAYSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysIndirect")) == NULL) || r; + r = ((glDrawElementsIndirect = (PFNGLDRAWELEMENTSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsIndirect")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_draw_indirect */ + +#ifdef GL_ARB_framebuffer_no_attachments + +static GLboolean _glewInit_GL_ARB_framebuffer_no_attachments (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFramebufferParameteri = (PFNGLFRAMEBUFFERPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glFramebufferParameteri")) == NULL) || r; + r = ((glGetFramebufferParameteriv = (PFNGLGETFRAMEBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetFramebufferParameteriv")) == NULL) || r; + r = ((glGetNamedFramebufferParameterivEXT = (PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedFramebufferParameterivEXT")) == NULL) || r; + r = ((glNamedFramebufferParameteriEXT = (PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferParameteriEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_framebuffer_no_attachments */ + +#ifdef GL_ARB_framebuffer_object + +static GLboolean _glewInit_GL_ARB_framebuffer_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBindFramebuffer")) == NULL) || r; + r = ((glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBindRenderbuffer")) == NULL) || r; + r = ((glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBlitFramebuffer")) == NULL) || r; + r = ((glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)glewGetProcAddress((const GLubyte*)"glCheckFramebufferStatus")) == NULL) || r; + r = ((glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteFramebuffers")) == NULL) || r; + r = ((glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteRenderbuffers")) == NULL) || r; + r = ((glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)glewGetProcAddress((const GLubyte*)"glFramebufferRenderbuffer")) == NULL) || r; + r = ((glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture1D")) == NULL) || r; + r = ((glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture2D")) == NULL) || r; + r = ((glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture3D")) == NULL) || r; + r = ((glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureLayer")) == NULL) || r; + r = ((glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glGenFramebuffers")) == NULL) || r; + r = ((glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glGenRenderbuffers")) == NULL) || r; + r = ((glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)glewGetProcAddress((const GLubyte*)"glGenerateMipmap")) == NULL) || r; + r = ((glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetFramebufferAttachmentParameteriv")) == NULL) || r; + r = ((glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetRenderbufferParameteriv")) == NULL) || r; + r = ((glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glIsFramebuffer")) == NULL) || r; + r = ((glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)glewGetProcAddress((const GLubyte*)"glIsRenderbuffer")) == NULL) || r; + r = ((glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorage")) == NULL) || r; + r = ((glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageMultisample")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_framebuffer_object */ + +#ifdef GL_ARB_geometry_shader4 + +static GLboolean _glewInit_GL_ARB_geometry_shader4 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFramebufferTextureARB = (PFNGLFRAMEBUFFERTEXTUREARBPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureARB")) == NULL) || r; + r = ((glFramebufferTextureFaceARB = (PFNGLFRAMEBUFFERTEXTUREFACEARBPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureFaceARB")) == NULL) || r; + r = ((glFramebufferTextureLayerARB = (PFNGLFRAMEBUFFERTEXTURELAYERARBPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureLayerARB")) == NULL) || r; + r = ((glProgramParameteriARB = (PFNGLPROGRAMPARAMETERIARBPROC)glewGetProcAddress((const GLubyte*)"glProgramParameteriARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_geometry_shader4 */ + +#ifdef GL_ARB_get_program_binary + +static GLboolean _glewInit_GL_ARB_get_program_binary (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetProgramBinary = (PFNGLGETPROGRAMBINARYPROC)glewGetProcAddress((const GLubyte*)"glGetProgramBinary")) == NULL) || r; + r = ((glProgramBinary = (PFNGLPROGRAMBINARYPROC)glewGetProcAddress((const GLubyte*)"glProgramBinary")) == NULL) || r; + r = ((glProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glProgramParameteri")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_get_program_binary */ + +#ifdef GL_ARB_get_texture_sub_image + +static GLboolean _glewInit_GL_ARB_get_texture_sub_image (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetCompressedTextureSubImage = (PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTextureSubImage")) == NULL) || r; + r = ((glGetTextureSubImage = (PFNGLGETTEXTURESUBIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetTextureSubImage")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_get_texture_sub_image */ + +#ifdef GL_ARB_gpu_shader_fp64 + +static GLboolean _glewInit_GL_ARB_gpu_shader_fp64 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetUniformdv = (PFNGLGETUNIFORMDVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformdv")) == NULL) || r; + r = ((glUniform1d = (PFNGLUNIFORM1DPROC)glewGetProcAddress((const GLubyte*)"glUniform1d")) == NULL) || r; + r = ((glUniform1dv = (PFNGLUNIFORM1DVPROC)glewGetProcAddress((const GLubyte*)"glUniform1dv")) == NULL) || r; + r = ((glUniform2d = (PFNGLUNIFORM2DPROC)glewGetProcAddress((const GLubyte*)"glUniform2d")) == NULL) || r; + r = ((glUniform2dv = (PFNGLUNIFORM2DVPROC)glewGetProcAddress((const GLubyte*)"glUniform2dv")) == NULL) || r; + r = ((glUniform3d = (PFNGLUNIFORM3DPROC)glewGetProcAddress((const GLubyte*)"glUniform3d")) == NULL) || r; + r = ((glUniform3dv = (PFNGLUNIFORM3DVPROC)glewGetProcAddress((const GLubyte*)"glUniform3dv")) == NULL) || r; + r = ((glUniform4d = (PFNGLUNIFORM4DPROC)glewGetProcAddress((const GLubyte*)"glUniform4d")) == NULL) || r; + r = ((glUniform4dv = (PFNGLUNIFORM4DVPROC)glewGetProcAddress((const GLubyte*)"glUniform4dv")) == NULL) || r; + r = ((glUniformMatrix2dv = (PFNGLUNIFORMMATRIX2DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2dv")) == NULL) || r; + r = ((glUniformMatrix2x3dv = (PFNGLUNIFORMMATRIX2X3DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2x3dv")) == NULL) || r; + r = ((glUniformMatrix2x4dv = (PFNGLUNIFORMMATRIX2X4DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2x4dv")) == NULL) || r; + r = ((glUniformMatrix3dv = (PFNGLUNIFORMMATRIX3DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3dv")) == NULL) || r; + r = ((glUniformMatrix3x2dv = (PFNGLUNIFORMMATRIX3X2DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3x2dv")) == NULL) || r; + r = ((glUniformMatrix3x4dv = (PFNGLUNIFORMMATRIX3X4DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3x4dv")) == NULL) || r; + r = ((glUniformMatrix4dv = (PFNGLUNIFORMMATRIX4DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4dv")) == NULL) || r; + r = ((glUniformMatrix4x2dv = (PFNGLUNIFORMMATRIX4X2DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4x2dv")) == NULL) || r; + r = ((glUniformMatrix4x3dv = (PFNGLUNIFORMMATRIX4X3DVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4x3dv")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_gpu_shader_fp64 */ + +#ifdef GL_ARB_gpu_shader_int64 + +static GLboolean _glewInit_GL_ARB_gpu_shader_int64 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetUniformi64vARB = (PFNGLGETUNIFORMI64VARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformi64vARB")) == NULL) || r; + r = ((glGetUniformui64vARB = (PFNGLGETUNIFORMUI64VARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformui64vARB")) == NULL) || r; + r = ((glGetnUniformi64vARB = (PFNGLGETNUNIFORMI64VARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformi64vARB")) == NULL) || r; + r = ((glGetnUniformui64vARB = (PFNGLGETNUNIFORMUI64VARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformui64vARB")) == NULL) || r; + r = ((glProgramUniform1i64ARB = (PFNGLPROGRAMUNIFORM1I64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i64ARB")) == NULL) || r; + r = ((glProgramUniform1i64vARB = (PFNGLPROGRAMUNIFORM1I64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i64vARB")) == NULL) || r; + r = ((glProgramUniform1ui64ARB = (PFNGLPROGRAMUNIFORM1UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui64ARB")) == NULL) || r; + r = ((glProgramUniform1ui64vARB = (PFNGLPROGRAMUNIFORM1UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui64vARB")) == NULL) || r; + r = ((glProgramUniform2i64ARB = (PFNGLPROGRAMUNIFORM2I64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i64ARB")) == NULL) || r; + r = ((glProgramUniform2i64vARB = (PFNGLPROGRAMUNIFORM2I64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i64vARB")) == NULL) || r; + r = ((glProgramUniform2ui64ARB = (PFNGLPROGRAMUNIFORM2UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui64ARB")) == NULL) || r; + r = ((glProgramUniform2ui64vARB = (PFNGLPROGRAMUNIFORM2UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui64vARB")) == NULL) || r; + r = ((glProgramUniform3i64ARB = (PFNGLPROGRAMUNIFORM3I64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i64ARB")) == NULL) || r; + r = ((glProgramUniform3i64vARB = (PFNGLPROGRAMUNIFORM3I64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i64vARB")) == NULL) || r; + r = ((glProgramUniform3ui64ARB = (PFNGLPROGRAMUNIFORM3UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui64ARB")) == NULL) || r; + r = ((glProgramUniform3ui64vARB = (PFNGLPROGRAMUNIFORM3UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui64vARB")) == NULL) || r; + r = ((glProgramUniform4i64ARB = (PFNGLPROGRAMUNIFORM4I64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i64ARB")) == NULL) || r; + r = ((glProgramUniform4i64vARB = (PFNGLPROGRAMUNIFORM4I64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i64vARB")) == NULL) || r; + r = ((glProgramUniform4ui64ARB = (PFNGLPROGRAMUNIFORM4UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui64ARB")) == NULL) || r; + r = ((glProgramUniform4ui64vARB = (PFNGLPROGRAMUNIFORM4UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui64vARB")) == NULL) || r; + r = ((glUniform1i64ARB = (PFNGLUNIFORM1I64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1i64ARB")) == NULL) || r; + r = ((glUniform1i64vARB = (PFNGLUNIFORM1I64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1i64vARB")) == NULL) || r; + r = ((glUniform1ui64ARB = (PFNGLUNIFORM1UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui64ARB")) == NULL) || r; + r = ((glUniform1ui64vARB = (PFNGLUNIFORM1UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui64vARB")) == NULL) || r; + r = ((glUniform2i64ARB = (PFNGLUNIFORM2I64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2i64ARB")) == NULL) || r; + r = ((glUniform2i64vARB = (PFNGLUNIFORM2I64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2i64vARB")) == NULL) || r; + r = ((glUniform2ui64ARB = (PFNGLUNIFORM2UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui64ARB")) == NULL) || r; + r = ((glUniform2ui64vARB = (PFNGLUNIFORM2UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui64vARB")) == NULL) || r; + r = ((glUniform3i64ARB = (PFNGLUNIFORM3I64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3i64ARB")) == NULL) || r; + r = ((glUniform3i64vARB = (PFNGLUNIFORM3I64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3i64vARB")) == NULL) || r; + r = ((glUniform3ui64ARB = (PFNGLUNIFORM3UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui64ARB")) == NULL) || r; + r = ((glUniform3ui64vARB = (PFNGLUNIFORM3UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui64vARB")) == NULL) || r; + r = ((glUniform4i64ARB = (PFNGLUNIFORM4I64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4i64ARB")) == NULL) || r; + r = ((glUniform4i64vARB = (PFNGLUNIFORM4I64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4i64vARB")) == NULL) || r; + r = ((glUniform4ui64ARB = (PFNGLUNIFORM4UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui64ARB")) == NULL) || r; + r = ((glUniform4ui64vARB = (PFNGLUNIFORM4UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui64vARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_gpu_shader_int64 */ + +#ifdef GL_ARB_imaging + +static GLboolean _glewInit_GL_ARB_imaging (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendEquation = (PFNGLBLENDEQUATIONPROC)glewGetProcAddress((const GLubyte*)"glBlendEquation")) == NULL) || r; + r = ((glColorSubTable = (PFNGLCOLORSUBTABLEPROC)glewGetProcAddress((const GLubyte*)"glColorSubTable")) == NULL) || r; + r = ((glColorTable = (PFNGLCOLORTABLEPROC)glewGetProcAddress((const GLubyte*)"glColorTable")) == NULL) || r; + r = ((glColorTableParameterfv = (PFNGLCOLORTABLEPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameterfv")) == NULL) || r; + r = ((glColorTableParameteriv = (PFNGLCOLORTABLEPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameteriv")) == NULL) || r; + r = ((glConvolutionFilter1D = (PFNGLCONVOLUTIONFILTER1DPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter1D")) == NULL) || r; + r = ((glConvolutionFilter2D = (PFNGLCONVOLUTIONFILTER2DPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter2D")) == NULL) || r; + r = ((glConvolutionParameterf = (PFNGLCONVOLUTIONPARAMETERFPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterf")) == NULL) || r; + r = ((glConvolutionParameterfv = (PFNGLCONVOLUTIONPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterfv")) == NULL) || r; + r = ((glConvolutionParameteri = (PFNGLCONVOLUTIONPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameteri")) == NULL) || r; + r = ((glConvolutionParameteriv = (PFNGLCONVOLUTIONPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameteriv")) == NULL) || r; + r = ((glCopyColorSubTable = (PFNGLCOPYCOLORSUBTABLEPROC)glewGetProcAddress((const GLubyte*)"glCopyColorSubTable")) == NULL) || r; + r = ((glCopyColorTable = (PFNGLCOPYCOLORTABLEPROC)glewGetProcAddress((const GLubyte*)"glCopyColorTable")) == NULL) || r; + r = ((glCopyConvolutionFilter1D = (PFNGLCOPYCONVOLUTIONFILTER1DPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter1D")) == NULL) || r; + r = ((glCopyConvolutionFilter2D = (PFNGLCOPYCONVOLUTIONFILTER2DPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter2D")) == NULL) || r; + r = ((glGetColorTable = (PFNGLGETCOLORTABLEPROC)glewGetProcAddress((const GLubyte*)"glGetColorTable")) == NULL) || r; + r = ((glGetColorTableParameterfv = (PFNGLGETCOLORTABLEPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterfv")) == NULL) || r; + r = ((glGetColorTableParameteriv = (PFNGLGETCOLORTABLEPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameteriv")) == NULL) || r; + r = ((glGetConvolutionFilter = (PFNGLGETCONVOLUTIONFILTERPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionFilter")) == NULL) || r; + r = ((glGetConvolutionParameterfv = (PFNGLGETCONVOLUTIONPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameterfv")) == NULL) || r; + r = ((glGetConvolutionParameteriv = (PFNGLGETCONVOLUTIONPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameteriv")) == NULL) || r; + r = ((glGetHistogram = (PFNGLGETHISTOGRAMPROC)glewGetProcAddress((const GLubyte*)"glGetHistogram")) == NULL) || r; + r = ((glGetHistogramParameterfv = (PFNGLGETHISTOGRAMPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameterfv")) == NULL) || r; + r = ((glGetHistogramParameteriv = (PFNGLGETHISTOGRAMPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameteriv")) == NULL) || r; + r = ((glGetMinmax = (PFNGLGETMINMAXPROC)glewGetProcAddress((const GLubyte*)"glGetMinmax")) == NULL) || r; + r = ((glGetMinmaxParameterfv = (PFNGLGETMINMAXPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameterfv")) == NULL) || r; + r = ((glGetMinmaxParameteriv = (PFNGLGETMINMAXPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameteriv")) == NULL) || r; + r = ((glGetSeparableFilter = (PFNGLGETSEPARABLEFILTERPROC)glewGetProcAddress((const GLubyte*)"glGetSeparableFilter")) == NULL) || r; + r = ((glHistogram = (PFNGLHISTOGRAMPROC)glewGetProcAddress((const GLubyte*)"glHistogram")) == NULL) || r; + r = ((glMinmax = (PFNGLMINMAXPROC)glewGetProcAddress((const GLubyte*)"glMinmax")) == NULL) || r; + r = ((glResetHistogram = (PFNGLRESETHISTOGRAMPROC)glewGetProcAddress((const GLubyte*)"glResetHistogram")) == NULL) || r; + r = ((glResetMinmax = (PFNGLRESETMINMAXPROC)glewGetProcAddress((const GLubyte*)"glResetMinmax")) == NULL) || r; + r = ((glSeparableFilter2D = (PFNGLSEPARABLEFILTER2DPROC)glewGetProcAddress((const GLubyte*)"glSeparableFilter2D")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_imaging */ + +#ifdef GL_ARB_indirect_parameters + +static GLboolean _glewInit_GL_ARB_indirect_parameters (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMultiDrawArraysIndirectCountARB = (PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirectCountARB")) == NULL) || r; + r = ((glMultiDrawElementsIndirectCountARB = (PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirectCountARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_indirect_parameters */ + +#ifdef GL_ARB_instanced_arrays + +static GLboolean _glewInit_GL_ARB_instanced_arrays (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawArraysInstancedARB = (PFNGLDRAWARRAYSINSTANCEDARBPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstancedARB")) == NULL) || r; + r = ((glDrawElementsInstancedARB = (PFNGLDRAWELEMENTSINSTANCEDARBPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedARB")) == NULL) || r; + r = ((glVertexAttribDivisorARB = (PFNGLVERTEXATTRIBDIVISORARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribDivisorARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_instanced_arrays */ + +#ifdef GL_ARB_internalformat_query + +static GLboolean _glewInit_GL_ARB_internalformat_query (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetInternalformativ = (PFNGLGETINTERNALFORMATIVPROC)glewGetProcAddress((const GLubyte*)"glGetInternalformativ")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_internalformat_query */ + +#ifdef GL_ARB_internalformat_query2 + +static GLboolean _glewInit_GL_ARB_internalformat_query2 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetInternalformati64v = (PFNGLGETINTERNALFORMATI64VPROC)glewGetProcAddress((const GLubyte*)"glGetInternalformati64v")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_internalformat_query2 */ + +#ifdef GL_ARB_invalidate_subdata + +static GLboolean _glewInit_GL_ARB_invalidate_subdata (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glInvalidateBufferData = (PFNGLINVALIDATEBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glInvalidateBufferData")) == NULL) || r; + r = ((glInvalidateBufferSubData = (PFNGLINVALIDATEBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glInvalidateBufferSubData")) == NULL) || r; + r = ((glInvalidateFramebuffer = (PFNGLINVALIDATEFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glInvalidateFramebuffer")) == NULL) || r; + r = ((glInvalidateSubFramebuffer = (PFNGLINVALIDATESUBFRAMEBUFFERPROC)glewGetProcAddress((const GLubyte*)"glInvalidateSubFramebuffer")) == NULL) || r; + r = ((glInvalidateTexImage = (PFNGLINVALIDATETEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glInvalidateTexImage")) == NULL) || r; + r = ((glInvalidateTexSubImage = (PFNGLINVALIDATETEXSUBIMAGEPROC)glewGetProcAddress((const GLubyte*)"glInvalidateTexSubImage")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_invalidate_subdata */ + +#ifdef GL_ARB_map_buffer_range + +static GLboolean _glewInit_GL_ARB_map_buffer_range (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glFlushMappedBufferRange")) == NULL) || r; + r = ((glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glMapBufferRange")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_map_buffer_range */ + +#ifdef GL_ARB_matrix_palette + +static GLboolean _glewInit_GL_ARB_matrix_palette (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCurrentPaletteMatrixARB = (PFNGLCURRENTPALETTEMATRIXARBPROC)glewGetProcAddress((const GLubyte*)"glCurrentPaletteMatrixARB")) == NULL) || r; + r = ((glMatrixIndexPointerARB = (PFNGLMATRIXINDEXPOINTERARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexPointerARB")) == NULL) || r; + r = ((glMatrixIndexubvARB = (PFNGLMATRIXINDEXUBVARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexubvARB")) == NULL) || r; + r = ((glMatrixIndexuivARB = (PFNGLMATRIXINDEXUIVARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexuivARB")) == NULL) || r; + r = ((glMatrixIndexusvARB = (PFNGLMATRIXINDEXUSVARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexusvARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_matrix_palette */ + +#ifdef GL_ARB_multi_bind + +static GLboolean _glewInit_GL_ARB_multi_bind (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindBuffersBase = (PFNGLBINDBUFFERSBASEPROC)glewGetProcAddress((const GLubyte*)"glBindBuffersBase")) == NULL) || r; + r = ((glBindBuffersRange = (PFNGLBINDBUFFERSRANGEPROC)glewGetProcAddress((const GLubyte*)"glBindBuffersRange")) == NULL) || r; + r = ((glBindImageTextures = (PFNGLBINDIMAGETEXTURESPROC)glewGetProcAddress((const GLubyte*)"glBindImageTextures")) == NULL) || r; + r = ((glBindSamplers = (PFNGLBINDSAMPLERSPROC)glewGetProcAddress((const GLubyte*)"glBindSamplers")) == NULL) || r; + r = ((glBindTextures = (PFNGLBINDTEXTURESPROC)glewGetProcAddress((const GLubyte*)"glBindTextures")) == NULL) || r; + r = ((glBindVertexBuffers = (PFNGLBINDVERTEXBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glBindVertexBuffers")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_multi_bind */ + +#ifdef GL_ARB_multi_draw_indirect + +static GLboolean _glewInit_GL_ARB_multi_draw_indirect (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMultiDrawArraysIndirect = (PFNGLMULTIDRAWARRAYSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirect")) == NULL) || r; + r = ((glMultiDrawElementsIndirect = (PFNGLMULTIDRAWELEMENTSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirect")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_multi_draw_indirect */ + +#ifdef GL_ARB_multisample + +static GLboolean _glewInit_GL_ARB_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glSampleCoverageARB = (PFNGLSAMPLECOVERAGEARBPROC)glewGetProcAddress((const GLubyte*)"glSampleCoverageARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_multisample */ + +#ifdef GL_ARB_multitexture + +static GLboolean _glewInit_GL_ARB_multitexture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)glewGetProcAddress((const GLubyte*)"glActiveTextureARB")) == NULL) || r; + r = ((glClientActiveTextureARB = (PFNGLCLIENTACTIVETEXTUREARBPROC)glewGetProcAddress((const GLubyte*)"glClientActiveTextureARB")) == NULL) || r; + r = ((glMultiTexCoord1dARB = (PFNGLMULTITEXCOORD1DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1dARB")) == NULL) || r; + r = ((glMultiTexCoord1dvARB = (PFNGLMULTITEXCOORD1DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1dvARB")) == NULL) || r; + r = ((glMultiTexCoord1fARB = (PFNGLMULTITEXCOORD1FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1fARB")) == NULL) || r; + r = ((glMultiTexCoord1fvARB = (PFNGLMULTITEXCOORD1FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1fvARB")) == NULL) || r; + r = ((glMultiTexCoord1iARB = (PFNGLMULTITEXCOORD1IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1iARB")) == NULL) || r; + r = ((glMultiTexCoord1ivARB = (PFNGLMULTITEXCOORD1IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1ivARB")) == NULL) || r; + r = ((glMultiTexCoord1sARB = (PFNGLMULTITEXCOORD1SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1sARB")) == NULL) || r; + r = ((glMultiTexCoord1svARB = (PFNGLMULTITEXCOORD1SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1svARB")) == NULL) || r; + r = ((glMultiTexCoord2dARB = (PFNGLMULTITEXCOORD2DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2dARB")) == NULL) || r; + r = ((glMultiTexCoord2dvARB = (PFNGLMULTITEXCOORD2DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2dvARB")) == NULL) || r; + r = ((glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2fARB")) == NULL) || r; + r = ((glMultiTexCoord2fvARB = (PFNGLMULTITEXCOORD2FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2fvARB")) == NULL) || r; + r = ((glMultiTexCoord2iARB = (PFNGLMULTITEXCOORD2IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2iARB")) == NULL) || r; + r = ((glMultiTexCoord2ivARB = (PFNGLMULTITEXCOORD2IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2ivARB")) == NULL) || r; + r = ((glMultiTexCoord2sARB = (PFNGLMULTITEXCOORD2SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2sARB")) == NULL) || r; + r = ((glMultiTexCoord2svARB = (PFNGLMULTITEXCOORD2SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2svARB")) == NULL) || r; + r = ((glMultiTexCoord3dARB = (PFNGLMULTITEXCOORD3DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3dARB")) == NULL) || r; + r = ((glMultiTexCoord3dvARB = (PFNGLMULTITEXCOORD3DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3dvARB")) == NULL) || r; + r = ((glMultiTexCoord3fARB = (PFNGLMULTITEXCOORD3FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3fARB")) == NULL) || r; + r = ((glMultiTexCoord3fvARB = (PFNGLMULTITEXCOORD3FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3fvARB")) == NULL) || r; + r = ((glMultiTexCoord3iARB = (PFNGLMULTITEXCOORD3IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3iARB")) == NULL) || r; + r = ((glMultiTexCoord3ivARB = (PFNGLMULTITEXCOORD3IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3ivARB")) == NULL) || r; + r = ((glMultiTexCoord3sARB = (PFNGLMULTITEXCOORD3SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3sARB")) == NULL) || r; + r = ((glMultiTexCoord3svARB = (PFNGLMULTITEXCOORD3SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3svARB")) == NULL) || r; + r = ((glMultiTexCoord4dARB = (PFNGLMULTITEXCOORD4DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4dARB")) == NULL) || r; + r = ((glMultiTexCoord4dvARB = (PFNGLMULTITEXCOORD4DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4dvARB")) == NULL) || r; + r = ((glMultiTexCoord4fARB = (PFNGLMULTITEXCOORD4FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4fARB")) == NULL) || r; + r = ((glMultiTexCoord4fvARB = (PFNGLMULTITEXCOORD4FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4fvARB")) == NULL) || r; + r = ((glMultiTexCoord4iARB = (PFNGLMULTITEXCOORD4IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4iARB")) == NULL) || r; + r = ((glMultiTexCoord4ivARB = (PFNGLMULTITEXCOORD4IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4ivARB")) == NULL) || r; + r = ((glMultiTexCoord4sARB = (PFNGLMULTITEXCOORD4SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4sARB")) == NULL) || r; + r = ((glMultiTexCoord4svARB = (PFNGLMULTITEXCOORD4SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4svARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_multitexture */ + +#ifdef GL_ARB_occlusion_query + +static GLboolean _glewInit_GL_ARB_occlusion_query (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginQueryARB = (PFNGLBEGINQUERYARBPROC)glewGetProcAddress((const GLubyte*)"glBeginQueryARB")) == NULL) || r; + r = ((glDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteQueriesARB")) == NULL) || r; + r = ((glEndQueryARB = (PFNGLENDQUERYARBPROC)glewGetProcAddress((const GLubyte*)"glEndQueryARB")) == NULL) || r; + r = ((glGenQueriesARB = (PFNGLGENQUERIESARBPROC)glewGetProcAddress((const GLubyte*)"glGenQueriesARB")) == NULL) || r; + r = ((glGetQueryObjectivARB = (PFNGLGETQUERYOBJECTIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectivARB")) == NULL) || r; + r = ((glGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectuivARB")) == NULL) || r; + r = ((glGetQueryivARB = (PFNGLGETQUERYIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetQueryivARB")) == NULL) || r; + r = ((glIsQueryARB = (PFNGLISQUERYARBPROC)glewGetProcAddress((const GLubyte*)"glIsQueryARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_occlusion_query */ + +#ifdef GL_ARB_parallel_shader_compile + +static GLboolean _glewInit_GL_ARB_parallel_shader_compile (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMaxShaderCompilerThreadsARB = (PFNGLMAXSHADERCOMPILERTHREADSARBPROC)glewGetProcAddress((const GLubyte*)"glMaxShaderCompilerThreadsARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_parallel_shader_compile */ + +#ifdef GL_ARB_point_parameters + +static GLboolean _glewInit_GL_ARB_point_parameters (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfARB")) == NULL) || r; + r = ((glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfvARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_point_parameters */ + +#ifdef GL_ARB_program_interface_query + +static GLboolean _glewInit_GL_ARB_program_interface_query (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetProgramInterfaceiv = (PFNGLGETPROGRAMINTERFACEIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramInterfaceiv")) == NULL) || r; + r = ((glGetProgramResourceIndex = (PFNGLGETPROGRAMRESOURCEINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceIndex")) == NULL) || r; + r = ((glGetProgramResourceLocation = (PFNGLGETPROGRAMRESOURCELOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceLocation")) == NULL) || r; + r = ((glGetProgramResourceLocationIndex = (PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceLocationIndex")) == NULL) || r; + r = ((glGetProgramResourceName = (PFNGLGETPROGRAMRESOURCENAMEPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceName")) == NULL) || r; + r = ((glGetProgramResourceiv = (PFNGLGETPROGRAMRESOURCEIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourceiv")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_program_interface_query */ + +#ifdef GL_ARB_provoking_vertex + +static GLboolean _glewInit_GL_ARB_provoking_vertex (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC)glewGetProcAddress((const GLubyte*)"glProvokingVertex")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_provoking_vertex */ + +#ifdef GL_ARB_robustness + +static GLboolean _glewInit_GL_ARB_robustness (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetGraphicsResetStatusARB = (PFNGLGETGRAPHICSRESETSTATUSARBPROC)glewGetProcAddress((const GLubyte*)"glGetGraphicsResetStatusARB")) == NULL) || r; + r = ((glGetnColorTableARB = (PFNGLGETNCOLORTABLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetnColorTableARB")) == NULL) || r; + r = ((glGetnCompressedTexImageARB = (PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"glGetnCompressedTexImageARB")) == NULL) || r; + r = ((glGetnConvolutionFilterARB = (PFNGLGETNCONVOLUTIONFILTERARBPROC)glewGetProcAddress((const GLubyte*)"glGetnConvolutionFilterARB")) == NULL) || r; + r = ((glGetnHistogramARB = (PFNGLGETNHISTOGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glGetnHistogramARB")) == NULL) || r; + r = ((glGetnMapdvARB = (PFNGLGETNMAPDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnMapdvARB")) == NULL) || r; + r = ((glGetnMapfvARB = (PFNGLGETNMAPFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnMapfvARB")) == NULL) || r; + r = ((glGetnMapivARB = (PFNGLGETNMAPIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnMapivARB")) == NULL) || r; + r = ((glGetnMinmaxARB = (PFNGLGETNMINMAXARBPROC)glewGetProcAddress((const GLubyte*)"glGetnMinmaxARB")) == NULL) || r; + r = ((glGetnPixelMapfvARB = (PFNGLGETNPIXELMAPFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnPixelMapfvARB")) == NULL) || r; + r = ((glGetnPixelMapuivARB = (PFNGLGETNPIXELMAPUIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnPixelMapuivARB")) == NULL) || r; + r = ((glGetnPixelMapusvARB = (PFNGLGETNPIXELMAPUSVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnPixelMapusvARB")) == NULL) || r; + r = ((glGetnPolygonStippleARB = (PFNGLGETNPOLYGONSTIPPLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetnPolygonStippleARB")) == NULL) || r; + r = ((glGetnSeparableFilterARB = (PFNGLGETNSEPARABLEFILTERARBPROC)glewGetProcAddress((const GLubyte*)"glGetnSeparableFilterARB")) == NULL) || r; + r = ((glGetnTexImageARB = (PFNGLGETNTEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"glGetnTexImageARB")) == NULL) || r; + r = ((glGetnUniformdvARB = (PFNGLGETNUNIFORMDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformdvARB")) == NULL) || r; + r = ((glGetnUniformfvARB = (PFNGLGETNUNIFORMFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformfvARB")) == NULL) || r; + r = ((glGetnUniformivARB = (PFNGLGETNUNIFORMIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformivARB")) == NULL) || r; + r = ((glGetnUniformuivARB = (PFNGLGETNUNIFORMUIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformuivARB")) == NULL) || r; + r = ((glReadnPixelsARB = (PFNGLREADNPIXELSARBPROC)glewGetProcAddress((const GLubyte*)"glReadnPixelsARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_robustness */ + +#ifdef GL_ARB_sample_locations + +static GLboolean _glewInit_GL_ARB_sample_locations (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFramebufferSampleLocationsfvARB = (PFNGLFRAMEBUFFERSAMPLELOCATIONSFVARBPROC)glewGetProcAddress((const GLubyte*)"glFramebufferSampleLocationsfvARB")) == NULL) || r; + r = ((glNamedFramebufferSampleLocationsfvARB = (PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVARBPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferSampleLocationsfvARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_sample_locations */ + +#ifdef GL_ARB_sample_shading + +static GLboolean _glewInit_GL_ARB_sample_shading (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMinSampleShadingARB = (PFNGLMINSAMPLESHADINGARBPROC)glewGetProcAddress((const GLubyte*)"glMinSampleShadingARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_sample_shading */ + +#ifdef GL_ARB_sampler_objects + +static GLboolean _glewInit_GL_ARB_sampler_objects (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindSampler = (PFNGLBINDSAMPLERPROC)glewGetProcAddress((const GLubyte*)"glBindSampler")) == NULL) || r; + r = ((glDeleteSamplers = (PFNGLDELETESAMPLERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteSamplers")) == NULL) || r; + r = ((glGenSamplers = (PFNGLGENSAMPLERSPROC)glewGetProcAddress((const GLubyte*)"glGenSamplers")) == NULL) || r; + r = ((glGetSamplerParameterIiv = (PFNGLGETSAMPLERPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glGetSamplerParameterIiv")) == NULL) || r; + r = ((glGetSamplerParameterIuiv = (PFNGLGETSAMPLERPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glGetSamplerParameterIuiv")) == NULL) || r; + r = ((glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetSamplerParameterfv")) == NULL) || r; + r = ((glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetSamplerParameteriv")) == NULL) || r; + r = ((glIsSampler = (PFNGLISSAMPLERPROC)glewGetProcAddress((const GLubyte*)"glIsSampler")) == NULL) || r; + r = ((glSamplerParameterIiv = (PFNGLSAMPLERPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameterIiv")) == NULL) || r; + r = ((glSamplerParameterIuiv = (PFNGLSAMPLERPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameterIuiv")) == NULL) || r; + r = ((glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameterf")) == NULL) || r; + r = ((glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameterfv")) == NULL) || r; + r = ((glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameteri")) == NULL) || r; + r = ((glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glSamplerParameteriv")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_sampler_objects */ + +#ifdef GL_ARB_separate_shader_objects + +static GLboolean _glewInit_GL_ARB_separate_shader_objects (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glActiveShaderProgram = (PFNGLACTIVESHADERPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glActiveShaderProgram")) == NULL) || r; + r = ((glBindProgramPipeline = (PFNGLBINDPROGRAMPIPELINEPROC)glewGetProcAddress((const GLubyte*)"glBindProgramPipeline")) == NULL) || r; + r = ((glCreateShaderProgramv = (PFNGLCREATESHADERPROGRAMVPROC)glewGetProcAddress((const GLubyte*)"glCreateShaderProgramv")) == NULL) || r; + r = ((glDeleteProgramPipelines = (PFNGLDELETEPROGRAMPIPELINESPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgramPipelines")) == NULL) || r; + r = ((glGenProgramPipelines = (PFNGLGENPROGRAMPIPELINESPROC)glewGetProcAddress((const GLubyte*)"glGenProgramPipelines")) == NULL) || r; + r = ((glGetProgramPipelineInfoLog = (PFNGLGETPROGRAMPIPELINEINFOLOGPROC)glewGetProcAddress((const GLubyte*)"glGetProgramPipelineInfoLog")) == NULL) || r; + r = ((glGetProgramPipelineiv = (PFNGLGETPROGRAMPIPELINEIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramPipelineiv")) == NULL) || r; + r = ((glIsProgramPipeline = (PFNGLISPROGRAMPIPELINEPROC)glewGetProcAddress((const GLubyte*)"glIsProgramPipeline")) == NULL) || r; + r = ((glProgramUniform1d = (PFNGLPROGRAMUNIFORM1DPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1d")) == NULL) || r; + r = ((glProgramUniform1dv = (PFNGLPROGRAMUNIFORM1DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1dv")) == NULL) || r; + r = ((glProgramUniform1f = (PFNGLPROGRAMUNIFORM1FPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1f")) == NULL) || r; + r = ((glProgramUniform1fv = (PFNGLPROGRAMUNIFORM1FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1fv")) == NULL) || r; + r = ((glProgramUniform1i = (PFNGLPROGRAMUNIFORM1IPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i")) == NULL) || r; + r = ((glProgramUniform1iv = (PFNGLPROGRAMUNIFORM1IVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1iv")) == NULL) || r; + r = ((glProgramUniform1ui = (PFNGLPROGRAMUNIFORM1UIPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui")) == NULL) || r; + r = ((glProgramUniform1uiv = (PFNGLPROGRAMUNIFORM1UIVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1uiv")) == NULL) || r; + r = ((glProgramUniform2d = (PFNGLPROGRAMUNIFORM2DPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2d")) == NULL) || r; + r = ((glProgramUniform2dv = (PFNGLPROGRAMUNIFORM2DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2dv")) == NULL) || r; + r = ((glProgramUniform2f = (PFNGLPROGRAMUNIFORM2FPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2f")) == NULL) || r; + r = ((glProgramUniform2fv = (PFNGLPROGRAMUNIFORM2FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2fv")) == NULL) || r; + r = ((glProgramUniform2i = (PFNGLPROGRAMUNIFORM2IPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i")) == NULL) || r; + r = ((glProgramUniform2iv = (PFNGLPROGRAMUNIFORM2IVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2iv")) == NULL) || r; + r = ((glProgramUniform2ui = (PFNGLPROGRAMUNIFORM2UIPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui")) == NULL) || r; + r = ((glProgramUniform2uiv = (PFNGLPROGRAMUNIFORM2UIVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2uiv")) == NULL) || r; + r = ((glProgramUniform3d = (PFNGLPROGRAMUNIFORM3DPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3d")) == NULL) || r; + r = ((glProgramUniform3dv = (PFNGLPROGRAMUNIFORM3DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3dv")) == NULL) || r; + r = ((glProgramUniform3f = (PFNGLPROGRAMUNIFORM3FPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3f")) == NULL) || r; + r = ((glProgramUniform3fv = (PFNGLPROGRAMUNIFORM3FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3fv")) == NULL) || r; + r = ((glProgramUniform3i = (PFNGLPROGRAMUNIFORM3IPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i")) == NULL) || r; + r = ((glProgramUniform3iv = (PFNGLPROGRAMUNIFORM3IVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3iv")) == NULL) || r; + r = ((glProgramUniform3ui = (PFNGLPROGRAMUNIFORM3UIPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui")) == NULL) || r; + r = ((glProgramUniform3uiv = (PFNGLPROGRAMUNIFORM3UIVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3uiv")) == NULL) || r; + r = ((glProgramUniform4d = (PFNGLPROGRAMUNIFORM4DPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4d")) == NULL) || r; + r = ((glProgramUniform4dv = (PFNGLPROGRAMUNIFORM4DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4dv")) == NULL) || r; + r = ((glProgramUniform4f = (PFNGLPROGRAMUNIFORM4FPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4f")) == NULL) || r; + r = ((glProgramUniform4fv = (PFNGLPROGRAMUNIFORM4FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4fv")) == NULL) || r; + r = ((glProgramUniform4i = (PFNGLPROGRAMUNIFORM4IPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i")) == NULL) || r; + r = ((glProgramUniform4iv = (PFNGLPROGRAMUNIFORM4IVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4iv")) == NULL) || r; + r = ((glProgramUniform4ui = (PFNGLPROGRAMUNIFORM4UIPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui")) == NULL) || r; + r = ((glProgramUniform4uiv = (PFNGLPROGRAMUNIFORM4UIVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4uiv")) == NULL) || r; + r = ((glProgramUniformMatrix2dv = (PFNGLPROGRAMUNIFORMMATRIX2DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2dv")) == NULL) || r; + r = ((glProgramUniformMatrix2fv = (PFNGLPROGRAMUNIFORMMATRIX2FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2fv")) == NULL) || r; + r = ((glProgramUniformMatrix2x3dv = (PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x3dv")) == NULL) || r; + r = ((glProgramUniformMatrix2x3fv = (PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x3fv")) == NULL) || r; + r = ((glProgramUniformMatrix2x4dv = (PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x4dv")) == NULL) || r; + r = ((glProgramUniformMatrix2x4fv = (PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x4fv")) == NULL) || r; + r = ((glProgramUniformMatrix3dv = (PFNGLPROGRAMUNIFORMMATRIX3DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3dv")) == NULL) || r; + r = ((glProgramUniformMatrix3fv = (PFNGLPROGRAMUNIFORMMATRIX3FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3fv")) == NULL) || r; + r = ((glProgramUniformMatrix3x2dv = (PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x2dv")) == NULL) || r; + r = ((glProgramUniformMatrix3x2fv = (PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x2fv")) == NULL) || r; + r = ((glProgramUniformMatrix3x4dv = (PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x4dv")) == NULL) || r; + r = ((glProgramUniformMatrix3x4fv = (PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x4fv")) == NULL) || r; + r = ((glProgramUniformMatrix4dv = (PFNGLPROGRAMUNIFORMMATRIX4DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4dv")) == NULL) || r; + r = ((glProgramUniformMatrix4fv = (PFNGLPROGRAMUNIFORMMATRIX4FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4fv")) == NULL) || r; + r = ((glProgramUniformMatrix4x2dv = (PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x2dv")) == NULL) || r; + r = ((glProgramUniformMatrix4x2fv = (PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x2fv")) == NULL) || r; + r = ((glProgramUniformMatrix4x3dv = (PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x3dv")) == NULL) || r; + r = ((glProgramUniformMatrix4x3fv = (PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x3fv")) == NULL) || r; + r = ((glUseProgramStages = (PFNGLUSEPROGRAMSTAGESPROC)glewGetProcAddress((const GLubyte*)"glUseProgramStages")) == NULL) || r; + r = ((glValidateProgramPipeline = (PFNGLVALIDATEPROGRAMPIPELINEPROC)glewGetProcAddress((const GLubyte*)"glValidateProgramPipeline")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_separate_shader_objects */ + +#ifdef GL_ARB_shader_atomic_counters + +static GLboolean _glewInit_GL_ARB_shader_atomic_counters (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetActiveAtomicCounterBufferiv = (PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveAtomicCounterBufferiv")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_shader_atomic_counters */ + +#ifdef GL_ARB_shader_image_load_store + +static GLboolean _glewInit_GL_ARB_shader_image_load_store (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindImageTexture = (PFNGLBINDIMAGETEXTUREPROC)glewGetProcAddress((const GLubyte*)"glBindImageTexture")) == NULL) || r; + r = ((glMemoryBarrier = (PFNGLMEMORYBARRIERPROC)glewGetProcAddress((const GLubyte*)"glMemoryBarrier")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_shader_image_load_store */ + +#ifdef GL_ARB_shader_objects + +static GLboolean _glewInit_GL_ARB_shader_objects (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glAttachObjectARB")) == NULL) || r; + r = ((glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)glewGetProcAddress((const GLubyte*)"glCompileShaderARB")) == NULL) || r; + r = ((glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glCreateProgramObjectARB")) == NULL) || r; + r = ((glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glCreateShaderObjectARB")) == NULL) || r; + r = ((glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteObjectARB")) == NULL) || r; + r = ((glDetachObjectARB = (PFNGLDETACHOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glDetachObjectARB")) == NULL) || r; + r = ((glGetActiveUniformARB = (PFNGLGETACTIVEUNIFORMARBPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformARB")) == NULL) || r; + r = ((glGetAttachedObjectsARB = (PFNGLGETATTACHEDOBJECTSARBPROC)glewGetProcAddress((const GLubyte*)"glGetAttachedObjectsARB")) == NULL) || r; + r = ((glGetHandleARB = (PFNGLGETHANDLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetHandleARB")) == NULL) || r; + r = ((glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)glewGetProcAddress((const GLubyte*)"glGetInfoLogARB")) == NULL) || r; + r = ((glGetObjectParameterfvARB = (PFNGLGETOBJECTPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetObjectParameterfvARB")) == NULL) || r; + r = ((glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetObjectParameterivARB")) == NULL) || r; + r = ((glGetShaderSourceARB = (PFNGLGETSHADERSOURCEARBPROC)glewGetProcAddress((const GLubyte*)"glGetShaderSourceARB")) == NULL) || r; + r = ((glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformLocationARB")) == NULL) || r; + r = ((glGetUniformfvARB = (PFNGLGETUNIFORMFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformfvARB")) == NULL) || r; + r = ((glGetUniformivARB = (PFNGLGETUNIFORMIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformivARB")) == NULL) || r; + r = ((glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glLinkProgramARB")) == NULL) || r; + r = ((glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)glewGetProcAddress((const GLubyte*)"glShaderSourceARB")) == NULL) || r; + r = ((glUniform1fARB = (PFNGLUNIFORM1FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1fARB")) == NULL) || r; + r = ((glUniform1fvARB = (PFNGLUNIFORM1FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1fvARB")) == NULL) || r; + r = ((glUniform1iARB = (PFNGLUNIFORM1IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1iARB")) == NULL) || r; + r = ((glUniform1ivARB = (PFNGLUNIFORM1IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1ivARB")) == NULL) || r; + r = ((glUniform2fARB = (PFNGLUNIFORM2FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2fARB")) == NULL) || r; + r = ((glUniform2fvARB = (PFNGLUNIFORM2FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2fvARB")) == NULL) || r; + r = ((glUniform2iARB = (PFNGLUNIFORM2IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2iARB")) == NULL) || r; + r = ((glUniform2ivARB = (PFNGLUNIFORM2IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2ivARB")) == NULL) || r; + r = ((glUniform3fARB = (PFNGLUNIFORM3FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3fARB")) == NULL) || r; + r = ((glUniform3fvARB = (PFNGLUNIFORM3FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3fvARB")) == NULL) || r; + r = ((glUniform3iARB = (PFNGLUNIFORM3IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3iARB")) == NULL) || r; + r = ((glUniform3ivARB = (PFNGLUNIFORM3IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3ivARB")) == NULL) || r; + r = ((glUniform4fARB = (PFNGLUNIFORM4FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4fARB")) == NULL) || r; + r = ((glUniform4fvARB = (PFNGLUNIFORM4FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4fvARB")) == NULL) || r; + r = ((glUniform4iARB = (PFNGLUNIFORM4IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4iARB")) == NULL) || r; + r = ((glUniform4ivARB = (PFNGLUNIFORM4IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4ivARB")) == NULL) || r; + r = ((glUniformMatrix2fvARB = (PFNGLUNIFORMMATRIX2FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2fvARB")) == NULL) || r; + r = ((glUniformMatrix3fvARB = (PFNGLUNIFORMMATRIX3FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3fvARB")) == NULL) || r; + r = ((glUniformMatrix4fvARB = (PFNGLUNIFORMMATRIX4FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4fvARB")) == NULL) || r; + r = ((glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glUseProgramObjectARB")) == NULL) || r; + r = ((glValidateProgramARB = (PFNGLVALIDATEPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glValidateProgramARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_shader_objects */ + +#ifdef GL_ARB_shader_storage_buffer_object + +static GLboolean _glewInit_GL_ARB_shader_storage_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glShaderStorageBlockBinding = (PFNGLSHADERSTORAGEBLOCKBINDINGPROC)glewGetProcAddress((const GLubyte*)"glShaderStorageBlockBinding")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_shader_storage_buffer_object */ + +#ifdef GL_ARB_shader_subroutine + +static GLboolean _glewInit_GL_ARB_shader_subroutine (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetActiveSubroutineName = (PFNGLGETACTIVESUBROUTINENAMEPROC)glewGetProcAddress((const GLubyte*)"glGetActiveSubroutineName")) == NULL) || r; + r = ((glGetActiveSubroutineUniformName = (PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC)glewGetProcAddress((const GLubyte*)"glGetActiveSubroutineUniformName")) == NULL) || r; + r = ((glGetActiveSubroutineUniformiv = (PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveSubroutineUniformiv")) == NULL) || r; + r = ((glGetProgramStageiv = (PFNGLGETPROGRAMSTAGEIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramStageiv")) == NULL) || r; + r = ((glGetSubroutineIndex = (PFNGLGETSUBROUTINEINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetSubroutineIndex")) == NULL) || r; + r = ((glGetSubroutineUniformLocation = (PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetSubroutineUniformLocation")) == NULL) || r; + r = ((glGetUniformSubroutineuiv = (PFNGLGETUNIFORMSUBROUTINEUIVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformSubroutineuiv")) == NULL) || r; + r = ((glUniformSubroutinesuiv = (PFNGLUNIFORMSUBROUTINESUIVPROC)glewGetProcAddress((const GLubyte*)"glUniformSubroutinesuiv")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_shader_subroutine */ + +#ifdef GL_ARB_shading_language_include + +static GLboolean _glewInit_GL_ARB_shading_language_include (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCompileShaderIncludeARB = (PFNGLCOMPILESHADERINCLUDEARBPROC)glewGetProcAddress((const GLubyte*)"glCompileShaderIncludeARB")) == NULL) || r; + r = ((glDeleteNamedStringARB = (PFNGLDELETENAMEDSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteNamedStringARB")) == NULL) || r; + r = ((glGetNamedStringARB = (PFNGLGETNAMEDSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glGetNamedStringARB")) == NULL) || r; + r = ((glGetNamedStringivARB = (PFNGLGETNAMEDSTRINGIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetNamedStringivARB")) == NULL) || r; + r = ((glIsNamedStringARB = (PFNGLISNAMEDSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glIsNamedStringARB")) == NULL) || r; + r = ((glNamedStringARB = (PFNGLNAMEDSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glNamedStringARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_shading_language_include */ + +#ifdef GL_ARB_sparse_buffer + +static GLboolean _glewInit_GL_ARB_sparse_buffer (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBufferPageCommitmentARB = (PFNGLBUFFERPAGECOMMITMENTARBPROC)glewGetProcAddress((const GLubyte*)"glBufferPageCommitmentARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_sparse_buffer */ + +#ifdef GL_ARB_sparse_texture + +static GLboolean _glewInit_GL_ARB_sparse_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexPageCommitmentARB = (PFNGLTEXPAGECOMMITMENTARBPROC)glewGetProcAddress((const GLubyte*)"glTexPageCommitmentARB")) == NULL) || r; + r = ((glTexturePageCommitmentEXT = (PFNGLTEXTUREPAGECOMMITMENTEXTPROC)glewGetProcAddress((const GLubyte*)"glTexturePageCommitmentEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_sparse_texture */ + +#ifdef GL_ARB_sync + +static GLboolean _glewInit_GL_ARB_sync (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)glewGetProcAddress((const GLubyte*)"glClientWaitSync")) == NULL) || r; + r = ((glDeleteSync = (PFNGLDELETESYNCPROC)glewGetProcAddress((const GLubyte*)"glDeleteSync")) == NULL) || r; + r = ((glFenceSync = (PFNGLFENCESYNCPROC)glewGetProcAddress((const GLubyte*)"glFenceSync")) == NULL) || r; + r = ((glGetInteger64v = (PFNGLGETINTEGER64VPROC)glewGetProcAddress((const GLubyte*)"glGetInteger64v")) == NULL) || r; + r = ((glGetSynciv = (PFNGLGETSYNCIVPROC)glewGetProcAddress((const GLubyte*)"glGetSynciv")) == NULL) || r; + r = ((glIsSync = (PFNGLISSYNCPROC)glewGetProcAddress((const GLubyte*)"glIsSync")) == NULL) || r; + r = ((glWaitSync = (PFNGLWAITSYNCPROC)glewGetProcAddress((const GLubyte*)"glWaitSync")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_sync */ + +#ifdef GL_ARB_tessellation_shader + +static GLboolean _glewInit_GL_ARB_tessellation_shader (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPatchParameterfv = (PFNGLPATCHPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glPatchParameterfv")) == NULL) || r; + r = ((glPatchParameteri = (PFNGLPATCHPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glPatchParameteri")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_tessellation_shader */ + +#ifdef GL_ARB_texture_barrier + +static GLboolean _glewInit_GL_ARB_texture_barrier (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTextureBarrier = (PFNGLTEXTUREBARRIERPROC)glewGetProcAddress((const GLubyte*)"glTextureBarrier")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_texture_barrier */ + +#ifdef GL_ARB_texture_buffer_object + +static GLboolean _glewInit_GL_ARB_texture_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexBufferARB = (PFNGLTEXBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glTexBufferARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_texture_buffer_object */ + +#ifdef GL_ARB_texture_buffer_range + +static GLboolean _glewInit_GL_ARB_texture_buffer_range (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexBufferRange = (PFNGLTEXBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glTexBufferRange")) == NULL) || r; + r = ((glTextureBufferRangeEXT = (PFNGLTEXTUREBUFFERRANGEEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureBufferRangeEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_texture_buffer_range */ + +#ifdef GL_ARB_texture_compression + +static GLboolean _glewInit_GL_ARB_texture_compression (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCompressedTexImage1DARB = (PFNGLCOMPRESSEDTEXIMAGE1DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage1DARB")) == NULL) || r; + r = ((glCompressedTexImage2DARB = (PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage2DARB")) == NULL) || r; + r = ((glCompressedTexImage3DARB = (PFNGLCOMPRESSEDTEXIMAGE3DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage3DARB")) == NULL) || r; + r = ((glCompressedTexSubImage1DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage1DARB")) == NULL) || r; + r = ((glCompressedTexSubImage2DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage2DARB")) == NULL) || r; + r = ((glCompressedTexSubImage3DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage3DARB")) == NULL) || r; + r = ((glGetCompressedTexImageARB = (PFNGLGETCOMPRESSEDTEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTexImageARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_texture_compression */ + +#ifdef GL_ARB_texture_multisample + +static GLboolean _glewInit_GL_ARB_texture_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC)glewGetProcAddress((const GLubyte*)"glGetMultisamplefv")) == NULL) || r; + r = ((glSampleMaski = (PFNGLSAMPLEMASKIPROC)glewGetProcAddress((const GLubyte*)"glSampleMaski")) == NULL) || r; + r = ((glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTexImage2DMultisample")) == NULL) || r; + r = ((glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTexImage3DMultisample")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_texture_multisample */ + +#ifdef GL_ARB_texture_storage + +static GLboolean _glewInit_GL_ARB_texture_storage (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexStorage1D = (PFNGLTEXSTORAGE1DPROC)glewGetProcAddress((const GLubyte*)"glTexStorage1D")) == NULL) || r; + r = ((glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)glewGetProcAddress((const GLubyte*)"glTexStorage2D")) == NULL) || r; + r = ((glTexStorage3D = (PFNGLTEXSTORAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTexStorage3D")) == NULL) || r; + r = ((glTextureStorage1DEXT = (PFNGLTEXTURESTORAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage1DEXT")) == NULL) || r; + r = ((glTextureStorage2DEXT = (PFNGLTEXTURESTORAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage2DEXT")) == NULL) || r; + r = ((glTextureStorage3DEXT = (PFNGLTEXTURESTORAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage3DEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_texture_storage */ + +#ifdef GL_ARB_texture_storage_multisample + +static GLboolean _glewInit_GL_ARB_texture_storage_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexStorage2DMultisample = (PFNGLTEXSTORAGE2DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTexStorage2DMultisample")) == NULL) || r; + r = ((glTexStorage3DMultisample = (PFNGLTEXSTORAGE3DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTexStorage3DMultisample")) == NULL) || r; + r = ((glTextureStorage2DMultisampleEXT = (PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage2DMultisampleEXT")) == NULL) || r; + r = ((glTextureStorage3DMultisampleEXT = (PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage3DMultisampleEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_texture_storage_multisample */ + +#ifdef GL_ARB_texture_view + +static GLboolean _glewInit_GL_ARB_texture_view (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTextureView = (PFNGLTEXTUREVIEWPROC)glewGetProcAddress((const GLubyte*)"glTextureView")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_texture_view */ + +#ifdef GL_ARB_timer_query + +static GLboolean _glewInit_GL_ARB_timer_query (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjecti64v")) == NULL) || r; + r = ((glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectui64v")) == NULL) || r; + r = ((glQueryCounter = (PFNGLQUERYCOUNTERPROC)glewGetProcAddress((const GLubyte*)"glQueryCounter")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_timer_query */ + +#ifdef GL_ARB_transform_feedback2 + +static GLboolean _glewInit_GL_ARB_transform_feedback2 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindTransformFeedback = (PFNGLBINDTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glBindTransformFeedback")) == NULL) || r; + r = ((glDeleteTransformFeedbacks = (PFNGLDELETETRANSFORMFEEDBACKSPROC)glewGetProcAddress((const GLubyte*)"glDeleteTransformFeedbacks")) == NULL) || r; + r = ((glDrawTransformFeedback = (PFNGLDRAWTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedback")) == NULL) || r; + r = ((glGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC)glewGetProcAddress((const GLubyte*)"glGenTransformFeedbacks")) == NULL) || r; + r = ((glIsTransformFeedback = (PFNGLISTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glIsTransformFeedback")) == NULL) || r; + r = ((glPauseTransformFeedback = (PFNGLPAUSETRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glPauseTransformFeedback")) == NULL) || r; + r = ((glResumeTransformFeedback = (PFNGLRESUMETRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glResumeTransformFeedback")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_transform_feedback2 */ + +#ifdef GL_ARB_transform_feedback3 + +static GLboolean _glewInit_GL_ARB_transform_feedback3 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginQueryIndexed = (PFNGLBEGINQUERYINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glBeginQueryIndexed")) == NULL) || r; + r = ((glDrawTransformFeedbackStream = (PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedbackStream")) == NULL) || r; + r = ((glEndQueryIndexed = (PFNGLENDQUERYINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glEndQueryIndexed")) == NULL) || r; + r = ((glGetQueryIndexediv = (PFNGLGETQUERYINDEXEDIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryIndexediv")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_transform_feedback3 */ + +#ifdef GL_ARB_transform_feedback_instanced + +static GLboolean _glewInit_GL_ARB_transform_feedback_instanced (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawTransformFeedbackInstanced = (PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedbackInstanced")) == NULL) || r; + r = ((glDrawTransformFeedbackStreamInstanced = (PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedbackStreamInstanced")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_transform_feedback_instanced */ + +#ifdef GL_ARB_transpose_matrix + +static GLboolean _glewInit_GL_ARB_transpose_matrix (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glLoadTransposeMatrixdARB = (PFNGLLOADTRANSPOSEMATRIXDARBPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixdARB")) == NULL) || r; + r = ((glLoadTransposeMatrixfARB = (PFNGLLOADTRANSPOSEMATRIXFARBPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixfARB")) == NULL) || r; + r = ((glMultTransposeMatrixdARB = (PFNGLMULTTRANSPOSEMATRIXDARBPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixdARB")) == NULL) || r; + r = ((glMultTransposeMatrixfARB = (PFNGLMULTTRANSPOSEMATRIXFARBPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixfARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_transpose_matrix */ + +#ifdef GL_ARB_uniform_buffer_object + +static GLboolean _glewInit_GL_ARB_uniform_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)glewGetProcAddress((const GLubyte*)"glBindBufferBase")) == NULL) || r; + r = ((glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glBindBufferRange")) == NULL) || r; + r = ((glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformBlockName")) == NULL) || r; + r = ((glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformBlockiv")) == NULL) || r; + r = ((glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformName")) == NULL) || r; + r = ((glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformsiv")) == NULL) || r; + r = ((glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)glewGetProcAddress((const GLubyte*)"glGetIntegeri_v")) == NULL) || r; + r = ((glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetUniformBlockIndex")) == NULL) || r; + r = ((glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)glewGetProcAddress((const GLubyte*)"glGetUniformIndices")) == NULL) || r; + r = ((glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)glewGetProcAddress((const GLubyte*)"glUniformBlockBinding")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_uniform_buffer_object */ + +#ifdef GL_ARB_vertex_array_object + +static GLboolean _glewInit_GL_ARB_vertex_array_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)glewGetProcAddress((const GLubyte*)"glBindVertexArray")) == NULL) || r; + r = ((glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)glewGetProcAddress((const GLubyte*)"glDeleteVertexArrays")) == NULL) || r; + r = ((glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)glewGetProcAddress((const GLubyte*)"glGenVertexArrays")) == NULL) || r; + r = ((glIsVertexArray = (PFNGLISVERTEXARRAYPROC)glewGetProcAddress((const GLubyte*)"glIsVertexArray")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_vertex_array_object */ + +#ifdef GL_ARB_vertex_attrib_64bit + +static GLboolean _glewInit_GL_ARB_vertex_attrib_64bit (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetVertexAttribLdv = (PFNGLGETVERTEXATTRIBLDVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribLdv")) == NULL) || r; + r = ((glVertexAttribL1d = (PFNGLVERTEXATTRIBL1DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1d")) == NULL) || r; + r = ((glVertexAttribL1dv = (PFNGLVERTEXATTRIBL1DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1dv")) == NULL) || r; + r = ((glVertexAttribL2d = (PFNGLVERTEXATTRIBL2DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2d")) == NULL) || r; + r = ((glVertexAttribL2dv = (PFNGLVERTEXATTRIBL2DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2dv")) == NULL) || r; + r = ((glVertexAttribL3d = (PFNGLVERTEXATTRIBL3DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3d")) == NULL) || r; + r = ((glVertexAttribL3dv = (PFNGLVERTEXATTRIBL3DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3dv")) == NULL) || r; + r = ((glVertexAttribL4d = (PFNGLVERTEXATTRIBL4DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4d")) == NULL) || r; + r = ((glVertexAttribL4dv = (PFNGLVERTEXATTRIBL4DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4dv")) == NULL) || r; + r = ((glVertexAttribLPointer = (PFNGLVERTEXATTRIBLPOINTERPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribLPointer")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_vertex_attrib_64bit */ + +#ifdef GL_ARB_vertex_attrib_binding + +static GLboolean _glewInit_GL_ARB_vertex_attrib_binding (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindVertexBuffer = (PFNGLBINDVERTEXBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBindVertexBuffer")) == NULL) || r; + r = ((glVertexArrayBindVertexBufferEXT = (PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayBindVertexBufferEXT")) == NULL) || r; + r = ((glVertexArrayVertexAttribBindingEXT = (PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribBindingEXT")) == NULL) || r; + r = ((glVertexArrayVertexAttribFormatEXT = (PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribFormatEXT")) == NULL) || r; + r = ((glVertexArrayVertexAttribIFormatEXT = (PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribIFormatEXT")) == NULL) || r; + r = ((glVertexArrayVertexAttribLFormatEXT = (PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribLFormatEXT")) == NULL) || r; + r = ((glVertexArrayVertexBindingDivisorEXT = (PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexBindingDivisorEXT")) == NULL) || r; + r = ((glVertexAttribBinding = (PFNGLVERTEXATTRIBBINDINGPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribBinding")) == NULL) || r; + r = ((glVertexAttribFormat = (PFNGLVERTEXATTRIBFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribFormat")) == NULL) || r; + r = ((glVertexAttribIFormat = (PFNGLVERTEXATTRIBIFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribIFormat")) == NULL) || r; + r = ((glVertexAttribLFormat = (PFNGLVERTEXATTRIBLFORMATPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribLFormat")) == NULL) || r; + r = ((glVertexBindingDivisor = (PFNGLVERTEXBINDINGDIVISORPROC)glewGetProcAddress((const GLubyte*)"glVertexBindingDivisor")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_vertex_attrib_binding */ + +#ifdef GL_ARB_vertex_blend + +static GLboolean _glewInit_GL_ARB_vertex_blend (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glVertexBlendARB = (PFNGLVERTEXBLENDARBPROC)glewGetProcAddress((const GLubyte*)"glVertexBlendARB")) == NULL) || r; + r = ((glWeightPointerARB = (PFNGLWEIGHTPOINTERARBPROC)glewGetProcAddress((const GLubyte*)"glWeightPointerARB")) == NULL) || r; + r = ((glWeightbvARB = (PFNGLWEIGHTBVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightbvARB")) == NULL) || r; + r = ((glWeightdvARB = (PFNGLWEIGHTDVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightdvARB")) == NULL) || r; + r = ((glWeightfvARB = (PFNGLWEIGHTFVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightfvARB")) == NULL) || r; + r = ((glWeightivARB = (PFNGLWEIGHTIVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightivARB")) == NULL) || r; + r = ((glWeightsvARB = (PFNGLWEIGHTSVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightsvARB")) == NULL) || r; + r = ((glWeightubvARB = (PFNGLWEIGHTUBVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightubvARB")) == NULL) || r; + r = ((glWeightuivARB = (PFNGLWEIGHTUIVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightuivARB")) == NULL) || r; + r = ((glWeightusvARB = (PFNGLWEIGHTUSVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightusvARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_vertex_blend */ + +#ifdef GL_ARB_vertex_buffer_object + +static GLboolean _glewInit_GL_ARB_vertex_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindBufferARB = (PFNGLBINDBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glBindBufferARB")) == NULL) || r; + r = ((glBufferDataARB = (PFNGLBUFFERDATAARBPROC)glewGetProcAddress((const GLubyte*)"glBufferDataARB")) == NULL) || r; + r = ((glBufferSubDataARB = (PFNGLBUFFERSUBDATAARBPROC)glewGetProcAddress((const GLubyte*)"glBufferSubDataARB")) == NULL) || r; + r = ((glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteBuffersARB")) == NULL) || r; + r = ((glGenBuffersARB = (PFNGLGENBUFFERSARBPROC)glewGetProcAddress((const GLubyte*)"glGenBuffersARB")) == NULL) || r; + r = ((glGetBufferParameterivARB = (PFNGLGETBUFFERPARAMETERIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetBufferParameterivARB")) == NULL) || r; + r = ((glGetBufferPointervARB = (PFNGLGETBUFFERPOINTERVARBPROC)glewGetProcAddress((const GLubyte*)"glGetBufferPointervARB")) == NULL) || r; + r = ((glGetBufferSubDataARB = (PFNGLGETBUFFERSUBDATAARBPROC)glewGetProcAddress((const GLubyte*)"glGetBufferSubDataARB")) == NULL) || r; + r = ((glIsBufferARB = (PFNGLISBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glIsBufferARB")) == NULL) || r; + r = ((glMapBufferARB = (PFNGLMAPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glMapBufferARB")) == NULL) || r; + r = ((glUnmapBufferARB = (PFNGLUNMAPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glUnmapBufferARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_vertex_buffer_object */ + +#ifdef GL_ARB_vertex_program + +static GLboolean _glewInit_GL_ARB_vertex_program (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindProgramARB = (PFNGLBINDPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glBindProgramARB")) == NULL) || r; + r = ((glDeleteProgramsARB = (PFNGLDELETEPROGRAMSARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgramsARB")) == NULL) || r; + r = ((glDisableVertexAttribArrayARB = (PFNGLDISABLEVERTEXATTRIBARRAYARBPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexAttribArrayARB")) == NULL) || r; + r = ((glEnableVertexAttribArrayARB = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexAttribArrayARB")) == NULL) || r; + r = ((glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC)glewGetProcAddress((const GLubyte*)"glGenProgramsARB")) == NULL) || r; + r = ((glGetProgramEnvParameterdvARB = (PFNGLGETPROGRAMENVPARAMETERDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramEnvParameterdvARB")) == NULL) || r; + r = ((glGetProgramEnvParameterfvARB = (PFNGLGETPROGRAMENVPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramEnvParameterfvARB")) == NULL) || r; + r = ((glGetProgramLocalParameterdvARB = (PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramLocalParameterdvARB")) == NULL) || r; + r = ((glGetProgramLocalParameterfvARB = (PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramLocalParameterfvARB")) == NULL) || r; + r = ((glGetProgramStringARB = (PFNGLGETPROGRAMSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramStringARB")) == NULL) || r; + r = ((glGetProgramivARB = (PFNGLGETPROGRAMIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramivARB")) == NULL) || r; + r = ((glGetVertexAttribPointervARB = (PFNGLGETVERTEXATTRIBPOINTERVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribPointervARB")) == NULL) || r; + r = ((glGetVertexAttribdvARB = (PFNGLGETVERTEXATTRIBDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribdvARB")) == NULL) || r; + r = ((glGetVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribfvARB")) == NULL) || r; + r = ((glGetVertexAttribivARB = (PFNGLGETVERTEXATTRIBIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribivARB")) == NULL) || r; + r = ((glIsProgramARB = (PFNGLISPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glIsProgramARB")) == NULL) || r; + r = ((glProgramEnvParameter4dARB = (PFNGLPROGRAMENVPARAMETER4DARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4dARB")) == NULL) || r; + r = ((glProgramEnvParameter4dvARB = (PFNGLPROGRAMENVPARAMETER4DVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4dvARB")) == NULL) || r; + r = ((glProgramEnvParameter4fARB = (PFNGLPROGRAMENVPARAMETER4FARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4fARB")) == NULL) || r; + r = ((glProgramEnvParameter4fvARB = (PFNGLPROGRAMENVPARAMETER4FVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4fvARB")) == NULL) || r; + r = ((glProgramLocalParameter4dARB = (PFNGLPROGRAMLOCALPARAMETER4DARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4dARB")) == NULL) || r; + r = ((glProgramLocalParameter4dvARB = (PFNGLPROGRAMLOCALPARAMETER4DVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4dvARB")) == NULL) || r; + r = ((glProgramLocalParameter4fARB = (PFNGLPROGRAMLOCALPARAMETER4FARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4fARB")) == NULL) || r; + r = ((glProgramLocalParameter4fvARB = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4fvARB")) == NULL) || r; + r = ((glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glProgramStringARB")) == NULL) || r; + r = ((glVertexAttrib1dARB = (PFNGLVERTEXATTRIB1DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dARB")) == NULL) || r; + r = ((glVertexAttrib1dvARB = (PFNGLVERTEXATTRIB1DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dvARB")) == NULL) || r; + r = ((glVertexAttrib1fARB = (PFNGLVERTEXATTRIB1FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fARB")) == NULL) || r; + r = ((glVertexAttrib1fvARB = (PFNGLVERTEXATTRIB1FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fvARB")) == NULL) || r; + r = ((glVertexAttrib1sARB = (PFNGLVERTEXATTRIB1SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1sARB")) == NULL) || r; + r = ((glVertexAttrib1svARB = (PFNGLVERTEXATTRIB1SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1svARB")) == NULL) || r; + r = ((glVertexAttrib2dARB = (PFNGLVERTEXATTRIB2DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dARB")) == NULL) || r; + r = ((glVertexAttrib2dvARB = (PFNGLVERTEXATTRIB2DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dvARB")) == NULL) || r; + r = ((glVertexAttrib2fARB = (PFNGLVERTEXATTRIB2FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fARB")) == NULL) || r; + r = ((glVertexAttrib2fvARB = (PFNGLVERTEXATTRIB2FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fvARB")) == NULL) || r; + r = ((glVertexAttrib2sARB = (PFNGLVERTEXATTRIB2SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2sARB")) == NULL) || r; + r = ((glVertexAttrib2svARB = (PFNGLVERTEXATTRIB2SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2svARB")) == NULL) || r; + r = ((glVertexAttrib3dARB = (PFNGLVERTEXATTRIB3DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dARB")) == NULL) || r; + r = ((glVertexAttrib3dvARB = (PFNGLVERTEXATTRIB3DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dvARB")) == NULL) || r; + r = ((glVertexAttrib3fARB = (PFNGLVERTEXATTRIB3FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fARB")) == NULL) || r; + r = ((glVertexAttrib3fvARB = (PFNGLVERTEXATTRIB3FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fvARB")) == NULL) || r; + r = ((glVertexAttrib3sARB = (PFNGLVERTEXATTRIB3SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3sARB")) == NULL) || r; + r = ((glVertexAttrib3svARB = (PFNGLVERTEXATTRIB3SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3svARB")) == NULL) || r; + r = ((glVertexAttrib4NbvARB = (PFNGLVERTEXATTRIB4NBVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NbvARB")) == NULL) || r; + r = ((glVertexAttrib4NivARB = (PFNGLVERTEXATTRIB4NIVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NivARB")) == NULL) || r; + r = ((glVertexAttrib4NsvARB = (PFNGLVERTEXATTRIB4NSVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NsvARB")) == NULL) || r; + r = ((glVertexAttrib4NubARB = (PFNGLVERTEXATTRIB4NUBARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NubARB")) == NULL) || r; + r = ((glVertexAttrib4NubvARB = (PFNGLVERTEXATTRIB4NUBVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NubvARB")) == NULL) || r; + r = ((glVertexAttrib4NuivARB = (PFNGLVERTEXATTRIB4NUIVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NuivARB")) == NULL) || r; + r = ((glVertexAttrib4NusvARB = (PFNGLVERTEXATTRIB4NUSVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NusvARB")) == NULL) || r; + r = ((glVertexAttrib4bvARB = (PFNGLVERTEXATTRIB4BVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4bvARB")) == NULL) || r; + r = ((glVertexAttrib4dARB = (PFNGLVERTEXATTRIB4DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dARB")) == NULL) || r; + r = ((glVertexAttrib4dvARB = (PFNGLVERTEXATTRIB4DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dvARB")) == NULL) || r; + r = ((glVertexAttrib4fARB = (PFNGLVERTEXATTRIB4FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fARB")) == NULL) || r; + r = ((glVertexAttrib4fvARB = (PFNGLVERTEXATTRIB4FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fvARB")) == NULL) || r; + r = ((glVertexAttrib4ivARB = (PFNGLVERTEXATTRIB4IVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ivARB")) == NULL) || r; + r = ((glVertexAttrib4sARB = (PFNGLVERTEXATTRIB4SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4sARB")) == NULL) || r; + r = ((glVertexAttrib4svARB = (PFNGLVERTEXATTRIB4SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4svARB")) == NULL) || r; + r = ((glVertexAttrib4ubvARB = (PFNGLVERTEXATTRIB4UBVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubvARB")) == NULL) || r; + r = ((glVertexAttrib4uivARB = (PFNGLVERTEXATTRIB4UIVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4uivARB")) == NULL) || r; + r = ((glVertexAttrib4usvARB = (PFNGLVERTEXATTRIB4USVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4usvARB")) == NULL) || r; + r = ((glVertexAttribPointerARB = (PFNGLVERTEXATTRIBPOINTERARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointerARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_vertex_program */ + +#ifdef GL_ARB_vertex_shader + +static GLboolean _glewInit_GL_ARB_vertex_shader (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC)glewGetProcAddress((const GLubyte*)"glBindAttribLocationARB")) == NULL) || r; + r = ((glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC)glewGetProcAddress((const GLubyte*)"glGetActiveAttribARB")) == NULL) || r; + r = ((glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC)glewGetProcAddress((const GLubyte*)"glGetAttribLocationARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_vertex_shader */ + +#ifdef GL_ARB_vertex_type_2_10_10_10_rev + +static GLboolean _glewInit_GL_ARB_vertex_type_2_10_10_10_rev (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColorP3ui = (PFNGLCOLORP3UIPROC)glewGetProcAddress((const GLubyte*)"glColorP3ui")) == NULL) || r; + r = ((glColorP3uiv = (PFNGLCOLORP3UIVPROC)glewGetProcAddress((const GLubyte*)"glColorP3uiv")) == NULL) || r; + r = ((glColorP4ui = (PFNGLCOLORP4UIPROC)glewGetProcAddress((const GLubyte*)"glColorP4ui")) == NULL) || r; + r = ((glColorP4uiv = (PFNGLCOLORP4UIVPROC)glewGetProcAddress((const GLubyte*)"glColorP4uiv")) == NULL) || r; + r = ((glMultiTexCoordP1ui = (PFNGLMULTITEXCOORDP1UIPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP1ui")) == NULL) || r; + r = ((glMultiTexCoordP1uiv = (PFNGLMULTITEXCOORDP1UIVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP1uiv")) == NULL) || r; + r = ((glMultiTexCoordP2ui = (PFNGLMULTITEXCOORDP2UIPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP2ui")) == NULL) || r; + r = ((glMultiTexCoordP2uiv = (PFNGLMULTITEXCOORDP2UIVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP2uiv")) == NULL) || r; + r = ((glMultiTexCoordP3ui = (PFNGLMULTITEXCOORDP3UIPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP3ui")) == NULL) || r; + r = ((glMultiTexCoordP3uiv = (PFNGLMULTITEXCOORDP3UIVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP3uiv")) == NULL) || r; + r = ((glMultiTexCoordP4ui = (PFNGLMULTITEXCOORDP4UIPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP4ui")) == NULL) || r; + r = ((glMultiTexCoordP4uiv = (PFNGLMULTITEXCOORDP4UIVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordP4uiv")) == NULL) || r; + r = ((glNormalP3ui = (PFNGLNORMALP3UIPROC)glewGetProcAddress((const GLubyte*)"glNormalP3ui")) == NULL) || r; + r = ((glNormalP3uiv = (PFNGLNORMALP3UIVPROC)glewGetProcAddress((const GLubyte*)"glNormalP3uiv")) == NULL) || r; + r = ((glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorP3ui")) == NULL) || r; + r = ((glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorP3uiv")) == NULL) || r; + r = ((glTexCoordP1ui = (PFNGLTEXCOORDP1UIPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP1ui")) == NULL) || r; + r = ((glTexCoordP1uiv = (PFNGLTEXCOORDP1UIVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP1uiv")) == NULL) || r; + r = ((glTexCoordP2ui = (PFNGLTEXCOORDP2UIPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP2ui")) == NULL) || r; + r = ((glTexCoordP2uiv = (PFNGLTEXCOORDP2UIVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP2uiv")) == NULL) || r; + r = ((glTexCoordP3ui = (PFNGLTEXCOORDP3UIPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP3ui")) == NULL) || r; + r = ((glTexCoordP3uiv = (PFNGLTEXCOORDP3UIVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP3uiv")) == NULL) || r; + r = ((glTexCoordP4ui = (PFNGLTEXCOORDP4UIPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP4ui")) == NULL) || r; + r = ((glTexCoordP4uiv = (PFNGLTEXCOORDP4UIVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordP4uiv")) == NULL) || r; + r = ((glVertexAttribP1ui = (PFNGLVERTEXATTRIBP1UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP1ui")) == NULL) || r; + r = ((glVertexAttribP1uiv = (PFNGLVERTEXATTRIBP1UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP1uiv")) == NULL) || r; + r = ((glVertexAttribP2ui = (PFNGLVERTEXATTRIBP2UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP2ui")) == NULL) || r; + r = ((glVertexAttribP2uiv = (PFNGLVERTEXATTRIBP2UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP2uiv")) == NULL) || r; + r = ((glVertexAttribP3ui = (PFNGLVERTEXATTRIBP3UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP3ui")) == NULL) || r; + r = ((glVertexAttribP3uiv = (PFNGLVERTEXATTRIBP3UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP3uiv")) == NULL) || r; + r = ((glVertexAttribP4ui = (PFNGLVERTEXATTRIBP4UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP4ui")) == NULL) || r; + r = ((glVertexAttribP4uiv = (PFNGLVERTEXATTRIBP4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP4uiv")) == NULL) || r; + r = ((glVertexP2ui = (PFNGLVERTEXP2UIPROC)glewGetProcAddress((const GLubyte*)"glVertexP2ui")) == NULL) || r; + r = ((glVertexP2uiv = (PFNGLVERTEXP2UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexP2uiv")) == NULL) || r; + r = ((glVertexP3ui = (PFNGLVERTEXP3UIPROC)glewGetProcAddress((const GLubyte*)"glVertexP3ui")) == NULL) || r; + r = ((glVertexP3uiv = (PFNGLVERTEXP3UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexP3uiv")) == NULL) || r; + r = ((glVertexP4ui = (PFNGLVERTEXP4UIPROC)glewGetProcAddress((const GLubyte*)"glVertexP4ui")) == NULL) || r; + r = ((glVertexP4uiv = (PFNGLVERTEXP4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexP4uiv")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_vertex_type_2_10_10_10_rev */ + +#ifdef GL_ARB_viewport_array + +static GLboolean _glewInit_GL_ARB_viewport_array (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDepthRangeArrayv = (PFNGLDEPTHRANGEARRAYVPROC)glewGetProcAddress((const GLubyte*)"glDepthRangeArrayv")) == NULL) || r; + r = ((glDepthRangeIndexed = (PFNGLDEPTHRANGEINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glDepthRangeIndexed")) == NULL) || r; + r = ((glGetDoublei_v = (PFNGLGETDOUBLEI_VPROC)glewGetProcAddress((const GLubyte*)"glGetDoublei_v")) == NULL) || r; + r = ((glGetFloati_v = (PFNGLGETFLOATI_VPROC)glewGetProcAddress((const GLubyte*)"glGetFloati_v")) == NULL) || r; + r = ((glScissorArrayv = (PFNGLSCISSORARRAYVPROC)glewGetProcAddress((const GLubyte*)"glScissorArrayv")) == NULL) || r; + r = ((glScissorIndexed = (PFNGLSCISSORINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glScissorIndexed")) == NULL) || r; + r = ((glScissorIndexedv = (PFNGLSCISSORINDEXEDVPROC)glewGetProcAddress((const GLubyte*)"glScissorIndexedv")) == NULL) || r; + r = ((glViewportArrayv = (PFNGLVIEWPORTARRAYVPROC)glewGetProcAddress((const GLubyte*)"glViewportArrayv")) == NULL) || r; + r = ((glViewportIndexedf = (PFNGLVIEWPORTINDEXEDFPROC)glewGetProcAddress((const GLubyte*)"glViewportIndexedf")) == NULL) || r; + r = ((glViewportIndexedfv = (PFNGLVIEWPORTINDEXEDFVPROC)glewGetProcAddress((const GLubyte*)"glViewportIndexedfv")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_viewport_array */ + +#ifdef GL_ARB_window_pos + +static GLboolean _glewInit_GL_ARB_window_pos (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glWindowPos2dARB = (PFNGLWINDOWPOS2DARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dARB")) == NULL) || r; + r = ((glWindowPos2dvARB = (PFNGLWINDOWPOS2DVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dvARB")) == NULL) || r; + r = ((glWindowPos2fARB = (PFNGLWINDOWPOS2FARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fARB")) == NULL) || r; + r = ((glWindowPos2fvARB = (PFNGLWINDOWPOS2FVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fvARB")) == NULL) || r; + r = ((glWindowPos2iARB = (PFNGLWINDOWPOS2IARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2iARB")) == NULL) || r; + r = ((glWindowPos2ivARB = (PFNGLWINDOWPOS2IVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2ivARB")) == NULL) || r; + r = ((glWindowPos2sARB = (PFNGLWINDOWPOS2SARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2sARB")) == NULL) || r; + r = ((glWindowPos2svARB = (PFNGLWINDOWPOS2SVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2svARB")) == NULL) || r; + r = ((glWindowPos3dARB = (PFNGLWINDOWPOS3DARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dARB")) == NULL) || r; + r = ((glWindowPos3dvARB = (PFNGLWINDOWPOS3DVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dvARB")) == NULL) || r; + r = ((glWindowPos3fARB = (PFNGLWINDOWPOS3FARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fARB")) == NULL) || r; + r = ((glWindowPos3fvARB = (PFNGLWINDOWPOS3FVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fvARB")) == NULL) || r; + r = ((glWindowPos3iARB = (PFNGLWINDOWPOS3IARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3iARB")) == NULL) || r; + r = ((glWindowPos3ivARB = (PFNGLWINDOWPOS3IVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3ivARB")) == NULL) || r; + r = ((glWindowPos3sARB = (PFNGLWINDOWPOS3SARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3sARB")) == NULL) || r; + r = ((glWindowPos3svARB = (PFNGLWINDOWPOS3SVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3svARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_window_pos */ + +#ifdef GL_ATI_draw_buffers + +static GLboolean _glewInit_GL_ATI_draw_buffers (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawBuffersATI = (PFNGLDRAWBUFFERSATIPROC)glewGetProcAddress((const GLubyte*)"glDrawBuffersATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_draw_buffers */ + +#ifdef GL_ATI_element_array + +static GLboolean _glewInit_GL_ATI_element_array (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawElementArrayATI = (PFNGLDRAWELEMENTARRAYATIPROC)glewGetProcAddress((const GLubyte*)"glDrawElementArrayATI")) == NULL) || r; + r = ((glDrawRangeElementArrayATI = (PFNGLDRAWRANGEELEMENTARRAYATIPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementArrayATI")) == NULL) || r; + r = ((glElementPointerATI = (PFNGLELEMENTPOINTERATIPROC)glewGetProcAddress((const GLubyte*)"glElementPointerATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_element_array */ + +#ifdef GL_ATI_envmap_bumpmap + +static GLboolean _glewInit_GL_ATI_envmap_bumpmap (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetTexBumpParameterfvATI = (PFNGLGETTEXBUMPPARAMETERFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetTexBumpParameterfvATI")) == NULL) || r; + r = ((glGetTexBumpParameterivATI = (PFNGLGETTEXBUMPPARAMETERIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetTexBumpParameterivATI")) == NULL) || r; + r = ((glTexBumpParameterfvATI = (PFNGLTEXBUMPPARAMETERFVATIPROC)glewGetProcAddress((const GLubyte*)"glTexBumpParameterfvATI")) == NULL) || r; + r = ((glTexBumpParameterivATI = (PFNGLTEXBUMPPARAMETERIVATIPROC)glewGetProcAddress((const GLubyte*)"glTexBumpParameterivATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_envmap_bumpmap */ + +#ifdef GL_ATI_fragment_shader + +static GLboolean _glewInit_GL_ATI_fragment_shader (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAlphaFragmentOp1ATI = (PFNGLALPHAFRAGMENTOP1ATIPROC)glewGetProcAddress((const GLubyte*)"glAlphaFragmentOp1ATI")) == NULL) || r; + r = ((glAlphaFragmentOp2ATI = (PFNGLALPHAFRAGMENTOP2ATIPROC)glewGetProcAddress((const GLubyte*)"glAlphaFragmentOp2ATI")) == NULL) || r; + r = ((glAlphaFragmentOp3ATI = (PFNGLALPHAFRAGMENTOP3ATIPROC)glewGetProcAddress((const GLubyte*)"glAlphaFragmentOp3ATI")) == NULL) || r; + r = ((glBeginFragmentShaderATI = (PFNGLBEGINFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glBeginFragmentShaderATI")) == NULL) || r; + r = ((glBindFragmentShaderATI = (PFNGLBINDFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glBindFragmentShaderATI")) == NULL) || r; + r = ((glColorFragmentOp1ATI = (PFNGLCOLORFRAGMENTOP1ATIPROC)glewGetProcAddress((const GLubyte*)"glColorFragmentOp1ATI")) == NULL) || r; + r = ((glColorFragmentOp2ATI = (PFNGLCOLORFRAGMENTOP2ATIPROC)glewGetProcAddress((const GLubyte*)"glColorFragmentOp2ATI")) == NULL) || r; + r = ((glColorFragmentOp3ATI = (PFNGLCOLORFRAGMENTOP3ATIPROC)glewGetProcAddress((const GLubyte*)"glColorFragmentOp3ATI")) == NULL) || r; + r = ((glDeleteFragmentShaderATI = (PFNGLDELETEFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glDeleteFragmentShaderATI")) == NULL) || r; + r = ((glEndFragmentShaderATI = (PFNGLENDFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glEndFragmentShaderATI")) == NULL) || r; + r = ((glGenFragmentShadersATI = (PFNGLGENFRAGMENTSHADERSATIPROC)glewGetProcAddress((const GLubyte*)"glGenFragmentShadersATI")) == NULL) || r; + r = ((glPassTexCoordATI = (PFNGLPASSTEXCOORDATIPROC)glewGetProcAddress((const GLubyte*)"glPassTexCoordATI")) == NULL) || r; + r = ((glSampleMapATI = (PFNGLSAMPLEMAPATIPROC)glewGetProcAddress((const GLubyte*)"glSampleMapATI")) == NULL) || r; + r = ((glSetFragmentShaderConstantATI = (PFNGLSETFRAGMENTSHADERCONSTANTATIPROC)glewGetProcAddress((const GLubyte*)"glSetFragmentShaderConstantATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_fragment_shader */ + +#ifdef GL_ATI_map_object_buffer + +static GLboolean _glewInit_GL_ATI_map_object_buffer (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMapObjectBufferATI = (PFNGLMAPOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glMapObjectBufferATI")) == NULL) || r; + r = ((glUnmapObjectBufferATI = (PFNGLUNMAPOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glUnmapObjectBufferATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_map_object_buffer */ + +#ifdef GL_ATI_pn_triangles + +static GLboolean _glewInit_GL_ATI_pn_triangles (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPNTrianglesfATI = (PFNGLPNTRIANGLESFATIPROC)glewGetProcAddress((const GLubyte*)"glPNTrianglesfATI")) == NULL) || r; + r = ((glPNTrianglesiATI = (PFNGLPNTRIANGLESIATIPROC)glewGetProcAddress((const GLubyte*)"glPNTrianglesiATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_pn_triangles */ + +#ifdef GL_ATI_separate_stencil + +static GLboolean _glewInit_GL_ATI_separate_stencil (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glStencilFuncSeparateATI = (PFNGLSTENCILFUNCSEPARATEATIPROC)glewGetProcAddress((const GLubyte*)"glStencilFuncSeparateATI")) == NULL) || r; + r = ((glStencilOpSeparateATI = (PFNGLSTENCILOPSEPARATEATIPROC)glewGetProcAddress((const GLubyte*)"glStencilOpSeparateATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_separate_stencil */ + +#ifdef GL_ATI_vertex_array_object + +static GLboolean _glewInit_GL_ATI_vertex_array_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glArrayObjectATI = (PFNGLARRAYOBJECTATIPROC)glewGetProcAddress((const GLubyte*)"glArrayObjectATI")) == NULL) || r; + r = ((glFreeObjectBufferATI = (PFNGLFREEOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glFreeObjectBufferATI")) == NULL) || r; + r = ((glGetArrayObjectfvATI = (PFNGLGETARRAYOBJECTFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetArrayObjectfvATI")) == NULL) || r; + r = ((glGetArrayObjectivATI = (PFNGLGETARRAYOBJECTIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetArrayObjectivATI")) == NULL) || r; + r = ((glGetObjectBufferfvATI = (PFNGLGETOBJECTBUFFERFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetObjectBufferfvATI")) == NULL) || r; + r = ((glGetObjectBufferivATI = (PFNGLGETOBJECTBUFFERIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetObjectBufferivATI")) == NULL) || r; + r = ((glGetVariantArrayObjectfvATI = (PFNGLGETVARIANTARRAYOBJECTFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVariantArrayObjectfvATI")) == NULL) || r; + r = ((glGetVariantArrayObjectivATI = (PFNGLGETVARIANTARRAYOBJECTIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVariantArrayObjectivATI")) == NULL) || r; + r = ((glIsObjectBufferATI = (PFNGLISOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glIsObjectBufferATI")) == NULL) || r; + r = ((glNewObjectBufferATI = (PFNGLNEWOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glNewObjectBufferATI")) == NULL) || r; + r = ((glUpdateObjectBufferATI = (PFNGLUPDATEOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glUpdateObjectBufferATI")) == NULL) || r; + r = ((glVariantArrayObjectATI = (PFNGLVARIANTARRAYOBJECTATIPROC)glewGetProcAddress((const GLubyte*)"glVariantArrayObjectATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_vertex_array_object */ + +#ifdef GL_ATI_vertex_attrib_array_object + +static GLboolean _glewInit_GL_ATI_vertex_attrib_array_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetVertexAttribArrayObjectfvATI = (PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribArrayObjectfvATI")) == NULL) || r; + r = ((glGetVertexAttribArrayObjectivATI = (PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribArrayObjectivATI")) == NULL) || r; + r = ((glVertexAttribArrayObjectATI = (PFNGLVERTEXATTRIBARRAYOBJECTATIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribArrayObjectATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_vertex_attrib_array_object */ + +#ifdef GL_ATI_vertex_streams + +static GLboolean _glewInit_GL_ATI_vertex_streams (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glClientActiveVertexStreamATI = (PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC)glewGetProcAddress((const GLubyte*)"glClientActiveVertexStreamATI")) == NULL) || r; + r = ((glNormalStream3bATI = (PFNGLNORMALSTREAM3BATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3bATI")) == NULL) || r; + r = ((glNormalStream3bvATI = (PFNGLNORMALSTREAM3BVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3bvATI")) == NULL) || r; + r = ((glNormalStream3dATI = (PFNGLNORMALSTREAM3DATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3dATI")) == NULL) || r; + r = ((glNormalStream3dvATI = (PFNGLNORMALSTREAM3DVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3dvATI")) == NULL) || r; + r = ((glNormalStream3fATI = (PFNGLNORMALSTREAM3FATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3fATI")) == NULL) || r; + r = ((glNormalStream3fvATI = (PFNGLNORMALSTREAM3FVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3fvATI")) == NULL) || r; + r = ((glNormalStream3iATI = (PFNGLNORMALSTREAM3IATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3iATI")) == NULL) || r; + r = ((glNormalStream3ivATI = (PFNGLNORMALSTREAM3IVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3ivATI")) == NULL) || r; + r = ((glNormalStream3sATI = (PFNGLNORMALSTREAM3SATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3sATI")) == NULL) || r; + r = ((glNormalStream3svATI = (PFNGLNORMALSTREAM3SVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3svATI")) == NULL) || r; + r = ((glVertexBlendEnvfATI = (PFNGLVERTEXBLENDENVFATIPROC)glewGetProcAddress((const GLubyte*)"glVertexBlendEnvfATI")) == NULL) || r; + r = ((glVertexBlendEnviATI = (PFNGLVERTEXBLENDENVIATIPROC)glewGetProcAddress((const GLubyte*)"glVertexBlendEnviATI")) == NULL) || r; + r = ((glVertexStream1dATI = (PFNGLVERTEXSTREAM1DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1dATI")) == NULL) || r; + r = ((glVertexStream1dvATI = (PFNGLVERTEXSTREAM1DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1dvATI")) == NULL) || r; + r = ((glVertexStream1fATI = (PFNGLVERTEXSTREAM1FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1fATI")) == NULL) || r; + r = ((glVertexStream1fvATI = (PFNGLVERTEXSTREAM1FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1fvATI")) == NULL) || r; + r = ((glVertexStream1iATI = (PFNGLVERTEXSTREAM1IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1iATI")) == NULL) || r; + r = ((glVertexStream1ivATI = (PFNGLVERTEXSTREAM1IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1ivATI")) == NULL) || r; + r = ((glVertexStream1sATI = (PFNGLVERTEXSTREAM1SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1sATI")) == NULL) || r; + r = ((glVertexStream1svATI = (PFNGLVERTEXSTREAM1SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream1svATI")) == NULL) || r; + r = ((glVertexStream2dATI = (PFNGLVERTEXSTREAM2DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2dATI")) == NULL) || r; + r = ((glVertexStream2dvATI = (PFNGLVERTEXSTREAM2DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2dvATI")) == NULL) || r; + r = ((glVertexStream2fATI = (PFNGLVERTEXSTREAM2FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2fATI")) == NULL) || r; + r = ((glVertexStream2fvATI = (PFNGLVERTEXSTREAM2FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2fvATI")) == NULL) || r; + r = ((glVertexStream2iATI = (PFNGLVERTEXSTREAM2IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2iATI")) == NULL) || r; + r = ((glVertexStream2ivATI = (PFNGLVERTEXSTREAM2IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2ivATI")) == NULL) || r; + r = ((glVertexStream2sATI = (PFNGLVERTEXSTREAM2SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2sATI")) == NULL) || r; + r = ((glVertexStream2svATI = (PFNGLVERTEXSTREAM2SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2svATI")) == NULL) || r; + r = ((glVertexStream3dATI = (PFNGLVERTEXSTREAM3DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3dATI")) == NULL) || r; + r = ((glVertexStream3dvATI = (PFNGLVERTEXSTREAM3DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3dvATI")) == NULL) || r; + r = ((glVertexStream3fATI = (PFNGLVERTEXSTREAM3FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3fATI")) == NULL) || r; + r = ((glVertexStream3fvATI = (PFNGLVERTEXSTREAM3FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3fvATI")) == NULL) || r; + r = ((glVertexStream3iATI = (PFNGLVERTEXSTREAM3IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3iATI")) == NULL) || r; + r = ((glVertexStream3ivATI = (PFNGLVERTEXSTREAM3IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3ivATI")) == NULL) || r; + r = ((glVertexStream3sATI = (PFNGLVERTEXSTREAM3SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3sATI")) == NULL) || r; + r = ((glVertexStream3svATI = (PFNGLVERTEXSTREAM3SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3svATI")) == NULL) || r; + r = ((glVertexStream4dATI = (PFNGLVERTEXSTREAM4DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4dATI")) == NULL) || r; + r = ((glVertexStream4dvATI = (PFNGLVERTEXSTREAM4DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4dvATI")) == NULL) || r; + r = ((glVertexStream4fATI = (PFNGLVERTEXSTREAM4FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4fATI")) == NULL) || r; + r = ((glVertexStream4fvATI = (PFNGLVERTEXSTREAM4FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4fvATI")) == NULL) || r; + r = ((glVertexStream4iATI = (PFNGLVERTEXSTREAM4IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4iATI")) == NULL) || r; + r = ((glVertexStream4ivATI = (PFNGLVERTEXSTREAM4IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4ivATI")) == NULL) || r; + r = ((glVertexStream4sATI = (PFNGLVERTEXSTREAM4SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4sATI")) == NULL) || r; + r = ((glVertexStream4svATI = (PFNGLVERTEXSTREAM4SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4svATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_vertex_streams */ + +#ifdef GL_EXT_bindable_uniform + +static GLboolean _glewInit_GL_EXT_bindable_uniform (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetUniformBufferSizeEXT = (PFNGLGETUNIFORMBUFFERSIZEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetUniformBufferSizeEXT")) == NULL) || r; + r = ((glGetUniformOffsetEXT = (PFNGLGETUNIFORMOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glGetUniformOffsetEXT")) == NULL) || r; + r = ((glUniformBufferEXT = (PFNGLUNIFORMBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glUniformBufferEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_bindable_uniform */ + +#ifdef GL_EXT_blend_color + +static GLboolean _glewInit_GL_EXT_blend_color (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendColorEXT = (PFNGLBLENDCOLOREXTPROC)glewGetProcAddress((const GLubyte*)"glBlendColorEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_blend_color */ + +#ifdef GL_EXT_blend_equation_separate + +static GLboolean _glewInit_GL_EXT_blend_equation_separate (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendEquationSeparateEXT = (PFNGLBLENDEQUATIONSEPARATEEXTPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparateEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_blend_equation_separate */ + +#ifdef GL_EXT_blend_func_separate + +static GLboolean _glewInit_GL_EXT_blend_func_separate (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparateEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_blend_func_separate */ + +#ifdef GL_EXT_blend_minmax + +static GLboolean _glewInit_GL_EXT_blend_minmax (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendEquationEXT = (PFNGLBLENDEQUATIONEXTPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_blend_minmax */ + +#ifdef GL_EXT_color_subtable + +static GLboolean _glewInit_GL_EXT_color_subtable (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColorSubTableEXT = (PFNGLCOLORSUBTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glColorSubTableEXT")) == NULL) || r; + r = ((glCopyColorSubTableEXT = (PFNGLCOPYCOLORSUBTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyColorSubTableEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_color_subtable */ + +#ifdef GL_EXT_compiled_vertex_array + +static GLboolean _glewInit_GL_EXT_compiled_vertex_array (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glLockArraysEXT = (PFNGLLOCKARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glLockArraysEXT")) == NULL) || r; + r = ((glUnlockArraysEXT = (PFNGLUNLOCKARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glUnlockArraysEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_compiled_vertex_array */ + +#ifdef GL_EXT_convolution + +static GLboolean _glewInit_GL_EXT_convolution (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glConvolutionFilter1DEXT = (PFNGLCONVOLUTIONFILTER1DEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter1DEXT")) == NULL) || r; + r = ((glConvolutionFilter2DEXT = (PFNGLCONVOLUTIONFILTER2DEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter2DEXT")) == NULL) || r; + r = ((glConvolutionParameterfEXT = (PFNGLCONVOLUTIONPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterfEXT")) == NULL) || r; + r = ((glConvolutionParameterfvEXT = (PFNGLCONVOLUTIONPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterfvEXT")) == NULL) || r; + r = ((glConvolutionParameteriEXT = (PFNGLCONVOLUTIONPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameteriEXT")) == NULL) || r; + r = ((glConvolutionParameterivEXT = (PFNGLCONVOLUTIONPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterivEXT")) == NULL) || r; + r = ((glCopyConvolutionFilter1DEXT = (PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter1DEXT")) == NULL) || r; + r = ((glCopyConvolutionFilter2DEXT = (PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter2DEXT")) == NULL) || r; + r = ((glGetConvolutionFilterEXT = (PFNGLGETCONVOLUTIONFILTEREXTPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionFilterEXT")) == NULL) || r; + r = ((glGetConvolutionParameterfvEXT = (PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameterfvEXT")) == NULL) || r; + r = ((glGetConvolutionParameterivEXT = (PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameterivEXT")) == NULL) || r; + r = ((glGetSeparableFilterEXT = (PFNGLGETSEPARABLEFILTEREXTPROC)glewGetProcAddress((const GLubyte*)"glGetSeparableFilterEXT")) == NULL) || r; + r = ((glSeparableFilter2DEXT = (PFNGLSEPARABLEFILTER2DEXTPROC)glewGetProcAddress((const GLubyte*)"glSeparableFilter2DEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_convolution */ + +#ifdef GL_EXT_coordinate_frame + +static GLboolean _glewInit_GL_EXT_coordinate_frame (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBinormalPointerEXT = (PFNGLBINORMALPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glBinormalPointerEXT")) == NULL) || r; + r = ((glTangentPointerEXT = (PFNGLTANGENTPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glTangentPointerEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_coordinate_frame */ + +#ifdef GL_EXT_copy_texture + +static GLboolean _glewInit_GL_EXT_copy_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCopyTexImage1DEXT = (PFNGLCOPYTEXIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexImage1DEXT")) == NULL) || r; + r = ((glCopyTexImage2DEXT = (PFNGLCOPYTEXIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexImage2DEXT")) == NULL) || r; + r = ((glCopyTexSubImage1DEXT = (PFNGLCOPYTEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage1DEXT")) == NULL) || r; + r = ((glCopyTexSubImage2DEXT = (PFNGLCOPYTEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage2DEXT")) == NULL) || r; + r = ((glCopyTexSubImage3DEXT = (PFNGLCOPYTEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage3DEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_copy_texture */ + +#ifdef GL_EXT_cull_vertex + +static GLboolean _glewInit_GL_EXT_cull_vertex (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCullParameterdvEXT = (PFNGLCULLPARAMETERDVEXTPROC)glewGetProcAddress((const GLubyte*)"glCullParameterdvEXT")) == NULL) || r; + r = ((glCullParameterfvEXT = (PFNGLCULLPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glCullParameterfvEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_cull_vertex */ + +#ifdef GL_EXT_debug_label + +static GLboolean _glewInit_GL_EXT_debug_label (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetObjectLabelEXT = (PFNGLGETOBJECTLABELEXTPROC)glewGetProcAddress((const GLubyte*)"glGetObjectLabelEXT")) == NULL) || r; + r = ((glLabelObjectEXT = (PFNGLLABELOBJECTEXTPROC)glewGetProcAddress((const GLubyte*)"glLabelObjectEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_debug_label */ + +#ifdef GL_EXT_debug_marker + +static GLboolean _glewInit_GL_EXT_debug_marker (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glInsertEventMarkerEXT = (PFNGLINSERTEVENTMARKEREXTPROC)glewGetProcAddress((const GLubyte*)"glInsertEventMarkerEXT")) == NULL) || r; + r = ((glPopGroupMarkerEXT = (PFNGLPOPGROUPMARKEREXTPROC)glewGetProcAddress((const GLubyte*)"glPopGroupMarkerEXT")) == NULL) || r; + r = ((glPushGroupMarkerEXT = (PFNGLPUSHGROUPMARKEREXTPROC)glewGetProcAddress((const GLubyte*)"glPushGroupMarkerEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_debug_marker */ + +#ifdef GL_EXT_depth_bounds_test + +static GLboolean _glewInit_GL_EXT_depth_bounds_test (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDepthBoundsEXT = (PFNGLDEPTHBOUNDSEXTPROC)glewGetProcAddress((const GLubyte*)"glDepthBoundsEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_depth_bounds_test */ + +#ifdef GL_EXT_direct_state_access + +static GLboolean _glewInit_GL_EXT_direct_state_access (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindMultiTextureEXT = (PFNGLBINDMULTITEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glBindMultiTextureEXT")) == NULL) || r; + r = ((glCheckNamedFramebufferStatusEXT = (PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC)glewGetProcAddress((const GLubyte*)"glCheckNamedFramebufferStatusEXT")) == NULL) || r; + r = ((glClientAttribDefaultEXT = (PFNGLCLIENTATTRIBDEFAULTEXTPROC)glewGetProcAddress((const GLubyte*)"glClientAttribDefaultEXT")) == NULL) || r; + r = ((glCompressedMultiTexImage1DEXT = (PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexImage1DEXT")) == NULL) || r; + r = ((glCompressedMultiTexImage2DEXT = (PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexImage2DEXT")) == NULL) || r; + r = ((glCompressedMultiTexImage3DEXT = (PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexImage3DEXT")) == NULL) || r; + r = ((glCompressedMultiTexSubImage1DEXT = (PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexSubImage1DEXT")) == NULL) || r; + r = ((glCompressedMultiTexSubImage2DEXT = (PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexSubImage2DEXT")) == NULL) || r; + r = ((glCompressedMultiTexSubImage3DEXT = (PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedMultiTexSubImage3DEXT")) == NULL) || r; + r = ((glCompressedTextureImage1DEXT = (PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureImage1DEXT")) == NULL) || r; + r = ((glCompressedTextureImage2DEXT = (PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureImage2DEXT")) == NULL) || r; + r = ((glCompressedTextureImage3DEXT = (PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureImage3DEXT")) == NULL) || r; + r = ((glCompressedTextureSubImage1DEXT = (PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage1DEXT")) == NULL) || r; + r = ((glCompressedTextureSubImage2DEXT = (PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage2DEXT")) == NULL) || r; + r = ((glCompressedTextureSubImage3DEXT = (PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCompressedTextureSubImage3DEXT")) == NULL) || r; + r = ((glCopyMultiTexImage1DEXT = (PFNGLCOPYMULTITEXIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexImage1DEXT")) == NULL) || r; + r = ((glCopyMultiTexImage2DEXT = (PFNGLCOPYMULTITEXIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexImage2DEXT")) == NULL) || r; + r = ((glCopyMultiTexSubImage1DEXT = (PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexSubImage1DEXT")) == NULL) || r; + r = ((glCopyMultiTexSubImage2DEXT = (PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexSubImage2DEXT")) == NULL) || r; + r = ((glCopyMultiTexSubImage3DEXT = (PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyMultiTexSubImage3DEXT")) == NULL) || r; + r = ((glCopyTextureImage1DEXT = (PFNGLCOPYTEXTUREIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureImage1DEXT")) == NULL) || r; + r = ((glCopyTextureImage2DEXT = (PFNGLCOPYTEXTUREIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureImage2DEXT")) == NULL) || r; + r = ((glCopyTextureSubImage1DEXT = (PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage1DEXT")) == NULL) || r; + r = ((glCopyTextureSubImage2DEXT = (PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage2DEXT")) == NULL) || r; + r = ((glCopyTextureSubImage3DEXT = (PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTextureSubImage3DEXT")) == NULL) || r; + r = ((glDisableClientStateIndexedEXT = (PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableClientStateIndexedEXT")) == NULL) || r; + r = ((glDisableClientStateiEXT = (PFNGLDISABLECLIENTSTATEIEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableClientStateiEXT")) == NULL) || r; + r = ((glDisableVertexArrayAttribEXT = (PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexArrayAttribEXT")) == NULL) || r; + r = ((glDisableVertexArrayEXT = (PFNGLDISABLEVERTEXARRAYEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexArrayEXT")) == NULL) || r; + r = ((glEnableClientStateIndexedEXT = (PFNGLENABLECLIENTSTATEINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableClientStateIndexedEXT")) == NULL) || r; + r = ((glEnableClientStateiEXT = (PFNGLENABLECLIENTSTATEIEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableClientStateiEXT")) == NULL) || r; + r = ((glEnableVertexArrayAttribEXT = (PFNGLENABLEVERTEXARRAYATTRIBEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexArrayAttribEXT")) == NULL) || r; + r = ((glEnableVertexArrayEXT = (PFNGLENABLEVERTEXARRAYEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexArrayEXT")) == NULL) || r; + r = ((glFlushMappedNamedBufferRangeEXT = (PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC)glewGetProcAddress((const GLubyte*)"glFlushMappedNamedBufferRangeEXT")) == NULL) || r; + r = ((glFramebufferDrawBufferEXT = (PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferDrawBufferEXT")) == NULL) || r; + r = ((glFramebufferDrawBuffersEXT = (PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferDrawBuffersEXT")) == NULL) || r; + r = ((glFramebufferReadBufferEXT = (PFNGLFRAMEBUFFERREADBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferReadBufferEXT")) == NULL) || r; + r = ((glGenerateMultiTexMipmapEXT = (PFNGLGENERATEMULTITEXMIPMAPEXTPROC)glewGetProcAddress((const GLubyte*)"glGenerateMultiTexMipmapEXT")) == NULL) || r; + r = ((glGenerateTextureMipmapEXT = (PFNGLGENERATETEXTUREMIPMAPEXTPROC)glewGetProcAddress((const GLubyte*)"glGenerateTextureMipmapEXT")) == NULL) || r; + r = ((glGetCompressedMultiTexImageEXT = (PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedMultiTexImageEXT")) == NULL) || r; + r = ((glGetCompressedTextureImageEXT = (PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTextureImageEXT")) == NULL) || r; + r = ((glGetDoubleIndexedvEXT = (PFNGLGETDOUBLEINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetDoubleIndexedvEXT")) == NULL) || r; + r = ((glGetDoublei_vEXT = (PFNGLGETDOUBLEI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetDoublei_vEXT")) == NULL) || r; + r = ((glGetFloatIndexedvEXT = (PFNGLGETFLOATINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFloatIndexedvEXT")) == NULL) || r; + r = ((glGetFloati_vEXT = (PFNGLGETFLOATI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFloati_vEXT")) == NULL) || r; + r = ((glGetFramebufferParameterivEXT = (PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFramebufferParameterivEXT")) == NULL) || r; + r = ((glGetMultiTexEnvfvEXT = (PFNGLGETMULTITEXENVFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexEnvfvEXT")) == NULL) || r; + r = ((glGetMultiTexEnvivEXT = (PFNGLGETMULTITEXENVIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexEnvivEXT")) == NULL) || r; + r = ((glGetMultiTexGendvEXT = (PFNGLGETMULTITEXGENDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexGendvEXT")) == NULL) || r; + r = ((glGetMultiTexGenfvEXT = (PFNGLGETMULTITEXGENFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexGenfvEXT")) == NULL) || r; + r = ((glGetMultiTexGenivEXT = (PFNGLGETMULTITEXGENIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexGenivEXT")) == NULL) || r; + r = ((glGetMultiTexImageEXT = (PFNGLGETMULTITEXIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexImageEXT")) == NULL) || r; + r = ((glGetMultiTexLevelParameterfvEXT = (PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexLevelParameterfvEXT")) == NULL) || r; + r = ((glGetMultiTexLevelParameterivEXT = (PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexLevelParameterivEXT")) == NULL) || r; + r = ((glGetMultiTexParameterIivEXT = (PFNGLGETMULTITEXPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexParameterIivEXT")) == NULL) || r; + r = ((glGetMultiTexParameterIuivEXT = (PFNGLGETMULTITEXPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexParameterIuivEXT")) == NULL) || r; + r = ((glGetMultiTexParameterfvEXT = (PFNGLGETMULTITEXPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexParameterfvEXT")) == NULL) || r; + r = ((glGetMultiTexParameterivEXT = (PFNGLGETMULTITEXPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMultiTexParameterivEXT")) == NULL) || r; + r = ((glGetNamedBufferParameterivEXT = (PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferParameterivEXT")) == NULL) || r; + r = ((glGetNamedBufferPointervEXT = (PFNGLGETNAMEDBUFFERPOINTERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferPointervEXT")) == NULL) || r; + r = ((glGetNamedBufferSubDataEXT = (PFNGLGETNAMEDBUFFERSUBDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferSubDataEXT")) == NULL) || r; + r = ((glGetNamedFramebufferAttachmentParameterivEXT = (PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedFramebufferAttachmentParameterivEXT")) == NULL) || r; + r = ((glGetNamedProgramLocalParameterIivEXT = (PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramLocalParameterIivEXT")) == NULL) || r; + r = ((glGetNamedProgramLocalParameterIuivEXT = (PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramLocalParameterIuivEXT")) == NULL) || r; + r = ((glGetNamedProgramLocalParameterdvEXT = (PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramLocalParameterdvEXT")) == NULL) || r; + r = ((glGetNamedProgramLocalParameterfvEXT = (PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramLocalParameterfvEXT")) == NULL) || r; + r = ((glGetNamedProgramStringEXT = (PFNGLGETNAMEDPROGRAMSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramStringEXT")) == NULL) || r; + r = ((glGetNamedProgramivEXT = (PFNGLGETNAMEDPROGRAMIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedProgramivEXT")) == NULL) || r; + r = ((glGetNamedRenderbufferParameterivEXT = (PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetNamedRenderbufferParameterivEXT")) == NULL) || r; + r = ((glGetPointerIndexedvEXT = (PFNGLGETPOINTERINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPointerIndexedvEXT")) == NULL) || r; + r = ((glGetPointeri_vEXT = (PFNGLGETPOINTERI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPointeri_vEXT")) == NULL) || r; + r = ((glGetTextureImageEXT = (PFNGLGETTEXTUREIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureImageEXT")) == NULL) || r; + r = ((glGetTextureLevelParameterfvEXT = (PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureLevelParameterfvEXT")) == NULL) || r; + r = ((glGetTextureLevelParameterivEXT = (PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureLevelParameterivEXT")) == NULL) || r; + r = ((glGetTextureParameterIivEXT = (PFNGLGETTEXTUREPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterIivEXT")) == NULL) || r; + r = ((glGetTextureParameterIuivEXT = (PFNGLGETTEXTUREPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterIuivEXT")) == NULL) || r; + r = ((glGetTextureParameterfvEXT = (PFNGLGETTEXTUREPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterfvEXT")) == NULL) || r; + r = ((glGetTextureParameterivEXT = (PFNGLGETTEXTUREPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTextureParameterivEXT")) == NULL) || r; + r = ((glGetVertexArrayIntegeri_vEXT = (PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayIntegeri_vEXT")) == NULL) || r; + r = ((glGetVertexArrayIntegervEXT = (PFNGLGETVERTEXARRAYINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayIntegervEXT")) == NULL) || r; + r = ((glGetVertexArrayPointeri_vEXT = (PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayPointeri_vEXT")) == NULL) || r; + r = ((glGetVertexArrayPointervEXT = (PFNGLGETVERTEXARRAYPOINTERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexArrayPointervEXT")) == NULL) || r; + r = ((glMapNamedBufferEXT = (PFNGLMAPNAMEDBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glMapNamedBufferEXT")) == NULL) || r; + r = ((glMapNamedBufferRangeEXT = (PFNGLMAPNAMEDBUFFERRANGEEXTPROC)glewGetProcAddress((const GLubyte*)"glMapNamedBufferRangeEXT")) == NULL) || r; + r = ((glMatrixFrustumEXT = (PFNGLMATRIXFRUSTUMEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixFrustumEXT")) == NULL) || r; + r = ((glMatrixLoadIdentityEXT = (PFNGLMATRIXLOADIDENTITYEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoadIdentityEXT")) == NULL) || r; + r = ((glMatrixLoadTransposedEXT = (PFNGLMATRIXLOADTRANSPOSEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoadTransposedEXT")) == NULL) || r; + r = ((glMatrixLoadTransposefEXT = (PFNGLMATRIXLOADTRANSPOSEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoadTransposefEXT")) == NULL) || r; + r = ((glMatrixLoaddEXT = (PFNGLMATRIXLOADDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoaddEXT")) == NULL) || r; + r = ((glMatrixLoadfEXT = (PFNGLMATRIXLOADFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoadfEXT")) == NULL) || r; + r = ((glMatrixMultTransposedEXT = (PFNGLMATRIXMULTTRANSPOSEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixMultTransposedEXT")) == NULL) || r; + r = ((glMatrixMultTransposefEXT = (PFNGLMATRIXMULTTRANSPOSEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixMultTransposefEXT")) == NULL) || r; + r = ((glMatrixMultdEXT = (PFNGLMATRIXMULTDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixMultdEXT")) == NULL) || r; + r = ((glMatrixMultfEXT = (PFNGLMATRIXMULTFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixMultfEXT")) == NULL) || r; + r = ((glMatrixOrthoEXT = (PFNGLMATRIXORTHOEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixOrthoEXT")) == NULL) || r; + r = ((glMatrixPopEXT = (PFNGLMATRIXPOPEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixPopEXT")) == NULL) || r; + r = ((glMatrixPushEXT = (PFNGLMATRIXPUSHEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixPushEXT")) == NULL) || r; + r = ((glMatrixRotatedEXT = (PFNGLMATRIXROTATEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixRotatedEXT")) == NULL) || r; + r = ((glMatrixRotatefEXT = (PFNGLMATRIXROTATEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixRotatefEXT")) == NULL) || r; + r = ((glMatrixScaledEXT = (PFNGLMATRIXSCALEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixScaledEXT")) == NULL) || r; + r = ((glMatrixScalefEXT = (PFNGLMATRIXSCALEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixScalefEXT")) == NULL) || r; + r = ((glMatrixTranslatedEXT = (PFNGLMATRIXTRANSLATEDEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixTranslatedEXT")) == NULL) || r; + r = ((glMatrixTranslatefEXT = (PFNGLMATRIXTRANSLATEFEXTPROC)glewGetProcAddress((const GLubyte*)"glMatrixTranslatefEXT")) == NULL) || r; + r = ((glMultiTexBufferEXT = (PFNGLMULTITEXBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexBufferEXT")) == NULL) || r; + r = ((glMultiTexCoordPointerEXT = (PFNGLMULTITEXCOORDPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoordPointerEXT")) == NULL) || r; + r = ((glMultiTexEnvfEXT = (PFNGLMULTITEXENVFEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexEnvfEXT")) == NULL) || r; + r = ((glMultiTexEnvfvEXT = (PFNGLMULTITEXENVFVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexEnvfvEXT")) == NULL) || r; + r = ((glMultiTexEnviEXT = (PFNGLMULTITEXENVIEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexEnviEXT")) == NULL) || r; + r = ((glMultiTexEnvivEXT = (PFNGLMULTITEXENVIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexEnvivEXT")) == NULL) || r; + r = ((glMultiTexGendEXT = (PFNGLMULTITEXGENDEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGendEXT")) == NULL) || r; + r = ((glMultiTexGendvEXT = (PFNGLMULTITEXGENDVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGendvEXT")) == NULL) || r; + r = ((glMultiTexGenfEXT = (PFNGLMULTITEXGENFEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGenfEXT")) == NULL) || r; + r = ((glMultiTexGenfvEXT = (PFNGLMULTITEXGENFVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGenfvEXT")) == NULL) || r; + r = ((glMultiTexGeniEXT = (PFNGLMULTITEXGENIEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGeniEXT")) == NULL) || r; + r = ((glMultiTexGenivEXT = (PFNGLMULTITEXGENIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexGenivEXT")) == NULL) || r; + r = ((glMultiTexImage1DEXT = (PFNGLMULTITEXIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexImage1DEXT")) == NULL) || r; + r = ((glMultiTexImage2DEXT = (PFNGLMULTITEXIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexImage2DEXT")) == NULL) || r; + r = ((glMultiTexImage3DEXT = (PFNGLMULTITEXIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexImage3DEXT")) == NULL) || r; + r = ((glMultiTexParameterIivEXT = (PFNGLMULTITEXPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterIivEXT")) == NULL) || r; + r = ((glMultiTexParameterIuivEXT = (PFNGLMULTITEXPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterIuivEXT")) == NULL) || r; + r = ((glMultiTexParameterfEXT = (PFNGLMULTITEXPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterfEXT")) == NULL) || r; + r = ((glMultiTexParameterfvEXT = (PFNGLMULTITEXPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterfvEXT")) == NULL) || r; + r = ((glMultiTexParameteriEXT = (PFNGLMULTITEXPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameteriEXT")) == NULL) || r; + r = ((glMultiTexParameterivEXT = (PFNGLMULTITEXPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexParameterivEXT")) == NULL) || r; + r = ((glMultiTexRenderbufferEXT = (PFNGLMULTITEXRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexRenderbufferEXT")) == NULL) || r; + r = ((glMultiTexSubImage1DEXT = (PFNGLMULTITEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexSubImage1DEXT")) == NULL) || r; + r = ((glMultiTexSubImage2DEXT = (PFNGLMULTITEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexSubImage2DEXT")) == NULL) || r; + r = ((glMultiTexSubImage3DEXT = (PFNGLMULTITEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiTexSubImage3DEXT")) == NULL) || r; + r = ((glNamedBufferDataEXT = (PFNGLNAMEDBUFFERDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferDataEXT")) == NULL) || r; + r = ((glNamedBufferSubDataEXT = (PFNGLNAMEDBUFFERSUBDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferSubDataEXT")) == NULL) || r; + r = ((glNamedCopyBufferSubDataEXT = (PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedCopyBufferSubDataEXT")) == NULL) || r; + r = ((glNamedFramebufferRenderbufferEXT = (PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferRenderbufferEXT")) == NULL) || r; + r = ((glNamedFramebufferTexture1DEXT = (PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTexture1DEXT")) == NULL) || r; + r = ((glNamedFramebufferTexture2DEXT = (PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTexture2DEXT")) == NULL) || r; + r = ((glNamedFramebufferTexture3DEXT = (PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTexture3DEXT")) == NULL) || r; + r = ((glNamedFramebufferTextureEXT = (PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTextureEXT")) == NULL) || r; + r = ((glNamedFramebufferTextureFaceEXT = (PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTextureFaceEXT")) == NULL) || r; + r = ((glNamedFramebufferTextureLayerEXT = (PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferTextureLayerEXT")) == NULL) || r; + r = ((glNamedProgramLocalParameter4dEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameter4dEXT")) == NULL) || r; + r = ((glNamedProgramLocalParameter4dvEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameter4dvEXT")) == NULL) || r; + r = ((glNamedProgramLocalParameter4fEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameter4fEXT")) == NULL) || r; + r = ((glNamedProgramLocalParameter4fvEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameter4fvEXT")) == NULL) || r; + r = ((glNamedProgramLocalParameterI4iEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameterI4iEXT")) == NULL) || r; + r = ((glNamedProgramLocalParameterI4ivEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameterI4ivEXT")) == NULL) || r; + r = ((glNamedProgramLocalParameterI4uiEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameterI4uiEXT")) == NULL) || r; + r = ((glNamedProgramLocalParameterI4uivEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameterI4uivEXT")) == NULL) || r; + r = ((glNamedProgramLocalParameters4fvEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParameters4fvEXT")) == NULL) || r; + r = ((glNamedProgramLocalParametersI4ivEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParametersI4ivEXT")) == NULL) || r; + r = ((glNamedProgramLocalParametersI4uivEXT = (PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramLocalParametersI4uivEXT")) == NULL) || r; + r = ((glNamedProgramStringEXT = (PFNGLNAMEDPROGRAMSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedProgramStringEXT")) == NULL) || r; + r = ((glNamedRenderbufferStorageEXT = (PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedRenderbufferStorageEXT")) == NULL) || r; + r = ((glNamedRenderbufferStorageMultisampleCoverageEXT = (PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedRenderbufferStorageMultisampleCoverageEXT")) == NULL) || r; + r = ((glNamedRenderbufferStorageMultisampleEXT = (PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedRenderbufferStorageMultisampleEXT")) == NULL) || r; + r = ((glProgramUniform1fEXT = (PFNGLPROGRAMUNIFORM1FEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1fEXT")) == NULL) || r; + r = ((glProgramUniform1fvEXT = (PFNGLPROGRAMUNIFORM1FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1fvEXT")) == NULL) || r; + r = ((glProgramUniform1iEXT = (PFNGLPROGRAMUNIFORM1IEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1iEXT")) == NULL) || r; + r = ((glProgramUniform1ivEXT = (PFNGLPROGRAMUNIFORM1IVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ivEXT")) == NULL) || r; + r = ((glProgramUniform1uiEXT = (PFNGLPROGRAMUNIFORM1UIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1uiEXT")) == NULL) || r; + r = ((glProgramUniform1uivEXT = (PFNGLPROGRAMUNIFORM1UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1uivEXT")) == NULL) || r; + r = ((glProgramUniform2fEXT = (PFNGLPROGRAMUNIFORM2FEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2fEXT")) == NULL) || r; + r = ((glProgramUniform2fvEXT = (PFNGLPROGRAMUNIFORM2FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2fvEXT")) == NULL) || r; + r = ((glProgramUniform2iEXT = (PFNGLPROGRAMUNIFORM2IEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2iEXT")) == NULL) || r; + r = ((glProgramUniform2ivEXT = (PFNGLPROGRAMUNIFORM2IVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ivEXT")) == NULL) || r; + r = ((glProgramUniform2uiEXT = (PFNGLPROGRAMUNIFORM2UIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2uiEXT")) == NULL) || r; + r = ((glProgramUniform2uivEXT = (PFNGLPROGRAMUNIFORM2UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2uivEXT")) == NULL) || r; + r = ((glProgramUniform3fEXT = (PFNGLPROGRAMUNIFORM3FEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3fEXT")) == NULL) || r; + r = ((glProgramUniform3fvEXT = (PFNGLPROGRAMUNIFORM3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3fvEXT")) == NULL) || r; + r = ((glProgramUniform3iEXT = (PFNGLPROGRAMUNIFORM3IEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3iEXT")) == NULL) || r; + r = ((glProgramUniform3ivEXT = (PFNGLPROGRAMUNIFORM3IVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ivEXT")) == NULL) || r; + r = ((glProgramUniform3uiEXT = (PFNGLPROGRAMUNIFORM3UIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3uiEXT")) == NULL) || r; + r = ((glProgramUniform3uivEXT = (PFNGLPROGRAMUNIFORM3UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3uivEXT")) == NULL) || r; + r = ((glProgramUniform4fEXT = (PFNGLPROGRAMUNIFORM4FEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4fEXT")) == NULL) || r; + r = ((glProgramUniform4fvEXT = (PFNGLPROGRAMUNIFORM4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4fvEXT")) == NULL) || r; + r = ((glProgramUniform4iEXT = (PFNGLPROGRAMUNIFORM4IEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4iEXT")) == NULL) || r; + r = ((glProgramUniform4ivEXT = (PFNGLPROGRAMUNIFORM4IVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ivEXT")) == NULL) || r; + r = ((glProgramUniform4uiEXT = (PFNGLPROGRAMUNIFORM4UIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4uiEXT")) == NULL) || r; + r = ((glProgramUniform4uivEXT = (PFNGLPROGRAMUNIFORM4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4uivEXT")) == NULL) || r; + r = ((glProgramUniformMatrix2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2fvEXT")) == NULL) || r; + r = ((glProgramUniformMatrix2x3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x3fvEXT")) == NULL) || r; + r = ((glProgramUniformMatrix2x4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix2x4fvEXT")) == NULL) || r; + r = ((glProgramUniformMatrix3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3fvEXT")) == NULL) || r; + r = ((glProgramUniformMatrix3x2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x2fvEXT")) == NULL) || r; + r = ((glProgramUniformMatrix3x4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix3x4fvEXT")) == NULL) || r; + r = ((glProgramUniformMatrix4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4fvEXT")) == NULL) || r; + r = ((glProgramUniformMatrix4x2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x2fvEXT")) == NULL) || r; + r = ((glProgramUniformMatrix4x3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformMatrix4x3fvEXT")) == NULL) || r; + r = ((glPushClientAttribDefaultEXT = (PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC)glewGetProcAddress((const GLubyte*)"glPushClientAttribDefaultEXT")) == NULL) || r; + r = ((glTextureBufferEXT = (PFNGLTEXTUREBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glTextureBufferEXT")) == NULL) || r; + r = ((glTextureImage1DEXT = (PFNGLTEXTUREIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureImage1DEXT")) == NULL) || r; + r = ((glTextureImage2DEXT = (PFNGLTEXTUREIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureImage2DEXT")) == NULL) || r; + r = ((glTextureImage3DEXT = (PFNGLTEXTUREIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureImage3DEXT")) == NULL) || r; + r = ((glTextureParameterIivEXT = (PFNGLTEXTUREPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterIivEXT")) == NULL) || r; + r = ((glTextureParameterIuivEXT = (PFNGLTEXTUREPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterIuivEXT")) == NULL) || r; + r = ((glTextureParameterfEXT = (PFNGLTEXTUREPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterfEXT")) == NULL) || r; + r = ((glTextureParameterfvEXT = (PFNGLTEXTUREPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterfvEXT")) == NULL) || r; + r = ((glTextureParameteriEXT = (PFNGLTEXTUREPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameteriEXT")) == NULL) || r; + r = ((glTextureParameterivEXT = (PFNGLTEXTUREPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureParameterivEXT")) == NULL) || r; + r = ((glTextureRenderbufferEXT = (PFNGLTEXTURERENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glTextureRenderbufferEXT")) == NULL) || r; + r = ((glTextureSubImage1DEXT = (PFNGLTEXTURESUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage1DEXT")) == NULL) || r; + r = ((glTextureSubImage2DEXT = (PFNGLTEXTURESUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage2DEXT")) == NULL) || r; + r = ((glTextureSubImage3DEXT = (PFNGLTEXTURESUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureSubImage3DEXT")) == NULL) || r; + r = ((glUnmapNamedBufferEXT = (PFNGLUNMAPNAMEDBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glUnmapNamedBufferEXT")) == NULL) || r; + r = ((glVertexArrayColorOffsetEXT = (PFNGLVERTEXARRAYCOLOROFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayColorOffsetEXT")) == NULL) || r; + r = ((glVertexArrayEdgeFlagOffsetEXT = (PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayEdgeFlagOffsetEXT")) == NULL) || r; + r = ((glVertexArrayFogCoordOffsetEXT = (PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayFogCoordOffsetEXT")) == NULL) || r; + r = ((glVertexArrayIndexOffsetEXT = (PFNGLVERTEXARRAYINDEXOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayIndexOffsetEXT")) == NULL) || r; + r = ((glVertexArrayMultiTexCoordOffsetEXT = (PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayMultiTexCoordOffsetEXT")) == NULL) || r; + r = ((glVertexArrayNormalOffsetEXT = (PFNGLVERTEXARRAYNORMALOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayNormalOffsetEXT")) == NULL) || r; + r = ((glVertexArraySecondaryColorOffsetEXT = (PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArraySecondaryColorOffsetEXT")) == NULL) || r; + r = ((glVertexArrayTexCoordOffsetEXT = (PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayTexCoordOffsetEXT")) == NULL) || r; + r = ((glVertexArrayVertexAttribDivisorEXT = (PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribDivisorEXT")) == NULL) || r; + r = ((glVertexArrayVertexAttribIOffsetEXT = (PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribIOffsetEXT")) == NULL) || r; + r = ((glVertexArrayVertexAttribOffsetEXT = (PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribOffsetEXT")) == NULL) || r; + r = ((glVertexArrayVertexOffsetEXT = (PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexOffsetEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_direct_state_access */ + +#ifdef GL_EXT_draw_buffers2 + +static GLboolean _glewInit_GL_EXT_draw_buffers2 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColorMaskIndexedEXT = (PFNGLCOLORMASKINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glColorMaskIndexedEXT")) == NULL) || r; + r = ((glDisableIndexedEXT = (PFNGLDISABLEINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableIndexedEXT")) == NULL) || r; + r = ((glEnableIndexedEXT = (PFNGLENABLEINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableIndexedEXT")) == NULL) || r; + r = ((glGetBooleanIndexedvEXT = (PFNGLGETBOOLEANINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetBooleanIndexedvEXT")) == NULL) || r; + r = ((glGetIntegerIndexedvEXT = (PFNGLGETINTEGERINDEXEDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetIntegerIndexedvEXT")) == NULL) || r; + r = ((glIsEnabledIndexedEXT = (PFNGLISENABLEDINDEXEDEXTPROC)glewGetProcAddress((const GLubyte*)"glIsEnabledIndexedEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_draw_buffers2 */ + +#ifdef GL_EXT_draw_instanced + +static GLboolean _glewInit_GL_EXT_draw_instanced (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawArraysInstancedEXT = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstancedEXT")) == NULL) || r; + r = ((glDrawElementsInstancedEXT = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_draw_instanced */ + +#ifdef GL_EXT_draw_range_elements + +static GLboolean _glewInit_GL_EXT_draw_range_elements (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawRangeElementsEXT = (PFNGLDRAWRANGEELEMENTSEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementsEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_draw_range_elements */ + +#ifdef GL_EXT_fog_coord + +static GLboolean _glewInit_GL_EXT_fog_coord (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFogCoordPointerEXT = (PFNGLFOGCOORDPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoordPointerEXT")) == NULL) || r; + r = ((glFogCoorddEXT = (PFNGLFOGCOORDDEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoorddEXT")) == NULL) || r; + r = ((glFogCoorddvEXT = (PFNGLFOGCOORDDVEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoorddvEXT")) == NULL) || r; + r = ((glFogCoordfEXT = (PFNGLFOGCOORDFEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoordfEXT")) == NULL) || r; + r = ((glFogCoordfvEXT = (PFNGLFOGCOORDFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoordfvEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_fog_coord */ + +#ifdef GL_EXT_fragment_lighting + +static GLboolean _glewInit_GL_EXT_fragment_lighting (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFragmentColorMaterialEXT = (PFNGLFRAGMENTCOLORMATERIALEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentColorMaterialEXT")) == NULL) || r; + r = ((glFragmentLightModelfEXT = (PFNGLFRAGMENTLIGHTMODELFEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfEXT")) == NULL) || r; + r = ((glFragmentLightModelfvEXT = (PFNGLFRAGMENTLIGHTMODELFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfvEXT")) == NULL) || r; + r = ((glFragmentLightModeliEXT = (PFNGLFRAGMENTLIGHTMODELIEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModeliEXT")) == NULL) || r; + r = ((glFragmentLightModelivEXT = (PFNGLFRAGMENTLIGHTMODELIVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelivEXT")) == NULL) || r; + r = ((glFragmentLightfEXT = (PFNGLFRAGMENTLIGHTFEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfEXT")) == NULL) || r; + r = ((glFragmentLightfvEXT = (PFNGLFRAGMENTLIGHTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfvEXT")) == NULL) || r; + r = ((glFragmentLightiEXT = (PFNGLFRAGMENTLIGHTIEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightiEXT")) == NULL) || r; + r = ((glFragmentLightivEXT = (PFNGLFRAGMENTLIGHTIVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightivEXT")) == NULL) || r; + r = ((glFragmentMaterialfEXT = (PFNGLFRAGMENTMATERIALFEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfEXT")) == NULL) || r; + r = ((glFragmentMaterialfvEXT = (PFNGLFRAGMENTMATERIALFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfvEXT")) == NULL) || r; + r = ((glFragmentMaterialiEXT = (PFNGLFRAGMENTMATERIALIEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialiEXT")) == NULL) || r; + r = ((glFragmentMaterialivEXT = (PFNGLFRAGMENTMATERIALIVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialivEXT")) == NULL) || r; + r = ((glGetFragmentLightfvEXT = (PFNGLGETFRAGMENTLIGHTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightfvEXT")) == NULL) || r; + r = ((glGetFragmentLightivEXT = (PFNGLGETFRAGMENTLIGHTIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightivEXT")) == NULL) || r; + r = ((glGetFragmentMaterialfvEXT = (PFNGLGETFRAGMENTMATERIALFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialfvEXT")) == NULL) || r; + r = ((glGetFragmentMaterialivEXT = (PFNGLGETFRAGMENTMATERIALIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialivEXT")) == NULL) || r; + r = ((glLightEnviEXT = (PFNGLLIGHTENVIEXTPROC)glewGetProcAddress((const GLubyte*)"glLightEnviEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_fragment_lighting */ + +#ifdef GL_EXT_framebuffer_blit + +static GLboolean _glewInit_GL_EXT_framebuffer_blit (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlitFramebufferEXT = (PFNGLBLITFRAMEBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glBlitFramebufferEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_framebuffer_blit */ + +#ifdef GL_EXT_framebuffer_multisample + +static GLboolean _glewInit_GL_EXT_framebuffer_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageMultisampleEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_framebuffer_multisample */ + +#ifdef GL_EXT_framebuffer_object + +static GLboolean _glewInit_GL_EXT_framebuffer_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindFramebufferEXT")) == NULL) || r; + r = ((glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindRenderbufferEXT")) == NULL) || r; + r = ((glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)glewGetProcAddress((const GLubyte*)"glCheckFramebufferStatusEXT")) == NULL) || r; + r = ((glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteFramebuffersEXT")) == NULL) || r; + r = ((glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteRenderbuffersEXT")) == NULL) || r; + r = ((glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferRenderbufferEXT")) == NULL) || r; + r = ((glFramebufferTexture1DEXT = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture1DEXT")) == NULL) || r; + r = ((glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture2DEXT")) == NULL) || r; + r = ((glFramebufferTexture3DEXT = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture3DEXT")) == NULL) || r; + r = ((glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenFramebuffersEXT")) == NULL) || r; + r = ((glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenRenderbuffersEXT")) == NULL) || r; + r = ((glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC)glewGetProcAddress((const GLubyte*)"glGenerateMipmapEXT")) == NULL) || r; + r = ((glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFramebufferAttachmentParameterivEXT")) == NULL) || r; + r = ((glGetRenderbufferParameterivEXT = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetRenderbufferParameterivEXT")) == NULL) || r; + r = ((glIsFramebufferEXT = (PFNGLISFRAMEBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glIsFramebufferEXT")) == NULL) || r; + r = ((glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glIsRenderbufferEXT")) == NULL) || r; + r = ((glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_framebuffer_object */ + +#ifdef GL_EXT_geometry_shader4 + +static GLboolean _glewInit_GL_EXT_geometry_shader4 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFramebufferTextureEXT = (PFNGLFRAMEBUFFERTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureEXT")) == NULL) || r; + r = ((glFramebufferTextureFaceEXT = (PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureFaceEXT")) == NULL) || r; + r = ((glProgramParameteriEXT = (PFNGLPROGRAMPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramParameteriEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_geometry_shader4 */ + +#ifdef GL_EXT_gpu_program_parameters + +static GLboolean _glewInit_GL_EXT_gpu_program_parameters (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glProgramEnvParameters4fvEXT = (PFNGLPROGRAMENVPARAMETERS4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameters4fvEXT")) == NULL) || r; + r = ((glProgramLocalParameters4fvEXT = (PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameters4fvEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_gpu_program_parameters */ + +#ifdef GL_EXT_gpu_shader4 + +static GLboolean _glewInit_GL_EXT_gpu_shader4 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindFragDataLocationEXT = (PFNGLBINDFRAGDATALOCATIONEXTPROC)glewGetProcAddress((const GLubyte*)"glBindFragDataLocationEXT")) == NULL) || r; + r = ((glGetFragDataLocationEXT = (PFNGLGETFRAGDATALOCATIONEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragDataLocationEXT")) == NULL) || r; + r = ((glGetUniformuivEXT = (PFNGLGETUNIFORMUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetUniformuivEXT")) == NULL) || r; + r = ((glGetVertexAttribIivEXT = (PFNGLGETVERTEXATTRIBIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribIivEXT")) == NULL) || r; + r = ((glGetVertexAttribIuivEXT = (PFNGLGETVERTEXATTRIBIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribIuivEXT")) == NULL) || r; + r = ((glUniform1uiEXT = (PFNGLUNIFORM1UIEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform1uiEXT")) == NULL) || r; + r = ((glUniform1uivEXT = (PFNGLUNIFORM1UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform1uivEXT")) == NULL) || r; + r = ((glUniform2uiEXT = (PFNGLUNIFORM2UIEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform2uiEXT")) == NULL) || r; + r = ((glUniform2uivEXT = (PFNGLUNIFORM2UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform2uivEXT")) == NULL) || r; + r = ((glUniform3uiEXT = (PFNGLUNIFORM3UIEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform3uiEXT")) == NULL) || r; + r = ((glUniform3uivEXT = (PFNGLUNIFORM3UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform3uivEXT")) == NULL) || r; + r = ((glUniform4uiEXT = (PFNGLUNIFORM4UIEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform4uiEXT")) == NULL) || r; + r = ((glUniform4uivEXT = (PFNGLUNIFORM4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glUniform4uivEXT")) == NULL) || r; + r = ((glVertexAttribI1iEXT = (PFNGLVERTEXATTRIBI1IEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1iEXT")) == NULL) || r; + r = ((glVertexAttribI1ivEXT = (PFNGLVERTEXATTRIBI1IVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1ivEXT")) == NULL) || r; + r = ((glVertexAttribI1uiEXT = (PFNGLVERTEXATTRIBI1UIEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1uiEXT")) == NULL) || r; + r = ((glVertexAttribI1uivEXT = (PFNGLVERTEXATTRIBI1UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI1uivEXT")) == NULL) || r; + r = ((glVertexAttribI2iEXT = (PFNGLVERTEXATTRIBI2IEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2iEXT")) == NULL) || r; + r = ((glVertexAttribI2ivEXT = (PFNGLVERTEXATTRIBI2IVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2ivEXT")) == NULL) || r; + r = ((glVertexAttribI2uiEXT = (PFNGLVERTEXATTRIBI2UIEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2uiEXT")) == NULL) || r; + r = ((glVertexAttribI2uivEXT = (PFNGLVERTEXATTRIBI2UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI2uivEXT")) == NULL) || r; + r = ((glVertexAttribI3iEXT = (PFNGLVERTEXATTRIBI3IEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3iEXT")) == NULL) || r; + r = ((glVertexAttribI3ivEXT = (PFNGLVERTEXATTRIBI3IVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3ivEXT")) == NULL) || r; + r = ((glVertexAttribI3uiEXT = (PFNGLVERTEXATTRIBI3UIEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3uiEXT")) == NULL) || r; + r = ((glVertexAttribI3uivEXT = (PFNGLVERTEXATTRIBI3UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI3uivEXT")) == NULL) || r; + r = ((glVertexAttribI4bvEXT = (PFNGLVERTEXATTRIBI4BVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4bvEXT")) == NULL) || r; + r = ((glVertexAttribI4iEXT = (PFNGLVERTEXATTRIBI4IEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4iEXT")) == NULL) || r; + r = ((glVertexAttribI4ivEXT = (PFNGLVERTEXATTRIBI4IVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4ivEXT")) == NULL) || r; + r = ((glVertexAttribI4svEXT = (PFNGLVERTEXATTRIBI4SVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4svEXT")) == NULL) || r; + r = ((glVertexAttribI4ubvEXT = (PFNGLVERTEXATTRIBI4UBVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4ubvEXT")) == NULL) || r; + r = ((glVertexAttribI4uiEXT = (PFNGLVERTEXATTRIBI4UIEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4uiEXT")) == NULL) || r; + r = ((glVertexAttribI4uivEXT = (PFNGLVERTEXATTRIBI4UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4uivEXT")) == NULL) || r; + r = ((glVertexAttribI4usvEXT = (PFNGLVERTEXATTRIBI4USVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribI4usvEXT")) == NULL) || r; + r = ((glVertexAttribIPointerEXT = (PFNGLVERTEXATTRIBIPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribIPointerEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_gpu_shader4 */ + +#ifdef GL_EXT_histogram + +static GLboolean _glewInit_GL_EXT_histogram (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetHistogramEXT = (PFNGLGETHISTOGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramEXT")) == NULL) || r; + r = ((glGetHistogramParameterfvEXT = (PFNGLGETHISTOGRAMPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameterfvEXT")) == NULL) || r; + r = ((glGetHistogramParameterivEXT = (PFNGLGETHISTOGRAMPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameterivEXT")) == NULL) || r; + r = ((glGetMinmaxEXT = (PFNGLGETMINMAXEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxEXT")) == NULL) || r; + r = ((glGetMinmaxParameterfvEXT = (PFNGLGETMINMAXPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameterfvEXT")) == NULL) || r; + r = ((glGetMinmaxParameterivEXT = (PFNGLGETMINMAXPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameterivEXT")) == NULL) || r; + r = ((glHistogramEXT = (PFNGLHISTOGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glHistogramEXT")) == NULL) || r; + r = ((glMinmaxEXT = (PFNGLMINMAXEXTPROC)glewGetProcAddress((const GLubyte*)"glMinmaxEXT")) == NULL) || r; + r = ((glResetHistogramEXT = (PFNGLRESETHISTOGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glResetHistogramEXT")) == NULL) || r; + r = ((glResetMinmaxEXT = (PFNGLRESETMINMAXEXTPROC)glewGetProcAddress((const GLubyte*)"glResetMinmaxEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_histogram */ + +#ifdef GL_EXT_index_func + +static GLboolean _glewInit_GL_EXT_index_func (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glIndexFuncEXT = (PFNGLINDEXFUNCEXTPROC)glewGetProcAddress((const GLubyte*)"glIndexFuncEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_index_func */ + +#ifdef GL_EXT_index_material + +static GLboolean _glewInit_GL_EXT_index_material (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glIndexMaterialEXT = (PFNGLINDEXMATERIALEXTPROC)glewGetProcAddress((const GLubyte*)"glIndexMaterialEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_index_material */ + +#ifdef GL_EXT_light_texture + +static GLboolean _glewInit_GL_EXT_light_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glApplyTextureEXT = (PFNGLAPPLYTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glApplyTextureEXT")) == NULL) || r; + r = ((glTextureLightEXT = (PFNGLTEXTURELIGHTEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureLightEXT")) == NULL) || r; + r = ((glTextureMaterialEXT = (PFNGLTEXTUREMATERIALEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureMaterialEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_light_texture */ + +#ifdef GL_EXT_multi_draw_arrays + +static GLboolean _glewInit_GL_EXT_multi_draw_arrays (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMultiDrawArraysEXT = (PFNGLMULTIDRAWARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysEXT")) == NULL) || r; + r = ((glMultiDrawElementsEXT = (PFNGLMULTIDRAWELEMENTSEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_multi_draw_arrays */ + +#ifdef GL_EXT_multisample + +static GLboolean _glewInit_GL_EXT_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glSampleMaskEXT = (PFNGLSAMPLEMASKEXTPROC)glewGetProcAddress((const GLubyte*)"glSampleMaskEXT")) == NULL) || r; + r = ((glSamplePatternEXT = (PFNGLSAMPLEPATTERNEXTPROC)glewGetProcAddress((const GLubyte*)"glSamplePatternEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_multisample */ + +#ifdef GL_EXT_paletted_texture + +static GLboolean _glewInit_GL_EXT_paletted_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColorTableEXT = (PFNGLCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glColorTableEXT")) == NULL) || r; + r = ((glGetColorTableEXT = (PFNGLGETCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableEXT")) == NULL) || r; + r = ((glGetColorTableParameterfvEXT = (PFNGLGETCOLORTABLEPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterfvEXT")) == NULL) || r; + r = ((glGetColorTableParameterivEXT = (PFNGLGETCOLORTABLEPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterivEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_paletted_texture */ + +#ifdef GL_EXT_pixel_transform + +static GLboolean _glewInit_GL_EXT_pixel_transform (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetPixelTransformParameterfvEXT = (PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPixelTransformParameterfvEXT")) == NULL) || r; + r = ((glGetPixelTransformParameterivEXT = (PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPixelTransformParameterivEXT")) == NULL) || r; + r = ((glPixelTransformParameterfEXT = (PFNGLPIXELTRANSFORMPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameterfEXT")) == NULL) || r; + r = ((glPixelTransformParameterfvEXT = (PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameterfvEXT")) == NULL) || r; + r = ((glPixelTransformParameteriEXT = (PFNGLPIXELTRANSFORMPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameteriEXT")) == NULL) || r; + r = ((glPixelTransformParameterivEXT = (PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameterivEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_pixel_transform */ + +#ifdef GL_EXT_point_parameters + +static GLboolean _glewInit_GL_EXT_point_parameters (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPointParameterfEXT = (PFNGLPOINTPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfEXT")) == NULL) || r; + r = ((glPointParameterfvEXT = (PFNGLPOINTPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfvEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_point_parameters */ + +#ifdef GL_EXT_polygon_offset + +static GLboolean _glewInit_GL_EXT_polygon_offset (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPolygonOffsetEXT = (PFNGLPOLYGONOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glPolygonOffsetEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_polygon_offset */ + +#ifdef GL_EXT_polygon_offset_clamp + +static GLboolean _glewInit_GL_EXT_polygon_offset_clamp (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPolygonOffsetClampEXT = (PFNGLPOLYGONOFFSETCLAMPEXTPROC)glewGetProcAddress((const GLubyte*)"glPolygonOffsetClampEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_polygon_offset_clamp */ + +#ifdef GL_EXT_provoking_vertex + +static GLboolean _glewInit_GL_EXT_provoking_vertex (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glProvokingVertexEXT = (PFNGLPROVOKINGVERTEXEXTPROC)glewGetProcAddress((const GLubyte*)"glProvokingVertexEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_provoking_vertex */ + +#ifdef GL_EXT_raster_multisample + +static GLboolean _glewInit_GL_EXT_raster_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCoverageModulationNV = (PFNGLCOVERAGEMODULATIONNVPROC)glewGetProcAddress((const GLubyte*)"glCoverageModulationNV")) == NULL) || r; + r = ((glCoverageModulationTableNV = (PFNGLCOVERAGEMODULATIONTABLENVPROC)glewGetProcAddress((const GLubyte*)"glCoverageModulationTableNV")) == NULL) || r; + r = ((glGetCoverageModulationTableNV = (PFNGLGETCOVERAGEMODULATIONTABLENVPROC)glewGetProcAddress((const GLubyte*)"glGetCoverageModulationTableNV")) == NULL) || r; + r = ((glRasterSamplesEXT = (PFNGLRASTERSAMPLESEXTPROC)glewGetProcAddress((const GLubyte*)"glRasterSamplesEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_raster_multisample */ + +#ifdef GL_EXT_scene_marker + +static GLboolean _glewInit_GL_EXT_scene_marker (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginSceneEXT = (PFNGLBEGINSCENEEXTPROC)glewGetProcAddress((const GLubyte*)"glBeginSceneEXT")) == NULL) || r; + r = ((glEndSceneEXT = (PFNGLENDSCENEEXTPROC)glewGetProcAddress((const GLubyte*)"glEndSceneEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_scene_marker */ + +#ifdef GL_EXT_secondary_color + +static GLboolean _glewInit_GL_EXT_secondary_color (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glSecondaryColor3bEXT = (PFNGLSECONDARYCOLOR3BEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3bEXT")) == NULL) || r; + r = ((glSecondaryColor3bvEXT = (PFNGLSECONDARYCOLOR3BVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3bvEXT")) == NULL) || r; + r = ((glSecondaryColor3dEXT = (PFNGLSECONDARYCOLOR3DEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3dEXT")) == NULL) || r; + r = ((glSecondaryColor3dvEXT = (PFNGLSECONDARYCOLOR3DVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3dvEXT")) == NULL) || r; + r = ((glSecondaryColor3fEXT = (PFNGLSECONDARYCOLOR3FEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3fEXT")) == NULL) || r; + r = ((glSecondaryColor3fvEXT = (PFNGLSECONDARYCOLOR3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3fvEXT")) == NULL) || r; + r = ((glSecondaryColor3iEXT = (PFNGLSECONDARYCOLOR3IEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3iEXT")) == NULL) || r; + r = ((glSecondaryColor3ivEXT = (PFNGLSECONDARYCOLOR3IVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ivEXT")) == NULL) || r; + r = ((glSecondaryColor3sEXT = (PFNGLSECONDARYCOLOR3SEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3sEXT")) == NULL) || r; + r = ((glSecondaryColor3svEXT = (PFNGLSECONDARYCOLOR3SVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3svEXT")) == NULL) || r; + r = ((glSecondaryColor3ubEXT = (PFNGLSECONDARYCOLOR3UBEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ubEXT")) == NULL) || r; + r = ((glSecondaryColor3ubvEXT = (PFNGLSECONDARYCOLOR3UBVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ubvEXT")) == NULL) || r; + r = ((glSecondaryColor3uiEXT = (PFNGLSECONDARYCOLOR3UIEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3uiEXT")) == NULL) || r; + r = ((glSecondaryColor3uivEXT = (PFNGLSECONDARYCOLOR3UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3uivEXT")) == NULL) || r; + r = ((glSecondaryColor3usEXT = (PFNGLSECONDARYCOLOR3USEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3usEXT")) == NULL) || r; + r = ((glSecondaryColor3usvEXT = (PFNGLSECONDARYCOLOR3USVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3usvEXT")) == NULL) || r; + r = ((glSecondaryColorPointerEXT = (PFNGLSECONDARYCOLORPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorPointerEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_secondary_color */ + +#ifdef GL_EXT_separate_shader_objects + +static GLboolean _glewInit_GL_EXT_separate_shader_objects (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glActiveProgramEXT = (PFNGLACTIVEPROGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glActiveProgramEXT")) == NULL) || r; + r = ((glCreateShaderProgramEXT = (PFNGLCREATESHADERPROGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glCreateShaderProgramEXT")) == NULL) || r; + r = ((glUseShaderProgramEXT = (PFNGLUSESHADERPROGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glUseShaderProgramEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_separate_shader_objects */ + +#ifdef GL_EXT_shader_image_load_store + +static GLboolean _glewInit_GL_EXT_shader_image_load_store (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindImageTextureEXT = (PFNGLBINDIMAGETEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glBindImageTextureEXT")) == NULL) || r; + r = ((glMemoryBarrierEXT = (PFNGLMEMORYBARRIEREXTPROC)glewGetProcAddress((const GLubyte*)"glMemoryBarrierEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_shader_image_load_store */ + +#ifdef GL_EXT_stencil_two_side + +static GLboolean _glewInit_GL_EXT_stencil_two_side (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glActiveStencilFaceEXT = (PFNGLACTIVESTENCILFACEEXTPROC)glewGetProcAddress((const GLubyte*)"glActiveStencilFaceEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_stencil_two_side */ + +#ifdef GL_EXT_subtexture + +static GLboolean _glewInit_GL_EXT_subtexture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexSubImage1DEXT = (PFNGLTEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage1DEXT")) == NULL) || r; + r = ((glTexSubImage2DEXT = (PFNGLTEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage2DEXT")) == NULL) || r; + r = ((glTexSubImage3DEXT = (PFNGLTEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage3DEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_subtexture */ + +#ifdef GL_EXT_texture3D + +static GLboolean _glewInit_GL_EXT_texture3D (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexImage3DEXT = (PFNGLTEXIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexImage3DEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_texture3D */ + +#ifdef GL_EXT_texture_array + +static GLboolean _glewInit_GL_EXT_texture_array (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFramebufferTextureLayerEXT = (PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureLayerEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_texture_array */ + +#ifdef GL_EXT_texture_buffer_object + +static GLboolean _glewInit_GL_EXT_texture_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexBufferEXT = (PFNGLTEXBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glTexBufferEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_texture_buffer_object */ + +#ifdef GL_EXT_texture_integer + +static GLboolean _glewInit_GL_EXT_texture_integer (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glClearColorIiEXT = (PFNGLCLEARCOLORIIEXTPROC)glewGetProcAddress((const GLubyte*)"glClearColorIiEXT")) == NULL) || r; + r = ((glClearColorIuiEXT = (PFNGLCLEARCOLORIUIEXTPROC)glewGetProcAddress((const GLubyte*)"glClearColorIuiEXT")) == NULL) || r; + r = ((glGetTexParameterIivEXT = (PFNGLGETTEXPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterIivEXT")) == NULL) || r; + r = ((glGetTexParameterIuivEXT = (PFNGLGETTEXPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterIuivEXT")) == NULL) || r; + r = ((glTexParameterIivEXT = (PFNGLTEXPARAMETERIIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTexParameterIivEXT")) == NULL) || r; + r = ((glTexParameterIuivEXT = (PFNGLTEXPARAMETERIUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glTexParameterIuivEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_texture_integer */ + +#ifdef GL_EXT_texture_object + +static GLboolean _glewInit_GL_EXT_texture_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAreTexturesResidentEXT = (PFNGLARETEXTURESRESIDENTEXTPROC)glewGetProcAddress((const GLubyte*)"glAreTexturesResidentEXT")) == NULL) || r; + r = ((glBindTextureEXT = (PFNGLBINDTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glBindTextureEXT")) == NULL) || r; + r = ((glDeleteTexturesEXT = (PFNGLDELETETEXTURESEXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteTexturesEXT")) == NULL) || r; + r = ((glGenTexturesEXT = (PFNGLGENTEXTURESEXTPROC)glewGetProcAddress((const GLubyte*)"glGenTexturesEXT")) == NULL) || r; + r = ((glIsTextureEXT = (PFNGLISTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glIsTextureEXT")) == NULL) || r; + r = ((glPrioritizeTexturesEXT = (PFNGLPRIORITIZETEXTURESEXTPROC)glewGetProcAddress((const GLubyte*)"glPrioritizeTexturesEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_texture_object */ + +#ifdef GL_EXT_texture_perturb_normal + +static GLboolean _glewInit_GL_EXT_texture_perturb_normal (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTextureNormalEXT = (PFNGLTEXTURENORMALEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureNormalEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_texture_perturb_normal */ + +#ifdef GL_EXT_timer_query + +static GLboolean _glewInit_GL_EXT_timer_query (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetQueryObjecti64vEXT = (PFNGLGETQUERYOBJECTI64VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjecti64vEXT")) == NULL) || r; + r = ((glGetQueryObjectui64vEXT = (PFNGLGETQUERYOBJECTUI64VEXTPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectui64vEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_timer_query */ + +#ifdef GL_EXT_transform_feedback + +static GLboolean _glewInit_GL_EXT_transform_feedback (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginTransformFeedbackEXT = (PFNGLBEGINTRANSFORMFEEDBACKEXTPROC)glewGetProcAddress((const GLubyte*)"glBeginTransformFeedbackEXT")) == NULL) || r; + r = ((glBindBufferBaseEXT = (PFNGLBINDBUFFERBASEEXTPROC)glewGetProcAddress((const GLubyte*)"glBindBufferBaseEXT")) == NULL) || r; + r = ((glBindBufferOffsetEXT = (PFNGLBINDBUFFEROFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glBindBufferOffsetEXT")) == NULL) || r; + r = ((glBindBufferRangeEXT = (PFNGLBINDBUFFERRANGEEXTPROC)glewGetProcAddress((const GLubyte*)"glBindBufferRangeEXT")) == NULL) || r; + r = ((glEndTransformFeedbackEXT = (PFNGLENDTRANSFORMFEEDBACKEXTPROC)glewGetProcAddress((const GLubyte*)"glEndTransformFeedbackEXT")) == NULL) || r; + r = ((glGetTransformFeedbackVaryingEXT = (PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbackVaryingEXT")) == NULL) || r; + r = ((glTransformFeedbackVaryingsEXT = (PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackVaryingsEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_transform_feedback */ + +#ifdef GL_EXT_vertex_array + +static GLboolean _glewInit_GL_EXT_vertex_array (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glArrayElementEXT = (PFNGLARRAYELEMENTEXTPROC)glewGetProcAddress((const GLubyte*)"glArrayElementEXT")) == NULL) || r; + r = ((glColorPointerEXT = (PFNGLCOLORPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glColorPointerEXT")) == NULL) || r; + r = ((glDrawArraysEXT = (PFNGLDRAWARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysEXT")) == NULL) || r; + r = ((glEdgeFlagPointerEXT = (PFNGLEDGEFLAGPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glEdgeFlagPointerEXT")) == NULL) || r; + r = ((glIndexPointerEXT = (PFNGLINDEXPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glIndexPointerEXT")) == NULL) || r; + r = ((glNormalPointerEXT = (PFNGLNORMALPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glNormalPointerEXT")) == NULL) || r; + r = ((glTexCoordPointerEXT = (PFNGLTEXCOORDPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glTexCoordPointerEXT")) == NULL) || r; + r = ((glVertexPointerEXT = (PFNGLVERTEXPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexPointerEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_vertex_array */ + +#ifdef GL_EXT_vertex_attrib_64bit + +static GLboolean _glewInit_GL_EXT_vertex_attrib_64bit (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetVertexAttribLdvEXT = (PFNGLGETVERTEXATTRIBLDVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribLdvEXT")) == NULL) || r; + r = ((glVertexArrayVertexAttribLOffsetEXT = (PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayVertexAttribLOffsetEXT")) == NULL) || r; + r = ((glVertexAttribL1dEXT = (PFNGLVERTEXATTRIBL1DEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1dEXT")) == NULL) || r; + r = ((glVertexAttribL1dvEXT = (PFNGLVERTEXATTRIBL1DVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1dvEXT")) == NULL) || r; + r = ((glVertexAttribL2dEXT = (PFNGLVERTEXATTRIBL2DEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2dEXT")) == NULL) || r; + r = ((glVertexAttribL2dvEXT = (PFNGLVERTEXATTRIBL2DVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2dvEXT")) == NULL) || r; + r = ((glVertexAttribL3dEXT = (PFNGLVERTEXATTRIBL3DEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3dEXT")) == NULL) || r; + r = ((glVertexAttribL3dvEXT = (PFNGLVERTEXATTRIBL3DVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3dvEXT")) == NULL) || r; + r = ((glVertexAttribL4dEXT = (PFNGLVERTEXATTRIBL4DEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4dEXT")) == NULL) || r; + r = ((glVertexAttribL4dvEXT = (PFNGLVERTEXATTRIBL4DVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4dvEXT")) == NULL) || r; + r = ((glVertexAttribLPointerEXT = (PFNGLVERTEXATTRIBLPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribLPointerEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_vertex_attrib_64bit */ + +#ifdef GL_EXT_vertex_shader + +static GLboolean _glewInit_GL_EXT_vertex_shader (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginVertexShaderEXT = (PFNGLBEGINVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glBeginVertexShaderEXT")) == NULL) || r; + r = ((glBindLightParameterEXT = (PFNGLBINDLIGHTPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindLightParameterEXT")) == NULL) || r; + r = ((glBindMaterialParameterEXT = (PFNGLBINDMATERIALPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindMaterialParameterEXT")) == NULL) || r; + r = ((glBindParameterEXT = (PFNGLBINDPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindParameterEXT")) == NULL) || r; + r = ((glBindTexGenParameterEXT = (PFNGLBINDTEXGENPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindTexGenParameterEXT")) == NULL) || r; + r = ((glBindTextureUnitParameterEXT = (PFNGLBINDTEXTUREUNITPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindTextureUnitParameterEXT")) == NULL) || r; + r = ((glBindVertexShaderEXT = (PFNGLBINDVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindVertexShaderEXT")) == NULL) || r; + r = ((glDeleteVertexShaderEXT = (PFNGLDELETEVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteVertexShaderEXT")) == NULL) || r; + r = ((glDisableVariantClientStateEXT = (PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableVariantClientStateEXT")) == NULL) || r; + r = ((glEnableVariantClientStateEXT = (PFNGLENABLEVARIANTCLIENTSTATEEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableVariantClientStateEXT")) == NULL) || r; + r = ((glEndVertexShaderEXT = (PFNGLENDVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glEndVertexShaderEXT")) == NULL) || r; + r = ((glExtractComponentEXT = (PFNGLEXTRACTCOMPONENTEXTPROC)glewGetProcAddress((const GLubyte*)"glExtractComponentEXT")) == NULL) || r; + r = ((glGenSymbolsEXT = (PFNGLGENSYMBOLSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenSymbolsEXT")) == NULL) || r; + r = ((glGenVertexShadersEXT = (PFNGLGENVERTEXSHADERSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenVertexShadersEXT")) == NULL) || r; + r = ((glGetInvariantBooleanvEXT = (PFNGLGETINVARIANTBOOLEANVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetInvariantBooleanvEXT")) == NULL) || r; + r = ((glGetInvariantFloatvEXT = (PFNGLGETINVARIANTFLOATVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetInvariantFloatvEXT")) == NULL) || r; + r = ((glGetInvariantIntegervEXT = (PFNGLGETINVARIANTINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetInvariantIntegervEXT")) == NULL) || r; + r = ((glGetLocalConstantBooleanvEXT = (PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetLocalConstantBooleanvEXT")) == NULL) || r; + r = ((glGetLocalConstantFloatvEXT = (PFNGLGETLOCALCONSTANTFLOATVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetLocalConstantFloatvEXT")) == NULL) || r; + r = ((glGetLocalConstantIntegervEXT = (PFNGLGETLOCALCONSTANTINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetLocalConstantIntegervEXT")) == NULL) || r; + r = ((glGetVariantBooleanvEXT = (PFNGLGETVARIANTBOOLEANVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantBooleanvEXT")) == NULL) || r; + r = ((glGetVariantFloatvEXT = (PFNGLGETVARIANTFLOATVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantFloatvEXT")) == NULL) || r; + r = ((glGetVariantIntegervEXT = (PFNGLGETVARIANTINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantIntegervEXT")) == NULL) || r; + r = ((glGetVariantPointervEXT = (PFNGLGETVARIANTPOINTERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantPointervEXT")) == NULL) || r; + r = ((glInsertComponentEXT = (PFNGLINSERTCOMPONENTEXTPROC)glewGetProcAddress((const GLubyte*)"glInsertComponentEXT")) == NULL) || r; + r = ((glIsVariantEnabledEXT = (PFNGLISVARIANTENABLEDEXTPROC)glewGetProcAddress((const GLubyte*)"glIsVariantEnabledEXT")) == NULL) || r; + r = ((glSetInvariantEXT = (PFNGLSETINVARIANTEXTPROC)glewGetProcAddress((const GLubyte*)"glSetInvariantEXT")) == NULL) || r; + r = ((glSetLocalConstantEXT = (PFNGLSETLOCALCONSTANTEXTPROC)glewGetProcAddress((const GLubyte*)"glSetLocalConstantEXT")) == NULL) || r; + r = ((glShaderOp1EXT = (PFNGLSHADEROP1EXTPROC)glewGetProcAddress((const GLubyte*)"glShaderOp1EXT")) == NULL) || r; + r = ((glShaderOp2EXT = (PFNGLSHADEROP2EXTPROC)glewGetProcAddress((const GLubyte*)"glShaderOp2EXT")) == NULL) || r; + r = ((glShaderOp3EXT = (PFNGLSHADEROP3EXTPROC)glewGetProcAddress((const GLubyte*)"glShaderOp3EXT")) == NULL) || r; + r = ((glSwizzleEXT = (PFNGLSWIZZLEEXTPROC)glewGetProcAddress((const GLubyte*)"glSwizzleEXT")) == NULL) || r; + r = ((glVariantPointerEXT = (PFNGLVARIANTPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVariantPointerEXT")) == NULL) || r; + r = ((glVariantbvEXT = (PFNGLVARIANTBVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantbvEXT")) == NULL) || r; + r = ((glVariantdvEXT = (PFNGLVARIANTDVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantdvEXT")) == NULL) || r; + r = ((glVariantfvEXT = (PFNGLVARIANTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantfvEXT")) == NULL) || r; + r = ((glVariantivEXT = (PFNGLVARIANTIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantivEXT")) == NULL) || r; + r = ((glVariantsvEXT = (PFNGLVARIANTSVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantsvEXT")) == NULL) || r; + r = ((glVariantubvEXT = (PFNGLVARIANTUBVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantubvEXT")) == NULL) || r; + r = ((glVariantuivEXT = (PFNGLVARIANTUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantuivEXT")) == NULL) || r; + r = ((glVariantusvEXT = (PFNGLVARIANTUSVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantusvEXT")) == NULL) || r; + r = ((glWriteMaskEXT = (PFNGLWRITEMASKEXTPROC)glewGetProcAddress((const GLubyte*)"glWriteMaskEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_vertex_shader */ + +#ifdef GL_EXT_vertex_weighting + +static GLboolean _glewInit_GL_EXT_vertex_weighting (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glVertexWeightPointerEXT = (PFNGLVERTEXWEIGHTPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexWeightPointerEXT")) == NULL) || r; + r = ((glVertexWeightfEXT = (PFNGLVERTEXWEIGHTFEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexWeightfEXT")) == NULL) || r; + r = ((glVertexWeightfvEXT = (PFNGLVERTEXWEIGHTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexWeightfvEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_vertex_weighting */ + +#ifdef GL_EXT_x11_sync_object + +static GLboolean _glewInit_GL_EXT_x11_sync_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glImportSyncEXT = (PFNGLIMPORTSYNCEXTPROC)glewGetProcAddress((const GLubyte*)"glImportSyncEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_x11_sync_object */ + +#ifdef GL_GREMEDY_frame_terminator + +static GLboolean _glewInit_GL_GREMEDY_frame_terminator (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFrameTerminatorGREMEDY = (PFNGLFRAMETERMINATORGREMEDYPROC)glewGetProcAddress((const GLubyte*)"glFrameTerminatorGREMEDY")) == NULL) || r; + + return r; +} + +#endif /* GL_GREMEDY_frame_terminator */ + +#ifdef GL_GREMEDY_string_marker + +static GLboolean _glewInit_GL_GREMEDY_string_marker (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glStringMarkerGREMEDY = (PFNGLSTRINGMARKERGREMEDYPROC)glewGetProcAddress((const GLubyte*)"glStringMarkerGREMEDY")) == NULL) || r; + + return r; +} + +#endif /* GL_GREMEDY_string_marker */ + +#ifdef GL_HP_image_transform + +static GLboolean _glewInit_GL_HP_image_transform (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetImageTransformParameterfvHP = (PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC)glewGetProcAddress((const GLubyte*)"glGetImageTransformParameterfvHP")) == NULL) || r; + r = ((glGetImageTransformParameterivHP = (PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC)glewGetProcAddress((const GLubyte*)"glGetImageTransformParameterivHP")) == NULL) || r; + r = ((glImageTransformParameterfHP = (PFNGLIMAGETRANSFORMPARAMETERFHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameterfHP")) == NULL) || r; + r = ((glImageTransformParameterfvHP = (PFNGLIMAGETRANSFORMPARAMETERFVHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameterfvHP")) == NULL) || r; + r = ((glImageTransformParameteriHP = (PFNGLIMAGETRANSFORMPARAMETERIHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameteriHP")) == NULL) || r; + r = ((glImageTransformParameterivHP = (PFNGLIMAGETRANSFORMPARAMETERIVHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameterivHP")) == NULL) || r; + + return r; +} + +#endif /* GL_HP_image_transform */ + +#ifdef GL_IBM_multimode_draw_arrays + +static GLboolean _glewInit_GL_IBM_multimode_draw_arrays (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMultiModeDrawArraysIBM = (PFNGLMULTIMODEDRAWARRAYSIBMPROC)glewGetProcAddress((const GLubyte*)"glMultiModeDrawArraysIBM")) == NULL) || r; + r = ((glMultiModeDrawElementsIBM = (PFNGLMULTIMODEDRAWELEMENTSIBMPROC)glewGetProcAddress((const GLubyte*)"glMultiModeDrawElementsIBM")) == NULL) || r; + + return r; +} + +#endif /* GL_IBM_multimode_draw_arrays */ + +#ifdef GL_IBM_vertex_array_lists + +static GLboolean _glewInit_GL_IBM_vertex_array_lists (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColorPointerListIBM = (PFNGLCOLORPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glColorPointerListIBM")) == NULL) || r; + r = ((glEdgeFlagPointerListIBM = (PFNGLEDGEFLAGPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glEdgeFlagPointerListIBM")) == NULL) || r; + r = ((glFogCoordPointerListIBM = (PFNGLFOGCOORDPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glFogCoordPointerListIBM")) == NULL) || r; + r = ((glIndexPointerListIBM = (PFNGLINDEXPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glIndexPointerListIBM")) == NULL) || r; + r = ((glNormalPointerListIBM = (PFNGLNORMALPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glNormalPointerListIBM")) == NULL) || r; + r = ((glSecondaryColorPointerListIBM = (PFNGLSECONDARYCOLORPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorPointerListIBM")) == NULL) || r; + r = ((glTexCoordPointerListIBM = (PFNGLTEXCOORDPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glTexCoordPointerListIBM")) == NULL) || r; + r = ((glVertexPointerListIBM = (PFNGLVERTEXPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glVertexPointerListIBM")) == NULL) || r; + + return r; +} + +#endif /* GL_IBM_vertex_array_lists */ + +#ifdef GL_INTEL_map_texture + +static GLboolean _glewInit_GL_INTEL_map_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMapTexture2DINTEL = (PFNGLMAPTEXTURE2DINTELPROC)glewGetProcAddress((const GLubyte*)"glMapTexture2DINTEL")) == NULL) || r; + r = ((glSyncTextureINTEL = (PFNGLSYNCTEXTUREINTELPROC)glewGetProcAddress((const GLubyte*)"glSyncTextureINTEL")) == NULL) || r; + r = ((glUnmapTexture2DINTEL = (PFNGLUNMAPTEXTURE2DINTELPROC)glewGetProcAddress((const GLubyte*)"glUnmapTexture2DINTEL")) == NULL) || r; + + return r; +} + +#endif /* GL_INTEL_map_texture */ + +#ifdef GL_INTEL_parallel_arrays + +static GLboolean _glewInit_GL_INTEL_parallel_arrays (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColorPointervINTEL = (PFNGLCOLORPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glColorPointervINTEL")) == NULL) || r; + r = ((glNormalPointervINTEL = (PFNGLNORMALPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glNormalPointervINTEL")) == NULL) || r; + r = ((glTexCoordPointervINTEL = (PFNGLTEXCOORDPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glTexCoordPointervINTEL")) == NULL) || r; + r = ((glVertexPointervINTEL = (PFNGLVERTEXPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glVertexPointervINTEL")) == NULL) || r; + + return r; +} + +#endif /* GL_INTEL_parallel_arrays */ + +#ifdef GL_INTEL_performance_query + +static GLboolean _glewInit_GL_INTEL_performance_query (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginPerfQueryINTEL = (PFNGLBEGINPERFQUERYINTELPROC)glewGetProcAddress((const GLubyte*)"glBeginPerfQueryINTEL")) == NULL) || r; + r = ((glCreatePerfQueryINTEL = (PFNGLCREATEPERFQUERYINTELPROC)glewGetProcAddress((const GLubyte*)"glCreatePerfQueryINTEL")) == NULL) || r; + r = ((glDeletePerfQueryINTEL = (PFNGLDELETEPERFQUERYINTELPROC)glewGetProcAddress((const GLubyte*)"glDeletePerfQueryINTEL")) == NULL) || r; + r = ((glEndPerfQueryINTEL = (PFNGLENDPERFQUERYINTELPROC)glewGetProcAddress((const GLubyte*)"glEndPerfQueryINTEL")) == NULL) || r; + r = ((glGetFirstPerfQueryIdINTEL = (PFNGLGETFIRSTPERFQUERYIDINTELPROC)glewGetProcAddress((const GLubyte*)"glGetFirstPerfQueryIdINTEL")) == NULL) || r; + r = ((glGetNextPerfQueryIdINTEL = (PFNGLGETNEXTPERFQUERYIDINTELPROC)glewGetProcAddress((const GLubyte*)"glGetNextPerfQueryIdINTEL")) == NULL) || r; + r = ((glGetPerfCounterInfoINTEL = (PFNGLGETPERFCOUNTERINFOINTELPROC)glewGetProcAddress((const GLubyte*)"glGetPerfCounterInfoINTEL")) == NULL) || r; + r = ((glGetPerfQueryDataINTEL = (PFNGLGETPERFQUERYDATAINTELPROC)glewGetProcAddress((const GLubyte*)"glGetPerfQueryDataINTEL")) == NULL) || r; + r = ((glGetPerfQueryIdByNameINTEL = (PFNGLGETPERFQUERYIDBYNAMEINTELPROC)glewGetProcAddress((const GLubyte*)"glGetPerfQueryIdByNameINTEL")) == NULL) || r; + r = ((glGetPerfQueryInfoINTEL = (PFNGLGETPERFQUERYINFOINTELPROC)glewGetProcAddress((const GLubyte*)"glGetPerfQueryInfoINTEL")) == NULL) || r; + + return r; +} + +#endif /* GL_INTEL_performance_query */ + +#ifdef GL_INTEL_texture_scissor + +static GLboolean _glewInit_GL_INTEL_texture_scissor (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexScissorFuncINTEL = (PFNGLTEXSCISSORFUNCINTELPROC)glewGetProcAddress((const GLubyte*)"glTexScissorFuncINTEL")) == NULL) || r; + r = ((glTexScissorINTEL = (PFNGLTEXSCISSORINTELPROC)glewGetProcAddress((const GLubyte*)"glTexScissorINTEL")) == NULL) || r; + + return r; +} + +#endif /* GL_INTEL_texture_scissor */ + +#ifdef GL_KHR_blend_equation_advanced + +static GLboolean _glewInit_GL_KHR_blend_equation_advanced (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendBarrierKHR = (PFNGLBLENDBARRIERKHRPROC)glewGetProcAddress((const GLubyte*)"glBlendBarrierKHR")) == NULL) || r; + + return r; +} + +#endif /* GL_KHR_blend_equation_advanced */ + +#ifdef GL_KHR_debug + +static GLboolean _glewInit_GL_KHR_debug (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDebugMessageCallback = (PFNGLDEBUGMESSAGECALLBACKPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageCallback")) == NULL) || r; + r = ((glDebugMessageControl = (PFNGLDEBUGMESSAGECONTROLPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageControl")) == NULL) || r; + r = ((glDebugMessageInsert = (PFNGLDEBUGMESSAGEINSERTPROC)glewGetProcAddress((const GLubyte*)"glDebugMessageInsert")) == NULL) || r; + r = ((glGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGPROC)glewGetProcAddress((const GLubyte*)"glGetDebugMessageLog")) == NULL) || r; + r = ((glGetObjectLabel = (PFNGLGETOBJECTLABELPROC)glewGetProcAddress((const GLubyte*)"glGetObjectLabel")) == NULL) || r; + r = ((glGetObjectPtrLabel = (PFNGLGETOBJECTPTRLABELPROC)glewGetProcAddress((const GLubyte*)"glGetObjectPtrLabel")) == NULL) || r; + r = ((glObjectLabel = (PFNGLOBJECTLABELPROC)glewGetProcAddress((const GLubyte*)"glObjectLabel")) == NULL) || r; + r = ((glObjectPtrLabel = (PFNGLOBJECTPTRLABELPROC)glewGetProcAddress((const GLubyte*)"glObjectPtrLabel")) == NULL) || r; + r = ((glPopDebugGroup = (PFNGLPOPDEBUGGROUPPROC)glewGetProcAddress((const GLubyte*)"glPopDebugGroup")) == NULL) || r; + r = ((glPushDebugGroup = (PFNGLPUSHDEBUGGROUPPROC)glewGetProcAddress((const GLubyte*)"glPushDebugGroup")) == NULL) || r; + + return r; +} + +#endif /* GL_KHR_debug */ + +#ifdef GL_KHR_robustness + +static GLboolean _glewInit_GL_KHR_robustness (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetnUniformfv = (PFNGLGETNUNIFORMFVPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformfv")) == NULL) || r; + r = ((glGetnUniformiv = (PFNGLGETNUNIFORMIVPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformiv")) == NULL) || r; + r = ((glGetnUniformuiv = (PFNGLGETNUNIFORMUIVPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformuiv")) == NULL) || r; + r = ((glReadnPixels = (PFNGLREADNPIXELSPROC)glewGetProcAddress((const GLubyte*)"glReadnPixels")) == NULL) || r; + + return r; +} + +#endif /* GL_KHR_robustness */ + +#ifdef GL_KTX_buffer_region + +static GLboolean _glewInit_GL_KTX_buffer_region (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBufferRegionEnabled = (PFNGLBUFFERREGIONENABLEDPROC)glewGetProcAddress((const GLubyte*)"glBufferRegionEnabled")) == NULL) || r; + r = ((glDeleteBufferRegion = (PFNGLDELETEBUFFERREGIONPROC)glewGetProcAddress((const GLubyte*)"glDeleteBufferRegion")) == NULL) || r; + r = ((glDrawBufferRegion = (PFNGLDRAWBUFFERREGIONPROC)glewGetProcAddress((const GLubyte*)"glDrawBufferRegion")) == NULL) || r; + r = ((glNewBufferRegion = (PFNGLNEWBUFFERREGIONPROC)glewGetProcAddress((const GLubyte*)"glNewBufferRegion")) == NULL) || r; + r = ((glReadBufferRegion = (PFNGLREADBUFFERREGIONPROC)glewGetProcAddress((const GLubyte*)"glReadBufferRegion")) == NULL) || r; + + return r; +} + +#endif /* GL_KTX_buffer_region */ + +#ifdef GL_MESA_resize_buffers + +static GLboolean _glewInit_GL_MESA_resize_buffers (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glResizeBuffersMESA = (PFNGLRESIZEBUFFERSMESAPROC)glewGetProcAddress((const GLubyte*)"glResizeBuffersMESA")) == NULL) || r; + + return r; +} + +#endif /* GL_MESA_resize_buffers */ + +#ifdef GL_MESA_window_pos + +static GLboolean _glewInit_GL_MESA_window_pos (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glWindowPos2dMESA = (PFNGLWINDOWPOS2DMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dMESA")) == NULL) || r; + r = ((glWindowPos2dvMESA = (PFNGLWINDOWPOS2DVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dvMESA")) == NULL) || r; + r = ((glWindowPos2fMESA = (PFNGLWINDOWPOS2FMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fMESA")) == NULL) || r; + r = ((glWindowPos2fvMESA = (PFNGLWINDOWPOS2FVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fvMESA")) == NULL) || r; + r = ((glWindowPos2iMESA = (PFNGLWINDOWPOS2IMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2iMESA")) == NULL) || r; + r = ((glWindowPos2ivMESA = (PFNGLWINDOWPOS2IVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2ivMESA")) == NULL) || r; + r = ((glWindowPos2sMESA = (PFNGLWINDOWPOS2SMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2sMESA")) == NULL) || r; + r = ((glWindowPos2svMESA = (PFNGLWINDOWPOS2SVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2svMESA")) == NULL) || r; + r = ((glWindowPos3dMESA = (PFNGLWINDOWPOS3DMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dMESA")) == NULL) || r; + r = ((glWindowPos3dvMESA = (PFNGLWINDOWPOS3DVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dvMESA")) == NULL) || r; + r = ((glWindowPos3fMESA = (PFNGLWINDOWPOS3FMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fMESA")) == NULL) || r; + r = ((glWindowPos3fvMESA = (PFNGLWINDOWPOS3FVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fvMESA")) == NULL) || r; + r = ((glWindowPos3iMESA = (PFNGLWINDOWPOS3IMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3iMESA")) == NULL) || r; + r = ((glWindowPos3ivMESA = (PFNGLWINDOWPOS3IVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3ivMESA")) == NULL) || r; + r = ((glWindowPos3sMESA = (PFNGLWINDOWPOS3SMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3sMESA")) == NULL) || r; + r = ((glWindowPos3svMESA = (PFNGLWINDOWPOS3SVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3svMESA")) == NULL) || r; + r = ((glWindowPos4dMESA = (PFNGLWINDOWPOS4DMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4dMESA")) == NULL) || r; + r = ((glWindowPos4dvMESA = (PFNGLWINDOWPOS4DVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4dvMESA")) == NULL) || r; + r = ((glWindowPos4fMESA = (PFNGLWINDOWPOS4FMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4fMESA")) == NULL) || r; + r = ((glWindowPos4fvMESA = (PFNGLWINDOWPOS4FVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4fvMESA")) == NULL) || r; + r = ((glWindowPos4iMESA = (PFNGLWINDOWPOS4IMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4iMESA")) == NULL) || r; + r = ((glWindowPos4ivMESA = (PFNGLWINDOWPOS4IVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4ivMESA")) == NULL) || r; + r = ((glWindowPos4sMESA = (PFNGLWINDOWPOS4SMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4sMESA")) == NULL) || r; + r = ((glWindowPos4svMESA = (PFNGLWINDOWPOS4SVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4svMESA")) == NULL) || r; + + return r; +} + +#endif /* GL_MESA_window_pos */ + +#ifdef GL_NVX_conditional_render + +static GLboolean _glewInit_GL_NVX_conditional_render (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginConditionalRenderNVX = (PFNGLBEGINCONDITIONALRENDERNVXPROC)glewGetProcAddress((const GLubyte*)"glBeginConditionalRenderNVX")) == NULL) || r; + r = ((glEndConditionalRenderNVX = (PFNGLENDCONDITIONALRENDERNVXPROC)glewGetProcAddress((const GLubyte*)"glEndConditionalRenderNVX")) == NULL) || r; + + return r; +} + +#endif /* GL_NVX_conditional_render */ + +#ifdef GL_NV_bindless_multi_draw_indirect + +static GLboolean _glewInit_GL_NV_bindless_multi_draw_indirect (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMultiDrawArraysIndirectBindlessNV = (PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirectBindlessNV")) == NULL) || r; + r = ((glMultiDrawElementsIndirectBindlessNV = (PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirectBindlessNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_bindless_multi_draw_indirect */ + +#ifdef GL_NV_bindless_multi_draw_indirect_count + +static GLboolean _glewInit_GL_NV_bindless_multi_draw_indirect_count (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMultiDrawArraysIndirectBindlessCountNV = (PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirectBindlessCountNV")) == NULL) || r; + r = ((glMultiDrawElementsIndirectBindlessCountNV = (PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirectBindlessCountNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_bindless_multi_draw_indirect_count */ + +#ifdef GL_NV_bindless_texture + +static GLboolean _glewInit_GL_NV_bindless_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetImageHandleNV = (PFNGLGETIMAGEHANDLENVPROC)glewGetProcAddress((const GLubyte*)"glGetImageHandleNV")) == NULL) || r; + r = ((glGetTextureHandleNV = (PFNGLGETTEXTUREHANDLENVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureHandleNV")) == NULL) || r; + r = ((glGetTextureSamplerHandleNV = (PFNGLGETTEXTURESAMPLERHANDLENVPROC)glewGetProcAddress((const GLubyte*)"glGetTextureSamplerHandleNV")) == NULL) || r; + r = ((glIsImageHandleResidentNV = (PFNGLISIMAGEHANDLERESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glIsImageHandleResidentNV")) == NULL) || r; + r = ((glIsTextureHandleResidentNV = (PFNGLISTEXTUREHANDLERESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glIsTextureHandleResidentNV")) == NULL) || r; + r = ((glMakeImageHandleNonResidentNV = (PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeImageHandleNonResidentNV")) == NULL) || r; + r = ((glMakeImageHandleResidentNV = (PFNGLMAKEIMAGEHANDLERESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeImageHandleResidentNV")) == NULL) || r; + r = ((glMakeTextureHandleNonResidentNV = (PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeTextureHandleNonResidentNV")) == NULL) || r; + r = ((glMakeTextureHandleResidentNV = (PFNGLMAKETEXTUREHANDLERESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeTextureHandleResidentNV")) == NULL) || r; + r = ((glProgramUniformHandleui64NV = (PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformHandleui64NV")) == NULL) || r; + r = ((glProgramUniformHandleui64vNV = (PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformHandleui64vNV")) == NULL) || r; + r = ((glUniformHandleui64NV = (PFNGLUNIFORMHANDLEUI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniformHandleui64NV")) == NULL) || r; + r = ((glUniformHandleui64vNV = (PFNGLUNIFORMHANDLEUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniformHandleui64vNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_bindless_texture */ + +#ifdef GL_NV_blend_equation_advanced + +static GLboolean _glewInit_GL_NV_blend_equation_advanced (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendBarrierNV = (PFNGLBLENDBARRIERNVPROC)glewGetProcAddress((const GLubyte*)"glBlendBarrierNV")) == NULL) || r; + r = ((glBlendParameteriNV = (PFNGLBLENDPARAMETERINVPROC)glewGetProcAddress((const GLubyte*)"glBlendParameteriNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_blend_equation_advanced */ + +#ifdef GL_NV_conditional_render + +static GLboolean _glewInit_GL_NV_conditional_render (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginConditionalRenderNV = (PFNGLBEGINCONDITIONALRENDERNVPROC)glewGetProcAddress((const GLubyte*)"glBeginConditionalRenderNV")) == NULL) || r; + r = ((glEndConditionalRenderNV = (PFNGLENDCONDITIONALRENDERNVPROC)glewGetProcAddress((const GLubyte*)"glEndConditionalRenderNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_conditional_render */ + +#ifdef GL_NV_conservative_raster + +static GLboolean _glewInit_GL_NV_conservative_raster (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glSubpixelPrecisionBiasNV = (PFNGLSUBPIXELPRECISIONBIASNVPROC)glewGetProcAddress((const GLubyte*)"glSubpixelPrecisionBiasNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_conservative_raster */ + +#ifdef GL_NV_conservative_raster_dilate + +static GLboolean _glewInit_GL_NV_conservative_raster_dilate (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glConservativeRasterParameterfNV = (PFNGLCONSERVATIVERASTERPARAMETERFNVPROC)glewGetProcAddress((const GLubyte*)"glConservativeRasterParameterfNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_conservative_raster_dilate */ + +#ifdef GL_NV_copy_image + +static GLboolean _glewInit_GL_NV_copy_image (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCopyImageSubDataNV = (PFNGLCOPYIMAGESUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glCopyImageSubDataNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_copy_image */ + +#ifdef GL_NV_depth_buffer_float + +static GLboolean _glewInit_GL_NV_depth_buffer_float (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glClearDepthdNV = (PFNGLCLEARDEPTHDNVPROC)glewGetProcAddress((const GLubyte*)"glClearDepthdNV")) == NULL) || r; + r = ((glDepthBoundsdNV = (PFNGLDEPTHBOUNDSDNVPROC)glewGetProcAddress((const GLubyte*)"glDepthBoundsdNV")) == NULL) || r; + r = ((glDepthRangedNV = (PFNGLDEPTHRANGEDNVPROC)glewGetProcAddress((const GLubyte*)"glDepthRangedNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_depth_buffer_float */ + +#ifdef GL_NV_draw_texture + +static GLboolean _glewInit_GL_NV_draw_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawTextureNV = (PFNGLDRAWTEXTURENVPROC)glewGetProcAddress((const GLubyte*)"glDrawTextureNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_draw_texture */ + +#ifdef GL_NV_evaluators + +static GLboolean _glewInit_GL_NV_evaluators (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glEvalMapsNV = (PFNGLEVALMAPSNVPROC)glewGetProcAddress((const GLubyte*)"glEvalMapsNV")) == NULL) || r; + r = ((glGetMapAttribParameterfvNV = (PFNGLGETMAPATTRIBPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapAttribParameterfvNV")) == NULL) || r; + r = ((glGetMapAttribParameterivNV = (PFNGLGETMAPATTRIBPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapAttribParameterivNV")) == NULL) || r; + r = ((glGetMapControlPointsNV = (PFNGLGETMAPCONTROLPOINTSNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapControlPointsNV")) == NULL) || r; + r = ((glGetMapParameterfvNV = (PFNGLGETMAPPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapParameterfvNV")) == NULL) || r; + r = ((glGetMapParameterivNV = (PFNGLGETMAPPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapParameterivNV")) == NULL) || r; + r = ((glMapControlPointsNV = (PFNGLMAPCONTROLPOINTSNVPROC)glewGetProcAddress((const GLubyte*)"glMapControlPointsNV")) == NULL) || r; + r = ((glMapParameterfvNV = (PFNGLMAPPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glMapParameterfvNV")) == NULL) || r; + r = ((glMapParameterivNV = (PFNGLMAPPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glMapParameterivNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_evaluators */ + +#ifdef GL_NV_explicit_multisample + +static GLboolean _glewInit_GL_NV_explicit_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetMultisamplefvNV = (PFNGLGETMULTISAMPLEFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMultisamplefvNV")) == NULL) || r; + r = ((glSampleMaskIndexedNV = (PFNGLSAMPLEMASKINDEXEDNVPROC)glewGetProcAddress((const GLubyte*)"glSampleMaskIndexedNV")) == NULL) || r; + r = ((glTexRenderbufferNV = (PFNGLTEXRENDERBUFFERNVPROC)glewGetProcAddress((const GLubyte*)"glTexRenderbufferNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_explicit_multisample */ + +#ifdef GL_NV_fence + +static GLboolean _glewInit_GL_NV_fence (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDeleteFencesNV = (PFNGLDELETEFENCESNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteFencesNV")) == NULL) || r; + r = ((glFinishFenceNV = (PFNGLFINISHFENCENVPROC)glewGetProcAddress((const GLubyte*)"glFinishFenceNV")) == NULL) || r; + r = ((glGenFencesNV = (PFNGLGENFENCESNVPROC)glewGetProcAddress((const GLubyte*)"glGenFencesNV")) == NULL) || r; + r = ((glGetFenceivNV = (PFNGLGETFENCEIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetFenceivNV")) == NULL) || r; + r = ((glIsFenceNV = (PFNGLISFENCENVPROC)glewGetProcAddress((const GLubyte*)"glIsFenceNV")) == NULL) || r; + r = ((glSetFenceNV = (PFNGLSETFENCENVPROC)glewGetProcAddress((const GLubyte*)"glSetFenceNV")) == NULL) || r; + r = ((glTestFenceNV = (PFNGLTESTFENCENVPROC)glewGetProcAddress((const GLubyte*)"glTestFenceNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_fence */ + +#ifdef GL_NV_fragment_coverage_to_color + +static GLboolean _glewInit_GL_NV_fragment_coverage_to_color (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFragmentCoverageColorNV = (PFNGLFRAGMENTCOVERAGECOLORNVPROC)glewGetProcAddress((const GLubyte*)"glFragmentCoverageColorNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_fragment_coverage_to_color */ + +#ifdef GL_NV_fragment_program + +static GLboolean _glewInit_GL_NV_fragment_program (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetProgramNamedParameterdvNV = (PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramNamedParameterdvNV")) == NULL) || r; + r = ((glGetProgramNamedParameterfvNV = (PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramNamedParameterfvNV")) == NULL) || r; + r = ((glProgramNamedParameter4dNV = (PFNGLPROGRAMNAMEDPARAMETER4DNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4dNV")) == NULL) || r; + r = ((glProgramNamedParameter4dvNV = (PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4dvNV")) == NULL) || r; + r = ((glProgramNamedParameter4fNV = (PFNGLPROGRAMNAMEDPARAMETER4FNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4fNV")) == NULL) || r; + r = ((glProgramNamedParameter4fvNV = (PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4fvNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_fragment_program */ + +#ifdef GL_NV_framebuffer_multisample_coverage + +static GLboolean _glewInit_GL_NV_framebuffer_multisample_coverage (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glRenderbufferStorageMultisampleCoverageNV = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageMultisampleCoverageNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_framebuffer_multisample_coverage */ + +#ifdef GL_NV_geometry_program4 + +static GLboolean _glewInit_GL_NV_geometry_program4 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glProgramVertexLimitNV = (PFNGLPROGRAMVERTEXLIMITNVPROC)glewGetProcAddress((const GLubyte*)"glProgramVertexLimitNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_geometry_program4 */ + +#ifdef GL_NV_gpu_program4 + +static GLboolean _glewInit_GL_NV_gpu_program4 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glProgramEnvParameterI4iNV = (PFNGLPROGRAMENVPARAMETERI4INVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameterI4iNV")) == NULL) || r; + r = ((glProgramEnvParameterI4ivNV = (PFNGLPROGRAMENVPARAMETERI4IVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameterI4ivNV")) == NULL) || r; + r = ((glProgramEnvParameterI4uiNV = (PFNGLPROGRAMENVPARAMETERI4UINVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameterI4uiNV")) == NULL) || r; + r = ((glProgramEnvParameterI4uivNV = (PFNGLPROGRAMENVPARAMETERI4UIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameterI4uivNV")) == NULL) || r; + r = ((glProgramEnvParametersI4ivNV = (PFNGLPROGRAMENVPARAMETERSI4IVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParametersI4ivNV")) == NULL) || r; + r = ((glProgramEnvParametersI4uivNV = (PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParametersI4uivNV")) == NULL) || r; + r = ((glProgramLocalParameterI4iNV = (PFNGLPROGRAMLOCALPARAMETERI4INVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameterI4iNV")) == NULL) || r; + r = ((glProgramLocalParameterI4ivNV = (PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameterI4ivNV")) == NULL) || r; + r = ((glProgramLocalParameterI4uiNV = (PFNGLPROGRAMLOCALPARAMETERI4UINVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameterI4uiNV")) == NULL) || r; + r = ((glProgramLocalParameterI4uivNV = (PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameterI4uivNV")) == NULL) || r; + r = ((glProgramLocalParametersI4ivNV = (PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParametersI4ivNV")) == NULL) || r; + r = ((glProgramLocalParametersI4uivNV = (PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParametersI4uivNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_gpu_program4 */ + +#ifdef GL_NV_gpu_shader5 + +static GLboolean _glewInit_GL_NV_gpu_shader5 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetUniformi64vNV = (PFNGLGETUNIFORMI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformi64vNV")) == NULL) || r; + r = ((glGetUniformui64vNV = (PFNGLGETUNIFORMUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformui64vNV")) == NULL) || r; + r = ((glProgramUniform1i64NV = (PFNGLPROGRAMUNIFORM1I64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i64NV")) == NULL) || r; + r = ((glProgramUniform1i64vNV = (PFNGLPROGRAMUNIFORM1I64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i64vNV")) == NULL) || r; + r = ((glProgramUniform1ui64NV = (PFNGLPROGRAMUNIFORM1UI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui64NV")) == NULL) || r; + r = ((glProgramUniform1ui64vNV = (PFNGLPROGRAMUNIFORM1UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui64vNV")) == NULL) || r; + r = ((glProgramUniform2i64NV = (PFNGLPROGRAMUNIFORM2I64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i64NV")) == NULL) || r; + r = ((glProgramUniform2i64vNV = (PFNGLPROGRAMUNIFORM2I64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i64vNV")) == NULL) || r; + r = ((glProgramUniform2ui64NV = (PFNGLPROGRAMUNIFORM2UI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui64NV")) == NULL) || r; + r = ((glProgramUniform2ui64vNV = (PFNGLPROGRAMUNIFORM2UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui64vNV")) == NULL) || r; + r = ((glProgramUniform3i64NV = (PFNGLPROGRAMUNIFORM3I64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i64NV")) == NULL) || r; + r = ((glProgramUniform3i64vNV = (PFNGLPROGRAMUNIFORM3I64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i64vNV")) == NULL) || r; + r = ((glProgramUniform3ui64NV = (PFNGLPROGRAMUNIFORM3UI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui64NV")) == NULL) || r; + r = ((glProgramUniform3ui64vNV = (PFNGLPROGRAMUNIFORM3UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui64vNV")) == NULL) || r; + r = ((glProgramUniform4i64NV = (PFNGLPROGRAMUNIFORM4I64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i64NV")) == NULL) || r; + r = ((glProgramUniform4i64vNV = (PFNGLPROGRAMUNIFORM4I64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i64vNV")) == NULL) || r; + r = ((glProgramUniform4ui64NV = (PFNGLPROGRAMUNIFORM4UI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui64NV")) == NULL) || r; + r = ((glProgramUniform4ui64vNV = (PFNGLPROGRAMUNIFORM4UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui64vNV")) == NULL) || r; + r = ((glUniform1i64NV = (PFNGLUNIFORM1I64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform1i64NV")) == NULL) || r; + r = ((glUniform1i64vNV = (PFNGLUNIFORM1I64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform1i64vNV")) == NULL) || r; + r = ((glUniform1ui64NV = (PFNGLUNIFORM1UI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui64NV")) == NULL) || r; + r = ((glUniform1ui64vNV = (PFNGLUNIFORM1UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui64vNV")) == NULL) || r; + r = ((glUniform2i64NV = (PFNGLUNIFORM2I64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform2i64NV")) == NULL) || r; + r = ((glUniform2i64vNV = (PFNGLUNIFORM2I64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform2i64vNV")) == NULL) || r; + r = ((glUniform2ui64NV = (PFNGLUNIFORM2UI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui64NV")) == NULL) || r; + r = ((glUniform2ui64vNV = (PFNGLUNIFORM2UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui64vNV")) == NULL) || r; + r = ((glUniform3i64NV = (PFNGLUNIFORM3I64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform3i64NV")) == NULL) || r; + r = ((glUniform3i64vNV = (PFNGLUNIFORM3I64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform3i64vNV")) == NULL) || r; + r = ((glUniform3ui64NV = (PFNGLUNIFORM3UI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui64NV")) == NULL) || r; + r = ((glUniform3ui64vNV = (PFNGLUNIFORM3UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui64vNV")) == NULL) || r; + r = ((glUniform4i64NV = (PFNGLUNIFORM4I64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform4i64NV")) == NULL) || r; + r = ((glUniform4i64vNV = (PFNGLUNIFORM4I64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform4i64vNV")) == NULL) || r; + r = ((glUniform4ui64NV = (PFNGLUNIFORM4UI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui64NV")) == NULL) || r; + r = ((glUniform4ui64vNV = (PFNGLUNIFORM4UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui64vNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_gpu_shader5 */ + +#ifdef GL_NV_half_float + +static GLboolean _glewInit_GL_NV_half_float (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColor3hNV = (PFNGLCOLOR3HNVPROC)glewGetProcAddress((const GLubyte*)"glColor3hNV")) == NULL) || r; + r = ((glColor3hvNV = (PFNGLCOLOR3HVNVPROC)glewGetProcAddress((const GLubyte*)"glColor3hvNV")) == NULL) || r; + r = ((glColor4hNV = (PFNGLCOLOR4HNVPROC)glewGetProcAddress((const GLubyte*)"glColor4hNV")) == NULL) || r; + r = ((glColor4hvNV = (PFNGLCOLOR4HVNVPROC)glewGetProcAddress((const GLubyte*)"glColor4hvNV")) == NULL) || r; + r = ((glFogCoordhNV = (PFNGLFOGCOORDHNVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordhNV")) == NULL) || r; + r = ((glFogCoordhvNV = (PFNGLFOGCOORDHVNVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordhvNV")) == NULL) || r; + r = ((glMultiTexCoord1hNV = (PFNGLMULTITEXCOORD1HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1hNV")) == NULL) || r; + r = ((glMultiTexCoord1hvNV = (PFNGLMULTITEXCOORD1HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1hvNV")) == NULL) || r; + r = ((glMultiTexCoord2hNV = (PFNGLMULTITEXCOORD2HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2hNV")) == NULL) || r; + r = ((glMultiTexCoord2hvNV = (PFNGLMULTITEXCOORD2HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2hvNV")) == NULL) || r; + r = ((glMultiTexCoord3hNV = (PFNGLMULTITEXCOORD3HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3hNV")) == NULL) || r; + r = ((glMultiTexCoord3hvNV = (PFNGLMULTITEXCOORD3HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3hvNV")) == NULL) || r; + r = ((glMultiTexCoord4hNV = (PFNGLMULTITEXCOORD4HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4hNV")) == NULL) || r; + r = ((glMultiTexCoord4hvNV = (PFNGLMULTITEXCOORD4HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4hvNV")) == NULL) || r; + r = ((glNormal3hNV = (PFNGLNORMAL3HNVPROC)glewGetProcAddress((const GLubyte*)"glNormal3hNV")) == NULL) || r; + r = ((glNormal3hvNV = (PFNGLNORMAL3HVNVPROC)glewGetProcAddress((const GLubyte*)"glNormal3hvNV")) == NULL) || r; + r = ((glSecondaryColor3hNV = (PFNGLSECONDARYCOLOR3HNVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3hNV")) == NULL) || r; + r = ((glSecondaryColor3hvNV = (PFNGLSECONDARYCOLOR3HVNVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3hvNV")) == NULL) || r; + r = ((glTexCoord1hNV = (PFNGLTEXCOORD1HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord1hNV")) == NULL) || r; + r = ((glTexCoord1hvNV = (PFNGLTEXCOORD1HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord1hvNV")) == NULL) || r; + r = ((glTexCoord2hNV = (PFNGLTEXCOORD2HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2hNV")) == NULL) || r; + r = ((glTexCoord2hvNV = (PFNGLTEXCOORD2HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2hvNV")) == NULL) || r; + r = ((glTexCoord3hNV = (PFNGLTEXCOORD3HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord3hNV")) == NULL) || r; + r = ((glTexCoord3hvNV = (PFNGLTEXCOORD3HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord3hvNV")) == NULL) || r; + r = ((glTexCoord4hNV = (PFNGLTEXCOORD4HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4hNV")) == NULL) || r; + r = ((glTexCoord4hvNV = (PFNGLTEXCOORD4HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4hvNV")) == NULL) || r; + r = ((glVertex2hNV = (PFNGLVERTEX2HNVPROC)glewGetProcAddress((const GLubyte*)"glVertex2hNV")) == NULL) || r; + r = ((glVertex2hvNV = (PFNGLVERTEX2HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertex2hvNV")) == NULL) || r; + r = ((glVertex3hNV = (PFNGLVERTEX3HNVPROC)glewGetProcAddress((const GLubyte*)"glVertex3hNV")) == NULL) || r; + r = ((glVertex3hvNV = (PFNGLVERTEX3HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertex3hvNV")) == NULL) || r; + r = ((glVertex4hNV = (PFNGLVERTEX4HNVPROC)glewGetProcAddress((const GLubyte*)"glVertex4hNV")) == NULL) || r; + r = ((glVertex4hvNV = (PFNGLVERTEX4HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertex4hvNV")) == NULL) || r; + r = ((glVertexAttrib1hNV = (PFNGLVERTEXATTRIB1HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1hNV")) == NULL) || r; + r = ((glVertexAttrib1hvNV = (PFNGLVERTEXATTRIB1HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1hvNV")) == NULL) || r; + r = ((glVertexAttrib2hNV = (PFNGLVERTEXATTRIB2HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2hNV")) == NULL) || r; + r = ((glVertexAttrib2hvNV = (PFNGLVERTEXATTRIB2HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2hvNV")) == NULL) || r; + r = ((glVertexAttrib3hNV = (PFNGLVERTEXATTRIB3HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3hNV")) == NULL) || r; + r = ((glVertexAttrib3hvNV = (PFNGLVERTEXATTRIB3HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3hvNV")) == NULL) || r; + r = ((glVertexAttrib4hNV = (PFNGLVERTEXATTRIB4HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4hNV")) == NULL) || r; + r = ((glVertexAttrib4hvNV = (PFNGLVERTEXATTRIB4HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4hvNV")) == NULL) || r; + r = ((glVertexAttribs1hvNV = (PFNGLVERTEXATTRIBS1HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1hvNV")) == NULL) || r; + r = ((glVertexAttribs2hvNV = (PFNGLVERTEXATTRIBS2HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2hvNV")) == NULL) || r; + r = ((glVertexAttribs3hvNV = (PFNGLVERTEXATTRIBS3HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3hvNV")) == NULL) || r; + r = ((glVertexAttribs4hvNV = (PFNGLVERTEXATTRIBS4HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4hvNV")) == NULL) || r; + r = ((glVertexWeighthNV = (PFNGLVERTEXWEIGHTHNVPROC)glewGetProcAddress((const GLubyte*)"glVertexWeighthNV")) == NULL) || r; + r = ((glVertexWeighthvNV = (PFNGLVERTEXWEIGHTHVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexWeighthvNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_half_float */ + +#ifdef GL_NV_internalformat_sample_query + +static GLboolean _glewInit_GL_NV_internalformat_sample_query (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetInternalformatSampleivNV = (PFNGLGETINTERNALFORMATSAMPLEIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetInternalformatSampleivNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_internalformat_sample_query */ + +#ifdef GL_NV_occlusion_query + +static GLboolean _glewInit_GL_NV_occlusion_query (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginOcclusionQueryNV = (PFNGLBEGINOCCLUSIONQUERYNVPROC)glewGetProcAddress((const GLubyte*)"glBeginOcclusionQueryNV")) == NULL) || r; + r = ((glDeleteOcclusionQueriesNV = (PFNGLDELETEOCCLUSIONQUERIESNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteOcclusionQueriesNV")) == NULL) || r; + r = ((glEndOcclusionQueryNV = (PFNGLENDOCCLUSIONQUERYNVPROC)glewGetProcAddress((const GLubyte*)"glEndOcclusionQueryNV")) == NULL) || r; + r = ((glGenOcclusionQueriesNV = (PFNGLGENOCCLUSIONQUERIESNVPROC)glewGetProcAddress((const GLubyte*)"glGenOcclusionQueriesNV")) == NULL) || r; + r = ((glGetOcclusionQueryivNV = (PFNGLGETOCCLUSIONQUERYIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetOcclusionQueryivNV")) == NULL) || r; + r = ((glGetOcclusionQueryuivNV = (PFNGLGETOCCLUSIONQUERYUIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetOcclusionQueryuivNV")) == NULL) || r; + r = ((glIsOcclusionQueryNV = (PFNGLISOCCLUSIONQUERYNVPROC)glewGetProcAddress((const GLubyte*)"glIsOcclusionQueryNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_occlusion_query */ + +#ifdef GL_NV_parameter_buffer_object + +static GLboolean _glewInit_GL_NV_parameter_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glProgramBufferParametersIivNV = (PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramBufferParametersIivNV")) == NULL) || r; + r = ((glProgramBufferParametersIuivNV = (PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramBufferParametersIuivNV")) == NULL) || r; + r = ((glProgramBufferParametersfvNV = (PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramBufferParametersfvNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_parameter_buffer_object */ + +#ifdef GL_NV_path_rendering + +static GLboolean _glewInit_GL_NV_path_rendering (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCopyPathNV = (PFNGLCOPYPATHNVPROC)glewGetProcAddress((const GLubyte*)"glCopyPathNV")) == NULL) || r; + r = ((glCoverFillPathInstancedNV = (PFNGLCOVERFILLPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glCoverFillPathInstancedNV")) == NULL) || r; + r = ((glCoverFillPathNV = (PFNGLCOVERFILLPATHNVPROC)glewGetProcAddress((const GLubyte*)"glCoverFillPathNV")) == NULL) || r; + r = ((glCoverStrokePathInstancedNV = (PFNGLCOVERSTROKEPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glCoverStrokePathInstancedNV")) == NULL) || r; + r = ((glCoverStrokePathNV = (PFNGLCOVERSTROKEPATHNVPROC)glewGetProcAddress((const GLubyte*)"glCoverStrokePathNV")) == NULL) || r; + r = ((glDeletePathsNV = (PFNGLDELETEPATHSNVPROC)glewGetProcAddress((const GLubyte*)"glDeletePathsNV")) == NULL) || r; + r = ((glGenPathsNV = (PFNGLGENPATHSNVPROC)glewGetProcAddress((const GLubyte*)"glGenPathsNV")) == NULL) || r; + r = ((glGetPathColorGenfvNV = (PFNGLGETPATHCOLORGENFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathColorGenfvNV")) == NULL) || r; + r = ((glGetPathColorGenivNV = (PFNGLGETPATHCOLORGENIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathColorGenivNV")) == NULL) || r; + r = ((glGetPathCommandsNV = (PFNGLGETPATHCOMMANDSNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathCommandsNV")) == NULL) || r; + r = ((glGetPathCoordsNV = (PFNGLGETPATHCOORDSNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathCoordsNV")) == NULL) || r; + r = ((glGetPathDashArrayNV = (PFNGLGETPATHDASHARRAYNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathDashArrayNV")) == NULL) || r; + r = ((glGetPathLengthNV = (PFNGLGETPATHLENGTHNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathLengthNV")) == NULL) || r; + r = ((glGetPathMetricRangeNV = (PFNGLGETPATHMETRICRANGENVPROC)glewGetProcAddress((const GLubyte*)"glGetPathMetricRangeNV")) == NULL) || r; + r = ((glGetPathMetricsNV = (PFNGLGETPATHMETRICSNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathMetricsNV")) == NULL) || r; + r = ((glGetPathParameterfvNV = (PFNGLGETPATHPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathParameterfvNV")) == NULL) || r; + r = ((glGetPathParameterivNV = (PFNGLGETPATHPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathParameterivNV")) == NULL) || r; + r = ((glGetPathSpacingNV = (PFNGLGETPATHSPACINGNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathSpacingNV")) == NULL) || r; + r = ((glGetPathTexGenfvNV = (PFNGLGETPATHTEXGENFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathTexGenfvNV")) == NULL) || r; + r = ((glGetPathTexGenivNV = (PFNGLGETPATHTEXGENIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetPathTexGenivNV")) == NULL) || r; + r = ((glGetProgramResourcefvNV = (PFNGLGETPROGRAMRESOURCEFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramResourcefvNV")) == NULL) || r; + r = ((glInterpolatePathsNV = (PFNGLINTERPOLATEPATHSNVPROC)glewGetProcAddress((const GLubyte*)"glInterpolatePathsNV")) == NULL) || r; + r = ((glIsPathNV = (PFNGLISPATHNVPROC)glewGetProcAddress((const GLubyte*)"glIsPathNV")) == NULL) || r; + r = ((glIsPointInFillPathNV = (PFNGLISPOINTINFILLPATHNVPROC)glewGetProcAddress((const GLubyte*)"glIsPointInFillPathNV")) == NULL) || r; + r = ((glIsPointInStrokePathNV = (PFNGLISPOINTINSTROKEPATHNVPROC)glewGetProcAddress((const GLubyte*)"glIsPointInStrokePathNV")) == NULL) || r; + r = ((glMatrixLoad3x2fNV = (PFNGLMATRIXLOAD3X2FNVPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoad3x2fNV")) == NULL) || r; + r = ((glMatrixLoad3x3fNV = (PFNGLMATRIXLOAD3X3FNVPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoad3x3fNV")) == NULL) || r; + r = ((glMatrixLoadTranspose3x3fNV = (PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC)glewGetProcAddress((const GLubyte*)"glMatrixLoadTranspose3x3fNV")) == NULL) || r; + r = ((glMatrixMult3x2fNV = (PFNGLMATRIXMULT3X2FNVPROC)glewGetProcAddress((const GLubyte*)"glMatrixMult3x2fNV")) == NULL) || r; + r = ((glMatrixMult3x3fNV = (PFNGLMATRIXMULT3X3FNVPROC)glewGetProcAddress((const GLubyte*)"glMatrixMult3x3fNV")) == NULL) || r; + r = ((glMatrixMultTranspose3x3fNV = (PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC)glewGetProcAddress((const GLubyte*)"glMatrixMultTranspose3x3fNV")) == NULL) || r; + r = ((glPathColorGenNV = (PFNGLPATHCOLORGENNVPROC)glewGetProcAddress((const GLubyte*)"glPathColorGenNV")) == NULL) || r; + r = ((glPathCommandsNV = (PFNGLPATHCOMMANDSNVPROC)glewGetProcAddress((const GLubyte*)"glPathCommandsNV")) == NULL) || r; + r = ((glPathCoordsNV = (PFNGLPATHCOORDSNVPROC)glewGetProcAddress((const GLubyte*)"glPathCoordsNV")) == NULL) || r; + r = ((glPathCoverDepthFuncNV = (PFNGLPATHCOVERDEPTHFUNCNVPROC)glewGetProcAddress((const GLubyte*)"glPathCoverDepthFuncNV")) == NULL) || r; + r = ((glPathDashArrayNV = (PFNGLPATHDASHARRAYNVPROC)glewGetProcAddress((const GLubyte*)"glPathDashArrayNV")) == NULL) || r; + r = ((glPathFogGenNV = (PFNGLPATHFOGGENNVPROC)glewGetProcAddress((const GLubyte*)"glPathFogGenNV")) == NULL) || r; + r = ((glPathGlyphIndexArrayNV = (PFNGLPATHGLYPHINDEXARRAYNVPROC)glewGetProcAddress((const GLubyte*)"glPathGlyphIndexArrayNV")) == NULL) || r; + r = ((glPathGlyphIndexRangeNV = (PFNGLPATHGLYPHINDEXRANGENVPROC)glewGetProcAddress((const GLubyte*)"glPathGlyphIndexRangeNV")) == NULL) || r; + r = ((glPathGlyphRangeNV = (PFNGLPATHGLYPHRANGENVPROC)glewGetProcAddress((const GLubyte*)"glPathGlyphRangeNV")) == NULL) || r; + r = ((glPathGlyphsNV = (PFNGLPATHGLYPHSNVPROC)glewGetProcAddress((const GLubyte*)"glPathGlyphsNV")) == NULL) || r; + r = ((glPathMemoryGlyphIndexArrayNV = (PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC)glewGetProcAddress((const GLubyte*)"glPathMemoryGlyphIndexArrayNV")) == NULL) || r; + r = ((glPathParameterfNV = (PFNGLPATHPARAMETERFNVPROC)glewGetProcAddress((const GLubyte*)"glPathParameterfNV")) == NULL) || r; + r = ((glPathParameterfvNV = (PFNGLPATHPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glPathParameterfvNV")) == NULL) || r; + r = ((glPathParameteriNV = (PFNGLPATHPARAMETERINVPROC)glewGetProcAddress((const GLubyte*)"glPathParameteriNV")) == NULL) || r; + r = ((glPathParameterivNV = (PFNGLPATHPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glPathParameterivNV")) == NULL) || r; + r = ((glPathStencilDepthOffsetNV = (PFNGLPATHSTENCILDEPTHOFFSETNVPROC)glewGetProcAddress((const GLubyte*)"glPathStencilDepthOffsetNV")) == NULL) || r; + r = ((glPathStencilFuncNV = (PFNGLPATHSTENCILFUNCNVPROC)glewGetProcAddress((const GLubyte*)"glPathStencilFuncNV")) == NULL) || r; + r = ((glPathStringNV = (PFNGLPATHSTRINGNVPROC)glewGetProcAddress((const GLubyte*)"glPathStringNV")) == NULL) || r; + r = ((glPathSubCommandsNV = (PFNGLPATHSUBCOMMANDSNVPROC)glewGetProcAddress((const GLubyte*)"glPathSubCommandsNV")) == NULL) || r; + r = ((glPathSubCoordsNV = (PFNGLPATHSUBCOORDSNVPROC)glewGetProcAddress((const GLubyte*)"glPathSubCoordsNV")) == NULL) || r; + r = ((glPathTexGenNV = (PFNGLPATHTEXGENNVPROC)glewGetProcAddress((const GLubyte*)"glPathTexGenNV")) == NULL) || r; + r = ((glPointAlongPathNV = (PFNGLPOINTALONGPATHNVPROC)glewGetProcAddress((const GLubyte*)"glPointAlongPathNV")) == NULL) || r; + r = ((glProgramPathFragmentInputGenNV = (PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC)glewGetProcAddress((const GLubyte*)"glProgramPathFragmentInputGenNV")) == NULL) || r; + r = ((glStencilFillPathInstancedNV = (PFNGLSTENCILFILLPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glStencilFillPathInstancedNV")) == NULL) || r; + r = ((glStencilFillPathNV = (PFNGLSTENCILFILLPATHNVPROC)glewGetProcAddress((const GLubyte*)"glStencilFillPathNV")) == NULL) || r; + r = ((glStencilStrokePathInstancedNV = (PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glStencilStrokePathInstancedNV")) == NULL) || r; + r = ((glStencilStrokePathNV = (PFNGLSTENCILSTROKEPATHNVPROC)glewGetProcAddress((const GLubyte*)"glStencilStrokePathNV")) == NULL) || r; + r = ((glStencilThenCoverFillPathInstancedNV = (PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glStencilThenCoverFillPathInstancedNV")) == NULL) || r; + r = ((glStencilThenCoverFillPathNV = (PFNGLSTENCILTHENCOVERFILLPATHNVPROC)glewGetProcAddress((const GLubyte*)"glStencilThenCoverFillPathNV")) == NULL) || r; + r = ((glStencilThenCoverStrokePathInstancedNV = (PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC)glewGetProcAddress((const GLubyte*)"glStencilThenCoverStrokePathInstancedNV")) == NULL) || r; + r = ((glStencilThenCoverStrokePathNV = (PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC)glewGetProcAddress((const GLubyte*)"glStencilThenCoverStrokePathNV")) == NULL) || r; + r = ((glTransformPathNV = (PFNGLTRANSFORMPATHNVPROC)glewGetProcAddress((const GLubyte*)"glTransformPathNV")) == NULL) || r; + r = ((glWeightPathsNV = (PFNGLWEIGHTPATHSNVPROC)glewGetProcAddress((const GLubyte*)"glWeightPathsNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_path_rendering */ + +#ifdef GL_NV_pixel_data_range + +static GLboolean _glewInit_GL_NV_pixel_data_range (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFlushPixelDataRangeNV = (PFNGLFLUSHPIXELDATARANGENVPROC)glewGetProcAddress((const GLubyte*)"glFlushPixelDataRangeNV")) == NULL) || r; + r = ((glPixelDataRangeNV = (PFNGLPIXELDATARANGENVPROC)glewGetProcAddress((const GLubyte*)"glPixelDataRangeNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_pixel_data_range */ + +#ifdef GL_NV_point_sprite + +static GLboolean _glewInit_GL_NV_point_sprite (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPointParameteriNV = (PFNGLPOINTPARAMETERINVPROC)glewGetProcAddress((const GLubyte*)"glPointParameteriNV")) == NULL) || r; + r = ((glPointParameterivNV = (PFNGLPOINTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glPointParameterivNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_point_sprite */ + +#ifdef GL_NV_present_video + +static GLboolean _glewInit_GL_NV_present_video (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetVideoi64vNV = (PFNGLGETVIDEOI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoi64vNV")) == NULL) || r; + r = ((glGetVideoivNV = (PFNGLGETVIDEOIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoivNV")) == NULL) || r; + r = ((glGetVideoui64vNV = (PFNGLGETVIDEOUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoui64vNV")) == NULL) || r; + r = ((glGetVideouivNV = (PFNGLGETVIDEOUIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideouivNV")) == NULL) || r; + r = ((glPresentFrameDualFillNV = (PFNGLPRESENTFRAMEDUALFILLNVPROC)glewGetProcAddress((const GLubyte*)"glPresentFrameDualFillNV")) == NULL) || r; + r = ((glPresentFrameKeyedNV = (PFNGLPRESENTFRAMEKEYEDNVPROC)glewGetProcAddress((const GLubyte*)"glPresentFrameKeyedNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_present_video */ + +#ifdef GL_NV_primitive_restart + +static GLboolean _glewInit_GL_NV_primitive_restart (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPrimitiveRestartIndexNV = (PFNGLPRIMITIVERESTARTINDEXNVPROC)glewGetProcAddress((const GLubyte*)"glPrimitiveRestartIndexNV")) == NULL) || r; + r = ((glPrimitiveRestartNV = (PFNGLPRIMITIVERESTARTNVPROC)glewGetProcAddress((const GLubyte*)"glPrimitiveRestartNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_primitive_restart */ + +#ifdef GL_NV_register_combiners + +static GLboolean _glewInit_GL_NV_register_combiners (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCombinerInputNV = (PFNGLCOMBINERINPUTNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerInputNV")) == NULL) || r; + r = ((glCombinerOutputNV = (PFNGLCOMBINEROUTPUTNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerOutputNV")) == NULL) || r; + r = ((glCombinerParameterfNV = (PFNGLCOMBINERPARAMETERFNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameterfNV")) == NULL) || r; + r = ((glCombinerParameterfvNV = (PFNGLCOMBINERPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameterfvNV")) == NULL) || r; + r = ((glCombinerParameteriNV = (PFNGLCOMBINERPARAMETERINVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameteriNV")) == NULL) || r; + r = ((glCombinerParameterivNV = (PFNGLCOMBINERPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameterivNV")) == NULL) || r; + r = ((glFinalCombinerInputNV = (PFNGLFINALCOMBINERINPUTNVPROC)glewGetProcAddress((const GLubyte*)"glFinalCombinerInputNV")) == NULL) || r; + r = ((glGetCombinerInputParameterfvNV = (PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerInputParameterfvNV")) == NULL) || r; + r = ((glGetCombinerInputParameterivNV = (PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerInputParameterivNV")) == NULL) || r; + r = ((glGetCombinerOutputParameterfvNV = (PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerOutputParameterfvNV")) == NULL) || r; + r = ((glGetCombinerOutputParameterivNV = (PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerOutputParameterivNV")) == NULL) || r; + r = ((glGetFinalCombinerInputParameterfvNV = (PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetFinalCombinerInputParameterfvNV")) == NULL) || r; + r = ((glGetFinalCombinerInputParameterivNV = (PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetFinalCombinerInputParameterivNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_register_combiners */ + +#ifdef GL_NV_register_combiners2 + +static GLboolean _glewInit_GL_NV_register_combiners2 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCombinerStageParameterfvNV = (PFNGLCOMBINERSTAGEPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerStageParameterfvNV")) == NULL) || r; + r = ((glGetCombinerStageParameterfvNV = (PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerStageParameterfvNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_register_combiners2 */ + +#ifdef GL_NV_sample_locations + +static GLboolean _glewInit_GL_NV_sample_locations (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFramebufferSampleLocationsfvNV = (PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC)glewGetProcAddress((const GLubyte*)"glFramebufferSampleLocationsfvNV")) == NULL) || r; + r = ((glNamedFramebufferSampleLocationsfvNV = (PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferSampleLocationsfvNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_sample_locations */ + +#ifdef GL_NV_shader_buffer_load + +static GLboolean _glewInit_GL_NV_shader_buffer_load (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetBufferParameterui64vNV = (PFNGLGETBUFFERPARAMETERUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetBufferParameterui64vNV")) == NULL) || r; + r = ((glGetIntegerui64vNV = (PFNGLGETINTEGERUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetIntegerui64vNV")) == NULL) || r; + r = ((glGetNamedBufferParameterui64vNV = (PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetNamedBufferParameterui64vNV")) == NULL) || r; + r = ((glIsBufferResidentNV = (PFNGLISBUFFERRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glIsBufferResidentNV")) == NULL) || r; + r = ((glIsNamedBufferResidentNV = (PFNGLISNAMEDBUFFERRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glIsNamedBufferResidentNV")) == NULL) || r; + r = ((glMakeBufferNonResidentNV = (PFNGLMAKEBUFFERNONRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeBufferNonResidentNV")) == NULL) || r; + r = ((glMakeBufferResidentNV = (PFNGLMAKEBUFFERRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeBufferResidentNV")) == NULL) || r; + r = ((glMakeNamedBufferNonResidentNV = (PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeNamedBufferNonResidentNV")) == NULL) || r; + r = ((glMakeNamedBufferResidentNV = (PFNGLMAKENAMEDBUFFERRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glMakeNamedBufferResidentNV")) == NULL) || r; + r = ((glProgramUniformui64NV = (PFNGLPROGRAMUNIFORMUI64NVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformui64NV")) == NULL) || r; + r = ((glProgramUniformui64vNV = (PFNGLPROGRAMUNIFORMUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glProgramUniformui64vNV")) == NULL) || r; + r = ((glUniformui64NV = (PFNGLUNIFORMUI64NVPROC)glewGetProcAddress((const GLubyte*)"glUniformui64NV")) == NULL) || r; + r = ((glUniformui64vNV = (PFNGLUNIFORMUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glUniformui64vNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_shader_buffer_load */ + +#ifdef GL_NV_texture_barrier + +static GLboolean _glewInit_GL_NV_texture_barrier (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTextureBarrierNV = (PFNGLTEXTUREBARRIERNVPROC)glewGetProcAddress((const GLubyte*)"glTextureBarrierNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_texture_barrier */ + +#ifdef GL_NV_texture_multisample + +static GLboolean _glewInit_GL_NV_texture_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexImage2DMultisampleCoverageNV = (PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTexImage2DMultisampleCoverageNV")) == NULL) || r; + r = ((glTexImage3DMultisampleCoverageNV = (PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTexImage3DMultisampleCoverageNV")) == NULL) || r; + r = ((glTextureImage2DMultisampleCoverageNV = (PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage2DMultisampleCoverageNV")) == NULL) || r; + r = ((glTextureImage2DMultisampleNV = (PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage2DMultisampleNV")) == NULL) || r; + r = ((glTextureImage3DMultisampleCoverageNV = (PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage3DMultisampleCoverageNV")) == NULL) || r; + r = ((glTextureImage3DMultisampleNV = (PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage3DMultisampleNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_texture_multisample */ + +#ifdef GL_NV_transform_feedback + +static GLboolean _glewInit_GL_NV_transform_feedback (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glActiveVaryingNV = (PFNGLACTIVEVARYINGNVPROC)glewGetProcAddress((const GLubyte*)"glActiveVaryingNV")) == NULL) || r; + r = ((glBeginTransformFeedbackNV = (PFNGLBEGINTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glBeginTransformFeedbackNV")) == NULL) || r; + r = ((glBindBufferBaseNV = (PFNGLBINDBUFFERBASENVPROC)glewGetProcAddress((const GLubyte*)"glBindBufferBaseNV")) == NULL) || r; + r = ((glBindBufferOffsetNV = (PFNGLBINDBUFFEROFFSETNVPROC)glewGetProcAddress((const GLubyte*)"glBindBufferOffsetNV")) == NULL) || r; + r = ((glBindBufferRangeNV = (PFNGLBINDBUFFERRANGENVPROC)glewGetProcAddress((const GLubyte*)"glBindBufferRangeNV")) == NULL) || r; + r = ((glEndTransformFeedbackNV = (PFNGLENDTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glEndTransformFeedbackNV")) == NULL) || r; + r = ((glGetActiveVaryingNV = (PFNGLGETACTIVEVARYINGNVPROC)glewGetProcAddress((const GLubyte*)"glGetActiveVaryingNV")) == NULL) || r; + r = ((glGetTransformFeedbackVaryingNV = (PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC)glewGetProcAddress((const GLubyte*)"glGetTransformFeedbackVaryingNV")) == NULL) || r; + r = ((glGetVaryingLocationNV = (PFNGLGETVARYINGLOCATIONNVPROC)glewGetProcAddress((const GLubyte*)"glGetVaryingLocationNV")) == NULL) || r; + r = ((glTransformFeedbackAttribsNV = (PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackAttribsNV")) == NULL) || r; + r = ((glTransformFeedbackVaryingsNV = (PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC)glewGetProcAddress((const GLubyte*)"glTransformFeedbackVaryingsNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_transform_feedback */ + +#ifdef GL_NV_transform_feedback2 + +static GLboolean _glewInit_GL_NV_transform_feedback2 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindTransformFeedbackNV = (PFNGLBINDTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glBindTransformFeedbackNV")) == NULL) || r; + r = ((glDeleteTransformFeedbacksNV = (PFNGLDELETETRANSFORMFEEDBACKSNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteTransformFeedbacksNV")) == NULL) || r; + r = ((glDrawTransformFeedbackNV = (PFNGLDRAWTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glDrawTransformFeedbackNV")) == NULL) || r; + r = ((glGenTransformFeedbacksNV = (PFNGLGENTRANSFORMFEEDBACKSNVPROC)glewGetProcAddress((const GLubyte*)"glGenTransformFeedbacksNV")) == NULL) || r; + r = ((glIsTransformFeedbackNV = (PFNGLISTRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glIsTransformFeedbackNV")) == NULL) || r; + r = ((glPauseTransformFeedbackNV = (PFNGLPAUSETRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glPauseTransformFeedbackNV")) == NULL) || r; + r = ((glResumeTransformFeedbackNV = (PFNGLRESUMETRANSFORMFEEDBACKNVPROC)glewGetProcAddress((const GLubyte*)"glResumeTransformFeedbackNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_transform_feedback2 */ + +#ifdef GL_NV_vdpau_interop + +static GLboolean _glewInit_GL_NV_vdpau_interop (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glVDPAUFiniNV = (PFNGLVDPAUFININVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUFiniNV")) == NULL) || r; + r = ((glVDPAUGetSurfaceivNV = (PFNGLVDPAUGETSURFACEIVNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUGetSurfaceivNV")) == NULL) || r; + r = ((glVDPAUInitNV = (PFNGLVDPAUINITNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUInitNV")) == NULL) || r; + r = ((glVDPAUIsSurfaceNV = (PFNGLVDPAUISSURFACENVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUIsSurfaceNV")) == NULL) || r; + r = ((glVDPAUMapSurfacesNV = (PFNGLVDPAUMAPSURFACESNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUMapSurfacesNV")) == NULL) || r; + r = ((glVDPAURegisterOutputSurfaceNV = (PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC)glewGetProcAddress((const GLubyte*)"glVDPAURegisterOutputSurfaceNV")) == NULL) || r; + r = ((glVDPAURegisterVideoSurfaceNV = (PFNGLVDPAUREGISTERVIDEOSURFACENVPROC)glewGetProcAddress((const GLubyte*)"glVDPAURegisterVideoSurfaceNV")) == NULL) || r; + r = ((glVDPAUSurfaceAccessNV = (PFNGLVDPAUSURFACEACCESSNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUSurfaceAccessNV")) == NULL) || r; + r = ((glVDPAUUnmapSurfacesNV = (PFNGLVDPAUUNMAPSURFACESNVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUUnmapSurfacesNV")) == NULL) || r; + r = ((glVDPAUUnregisterSurfaceNV = (PFNGLVDPAUUNREGISTERSURFACENVPROC)glewGetProcAddress((const GLubyte*)"glVDPAUUnregisterSurfaceNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_vdpau_interop */ + +#ifdef GL_NV_vertex_array_range + +static GLboolean _glewInit_GL_NV_vertex_array_range (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFlushVertexArrayRangeNV = (PFNGLFLUSHVERTEXARRAYRANGENVPROC)glewGetProcAddress((const GLubyte*)"glFlushVertexArrayRangeNV")) == NULL) || r; + r = ((glVertexArrayRangeNV = (PFNGLVERTEXARRAYRANGENVPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayRangeNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_vertex_array_range */ + +#ifdef GL_NV_vertex_attrib_integer_64bit + +static GLboolean _glewInit_GL_NV_vertex_attrib_integer_64bit (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetVertexAttribLi64vNV = (PFNGLGETVERTEXATTRIBLI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribLi64vNV")) == NULL) || r; + r = ((glGetVertexAttribLui64vNV = (PFNGLGETVERTEXATTRIBLUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribLui64vNV")) == NULL) || r; + r = ((glVertexAttribL1i64NV = (PFNGLVERTEXATTRIBL1I64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1i64NV")) == NULL) || r; + r = ((glVertexAttribL1i64vNV = (PFNGLVERTEXATTRIBL1I64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1i64vNV")) == NULL) || r; + r = ((glVertexAttribL1ui64NV = (PFNGLVERTEXATTRIBL1UI64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1ui64NV")) == NULL) || r; + r = ((glVertexAttribL1ui64vNV = (PFNGLVERTEXATTRIBL1UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL1ui64vNV")) == NULL) || r; + r = ((glVertexAttribL2i64NV = (PFNGLVERTEXATTRIBL2I64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2i64NV")) == NULL) || r; + r = ((glVertexAttribL2i64vNV = (PFNGLVERTEXATTRIBL2I64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2i64vNV")) == NULL) || r; + r = ((glVertexAttribL2ui64NV = (PFNGLVERTEXATTRIBL2UI64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2ui64NV")) == NULL) || r; + r = ((glVertexAttribL2ui64vNV = (PFNGLVERTEXATTRIBL2UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL2ui64vNV")) == NULL) || r; + r = ((glVertexAttribL3i64NV = (PFNGLVERTEXATTRIBL3I64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3i64NV")) == NULL) || r; + r = ((glVertexAttribL3i64vNV = (PFNGLVERTEXATTRIBL3I64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3i64vNV")) == NULL) || r; + r = ((glVertexAttribL3ui64NV = (PFNGLVERTEXATTRIBL3UI64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3ui64NV")) == NULL) || r; + r = ((glVertexAttribL3ui64vNV = (PFNGLVERTEXATTRIBL3UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL3ui64vNV")) == NULL) || r; + r = ((glVertexAttribL4i64NV = (PFNGLVERTEXATTRIBL4I64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4i64NV")) == NULL) || r; + r = ((glVertexAttribL4i64vNV = (PFNGLVERTEXATTRIBL4I64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4i64vNV")) == NULL) || r; + r = ((glVertexAttribL4ui64NV = (PFNGLVERTEXATTRIBL4UI64NVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4ui64NV")) == NULL) || r; + r = ((glVertexAttribL4ui64vNV = (PFNGLVERTEXATTRIBL4UI64VNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribL4ui64vNV")) == NULL) || r; + r = ((glVertexAttribLFormatNV = (PFNGLVERTEXATTRIBLFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribLFormatNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_vertex_attrib_integer_64bit */ + +#ifdef GL_NV_vertex_buffer_unified_memory + +static GLboolean _glewInit_GL_NV_vertex_buffer_unified_memory (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBufferAddressRangeNV = (PFNGLBUFFERADDRESSRANGENVPROC)glewGetProcAddress((const GLubyte*)"glBufferAddressRangeNV")) == NULL) || r; + r = ((glColorFormatNV = (PFNGLCOLORFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glColorFormatNV")) == NULL) || r; + r = ((glEdgeFlagFormatNV = (PFNGLEDGEFLAGFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glEdgeFlagFormatNV")) == NULL) || r; + r = ((glFogCoordFormatNV = (PFNGLFOGCOORDFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordFormatNV")) == NULL) || r; + r = ((glGetIntegerui64i_vNV = (PFNGLGETINTEGERUI64I_VNVPROC)glewGetProcAddress((const GLubyte*)"glGetIntegerui64i_vNV")) == NULL) || r; + r = ((glIndexFormatNV = (PFNGLINDEXFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glIndexFormatNV")) == NULL) || r; + r = ((glNormalFormatNV = (PFNGLNORMALFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glNormalFormatNV")) == NULL) || r; + r = ((glSecondaryColorFormatNV = (PFNGLSECONDARYCOLORFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorFormatNV")) == NULL) || r; + r = ((glTexCoordFormatNV = (PFNGLTEXCOORDFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoordFormatNV")) == NULL) || r; + r = ((glVertexAttribFormatNV = (PFNGLVERTEXATTRIBFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribFormatNV")) == NULL) || r; + r = ((glVertexAttribIFormatNV = (PFNGLVERTEXATTRIBIFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribIFormatNV")) == NULL) || r; + r = ((glVertexFormatNV = (PFNGLVERTEXFORMATNVPROC)glewGetProcAddress((const GLubyte*)"glVertexFormatNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_vertex_buffer_unified_memory */ + +#ifdef GL_NV_vertex_program + +static GLboolean _glewInit_GL_NV_vertex_program (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAreProgramsResidentNV = (PFNGLAREPROGRAMSRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glAreProgramsResidentNV")) == NULL) || r; + r = ((glBindProgramNV = (PFNGLBINDPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glBindProgramNV")) == NULL) || r; + r = ((glDeleteProgramsNV = (PFNGLDELETEPROGRAMSNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgramsNV")) == NULL) || r; + r = ((glExecuteProgramNV = (PFNGLEXECUTEPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glExecuteProgramNV")) == NULL) || r; + r = ((glGenProgramsNV = (PFNGLGENPROGRAMSNVPROC)glewGetProcAddress((const GLubyte*)"glGenProgramsNV")) == NULL) || r; + r = ((glGetProgramParameterdvNV = (PFNGLGETPROGRAMPARAMETERDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramParameterdvNV")) == NULL) || r; + r = ((glGetProgramParameterfvNV = (PFNGLGETPROGRAMPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramParameterfvNV")) == NULL) || r; + r = ((glGetProgramStringNV = (PFNGLGETPROGRAMSTRINGNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramStringNV")) == NULL) || r; + r = ((glGetProgramivNV = (PFNGLGETPROGRAMIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramivNV")) == NULL) || r; + r = ((glGetTrackMatrixivNV = (PFNGLGETTRACKMATRIXIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetTrackMatrixivNV")) == NULL) || r; + r = ((glGetVertexAttribPointervNV = (PFNGLGETVERTEXATTRIBPOINTERVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribPointervNV")) == NULL) || r; + r = ((glGetVertexAttribdvNV = (PFNGLGETVERTEXATTRIBDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribdvNV")) == NULL) || r; + r = ((glGetVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribfvNV")) == NULL) || r; + r = ((glGetVertexAttribivNV = (PFNGLGETVERTEXATTRIBIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribivNV")) == NULL) || r; + r = ((glIsProgramNV = (PFNGLISPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glIsProgramNV")) == NULL) || r; + r = ((glLoadProgramNV = (PFNGLLOADPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glLoadProgramNV")) == NULL) || r; + r = ((glProgramParameter4dNV = (PFNGLPROGRAMPARAMETER4DNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4dNV")) == NULL) || r; + r = ((glProgramParameter4dvNV = (PFNGLPROGRAMPARAMETER4DVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4dvNV")) == NULL) || r; + r = ((glProgramParameter4fNV = (PFNGLPROGRAMPARAMETER4FNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4fNV")) == NULL) || r; + r = ((glProgramParameter4fvNV = (PFNGLPROGRAMPARAMETER4FVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4fvNV")) == NULL) || r; + r = ((glProgramParameters4dvNV = (PFNGLPROGRAMPARAMETERS4DVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameters4dvNV")) == NULL) || r; + r = ((glProgramParameters4fvNV = (PFNGLPROGRAMPARAMETERS4FVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameters4fvNV")) == NULL) || r; + r = ((glRequestResidentProgramsNV = (PFNGLREQUESTRESIDENTPROGRAMSNVPROC)glewGetProcAddress((const GLubyte*)"glRequestResidentProgramsNV")) == NULL) || r; + r = ((glTrackMatrixNV = (PFNGLTRACKMATRIXNVPROC)glewGetProcAddress((const GLubyte*)"glTrackMatrixNV")) == NULL) || r; + r = ((glVertexAttrib1dNV = (PFNGLVERTEXATTRIB1DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dNV")) == NULL) || r; + r = ((glVertexAttrib1dvNV = (PFNGLVERTEXATTRIB1DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dvNV")) == NULL) || r; + r = ((glVertexAttrib1fNV = (PFNGLVERTEXATTRIB1FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fNV")) == NULL) || r; + r = ((glVertexAttrib1fvNV = (PFNGLVERTEXATTRIB1FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fvNV")) == NULL) || r; + r = ((glVertexAttrib1sNV = (PFNGLVERTEXATTRIB1SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1sNV")) == NULL) || r; + r = ((glVertexAttrib1svNV = (PFNGLVERTEXATTRIB1SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1svNV")) == NULL) || r; + r = ((glVertexAttrib2dNV = (PFNGLVERTEXATTRIB2DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dNV")) == NULL) || r; + r = ((glVertexAttrib2dvNV = (PFNGLVERTEXATTRIB2DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dvNV")) == NULL) || r; + r = ((glVertexAttrib2fNV = (PFNGLVERTEXATTRIB2FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fNV")) == NULL) || r; + r = ((glVertexAttrib2fvNV = (PFNGLVERTEXATTRIB2FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fvNV")) == NULL) || r; + r = ((glVertexAttrib2sNV = (PFNGLVERTEXATTRIB2SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2sNV")) == NULL) || r; + r = ((glVertexAttrib2svNV = (PFNGLVERTEXATTRIB2SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2svNV")) == NULL) || r; + r = ((glVertexAttrib3dNV = (PFNGLVERTEXATTRIB3DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dNV")) == NULL) || r; + r = ((glVertexAttrib3dvNV = (PFNGLVERTEXATTRIB3DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dvNV")) == NULL) || r; + r = ((glVertexAttrib3fNV = (PFNGLVERTEXATTRIB3FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fNV")) == NULL) || r; + r = ((glVertexAttrib3fvNV = (PFNGLVERTEXATTRIB3FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fvNV")) == NULL) || r; + r = ((glVertexAttrib3sNV = (PFNGLVERTEXATTRIB3SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3sNV")) == NULL) || r; + r = ((glVertexAttrib3svNV = (PFNGLVERTEXATTRIB3SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3svNV")) == NULL) || r; + r = ((glVertexAttrib4dNV = (PFNGLVERTEXATTRIB4DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dNV")) == NULL) || r; + r = ((glVertexAttrib4dvNV = (PFNGLVERTEXATTRIB4DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dvNV")) == NULL) || r; + r = ((glVertexAttrib4fNV = (PFNGLVERTEXATTRIB4FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fNV")) == NULL) || r; + r = ((glVertexAttrib4fvNV = (PFNGLVERTEXATTRIB4FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fvNV")) == NULL) || r; + r = ((glVertexAttrib4sNV = (PFNGLVERTEXATTRIB4SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4sNV")) == NULL) || r; + r = ((glVertexAttrib4svNV = (PFNGLVERTEXATTRIB4SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4svNV")) == NULL) || r; + r = ((glVertexAttrib4ubNV = (PFNGLVERTEXATTRIB4UBNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubNV")) == NULL) || r; + r = ((glVertexAttrib4ubvNV = (PFNGLVERTEXATTRIB4UBVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubvNV")) == NULL) || r; + r = ((glVertexAttribPointerNV = (PFNGLVERTEXATTRIBPOINTERNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointerNV")) == NULL) || r; + r = ((glVertexAttribs1dvNV = (PFNGLVERTEXATTRIBS1DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1dvNV")) == NULL) || r; + r = ((glVertexAttribs1fvNV = (PFNGLVERTEXATTRIBS1FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1fvNV")) == NULL) || r; + r = ((glVertexAttribs1svNV = (PFNGLVERTEXATTRIBS1SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1svNV")) == NULL) || r; + r = ((glVertexAttribs2dvNV = (PFNGLVERTEXATTRIBS2DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2dvNV")) == NULL) || r; + r = ((glVertexAttribs2fvNV = (PFNGLVERTEXATTRIBS2FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2fvNV")) == NULL) || r; + r = ((glVertexAttribs2svNV = (PFNGLVERTEXATTRIBS2SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2svNV")) == NULL) || r; + r = ((glVertexAttribs3dvNV = (PFNGLVERTEXATTRIBS3DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3dvNV")) == NULL) || r; + r = ((glVertexAttribs3fvNV = (PFNGLVERTEXATTRIBS3FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3fvNV")) == NULL) || r; + r = ((glVertexAttribs3svNV = (PFNGLVERTEXATTRIBS3SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3svNV")) == NULL) || r; + r = ((glVertexAttribs4dvNV = (PFNGLVERTEXATTRIBS4DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4dvNV")) == NULL) || r; + r = ((glVertexAttribs4fvNV = (PFNGLVERTEXATTRIBS4FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4fvNV")) == NULL) || r; + r = ((glVertexAttribs4svNV = (PFNGLVERTEXATTRIBS4SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4svNV")) == NULL) || r; + r = ((glVertexAttribs4ubvNV = (PFNGLVERTEXATTRIBS4UBVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4ubvNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_vertex_program */ + +#ifdef GL_NV_video_capture + +static GLboolean _glewInit_GL_NV_video_capture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginVideoCaptureNV = (PFNGLBEGINVIDEOCAPTURENVPROC)glewGetProcAddress((const GLubyte*)"glBeginVideoCaptureNV")) == NULL) || r; + r = ((glBindVideoCaptureStreamBufferNV = (PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC)glewGetProcAddress((const GLubyte*)"glBindVideoCaptureStreamBufferNV")) == NULL) || r; + r = ((glBindVideoCaptureStreamTextureNV = (PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC)glewGetProcAddress((const GLubyte*)"glBindVideoCaptureStreamTextureNV")) == NULL) || r; + r = ((glEndVideoCaptureNV = (PFNGLENDVIDEOCAPTURENVPROC)glewGetProcAddress((const GLubyte*)"glEndVideoCaptureNV")) == NULL) || r; + r = ((glGetVideoCaptureStreamdvNV = (PFNGLGETVIDEOCAPTURESTREAMDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureStreamdvNV")) == NULL) || r; + r = ((glGetVideoCaptureStreamfvNV = (PFNGLGETVIDEOCAPTURESTREAMFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureStreamfvNV")) == NULL) || r; + r = ((glGetVideoCaptureStreamivNV = (PFNGLGETVIDEOCAPTURESTREAMIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureStreamivNV")) == NULL) || r; + r = ((glGetVideoCaptureivNV = (PFNGLGETVIDEOCAPTUREIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureivNV")) == NULL) || r; + r = ((glVideoCaptureNV = (PFNGLVIDEOCAPTURENVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureNV")) == NULL) || r; + r = ((glVideoCaptureStreamParameterdvNV = (PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureStreamParameterdvNV")) == NULL) || r; + r = ((glVideoCaptureStreamParameterfvNV = (PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureStreamParameterfvNV")) == NULL) || r; + r = ((glVideoCaptureStreamParameterivNV = (PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureStreamParameterivNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_video_capture */ + +#ifdef GL_OES_single_precision + +static GLboolean _glewInit_GL_OES_single_precision (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glClearDepthfOES = (PFNGLCLEARDEPTHFOESPROC)glewGetProcAddress((const GLubyte*)"glClearDepthfOES")) == NULL) || r; + r = ((glClipPlanefOES = (PFNGLCLIPPLANEFOESPROC)glewGetProcAddress((const GLubyte*)"glClipPlanefOES")) == NULL) || r; + r = ((glDepthRangefOES = (PFNGLDEPTHRANGEFOESPROC)glewGetProcAddress((const GLubyte*)"glDepthRangefOES")) == NULL) || r; + r = ((glFrustumfOES = (PFNGLFRUSTUMFOESPROC)glewGetProcAddress((const GLubyte*)"glFrustumfOES")) == NULL) || r; + r = ((glGetClipPlanefOES = (PFNGLGETCLIPPLANEFOESPROC)glewGetProcAddress((const GLubyte*)"glGetClipPlanefOES")) == NULL) || r; + r = ((glOrthofOES = (PFNGLORTHOFOESPROC)glewGetProcAddress((const GLubyte*)"glOrthofOES")) == NULL) || r; + + return r; +} + +#endif /* GL_OES_single_precision */ + +#ifdef GL_OVR_multiview + +static GLboolean _glewInit_GL_OVR_multiview (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFramebufferTextureMultiviewOVR = (PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureMultiviewOVR")) == NULL) || r; + + return r; +} + +#endif /* GL_OVR_multiview */ + +#ifdef GL_REGAL_ES1_0_compatibility + +static GLboolean _glewInit_GL_REGAL_ES1_0_compatibility (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAlphaFuncx = (PFNGLALPHAFUNCXPROC)glewGetProcAddress((const GLubyte*)"glAlphaFuncx")) == NULL) || r; + r = ((glClearColorx = (PFNGLCLEARCOLORXPROC)glewGetProcAddress((const GLubyte*)"glClearColorx")) == NULL) || r; + r = ((glClearDepthx = (PFNGLCLEARDEPTHXPROC)glewGetProcAddress((const GLubyte*)"glClearDepthx")) == NULL) || r; + r = ((glColor4x = (PFNGLCOLOR4XPROC)glewGetProcAddress((const GLubyte*)"glColor4x")) == NULL) || r; + r = ((glDepthRangex = (PFNGLDEPTHRANGEXPROC)glewGetProcAddress((const GLubyte*)"glDepthRangex")) == NULL) || r; + r = ((glFogx = (PFNGLFOGXPROC)glewGetProcAddress((const GLubyte*)"glFogx")) == NULL) || r; + r = ((glFogxv = (PFNGLFOGXVPROC)glewGetProcAddress((const GLubyte*)"glFogxv")) == NULL) || r; + r = ((glFrustumf = (PFNGLFRUSTUMFPROC)glewGetProcAddress((const GLubyte*)"glFrustumf")) == NULL) || r; + r = ((glFrustumx = (PFNGLFRUSTUMXPROC)glewGetProcAddress((const GLubyte*)"glFrustumx")) == NULL) || r; + r = ((glLightModelx = (PFNGLLIGHTMODELXPROC)glewGetProcAddress((const GLubyte*)"glLightModelx")) == NULL) || r; + r = ((glLightModelxv = (PFNGLLIGHTMODELXVPROC)glewGetProcAddress((const GLubyte*)"glLightModelxv")) == NULL) || r; + r = ((glLightx = (PFNGLLIGHTXPROC)glewGetProcAddress((const GLubyte*)"glLightx")) == NULL) || r; + r = ((glLightxv = (PFNGLLIGHTXVPROC)glewGetProcAddress((const GLubyte*)"glLightxv")) == NULL) || r; + r = ((glLineWidthx = (PFNGLLINEWIDTHXPROC)glewGetProcAddress((const GLubyte*)"glLineWidthx")) == NULL) || r; + r = ((glLoadMatrixx = (PFNGLLOADMATRIXXPROC)glewGetProcAddress((const GLubyte*)"glLoadMatrixx")) == NULL) || r; + r = ((glMaterialx = (PFNGLMATERIALXPROC)glewGetProcAddress((const GLubyte*)"glMaterialx")) == NULL) || r; + r = ((glMaterialxv = (PFNGLMATERIALXVPROC)glewGetProcAddress((const GLubyte*)"glMaterialxv")) == NULL) || r; + r = ((glMultMatrixx = (PFNGLMULTMATRIXXPROC)glewGetProcAddress((const GLubyte*)"glMultMatrixx")) == NULL) || r; + r = ((glMultiTexCoord4x = (PFNGLMULTITEXCOORD4XPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4x")) == NULL) || r; + r = ((glNormal3x = (PFNGLNORMAL3XPROC)glewGetProcAddress((const GLubyte*)"glNormal3x")) == NULL) || r; + r = ((glOrthof = (PFNGLORTHOFPROC)glewGetProcAddress((const GLubyte*)"glOrthof")) == NULL) || r; + r = ((glOrthox = (PFNGLORTHOXPROC)glewGetProcAddress((const GLubyte*)"glOrthox")) == NULL) || r; + r = ((glPointSizex = (PFNGLPOINTSIZEXPROC)glewGetProcAddress((const GLubyte*)"glPointSizex")) == NULL) || r; + r = ((glPolygonOffsetx = (PFNGLPOLYGONOFFSETXPROC)glewGetProcAddress((const GLubyte*)"glPolygonOffsetx")) == NULL) || r; + r = ((glRotatex = (PFNGLROTATEXPROC)glewGetProcAddress((const GLubyte*)"glRotatex")) == NULL) || r; + r = ((glSampleCoveragex = (PFNGLSAMPLECOVERAGEXPROC)glewGetProcAddress((const GLubyte*)"glSampleCoveragex")) == NULL) || r; + r = ((glScalex = (PFNGLSCALEXPROC)glewGetProcAddress((const GLubyte*)"glScalex")) == NULL) || r; + r = ((glTexEnvx = (PFNGLTEXENVXPROC)glewGetProcAddress((const GLubyte*)"glTexEnvx")) == NULL) || r; + r = ((glTexEnvxv = (PFNGLTEXENVXVPROC)glewGetProcAddress((const GLubyte*)"glTexEnvxv")) == NULL) || r; + r = ((glTexParameterx = (PFNGLTEXPARAMETERXPROC)glewGetProcAddress((const GLubyte*)"glTexParameterx")) == NULL) || r; + r = ((glTranslatex = (PFNGLTRANSLATEXPROC)glewGetProcAddress((const GLubyte*)"glTranslatex")) == NULL) || r; + + return r; +} + +#endif /* GL_REGAL_ES1_0_compatibility */ + +#ifdef GL_REGAL_ES1_1_compatibility + +static GLboolean _glewInit_GL_REGAL_ES1_1_compatibility (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glClipPlanef = (PFNGLCLIPPLANEFPROC)glewGetProcAddress((const GLubyte*)"glClipPlanef")) == NULL) || r; + r = ((glClipPlanex = (PFNGLCLIPPLANEXPROC)glewGetProcAddress((const GLubyte*)"glClipPlanex")) == NULL) || r; + r = ((glGetClipPlanef = (PFNGLGETCLIPPLANEFPROC)glewGetProcAddress((const GLubyte*)"glGetClipPlanef")) == NULL) || r; + r = ((glGetClipPlanex = (PFNGLGETCLIPPLANEXPROC)glewGetProcAddress((const GLubyte*)"glGetClipPlanex")) == NULL) || r; + r = ((glGetFixedv = (PFNGLGETFIXEDVPROC)glewGetProcAddress((const GLubyte*)"glGetFixedv")) == NULL) || r; + r = ((glGetLightxv = (PFNGLGETLIGHTXVPROC)glewGetProcAddress((const GLubyte*)"glGetLightxv")) == NULL) || r; + r = ((glGetMaterialxv = (PFNGLGETMATERIALXVPROC)glewGetProcAddress((const GLubyte*)"glGetMaterialxv")) == NULL) || r; + r = ((glGetTexEnvxv = (PFNGLGETTEXENVXVPROC)glewGetProcAddress((const GLubyte*)"glGetTexEnvxv")) == NULL) || r; + r = ((glGetTexParameterxv = (PFNGLGETTEXPARAMETERXVPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterxv")) == NULL) || r; + r = ((glPointParameterx = (PFNGLPOINTPARAMETERXPROC)glewGetProcAddress((const GLubyte*)"glPointParameterx")) == NULL) || r; + r = ((glPointParameterxv = (PFNGLPOINTPARAMETERXVPROC)glewGetProcAddress((const GLubyte*)"glPointParameterxv")) == NULL) || r; + r = ((glPointSizePointerOES = (PFNGLPOINTSIZEPOINTEROESPROC)glewGetProcAddress((const GLubyte*)"glPointSizePointerOES")) == NULL) || r; + r = ((glTexParameterxv = (PFNGLTEXPARAMETERXVPROC)glewGetProcAddress((const GLubyte*)"glTexParameterxv")) == NULL) || r; + + return r; +} + +#endif /* GL_REGAL_ES1_1_compatibility */ + +#ifdef GL_REGAL_error_string + +static GLboolean _glewInit_GL_REGAL_error_string (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glErrorStringREGAL = (PFNGLERRORSTRINGREGALPROC)glewGetProcAddress((const GLubyte*)"glErrorStringREGAL")) == NULL) || r; + + return r; +} + +#endif /* GL_REGAL_error_string */ + +#ifdef GL_REGAL_extension_query + +static GLboolean _glewInit_GL_REGAL_extension_query (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetExtensionREGAL = (PFNGLGETEXTENSIONREGALPROC)glewGetProcAddress((const GLubyte*)"glGetExtensionREGAL")) == NULL) || r; + r = ((glIsSupportedREGAL = (PFNGLISSUPPORTEDREGALPROC)glewGetProcAddress((const GLubyte*)"glIsSupportedREGAL")) == NULL) || r; + + return r; +} + +#endif /* GL_REGAL_extension_query */ + +#ifdef GL_REGAL_log + +static GLboolean _glewInit_GL_REGAL_log (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glLogMessageCallbackREGAL = (PFNGLLOGMESSAGECALLBACKREGALPROC)glewGetProcAddress((const GLubyte*)"glLogMessageCallbackREGAL")) == NULL) || r; + + return r; +} + +#endif /* GL_REGAL_log */ + +#ifdef GL_REGAL_proc_address + +static GLboolean _glewInit_GL_REGAL_proc_address (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetProcAddressREGAL = (PFNGLGETPROCADDRESSREGALPROC)glewGetProcAddress((const GLubyte*)"glGetProcAddressREGAL")) == NULL) || r; + + return r; +} + +#endif /* GL_REGAL_proc_address */ + +#ifdef GL_SGIS_detail_texture + +static GLboolean _glewInit_GL_SGIS_detail_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDetailTexFuncSGIS = (PFNGLDETAILTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glDetailTexFuncSGIS")) == NULL) || r; + r = ((glGetDetailTexFuncSGIS = (PFNGLGETDETAILTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetDetailTexFuncSGIS")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIS_detail_texture */ + +#ifdef GL_SGIS_fog_function + +static GLboolean _glewInit_GL_SGIS_fog_function (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFogFuncSGIS = (PFNGLFOGFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glFogFuncSGIS")) == NULL) || r; + r = ((glGetFogFuncSGIS = (PFNGLGETFOGFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetFogFuncSGIS")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIS_fog_function */ + +#ifdef GL_SGIS_multisample + +static GLboolean _glewInit_GL_SGIS_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glSampleMaskSGIS = (PFNGLSAMPLEMASKSGISPROC)glewGetProcAddress((const GLubyte*)"glSampleMaskSGIS")) == NULL) || r; + r = ((glSamplePatternSGIS = (PFNGLSAMPLEPATTERNSGISPROC)glewGetProcAddress((const GLubyte*)"glSamplePatternSGIS")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIS_multisample */ + +#ifdef GL_SGIS_sharpen_texture + +static GLboolean _glewInit_GL_SGIS_sharpen_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetSharpenTexFuncSGIS = (PFNGLGETSHARPENTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetSharpenTexFuncSGIS")) == NULL) || r; + r = ((glSharpenTexFuncSGIS = (PFNGLSHARPENTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glSharpenTexFuncSGIS")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIS_sharpen_texture */ + +#ifdef GL_SGIS_texture4D + +static GLboolean _glewInit_GL_SGIS_texture4D (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexImage4DSGIS = (PFNGLTEXIMAGE4DSGISPROC)glewGetProcAddress((const GLubyte*)"glTexImage4DSGIS")) == NULL) || r; + r = ((glTexSubImage4DSGIS = (PFNGLTEXSUBIMAGE4DSGISPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage4DSGIS")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIS_texture4D */ + +#ifdef GL_SGIS_texture_filter4 + +static GLboolean _glewInit_GL_SGIS_texture_filter4 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetTexFilterFuncSGIS = (PFNGLGETTEXFILTERFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetTexFilterFuncSGIS")) == NULL) || r; + r = ((glTexFilterFuncSGIS = (PFNGLTEXFILTERFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glTexFilterFuncSGIS")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIS_texture_filter4 */ + +#ifdef GL_SGIX_async + +static GLboolean _glewInit_GL_SGIX_async (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAsyncMarkerSGIX = (PFNGLASYNCMARKERSGIXPROC)glewGetProcAddress((const GLubyte*)"glAsyncMarkerSGIX")) == NULL) || r; + r = ((glDeleteAsyncMarkersSGIX = (PFNGLDELETEASYNCMARKERSSGIXPROC)glewGetProcAddress((const GLubyte*)"glDeleteAsyncMarkersSGIX")) == NULL) || r; + r = ((glFinishAsyncSGIX = (PFNGLFINISHASYNCSGIXPROC)glewGetProcAddress((const GLubyte*)"glFinishAsyncSGIX")) == NULL) || r; + r = ((glGenAsyncMarkersSGIX = (PFNGLGENASYNCMARKERSSGIXPROC)glewGetProcAddress((const GLubyte*)"glGenAsyncMarkersSGIX")) == NULL) || r; + r = ((glIsAsyncMarkerSGIX = (PFNGLISASYNCMARKERSGIXPROC)glewGetProcAddress((const GLubyte*)"glIsAsyncMarkerSGIX")) == NULL) || r; + r = ((glPollAsyncSGIX = (PFNGLPOLLASYNCSGIXPROC)glewGetProcAddress((const GLubyte*)"glPollAsyncSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_async */ + +#ifdef GL_SGIX_flush_raster + +static GLboolean _glewInit_GL_SGIX_flush_raster (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFlushRasterSGIX = (PFNGLFLUSHRASTERSGIXPROC)glewGetProcAddress((const GLubyte*)"glFlushRasterSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_flush_raster */ + +#ifdef GL_SGIX_fog_texture + +static GLboolean _glewInit_GL_SGIX_fog_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTextureFogSGIX = (PFNGLTEXTUREFOGSGIXPROC)glewGetProcAddress((const GLubyte*)"glTextureFogSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_fog_texture */ + +#ifdef GL_SGIX_fragment_specular_lighting + +static GLboolean _glewInit_GL_SGIX_fragment_specular_lighting (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFragmentColorMaterialSGIX = (PFNGLFRAGMENTCOLORMATERIALSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentColorMaterialSGIX")) == NULL) || r; + r = ((glFragmentLightModelfSGIX = (PFNGLFRAGMENTLIGHTMODELFSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfSGIX")) == NULL) || r; + r = ((glFragmentLightModelfvSGIX = (PFNGLFRAGMENTLIGHTMODELFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfvSGIX")) == NULL) || r; + r = ((glFragmentLightModeliSGIX = (PFNGLFRAGMENTLIGHTMODELISGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModeliSGIX")) == NULL) || r; + r = ((glFragmentLightModelivSGIX = (PFNGLFRAGMENTLIGHTMODELIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelivSGIX")) == NULL) || r; + r = ((glFragmentLightfSGIX = (PFNGLFRAGMENTLIGHTFSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfSGIX")) == NULL) || r; + r = ((glFragmentLightfvSGIX = (PFNGLFRAGMENTLIGHTFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfvSGIX")) == NULL) || r; + r = ((glFragmentLightiSGIX = (PFNGLFRAGMENTLIGHTISGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightiSGIX")) == NULL) || r; + r = ((glFragmentLightivSGIX = (PFNGLFRAGMENTLIGHTIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightivSGIX")) == NULL) || r; + r = ((glFragmentMaterialfSGIX = (PFNGLFRAGMENTMATERIALFSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfSGIX")) == NULL) || r; + r = ((glFragmentMaterialfvSGIX = (PFNGLFRAGMENTMATERIALFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfvSGIX")) == NULL) || r; + r = ((glFragmentMaterialiSGIX = (PFNGLFRAGMENTMATERIALISGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialiSGIX")) == NULL) || r; + r = ((glFragmentMaterialivSGIX = (PFNGLFRAGMENTMATERIALIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialivSGIX")) == NULL) || r; + r = ((glGetFragmentLightfvSGIX = (PFNGLGETFRAGMENTLIGHTFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightfvSGIX")) == NULL) || r; + r = ((glGetFragmentLightivSGIX = (PFNGLGETFRAGMENTLIGHTIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightivSGIX")) == NULL) || r; + r = ((glGetFragmentMaterialfvSGIX = (PFNGLGETFRAGMENTMATERIALFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialfvSGIX")) == NULL) || r; + r = ((glGetFragmentMaterialivSGIX = (PFNGLGETFRAGMENTMATERIALIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialivSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_fragment_specular_lighting */ + +#ifdef GL_SGIX_framezoom + +static GLboolean _glewInit_GL_SGIX_framezoom (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFrameZoomSGIX = (PFNGLFRAMEZOOMSGIXPROC)glewGetProcAddress((const GLubyte*)"glFrameZoomSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_framezoom */ + +#ifdef GL_SGIX_pixel_texture + +static GLboolean _glewInit_GL_SGIX_pixel_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPixelTexGenSGIX = (PFNGLPIXELTEXGENSGIXPROC)glewGetProcAddress((const GLubyte*)"glPixelTexGenSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_pixel_texture */ + +#ifdef GL_SGIX_reference_plane + +static GLboolean _glewInit_GL_SGIX_reference_plane (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glReferencePlaneSGIX = (PFNGLREFERENCEPLANESGIXPROC)glewGetProcAddress((const GLubyte*)"glReferencePlaneSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_reference_plane */ + +#ifdef GL_SGIX_sprite + +static GLboolean _glewInit_GL_SGIX_sprite (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glSpriteParameterfSGIX = (PFNGLSPRITEPARAMETERFSGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameterfSGIX")) == NULL) || r; + r = ((glSpriteParameterfvSGIX = (PFNGLSPRITEPARAMETERFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameterfvSGIX")) == NULL) || r; + r = ((glSpriteParameteriSGIX = (PFNGLSPRITEPARAMETERISGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameteriSGIX")) == NULL) || r; + r = ((glSpriteParameterivSGIX = (PFNGLSPRITEPARAMETERIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameterivSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_sprite */ + +#ifdef GL_SGIX_tag_sample_buffer + +static GLboolean _glewInit_GL_SGIX_tag_sample_buffer (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTagSampleBufferSGIX = (PFNGLTAGSAMPLEBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glTagSampleBufferSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_tag_sample_buffer */ + +#ifdef GL_SGI_color_table + +static GLboolean _glewInit_GL_SGI_color_table (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColorTableParameterfvSGI = (PFNGLCOLORTABLEPARAMETERFVSGIPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameterfvSGI")) == NULL) || r; + r = ((glColorTableParameterivSGI = (PFNGLCOLORTABLEPARAMETERIVSGIPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameterivSGI")) == NULL) || r; + r = ((glColorTableSGI = (PFNGLCOLORTABLESGIPROC)glewGetProcAddress((const GLubyte*)"glColorTableSGI")) == NULL) || r; + r = ((glCopyColorTableSGI = (PFNGLCOPYCOLORTABLESGIPROC)glewGetProcAddress((const GLubyte*)"glCopyColorTableSGI")) == NULL) || r; + r = ((glGetColorTableParameterfvSGI = (PFNGLGETCOLORTABLEPARAMETERFVSGIPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterfvSGI")) == NULL) || r; + r = ((glGetColorTableParameterivSGI = (PFNGLGETCOLORTABLEPARAMETERIVSGIPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterivSGI")) == NULL) || r; + r = ((glGetColorTableSGI = (PFNGLGETCOLORTABLESGIPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableSGI")) == NULL) || r; + + return r; +} + +#endif /* GL_SGI_color_table */ + +#ifdef GL_SUNX_constant_data + +static GLboolean _glewInit_GL_SUNX_constant_data (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFinishTextureSUNX = (PFNGLFINISHTEXTURESUNXPROC)glewGetProcAddress((const GLubyte*)"glFinishTextureSUNX")) == NULL) || r; + + return r; +} + +#endif /* GL_SUNX_constant_data */ + +#ifdef GL_SUN_global_alpha + +static GLboolean _glewInit_GL_SUN_global_alpha (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGlobalAlphaFactorbSUN = (PFNGLGLOBALALPHAFACTORBSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorbSUN")) == NULL) || r; + r = ((glGlobalAlphaFactordSUN = (PFNGLGLOBALALPHAFACTORDSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactordSUN")) == NULL) || r; + r = ((glGlobalAlphaFactorfSUN = (PFNGLGLOBALALPHAFACTORFSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorfSUN")) == NULL) || r; + r = ((glGlobalAlphaFactoriSUN = (PFNGLGLOBALALPHAFACTORISUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactoriSUN")) == NULL) || r; + r = ((glGlobalAlphaFactorsSUN = (PFNGLGLOBALALPHAFACTORSSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorsSUN")) == NULL) || r; + r = ((glGlobalAlphaFactorubSUN = (PFNGLGLOBALALPHAFACTORUBSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorubSUN")) == NULL) || r; + r = ((glGlobalAlphaFactoruiSUN = (PFNGLGLOBALALPHAFACTORUISUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactoruiSUN")) == NULL) || r; + r = ((glGlobalAlphaFactorusSUN = (PFNGLGLOBALALPHAFACTORUSSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorusSUN")) == NULL) || r; + + return r; +} + +#endif /* GL_SUN_global_alpha */ + +#ifdef GL_SUN_read_video_pixels + +static GLboolean _glewInit_GL_SUN_read_video_pixels (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glReadVideoPixelsSUN = (PFNGLREADVIDEOPIXELSSUNPROC)glewGetProcAddress((const GLubyte*)"glReadVideoPixelsSUN")) == NULL) || r; + + return r; +} + +#endif /* GL_SUN_read_video_pixels */ + +#ifdef GL_SUN_triangle_list + +static GLboolean _glewInit_GL_SUN_triangle_list (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glReplacementCodePointerSUN = (PFNGLREPLACEMENTCODEPOINTERSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodePointerSUN")) == NULL) || r; + r = ((glReplacementCodeubSUN = (PFNGLREPLACEMENTCODEUBSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeubSUN")) == NULL) || r; + r = ((glReplacementCodeubvSUN = (PFNGLREPLACEMENTCODEUBVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeubvSUN")) == NULL) || r; + r = ((glReplacementCodeuiSUN = (PFNGLREPLACEMENTCODEUISUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiSUN")) == NULL) || r; + r = ((glReplacementCodeuivSUN = (PFNGLREPLACEMENTCODEUIVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuivSUN")) == NULL) || r; + r = ((glReplacementCodeusSUN = (PFNGLREPLACEMENTCODEUSSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeusSUN")) == NULL) || r; + r = ((glReplacementCodeusvSUN = (PFNGLREPLACEMENTCODEUSVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeusvSUN")) == NULL) || r; + + return r; +} + +#endif /* GL_SUN_triangle_list */ + +#ifdef GL_SUN_vertex + +static GLboolean _glewInit_GL_SUN_vertex (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColor3fVertex3fSUN = (PFNGLCOLOR3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor3fVertex3fSUN")) == NULL) || r; + r = ((glColor3fVertex3fvSUN = (PFNGLCOLOR3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor3fVertex3fvSUN")) == NULL) || r; + r = ((glColor4fNormal3fVertex3fSUN = (PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4fNormal3fVertex3fSUN")) == NULL) || r; + r = ((glColor4fNormal3fVertex3fvSUN = (PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4fNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glColor4ubVertex2fSUN = (PFNGLCOLOR4UBVERTEX2FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex2fSUN")) == NULL) || r; + r = ((glColor4ubVertex2fvSUN = (PFNGLCOLOR4UBVERTEX2FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex2fvSUN")) == NULL) || r; + r = ((glColor4ubVertex3fSUN = (PFNGLCOLOR4UBVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex3fSUN")) == NULL) || r; + r = ((glColor4ubVertex3fvSUN = (PFNGLCOLOR4UBVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex3fvSUN")) == NULL) || r; + r = ((glNormal3fVertex3fSUN = (PFNGLNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glNormal3fVertex3fSUN")) == NULL) || r; + r = ((glNormal3fVertex3fvSUN = (PFNGLNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiColor3fVertex3fSUN = (PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor3fVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiColor3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor3fVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiColor4fNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4fNormal3fVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiColor4fNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4fNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiColor4ubVertex3fSUN = (PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4ubVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiColor4ubVertex3fvSUN = (PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4ubVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiNormal3fVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiTexCoord2fVertex3fSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiTexCoord2fVertex3fvSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiVertex3fSUN = (PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiVertex3fvSUN = (PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiVertex3fvSUN")) == NULL) || r; + r = ((glTexCoord2fColor3fVertex3fSUN = (PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor3fVertex3fSUN")) == NULL) || r; + r = ((glTexCoord2fColor3fVertex3fvSUN = (PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor3fVertex3fvSUN")) == NULL) || r; + r = ((glTexCoord2fColor4fNormal3fVertex3fSUN = (PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4fNormal3fVertex3fSUN")) == NULL) || r; + r = ((glTexCoord2fColor4fNormal3fVertex3fvSUN = (PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4fNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glTexCoord2fColor4ubVertex3fSUN = (PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4ubVertex3fSUN")) == NULL) || r; + r = ((glTexCoord2fColor4ubVertex3fvSUN = (PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4ubVertex3fvSUN")) == NULL) || r; + r = ((glTexCoord2fNormal3fVertex3fSUN = (PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fNormal3fVertex3fSUN")) == NULL) || r; + r = ((glTexCoord2fNormal3fVertex3fvSUN = (PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glTexCoord2fVertex3fSUN = (PFNGLTEXCOORD2FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fVertex3fSUN")) == NULL) || r; + r = ((glTexCoord2fVertex3fvSUN = (PFNGLTEXCOORD2FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fVertex3fvSUN")) == NULL) || r; + r = ((glTexCoord4fColor4fNormal3fVertex4fSUN = (PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fColor4fNormal3fVertex4fSUN")) == NULL) || r; + r = ((glTexCoord4fColor4fNormal3fVertex4fvSUN = (PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fColor4fNormal3fVertex4fvSUN")) == NULL) || r; + r = ((glTexCoord4fVertex4fSUN = (PFNGLTEXCOORD4FVERTEX4FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fVertex4fSUN")) == NULL) || r; + r = ((glTexCoord4fVertex4fvSUN = (PFNGLTEXCOORD4FVERTEX4FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fVertex4fvSUN")) == NULL) || r; + + return r; +} + +#endif /* GL_SUN_vertex */ + +#ifdef GL_WIN_swap_hint + +static GLboolean _glewInit_GL_WIN_swap_hint (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAddSwapHintRectWIN = (PFNGLADDSWAPHINTRECTWINPROC)glewGetProcAddress((const GLubyte*)"glAddSwapHintRectWIN")) == NULL) || r; + + return r; +} + +#endif /* GL_WIN_swap_hint */ + +/* ------------------------------------------------------------------------- */ + +GLboolean GLEWAPIENTRY glewGetExtension (const char* name) +{ + const GLubyte* start; + const GLubyte* end; + start = (const GLubyte*)glGetString(GL_EXTENSIONS); + if (start == 0) + return GL_FALSE; + end = start + _glewStrLen(start); + return _glewSearchExtension(name, start, end); +} + +/* ------------------------------------------------------------------------- */ + +#ifndef GLEW_MX +static +#endif +GLenum GLEWAPIENTRY glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST) +{ + const GLubyte* s; + GLuint dot; + GLint major, minor; + const GLubyte* extStart; + const GLubyte* extEnd; + /* query opengl version */ + s = glGetString(GL_VERSION); + dot = _glewStrCLen(s, '.'); + if (dot == 0) + return GLEW_ERROR_NO_GL_VERSION; + + major = s[dot-1]-'0'; + minor = s[dot+1]-'0'; + + if (minor < 0 || minor > 9) + minor = 0; + if (major<0 || major>9) + return GLEW_ERROR_NO_GL_VERSION; + + + if (major == 1 && minor == 0) + { + return GLEW_ERROR_GL_VERSION_10_ONLY; + } + else + { + GLEW_VERSION_4_5 = ( major > 4 ) || ( major == 4 && minor >= 5 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_4_4 = GLEW_VERSION_4_5 == GL_TRUE || ( major == 4 && minor >= 4 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_4_3 = GLEW_VERSION_4_4 == GL_TRUE || ( major == 4 && minor >= 3 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_4_2 = GLEW_VERSION_4_3 == GL_TRUE || ( major == 4 && minor >= 2 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_4_1 = GLEW_VERSION_4_2 == GL_TRUE || ( major == 4 && minor >= 1 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_4_0 = GLEW_VERSION_4_1 == GL_TRUE || ( major == 4 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_3_3 = GLEW_VERSION_4_0 == GL_TRUE || ( major == 3 && minor >= 3 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_3_2 = GLEW_VERSION_3_3 == GL_TRUE || ( major == 3 && minor >= 2 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_3_1 = GLEW_VERSION_3_2 == GL_TRUE || ( major == 3 && minor >= 1 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_3_0 = GLEW_VERSION_3_1 == GL_TRUE || ( major == 3 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_2_1 = GLEW_VERSION_3_0 == GL_TRUE || ( major == 2 && minor >= 1 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_2_0 = GLEW_VERSION_2_1 == GL_TRUE || ( major == 2 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_1_5 = GLEW_VERSION_2_0 == GL_TRUE || ( major == 1 && minor >= 5 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_1_4 = GLEW_VERSION_1_5 == GL_TRUE || ( major == 1 && minor >= 4 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_1_3 = GLEW_VERSION_1_4 == GL_TRUE || ( major == 1 && minor >= 3 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_1_2_1 = GLEW_VERSION_1_3 == GL_TRUE ? GL_TRUE : GL_FALSE; + GLEW_VERSION_1_2 = GLEW_VERSION_1_2_1 == GL_TRUE || ( major == 1 && minor >= 2 ) ? GL_TRUE : GL_FALSE; + GLEW_VERSION_1_1 = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE; + } + + /* query opengl extensions string */ + extStart = glGetString(GL_EXTENSIONS); + if (extStart == 0) + extStart = (const GLubyte*)""; + extEnd = extStart + _glewStrLen(extStart); + + /* initialize extensions */ +#ifdef GL_VERSION_1_2 + if (glewExperimental || GLEW_VERSION_1_2) GLEW_VERSION_1_2 = !_glewInit_GL_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_1_2 */ +#ifdef GL_VERSION_1_2_1 +#endif /* GL_VERSION_1_2_1 */ +#ifdef GL_VERSION_1_3 + if (glewExperimental || GLEW_VERSION_1_3) GLEW_VERSION_1_3 = !_glewInit_GL_VERSION_1_3(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_1_3 */ +#ifdef GL_VERSION_1_4 + if (glewExperimental || GLEW_VERSION_1_4) GLEW_VERSION_1_4 = !_glewInit_GL_VERSION_1_4(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_1_4 */ +#ifdef GL_VERSION_1_5 + if (glewExperimental || GLEW_VERSION_1_5) GLEW_VERSION_1_5 = !_glewInit_GL_VERSION_1_5(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_1_5 */ +#ifdef GL_VERSION_2_0 + if (glewExperimental || GLEW_VERSION_2_0) GLEW_VERSION_2_0 = !_glewInit_GL_VERSION_2_0(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_2_0 */ +#ifdef GL_VERSION_2_1 + if (glewExperimental || GLEW_VERSION_2_1) GLEW_VERSION_2_1 = !_glewInit_GL_VERSION_2_1(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_2_1 */ +#ifdef GL_VERSION_3_0 + if (glewExperimental || GLEW_VERSION_3_0) GLEW_VERSION_3_0 = !_glewInit_GL_VERSION_3_0(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_3_0 */ +#ifdef GL_VERSION_3_1 + if (glewExperimental || GLEW_VERSION_3_1) GLEW_VERSION_3_1 = !_glewInit_GL_VERSION_3_1(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_3_1 */ +#ifdef GL_VERSION_3_2 + if (glewExperimental || GLEW_VERSION_3_2) GLEW_VERSION_3_2 = !_glewInit_GL_VERSION_3_2(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_3_2 */ +#ifdef GL_VERSION_3_3 + if (glewExperimental || GLEW_VERSION_3_3) GLEW_VERSION_3_3 = !_glewInit_GL_VERSION_3_3(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_3_3 */ +#ifdef GL_VERSION_4_0 + if (glewExperimental || GLEW_VERSION_4_0) GLEW_VERSION_4_0 = !_glewInit_GL_VERSION_4_0(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_4_0 */ +#ifdef GL_VERSION_4_1 +#endif /* GL_VERSION_4_1 */ +#ifdef GL_VERSION_4_2 +#endif /* GL_VERSION_4_2 */ +#ifdef GL_VERSION_4_3 +#endif /* GL_VERSION_4_3 */ +#ifdef GL_VERSION_4_4 +#endif /* GL_VERSION_4_4 */ +#ifdef GL_VERSION_4_5 + if (glewExperimental || GLEW_VERSION_4_5) GLEW_VERSION_4_5 = !_glewInit_GL_VERSION_4_5(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_4_5 */ +#ifdef GL_3DFX_multisample + GLEW_3DFX_multisample = _glewSearchExtension("GL_3DFX_multisample", extStart, extEnd); +#endif /* GL_3DFX_multisample */ +#ifdef GL_3DFX_tbuffer + GLEW_3DFX_tbuffer = _glewSearchExtension("GL_3DFX_tbuffer", extStart, extEnd); + if (glewExperimental || GLEW_3DFX_tbuffer) GLEW_3DFX_tbuffer = !_glewInit_GL_3DFX_tbuffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_3DFX_tbuffer */ +#ifdef GL_3DFX_texture_compression_FXT1 + GLEW_3DFX_texture_compression_FXT1 = _glewSearchExtension("GL_3DFX_texture_compression_FXT1", extStart, extEnd); +#endif /* GL_3DFX_texture_compression_FXT1 */ +#ifdef GL_AMD_blend_minmax_factor + GLEW_AMD_blend_minmax_factor = _glewSearchExtension("GL_AMD_blend_minmax_factor", extStart, extEnd); +#endif /* GL_AMD_blend_minmax_factor */ +#ifdef GL_AMD_conservative_depth + GLEW_AMD_conservative_depth = _glewSearchExtension("GL_AMD_conservative_depth", extStart, extEnd); +#endif /* GL_AMD_conservative_depth */ +#ifdef GL_AMD_debug_output + GLEW_AMD_debug_output = _glewSearchExtension("GL_AMD_debug_output", extStart, extEnd); + if (glewExperimental || GLEW_AMD_debug_output) GLEW_AMD_debug_output = !_glewInit_GL_AMD_debug_output(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_AMD_debug_output */ +#ifdef GL_AMD_depth_clamp_separate + GLEW_AMD_depth_clamp_separate = _glewSearchExtension("GL_AMD_depth_clamp_separate", extStart, extEnd); +#endif /* GL_AMD_depth_clamp_separate */ +#ifdef GL_AMD_draw_buffers_blend + GLEW_AMD_draw_buffers_blend = _glewSearchExtension("GL_AMD_draw_buffers_blend", extStart, extEnd); + if (glewExperimental || GLEW_AMD_draw_buffers_blend) GLEW_AMD_draw_buffers_blend = !_glewInit_GL_AMD_draw_buffers_blend(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_AMD_draw_buffers_blend */ +#ifdef GL_AMD_gcn_shader + GLEW_AMD_gcn_shader = _glewSearchExtension("GL_AMD_gcn_shader", extStart, extEnd); +#endif /* GL_AMD_gcn_shader */ +#ifdef GL_AMD_gpu_shader_int64 + GLEW_AMD_gpu_shader_int64 = _glewSearchExtension("GL_AMD_gpu_shader_int64", extStart, extEnd); +#endif /* GL_AMD_gpu_shader_int64 */ +#ifdef GL_AMD_interleaved_elements + GLEW_AMD_interleaved_elements = _glewSearchExtension("GL_AMD_interleaved_elements", extStart, extEnd); + if (glewExperimental || GLEW_AMD_interleaved_elements) GLEW_AMD_interleaved_elements = !_glewInit_GL_AMD_interleaved_elements(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_AMD_interleaved_elements */ +#ifdef GL_AMD_multi_draw_indirect + GLEW_AMD_multi_draw_indirect = _glewSearchExtension("GL_AMD_multi_draw_indirect", extStart, extEnd); + if (glewExperimental || GLEW_AMD_multi_draw_indirect) GLEW_AMD_multi_draw_indirect = !_glewInit_GL_AMD_multi_draw_indirect(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_AMD_multi_draw_indirect */ +#ifdef GL_AMD_name_gen_delete + GLEW_AMD_name_gen_delete = _glewSearchExtension("GL_AMD_name_gen_delete", extStart, extEnd); + if (glewExperimental || GLEW_AMD_name_gen_delete) GLEW_AMD_name_gen_delete = !_glewInit_GL_AMD_name_gen_delete(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_AMD_name_gen_delete */ +#ifdef GL_AMD_occlusion_query_event + GLEW_AMD_occlusion_query_event = _glewSearchExtension("GL_AMD_occlusion_query_event", extStart, extEnd); + if (glewExperimental || GLEW_AMD_occlusion_query_event) GLEW_AMD_occlusion_query_event = !_glewInit_GL_AMD_occlusion_query_event(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_AMD_occlusion_query_event */ +#ifdef GL_AMD_performance_monitor + GLEW_AMD_performance_monitor = _glewSearchExtension("GL_AMD_performance_monitor", extStart, extEnd); + if (glewExperimental || GLEW_AMD_performance_monitor) GLEW_AMD_performance_monitor = !_glewInit_GL_AMD_performance_monitor(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_AMD_performance_monitor */ +#ifdef GL_AMD_pinned_memory + GLEW_AMD_pinned_memory = _glewSearchExtension("GL_AMD_pinned_memory", extStart, extEnd); +#endif /* GL_AMD_pinned_memory */ +#ifdef GL_AMD_query_buffer_object + GLEW_AMD_query_buffer_object = _glewSearchExtension("GL_AMD_query_buffer_object", extStart, extEnd); +#endif /* GL_AMD_query_buffer_object */ +#ifdef GL_AMD_sample_positions + GLEW_AMD_sample_positions = _glewSearchExtension("GL_AMD_sample_positions", extStart, extEnd); + if (glewExperimental || GLEW_AMD_sample_positions) GLEW_AMD_sample_positions = !_glewInit_GL_AMD_sample_positions(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_AMD_sample_positions */ +#ifdef GL_AMD_seamless_cubemap_per_texture + GLEW_AMD_seamless_cubemap_per_texture = _glewSearchExtension("GL_AMD_seamless_cubemap_per_texture", extStart, extEnd); +#endif /* GL_AMD_seamless_cubemap_per_texture */ +#ifdef GL_AMD_shader_atomic_counter_ops + GLEW_AMD_shader_atomic_counter_ops = _glewSearchExtension("GL_AMD_shader_atomic_counter_ops", extStart, extEnd); +#endif /* GL_AMD_shader_atomic_counter_ops */ +#ifdef GL_AMD_shader_stencil_export + GLEW_AMD_shader_stencil_export = _glewSearchExtension("GL_AMD_shader_stencil_export", extStart, extEnd); +#endif /* GL_AMD_shader_stencil_export */ +#ifdef GL_AMD_shader_stencil_value_export + GLEW_AMD_shader_stencil_value_export = _glewSearchExtension("GL_AMD_shader_stencil_value_export", extStart, extEnd); +#endif /* GL_AMD_shader_stencil_value_export */ +#ifdef GL_AMD_shader_trinary_minmax + GLEW_AMD_shader_trinary_minmax = _glewSearchExtension("GL_AMD_shader_trinary_minmax", extStart, extEnd); +#endif /* GL_AMD_shader_trinary_minmax */ +#ifdef GL_AMD_sparse_texture + GLEW_AMD_sparse_texture = _glewSearchExtension("GL_AMD_sparse_texture", extStart, extEnd); + if (glewExperimental || GLEW_AMD_sparse_texture) GLEW_AMD_sparse_texture = !_glewInit_GL_AMD_sparse_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_AMD_sparse_texture */ +#ifdef GL_AMD_stencil_operation_extended + GLEW_AMD_stencil_operation_extended = _glewSearchExtension("GL_AMD_stencil_operation_extended", extStart, extEnd); + if (glewExperimental || GLEW_AMD_stencil_operation_extended) GLEW_AMD_stencil_operation_extended = !_glewInit_GL_AMD_stencil_operation_extended(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_AMD_stencil_operation_extended */ +#ifdef GL_AMD_texture_texture4 + GLEW_AMD_texture_texture4 = _glewSearchExtension("GL_AMD_texture_texture4", extStart, extEnd); +#endif /* GL_AMD_texture_texture4 */ +#ifdef GL_AMD_transform_feedback3_lines_triangles + GLEW_AMD_transform_feedback3_lines_triangles = _glewSearchExtension("GL_AMD_transform_feedback3_lines_triangles", extStart, extEnd); +#endif /* GL_AMD_transform_feedback3_lines_triangles */ +#ifdef GL_AMD_transform_feedback4 + GLEW_AMD_transform_feedback4 = _glewSearchExtension("GL_AMD_transform_feedback4", extStart, extEnd); +#endif /* GL_AMD_transform_feedback4 */ +#ifdef GL_AMD_vertex_shader_layer + GLEW_AMD_vertex_shader_layer = _glewSearchExtension("GL_AMD_vertex_shader_layer", extStart, extEnd); +#endif /* GL_AMD_vertex_shader_layer */ +#ifdef GL_AMD_vertex_shader_tessellator + GLEW_AMD_vertex_shader_tessellator = _glewSearchExtension("GL_AMD_vertex_shader_tessellator", extStart, extEnd); + if (glewExperimental || GLEW_AMD_vertex_shader_tessellator) GLEW_AMD_vertex_shader_tessellator = !_glewInit_GL_AMD_vertex_shader_tessellator(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_AMD_vertex_shader_tessellator */ +#ifdef GL_AMD_vertex_shader_viewport_index + GLEW_AMD_vertex_shader_viewport_index = _glewSearchExtension("GL_AMD_vertex_shader_viewport_index", extStart, extEnd); +#endif /* GL_AMD_vertex_shader_viewport_index */ +#ifdef GL_ANGLE_depth_texture + GLEW_ANGLE_depth_texture = _glewSearchExtension("GL_ANGLE_depth_texture", extStart, extEnd); +#endif /* GL_ANGLE_depth_texture */ +#ifdef GL_ANGLE_framebuffer_blit + GLEW_ANGLE_framebuffer_blit = _glewSearchExtension("GL_ANGLE_framebuffer_blit", extStart, extEnd); + if (glewExperimental || GLEW_ANGLE_framebuffer_blit) GLEW_ANGLE_framebuffer_blit = !_glewInit_GL_ANGLE_framebuffer_blit(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ANGLE_framebuffer_blit */ +#ifdef GL_ANGLE_framebuffer_multisample + GLEW_ANGLE_framebuffer_multisample = _glewSearchExtension("GL_ANGLE_framebuffer_multisample", extStart, extEnd); + if (glewExperimental || GLEW_ANGLE_framebuffer_multisample) GLEW_ANGLE_framebuffer_multisample = !_glewInit_GL_ANGLE_framebuffer_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ANGLE_framebuffer_multisample */ +#ifdef GL_ANGLE_instanced_arrays + GLEW_ANGLE_instanced_arrays = _glewSearchExtension("GL_ANGLE_instanced_arrays", extStart, extEnd); + if (glewExperimental || GLEW_ANGLE_instanced_arrays) GLEW_ANGLE_instanced_arrays = !_glewInit_GL_ANGLE_instanced_arrays(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ANGLE_instanced_arrays */ +#ifdef GL_ANGLE_pack_reverse_row_order + GLEW_ANGLE_pack_reverse_row_order = _glewSearchExtension("GL_ANGLE_pack_reverse_row_order", extStart, extEnd); +#endif /* GL_ANGLE_pack_reverse_row_order */ +#ifdef GL_ANGLE_program_binary + GLEW_ANGLE_program_binary = _glewSearchExtension("GL_ANGLE_program_binary", extStart, extEnd); +#endif /* GL_ANGLE_program_binary */ +#ifdef GL_ANGLE_texture_compression_dxt1 + GLEW_ANGLE_texture_compression_dxt1 = _glewSearchExtension("GL_ANGLE_texture_compression_dxt1", extStart, extEnd); +#endif /* GL_ANGLE_texture_compression_dxt1 */ +#ifdef GL_ANGLE_texture_compression_dxt3 + GLEW_ANGLE_texture_compression_dxt3 = _glewSearchExtension("GL_ANGLE_texture_compression_dxt3", extStart, extEnd); +#endif /* GL_ANGLE_texture_compression_dxt3 */ +#ifdef GL_ANGLE_texture_compression_dxt5 + GLEW_ANGLE_texture_compression_dxt5 = _glewSearchExtension("GL_ANGLE_texture_compression_dxt5", extStart, extEnd); +#endif /* GL_ANGLE_texture_compression_dxt5 */ +#ifdef GL_ANGLE_texture_usage + GLEW_ANGLE_texture_usage = _glewSearchExtension("GL_ANGLE_texture_usage", extStart, extEnd); +#endif /* GL_ANGLE_texture_usage */ +#ifdef GL_ANGLE_timer_query + GLEW_ANGLE_timer_query = _glewSearchExtension("GL_ANGLE_timer_query", extStart, extEnd); + if (glewExperimental || GLEW_ANGLE_timer_query) GLEW_ANGLE_timer_query = !_glewInit_GL_ANGLE_timer_query(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ANGLE_timer_query */ +#ifdef GL_ANGLE_translated_shader_source + GLEW_ANGLE_translated_shader_source = _glewSearchExtension("GL_ANGLE_translated_shader_source", extStart, extEnd); + if (glewExperimental || GLEW_ANGLE_translated_shader_source) GLEW_ANGLE_translated_shader_source = !_glewInit_GL_ANGLE_translated_shader_source(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ANGLE_translated_shader_source */ +#ifdef GL_APPLE_aux_depth_stencil + GLEW_APPLE_aux_depth_stencil = _glewSearchExtension("GL_APPLE_aux_depth_stencil", extStart, extEnd); +#endif /* GL_APPLE_aux_depth_stencil */ +#ifdef GL_APPLE_client_storage + GLEW_APPLE_client_storage = _glewSearchExtension("GL_APPLE_client_storage", extStart, extEnd); +#endif /* GL_APPLE_client_storage */ +#ifdef GL_APPLE_element_array + GLEW_APPLE_element_array = _glewSearchExtension("GL_APPLE_element_array", extStart, extEnd); + if (glewExperimental || GLEW_APPLE_element_array) GLEW_APPLE_element_array = !_glewInit_GL_APPLE_element_array(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_APPLE_element_array */ +#ifdef GL_APPLE_fence + GLEW_APPLE_fence = _glewSearchExtension("GL_APPLE_fence", extStart, extEnd); + if (glewExperimental || GLEW_APPLE_fence) GLEW_APPLE_fence = !_glewInit_GL_APPLE_fence(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_APPLE_fence */ +#ifdef GL_APPLE_float_pixels + GLEW_APPLE_float_pixels = _glewSearchExtension("GL_APPLE_float_pixels", extStart, extEnd); +#endif /* GL_APPLE_float_pixels */ +#ifdef GL_APPLE_flush_buffer_range + GLEW_APPLE_flush_buffer_range = _glewSearchExtension("GL_APPLE_flush_buffer_range", extStart, extEnd); + if (glewExperimental || GLEW_APPLE_flush_buffer_range) GLEW_APPLE_flush_buffer_range = !_glewInit_GL_APPLE_flush_buffer_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_APPLE_flush_buffer_range */ +#ifdef GL_APPLE_object_purgeable + GLEW_APPLE_object_purgeable = _glewSearchExtension("GL_APPLE_object_purgeable", extStart, extEnd); + if (glewExperimental || GLEW_APPLE_object_purgeable) GLEW_APPLE_object_purgeable = !_glewInit_GL_APPLE_object_purgeable(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_APPLE_object_purgeable */ +#ifdef GL_APPLE_pixel_buffer + GLEW_APPLE_pixel_buffer = _glewSearchExtension("GL_APPLE_pixel_buffer", extStart, extEnd); +#endif /* GL_APPLE_pixel_buffer */ +#ifdef GL_APPLE_rgb_422 + GLEW_APPLE_rgb_422 = _glewSearchExtension("GL_APPLE_rgb_422", extStart, extEnd); +#endif /* GL_APPLE_rgb_422 */ +#ifdef GL_APPLE_row_bytes + GLEW_APPLE_row_bytes = _glewSearchExtension("GL_APPLE_row_bytes", extStart, extEnd); +#endif /* GL_APPLE_row_bytes */ +#ifdef GL_APPLE_specular_vector + GLEW_APPLE_specular_vector = _glewSearchExtension("GL_APPLE_specular_vector", extStart, extEnd); +#endif /* GL_APPLE_specular_vector */ +#ifdef GL_APPLE_texture_range + GLEW_APPLE_texture_range = _glewSearchExtension("GL_APPLE_texture_range", extStart, extEnd); + if (glewExperimental || GLEW_APPLE_texture_range) GLEW_APPLE_texture_range = !_glewInit_GL_APPLE_texture_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_APPLE_texture_range */ +#ifdef GL_APPLE_transform_hint + GLEW_APPLE_transform_hint = _glewSearchExtension("GL_APPLE_transform_hint", extStart, extEnd); +#endif /* GL_APPLE_transform_hint */ +#ifdef GL_APPLE_vertex_array_object + GLEW_APPLE_vertex_array_object = _glewSearchExtension("GL_APPLE_vertex_array_object", extStart, extEnd); + if (glewExperimental || GLEW_APPLE_vertex_array_object) GLEW_APPLE_vertex_array_object = !_glewInit_GL_APPLE_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_APPLE_vertex_array_object */ +#ifdef GL_APPLE_vertex_array_range + GLEW_APPLE_vertex_array_range = _glewSearchExtension("GL_APPLE_vertex_array_range", extStart, extEnd); + if (glewExperimental || GLEW_APPLE_vertex_array_range) GLEW_APPLE_vertex_array_range = !_glewInit_GL_APPLE_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_APPLE_vertex_array_range */ +#ifdef GL_APPLE_vertex_program_evaluators + GLEW_APPLE_vertex_program_evaluators = _glewSearchExtension("GL_APPLE_vertex_program_evaluators", extStart, extEnd); + if (glewExperimental || GLEW_APPLE_vertex_program_evaluators) GLEW_APPLE_vertex_program_evaluators = !_glewInit_GL_APPLE_vertex_program_evaluators(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_APPLE_vertex_program_evaluators */ +#ifdef GL_APPLE_ycbcr_422 + GLEW_APPLE_ycbcr_422 = _glewSearchExtension("GL_APPLE_ycbcr_422", extStart, extEnd); +#endif /* GL_APPLE_ycbcr_422 */ +#ifdef GL_ARB_ES2_compatibility + GLEW_ARB_ES2_compatibility = _glewSearchExtension("GL_ARB_ES2_compatibility", extStart, extEnd); + if (glewExperimental || GLEW_ARB_ES2_compatibility) GLEW_ARB_ES2_compatibility = !_glewInit_GL_ARB_ES2_compatibility(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_ES2_compatibility */ +#ifdef GL_ARB_ES3_1_compatibility + GLEW_ARB_ES3_1_compatibility = _glewSearchExtension("GL_ARB_ES3_1_compatibility", extStart, extEnd); + if (glewExperimental || GLEW_ARB_ES3_1_compatibility) GLEW_ARB_ES3_1_compatibility = !_glewInit_GL_ARB_ES3_1_compatibility(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_ES3_1_compatibility */ +#ifdef GL_ARB_ES3_2_compatibility + GLEW_ARB_ES3_2_compatibility = _glewSearchExtension("GL_ARB_ES3_2_compatibility", extStart, extEnd); + if (glewExperimental || GLEW_ARB_ES3_2_compatibility) GLEW_ARB_ES3_2_compatibility = !_glewInit_GL_ARB_ES3_2_compatibility(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_ES3_2_compatibility */ +#ifdef GL_ARB_ES3_compatibility + GLEW_ARB_ES3_compatibility = _glewSearchExtension("GL_ARB_ES3_compatibility", extStart, extEnd); +#endif /* GL_ARB_ES3_compatibility */ +#ifdef GL_ARB_arrays_of_arrays + GLEW_ARB_arrays_of_arrays = _glewSearchExtension("GL_ARB_arrays_of_arrays", extStart, extEnd); +#endif /* GL_ARB_arrays_of_arrays */ +#ifdef GL_ARB_base_instance + GLEW_ARB_base_instance = _glewSearchExtension("GL_ARB_base_instance", extStart, extEnd); + if (glewExperimental || GLEW_ARB_base_instance) GLEW_ARB_base_instance = !_glewInit_GL_ARB_base_instance(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_base_instance */ +#ifdef GL_ARB_bindless_texture + GLEW_ARB_bindless_texture = _glewSearchExtension("GL_ARB_bindless_texture", extStart, extEnd); + if (glewExperimental || GLEW_ARB_bindless_texture) GLEW_ARB_bindless_texture = !_glewInit_GL_ARB_bindless_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_bindless_texture */ +#ifdef GL_ARB_blend_func_extended + GLEW_ARB_blend_func_extended = _glewSearchExtension("GL_ARB_blend_func_extended", extStart, extEnd); + if (glewExperimental || GLEW_ARB_blend_func_extended) GLEW_ARB_blend_func_extended = !_glewInit_GL_ARB_blend_func_extended(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_blend_func_extended */ +#ifdef GL_ARB_buffer_storage + GLEW_ARB_buffer_storage = _glewSearchExtension("GL_ARB_buffer_storage", extStart, extEnd); + if (glewExperimental || GLEW_ARB_buffer_storage) GLEW_ARB_buffer_storage = !_glewInit_GL_ARB_buffer_storage(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_buffer_storage */ +#ifdef GL_ARB_cl_event + GLEW_ARB_cl_event = _glewSearchExtension("GL_ARB_cl_event", extStart, extEnd); + if (glewExperimental || GLEW_ARB_cl_event) GLEW_ARB_cl_event = !_glewInit_GL_ARB_cl_event(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_cl_event */ +#ifdef GL_ARB_clear_buffer_object + GLEW_ARB_clear_buffer_object = _glewSearchExtension("GL_ARB_clear_buffer_object", extStart, extEnd); + if (glewExperimental || GLEW_ARB_clear_buffer_object) GLEW_ARB_clear_buffer_object = !_glewInit_GL_ARB_clear_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_clear_buffer_object */ +#ifdef GL_ARB_clear_texture + GLEW_ARB_clear_texture = _glewSearchExtension("GL_ARB_clear_texture", extStart, extEnd); + if (glewExperimental || GLEW_ARB_clear_texture) GLEW_ARB_clear_texture = !_glewInit_GL_ARB_clear_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_clear_texture */ +#ifdef GL_ARB_clip_control + GLEW_ARB_clip_control = _glewSearchExtension("GL_ARB_clip_control", extStart, extEnd); + if (glewExperimental || GLEW_ARB_clip_control) GLEW_ARB_clip_control = !_glewInit_GL_ARB_clip_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_clip_control */ +#ifdef GL_ARB_color_buffer_float + GLEW_ARB_color_buffer_float = _glewSearchExtension("GL_ARB_color_buffer_float", extStart, extEnd); + if (glewExperimental || GLEW_ARB_color_buffer_float) GLEW_ARB_color_buffer_float = !_glewInit_GL_ARB_color_buffer_float(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_color_buffer_float */ +#ifdef GL_ARB_compatibility + GLEW_ARB_compatibility = _glewSearchExtension("GL_ARB_compatibility", extStart, extEnd); +#endif /* GL_ARB_compatibility */ +#ifdef GL_ARB_compressed_texture_pixel_storage + GLEW_ARB_compressed_texture_pixel_storage = _glewSearchExtension("GL_ARB_compressed_texture_pixel_storage", extStart, extEnd); +#endif /* GL_ARB_compressed_texture_pixel_storage */ +#ifdef GL_ARB_compute_shader + GLEW_ARB_compute_shader = _glewSearchExtension("GL_ARB_compute_shader", extStart, extEnd); + if (glewExperimental || GLEW_ARB_compute_shader) GLEW_ARB_compute_shader = !_glewInit_GL_ARB_compute_shader(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_compute_shader */ +#ifdef GL_ARB_compute_variable_group_size + GLEW_ARB_compute_variable_group_size = _glewSearchExtension("GL_ARB_compute_variable_group_size", extStart, extEnd); + if (glewExperimental || GLEW_ARB_compute_variable_group_size) GLEW_ARB_compute_variable_group_size = !_glewInit_GL_ARB_compute_variable_group_size(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_compute_variable_group_size */ +#ifdef GL_ARB_conditional_render_inverted + GLEW_ARB_conditional_render_inverted = _glewSearchExtension("GL_ARB_conditional_render_inverted", extStart, extEnd); +#endif /* GL_ARB_conditional_render_inverted */ +#ifdef GL_ARB_conservative_depth + GLEW_ARB_conservative_depth = _glewSearchExtension("GL_ARB_conservative_depth", extStart, extEnd); +#endif /* GL_ARB_conservative_depth */ +#ifdef GL_ARB_copy_buffer + GLEW_ARB_copy_buffer = _glewSearchExtension("GL_ARB_copy_buffer", extStart, extEnd); + if (glewExperimental || GLEW_ARB_copy_buffer) GLEW_ARB_copy_buffer = !_glewInit_GL_ARB_copy_buffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_copy_buffer */ +#ifdef GL_ARB_copy_image + GLEW_ARB_copy_image = _glewSearchExtension("GL_ARB_copy_image", extStart, extEnd); + if (glewExperimental || GLEW_ARB_copy_image) GLEW_ARB_copy_image = !_glewInit_GL_ARB_copy_image(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_copy_image */ +#ifdef GL_ARB_cull_distance + GLEW_ARB_cull_distance = _glewSearchExtension("GL_ARB_cull_distance", extStart, extEnd); +#endif /* GL_ARB_cull_distance */ +#ifdef GL_ARB_debug_output + GLEW_ARB_debug_output = _glewSearchExtension("GL_ARB_debug_output", extStart, extEnd); + if (glewExperimental || GLEW_ARB_debug_output) GLEW_ARB_debug_output = !_glewInit_GL_ARB_debug_output(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_debug_output */ +#ifdef GL_ARB_depth_buffer_float + GLEW_ARB_depth_buffer_float = _glewSearchExtension("GL_ARB_depth_buffer_float", extStart, extEnd); +#endif /* GL_ARB_depth_buffer_float */ +#ifdef GL_ARB_depth_clamp + GLEW_ARB_depth_clamp = _glewSearchExtension("GL_ARB_depth_clamp", extStart, extEnd); +#endif /* GL_ARB_depth_clamp */ +#ifdef GL_ARB_depth_texture + GLEW_ARB_depth_texture = _glewSearchExtension("GL_ARB_depth_texture", extStart, extEnd); +#endif /* GL_ARB_depth_texture */ +#ifdef GL_ARB_derivative_control + GLEW_ARB_derivative_control = _glewSearchExtension("GL_ARB_derivative_control", extStart, extEnd); +#endif /* GL_ARB_derivative_control */ +#ifdef GL_ARB_direct_state_access + GLEW_ARB_direct_state_access = _glewSearchExtension("GL_ARB_direct_state_access", extStart, extEnd); + if (glewExperimental || GLEW_ARB_direct_state_access) GLEW_ARB_direct_state_access = !_glewInit_GL_ARB_direct_state_access(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_direct_state_access */ +#ifdef GL_ARB_draw_buffers + GLEW_ARB_draw_buffers = _glewSearchExtension("GL_ARB_draw_buffers", extStart, extEnd); + if (glewExperimental || GLEW_ARB_draw_buffers) GLEW_ARB_draw_buffers = !_glewInit_GL_ARB_draw_buffers(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_draw_buffers */ +#ifdef GL_ARB_draw_buffers_blend + GLEW_ARB_draw_buffers_blend = _glewSearchExtension("GL_ARB_draw_buffers_blend", extStart, extEnd); + if (glewExperimental || GLEW_ARB_draw_buffers_blend) GLEW_ARB_draw_buffers_blend = !_glewInit_GL_ARB_draw_buffers_blend(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_draw_buffers_blend */ +#ifdef GL_ARB_draw_elements_base_vertex + GLEW_ARB_draw_elements_base_vertex = _glewSearchExtension("GL_ARB_draw_elements_base_vertex", extStart, extEnd); + if (glewExperimental || GLEW_ARB_draw_elements_base_vertex) GLEW_ARB_draw_elements_base_vertex = !_glewInit_GL_ARB_draw_elements_base_vertex(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_draw_elements_base_vertex */ +#ifdef GL_ARB_draw_indirect + GLEW_ARB_draw_indirect = _glewSearchExtension("GL_ARB_draw_indirect", extStart, extEnd); + if (glewExperimental || GLEW_ARB_draw_indirect) GLEW_ARB_draw_indirect = !_glewInit_GL_ARB_draw_indirect(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_draw_indirect */ +#ifdef GL_ARB_draw_instanced + GLEW_ARB_draw_instanced = _glewSearchExtension("GL_ARB_draw_instanced", extStart, extEnd); +#endif /* GL_ARB_draw_instanced */ +#ifdef GL_ARB_enhanced_layouts + GLEW_ARB_enhanced_layouts = _glewSearchExtension("GL_ARB_enhanced_layouts", extStart, extEnd); +#endif /* GL_ARB_enhanced_layouts */ +#ifdef GL_ARB_explicit_attrib_location + GLEW_ARB_explicit_attrib_location = _glewSearchExtension("GL_ARB_explicit_attrib_location", extStart, extEnd); +#endif /* GL_ARB_explicit_attrib_location */ +#ifdef GL_ARB_explicit_uniform_location + GLEW_ARB_explicit_uniform_location = _glewSearchExtension("GL_ARB_explicit_uniform_location", extStart, extEnd); +#endif /* GL_ARB_explicit_uniform_location */ +#ifdef GL_ARB_fragment_coord_conventions + GLEW_ARB_fragment_coord_conventions = _glewSearchExtension("GL_ARB_fragment_coord_conventions", extStart, extEnd); +#endif /* GL_ARB_fragment_coord_conventions */ +#ifdef GL_ARB_fragment_layer_viewport + GLEW_ARB_fragment_layer_viewport = _glewSearchExtension("GL_ARB_fragment_layer_viewport", extStart, extEnd); +#endif /* GL_ARB_fragment_layer_viewport */ +#ifdef GL_ARB_fragment_program + GLEW_ARB_fragment_program = _glewSearchExtension("GL_ARB_fragment_program", extStart, extEnd); +#endif /* GL_ARB_fragment_program */ +#ifdef GL_ARB_fragment_program_shadow + GLEW_ARB_fragment_program_shadow = _glewSearchExtension("GL_ARB_fragment_program_shadow", extStart, extEnd); +#endif /* GL_ARB_fragment_program_shadow */ +#ifdef GL_ARB_fragment_shader + GLEW_ARB_fragment_shader = _glewSearchExtension("GL_ARB_fragment_shader", extStart, extEnd); +#endif /* GL_ARB_fragment_shader */ +#ifdef GL_ARB_fragment_shader_interlock + GLEW_ARB_fragment_shader_interlock = _glewSearchExtension("GL_ARB_fragment_shader_interlock", extStart, extEnd); +#endif /* GL_ARB_fragment_shader_interlock */ +#ifdef GL_ARB_framebuffer_no_attachments + GLEW_ARB_framebuffer_no_attachments = _glewSearchExtension("GL_ARB_framebuffer_no_attachments", extStart, extEnd); + if (glewExperimental || GLEW_ARB_framebuffer_no_attachments) GLEW_ARB_framebuffer_no_attachments = !_glewInit_GL_ARB_framebuffer_no_attachments(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_framebuffer_no_attachments */ +#ifdef GL_ARB_framebuffer_object + GLEW_ARB_framebuffer_object = _glewSearchExtension("GL_ARB_framebuffer_object", extStart, extEnd); + if (glewExperimental || GLEW_ARB_framebuffer_object) GLEW_ARB_framebuffer_object = !_glewInit_GL_ARB_framebuffer_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_framebuffer_object */ +#ifdef GL_ARB_framebuffer_sRGB + GLEW_ARB_framebuffer_sRGB = _glewSearchExtension("GL_ARB_framebuffer_sRGB", extStart, extEnd); +#endif /* GL_ARB_framebuffer_sRGB */ +#ifdef GL_ARB_geometry_shader4 + GLEW_ARB_geometry_shader4 = _glewSearchExtension("GL_ARB_geometry_shader4", extStart, extEnd); + if (glewExperimental || GLEW_ARB_geometry_shader4) GLEW_ARB_geometry_shader4 = !_glewInit_GL_ARB_geometry_shader4(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_geometry_shader4 */ +#ifdef GL_ARB_get_program_binary + GLEW_ARB_get_program_binary = _glewSearchExtension("GL_ARB_get_program_binary", extStart, extEnd); + if (glewExperimental || GLEW_ARB_get_program_binary) GLEW_ARB_get_program_binary = !_glewInit_GL_ARB_get_program_binary(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_get_program_binary */ +#ifdef GL_ARB_get_texture_sub_image + GLEW_ARB_get_texture_sub_image = _glewSearchExtension("GL_ARB_get_texture_sub_image", extStart, extEnd); + if (glewExperimental || GLEW_ARB_get_texture_sub_image) GLEW_ARB_get_texture_sub_image = !_glewInit_GL_ARB_get_texture_sub_image(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_get_texture_sub_image */ +#ifdef GL_ARB_gpu_shader5 + GLEW_ARB_gpu_shader5 = _glewSearchExtension("GL_ARB_gpu_shader5", extStart, extEnd); +#endif /* GL_ARB_gpu_shader5 */ +#ifdef GL_ARB_gpu_shader_fp64 + GLEW_ARB_gpu_shader_fp64 = _glewSearchExtension("GL_ARB_gpu_shader_fp64", extStart, extEnd); + if (glewExperimental || GLEW_ARB_gpu_shader_fp64) GLEW_ARB_gpu_shader_fp64 = !_glewInit_GL_ARB_gpu_shader_fp64(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_gpu_shader_fp64 */ +#ifdef GL_ARB_gpu_shader_int64 + GLEW_ARB_gpu_shader_int64 = _glewSearchExtension("GL_ARB_gpu_shader_int64", extStart, extEnd); + if (glewExperimental || GLEW_ARB_gpu_shader_int64) GLEW_ARB_gpu_shader_int64 = !_glewInit_GL_ARB_gpu_shader_int64(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_gpu_shader_int64 */ +#ifdef GL_ARB_half_float_pixel + GLEW_ARB_half_float_pixel = _glewSearchExtension("GL_ARB_half_float_pixel", extStart, extEnd); +#endif /* GL_ARB_half_float_pixel */ +#ifdef GL_ARB_half_float_vertex + GLEW_ARB_half_float_vertex = _glewSearchExtension("GL_ARB_half_float_vertex", extStart, extEnd); +#endif /* GL_ARB_half_float_vertex */ +#ifdef GL_ARB_imaging + GLEW_ARB_imaging = _glewSearchExtension("GL_ARB_imaging", extStart, extEnd); + if (glewExperimental || GLEW_ARB_imaging) GLEW_ARB_imaging = !_glewInit_GL_ARB_imaging(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_imaging */ +#ifdef GL_ARB_indirect_parameters + GLEW_ARB_indirect_parameters = _glewSearchExtension("GL_ARB_indirect_parameters", extStart, extEnd); + if (glewExperimental || GLEW_ARB_indirect_parameters) GLEW_ARB_indirect_parameters = !_glewInit_GL_ARB_indirect_parameters(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_indirect_parameters */ +#ifdef GL_ARB_instanced_arrays + GLEW_ARB_instanced_arrays = _glewSearchExtension("GL_ARB_instanced_arrays", extStart, extEnd); + if (glewExperimental || GLEW_ARB_instanced_arrays) GLEW_ARB_instanced_arrays = !_glewInit_GL_ARB_instanced_arrays(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_instanced_arrays */ +#ifdef GL_ARB_internalformat_query + GLEW_ARB_internalformat_query = _glewSearchExtension("GL_ARB_internalformat_query", extStart, extEnd); + if (glewExperimental || GLEW_ARB_internalformat_query) GLEW_ARB_internalformat_query = !_glewInit_GL_ARB_internalformat_query(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_internalformat_query */ +#ifdef GL_ARB_internalformat_query2 + GLEW_ARB_internalformat_query2 = _glewSearchExtension("GL_ARB_internalformat_query2", extStart, extEnd); + if (glewExperimental || GLEW_ARB_internalformat_query2) GLEW_ARB_internalformat_query2 = !_glewInit_GL_ARB_internalformat_query2(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_internalformat_query2 */ +#ifdef GL_ARB_invalidate_subdata + GLEW_ARB_invalidate_subdata = _glewSearchExtension("GL_ARB_invalidate_subdata", extStart, extEnd); + if (glewExperimental || GLEW_ARB_invalidate_subdata) GLEW_ARB_invalidate_subdata = !_glewInit_GL_ARB_invalidate_subdata(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_invalidate_subdata */ +#ifdef GL_ARB_map_buffer_alignment + GLEW_ARB_map_buffer_alignment = _glewSearchExtension("GL_ARB_map_buffer_alignment", extStart, extEnd); +#endif /* GL_ARB_map_buffer_alignment */ +#ifdef GL_ARB_map_buffer_range + GLEW_ARB_map_buffer_range = _glewSearchExtension("GL_ARB_map_buffer_range", extStart, extEnd); + if (glewExperimental || GLEW_ARB_map_buffer_range) GLEW_ARB_map_buffer_range = !_glewInit_GL_ARB_map_buffer_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_map_buffer_range */ +#ifdef GL_ARB_matrix_palette + GLEW_ARB_matrix_palette = _glewSearchExtension("GL_ARB_matrix_palette", extStart, extEnd); + if (glewExperimental || GLEW_ARB_matrix_palette) GLEW_ARB_matrix_palette = !_glewInit_GL_ARB_matrix_palette(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_matrix_palette */ +#ifdef GL_ARB_multi_bind + GLEW_ARB_multi_bind = _glewSearchExtension("GL_ARB_multi_bind", extStart, extEnd); + if (glewExperimental || GLEW_ARB_multi_bind) GLEW_ARB_multi_bind = !_glewInit_GL_ARB_multi_bind(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_multi_bind */ +#ifdef GL_ARB_multi_draw_indirect + GLEW_ARB_multi_draw_indirect = _glewSearchExtension("GL_ARB_multi_draw_indirect", extStart, extEnd); + if (glewExperimental || GLEW_ARB_multi_draw_indirect) GLEW_ARB_multi_draw_indirect = !_glewInit_GL_ARB_multi_draw_indirect(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_multi_draw_indirect */ +#ifdef GL_ARB_multisample + GLEW_ARB_multisample = _glewSearchExtension("GL_ARB_multisample", extStart, extEnd); + if (glewExperimental || GLEW_ARB_multisample) GLEW_ARB_multisample = !_glewInit_GL_ARB_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_multisample */ +#ifdef GL_ARB_multitexture + GLEW_ARB_multitexture = _glewSearchExtension("GL_ARB_multitexture", extStart, extEnd); + if (glewExperimental || GLEW_ARB_multitexture) GLEW_ARB_multitexture = !_glewInit_GL_ARB_multitexture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_multitexture */ +#ifdef GL_ARB_occlusion_query + GLEW_ARB_occlusion_query = _glewSearchExtension("GL_ARB_occlusion_query", extStart, extEnd); + if (glewExperimental || GLEW_ARB_occlusion_query) GLEW_ARB_occlusion_query = !_glewInit_GL_ARB_occlusion_query(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_occlusion_query */ +#ifdef GL_ARB_occlusion_query2 + GLEW_ARB_occlusion_query2 = _glewSearchExtension("GL_ARB_occlusion_query2", extStart, extEnd); +#endif /* GL_ARB_occlusion_query2 */ +#ifdef GL_ARB_parallel_shader_compile + GLEW_ARB_parallel_shader_compile = _glewSearchExtension("GL_ARB_parallel_shader_compile", extStart, extEnd); + if (glewExperimental || GLEW_ARB_parallel_shader_compile) GLEW_ARB_parallel_shader_compile = !_glewInit_GL_ARB_parallel_shader_compile(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_parallel_shader_compile */ +#ifdef GL_ARB_pipeline_statistics_query + GLEW_ARB_pipeline_statistics_query = _glewSearchExtension("GL_ARB_pipeline_statistics_query", extStart, extEnd); +#endif /* GL_ARB_pipeline_statistics_query */ +#ifdef GL_ARB_pixel_buffer_object + GLEW_ARB_pixel_buffer_object = _glewSearchExtension("GL_ARB_pixel_buffer_object", extStart, extEnd); +#endif /* GL_ARB_pixel_buffer_object */ +#ifdef GL_ARB_point_parameters + GLEW_ARB_point_parameters = _glewSearchExtension("GL_ARB_point_parameters", extStart, extEnd); + if (glewExperimental || GLEW_ARB_point_parameters) GLEW_ARB_point_parameters = !_glewInit_GL_ARB_point_parameters(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_point_parameters */ +#ifdef GL_ARB_point_sprite + GLEW_ARB_point_sprite = _glewSearchExtension("GL_ARB_point_sprite", extStart, extEnd); +#endif /* GL_ARB_point_sprite */ +#ifdef GL_ARB_post_depth_coverage + GLEW_ARB_post_depth_coverage = _glewSearchExtension("GL_ARB_post_depth_coverage", extStart, extEnd); +#endif /* GL_ARB_post_depth_coverage */ +#ifdef GL_ARB_program_interface_query + GLEW_ARB_program_interface_query = _glewSearchExtension("GL_ARB_program_interface_query", extStart, extEnd); + if (glewExperimental || GLEW_ARB_program_interface_query) GLEW_ARB_program_interface_query = !_glewInit_GL_ARB_program_interface_query(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_program_interface_query */ +#ifdef GL_ARB_provoking_vertex + GLEW_ARB_provoking_vertex = _glewSearchExtension("GL_ARB_provoking_vertex", extStart, extEnd); + if (glewExperimental || GLEW_ARB_provoking_vertex) GLEW_ARB_provoking_vertex = !_glewInit_GL_ARB_provoking_vertex(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_provoking_vertex */ +#ifdef GL_ARB_query_buffer_object + GLEW_ARB_query_buffer_object = _glewSearchExtension("GL_ARB_query_buffer_object", extStart, extEnd); +#endif /* GL_ARB_query_buffer_object */ +#ifdef GL_ARB_robust_buffer_access_behavior + GLEW_ARB_robust_buffer_access_behavior = _glewSearchExtension("GL_ARB_robust_buffer_access_behavior", extStart, extEnd); +#endif /* GL_ARB_robust_buffer_access_behavior */ +#ifdef GL_ARB_robustness + GLEW_ARB_robustness = _glewSearchExtension("GL_ARB_robustness", extStart, extEnd); + if (glewExperimental || GLEW_ARB_robustness) GLEW_ARB_robustness = !_glewInit_GL_ARB_robustness(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_robustness */ +#ifdef GL_ARB_robustness_application_isolation + GLEW_ARB_robustness_application_isolation = _glewSearchExtension("GL_ARB_robustness_application_isolation", extStart, extEnd); +#endif /* GL_ARB_robustness_application_isolation */ +#ifdef GL_ARB_robustness_share_group_isolation + GLEW_ARB_robustness_share_group_isolation = _glewSearchExtension("GL_ARB_robustness_share_group_isolation", extStart, extEnd); +#endif /* GL_ARB_robustness_share_group_isolation */ +#ifdef GL_ARB_sample_locations + GLEW_ARB_sample_locations = _glewSearchExtension("GL_ARB_sample_locations", extStart, extEnd); + if (glewExperimental || GLEW_ARB_sample_locations) GLEW_ARB_sample_locations = !_glewInit_GL_ARB_sample_locations(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_sample_locations */ +#ifdef GL_ARB_sample_shading + GLEW_ARB_sample_shading = _glewSearchExtension("GL_ARB_sample_shading", extStart, extEnd); + if (glewExperimental || GLEW_ARB_sample_shading) GLEW_ARB_sample_shading = !_glewInit_GL_ARB_sample_shading(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_sample_shading */ +#ifdef GL_ARB_sampler_objects + GLEW_ARB_sampler_objects = _glewSearchExtension("GL_ARB_sampler_objects", extStart, extEnd); + if (glewExperimental || GLEW_ARB_sampler_objects) GLEW_ARB_sampler_objects = !_glewInit_GL_ARB_sampler_objects(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_sampler_objects */ +#ifdef GL_ARB_seamless_cube_map + GLEW_ARB_seamless_cube_map = _glewSearchExtension("GL_ARB_seamless_cube_map", extStart, extEnd); +#endif /* GL_ARB_seamless_cube_map */ +#ifdef GL_ARB_seamless_cubemap_per_texture + GLEW_ARB_seamless_cubemap_per_texture = _glewSearchExtension("GL_ARB_seamless_cubemap_per_texture", extStart, extEnd); +#endif /* GL_ARB_seamless_cubemap_per_texture */ +#ifdef GL_ARB_separate_shader_objects + GLEW_ARB_separate_shader_objects = _glewSearchExtension("GL_ARB_separate_shader_objects", extStart, extEnd); + if (glewExperimental || GLEW_ARB_separate_shader_objects) GLEW_ARB_separate_shader_objects = !_glewInit_GL_ARB_separate_shader_objects(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_separate_shader_objects */ +#ifdef GL_ARB_shader_atomic_counter_ops + GLEW_ARB_shader_atomic_counter_ops = _glewSearchExtension("GL_ARB_shader_atomic_counter_ops", extStart, extEnd); +#endif /* GL_ARB_shader_atomic_counter_ops */ +#ifdef GL_ARB_shader_atomic_counters + GLEW_ARB_shader_atomic_counters = _glewSearchExtension("GL_ARB_shader_atomic_counters", extStart, extEnd); + if (glewExperimental || GLEW_ARB_shader_atomic_counters) GLEW_ARB_shader_atomic_counters = !_glewInit_GL_ARB_shader_atomic_counters(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_shader_atomic_counters */ +#ifdef GL_ARB_shader_ballot + GLEW_ARB_shader_ballot = _glewSearchExtension("GL_ARB_shader_ballot", extStart, extEnd); +#endif /* GL_ARB_shader_ballot */ +#ifdef GL_ARB_shader_bit_encoding + GLEW_ARB_shader_bit_encoding = _glewSearchExtension("GL_ARB_shader_bit_encoding", extStart, extEnd); +#endif /* GL_ARB_shader_bit_encoding */ +#ifdef GL_ARB_shader_clock + GLEW_ARB_shader_clock = _glewSearchExtension("GL_ARB_shader_clock", extStart, extEnd); +#endif /* GL_ARB_shader_clock */ +#ifdef GL_ARB_shader_draw_parameters + GLEW_ARB_shader_draw_parameters = _glewSearchExtension("GL_ARB_shader_draw_parameters", extStart, extEnd); +#endif /* GL_ARB_shader_draw_parameters */ +#ifdef GL_ARB_shader_group_vote + GLEW_ARB_shader_group_vote = _glewSearchExtension("GL_ARB_shader_group_vote", extStart, extEnd); +#endif /* GL_ARB_shader_group_vote */ +#ifdef GL_ARB_shader_image_load_store + GLEW_ARB_shader_image_load_store = _glewSearchExtension("GL_ARB_shader_image_load_store", extStart, extEnd); + if (glewExperimental || GLEW_ARB_shader_image_load_store) GLEW_ARB_shader_image_load_store = !_glewInit_GL_ARB_shader_image_load_store(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_shader_image_load_store */ +#ifdef GL_ARB_shader_image_size + GLEW_ARB_shader_image_size = _glewSearchExtension("GL_ARB_shader_image_size", extStart, extEnd); +#endif /* GL_ARB_shader_image_size */ +#ifdef GL_ARB_shader_objects + GLEW_ARB_shader_objects = _glewSearchExtension("GL_ARB_shader_objects", extStart, extEnd); + if (glewExperimental || GLEW_ARB_shader_objects) GLEW_ARB_shader_objects = !_glewInit_GL_ARB_shader_objects(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_shader_objects */ +#ifdef GL_ARB_shader_precision + GLEW_ARB_shader_precision = _glewSearchExtension("GL_ARB_shader_precision", extStart, extEnd); +#endif /* GL_ARB_shader_precision */ +#ifdef GL_ARB_shader_stencil_export + GLEW_ARB_shader_stencil_export = _glewSearchExtension("GL_ARB_shader_stencil_export", extStart, extEnd); +#endif /* GL_ARB_shader_stencil_export */ +#ifdef GL_ARB_shader_storage_buffer_object + GLEW_ARB_shader_storage_buffer_object = _glewSearchExtension("GL_ARB_shader_storage_buffer_object", extStart, extEnd); + if (glewExperimental || GLEW_ARB_shader_storage_buffer_object) GLEW_ARB_shader_storage_buffer_object = !_glewInit_GL_ARB_shader_storage_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_shader_storage_buffer_object */ +#ifdef GL_ARB_shader_subroutine + GLEW_ARB_shader_subroutine = _glewSearchExtension("GL_ARB_shader_subroutine", extStart, extEnd); + if (glewExperimental || GLEW_ARB_shader_subroutine) GLEW_ARB_shader_subroutine = !_glewInit_GL_ARB_shader_subroutine(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_shader_subroutine */ +#ifdef GL_ARB_shader_texture_image_samples + GLEW_ARB_shader_texture_image_samples = _glewSearchExtension("GL_ARB_shader_texture_image_samples", extStart, extEnd); +#endif /* GL_ARB_shader_texture_image_samples */ +#ifdef GL_ARB_shader_texture_lod + GLEW_ARB_shader_texture_lod = _glewSearchExtension("GL_ARB_shader_texture_lod", extStart, extEnd); +#endif /* GL_ARB_shader_texture_lod */ +#ifdef GL_ARB_shader_viewport_layer_array + GLEW_ARB_shader_viewport_layer_array = _glewSearchExtension("GL_ARB_shader_viewport_layer_array", extStart, extEnd); +#endif /* GL_ARB_shader_viewport_layer_array */ +#ifdef GL_ARB_shading_language_100 + GLEW_ARB_shading_language_100 = _glewSearchExtension("GL_ARB_shading_language_100", extStart, extEnd); +#endif /* GL_ARB_shading_language_100 */ +#ifdef GL_ARB_shading_language_420pack + GLEW_ARB_shading_language_420pack = _glewSearchExtension("GL_ARB_shading_language_420pack", extStart, extEnd); +#endif /* GL_ARB_shading_language_420pack */ +#ifdef GL_ARB_shading_language_include + GLEW_ARB_shading_language_include = _glewSearchExtension("GL_ARB_shading_language_include", extStart, extEnd); + if (glewExperimental || GLEW_ARB_shading_language_include) GLEW_ARB_shading_language_include = !_glewInit_GL_ARB_shading_language_include(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_shading_language_include */ +#ifdef GL_ARB_shading_language_packing + GLEW_ARB_shading_language_packing = _glewSearchExtension("GL_ARB_shading_language_packing", extStart, extEnd); +#endif /* GL_ARB_shading_language_packing */ +#ifdef GL_ARB_shadow + GLEW_ARB_shadow = _glewSearchExtension("GL_ARB_shadow", extStart, extEnd); +#endif /* GL_ARB_shadow */ +#ifdef GL_ARB_shadow_ambient + GLEW_ARB_shadow_ambient = _glewSearchExtension("GL_ARB_shadow_ambient", extStart, extEnd); +#endif /* GL_ARB_shadow_ambient */ +#ifdef GL_ARB_sparse_buffer + GLEW_ARB_sparse_buffer = _glewSearchExtension("GL_ARB_sparse_buffer", extStart, extEnd); + if (glewExperimental || GLEW_ARB_sparse_buffer) GLEW_ARB_sparse_buffer = !_glewInit_GL_ARB_sparse_buffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_sparse_buffer */ +#ifdef GL_ARB_sparse_texture + GLEW_ARB_sparse_texture = _glewSearchExtension("GL_ARB_sparse_texture", extStart, extEnd); + if (glewExperimental || GLEW_ARB_sparse_texture) GLEW_ARB_sparse_texture = !_glewInit_GL_ARB_sparse_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_sparse_texture */ +#ifdef GL_ARB_sparse_texture2 + GLEW_ARB_sparse_texture2 = _glewSearchExtension("GL_ARB_sparse_texture2", extStart, extEnd); +#endif /* GL_ARB_sparse_texture2 */ +#ifdef GL_ARB_sparse_texture_clamp + GLEW_ARB_sparse_texture_clamp = _glewSearchExtension("GL_ARB_sparse_texture_clamp", extStart, extEnd); +#endif /* GL_ARB_sparse_texture_clamp */ +#ifdef GL_ARB_stencil_texturing + GLEW_ARB_stencil_texturing = _glewSearchExtension("GL_ARB_stencil_texturing", extStart, extEnd); +#endif /* GL_ARB_stencil_texturing */ +#ifdef GL_ARB_sync + GLEW_ARB_sync = _glewSearchExtension("GL_ARB_sync", extStart, extEnd); + if (glewExperimental || GLEW_ARB_sync) GLEW_ARB_sync = !_glewInit_GL_ARB_sync(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_sync */ +#ifdef GL_ARB_tessellation_shader + GLEW_ARB_tessellation_shader = _glewSearchExtension("GL_ARB_tessellation_shader", extStart, extEnd); + if (glewExperimental || GLEW_ARB_tessellation_shader) GLEW_ARB_tessellation_shader = !_glewInit_GL_ARB_tessellation_shader(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_tessellation_shader */ +#ifdef GL_ARB_texture_barrier + GLEW_ARB_texture_barrier = _glewSearchExtension("GL_ARB_texture_barrier", extStart, extEnd); + if (glewExperimental || GLEW_ARB_texture_barrier) GLEW_ARB_texture_barrier = !_glewInit_GL_ARB_texture_barrier(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_texture_barrier */ +#ifdef GL_ARB_texture_border_clamp + GLEW_ARB_texture_border_clamp = _glewSearchExtension("GL_ARB_texture_border_clamp", extStart, extEnd); +#endif /* GL_ARB_texture_border_clamp */ +#ifdef GL_ARB_texture_buffer_object + GLEW_ARB_texture_buffer_object = _glewSearchExtension("GL_ARB_texture_buffer_object", extStart, extEnd); + if (glewExperimental || GLEW_ARB_texture_buffer_object) GLEW_ARB_texture_buffer_object = !_glewInit_GL_ARB_texture_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_texture_buffer_object */ +#ifdef GL_ARB_texture_buffer_object_rgb32 + GLEW_ARB_texture_buffer_object_rgb32 = _glewSearchExtension("GL_ARB_texture_buffer_object_rgb32", extStart, extEnd); +#endif /* GL_ARB_texture_buffer_object_rgb32 */ +#ifdef GL_ARB_texture_buffer_range + GLEW_ARB_texture_buffer_range = _glewSearchExtension("GL_ARB_texture_buffer_range", extStart, extEnd); + if (glewExperimental || GLEW_ARB_texture_buffer_range) GLEW_ARB_texture_buffer_range = !_glewInit_GL_ARB_texture_buffer_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_texture_buffer_range */ +#ifdef GL_ARB_texture_compression + GLEW_ARB_texture_compression = _glewSearchExtension("GL_ARB_texture_compression", extStart, extEnd); + if (glewExperimental || GLEW_ARB_texture_compression) GLEW_ARB_texture_compression = !_glewInit_GL_ARB_texture_compression(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_texture_compression */ +#ifdef GL_ARB_texture_compression_bptc + GLEW_ARB_texture_compression_bptc = _glewSearchExtension("GL_ARB_texture_compression_bptc", extStart, extEnd); +#endif /* GL_ARB_texture_compression_bptc */ +#ifdef GL_ARB_texture_compression_rgtc + GLEW_ARB_texture_compression_rgtc = _glewSearchExtension("GL_ARB_texture_compression_rgtc", extStart, extEnd); +#endif /* GL_ARB_texture_compression_rgtc */ +#ifdef GL_ARB_texture_cube_map + GLEW_ARB_texture_cube_map = _glewSearchExtension("GL_ARB_texture_cube_map", extStart, extEnd); +#endif /* GL_ARB_texture_cube_map */ +#ifdef GL_ARB_texture_cube_map_array + GLEW_ARB_texture_cube_map_array = _glewSearchExtension("GL_ARB_texture_cube_map_array", extStart, extEnd); +#endif /* GL_ARB_texture_cube_map_array */ +#ifdef GL_ARB_texture_env_add + GLEW_ARB_texture_env_add = _glewSearchExtension("GL_ARB_texture_env_add", extStart, extEnd); +#endif /* GL_ARB_texture_env_add */ +#ifdef GL_ARB_texture_env_combine + GLEW_ARB_texture_env_combine = _glewSearchExtension("GL_ARB_texture_env_combine", extStart, extEnd); +#endif /* GL_ARB_texture_env_combine */ +#ifdef GL_ARB_texture_env_crossbar + GLEW_ARB_texture_env_crossbar = _glewSearchExtension("GL_ARB_texture_env_crossbar", extStart, extEnd); +#endif /* GL_ARB_texture_env_crossbar */ +#ifdef GL_ARB_texture_env_dot3 + GLEW_ARB_texture_env_dot3 = _glewSearchExtension("GL_ARB_texture_env_dot3", extStart, extEnd); +#endif /* GL_ARB_texture_env_dot3 */ +#ifdef GL_ARB_texture_filter_minmax + GLEW_ARB_texture_filter_minmax = _glewSearchExtension("GL_ARB_texture_filter_minmax", extStart, extEnd); +#endif /* GL_ARB_texture_filter_minmax */ +#ifdef GL_ARB_texture_float + GLEW_ARB_texture_float = _glewSearchExtension("GL_ARB_texture_float", extStart, extEnd); +#endif /* GL_ARB_texture_float */ +#ifdef GL_ARB_texture_gather + GLEW_ARB_texture_gather = _glewSearchExtension("GL_ARB_texture_gather", extStart, extEnd); +#endif /* GL_ARB_texture_gather */ +#ifdef GL_ARB_texture_mirror_clamp_to_edge + GLEW_ARB_texture_mirror_clamp_to_edge = _glewSearchExtension("GL_ARB_texture_mirror_clamp_to_edge", extStart, extEnd); +#endif /* GL_ARB_texture_mirror_clamp_to_edge */ +#ifdef GL_ARB_texture_mirrored_repeat + GLEW_ARB_texture_mirrored_repeat = _glewSearchExtension("GL_ARB_texture_mirrored_repeat", extStart, extEnd); +#endif /* GL_ARB_texture_mirrored_repeat */ +#ifdef GL_ARB_texture_multisample + GLEW_ARB_texture_multisample = _glewSearchExtension("GL_ARB_texture_multisample", extStart, extEnd); + if (glewExperimental || GLEW_ARB_texture_multisample) GLEW_ARB_texture_multisample = !_glewInit_GL_ARB_texture_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_texture_multisample */ +#ifdef GL_ARB_texture_non_power_of_two + GLEW_ARB_texture_non_power_of_two = _glewSearchExtension("GL_ARB_texture_non_power_of_two", extStart, extEnd); +#endif /* GL_ARB_texture_non_power_of_two */ +#ifdef GL_ARB_texture_query_levels + GLEW_ARB_texture_query_levels = _glewSearchExtension("GL_ARB_texture_query_levels", extStart, extEnd); +#endif /* GL_ARB_texture_query_levels */ +#ifdef GL_ARB_texture_query_lod + GLEW_ARB_texture_query_lod = _glewSearchExtension("GL_ARB_texture_query_lod", extStart, extEnd); +#endif /* GL_ARB_texture_query_lod */ +#ifdef GL_ARB_texture_rectangle + GLEW_ARB_texture_rectangle = _glewSearchExtension("GL_ARB_texture_rectangle", extStart, extEnd); +#endif /* GL_ARB_texture_rectangle */ +#ifdef GL_ARB_texture_rg + GLEW_ARB_texture_rg = _glewSearchExtension("GL_ARB_texture_rg", extStart, extEnd); +#endif /* GL_ARB_texture_rg */ +#ifdef GL_ARB_texture_rgb10_a2ui + GLEW_ARB_texture_rgb10_a2ui = _glewSearchExtension("GL_ARB_texture_rgb10_a2ui", extStart, extEnd); +#endif /* GL_ARB_texture_rgb10_a2ui */ +#ifdef GL_ARB_texture_stencil8 + GLEW_ARB_texture_stencil8 = _glewSearchExtension("GL_ARB_texture_stencil8", extStart, extEnd); +#endif /* GL_ARB_texture_stencil8 */ +#ifdef GL_ARB_texture_storage + GLEW_ARB_texture_storage = _glewSearchExtension("GL_ARB_texture_storage", extStart, extEnd); + if (glewExperimental || GLEW_ARB_texture_storage) GLEW_ARB_texture_storage = !_glewInit_GL_ARB_texture_storage(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_texture_storage */ +#ifdef GL_ARB_texture_storage_multisample + GLEW_ARB_texture_storage_multisample = _glewSearchExtension("GL_ARB_texture_storage_multisample", extStart, extEnd); + if (glewExperimental || GLEW_ARB_texture_storage_multisample) GLEW_ARB_texture_storage_multisample = !_glewInit_GL_ARB_texture_storage_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_texture_storage_multisample */ +#ifdef GL_ARB_texture_swizzle + GLEW_ARB_texture_swizzle = _glewSearchExtension("GL_ARB_texture_swizzle", extStart, extEnd); +#endif /* GL_ARB_texture_swizzle */ +#ifdef GL_ARB_texture_view + GLEW_ARB_texture_view = _glewSearchExtension("GL_ARB_texture_view", extStart, extEnd); + if (glewExperimental || GLEW_ARB_texture_view) GLEW_ARB_texture_view = !_glewInit_GL_ARB_texture_view(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_texture_view */ +#ifdef GL_ARB_timer_query + GLEW_ARB_timer_query = _glewSearchExtension("GL_ARB_timer_query", extStart, extEnd); + if (glewExperimental || GLEW_ARB_timer_query) GLEW_ARB_timer_query = !_glewInit_GL_ARB_timer_query(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_timer_query */ +#ifdef GL_ARB_transform_feedback2 + GLEW_ARB_transform_feedback2 = _glewSearchExtension("GL_ARB_transform_feedback2", extStart, extEnd); + if (glewExperimental || GLEW_ARB_transform_feedback2) GLEW_ARB_transform_feedback2 = !_glewInit_GL_ARB_transform_feedback2(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_transform_feedback2 */ +#ifdef GL_ARB_transform_feedback3 + GLEW_ARB_transform_feedback3 = _glewSearchExtension("GL_ARB_transform_feedback3", extStart, extEnd); + if (glewExperimental || GLEW_ARB_transform_feedback3) GLEW_ARB_transform_feedback3 = !_glewInit_GL_ARB_transform_feedback3(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_transform_feedback3 */ +#ifdef GL_ARB_transform_feedback_instanced + GLEW_ARB_transform_feedback_instanced = _glewSearchExtension("GL_ARB_transform_feedback_instanced", extStart, extEnd); + if (glewExperimental || GLEW_ARB_transform_feedback_instanced) GLEW_ARB_transform_feedback_instanced = !_glewInit_GL_ARB_transform_feedback_instanced(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_transform_feedback_instanced */ +#ifdef GL_ARB_transform_feedback_overflow_query + GLEW_ARB_transform_feedback_overflow_query = _glewSearchExtension("GL_ARB_transform_feedback_overflow_query", extStart, extEnd); +#endif /* GL_ARB_transform_feedback_overflow_query */ +#ifdef GL_ARB_transpose_matrix + GLEW_ARB_transpose_matrix = _glewSearchExtension("GL_ARB_transpose_matrix", extStart, extEnd); + if (glewExperimental || GLEW_ARB_transpose_matrix) GLEW_ARB_transpose_matrix = !_glewInit_GL_ARB_transpose_matrix(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_transpose_matrix */ +#ifdef GL_ARB_uniform_buffer_object + GLEW_ARB_uniform_buffer_object = _glewSearchExtension("GL_ARB_uniform_buffer_object", extStart, extEnd); + if (glewExperimental || GLEW_ARB_uniform_buffer_object) GLEW_ARB_uniform_buffer_object = !_glewInit_GL_ARB_uniform_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_uniform_buffer_object */ +#ifdef GL_ARB_vertex_array_bgra + GLEW_ARB_vertex_array_bgra = _glewSearchExtension("GL_ARB_vertex_array_bgra", extStart, extEnd); +#endif /* GL_ARB_vertex_array_bgra */ +#ifdef GL_ARB_vertex_array_object + GLEW_ARB_vertex_array_object = _glewSearchExtension("GL_ARB_vertex_array_object", extStart, extEnd); + if (glewExperimental || GLEW_ARB_vertex_array_object) GLEW_ARB_vertex_array_object = !_glewInit_GL_ARB_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_vertex_array_object */ +#ifdef GL_ARB_vertex_attrib_64bit + GLEW_ARB_vertex_attrib_64bit = _glewSearchExtension("GL_ARB_vertex_attrib_64bit", extStart, extEnd); + if (glewExperimental || GLEW_ARB_vertex_attrib_64bit) GLEW_ARB_vertex_attrib_64bit = !_glewInit_GL_ARB_vertex_attrib_64bit(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_vertex_attrib_64bit */ +#ifdef GL_ARB_vertex_attrib_binding + GLEW_ARB_vertex_attrib_binding = _glewSearchExtension("GL_ARB_vertex_attrib_binding", extStart, extEnd); + if (glewExperimental || GLEW_ARB_vertex_attrib_binding) GLEW_ARB_vertex_attrib_binding = !_glewInit_GL_ARB_vertex_attrib_binding(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_vertex_attrib_binding */ +#ifdef GL_ARB_vertex_blend + GLEW_ARB_vertex_blend = _glewSearchExtension("GL_ARB_vertex_blend", extStart, extEnd); + if (glewExperimental || GLEW_ARB_vertex_blend) GLEW_ARB_vertex_blend = !_glewInit_GL_ARB_vertex_blend(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_vertex_blend */ +#ifdef GL_ARB_vertex_buffer_object + GLEW_ARB_vertex_buffer_object = _glewSearchExtension("GL_ARB_vertex_buffer_object", extStart, extEnd); + if (glewExperimental || GLEW_ARB_vertex_buffer_object) GLEW_ARB_vertex_buffer_object = !_glewInit_GL_ARB_vertex_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_vertex_buffer_object */ +#ifdef GL_ARB_vertex_program + GLEW_ARB_vertex_program = _glewSearchExtension("GL_ARB_vertex_program", extStart, extEnd); + if (glewExperimental || GLEW_ARB_vertex_program) GLEW_ARB_vertex_program = !_glewInit_GL_ARB_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_vertex_program */ +#ifdef GL_ARB_vertex_shader + GLEW_ARB_vertex_shader = _glewSearchExtension("GL_ARB_vertex_shader", extStart, extEnd); + if (glewExperimental || GLEW_ARB_vertex_shader) { GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT); _glewInit_GL_ARB_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); } +#endif /* GL_ARB_vertex_shader */ +#ifdef GL_ARB_vertex_type_10f_11f_11f_rev + GLEW_ARB_vertex_type_10f_11f_11f_rev = _glewSearchExtension("GL_ARB_vertex_type_10f_11f_11f_rev", extStart, extEnd); +#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */ +#ifdef GL_ARB_vertex_type_2_10_10_10_rev + GLEW_ARB_vertex_type_2_10_10_10_rev = _glewSearchExtension("GL_ARB_vertex_type_2_10_10_10_rev", extStart, extEnd); + if (glewExperimental || GLEW_ARB_vertex_type_2_10_10_10_rev) GLEW_ARB_vertex_type_2_10_10_10_rev = !_glewInit_GL_ARB_vertex_type_2_10_10_10_rev(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_vertex_type_2_10_10_10_rev */ +#ifdef GL_ARB_viewport_array + GLEW_ARB_viewport_array = _glewSearchExtension("GL_ARB_viewport_array", extStart, extEnd); + if (glewExperimental || GLEW_ARB_viewport_array) GLEW_ARB_viewport_array = !_glewInit_GL_ARB_viewport_array(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_viewport_array */ +#ifdef GL_ARB_window_pos + GLEW_ARB_window_pos = _glewSearchExtension("GL_ARB_window_pos", extStart, extEnd); + if (glewExperimental || GLEW_ARB_window_pos) GLEW_ARB_window_pos = !_glewInit_GL_ARB_window_pos(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_window_pos */ +#ifdef GL_ATIX_point_sprites + GLEW_ATIX_point_sprites = _glewSearchExtension("GL_ATIX_point_sprites", extStart, extEnd); +#endif /* GL_ATIX_point_sprites */ +#ifdef GL_ATIX_texture_env_combine3 + GLEW_ATIX_texture_env_combine3 = _glewSearchExtension("GL_ATIX_texture_env_combine3", extStart, extEnd); +#endif /* GL_ATIX_texture_env_combine3 */ +#ifdef GL_ATIX_texture_env_route + GLEW_ATIX_texture_env_route = _glewSearchExtension("GL_ATIX_texture_env_route", extStart, extEnd); +#endif /* GL_ATIX_texture_env_route */ +#ifdef GL_ATIX_vertex_shader_output_point_size + GLEW_ATIX_vertex_shader_output_point_size = _glewSearchExtension("GL_ATIX_vertex_shader_output_point_size", extStart, extEnd); +#endif /* GL_ATIX_vertex_shader_output_point_size */ +#ifdef GL_ATI_draw_buffers + GLEW_ATI_draw_buffers = _glewSearchExtension("GL_ATI_draw_buffers", extStart, extEnd); + if (glewExperimental || GLEW_ATI_draw_buffers) GLEW_ATI_draw_buffers = !_glewInit_GL_ATI_draw_buffers(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_draw_buffers */ +#ifdef GL_ATI_element_array + GLEW_ATI_element_array = _glewSearchExtension("GL_ATI_element_array", extStart, extEnd); + if (glewExperimental || GLEW_ATI_element_array) GLEW_ATI_element_array = !_glewInit_GL_ATI_element_array(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_element_array */ +#ifdef GL_ATI_envmap_bumpmap + GLEW_ATI_envmap_bumpmap = _glewSearchExtension("GL_ATI_envmap_bumpmap", extStart, extEnd); + if (glewExperimental || GLEW_ATI_envmap_bumpmap) GLEW_ATI_envmap_bumpmap = !_glewInit_GL_ATI_envmap_bumpmap(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_envmap_bumpmap */ +#ifdef GL_ATI_fragment_shader + GLEW_ATI_fragment_shader = _glewSearchExtension("GL_ATI_fragment_shader", extStart, extEnd); + if (glewExperimental || GLEW_ATI_fragment_shader) GLEW_ATI_fragment_shader = !_glewInit_GL_ATI_fragment_shader(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_fragment_shader */ +#ifdef GL_ATI_map_object_buffer + GLEW_ATI_map_object_buffer = _glewSearchExtension("GL_ATI_map_object_buffer", extStart, extEnd); + if (glewExperimental || GLEW_ATI_map_object_buffer) GLEW_ATI_map_object_buffer = !_glewInit_GL_ATI_map_object_buffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_map_object_buffer */ +#ifdef GL_ATI_meminfo + GLEW_ATI_meminfo = _glewSearchExtension("GL_ATI_meminfo", extStart, extEnd); +#endif /* GL_ATI_meminfo */ +#ifdef GL_ATI_pn_triangles + GLEW_ATI_pn_triangles = _glewSearchExtension("GL_ATI_pn_triangles", extStart, extEnd); + if (glewExperimental || GLEW_ATI_pn_triangles) GLEW_ATI_pn_triangles = !_glewInit_GL_ATI_pn_triangles(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_pn_triangles */ +#ifdef GL_ATI_separate_stencil + GLEW_ATI_separate_stencil = _glewSearchExtension("GL_ATI_separate_stencil", extStart, extEnd); + if (glewExperimental || GLEW_ATI_separate_stencil) GLEW_ATI_separate_stencil = !_glewInit_GL_ATI_separate_stencil(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_separate_stencil */ +#ifdef GL_ATI_shader_texture_lod + GLEW_ATI_shader_texture_lod = _glewSearchExtension("GL_ATI_shader_texture_lod", extStart, extEnd); +#endif /* GL_ATI_shader_texture_lod */ +#ifdef GL_ATI_text_fragment_shader + GLEW_ATI_text_fragment_shader = _glewSearchExtension("GL_ATI_text_fragment_shader", extStart, extEnd); +#endif /* GL_ATI_text_fragment_shader */ +#ifdef GL_ATI_texture_compression_3dc + GLEW_ATI_texture_compression_3dc = _glewSearchExtension("GL_ATI_texture_compression_3dc", extStart, extEnd); +#endif /* GL_ATI_texture_compression_3dc */ +#ifdef GL_ATI_texture_env_combine3 + GLEW_ATI_texture_env_combine3 = _glewSearchExtension("GL_ATI_texture_env_combine3", extStart, extEnd); +#endif /* GL_ATI_texture_env_combine3 */ +#ifdef GL_ATI_texture_float + GLEW_ATI_texture_float = _glewSearchExtension("GL_ATI_texture_float", extStart, extEnd); +#endif /* GL_ATI_texture_float */ +#ifdef GL_ATI_texture_mirror_once + GLEW_ATI_texture_mirror_once = _glewSearchExtension("GL_ATI_texture_mirror_once", extStart, extEnd); +#endif /* GL_ATI_texture_mirror_once */ +#ifdef GL_ATI_vertex_array_object + GLEW_ATI_vertex_array_object = _glewSearchExtension("GL_ATI_vertex_array_object", extStart, extEnd); + if (glewExperimental || GLEW_ATI_vertex_array_object) GLEW_ATI_vertex_array_object = !_glewInit_GL_ATI_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_vertex_array_object */ +#ifdef GL_ATI_vertex_attrib_array_object + GLEW_ATI_vertex_attrib_array_object = _glewSearchExtension("GL_ATI_vertex_attrib_array_object", extStart, extEnd); + if (glewExperimental || GLEW_ATI_vertex_attrib_array_object) GLEW_ATI_vertex_attrib_array_object = !_glewInit_GL_ATI_vertex_attrib_array_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_vertex_attrib_array_object */ +#ifdef GL_ATI_vertex_streams + GLEW_ATI_vertex_streams = _glewSearchExtension("GL_ATI_vertex_streams", extStart, extEnd); + if (glewExperimental || GLEW_ATI_vertex_streams) GLEW_ATI_vertex_streams = !_glewInit_GL_ATI_vertex_streams(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_vertex_streams */ +#ifdef GL_EXT_422_pixels + GLEW_EXT_422_pixels = _glewSearchExtension("GL_EXT_422_pixels", extStart, extEnd); +#endif /* GL_EXT_422_pixels */ +#ifdef GL_EXT_Cg_shader + GLEW_EXT_Cg_shader = _glewSearchExtension("GL_EXT_Cg_shader", extStart, extEnd); +#endif /* GL_EXT_Cg_shader */ +#ifdef GL_EXT_abgr + GLEW_EXT_abgr = _glewSearchExtension("GL_EXT_abgr", extStart, extEnd); +#endif /* GL_EXT_abgr */ +#ifdef GL_EXT_bgra + GLEW_EXT_bgra = _glewSearchExtension("GL_EXT_bgra", extStart, extEnd); +#endif /* GL_EXT_bgra */ +#ifdef GL_EXT_bindable_uniform + GLEW_EXT_bindable_uniform = _glewSearchExtension("GL_EXT_bindable_uniform", extStart, extEnd); + if (glewExperimental || GLEW_EXT_bindable_uniform) GLEW_EXT_bindable_uniform = !_glewInit_GL_EXT_bindable_uniform(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_bindable_uniform */ +#ifdef GL_EXT_blend_color + GLEW_EXT_blend_color = _glewSearchExtension("GL_EXT_blend_color", extStart, extEnd); + if (glewExperimental || GLEW_EXT_blend_color) GLEW_EXT_blend_color = !_glewInit_GL_EXT_blend_color(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_blend_color */ +#ifdef GL_EXT_blend_equation_separate + GLEW_EXT_blend_equation_separate = _glewSearchExtension("GL_EXT_blend_equation_separate", extStart, extEnd); + if (glewExperimental || GLEW_EXT_blend_equation_separate) GLEW_EXT_blend_equation_separate = !_glewInit_GL_EXT_blend_equation_separate(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_blend_equation_separate */ +#ifdef GL_EXT_blend_func_separate + GLEW_EXT_blend_func_separate = _glewSearchExtension("GL_EXT_blend_func_separate", extStart, extEnd); + if (glewExperimental || GLEW_EXT_blend_func_separate) GLEW_EXT_blend_func_separate = !_glewInit_GL_EXT_blend_func_separate(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_blend_func_separate */ +#ifdef GL_EXT_blend_logic_op + GLEW_EXT_blend_logic_op = _glewSearchExtension("GL_EXT_blend_logic_op", extStart, extEnd); +#endif /* GL_EXT_blend_logic_op */ +#ifdef GL_EXT_blend_minmax + GLEW_EXT_blend_minmax = _glewSearchExtension("GL_EXT_blend_minmax", extStart, extEnd); + if (glewExperimental || GLEW_EXT_blend_minmax) GLEW_EXT_blend_minmax = !_glewInit_GL_EXT_blend_minmax(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_blend_minmax */ +#ifdef GL_EXT_blend_subtract + GLEW_EXT_blend_subtract = _glewSearchExtension("GL_EXT_blend_subtract", extStart, extEnd); +#endif /* GL_EXT_blend_subtract */ +#ifdef GL_EXT_clip_volume_hint + GLEW_EXT_clip_volume_hint = _glewSearchExtension("GL_EXT_clip_volume_hint", extStart, extEnd); +#endif /* GL_EXT_clip_volume_hint */ +#ifdef GL_EXT_cmyka + GLEW_EXT_cmyka = _glewSearchExtension("GL_EXT_cmyka", extStart, extEnd); +#endif /* GL_EXT_cmyka */ +#ifdef GL_EXT_color_subtable + GLEW_EXT_color_subtable = _glewSearchExtension("GL_EXT_color_subtable", extStart, extEnd); + if (glewExperimental || GLEW_EXT_color_subtable) GLEW_EXT_color_subtable = !_glewInit_GL_EXT_color_subtable(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_color_subtable */ +#ifdef GL_EXT_compiled_vertex_array + GLEW_EXT_compiled_vertex_array = _glewSearchExtension("GL_EXT_compiled_vertex_array", extStart, extEnd); + if (glewExperimental || GLEW_EXT_compiled_vertex_array) GLEW_EXT_compiled_vertex_array = !_glewInit_GL_EXT_compiled_vertex_array(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_compiled_vertex_array */ +#ifdef GL_EXT_convolution + GLEW_EXT_convolution = _glewSearchExtension("GL_EXT_convolution", extStart, extEnd); + if (glewExperimental || GLEW_EXT_convolution) GLEW_EXT_convolution = !_glewInit_GL_EXT_convolution(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_convolution */ +#ifdef GL_EXT_coordinate_frame + GLEW_EXT_coordinate_frame = _glewSearchExtension("GL_EXT_coordinate_frame", extStart, extEnd); + if (glewExperimental || GLEW_EXT_coordinate_frame) GLEW_EXT_coordinate_frame = !_glewInit_GL_EXT_coordinate_frame(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_coordinate_frame */ +#ifdef GL_EXT_copy_texture + GLEW_EXT_copy_texture = _glewSearchExtension("GL_EXT_copy_texture", extStart, extEnd); + if (glewExperimental || GLEW_EXT_copy_texture) GLEW_EXT_copy_texture = !_glewInit_GL_EXT_copy_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_copy_texture */ +#ifdef GL_EXT_cull_vertex + GLEW_EXT_cull_vertex = _glewSearchExtension("GL_EXT_cull_vertex", extStart, extEnd); + if (glewExperimental || GLEW_EXT_cull_vertex) GLEW_EXT_cull_vertex = !_glewInit_GL_EXT_cull_vertex(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_cull_vertex */ +#ifdef GL_EXT_debug_label + GLEW_EXT_debug_label = _glewSearchExtension("GL_EXT_debug_label", extStart, extEnd); + if (glewExperimental || GLEW_EXT_debug_label) GLEW_EXT_debug_label = !_glewInit_GL_EXT_debug_label(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_debug_label */ +#ifdef GL_EXT_debug_marker + GLEW_EXT_debug_marker = _glewSearchExtension("GL_EXT_debug_marker", extStart, extEnd); + if (glewExperimental || GLEW_EXT_debug_marker) GLEW_EXT_debug_marker = !_glewInit_GL_EXT_debug_marker(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_debug_marker */ +#ifdef GL_EXT_depth_bounds_test + GLEW_EXT_depth_bounds_test = _glewSearchExtension("GL_EXT_depth_bounds_test", extStart, extEnd); + if (glewExperimental || GLEW_EXT_depth_bounds_test) GLEW_EXT_depth_bounds_test = !_glewInit_GL_EXT_depth_bounds_test(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_depth_bounds_test */ +#ifdef GL_EXT_direct_state_access + GLEW_EXT_direct_state_access = _glewSearchExtension("GL_EXT_direct_state_access", extStart, extEnd); + if (glewExperimental || GLEW_EXT_direct_state_access) GLEW_EXT_direct_state_access = !_glewInit_GL_EXT_direct_state_access(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_direct_state_access */ +#ifdef GL_EXT_draw_buffers2 + GLEW_EXT_draw_buffers2 = _glewSearchExtension("GL_EXT_draw_buffers2", extStart, extEnd); + if (glewExperimental || GLEW_EXT_draw_buffers2) GLEW_EXT_draw_buffers2 = !_glewInit_GL_EXT_draw_buffers2(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_draw_buffers2 */ +#ifdef GL_EXT_draw_instanced + GLEW_EXT_draw_instanced = _glewSearchExtension("GL_EXT_draw_instanced", extStart, extEnd); + if (glewExperimental || GLEW_EXT_draw_instanced) GLEW_EXT_draw_instanced = !_glewInit_GL_EXT_draw_instanced(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_draw_instanced */ +#ifdef GL_EXT_draw_range_elements + GLEW_EXT_draw_range_elements = _glewSearchExtension("GL_EXT_draw_range_elements", extStart, extEnd); + if (glewExperimental || GLEW_EXT_draw_range_elements) GLEW_EXT_draw_range_elements = !_glewInit_GL_EXT_draw_range_elements(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_draw_range_elements */ +#ifdef GL_EXT_fog_coord + GLEW_EXT_fog_coord = _glewSearchExtension("GL_EXT_fog_coord", extStart, extEnd); + if (glewExperimental || GLEW_EXT_fog_coord) GLEW_EXT_fog_coord = !_glewInit_GL_EXT_fog_coord(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_fog_coord */ +#ifdef GL_EXT_fragment_lighting + GLEW_EXT_fragment_lighting = _glewSearchExtension("GL_EXT_fragment_lighting", extStart, extEnd); + if (glewExperimental || GLEW_EXT_fragment_lighting) GLEW_EXT_fragment_lighting = !_glewInit_GL_EXT_fragment_lighting(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_fragment_lighting */ +#ifdef GL_EXT_framebuffer_blit + GLEW_EXT_framebuffer_blit = _glewSearchExtension("GL_EXT_framebuffer_blit", extStart, extEnd); + if (glewExperimental || GLEW_EXT_framebuffer_blit) GLEW_EXT_framebuffer_blit = !_glewInit_GL_EXT_framebuffer_blit(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_framebuffer_blit */ +#ifdef GL_EXT_framebuffer_multisample + GLEW_EXT_framebuffer_multisample = _glewSearchExtension("GL_EXT_framebuffer_multisample", extStart, extEnd); + if (glewExperimental || GLEW_EXT_framebuffer_multisample) GLEW_EXT_framebuffer_multisample = !_glewInit_GL_EXT_framebuffer_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_framebuffer_multisample */ +#ifdef GL_EXT_framebuffer_multisample_blit_scaled + GLEW_EXT_framebuffer_multisample_blit_scaled = _glewSearchExtension("GL_EXT_framebuffer_multisample_blit_scaled", extStart, extEnd); +#endif /* GL_EXT_framebuffer_multisample_blit_scaled */ +#ifdef GL_EXT_framebuffer_object + GLEW_EXT_framebuffer_object = _glewSearchExtension("GL_EXT_framebuffer_object", extStart, extEnd); + if (glewExperimental || GLEW_EXT_framebuffer_object) GLEW_EXT_framebuffer_object = !_glewInit_GL_EXT_framebuffer_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_framebuffer_object */ +#ifdef GL_EXT_framebuffer_sRGB + GLEW_EXT_framebuffer_sRGB = _glewSearchExtension("GL_EXT_framebuffer_sRGB", extStart, extEnd); +#endif /* GL_EXT_framebuffer_sRGB */ +#ifdef GL_EXT_geometry_shader4 + GLEW_EXT_geometry_shader4 = _glewSearchExtension("GL_EXT_geometry_shader4", extStart, extEnd); + if (glewExperimental || GLEW_EXT_geometry_shader4) GLEW_EXT_geometry_shader4 = !_glewInit_GL_EXT_geometry_shader4(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_geometry_shader4 */ +#ifdef GL_EXT_gpu_program_parameters + GLEW_EXT_gpu_program_parameters = _glewSearchExtension("GL_EXT_gpu_program_parameters", extStart, extEnd); + if (glewExperimental || GLEW_EXT_gpu_program_parameters) GLEW_EXT_gpu_program_parameters = !_glewInit_GL_EXT_gpu_program_parameters(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_gpu_program_parameters */ +#ifdef GL_EXT_gpu_shader4 + GLEW_EXT_gpu_shader4 = _glewSearchExtension("GL_EXT_gpu_shader4", extStart, extEnd); + if (glewExperimental || GLEW_EXT_gpu_shader4) GLEW_EXT_gpu_shader4 = !_glewInit_GL_EXT_gpu_shader4(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_gpu_shader4 */ +#ifdef GL_EXT_histogram + GLEW_EXT_histogram = _glewSearchExtension("GL_EXT_histogram", extStart, extEnd); + if (glewExperimental || GLEW_EXT_histogram) GLEW_EXT_histogram = !_glewInit_GL_EXT_histogram(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_histogram */ +#ifdef GL_EXT_index_array_formats + GLEW_EXT_index_array_formats = _glewSearchExtension("GL_EXT_index_array_formats", extStart, extEnd); +#endif /* GL_EXT_index_array_formats */ +#ifdef GL_EXT_index_func + GLEW_EXT_index_func = _glewSearchExtension("GL_EXT_index_func", extStart, extEnd); + if (glewExperimental || GLEW_EXT_index_func) GLEW_EXT_index_func = !_glewInit_GL_EXT_index_func(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_index_func */ +#ifdef GL_EXT_index_material + GLEW_EXT_index_material = _glewSearchExtension("GL_EXT_index_material", extStart, extEnd); + if (glewExperimental || GLEW_EXT_index_material) GLEW_EXT_index_material = !_glewInit_GL_EXT_index_material(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_index_material */ +#ifdef GL_EXT_index_texture + GLEW_EXT_index_texture = _glewSearchExtension("GL_EXT_index_texture", extStart, extEnd); +#endif /* GL_EXT_index_texture */ +#ifdef GL_EXT_light_texture + GLEW_EXT_light_texture = _glewSearchExtension("GL_EXT_light_texture", extStart, extEnd); + if (glewExperimental || GLEW_EXT_light_texture) GLEW_EXT_light_texture = !_glewInit_GL_EXT_light_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_light_texture */ +#ifdef GL_EXT_misc_attribute + GLEW_EXT_misc_attribute = _glewSearchExtension("GL_EXT_misc_attribute", extStart, extEnd); +#endif /* GL_EXT_misc_attribute */ +#ifdef GL_EXT_multi_draw_arrays + GLEW_EXT_multi_draw_arrays = _glewSearchExtension("GL_EXT_multi_draw_arrays", extStart, extEnd); + if (glewExperimental || GLEW_EXT_multi_draw_arrays) GLEW_EXT_multi_draw_arrays = !_glewInit_GL_EXT_multi_draw_arrays(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_multi_draw_arrays */ +#ifdef GL_EXT_multisample + GLEW_EXT_multisample = _glewSearchExtension("GL_EXT_multisample", extStart, extEnd); + if (glewExperimental || GLEW_EXT_multisample) GLEW_EXT_multisample = !_glewInit_GL_EXT_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_multisample */ +#ifdef GL_EXT_packed_depth_stencil + GLEW_EXT_packed_depth_stencil = _glewSearchExtension("GL_EXT_packed_depth_stencil", extStart, extEnd); +#endif /* GL_EXT_packed_depth_stencil */ +#ifdef GL_EXT_packed_float + GLEW_EXT_packed_float = _glewSearchExtension("GL_EXT_packed_float", extStart, extEnd); +#endif /* GL_EXT_packed_float */ +#ifdef GL_EXT_packed_pixels + GLEW_EXT_packed_pixels = _glewSearchExtension("GL_EXT_packed_pixels", extStart, extEnd); +#endif /* GL_EXT_packed_pixels */ +#ifdef GL_EXT_paletted_texture + GLEW_EXT_paletted_texture = _glewSearchExtension("GL_EXT_paletted_texture", extStart, extEnd); + if (glewExperimental || GLEW_EXT_paletted_texture) GLEW_EXT_paletted_texture = !_glewInit_GL_EXT_paletted_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_paletted_texture */ +#ifdef GL_EXT_pixel_buffer_object + GLEW_EXT_pixel_buffer_object = _glewSearchExtension("GL_EXT_pixel_buffer_object", extStart, extEnd); +#endif /* GL_EXT_pixel_buffer_object */ +#ifdef GL_EXT_pixel_transform + GLEW_EXT_pixel_transform = _glewSearchExtension("GL_EXT_pixel_transform", extStart, extEnd); + if (glewExperimental || GLEW_EXT_pixel_transform) GLEW_EXT_pixel_transform = !_glewInit_GL_EXT_pixel_transform(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_pixel_transform */ +#ifdef GL_EXT_pixel_transform_color_table + GLEW_EXT_pixel_transform_color_table = _glewSearchExtension("GL_EXT_pixel_transform_color_table", extStart, extEnd); +#endif /* GL_EXT_pixel_transform_color_table */ +#ifdef GL_EXT_point_parameters + GLEW_EXT_point_parameters = _glewSearchExtension("GL_EXT_point_parameters", extStart, extEnd); + if (glewExperimental || GLEW_EXT_point_parameters) GLEW_EXT_point_parameters = !_glewInit_GL_EXT_point_parameters(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_point_parameters */ +#ifdef GL_EXT_polygon_offset + GLEW_EXT_polygon_offset = _glewSearchExtension("GL_EXT_polygon_offset", extStart, extEnd); + if (glewExperimental || GLEW_EXT_polygon_offset) GLEW_EXT_polygon_offset = !_glewInit_GL_EXT_polygon_offset(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_polygon_offset */ +#ifdef GL_EXT_polygon_offset_clamp + GLEW_EXT_polygon_offset_clamp = _glewSearchExtension("GL_EXT_polygon_offset_clamp", extStart, extEnd); + if (glewExperimental || GLEW_EXT_polygon_offset_clamp) GLEW_EXT_polygon_offset_clamp = !_glewInit_GL_EXT_polygon_offset_clamp(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_polygon_offset_clamp */ +#ifdef GL_EXT_post_depth_coverage + GLEW_EXT_post_depth_coverage = _glewSearchExtension("GL_EXT_post_depth_coverage", extStart, extEnd); +#endif /* GL_EXT_post_depth_coverage */ +#ifdef GL_EXT_provoking_vertex + GLEW_EXT_provoking_vertex = _glewSearchExtension("GL_EXT_provoking_vertex", extStart, extEnd); + if (glewExperimental || GLEW_EXT_provoking_vertex) GLEW_EXT_provoking_vertex = !_glewInit_GL_EXT_provoking_vertex(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_provoking_vertex */ +#ifdef GL_EXT_raster_multisample + GLEW_EXT_raster_multisample = _glewSearchExtension("GL_EXT_raster_multisample", extStart, extEnd); + if (glewExperimental || GLEW_EXT_raster_multisample) GLEW_EXT_raster_multisample = !_glewInit_GL_EXT_raster_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_raster_multisample */ +#ifdef GL_EXT_rescale_normal + GLEW_EXT_rescale_normal = _glewSearchExtension("GL_EXT_rescale_normal", extStart, extEnd); +#endif /* GL_EXT_rescale_normal */ +#ifdef GL_EXT_scene_marker + GLEW_EXT_scene_marker = _glewSearchExtension("GL_EXT_scene_marker", extStart, extEnd); + if (glewExperimental || GLEW_EXT_scene_marker) GLEW_EXT_scene_marker = !_glewInit_GL_EXT_scene_marker(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_scene_marker */ +#ifdef GL_EXT_secondary_color + GLEW_EXT_secondary_color = _glewSearchExtension("GL_EXT_secondary_color", extStart, extEnd); + if (glewExperimental || GLEW_EXT_secondary_color) GLEW_EXT_secondary_color = !_glewInit_GL_EXT_secondary_color(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_secondary_color */ +#ifdef GL_EXT_separate_shader_objects + GLEW_EXT_separate_shader_objects = _glewSearchExtension("GL_EXT_separate_shader_objects", extStart, extEnd); + if (glewExperimental || GLEW_EXT_separate_shader_objects) GLEW_EXT_separate_shader_objects = !_glewInit_GL_EXT_separate_shader_objects(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_separate_shader_objects */ +#ifdef GL_EXT_separate_specular_color + GLEW_EXT_separate_specular_color = _glewSearchExtension("GL_EXT_separate_specular_color", extStart, extEnd); +#endif /* GL_EXT_separate_specular_color */ +#ifdef GL_EXT_shader_image_load_formatted + GLEW_EXT_shader_image_load_formatted = _glewSearchExtension("GL_EXT_shader_image_load_formatted", extStart, extEnd); +#endif /* GL_EXT_shader_image_load_formatted */ +#ifdef GL_EXT_shader_image_load_store + GLEW_EXT_shader_image_load_store = _glewSearchExtension("GL_EXT_shader_image_load_store", extStart, extEnd); + if (glewExperimental || GLEW_EXT_shader_image_load_store) GLEW_EXT_shader_image_load_store = !_glewInit_GL_EXT_shader_image_load_store(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_shader_image_load_store */ +#ifdef GL_EXT_shader_integer_mix + GLEW_EXT_shader_integer_mix = _glewSearchExtension("GL_EXT_shader_integer_mix", extStart, extEnd); +#endif /* GL_EXT_shader_integer_mix */ +#ifdef GL_EXT_shadow_funcs + GLEW_EXT_shadow_funcs = _glewSearchExtension("GL_EXT_shadow_funcs", extStart, extEnd); +#endif /* GL_EXT_shadow_funcs */ +#ifdef GL_EXT_shared_texture_palette + GLEW_EXT_shared_texture_palette = _glewSearchExtension("GL_EXT_shared_texture_palette", extStart, extEnd); +#endif /* GL_EXT_shared_texture_palette */ +#ifdef GL_EXT_sparse_texture2 + GLEW_EXT_sparse_texture2 = _glewSearchExtension("GL_EXT_sparse_texture2", extStart, extEnd); +#endif /* GL_EXT_sparse_texture2 */ +#ifdef GL_EXT_stencil_clear_tag + GLEW_EXT_stencil_clear_tag = _glewSearchExtension("GL_EXT_stencil_clear_tag", extStart, extEnd); +#endif /* GL_EXT_stencil_clear_tag */ +#ifdef GL_EXT_stencil_two_side + GLEW_EXT_stencil_two_side = _glewSearchExtension("GL_EXT_stencil_two_side", extStart, extEnd); + if (glewExperimental || GLEW_EXT_stencil_two_side) GLEW_EXT_stencil_two_side = !_glewInit_GL_EXT_stencil_two_side(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_stencil_two_side */ +#ifdef GL_EXT_stencil_wrap + GLEW_EXT_stencil_wrap = _glewSearchExtension("GL_EXT_stencil_wrap", extStart, extEnd); +#endif /* GL_EXT_stencil_wrap */ +#ifdef GL_EXT_subtexture + GLEW_EXT_subtexture = _glewSearchExtension("GL_EXT_subtexture", extStart, extEnd); + if (glewExperimental || GLEW_EXT_subtexture) GLEW_EXT_subtexture = !_glewInit_GL_EXT_subtexture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_subtexture */ +#ifdef GL_EXT_texture + GLEW_EXT_texture = _glewSearchExtension("GL_EXT_texture", extStart, extEnd); +#endif /* GL_EXT_texture */ +#ifdef GL_EXT_texture3D + GLEW_EXT_texture3D = _glewSearchExtension("GL_EXT_texture3D", extStart, extEnd); + if (glewExperimental || GLEW_EXT_texture3D) GLEW_EXT_texture3D = !_glewInit_GL_EXT_texture3D(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_texture3D */ +#ifdef GL_EXT_texture_array + GLEW_EXT_texture_array = _glewSearchExtension("GL_EXT_texture_array", extStart, extEnd); + if (glewExperimental || GLEW_EXT_texture_array) GLEW_EXT_texture_array = !_glewInit_GL_EXT_texture_array(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_texture_array */ +#ifdef GL_EXT_texture_buffer_object + GLEW_EXT_texture_buffer_object = _glewSearchExtension("GL_EXT_texture_buffer_object", extStart, extEnd); + if (glewExperimental || GLEW_EXT_texture_buffer_object) GLEW_EXT_texture_buffer_object = !_glewInit_GL_EXT_texture_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_texture_buffer_object */ +#ifdef GL_EXT_texture_compression_dxt1 + GLEW_EXT_texture_compression_dxt1 = _glewSearchExtension("GL_EXT_texture_compression_dxt1", extStart, extEnd); +#endif /* GL_EXT_texture_compression_dxt1 */ +#ifdef GL_EXT_texture_compression_latc + GLEW_EXT_texture_compression_latc = _glewSearchExtension("GL_EXT_texture_compression_latc", extStart, extEnd); +#endif /* GL_EXT_texture_compression_latc */ +#ifdef GL_EXT_texture_compression_rgtc + GLEW_EXT_texture_compression_rgtc = _glewSearchExtension("GL_EXT_texture_compression_rgtc", extStart, extEnd); +#endif /* GL_EXT_texture_compression_rgtc */ +#ifdef GL_EXT_texture_compression_s3tc + GLEW_EXT_texture_compression_s3tc = _glewSearchExtension("GL_EXT_texture_compression_s3tc", extStart, extEnd); +#endif /* GL_EXT_texture_compression_s3tc */ +#ifdef GL_EXT_texture_cube_map + GLEW_EXT_texture_cube_map = _glewSearchExtension("GL_EXT_texture_cube_map", extStart, extEnd); +#endif /* GL_EXT_texture_cube_map */ +#ifdef GL_EXT_texture_edge_clamp + GLEW_EXT_texture_edge_clamp = _glewSearchExtension("GL_EXT_texture_edge_clamp", extStart, extEnd); +#endif /* GL_EXT_texture_edge_clamp */ +#ifdef GL_EXT_texture_env + GLEW_EXT_texture_env = _glewSearchExtension("GL_EXT_texture_env", extStart, extEnd); +#endif /* GL_EXT_texture_env */ +#ifdef GL_EXT_texture_env_add + GLEW_EXT_texture_env_add = _glewSearchExtension("GL_EXT_texture_env_add", extStart, extEnd); +#endif /* GL_EXT_texture_env_add */ +#ifdef GL_EXT_texture_env_combine + GLEW_EXT_texture_env_combine = _glewSearchExtension("GL_EXT_texture_env_combine", extStart, extEnd); +#endif /* GL_EXT_texture_env_combine */ +#ifdef GL_EXT_texture_env_dot3 + GLEW_EXT_texture_env_dot3 = _glewSearchExtension("GL_EXT_texture_env_dot3", extStart, extEnd); +#endif /* GL_EXT_texture_env_dot3 */ +#ifdef GL_EXT_texture_filter_anisotropic + GLEW_EXT_texture_filter_anisotropic = _glewSearchExtension("GL_EXT_texture_filter_anisotropic", extStart, extEnd); +#endif /* GL_EXT_texture_filter_anisotropic */ +#ifdef GL_EXT_texture_filter_minmax + GLEW_EXT_texture_filter_minmax = _glewSearchExtension("GL_EXT_texture_filter_minmax", extStart, extEnd); +#endif /* GL_EXT_texture_filter_minmax */ +#ifdef GL_EXT_texture_integer + GLEW_EXT_texture_integer = _glewSearchExtension("GL_EXT_texture_integer", extStart, extEnd); + if (glewExperimental || GLEW_EXT_texture_integer) GLEW_EXT_texture_integer = !_glewInit_GL_EXT_texture_integer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_texture_integer */ +#ifdef GL_EXT_texture_lod_bias + GLEW_EXT_texture_lod_bias = _glewSearchExtension("GL_EXT_texture_lod_bias", extStart, extEnd); +#endif /* GL_EXT_texture_lod_bias */ +#ifdef GL_EXT_texture_mirror_clamp + GLEW_EXT_texture_mirror_clamp = _glewSearchExtension("GL_EXT_texture_mirror_clamp", extStart, extEnd); +#endif /* GL_EXT_texture_mirror_clamp */ +#ifdef GL_EXT_texture_object + GLEW_EXT_texture_object = _glewSearchExtension("GL_EXT_texture_object", extStart, extEnd); + if (glewExperimental || GLEW_EXT_texture_object) GLEW_EXT_texture_object = !_glewInit_GL_EXT_texture_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_texture_object */ +#ifdef GL_EXT_texture_perturb_normal + GLEW_EXT_texture_perturb_normal = _glewSearchExtension("GL_EXT_texture_perturb_normal", extStart, extEnd); + if (glewExperimental || GLEW_EXT_texture_perturb_normal) GLEW_EXT_texture_perturb_normal = !_glewInit_GL_EXT_texture_perturb_normal(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_texture_perturb_normal */ +#ifdef GL_EXT_texture_rectangle + GLEW_EXT_texture_rectangle = _glewSearchExtension("GL_EXT_texture_rectangle", extStart, extEnd); +#endif /* GL_EXT_texture_rectangle */ +#ifdef GL_EXT_texture_sRGB + GLEW_EXT_texture_sRGB = _glewSearchExtension("GL_EXT_texture_sRGB", extStart, extEnd); +#endif /* GL_EXT_texture_sRGB */ +#ifdef GL_EXT_texture_sRGB_decode + GLEW_EXT_texture_sRGB_decode = _glewSearchExtension("GL_EXT_texture_sRGB_decode", extStart, extEnd); +#endif /* GL_EXT_texture_sRGB_decode */ +#ifdef GL_EXT_texture_shared_exponent + GLEW_EXT_texture_shared_exponent = _glewSearchExtension("GL_EXT_texture_shared_exponent", extStart, extEnd); +#endif /* GL_EXT_texture_shared_exponent */ +#ifdef GL_EXT_texture_snorm + GLEW_EXT_texture_snorm = _glewSearchExtension("GL_EXT_texture_snorm", extStart, extEnd); +#endif /* GL_EXT_texture_snorm */ +#ifdef GL_EXT_texture_swizzle + GLEW_EXT_texture_swizzle = _glewSearchExtension("GL_EXT_texture_swizzle", extStart, extEnd); +#endif /* GL_EXT_texture_swizzle */ +#ifdef GL_EXT_timer_query + GLEW_EXT_timer_query = _glewSearchExtension("GL_EXT_timer_query", extStart, extEnd); + if (glewExperimental || GLEW_EXT_timer_query) GLEW_EXT_timer_query = !_glewInit_GL_EXT_timer_query(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_timer_query */ +#ifdef GL_EXT_transform_feedback + GLEW_EXT_transform_feedback = _glewSearchExtension("GL_EXT_transform_feedback", extStart, extEnd); + if (glewExperimental || GLEW_EXT_transform_feedback) GLEW_EXT_transform_feedback = !_glewInit_GL_EXT_transform_feedback(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_transform_feedback */ +#ifdef GL_EXT_vertex_array + GLEW_EXT_vertex_array = _glewSearchExtension("GL_EXT_vertex_array", extStart, extEnd); + if (glewExperimental || GLEW_EXT_vertex_array) GLEW_EXT_vertex_array = !_glewInit_GL_EXT_vertex_array(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_vertex_array */ +#ifdef GL_EXT_vertex_array_bgra + GLEW_EXT_vertex_array_bgra = _glewSearchExtension("GL_EXT_vertex_array_bgra", extStart, extEnd); +#endif /* GL_EXT_vertex_array_bgra */ +#ifdef GL_EXT_vertex_attrib_64bit + GLEW_EXT_vertex_attrib_64bit = _glewSearchExtension("GL_EXT_vertex_attrib_64bit", extStart, extEnd); + if (glewExperimental || GLEW_EXT_vertex_attrib_64bit) GLEW_EXT_vertex_attrib_64bit = !_glewInit_GL_EXT_vertex_attrib_64bit(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_vertex_attrib_64bit */ +#ifdef GL_EXT_vertex_shader + GLEW_EXT_vertex_shader = _glewSearchExtension("GL_EXT_vertex_shader", extStart, extEnd); + if (glewExperimental || GLEW_EXT_vertex_shader) GLEW_EXT_vertex_shader = !_glewInit_GL_EXT_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_vertex_shader */ +#ifdef GL_EXT_vertex_weighting + GLEW_EXT_vertex_weighting = _glewSearchExtension("GL_EXT_vertex_weighting", extStart, extEnd); + if (glewExperimental || GLEW_EXT_vertex_weighting) GLEW_EXT_vertex_weighting = !_glewInit_GL_EXT_vertex_weighting(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_vertex_weighting */ +#ifdef GL_EXT_x11_sync_object + GLEW_EXT_x11_sync_object = _glewSearchExtension("GL_EXT_x11_sync_object", extStart, extEnd); + if (glewExperimental || GLEW_EXT_x11_sync_object) GLEW_EXT_x11_sync_object = !_glewInit_GL_EXT_x11_sync_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_x11_sync_object */ +#ifdef GL_GREMEDY_frame_terminator + GLEW_GREMEDY_frame_terminator = _glewSearchExtension("GL_GREMEDY_frame_terminator", extStart, extEnd); + if (glewExperimental || GLEW_GREMEDY_frame_terminator) GLEW_GREMEDY_frame_terminator = !_glewInit_GL_GREMEDY_frame_terminator(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_GREMEDY_frame_terminator */ +#ifdef GL_GREMEDY_string_marker + GLEW_GREMEDY_string_marker = _glewSearchExtension("GL_GREMEDY_string_marker", extStart, extEnd); + if (glewExperimental || GLEW_GREMEDY_string_marker) GLEW_GREMEDY_string_marker = !_glewInit_GL_GREMEDY_string_marker(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_GREMEDY_string_marker */ +#ifdef GL_HP_convolution_border_modes + GLEW_HP_convolution_border_modes = _glewSearchExtension("GL_HP_convolution_border_modes", extStart, extEnd); +#endif /* GL_HP_convolution_border_modes */ +#ifdef GL_HP_image_transform + GLEW_HP_image_transform = _glewSearchExtension("GL_HP_image_transform", extStart, extEnd); + if (glewExperimental || GLEW_HP_image_transform) GLEW_HP_image_transform = !_glewInit_GL_HP_image_transform(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_HP_image_transform */ +#ifdef GL_HP_occlusion_test + GLEW_HP_occlusion_test = _glewSearchExtension("GL_HP_occlusion_test", extStart, extEnd); +#endif /* GL_HP_occlusion_test */ +#ifdef GL_HP_texture_lighting + GLEW_HP_texture_lighting = _glewSearchExtension("GL_HP_texture_lighting", extStart, extEnd); +#endif /* GL_HP_texture_lighting */ +#ifdef GL_IBM_cull_vertex + GLEW_IBM_cull_vertex = _glewSearchExtension("GL_IBM_cull_vertex", extStart, extEnd); +#endif /* GL_IBM_cull_vertex */ +#ifdef GL_IBM_multimode_draw_arrays + GLEW_IBM_multimode_draw_arrays = _glewSearchExtension("GL_IBM_multimode_draw_arrays", extStart, extEnd); + if (glewExperimental || GLEW_IBM_multimode_draw_arrays) GLEW_IBM_multimode_draw_arrays = !_glewInit_GL_IBM_multimode_draw_arrays(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_IBM_multimode_draw_arrays */ +#ifdef GL_IBM_rasterpos_clip + GLEW_IBM_rasterpos_clip = _glewSearchExtension("GL_IBM_rasterpos_clip", extStart, extEnd); +#endif /* GL_IBM_rasterpos_clip */ +#ifdef GL_IBM_static_data + GLEW_IBM_static_data = _glewSearchExtension("GL_IBM_static_data", extStart, extEnd); +#endif /* GL_IBM_static_data */ +#ifdef GL_IBM_texture_mirrored_repeat + GLEW_IBM_texture_mirrored_repeat = _glewSearchExtension("GL_IBM_texture_mirrored_repeat", extStart, extEnd); +#endif /* GL_IBM_texture_mirrored_repeat */ +#ifdef GL_IBM_vertex_array_lists + GLEW_IBM_vertex_array_lists = _glewSearchExtension("GL_IBM_vertex_array_lists", extStart, extEnd); + if (glewExperimental || GLEW_IBM_vertex_array_lists) GLEW_IBM_vertex_array_lists = !_glewInit_GL_IBM_vertex_array_lists(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_IBM_vertex_array_lists */ +#ifdef GL_INGR_color_clamp + GLEW_INGR_color_clamp = _glewSearchExtension("GL_INGR_color_clamp", extStart, extEnd); +#endif /* GL_INGR_color_clamp */ +#ifdef GL_INGR_interlace_read + GLEW_INGR_interlace_read = _glewSearchExtension("GL_INGR_interlace_read", extStart, extEnd); +#endif /* GL_INGR_interlace_read */ +#ifdef GL_INTEL_fragment_shader_ordering + GLEW_INTEL_fragment_shader_ordering = _glewSearchExtension("GL_INTEL_fragment_shader_ordering", extStart, extEnd); +#endif /* GL_INTEL_fragment_shader_ordering */ +#ifdef GL_INTEL_framebuffer_CMAA + GLEW_INTEL_framebuffer_CMAA = _glewSearchExtension("GL_INTEL_framebuffer_CMAA", extStart, extEnd); +#endif /* GL_INTEL_framebuffer_CMAA */ +#ifdef GL_INTEL_map_texture + GLEW_INTEL_map_texture = _glewSearchExtension("GL_INTEL_map_texture", extStart, extEnd); + if (glewExperimental || GLEW_INTEL_map_texture) GLEW_INTEL_map_texture = !_glewInit_GL_INTEL_map_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_INTEL_map_texture */ +#ifdef GL_INTEL_parallel_arrays + GLEW_INTEL_parallel_arrays = _glewSearchExtension("GL_INTEL_parallel_arrays", extStart, extEnd); + if (glewExperimental || GLEW_INTEL_parallel_arrays) GLEW_INTEL_parallel_arrays = !_glewInit_GL_INTEL_parallel_arrays(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_INTEL_parallel_arrays */ +#ifdef GL_INTEL_performance_query + GLEW_INTEL_performance_query = _glewSearchExtension("GL_INTEL_performance_query", extStart, extEnd); + if (glewExperimental || GLEW_INTEL_performance_query) GLEW_INTEL_performance_query = !_glewInit_GL_INTEL_performance_query(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_INTEL_performance_query */ +#ifdef GL_INTEL_texture_scissor + GLEW_INTEL_texture_scissor = _glewSearchExtension("GL_INTEL_texture_scissor", extStart, extEnd); + if (glewExperimental || GLEW_INTEL_texture_scissor) GLEW_INTEL_texture_scissor = !_glewInit_GL_INTEL_texture_scissor(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_INTEL_texture_scissor */ +#ifdef GL_KHR_blend_equation_advanced + GLEW_KHR_blend_equation_advanced = _glewSearchExtension("GL_KHR_blend_equation_advanced", extStart, extEnd); + if (glewExperimental || GLEW_KHR_blend_equation_advanced) GLEW_KHR_blend_equation_advanced = !_glewInit_GL_KHR_blend_equation_advanced(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_KHR_blend_equation_advanced */ +#ifdef GL_KHR_blend_equation_advanced_coherent + GLEW_KHR_blend_equation_advanced_coherent = _glewSearchExtension("GL_KHR_blend_equation_advanced_coherent", extStart, extEnd); +#endif /* GL_KHR_blend_equation_advanced_coherent */ +#ifdef GL_KHR_context_flush_control + GLEW_KHR_context_flush_control = _glewSearchExtension("GL_KHR_context_flush_control", extStart, extEnd); +#endif /* GL_KHR_context_flush_control */ +#ifdef GL_KHR_debug + GLEW_KHR_debug = _glewSearchExtension("GL_KHR_debug", extStart, extEnd); + if (glewExperimental || GLEW_KHR_debug) GLEW_KHR_debug = !_glewInit_GL_KHR_debug(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_KHR_debug */ +#ifdef GL_KHR_no_error + GLEW_KHR_no_error = _glewSearchExtension("GL_KHR_no_error", extStart, extEnd); +#endif /* GL_KHR_no_error */ +#ifdef GL_KHR_robust_buffer_access_behavior + GLEW_KHR_robust_buffer_access_behavior = _glewSearchExtension("GL_KHR_robust_buffer_access_behavior", extStart, extEnd); +#endif /* GL_KHR_robust_buffer_access_behavior */ +#ifdef GL_KHR_robustness + GLEW_KHR_robustness = _glewSearchExtension("GL_KHR_robustness", extStart, extEnd); + if (glewExperimental || GLEW_KHR_robustness) GLEW_KHR_robustness = !_glewInit_GL_KHR_robustness(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_KHR_robustness */ +#ifdef GL_KHR_texture_compression_astc_hdr + GLEW_KHR_texture_compression_astc_hdr = _glewSearchExtension("GL_KHR_texture_compression_astc_hdr", extStart, extEnd); +#endif /* GL_KHR_texture_compression_astc_hdr */ +#ifdef GL_KHR_texture_compression_astc_ldr + GLEW_KHR_texture_compression_astc_ldr = _glewSearchExtension("GL_KHR_texture_compression_astc_ldr", extStart, extEnd); +#endif /* GL_KHR_texture_compression_astc_ldr */ +#ifdef GL_KTX_buffer_region + GLEW_KTX_buffer_region = _glewSearchExtension("GL_KTX_buffer_region", extStart, extEnd); + if (glewExperimental || GLEW_KTX_buffer_region) GLEW_KTX_buffer_region = !_glewInit_GL_KTX_buffer_region(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_KTX_buffer_region */ +#ifdef GL_MESAX_texture_stack + GLEW_MESAX_texture_stack = _glewSearchExtension("GL_MESAX_texture_stack", extStart, extEnd); +#endif /* GL_MESAX_texture_stack */ +#ifdef GL_MESA_pack_invert + GLEW_MESA_pack_invert = _glewSearchExtension("GL_MESA_pack_invert", extStart, extEnd); +#endif /* GL_MESA_pack_invert */ +#ifdef GL_MESA_resize_buffers + GLEW_MESA_resize_buffers = _glewSearchExtension("GL_MESA_resize_buffers", extStart, extEnd); + if (glewExperimental || GLEW_MESA_resize_buffers) GLEW_MESA_resize_buffers = !_glewInit_GL_MESA_resize_buffers(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_MESA_resize_buffers */ +#ifdef GL_MESA_window_pos + GLEW_MESA_window_pos = _glewSearchExtension("GL_MESA_window_pos", extStart, extEnd); + if (glewExperimental || GLEW_MESA_window_pos) GLEW_MESA_window_pos = !_glewInit_GL_MESA_window_pos(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_MESA_window_pos */ +#ifdef GL_MESA_ycbcr_texture + GLEW_MESA_ycbcr_texture = _glewSearchExtension("GL_MESA_ycbcr_texture", extStart, extEnd); +#endif /* GL_MESA_ycbcr_texture */ +#ifdef GL_NVX_conditional_render + GLEW_NVX_conditional_render = _glewSearchExtension("GL_NVX_conditional_render", extStart, extEnd); + if (glewExperimental || GLEW_NVX_conditional_render) GLEW_NVX_conditional_render = !_glewInit_GL_NVX_conditional_render(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NVX_conditional_render */ +#ifdef GL_NVX_gpu_memory_info + GLEW_NVX_gpu_memory_info = _glewSearchExtension("GL_NVX_gpu_memory_info", extStart, extEnd); +#endif /* GL_NVX_gpu_memory_info */ +#ifdef GL_NV_bindless_multi_draw_indirect + GLEW_NV_bindless_multi_draw_indirect = _glewSearchExtension("GL_NV_bindless_multi_draw_indirect", extStart, extEnd); + if (glewExperimental || GLEW_NV_bindless_multi_draw_indirect) GLEW_NV_bindless_multi_draw_indirect = !_glewInit_GL_NV_bindless_multi_draw_indirect(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_bindless_multi_draw_indirect */ +#ifdef GL_NV_bindless_multi_draw_indirect_count + GLEW_NV_bindless_multi_draw_indirect_count = _glewSearchExtension("GL_NV_bindless_multi_draw_indirect_count", extStart, extEnd); + if (glewExperimental || GLEW_NV_bindless_multi_draw_indirect_count) GLEW_NV_bindless_multi_draw_indirect_count = !_glewInit_GL_NV_bindless_multi_draw_indirect_count(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_bindless_multi_draw_indirect_count */ +#ifdef GL_NV_bindless_texture + GLEW_NV_bindless_texture = _glewSearchExtension("GL_NV_bindless_texture", extStart, extEnd); + if (glewExperimental || GLEW_NV_bindless_texture) GLEW_NV_bindless_texture = !_glewInit_GL_NV_bindless_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_bindless_texture */ +#ifdef GL_NV_blend_equation_advanced + GLEW_NV_blend_equation_advanced = _glewSearchExtension("GL_NV_blend_equation_advanced", extStart, extEnd); + if (glewExperimental || GLEW_NV_blend_equation_advanced) GLEW_NV_blend_equation_advanced = !_glewInit_GL_NV_blend_equation_advanced(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_blend_equation_advanced */ +#ifdef GL_NV_blend_equation_advanced_coherent + GLEW_NV_blend_equation_advanced_coherent = _glewSearchExtension("GL_NV_blend_equation_advanced_coherent", extStart, extEnd); +#endif /* GL_NV_blend_equation_advanced_coherent */ +#ifdef GL_NV_blend_square + GLEW_NV_blend_square = _glewSearchExtension("GL_NV_blend_square", extStart, extEnd); +#endif /* GL_NV_blend_square */ +#ifdef GL_NV_compute_program5 + GLEW_NV_compute_program5 = _glewSearchExtension("GL_NV_compute_program5", extStart, extEnd); +#endif /* GL_NV_compute_program5 */ +#ifdef GL_NV_conditional_render + GLEW_NV_conditional_render = _glewSearchExtension("GL_NV_conditional_render", extStart, extEnd); + if (glewExperimental || GLEW_NV_conditional_render) GLEW_NV_conditional_render = !_glewInit_GL_NV_conditional_render(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_conditional_render */ +#ifdef GL_NV_conservative_raster + GLEW_NV_conservative_raster = _glewSearchExtension("GL_NV_conservative_raster", extStart, extEnd); + if (glewExperimental || GLEW_NV_conservative_raster) GLEW_NV_conservative_raster = !_glewInit_GL_NV_conservative_raster(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_conservative_raster */ +#ifdef GL_NV_conservative_raster_dilate + GLEW_NV_conservative_raster_dilate = _glewSearchExtension("GL_NV_conservative_raster_dilate", extStart, extEnd); + if (glewExperimental || GLEW_NV_conservative_raster_dilate) GLEW_NV_conservative_raster_dilate = !_glewInit_GL_NV_conservative_raster_dilate(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_conservative_raster_dilate */ +#ifdef GL_NV_copy_depth_to_color + GLEW_NV_copy_depth_to_color = _glewSearchExtension("GL_NV_copy_depth_to_color", extStart, extEnd); +#endif /* GL_NV_copy_depth_to_color */ +#ifdef GL_NV_copy_image + GLEW_NV_copy_image = _glewSearchExtension("GL_NV_copy_image", extStart, extEnd); + if (glewExperimental || GLEW_NV_copy_image) GLEW_NV_copy_image = !_glewInit_GL_NV_copy_image(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_copy_image */ +#ifdef GL_NV_deep_texture3D + GLEW_NV_deep_texture3D = _glewSearchExtension("GL_NV_deep_texture3D", extStart, extEnd); +#endif /* GL_NV_deep_texture3D */ +#ifdef GL_NV_depth_buffer_float + GLEW_NV_depth_buffer_float = _glewSearchExtension("GL_NV_depth_buffer_float", extStart, extEnd); + if (glewExperimental || GLEW_NV_depth_buffer_float) GLEW_NV_depth_buffer_float = !_glewInit_GL_NV_depth_buffer_float(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_depth_buffer_float */ +#ifdef GL_NV_depth_clamp + GLEW_NV_depth_clamp = _glewSearchExtension("GL_NV_depth_clamp", extStart, extEnd); +#endif /* GL_NV_depth_clamp */ +#ifdef GL_NV_depth_range_unclamped + GLEW_NV_depth_range_unclamped = _glewSearchExtension("GL_NV_depth_range_unclamped", extStart, extEnd); +#endif /* GL_NV_depth_range_unclamped */ +#ifdef GL_NV_draw_texture + GLEW_NV_draw_texture = _glewSearchExtension("GL_NV_draw_texture", extStart, extEnd); + if (glewExperimental || GLEW_NV_draw_texture) GLEW_NV_draw_texture = !_glewInit_GL_NV_draw_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_draw_texture */ +#ifdef GL_NV_evaluators + GLEW_NV_evaluators = _glewSearchExtension("GL_NV_evaluators", extStart, extEnd); + if (glewExperimental || GLEW_NV_evaluators) GLEW_NV_evaluators = !_glewInit_GL_NV_evaluators(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_evaluators */ +#ifdef GL_NV_explicit_multisample + GLEW_NV_explicit_multisample = _glewSearchExtension("GL_NV_explicit_multisample", extStart, extEnd); + if (glewExperimental || GLEW_NV_explicit_multisample) GLEW_NV_explicit_multisample = !_glewInit_GL_NV_explicit_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_explicit_multisample */ +#ifdef GL_NV_fence + GLEW_NV_fence = _glewSearchExtension("GL_NV_fence", extStart, extEnd); + if (glewExperimental || GLEW_NV_fence) GLEW_NV_fence = !_glewInit_GL_NV_fence(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_fence */ +#ifdef GL_NV_fill_rectangle + GLEW_NV_fill_rectangle = _glewSearchExtension("GL_NV_fill_rectangle", extStart, extEnd); +#endif /* GL_NV_fill_rectangle */ +#ifdef GL_NV_float_buffer + GLEW_NV_float_buffer = _glewSearchExtension("GL_NV_float_buffer", extStart, extEnd); +#endif /* GL_NV_float_buffer */ +#ifdef GL_NV_fog_distance + GLEW_NV_fog_distance = _glewSearchExtension("GL_NV_fog_distance", extStart, extEnd); +#endif /* GL_NV_fog_distance */ +#ifdef GL_NV_fragment_coverage_to_color + GLEW_NV_fragment_coverage_to_color = _glewSearchExtension("GL_NV_fragment_coverage_to_color", extStart, extEnd); + if (glewExperimental || GLEW_NV_fragment_coverage_to_color) GLEW_NV_fragment_coverage_to_color = !_glewInit_GL_NV_fragment_coverage_to_color(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_fragment_coverage_to_color */ +#ifdef GL_NV_fragment_program + GLEW_NV_fragment_program = _glewSearchExtension("GL_NV_fragment_program", extStart, extEnd); + if (glewExperimental || GLEW_NV_fragment_program) GLEW_NV_fragment_program = !_glewInit_GL_NV_fragment_program(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_fragment_program */ +#ifdef GL_NV_fragment_program2 + GLEW_NV_fragment_program2 = _glewSearchExtension("GL_NV_fragment_program2", extStart, extEnd); +#endif /* GL_NV_fragment_program2 */ +#ifdef GL_NV_fragment_program4 + GLEW_NV_fragment_program4 = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); +#endif /* GL_NV_fragment_program4 */ +#ifdef GL_NV_fragment_program_option + GLEW_NV_fragment_program_option = _glewSearchExtension("GL_NV_fragment_program_option", extStart, extEnd); +#endif /* GL_NV_fragment_program_option */ +#ifdef GL_NV_fragment_shader_interlock + GLEW_NV_fragment_shader_interlock = _glewSearchExtension("GL_NV_fragment_shader_interlock", extStart, extEnd); +#endif /* GL_NV_fragment_shader_interlock */ +#ifdef GL_NV_framebuffer_mixed_samples + GLEW_NV_framebuffer_mixed_samples = _glewSearchExtension("GL_NV_framebuffer_mixed_samples", extStart, extEnd); +#endif /* GL_NV_framebuffer_mixed_samples */ +#ifdef GL_NV_framebuffer_multisample_coverage + GLEW_NV_framebuffer_multisample_coverage = _glewSearchExtension("GL_NV_framebuffer_multisample_coverage", extStart, extEnd); + if (glewExperimental || GLEW_NV_framebuffer_multisample_coverage) GLEW_NV_framebuffer_multisample_coverage = !_glewInit_GL_NV_framebuffer_multisample_coverage(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_framebuffer_multisample_coverage */ +#ifdef GL_NV_geometry_program4 + GLEW_NV_geometry_program4 = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); + if (glewExperimental || GLEW_NV_geometry_program4) GLEW_NV_geometry_program4 = !_glewInit_GL_NV_geometry_program4(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_geometry_program4 */ +#ifdef GL_NV_geometry_shader4 + GLEW_NV_geometry_shader4 = _glewSearchExtension("GL_NV_geometry_shader4", extStart, extEnd); +#endif /* GL_NV_geometry_shader4 */ +#ifdef GL_NV_geometry_shader_passthrough + GLEW_NV_geometry_shader_passthrough = _glewSearchExtension("GL_NV_geometry_shader_passthrough", extStart, extEnd); +#endif /* GL_NV_geometry_shader_passthrough */ +#ifdef GL_NV_gpu_program4 + GLEW_NV_gpu_program4 = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); + if (glewExperimental || GLEW_NV_gpu_program4) GLEW_NV_gpu_program4 = !_glewInit_GL_NV_gpu_program4(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_gpu_program4 */ +#ifdef GL_NV_gpu_program5 + GLEW_NV_gpu_program5 = _glewSearchExtension("GL_NV_gpu_program5", extStart, extEnd); +#endif /* GL_NV_gpu_program5 */ +#ifdef GL_NV_gpu_program5_mem_extended + GLEW_NV_gpu_program5_mem_extended = _glewSearchExtension("GL_NV_gpu_program5_mem_extended", extStart, extEnd); +#endif /* GL_NV_gpu_program5_mem_extended */ +#ifdef GL_NV_gpu_program_fp64 + GLEW_NV_gpu_program_fp64 = _glewSearchExtension("GL_NV_gpu_program_fp64", extStart, extEnd); +#endif /* GL_NV_gpu_program_fp64 */ +#ifdef GL_NV_gpu_shader5 + GLEW_NV_gpu_shader5 = _glewSearchExtension("GL_NV_gpu_shader5", extStart, extEnd); + if (glewExperimental || GLEW_NV_gpu_shader5) GLEW_NV_gpu_shader5 = !_glewInit_GL_NV_gpu_shader5(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_gpu_shader5 */ +#ifdef GL_NV_half_float + GLEW_NV_half_float = _glewSearchExtension("GL_NV_half_float", extStart, extEnd); + if (glewExperimental || GLEW_NV_half_float) GLEW_NV_half_float = !_glewInit_GL_NV_half_float(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_half_float */ +#ifdef GL_NV_internalformat_sample_query + GLEW_NV_internalformat_sample_query = _glewSearchExtension("GL_NV_internalformat_sample_query", extStart, extEnd); + if (glewExperimental || GLEW_NV_internalformat_sample_query) GLEW_NV_internalformat_sample_query = !_glewInit_GL_NV_internalformat_sample_query(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_internalformat_sample_query */ +#ifdef GL_NV_light_max_exponent + GLEW_NV_light_max_exponent = _glewSearchExtension("GL_NV_light_max_exponent", extStart, extEnd); +#endif /* GL_NV_light_max_exponent */ +#ifdef GL_NV_multisample_coverage + GLEW_NV_multisample_coverage = _glewSearchExtension("GL_NV_multisample_coverage", extStart, extEnd); +#endif /* GL_NV_multisample_coverage */ +#ifdef GL_NV_multisample_filter_hint + GLEW_NV_multisample_filter_hint = _glewSearchExtension("GL_NV_multisample_filter_hint", extStart, extEnd); +#endif /* GL_NV_multisample_filter_hint */ +#ifdef GL_NV_occlusion_query + GLEW_NV_occlusion_query = _glewSearchExtension("GL_NV_occlusion_query", extStart, extEnd); + if (glewExperimental || GLEW_NV_occlusion_query) GLEW_NV_occlusion_query = !_glewInit_GL_NV_occlusion_query(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_occlusion_query */ +#ifdef GL_NV_packed_depth_stencil + GLEW_NV_packed_depth_stencil = _glewSearchExtension("GL_NV_packed_depth_stencil", extStart, extEnd); +#endif /* GL_NV_packed_depth_stencil */ +#ifdef GL_NV_parameter_buffer_object + GLEW_NV_parameter_buffer_object = _glewSearchExtension("GL_NV_parameter_buffer_object", extStart, extEnd); + if (glewExperimental || GLEW_NV_parameter_buffer_object) GLEW_NV_parameter_buffer_object = !_glewInit_GL_NV_parameter_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_parameter_buffer_object */ +#ifdef GL_NV_parameter_buffer_object2 + GLEW_NV_parameter_buffer_object2 = _glewSearchExtension("GL_NV_parameter_buffer_object2", extStart, extEnd); +#endif /* GL_NV_parameter_buffer_object2 */ +#ifdef GL_NV_path_rendering + GLEW_NV_path_rendering = _glewSearchExtension("GL_NV_path_rendering", extStart, extEnd); + if (glewExperimental || GLEW_NV_path_rendering) GLEW_NV_path_rendering = !_glewInit_GL_NV_path_rendering(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_path_rendering */ +#ifdef GL_NV_path_rendering_shared_edge + GLEW_NV_path_rendering_shared_edge = _glewSearchExtension("GL_NV_path_rendering_shared_edge", extStart, extEnd); +#endif /* GL_NV_path_rendering_shared_edge */ +#ifdef GL_NV_pixel_data_range + GLEW_NV_pixel_data_range = _glewSearchExtension("GL_NV_pixel_data_range", extStart, extEnd); + if (glewExperimental || GLEW_NV_pixel_data_range) GLEW_NV_pixel_data_range = !_glewInit_GL_NV_pixel_data_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_pixel_data_range */ +#ifdef GL_NV_point_sprite + GLEW_NV_point_sprite = _glewSearchExtension("GL_NV_point_sprite", extStart, extEnd); + if (glewExperimental || GLEW_NV_point_sprite) GLEW_NV_point_sprite = !_glewInit_GL_NV_point_sprite(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_point_sprite */ +#ifdef GL_NV_present_video + GLEW_NV_present_video = _glewSearchExtension("GL_NV_present_video", extStart, extEnd); + if (glewExperimental || GLEW_NV_present_video) GLEW_NV_present_video = !_glewInit_GL_NV_present_video(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_present_video */ +#ifdef GL_NV_primitive_restart + GLEW_NV_primitive_restart = _glewSearchExtension("GL_NV_primitive_restart", extStart, extEnd); + if (glewExperimental || GLEW_NV_primitive_restart) GLEW_NV_primitive_restart = !_glewInit_GL_NV_primitive_restart(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_primitive_restart */ +#ifdef GL_NV_register_combiners + GLEW_NV_register_combiners = _glewSearchExtension("GL_NV_register_combiners", extStart, extEnd); + if (glewExperimental || GLEW_NV_register_combiners) GLEW_NV_register_combiners = !_glewInit_GL_NV_register_combiners(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_register_combiners */ +#ifdef GL_NV_register_combiners2 + GLEW_NV_register_combiners2 = _glewSearchExtension("GL_NV_register_combiners2", extStart, extEnd); + if (glewExperimental || GLEW_NV_register_combiners2) GLEW_NV_register_combiners2 = !_glewInit_GL_NV_register_combiners2(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_register_combiners2 */ +#ifdef GL_NV_sample_locations + GLEW_NV_sample_locations = _glewSearchExtension("GL_NV_sample_locations", extStart, extEnd); + if (glewExperimental || GLEW_NV_sample_locations) GLEW_NV_sample_locations = !_glewInit_GL_NV_sample_locations(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_sample_locations */ +#ifdef GL_NV_sample_mask_override_coverage + GLEW_NV_sample_mask_override_coverage = _glewSearchExtension("GL_NV_sample_mask_override_coverage", extStart, extEnd); +#endif /* GL_NV_sample_mask_override_coverage */ +#ifdef GL_NV_shader_atomic_counters + GLEW_NV_shader_atomic_counters = _glewSearchExtension("GL_NV_shader_atomic_counters", extStart, extEnd); +#endif /* GL_NV_shader_atomic_counters */ +#ifdef GL_NV_shader_atomic_float + GLEW_NV_shader_atomic_float = _glewSearchExtension("GL_NV_shader_atomic_float", extStart, extEnd); +#endif /* GL_NV_shader_atomic_float */ +#ifdef GL_NV_shader_atomic_fp16_vector + GLEW_NV_shader_atomic_fp16_vector = _glewSearchExtension("GL_NV_shader_atomic_fp16_vector", extStart, extEnd); +#endif /* GL_NV_shader_atomic_fp16_vector */ +#ifdef GL_NV_shader_atomic_int64 + GLEW_NV_shader_atomic_int64 = _glewSearchExtension("GL_NV_shader_atomic_int64", extStart, extEnd); +#endif /* GL_NV_shader_atomic_int64 */ +#ifdef GL_NV_shader_buffer_load + GLEW_NV_shader_buffer_load = _glewSearchExtension("GL_NV_shader_buffer_load", extStart, extEnd); + if (glewExperimental || GLEW_NV_shader_buffer_load) GLEW_NV_shader_buffer_load = !_glewInit_GL_NV_shader_buffer_load(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_shader_buffer_load */ +#ifdef GL_NV_shader_storage_buffer_object + GLEW_NV_shader_storage_buffer_object = _glewSearchExtension("GL_NV_shader_storage_buffer_object", extStart, extEnd); +#endif /* GL_NV_shader_storage_buffer_object */ +#ifdef GL_NV_shader_thread_group + GLEW_NV_shader_thread_group = _glewSearchExtension("GL_NV_shader_thread_group", extStart, extEnd); +#endif /* GL_NV_shader_thread_group */ +#ifdef GL_NV_shader_thread_shuffle + GLEW_NV_shader_thread_shuffle = _glewSearchExtension("GL_NV_shader_thread_shuffle", extStart, extEnd); +#endif /* GL_NV_shader_thread_shuffle */ +#ifdef GL_NV_tessellation_program5 + GLEW_NV_tessellation_program5 = _glewSearchExtension("GL_NV_gpu_program5", extStart, extEnd); +#endif /* GL_NV_tessellation_program5 */ +#ifdef GL_NV_texgen_emboss + GLEW_NV_texgen_emboss = _glewSearchExtension("GL_NV_texgen_emboss", extStart, extEnd); +#endif /* GL_NV_texgen_emboss */ +#ifdef GL_NV_texgen_reflection + GLEW_NV_texgen_reflection = _glewSearchExtension("GL_NV_texgen_reflection", extStart, extEnd); +#endif /* GL_NV_texgen_reflection */ +#ifdef GL_NV_texture_barrier + GLEW_NV_texture_barrier = _glewSearchExtension("GL_NV_texture_barrier", extStart, extEnd); + if (glewExperimental || GLEW_NV_texture_barrier) GLEW_NV_texture_barrier = !_glewInit_GL_NV_texture_barrier(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_texture_barrier */ +#ifdef GL_NV_texture_compression_vtc + GLEW_NV_texture_compression_vtc = _glewSearchExtension("GL_NV_texture_compression_vtc", extStart, extEnd); +#endif /* GL_NV_texture_compression_vtc */ +#ifdef GL_NV_texture_env_combine4 + GLEW_NV_texture_env_combine4 = _glewSearchExtension("GL_NV_texture_env_combine4", extStart, extEnd); +#endif /* GL_NV_texture_env_combine4 */ +#ifdef GL_NV_texture_expand_normal + GLEW_NV_texture_expand_normal = _glewSearchExtension("GL_NV_texture_expand_normal", extStart, extEnd); +#endif /* GL_NV_texture_expand_normal */ +#ifdef GL_NV_texture_multisample + GLEW_NV_texture_multisample = _glewSearchExtension("GL_NV_texture_multisample", extStart, extEnd); + if (glewExperimental || GLEW_NV_texture_multisample) GLEW_NV_texture_multisample = !_glewInit_GL_NV_texture_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_texture_multisample */ +#ifdef GL_NV_texture_rectangle + GLEW_NV_texture_rectangle = _glewSearchExtension("GL_NV_texture_rectangle", extStart, extEnd); +#endif /* GL_NV_texture_rectangle */ +#ifdef GL_NV_texture_shader + GLEW_NV_texture_shader = _glewSearchExtension("GL_NV_texture_shader", extStart, extEnd); +#endif /* GL_NV_texture_shader */ +#ifdef GL_NV_texture_shader2 + GLEW_NV_texture_shader2 = _glewSearchExtension("GL_NV_texture_shader2", extStart, extEnd); +#endif /* GL_NV_texture_shader2 */ +#ifdef GL_NV_texture_shader3 + GLEW_NV_texture_shader3 = _glewSearchExtension("GL_NV_texture_shader3", extStart, extEnd); +#endif /* GL_NV_texture_shader3 */ +#ifdef GL_NV_transform_feedback + GLEW_NV_transform_feedback = _glewSearchExtension("GL_NV_transform_feedback", extStart, extEnd); + if (glewExperimental || GLEW_NV_transform_feedback) GLEW_NV_transform_feedback = !_glewInit_GL_NV_transform_feedback(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_transform_feedback */ +#ifdef GL_NV_transform_feedback2 + GLEW_NV_transform_feedback2 = _glewSearchExtension("GL_NV_transform_feedback2", extStart, extEnd); + if (glewExperimental || GLEW_NV_transform_feedback2) GLEW_NV_transform_feedback2 = !_glewInit_GL_NV_transform_feedback2(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_transform_feedback2 */ +#ifdef GL_NV_uniform_buffer_unified_memory + GLEW_NV_uniform_buffer_unified_memory = _glewSearchExtension("GL_NV_uniform_buffer_unified_memory", extStart, extEnd); +#endif /* GL_NV_uniform_buffer_unified_memory */ +#ifdef GL_NV_vdpau_interop + GLEW_NV_vdpau_interop = _glewSearchExtension("GL_NV_vdpau_interop", extStart, extEnd); + if (glewExperimental || GLEW_NV_vdpau_interop) GLEW_NV_vdpau_interop = !_glewInit_GL_NV_vdpau_interop(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_vdpau_interop */ +#ifdef GL_NV_vertex_array_range + GLEW_NV_vertex_array_range = _glewSearchExtension("GL_NV_vertex_array_range", extStart, extEnd); + if (glewExperimental || GLEW_NV_vertex_array_range) GLEW_NV_vertex_array_range = !_glewInit_GL_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_vertex_array_range */ +#ifdef GL_NV_vertex_array_range2 + GLEW_NV_vertex_array_range2 = _glewSearchExtension("GL_NV_vertex_array_range2", extStart, extEnd); +#endif /* GL_NV_vertex_array_range2 */ +#ifdef GL_NV_vertex_attrib_integer_64bit + GLEW_NV_vertex_attrib_integer_64bit = _glewSearchExtension("GL_NV_vertex_attrib_integer_64bit", extStart, extEnd); + if (glewExperimental || GLEW_NV_vertex_attrib_integer_64bit) GLEW_NV_vertex_attrib_integer_64bit = !_glewInit_GL_NV_vertex_attrib_integer_64bit(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_vertex_attrib_integer_64bit */ +#ifdef GL_NV_vertex_buffer_unified_memory + GLEW_NV_vertex_buffer_unified_memory = _glewSearchExtension("GL_NV_vertex_buffer_unified_memory", extStart, extEnd); + if (glewExperimental || GLEW_NV_vertex_buffer_unified_memory) GLEW_NV_vertex_buffer_unified_memory = !_glewInit_GL_NV_vertex_buffer_unified_memory(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_vertex_buffer_unified_memory */ +#ifdef GL_NV_vertex_program + GLEW_NV_vertex_program = _glewSearchExtension("GL_NV_vertex_program", extStart, extEnd); + if (glewExperimental || GLEW_NV_vertex_program) GLEW_NV_vertex_program = !_glewInit_GL_NV_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_vertex_program */ +#ifdef GL_NV_vertex_program1_1 + GLEW_NV_vertex_program1_1 = _glewSearchExtension("GL_NV_vertex_program1_1", extStart, extEnd); +#endif /* GL_NV_vertex_program1_1 */ +#ifdef GL_NV_vertex_program2 + GLEW_NV_vertex_program2 = _glewSearchExtension("GL_NV_vertex_program2", extStart, extEnd); +#endif /* GL_NV_vertex_program2 */ +#ifdef GL_NV_vertex_program2_option + GLEW_NV_vertex_program2_option = _glewSearchExtension("GL_NV_vertex_program2_option", extStart, extEnd); +#endif /* GL_NV_vertex_program2_option */ +#ifdef GL_NV_vertex_program3 + GLEW_NV_vertex_program3 = _glewSearchExtension("GL_NV_vertex_program3", extStart, extEnd); +#endif /* GL_NV_vertex_program3 */ +#ifdef GL_NV_vertex_program4 + GLEW_NV_vertex_program4 = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); +#endif /* GL_NV_vertex_program4 */ +#ifdef GL_NV_video_capture + GLEW_NV_video_capture = _glewSearchExtension("GL_NV_video_capture", extStart, extEnd); + if (glewExperimental || GLEW_NV_video_capture) GLEW_NV_video_capture = !_glewInit_GL_NV_video_capture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_video_capture */ +#ifdef GL_NV_viewport_array2 + GLEW_NV_viewport_array2 = _glewSearchExtension("GL_NV_viewport_array2", extStart, extEnd); +#endif /* GL_NV_viewport_array2 */ +#ifdef GL_OES_byte_coordinates + GLEW_OES_byte_coordinates = _glewSearchExtension("GL_OES_byte_coordinates", extStart, extEnd); +#endif /* GL_OES_byte_coordinates */ +#ifdef GL_OES_compressed_paletted_texture + GLEW_OES_compressed_paletted_texture = _glewSearchExtension("GL_OES_compressed_paletted_texture", extStart, extEnd); +#endif /* GL_OES_compressed_paletted_texture */ +#ifdef GL_OES_read_format + GLEW_OES_read_format = _glewSearchExtension("GL_OES_read_format", extStart, extEnd); +#endif /* GL_OES_read_format */ +#ifdef GL_OES_single_precision + GLEW_OES_single_precision = _glewSearchExtension("GL_OES_single_precision", extStart, extEnd); + if (glewExperimental || GLEW_OES_single_precision) GLEW_OES_single_precision = !_glewInit_GL_OES_single_precision(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_OES_single_precision */ +#ifdef GL_OML_interlace + GLEW_OML_interlace = _glewSearchExtension("GL_OML_interlace", extStart, extEnd); +#endif /* GL_OML_interlace */ +#ifdef GL_OML_resample + GLEW_OML_resample = _glewSearchExtension("GL_OML_resample", extStart, extEnd); +#endif /* GL_OML_resample */ +#ifdef GL_OML_subsample + GLEW_OML_subsample = _glewSearchExtension("GL_OML_subsample", extStart, extEnd); +#endif /* GL_OML_subsample */ +#ifdef GL_OVR_multiview + GLEW_OVR_multiview = _glewSearchExtension("GL_OVR_multiview", extStart, extEnd); + if (glewExperimental || GLEW_OVR_multiview) GLEW_OVR_multiview = !_glewInit_GL_OVR_multiview(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_OVR_multiview */ +#ifdef GL_OVR_multiview2 + GLEW_OVR_multiview2 = _glewSearchExtension("GL_OVR_multiview2", extStart, extEnd); +#endif /* GL_OVR_multiview2 */ +#ifdef GL_PGI_misc_hints + GLEW_PGI_misc_hints = _glewSearchExtension("GL_PGI_misc_hints", extStart, extEnd); +#endif /* GL_PGI_misc_hints */ +#ifdef GL_PGI_vertex_hints + GLEW_PGI_vertex_hints = _glewSearchExtension("GL_PGI_vertex_hints", extStart, extEnd); +#endif /* GL_PGI_vertex_hints */ +#ifdef GL_REGAL_ES1_0_compatibility + GLEW_REGAL_ES1_0_compatibility = _glewSearchExtension("GL_REGAL_ES1_0_compatibility", extStart, extEnd); + if (glewExperimental || GLEW_REGAL_ES1_0_compatibility) GLEW_REGAL_ES1_0_compatibility = !_glewInit_GL_REGAL_ES1_0_compatibility(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_REGAL_ES1_0_compatibility */ +#ifdef GL_REGAL_ES1_1_compatibility + GLEW_REGAL_ES1_1_compatibility = _glewSearchExtension("GL_REGAL_ES1_1_compatibility", extStart, extEnd); + if (glewExperimental || GLEW_REGAL_ES1_1_compatibility) GLEW_REGAL_ES1_1_compatibility = !_glewInit_GL_REGAL_ES1_1_compatibility(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_REGAL_ES1_1_compatibility */ +#ifdef GL_REGAL_enable + GLEW_REGAL_enable = _glewSearchExtension("GL_REGAL_enable", extStart, extEnd); +#endif /* GL_REGAL_enable */ +#ifdef GL_REGAL_error_string + GLEW_REGAL_error_string = _glewSearchExtension("GL_REGAL_error_string", extStart, extEnd); + if (glewExperimental || GLEW_REGAL_error_string) GLEW_REGAL_error_string = !_glewInit_GL_REGAL_error_string(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_REGAL_error_string */ +#ifdef GL_REGAL_extension_query + GLEW_REGAL_extension_query = _glewSearchExtension("GL_REGAL_extension_query", extStart, extEnd); + if (glewExperimental || GLEW_REGAL_extension_query) GLEW_REGAL_extension_query = !_glewInit_GL_REGAL_extension_query(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_REGAL_extension_query */ +#ifdef GL_REGAL_log + GLEW_REGAL_log = _glewSearchExtension("GL_REGAL_log", extStart, extEnd); + if (glewExperimental || GLEW_REGAL_log) GLEW_REGAL_log = !_glewInit_GL_REGAL_log(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_REGAL_log */ +#ifdef GL_REGAL_proc_address + GLEW_REGAL_proc_address = _glewSearchExtension("GL_REGAL_proc_address", extStart, extEnd); + if (glewExperimental || GLEW_REGAL_proc_address) GLEW_REGAL_proc_address = !_glewInit_GL_REGAL_proc_address(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_REGAL_proc_address */ +#ifdef GL_REND_screen_coordinates + GLEW_REND_screen_coordinates = _glewSearchExtension("GL_REND_screen_coordinates", extStart, extEnd); +#endif /* GL_REND_screen_coordinates */ +#ifdef GL_S3_s3tc + GLEW_S3_s3tc = _glewSearchExtension("GL_S3_s3tc", extStart, extEnd); +#endif /* GL_S3_s3tc */ +#ifdef GL_SGIS_color_range + GLEW_SGIS_color_range = _glewSearchExtension("GL_SGIS_color_range", extStart, extEnd); +#endif /* GL_SGIS_color_range */ +#ifdef GL_SGIS_detail_texture + GLEW_SGIS_detail_texture = _glewSearchExtension("GL_SGIS_detail_texture", extStart, extEnd); + if (glewExperimental || GLEW_SGIS_detail_texture) GLEW_SGIS_detail_texture = !_glewInit_GL_SGIS_detail_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIS_detail_texture */ +#ifdef GL_SGIS_fog_function + GLEW_SGIS_fog_function = _glewSearchExtension("GL_SGIS_fog_function", extStart, extEnd); + if (glewExperimental || GLEW_SGIS_fog_function) GLEW_SGIS_fog_function = !_glewInit_GL_SGIS_fog_function(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIS_fog_function */ +#ifdef GL_SGIS_generate_mipmap + GLEW_SGIS_generate_mipmap = _glewSearchExtension("GL_SGIS_generate_mipmap", extStart, extEnd); +#endif /* GL_SGIS_generate_mipmap */ +#ifdef GL_SGIS_multisample + GLEW_SGIS_multisample = _glewSearchExtension("GL_SGIS_multisample", extStart, extEnd); + if (glewExperimental || GLEW_SGIS_multisample) GLEW_SGIS_multisample = !_glewInit_GL_SGIS_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIS_multisample */ +#ifdef GL_SGIS_pixel_texture + GLEW_SGIS_pixel_texture = _glewSearchExtension("GL_SGIS_pixel_texture", extStart, extEnd); +#endif /* GL_SGIS_pixel_texture */ +#ifdef GL_SGIS_point_line_texgen + GLEW_SGIS_point_line_texgen = _glewSearchExtension("GL_SGIS_point_line_texgen", extStart, extEnd); +#endif /* GL_SGIS_point_line_texgen */ +#ifdef GL_SGIS_sharpen_texture + GLEW_SGIS_sharpen_texture = _glewSearchExtension("GL_SGIS_sharpen_texture", extStart, extEnd); + if (glewExperimental || GLEW_SGIS_sharpen_texture) GLEW_SGIS_sharpen_texture = !_glewInit_GL_SGIS_sharpen_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIS_sharpen_texture */ +#ifdef GL_SGIS_texture4D + GLEW_SGIS_texture4D = _glewSearchExtension("GL_SGIS_texture4D", extStart, extEnd); + if (glewExperimental || GLEW_SGIS_texture4D) GLEW_SGIS_texture4D = !_glewInit_GL_SGIS_texture4D(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIS_texture4D */ +#ifdef GL_SGIS_texture_border_clamp + GLEW_SGIS_texture_border_clamp = _glewSearchExtension("GL_SGIS_texture_border_clamp", extStart, extEnd); +#endif /* GL_SGIS_texture_border_clamp */ +#ifdef GL_SGIS_texture_edge_clamp + GLEW_SGIS_texture_edge_clamp = _glewSearchExtension("GL_SGIS_texture_edge_clamp", extStart, extEnd); +#endif /* GL_SGIS_texture_edge_clamp */ +#ifdef GL_SGIS_texture_filter4 + GLEW_SGIS_texture_filter4 = _glewSearchExtension("GL_SGIS_texture_filter4", extStart, extEnd); + if (glewExperimental || GLEW_SGIS_texture_filter4) GLEW_SGIS_texture_filter4 = !_glewInit_GL_SGIS_texture_filter4(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIS_texture_filter4 */ +#ifdef GL_SGIS_texture_lod + GLEW_SGIS_texture_lod = _glewSearchExtension("GL_SGIS_texture_lod", extStart, extEnd); +#endif /* GL_SGIS_texture_lod */ +#ifdef GL_SGIS_texture_select + GLEW_SGIS_texture_select = _glewSearchExtension("GL_SGIS_texture_select", extStart, extEnd); +#endif /* GL_SGIS_texture_select */ +#ifdef GL_SGIX_async + GLEW_SGIX_async = _glewSearchExtension("GL_SGIX_async", extStart, extEnd); + if (glewExperimental || GLEW_SGIX_async) GLEW_SGIX_async = !_glewInit_GL_SGIX_async(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_async */ +#ifdef GL_SGIX_async_histogram + GLEW_SGIX_async_histogram = _glewSearchExtension("GL_SGIX_async_histogram", extStart, extEnd); +#endif /* GL_SGIX_async_histogram */ +#ifdef GL_SGIX_async_pixel + GLEW_SGIX_async_pixel = _glewSearchExtension("GL_SGIX_async_pixel", extStart, extEnd); +#endif /* GL_SGIX_async_pixel */ +#ifdef GL_SGIX_blend_alpha_minmax + GLEW_SGIX_blend_alpha_minmax = _glewSearchExtension("GL_SGIX_blend_alpha_minmax", extStart, extEnd); +#endif /* GL_SGIX_blend_alpha_minmax */ +#ifdef GL_SGIX_clipmap + GLEW_SGIX_clipmap = _glewSearchExtension("GL_SGIX_clipmap", extStart, extEnd); +#endif /* GL_SGIX_clipmap */ +#ifdef GL_SGIX_convolution_accuracy + GLEW_SGIX_convolution_accuracy = _glewSearchExtension("GL_SGIX_convolution_accuracy", extStart, extEnd); +#endif /* GL_SGIX_convolution_accuracy */ +#ifdef GL_SGIX_depth_texture + GLEW_SGIX_depth_texture = _glewSearchExtension("GL_SGIX_depth_texture", extStart, extEnd); +#endif /* GL_SGIX_depth_texture */ +#ifdef GL_SGIX_flush_raster + GLEW_SGIX_flush_raster = _glewSearchExtension("GL_SGIX_flush_raster", extStart, extEnd); + if (glewExperimental || GLEW_SGIX_flush_raster) GLEW_SGIX_flush_raster = !_glewInit_GL_SGIX_flush_raster(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_flush_raster */ +#ifdef GL_SGIX_fog_offset + GLEW_SGIX_fog_offset = _glewSearchExtension("GL_SGIX_fog_offset", extStart, extEnd); +#endif /* GL_SGIX_fog_offset */ +#ifdef GL_SGIX_fog_texture + GLEW_SGIX_fog_texture = _glewSearchExtension("GL_SGIX_fog_texture", extStart, extEnd); + if (glewExperimental || GLEW_SGIX_fog_texture) GLEW_SGIX_fog_texture = !_glewInit_GL_SGIX_fog_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_fog_texture */ +#ifdef GL_SGIX_fragment_specular_lighting + GLEW_SGIX_fragment_specular_lighting = _glewSearchExtension("GL_SGIX_fragment_specular_lighting", extStart, extEnd); + if (glewExperimental || GLEW_SGIX_fragment_specular_lighting) GLEW_SGIX_fragment_specular_lighting = !_glewInit_GL_SGIX_fragment_specular_lighting(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_fragment_specular_lighting */ +#ifdef GL_SGIX_framezoom + GLEW_SGIX_framezoom = _glewSearchExtension("GL_SGIX_framezoom", extStart, extEnd); + if (glewExperimental || GLEW_SGIX_framezoom) GLEW_SGIX_framezoom = !_glewInit_GL_SGIX_framezoom(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_framezoom */ +#ifdef GL_SGIX_interlace + GLEW_SGIX_interlace = _glewSearchExtension("GL_SGIX_interlace", extStart, extEnd); +#endif /* GL_SGIX_interlace */ +#ifdef GL_SGIX_ir_instrument1 + GLEW_SGIX_ir_instrument1 = _glewSearchExtension("GL_SGIX_ir_instrument1", extStart, extEnd); +#endif /* GL_SGIX_ir_instrument1 */ +#ifdef GL_SGIX_list_priority + GLEW_SGIX_list_priority = _glewSearchExtension("GL_SGIX_list_priority", extStart, extEnd); +#endif /* GL_SGIX_list_priority */ +#ifdef GL_SGIX_pixel_texture + GLEW_SGIX_pixel_texture = _glewSearchExtension("GL_SGIX_pixel_texture", extStart, extEnd); + if (glewExperimental || GLEW_SGIX_pixel_texture) GLEW_SGIX_pixel_texture = !_glewInit_GL_SGIX_pixel_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_pixel_texture */ +#ifdef GL_SGIX_pixel_texture_bits + GLEW_SGIX_pixel_texture_bits = _glewSearchExtension("GL_SGIX_pixel_texture_bits", extStart, extEnd); +#endif /* GL_SGIX_pixel_texture_bits */ +#ifdef GL_SGIX_reference_plane + GLEW_SGIX_reference_plane = _glewSearchExtension("GL_SGIX_reference_plane", extStart, extEnd); + if (glewExperimental || GLEW_SGIX_reference_plane) GLEW_SGIX_reference_plane = !_glewInit_GL_SGIX_reference_plane(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_reference_plane */ +#ifdef GL_SGIX_resample + GLEW_SGIX_resample = _glewSearchExtension("GL_SGIX_resample", extStart, extEnd); +#endif /* GL_SGIX_resample */ +#ifdef GL_SGIX_shadow + GLEW_SGIX_shadow = _glewSearchExtension("GL_SGIX_shadow", extStart, extEnd); +#endif /* GL_SGIX_shadow */ +#ifdef GL_SGIX_shadow_ambient + GLEW_SGIX_shadow_ambient = _glewSearchExtension("GL_SGIX_shadow_ambient", extStart, extEnd); +#endif /* GL_SGIX_shadow_ambient */ +#ifdef GL_SGIX_sprite + GLEW_SGIX_sprite = _glewSearchExtension("GL_SGIX_sprite", extStart, extEnd); + if (glewExperimental || GLEW_SGIX_sprite) GLEW_SGIX_sprite = !_glewInit_GL_SGIX_sprite(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_sprite */ +#ifdef GL_SGIX_tag_sample_buffer + GLEW_SGIX_tag_sample_buffer = _glewSearchExtension("GL_SGIX_tag_sample_buffer", extStart, extEnd); + if (glewExperimental || GLEW_SGIX_tag_sample_buffer) GLEW_SGIX_tag_sample_buffer = !_glewInit_GL_SGIX_tag_sample_buffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_tag_sample_buffer */ +#ifdef GL_SGIX_texture_add_env + GLEW_SGIX_texture_add_env = _glewSearchExtension("GL_SGIX_texture_add_env", extStart, extEnd); +#endif /* GL_SGIX_texture_add_env */ +#ifdef GL_SGIX_texture_coordinate_clamp + GLEW_SGIX_texture_coordinate_clamp = _glewSearchExtension("GL_SGIX_texture_coordinate_clamp", extStart, extEnd); +#endif /* GL_SGIX_texture_coordinate_clamp */ +#ifdef GL_SGIX_texture_lod_bias + GLEW_SGIX_texture_lod_bias = _glewSearchExtension("GL_SGIX_texture_lod_bias", extStart, extEnd); +#endif /* GL_SGIX_texture_lod_bias */ +#ifdef GL_SGIX_texture_multi_buffer + GLEW_SGIX_texture_multi_buffer = _glewSearchExtension("GL_SGIX_texture_multi_buffer", extStart, extEnd); +#endif /* GL_SGIX_texture_multi_buffer */ +#ifdef GL_SGIX_texture_range + GLEW_SGIX_texture_range = _glewSearchExtension("GL_SGIX_texture_range", extStart, extEnd); +#endif /* GL_SGIX_texture_range */ +#ifdef GL_SGIX_texture_scale_bias + GLEW_SGIX_texture_scale_bias = _glewSearchExtension("GL_SGIX_texture_scale_bias", extStart, extEnd); +#endif /* GL_SGIX_texture_scale_bias */ +#ifdef GL_SGIX_vertex_preclip + GLEW_SGIX_vertex_preclip = _glewSearchExtension("GL_SGIX_vertex_preclip", extStart, extEnd); +#endif /* GL_SGIX_vertex_preclip */ +#ifdef GL_SGIX_vertex_preclip_hint + GLEW_SGIX_vertex_preclip_hint = _glewSearchExtension("GL_SGIX_vertex_preclip_hint", extStart, extEnd); +#endif /* GL_SGIX_vertex_preclip_hint */ +#ifdef GL_SGIX_ycrcb + GLEW_SGIX_ycrcb = _glewSearchExtension("GL_SGIX_ycrcb", extStart, extEnd); +#endif /* GL_SGIX_ycrcb */ +#ifdef GL_SGI_color_matrix + GLEW_SGI_color_matrix = _glewSearchExtension("GL_SGI_color_matrix", extStart, extEnd); +#endif /* GL_SGI_color_matrix */ +#ifdef GL_SGI_color_table + GLEW_SGI_color_table = _glewSearchExtension("GL_SGI_color_table", extStart, extEnd); + if (glewExperimental || GLEW_SGI_color_table) GLEW_SGI_color_table = !_glewInit_GL_SGI_color_table(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGI_color_table */ +#ifdef GL_SGI_texture_color_table + GLEW_SGI_texture_color_table = _glewSearchExtension("GL_SGI_texture_color_table", extStart, extEnd); +#endif /* GL_SGI_texture_color_table */ +#ifdef GL_SUNX_constant_data + GLEW_SUNX_constant_data = _glewSearchExtension("GL_SUNX_constant_data", extStart, extEnd); + if (glewExperimental || GLEW_SUNX_constant_data) GLEW_SUNX_constant_data = !_glewInit_GL_SUNX_constant_data(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SUNX_constant_data */ +#ifdef GL_SUN_convolution_border_modes + GLEW_SUN_convolution_border_modes = _glewSearchExtension("GL_SUN_convolution_border_modes", extStart, extEnd); +#endif /* GL_SUN_convolution_border_modes */ +#ifdef GL_SUN_global_alpha + GLEW_SUN_global_alpha = _glewSearchExtension("GL_SUN_global_alpha", extStart, extEnd); + if (glewExperimental || GLEW_SUN_global_alpha) GLEW_SUN_global_alpha = !_glewInit_GL_SUN_global_alpha(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SUN_global_alpha */ +#ifdef GL_SUN_mesh_array + GLEW_SUN_mesh_array = _glewSearchExtension("GL_SUN_mesh_array", extStart, extEnd); +#endif /* GL_SUN_mesh_array */ +#ifdef GL_SUN_read_video_pixels + GLEW_SUN_read_video_pixels = _glewSearchExtension("GL_SUN_read_video_pixels", extStart, extEnd); + if (glewExperimental || GLEW_SUN_read_video_pixels) GLEW_SUN_read_video_pixels = !_glewInit_GL_SUN_read_video_pixels(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SUN_read_video_pixels */ +#ifdef GL_SUN_slice_accum + GLEW_SUN_slice_accum = _glewSearchExtension("GL_SUN_slice_accum", extStart, extEnd); +#endif /* GL_SUN_slice_accum */ +#ifdef GL_SUN_triangle_list + GLEW_SUN_triangle_list = _glewSearchExtension("GL_SUN_triangle_list", extStart, extEnd); + if (glewExperimental || GLEW_SUN_triangle_list) GLEW_SUN_triangle_list = !_glewInit_GL_SUN_triangle_list(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SUN_triangle_list */ +#ifdef GL_SUN_vertex + GLEW_SUN_vertex = _glewSearchExtension("GL_SUN_vertex", extStart, extEnd); + if (glewExperimental || GLEW_SUN_vertex) GLEW_SUN_vertex = !_glewInit_GL_SUN_vertex(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SUN_vertex */ +#ifdef GL_WIN_phong_shading + GLEW_WIN_phong_shading = _glewSearchExtension("GL_WIN_phong_shading", extStart, extEnd); +#endif /* GL_WIN_phong_shading */ +#ifdef GL_WIN_specular_fog + GLEW_WIN_specular_fog = _glewSearchExtension("GL_WIN_specular_fog", extStart, extEnd); +#endif /* GL_WIN_specular_fog */ +#ifdef GL_WIN_swap_hint + GLEW_WIN_swap_hint = _glewSearchExtension("GL_WIN_swap_hint", extStart, extEnd); + if (glewExperimental || GLEW_WIN_swap_hint) GLEW_WIN_swap_hint = !_glewInit_GL_WIN_swap_hint(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_WIN_swap_hint */ + + return GLEW_OK; +} + + +#if defined(_WIN32) + +#if !defined(GLEW_MX) + +PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL = NULL; + +PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD = NULL; +PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC __wglewCreateAssociatedContextAMD = NULL; +PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __wglewCreateAssociatedContextAttribsAMD = NULL; +PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD = NULL; +PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD = NULL; +PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD = NULL; +PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD = NULL; +PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD = NULL; +PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD = NULL; + +PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB = NULL; +PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB = NULL; +PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB = NULL; +PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB = NULL; + +PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB = NULL; + +PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB = NULL; + +PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB = NULL; +PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB = NULL; + +PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB = NULL; +PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB = NULL; +PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB = NULL; +PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB = NULL; +PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB = NULL; + +PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB = NULL; +PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB = NULL; +PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB = NULL; + +PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB = NULL; +PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB = NULL; +PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB = NULL; + +PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT = NULL; +PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT = NULL; +PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT = NULL; +PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT = NULL; + +PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT = NULL; + +PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT = NULL; +PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT = NULL; + +PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT = NULL; +PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT = NULL; +PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT = NULL; +PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT = NULL; +PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT = NULL; + +PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT = NULL; +PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT = NULL; +PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT = NULL; + +PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT = NULL; +PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT = NULL; + +PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D = NULL; +PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D = NULL; + +PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D = NULL; +PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D = NULL; +PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D = NULL; +PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D = NULL; + +PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D = NULL; +PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D = NULL; +PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D = NULL; +PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D = NULL; +PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D = NULL; +PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D = NULL; +PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D = NULL; +PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D = NULL; +PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D = NULL; +PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D = NULL; +PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D = NULL; +PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D = NULL; + +PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D = NULL; +PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D = NULL; +PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D = NULL; +PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D = NULL; + +PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D = NULL; +PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D = NULL; +PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D = NULL; +PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D = NULL; + +PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D = NULL; +PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D = NULL; +PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D = NULL; +PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D = NULL; + +PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV = NULL; +PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV = NULL; +PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV = NULL; +PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV = NULL; +PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV = NULL; +PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV = NULL; +PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV = NULL; +PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV = NULL; + +PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV = NULL; + +PFNWGLDELAYBEFORESWAPNVPROC __wglewDelayBeforeSwapNV = NULL; + +PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV = NULL; +PFNWGLDELETEDCNVPROC __wglewDeleteDCNV = NULL; +PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV = NULL; +PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV = NULL; +PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV = NULL; + +PFNWGLBINDVIDEODEVICENVPROC __wglewBindVideoDeviceNV = NULL; +PFNWGLENUMERATEVIDEODEVICESNVPROC __wglewEnumerateVideoDevicesNV = NULL; +PFNWGLQUERYCURRENTCONTEXTNVPROC __wglewQueryCurrentContextNV = NULL; + +PFNWGLBINDSWAPBARRIERNVPROC __wglewBindSwapBarrierNV = NULL; +PFNWGLJOINSWAPGROUPNVPROC __wglewJoinSwapGroupNV = NULL; +PFNWGLQUERYFRAMECOUNTNVPROC __wglewQueryFrameCountNV = NULL; +PFNWGLQUERYMAXSWAPGROUPSNVPROC __wglewQueryMaxSwapGroupsNV = NULL; +PFNWGLQUERYSWAPGROUPNVPROC __wglewQuerySwapGroupNV = NULL; +PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV = NULL; + +PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV = NULL; +PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV = NULL; + +PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV = NULL; +PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV = NULL; +PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV = NULL; +PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV = NULL; +PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV = NULL; + +PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV = NULL; +PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV = NULL; +PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV = NULL; +PFNWGLRELEASEVIDEODEVICENVPROC __wglewReleaseVideoDeviceNV = NULL; +PFNWGLRELEASEVIDEOIMAGENVPROC __wglewReleaseVideoImageNV = NULL; +PFNWGLSENDPBUFFERTOVIDEONVPROC __wglewSendPbufferToVideoNV = NULL; + +PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML = NULL; +PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML = NULL; +PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML = NULL; +PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML = NULL; +PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML = NULL; +PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML = NULL; +GLboolean __WGLEW_3DFX_multisample = GL_FALSE; +GLboolean __WGLEW_3DL_stereo_control = GL_FALSE; +GLboolean __WGLEW_AMD_gpu_association = GL_FALSE; +GLboolean __WGLEW_ARB_buffer_region = GL_FALSE; +GLboolean __WGLEW_ARB_context_flush_control = GL_FALSE; +GLboolean __WGLEW_ARB_create_context = GL_FALSE; +GLboolean __WGLEW_ARB_create_context_profile = GL_FALSE; +GLboolean __WGLEW_ARB_create_context_robustness = GL_FALSE; +GLboolean __WGLEW_ARB_extensions_string = GL_FALSE; +GLboolean __WGLEW_ARB_framebuffer_sRGB = GL_FALSE; +GLboolean __WGLEW_ARB_make_current_read = GL_FALSE; +GLboolean __WGLEW_ARB_multisample = GL_FALSE; +GLboolean __WGLEW_ARB_pbuffer = GL_FALSE; +GLboolean __WGLEW_ARB_pixel_format = GL_FALSE; +GLboolean __WGLEW_ARB_pixel_format_float = GL_FALSE; +GLboolean __WGLEW_ARB_render_texture = GL_FALSE; +GLboolean __WGLEW_ARB_robustness_application_isolation = GL_FALSE; +GLboolean __WGLEW_ARB_robustness_share_group_isolation = GL_FALSE; +GLboolean __WGLEW_ATI_pixel_format_float = GL_FALSE; +GLboolean __WGLEW_ATI_render_texture_rectangle = GL_FALSE; +GLboolean __WGLEW_EXT_create_context_es2_profile = GL_FALSE; +GLboolean __WGLEW_EXT_create_context_es_profile = GL_FALSE; +GLboolean __WGLEW_EXT_depth_float = GL_FALSE; +GLboolean __WGLEW_EXT_display_color_table = GL_FALSE; +GLboolean __WGLEW_EXT_extensions_string = GL_FALSE; +GLboolean __WGLEW_EXT_framebuffer_sRGB = GL_FALSE; +GLboolean __WGLEW_EXT_make_current_read = GL_FALSE; +GLboolean __WGLEW_EXT_multisample = GL_FALSE; +GLboolean __WGLEW_EXT_pbuffer = GL_FALSE; +GLboolean __WGLEW_EXT_pixel_format = GL_FALSE; +GLboolean __WGLEW_EXT_pixel_format_packed_float = GL_FALSE; +GLboolean __WGLEW_EXT_swap_control = GL_FALSE; +GLboolean __WGLEW_EXT_swap_control_tear = GL_FALSE; +GLboolean __WGLEW_I3D_digital_video_control = GL_FALSE; +GLboolean __WGLEW_I3D_gamma = GL_FALSE; +GLboolean __WGLEW_I3D_genlock = GL_FALSE; +GLboolean __WGLEW_I3D_image_buffer = GL_FALSE; +GLboolean __WGLEW_I3D_swap_frame_lock = GL_FALSE; +GLboolean __WGLEW_I3D_swap_frame_usage = GL_FALSE; +GLboolean __WGLEW_NV_DX_interop = GL_FALSE; +GLboolean __WGLEW_NV_DX_interop2 = GL_FALSE; +GLboolean __WGLEW_NV_copy_image = GL_FALSE; +GLboolean __WGLEW_NV_delay_before_swap = GL_FALSE; +GLboolean __WGLEW_NV_float_buffer = GL_FALSE; +GLboolean __WGLEW_NV_gpu_affinity = GL_FALSE; +GLboolean __WGLEW_NV_multisample_coverage = GL_FALSE; +GLboolean __WGLEW_NV_present_video = GL_FALSE; +GLboolean __WGLEW_NV_render_depth_texture = GL_FALSE; +GLboolean __WGLEW_NV_render_texture_rectangle = GL_FALSE; +GLboolean __WGLEW_NV_swap_group = GL_FALSE; +GLboolean __WGLEW_NV_vertex_array_range = GL_FALSE; +GLboolean __WGLEW_NV_video_capture = GL_FALSE; +GLboolean __WGLEW_NV_video_output = GL_FALSE; +GLboolean __WGLEW_OML_sync_control = GL_FALSE; + +#endif /* !GLEW_MX */ + +#ifdef WGL_3DL_stereo_control + +static GLboolean _glewInit_WGL_3DL_stereo_control (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglSetStereoEmitterState3DL = (PFNWGLSETSTEREOEMITTERSTATE3DLPROC)glewGetProcAddress((const GLubyte*)"wglSetStereoEmitterState3DL")) == NULL) || r; + + return r; +} + +#endif /* WGL_3DL_stereo_control */ + +#ifdef WGL_AMD_gpu_association + +static GLboolean _glewInit_WGL_AMD_gpu_association (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglBlitContextFramebufferAMD = (PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC)glewGetProcAddress((const GLubyte*)"wglBlitContextFramebufferAMD")) == NULL) || r; + r = ((wglCreateAssociatedContextAMD = (PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"wglCreateAssociatedContextAMD")) == NULL) || r; + r = ((wglCreateAssociatedContextAttribsAMD = (PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC)glewGetProcAddress((const GLubyte*)"wglCreateAssociatedContextAttribsAMD")) == NULL) || r; + r = ((wglDeleteAssociatedContextAMD = (PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"wglDeleteAssociatedContextAMD")) == NULL) || r; + r = ((wglGetContextGPUIDAMD = (PFNWGLGETCONTEXTGPUIDAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetContextGPUIDAMD")) == NULL) || r; + r = ((wglGetCurrentAssociatedContextAMD = (PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetCurrentAssociatedContextAMD")) == NULL) || r; + r = ((wglGetGPUIDsAMD = (PFNWGLGETGPUIDSAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetGPUIDsAMD")) == NULL) || r; + r = ((wglGetGPUInfoAMD = (PFNWGLGETGPUINFOAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetGPUInfoAMD")) == NULL) || r; + r = ((wglMakeAssociatedContextCurrentAMD = (PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC)glewGetProcAddress((const GLubyte*)"wglMakeAssociatedContextCurrentAMD")) == NULL) || r; + + return r; +} + +#endif /* WGL_AMD_gpu_association */ + +#ifdef WGL_ARB_buffer_region + +static GLboolean _glewInit_WGL_ARB_buffer_region (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglCreateBufferRegionARB = (PFNWGLCREATEBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglCreateBufferRegionARB")) == NULL) || r; + r = ((wglDeleteBufferRegionARB = (PFNWGLDELETEBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglDeleteBufferRegionARB")) == NULL) || r; + r = ((wglRestoreBufferRegionARB = (PFNWGLRESTOREBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglRestoreBufferRegionARB")) == NULL) || r; + r = ((wglSaveBufferRegionARB = (PFNWGLSAVEBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglSaveBufferRegionARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_buffer_region */ + +#ifdef WGL_ARB_create_context + +static GLboolean _glewInit_WGL_ARB_create_context (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)glewGetProcAddress((const GLubyte*)"wglCreateContextAttribsARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_create_context */ + +#ifdef WGL_ARB_extensions_string + +static GLboolean _glewInit_WGL_ARB_extensions_string (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_extensions_string */ + +#ifdef WGL_ARB_make_current_read + +static GLboolean _glewInit_WGL_ARB_make_current_read (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetCurrentReadDCARB = (PFNWGLGETCURRENTREADDCARBPROC)glewGetProcAddress((const GLubyte*)"wglGetCurrentReadDCARB")) == NULL) || r; + r = ((wglMakeContextCurrentARB = (PFNWGLMAKECONTEXTCURRENTARBPROC)glewGetProcAddress((const GLubyte*)"wglMakeContextCurrentARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_make_current_read */ + +#ifdef WGL_ARB_pbuffer + +static GLboolean _glewInit_WGL_ARB_pbuffer (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglCreatePbufferARB = (PFNWGLCREATEPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"wglCreatePbufferARB")) == NULL) || r; + r = ((wglDestroyPbufferARB = (PFNWGLDESTROYPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"wglDestroyPbufferARB")) == NULL) || r; + r = ((wglGetPbufferDCARB = (PFNWGLGETPBUFFERDCARBPROC)glewGetProcAddress((const GLubyte*)"wglGetPbufferDCARB")) == NULL) || r; + r = ((wglQueryPbufferARB = (PFNWGLQUERYPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"wglQueryPbufferARB")) == NULL) || r; + r = ((wglReleasePbufferDCARB = (PFNWGLRELEASEPBUFFERDCARBPROC)glewGetProcAddress((const GLubyte*)"wglReleasePbufferDCARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_pbuffer */ + +#ifdef WGL_ARB_pixel_format + +static GLboolean _glewInit_WGL_ARB_pixel_format (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)glewGetProcAddress((const GLubyte*)"wglChoosePixelFormatARB")) == NULL) || r; + r = ((wglGetPixelFormatAttribfvARB = (PFNWGLGETPIXELFORMATATTRIBFVARBPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribfvARB")) == NULL) || r; + r = ((wglGetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribivARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_pixel_format */ + +#ifdef WGL_ARB_render_texture + +static GLboolean _glewInit_WGL_ARB_render_texture (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglBindTexImageARB = (PFNWGLBINDTEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"wglBindTexImageARB")) == NULL) || r; + r = ((wglReleaseTexImageARB = (PFNWGLRELEASETEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"wglReleaseTexImageARB")) == NULL) || r; + r = ((wglSetPbufferAttribARB = (PFNWGLSETPBUFFERATTRIBARBPROC)glewGetProcAddress((const GLubyte*)"wglSetPbufferAttribARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_render_texture */ + +#ifdef WGL_EXT_display_color_table + +static GLboolean _glewInit_WGL_EXT_display_color_table (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglBindDisplayColorTableEXT = (PFNWGLBINDDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglBindDisplayColorTableEXT")) == NULL) || r; + r = ((wglCreateDisplayColorTableEXT = (PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglCreateDisplayColorTableEXT")) == NULL) || r; + r = ((wglDestroyDisplayColorTableEXT = (PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglDestroyDisplayColorTableEXT")) == NULL) || r; + r = ((wglLoadDisplayColorTableEXT = (PFNWGLLOADDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglLoadDisplayColorTableEXT")) == NULL) || r; + + return r; +} + +#endif /* WGL_EXT_display_color_table */ + +#ifdef WGL_EXT_extensions_string + +static GLboolean _glewInit_WGL_EXT_extensions_string (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringEXT")) == NULL) || r; + + return r; +} + +#endif /* WGL_EXT_extensions_string */ + +#ifdef WGL_EXT_make_current_read + +static GLboolean _glewInit_WGL_EXT_make_current_read (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetCurrentReadDCEXT = (PFNWGLGETCURRENTREADDCEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetCurrentReadDCEXT")) == NULL) || r; + r = ((wglMakeContextCurrentEXT = (PFNWGLMAKECONTEXTCURRENTEXTPROC)glewGetProcAddress((const GLubyte*)"wglMakeContextCurrentEXT")) == NULL) || r; + + return r; +} + +#endif /* WGL_EXT_make_current_read */ + +#ifdef WGL_EXT_pbuffer + +static GLboolean _glewInit_WGL_EXT_pbuffer (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglCreatePbufferEXT = (PFNWGLCREATEPBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"wglCreatePbufferEXT")) == NULL) || r; + r = ((wglDestroyPbufferEXT = (PFNWGLDESTROYPBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"wglDestroyPbufferEXT")) == NULL) || r; + r = ((wglGetPbufferDCEXT = (PFNWGLGETPBUFFERDCEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetPbufferDCEXT")) == NULL) || r; + r = ((wglQueryPbufferEXT = (PFNWGLQUERYPBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"wglQueryPbufferEXT")) == NULL) || r; + r = ((wglReleasePbufferDCEXT = (PFNWGLRELEASEPBUFFERDCEXTPROC)glewGetProcAddress((const GLubyte*)"wglReleasePbufferDCEXT")) == NULL) || r; + + return r; +} + +#endif /* WGL_EXT_pbuffer */ + +#ifdef WGL_EXT_pixel_format + +static GLboolean _glewInit_WGL_EXT_pixel_format (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglChoosePixelFormatEXT = (PFNWGLCHOOSEPIXELFORMATEXTPROC)glewGetProcAddress((const GLubyte*)"wglChoosePixelFormatEXT")) == NULL) || r; + r = ((wglGetPixelFormatAttribfvEXT = (PFNWGLGETPIXELFORMATATTRIBFVEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribfvEXT")) == NULL) || r; + r = ((wglGetPixelFormatAttribivEXT = (PFNWGLGETPIXELFORMATATTRIBIVEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribivEXT")) == NULL) || r; + + return r; +} + +#endif /* WGL_EXT_pixel_format */ + +#ifdef WGL_EXT_swap_control + +static GLboolean _glewInit_WGL_EXT_swap_control (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetSwapIntervalEXT")) == NULL) || r; + r = ((wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"wglSwapIntervalEXT")) == NULL) || r; + + return r; +} + +#endif /* WGL_EXT_swap_control */ + +#ifdef WGL_I3D_digital_video_control + +static GLboolean _glewInit_WGL_I3D_digital_video_control (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetDigitalVideoParametersI3D = (PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetDigitalVideoParametersI3D")) == NULL) || r; + r = ((wglSetDigitalVideoParametersI3D = (PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglSetDigitalVideoParametersI3D")) == NULL) || r; + + return r; +} + +#endif /* WGL_I3D_digital_video_control */ + +#ifdef WGL_I3D_gamma + +static GLboolean _glewInit_WGL_I3D_gamma (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetGammaTableI3D = (PFNWGLGETGAMMATABLEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGammaTableI3D")) == NULL) || r; + r = ((wglGetGammaTableParametersI3D = (PFNWGLGETGAMMATABLEPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGammaTableParametersI3D")) == NULL) || r; + r = ((wglSetGammaTableI3D = (PFNWGLSETGAMMATABLEI3DPROC)glewGetProcAddress((const GLubyte*)"wglSetGammaTableI3D")) == NULL) || r; + r = ((wglSetGammaTableParametersI3D = (PFNWGLSETGAMMATABLEPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglSetGammaTableParametersI3D")) == NULL) || r; + + return r; +} + +#endif /* WGL_I3D_gamma */ + +#ifdef WGL_I3D_genlock + +static GLboolean _glewInit_WGL_I3D_genlock (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglDisableGenlockI3D = (PFNWGLDISABLEGENLOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglDisableGenlockI3D")) == NULL) || r; + r = ((wglEnableGenlockI3D = (PFNWGLENABLEGENLOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglEnableGenlockI3D")) == NULL) || r; + r = ((wglGenlockSampleRateI3D = (PFNWGLGENLOCKSAMPLERATEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSampleRateI3D")) == NULL) || r; + r = ((wglGenlockSourceDelayI3D = (PFNWGLGENLOCKSOURCEDELAYI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSourceDelayI3D")) == NULL) || r; + r = ((wglGenlockSourceEdgeI3D = (PFNWGLGENLOCKSOURCEEDGEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSourceEdgeI3D")) == NULL) || r; + r = ((wglGenlockSourceI3D = (PFNWGLGENLOCKSOURCEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSourceI3D")) == NULL) || r; + r = ((wglGetGenlockSampleRateI3D = (PFNWGLGETGENLOCKSAMPLERATEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSampleRateI3D")) == NULL) || r; + r = ((wglGetGenlockSourceDelayI3D = (PFNWGLGETGENLOCKSOURCEDELAYI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSourceDelayI3D")) == NULL) || r; + r = ((wglGetGenlockSourceEdgeI3D = (PFNWGLGETGENLOCKSOURCEEDGEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSourceEdgeI3D")) == NULL) || r; + r = ((wglGetGenlockSourceI3D = (PFNWGLGETGENLOCKSOURCEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSourceI3D")) == NULL) || r; + r = ((wglIsEnabledGenlockI3D = (PFNWGLISENABLEDGENLOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglIsEnabledGenlockI3D")) == NULL) || r; + r = ((wglQueryGenlockMaxSourceDelayI3D = (PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC)glewGetProcAddress((const GLubyte*)"wglQueryGenlockMaxSourceDelayI3D")) == NULL) || r; + + return r; +} + +#endif /* WGL_I3D_genlock */ + +#ifdef WGL_I3D_image_buffer + +static GLboolean _glewInit_WGL_I3D_image_buffer (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglAssociateImageBufferEventsI3D = (PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC)glewGetProcAddress((const GLubyte*)"wglAssociateImageBufferEventsI3D")) == NULL) || r; + r = ((wglCreateImageBufferI3D = (PFNWGLCREATEIMAGEBUFFERI3DPROC)glewGetProcAddress((const GLubyte*)"wglCreateImageBufferI3D")) == NULL) || r; + r = ((wglDestroyImageBufferI3D = (PFNWGLDESTROYIMAGEBUFFERI3DPROC)glewGetProcAddress((const GLubyte*)"wglDestroyImageBufferI3D")) == NULL) || r; + r = ((wglReleaseImageBufferEventsI3D = (PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC)glewGetProcAddress((const GLubyte*)"wglReleaseImageBufferEventsI3D")) == NULL) || r; + + return r; +} + +#endif /* WGL_I3D_image_buffer */ + +#ifdef WGL_I3D_swap_frame_lock + +static GLboolean _glewInit_WGL_I3D_swap_frame_lock (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglDisableFrameLockI3D = (PFNWGLDISABLEFRAMELOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglDisableFrameLockI3D")) == NULL) || r; + r = ((wglEnableFrameLockI3D = (PFNWGLENABLEFRAMELOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglEnableFrameLockI3D")) == NULL) || r; + r = ((wglIsEnabledFrameLockI3D = (PFNWGLISENABLEDFRAMELOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglIsEnabledFrameLockI3D")) == NULL) || r; + r = ((wglQueryFrameLockMasterI3D = (PFNWGLQUERYFRAMELOCKMASTERI3DPROC)glewGetProcAddress((const GLubyte*)"wglQueryFrameLockMasterI3D")) == NULL) || r; + + return r; +} + +#endif /* WGL_I3D_swap_frame_lock */ + +#ifdef WGL_I3D_swap_frame_usage + +static GLboolean _glewInit_WGL_I3D_swap_frame_usage (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglBeginFrameTrackingI3D = (PFNWGLBEGINFRAMETRACKINGI3DPROC)glewGetProcAddress((const GLubyte*)"wglBeginFrameTrackingI3D")) == NULL) || r; + r = ((wglEndFrameTrackingI3D = (PFNWGLENDFRAMETRACKINGI3DPROC)glewGetProcAddress((const GLubyte*)"wglEndFrameTrackingI3D")) == NULL) || r; + r = ((wglGetFrameUsageI3D = (PFNWGLGETFRAMEUSAGEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetFrameUsageI3D")) == NULL) || r; + r = ((wglQueryFrameTrackingI3D = (PFNWGLQUERYFRAMETRACKINGI3DPROC)glewGetProcAddress((const GLubyte*)"wglQueryFrameTrackingI3D")) == NULL) || r; + + return r; +} + +#endif /* WGL_I3D_swap_frame_usage */ + +#ifdef WGL_NV_DX_interop + +static GLboolean _glewInit_WGL_NV_DX_interop (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglDXCloseDeviceNV = (PFNWGLDXCLOSEDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglDXCloseDeviceNV")) == NULL) || r; + r = ((wglDXLockObjectsNV = (PFNWGLDXLOCKOBJECTSNVPROC)glewGetProcAddress((const GLubyte*)"wglDXLockObjectsNV")) == NULL) || r; + r = ((wglDXObjectAccessNV = (PFNWGLDXOBJECTACCESSNVPROC)glewGetProcAddress((const GLubyte*)"wglDXObjectAccessNV")) == NULL) || r; + r = ((wglDXOpenDeviceNV = (PFNWGLDXOPENDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglDXOpenDeviceNV")) == NULL) || r; + r = ((wglDXRegisterObjectNV = (PFNWGLDXREGISTEROBJECTNVPROC)glewGetProcAddress((const GLubyte*)"wglDXRegisterObjectNV")) == NULL) || r; + r = ((wglDXSetResourceShareHandleNV = (PFNWGLDXSETRESOURCESHAREHANDLENVPROC)glewGetProcAddress((const GLubyte*)"wglDXSetResourceShareHandleNV")) == NULL) || r; + r = ((wglDXUnlockObjectsNV = (PFNWGLDXUNLOCKOBJECTSNVPROC)glewGetProcAddress((const GLubyte*)"wglDXUnlockObjectsNV")) == NULL) || r; + r = ((wglDXUnregisterObjectNV = (PFNWGLDXUNREGISTEROBJECTNVPROC)glewGetProcAddress((const GLubyte*)"wglDXUnregisterObjectNV")) == NULL) || r; + + return r; +} + +#endif /* WGL_NV_DX_interop */ + +#ifdef WGL_NV_copy_image + +static GLboolean _glewInit_WGL_NV_copy_image (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglCopyImageSubDataNV = (PFNWGLCOPYIMAGESUBDATANVPROC)glewGetProcAddress((const GLubyte*)"wglCopyImageSubDataNV")) == NULL) || r; + + return r; +} + +#endif /* WGL_NV_copy_image */ + +#ifdef WGL_NV_delay_before_swap + +static GLboolean _glewInit_WGL_NV_delay_before_swap (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglDelayBeforeSwapNV = (PFNWGLDELAYBEFORESWAPNVPROC)glewGetProcAddress((const GLubyte*)"wglDelayBeforeSwapNV")) == NULL) || r; + + return r; +} + +#endif /* WGL_NV_delay_before_swap */ + +#ifdef WGL_NV_gpu_affinity + +static GLboolean _glewInit_WGL_NV_gpu_affinity (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglCreateAffinityDCNV = (PFNWGLCREATEAFFINITYDCNVPROC)glewGetProcAddress((const GLubyte*)"wglCreateAffinityDCNV")) == NULL) || r; + r = ((wglDeleteDCNV = (PFNWGLDELETEDCNVPROC)glewGetProcAddress((const GLubyte*)"wglDeleteDCNV")) == NULL) || r; + r = ((wglEnumGpuDevicesNV = (PFNWGLENUMGPUDEVICESNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumGpuDevicesNV")) == NULL) || r; + r = ((wglEnumGpusFromAffinityDCNV = (PFNWGLENUMGPUSFROMAFFINITYDCNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumGpusFromAffinityDCNV")) == NULL) || r; + r = ((wglEnumGpusNV = (PFNWGLENUMGPUSNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumGpusNV")) == NULL) || r; + + return r; +} + +#endif /* WGL_NV_gpu_affinity */ + +#ifdef WGL_NV_present_video + +static GLboolean _glewInit_WGL_NV_present_video (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglBindVideoDeviceNV = (PFNWGLBINDVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglBindVideoDeviceNV")) == NULL) || r; + r = ((wglEnumerateVideoDevicesNV = (PFNWGLENUMERATEVIDEODEVICESNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumerateVideoDevicesNV")) == NULL) || r; + r = ((wglQueryCurrentContextNV = (PFNWGLQUERYCURRENTCONTEXTNVPROC)glewGetProcAddress((const GLubyte*)"wglQueryCurrentContextNV")) == NULL) || r; + + return r; +} + +#endif /* WGL_NV_present_video */ + +#ifdef WGL_NV_swap_group + +static GLboolean _glewInit_WGL_NV_swap_group (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglBindSwapBarrierNV = (PFNWGLBINDSWAPBARRIERNVPROC)glewGetProcAddress((const GLubyte*)"wglBindSwapBarrierNV")) == NULL) || r; + r = ((wglJoinSwapGroupNV = (PFNWGLJOINSWAPGROUPNVPROC)glewGetProcAddress((const GLubyte*)"wglJoinSwapGroupNV")) == NULL) || r; + r = ((wglQueryFrameCountNV = (PFNWGLQUERYFRAMECOUNTNVPROC)glewGetProcAddress((const GLubyte*)"wglQueryFrameCountNV")) == NULL) || r; + r = ((wglQueryMaxSwapGroupsNV = (PFNWGLQUERYMAXSWAPGROUPSNVPROC)glewGetProcAddress((const GLubyte*)"wglQueryMaxSwapGroupsNV")) == NULL) || r; + r = ((wglQuerySwapGroupNV = (PFNWGLQUERYSWAPGROUPNVPROC)glewGetProcAddress((const GLubyte*)"wglQuerySwapGroupNV")) == NULL) || r; + r = ((wglResetFrameCountNV = (PFNWGLRESETFRAMECOUNTNVPROC)glewGetProcAddress((const GLubyte*)"wglResetFrameCountNV")) == NULL) || r; + + return r; +} + +#endif /* WGL_NV_swap_group */ + +#ifdef WGL_NV_vertex_array_range + +static GLboolean _glewInit_WGL_NV_vertex_array_range (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglAllocateMemoryNV = (PFNWGLALLOCATEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"wglAllocateMemoryNV")) == NULL) || r; + r = ((wglFreeMemoryNV = (PFNWGLFREEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"wglFreeMemoryNV")) == NULL) || r; + + return r; +} + +#endif /* WGL_NV_vertex_array_range */ + +#ifdef WGL_NV_video_capture + +static GLboolean _glewInit_WGL_NV_video_capture (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglBindVideoCaptureDeviceNV = (PFNWGLBINDVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglBindVideoCaptureDeviceNV")) == NULL) || r; + r = ((wglEnumerateVideoCaptureDevicesNV = (PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumerateVideoCaptureDevicesNV")) == NULL) || r; + r = ((wglLockVideoCaptureDeviceNV = (PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglLockVideoCaptureDeviceNV")) == NULL) || r; + r = ((wglQueryVideoCaptureDeviceNV = (PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglQueryVideoCaptureDeviceNV")) == NULL) || r; + r = ((wglReleaseVideoCaptureDeviceNV = (PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglReleaseVideoCaptureDeviceNV")) == NULL) || r; + + return r; +} + +#endif /* WGL_NV_video_capture */ + +#ifdef WGL_NV_video_output + +static GLboolean _glewInit_WGL_NV_video_output (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglBindVideoImageNV = (PFNWGLBINDVIDEOIMAGENVPROC)glewGetProcAddress((const GLubyte*)"wglBindVideoImageNV")) == NULL) || r; + r = ((wglGetVideoDeviceNV = (PFNWGLGETVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglGetVideoDeviceNV")) == NULL) || r; + r = ((wglGetVideoInfoNV = (PFNWGLGETVIDEOINFONVPROC)glewGetProcAddress((const GLubyte*)"wglGetVideoInfoNV")) == NULL) || r; + r = ((wglReleaseVideoDeviceNV = (PFNWGLRELEASEVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglReleaseVideoDeviceNV")) == NULL) || r; + r = ((wglReleaseVideoImageNV = (PFNWGLRELEASEVIDEOIMAGENVPROC)glewGetProcAddress((const GLubyte*)"wglReleaseVideoImageNV")) == NULL) || r; + r = ((wglSendPbufferToVideoNV = (PFNWGLSENDPBUFFERTOVIDEONVPROC)glewGetProcAddress((const GLubyte*)"wglSendPbufferToVideoNV")) == NULL) || r; + + return r; +} + +#endif /* WGL_NV_video_output */ + +#ifdef WGL_OML_sync_control + +static GLboolean _glewInit_WGL_OML_sync_control (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetMscRateOML = (PFNWGLGETMSCRATEOMLPROC)glewGetProcAddress((const GLubyte*)"wglGetMscRateOML")) == NULL) || r; + r = ((wglGetSyncValuesOML = (PFNWGLGETSYNCVALUESOMLPROC)glewGetProcAddress((const GLubyte*)"wglGetSyncValuesOML")) == NULL) || r; + r = ((wglSwapBuffersMscOML = (PFNWGLSWAPBUFFERSMSCOMLPROC)glewGetProcAddress((const GLubyte*)"wglSwapBuffersMscOML")) == NULL) || r; + r = ((wglSwapLayerBuffersMscOML = (PFNWGLSWAPLAYERBUFFERSMSCOMLPROC)glewGetProcAddress((const GLubyte*)"wglSwapLayerBuffersMscOML")) == NULL) || r; + r = ((wglWaitForMscOML = (PFNWGLWAITFORMSCOMLPROC)glewGetProcAddress((const GLubyte*)"wglWaitForMscOML")) == NULL) || r; + r = ((wglWaitForSbcOML = (PFNWGLWAITFORSBCOMLPROC)glewGetProcAddress((const GLubyte*)"wglWaitForSbcOML")) == NULL) || r; + + return r; +} + +#endif /* WGL_OML_sync_control */ + +/* ------------------------------------------------------------------------- */ + +static PFNWGLGETEXTENSIONSSTRINGARBPROC _wglewGetExtensionsStringARB = NULL; +static PFNWGLGETEXTENSIONSSTRINGEXTPROC _wglewGetExtensionsStringEXT = NULL; + +GLboolean GLEWAPIENTRY wglewGetExtension (const char* name) +{ + const GLubyte* start; + const GLubyte* end; + if (_wglewGetExtensionsStringARB == NULL) + if (_wglewGetExtensionsStringEXT == NULL) + return GL_FALSE; + else + start = (const GLubyte*)_wglewGetExtensionsStringEXT(); + else + start = (const GLubyte*)_wglewGetExtensionsStringARB(wglGetCurrentDC()); + if (start == 0) + return GL_FALSE; + end = start + _glewStrLen(start); + return _glewSearchExtension(name, start, end); +} + +#ifdef GLEW_MX +GLenum GLEWAPIENTRY wglewContextInit (WGLEW_CONTEXT_ARG_DEF_LIST) +#else +GLenum GLEWAPIENTRY wglewInit (WGLEW_CONTEXT_ARG_DEF_LIST) +#endif +{ + GLboolean crippled; + const GLubyte* extStart; + const GLubyte* extEnd; + /* find wgl extension string query functions */ + _wglewGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringARB"); + _wglewGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringEXT"); + /* query wgl extension string */ + if (_wglewGetExtensionsStringARB == NULL) + if (_wglewGetExtensionsStringEXT == NULL) + extStart = (const GLubyte*)""; + else + extStart = (const GLubyte*)_wglewGetExtensionsStringEXT(); + else + extStart = (const GLubyte*)_wglewGetExtensionsStringARB(wglGetCurrentDC()); + extEnd = extStart + _glewStrLen(extStart); + /* initialize extensions */ + crippled = _wglewGetExtensionsStringARB == NULL && _wglewGetExtensionsStringEXT == NULL; +#ifdef WGL_3DFX_multisample + WGLEW_3DFX_multisample = _glewSearchExtension("WGL_3DFX_multisample", extStart, extEnd); +#endif /* WGL_3DFX_multisample */ +#ifdef WGL_3DL_stereo_control + WGLEW_3DL_stereo_control = _glewSearchExtension("WGL_3DL_stereo_control", extStart, extEnd); + if (glewExperimental || WGLEW_3DL_stereo_control|| crippled) WGLEW_3DL_stereo_control= !_glewInit_WGL_3DL_stereo_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_3DL_stereo_control */ +#ifdef WGL_AMD_gpu_association + WGLEW_AMD_gpu_association = _glewSearchExtension("WGL_AMD_gpu_association", extStart, extEnd); + if (glewExperimental || WGLEW_AMD_gpu_association|| crippled) WGLEW_AMD_gpu_association= !_glewInit_WGL_AMD_gpu_association(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_AMD_gpu_association */ +#ifdef WGL_ARB_buffer_region + WGLEW_ARB_buffer_region = _glewSearchExtension("WGL_ARB_buffer_region", extStart, extEnd); + if (glewExperimental || WGLEW_ARB_buffer_region|| crippled) WGLEW_ARB_buffer_region= !_glewInit_WGL_ARB_buffer_region(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_ARB_buffer_region */ +#ifdef WGL_ARB_context_flush_control + WGLEW_ARB_context_flush_control = _glewSearchExtension("WGL_ARB_context_flush_control", extStart, extEnd); +#endif /* WGL_ARB_context_flush_control */ +#ifdef WGL_ARB_create_context + WGLEW_ARB_create_context = _glewSearchExtension("WGL_ARB_create_context", extStart, extEnd); + if (glewExperimental || WGLEW_ARB_create_context|| crippled) WGLEW_ARB_create_context= !_glewInit_WGL_ARB_create_context(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_ARB_create_context */ +#ifdef WGL_ARB_create_context_profile + WGLEW_ARB_create_context_profile = _glewSearchExtension("WGL_ARB_create_context_profile", extStart, extEnd); +#endif /* WGL_ARB_create_context_profile */ +#ifdef WGL_ARB_create_context_robustness + WGLEW_ARB_create_context_robustness = _glewSearchExtension("WGL_ARB_create_context_robustness", extStart, extEnd); +#endif /* WGL_ARB_create_context_robustness */ +#ifdef WGL_ARB_extensions_string + WGLEW_ARB_extensions_string = _glewSearchExtension("WGL_ARB_extensions_string", extStart, extEnd); + if (glewExperimental || WGLEW_ARB_extensions_string|| crippled) WGLEW_ARB_extensions_string= !_glewInit_WGL_ARB_extensions_string(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_ARB_extensions_string */ +#ifdef WGL_ARB_framebuffer_sRGB + WGLEW_ARB_framebuffer_sRGB = _glewSearchExtension("WGL_ARB_framebuffer_sRGB", extStart, extEnd); +#endif /* WGL_ARB_framebuffer_sRGB */ +#ifdef WGL_ARB_make_current_read + WGLEW_ARB_make_current_read = _glewSearchExtension("WGL_ARB_make_current_read", extStart, extEnd); + if (glewExperimental || WGLEW_ARB_make_current_read|| crippled) WGLEW_ARB_make_current_read= !_glewInit_WGL_ARB_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_ARB_make_current_read */ +#ifdef WGL_ARB_multisample + WGLEW_ARB_multisample = _glewSearchExtension("WGL_ARB_multisample", extStart, extEnd); +#endif /* WGL_ARB_multisample */ +#ifdef WGL_ARB_pbuffer + WGLEW_ARB_pbuffer = _glewSearchExtension("WGL_ARB_pbuffer", extStart, extEnd); + if (glewExperimental || WGLEW_ARB_pbuffer|| crippled) WGLEW_ARB_pbuffer= !_glewInit_WGL_ARB_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_ARB_pbuffer */ +#ifdef WGL_ARB_pixel_format + WGLEW_ARB_pixel_format = _glewSearchExtension("WGL_ARB_pixel_format", extStart, extEnd); + if (glewExperimental || WGLEW_ARB_pixel_format|| crippled) WGLEW_ARB_pixel_format= !_glewInit_WGL_ARB_pixel_format(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_ARB_pixel_format */ +#ifdef WGL_ARB_pixel_format_float + WGLEW_ARB_pixel_format_float = _glewSearchExtension("WGL_ARB_pixel_format_float", extStart, extEnd); +#endif /* WGL_ARB_pixel_format_float */ +#ifdef WGL_ARB_render_texture + WGLEW_ARB_render_texture = _glewSearchExtension("WGL_ARB_render_texture", extStart, extEnd); + if (glewExperimental || WGLEW_ARB_render_texture|| crippled) WGLEW_ARB_render_texture= !_glewInit_WGL_ARB_render_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_ARB_render_texture */ +#ifdef WGL_ARB_robustness_application_isolation + WGLEW_ARB_robustness_application_isolation = _glewSearchExtension("WGL_ARB_robustness_application_isolation", extStart, extEnd); +#endif /* WGL_ARB_robustness_application_isolation */ +#ifdef WGL_ARB_robustness_share_group_isolation + WGLEW_ARB_robustness_share_group_isolation = _glewSearchExtension("WGL_ARB_robustness_share_group_isolation", extStart, extEnd); +#endif /* WGL_ARB_robustness_share_group_isolation */ +#ifdef WGL_ATI_pixel_format_float + WGLEW_ATI_pixel_format_float = _glewSearchExtension("WGL_ATI_pixel_format_float", extStart, extEnd); +#endif /* WGL_ATI_pixel_format_float */ +#ifdef WGL_ATI_render_texture_rectangle + WGLEW_ATI_render_texture_rectangle = _glewSearchExtension("WGL_ATI_render_texture_rectangle", extStart, extEnd); +#endif /* WGL_ATI_render_texture_rectangle */ +#ifdef WGL_EXT_create_context_es2_profile + WGLEW_EXT_create_context_es2_profile = _glewSearchExtension("WGL_EXT_create_context_es2_profile", extStart, extEnd); +#endif /* WGL_EXT_create_context_es2_profile */ +#ifdef WGL_EXT_create_context_es_profile + WGLEW_EXT_create_context_es_profile = _glewSearchExtension("WGL_EXT_create_context_es_profile", extStart, extEnd); +#endif /* WGL_EXT_create_context_es_profile */ +#ifdef WGL_EXT_depth_float + WGLEW_EXT_depth_float = _glewSearchExtension("WGL_EXT_depth_float", extStart, extEnd); +#endif /* WGL_EXT_depth_float */ +#ifdef WGL_EXT_display_color_table + WGLEW_EXT_display_color_table = _glewSearchExtension("WGL_EXT_display_color_table", extStart, extEnd); + if (glewExperimental || WGLEW_EXT_display_color_table|| crippled) WGLEW_EXT_display_color_table= !_glewInit_WGL_EXT_display_color_table(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_EXT_display_color_table */ +#ifdef WGL_EXT_extensions_string + WGLEW_EXT_extensions_string = _glewSearchExtension("WGL_EXT_extensions_string", extStart, extEnd); + if (glewExperimental || WGLEW_EXT_extensions_string|| crippled) WGLEW_EXT_extensions_string= !_glewInit_WGL_EXT_extensions_string(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_EXT_extensions_string */ +#ifdef WGL_EXT_framebuffer_sRGB + WGLEW_EXT_framebuffer_sRGB = _glewSearchExtension("WGL_EXT_framebuffer_sRGB", extStart, extEnd); +#endif /* WGL_EXT_framebuffer_sRGB */ +#ifdef WGL_EXT_make_current_read + WGLEW_EXT_make_current_read = _glewSearchExtension("WGL_EXT_make_current_read", extStart, extEnd); + if (glewExperimental || WGLEW_EXT_make_current_read|| crippled) WGLEW_EXT_make_current_read= !_glewInit_WGL_EXT_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_EXT_make_current_read */ +#ifdef WGL_EXT_multisample + WGLEW_EXT_multisample = _glewSearchExtension("WGL_EXT_multisample", extStart, extEnd); +#endif /* WGL_EXT_multisample */ +#ifdef WGL_EXT_pbuffer + WGLEW_EXT_pbuffer = _glewSearchExtension("WGL_EXT_pbuffer", extStart, extEnd); + if (glewExperimental || WGLEW_EXT_pbuffer|| crippled) WGLEW_EXT_pbuffer= !_glewInit_WGL_EXT_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_EXT_pbuffer */ +#ifdef WGL_EXT_pixel_format + WGLEW_EXT_pixel_format = _glewSearchExtension("WGL_EXT_pixel_format", extStart, extEnd); + if (glewExperimental || WGLEW_EXT_pixel_format|| crippled) WGLEW_EXT_pixel_format= !_glewInit_WGL_EXT_pixel_format(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_EXT_pixel_format */ +#ifdef WGL_EXT_pixel_format_packed_float + WGLEW_EXT_pixel_format_packed_float = _glewSearchExtension("WGL_EXT_pixel_format_packed_float", extStart, extEnd); +#endif /* WGL_EXT_pixel_format_packed_float */ +#ifdef WGL_EXT_swap_control + WGLEW_EXT_swap_control = _glewSearchExtension("WGL_EXT_swap_control", extStart, extEnd); + if (glewExperimental || WGLEW_EXT_swap_control|| crippled) WGLEW_EXT_swap_control= !_glewInit_WGL_EXT_swap_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_EXT_swap_control */ +#ifdef WGL_EXT_swap_control_tear + WGLEW_EXT_swap_control_tear = _glewSearchExtension("WGL_EXT_swap_control_tear", extStart, extEnd); +#endif /* WGL_EXT_swap_control_tear */ +#ifdef WGL_I3D_digital_video_control + WGLEW_I3D_digital_video_control = _glewSearchExtension("WGL_I3D_digital_video_control", extStart, extEnd); + if (glewExperimental || WGLEW_I3D_digital_video_control|| crippled) WGLEW_I3D_digital_video_control= !_glewInit_WGL_I3D_digital_video_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_I3D_digital_video_control */ +#ifdef WGL_I3D_gamma + WGLEW_I3D_gamma = _glewSearchExtension("WGL_I3D_gamma", extStart, extEnd); + if (glewExperimental || WGLEW_I3D_gamma|| crippled) WGLEW_I3D_gamma= !_glewInit_WGL_I3D_gamma(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_I3D_gamma */ +#ifdef WGL_I3D_genlock + WGLEW_I3D_genlock = _glewSearchExtension("WGL_I3D_genlock", extStart, extEnd); + if (glewExperimental || WGLEW_I3D_genlock|| crippled) WGLEW_I3D_genlock= !_glewInit_WGL_I3D_genlock(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_I3D_genlock */ +#ifdef WGL_I3D_image_buffer + WGLEW_I3D_image_buffer = _glewSearchExtension("WGL_I3D_image_buffer", extStart, extEnd); + if (glewExperimental || WGLEW_I3D_image_buffer|| crippled) WGLEW_I3D_image_buffer= !_glewInit_WGL_I3D_image_buffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_I3D_image_buffer */ +#ifdef WGL_I3D_swap_frame_lock + WGLEW_I3D_swap_frame_lock = _glewSearchExtension("WGL_I3D_swap_frame_lock", extStart, extEnd); + if (glewExperimental || WGLEW_I3D_swap_frame_lock|| crippled) WGLEW_I3D_swap_frame_lock= !_glewInit_WGL_I3D_swap_frame_lock(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_I3D_swap_frame_lock */ +#ifdef WGL_I3D_swap_frame_usage + WGLEW_I3D_swap_frame_usage = _glewSearchExtension("WGL_I3D_swap_frame_usage", extStart, extEnd); + if (glewExperimental || WGLEW_I3D_swap_frame_usage|| crippled) WGLEW_I3D_swap_frame_usage= !_glewInit_WGL_I3D_swap_frame_usage(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_I3D_swap_frame_usage */ +#ifdef WGL_NV_DX_interop + WGLEW_NV_DX_interop = _glewSearchExtension("WGL_NV_DX_interop", extStart, extEnd); + if (glewExperimental || WGLEW_NV_DX_interop|| crippled) WGLEW_NV_DX_interop= !_glewInit_WGL_NV_DX_interop(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_NV_DX_interop */ +#ifdef WGL_NV_DX_interop2 + WGLEW_NV_DX_interop2 = _glewSearchExtension("WGL_NV_DX_interop2", extStart, extEnd); +#endif /* WGL_NV_DX_interop2 */ +#ifdef WGL_NV_copy_image + WGLEW_NV_copy_image = _glewSearchExtension("WGL_NV_copy_image", extStart, extEnd); + if (glewExperimental || WGLEW_NV_copy_image|| crippled) WGLEW_NV_copy_image= !_glewInit_WGL_NV_copy_image(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_NV_copy_image */ +#ifdef WGL_NV_delay_before_swap + WGLEW_NV_delay_before_swap = _glewSearchExtension("WGL_NV_delay_before_swap", extStart, extEnd); + if (glewExperimental || WGLEW_NV_delay_before_swap|| crippled) WGLEW_NV_delay_before_swap= !_glewInit_WGL_NV_delay_before_swap(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_NV_delay_before_swap */ +#ifdef WGL_NV_float_buffer + WGLEW_NV_float_buffer = _glewSearchExtension("WGL_NV_float_buffer", extStart, extEnd); +#endif /* WGL_NV_float_buffer */ +#ifdef WGL_NV_gpu_affinity + WGLEW_NV_gpu_affinity = _glewSearchExtension("WGL_NV_gpu_affinity", extStart, extEnd); + if (glewExperimental || WGLEW_NV_gpu_affinity|| crippled) WGLEW_NV_gpu_affinity= !_glewInit_WGL_NV_gpu_affinity(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_NV_gpu_affinity */ +#ifdef WGL_NV_multisample_coverage + WGLEW_NV_multisample_coverage = _glewSearchExtension("WGL_NV_multisample_coverage", extStart, extEnd); +#endif /* WGL_NV_multisample_coverage */ +#ifdef WGL_NV_present_video + WGLEW_NV_present_video = _glewSearchExtension("WGL_NV_present_video", extStart, extEnd); + if (glewExperimental || WGLEW_NV_present_video|| crippled) WGLEW_NV_present_video= !_glewInit_WGL_NV_present_video(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_NV_present_video */ +#ifdef WGL_NV_render_depth_texture + WGLEW_NV_render_depth_texture = _glewSearchExtension("WGL_NV_render_depth_texture", extStart, extEnd); +#endif /* WGL_NV_render_depth_texture */ +#ifdef WGL_NV_render_texture_rectangle + WGLEW_NV_render_texture_rectangle = _glewSearchExtension("WGL_NV_render_texture_rectangle", extStart, extEnd); +#endif /* WGL_NV_render_texture_rectangle */ +#ifdef WGL_NV_swap_group + WGLEW_NV_swap_group = _glewSearchExtension("WGL_NV_swap_group", extStart, extEnd); + if (glewExperimental || WGLEW_NV_swap_group|| crippled) WGLEW_NV_swap_group= !_glewInit_WGL_NV_swap_group(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_NV_swap_group */ +#ifdef WGL_NV_vertex_array_range + WGLEW_NV_vertex_array_range = _glewSearchExtension("WGL_NV_vertex_array_range", extStart, extEnd); + if (glewExperimental || WGLEW_NV_vertex_array_range|| crippled) WGLEW_NV_vertex_array_range= !_glewInit_WGL_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_NV_vertex_array_range */ +#ifdef WGL_NV_video_capture + WGLEW_NV_video_capture = _glewSearchExtension("WGL_NV_video_capture", extStart, extEnd); + if (glewExperimental || WGLEW_NV_video_capture|| crippled) WGLEW_NV_video_capture= !_glewInit_WGL_NV_video_capture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_NV_video_capture */ +#ifdef WGL_NV_video_output + WGLEW_NV_video_output = _glewSearchExtension("WGL_NV_video_output", extStart, extEnd); + if (glewExperimental || WGLEW_NV_video_output|| crippled) WGLEW_NV_video_output= !_glewInit_WGL_NV_video_output(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_NV_video_output */ +#ifdef WGL_OML_sync_control + WGLEW_OML_sync_control = _glewSearchExtension("WGL_OML_sync_control", extStart, extEnd); + if (glewExperimental || WGLEW_OML_sync_control|| crippled) WGLEW_OML_sync_control= !_glewInit_WGL_OML_sync_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_OML_sync_control */ + + return GLEW_OK; +} + +#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) + +PFNGLXGETCURRENTDISPLAYPROC __glewXGetCurrentDisplay = NULL; + +PFNGLXCHOOSEFBCONFIGPROC __glewXChooseFBConfig = NULL; +PFNGLXCREATENEWCONTEXTPROC __glewXCreateNewContext = NULL; +PFNGLXCREATEPBUFFERPROC __glewXCreatePbuffer = NULL; +PFNGLXCREATEPIXMAPPROC __glewXCreatePixmap = NULL; +PFNGLXCREATEWINDOWPROC __glewXCreateWindow = NULL; +PFNGLXDESTROYPBUFFERPROC __glewXDestroyPbuffer = NULL; +PFNGLXDESTROYPIXMAPPROC __glewXDestroyPixmap = NULL; +PFNGLXDESTROYWINDOWPROC __glewXDestroyWindow = NULL; +PFNGLXGETCURRENTREADDRAWABLEPROC __glewXGetCurrentReadDrawable = NULL; +PFNGLXGETFBCONFIGATTRIBPROC __glewXGetFBConfigAttrib = NULL; +PFNGLXGETFBCONFIGSPROC __glewXGetFBConfigs = NULL; +PFNGLXGETSELECTEDEVENTPROC __glewXGetSelectedEvent = NULL; +PFNGLXGETVISUALFROMFBCONFIGPROC __glewXGetVisualFromFBConfig = NULL; +PFNGLXMAKECONTEXTCURRENTPROC __glewXMakeContextCurrent = NULL; +PFNGLXQUERYCONTEXTPROC __glewXQueryContext = NULL; +PFNGLXQUERYDRAWABLEPROC __glewXQueryDrawable = NULL; +PFNGLXSELECTEVENTPROC __glewXSelectEvent = NULL; + +PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC __glewXBlitContextFramebufferAMD = NULL; +PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC __glewXCreateAssociatedContextAMD = NULL; +PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __glewXCreateAssociatedContextAttribsAMD = NULL; +PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC __glewXDeleteAssociatedContextAMD = NULL; +PFNGLXGETCONTEXTGPUIDAMDPROC __glewXGetContextGPUIDAMD = NULL; +PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC __glewXGetCurrentAssociatedContextAMD = NULL; +PFNGLXGETGPUIDSAMDPROC __glewXGetGPUIDsAMD = NULL; +PFNGLXGETGPUINFOAMDPROC __glewXGetGPUInfoAMD = NULL; +PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __glewXMakeAssociatedContextCurrentAMD = NULL; + +PFNGLXCREATECONTEXTATTRIBSARBPROC __glewXCreateContextAttribsARB = NULL; + +PFNGLXBINDTEXIMAGEATIPROC __glewXBindTexImageATI = NULL; +PFNGLXDRAWABLEATTRIBATIPROC __glewXDrawableAttribATI = NULL; +PFNGLXRELEASETEXIMAGEATIPROC __glewXReleaseTexImageATI = NULL; + +PFNGLXFREECONTEXTEXTPROC __glewXFreeContextEXT = NULL; +PFNGLXGETCONTEXTIDEXTPROC __glewXGetContextIDEXT = NULL; +PFNGLXIMPORTCONTEXTEXTPROC __glewXImportContextEXT = NULL; +PFNGLXQUERYCONTEXTINFOEXTPROC __glewXQueryContextInfoEXT = NULL; + +PFNGLXSWAPINTERVALEXTPROC __glewXSwapIntervalEXT = NULL; + +PFNGLXBINDTEXIMAGEEXTPROC __glewXBindTexImageEXT = NULL; +PFNGLXRELEASETEXIMAGEEXTPROC __glewXReleaseTexImageEXT = NULL; + +PFNGLXGETAGPOFFSETMESAPROC __glewXGetAGPOffsetMESA = NULL; + +PFNGLXCOPYSUBBUFFERMESAPROC __glewXCopySubBufferMESA = NULL; + +PFNGLXCREATEGLXPIXMAPMESAPROC __glewXCreateGLXPixmapMESA = NULL; + +PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC __glewXQueryCurrentRendererIntegerMESA = NULL; +PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC __glewXQueryCurrentRendererStringMESA = NULL; +PFNGLXQUERYRENDERERINTEGERMESAPROC __glewXQueryRendererIntegerMESA = NULL; +PFNGLXQUERYRENDERERSTRINGMESAPROC __glewXQueryRendererStringMESA = NULL; + +PFNGLXRELEASEBUFFERSMESAPROC __glewXReleaseBuffersMESA = NULL; + +PFNGLXSET3DFXMODEMESAPROC __glewXSet3DfxModeMESA = NULL; + +PFNGLXGETSWAPINTERVALMESAPROC __glewXGetSwapIntervalMESA = NULL; +PFNGLXSWAPINTERVALMESAPROC __glewXSwapIntervalMESA = NULL; + +PFNGLXCOPYBUFFERSUBDATANVPROC __glewXCopyBufferSubDataNV = NULL; +PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC __glewXNamedCopyBufferSubDataNV = NULL; + +PFNGLXCOPYIMAGESUBDATANVPROC __glewXCopyImageSubDataNV = NULL; + +PFNGLXDELAYBEFORESWAPNVPROC __glewXDelayBeforeSwapNV = NULL; + +PFNGLXBINDVIDEODEVICENVPROC __glewXBindVideoDeviceNV = NULL; +PFNGLXENUMERATEVIDEODEVICESNVPROC __glewXEnumerateVideoDevicesNV = NULL; + +PFNGLXBINDSWAPBARRIERNVPROC __glewXBindSwapBarrierNV = NULL; +PFNGLXJOINSWAPGROUPNVPROC __glewXJoinSwapGroupNV = NULL; +PFNGLXQUERYFRAMECOUNTNVPROC __glewXQueryFrameCountNV = NULL; +PFNGLXQUERYMAXSWAPGROUPSNVPROC __glewXQueryMaxSwapGroupsNV = NULL; +PFNGLXQUERYSWAPGROUPNVPROC __glewXQuerySwapGroupNV = NULL; +PFNGLXRESETFRAMECOUNTNVPROC __glewXResetFrameCountNV = NULL; + +PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV = NULL; +PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV = NULL; + +PFNGLXBINDVIDEOCAPTUREDEVICENVPROC __glewXBindVideoCaptureDeviceNV = NULL; +PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC __glewXEnumerateVideoCaptureDevicesNV = NULL; +PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC __glewXLockVideoCaptureDeviceNV = NULL; +PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC __glewXQueryVideoCaptureDeviceNV = NULL; +PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC __glewXReleaseVideoCaptureDeviceNV = NULL; + +PFNGLXBINDVIDEOIMAGENVPROC __glewXBindVideoImageNV = NULL; +PFNGLXGETVIDEODEVICENVPROC __glewXGetVideoDeviceNV = NULL; +PFNGLXGETVIDEOINFONVPROC __glewXGetVideoInfoNV = NULL; +PFNGLXRELEASEVIDEODEVICENVPROC __glewXReleaseVideoDeviceNV = NULL; +PFNGLXRELEASEVIDEOIMAGENVPROC __glewXReleaseVideoImageNV = NULL; +PFNGLXSENDPBUFFERTOVIDEONVPROC __glewXSendPbufferToVideoNV = NULL; + +PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML = NULL; +PFNGLXGETSYNCVALUESOMLPROC __glewXGetSyncValuesOML = NULL; +PFNGLXSWAPBUFFERSMSCOMLPROC __glewXSwapBuffersMscOML = NULL; +PFNGLXWAITFORMSCOMLPROC __glewXWaitForMscOML = NULL; +PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML = NULL; + +PFNGLXCHOOSEFBCONFIGSGIXPROC __glewXChooseFBConfigSGIX = NULL; +PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC __glewXCreateContextWithConfigSGIX = NULL; +PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC __glewXCreateGLXPixmapWithConfigSGIX = NULL; +PFNGLXGETFBCONFIGATTRIBSGIXPROC __glewXGetFBConfigAttribSGIX = NULL; +PFNGLXGETFBCONFIGFROMVISUALSGIXPROC __glewXGetFBConfigFromVisualSGIX = NULL; +PFNGLXGETVISUALFROMFBCONFIGSGIXPROC __glewXGetVisualFromFBConfigSGIX = NULL; + +PFNGLXBINDHYPERPIPESGIXPROC __glewXBindHyperpipeSGIX = NULL; +PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC __glewXDestroyHyperpipeConfigSGIX = NULL; +PFNGLXHYPERPIPEATTRIBSGIXPROC __glewXHyperpipeAttribSGIX = NULL; +PFNGLXHYPERPIPECONFIGSGIXPROC __glewXHyperpipeConfigSGIX = NULL; +PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC __glewXQueryHyperpipeAttribSGIX = NULL; +PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC __glewXQueryHyperpipeBestAttribSGIX = NULL; +PFNGLXQUERYHYPERPIPECONFIGSGIXPROC __glewXQueryHyperpipeConfigSGIX = NULL; +PFNGLXQUERYHYPERPIPENETWORKSGIXPROC __glewXQueryHyperpipeNetworkSGIX = NULL; + +PFNGLXCREATEGLXPBUFFERSGIXPROC __glewXCreateGLXPbufferSGIX = NULL; +PFNGLXDESTROYGLXPBUFFERSGIXPROC __glewXDestroyGLXPbufferSGIX = NULL; +PFNGLXGETSELECTEDEVENTSGIXPROC __glewXGetSelectedEventSGIX = NULL; +PFNGLXQUERYGLXPBUFFERSGIXPROC __glewXQueryGLXPbufferSGIX = NULL; +PFNGLXSELECTEVENTSGIXPROC __glewXSelectEventSGIX = NULL; + +PFNGLXBINDSWAPBARRIERSGIXPROC __glewXBindSwapBarrierSGIX = NULL; +PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC __glewXQueryMaxSwapBarriersSGIX = NULL; + +PFNGLXJOINSWAPGROUPSGIXPROC __glewXJoinSwapGroupSGIX = NULL; + +PFNGLXBINDCHANNELTOWINDOWSGIXPROC __glewXBindChannelToWindowSGIX = NULL; +PFNGLXCHANNELRECTSGIXPROC __glewXChannelRectSGIX = NULL; +PFNGLXCHANNELRECTSYNCSGIXPROC __glewXChannelRectSyncSGIX = NULL; +PFNGLXQUERYCHANNELDELTASSGIXPROC __glewXQueryChannelDeltasSGIX = NULL; +PFNGLXQUERYCHANNELRECTSGIXPROC __glewXQueryChannelRectSGIX = NULL; + +PFNGLXCUSHIONSGIPROC __glewXCushionSGI = NULL; + +PFNGLXGETCURRENTREADDRAWABLESGIPROC __glewXGetCurrentReadDrawableSGI = NULL; +PFNGLXMAKECURRENTREADSGIPROC __glewXMakeCurrentReadSGI = NULL; + +PFNGLXSWAPINTERVALSGIPROC __glewXSwapIntervalSGI = NULL; + +PFNGLXGETVIDEOSYNCSGIPROC __glewXGetVideoSyncSGI = NULL; +PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI = NULL; + +PFNGLXGETTRANSPARENTINDEXSUNPROC __glewXGetTransparentIndexSUN = NULL; + +PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN = NULL; +PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN = NULL; + +#if !defined(GLEW_MX) + +GLboolean __GLXEW_VERSION_1_0 = GL_FALSE; +GLboolean __GLXEW_VERSION_1_1 = GL_FALSE; +GLboolean __GLXEW_VERSION_1_2 = GL_FALSE; +GLboolean __GLXEW_VERSION_1_3 = GL_FALSE; +GLboolean __GLXEW_VERSION_1_4 = GL_FALSE; +GLboolean __GLXEW_3DFX_multisample = GL_FALSE; +GLboolean __GLXEW_AMD_gpu_association = GL_FALSE; +GLboolean __GLXEW_ARB_context_flush_control = GL_FALSE; +GLboolean __GLXEW_ARB_create_context = GL_FALSE; +GLboolean __GLXEW_ARB_create_context_profile = GL_FALSE; +GLboolean __GLXEW_ARB_create_context_robustness = GL_FALSE; +GLboolean __GLXEW_ARB_fbconfig_float = GL_FALSE; +GLboolean __GLXEW_ARB_framebuffer_sRGB = GL_FALSE; +GLboolean __GLXEW_ARB_get_proc_address = GL_FALSE; +GLboolean __GLXEW_ARB_multisample = GL_FALSE; +GLboolean __GLXEW_ARB_robustness_application_isolation = GL_FALSE; +GLboolean __GLXEW_ARB_robustness_share_group_isolation = GL_FALSE; +GLboolean __GLXEW_ARB_vertex_buffer_object = GL_FALSE; +GLboolean __GLXEW_ATI_pixel_format_float = GL_FALSE; +GLboolean __GLXEW_ATI_render_texture = GL_FALSE; +GLboolean __GLXEW_EXT_buffer_age = GL_FALSE; +GLboolean __GLXEW_EXT_create_context_es2_profile = GL_FALSE; +GLboolean __GLXEW_EXT_create_context_es_profile = GL_FALSE; +GLboolean __GLXEW_EXT_fbconfig_packed_float = GL_FALSE; +GLboolean __GLXEW_EXT_framebuffer_sRGB = GL_FALSE; +GLboolean __GLXEW_EXT_import_context = GL_FALSE; +GLboolean __GLXEW_EXT_scene_marker = GL_FALSE; +GLboolean __GLXEW_EXT_stereo_tree = GL_FALSE; +GLboolean __GLXEW_EXT_swap_control = GL_FALSE; +GLboolean __GLXEW_EXT_swap_control_tear = GL_FALSE; +GLboolean __GLXEW_EXT_texture_from_pixmap = GL_FALSE; +GLboolean __GLXEW_EXT_visual_info = GL_FALSE; +GLboolean __GLXEW_EXT_visual_rating = GL_FALSE; +GLboolean __GLXEW_INTEL_swap_event = GL_FALSE; +GLboolean __GLXEW_MESA_agp_offset = GL_FALSE; +GLboolean __GLXEW_MESA_copy_sub_buffer = GL_FALSE; +GLboolean __GLXEW_MESA_pixmap_colormap = GL_FALSE; +GLboolean __GLXEW_MESA_query_renderer = GL_FALSE; +GLboolean __GLXEW_MESA_release_buffers = GL_FALSE; +GLboolean __GLXEW_MESA_set_3dfx_mode = GL_FALSE; +GLboolean __GLXEW_MESA_swap_control = GL_FALSE; +GLboolean __GLXEW_NV_copy_buffer = GL_FALSE; +GLboolean __GLXEW_NV_copy_image = GL_FALSE; +GLboolean __GLXEW_NV_delay_before_swap = GL_FALSE; +GLboolean __GLXEW_NV_float_buffer = GL_FALSE; +GLboolean __GLXEW_NV_multisample_coverage = GL_FALSE; +GLboolean __GLXEW_NV_present_video = GL_FALSE; +GLboolean __GLXEW_NV_swap_group = GL_FALSE; +GLboolean __GLXEW_NV_vertex_array_range = GL_FALSE; +GLboolean __GLXEW_NV_video_capture = GL_FALSE; +GLboolean __GLXEW_NV_video_out = GL_FALSE; +GLboolean __GLXEW_OML_swap_method = GL_FALSE; +GLboolean __GLXEW_OML_sync_control = GL_FALSE; +GLboolean __GLXEW_SGIS_blended_overlay = GL_FALSE; +GLboolean __GLXEW_SGIS_color_range = GL_FALSE; +GLboolean __GLXEW_SGIS_multisample = GL_FALSE; +GLboolean __GLXEW_SGIS_shared_multisample = GL_FALSE; +GLboolean __GLXEW_SGIX_fbconfig = GL_FALSE; +GLboolean __GLXEW_SGIX_hyperpipe = GL_FALSE; +GLboolean __GLXEW_SGIX_pbuffer = GL_FALSE; +GLboolean __GLXEW_SGIX_swap_barrier = GL_FALSE; +GLboolean __GLXEW_SGIX_swap_group = GL_FALSE; +GLboolean __GLXEW_SGIX_video_resize = GL_FALSE; +GLboolean __GLXEW_SGIX_visual_select_group = GL_FALSE; +GLboolean __GLXEW_SGI_cushion = GL_FALSE; +GLboolean __GLXEW_SGI_make_current_read = GL_FALSE; +GLboolean __GLXEW_SGI_swap_control = GL_FALSE; +GLboolean __GLXEW_SGI_video_sync = GL_FALSE; +GLboolean __GLXEW_SUN_get_transparent_index = GL_FALSE; +GLboolean __GLXEW_SUN_video_resize = GL_FALSE; + +#endif /* !GLEW_MX */ + +#ifdef GLX_VERSION_1_2 + +static GLboolean _glewInit_GLX_VERSION_1_2 (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetCurrentDisplay = (PFNGLXGETCURRENTDISPLAYPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentDisplay")) == NULL) || r; + + return r; +} + +#endif /* GLX_VERSION_1_2 */ + +#ifdef GLX_VERSION_1_3 + +static GLboolean _glewInit_GLX_VERSION_1_3 (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)glewGetProcAddress((const GLubyte*)"glXChooseFBConfig")) == NULL) || r; + r = ((glXCreateNewContext = (PFNGLXCREATENEWCONTEXTPROC)glewGetProcAddress((const GLubyte*)"glXCreateNewContext")) == NULL) || r; + r = ((glXCreatePbuffer = (PFNGLXCREATEPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glXCreatePbuffer")) == NULL) || r; + r = ((glXCreatePixmap = (PFNGLXCREATEPIXMAPPROC)glewGetProcAddress((const GLubyte*)"glXCreatePixmap")) == NULL) || r; + r = ((glXCreateWindow = (PFNGLXCREATEWINDOWPROC)glewGetProcAddress((const GLubyte*)"glXCreateWindow")) == NULL) || r; + r = ((glXDestroyPbuffer = (PFNGLXDESTROYPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glXDestroyPbuffer")) == NULL) || r; + r = ((glXDestroyPixmap = (PFNGLXDESTROYPIXMAPPROC)glewGetProcAddress((const GLubyte*)"glXDestroyPixmap")) == NULL) || r; + r = ((glXDestroyWindow = (PFNGLXDESTROYWINDOWPROC)glewGetProcAddress((const GLubyte*)"glXDestroyWindow")) == NULL) || r; + r = ((glXGetCurrentReadDrawable = (PFNGLXGETCURRENTREADDRAWABLEPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentReadDrawable")) == NULL) || r; + r = ((glXGetFBConfigAttrib = (PFNGLXGETFBCONFIGATTRIBPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigAttrib")) == NULL) || r; + r = ((glXGetFBConfigs = (PFNGLXGETFBCONFIGSPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigs")) == NULL) || r; + r = ((glXGetSelectedEvent = (PFNGLXGETSELECTEDEVENTPROC)glewGetProcAddress((const GLubyte*)"glXGetSelectedEvent")) == NULL) || r; + r = ((glXGetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)glewGetProcAddress((const GLubyte*)"glXGetVisualFromFBConfig")) == NULL) || r; + r = ((glXMakeContextCurrent = (PFNGLXMAKECONTEXTCURRENTPROC)glewGetProcAddress((const GLubyte*)"glXMakeContextCurrent")) == NULL) || r; + r = ((glXQueryContext = (PFNGLXQUERYCONTEXTPROC)glewGetProcAddress((const GLubyte*)"glXQueryContext")) == NULL) || r; + r = ((glXQueryDrawable = (PFNGLXQUERYDRAWABLEPROC)glewGetProcAddress((const GLubyte*)"glXQueryDrawable")) == NULL) || r; + r = ((glXSelectEvent = (PFNGLXSELECTEVENTPROC)glewGetProcAddress((const GLubyte*)"glXSelectEvent")) == NULL) || r; + + return r; +} + +#endif /* GLX_VERSION_1_3 */ + +#ifdef GLX_AMD_gpu_association + +static GLboolean _glewInit_GLX_AMD_gpu_association (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXBlitContextFramebufferAMD = (PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC)glewGetProcAddress((const GLubyte*)"glXBlitContextFramebufferAMD")) == NULL) || r; + r = ((glXCreateAssociatedContextAMD = (PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"glXCreateAssociatedContextAMD")) == NULL) || r; + r = ((glXCreateAssociatedContextAttribsAMD = (PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC)glewGetProcAddress((const GLubyte*)"glXCreateAssociatedContextAttribsAMD")) == NULL) || r; + r = ((glXDeleteAssociatedContextAMD = (PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"glXDeleteAssociatedContextAMD")) == NULL) || r; + r = ((glXGetContextGPUIDAMD = (PFNGLXGETCONTEXTGPUIDAMDPROC)glewGetProcAddress((const GLubyte*)"glXGetContextGPUIDAMD")) == NULL) || r; + r = ((glXGetCurrentAssociatedContextAMD = (PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentAssociatedContextAMD")) == NULL) || r; + r = ((glXGetGPUIDsAMD = (PFNGLXGETGPUIDSAMDPROC)glewGetProcAddress((const GLubyte*)"glXGetGPUIDsAMD")) == NULL) || r; + r = ((glXGetGPUInfoAMD = (PFNGLXGETGPUINFOAMDPROC)glewGetProcAddress((const GLubyte*)"glXGetGPUInfoAMD")) == NULL) || r; + r = ((glXMakeAssociatedContextCurrentAMD = (PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC)glewGetProcAddress((const GLubyte*)"glXMakeAssociatedContextCurrentAMD")) == NULL) || r; + + return r; +} + +#endif /* GLX_AMD_gpu_association */ + +#ifdef GLX_ARB_create_context + +static GLboolean _glewInit_GLX_ARB_create_context (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glewGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB")) == NULL) || r; + + return r; +} + +#endif /* GLX_ARB_create_context */ + +#ifdef GLX_ATI_render_texture + +static GLboolean _glewInit_GLX_ATI_render_texture (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXBindTexImageATI = (PFNGLXBINDTEXIMAGEATIPROC)glewGetProcAddress((const GLubyte*)"glXBindTexImageATI")) == NULL) || r; + r = ((glXDrawableAttribATI = (PFNGLXDRAWABLEATTRIBATIPROC)glewGetProcAddress((const GLubyte*)"glXDrawableAttribATI")) == NULL) || r; + r = ((glXReleaseTexImageATI = (PFNGLXRELEASETEXIMAGEATIPROC)glewGetProcAddress((const GLubyte*)"glXReleaseTexImageATI")) == NULL) || r; + + return r; +} + +#endif /* GLX_ATI_render_texture */ + +#ifdef GLX_EXT_import_context + +static GLboolean _glewInit_GLX_EXT_import_context (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXFreeContextEXT = (PFNGLXFREECONTEXTEXTPROC)glewGetProcAddress((const GLubyte*)"glXFreeContextEXT")) == NULL) || r; + r = ((glXGetContextIDEXT = (PFNGLXGETCONTEXTIDEXTPROC)glewGetProcAddress((const GLubyte*)"glXGetContextIDEXT")) == NULL) || r; + r = ((glXImportContextEXT = (PFNGLXIMPORTCONTEXTEXTPROC)glewGetProcAddress((const GLubyte*)"glXImportContextEXT")) == NULL) || r; + r = ((glXQueryContextInfoEXT = (PFNGLXQUERYCONTEXTINFOEXTPROC)glewGetProcAddress((const GLubyte*)"glXQueryContextInfoEXT")) == NULL) || r; + + return r; +} + +#endif /* GLX_EXT_import_context */ + +#ifdef GLX_EXT_swap_control + +static GLboolean _glewInit_GLX_EXT_swap_control (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"glXSwapIntervalEXT")) == NULL) || r; + + return r; +} + +#endif /* GLX_EXT_swap_control */ + +#ifdef GLX_EXT_texture_from_pixmap + +static GLboolean _glewInit_GLX_EXT_texture_from_pixmap (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXBindTexImageEXT = (PFNGLXBINDTEXIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glXBindTexImageEXT")) == NULL) || r; + r = ((glXReleaseTexImageEXT = (PFNGLXRELEASETEXIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glXReleaseTexImageEXT")) == NULL) || r; + + return r; +} + +#endif /* GLX_EXT_texture_from_pixmap */ + +#ifdef GLX_MESA_agp_offset + +static GLboolean _glewInit_GLX_MESA_agp_offset (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetAGPOffsetMESA = (PFNGLXGETAGPOFFSETMESAPROC)glewGetProcAddress((const GLubyte*)"glXGetAGPOffsetMESA")) == NULL) || r; + + return r; +} + +#endif /* GLX_MESA_agp_offset */ + +#ifdef GLX_MESA_copy_sub_buffer + +static GLboolean _glewInit_GLX_MESA_copy_sub_buffer (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXCopySubBufferMESA = (PFNGLXCOPYSUBBUFFERMESAPROC)glewGetProcAddress((const GLubyte*)"glXCopySubBufferMESA")) == NULL) || r; + + return r; +} + +#endif /* GLX_MESA_copy_sub_buffer */ + +#ifdef GLX_MESA_pixmap_colormap + +static GLboolean _glewInit_GLX_MESA_pixmap_colormap (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXCreateGLXPixmapMESA = (PFNGLXCREATEGLXPIXMAPMESAPROC)glewGetProcAddress((const GLubyte*)"glXCreateGLXPixmapMESA")) == NULL) || r; + + return r; +} + +#endif /* GLX_MESA_pixmap_colormap */ + +#ifdef GLX_MESA_query_renderer + +static GLboolean _glewInit_GLX_MESA_query_renderer (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXQueryCurrentRendererIntegerMESA = (PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC)glewGetProcAddress((const GLubyte*)"glXQueryCurrentRendererIntegerMESA")) == NULL) || r; + r = ((glXQueryCurrentRendererStringMESA = (PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC)glewGetProcAddress((const GLubyte*)"glXQueryCurrentRendererStringMESA")) == NULL) || r; + r = ((glXQueryRendererIntegerMESA = (PFNGLXQUERYRENDERERINTEGERMESAPROC)glewGetProcAddress((const GLubyte*)"glXQueryRendererIntegerMESA")) == NULL) || r; + r = ((glXQueryRendererStringMESA = (PFNGLXQUERYRENDERERSTRINGMESAPROC)glewGetProcAddress((const GLubyte*)"glXQueryRendererStringMESA")) == NULL) || r; + + return r; +} + +#endif /* GLX_MESA_query_renderer */ + +#ifdef GLX_MESA_release_buffers + +static GLboolean _glewInit_GLX_MESA_release_buffers (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXReleaseBuffersMESA = (PFNGLXRELEASEBUFFERSMESAPROC)glewGetProcAddress((const GLubyte*)"glXReleaseBuffersMESA")) == NULL) || r; + + return r; +} + +#endif /* GLX_MESA_release_buffers */ + +#ifdef GLX_MESA_set_3dfx_mode + +static GLboolean _glewInit_GLX_MESA_set_3dfx_mode (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXSet3DfxModeMESA = (PFNGLXSET3DFXMODEMESAPROC)glewGetProcAddress((const GLubyte*)"glXSet3DfxModeMESA")) == NULL) || r; + + return r; +} + +#endif /* GLX_MESA_set_3dfx_mode */ + +#ifdef GLX_MESA_swap_control + +static GLboolean _glewInit_GLX_MESA_swap_control (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetSwapIntervalMESA = (PFNGLXGETSWAPINTERVALMESAPROC)glewGetProcAddress((const GLubyte*)"glXGetSwapIntervalMESA")) == NULL) || r; + r = ((glXSwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)glewGetProcAddress((const GLubyte*)"glXSwapIntervalMESA")) == NULL) || r; + + return r; +} + +#endif /* GLX_MESA_swap_control */ + +#ifdef GLX_NV_copy_buffer + +static GLboolean _glewInit_GLX_NV_copy_buffer (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXCopyBufferSubDataNV = (PFNGLXCOPYBUFFERSUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glXCopyBufferSubDataNV")) == NULL) || r; + r = ((glXNamedCopyBufferSubDataNV = (PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glXNamedCopyBufferSubDataNV")) == NULL) || r; + + return r; +} + +#endif /* GLX_NV_copy_buffer */ + +#ifdef GLX_NV_copy_image + +static GLboolean _glewInit_GLX_NV_copy_image (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXCopyImageSubDataNV = (PFNGLXCOPYIMAGESUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glXCopyImageSubDataNV")) == NULL) || r; + + return r; +} + +#endif /* GLX_NV_copy_image */ + +#ifdef GLX_NV_delay_before_swap + +static GLboolean _glewInit_GLX_NV_delay_before_swap (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXDelayBeforeSwapNV = (PFNGLXDELAYBEFORESWAPNVPROC)glewGetProcAddress((const GLubyte*)"glXDelayBeforeSwapNV")) == NULL) || r; + + return r; +} + +#endif /* GLX_NV_delay_before_swap */ + +#ifdef GLX_NV_present_video + +static GLboolean _glewInit_GLX_NV_present_video (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXBindVideoDeviceNV = (PFNGLXBINDVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXBindVideoDeviceNV")) == NULL) || r; + r = ((glXEnumerateVideoDevicesNV = (PFNGLXENUMERATEVIDEODEVICESNVPROC)glewGetProcAddress((const GLubyte*)"glXEnumerateVideoDevicesNV")) == NULL) || r; + + return r; +} + +#endif /* GLX_NV_present_video */ + +#ifdef GLX_NV_swap_group + +static GLboolean _glewInit_GLX_NV_swap_group (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXBindSwapBarrierNV = (PFNGLXBINDSWAPBARRIERNVPROC)glewGetProcAddress((const GLubyte*)"glXBindSwapBarrierNV")) == NULL) || r; + r = ((glXJoinSwapGroupNV = (PFNGLXJOINSWAPGROUPNVPROC)glewGetProcAddress((const GLubyte*)"glXJoinSwapGroupNV")) == NULL) || r; + r = ((glXQueryFrameCountNV = (PFNGLXQUERYFRAMECOUNTNVPROC)glewGetProcAddress((const GLubyte*)"glXQueryFrameCountNV")) == NULL) || r; + r = ((glXQueryMaxSwapGroupsNV = (PFNGLXQUERYMAXSWAPGROUPSNVPROC)glewGetProcAddress((const GLubyte*)"glXQueryMaxSwapGroupsNV")) == NULL) || r; + r = ((glXQuerySwapGroupNV = (PFNGLXQUERYSWAPGROUPNVPROC)glewGetProcAddress((const GLubyte*)"glXQuerySwapGroupNV")) == NULL) || r; + r = ((glXResetFrameCountNV = (PFNGLXRESETFRAMECOUNTNVPROC)glewGetProcAddress((const GLubyte*)"glXResetFrameCountNV")) == NULL) || r; + + return r; +} + +#endif /* GLX_NV_swap_group */ + +#ifdef GLX_NV_vertex_array_range + +static GLboolean _glewInit_GLX_NV_vertex_array_range (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXAllocateMemoryNV = (PFNGLXALLOCATEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"glXAllocateMemoryNV")) == NULL) || r; + r = ((glXFreeMemoryNV = (PFNGLXFREEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"glXFreeMemoryNV")) == NULL) || r; + + return r; +} + +#endif /* GLX_NV_vertex_array_range */ + +#ifdef GLX_NV_video_capture + +static GLboolean _glewInit_GLX_NV_video_capture (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXBindVideoCaptureDeviceNV = (PFNGLXBINDVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXBindVideoCaptureDeviceNV")) == NULL) || r; + r = ((glXEnumerateVideoCaptureDevicesNV = (PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC)glewGetProcAddress((const GLubyte*)"glXEnumerateVideoCaptureDevicesNV")) == NULL) || r; + r = ((glXLockVideoCaptureDeviceNV = (PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXLockVideoCaptureDeviceNV")) == NULL) || r; + r = ((glXQueryVideoCaptureDeviceNV = (PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXQueryVideoCaptureDeviceNV")) == NULL) || r; + r = ((glXReleaseVideoCaptureDeviceNV = (PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXReleaseVideoCaptureDeviceNV")) == NULL) || r; + + return r; +} + +#endif /* GLX_NV_video_capture */ + +#ifdef GLX_NV_video_out + +static GLboolean _glewInit_GLX_NV_video_out (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXBindVideoImageNV = (PFNGLXBINDVIDEOIMAGENVPROC)glewGetProcAddress((const GLubyte*)"glXBindVideoImageNV")) == NULL) || r; + r = ((glXGetVideoDeviceNV = (PFNGLXGETVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoDeviceNV")) == NULL) || r; + r = ((glXGetVideoInfoNV = (PFNGLXGETVIDEOINFONVPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoInfoNV")) == NULL) || r; + r = ((glXReleaseVideoDeviceNV = (PFNGLXRELEASEVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXReleaseVideoDeviceNV")) == NULL) || r; + r = ((glXReleaseVideoImageNV = (PFNGLXRELEASEVIDEOIMAGENVPROC)glewGetProcAddress((const GLubyte*)"glXReleaseVideoImageNV")) == NULL) || r; + r = ((glXSendPbufferToVideoNV = (PFNGLXSENDPBUFFERTOVIDEONVPROC)glewGetProcAddress((const GLubyte*)"glXSendPbufferToVideoNV")) == NULL) || r; + + return r; +} + +#endif /* GLX_NV_video_out */ + +#ifdef GLX_OML_sync_control + +static GLboolean _glewInit_GLX_OML_sync_control (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetMscRateOML = (PFNGLXGETMSCRATEOMLPROC)glewGetProcAddress((const GLubyte*)"glXGetMscRateOML")) == NULL) || r; + r = ((glXGetSyncValuesOML = (PFNGLXGETSYNCVALUESOMLPROC)glewGetProcAddress((const GLubyte*)"glXGetSyncValuesOML")) == NULL) || r; + r = ((glXSwapBuffersMscOML = (PFNGLXSWAPBUFFERSMSCOMLPROC)glewGetProcAddress((const GLubyte*)"glXSwapBuffersMscOML")) == NULL) || r; + r = ((glXWaitForMscOML = (PFNGLXWAITFORMSCOMLPROC)glewGetProcAddress((const GLubyte*)"glXWaitForMscOML")) == NULL) || r; + r = ((glXWaitForSbcOML = (PFNGLXWAITFORSBCOMLPROC)glewGetProcAddress((const GLubyte*)"glXWaitForSbcOML")) == NULL) || r; + + return r; +} + +#endif /* GLX_OML_sync_control */ + +#ifdef GLX_SGIX_fbconfig + +static GLboolean _glewInit_GLX_SGIX_fbconfig (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXChooseFBConfigSGIX = (PFNGLXCHOOSEFBCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXChooseFBConfigSGIX")) == NULL) || r; + r = ((glXCreateContextWithConfigSGIX = (PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXCreateContextWithConfigSGIX")) == NULL) || r; + r = ((glXCreateGLXPixmapWithConfigSGIX = (PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXCreateGLXPixmapWithConfigSGIX")) == NULL) || r; + r = ((glXGetFBConfigAttribSGIX = (PFNGLXGETFBCONFIGATTRIBSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigAttribSGIX")) == NULL) || r; + r = ((glXGetFBConfigFromVisualSGIX = (PFNGLXGETFBCONFIGFROMVISUALSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigFromVisualSGIX")) == NULL) || r; + r = ((glXGetVisualFromFBConfigSGIX = (PFNGLXGETVISUALFROMFBCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetVisualFromFBConfigSGIX")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGIX_fbconfig */ + +#ifdef GLX_SGIX_hyperpipe + +static GLboolean _glewInit_GLX_SGIX_hyperpipe (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXBindHyperpipeSGIX = (PFNGLXBINDHYPERPIPESGIXPROC)glewGetProcAddress((const GLubyte*)"glXBindHyperpipeSGIX")) == NULL) || r; + r = ((glXDestroyHyperpipeConfigSGIX = (PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXDestroyHyperpipeConfigSGIX")) == NULL) || r; + r = ((glXHyperpipeAttribSGIX = (PFNGLXHYPERPIPEATTRIBSGIXPROC)glewGetProcAddress((const GLubyte*)"glXHyperpipeAttribSGIX")) == NULL) || r; + r = ((glXHyperpipeConfigSGIX = (PFNGLXHYPERPIPECONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXHyperpipeConfigSGIX")) == NULL) || r; + r = ((glXQueryHyperpipeAttribSGIX = (PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryHyperpipeAttribSGIX")) == NULL) || r; + r = ((glXQueryHyperpipeBestAttribSGIX = (PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryHyperpipeBestAttribSGIX")) == NULL) || r; + r = ((glXQueryHyperpipeConfigSGIX = (PFNGLXQUERYHYPERPIPECONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryHyperpipeConfigSGIX")) == NULL) || r; + r = ((glXQueryHyperpipeNetworkSGIX = (PFNGLXQUERYHYPERPIPENETWORKSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryHyperpipeNetworkSGIX")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGIX_hyperpipe */ + +#ifdef GLX_SGIX_pbuffer + +static GLboolean _glewInit_GLX_SGIX_pbuffer (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXCreateGLXPbufferSGIX = (PFNGLXCREATEGLXPBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXCreateGLXPbufferSGIX")) == NULL) || r; + r = ((glXDestroyGLXPbufferSGIX = (PFNGLXDESTROYGLXPBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXDestroyGLXPbufferSGIX")) == NULL) || r; + r = ((glXGetSelectedEventSGIX = (PFNGLXGETSELECTEDEVENTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetSelectedEventSGIX")) == NULL) || r; + r = ((glXQueryGLXPbufferSGIX = (PFNGLXQUERYGLXPBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryGLXPbufferSGIX")) == NULL) || r; + r = ((glXSelectEventSGIX = (PFNGLXSELECTEVENTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXSelectEventSGIX")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGIX_pbuffer */ + +#ifdef GLX_SGIX_swap_barrier + +static GLboolean _glewInit_GLX_SGIX_swap_barrier (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXBindSwapBarrierSGIX = (PFNGLXBINDSWAPBARRIERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXBindSwapBarrierSGIX")) == NULL) || r; + r = ((glXQueryMaxSwapBarriersSGIX = (PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryMaxSwapBarriersSGIX")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGIX_swap_barrier */ + +#ifdef GLX_SGIX_swap_group + +static GLboolean _glewInit_GLX_SGIX_swap_group (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXJoinSwapGroupSGIX = (PFNGLXJOINSWAPGROUPSGIXPROC)glewGetProcAddress((const GLubyte*)"glXJoinSwapGroupSGIX")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGIX_swap_group */ + +#ifdef GLX_SGIX_video_resize + +static GLboolean _glewInit_GLX_SGIX_video_resize (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXBindChannelToWindowSGIX = (PFNGLXBINDCHANNELTOWINDOWSGIXPROC)glewGetProcAddress((const GLubyte*)"glXBindChannelToWindowSGIX")) == NULL) || r; + r = ((glXChannelRectSGIX = (PFNGLXCHANNELRECTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXChannelRectSGIX")) == NULL) || r; + r = ((glXChannelRectSyncSGIX = (PFNGLXCHANNELRECTSYNCSGIXPROC)glewGetProcAddress((const GLubyte*)"glXChannelRectSyncSGIX")) == NULL) || r; + r = ((glXQueryChannelDeltasSGIX = (PFNGLXQUERYCHANNELDELTASSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryChannelDeltasSGIX")) == NULL) || r; + r = ((glXQueryChannelRectSGIX = (PFNGLXQUERYCHANNELRECTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryChannelRectSGIX")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGIX_video_resize */ + +#ifdef GLX_SGI_cushion + +static GLboolean _glewInit_GLX_SGI_cushion (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXCushionSGI = (PFNGLXCUSHIONSGIPROC)glewGetProcAddress((const GLubyte*)"glXCushionSGI")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGI_cushion */ + +#ifdef GLX_SGI_make_current_read + +static GLboolean _glewInit_GLX_SGI_make_current_read (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetCurrentReadDrawableSGI = (PFNGLXGETCURRENTREADDRAWABLESGIPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentReadDrawableSGI")) == NULL) || r; + r = ((glXMakeCurrentReadSGI = (PFNGLXMAKECURRENTREADSGIPROC)glewGetProcAddress((const GLubyte*)"glXMakeCurrentReadSGI")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGI_make_current_read */ + +#ifdef GLX_SGI_swap_control + +static GLboolean _glewInit_GLX_SGI_swap_control (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)glewGetProcAddress((const GLubyte*)"glXSwapIntervalSGI")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGI_swap_control */ + +#ifdef GLX_SGI_video_sync + +static GLboolean _glewInit_GLX_SGI_video_sync (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetVideoSyncSGI = (PFNGLXGETVIDEOSYNCSGIPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoSyncSGI")) == NULL) || r; + r = ((glXWaitVideoSyncSGI = (PFNGLXWAITVIDEOSYNCSGIPROC)glewGetProcAddress((const GLubyte*)"glXWaitVideoSyncSGI")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGI_video_sync */ + +#ifdef GLX_SUN_get_transparent_index + +static GLboolean _glewInit_GLX_SUN_get_transparent_index (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetTransparentIndexSUN = (PFNGLXGETTRANSPARENTINDEXSUNPROC)glewGetProcAddress((const GLubyte*)"glXGetTransparentIndexSUN")) == NULL) || r; + + return r; +} + +#endif /* GLX_SUN_get_transparent_index */ + +#ifdef GLX_SUN_video_resize + +static GLboolean _glewInit_GLX_SUN_video_resize (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetVideoResizeSUN = (PFNGLXGETVIDEORESIZESUNPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoResizeSUN")) == NULL) || r; + r = ((glXVideoResizeSUN = (PFNGLXVIDEORESIZESUNPROC)glewGetProcAddress((const GLubyte*)"glXVideoResizeSUN")) == NULL) || r; + + return r; +} + +#endif /* GLX_SUN_video_resize */ + +/* ------------------------------------------------------------------------ */ + +GLboolean glxewGetExtension (const char* name) +{ + const GLubyte* start; + const GLubyte* end; + + if (glXGetCurrentDisplay == NULL) return GL_FALSE; + start = (const GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS); + if (0 == start) return GL_FALSE; + end = start + _glewStrLen(start); + return _glewSearchExtension(name, start, end); +} + +#ifdef GLEW_MX +GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST) +#else +GLenum glxewInit (GLXEW_CONTEXT_ARG_DEF_LIST) +#endif +{ + int major, minor; + const GLubyte* extStart; + const GLubyte* extEnd; + /* initialize core GLX 1.2 */ + if (_glewInit_GLX_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT)) return GLEW_ERROR_GLX_VERSION_11_ONLY; + /* initialize flags */ + GLXEW_VERSION_1_0 = GL_TRUE; + GLXEW_VERSION_1_1 = GL_TRUE; + GLXEW_VERSION_1_2 = GL_TRUE; + GLXEW_VERSION_1_3 = GL_TRUE; + GLXEW_VERSION_1_4 = GL_TRUE; + /* query GLX version */ + glXQueryVersion(glXGetCurrentDisplay(), &major, &minor); + if (major == 1 && minor <= 3) + { + switch (minor) + { + case 3: + GLXEW_VERSION_1_4 = GL_FALSE; + break; + case 2: + GLXEW_VERSION_1_4 = GL_FALSE; + GLXEW_VERSION_1_3 = GL_FALSE; + break; + default: + return GLEW_ERROR_GLX_VERSION_11_ONLY; + break; + } + } + /* query GLX extension string */ + extStart = 0; + if (glXGetCurrentDisplay != NULL) + extStart = (const GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS); + if (extStart == 0) + extStart = (const GLubyte *)""; + extEnd = extStart + _glewStrLen(extStart); + /* initialize extensions */ +#ifdef GLX_VERSION_1_3 + if (glewExperimental || GLXEW_VERSION_1_3) GLXEW_VERSION_1_3 = !_glewInit_GLX_VERSION_1_3(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_VERSION_1_3 */ +#ifdef GLX_3DFX_multisample + GLXEW_3DFX_multisample = _glewSearchExtension("GLX_3DFX_multisample", extStart, extEnd); +#endif /* GLX_3DFX_multisample */ +#ifdef GLX_AMD_gpu_association + GLXEW_AMD_gpu_association = _glewSearchExtension("GLX_AMD_gpu_association", extStart, extEnd); + if (glewExperimental || GLXEW_AMD_gpu_association) GLXEW_AMD_gpu_association = !_glewInit_GLX_AMD_gpu_association(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_AMD_gpu_association */ +#ifdef GLX_ARB_context_flush_control + GLXEW_ARB_context_flush_control = _glewSearchExtension("GLX_ARB_context_flush_control", extStart, extEnd); +#endif /* GLX_ARB_context_flush_control */ +#ifdef GLX_ARB_create_context + GLXEW_ARB_create_context = _glewSearchExtension("GLX_ARB_create_context", extStart, extEnd); + if (glewExperimental || GLXEW_ARB_create_context) GLXEW_ARB_create_context = !_glewInit_GLX_ARB_create_context(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_ARB_create_context */ +#ifdef GLX_ARB_create_context_profile + GLXEW_ARB_create_context_profile = _glewSearchExtension("GLX_ARB_create_context_profile", extStart, extEnd); +#endif /* GLX_ARB_create_context_profile */ +#ifdef GLX_ARB_create_context_robustness + GLXEW_ARB_create_context_robustness = _glewSearchExtension("GLX_ARB_create_context_robustness", extStart, extEnd); +#endif /* GLX_ARB_create_context_robustness */ +#ifdef GLX_ARB_fbconfig_float + GLXEW_ARB_fbconfig_float = _glewSearchExtension("GLX_ARB_fbconfig_float", extStart, extEnd); +#endif /* GLX_ARB_fbconfig_float */ +#ifdef GLX_ARB_framebuffer_sRGB + GLXEW_ARB_framebuffer_sRGB = _glewSearchExtension("GLX_ARB_framebuffer_sRGB", extStart, extEnd); +#endif /* GLX_ARB_framebuffer_sRGB */ +#ifdef GLX_ARB_get_proc_address + GLXEW_ARB_get_proc_address = _glewSearchExtension("GLX_ARB_get_proc_address", extStart, extEnd); +#endif /* GLX_ARB_get_proc_address */ +#ifdef GLX_ARB_multisample + GLXEW_ARB_multisample = _glewSearchExtension("GLX_ARB_multisample", extStart, extEnd); +#endif /* GLX_ARB_multisample */ +#ifdef GLX_ARB_robustness_application_isolation + GLXEW_ARB_robustness_application_isolation = _glewSearchExtension("GLX_ARB_robustness_application_isolation", extStart, extEnd); +#endif /* GLX_ARB_robustness_application_isolation */ +#ifdef GLX_ARB_robustness_share_group_isolation + GLXEW_ARB_robustness_share_group_isolation = _glewSearchExtension("GLX_ARB_robustness_share_group_isolation", extStart, extEnd); +#endif /* GLX_ARB_robustness_share_group_isolation */ +#ifdef GLX_ARB_vertex_buffer_object + GLXEW_ARB_vertex_buffer_object = _glewSearchExtension("GLX_ARB_vertex_buffer_object", extStart, extEnd); +#endif /* GLX_ARB_vertex_buffer_object */ +#ifdef GLX_ATI_pixel_format_float + GLXEW_ATI_pixel_format_float = _glewSearchExtension("GLX_ATI_pixel_format_float", extStart, extEnd); +#endif /* GLX_ATI_pixel_format_float */ +#ifdef GLX_ATI_render_texture + GLXEW_ATI_render_texture = _glewSearchExtension("GLX_ATI_render_texture", extStart, extEnd); + if (glewExperimental || GLXEW_ATI_render_texture) GLXEW_ATI_render_texture = !_glewInit_GLX_ATI_render_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_ATI_render_texture */ +#ifdef GLX_EXT_buffer_age + GLXEW_EXT_buffer_age = _glewSearchExtension("GLX_EXT_buffer_age", extStart, extEnd); +#endif /* GLX_EXT_buffer_age */ +#ifdef GLX_EXT_create_context_es2_profile + GLXEW_EXT_create_context_es2_profile = _glewSearchExtension("GLX_EXT_create_context_es2_profile", extStart, extEnd); +#endif /* GLX_EXT_create_context_es2_profile */ +#ifdef GLX_EXT_create_context_es_profile + GLXEW_EXT_create_context_es_profile = _glewSearchExtension("GLX_EXT_create_context_es_profile", extStart, extEnd); +#endif /* GLX_EXT_create_context_es_profile */ +#ifdef GLX_EXT_fbconfig_packed_float + GLXEW_EXT_fbconfig_packed_float = _glewSearchExtension("GLX_EXT_fbconfig_packed_float", extStart, extEnd); +#endif /* GLX_EXT_fbconfig_packed_float */ +#ifdef GLX_EXT_framebuffer_sRGB + GLXEW_EXT_framebuffer_sRGB = _glewSearchExtension("GLX_EXT_framebuffer_sRGB", extStart, extEnd); +#endif /* GLX_EXT_framebuffer_sRGB */ +#ifdef GLX_EXT_import_context + GLXEW_EXT_import_context = _glewSearchExtension("GLX_EXT_import_context", extStart, extEnd); + if (glewExperimental || GLXEW_EXT_import_context) GLXEW_EXT_import_context = !_glewInit_GLX_EXT_import_context(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_EXT_import_context */ +#ifdef GLX_EXT_scene_marker + GLXEW_EXT_scene_marker = _glewSearchExtension("GLX_EXT_scene_marker", extStart, extEnd); +#endif /* GLX_EXT_scene_marker */ +#ifdef GLX_EXT_stereo_tree + GLXEW_EXT_stereo_tree = _glewSearchExtension("GLX_EXT_stereo_tree", extStart, extEnd); +#endif /* GLX_EXT_stereo_tree */ +#ifdef GLX_EXT_swap_control + GLXEW_EXT_swap_control = _glewSearchExtension("GLX_EXT_swap_control", extStart, extEnd); + if (glewExperimental || GLXEW_EXT_swap_control) GLXEW_EXT_swap_control = !_glewInit_GLX_EXT_swap_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_EXT_swap_control */ +#ifdef GLX_EXT_swap_control_tear + GLXEW_EXT_swap_control_tear = _glewSearchExtension("GLX_EXT_swap_control_tear", extStart, extEnd); +#endif /* GLX_EXT_swap_control_tear */ +#ifdef GLX_EXT_texture_from_pixmap + GLXEW_EXT_texture_from_pixmap = _glewSearchExtension("GLX_EXT_texture_from_pixmap", extStart, extEnd); + if (glewExperimental || GLXEW_EXT_texture_from_pixmap) GLXEW_EXT_texture_from_pixmap = !_glewInit_GLX_EXT_texture_from_pixmap(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_EXT_texture_from_pixmap */ +#ifdef GLX_EXT_visual_info + GLXEW_EXT_visual_info = _glewSearchExtension("GLX_EXT_visual_info", extStart, extEnd); +#endif /* GLX_EXT_visual_info */ +#ifdef GLX_EXT_visual_rating + GLXEW_EXT_visual_rating = _glewSearchExtension("GLX_EXT_visual_rating", extStart, extEnd); +#endif /* GLX_EXT_visual_rating */ +#ifdef GLX_INTEL_swap_event + GLXEW_INTEL_swap_event = _glewSearchExtension("GLX_INTEL_swap_event", extStart, extEnd); +#endif /* GLX_INTEL_swap_event */ +#ifdef GLX_MESA_agp_offset + GLXEW_MESA_agp_offset = _glewSearchExtension("GLX_MESA_agp_offset", extStart, extEnd); + if (glewExperimental || GLXEW_MESA_agp_offset) GLXEW_MESA_agp_offset = !_glewInit_GLX_MESA_agp_offset(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_MESA_agp_offset */ +#ifdef GLX_MESA_copy_sub_buffer + GLXEW_MESA_copy_sub_buffer = _glewSearchExtension("GLX_MESA_copy_sub_buffer", extStart, extEnd); + if (glewExperimental || GLXEW_MESA_copy_sub_buffer) GLXEW_MESA_copy_sub_buffer = !_glewInit_GLX_MESA_copy_sub_buffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_MESA_copy_sub_buffer */ +#ifdef GLX_MESA_pixmap_colormap + GLXEW_MESA_pixmap_colormap = _glewSearchExtension("GLX_MESA_pixmap_colormap", extStart, extEnd); + if (glewExperimental || GLXEW_MESA_pixmap_colormap) GLXEW_MESA_pixmap_colormap = !_glewInit_GLX_MESA_pixmap_colormap(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_MESA_pixmap_colormap */ +#ifdef GLX_MESA_query_renderer + GLXEW_MESA_query_renderer = _glewSearchExtension("GLX_MESA_query_renderer", extStart, extEnd); + if (glewExperimental || GLXEW_MESA_query_renderer) GLXEW_MESA_query_renderer = !_glewInit_GLX_MESA_query_renderer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_MESA_query_renderer */ +#ifdef GLX_MESA_release_buffers + GLXEW_MESA_release_buffers = _glewSearchExtension("GLX_MESA_release_buffers", extStart, extEnd); + if (glewExperimental || GLXEW_MESA_release_buffers) GLXEW_MESA_release_buffers = !_glewInit_GLX_MESA_release_buffers(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_MESA_release_buffers */ +#ifdef GLX_MESA_set_3dfx_mode + GLXEW_MESA_set_3dfx_mode = _glewSearchExtension("GLX_MESA_set_3dfx_mode", extStart, extEnd); + if (glewExperimental || GLXEW_MESA_set_3dfx_mode) GLXEW_MESA_set_3dfx_mode = !_glewInit_GLX_MESA_set_3dfx_mode(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_MESA_set_3dfx_mode */ +#ifdef GLX_MESA_swap_control + GLXEW_MESA_swap_control = _glewSearchExtension("GLX_MESA_swap_control", extStart, extEnd); + if (glewExperimental || GLXEW_MESA_swap_control) GLXEW_MESA_swap_control = !_glewInit_GLX_MESA_swap_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_MESA_swap_control */ +#ifdef GLX_NV_copy_buffer + GLXEW_NV_copy_buffer = _glewSearchExtension("GLX_NV_copy_buffer", extStart, extEnd); + if (glewExperimental || GLXEW_NV_copy_buffer) GLXEW_NV_copy_buffer = !_glewInit_GLX_NV_copy_buffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_NV_copy_buffer */ +#ifdef GLX_NV_copy_image + GLXEW_NV_copy_image = _glewSearchExtension("GLX_NV_copy_image", extStart, extEnd); + if (glewExperimental || GLXEW_NV_copy_image) GLXEW_NV_copy_image = !_glewInit_GLX_NV_copy_image(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_NV_copy_image */ +#ifdef GLX_NV_delay_before_swap + GLXEW_NV_delay_before_swap = _glewSearchExtension("GLX_NV_delay_before_swap", extStart, extEnd); + if (glewExperimental || GLXEW_NV_delay_before_swap) GLXEW_NV_delay_before_swap = !_glewInit_GLX_NV_delay_before_swap(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_NV_delay_before_swap */ +#ifdef GLX_NV_float_buffer + GLXEW_NV_float_buffer = _glewSearchExtension("GLX_NV_float_buffer", extStart, extEnd); +#endif /* GLX_NV_float_buffer */ +#ifdef GLX_NV_multisample_coverage + GLXEW_NV_multisample_coverage = _glewSearchExtension("GLX_NV_multisample_coverage", extStart, extEnd); +#endif /* GLX_NV_multisample_coverage */ +#ifdef GLX_NV_present_video + GLXEW_NV_present_video = _glewSearchExtension("GLX_NV_present_video", extStart, extEnd); + if (glewExperimental || GLXEW_NV_present_video) GLXEW_NV_present_video = !_glewInit_GLX_NV_present_video(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_NV_present_video */ +#ifdef GLX_NV_swap_group + GLXEW_NV_swap_group = _glewSearchExtension("GLX_NV_swap_group", extStart, extEnd); + if (glewExperimental || GLXEW_NV_swap_group) GLXEW_NV_swap_group = !_glewInit_GLX_NV_swap_group(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_NV_swap_group */ +#ifdef GLX_NV_vertex_array_range + GLXEW_NV_vertex_array_range = _glewSearchExtension("GLX_NV_vertex_array_range", extStart, extEnd); + if (glewExperimental || GLXEW_NV_vertex_array_range) GLXEW_NV_vertex_array_range = !_glewInit_GLX_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_NV_vertex_array_range */ +#ifdef GLX_NV_video_capture + GLXEW_NV_video_capture = _glewSearchExtension("GLX_NV_video_capture", extStart, extEnd); + if (glewExperimental || GLXEW_NV_video_capture) GLXEW_NV_video_capture = !_glewInit_GLX_NV_video_capture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_NV_video_capture */ +#ifdef GLX_NV_video_out + GLXEW_NV_video_out = _glewSearchExtension("GLX_NV_video_out", extStart, extEnd); + if (glewExperimental || GLXEW_NV_video_out) GLXEW_NV_video_out = !_glewInit_GLX_NV_video_out(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_NV_video_out */ +#ifdef GLX_OML_swap_method + GLXEW_OML_swap_method = _glewSearchExtension("GLX_OML_swap_method", extStart, extEnd); +#endif /* GLX_OML_swap_method */ +#ifdef GLX_OML_sync_control + GLXEW_OML_sync_control = _glewSearchExtension("GLX_OML_sync_control", extStart, extEnd); + if (glewExperimental || GLXEW_OML_sync_control) GLXEW_OML_sync_control = !_glewInit_GLX_OML_sync_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_OML_sync_control */ +#ifdef GLX_SGIS_blended_overlay + GLXEW_SGIS_blended_overlay = _glewSearchExtension("GLX_SGIS_blended_overlay", extStart, extEnd); +#endif /* GLX_SGIS_blended_overlay */ +#ifdef GLX_SGIS_color_range + GLXEW_SGIS_color_range = _glewSearchExtension("GLX_SGIS_color_range", extStart, extEnd); +#endif /* GLX_SGIS_color_range */ +#ifdef GLX_SGIS_multisample + GLXEW_SGIS_multisample = _glewSearchExtension("GLX_SGIS_multisample", extStart, extEnd); +#endif /* GLX_SGIS_multisample */ +#ifdef GLX_SGIS_shared_multisample + GLXEW_SGIS_shared_multisample = _glewSearchExtension("GLX_SGIS_shared_multisample", extStart, extEnd); +#endif /* GLX_SGIS_shared_multisample */ +#ifdef GLX_SGIX_fbconfig + GLXEW_SGIX_fbconfig = _glewSearchExtension("GLX_SGIX_fbconfig", extStart, extEnd); + if (glewExperimental || GLXEW_SGIX_fbconfig) GLXEW_SGIX_fbconfig = !_glewInit_GLX_SGIX_fbconfig(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGIX_fbconfig */ +#ifdef GLX_SGIX_hyperpipe + GLXEW_SGIX_hyperpipe = _glewSearchExtension("GLX_SGIX_hyperpipe", extStart, extEnd); + if (glewExperimental || GLXEW_SGIX_hyperpipe) GLXEW_SGIX_hyperpipe = !_glewInit_GLX_SGIX_hyperpipe(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGIX_hyperpipe */ +#ifdef GLX_SGIX_pbuffer + GLXEW_SGIX_pbuffer = _glewSearchExtension("GLX_SGIX_pbuffer", extStart, extEnd); + if (glewExperimental || GLXEW_SGIX_pbuffer) GLXEW_SGIX_pbuffer = !_glewInit_GLX_SGIX_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGIX_pbuffer */ +#ifdef GLX_SGIX_swap_barrier + GLXEW_SGIX_swap_barrier = _glewSearchExtension("GLX_SGIX_swap_barrier", extStart, extEnd); + if (glewExperimental || GLXEW_SGIX_swap_barrier) GLXEW_SGIX_swap_barrier = !_glewInit_GLX_SGIX_swap_barrier(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGIX_swap_barrier */ +#ifdef GLX_SGIX_swap_group + GLXEW_SGIX_swap_group = _glewSearchExtension("GLX_SGIX_swap_group", extStart, extEnd); + if (glewExperimental || GLXEW_SGIX_swap_group) GLXEW_SGIX_swap_group = !_glewInit_GLX_SGIX_swap_group(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGIX_swap_group */ +#ifdef GLX_SGIX_video_resize + GLXEW_SGIX_video_resize = _glewSearchExtension("GLX_SGIX_video_resize", extStart, extEnd); + if (glewExperimental || GLXEW_SGIX_video_resize) GLXEW_SGIX_video_resize = !_glewInit_GLX_SGIX_video_resize(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGIX_video_resize */ +#ifdef GLX_SGIX_visual_select_group + GLXEW_SGIX_visual_select_group = _glewSearchExtension("GLX_SGIX_visual_select_group", extStart, extEnd); +#endif /* GLX_SGIX_visual_select_group */ +#ifdef GLX_SGI_cushion + GLXEW_SGI_cushion = _glewSearchExtension("GLX_SGI_cushion", extStart, extEnd); + if (glewExperimental || GLXEW_SGI_cushion) GLXEW_SGI_cushion = !_glewInit_GLX_SGI_cushion(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGI_cushion */ +#ifdef GLX_SGI_make_current_read + GLXEW_SGI_make_current_read = _glewSearchExtension("GLX_SGI_make_current_read", extStart, extEnd); + if (glewExperimental || GLXEW_SGI_make_current_read) GLXEW_SGI_make_current_read = !_glewInit_GLX_SGI_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGI_make_current_read */ +#ifdef GLX_SGI_swap_control + GLXEW_SGI_swap_control = _glewSearchExtension("GLX_SGI_swap_control", extStart, extEnd); + if (glewExperimental || GLXEW_SGI_swap_control) GLXEW_SGI_swap_control = !_glewInit_GLX_SGI_swap_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGI_swap_control */ +#ifdef GLX_SGI_video_sync + GLXEW_SGI_video_sync = _glewSearchExtension("GLX_SGI_video_sync", extStart, extEnd); + if (glewExperimental || GLXEW_SGI_video_sync) GLXEW_SGI_video_sync = !_glewInit_GLX_SGI_video_sync(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGI_video_sync */ +#ifdef GLX_SUN_get_transparent_index + GLXEW_SUN_get_transparent_index = _glewSearchExtension("GLX_SUN_get_transparent_index", extStart, extEnd); + if (glewExperimental || GLXEW_SUN_get_transparent_index) GLXEW_SUN_get_transparent_index = !_glewInit_GLX_SUN_get_transparent_index(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SUN_get_transparent_index */ +#ifdef GLX_SUN_video_resize + GLXEW_SUN_video_resize = _glewSearchExtension("GLX_SUN_video_resize", extStart, extEnd); + if (glewExperimental || GLXEW_SUN_video_resize) GLXEW_SUN_video_resize = !_glewInit_GLX_SUN_video_resize(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SUN_video_resize */ + + return GLEW_OK; +} + +#endif /* !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) */ + +/* ------------------------------------------------------------------------ */ + +const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error) +{ + static const GLubyte* _glewErrorString[] = + { + (const GLubyte*)"No error", + (const GLubyte*)"Missing GL version", + (const GLubyte*)"GL 1.1 and up are not supported", + (const GLubyte*)"GLX 1.2 and up are not supported", + (const GLubyte*)"Unknown error" + }; + const size_t max_error = sizeof(_glewErrorString)/sizeof(*_glewErrorString) - 1; + return _glewErrorString[(size_t)error > max_error ? max_error : (size_t)error]; +} + +const GLubyte * GLEWAPIENTRY glewGetString (GLenum name) +{ + static const GLubyte* _glewString[] = + { + (const GLubyte*)NULL, + (const GLubyte*)"1.13.0", + (const GLubyte*)"1", + (const GLubyte*)"13", + (const GLubyte*)"0" + }; + const size_t max_string = sizeof(_glewString)/sizeof(*_glewString) - 1; + return _glewString[(size_t)name > max_string ? 0 : (size_t)name]; +} + +/* ------------------------------------------------------------------------ */ + +GLboolean glewExperimental = GL_FALSE; + +#if !defined(GLEW_MX) + +GLenum GLEWAPIENTRY glewInit (void) +{ + GLenum r; + r = glewContextInit(); + if ( r != 0 ) return r; +#if defined(_WIN32) + return wglewInit(); +#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) /* _UNIX */ + return glxewInit(); +#else + return r; +#endif /* _WIN32 */ +} + +#endif /* !GLEW_MX */ +#ifdef GLEW_MX +GLboolean GLEWAPIENTRY glewContextIsSupported (const GLEWContext* ctx, const char* name) +#else +GLboolean GLEWAPIENTRY glewIsSupported (const char* name) +#endif +{ + const GLubyte* pos = (const GLubyte*)name; + GLuint len = _glewStrLen(pos); + GLboolean ret = GL_TRUE; + while (ret && len > 0) + { + if (_glewStrSame1(&pos, &len, (const GLubyte*)"GL_", 3)) + { + if (_glewStrSame2(&pos, &len, (const GLubyte*)"VERSION_", 8)) + { +#ifdef GL_VERSION_1_2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_2", 3)) + { + ret = GLEW_VERSION_1_2; + continue; + } +#endif +#ifdef GL_VERSION_1_2_1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_2_1", 5)) + { + ret = GLEW_VERSION_1_2_1; + continue; + } +#endif +#ifdef GL_VERSION_1_3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_3", 3)) + { + ret = GLEW_VERSION_1_3; + continue; + } +#endif +#ifdef GL_VERSION_1_4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_4", 3)) + { + ret = GLEW_VERSION_1_4; + continue; + } +#endif +#ifdef GL_VERSION_1_5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_5", 3)) + { + ret = GLEW_VERSION_1_5; + continue; + } +#endif +#ifdef GL_VERSION_2_0 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"2_0", 3)) + { + ret = GLEW_VERSION_2_0; + continue; + } +#endif +#ifdef GL_VERSION_2_1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"2_1", 3)) + { + ret = GLEW_VERSION_2_1; + continue; + } +#endif +#ifdef GL_VERSION_3_0 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_0", 3)) + { + ret = GLEW_VERSION_3_0; + continue; + } +#endif +#ifdef GL_VERSION_3_1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_1", 3)) + { + ret = GLEW_VERSION_3_1; + continue; + } +#endif +#ifdef GL_VERSION_3_2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_2", 3)) + { + ret = GLEW_VERSION_3_2; + continue; + } +#endif +#ifdef GL_VERSION_3_3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_3", 3)) + { + ret = GLEW_VERSION_3_3; + continue; + } +#endif +#ifdef GL_VERSION_4_0 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_0", 3)) + { + ret = GLEW_VERSION_4_0; + continue; + } +#endif +#ifdef GL_VERSION_4_1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_1", 3)) + { + ret = GLEW_VERSION_4_1; + continue; + } +#endif +#ifdef GL_VERSION_4_2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_2", 3)) + { + ret = GLEW_VERSION_4_2; + continue; + } +#endif +#ifdef GL_VERSION_4_3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_3", 3)) + { + ret = GLEW_VERSION_4_3; + continue; + } +#endif +#ifdef GL_VERSION_4_4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_4", 3)) + { + ret = GLEW_VERSION_4_4; + continue; + } +#endif +#ifdef GL_VERSION_4_5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_5", 3)) + { + ret = GLEW_VERSION_4_5; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5)) + { +#ifdef GL_3DFX_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = GLEW_3DFX_multisample; + continue; + } +#endif +#ifdef GL_3DFX_tbuffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"tbuffer", 7)) + { + ret = GLEW_3DFX_tbuffer; + continue; + } +#endif +#ifdef GL_3DFX_texture_compression_FXT1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_FXT1", 24)) + { + ret = GLEW_3DFX_texture_compression_FXT1; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"AMD_", 4)) + { +#ifdef GL_AMD_blend_minmax_factor + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_minmax_factor", 19)) + { + ret = GLEW_AMD_blend_minmax_factor; + continue; + } +#endif +#ifdef GL_AMD_conservative_depth + if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_depth", 18)) + { + ret = GLEW_AMD_conservative_depth; + continue; + } +#endif +#ifdef GL_AMD_debug_output + if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_output", 12)) + { + ret = GLEW_AMD_debug_output; + continue; + } +#endif +#ifdef GL_AMD_depth_clamp_separate + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_clamp_separate", 20)) + { + ret = GLEW_AMD_depth_clamp_separate; + continue; + } +#endif +#ifdef GL_AMD_draw_buffers_blend + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers_blend", 18)) + { + ret = GLEW_AMD_draw_buffers_blend; + continue; + } +#endif +#ifdef GL_AMD_gcn_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gcn_shader", 10)) + { + ret = GLEW_AMD_gcn_shader; + continue; + } +#endif +#ifdef GL_AMD_gpu_shader_int64 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader_int64", 16)) + { + ret = GLEW_AMD_gpu_shader_int64; + continue; + } +#endif +#ifdef GL_AMD_interleaved_elements + if (_glewStrSame3(&pos, &len, (const GLubyte*)"interleaved_elements", 20)) + { + ret = GLEW_AMD_interleaved_elements; + continue; + } +#endif +#ifdef GL_AMD_multi_draw_indirect + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_draw_indirect", 19)) + { + ret = GLEW_AMD_multi_draw_indirect; + continue; + } +#endif +#ifdef GL_AMD_name_gen_delete + if (_glewStrSame3(&pos, &len, (const GLubyte*)"name_gen_delete", 15)) + { + ret = GLEW_AMD_name_gen_delete; + continue; + } +#endif +#ifdef GL_AMD_occlusion_query_event + if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query_event", 21)) + { + ret = GLEW_AMD_occlusion_query_event; + continue; + } +#endif +#ifdef GL_AMD_performance_monitor + if (_glewStrSame3(&pos, &len, (const GLubyte*)"performance_monitor", 19)) + { + ret = GLEW_AMD_performance_monitor; + continue; + } +#endif +#ifdef GL_AMD_pinned_memory + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pinned_memory", 13)) + { + ret = GLEW_AMD_pinned_memory; + continue; + } +#endif +#ifdef GL_AMD_query_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"query_buffer_object", 19)) + { + ret = GLEW_AMD_query_buffer_object; + continue; + } +#endif +#ifdef GL_AMD_sample_positions + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_positions", 16)) + { + ret = GLEW_AMD_sample_positions; + continue; + } +#endif +#ifdef GL_AMD_seamless_cubemap_per_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"seamless_cubemap_per_texture", 28)) + { + ret = GLEW_AMD_seamless_cubemap_per_texture; + continue; + } +#endif +#ifdef GL_AMD_shader_atomic_counter_ops + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counter_ops", 25)) + { + ret = GLEW_AMD_shader_atomic_counter_ops; + continue; + } +#endif +#ifdef GL_AMD_shader_stencil_export + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_stencil_export", 21)) + { + ret = GLEW_AMD_shader_stencil_export; + continue; + } +#endif +#ifdef GL_AMD_shader_stencil_value_export + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_stencil_value_export", 27)) + { + ret = GLEW_AMD_shader_stencil_value_export; + continue; + } +#endif +#ifdef GL_AMD_shader_trinary_minmax + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_trinary_minmax", 21)) + { + ret = GLEW_AMD_shader_trinary_minmax; + continue; + } +#endif +#ifdef GL_AMD_sparse_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture", 14)) + { + ret = GLEW_AMD_sparse_texture; + continue; + } +#endif +#ifdef GL_AMD_stencil_operation_extended + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_operation_extended", 26)) + { + ret = GLEW_AMD_stencil_operation_extended; + continue; + } +#endif +#ifdef GL_AMD_texture_texture4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_texture4", 16)) + { + ret = GLEW_AMD_texture_texture4; + continue; + } +#endif +#ifdef GL_AMD_transform_feedback3_lines_triangles + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback3_lines_triangles", 35)) + { + ret = GLEW_AMD_transform_feedback3_lines_triangles; + continue; + } +#endif +#ifdef GL_AMD_transform_feedback4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback4", 19)) + { + ret = GLEW_AMD_transform_feedback4; + continue; + } +#endif +#ifdef GL_AMD_vertex_shader_layer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_layer", 19)) + { + ret = GLEW_AMD_vertex_shader_layer; + continue; + } +#endif +#ifdef GL_AMD_vertex_shader_tessellator + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_tessellator", 25)) + { + ret = GLEW_AMD_vertex_shader_tessellator; + continue; + } +#endif +#ifdef GL_AMD_vertex_shader_viewport_index + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_viewport_index", 28)) + { + ret = GLEW_AMD_vertex_shader_viewport_index; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ANGLE_", 6)) + { +#ifdef GL_ANGLE_depth_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_texture", 13)) + { + ret = GLEW_ANGLE_depth_texture; + continue; + } +#endif +#ifdef GL_ANGLE_framebuffer_blit + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_blit", 16)) + { + ret = GLEW_ANGLE_framebuffer_blit; + continue; + } +#endif +#ifdef GL_ANGLE_framebuffer_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample", 23)) + { + ret = GLEW_ANGLE_framebuffer_multisample; + continue; + } +#endif +#ifdef GL_ANGLE_instanced_arrays + if (_glewStrSame3(&pos, &len, (const GLubyte*)"instanced_arrays", 16)) + { + ret = GLEW_ANGLE_instanced_arrays; + continue; + } +#endif +#ifdef GL_ANGLE_pack_reverse_row_order + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pack_reverse_row_order", 22)) + { + ret = GLEW_ANGLE_pack_reverse_row_order; + continue; + } +#endif +#ifdef GL_ANGLE_program_binary + if (_glewStrSame3(&pos, &len, (const GLubyte*)"program_binary", 14)) + { + ret = GLEW_ANGLE_program_binary; + continue; + } +#endif +#ifdef GL_ANGLE_texture_compression_dxt1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt1", 24)) + { + ret = GLEW_ANGLE_texture_compression_dxt1; + continue; + } +#endif +#ifdef GL_ANGLE_texture_compression_dxt3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt3", 24)) + { + ret = GLEW_ANGLE_texture_compression_dxt3; + continue; + } +#endif +#ifdef GL_ANGLE_texture_compression_dxt5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt5", 24)) + { + ret = GLEW_ANGLE_texture_compression_dxt5; + continue; + } +#endif +#ifdef GL_ANGLE_texture_usage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_usage", 13)) + { + ret = GLEW_ANGLE_texture_usage; + continue; + } +#endif +#ifdef GL_ANGLE_timer_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"timer_query", 11)) + { + ret = GLEW_ANGLE_timer_query; + continue; + } +#endif +#ifdef GL_ANGLE_translated_shader_source + if (_glewStrSame3(&pos, &len, (const GLubyte*)"translated_shader_source", 24)) + { + ret = GLEW_ANGLE_translated_shader_source; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"APPLE_", 6)) + { +#ifdef GL_APPLE_aux_depth_stencil + if (_glewStrSame3(&pos, &len, (const GLubyte*)"aux_depth_stencil", 17)) + { + ret = GLEW_APPLE_aux_depth_stencil; + continue; + } +#endif +#ifdef GL_APPLE_client_storage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"client_storage", 14)) + { + ret = GLEW_APPLE_client_storage; + continue; + } +#endif +#ifdef GL_APPLE_element_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"element_array", 13)) + { + ret = GLEW_APPLE_element_array; + continue; + } +#endif +#ifdef GL_APPLE_fence + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fence", 5)) + { + ret = GLEW_APPLE_fence; + continue; + } +#endif +#ifdef GL_APPLE_float_pixels + if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_pixels", 12)) + { + ret = GLEW_APPLE_float_pixels; + continue; + } +#endif +#ifdef GL_APPLE_flush_buffer_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"flush_buffer_range", 18)) + { + ret = GLEW_APPLE_flush_buffer_range; + continue; + } +#endif +#ifdef GL_APPLE_object_purgeable + if (_glewStrSame3(&pos, &len, (const GLubyte*)"object_purgeable", 16)) + { + ret = GLEW_APPLE_object_purgeable; + continue; + } +#endif +#ifdef GL_APPLE_pixel_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer", 12)) + { + ret = GLEW_APPLE_pixel_buffer; + continue; + } +#endif +#ifdef GL_APPLE_rgb_422 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"rgb_422", 7)) + { + ret = GLEW_APPLE_rgb_422; + continue; + } +#endif +#ifdef GL_APPLE_row_bytes + if (_glewStrSame3(&pos, &len, (const GLubyte*)"row_bytes", 9)) + { + ret = GLEW_APPLE_row_bytes; + continue; + } +#endif +#ifdef GL_APPLE_specular_vector + if (_glewStrSame3(&pos, &len, (const GLubyte*)"specular_vector", 15)) + { + ret = GLEW_APPLE_specular_vector; + continue; + } +#endif +#ifdef GL_APPLE_texture_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_range", 13)) + { + ret = GLEW_APPLE_texture_range; + continue; + } +#endif +#ifdef GL_APPLE_transform_hint + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_hint", 14)) + { + ret = GLEW_APPLE_transform_hint; + continue; + } +#endif +#ifdef GL_APPLE_vertex_array_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19)) + { + ret = GLEW_APPLE_vertex_array_object; + continue; + } +#endif +#ifdef GL_APPLE_vertex_array_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) + { + ret = GLEW_APPLE_vertex_array_range; + continue; + } +#endif +#ifdef GL_APPLE_vertex_program_evaluators + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program_evaluators", 25)) + { + ret = GLEW_APPLE_vertex_program_evaluators; + continue; + } +#endif +#ifdef GL_APPLE_ycbcr_422 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycbcr_422", 9)) + { + ret = GLEW_APPLE_ycbcr_422; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4)) + { +#ifdef GL_ARB_ES2_compatibility + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES2_compatibility", 17)) + { + ret = GLEW_ARB_ES2_compatibility; + continue; + } +#endif +#ifdef GL_ARB_ES3_1_compatibility + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES3_1_compatibility", 19)) + { + ret = GLEW_ARB_ES3_1_compatibility; + continue; + } +#endif +#ifdef GL_ARB_ES3_2_compatibility + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES3_2_compatibility", 19)) + { + ret = GLEW_ARB_ES3_2_compatibility; + continue; + } +#endif +#ifdef GL_ARB_ES3_compatibility + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES3_compatibility", 17)) + { + ret = GLEW_ARB_ES3_compatibility; + continue; + } +#endif +#ifdef GL_ARB_arrays_of_arrays + if (_glewStrSame3(&pos, &len, (const GLubyte*)"arrays_of_arrays", 16)) + { + ret = GLEW_ARB_arrays_of_arrays; + continue; + } +#endif +#ifdef GL_ARB_base_instance + if (_glewStrSame3(&pos, &len, (const GLubyte*)"base_instance", 13)) + { + ret = GLEW_ARB_base_instance; + continue; + } +#endif +#ifdef GL_ARB_bindless_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_texture", 16)) + { + ret = GLEW_ARB_bindless_texture; + continue; + } +#endif +#ifdef GL_ARB_blend_func_extended + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_func_extended", 19)) + { + ret = GLEW_ARB_blend_func_extended; + continue; + } +#endif +#ifdef GL_ARB_buffer_storage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_storage", 14)) + { + ret = GLEW_ARB_buffer_storage; + continue; + } +#endif +#ifdef GL_ARB_cl_event + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cl_event", 8)) + { + ret = GLEW_ARB_cl_event; + continue; + } +#endif +#ifdef GL_ARB_clear_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"clear_buffer_object", 19)) + { + ret = GLEW_ARB_clear_buffer_object; + continue; + } +#endif +#ifdef GL_ARB_clear_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"clear_texture", 13)) + { + ret = GLEW_ARB_clear_texture; + continue; + } +#endif +#ifdef GL_ARB_clip_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"clip_control", 12)) + { + ret = GLEW_ARB_clip_control; + continue; + } +#endif +#ifdef GL_ARB_color_buffer_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_buffer_float", 18)) + { + ret = GLEW_ARB_color_buffer_float; + continue; + } +#endif +#ifdef GL_ARB_compatibility + if (_glewStrSame3(&pos, &len, (const GLubyte*)"compatibility", 13)) + { + ret = GLEW_ARB_compatibility; + continue; + } +#endif +#ifdef GL_ARB_compressed_texture_pixel_storage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"compressed_texture_pixel_storage", 32)) + { + ret = GLEW_ARB_compressed_texture_pixel_storage; + continue; + } +#endif +#ifdef GL_ARB_compute_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"compute_shader", 14)) + { + ret = GLEW_ARB_compute_shader; + continue; + } +#endif +#ifdef GL_ARB_compute_variable_group_size + if (_glewStrSame3(&pos, &len, (const GLubyte*)"compute_variable_group_size", 27)) + { + ret = GLEW_ARB_compute_variable_group_size; + continue; + } +#endif +#ifdef GL_ARB_conditional_render_inverted + if (_glewStrSame3(&pos, &len, (const GLubyte*)"conditional_render_inverted", 27)) + { + ret = GLEW_ARB_conditional_render_inverted; + continue; + } +#endif +#ifdef GL_ARB_conservative_depth + if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_depth", 18)) + { + ret = GLEW_ARB_conservative_depth; + continue; + } +#endif +#ifdef GL_ARB_copy_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_buffer", 11)) + { + ret = GLEW_ARB_copy_buffer; + continue; + } +#endif +#ifdef GL_ARB_copy_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) + { + ret = GLEW_ARB_copy_image; + continue; + } +#endif +#ifdef GL_ARB_cull_distance + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_distance", 13)) + { + ret = GLEW_ARB_cull_distance; + continue; + } +#endif +#ifdef GL_ARB_debug_output + if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_output", 12)) + { + ret = GLEW_ARB_debug_output; + continue; + } +#endif +#ifdef GL_ARB_depth_buffer_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_buffer_float", 18)) + { + ret = GLEW_ARB_depth_buffer_float; + continue; + } +#endif +#ifdef GL_ARB_depth_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_clamp", 11)) + { + ret = GLEW_ARB_depth_clamp; + continue; + } +#endif +#ifdef GL_ARB_depth_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_texture", 13)) + { + ret = GLEW_ARB_depth_texture; + continue; + } +#endif +#ifdef GL_ARB_derivative_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"derivative_control", 18)) + { + ret = GLEW_ARB_derivative_control; + continue; + } +#endif +#ifdef GL_ARB_direct_state_access + if (_glewStrSame3(&pos, &len, (const GLubyte*)"direct_state_access", 19)) + { + ret = GLEW_ARB_direct_state_access; + continue; + } +#endif +#ifdef GL_ARB_draw_buffers + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers", 12)) + { + ret = GLEW_ARB_draw_buffers; + continue; + } +#endif +#ifdef GL_ARB_draw_buffers_blend + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers_blend", 18)) + { + ret = GLEW_ARB_draw_buffers_blend; + continue; + } +#endif +#ifdef GL_ARB_draw_elements_base_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_elements_base_vertex", 25)) + { + ret = GLEW_ARB_draw_elements_base_vertex; + continue; + } +#endif +#ifdef GL_ARB_draw_indirect + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_indirect", 13)) + { + ret = GLEW_ARB_draw_indirect; + continue; + } +#endif +#ifdef GL_ARB_draw_instanced + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_instanced", 14)) + { + ret = GLEW_ARB_draw_instanced; + continue; + } +#endif +#ifdef GL_ARB_enhanced_layouts + if (_glewStrSame3(&pos, &len, (const GLubyte*)"enhanced_layouts", 16)) + { + ret = GLEW_ARB_enhanced_layouts; + continue; + } +#endif +#ifdef GL_ARB_explicit_attrib_location + if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_attrib_location", 24)) + { + ret = GLEW_ARB_explicit_attrib_location; + continue; + } +#endif +#ifdef GL_ARB_explicit_uniform_location + if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_uniform_location", 25)) + { + ret = GLEW_ARB_explicit_uniform_location; + continue; + } +#endif +#ifdef GL_ARB_fragment_coord_conventions + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_coord_conventions", 26)) + { + ret = GLEW_ARB_fragment_coord_conventions; + continue; + } +#endif +#ifdef GL_ARB_fragment_layer_viewport + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_layer_viewport", 23)) + { + ret = GLEW_ARB_fragment_layer_viewport; + continue; + } +#endif +#ifdef GL_ARB_fragment_program + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program", 16)) + { + ret = GLEW_ARB_fragment_program; + continue; + } +#endif +#ifdef GL_ARB_fragment_program_shadow + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program_shadow", 23)) + { + ret = GLEW_ARB_fragment_program_shadow; + continue; + } +#endif +#ifdef GL_ARB_fragment_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader", 15)) + { + ret = GLEW_ARB_fragment_shader; + continue; + } +#endif +#ifdef GL_ARB_fragment_shader_interlock + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader_interlock", 25)) + { + ret = GLEW_ARB_fragment_shader_interlock; + continue; + } +#endif +#ifdef GL_ARB_framebuffer_no_attachments + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_no_attachments", 26)) + { + ret = GLEW_ARB_framebuffer_no_attachments; + continue; + } +#endif +#ifdef GL_ARB_framebuffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_object", 18)) + { + ret = GLEW_ARB_framebuffer_object; + continue; + } +#endif +#ifdef GL_ARB_framebuffer_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) + { + ret = GLEW_ARB_framebuffer_sRGB; + continue; + } +#endif +#ifdef GL_ARB_geometry_shader4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16)) + { + ret = GLEW_ARB_geometry_shader4; + continue; + } +#endif +#ifdef GL_ARB_get_program_binary + if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_program_binary", 18)) + { + ret = GLEW_ARB_get_program_binary; + continue; + } +#endif +#ifdef GL_ARB_get_texture_sub_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_texture_sub_image", 21)) + { + ret = GLEW_ARB_get_texture_sub_image; + continue; + } +#endif +#ifdef GL_ARB_gpu_shader5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader5", 11)) + { + ret = GLEW_ARB_gpu_shader5; + continue; + } +#endif +#ifdef GL_ARB_gpu_shader_fp64 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader_fp64", 15)) + { + ret = GLEW_ARB_gpu_shader_fp64; + continue; + } +#endif +#ifdef GL_ARB_gpu_shader_int64 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader_int64", 16)) + { + ret = GLEW_ARB_gpu_shader_int64; + continue; + } +#endif +#ifdef GL_ARB_half_float_pixel + if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float_pixel", 16)) + { + ret = GLEW_ARB_half_float_pixel; + continue; + } +#endif +#ifdef GL_ARB_half_float_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float_vertex", 17)) + { + ret = GLEW_ARB_half_float_vertex; + continue; + } +#endif +#ifdef GL_ARB_imaging + if (_glewStrSame3(&pos, &len, (const GLubyte*)"imaging", 7)) + { + ret = GLEW_ARB_imaging; + continue; + } +#endif +#ifdef GL_ARB_indirect_parameters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"indirect_parameters", 19)) + { + ret = GLEW_ARB_indirect_parameters; + continue; + } +#endif +#ifdef GL_ARB_instanced_arrays + if (_glewStrSame3(&pos, &len, (const GLubyte*)"instanced_arrays", 16)) + { + ret = GLEW_ARB_instanced_arrays; + continue; + } +#endif +#ifdef GL_ARB_internalformat_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"internalformat_query", 20)) + { + ret = GLEW_ARB_internalformat_query; + continue; + } +#endif +#ifdef GL_ARB_internalformat_query2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"internalformat_query2", 21)) + { + ret = GLEW_ARB_internalformat_query2; + continue; + } +#endif +#ifdef GL_ARB_invalidate_subdata + if (_glewStrSame3(&pos, &len, (const GLubyte*)"invalidate_subdata", 18)) + { + ret = GLEW_ARB_invalidate_subdata; + continue; + } +#endif +#ifdef GL_ARB_map_buffer_alignment + if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_buffer_alignment", 20)) + { + ret = GLEW_ARB_map_buffer_alignment; + continue; + } +#endif +#ifdef GL_ARB_map_buffer_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_buffer_range", 16)) + { + ret = GLEW_ARB_map_buffer_range; + continue; + } +#endif +#ifdef GL_ARB_matrix_palette + if (_glewStrSame3(&pos, &len, (const GLubyte*)"matrix_palette", 14)) + { + ret = GLEW_ARB_matrix_palette; + continue; + } +#endif +#ifdef GL_ARB_multi_bind + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_bind", 10)) + { + ret = GLEW_ARB_multi_bind; + continue; + } +#endif +#ifdef GL_ARB_multi_draw_indirect + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_draw_indirect", 19)) + { + ret = GLEW_ARB_multi_draw_indirect; + continue; + } +#endif +#ifdef GL_ARB_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = GLEW_ARB_multisample; + continue; + } +#endif +#ifdef GL_ARB_multitexture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multitexture", 12)) + { + ret = GLEW_ARB_multitexture; + continue; + } +#endif +#ifdef GL_ARB_occlusion_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query", 15)) + { + ret = GLEW_ARB_occlusion_query; + continue; + } +#endif +#ifdef GL_ARB_occlusion_query2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query2", 16)) + { + ret = GLEW_ARB_occlusion_query2; + continue; + } +#endif +#ifdef GL_ARB_parallel_shader_compile + if (_glewStrSame3(&pos, &len, (const GLubyte*)"parallel_shader_compile", 23)) + { + ret = GLEW_ARB_parallel_shader_compile; + continue; + } +#endif +#ifdef GL_ARB_pipeline_statistics_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pipeline_statistics_query", 25)) + { + ret = GLEW_ARB_pipeline_statistics_query; + continue; + } +#endif +#ifdef GL_ARB_pixel_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer_object", 19)) + { + ret = GLEW_ARB_pixel_buffer_object; + continue; + } +#endif +#ifdef GL_ARB_point_parameters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_parameters", 16)) + { + ret = GLEW_ARB_point_parameters; + continue; + } +#endif +#ifdef GL_ARB_point_sprite + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprite", 12)) + { + ret = GLEW_ARB_point_sprite; + continue; + } +#endif +#ifdef GL_ARB_post_depth_coverage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"post_depth_coverage", 19)) + { + ret = GLEW_ARB_post_depth_coverage; + continue; + } +#endif +#ifdef GL_ARB_program_interface_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"program_interface_query", 23)) + { + ret = GLEW_ARB_program_interface_query; + continue; + } +#endif +#ifdef GL_ARB_provoking_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"provoking_vertex", 16)) + { + ret = GLEW_ARB_provoking_vertex; + continue; + } +#endif +#ifdef GL_ARB_query_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"query_buffer_object", 19)) + { + ret = GLEW_ARB_query_buffer_object; + continue; + } +#endif +#ifdef GL_ARB_robust_buffer_access_behavior + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robust_buffer_access_behavior", 29)) + { + ret = GLEW_ARB_robust_buffer_access_behavior; + continue; + } +#endif +#ifdef GL_ARB_robustness + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness", 10)) + { + ret = GLEW_ARB_robustness; + continue; + } +#endif +#ifdef GL_ARB_robustness_application_isolation + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_application_isolation", 32)) + { + ret = GLEW_ARB_robustness_application_isolation; + continue; + } +#endif +#ifdef GL_ARB_robustness_share_group_isolation + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_share_group_isolation", 32)) + { + ret = GLEW_ARB_robustness_share_group_isolation; + continue; + } +#endif +#ifdef GL_ARB_sample_locations + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_locations", 16)) + { + ret = GLEW_ARB_sample_locations; + continue; + } +#endif +#ifdef GL_ARB_sample_shading + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_shading", 14)) + { + ret = GLEW_ARB_sample_shading; + continue; + } +#endif +#ifdef GL_ARB_sampler_objects + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sampler_objects", 15)) + { + ret = GLEW_ARB_sampler_objects; + continue; + } +#endif +#ifdef GL_ARB_seamless_cube_map + if (_glewStrSame3(&pos, &len, (const GLubyte*)"seamless_cube_map", 17)) + { + ret = GLEW_ARB_seamless_cube_map; + continue; + } +#endif +#ifdef GL_ARB_seamless_cubemap_per_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"seamless_cubemap_per_texture", 28)) + { + ret = GLEW_ARB_seamless_cubemap_per_texture; + continue; + } +#endif +#ifdef GL_ARB_separate_shader_objects + if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_shader_objects", 23)) + { + ret = GLEW_ARB_separate_shader_objects; + continue; + } +#endif +#ifdef GL_ARB_shader_atomic_counter_ops + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counter_ops", 25)) + { + ret = GLEW_ARB_shader_atomic_counter_ops; + continue; + } +#endif +#ifdef GL_ARB_shader_atomic_counters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counters", 22)) + { + ret = GLEW_ARB_shader_atomic_counters; + continue; + } +#endif +#ifdef GL_ARB_shader_ballot + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_ballot", 13)) + { + ret = GLEW_ARB_shader_ballot; + continue; + } +#endif +#ifdef GL_ARB_shader_bit_encoding + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_bit_encoding", 19)) + { + ret = GLEW_ARB_shader_bit_encoding; + continue; + } +#endif +#ifdef GL_ARB_shader_clock + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_clock", 12)) + { + ret = GLEW_ARB_shader_clock; + continue; + } +#endif +#ifdef GL_ARB_shader_draw_parameters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_draw_parameters", 22)) + { + ret = GLEW_ARB_shader_draw_parameters; + continue; + } +#endif +#ifdef GL_ARB_shader_group_vote + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_group_vote", 17)) + { + ret = GLEW_ARB_shader_group_vote; + continue; + } +#endif +#ifdef GL_ARB_shader_image_load_store + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_load_store", 23)) + { + ret = GLEW_ARB_shader_image_load_store; + continue; + } +#endif +#ifdef GL_ARB_shader_image_size + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_size", 17)) + { + ret = GLEW_ARB_shader_image_size; + continue; + } +#endif +#ifdef GL_ARB_shader_objects + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_objects", 14)) + { + ret = GLEW_ARB_shader_objects; + continue; + } +#endif +#ifdef GL_ARB_shader_precision + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_precision", 16)) + { + ret = GLEW_ARB_shader_precision; + continue; + } +#endif +#ifdef GL_ARB_shader_stencil_export + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_stencil_export", 21)) + { + ret = GLEW_ARB_shader_stencil_export; + continue; + } +#endif +#ifdef GL_ARB_shader_storage_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_storage_buffer_object", 28)) + { + ret = GLEW_ARB_shader_storage_buffer_object; + continue; + } +#endif +#ifdef GL_ARB_shader_subroutine + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_subroutine", 17)) + { + ret = GLEW_ARB_shader_subroutine; + continue; + } +#endif +#ifdef GL_ARB_shader_texture_image_samples + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_texture_image_samples", 28)) + { + ret = GLEW_ARB_shader_texture_image_samples; + continue; + } +#endif +#ifdef GL_ARB_shader_texture_lod + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_texture_lod", 18)) + { + ret = GLEW_ARB_shader_texture_lod; + continue; + } +#endif +#ifdef GL_ARB_shader_viewport_layer_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_viewport_layer_array", 27)) + { + ret = GLEW_ARB_shader_viewport_layer_array; + continue; + } +#endif +#ifdef GL_ARB_shading_language_100 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_100", 20)) + { + ret = GLEW_ARB_shading_language_100; + continue; + } +#endif +#ifdef GL_ARB_shading_language_420pack + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_420pack", 24)) + { + ret = GLEW_ARB_shading_language_420pack; + continue; + } +#endif +#ifdef GL_ARB_shading_language_include + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_include", 24)) + { + ret = GLEW_ARB_shading_language_include; + continue; + } +#endif +#ifdef GL_ARB_shading_language_packing + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_packing", 24)) + { + ret = GLEW_ARB_shading_language_packing; + continue; + } +#endif +#ifdef GL_ARB_shadow + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow", 6)) + { + ret = GLEW_ARB_shadow; + continue; + } +#endif +#ifdef GL_ARB_shadow_ambient + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_ambient", 14)) + { + ret = GLEW_ARB_shadow_ambient; + continue; + } +#endif +#ifdef GL_ARB_sparse_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_buffer", 13)) + { + ret = GLEW_ARB_sparse_buffer; + continue; + } +#endif +#ifdef GL_ARB_sparse_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture", 14)) + { + ret = GLEW_ARB_sparse_texture; + continue; + } +#endif +#ifdef GL_ARB_sparse_texture2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture2", 15)) + { + ret = GLEW_ARB_sparse_texture2; + continue; + } +#endif +#ifdef GL_ARB_sparse_texture_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture_clamp", 20)) + { + ret = GLEW_ARB_sparse_texture_clamp; + continue; + } +#endif +#ifdef GL_ARB_stencil_texturing + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_texturing", 17)) + { + ret = GLEW_ARB_stencil_texturing; + continue; + } +#endif +#ifdef GL_ARB_sync + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync", 4)) + { + ret = GLEW_ARB_sync; + continue; + } +#endif +#ifdef GL_ARB_tessellation_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"tessellation_shader", 19)) + { + ret = GLEW_ARB_tessellation_shader; + continue; + } +#endif +#ifdef GL_ARB_texture_barrier + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_barrier", 15)) + { + ret = GLEW_ARB_texture_barrier; + continue; + } +#endif +#ifdef GL_ARB_texture_border_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_border_clamp", 20)) + { + ret = GLEW_ARB_texture_border_clamp; + continue; + } +#endif +#ifdef GL_ARB_texture_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object", 21)) + { + ret = GLEW_ARB_texture_buffer_object; + continue; + } +#endif +#ifdef GL_ARB_texture_buffer_object_rgb32 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object_rgb32", 27)) + { + ret = GLEW_ARB_texture_buffer_object_rgb32; + continue; + } +#endif +#ifdef GL_ARB_texture_buffer_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_range", 20)) + { + ret = GLEW_ARB_texture_buffer_range; + continue; + } +#endif +#ifdef GL_ARB_texture_compression + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression", 19)) + { + ret = GLEW_ARB_texture_compression; + continue; + } +#endif +#ifdef GL_ARB_texture_compression_bptc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_bptc", 24)) + { + ret = GLEW_ARB_texture_compression_bptc; + continue; + } +#endif +#ifdef GL_ARB_texture_compression_rgtc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_rgtc", 24)) + { + ret = GLEW_ARB_texture_compression_rgtc; + continue; + } +#endif +#ifdef GL_ARB_texture_cube_map + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map", 16)) + { + ret = GLEW_ARB_texture_cube_map; + continue; + } +#endif +#ifdef GL_ARB_texture_cube_map_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map_array", 22)) + { + ret = GLEW_ARB_texture_cube_map_array; + continue; + } +#endif +#ifdef GL_ARB_texture_env_add + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_add", 15)) + { + ret = GLEW_ARB_texture_env_add; + continue; + } +#endif +#ifdef GL_ARB_texture_env_combine + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine", 19)) + { + ret = GLEW_ARB_texture_env_combine; + continue; + } +#endif +#ifdef GL_ARB_texture_env_crossbar + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_crossbar", 20)) + { + ret = GLEW_ARB_texture_env_crossbar; + continue; + } +#endif +#ifdef GL_ARB_texture_env_dot3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_dot3", 16)) + { + ret = GLEW_ARB_texture_env_dot3; + continue; + } +#endif +#ifdef GL_ARB_texture_filter_minmax + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter_minmax", 21)) + { + ret = GLEW_ARB_texture_filter_minmax; + continue; + } +#endif +#ifdef GL_ARB_texture_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_float", 13)) + { + ret = GLEW_ARB_texture_float; + continue; + } +#endif +#ifdef GL_ARB_texture_gather + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_gather", 14)) + { + ret = GLEW_ARB_texture_gather; + continue; + } +#endif +#ifdef GL_ARB_texture_mirror_clamp_to_edge + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_clamp_to_edge", 28)) + { + ret = GLEW_ARB_texture_mirror_clamp_to_edge; + continue; + } +#endif +#ifdef GL_ARB_texture_mirrored_repeat + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirrored_repeat", 23)) + { + ret = GLEW_ARB_texture_mirrored_repeat; + continue; + } +#endif +#ifdef GL_ARB_texture_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multisample", 19)) + { + ret = GLEW_ARB_texture_multisample; + continue; + } +#endif +#ifdef GL_ARB_texture_non_power_of_two + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_non_power_of_two", 24)) + { + ret = GLEW_ARB_texture_non_power_of_two; + continue; + } +#endif +#ifdef GL_ARB_texture_query_levels + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_query_levels", 20)) + { + ret = GLEW_ARB_texture_query_levels; + continue; + } +#endif +#ifdef GL_ARB_texture_query_lod + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_query_lod", 17)) + { + ret = GLEW_ARB_texture_query_lod; + continue; + } +#endif +#ifdef GL_ARB_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) + { + ret = GLEW_ARB_texture_rectangle; + continue; + } +#endif +#ifdef GL_ARB_texture_rg + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rg", 10)) + { + ret = GLEW_ARB_texture_rg; + continue; + } +#endif +#ifdef GL_ARB_texture_rgb10_a2ui + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rgb10_a2ui", 18)) + { + ret = GLEW_ARB_texture_rgb10_a2ui; + continue; + } +#endif +#ifdef GL_ARB_texture_stencil8 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_stencil8", 16)) + { + ret = GLEW_ARB_texture_stencil8; + continue; + } +#endif +#ifdef GL_ARB_texture_storage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_storage", 15)) + { + ret = GLEW_ARB_texture_storage; + continue; + } +#endif +#ifdef GL_ARB_texture_storage_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_storage_multisample", 27)) + { + ret = GLEW_ARB_texture_storage_multisample; + continue; + } +#endif +#ifdef GL_ARB_texture_swizzle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_swizzle", 15)) + { + ret = GLEW_ARB_texture_swizzle; + continue; + } +#endif +#ifdef GL_ARB_texture_view + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_view", 12)) + { + ret = GLEW_ARB_texture_view; + continue; + } +#endif +#ifdef GL_ARB_timer_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"timer_query", 11)) + { + ret = GLEW_ARB_timer_query; + continue; + } +#endif +#ifdef GL_ARB_transform_feedback2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback2", 19)) + { + ret = GLEW_ARB_transform_feedback2; + continue; + } +#endif +#ifdef GL_ARB_transform_feedback3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback3", 19)) + { + ret = GLEW_ARB_transform_feedback3; + continue; + } +#endif +#ifdef GL_ARB_transform_feedback_instanced + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback_instanced", 28)) + { + ret = GLEW_ARB_transform_feedback_instanced; + continue; + } +#endif +#ifdef GL_ARB_transform_feedback_overflow_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback_overflow_query", 33)) + { + ret = GLEW_ARB_transform_feedback_overflow_query; + continue; + } +#endif +#ifdef GL_ARB_transpose_matrix + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transpose_matrix", 16)) + { + ret = GLEW_ARB_transpose_matrix; + continue; + } +#endif +#ifdef GL_ARB_uniform_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"uniform_buffer_object", 21)) + { + ret = GLEW_ARB_uniform_buffer_object; + continue; + } +#endif +#ifdef GL_ARB_vertex_array_bgra + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_bgra", 17)) + { + ret = GLEW_ARB_vertex_array_bgra; + continue; + } +#endif +#ifdef GL_ARB_vertex_array_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19)) + { + ret = GLEW_ARB_vertex_array_object; + continue; + } +#endif +#ifdef GL_ARB_vertex_attrib_64bit + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_64bit", 19)) + { + ret = GLEW_ARB_vertex_attrib_64bit; + continue; + } +#endif +#ifdef GL_ARB_vertex_attrib_binding + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_binding", 21)) + { + ret = GLEW_ARB_vertex_attrib_binding; + continue; + } +#endif +#ifdef GL_ARB_vertex_blend + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_blend", 12)) + { + ret = GLEW_ARB_vertex_blend; + continue; + } +#endif +#ifdef GL_ARB_vertex_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_object", 20)) + { + ret = GLEW_ARB_vertex_buffer_object; + continue; + } +#endif +#ifdef GL_ARB_vertex_program + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program", 14)) + { + ret = GLEW_ARB_vertex_program; + continue; + } +#endif +#ifdef GL_ARB_vertex_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader", 13)) + { + ret = GLEW_ARB_vertex_shader; + continue; + } +#endif +#ifdef GL_ARB_vertex_type_10f_11f_11f_rev + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_type_10f_11f_11f_rev", 27)) + { + ret = GLEW_ARB_vertex_type_10f_11f_11f_rev; + continue; + } +#endif +#ifdef GL_ARB_vertex_type_2_10_10_10_rev + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_type_2_10_10_10_rev", 26)) + { + ret = GLEW_ARB_vertex_type_2_10_10_10_rev; + continue; + } +#endif +#ifdef GL_ARB_viewport_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"viewport_array", 14)) + { + ret = GLEW_ARB_viewport_array; + continue; + } +#endif +#ifdef GL_ARB_window_pos + if (_glewStrSame3(&pos, &len, (const GLubyte*)"window_pos", 10)) + { + ret = GLEW_ARB_window_pos; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATIX_", 5)) + { +#ifdef GL_ATIX_point_sprites + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprites", 13)) + { + ret = GLEW_ATIX_point_sprites; + continue; + } +#endif +#ifdef GL_ATIX_texture_env_combine3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine3", 20)) + { + ret = GLEW_ATIX_texture_env_combine3; + continue; + } +#endif +#ifdef GL_ATIX_texture_env_route + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_route", 17)) + { + ret = GLEW_ATIX_texture_env_route; + continue; + } +#endif +#ifdef GL_ATIX_vertex_shader_output_point_size + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_output_point_size", 31)) + { + ret = GLEW_ATIX_vertex_shader_output_point_size; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4)) + { +#ifdef GL_ATI_draw_buffers + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers", 12)) + { + ret = GLEW_ATI_draw_buffers; + continue; + } +#endif +#ifdef GL_ATI_element_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"element_array", 13)) + { + ret = GLEW_ATI_element_array; + continue; + } +#endif +#ifdef GL_ATI_envmap_bumpmap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"envmap_bumpmap", 14)) + { + ret = GLEW_ATI_envmap_bumpmap; + continue; + } +#endif +#ifdef GL_ATI_fragment_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader", 15)) + { + ret = GLEW_ATI_fragment_shader; + continue; + } +#endif +#ifdef GL_ATI_map_object_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_object_buffer", 17)) + { + ret = GLEW_ATI_map_object_buffer; + continue; + } +#endif +#ifdef GL_ATI_meminfo + if (_glewStrSame3(&pos, &len, (const GLubyte*)"meminfo", 7)) + { + ret = GLEW_ATI_meminfo; + continue; + } +#endif +#ifdef GL_ATI_pn_triangles + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pn_triangles", 12)) + { + ret = GLEW_ATI_pn_triangles; + continue; + } +#endif +#ifdef GL_ATI_separate_stencil + if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_stencil", 16)) + { + ret = GLEW_ATI_separate_stencil; + continue; + } +#endif +#ifdef GL_ATI_shader_texture_lod + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_texture_lod", 18)) + { + ret = GLEW_ATI_shader_texture_lod; + continue; + } +#endif +#ifdef GL_ATI_text_fragment_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"text_fragment_shader", 20)) + { + ret = GLEW_ATI_text_fragment_shader; + continue; + } +#endif +#ifdef GL_ATI_texture_compression_3dc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_3dc", 23)) + { + ret = GLEW_ATI_texture_compression_3dc; + continue; + } +#endif +#ifdef GL_ATI_texture_env_combine3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine3", 20)) + { + ret = GLEW_ATI_texture_env_combine3; + continue; + } +#endif +#ifdef GL_ATI_texture_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_float", 13)) + { + ret = GLEW_ATI_texture_float; + continue; + } +#endif +#ifdef GL_ATI_texture_mirror_once + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_once", 19)) + { + ret = GLEW_ATI_texture_mirror_once; + continue; + } +#endif +#ifdef GL_ATI_vertex_array_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19)) + { + ret = GLEW_ATI_vertex_array_object; + continue; + } +#endif +#ifdef GL_ATI_vertex_attrib_array_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_array_object", 26)) + { + ret = GLEW_ATI_vertex_attrib_array_object; + continue; + } +#endif +#ifdef GL_ATI_vertex_streams + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_streams", 14)) + { + ret = GLEW_ATI_vertex_streams; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) + { +#ifdef GL_EXT_422_pixels + if (_glewStrSame3(&pos, &len, (const GLubyte*)"422_pixels", 10)) + { + ret = GLEW_EXT_422_pixels; + continue; + } +#endif +#ifdef GL_EXT_Cg_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"Cg_shader", 9)) + { + ret = GLEW_EXT_Cg_shader; + continue; + } +#endif +#ifdef GL_EXT_abgr + if (_glewStrSame3(&pos, &len, (const GLubyte*)"abgr", 4)) + { + ret = GLEW_EXT_abgr; + continue; + } +#endif +#ifdef GL_EXT_bgra + if (_glewStrSame3(&pos, &len, (const GLubyte*)"bgra", 4)) + { + ret = GLEW_EXT_bgra; + continue; + } +#endif +#ifdef GL_EXT_bindable_uniform + if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindable_uniform", 16)) + { + ret = GLEW_EXT_bindable_uniform; + continue; + } +#endif +#ifdef GL_EXT_blend_color + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_color", 11)) + { + ret = GLEW_EXT_blend_color; + continue; + } +#endif +#ifdef GL_EXT_blend_equation_separate + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_separate", 23)) + { + ret = GLEW_EXT_blend_equation_separate; + continue; + } +#endif +#ifdef GL_EXT_blend_func_separate + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_func_separate", 19)) + { + ret = GLEW_EXT_blend_func_separate; + continue; + } +#endif +#ifdef GL_EXT_blend_logic_op + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_logic_op", 14)) + { + ret = GLEW_EXT_blend_logic_op; + continue; + } +#endif +#ifdef GL_EXT_blend_minmax + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_minmax", 12)) + { + ret = GLEW_EXT_blend_minmax; + continue; + } +#endif +#ifdef GL_EXT_blend_subtract + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_subtract", 14)) + { + ret = GLEW_EXT_blend_subtract; + continue; + } +#endif +#ifdef GL_EXT_clip_volume_hint + if (_glewStrSame3(&pos, &len, (const GLubyte*)"clip_volume_hint", 16)) + { + ret = GLEW_EXT_clip_volume_hint; + continue; + } +#endif +#ifdef GL_EXT_cmyka + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cmyka", 5)) + { + ret = GLEW_EXT_cmyka; + continue; + } +#endif +#ifdef GL_EXT_color_subtable + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_subtable", 14)) + { + ret = GLEW_EXT_color_subtable; + continue; + } +#endif +#ifdef GL_EXT_compiled_vertex_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"compiled_vertex_array", 21)) + { + ret = GLEW_EXT_compiled_vertex_array; + continue; + } +#endif +#ifdef GL_EXT_convolution + if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution", 11)) + { + ret = GLEW_EXT_convolution; + continue; + } +#endif +#ifdef GL_EXT_coordinate_frame + if (_glewStrSame3(&pos, &len, (const GLubyte*)"coordinate_frame", 16)) + { + ret = GLEW_EXT_coordinate_frame; + continue; + } +#endif +#ifdef GL_EXT_copy_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_texture", 12)) + { + ret = GLEW_EXT_copy_texture; + continue; + } +#endif +#ifdef GL_EXT_cull_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_vertex", 11)) + { + ret = GLEW_EXT_cull_vertex; + continue; + } +#endif +#ifdef GL_EXT_debug_label + if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_label", 11)) + { + ret = GLEW_EXT_debug_label; + continue; + } +#endif +#ifdef GL_EXT_debug_marker + if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_marker", 12)) + { + ret = GLEW_EXT_debug_marker; + continue; + } +#endif +#ifdef GL_EXT_depth_bounds_test + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_bounds_test", 17)) + { + ret = GLEW_EXT_depth_bounds_test; + continue; + } +#endif +#ifdef GL_EXT_direct_state_access + if (_glewStrSame3(&pos, &len, (const GLubyte*)"direct_state_access", 19)) + { + ret = GLEW_EXT_direct_state_access; + continue; + } +#endif +#ifdef GL_EXT_draw_buffers2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers2", 13)) + { + ret = GLEW_EXT_draw_buffers2; + continue; + } +#endif +#ifdef GL_EXT_draw_instanced + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_instanced", 14)) + { + ret = GLEW_EXT_draw_instanced; + continue; + } +#endif +#ifdef GL_EXT_draw_range_elements + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_range_elements", 19)) + { + ret = GLEW_EXT_draw_range_elements; + continue; + } +#endif +#ifdef GL_EXT_fog_coord + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_coord", 9)) + { + ret = GLEW_EXT_fog_coord; + continue; + } +#endif +#ifdef GL_EXT_fragment_lighting + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_lighting", 17)) + { + ret = GLEW_EXT_fragment_lighting; + continue; + } +#endif +#ifdef GL_EXT_framebuffer_blit + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_blit", 16)) + { + ret = GLEW_EXT_framebuffer_blit; + continue; + } +#endif +#ifdef GL_EXT_framebuffer_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample", 23)) + { + ret = GLEW_EXT_framebuffer_multisample; + continue; + } +#endif +#ifdef GL_EXT_framebuffer_multisample_blit_scaled + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample_blit_scaled", 35)) + { + ret = GLEW_EXT_framebuffer_multisample_blit_scaled; + continue; + } +#endif +#ifdef GL_EXT_framebuffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_object", 18)) + { + ret = GLEW_EXT_framebuffer_object; + continue; + } +#endif +#ifdef GL_EXT_framebuffer_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) + { + ret = GLEW_EXT_framebuffer_sRGB; + continue; + } +#endif +#ifdef GL_EXT_geometry_shader4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16)) + { + ret = GLEW_EXT_geometry_shader4; + continue; + } +#endif +#ifdef GL_EXT_gpu_program_parameters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program_parameters", 22)) + { + ret = GLEW_EXT_gpu_program_parameters; + continue; + } +#endif +#ifdef GL_EXT_gpu_shader4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader4", 11)) + { + ret = GLEW_EXT_gpu_shader4; + continue; + } +#endif +#ifdef GL_EXT_histogram + if (_glewStrSame3(&pos, &len, (const GLubyte*)"histogram", 9)) + { + ret = GLEW_EXT_histogram; + continue; + } +#endif +#ifdef GL_EXT_index_array_formats + if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_array_formats", 19)) + { + ret = GLEW_EXT_index_array_formats; + continue; + } +#endif +#ifdef GL_EXT_index_func + if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_func", 10)) + { + ret = GLEW_EXT_index_func; + continue; + } +#endif +#ifdef GL_EXT_index_material + if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_material", 14)) + { + ret = GLEW_EXT_index_material; + continue; + } +#endif +#ifdef GL_EXT_index_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_texture", 13)) + { + ret = GLEW_EXT_index_texture; + continue; + } +#endif +#ifdef GL_EXT_light_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"light_texture", 13)) + { + ret = GLEW_EXT_light_texture; + continue; + } +#endif +#ifdef GL_EXT_misc_attribute + if (_glewStrSame3(&pos, &len, (const GLubyte*)"misc_attribute", 14)) + { + ret = GLEW_EXT_misc_attribute; + continue; + } +#endif +#ifdef GL_EXT_multi_draw_arrays + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_draw_arrays", 17)) + { + ret = GLEW_EXT_multi_draw_arrays; + continue; + } +#endif +#ifdef GL_EXT_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = GLEW_EXT_multisample; + continue; + } +#endif +#ifdef GL_EXT_packed_depth_stencil + if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_depth_stencil", 20)) + { + ret = GLEW_EXT_packed_depth_stencil; + continue; + } +#endif +#ifdef GL_EXT_packed_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_float", 12)) + { + ret = GLEW_EXT_packed_float; + continue; + } +#endif +#ifdef GL_EXT_packed_pixels + if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_pixels", 13)) + { + ret = GLEW_EXT_packed_pixels; + continue; + } +#endif +#ifdef GL_EXT_paletted_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"paletted_texture", 16)) + { + ret = GLEW_EXT_paletted_texture; + continue; + } +#endif +#ifdef GL_EXT_pixel_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer_object", 19)) + { + ret = GLEW_EXT_pixel_buffer_object; + continue; + } +#endif +#ifdef GL_EXT_pixel_transform + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_transform", 15)) + { + ret = GLEW_EXT_pixel_transform; + continue; + } +#endif +#ifdef GL_EXT_pixel_transform_color_table + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_transform_color_table", 27)) + { + ret = GLEW_EXT_pixel_transform_color_table; + continue; + } +#endif +#ifdef GL_EXT_point_parameters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_parameters", 16)) + { + ret = GLEW_EXT_point_parameters; + continue; + } +#endif +#ifdef GL_EXT_polygon_offset + if (_glewStrSame3(&pos, &len, (const GLubyte*)"polygon_offset", 14)) + { + ret = GLEW_EXT_polygon_offset; + continue; + } +#endif +#ifdef GL_EXT_polygon_offset_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"polygon_offset_clamp", 20)) + { + ret = GLEW_EXT_polygon_offset_clamp; + continue; + } +#endif +#ifdef GL_EXT_post_depth_coverage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"post_depth_coverage", 19)) + { + ret = GLEW_EXT_post_depth_coverage; + continue; + } +#endif +#ifdef GL_EXT_provoking_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"provoking_vertex", 16)) + { + ret = GLEW_EXT_provoking_vertex; + continue; + } +#endif +#ifdef GL_EXT_raster_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"raster_multisample", 18)) + { + ret = GLEW_EXT_raster_multisample; + continue; + } +#endif +#ifdef GL_EXT_rescale_normal + if (_glewStrSame3(&pos, &len, (const GLubyte*)"rescale_normal", 14)) + { + ret = GLEW_EXT_rescale_normal; + continue; + } +#endif +#ifdef GL_EXT_scene_marker + if (_glewStrSame3(&pos, &len, (const GLubyte*)"scene_marker", 12)) + { + ret = GLEW_EXT_scene_marker; + continue; + } +#endif +#ifdef GL_EXT_secondary_color + if (_glewStrSame3(&pos, &len, (const GLubyte*)"secondary_color", 15)) + { + ret = GLEW_EXT_secondary_color; + continue; + } +#endif +#ifdef GL_EXT_separate_shader_objects + if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_shader_objects", 23)) + { + ret = GLEW_EXT_separate_shader_objects; + continue; + } +#endif +#ifdef GL_EXT_separate_specular_color + if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_specular_color", 23)) + { + ret = GLEW_EXT_separate_specular_color; + continue; + } +#endif +#ifdef GL_EXT_shader_image_load_formatted + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_load_formatted", 27)) + { + ret = GLEW_EXT_shader_image_load_formatted; + continue; + } +#endif +#ifdef GL_EXT_shader_image_load_store + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_load_store", 23)) + { + ret = GLEW_EXT_shader_image_load_store; + continue; + } +#endif +#ifdef GL_EXT_shader_integer_mix + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_integer_mix", 18)) + { + ret = GLEW_EXT_shader_integer_mix; + continue; + } +#endif +#ifdef GL_EXT_shadow_funcs + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_funcs", 12)) + { + ret = GLEW_EXT_shadow_funcs; + continue; + } +#endif +#ifdef GL_EXT_shared_texture_palette + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shared_texture_palette", 22)) + { + ret = GLEW_EXT_shared_texture_palette; + continue; + } +#endif +#ifdef GL_EXT_sparse_texture2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture2", 15)) + { + ret = GLEW_EXT_sparse_texture2; + continue; + } +#endif +#ifdef GL_EXT_stencil_clear_tag + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_clear_tag", 17)) + { + ret = GLEW_EXT_stencil_clear_tag; + continue; + } +#endif +#ifdef GL_EXT_stencil_two_side + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_two_side", 16)) + { + ret = GLEW_EXT_stencil_two_side; + continue; + } +#endif +#ifdef GL_EXT_stencil_wrap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_wrap", 12)) + { + ret = GLEW_EXT_stencil_wrap; + continue; + } +#endif +#ifdef GL_EXT_subtexture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"subtexture", 10)) + { + ret = GLEW_EXT_subtexture; + continue; + } +#endif +#ifdef GL_EXT_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture", 7)) + { + ret = GLEW_EXT_texture; + continue; + } +#endif +#ifdef GL_EXT_texture3D + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture3D", 9)) + { + ret = GLEW_EXT_texture3D; + continue; + } +#endif +#ifdef GL_EXT_texture_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_array", 13)) + { + ret = GLEW_EXT_texture_array; + continue; + } +#endif +#ifdef GL_EXT_texture_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object", 21)) + { + ret = GLEW_EXT_texture_buffer_object; + continue; + } +#endif +#ifdef GL_EXT_texture_compression_dxt1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt1", 24)) + { + ret = GLEW_EXT_texture_compression_dxt1; + continue; + } +#endif +#ifdef GL_EXT_texture_compression_latc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_latc", 24)) + { + ret = GLEW_EXT_texture_compression_latc; + continue; + } +#endif +#ifdef GL_EXT_texture_compression_rgtc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_rgtc", 24)) + { + ret = GLEW_EXT_texture_compression_rgtc; + continue; + } +#endif +#ifdef GL_EXT_texture_compression_s3tc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_s3tc", 24)) + { + ret = GLEW_EXT_texture_compression_s3tc; + continue; + } +#endif +#ifdef GL_EXT_texture_cube_map + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map", 16)) + { + ret = GLEW_EXT_texture_cube_map; + continue; + } +#endif +#ifdef GL_EXT_texture_edge_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_edge_clamp", 18)) + { + ret = GLEW_EXT_texture_edge_clamp; + continue; + } +#endif +#ifdef GL_EXT_texture_env + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env", 11)) + { + ret = GLEW_EXT_texture_env; + continue; + } +#endif +#ifdef GL_EXT_texture_env_add + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_add", 15)) + { + ret = GLEW_EXT_texture_env_add; + continue; + } +#endif +#ifdef GL_EXT_texture_env_combine + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine", 19)) + { + ret = GLEW_EXT_texture_env_combine; + continue; + } +#endif +#ifdef GL_EXT_texture_env_dot3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_dot3", 16)) + { + ret = GLEW_EXT_texture_env_dot3; + continue; + } +#endif +#ifdef GL_EXT_texture_filter_anisotropic + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter_anisotropic", 26)) + { + ret = GLEW_EXT_texture_filter_anisotropic; + continue; + } +#endif +#ifdef GL_EXT_texture_filter_minmax + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter_minmax", 21)) + { + ret = GLEW_EXT_texture_filter_minmax; + continue; + } +#endif +#ifdef GL_EXT_texture_integer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_integer", 15)) + { + ret = GLEW_EXT_texture_integer; + continue; + } +#endif +#ifdef GL_EXT_texture_lod_bias + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod_bias", 16)) + { + ret = GLEW_EXT_texture_lod_bias; + continue; + } +#endif +#ifdef GL_EXT_texture_mirror_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_clamp", 20)) + { + ret = GLEW_EXT_texture_mirror_clamp; + continue; + } +#endif +#ifdef GL_EXT_texture_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_object", 14)) + { + ret = GLEW_EXT_texture_object; + continue; + } +#endif +#ifdef GL_EXT_texture_perturb_normal + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_perturb_normal", 22)) + { + ret = GLEW_EXT_texture_perturb_normal; + continue; + } +#endif +#ifdef GL_EXT_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) + { + ret = GLEW_EXT_texture_rectangle; + continue; + } +#endif +#ifdef GL_EXT_texture_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_sRGB", 12)) + { + ret = GLEW_EXT_texture_sRGB; + continue; + } +#endif +#ifdef GL_EXT_texture_sRGB_decode + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_sRGB_decode", 19)) + { + ret = GLEW_EXT_texture_sRGB_decode; + continue; + } +#endif +#ifdef GL_EXT_texture_shared_exponent + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shared_exponent", 23)) + { + ret = GLEW_EXT_texture_shared_exponent; + continue; + } +#endif +#ifdef GL_EXT_texture_snorm + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_snorm", 13)) + { + ret = GLEW_EXT_texture_snorm; + continue; + } +#endif +#ifdef GL_EXT_texture_swizzle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_swizzle", 15)) + { + ret = GLEW_EXT_texture_swizzle; + continue; + } +#endif +#ifdef GL_EXT_timer_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"timer_query", 11)) + { + ret = GLEW_EXT_timer_query; + continue; + } +#endif +#ifdef GL_EXT_transform_feedback + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback", 18)) + { + ret = GLEW_EXT_transform_feedback; + continue; + } +#endif +#ifdef GL_EXT_vertex_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array", 12)) + { + ret = GLEW_EXT_vertex_array; + continue; + } +#endif +#ifdef GL_EXT_vertex_array_bgra + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_bgra", 17)) + { + ret = GLEW_EXT_vertex_array_bgra; + continue; + } +#endif +#ifdef GL_EXT_vertex_attrib_64bit + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_64bit", 19)) + { + ret = GLEW_EXT_vertex_attrib_64bit; + continue; + } +#endif +#ifdef GL_EXT_vertex_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader", 13)) + { + ret = GLEW_EXT_vertex_shader; + continue; + } +#endif +#ifdef GL_EXT_vertex_weighting + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_weighting", 16)) + { + ret = GLEW_EXT_vertex_weighting; + continue; + } +#endif +#ifdef GL_EXT_x11_sync_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"x11_sync_object", 15)) + { + ret = GLEW_EXT_x11_sync_object; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"GREMEDY_", 8)) + { +#ifdef GL_GREMEDY_frame_terminator + if (_glewStrSame3(&pos, &len, (const GLubyte*)"frame_terminator", 16)) + { + ret = GLEW_GREMEDY_frame_terminator; + continue; + } +#endif +#ifdef GL_GREMEDY_string_marker + if (_glewStrSame3(&pos, &len, (const GLubyte*)"string_marker", 13)) + { + ret = GLEW_GREMEDY_string_marker; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"HP_", 3)) + { +#ifdef GL_HP_convolution_border_modes + if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution_border_modes", 24)) + { + ret = GLEW_HP_convolution_border_modes; + continue; + } +#endif +#ifdef GL_HP_image_transform + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_transform", 15)) + { + ret = GLEW_HP_image_transform; + continue; + } +#endif +#ifdef GL_HP_occlusion_test + if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_test", 14)) + { + ret = GLEW_HP_occlusion_test; + continue; + } +#endif +#ifdef GL_HP_texture_lighting + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lighting", 16)) + { + ret = GLEW_HP_texture_lighting; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"IBM_", 4)) + { +#ifdef GL_IBM_cull_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_vertex", 11)) + { + ret = GLEW_IBM_cull_vertex; + continue; + } +#endif +#ifdef GL_IBM_multimode_draw_arrays + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multimode_draw_arrays", 21)) + { + ret = GLEW_IBM_multimode_draw_arrays; + continue; + } +#endif +#ifdef GL_IBM_rasterpos_clip + if (_glewStrSame3(&pos, &len, (const GLubyte*)"rasterpos_clip", 14)) + { + ret = GLEW_IBM_rasterpos_clip; + continue; + } +#endif +#ifdef GL_IBM_static_data + if (_glewStrSame3(&pos, &len, (const GLubyte*)"static_data", 11)) + { + ret = GLEW_IBM_static_data; + continue; + } +#endif +#ifdef GL_IBM_texture_mirrored_repeat + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirrored_repeat", 23)) + { + ret = GLEW_IBM_texture_mirrored_repeat; + continue; + } +#endif +#ifdef GL_IBM_vertex_array_lists + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_lists", 18)) + { + ret = GLEW_IBM_vertex_array_lists; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"INGR_", 5)) + { +#ifdef GL_INGR_color_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_clamp", 11)) + { + ret = GLEW_INGR_color_clamp; + continue; + } +#endif +#ifdef GL_INGR_interlace_read + if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace_read", 14)) + { + ret = GLEW_INGR_interlace_read; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"INTEL_", 6)) + { +#ifdef GL_INTEL_fragment_shader_ordering + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader_ordering", 24)) + { + ret = GLEW_INTEL_fragment_shader_ordering; + continue; + } +#endif +#ifdef GL_INTEL_framebuffer_CMAA + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_CMAA", 16)) + { + ret = GLEW_INTEL_framebuffer_CMAA; + continue; + } +#endif +#ifdef GL_INTEL_map_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_texture", 11)) + { + ret = GLEW_INTEL_map_texture; + continue; + } +#endif +#ifdef GL_INTEL_parallel_arrays + if (_glewStrSame3(&pos, &len, (const GLubyte*)"parallel_arrays", 15)) + { + ret = GLEW_INTEL_parallel_arrays; + continue; + } +#endif +#ifdef GL_INTEL_performance_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"performance_query", 17)) + { + ret = GLEW_INTEL_performance_query; + continue; + } +#endif +#ifdef GL_INTEL_texture_scissor + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_scissor", 15)) + { + ret = GLEW_INTEL_texture_scissor; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"KHR_", 4)) + { +#ifdef GL_KHR_blend_equation_advanced + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced", 23)) + { + ret = GLEW_KHR_blend_equation_advanced; + continue; + } +#endif +#ifdef GL_KHR_blend_equation_advanced_coherent + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced_coherent", 32)) + { + ret = GLEW_KHR_blend_equation_advanced_coherent; + continue; + } +#endif +#ifdef GL_KHR_context_flush_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"context_flush_control", 21)) + { + ret = GLEW_KHR_context_flush_control; + continue; + } +#endif +#ifdef GL_KHR_debug + if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug", 5)) + { + ret = GLEW_KHR_debug; + continue; + } +#endif +#ifdef GL_KHR_no_error + if (_glewStrSame3(&pos, &len, (const GLubyte*)"no_error", 8)) + { + ret = GLEW_KHR_no_error; + continue; + } +#endif +#ifdef GL_KHR_robust_buffer_access_behavior + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robust_buffer_access_behavior", 29)) + { + ret = GLEW_KHR_robust_buffer_access_behavior; + continue; + } +#endif +#ifdef GL_KHR_robustness + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness", 10)) + { + ret = GLEW_KHR_robustness; + continue; + } +#endif +#ifdef GL_KHR_texture_compression_astc_hdr + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_astc_hdr", 28)) + { + ret = GLEW_KHR_texture_compression_astc_hdr; + continue; + } +#endif +#ifdef GL_KHR_texture_compression_astc_ldr + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_astc_ldr", 28)) + { + ret = GLEW_KHR_texture_compression_astc_ldr; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"KTX_", 4)) + { +#ifdef GL_KTX_buffer_region + if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_region", 13)) + { + ret = GLEW_KTX_buffer_region; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESAX_", 6)) + { +#ifdef GL_MESAX_texture_stack + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_stack", 13)) + { + ret = GLEW_MESAX_texture_stack; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESA_", 5)) + { +#ifdef GL_MESA_pack_invert + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pack_invert", 11)) + { + ret = GLEW_MESA_pack_invert; + continue; + } +#endif +#ifdef GL_MESA_resize_buffers + if (_glewStrSame3(&pos, &len, (const GLubyte*)"resize_buffers", 14)) + { + ret = GLEW_MESA_resize_buffers; + continue; + } +#endif +#ifdef GL_MESA_window_pos + if (_glewStrSame3(&pos, &len, (const GLubyte*)"window_pos", 10)) + { + ret = GLEW_MESA_window_pos; + continue; + } +#endif +#ifdef GL_MESA_ycbcr_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycbcr_texture", 13)) + { + ret = GLEW_MESA_ycbcr_texture; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"NVX_", 4)) + { +#ifdef GL_NVX_conditional_render + if (_glewStrSame3(&pos, &len, (const GLubyte*)"conditional_render", 18)) + { + ret = GLEW_NVX_conditional_render; + continue; + } +#endif +#ifdef GL_NVX_gpu_memory_info + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_memory_info", 15)) + { + ret = GLEW_NVX_gpu_memory_info; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) + { +#ifdef GL_NV_bindless_multi_draw_indirect + if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_multi_draw_indirect", 28)) + { + ret = GLEW_NV_bindless_multi_draw_indirect; + continue; + } +#endif +#ifdef GL_NV_bindless_multi_draw_indirect_count + if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_multi_draw_indirect_count", 34)) + { + ret = GLEW_NV_bindless_multi_draw_indirect_count; + continue; + } +#endif +#ifdef GL_NV_bindless_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_texture", 16)) + { + ret = GLEW_NV_bindless_texture; + continue; + } +#endif +#ifdef GL_NV_blend_equation_advanced + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced", 23)) + { + ret = GLEW_NV_blend_equation_advanced; + continue; + } +#endif +#ifdef GL_NV_blend_equation_advanced_coherent + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced_coherent", 32)) + { + ret = GLEW_NV_blend_equation_advanced_coherent; + continue; + } +#endif +#ifdef GL_NV_blend_square + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_square", 12)) + { + ret = GLEW_NV_blend_square; + continue; + } +#endif +#ifdef GL_NV_compute_program5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"compute_program5", 16)) + { + ret = GLEW_NV_compute_program5; + continue; + } +#endif +#ifdef GL_NV_conditional_render + if (_glewStrSame3(&pos, &len, (const GLubyte*)"conditional_render", 18)) + { + ret = GLEW_NV_conditional_render; + continue; + } +#endif +#ifdef GL_NV_conservative_raster + if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_raster", 19)) + { + ret = GLEW_NV_conservative_raster; + continue; + } +#endif +#ifdef GL_NV_conservative_raster_dilate + if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_raster_dilate", 26)) + { + ret = GLEW_NV_conservative_raster_dilate; + continue; + } +#endif +#ifdef GL_NV_copy_depth_to_color + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_depth_to_color", 19)) + { + ret = GLEW_NV_copy_depth_to_color; + continue; + } +#endif +#ifdef GL_NV_copy_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) + { + ret = GLEW_NV_copy_image; + continue; + } +#endif +#ifdef GL_NV_deep_texture3D + if (_glewStrSame3(&pos, &len, (const GLubyte*)"deep_texture3D", 14)) + { + ret = GLEW_NV_deep_texture3D; + continue; + } +#endif +#ifdef GL_NV_depth_buffer_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_buffer_float", 18)) + { + ret = GLEW_NV_depth_buffer_float; + continue; + } +#endif +#ifdef GL_NV_depth_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_clamp", 11)) + { + ret = GLEW_NV_depth_clamp; + continue; + } +#endif +#ifdef GL_NV_depth_range_unclamped + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_range_unclamped", 21)) + { + ret = GLEW_NV_depth_range_unclamped; + continue; + } +#endif +#ifdef GL_NV_draw_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_texture", 12)) + { + ret = GLEW_NV_draw_texture; + continue; + } +#endif +#ifdef GL_NV_evaluators + if (_glewStrSame3(&pos, &len, (const GLubyte*)"evaluators", 10)) + { + ret = GLEW_NV_evaluators; + continue; + } +#endif +#ifdef GL_NV_explicit_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_multisample", 20)) + { + ret = GLEW_NV_explicit_multisample; + continue; + } +#endif +#ifdef GL_NV_fence + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fence", 5)) + { + ret = GLEW_NV_fence; + continue; + } +#endif +#ifdef GL_NV_fill_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fill_rectangle", 14)) + { + ret = GLEW_NV_fill_rectangle; + continue; + } +#endif +#ifdef GL_NV_float_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) + { + ret = GLEW_NV_float_buffer; + continue; + } +#endif +#ifdef GL_NV_fog_distance + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_distance", 12)) + { + ret = GLEW_NV_fog_distance; + continue; + } +#endif +#ifdef GL_NV_fragment_coverage_to_color + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_coverage_to_color", 26)) + { + ret = GLEW_NV_fragment_coverage_to_color; + continue; + } +#endif +#ifdef GL_NV_fragment_program + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program", 16)) + { + ret = GLEW_NV_fragment_program; + continue; + } +#endif +#ifdef GL_NV_fragment_program2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program2", 17)) + { + ret = GLEW_NV_fragment_program2; + continue; + } +#endif +#ifdef GL_NV_fragment_program4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program4", 17)) + { + ret = GLEW_NV_fragment_program4; + continue; + } +#endif +#ifdef GL_NV_fragment_program_option + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program_option", 23)) + { + ret = GLEW_NV_fragment_program_option; + continue; + } +#endif +#ifdef GL_NV_fragment_shader_interlock + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader_interlock", 25)) + { + ret = GLEW_NV_fragment_shader_interlock; + continue; + } +#endif +#ifdef GL_NV_framebuffer_mixed_samples + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_mixed_samples", 25)) + { + ret = GLEW_NV_framebuffer_mixed_samples; + continue; + } +#endif +#ifdef GL_NV_framebuffer_multisample_coverage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample_coverage", 32)) + { + ret = GLEW_NV_framebuffer_multisample_coverage; + continue; + } +#endif +#ifdef GL_NV_geometry_program4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_program4", 17)) + { + ret = GLEW_NV_geometry_program4; + continue; + } +#endif +#ifdef GL_NV_geometry_shader4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16)) + { + ret = GLEW_NV_geometry_shader4; + continue; + } +#endif +#ifdef GL_NV_geometry_shader_passthrough + if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader_passthrough", 27)) + { + ret = GLEW_NV_geometry_shader_passthrough; + continue; + } +#endif +#ifdef GL_NV_gpu_program4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program4", 12)) + { + ret = GLEW_NV_gpu_program4; + continue; + } +#endif +#ifdef GL_NV_gpu_program5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program5", 12)) + { + ret = GLEW_NV_gpu_program5; + continue; + } +#endif +#ifdef GL_NV_gpu_program5_mem_extended + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program5_mem_extended", 25)) + { + ret = GLEW_NV_gpu_program5_mem_extended; + continue; + } +#endif +#ifdef GL_NV_gpu_program_fp64 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program_fp64", 16)) + { + ret = GLEW_NV_gpu_program_fp64; + continue; + } +#endif +#ifdef GL_NV_gpu_shader5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader5", 11)) + { + ret = GLEW_NV_gpu_shader5; + continue; + } +#endif +#ifdef GL_NV_half_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float", 10)) + { + ret = GLEW_NV_half_float; + continue; + } +#endif +#ifdef GL_NV_internalformat_sample_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"internalformat_sample_query", 27)) + { + ret = GLEW_NV_internalformat_sample_query; + continue; + } +#endif +#ifdef GL_NV_light_max_exponent + if (_glewStrSame3(&pos, &len, (const GLubyte*)"light_max_exponent", 18)) + { + ret = GLEW_NV_light_max_exponent; + continue; + } +#endif +#ifdef GL_NV_multisample_coverage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20)) + { + ret = GLEW_NV_multisample_coverage; + continue; + } +#endif +#ifdef GL_NV_multisample_filter_hint + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_filter_hint", 23)) + { + ret = GLEW_NV_multisample_filter_hint; + continue; + } +#endif +#ifdef GL_NV_occlusion_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query", 15)) + { + ret = GLEW_NV_occlusion_query; + continue; + } +#endif +#ifdef GL_NV_packed_depth_stencil + if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_depth_stencil", 20)) + { + ret = GLEW_NV_packed_depth_stencil; + continue; + } +#endif +#ifdef GL_NV_parameter_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"parameter_buffer_object", 23)) + { + ret = GLEW_NV_parameter_buffer_object; + continue; + } +#endif +#ifdef GL_NV_parameter_buffer_object2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"parameter_buffer_object2", 24)) + { + ret = GLEW_NV_parameter_buffer_object2; + continue; + } +#endif +#ifdef GL_NV_path_rendering + if (_glewStrSame3(&pos, &len, (const GLubyte*)"path_rendering", 14)) + { + ret = GLEW_NV_path_rendering; + continue; + } +#endif +#ifdef GL_NV_path_rendering_shared_edge + if (_glewStrSame3(&pos, &len, (const GLubyte*)"path_rendering_shared_edge", 26)) + { + ret = GLEW_NV_path_rendering_shared_edge; + continue; + } +#endif +#ifdef GL_NV_pixel_data_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_data_range", 16)) + { + ret = GLEW_NV_pixel_data_range; + continue; + } +#endif +#ifdef GL_NV_point_sprite + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprite", 12)) + { + ret = GLEW_NV_point_sprite; + continue; + } +#endif +#ifdef GL_NV_present_video + if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13)) + { + ret = GLEW_NV_present_video; + continue; + } +#endif +#ifdef GL_NV_primitive_restart + if (_glewStrSame3(&pos, &len, (const GLubyte*)"primitive_restart", 17)) + { + ret = GLEW_NV_primitive_restart; + continue; + } +#endif +#ifdef GL_NV_register_combiners + if (_glewStrSame3(&pos, &len, (const GLubyte*)"register_combiners", 18)) + { + ret = GLEW_NV_register_combiners; + continue; + } +#endif +#ifdef GL_NV_register_combiners2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"register_combiners2", 19)) + { + ret = GLEW_NV_register_combiners2; + continue; + } +#endif +#ifdef GL_NV_sample_locations + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_locations", 16)) + { + ret = GLEW_NV_sample_locations; + continue; + } +#endif +#ifdef GL_NV_sample_mask_override_coverage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_mask_override_coverage", 29)) + { + ret = GLEW_NV_sample_mask_override_coverage; + continue; + } +#endif +#ifdef GL_NV_shader_atomic_counters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counters", 22)) + { + ret = GLEW_NV_shader_atomic_counters; + continue; + } +#endif +#ifdef GL_NV_shader_atomic_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_float", 19)) + { + ret = GLEW_NV_shader_atomic_float; + continue; + } +#endif +#ifdef GL_NV_shader_atomic_fp16_vector + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_fp16_vector", 25)) + { + ret = GLEW_NV_shader_atomic_fp16_vector; + continue; + } +#endif +#ifdef GL_NV_shader_atomic_int64 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_int64", 19)) + { + ret = GLEW_NV_shader_atomic_int64; + continue; + } +#endif +#ifdef GL_NV_shader_buffer_load + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_buffer_load", 18)) + { + ret = GLEW_NV_shader_buffer_load; + continue; + } +#endif +#ifdef GL_NV_shader_storage_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_storage_buffer_object", 28)) + { + ret = GLEW_NV_shader_storage_buffer_object; + continue; + } +#endif +#ifdef GL_NV_shader_thread_group + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_thread_group", 19)) + { + ret = GLEW_NV_shader_thread_group; + continue; + } +#endif +#ifdef GL_NV_shader_thread_shuffle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_thread_shuffle", 21)) + { + ret = GLEW_NV_shader_thread_shuffle; + continue; + } +#endif +#ifdef GL_NV_tessellation_program5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"tessellation_program5", 21)) + { + ret = GLEW_NV_tessellation_program5; + continue; + } +#endif +#ifdef GL_NV_texgen_emboss + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texgen_emboss", 13)) + { + ret = GLEW_NV_texgen_emboss; + continue; + } +#endif +#ifdef GL_NV_texgen_reflection + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texgen_reflection", 17)) + { + ret = GLEW_NV_texgen_reflection; + continue; + } +#endif +#ifdef GL_NV_texture_barrier + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_barrier", 15)) + { + ret = GLEW_NV_texture_barrier; + continue; + } +#endif +#ifdef GL_NV_texture_compression_vtc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_vtc", 23)) + { + ret = GLEW_NV_texture_compression_vtc; + continue; + } +#endif +#ifdef GL_NV_texture_env_combine4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine4", 20)) + { + ret = GLEW_NV_texture_env_combine4; + continue; + } +#endif +#ifdef GL_NV_texture_expand_normal + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_expand_normal", 21)) + { + ret = GLEW_NV_texture_expand_normal; + continue; + } +#endif +#ifdef GL_NV_texture_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multisample", 19)) + { + ret = GLEW_NV_texture_multisample; + continue; + } +#endif +#ifdef GL_NV_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) + { + ret = GLEW_NV_texture_rectangle; + continue; + } +#endif +#ifdef GL_NV_texture_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader", 14)) + { + ret = GLEW_NV_texture_shader; + continue; + } +#endif +#ifdef GL_NV_texture_shader2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader2", 15)) + { + ret = GLEW_NV_texture_shader2; + continue; + } +#endif +#ifdef GL_NV_texture_shader3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader3", 15)) + { + ret = GLEW_NV_texture_shader3; + continue; + } +#endif +#ifdef GL_NV_transform_feedback + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback", 18)) + { + ret = GLEW_NV_transform_feedback; + continue; + } +#endif +#ifdef GL_NV_transform_feedback2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback2", 19)) + { + ret = GLEW_NV_transform_feedback2; + continue; + } +#endif +#ifdef GL_NV_uniform_buffer_unified_memory + if (_glewStrSame3(&pos, &len, (const GLubyte*)"uniform_buffer_unified_memory", 29)) + { + ret = GLEW_NV_uniform_buffer_unified_memory; + continue; + } +#endif +#ifdef GL_NV_vdpau_interop + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vdpau_interop", 13)) + { + ret = GLEW_NV_vdpau_interop; + continue; + } +#endif +#ifdef GL_NV_vertex_array_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) + { + ret = GLEW_NV_vertex_array_range; + continue; + } +#endif +#ifdef GL_NV_vertex_array_range2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range2", 19)) + { + ret = GLEW_NV_vertex_array_range2; + continue; + } +#endif +#ifdef GL_NV_vertex_attrib_integer_64bit + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_integer_64bit", 27)) + { + ret = GLEW_NV_vertex_attrib_integer_64bit; + continue; + } +#endif +#ifdef GL_NV_vertex_buffer_unified_memory + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_unified_memory", 28)) + { + ret = GLEW_NV_vertex_buffer_unified_memory; + continue; + } +#endif +#ifdef GL_NV_vertex_program + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program", 14)) + { + ret = GLEW_NV_vertex_program; + continue; + } +#endif +#ifdef GL_NV_vertex_program1_1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program1_1", 17)) + { + ret = GLEW_NV_vertex_program1_1; + continue; + } +#endif +#ifdef GL_NV_vertex_program2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program2", 15)) + { + ret = GLEW_NV_vertex_program2; + continue; + } +#endif +#ifdef GL_NV_vertex_program2_option + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program2_option", 22)) + { + ret = GLEW_NV_vertex_program2_option; + continue; + } +#endif +#ifdef GL_NV_vertex_program3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program3", 15)) + { + ret = GLEW_NV_vertex_program3; + continue; + } +#endif +#ifdef GL_NV_vertex_program4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program4", 15)) + { + ret = GLEW_NV_vertex_program4; + continue; + } +#endif +#ifdef GL_NV_video_capture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) + { + ret = GLEW_NV_video_capture; + continue; + } +#endif +#ifdef GL_NV_viewport_array2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"viewport_array2", 15)) + { + ret = GLEW_NV_viewport_array2; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"OES_", 4)) + { +#ifdef GL_OES_byte_coordinates + if (_glewStrSame3(&pos, &len, (const GLubyte*)"byte_coordinates", 16)) + { + ret = GLEW_OES_byte_coordinates; + continue; + } +#endif +#ifdef GL_OES_compressed_paletted_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"compressed_paletted_texture", 27)) + { + ret = GLEW_OES_compressed_paletted_texture; + continue; + } +#endif +#ifdef GL_OES_read_format + if (_glewStrSame3(&pos, &len, (const GLubyte*)"read_format", 11)) + { + ret = GLEW_OES_read_format; + continue; + } +#endif +#ifdef GL_OES_single_precision + if (_glewStrSame3(&pos, &len, (const GLubyte*)"single_precision", 16)) + { + ret = GLEW_OES_single_precision; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) + { +#ifdef GL_OML_interlace + if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace", 9)) + { + ret = GLEW_OML_interlace; + continue; + } +#endif +#ifdef GL_OML_resample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"resample", 8)) + { + ret = GLEW_OML_resample; + continue; + } +#endif +#ifdef GL_OML_subsample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"subsample", 9)) + { + ret = GLEW_OML_subsample; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"OVR_", 4)) + { +#ifdef GL_OVR_multiview + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multiview", 9)) + { + ret = GLEW_OVR_multiview; + continue; + } +#endif +#ifdef GL_OVR_multiview2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multiview2", 10)) + { + ret = GLEW_OVR_multiview2; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"PGI_", 4)) + { +#ifdef GL_PGI_misc_hints + if (_glewStrSame3(&pos, &len, (const GLubyte*)"misc_hints", 10)) + { + ret = GLEW_PGI_misc_hints; + continue; + } +#endif +#ifdef GL_PGI_vertex_hints + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_hints", 12)) + { + ret = GLEW_PGI_vertex_hints; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"REGAL_", 6)) + { +#ifdef GL_REGAL_ES1_0_compatibility + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES1_0_compatibility", 19)) + { + ret = GLEW_REGAL_ES1_0_compatibility; + continue; + } +#endif +#ifdef GL_REGAL_ES1_1_compatibility + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES1_1_compatibility", 19)) + { + ret = GLEW_REGAL_ES1_1_compatibility; + continue; + } +#endif +#ifdef GL_REGAL_enable + if (_glewStrSame3(&pos, &len, (const GLubyte*)"enable", 6)) + { + ret = GLEW_REGAL_enable; + continue; + } +#endif +#ifdef GL_REGAL_error_string + if (_glewStrSame3(&pos, &len, (const GLubyte*)"error_string", 12)) + { + ret = GLEW_REGAL_error_string; + continue; + } +#endif +#ifdef GL_REGAL_extension_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"extension_query", 15)) + { + ret = GLEW_REGAL_extension_query; + continue; + } +#endif +#ifdef GL_REGAL_log + if (_glewStrSame3(&pos, &len, (const GLubyte*)"log", 3)) + { + ret = GLEW_REGAL_log; + continue; + } +#endif +#ifdef GL_REGAL_proc_address + if (_glewStrSame3(&pos, &len, (const GLubyte*)"proc_address", 12)) + { + ret = GLEW_REGAL_proc_address; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"REND_", 5)) + { +#ifdef GL_REND_screen_coordinates + if (_glewStrSame3(&pos, &len, (const GLubyte*)"screen_coordinates", 18)) + { + ret = GLEW_REND_screen_coordinates; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"S3_", 3)) + { +#ifdef GL_S3_s3tc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"s3tc", 4)) + { + ret = GLEW_S3_s3tc; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIS_", 5)) + { +#ifdef GL_SGIS_color_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_range", 11)) + { + ret = GLEW_SGIS_color_range; + continue; + } +#endif +#ifdef GL_SGIS_detail_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"detail_texture", 14)) + { + ret = GLEW_SGIS_detail_texture; + continue; + } +#endif +#ifdef GL_SGIS_fog_function + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_function", 12)) + { + ret = GLEW_SGIS_fog_function; + continue; + } +#endif +#ifdef GL_SGIS_generate_mipmap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"generate_mipmap", 15)) + { + ret = GLEW_SGIS_generate_mipmap; + continue; + } +#endif +#ifdef GL_SGIS_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = GLEW_SGIS_multisample; + continue; + } +#endif +#ifdef GL_SGIS_pixel_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture", 13)) + { + ret = GLEW_SGIS_pixel_texture; + continue; + } +#endif +#ifdef GL_SGIS_point_line_texgen + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_line_texgen", 17)) + { + ret = GLEW_SGIS_point_line_texgen; + continue; + } +#endif +#ifdef GL_SGIS_sharpen_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sharpen_texture", 15)) + { + ret = GLEW_SGIS_sharpen_texture; + continue; + } +#endif +#ifdef GL_SGIS_texture4D + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture4D", 9)) + { + ret = GLEW_SGIS_texture4D; + continue; + } +#endif +#ifdef GL_SGIS_texture_border_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_border_clamp", 20)) + { + ret = GLEW_SGIS_texture_border_clamp; + continue; + } +#endif +#ifdef GL_SGIS_texture_edge_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_edge_clamp", 18)) + { + ret = GLEW_SGIS_texture_edge_clamp; + continue; + } +#endif +#ifdef GL_SGIS_texture_filter4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter4", 15)) + { + ret = GLEW_SGIS_texture_filter4; + continue; + } +#endif +#ifdef GL_SGIS_texture_lod + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod", 11)) + { + ret = GLEW_SGIS_texture_lod; + continue; + } +#endif +#ifdef GL_SGIS_texture_select + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_select", 14)) + { + ret = GLEW_SGIS_texture_select; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIX_", 5)) + { +#ifdef GL_SGIX_async + if (_glewStrSame3(&pos, &len, (const GLubyte*)"async", 5)) + { + ret = GLEW_SGIX_async; + continue; + } +#endif +#ifdef GL_SGIX_async_histogram + if (_glewStrSame3(&pos, &len, (const GLubyte*)"async_histogram", 15)) + { + ret = GLEW_SGIX_async_histogram; + continue; + } +#endif +#ifdef GL_SGIX_async_pixel + if (_glewStrSame3(&pos, &len, (const GLubyte*)"async_pixel", 11)) + { + ret = GLEW_SGIX_async_pixel; + continue; + } +#endif +#ifdef GL_SGIX_blend_alpha_minmax + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_alpha_minmax", 18)) + { + ret = GLEW_SGIX_blend_alpha_minmax; + continue; + } +#endif +#ifdef GL_SGIX_clipmap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"clipmap", 7)) + { + ret = GLEW_SGIX_clipmap; + continue; + } +#endif +#ifdef GL_SGIX_convolution_accuracy + if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution_accuracy", 20)) + { + ret = GLEW_SGIX_convolution_accuracy; + continue; + } +#endif +#ifdef GL_SGIX_depth_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_texture", 13)) + { + ret = GLEW_SGIX_depth_texture; + continue; + } +#endif +#ifdef GL_SGIX_flush_raster + if (_glewStrSame3(&pos, &len, (const GLubyte*)"flush_raster", 12)) + { + ret = GLEW_SGIX_flush_raster; + continue; + } +#endif +#ifdef GL_SGIX_fog_offset + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_offset", 10)) + { + ret = GLEW_SGIX_fog_offset; + continue; + } +#endif +#ifdef GL_SGIX_fog_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_texture", 11)) + { + ret = GLEW_SGIX_fog_texture; + continue; + } +#endif +#ifdef GL_SGIX_fragment_specular_lighting + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_specular_lighting", 26)) + { + ret = GLEW_SGIX_fragment_specular_lighting; + continue; + } +#endif +#ifdef GL_SGIX_framezoom + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framezoom", 9)) + { + ret = GLEW_SGIX_framezoom; + continue; + } +#endif +#ifdef GL_SGIX_interlace + if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace", 9)) + { + ret = GLEW_SGIX_interlace; + continue; + } +#endif +#ifdef GL_SGIX_ir_instrument1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ir_instrument1", 14)) + { + ret = GLEW_SGIX_ir_instrument1; + continue; + } +#endif +#ifdef GL_SGIX_list_priority + if (_glewStrSame3(&pos, &len, (const GLubyte*)"list_priority", 13)) + { + ret = GLEW_SGIX_list_priority; + continue; + } +#endif +#ifdef GL_SGIX_pixel_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture", 13)) + { + ret = GLEW_SGIX_pixel_texture; + continue; + } +#endif +#ifdef GL_SGIX_pixel_texture_bits + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture_bits", 18)) + { + ret = GLEW_SGIX_pixel_texture_bits; + continue; + } +#endif +#ifdef GL_SGIX_reference_plane + if (_glewStrSame3(&pos, &len, (const GLubyte*)"reference_plane", 15)) + { + ret = GLEW_SGIX_reference_plane; + continue; + } +#endif +#ifdef GL_SGIX_resample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"resample", 8)) + { + ret = GLEW_SGIX_resample; + continue; + } +#endif +#ifdef GL_SGIX_shadow + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow", 6)) + { + ret = GLEW_SGIX_shadow; + continue; + } +#endif +#ifdef GL_SGIX_shadow_ambient + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_ambient", 14)) + { + ret = GLEW_SGIX_shadow_ambient; + continue; + } +#endif +#ifdef GL_SGIX_sprite + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sprite", 6)) + { + ret = GLEW_SGIX_sprite; + continue; + } +#endif +#ifdef GL_SGIX_tag_sample_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"tag_sample_buffer", 17)) + { + ret = GLEW_SGIX_tag_sample_buffer; + continue; + } +#endif +#ifdef GL_SGIX_texture_add_env + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_add_env", 15)) + { + ret = GLEW_SGIX_texture_add_env; + continue; + } +#endif +#ifdef GL_SGIX_texture_coordinate_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_coordinate_clamp", 24)) + { + ret = GLEW_SGIX_texture_coordinate_clamp; + continue; + } +#endif +#ifdef GL_SGIX_texture_lod_bias + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod_bias", 16)) + { + ret = GLEW_SGIX_texture_lod_bias; + continue; + } +#endif +#ifdef GL_SGIX_texture_multi_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multi_buffer", 20)) + { + ret = GLEW_SGIX_texture_multi_buffer; + continue; + } +#endif +#ifdef GL_SGIX_texture_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_range", 13)) + { + ret = GLEW_SGIX_texture_range; + continue; + } +#endif +#ifdef GL_SGIX_texture_scale_bias + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_scale_bias", 18)) + { + ret = GLEW_SGIX_texture_scale_bias; + continue; + } +#endif +#ifdef GL_SGIX_vertex_preclip + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_preclip", 14)) + { + ret = GLEW_SGIX_vertex_preclip; + continue; + } +#endif +#ifdef GL_SGIX_vertex_preclip_hint + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_preclip_hint", 19)) + { + ret = GLEW_SGIX_vertex_preclip_hint; + continue; + } +#endif +#ifdef GL_SGIX_ycrcb + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycrcb", 5)) + { + ret = GLEW_SGIX_ycrcb; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGI_", 4)) + { +#ifdef GL_SGI_color_matrix + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_matrix", 12)) + { + ret = GLEW_SGI_color_matrix; + continue; + } +#endif +#ifdef GL_SGI_color_table + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_table", 11)) + { + ret = GLEW_SGI_color_table; + continue; + } +#endif +#ifdef GL_SGI_texture_color_table + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_color_table", 19)) + { + ret = GLEW_SGI_texture_color_table; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUNX_", 5)) + { +#ifdef GL_SUNX_constant_data + if (_glewStrSame3(&pos, &len, (const GLubyte*)"constant_data", 13)) + { + ret = GLEW_SUNX_constant_data; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUN_", 4)) + { +#ifdef GL_SUN_convolution_border_modes + if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution_border_modes", 24)) + { + ret = GLEW_SUN_convolution_border_modes; + continue; + } +#endif +#ifdef GL_SUN_global_alpha + if (_glewStrSame3(&pos, &len, (const GLubyte*)"global_alpha", 12)) + { + ret = GLEW_SUN_global_alpha; + continue; + } +#endif +#ifdef GL_SUN_mesh_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"mesh_array", 10)) + { + ret = GLEW_SUN_mesh_array; + continue; + } +#endif +#ifdef GL_SUN_read_video_pixels + if (_glewStrSame3(&pos, &len, (const GLubyte*)"read_video_pixels", 17)) + { + ret = GLEW_SUN_read_video_pixels; + continue; + } +#endif +#ifdef GL_SUN_slice_accum + if (_glewStrSame3(&pos, &len, (const GLubyte*)"slice_accum", 11)) + { + ret = GLEW_SUN_slice_accum; + continue; + } +#endif +#ifdef GL_SUN_triangle_list + if (_glewStrSame3(&pos, &len, (const GLubyte*)"triangle_list", 13)) + { + ret = GLEW_SUN_triangle_list; + continue; + } +#endif +#ifdef GL_SUN_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex", 6)) + { + ret = GLEW_SUN_vertex; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"WIN_", 4)) + { +#ifdef GL_WIN_phong_shading + if (_glewStrSame3(&pos, &len, (const GLubyte*)"phong_shading", 13)) + { + ret = GLEW_WIN_phong_shading; + continue; + } +#endif +#ifdef GL_WIN_specular_fog + if (_glewStrSame3(&pos, &len, (const GLubyte*)"specular_fog", 12)) + { + ret = GLEW_WIN_specular_fog; + continue; + } +#endif +#ifdef GL_WIN_swap_hint + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_hint", 9)) + { + ret = GLEW_WIN_swap_hint; + continue; + } +#endif + } + } + ret = (len == 0); + } + return ret; +} + +#if defined(_WIN32) + +#if defined(GLEW_MX) +GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext* ctx, const char* name) +#else +GLboolean GLEWAPIENTRY wglewIsSupported (const char* name) +#endif +{ + const GLubyte* pos = (const GLubyte*)name; + GLuint len = _glewStrLen(pos); + GLboolean ret = GL_TRUE; + while (ret && len > 0) + { + if (_glewStrSame1(&pos, &len, (const GLubyte*)"WGL_", 4)) + { + if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5)) + { +#ifdef WGL_3DFX_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = WGLEW_3DFX_multisample; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DL_", 4)) + { +#ifdef WGL_3DL_stereo_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stereo_control", 14)) + { + ret = WGLEW_3DL_stereo_control; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"AMD_", 4)) + { +#ifdef WGL_AMD_gpu_association + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_association", 15)) + { + ret = WGLEW_AMD_gpu_association; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4)) + { +#ifdef WGL_ARB_buffer_region + if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_region", 13)) + { + ret = WGLEW_ARB_buffer_region; + continue; + } +#endif +#ifdef WGL_ARB_context_flush_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"context_flush_control", 21)) + { + ret = WGLEW_ARB_context_flush_control; + continue; + } +#endif +#ifdef WGL_ARB_create_context + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context", 14)) + { + ret = WGLEW_ARB_create_context; + continue; + } +#endif +#ifdef WGL_ARB_create_context_profile + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_profile", 22)) + { + ret = WGLEW_ARB_create_context_profile; + continue; + } +#endif +#ifdef WGL_ARB_create_context_robustness + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_robustness", 25)) + { + ret = WGLEW_ARB_create_context_robustness; + continue; + } +#endif +#ifdef WGL_ARB_extensions_string + if (_glewStrSame3(&pos, &len, (const GLubyte*)"extensions_string", 17)) + { + ret = WGLEW_ARB_extensions_string; + continue; + } +#endif +#ifdef WGL_ARB_framebuffer_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) + { + ret = WGLEW_ARB_framebuffer_sRGB; + continue; + } +#endif +#ifdef WGL_ARB_make_current_read + if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) + { + ret = WGLEW_ARB_make_current_read; + continue; + } +#endif +#ifdef WGL_ARB_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = WGLEW_ARB_multisample; + continue; + } +#endif +#ifdef WGL_ARB_pbuffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) + { + ret = WGLEW_ARB_pbuffer; + continue; + } +#endif +#ifdef WGL_ARB_pixel_format + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format", 12)) + { + ret = WGLEW_ARB_pixel_format; + continue; + } +#endif +#ifdef WGL_ARB_pixel_format_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18)) + { + ret = WGLEW_ARB_pixel_format_float; + continue; + } +#endif +#ifdef WGL_ARB_render_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture", 14)) + { + ret = WGLEW_ARB_render_texture; + continue; + } +#endif +#ifdef WGL_ARB_robustness_application_isolation + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_application_isolation", 32)) + { + ret = WGLEW_ARB_robustness_application_isolation; + continue; + } +#endif +#ifdef WGL_ARB_robustness_share_group_isolation + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_share_group_isolation", 32)) + { + ret = WGLEW_ARB_robustness_share_group_isolation; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4)) + { +#ifdef WGL_ATI_pixel_format_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18)) + { + ret = WGLEW_ATI_pixel_format_float; + continue; + } +#endif +#ifdef WGL_ATI_render_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture_rectangle", 24)) + { + ret = WGLEW_ATI_render_texture_rectangle; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) + { +#ifdef WGL_EXT_create_context_es2_profile + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es2_profile", 26)) + { + ret = WGLEW_EXT_create_context_es2_profile; + continue; + } +#endif +#ifdef WGL_EXT_create_context_es_profile + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es_profile", 25)) + { + ret = WGLEW_EXT_create_context_es_profile; + continue; + } +#endif +#ifdef WGL_EXT_depth_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_float", 11)) + { + ret = WGLEW_EXT_depth_float; + continue; + } +#endif +#ifdef WGL_EXT_display_color_table + if (_glewStrSame3(&pos, &len, (const GLubyte*)"display_color_table", 19)) + { + ret = WGLEW_EXT_display_color_table; + continue; + } +#endif +#ifdef WGL_EXT_extensions_string + if (_glewStrSame3(&pos, &len, (const GLubyte*)"extensions_string", 17)) + { + ret = WGLEW_EXT_extensions_string; + continue; + } +#endif +#ifdef WGL_EXT_framebuffer_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) + { + ret = WGLEW_EXT_framebuffer_sRGB; + continue; + } +#endif +#ifdef WGL_EXT_make_current_read + if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) + { + ret = WGLEW_EXT_make_current_read; + continue; + } +#endif +#ifdef WGL_EXT_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = WGLEW_EXT_multisample; + continue; + } +#endif +#ifdef WGL_EXT_pbuffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) + { + ret = WGLEW_EXT_pbuffer; + continue; + } +#endif +#ifdef WGL_EXT_pixel_format + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format", 12)) + { + ret = WGLEW_EXT_pixel_format; + continue; + } +#endif +#ifdef WGL_EXT_pixel_format_packed_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_packed_float", 25)) + { + ret = WGLEW_EXT_pixel_format_packed_float; + continue; + } +#endif +#ifdef WGL_EXT_swap_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) + { + ret = WGLEW_EXT_swap_control; + continue; + } +#endif +#ifdef WGL_EXT_swap_control_tear + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control_tear", 17)) + { + ret = WGLEW_EXT_swap_control_tear; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"I3D_", 4)) + { +#ifdef WGL_I3D_digital_video_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"digital_video_control", 21)) + { + ret = WGLEW_I3D_digital_video_control; + continue; + } +#endif +#ifdef WGL_I3D_gamma + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gamma", 5)) + { + ret = WGLEW_I3D_gamma; + continue; + } +#endif +#ifdef WGL_I3D_genlock + if (_glewStrSame3(&pos, &len, (const GLubyte*)"genlock", 7)) + { + ret = WGLEW_I3D_genlock; + continue; + } +#endif +#ifdef WGL_I3D_image_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_buffer", 12)) + { + ret = WGLEW_I3D_image_buffer; + continue; + } +#endif +#ifdef WGL_I3D_swap_frame_lock + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_frame_lock", 15)) + { + ret = WGLEW_I3D_swap_frame_lock; + continue; + } +#endif +#ifdef WGL_I3D_swap_frame_usage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_frame_usage", 16)) + { + ret = WGLEW_I3D_swap_frame_usage; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) + { +#ifdef WGL_NV_DX_interop + if (_glewStrSame3(&pos, &len, (const GLubyte*)"DX_interop", 10)) + { + ret = WGLEW_NV_DX_interop; + continue; + } +#endif +#ifdef WGL_NV_DX_interop2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"DX_interop2", 11)) + { + ret = WGLEW_NV_DX_interop2; + continue; + } +#endif +#ifdef WGL_NV_copy_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) + { + ret = WGLEW_NV_copy_image; + continue; + } +#endif +#ifdef WGL_NV_delay_before_swap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"delay_before_swap", 17)) + { + ret = WGLEW_NV_delay_before_swap; + continue; + } +#endif +#ifdef WGL_NV_float_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) + { + ret = WGLEW_NV_float_buffer; + continue; + } +#endif +#ifdef WGL_NV_gpu_affinity + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_affinity", 12)) + { + ret = WGLEW_NV_gpu_affinity; + continue; + } +#endif +#ifdef WGL_NV_multisample_coverage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20)) + { + ret = WGLEW_NV_multisample_coverage; + continue; + } +#endif +#ifdef WGL_NV_present_video + if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13)) + { + ret = WGLEW_NV_present_video; + continue; + } +#endif +#ifdef WGL_NV_render_depth_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_depth_texture", 20)) + { + ret = WGLEW_NV_render_depth_texture; + continue; + } +#endif +#ifdef WGL_NV_render_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture_rectangle", 24)) + { + ret = WGLEW_NV_render_texture_rectangle; + continue; + } +#endif +#ifdef WGL_NV_swap_group + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10)) + { + ret = WGLEW_NV_swap_group; + continue; + } +#endif +#ifdef WGL_NV_vertex_array_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) + { + ret = WGLEW_NV_vertex_array_range; + continue; + } +#endif +#ifdef WGL_NV_video_capture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) + { + ret = WGLEW_NV_video_capture; + continue; + } +#endif +#ifdef WGL_NV_video_output + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_output", 12)) + { + ret = WGLEW_NV_video_output; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) + { +#ifdef WGL_OML_sync_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync_control", 12)) + { + ret = WGLEW_OML_sync_control; + continue; + } +#endif + } + } + ret = (len == 0); + } + return ret; +} + +#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX) + +#if defined(GLEW_MX) +GLboolean glxewContextIsSupported (const GLXEWContext* ctx, const char* name) +#else +GLboolean glxewIsSupported (const char* name) +#endif +{ + const GLubyte* pos = (const GLubyte*)name; + GLuint len = _glewStrLen(pos); + GLboolean ret = GL_TRUE; + while (ret && len > 0) + { + if(_glewStrSame1(&pos, &len, (const GLubyte*)"GLX_", 4)) + { + if (_glewStrSame2(&pos, &len, (const GLubyte*)"VERSION_", 8)) + { +#ifdef GLX_VERSION_1_2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_2", 3)) + { + ret = GLXEW_VERSION_1_2; + continue; + } +#endif +#ifdef GLX_VERSION_1_3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_3", 3)) + { + ret = GLXEW_VERSION_1_3; + continue; + } +#endif +#ifdef GLX_VERSION_1_4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_4", 3)) + { + ret = GLXEW_VERSION_1_4; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5)) + { +#ifdef GLX_3DFX_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = GLXEW_3DFX_multisample; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"AMD_", 4)) + { +#ifdef GLX_AMD_gpu_association + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_association", 15)) + { + ret = GLXEW_AMD_gpu_association; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4)) + { +#ifdef GLX_ARB_context_flush_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"context_flush_control", 21)) + { + ret = GLXEW_ARB_context_flush_control; + continue; + } +#endif +#ifdef GLX_ARB_create_context + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context", 14)) + { + ret = GLXEW_ARB_create_context; + continue; + } +#endif +#ifdef GLX_ARB_create_context_profile + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_profile", 22)) + { + ret = GLXEW_ARB_create_context_profile; + continue; + } +#endif +#ifdef GLX_ARB_create_context_robustness + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_robustness", 25)) + { + ret = GLXEW_ARB_create_context_robustness; + continue; + } +#endif +#ifdef GLX_ARB_fbconfig_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig_float", 14)) + { + ret = GLXEW_ARB_fbconfig_float; + continue; + } +#endif +#ifdef GLX_ARB_framebuffer_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) + { + ret = GLXEW_ARB_framebuffer_sRGB; + continue; + } +#endif +#ifdef GLX_ARB_get_proc_address + if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_proc_address", 16)) + { + ret = GLXEW_ARB_get_proc_address; + continue; + } +#endif +#ifdef GLX_ARB_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = GLXEW_ARB_multisample; + continue; + } +#endif +#ifdef GLX_ARB_robustness_application_isolation + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_application_isolation", 32)) + { + ret = GLXEW_ARB_robustness_application_isolation; + continue; + } +#endif +#ifdef GLX_ARB_robustness_share_group_isolation + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_share_group_isolation", 32)) + { + ret = GLXEW_ARB_robustness_share_group_isolation; + continue; + } +#endif +#ifdef GLX_ARB_vertex_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_object", 20)) + { + ret = GLXEW_ARB_vertex_buffer_object; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4)) + { +#ifdef GLX_ATI_pixel_format_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18)) + { + ret = GLXEW_ATI_pixel_format_float; + continue; + } +#endif +#ifdef GLX_ATI_render_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture", 14)) + { + ret = GLXEW_ATI_render_texture; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) + { +#ifdef GLX_EXT_buffer_age + if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_age", 10)) + { + ret = GLXEW_EXT_buffer_age; + continue; + } +#endif +#ifdef GLX_EXT_create_context_es2_profile + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es2_profile", 26)) + { + ret = GLXEW_EXT_create_context_es2_profile; + continue; + } +#endif +#ifdef GLX_EXT_create_context_es_profile + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es_profile", 25)) + { + ret = GLXEW_EXT_create_context_es_profile; + continue; + } +#endif +#ifdef GLX_EXT_fbconfig_packed_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig_packed_float", 21)) + { + ret = GLXEW_EXT_fbconfig_packed_float; + continue; + } +#endif +#ifdef GLX_EXT_framebuffer_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) + { + ret = GLXEW_EXT_framebuffer_sRGB; + continue; + } +#endif +#ifdef GLX_EXT_import_context + if (_glewStrSame3(&pos, &len, (const GLubyte*)"import_context", 14)) + { + ret = GLXEW_EXT_import_context; + continue; + } +#endif +#ifdef GLX_EXT_scene_marker + if (_glewStrSame3(&pos, &len, (const GLubyte*)"scene_marker", 12)) + { + ret = GLXEW_EXT_scene_marker; + continue; + } +#endif +#ifdef GLX_EXT_stereo_tree + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stereo_tree", 11)) + { + ret = GLXEW_EXT_stereo_tree; + continue; + } +#endif +#ifdef GLX_EXT_swap_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) + { + ret = GLXEW_EXT_swap_control; + continue; + } +#endif +#ifdef GLX_EXT_swap_control_tear + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control_tear", 17)) + { + ret = GLXEW_EXT_swap_control_tear; + continue; + } +#endif +#ifdef GLX_EXT_texture_from_pixmap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_from_pixmap", 19)) + { + ret = GLXEW_EXT_texture_from_pixmap; + continue; + } +#endif +#ifdef GLX_EXT_visual_info + if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_info", 11)) + { + ret = GLXEW_EXT_visual_info; + continue; + } +#endif +#ifdef GLX_EXT_visual_rating + if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_rating", 13)) + { + ret = GLXEW_EXT_visual_rating; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"INTEL_", 6)) + { +#ifdef GLX_INTEL_swap_event + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_event", 10)) + { + ret = GLXEW_INTEL_swap_event; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESA_", 5)) + { +#ifdef GLX_MESA_agp_offset + if (_glewStrSame3(&pos, &len, (const GLubyte*)"agp_offset", 10)) + { + ret = GLXEW_MESA_agp_offset; + continue; + } +#endif +#ifdef GLX_MESA_copy_sub_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_sub_buffer", 15)) + { + ret = GLXEW_MESA_copy_sub_buffer; + continue; + } +#endif +#ifdef GLX_MESA_pixmap_colormap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixmap_colormap", 15)) + { + ret = GLXEW_MESA_pixmap_colormap; + continue; + } +#endif +#ifdef GLX_MESA_query_renderer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"query_renderer", 14)) + { + ret = GLXEW_MESA_query_renderer; + continue; + } +#endif +#ifdef GLX_MESA_release_buffers + if (_glewStrSame3(&pos, &len, (const GLubyte*)"release_buffers", 15)) + { + ret = GLXEW_MESA_release_buffers; + continue; + } +#endif +#ifdef GLX_MESA_set_3dfx_mode + if (_glewStrSame3(&pos, &len, (const GLubyte*)"set_3dfx_mode", 13)) + { + ret = GLXEW_MESA_set_3dfx_mode; + continue; + } +#endif +#ifdef GLX_MESA_swap_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) + { + ret = GLXEW_MESA_swap_control; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) + { +#ifdef GLX_NV_copy_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_buffer", 11)) + { + ret = GLXEW_NV_copy_buffer; + continue; + } +#endif +#ifdef GLX_NV_copy_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) + { + ret = GLXEW_NV_copy_image; + continue; + } +#endif +#ifdef GLX_NV_delay_before_swap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"delay_before_swap", 17)) + { + ret = GLXEW_NV_delay_before_swap; + continue; + } +#endif +#ifdef GLX_NV_float_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) + { + ret = GLXEW_NV_float_buffer; + continue; + } +#endif +#ifdef GLX_NV_multisample_coverage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20)) + { + ret = GLXEW_NV_multisample_coverage; + continue; + } +#endif +#ifdef GLX_NV_present_video + if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13)) + { + ret = GLXEW_NV_present_video; + continue; + } +#endif +#ifdef GLX_NV_swap_group + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10)) + { + ret = GLXEW_NV_swap_group; + continue; + } +#endif +#ifdef GLX_NV_vertex_array_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) + { + ret = GLXEW_NV_vertex_array_range; + continue; + } +#endif +#ifdef GLX_NV_video_capture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) + { + ret = GLXEW_NV_video_capture; + continue; + } +#endif +#ifdef GLX_NV_video_out + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_out", 9)) + { + ret = GLXEW_NV_video_out; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) + { +#ifdef GLX_OML_swap_method + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_method", 11)) + { + ret = GLXEW_OML_swap_method; + continue; + } +#endif +#ifdef GLX_OML_sync_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync_control", 12)) + { + ret = GLXEW_OML_sync_control; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIS_", 5)) + { +#ifdef GLX_SGIS_blended_overlay + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blended_overlay", 15)) + { + ret = GLXEW_SGIS_blended_overlay; + continue; + } +#endif +#ifdef GLX_SGIS_color_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_range", 11)) + { + ret = GLXEW_SGIS_color_range; + continue; + } +#endif +#ifdef GLX_SGIS_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = GLXEW_SGIS_multisample; + continue; + } +#endif +#ifdef GLX_SGIS_shared_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shared_multisample", 18)) + { + ret = GLXEW_SGIS_shared_multisample; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIX_", 5)) + { +#ifdef GLX_SGIX_fbconfig + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig", 8)) + { + ret = GLXEW_SGIX_fbconfig; + continue; + } +#endif +#ifdef GLX_SGIX_hyperpipe + if (_glewStrSame3(&pos, &len, (const GLubyte*)"hyperpipe", 9)) + { + ret = GLXEW_SGIX_hyperpipe; + continue; + } +#endif +#ifdef GLX_SGIX_pbuffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) + { + ret = GLXEW_SGIX_pbuffer; + continue; + } +#endif +#ifdef GLX_SGIX_swap_barrier + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_barrier", 12)) + { + ret = GLXEW_SGIX_swap_barrier; + continue; + } +#endif +#ifdef GLX_SGIX_swap_group + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10)) + { + ret = GLXEW_SGIX_swap_group; + continue; + } +#endif +#ifdef GLX_SGIX_video_resize + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_resize", 12)) + { + ret = GLXEW_SGIX_video_resize; + continue; + } +#endif +#ifdef GLX_SGIX_visual_select_group + if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_select_group", 19)) + { + ret = GLXEW_SGIX_visual_select_group; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGI_", 4)) + { +#ifdef GLX_SGI_cushion + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cushion", 7)) + { + ret = GLXEW_SGI_cushion; + continue; + } +#endif +#ifdef GLX_SGI_make_current_read + if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) + { + ret = GLXEW_SGI_make_current_read; + continue; + } +#endif +#ifdef GLX_SGI_swap_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) + { + ret = GLXEW_SGI_swap_control; + continue; + } +#endif +#ifdef GLX_SGI_video_sync + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_sync", 10)) + { + ret = GLXEW_SGI_video_sync; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUN_", 4)) + { +#ifdef GLX_SUN_get_transparent_index + if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_transparent_index", 21)) + { + ret = GLXEW_SUN_get_transparent_index; + continue; + } +#endif +#ifdef GLX_SUN_video_resize + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_resize", 12)) + { + ret = GLXEW_SUN_video_resize; + continue; + } +#endif + } + } + ret = (len == 0); + } + return ret; +} + +#endif /* _WIN32 */ diff --git a/engine/third_party/physx/snippets/media/vehicledata/Base.json b/engine/third_party/physx/snippets/media/vehicledata/Base.json new file mode 100644 index 00000000..606c92a3 --- /dev/null +++ b/engine/third_party/physx/snippets/media/vehicledata/Base.json @@ -0,0 +1,544 @@ +{ + "AxleDescription": [ + { + "WheelIds": [ + 0, + 1 + ] + }, + { + "WheelIds": [ + 2, + 3 + ] + } + ], + "Frame": { + "LngAxis": 4, + "LatAxis": 0, + "VrtAxis": 2 + }, + "Scale": { + "Scale": 1.0 + }, + "RigidBodyParams": { + "Mass": 2014.4000244140625, + "MOI": [ + 3200.0, + 3414.0, + 750.0 + ] + }, + "BrakeCommandResponseParams": { + "MaxResponse": 1875.0, + "WheelResponseMultipliers": [ + 1.0, + 1.0, + 1.0, + 1.0 + ] + }, + "HandbrakeCommandResponseParams": { + "MaxResponse": 0.0, + "WheelResponseMultipliers": [ + 0.0, + 0.0, + 1.0, + 1.0 + ] + }, + "SteerCommandResponseParams": { + "MaxResponse": 0.5235990285873413, + "WheelResponseMultipliers": [ + 1.0, + 1.0, + 0.0, + 0.0 + ] + }, + "AckermannParams": { + "WheelIds": [ + 0, + 1 + ], + "WheelBase": 2.863219976425171, + "TrackWidth": 1.5510799884796143, + "Strength": 1.0 + }, + "SuspensionParams": [ + { + "WheelId": 0, + "SuspensionAttachment": { + "Pos": [ + -0.7952629923820496, + -0.10795199871063233, + 1.269219994544983 + ], + "Quat": [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + }, + "SuspensionTravelDir": [ + 0.0, + -1.0, + 0.0 + ], + "SuspensionTravelDist": 0.221110999584198, + "WheelAttachment": { + "Pos": [ + 0.0, + 0.0, + 0.0 + ], + "Quat": [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + } + }, + { + "WheelId": 1, + "SuspensionAttachment": { + "Pos": [ + 0.7952629923820496, + -0.10795000195503235, + 1.269219994544983 + ], + "Quat": [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + }, + "SuspensionTravelDir": [ + 0.0, + -1.0, + 0.0 + ], + "SuspensionTravelDist": 0.221110999584198, + "WheelAttachment": { + "Pos": [ + 0.0, + 0.0, + 0.0 + ], + "Quat": [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + } + }, + { + "WheelId": 2, + "SuspensionAttachment": { + "Pos": [ + -0.7952629923820496, + -0.10795199871063233, + -1.593999981880188 + ], + "Quat": [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + }, + "SuspensionTravelDir": [ + 0.0, + -1.0, + 0.0 + ], + "SuspensionTravelDist": 0.221110999584198, + "WheelAttachment": { + "Pos": [ + 0.0, + 0.0, + 0.0 + ], + "Quat": [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + } + }, + { + "WheelId": 3, + "SuspensionAttachment": { + "Pos": [ + 0.7952629923820496, + -0.10795299708843231, + -1.593999981880188 + ], + "Quat": [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + }, + "SuspensionTravelDir": [ + 0.0, + -1.0, + 0.0 + ], + "SuspensionTravelDist": 0.221110999584198, + "WheelAttachment": { + "Pos": [ + 0.0, + 0.0, + 0.0 + ], + "Quat": [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + } + } + ], + "SuspensionStateCalculationParams": { + "JounceCalculationType": 1, + "LimitSuspensionExpansionVelocity": false + }, + "SuspensionComplianceParams": [ + { + "WheelId": 0, + "WheelToeAngle": [ + [ + 0.0, + 0.0 + ] + ], + "WheelCamberAngle": [ + [ + 0.0, + 0.0 + ] + ], + "SuspForceAppPoint": [ + [ + 0.0, + 0.0, 0.0, -0.11204999685287476 + ] + ], + "TireForceAppPoint": [ + [ + 0.0, + 0.0, 0.0, -0.11204999685287476 + ] + ] + }, + { + "WheelId": 1, + "WheelToeAngle": [ + [ + 0.0, + 0.0 + ] + ], + "WheelCamberAngle": [ + [ + 0.0, + 0.0 + ] + ], + "SuspForceAppPoint": [ + [ + 0.0, + 0.0, 0.0, -0.11204999685287476 + ] + ], + "TireForceAppPoint": [ + [ + 0.0, + 0.0, 0.0, -0.11204999685287476 + ] + ] + }, + { + "WheelId": 2, + "WheelToeAngle": [ + [ + 0.0, + 0.0 + ] + ], + "WheelCamberAngle": [ + [ + 0.0, + 0.0 + ] + ], + "SuspForceAppPoint": [ + [ + 0.0, + 0.0, 0.0, -0.11204999685287476 + ] + ], + "TireForceAppPoint": [ + [ + 0.0, + 0.0, 0.0, -0.11204999685287476 + ] + ] + }, + { + "WheelId": 3, + "WheelToeAngle": [ + [ + 0.0, + 0.0 + ] + ], + "WheelCamberAngle": [ + [ + 0.0, + 0.0 + ] + ], + "SuspForceAppPoint": [ + [ + 0.0, + 0.0, 0.0, -0.11204999685287476 + ] + ], + "TireForceAppPoint": [ + [ + 0.0, + 0.0, 0.0, -0.11204999685287476 + ] + ] + } + ], + "SuspensionForceParams": [ + { + "WheelId": 0, + "Damping": 8528.1201171875, + "Stiffness": 32833.30078125, + "SprungMass": 553.7739868164063 + }, + { + "WheelId": 1, + "Damping": 8742.1904296875, + "Stiffness": 33657.3984375, + "SprungMass": 567.6749877929688 + }, + { + "WheelId": 2, + "Damping": 6765.97021484375, + "Stiffness": 26049.0, + "SprungMass": 439.3489990234375 + }, + { + "WheelId": 3, + "Damping": 6985.47998046875, + "Stiffness": 26894.099609375, + "SprungMass": 453.6029968261719 + } + ], + "SuspensionForceLegacyParams": [ + { + "WheelId": 0, + "Damping": 8528.1201171875, + "Stiffness": 32833.30078125, + "RestDistance": 0.10000000149011612, + "SprungMass": 553.7739868164063 + }, + { + "WheelId": 1, + "Damping": 8742.1904296875, + "Stiffness": 33657.3984375, + "RestDistance": 0.10000000149011612, + "SprungMass": 567.6749877929688 + }, + { + "WheelId": 2, + "Damping": 6765.97021484375, + "Stiffness": 26049.0, + "RestDistance": 0.10000000149011612, + "SprungMass": 439.3489990234375 + }, + { + "WheelId": 3, + "Damping": 6985.47998046875, + "Stiffness": 26894.099609375, + "RestDistance": 0.10000000149011612, + "SprungMass": 453.6029968261719 + } + ], + "TireForceParams": [ + { + "WheelId": 0, + "LongitudinalStiffness": 24525.0, + "LateralStiffnessX": 0.009999999776482582, + "LateralStiffnessY": 118699.637252138, + "CamberStiffness": 0.0, + "RestLoad": 5628.72314453125, + "FrictionVsSlip": [ + [ + 0.0, + 1.0 + ], + [ + 0.10000000149011612, + 1.0 + ], + [ + 1.0, + 1.0 + ] + ], + "TireLoadFilter": [ + [ + 0.0, + 0.23080000281333924 + ], + [ + 3.0, + 3.0 + ] + ] + }, + { + "WheelId": 1, + "LongitudinalStiffness": 24525.0, + "LateralStiffnessX": 0.009999999776482582, + "LateralStiffnessY": 118699.637252138, + "CamberStiffness": 0.0, + "RestLoad": 5628.72314453125, + "FrictionVsSlip": [ + [ + 0.0, + 1.0 + ], + [ + 0.10000000149011612, + 1.0 + ], + [ + 1.0, + 1.0 + ] + ], + "TireLoadFilter": [ + [ + 0.0, + 0.23080000281333924 + ], + [ + 3.0, + 3.0 + ] + ] + }, + { + "WheelId": 2, + "LongitudinalStiffness": 24525.0, + "LateralStiffnessX": 0.009999999776482582, + "LateralStiffnessY": 143930.84033118, + "CamberStiffness": 0.0, + "RestLoad": 4604.3134765625, + "FrictionVsSlip": [ + [ + 0.0, + 1.0 + ], + [ + 0.10000000149011612, + 1.0 + ], + [ + 1.0, + 1.0 + ] + ], + "TireLoadFilter": [ + [ + 0.0, + 0.23080000281333924 + ], + [ + 3.0, + 3.0 + ] + ] + }, + { + "WheelId": 3, + "LongitudinalStiffness": 24525.0, + "LateralStiffnessX": 0.009999999776482582, + "LateralStiffnessY": 143930.84033118, + "CamberStiffness": 0.0, + "RestLoad": 4604.3134765625, + "FrictionVsSlip": [ + [ + 0.0, + 1.0 + ], + [ + 0.10000000149011612, + 1.0 + ], + [ + 1.0, + 1.0 + ] + ], + "TireLoadFilter": [ + [ + 0.0, + 0.23080000281333924 + ], + [ + 3.0, + 3.0 + ] + ] + } + ], + "WheelParams": [ + { + "WheelId": 0, + "HalfWidth": 0.15768450498580934, + "Radius": 0.3432520031929016, + "Mass": 20.0, + "MOI": 1.1716899871826172, + "DampingRate": 0.25 + }, + { + "WheelId": 1, + "HalfWidth": 0.15768450498580934, + "Radius": 0.3432520031929016, + "Mass": 20.0, + "MOI": 1.1716899871826172, + "DampingRate": 0.25 + }, + { + "WheelId": 2, + "HalfWidth": 0.15768450498580934, + "Radius": 0.3432520031929016, + "Mass": 20.0, + "MOI": 1.1716899871826172, + "DampingRate": 0.25 + }, + { + "WheelId": 3, + "HalfWidth": 0.15768450498580934, + "Radius": 0.3432520031929016, + "Mass": 20.0, + "MOI": 1.1716899871826172, + "DampingRate": 0.25 + } + ] +} diff --git a/engine/third_party/physx/snippets/media/vehicledata/DirectDrive.json b/engine/third_party/physx/snippets/media/vehicledata/DirectDrive.json new file mode 100644 index 00000000..c9586d07 --- /dev/null +++ b/engine/third_party/physx/snippets/media/vehicledata/DirectDrive.json @@ -0,0 +1,14 @@ +{ + "ThrottleCommandResponseParams": + { + "MaxResponse": 750.0, + "WheelResponseMultipliers": [1.0, 1.0, 1.0, 1.0], + "NonLinearResponse": [ + {"Throttle": 0.00, "ResponseCurve": [[0.0,0.00], [20.0, 0.00], [60.0, 0.0]]}, + {"Throttle": 0.25, "ResponseCurve": [[0.0,0.25], [20.0, 0.25], [60.0, 0.0]]}, + {"Throttle": 0.50, "ResponseCurve": [[0.0,0.50], [20.0, 0.50], [60.0, 0.0]]}, + {"Throttle": 0.75, "ResponseCurve": [[0.0,0.75], [20.0, 0.75], [60.0, 0.0]]}, + {"Throttle": 1.00, "ResponseCurve": [[1.0,1.00], [20.0, 1.00], [60.0, 0.0]]} + ] + } +} diff --git a/engine/third_party/physx/snippets/media/vehicledata/EngineDrive.json b/engine/third_party/physx/snippets/media/vehicledata/EngineDrive.json new file mode 100644 index 00000000..13327278 --- /dev/null +++ b/engine/third_party/physx/snippets/media/vehicledata/EngineDrive.json @@ -0,0 +1,62 @@ +{ + "AutoboxParams": + { + "UpRatios": [0.65, 0.15, 0.65, 0.65, 0.65, 0.65, 0.65], + "DownRatios":[0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5], + "Latency": 2.0 + }, + "ClutchCommandResponseParams": + { + "MaxResponse": 10.0 + }, + "EngineParams": + { + "TorqueCurve": [[0.0, 1.0], [0.33, 1.0], [1.0, 1.0]], + "MOI": 1.0, + "PeakTorque": 500.0, + "IdleOmega": 0.0, + "MaxOmega": 600.0, + "DampingRateFullThrottle": 0.15, + "DampingRateZeroThrottleClutchEngaged": 2.0, + "DampingRateZeroThrottleClutchDisengaged": 0.35 + }, + "GearboxParams": + { + "NeutralGear": 1, + "Ratios": [-4.0, 0.0, 4.0, 2.0, 1.5, 1.1, 1.0], + "FinalRatio": 4.0, + "SwitchTime": 0.5 + }, + "MultiWheelDifferentialParams": + { + "TorqueRatios": [0.25, 0.25, 0.25, 0.25], + "AveWheelSpeedRatios": [0.25, 0.25, 0.25, 0.25] + }, + "FourWheelDifferentialParams": + { + "TorqueRatios": [0.25, 0.25, 0.25, 0.25], + "AveWheelSpeedRatios": [0.25, 0.25, 0.25, 0.25], + "FrontWheelIds": [0, 1], + "RearWheelIds": [2, 3], + "CenterBias": 1.3, + "CenterTarget": 1.29, + "FrontBias": 1.3, + "FrontTarget": 1.29, + "RearBias": 1.3, + "RearTarget": 1.29, + "Rate": 10.0 + }, + "TankDifferentialParams": + { + "TorqueRatios": [0.25, 0.25, 0.25, 0.25], + "AveWheelSpeedRatios": [0.25, 0.25, 0.25, 0.25], + "TankTracks": [[0,2],[1,3]] + }, + "ClutchParams": + { + "AccuracyMode": 1, + "EstimateIterations": 5 + } +} + + diff --git a/engine/third_party/physx/snippets/snippetarticulationrc/SnippetArticulation.cpp b/engine/third_party/physx/snippets/snippetarticulationrc/SnippetArticulation.cpp new file mode 100644 index 00000000..985d20f9 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetarticulationrc/SnippetArticulation.cpp @@ -0,0 +1,433 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +// **************************************************************************** +// This snippet demonstrates the use of Reduced Coordinates articulations. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +static PxArticulationReducedCoordinate* gArticulation = NULL; +static PxArticulationJointReducedCoordinate* gDriveJoint = NULL; + +static PxFilterFlags scissorFilter( PxFilterObjectAttributes attributes0, PxFilterData filterData0, + PxFilterObjectAttributes attributes1, PxFilterData filterData1, + PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize) +{ + PX_UNUSED(attributes0); + PX_UNUSED(attributes1); + PX_UNUSED(constantBlock); + PX_UNUSED(constantBlockSize); + if (filterData0.word2 != 0 && filterData0.word2 == filterData1.word2) + return PxFilterFlag::eKILL; + pairFlags |= PxPairFlag::eCONTACT_DEFAULT; + return PxFilterFlag::eDEFAULT; +} + +static void createScissorLift() +{ + const PxReal runnerLength = 2.f; + const PxReal placementDistance = 1.8f; + + const PxReal cosAng = (placementDistance) / (runnerLength); + + const PxReal angle = PxAcos(cosAng); + + const PxReal sinAng = PxSin(angle); + + const PxQuat leftRot(-angle, PxVec3(1.f, 0.f, 0.f)); + const PxQuat rightRot(angle, PxVec3(1.f, 0.f, 0.f)); + + //(1) Create base... + PxArticulationLink* base = gArticulation->createLink(NULL, PxTransform(PxVec3(0.f, 0.25f, 0.f))); + PxRigidActorExt::createExclusiveShape(*base, PxBoxGeometry(0.5f, 0.25f, 1.5f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*base, 3.f); + + //Now create the slider and fixed joints... + + gArticulation->setSolverIterationCounts(32); + + PxArticulationLink* leftRoot = gArticulation->createLink(base, PxTransform(PxVec3(0.f, 0.55f, -0.9f))); + PxRigidActorExt::createExclusiveShape(*leftRoot, PxBoxGeometry(0.5f, 0.05f, 0.05f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*leftRoot, 1.f); + + PxArticulationLink* rightRoot = gArticulation->createLink(base, PxTransform(PxVec3(0.f, 0.55f, 0.9f))); + PxRigidActorExt::createExclusiveShape(*rightRoot, PxBoxGeometry(0.5f, 0.05f, 0.05f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*rightRoot, 1.f); + + PxArticulationJointReducedCoordinate* joint = leftRoot->getInboundJoint(); + joint->setJointType(PxArticulationJointType::eFIX); + joint->setParentPose(PxTransform(PxVec3(0.f, 0.25f, -0.9f))); + joint->setChildPose(PxTransform(PxVec3(0.f, -0.05f, 0.f))); + + //Set up the drive joint... + gDriveJoint = rightRoot->getInboundJoint(); + gDriveJoint->setJointType(PxArticulationJointType::ePRISMATIC); + gDriveJoint->setMotion(PxArticulationAxis::eZ, PxArticulationMotion::eLIMITED); + gDriveJoint->setLimitParams(PxArticulationAxis::eZ, PxArticulationLimit(-1.4f, 0.2f)); + gDriveJoint->setDriveParams(PxArticulationAxis::eZ, PxArticulationDrive(100000.f, 0.f, PX_MAX_F32)); + + gDriveJoint->setParentPose(PxTransform(PxVec3(0.f, 0.25f, 0.9f))); + gDriveJoint->setChildPose(PxTransform(PxVec3(0.f, -0.05f, 0.f))); + + + const PxU32 linkHeight = 3; + PxArticulationLink* currLeft = leftRoot, *currRight = rightRoot; + + PxQuat rightParentRot(PxIdentity); + PxQuat leftParentRot(PxIdentity); + for (PxU32 i = 0; i < linkHeight; ++i) + { + const PxVec3 pos(0.5f, 0.55f + 0.1f*(1 + i), 0.f); + PxArticulationLink* leftLink = gArticulation->createLink(currLeft, PxTransform(pos + PxVec3(0.f, sinAng*(2 * i + 1), 0.f), leftRot)); + PxRigidActorExt::createExclusiveShape(*leftLink, PxBoxGeometry(0.05f, 0.05f, 1.f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*leftLink, 1.f); + + const PxVec3 leftAnchorLocation = pos + PxVec3(0.f, sinAng*(2 * i), -0.9f); + + joint = leftLink->getInboundJoint(); + joint->setParentPose(PxTransform(currLeft->getGlobalPose().transformInv(leftAnchorLocation), leftParentRot)); + joint->setChildPose(PxTransform(PxVec3(0.f, 0.f, -1.f), rightRot)); + joint->setJointType(PxArticulationJointType::eREVOLUTE); + + leftParentRot = leftRot; + + joint->setMotion(PxArticulationAxis::eTWIST, PxArticulationMotion::eLIMITED); + joint->setLimitParams(PxArticulationAxis::eTWIST, PxArticulationLimit(-PxPi, angle)); + + + PxArticulationLink* rightLink = gArticulation->createLink(currRight, PxTransform(pos + PxVec3(0.f, sinAng*(2 * i + 1), 0.f), rightRot)); + PxRigidActorExt::createExclusiveShape(*rightLink, PxBoxGeometry(0.05f, 0.05f, 1.f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*rightLink, 1.f); + + const PxVec3 rightAnchorLocation = pos + PxVec3(0.f, sinAng*(2 * i), 0.9f); + + joint = rightLink->getInboundJoint(); + joint->setJointType(PxArticulationJointType::eREVOLUTE); + joint->setParentPose(PxTransform(currRight->getGlobalPose().transformInv(rightAnchorLocation), rightParentRot)); + joint->setChildPose(PxTransform(PxVec3(0.f, 0.f, 1.f), leftRot)); + joint->setMotion(PxArticulationAxis::eTWIST, PxArticulationMotion::eLIMITED); + joint->setLimitParams(PxArticulationAxis::eTWIST, PxArticulationLimit(-angle, PxPi)); + + rightParentRot = rightRot; + + PxD6Joint* d6joint = PxD6JointCreate(*gPhysics, leftLink, PxTransform(PxIdentity), rightLink, PxTransform(PxIdentity)); + + d6joint->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + d6joint->setMotion(PxD6Axis::eSWING1, PxD6Motion::eFREE); + d6joint->setMotion(PxD6Axis::eSWING2, PxD6Motion::eFREE); + + currLeft = rightLink; + currRight = leftLink; + } + + + PxArticulationLink* leftTop = gArticulation->createLink(currLeft, currLeft->getGlobalPose().transform(PxTransform(PxVec3(-0.5f, 0.f, -1.0f), leftParentRot))); + PxRigidActorExt::createExclusiveShape(*leftTop, PxBoxGeometry(0.5f, 0.05f, 0.05f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*leftTop, 1.f); + + PxArticulationLink* rightTop = gArticulation->createLink(currRight, currRight->getGlobalPose().transform(PxTransform(PxVec3(-0.5f, 0.f, 1.0f), rightParentRot))); + PxRigidActorExt::createExclusiveShape(*rightTop, PxCapsuleGeometry(0.05f, 0.8f), *gMaterial); + //PxRigidActorExt::createExclusiveShape(*rightTop, PxBoxGeometry(0.5f, 0.05f, 0.05f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*rightTop, 1.f); + + joint = leftTop->getInboundJoint(); + joint->setParentPose(PxTransform(PxVec3(0.f, 0.f, -1.f), currLeft->getGlobalPose().q.getConjugate())); + joint->setChildPose(PxTransform(PxVec3(0.5f, 0.f, 0.f), leftTop->getGlobalPose().q.getConjugate())); + joint->setJointType(PxArticulationJointType::eREVOLUTE); + joint->setMotion(PxArticulationAxis::eTWIST, PxArticulationMotion::eFREE); + + joint = rightTop->getInboundJoint(); + joint->setParentPose(PxTransform(PxVec3(0.f, 0.f, 1.f), currRight->getGlobalPose().q.getConjugate())); + joint->setChildPose(PxTransform(PxVec3(0.5f, 0.f, 0.f), rightTop->getGlobalPose().q.getConjugate())); + joint->setJointType(PxArticulationJointType::eREVOLUTE); + joint->setMotion(PxArticulationAxis::eTWIST, PxArticulationMotion::eFREE); + + + currLeft = leftRoot; + currRight = rightRoot; + + rightParentRot = PxQuat(PxIdentity); + leftParentRot = PxQuat(PxIdentity); + + for (PxU32 i = 0; i < linkHeight; ++i) + { + const PxVec3 pos(-0.5f, 0.55f + 0.1f*(1 + i), 0.f); + PxArticulationLink* leftLink = gArticulation->createLink(currLeft, PxTransform(pos + PxVec3(0.f, sinAng*(2 * i + 1), 0.f), leftRot)); + PxRigidActorExt::createExclusiveShape(*leftLink, PxBoxGeometry(0.05f, 0.05f, 1.f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*leftLink, 1.f); + + const PxVec3 leftAnchorLocation = pos + PxVec3(0.f, sinAng*(2 * i), -0.9f); + + joint = leftLink->getInboundJoint(); + joint->setJointType(PxArticulationJointType::eREVOLUTE); + joint->setParentPose(PxTransform(currLeft->getGlobalPose().transformInv(leftAnchorLocation), leftParentRot)); + joint->setChildPose(PxTransform(PxVec3(0.f, 0.f, -1.f), rightRot)); + + leftParentRot = leftRot; + + joint->setMotion(PxArticulationAxis::eTWIST, PxArticulationMotion::eLIMITED); + joint->setLimitParams(PxArticulationAxis::eTWIST, PxArticulationLimit(-PxPi, angle)); + + PxArticulationLink* rightLink = gArticulation->createLink(currRight, PxTransform(pos + PxVec3(0.f, sinAng*(2 * i + 1), 0.f), rightRot)); + PxRigidActorExt::createExclusiveShape(*rightLink, PxBoxGeometry(0.05f, 0.05f, 1.f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*rightLink, 1.f); + + const PxVec3 rightAnchorLocation = pos + PxVec3(0.f, sinAng*(2 * i), 0.9f); + + /*joint = PxD6JointCreate(getPhysics(), currRight, PxTransform(currRight->getGlobalPose().transformInv(rightAnchorLocation)), + rightLink, PxTransform(PxVec3(0.f, 0.f, 1.f)));*/ + + joint = rightLink->getInboundJoint(); + joint->setParentPose(PxTransform(currRight->getGlobalPose().transformInv(rightAnchorLocation), rightParentRot)); + joint->setJointType(PxArticulationJointType::eREVOLUTE); + joint->setChildPose(PxTransform(PxVec3(0.f, 0.f, 1.f), leftRot)); + joint->setMotion(PxArticulationAxis::eTWIST, PxArticulationMotion::eLIMITED); + joint->setLimitParams(PxArticulationAxis::eTWIST, PxArticulationLimit(-angle, PxPi)); + + rightParentRot = rightRot; + + PxD6Joint* d6joint = PxD6JointCreate(*gPhysics, leftLink, PxTransform(PxIdentity), rightLink, PxTransform(PxIdentity)); + + d6joint->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + d6joint->setMotion(PxD6Axis::eSWING1, PxD6Motion::eFREE); + d6joint->setMotion(PxD6Axis::eSWING2, PxD6Motion::eFREE); + + currLeft = rightLink; + currRight = leftLink; + } + + PxD6Joint* d6joint = PxD6JointCreate(*gPhysics, currLeft, PxTransform(PxVec3(0.f, 0.f, -1.f)), leftTop, PxTransform(PxVec3(-0.5f, 0.f, 0.f))); + + d6joint->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + d6joint->setMotion(PxD6Axis::eSWING1, PxD6Motion::eFREE); + d6joint->setMotion(PxD6Axis::eSWING2, PxD6Motion::eFREE); + + d6joint = PxD6JointCreate(*gPhysics, currRight, PxTransform(PxVec3(0.f, 0.f, 1.f)), rightTop, PxTransform(PxVec3(-0.5f, 0.f, 0.f))); + + d6joint->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + d6joint->setMotion(PxD6Axis::eSWING1, PxD6Motion::eFREE); + d6joint->setMotion(PxD6Axis::eSWING2, PxD6Motion::eFREE); + + + const PxTransform topPose(PxVec3(0.f, leftTop->getGlobalPose().p.y + 0.15f, 0.f)); + + PxArticulationLink* top = gArticulation->createLink(leftTop, topPose); + PxRigidActorExt::createExclusiveShape(*top, PxBoxGeometry(0.5f, 0.1f, 1.5f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*top, 1.f); + + joint = top->getInboundJoint(); + joint->setJointType(PxArticulationJointType::eFIX); + joint->setParentPose(PxTransform(PxVec3(0.f, 0.0f, 0.f))); + joint->setChildPose(PxTransform(PxVec3(0.f, -0.15f, -0.9f))); + + gScene->addArticulation(*gArticulation); + + for (PxU32 i = 0; i < gArticulation->getNbLinks(); ++i) + { + PxArticulationLink* link; + gArticulation->getLinks(&link, 1, i); + + link->setLinearDamping(0.2f); + link->setAngularDamping(0.2f); + + link->setMaxAngularVelocity(20.f); + link->setMaxLinearVelocity(100.f); + + if (link != top) + { + for (PxU32 b = 0; b < link->getNbShapes(); ++b) + { + PxShape* shape; + link->getShapes(&shape, 1, b); + + shape->setSimulationFilterData(PxFilterData(0, 0, 1, 0)); + } + } + } + + const PxVec3 halfExt(0.25f); + const PxReal density(0.5f); + + PxRigidDynamic* box0 = gPhysics->createRigidDynamic(PxTransform(PxVec3(-0.25f, 5.f, 0.5f))); + PxShape* shape0 = PxRigidActorExt::createExclusiveShape(*box0, PxBoxGeometry(halfExt), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box0, density); + gScene->addActor(*box0); + + PxRigidDynamic* box1 = gPhysics->createRigidDynamic(PxTransform(PxVec3(0.25f, 5.f, 0.5f))); + PxShape* shape1 = PxRigidActorExt::createExclusiveShape(*box1, PxBoxGeometry(halfExt), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box1, density); + gScene->addActor(*box1); + + PxRigidDynamic* box2 = gPhysics->createRigidDynamic(PxTransform(PxVec3(-0.25f, 4.5f, 0.5f))); + PxShape* shape2 = PxRigidActorExt::createExclusiveShape(*box2, PxBoxGeometry(halfExt), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box2, density); + gScene->addActor(*box2); + + PxRigidDynamic* box3 = gPhysics->createRigidDynamic(PxTransform(PxVec3(0.25f, 4.5f, 0.5f))); + PxShape* shape3 = PxRigidActorExt::createExclusiveShape(*box3, PxBoxGeometry(halfExt), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box3, density); + gScene->addActor(*box3); + + PxRigidDynamic* box4 = gPhysics->createRigidDynamic(PxTransform(PxVec3(-0.25f, 5.f, 0.f))); + PxShape* shape4 = PxRigidActorExt::createExclusiveShape(*box4, PxBoxGeometry(halfExt), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box4, density); + gScene->addActor(*box4); + + PxRigidDynamic* box5 = gPhysics->createRigidDynamic(PxTransform(PxVec3(0.25f, 5.f, 0.f))); + PxShape* shape5 = PxRigidActorExt::createExclusiveShape(*box5, PxBoxGeometry(halfExt), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box5, density); + gScene->addActor(*box5); + + PxRigidDynamic* box6 = gPhysics->createRigidDynamic(PxTransform(PxVec3(-0.25f, 4.5f, 0.f))); + PxShape* shape6 = PxRigidActorExt::createExclusiveShape(*box6, PxBoxGeometry(halfExt), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box6, density); + gScene->addActor(*box6); + + PxRigidDynamic* box7 = gPhysics->createRigidDynamic(PxTransform(PxVec3(0.25f, 4.5f, 0.f))); + PxShape* shape7 = PxRigidActorExt::createExclusiveShape(*box7, PxBoxGeometry(halfExt), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box7, density); + gScene->addActor(*box7); + + const float contactOffset = 0.2f; + shape0->setContactOffset(contactOffset); + shape1->setContactOffset(contactOffset); + shape2->setContactOffset(contactOffset); + shape3->setContactOffset(contactOffset); + shape4->setContactOffset(contactOffset); + shape5->setContactOffset(contactOffset); + shape6->setContactOffset(contactOffset); + shape7->setContactOffset(contactOffset); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + PxInitExtensions(*gPhysics, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + + PxU32 numCores = SnippetUtils::getNbPhysicalCores(); + gDispatcher = PxDefaultCpuDispatcherCreate(numCores == 0 ? 0 : numCores - 1); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + sceneDesc.solverType = PxSolverType::eTGS; + sceneDesc.filterShader = scissorFilter; + + gScene = gPhysics->createScene(sceneDesc); + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + gArticulation = gPhysics->createArticulationReducedCoordinate(); + + createScissorLift(); +} + +static bool gClosing = true; + +void stepPhysics(bool /*interactive*/) +{ + const PxReal dt = 1.0f / 60.f; + PxReal driveValue = gDriveJoint->getDriveTarget(PxArticulationAxis::eZ); + + if (gClosing && driveValue < -1.2f) + gClosing = false; + else if (!gClosing && driveValue > 0.f) + gClosing = true; + + if (gClosing) + driveValue -= dt*0.25f; + else + driveValue += dt*0.25f; + gDriveJoint->setDriveTarget(PxArticulationAxis::eZ, driveValue); + + gScene->simulate(dt); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) +{ + gArticulation->release(); + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + PxCloseExtensions(); + PX_RELEASE(gFoundation); + + printf("SnippetArticulation done.\n"); +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + + PxU32 nbArticulations = scene->getNbArticulations(); + for(PxU32 i=0;igetArticulations(&articulation, 1, i); + + const PxU32 nbLinks = articulation->getNbLinks(); + PxArray links(nbLinks); + articulation->getLinks(&links[0], nbLinks); + + Snippets::renderActors(reinterpret_cast(&links[0]), static_cast(links.size()), true, rcaColor); + } + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + cleanupPhysics(true); +} +} + +//const PxVec3 gCamEyeLift(8.605188f, 4.050591f, 0.145860f); +//const PxVec3 gCamDirLift(-0.999581f, -0.026449f, 0.011790f); +const PxVec3 gCamEyeLift(-5.858525f, 6.079476f, 1.546743f); +const PxVec3 gCamDirLift(0.927923f, -0.356565f, -0.108720f); + +void renderLoop() +{ + sCamera = new Snippets::Camera(gCamEyeLift, gCamDirLift); + + Snippets::setupDefault("PhysX Snippet RC Articulation", sCamera, NULL, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} + +#endif diff --git a/engine/third_party/physx/snippets/snippetbvhstructure/SnippetBVHStructure.cpp b/engine/third_party/physx/snippets/snippetbvhstructure/SnippetBVHStructure.cpp new file mode 100644 index 00000000..7b9ab858 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetbvhstructure/SnippetBVHStructure.cpp @@ -0,0 +1,198 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet illustrates the usage of PxBVH for PxScene's addActor function. +// +// It creates a large number of small sphere shapes forming a large sphere. Large sphere +// represents an actor and the actor is inserted into the scene with a BVH +// that is precomputed from all the small spheres. When an actor is inserted this +// way the scene queries against this object behave actor centric rather than shape +// centric. +// Each actor that is added with a BVH does not update any of its shape bounds +// within a pruning structure. It does update just the actor bounds and the query then +// goes into actors bounds pruner, then a local query is done against the shapes in the +// actor. +// For a dynamic actor consisting of a large amound of shapes there can be a significant +// performance benefits. During fetch results, there is no need to synchronize all +// shape bounds into scene query system. Also when a new AABB tree is build inside +// scene query system these actors shapes are not contained there. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; + +static void createLargeSphere(const PxTransform& t, PxU32 density, PxReal largeRadius, PxReal radius, bool useAggregate) +{ + PxRigidDynamic* body = gPhysics->createRigidDynamic(t); + + // generate the sphere shapes + const float gStep = PxPi/float(density); + const float tStep = 2.0f*PxPi/float(density); + for(PxU32 i=0; icreateShape(PxSphereGeometry(radius), *gMaterial); + shape->setLocalPose(localTm); + body->attachShape(*shape); + shape->release(); + } + } + PxRigidBodyExt::updateMassAndInertia(*body, 10.0f); + + // get the bounds from the actor, this can be done through a helper function in PhysX extensions + PxU32 numBounds = 0; + PxBounds3* bounds = PxRigidActorExt::getRigidActorShapeLocalBoundsList(*body, numBounds); + + printf("Creating BVH structure for large compound actor...\n"); + + // setup the PxBVHDesc, it does contain only the PxBounds3 data + PxBVHDesc bvhDesc; + bvhDesc.bounds.count = numBounds; + bvhDesc.bounds.data = bounds; + bvhDesc.bounds.stride = sizeof(PxBounds3); + + // cook the bvh + PxBVH* bvh = PxCreateBVH(bvhDesc, gPhysics->getPhysicsInsertionCallback()); + + // release the memory allocated within extensions, the bounds are not required anymore + gAllocator.deallocate(bounds); + + if(useAggregate) + printf("Adding actor + BVH structure to aggregate...\n"); + else + printf("Adding actor + BVH structure to scene...\n"); + + // add the actor to the scene and provide the bvh structure (regular path without aggregate usage) + if(!useAggregate) + gScene->addActor(*body, bvh); + + // Note that when objects with large amound of shapes are created it is also + // recommended to create an aggregate from them, see the code below that would replace + // the gScene->addActor(*body, bvh) + if(useAggregate) + { + PxAggregate* aggregate = gPhysics->createAggregate(1, body->getNbShapes(), false); + aggregate->addActor(*body, bvh); + gScene->addAggregate(*aggregate); + } + + // bvh can be released at this point, the precomputed BVH structure was copied to the SDK pruners. + bvh->release(); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(2); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + gScene = gPhysics->createScene(sceneDesc); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + for(PxU32 i = 0; i < 10; i++) + createLargeSphere(PxTransform(PxVec3(200.0f*i, .0f, 100.0f)), 50, 30.0f, 1.0f, false); +} + +void stepPhysics(bool /*interactive*/) +{ + printf("Simulating...\n"); + gScene->simulate(1.0f/60.0f); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetBVH done.\n"); +} + +void keyPress(unsigned char , const PxTransform& ) +{ +} + +int snippetMain(int, const char*const*) +{ + static const PxU32 frameCount = 50; + initPhysics(false); + for(PxU32 i=0; i +#include "PxPhysicsAPI.h" +#include "extensions/PxRaycastCCD.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#ifdef RENDER_SNIPPET + #include "../snippetrender/SnippetRender.h" +#endif + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +static RaycastCCDManager* gRaycastCCD = NULL; +static PxReal stackZ = 10.0f; + +enum CCDAlgorithm +{ + // Uses linear CCD algorithm + LINEAR_CCD, + + // Uses speculative/angular CCD algorithm + SPECULATIVE_CCD, + + // Uses linear & angular CCD at the same time + FULL_CCD, + + // Uses raycast CCD algorithm + RAYCAST_CCD, + + // Switch to NO_CCD to see the sphere go through the box stack without CCD. + NO_CCD, + + // Number of CCD algorithms used in this snippet + CCD_COUNT +}; + +static bool gPause = false; +static bool gOneFrame = false; +static const PxU32 gScenarioCount = CCD_COUNT; +static PxU32 gScenario = 0; + +static PX_FORCE_INLINE CCDAlgorithm getCCDAlgorithm() +{ + return CCDAlgorithm(gScenario); +} + +static PxRigidDynamic* createDynamic(const PxTransform& t, const PxGeometry& geometry, const PxVec3& velocity=PxVec3(0), bool enableLinearCCD = false, bool enableSpeculativeCCD = false) +{ + PX_ASSERT(gScene); + PxRigidDynamic* dynamic = NULL; + if(gScene) + { + dynamic = PxCreateDynamic(*gPhysics, t, geometry, *gMaterial, 10.0f); + dynamic->setAngularDamping(0.5f); + dynamic->setLinearVelocity(velocity); + gScene->addActor(*dynamic); + if(enableLinearCCD) + dynamic->setRigidBodyFlag(PxRigidBodyFlag::eENABLE_CCD, true); + if(enableSpeculativeCCD) + dynamic->setRigidBodyFlag(PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD, true); + } + + return dynamic; +} + +static void createStack(const PxTransform& t, PxU32 size, PxReal halfExtent, bool enableLinearCCD = false, bool enableSpeculativeCCD = false) +{ + PX_ASSERT(gScene); + if(!gScene) + return; + + PxShape* shape = gPhysics->createShape(PxBoxGeometry(halfExtent, halfExtent, halfExtent), *gMaterial); + PX_ASSERT(shape); + if(!shape) + return; + + for(PxU32 i=0; icreateRigidDynamic(t.transform(localTm)); + body->attachShape(*shape); + PxRigidBodyExt::updateMassAndInertia(*body, 10.0f); + if(enableLinearCCD) + body->setRigidBodyFlag(PxRigidBodyFlag::eENABLE_CCD, true); + if(enableSpeculativeCCD) + body->setRigidBodyFlag(PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD, true); + + gScene->addActor(*body); + } + } + shape->release(); +} + +static PxFilterFlags ccdFilterShader( + PxFilterObjectAttributes attributes0, + PxFilterData filterData0, + PxFilterObjectAttributes attributes1, + PxFilterData filterData1, + PxPairFlags& pairFlags, + const void* constantBlock, + PxU32 constantBlockSize) +{ + PX_UNUSED(attributes0); + PX_UNUSED(filterData0); + PX_UNUSED(attributes1); + PX_UNUSED(filterData1); + PX_UNUSED(constantBlock); + PX_UNUSED(constantBlockSize); + + pairFlags = PxPairFlag::eSOLVE_CONTACT | PxPairFlag::eDETECT_DISCRETE_CONTACT | PxPairFlag::eDETECT_CCD_CONTACT; + + return PxFilterFlags(); +} + +static void registerForRaycastCCD(PxRigidDynamic* actor) +{ + if(actor) + { + PxShape* shape = NULL; + + actor->getShapes(&shape, 1); + + // Register each object for which CCD should be enabled. In this snippet we only enable it for the sphere. + gRaycastCCD->registerRaycastCCDObject(actor, shape); + } +} + +static void initScene() +{ + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + bool enableLinearCCD = false; + bool enableSpeculativeCCD = false; + + const CCDAlgorithm ccd = getCCDAlgorithm(); + if(ccd == LINEAR_CCD) + { + enableLinearCCD = true; + sceneDesc.filterShader = ccdFilterShader; + sceneDesc.flags |= PxSceneFlag::eENABLE_CCD; + gScene = gPhysics->createScene(sceneDesc); + + printf("- Using linear CCD.\n"); + } + else if(ccd == SPECULATIVE_CCD) + { + enableSpeculativeCCD = true; + gScene = gPhysics->createScene(sceneDesc); + + printf("- Using speculative/angular CCD.\n"); + } + else if(ccd == FULL_CCD) + { + enableLinearCCD = true; + enableSpeculativeCCD = true; + sceneDesc.filterShader = ccdFilterShader; + sceneDesc.flags |= PxSceneFlag::eENABLE_CCD; + + gScene = gPhysics->createScene(sceneDesc); + + printf("- Using full CCD.\n"); + } + else if(ccd == RAYCAST_CCD) + { + gScene = gPhysics->createScene(sceneDesc); + gRaycastCCD = new RaycastCCDManager(gScene); + + printf("- Using raycast CCD.\n"); + } + else if(ccd == NO_CCD) + { + gScene = gPhysics->createScene(sceneDesc); + + printf("- Using no CCD.\n"); + } + + // Create a scenario that requires angular CCD: a rotating plank colliding with a falling box. + { + PxRigidDynamic* actor = createDynamic(PxTransform(PxVec3(40.0f, 20.0f, 0.0f)), PxBoxGeometry(10.0f, 1.0f, 0.1f), PxVec3(0.0f), enableLinearCCD, enableSpeculativeCCD); + actor->setAngularVelocity(PxVec3(0.0f, 10.0f, 0.0f)); + actor->setActorFlag(PxActorFlag::eDISABLE_GRAVITY, true); + actor->setRigidDynamicLockFlag(PxRigidDynamicLockFlag::eLOCK_LINEAR_X, true); + actor->setRigidDynamicLockFlag(PxRigidDynamicLockFlag::eLOCK_LINEAR_Y, true); + actor->setRigidDynamicLockFlag(PxRigidDynamicLockFlag::eLOCK_LINEAR_Z, true); + actor->setRigidDynamicLockFlag(PxRigidDynamicLockFlag::eLOCK_ANGULAR_X, true); + actor->setRigidDynamicLockFlag(PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z, true); + + if(gRaycastCCD) + registerForRaycastCCD(actor); + + PxRigidDynamic* actor2 = createDynamic(PxTransform(PxVec3(40.0f, 20.0f, 10.0f)), PxBoxGeometry(0.1f, 1.0f, 1.0f), PxVec3(0.0f), enableLinearCCD, enableSpeculativeCCD); + + if(gRaycastCCD) + registerForRaycastCCD(actor2); + } + + // Create a scenario that requires linear CCD: a fast moving sphere moving towards a box stack. + { + PxRigidDynamic* actor = createDynamic(PxTransform(PxVec3(0.0f, 18.0f, 100.0f)), PxSphereGeometry(2.0f), PxVec3(0.0f, 0.0f, -1000.0f), enableLinearCCD, enableSpeculativeCCD); + + if(gRaycastCCD) + registerForRaycastCCD(actor); + + createStack(PxTransform(PxVec3(0, 0, stackZ)), 10, 2.0f, enableLinearCCD, enableSpeculativeCCD); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0, 1, 0, 0), *gMaterial); + gScene->addActor(*groundPlane); + } + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if (pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } +} + +void renderText() +{ +#ifdef RENDER_SNIPPET + Snippets::print("Press F1 to F4 to select a scenario."); + switch(PxU32(gScenario)) + { + case 0: { Snippets::print("Current scenario: linear CCD"); }break; + case 1: { Snippets::print("Current scenario: angular CCD"); }break; + case 2: { Snippets::print("Current scenario: linear + angular CCD"); }break; + case 3: { Snippets::print("Current scenario: raycast CCD"); }break; + case 4: { Snippets::print("Current scenario: no CCD"); }break; + } +#endif +} + +void initPhysics(bool /*interactive*/) +{ + printf("CCD snippet. Use these keys:\n"); + printf(" P - enable/disable pause\n"); + printf(" O - step simulation for one frame\n"); + printf(" R - reset scene\n"); + printf(" F1 to F4 - select scenes with different CCD algorithms\n"); + printf(" F1 - Using linear CCD\n"); + printf(" F2 - Using speculative/angular CCD\n"); + printf(" F3 - Using full CCD (linear+angular)\n"); + printf(" F4 - Using raycast CCD\n"); + printf(" F5 - Using no CCD\n"); + printf("\n"); + + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + const PxU32 numCores = SnippetUtils::getNbPhysicalCores(); + gDispatcher = PxDefaultCpuDispatcherCreate(numCores == 0 ? 0 : numCores - 1); + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.25f); + + initScene(); +} + +void stepPhysics(bool /*interactive*/) +{ + if (gPause && !gOneFrame) + return; + gOneFrame = false; + + gScene->simulate(1.0f/60.0f); + gScene->fetchResults(true); + + // Simply call this after fetchResults to perform CCD raycasts. + if(gRaycastCCD) + gRaycastCCD->doRaycastCCD(true); +} + +static void releaseScene() +{ + PX_RELEASE(gScene); + PX_DELETE(gRaycastCCD); +} + +void cleanupPhysics(bool /*interactive*/) +{ + releaseScene(); + + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetCCD done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& /*camera*/) +{ + if(key == 'p' || key == 'P') + gPause = !gPause; + + if(key == 'o' || key == 'O') + { + gPause = true; + gOneFrame = true; + } + + if(gScene) + { + if(key >= 1 && key <= gScenarioCount) + { + gScenario = key - 1; + releaseScene(); + initScene(); + } + + if(key == 'r' || key == 'R') + { + releaseScene(); + initScene(); + } + } +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + + renderText(); + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + cleanupPhysics(true); +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(50.0f, 50.0f, 50.0f), PxVec3(-0.502444f, -0.442113f, -0.743025f)); + + Snippets::setupDefault("PhysX Snippet CCD", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetcommon/ClassicMain.cpp b/engine/third_party/physx/snippets/snippetcommon/ClassicMain.cpp new file mode 100644 index 00000000..dd34f6fb --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcommon/ClassicMain.cpp @@ -0,0 +1,34 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +extern int snippetMain(int, const char*const*); + +int main(int argc, char** argv) +{ + return snippetMain(argc, argv); +} diff --git a/engine/third_party/physx/snippets/snippetcommon/SnippetPVD.h b/engine/third_party/physx/snippets/snippetcommon/SnippetPVD.h new file mode 100644 index 00000000..b22b86a9 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcommon/SnippetPVD.h @@ -0,0 +1,35 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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 PHYSX_SNIPPET_PVD_H +#define PHYSX_SNIPPET_PVD_H + +#define PVD_HOST "127.0.0.1" //Set this to the IP address of the system running the PhysX Visual Debugger that you want to connect to. + +#endif //PHYSX_SNIPPET_PVD_H diff --git a/engine/third_party/physx/snippets/snippetcommon/SnippetPrint.h b/engine/third_party/physx/snippets/snippetcommon/SnippetPrint.h new file mode 100644 index 00000000..66d1dc57 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcommon/SnippetPrint.h @@ -0,0 +1,38 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PHYSX_SNIPPET_PRINT_H +#define PHYSX_SNIPPET_PRINT_H + +#include "foundation/PxPreprocessor.h" + +#if PX_SWITCH +#include "../SnippetCommon/Switch/SwitchSnippetPrint.h" +#endif + +#endif // PHYSX_SNIPPET_PRINT_H diff --git a/engine/third_party/physx/snippets/snippetcontactmodification/SnippetContactModification.cpp b/engine/third_party/physx/snippets/snippetcontactmodification/SnippetContactModification.cpp new file mode 100644 index 00000000..1ab1eb5d --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcontactmodification/SnippetContactModification.cpp @@ -0,0 +1,345 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet illustrates the use of simple contact reports and contact modification. +// +// It defines a filter shader function that requests contact modification and +// touch reports for all pairs, and a contact callback function that saves +// the contact points. It configures the scene to use this filter and callback, +// and prints the number of contact reports each frame. If rendering, it renders +// each contact as a line whose length and direction are defined by the contact +// impulse. +// This test sets up a situation that would be unstable without contact modification +// due to very large mass ratios. This test uses local mass modification to make +// the configuration stable. It also demonstrates how to interpret contact impulses +// when local mass modification is used. +// Local mass modification can be disabled with the MODIFY_MASS_PROPERTIES #define +// to demonstrate the instability if it was not used. +// +// **************************************************************************** + +#include "PxPhysicsAPI.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" + +using namespace physx; + +#define MODIFY_MASS_PROPERTIES 1 + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; + +PxArray gContactPositions; +PxArray gContactImpulses; +PxArray gContactLinearImpulses[2]; +PxArray gContactAngularImpulses[2]; + +static PxFilterFlags contactReportFilterShader( PxFilterObjectAttributes attributes0, PxFilterData filterData0, + PxFilterObjectAttributes attributes1, PxFilterData filterData1, + PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize) +{ + PX_UNUSED(attributes0); + PX_UNUSED(attributes1); + PX_UNUSED(filterData0); + PX_UNUSED(filterData1); + PX_UNUSED(constantBlockSize); + PX_UNUSED(constantBlock); + + // all initial and persisting reports for everything, with per-point data + pairFlags = PxPairFlag::eSOLVE_CONTACT | PxPairFlag::eDETECT_DISCRETE_CONTACT + | PxPairFlag::eNOTIFY_TOUCH_FOUND + | PxPairFlag::eNOTIFY_TOUCH_PERSISTS + | PxPairFlag::eNOTIFY_CONTACT_POINTS + | PxPairFlag::eMODIFY_CONTACTS; + return PxFilterFlag::eDEFAULT; +} + +class ContactModifyCallback: public PxContactModifyCallback +{ + void onContactModify(PxContactModifyPair* const pairs, PxU32 count) + { +#if MODIFY_MASS_PROPERTIES + //We define a maximum mass ratio that we will accept in this test, which is a ratio of 2 + const PxReal maxMassRatio = 2.f; + + for(PxU32 i = 0; i < count; i++) + { + const PxRigidDynamic* dynamic0 = pairs[i].actor[0]->is(); + const PxRigidDynamic* dynamic1 = pairs[i].actor[1]->is(); + if(dynamic0 != NULL && dynamic1 != NULL) + { + //We only want to perform local mass modification between 2 dynamic bodies because we intend on + //normalizing the mass ratios between the pair within a tolerable range + + PxReal mass0 = dynamic0->getMass(); + PxReal mass1 = dynamic1->getMass(); + + if(mass0 > mass1) + { + //dynamic0 is heavier than dynamic1 so we will locally increase the mass of dynamic1 + //to be half the mass of dynamic0. + PxReal ratio = mass0/mass1; + if(ratio > maxMassRatio) + { + PxReal invMassScale = maxMassRatio/ratio; + pairs[i].contacts.setInvMassScale1(invMassScale); + pairs[i].contacts.setInvInertiaScale1(invMassScale); + } + } + else + { + //dynamic1 is heavier than dynamic0 so we will locally increase the mass of dynamic0 + //to be half the mass of dynamic1. + PxReal ratio = mass1/mass0; + if(ratio > maxMassRatio) + { + PxReal invMassScale = maxMassRatio/ratio; + pairs[i].contacts.setInvMassScale0(invMassScale); + pairs[i].contacts.setInvInertiaScale0(invMassScale); + } + } + } + } +#endif + } +}; + +ContactModifyCallback gContactModifyCallback; + +static PxU32 extractContactsWithMassScale(const PxContactPair& pair, PxContactPairPoint* userBuffer, PxU32 bufferSize, PxReal& invMassScale0, PxReal& invMassScale1) +{ + const PxU8* contactStream = pair.contactPoints; + const PxU8* patchStream = pair.contactPatches; + const PxU32* faceIndices = pair.getInternalFaceIndices(); + + PxU32 nbContacts = 0; + + if(pair.contactCount && bufferSize) + { + PxContactStreamIterator iter(patchStream, contactStream, faceIndices, pair.patchCount, pair.contactCount); + + const PxReal* impulses = reinterpret_cast(pair.contactImpulses); + + PxU32 flippedContacts = (pair.flags & PxContactPairFlag::eINTERNAL_CONTACTS_ARE_FLIPPED); + PxU32 hasImpulses = (pair.flags & PxContactPairFlag::eINTERNAL_HAS_IMPULSES); + + + invMassScale0 = iter.getInvMassScale0(); + invMassScale1 = iter.getInvMassScale1(); + while(iter.hasNextPatch()) + { + iter.nextPatch(); + while(iter.hasNextContact()) + { + iter.nextContact(); + PxContactPairPoint& dst = userBuffer[nbContacts]; + dst.position = iter.getContactPoint(); + dst.separation = iter.getSeparation(); + dst.normal = iter.getContactNormal(); + if (!flippedContacts) + { + dst.internalFaceIndex0 = iter.getFaceIndex0(); + dst.internalFaceIndex1 = iter.getFaceIndex1(); + } + else + { + dst.internalFaceIndex0 = iter.getFaceIndex1(); + dst.internalFaceIndex1 = iter.getFaceIndex0(); + } + + if (hasImpulses) + { + PxReal impulse = impulses[nbContacts]; + dst.impulse = dst.normal * impulse; + } + else + dst.impulse = PxVec3(0.0f); + ++nbContacts; + if(nbContacts == bufferSize) + return nbContacts; + } + } + } + + return nbContacts; +} + +class ContactReportCallback: public PxSimulationEventCallback +{ + void onConstraintBreak(PxConstraintInfo* constraints, PxU32 count) { PX_UNUSED(constraints); PX_UNUSED(count); } + void onWake(PxActor** actors, PxU32 count) { PX_UNUSED(actors); PX_UNUSED(count); } + void onSleep(PxActor** actors, PxU32 count) { PX_UNUSED(actors); PX_UNUSED(count); } + void onTrigger(PxTriggerPair* pairs, PxU32 count) { PX_UNUSED(pairs); PX_UNUSED(count); } + void onAdvance(const PxRigidBody*const*, const PxTransform*, const PxU32) {} + void onContact(const PxContactPairHeader& pairHeader, const PxContactPair* pairs, PxU32 nbPairs) + { + PX_UNUSED((pairHeader)); + PxArray contactPoints; + + + for(PxU32 i=0;iis(); + PxVec3 linImpulse(0.f), angImpulse(0.f); + if(dynamic != NULL) + { + PxRigidBodyExt::computeLinearAngularImpulse(*dynamic, dynamic->getGlobalPose(), contactPoints[j].position, + k == 0 ? contactPoints[j].impulse : -contactPoints[j].impulse, invMassScale[k], invMassScale[k], linImpulse, angImpulse); + } + gContactLinearImpulses[k].pushBack(linImpulse); + gContactAngularImpulses[k].pushBack(angImpulse); + } + } + } + } + } +}; + +static ContactReportCallback gContactReportCallback; + +static void createStack(const PxTransform& t, PxU32 size, PxReal halfExtent) +{ + PxShape* shape = gPhysics->createShape(PxBoxGeometry(halfExtent, halfExtent, halfExtent), *gMaterial); + for(PxU32 i=0; icreateRigidDynamic(t.transform(localTm)); + body->attachShape(*shape); + PxRigidBodyExt::updateMassAndInertia(*body, (i+1)*(i+1)*(i+1)*10.0f); + gScene->addActor(*body); + } + shape->release(); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + PxInitExtensions(*gPhysics, gPvd); + + PxU32 numCores = SnippetUtils::getNbPhysicalCores(); + gDispatcher = PxDefaultCpuDispatcherCreate(numCores == 0 ? 0 : numCores - 1); + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.gravity = PxVec3(0, -9.81f, 0); + sceneDesc.filterShader = contactReportFilterShader; + sceneDesc.simulationEventCallback = &gContactReportCallback; + sceneDesc.contactModifyCallback = &gContactModifyCallback; + gScene = gPhysics->createScene(sceneDesc); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + createStack(PxTransform(PxVec3(0,0.0f,10.0f)), 5, 2.0f); +} + +void stepPhysics(bool /*interactive*/) +{ + gContactPositions.clear(); + gContactImpulses.clear(); + + gScene->simulate(1.0f/60.0f); + gScene->fetchResults(true); + printf("%d contact reports\n", PxU32(gContactPositions.size())); +} + +void cleanupPhysics(bool /*interactive*/) +{ + gContactPositions.reset(); + gContactImpulses.reset(); + gContactLinearImpulses[0].reset(); + gContactAngularImpulses[0].reset(); + gContactLinearImpulses[1].reset(); + gContactAngularImpulses[1].reset(); + + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PxCloseExtensions(); + PX_RELEASE(gPhysics); + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetContactModification done.\n"); +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + initPhysics(false); + for(PxU32 i=0; i<250; i++) + stepPhysics(false); + cleanupPhysics(false); +#endif + + return 0; +} + diff --git a/engine/third_party/physx/snippets/snippetcontactmodification/SnippetContactModificationRender.cpp b/engine/third_party/physx/snippets/snippetcontactmodification/SnippetContactModificationRender.cpp new file mode 100644 index 00000000..1f38a1b5 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcontactmodification/SnippetContactModificationRender.cpp @@ -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. + +#ifdef RENDER_SNIPPET + +#include "PxPhysicsAPI.h" +#include "../snippetrender/SnippetRender.h" +#include "../snippetrender/SnippetCamera.h" + +using namespace physx; + +extern void initPhysics(bool interactive); +extern void stepPhysics(bool interactive); +extern void cleanupPhysics(bool interactive); + +extern PxArray gContactPositions; +extern PxArray gContactImpulses; +PxArray gContactVertices; + +namespace +{ +Snippets::Camera* sCamera; + +void renderCallback() +{ + stepPhysics(true); + + Snippets::startRender(sCamera); + + PxScene* scene; + PxGetPhysics().getScenes(&scene,1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true); + } + + if(gContactPositions.size()) + { + gContactVertices.clear(); + for(PxU32 i=0;i gContactPositions; +PxArray gContactImpulses; + +static PxFilterFlags contactReportFilterShader( PxFilterObjectAttributes attributes0, PxFilterData filterData0, + PxFilterObjectAttributes attributes1, PxFilterData filterData1, + PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize) +{ + PX_UNUSED(attributes0); + PX_UNUSED(attributes1); + PX_UNUSED(filterData0); + PX_UNUSED(filterData1); + PX_UNUSED(constantBlockSize); + PX_UNUSED(constantBlock); + + // all initial and persisting reports for everything, with per-point data + pairFlags = PxPairFlag::eSOLVE_CONTACT | PxPairFlag::eDETECT_DISCRETE_CONTACT + | PxPairFlag::eNOTIFY_TOUCH_FOUND + | PxPairFlag::eNOTIFY_TOUCH_PERSISTS + | PxPairFlag::eNOTIFY_CONTACT_POINTS; + return PxFilterFlag::eDEFAULT; +} + +class ContactReportCallback: public PxSimulationEventCallback +{ + void onConstraintBreak(PxConstraintInfo* constraints, PxU32 count) { PX_UNUSED(constraints); PX_UNUSED(count); } + void onWake(PxActor** actors, PxU32 count) { PX_UNUSED(actors); PX_UNUSED(count); } + void onSleep(PxActor** actors, PxU32 count) { PX_UNUSED(actors); PX_UNUSED(count); } + void onTrigger(PxTriggerPair* pairs, PxU32 count) { PX_UNUSED(pairs); PX_UNUSED(count); } + void onAdvance(const PxRigidBody*const*, const PxTransform*, const PxU32) {} + void onContact(const PxContactPairHeader& pairHeader, const PxContactPair* pairs, PxU32 nbPairs) + { + PX_UNUSED((pairHeader)); + PxArray contactPoints; + + for(PxU32 i=0;icreateShape(PxBoxGeometry(halfExtent, halfExtent, halfExtent), *gMaterial); + for(PxU32 i=0; icreateRigidDynamic(t.transform(localTm)); + body->attachShape(*shape); + PxRigidBodyExt::updateMassAndInertia(*body, 10.0f); + gScene->addActor(*body); + } + } + shape->release(); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + PxInitExtensions(*gPhysics,gPvd); + PxU32 numCores = SnippetUtils::getNbPhysicalCores(); + gDispatcher = PxDefaultCpuDispatcherCreate(numCores == 0 ? 0 : numCores - 1); + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.gravity = PxVec3(0, -9.81f, 0); + sceneDesc.filterShader = contactReportFilterShader; + sceneDesc.simulationEventCallback = &gContactReportCallback; + gScene = gPhysics->createScene(sceneDesc); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + } + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + createStack(PxTransform(PxVec3(0,3.0f,10.0f)), 5, 2.0f); +} + +void stepPhysics(bool /*interactive*/) +{ + gContactPositions.clear(); + gContactImpulses.clear(); + + gScene->simulate(1.0f/60.0f); + gScene->fetchResults(true); + printf("%d contact reports\n", PxU32(gContactPositions.size())); +} + +void cleanupPhysics(bool /*interactive*/) +{ + gContactPositions.reset(); + gContactImpulses.reset(); + + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PxCloseExtensions(); + PX_RELEASE(gPhysics); + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetContactReport done.\n"); +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + initPhysics(false); + for(PxU32 i=0; i<250; i++) + stepPhysics(false); + cleanupPhysics(false); +#endif + + return 0; +} + diff --git a/engine/third_party/physx/snippets/snippetcontactreport/SnippetContactReportRender.cpp b/engine/third_party/physx/snippets/snippetcontactreport/SnippetContactReportRender.cpp new file mode 100644 index 00000000..1f38a1b5 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcontactreport/SnippetContactReportRender.cpp @@ -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. + +#ifdef RENDER_SNIPPET + +#include "PxPhysicsAPI.h" +#include "../snippetrender/SnippetRender.h" +#include "../snippetrender/SnippetCamera.h" + +using namespace physx; + +extern void initPhysics(bool interactive); +extern void stepPhysics(bool interactive); +extern void cleanupPhysics(bool interactive); + +extern PxArray gContactPositions; +extern PxArray gContactImpulses; +PxArray gContactVertices; + +namespace +{ +Snippets::Camera* sCamera; + +void renderCallback() +{ + stepPhysics(true); + + Snippets::startRender(sCamera); + + PxScene* scene; + PxGetPhysics().getScenes(&scene,1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true); + } + + if(gContactPositions.size()) + { + gContactVertices.clear(); + for(PxU32 i=0;i gContactPositions; +PxArray gContactImpulses; +PxArray gContactSphereActorPositions; + +static PxFilterFlags contactReportFilterShader( PxFilterObjectAttributes attributes0, PxFilterData filterData0, + PxFilterObjectAttributes attributes1, PxFilterData filterData1, + PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize) +{ + PX_UNUSED(attributes0); + PX_UNUSED(attributes1); + PX_UNUSED(filterData0); + PX_UNUSED(filterData1); + PX_UNUSED(constantBlockSize); + PX_UNUSED(constantBlock); + + // + // Enable CCD for the pair, request contact reports for initial and CCD contacts. + // Additionally, provide information per contact point and provide the actor + // pose at the time of contact. + // + + pairFlags = PxPairFlag::eCONTACT_DEFAULT + | PxPairFlag::eDETECT_CCD_CONTACT + | PxPairFlag::eNOTIFY_TOUCH_CCD + | PxPairFlag::eNOTIFY_TOUCH_FOUND + | PxPairFlag::eNOTIFY_CONTACT_POINTS + | PxPairFlag::eCONTACT_EVENT_POSE; + return PxFilterFlag::eDEFAULT; +} + +class ContactReportCallback: public PxSimulationEventCallback +{ + void onConstraintBreak(PxConstraintInfo* constraints, PxU32 count) { PX_UNUSED(constraints); PX_UNUSED(count); } + void onWake(PxActor** actors, PxU32 count) { PX_UNUSED(actors); PX_UNUSED(count); } + void onSleep(PxActor** actors, PxU32 count) { PX_UNUSED(actors); PX_UNUSED(count); } + void onTrigger(PxTriggerPair* pairs, PxU32 count) { PX_UNUSED(pairs); PX_UNUSED(count); } + void onAdvance(const PxRigidBody*const*, const PxTransform*, const PxU32) {} + void onContact(const PxContactPairHeader& pairHeader, const PxContactPair* pairs, PxU32 nbPairs) + { + PxArray contactPoints; + + PxTransform spherePose(PxIdentity); + PxU32 nextPairIndex = 0xffffffff; + + PxContactPairExtraDataIterator iter(pairHeader.extraDataStream, pairHeader.extraDataStreamSize); + bool hasItemSet = iter.nextItemSet(); + if (hasItemSet) + nextPairIndex = iter.contactPairIndex; + + for(PxU32 i=0; i < nbPairs; i++) + { + // + // Get the pose of the dynamic object at time of impact. + // + if (nextPairIndex == i) + { + if (pairHeader.actors[0]->is()) + spherePose = iter.eventPose->globalPose[0]; + else + spherePose = iter.eventPose->globalPose[1]; + + gContactSphereActorPositions.pushBack(spherePose.p); + + hasItemSet = iter.nextItemSet(); + if (hasItemSet) + nextPairIndex = iter.contactPairIndex; + } + + // + // Get the contact points for the pair. + // + const PxContactPair& cPair = pairs[i]; + if (cPair.events & (PxPairFlag::eNOTIFY_TOUCH_FOUND | PxPairFlag::eNOTIFY_TOUCH_CCD)) + { + PxU32 contactCount = cPair.contactCount; + contactPoints.resize(contactCount); + cPair.extractContacts(&contactPoints[0], contactCount); + + for(PxU32 j=0; j < contactCount; j++) + { + gContactPositions.pushBack(contactPoints[j].position); + gContactImpulses.pushBack(contactPoints[j].impulse); + } + } + } + } +}; + +ContactReportCallback gContactReportCallback; + +static void initScene() +{ + // + // Create a static triangle mesh + // + + PxVec3 vertices[] = { PxVec3(-8.0f, 0.0f, -3.0f), + PxVec3(-8.0f, 0.0f, 3.0f), + PxVec3(0.0f, 0.0f, 3.0f), + PxVec3(0.0f, 0.0f, -3.0f), + PxVec3(-8.0f, 10.0f, -3.0f), + PxVec3(-8.0f, 10.0f, 3.0f), + PxVec3(0.0f, 10.0f, 3.0f), + PxVec3(0.0f, 10.0f, -3.0f), + }; + + PxU32 vertexCount = sizeof(vertices) / sizeof(vertices[0]); + + PxU32 triangleIndices[] = { 0, 1, 2, + 0, 2, 3, + 0, 5, 1, + 0, 4, 5, + 4, 6, 5, + 4, 7, 6 + }; + PxU32 triangleCount = (sizeof(triangleIndices) / sizeof(triangleIndices[0])) / 3; + + PxTriangleMeshDesc triangleMeshDesc; + triangleMeshDesc.points.count = vertexCount; + triangleMeshDesc.points.data = vertices; + triangleMeshDesc.points.stride = sizeof(PxVec3); + triangleMeshDesc.triangles.count = triangleCount; + triangleMeshDesc.triangles.data = triangleIndices; + triangleMeshDesc.triangles.stride = 3 * sizeof(PxU32); + + PxTolerancesScale tolerances; + const PxCookingParams params(tolerances); + gTriangleMesh = PxCreateTriangleMesh(params, triangleMeshDesc, gPhysics->getPhysicsInsertionCallback()); + + if (!gTriangleMesh) + return; + + gTriangleMeshActor = gPhysics->createRigidStatic(PxTransform(PxVec3(0.0f, 1.0f, 0.0f), PxQuat(PxHalfPi / 60.0f, PxVec3(0.0f, 1.0f, 0.0f)))); + + if (!gTriangleMeshActor) + return; + + PxTriangleMeshGeometry triGeom(gTriangleMesh); + PxShape* triangleMeshShape = PxRigidActorExt::createExclusiveShape(*gTriangleMeshActor, triGeom, *gMaterial); + + if (!triangleMeshShape) + return; + + gScene->addActor(*gTriangleMeshActor); + + + // + // Create a fast moving sphere that will hit and bounce off the static triangle mesh 3 times + // in one simulation step. + // + + PxTransform spherePose(PxVec3(0.0f, 5.0f, 1.0f)); + gContactSphereActorPositions.pushBack(spherePose.p); + gSphereActor = gPhysics->createRigidDynamic(spherePose); + gSphereActor->setRigidBodyFlag(PxRigidBodyFlag::eENABLE_CCD, true); + + if (!gSphereActor) + return; + + PxSphereGeometry sphereGeom(1.0f); + PxShape* sphereShape = PxRigidActorExt::createExclusiveShape(*gSphereActor, sphereGeom, *gMaterial); + + if (!sphereShape) + return; + + PxRigidBodyExt::updateMassAndInertia(*gSphereActor, 1.0f); + + PxReal velMagn = 900.0f; + PxVec3 vel = PxVec3(-1.0f, -1.0f, 0.0f); + vel.normalize(); + vel *= velMagn; + gSphereActor->setLinearVelocity(vel); + + gScene->addActor(*gSphereActor); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + PxInitExtensions(*gPhysics, gPvd); + + PxU32 numCores = SnippetUtils::getNbPhysicalCores(); + gDispatcher = PxDefaultCpuDispatcherCreate(numCores == 0 ? 0 : numCores - 1); + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.gravity = PxVec3(0, 0, 0); + sceneDesc.filterShader = contactReportFilterShader; + sceneDesc.simulationEventCallback = &gContactReportCallback; + sceneDesc.flags |= PxSceneFlag::eENABLE_CCD; + sceneDesc.ccdMaxPasses = 4; + + gScene = gPhysics->createScene(sceneDesc); + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + } + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 1.0f); + + initScene(); +} + +void stepPhysics(bool /*interactive*/) +{ + if (!gSimStepCount) + { + gScene->simulate(1.0f/60.0f); + gScene->fetchResults(true); + printf("%d contact points\n", PxU32(gContactPositions.size())); + + if (gSphereActor) + gContactSphereActorPositions.pushBack(gSphereActor->getGlobalPose().p); + + gSimStepCount = 1; + } +} + +void cleanupPhysics(bool /*interactive*/) +{ + gContactPositions.reset(); + gContactImpulses.reset(); + gContactSphereActorPositions.reset(); + + PX_RELEASE(gSphereActor); + PX_RELEASE(gTriangleMeshActor); + PX_RELEASE(gTriangleMesh); + + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PxCloseExtensions(); + PX_RELEASE(gPhysics); + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetContactReportCCD done.\n"); +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + initPhysics(false); + + stepPhysics(false); + + cleanupPhysics(false); +#endif + + return 0; +} + diff --git a/engine/third_party/physx/snippets/snippetcontactreportccd/SnippetContactReportCCDRender.cpp b/engine/third_party/physx/snippets/snippetcontactreportccd/SnippetContactReportCCDRender.cpp new file mode 100644 index 00000000..81d950ad --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcontactreportccd/SnippetContactReportCCDRender.cpp @@ -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. + +#ifdef RENDER_SNIPPET + +#include "PxPhysicsAPI.h" +#include "../snippetrender/SnippetRender.h" +#include "../snippetrender/SnippetCamera.h" + +using namespace physx; + +extern void initPhysics(bool interactive); +extern void stepPhysics(bool interactive); +extern void cleanupPhysics(bool interactive); + +extern PxArray gContactPositions; +extern PxArray gContactImpulses; +extern PxArray gContactSphereActorPositions; +PxArray gContactVertices; + +namespace +{ +Snippets::Camera* sCamera; + +void renderCallback() +{ + stepPhysics(true); + + Snippets::startRender(sCamera); + + PxScene* scene; + PxGetPhysics().getScenes(&scene,1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true); + } + + if(gContactPositions.size()) + { + gContactVertices.clear(); + for(PxU32 i=0; i < gContactPositions.size(); i++) + { + gContactVertices.pushBack(gContactPositions[i]); + gContactVertices.pushBack(gContactPositions[i]-gContactImpulses[i]*0.0001f); + } + glDisable(GL_LIGHTING); + glColor4f(1.0f, 0.0f, 0.0f, 1.0f); + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, &gContactVertices[0]); + glDrawArrays(GL_LINES, 0, GLint(gContactVertices.size())); + glDisableClientState(GL_VERTEX_ARRAY); + glEnable(GL_LIGHTING); + } + + if(gContactSphereActorPositions.size()) + { + gContactVertices.clear(); + for(PxU32 i=0; i < gContactSphereActorPositions.size() - 1; i++) + { + gContactVertices.pushBack(gContactSphereActorPositions[i]); + gContactVertices.pushBack(gContactSphereActorPositions[i+1]); + } + glDisable(GL_LIGHTING); + glColor4f(1.0f, 1.0f, 0.0f, 1.0f); + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, &gContactVertices[0]); + glDrawArrays(GL_LINES, 0, GLint(gContactVertices.size())); + glDisableClientState(GL_VERTEX_ARRAY); + glEnable(GL_LIGHTING); + } + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + gContactVertices.reset(); + cleanupPhysics(true); +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(-1.5f, 6.0f, 14.0f), PxVec3(-0.1f,0.0f,-0.7f)); + + Snippets::setupDefault("PhysX Snippet ContactReport CCD", sCamera, NULL, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetconvexmeshcreate/SnippetConvexMeshCreate.cpp b/engine/third_party/physx/snippets/snippetconvexmeshcreate/SnippetConvexMeshCreate.cpp new file mode 100644 index 00000000..403b9189 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetconvexmeshcreate/SnippetConvexMeshCreate.cpp @@ -0,0 +1,171 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet creates convex meshes with different cooking settings +// and shows how these settings affect the convex mesh creation performance and +// the size of the resulting cooked meshes. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetutils/SnippetUtils.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; + +static float rand(float loVal, float hiVal) +{ + return loVal + (float(rand())/float(RAND_MAX))*(hiVal - loVal); +} + +template +static void createRandomConvex(PxU32 numVerts, const PxVec3* verts) +{ + PxTolerancesScale tolerances; + PxCookingParams params(tolerances); + + // Use the new (default) PxConvexMeshCookingType::eQUICKHULL + params.convexMeshCookingType = convexMeshCookingType; + + // If the gaussMapLimit is chosen higher than the number of output vertices, no gauss map is added to the convex mesh data (here 256). + // If the gaussMapLimit is chosen lower than the number of output vertices, a gauss map is added to the convex mesh data (here 16). + params.gaussMapLimit = gaussMapLimit; + + // Setup the convex mesh descriptor + PxConvexMeshDesc desc; + + // We provide points only, therefore the PxConvexFlag::eCOMPUTE_CONVEX flag must be specified + desc.points.data = verts; + desc.points.count = numVerts; + desc.points.stride = sizeof(PxVec3); + desc.flags = PxConvexFlag::eCOMPUTE_CONVEX; + + PxU32 meshSize = 0; + PxConvexMesh* convex = NULL; + + PxU64 startTime = SnippetUtils::getCurrentTimeCounterValue(); + + if(directInsertion) + { + // Directly insert mesh into PhysX + convex = PxCreateConvexMesh(params, desc, gPhysics->getPhysicsInsertionCallback()); + PX_ASSERT(convex); + } + else + { + // Serialize the cooked mesh into a stream. + PxDefaultMemoryOutputStream outStream; + bool res = PxCookConvexMesh(params, desc, outStream); + PX_UNUSED(res); + PX_ASSERT(res); + meshSize = outStream.getSize(); + + // Create the mesh from a stream. + PxDefaultMemoryInputData inStream(outStream.getData(), outStream.getSize()); + convex = gPhysics->createConvexMesh(inStream); + PX_ASSERT(convex); + } + + // Print the elapsed time for comparison + PxU64 stopTime = SnippetUtils::getCurrentTimeCounterValue(); + float elapsedTime = SnippetUtils::getElapsedTimeInMilliseconds(stopTime - startTime); + printf("\t -----------------------------------------------\n"); + printf("\t Create convex mesh with %d triangles: \n", numVerts); + directInsertion ? printf("\t\t Direct mesh insertion enabled\n") : printf("\t\t Direct mesh insertion disabled\n"); + printf("\t\t Gauss map limit: %d \n", gaussMapLimit); + printf("\t\t Created hull number of vertices: %d \n", convex->getNbVertices()); + printf("\t\t Created hull number of polygons: %d \n", convex->getNbPolygons()); + printf("\t Elapsed time in ms: %f \n", double(elapsedTime)); + if (!directInsertion) + { + printf("\t Mesh size: %d \n", meshSize); + } + + convex->release(); +} + +static void createConvexMeshes() +{ + const PxU32 numVerts = 64; + PxVec3* vertices = new PxVec3[numVerts]; + + // Prepare random verts + for(PxU32 i = 0; i < numVerts; i++) + { + vertices[i] = PxVec3(rand(-20.0f, 20.0f), rand(-20.0f, 20.0f), rand(-20.0f, 20.0f)); + } + + // Create convex mesh using the quickhull algorithm with different settings + printf("-----------------------------------------------\n"); + printf("Create convex mesh using the quickhull algorithm: \n\n"); + + // The default convex mesh creation serializing to a stream, useful for offline cooking. + createRandomConvex(numVerts, vertices); + + // The default convex mesh creation without the additional gauss map data. + createRandomConvex(numVerts, vertices); + + // Convex mesh creation inserting the mesh directly into PhysX. + // Useful for runtime cooking. + createRandomConvex(numVerts, vertices); + + // Convex mesh creation inserting the mesh directly into PhysX, without gauss map data. + // Useful for runtime cooking. + createRandomConvex(numVerts, vertices); + + delete [] vertices; +} + +void initPhysics() +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(),true); +} + +void cleanupPhysics() +{ + PX_RELEASE(gPhysics); + PX_RELEASE(gFoundation); + + printf("SnippetConvexMeshCreate done.\n"); +} + + +int snippetMain(int, const char*const*) +{ + initPhysics(); + createConvexMeshes(); + cleanupPhysics(); + + return 0; +} diff --git a/engine/third_party/physx/snippets/snippetcustomconvex/SnippetCustomConvex.cpp b/engine/third_party/physx/snippets/snippetcustomconvex/SnippetCustomConvex.cpp new file mode 100644 index 00000000..6306425f --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcustomconvex/SnippetCustomConvex.cpp @@ -0,0 +1,289 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +// **************************************************************************** +// This snippet shows how to use GJK queries to create custom convex geometry. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "geometry/PxGjkQuery.h" +#include "extensions/PxCustomGeometryExt.h" + +// temporary disable this snippet, cannot work without rendering we cannot include GL directly +#ifdef RENDER_SNIPPET + +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetrender/SnippetRender.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +static PxArray gConvexes; +static PxArray gActors; +struct RenderMesh; +static PxArray gMeshes; + +RenderMesh* createRenderCylinder(float radius, float height, float margin); +RenderMesh* createRenderCone(float height, float radius, float margin); +void destroyRenderMesh(RenderMesh* mesh); +void renderMesh(const RenderMesh& mesh, const PxTransform& pose, bool sleeping); +void renderRaycast(const PxVec3& origin, const PxVec3& unitDir, float maxDist, const PxRaycastHit* hit); +void renderSweepBox(const PxVec3& origin, const PxVec3& unitDir, float maxDist, const PxVec3& halfExtents, const PxSweepHit* hit); +void renderOverlapBox(const PxVec3& origin, const PxVec3& halfExtents, bool hit); + +static PxRigidDynamic* createDynamic(const PxTransform& t, const PxGeometry& geometry, const PxVec3& velocity = PxVec3(0), PxReal density = 1.0f) +{ + PxRigidDynamic* dynamic = PxCreateDynamic(*gPhysics, t, geometry, *gMaterial, density); + dynamic->setLinearVelocity(velocity); + gScene->addActor(*dynamic); + return dynamic; +} + +static void createCylinderActor(float height, float radius, float margin, const PxTransform& pose) +{ + PxCustomGeometryExt::CylinderCallbacks* cylinder = new PxCustomGeometryExt::CylinderCallbacks(height, radius, 0, margin); + gConvexes.pushBack(cylinder); + + PxRigidDynamic* actor = gPhysics->createRigidDynamic(pose); + actor->setActorFlag(PxActorFlag::eVISUALIZATION, true); + + PxShape* shape = PxRigidActorExt::createExclusiveShape(*actor, PxCustomGeometry(*cylinder), *gMaterial); + shape->setFlag(PxShapeFlag::eVISUALIZATION, true); + PxRigidBodyExt::updateMassAndInertia(*actor, 100); + gScene->addActor(*actor); + gActors.pushBack(actor); + + RenderMesh* mesh = createRenderCylinder(height, radius, margin); + gMeshes.pushBack(mesh); +} + +static void createConeActor(float height, float radius, float margin, const PxTransform& pose) +{ + PxCustomGeometryExt::ConeCallbacks* cone = new PxCustomGeometryExt::ConeCallbacks(height, radius, 0, margin); + gConvexes.pushBack(cone); + + PxRigidDynamic* actor = gPhysics->createRigidDynamic(pose); + actor->setActorFlag(PxActorFlag::eVISUALIZATION, true); + + PxShape* shape = PxRigidActorExt::createExclusiveShape(*actor, PxCustomGeometry(*cone), *gMaterial); + shape->setFlag(PxShapeFlag::eVISUALIZATION, true); + PxRigidBodyExt::updateMassAndInertia(*actor, 100); + gScene->addActor(*actor); + gActors.pushBack(actor); + + RenderMesh* mesh = createRenderCone(height, radius, margin); + gMeshes.pushBack(mesh); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport, PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(2); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + gScene = gPhysics->createScene(sceneDesc); + gScene->setVisualizationParameter(PxVisualizationParameter::eCOLLISION_SHAPES, 1.0f); + gScene->setVisualizationParameter(PxVisualizationParameter::eSCALE, 1.0f); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if (pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + // Some custom convexes + float heights[] = { 1.0f, 1.25f, 1.5f, 1.75f }; + float radiuss[] = { 0.3f, 0.35f, 0.4f, 0.45f }; + float margins[] = { 0.0f, 0.05f, 0.1f, 0.15f }; + for (int i = 0; i < 50; ++i) + { + float height = heights[rand() % (sizeof(heights) / sizeof(heights[0]))]; + float raduis = radiuss[rand() % (sizeof(radiuss) / sizeof(radiuss[0]))]; + float margin = margins[rand() % (sizeof(margins) / sizeof(margins[0]))]; + float angle = PX_PIDIV2; + createCylinderActor(height, raduis, margin, (PxTransform(PxVec3(-2.0f, 2.0f + i * 2, 2.0f), PxQuat(angle, PxVec3(0.0f, 0.0f, 1.0f))))); + } + for (int i = 0; i < 50; ++i) + { + float height = heights[rand() % (sizeof(heights) / sizeof(heights[0]))]; + float raduis = radiuss[rand() % (sizeof(radiuss) / sizeof(radiuss[0]))]; + float margin = margins[rand() % (sizeof(margins) / sizeof(margins[0]))]; + float angle = PX_PIDIV2; + createConeActor(height, raduis, margin, (PxTransform(PxVec3(2.0f, 2.0f + i * 2, -2.0f), PxQuat(angle, PxVec3(0, 0, 1))))); + } + + // Ground plane + PxRigidStatic* planeActor = gPhysics->createRigidStatic(PxTransform(PxQuat(PX_PIDIV2, PxVec3(0.0f, 0.0f, 1.0f)))); + PxRigidActorExt::createExclusiveShape(*planeActor, PxPlaneGeometry(), *gMaterial); + gScene->addActor(*planeActor); +} + +void debugRender() +{ + for (int i = 0; i < int(gConvexes.size()); ++i) + { + PxRigidActor* actor = gActors[i]; + RenderMesh* mesh = gMeshes[i]; + renderMesh(*mesh, actor->getGlobalPose(), !actor->is() || actor->is()->isSleeping()); + } + + int count = 20; + for (int i = 0; i < count; ++i) + { + float x = -count / 2.0f; + PxVec3 origin(x + i, 0.5f, x); + PxVec3 unitDir(0, 0, 1); + float maxDist = (float)count; + PxRaycastBuffer buffer; + gScene->raycast(origin, unitDir, maxDist, buffer); + renderRaycast(origin, unitDir, maxDist, buffer.hasBlock ? &buffer.block : nullptr); + } + for (int i = 0; i < count; ++i) + { + float x = -count / 2.0f; + PxVec3 origin(x, 0.5f, x + i); + PxVec3 unitDir(1, 0, 0); + float maxDist = (float)count; + PxVec3 halfExtents(0.2f, 0.1f, 0.4f); + PxSweepBuffer buffer; + gScene->sweep(PxBoxGeometry(halfExtents), PxTransform(origin), unitDir, maxDist, buffer); + renderSweepBox(origin, unitDir, maxDist, halfExtents, buffer.hasBlock ? &buffer.block : nullptr); + } + for (int i = 0; i < count; ++i) + { + float x = -count / 2.0f; + for (int j = 0; j < count; ++j) + { + PxVec3 origin(x + i, 0.0f, x + j); + PxVec3 halfExtents(0.4f, 0.1f, 0.4f); + PxOverlapBuffer buffer; + gScene->overlap(PxBoxGeometry(halfExtents), PxTransform(origin), buffer, PxQueryFilterData(PxQueryFlag::eANY_HIT | PxQueryFlag::eDYNAMIC)); + renderOverlapBox(origin, halfExtents, buffer.hasAnyHits()); + } + } +} + +void stepPhysics(bool /*interactive*/) +{ + gScene->simulate(1.0f / 60.0f); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) +{ + while (!gConvexes.empty()) + { + delete gConvexes.back(); + gConvexes.popBack(); + } + gConvexes.reset(); + + while (!gMeshes.empty()) + { + destroyRenderMesh(gMeshes.back()); + gMeshes.popBack(); + } + gMeshes.reset(); + + while (!gActors.empty()) + { + PX_RELEASE(gActors.back()); + gActors.popBack(); + } + gActors.reset(); + + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if (gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetCustomConvex done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& camera) +{ + switch (toupper(key)) + { + case ' ': createDynamic(camera, PxSphereGeometry(1.0f), camera.rotate(PxVec3(0, 0, -1)) * 100, 3.0f); break; + } +} + +int snippetMain(int, const char* const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for (PxU32 i = 0; i < frameCount; i++) + stepPhysics(false); + cleanupPhysics(false); +#endif + + return 0; +} + +#else +int snippetMain(int, const char* const*) +{ + return 0; +} + +#endif + diff --git a/engine/third_party/physx/snippets/snippetcustomconvex/SnippetCustomConvexRender.cpp b/engine/third_party/physx/snippets/snippetcustomconvex/SnippetCustomConvexRender.cpp new file mode 100644 index 00000000..6c71b75b --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcustomconvex/SnippetCustomConvexRender.cpp @@ -0,0 +1,471 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +#ifdef RENDER_SNIPPET + +#include "PxPhysicsAPI.h" + +#include "../snippetrender/SnippetRender.h" +#include "../snippetrender/SnippetCamera.h" + +using namespace physx; + +extern void initPhysics(bool interactive); +extern void stepPhysics(bool interactive); +extern void cleanupPhysics(bool interactive); +extern void keyPress(unsigned char key, const PxTransform& camera); +extern void debugRender(); + +namespace +{ + Snippets::Camera* sCamera; + + void renderCallback() + { + stepPhysics(true); + + Snippets::startRender(sCamera); + + PxScene* scene; + PxGetPhysics().getScenes(&scene, 1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if (nbActors) + { + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + + debugRender(); + + Snippets::finishRender(); + } + + void exitCallback() + { + delete sCamera; + cleanupPhysics(true); + } +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(-20.0f, 20.0f, -20.0f), PxVec3(0.6f, -0.4f, 0.6f)); + + Snippets::setupDefault("PhysX Snippet CustomConvex", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} + +struct RenderMesh +{ + PxArray positions, normals; +}; + +RenderMesh* createRenderCylinder(float height, float radius, float margin) +{ + struct InternalRenderHelper + { + InternalRenderHelper(float height_, float radius_, float margin_) + : + height(height_), radius(radius_), margin(margin_) + { + mesh = new RenderMesh(); + halfHeight = height * 0.5f; + sides = (int)ceilf(6.2832f / (2 * acosf((radius - err) / radius))); + step = 6.2832f / sides; + } + + float height, radius, margin; + RenderMesh* mesh; + + PxArray positions; + PxArray normals; + + float halfHeight; + + float err = 0.001f; + + int sides; + float step; + + void addVertex(int index) + { + mesh->positions.pushBack(positions[index]); + mesh->normals.pushBack(normals[index]); + } + + void addTop(const PxVec3& p0, const PxVec3& n0, const PxVec3& p1, const PxVec3& n1, const PxVec3& ax) + { + int base = int(positions.size()); + positions.pushBack(p0); + normals.pushBack(n0); + for (int i = 0; i < sides; ++i) + { + positions.pushBack(PxQuat(i * step, ax).rotate(p1)); + normals.pushBack(PxQuat(i * step, ax).rotate(n1)); + } + for (int i = 0; i < sides; ++i) + { + addVertex(base); + addVertex(base + 1 + i); + addVertex(base + 1 + (i + 1) % sides); + } + } + + void addRing(const PxVec3& p0, const PxVec3& n0, const PxVec3& ax) + { + int base = int(positions.size()); + for (int i = 0; i < sides; ++i) + { + positions.pushBack(PxQuat(i * step, ax).rotate(p0)); + normals.pushBack(PxQuat(i * step, ax).rotate(n0)); + } + for (int i = 0; i < sides; ++i) + { + addVertex(base - sides + i); + addVertex(base + i); + addVertex(base - sides + (i + 1) % sides); + addVertex(base - sides + (i + 1) % sides); + addVertex(base + i); + addVertex(base + (i + 1) % sides); + } + } + + void addBottom(const PxVec3& p0, const PxVec3& n0, const PxVec3& /*ax*/) + { + int base = int(positions.size()); + positions.pushBack(p0); + normals.pushBack(n0); + for (int i = 0; i < sides; ++i) + { + addVertex(base - sides + i); + addVertex(base); + addVertex(base - sides + (i + 1) % sides); + } + } + + void run() + { + int sides2 = margin > 0 ? (int)ceilf(1.5708f / (2 * acosf((margin - err) / margin))) : 1; + float step2 = 1.5708f / sides2; + + addTop(PxVec3(halfHeight + margin, 0, 0), PxVec3(1, 0, 0), PxVec3(halfHeight + margin, radius, 0), PxVec3(1, 0, 0), PxVec3(1, 0, 0)); + + for (int i = 1; i <= sides2; ++i) + { + PxVec3 n = PxQuat(i * step2, PxVec3(0, 0, 1)).rotate(PxVec3(1, 0, 0)); + addRing(PxVec3(halfHeight, radius, 0) + n * margin, n, PxVec3(1, 0, 0)); + } + + for (int i = 0; i <= sides2; ++i) + { + PxVec3 n = PxQuat(i * step2, PxVec3(0, 0, 1)).rotate(PxVec3(0, 1, 0)); + addRing(PxVec3(-halfHeight, radius, 0) + n * margin, n, PxVec3(1, 0, 0)); + } + + addBottom(PxVec3(-halfHeight - margin, 0, 0), PxVec3(-1, 0, 0), PxVec3(1, 0, 0)); + } + }; + + InternalRenderHelper renderHelper(height, radius, margin); + + renderHelper.run(); + + return renderHelper.mesh; +} + +RenderMesh* createRenderCone(float height, float radius, float margin) +{ + struct InternalRenderHelper + { + InternalRenderHelper(float height_, float radius_, float margin_) + : + height(height_), radius(radius_), margin(margin_) + { + mesh = new RenderMesh(); + + halfHeight = height * 0.5f; + + sides = (int)ceilf(6.2832f / (2 * acosf(((radius + margin) - err) / (radius + margin)))); + step = 6.2832f / sides; + } + + float height, radius, margin; + RenderMesh* mesh; + + PxArray positions; + PxArray normals; + + float halfHeight; + + float err = 0.001f; + + int sides; + float step; + + void addVertex(int index) + { + mesh->positions.pushBack(positions[index]); + mesh->normals.pushBack(normals[index]); + } + + void addTop(const PxVec3& p0, const PxVec3& n0, const PxVec3& p1, const PxVec3& n1, const PxVec3& ax) + { + int base = int(positions.size()); + positions.pushBack(p0); + normals.pushBack(n0); + for (int i = 0; i < sides; ++i) + { + positions.pushBack(PxQuat(i * step, ax).rotate(p1)); + normals.pushBack(PxQuat(i * step, ax).rotate(n1)); + } + for (int i = 0; i < sides; ++i) + { + addVertex(base); + addVertex(base + 1 + i); + addVertex(base + 1 + (i + 1) % sides); + } + } + + void addRing(const PxVec3& p0, const PxVec3& n0, const PxVec3& ax) + { + int base = int(positions.size()); + for (int i = 0; i < sides; ++i) + { + positions.pushBack(PxQuat(i * step, ax).rotate(p0)); + normals.pushBack(PxQuat(i * step, ax).rotate(n0)); + } + for (int i = 0; i < sides; ++i) + { + addVertex(base - sides + i); + addVertex(base + i); + addVertex(base - sides + (i + 1) % sides); + addVertex(base - sides + (i + 1) % sides); + addVertex(base + i); + addVertex(base + (i + 1) % sides); + } + } + + void addBottom(const PxVec3& p0, const PxVec3& n0, const PxVec3& /*ax*/) + { + int base = int(positions.size()); + positions.pushBack(p0); + normals.pushBack(n0); + for (int i = 0; i < sides; ++i) + { + addVertex(base - sides + i); + addVertex(base); + addVertex(base - sides + (i + 1) % sides); + } + } + + void run() + { + addTop(PxVec3(halfHeight + margin, 0, 0), PxVec3(1, 0, 0), PxVec3(halfHeight + margin, 0, 0), PxVec3(1, 0, 0), PxVec3(1, 0, 0)); + + float cosAlph = radius / sqrtf(height * height + radius * radius); + float alph = acosf(cosAlph); + int sides2 = margin > 0 ? (int)ceilf(alph / (2 * acosf((margin - err) / margin))) : 1; + float step2 = alph / sides2; + + for (int i = 1; i <= sides2; ++i) + { + PxVec3 n = PxQuat(i * step2, PxVec3(0, 0, 1)).rotate(PxVec3(1, 0, 0)); + addRing(PxVec3(halfHeight, 0, 0) + n * margin, n, PxVec3(1, 0, 0)); + } + + sides2 = margin > 0 ? (int)ceilf((3.1416f - alph) / (2 * acosf((margin - err) / margin))) : 1; + step2 = (3.1416f - alph) / sides2; + + for (int i = 0; i <= sides2; ++i) + { + PxVec3 n = PxQuat(alph + i * step2, PxVec3(0, 0, 1)).rotate(PxVec3(1, 0, 0)); + addRing(PxVec3(-halfHeight, radius, 0) + n * margin, n, PxVec3(1, 0, 0)); + } + + addBottom(PxVec3(-halfHeight - margin, 0, 0), PxVec3(-1, 0, 0), PxVec3(1, 0, 0)); + } + }; + + InternalRenderHelper renderHelper(height, radius, margin); + renderHelper.run(); + + return renderHelper.mesh; +} + +void destroyRenderMesh(RenderMesh* mesh) +{ + delete mesh; +} + +void renderMesh(const RenderMesh& mesh, const PxTransform& pose, bool sleeping) +{ + const PxVec3 color(1.0f, 0.5f, 0.25f); + const PxMat44 shapePose(pose); + + glPushMatrix(); + glMultMatrixf(&shapePose.column0.x); + if (sleeping) + { + const PxVec3 darkColor = color * 0.25f; + glColor4f(darkColor.x, darkColor.y, darkColor.z, 1.0f); + } + else + { + glColor4f(color.x, color.y, color.z, 1.0f); + } + + glEnableClientState(GL_NORMAL_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 3 * sizeof(float), mesh.positions.begin()); + glNormalPointer(GL_FLOAT, 3 * sizeof(float), mesh.normals.begin()); + glDrawArrays(GL_TRIANGLES, 0, int(mesh.positions.size())); + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_NORMAL_ARRAY); + + glPopMatrix(); + + bool shadows = true; + + if (shadows) + { + const PxVec3 shadowDir(0.0f, -0.7071067f, -0.7071067f); + const PxReal shadowMat[] = { 1,0,0,0, -shadowDir.x / shadowDir.y,0,-shadowDir.z / shadowDir.y,0, 0,0,1,0, 0,0,0,1 }; + + glPushMatrix(); + glMultMatrixf(shadowMat); + glMultMatrixf(&shapePose.column0.x); + glDisable(GL_LIGHTING); + //glColor4f(0.1f, 0.2f, 0.3f, 1.0f); + glColor4f(0.1f, 0.1f, 0.1f, 1.0f); + + glEnableClientState(GL_NORMAL_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 3 * sizeof(float), mesh.positions.begin()); + glNormalPointer(GL_FLOAT, 3 * sizeof(float), mesh.normals.begin()); + glDrawArrays(GL_TRIANGLES, 0, int(mesh.positions.size())); + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_NORMAL_ARRAY); + + glEnable(GL_LIGHTING); + glPopMatrix(); + } + +} + +static void PxVertex3f(const PxVec3& v) { ::glVertex3f(v.x, v.y, v.z); }; +static void PxScalef(const PxVec3& v) { ::glScalef(v.x, v.y, v.z); }; + +void renderRaycast(const PxVec3& origin, const PxVec3& unitDir, float maxDist, const PxRaycastHit* hit) +{ + glDisable(GL_LIGHTING); + if (hit) + { + glColor4f(1.0f, 0.0f, 0.0f, 1.0f); + glBegin(GL_LINES); + PxVertex3f(origin); + PxVertex3f(origin + unitDir * hit->distance); + PxVertex3f(hit->position); + PxVertex3f(hit->position + hit->normal); + glEnd(); + } + else + { + glColor4f(0.6f, 0.0f, 0.0f, 1.0f); + glBegin(GL_LINES); + PxVertex3f(origin); + PxVertex3f(origin + unitDir * maxDist); + glEnd(); + } + glEnable(GL_LIGHTING); +} + +void renderSweepBox(const PxVec3& origin, const PxVec3& unitDir, float maxDist, const PxVec3& halfExtents, const PxSweepHit* hit) +{ + glDisable(GL_LIGHTING); + if (hit) + { + glColor4f(0.0f, 0.6f, 0.0f, 1.0f); + glBegin(GL_LINES); + PxVertex3f(origin); + PxVertex3f(origin + unitDir * hit->distance); + PxVertex3f(hit->position); + PxVertex3f(hit->position + hit->normal); + glEnd(); + PxTransform boxPose(origin + unitDir * hit->distance); + PxMat44 boxMat(boxPose); + glPushMatrix(); + glMultMatrixf(&boxMat.column0.x); + PxScalef(halfExtents * 2); + glutWireCube(1); + glPopMatrix(); + } + else + { + glColor4f(0.0f, 0.3f, 0.0f, 1.0f); + glBegin(GL_LINES); + PxVertex3f(origin); + PxVertex3f(origin + unitDir * maxDist); + glEnd(); + } + glEnable(GL_LIGHTING); +} + +void renderOverlapBox(const PxVec3& origin, const PxVec3& halfExtents, bool hit) +{ + glDisable(GL_LIGHTING); + if (hit) + { + glColor4f(0.0f, 0.0f, 1.0f, 1.0f); + PxTransform boxPose(origin); + PxMat44 boxMat(boxPose); + glPushMatrix(); + glMultMatrixf(&boxMat.column0.x); + PxScalef(halfExtents * 2); + glutWireCube(1); + glPopMatrix(); + } + else + { + glColor4f(0.0f, 0.0f, 0.6f, 1.0f); + PxTransform boxPose(origin); + PxMat44 boxMat(boxPose); + glPushMatrix(); + glMultMatrixf(&boxMat.column0.x); + PxScalef(halfExtents * 2); + glutWireCube(1); + glPopMatrix(); + } + glEnable(GL_LIGHTING); +} + +#endif diff --git a/engine/third_party/physx/snippets/snippetcustomgeometry/SnippetCustomGeometry.cpp b/engine/third_party/physx/snippets/snippetcustomgeometry/SnippetCustomGeometry.cpp new file mode 100644 index 00000000..42c91cbf --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcustomgeometry/SnippetCustomGeometry.cpp @@ -0,0 +1,326 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet shows how to use custom geometries in PhysX. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" + +// temporary disable this snippet, cannot work without rendering we cannot include GL directly +#ifdef RENDER_SNIPPET + +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetrender/SnippetRender.h" + +#include "VoxelMap.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +static PxRigidStatic* gActor = NULL; + +static const int gVoxelMapDim = 20; +static const float gVoxelMapSize = 80.0f; +static VoxelMap* gVoxelMap; + +static PxArray gVertices; +static PxArray gIndices; +static PxU32 gVertexCount; +static PxU32 gIndexCount; +static PxGeometryHolder gVoxelGeometryHolder; +static const PxU32 gVertexOrder[12] = { + 0, 2, 1, 2, 3, 1, + 0, 1, 2, 2, 1, 3 +}; + +PX_INLINE void cookVoxelFace(bool reverseWinding) { + for (int i = 0; i < 6; ++i) { + gIndices[gIndexCount + i] = gVertexCount + gVertexOrder[i + (reverseWinding ? 6 : 0)]; + } + gVertexCount += 4; + gIndexCount += 6; +} + +void cookVoxelMesh() { + + int faceCount = 0; + gVertexCount = 0; + gIndexCount = 0; + + float vx[2] = {gVoxelMap->voxelSize().x * -0.5f, gVoxelMap->voxelSize().x * 0.5f}; + float vy[2] = {gVoxelMap->voxelSize().y * -0.5f, gVoxelMap->voxelSize().y * 0.5f}; + float vz[2] = {gVoxelMap->voxelSize().z * -0.5f, gVoxelMap->voxelSize().z * 0.5f}; + + for (int x = 0; x < gVoxelMap->dimX(); ++x) + for (int y = 0; y < gVoxelMap->dimY(); ++y) + for (int z = 0; z < gVoxelMap->dimZ(); ++z) + if (gVoxelMap->voxel(x, y, z)) + { + if (!gVoxelMap->voxel(x+1, y, z)) {faceCount++;} + if (!gVoxelMap->voxel(x-1, y, z)) {faceCount++;} + if (!gVoxelMap->voxel(x, y+1, z)) {faceCount++;} + if (!gVoxelMap->voxel(x, y-1, z)) {faceCount++;} + if (!gVoxelMap->voxel(x, y, z+1)) {faceCount++;} + if (!gVoxelMap->voxel(x, y, z-1)) {faceCount++;} + } + + gVertices.resize(faceCount*4); + gIndices.resize(faceCount*6); + + for (int x = 0; x < gVoxelMap->dimX(); ++x) + { + for (int y = 0; y < gVoxelMap->dimY(); ++y) + { + for (int z = 0; z < gVoxelMap->dimZ(); ++z) + { + PxVec3 voxelPos = gVoxelMap->voxelPos(x, y, z); + + if (gVoxelMap->voxel(x, y, z)) + { + if (!gVoxelMap->voxel(x+1, y, z)) { + gVertices[gVertexCount + 0] = voxelPos + PxVec3(vx[1], vy[0], vz[0]); + gVertices[gVertexCount + 1] = voxelPos + PxVec3(vx[1], vy[0], vz[1]); + gVertices[gVertexCount + 2] = voxelPos + PxVec3(vx[1], vy[1], vz[0]); + gVertices[gVertexCount + 3] = voxelPos + PxVec3(vx[1], vy[1], vz[1]); + cookVoxelFace(false); + } + if (!gVoxelMap->voxel(x-1, y, z)) { + gVertices[gVertexCount + 0] = voxelPos + PxVec3(vx[0], vy[0], vz[0]); + gVertices[gVertexCount + 1] = voxelPos + PxVec3(vx[0], vy[0], vz[1]); + gVertices[gVertexCount + 2] = voxelPos + PxVec3(vx[0], vy[1], vz[0]); + gVertices[gVertexCount + 3] = voxelPos + PxVec3(vx[0], vy[1], vz[1]); + cookVoxelFace(true); + } + if (!gVoxelMap->voxel(x, y+1, z)) { + gVertices[gVertexCount + 0] = voxelPos + PxVec3(vx[0], vy[1], vz[0]); + gVertices[gVertexCount + 1] = voxelPos + PxVec3(vx[0], vy[1], vz[1]); + gVertices[gVertexCount + 2] = voxelPos + PxVec3(vx[1], vy[1], vz[0]); + gVertices[gVertexCount + 3] = voxelPos + PxVec3(vx[1], vy[1], vz[1]); + cookVoxelFace(true); + } + if (!gVoxelMap->voxel(x, y-1, z)) { + gVertices[gVertexCount + 0] = voxelPos + PxVec3(vx[0], vy[0], vz[0]); + gVertices[gVertexCount + 1] = voxelPos + PxVec3(vx[0], vy[0], vz[1]); + gVertices[gVertexCount + 2] = voxelPos + PxVec3(vx[1], vy[0], vz[0]); + gVertices[gVertexCount + 3] = voxelPos + PxVec3(vx[1], vy[0], vz[1]); + cookVoxelFace(false); + } + if (!gVoxelMap->voxel(x, y, z+1)) { + gVertices[gVertexCount + 0] = voxelPos + PxVec3(vx[0], vy[0], vz[1]); + gVertices[gVertexCount + 1] = voxelPos + PxVec3(vx[0], vy[1], vz[1]); + gVertices[gVertexCount + 2] = voxelPos + PxVec3(vx[1], vy[0], vz[1]); + gVertices[gVertexCount + 3] = voxelPos + PxVec3(vx[1], vy[1], vz[1]); + cookVoxelFace(false); + } + if (!gVoxelMap->voxel(x, y, z-1)) { + gVertices[gVertexCount + 0] = voxelPos + PxVec3(vx[0], vy[0], vz[0]); + gVertices[gVertexCount + 1] = voxelPos + PxVec3(vx[0], vy[1], vz[0]); + gVertices[gVertexCount + 2] = voxelPos + PxVec3(vx[1], vy[0], vz[0]); + gVertices[gVertexCount + 3] = voxelPos + PxVec3(vx[1], vy[1], vz[0]); + cookVoxelFace(true); + } + } + } + } + } + + const PxTolerancesScale scale; + PxCookingParams params(scale); + params.midphaseDesc.setToDefault(PxMeshMidPhase::eBVH34); + params.meshPreprocessParams |= PxMeshPreprocessingFlag::eDISABLE_ACTIVE_EDGES_PRECOMPUTE; + params.meshPreprocessParams |= PxMeshPreprocessingFlag::eDISABLE_CLEAN_MESH; + PxTriangleMeshDesc triangleMeshDesc; + triangleMeshDesc.points.count = gVertexCount; + triangleMeshDesc.points.data = gVertices.begin(); + triangleMeshDesc.points.stride = sizeof(PxVec3); + triangleMeshDesc.triangles.count = gIndexCount / 3; + triangleMeshDesc.triangles.data = gIndices.begin(); + triangleMeshDesc.triangles.stride = 3 * sizeof(PxU32); + PxTriangleMesh* gTriangleMesh = PxCreateTriangleMesh(params, triangleMeshDesc); + gVoxelGeometryHolder.storeAny( PxTriangleMeshGeometry(gTriangleMesh) ); +} + +static PxRigidDynamic* createDynamic(const PxTransform& t, const PxGeometry& geometry, const PxVec3& velocity = PxVec3(0), PxReal density = 1.0f) +{ + PxRigidDynamic* dynamic = PxCreateDynamic(*gPhysics, t, geometry, *gMaterial, density); + dynamic->setLinearVelocity(velocity); + gScene->addActor(*dynamic); + return dynamic; +} + +static void createStack(const PxTransform& t, PxU32 size, PxReal halfExtent) +{ + PxShape* shape = gPhysics->createShape(PxBoxGeometry(halfExtent, halfExtent, halfExtent), *gMaterial); + for (PxU32 i = 0; i < size; i++) + { + for (PxU32 j = 0; j < size - i; j++) + { + PxTransform localTm(PxVec3(PxReal(j * 2) - PxReal(size - i), PxReal(i * 2 + 1), 0) * halfExtent); + PxRigidDynamic* body = gPhysics->createRigidDynamic(t.transform(localTm)); + body->attachShape(*shape); + PxRigidBodyExt::updateMassAndInertia(*body, 10.0f); + gScene->addActor(*body); + } + } + shape->release(); +} + +void initVoxelMap() +{ + gVoxelMap = PX_NEW(VoxelMap); + gVoxelMap->setDimensions(gVoxelMapDim, gVoxelMapDim, gVoxelMapDim); + gVoxelMap->setVoxelSize(gVoxelMapSize / gVoxelMapDim, gVoxelMapSize / gVoxelMapDim, gVoxelMapSize / gVoxelMapDim); + gVoxelMap->setWaveVoxels(); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport, PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(2); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + gScene = gPhysics->createScene(sceneDesc); + gScene->setVisualizationParameter(PxVisualizationParameter::eCOLLISION_SHAPES, 1.0f); + gScene->setVisualizationParameter(PxVisualizationParameter::eSCALE, 1.0f); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if (pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + // Create voxel map actor + initVoxelMap(); + PxRigidStatic* voxelMapActor = gPhysics->createRigidStatic(PxTransform(PxVec3(0, gVoxelMapSize * 0.5f, 0))); + PxShape* shape = PxRigidActorExt::createExclusiveShape(*voxelMapActor, PxCustomGeometry(*gVoxelMap), *gMaterial); + shape->setFlag(PxShapeFlag::eVISUALIZATION, true); + gScene->addActor(*voxelMapActor); + gActor = voxelMapActor; + gActor->setActorFlag(PxActorFlag::eVISUALIZATION, true); + + // Ground plane + PxRigidStatic* planeActor = gPhysics->createRigidStatic(PxTransform(PxQuat(PX_PIDIV2, PxVec3(0, 0, 1)))); + PxRigidActorExt::createExclusiveShape(*planeActor, PxPlaneGeometry(), *gMaterial); + gScene->addActor(*planeActor); + + gScene->setVisualizationParameter(PxVisualizationParameter::eSCALE, 1.f); + gScene->setVisualizationParameter(PxVisualizationParameter::eCOLLISION_SHAPES, 1.0f); + + createStack(PxTransform(PxVec3(0, 22, 0)), 10, 2.0f); + + cookVoxelMesh(); +} + +void debugRender() +{ + PxTransform pose = gActor->getGlobalPose(); + Snippets::renderGeoms(1, &gVoxelGeometryHolder, &pose, false, PxVec3(0.5f)); +} + +void stepPhysics(bool /*interactive*/) +{ + gScene->simulate(1.0f / 60.0f); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_DELETE(gVoxelMap); + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + gVertices.reset(); + gIndices.reset(); + if (gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetCustomGeometry done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& camera) +{ + switch (toupper(key)) + { + case ' ': createDynamic(camera, PxSphereGeometry(3.0f), camera.rotate(PxVec3(0, 0, -1)) * 200, 3.0f); break; + } +} + +int snippetMain(int, const char* const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for (PxU32 i = 0; i < frameCount; i++) + stepPhysics(false); + cleanupPhysics(false); +#endif + + return 0; +} + +#else +int snippetMain(int, const char* const*) +{ + return 0; +} + +#endif + diff --git a/engine/third_party/physx/snippets/snippetcustomgeometry/SnippetCustomGeometryRender.cpp b/engine/third_party/physx/snippets/snippetcustomgeometry/SnippetCustomGeometryRender.cpp new file mode 100644 index 00000000..f5c78775 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcustomgeometry/SnippetCustomGeometryRender.cpp @@ -0,0 +1,87 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#ifdef RENDER_SNIPPET + +#include "PxPhysicsAPI.h" + +#include "../snippetrender/SnippetRender.h" +#include "../snippetrender/SnippetCamera.h" + +using namespace physx; + +extern void initPhysics(bool interactive); +extern void stepPhysics(bool interactive); +extern void cleanupPhysics(bool interactive); +extern void keyPress(unsigned char key, const PxTransform& camera); +extern void debugRender(); + +namespace +{ + Snippets::Camera* sCamera; + + void renderCallback() + { + stepPhysics(true); + + Snippets::startRender(sCamera); + + PxScene* scene; + PxGetPhysics().getScenes(&scene, 1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if (nbActors) + { + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + + debugRender(); + + Snippets::finishRender(); + } + + void exitCallback() + { + delete sCamera; + cleanupPhysics(true); + } +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(50.0f, 50.0f, 50.0f), PxVec3(-0.6f, -0.2f, -0.7f)); + + Snippets::setupDefault("PhysX Snippet CustomGeometry", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetcustomgeometry/VoxelMap.cpp b/engine/third_party/physx/snippets/snippetcustomgeometry/VoxelMap.cpp new file mode 100644 index 00000000..a9f90033 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcustomgeometry/VoxelMap.cpp @@ -0,0 +1,445 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +#include "collision/PxCollisionDefs.h" +#include "PxImmediateMode.h" +#include "VoxelMap.h" +#include "common/PxRenderOutput.h" +#include "geomutils/PxContactBuffer.h" + +using namespace physx; + +void VoxelMap::setDimensions(int x, int y, int z) +{ + m_dimensions[0] = x; m_dimensions[1] = y; m_dimensions[2] = z; + m_packs.resize(size_t(pacsX()) * size_t(pacsY()) * size_t(pacsZ()), 0U); +} + +int VoxelMap::dimX() const +{ + return m_dimensions[0]; +} + +int VoxelMap::dimY() const +{ + return m_dimensions[1]; +} + +int VoxelMap::dimZ() const +{ + return m_dimensions[2]; +} + +int VoxelMap::pacsX() const +{ + return (dimX() + 3) / 4; +} + +int VoxelMap::pacsY() const +{ + return (dimY() + 3) / 4; +} + +int VoxelMap::pacsZ() const +{ + return (dimZ() + 3) / 4; +} + +PxVec3 VoxelMap::extents() const +{ + return PxVec3(dimX() * voxelSizeX(), dimY() * voxelSizeY(), dimZ() * voxelSizeZ()); +} + +void VoxelMap::setVoxelSize(float x, float y, float z) +{ + m_voxelSize = PxVec3(x, y, z); +} + +const PxVec3& VoxelMap::voxelSize() const +{ + return m_voxelSize; +} + +float VoxelMap::voxelSizeX() const +{ + return m_voxelSize.x; +} + +float VoxelMap::voxelSizeY() const +{ + return m_voxelSize.y; +} + +float VoxelMap::voxelSizeZ() const +{ + return m_voxelSize.z; +} + +void VoxelMap::setVoxel(int x, int y, int z, bool yes) +{ + if (x < 0 || x >= int(dimX()) || y < 0 || y >= int(dimY()) || z < 0 || z >= int(dimZ())) + return; + + int px = x / 4, py = y / 4, pz = z / 4; + int bx = x & 3, by = y & 3, bz = z & 3; + PxU64& p = m_packs[px + py * size_t(pacsX()) + pz * size_t(pacsX()) * size_t(pacsY())]; + if (yes) p |= (PxU64(1) << (bx + by * 4 + bz * 16)); + else p &= ~(PxU64(1) << (bx + by * 4 + bz * 16)); +} + +bool VoxelMap::voxel(int x, int y, int z) const +{ + if (x < 0 || x >= int(dimX()) || y < 0 || y >= int(dimY()) || z < 0 || z >= int(dimZ())) + return false; + + int px = x / 4, py = y / 4, pz = z / 4; + int bx = x & 3, by = y & 3, bz = z & 3; + PxU64 p = m_packs[px + py * size_t(pacsX()) + pz * size_t(pacsX()) * size_t(pacsY())]; + return (p & (PxU64(1) << (bx + by * 4 + bz * 16))) != 0; +} + +void VoxelMap::clearVoxels() +{ + memset(&m_packs[0], 0, m_packs.size() * sizeof(PxU64)); +} + +void VoxelMap::setFloorVoxels(int layers) +{ + for (int x = 0; x < dimX(); ++x) + for (int y = 0; y < layers; ++y) + for (int z = 0; z < dimZ(); ++z) + setVoxel(x, y, z); +} + +void VoxelMap::setWaveVoxels() +{ + PxVec3 ext = extents(); + for (int x = 0; x < dimX(); ++x) + for (int y = 0; y < dimY(); ++y) + for (int z = 0; z < dimZ(); ++z) + { + PxVec3 pos = voxelPos(x, y, z); + float a = sqrtf((pos.x / ext.x) * (pos.x / ext.x) + (pos.z / ext.z) * (pos.z / ext.z)); + if (a * 0.5f > pos.y / ext.y + 0.4f) + setVoxel(x, y, z); + } +} + +void VoxelMap::voxelize(const PxGeometry& geom, const PxTransform& pose, bool add) +{ + PxBounds3 bounds; PxGeometryQuery::computeGeomBounds(bounds, geom, pose); + int sx, sy, sz, ex, ey, ez; + getVoxelRegion(bounds, sx, sy, sz, ex, ey, ez); + for (int x = sx; x <= ex; ++x) + for (int y = sy; y <= ey; ++y) + for (int z = sz; z <= ez; ++z) + if (voxel(x, y, z)) + { + if (!add && PxGeometryQuery::pointDistance(voxelPos(x, y, z), geom, pose) == 0) + setVoxel(x, y, z, false); + } + else + { + if (add && PxGeometryQuery::pointDistance(voxelPos(x, y, z), geom, pose) == 0) + setVoxel(x, y, z); + } + +} + +PxVec3 VoxelMap::voxelPos(int x, int y, int z) const +{ + return PxVec3((x + 0.5f) * voxelSizeX(), (y + 0.5f) * voxelSizeY(), (z + 0.5f) * voxelSizeZ()) - extents() * 0.5f; +} + +void VoxelMap::pointCoords(const PxVec3& p, int& x, int& y, int& z) const +{ + PxVec3 l = p + extents() * 0.5f, s = voxelSize(); + x = int(PxFloor(l.x / s.x)); + y = int(PxFloor(l.y / s.y)); + z = int(PxFloor(l.z / s.z)); +} + +void VoxelMap::getVoxelRegion(const PxBounds3& b, int& sx, int& sy, int& sz, int& ex, int& ey, int& ez) const +{ + pointCoords(b.minimum, sx, sy, sz); + pointCoords(b.maximum, ex, ey, ez); +} + +// physx::PxCustomGeometry::Callbacks overrides + +IMPLEMENT_CUSTOM_GEOMETRY_TYPE(VoxelMap) + +PxBounds3 VoxelMap::getLocalBounds(const PxGeometry&) const +{ + return PxBounds3::centerExtents(PxVec3(0), extents()); +} + +bool VoxelMap::generateContacts(const PxGeometry& /*geom0*/, const PxGeometry& geom1, const PxTransform& pose0, const PxTransform& pose1, + const PxReal contactDistance, const PxReal meshContactMargin, const PxReal toleranceLength, + PxContactBuffer& contactBuffer) const +{ + PxBoxGeometry voxelGeom(voxelSize() * 0.5f); + PxGeometry* pGeom0 = &voxelGeom; + + const PxGeometry* pGeom1 = &geom1; + PxTransform pose1in0 = pose0.transformInv(pose1); + PxBounds3 bounds1; PxGeometryQuery::computeGeomBounds(bounds1, geom1, pose1in0, contactDistance); + + struct ContactRecorder : immediate::PxContactRecorder + { + PxContactBuffer* contactBuffer; + ContactRecorder(PxContactBuffer& _contactBuffer) : contactBuffer(&_contactBuffer) {} + virtual bool recordContacts(const PxContactPoint* contactPoints, PxU32 nbContacts, PxU32 /*index*/) + { + for (PxU32 i = 0; i < nbContacts; ++i) + contactBuffer->contact(contactPoints[i]); + return true; + } + } + contactRecorder(contactBuffer); + + PxCache contactCache; + + struct ContactCacheAllocator : PxCacheAllocator + { + PxU8 buffer[1024]; + ContactCacheAllocator() { memset(buffer, 0, sizeof(buffer)); } + virtual PxU8* allocateCacheData(const PxU32 /*byteSize*/) { return reinterpret_cast(size_t(buffer + 0xf) & ~0xf); } + } + contactCacheAllocator; + + int sx, sy, sz, ex, ey, ez; + getVoxelRegion(bounds1, sx, sy, sz, ex, ey, ez); + for (int x = sx; x <= ex; ++x) + for (int y = sy; y <= ey; ++y) + for (int z = sz; z <= ez; ++z) + if (voxel(x, y, z)) + { + PxTransform p0 = pose0.transform(PxTransform(voxelPos(x, y, z))); + immediate::PxGenerateContacts(&pGeom0, &pGeom1, &p0, &pose1, &contactCache, 1, contactRecorder, + contactDistance, meshContactMargin, toleranceLength, contactCacheAllocator); + } + + return true; +} + +PxU32 VoxelMap::raycast(const PxVec3& origin, const PxVec3& unitDir, const PxGeometry& /*geom*/, const PxTransform& pose, + PxReal maxDist, PxHitFlags hitFlags, PxU32 maxHits, PxGeomRaycastHit* rayHits, PxU32 stride, PxRaycastThreadContext*) const +{ + PxVec3 p = pose.transformInv(origin); + PxVec3 n = pose.rotateInv(unitDir); + PxVec3 s = voxelSize() * 0.5f; + int x, y, z; pointCoords(p, x, y, z); + int hitCount = 0; + PxU8* hitBuffer = reinterpret_cast(rayHits); + float currDist = 0; + PxVec3 hitN(0); + + while (currDist < maxDist) + { + PxVec3 v = voxelPos(x, y, z); + if (voxel(x, y, z)) + { + PxGeomRaycastHit& h = *reinterpret_cast(hitBuffer + hitCount * stride); + h.distance = currDist; + if (hitFlags.isSet(PxHitFlag::ePOSITION)) + h.position = origin + unitDir * currDist; + if (hitFlags.isSet(PxHitFlag::eNORMAL)) + h.normal = hitN; + if (hitFlags.isSet(PxHitFlag::eFACE_INDEX)) + h.faceIndex = (x) | (y << 10) | (z << 20); + hitCount += 1; + } + if (hitCount == int(maxHits)) + break; + float step = FLT_MAX; + int dx = 0, dy = 0, dz = 0; + if (n.x > FLT_EPSILON) + { + float d = (v.x + s.x - p.x) / n.x; + if (d < step) { step = d; dx = 1; dy = 0; dz = 0; } + } + if (n.x < -FLT_EPSILON) + { + float d = (v.x - s.x - p.x) / n.x; + if (d < step) { step = d; dx = -1; dy = 0; dz = 0; } + } + if (n.y > FLT_EPSILON) + { + float d = (v.y + s.y - p.y) / n.y; + if (d < step) { step = d; dx = 0; dy = 1; dz = 0; } + } + if (n.y < -FLT_EPSILON) + { + float d = (v.y - s.y - p.y) / n.y; + if (d < step) { step = d; dx = 0; dy = -1; dz = 0; } + } + if (n.z > FLT_EPSILON) + { + float d = (v.z + s.z - p.z) / n.z; + if (d < step) { step = d; dx = 0; dy = 0; dz = 1; } + } + if (n.z < -FLT_EPSILON) + { + float d = (v.z - s.z - p.z) / n.z; + if (d < step) { step = d; dx = 0; dy = 0; dz = -1; } + } + x += dx; y += dy; z += dz; + hitN = PxVec3(float(-dx), float(-dy), float(-dz)); + currDist = step; + } + + return hitCount; +} + +bool VoxelMap::overlap(const PxGeometry& /*geom0*/, const PxTransform& pose0, const PxGeometry& geom1, const PxTransform& pose1, PxOverlapThreadContext*) const +{ + PxBoxGeometry voxelGeom(voxelSize() * 0.5f); + + PxTransform pose1in0 = pose0.transformInv(pose1); + PxBounds3 bounds1; PxGeometryQuery::computeGeomBounds(bounds1, geom1, pose1in0); + + int sx, sy, sz, ex, ey, ez; + getVoxelRegion(bounds1, sx, sy, sz, ex, ey, ez); + for (int x = sx; x <= ex; ++x) + for (int y = sy; y <= ey; ++y) + for (int z = sz; z <= ez; ++z) + if (voxel(x, y, z)) + { + PxTransform p0 = pose0.transform(PxTransform(voxelPos(x, y, z))); + if (PxGeometryQuery::overlap(voxelGeom, p0, geom1, pose1, PxGeometryQueryFlags(0))) + return true; + } + + return false; +} + +bool VoxelMap::sweep(const PxVec3& unitDir, const PxReal maxDist, + const PxGeometry& /*geom0*/, const PxTransform& pose0, const PxGeometry& geom1, const PxTransform& pose1, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation, PxSweepThreadContext*) const +{ + PxBoxGeometry voxelGeom(voxelSize() * 0.5f); + + PxTransform pose1in0 = pose0.transformInv(pose1); + PxBounds3 b; PxGeometryQuery::computeGeomBounds(b, geom1, pose1in0, 0, 1.0f, PxGeometryQueryFlags(0)); + PxVec3 n = pose0.rotateInv(unitDir); + PxVec3 s = voxelSize(); + + int sx, sy, sz, ex, ey, ez; + getVoxelRegion(b, sx, sy, sz, ex, ey, ez); + int sx1, sy1, sz1, ex1, ey1, ez1; + sx1 = sy1 = sz1 = -1; ex1 = ey1 = ez1 = 0; + float currDist = 0; + sweepHit.distance = FLT_MAX; + + while (currDist < maxDist && currDist < sweepHit.distance) + { + for (int x = sx; x <= ex; ++x) + for (int y = sy; y <= ey; ++y) + for (int z = sz; z <= ez; ++z) + if (voxel(x, y, z)) + { + if (x >= sx1 && x <= ex1 && y >= sy1 && y <= ey1 && z >= sz1 && z <= ez1) + continue; + + PxGeomSweepHit hit; + PxTransform p0 = pose0.transform(PxTransform(voxelPos(x, y, z))); + if (PxGeometryQuery::sweep(unitDir, maxDist, geom1, pose1, voxelGeom, p0, hit, hitFlags, inflation, PxGeometryQueryFlags(0))) + if (hit.distance < sweepHit.distance) + sweepHit = hit; + } + + PxVec3 mi = b.minimum, ma = b.maximum; + PxVec3 bs = voxelPos(sx, sy, sz) - s, be = voxelPos(ex, ey, ez) + s; + float dist = FLT_MAX; + if (n.x > FLT_EPSILON) + { + float d = (be.x - ma.x) / n.x; + if (d < dist) dist = d; + } + if (n.x < -FLT_EPSILON) + { + float d = (bs.x - mi.x) / n.x; + if (d < dist) dist = d; + } + if (n.y > FLT_EPSILON) + { + float d = (be.y - ma.y) / n.y; + if (d < dist) dist = d; + } + if (n.y < -FLT_EPSILON) + { + float d = (bs.y - mi.y) / n.y; + if (d < dist) dist = d; + } + if (n.z > FLT_EPSILON) + { + float d = (be.z - ma.z) / n.z; + if (d < dist) dist = d; + } + if (n.z < -FLT_EPSILON) + { + float d = (bs.z - mi.z) / n.z; + if (d < dist) dist = d; + } + sx1 = sx; sy1 = sy; sz1 = sz; ex1 = ex; ey1 = ey; ez1 = ez; + PxBounds3 b1 = b; b1.minimum += n * dist; b1.maximum += n * dist; + getVoxelRegion(b1, sx, sy, sz, ex, ey, ez); + currDist = dist; + } + + return sweepHit.distance < FLT_MAX; +} + +void VoxelMap::visualize(const physx::PxGeometry& /*geom*/, physx::PxRenderOutput& render, const physx::PxTransform& transform, const physx::PxBounds3& /*bound*/) const +{ + PxVec3 extents = voxelSize() * 0.5f; + + render << transform; + + for (int x = 0; x < dimX(); ++x) + for (int y = 0; y < dimY(); ++y) + for (int z = 0; z < dimZ(); ++z) + if (voxel(x, y, z)) + { + if (voxel(x + 1, y, z) && + voxel(x - 1, y, z) && + voxel(x, y + 1, z) && + voxel(x, y - 1, z) && + voxel(x, y, z + 1) && + voxel(x, y, z - 1)) + continue; + + PxVec3 pos = voxelPos(x, y, z); + + PxBounds3 bounds(pos - extents, pos + extents); + + physx::PxDebugBox box(bounds, true); + render << box; + } +} diff --git a/engine/third_party/physx/snippets/snippetcustomgeometry/VoxelMap.h b/engine/third_party/physx/snippets/snippetcustomgeometry/VoxelMap.h new file mode 100644 index 00000000..6ef6b1f6 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcustomgeometry/VoxelMap.h @@ -0,0 +1,108 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 VOXEL_MAP_H +#define VOXEL_MAP_H + +#include "PxPhysicsAPI.h" + +/* +VoxelMap inherits physx::PxCustomGeometry::Callbacks interface and provides +implementations for 5 callback functions: + +- getLocalBounds +- generateContacts +- raycast +- overlap +- sweep + +It should be passed to PxCustomGeometry constructor. + +*/ +struct VoxelMap : physx::PxCustomGeometry::Callbacks, physx::PxUserAllocated +{ + void setDimensions(int x, int y, int z); + int dimX() const; + int dimY() const; + int dimZ() const; + + void setVoxelSize(float x, float y, float z); + const physx::PxVec3& voxelSize() const; + float voxelSizeX() const; + float voxelSizeY() const; + float voxelSizeZ() const; + + physx::PxVec3 extents() const; + + void setVoxel(int x, int y, int z, bool yes = true); + + bool voxel(int x, int y, int z) const; + + void clearVoxels(); + + void setFloorVoxels(int layers); + + void setWaveVoxels(); + + void voxelize(const physx::PxGeometry& geom, const physx::PxTransform& pose, bool add = true); + + physx::PxVec3 voxelPos(int x, int y, int z) const; + + void pointCoords(const physx::PxVec3& p, int& x, int& y, int& z) const; + + void getVoxelRegion(const physx::PxBounds3& b, int& sx, int& sy, int& sz, int& ex, int& ey, int& ez) const; + + // physx::PxCustomGeometry::Callbacks overrides + + DECLARE_CUSTOM_GEOMETRY_TYPE + virtual physx::PxBounds3 getLocalBounds(const physx::PxGeometry&) const; + virtual bool generateContacts(const physx::PxGeometry& geom0, const physx::PxGeometry& geom1, const physx::PxTransform& pose0, const physx::PxTransform& pose1, + const physx::PxReal contactDistance, const physx::PxReal meshContactMargin, const physx::PxReal toleranceLength, + physx::PxContactBuffer& contactBuffer) const; + virtual physx::PxU32 raycast(const physx::PxVec3& origin, const physx::PxVec3& unitDir, const physx::PxGeometry& geom, const physx::PxTransform& pose, + physx::PxReal maxDist, physx::PxHitFlags hitFlags, physx::PxU32 maxHits, physx::PxGeomRaycastHit* rayHits, physx::PxU32 stride, physx::PxRaycastThreadContext*) const; + virtual bool overlap(const physx::PxGeometry& geom0, const physx::PxTransform& pose0, const physx::PxGeometry& geom1, const physx::PxTransform& pose1, physx::PxOverlapThreadContext*) const; + virtual bool sweep(const physx::PxVec3& unitDir, const physx::PxReal maxDist, + const physx::PxGeometry& geom0, const physx::PxTransform& pose0, const physx::PxGeometry& geom1, const physx::PxTransform& pose1, + physx::PxGeomSweepHit& sweepHit, physx::PxHitFlags hitFlags, const physx::PxReal inflation, physx::PxSweepThreadContext*) const; + virtual void visualize(const physx::PxGeometry&, physx::PxRenderOutput&, const physx::PxTransform&, const physx::PxBounds3&) const; + virtual void computeMassProperties(const physx::PxGeometry&, physx::PxMassProperties&) const {} + virtual bool usePersistentContactManifold(const physx::PxGeometry&, physx::PxReal&) const { return true; } + +private: + + int pacsX() const; + int pacsY() const; + int pacsZ() const; + + int m_dimensions[3]; + physx::PxVec3 m_voxelSize; + physx::PxArray m_packs; +}; + +#endif diff --git a/engine/third_party/physx/snippets/snippetcustomgeometrycollision/SnippetCustomGeometryCollision.cpp b/engine/third_party/physx/snippets/snippetcustomgeometrycollision/SnippetCustomGeometryCollision.cpp new file mode 100644 index 00000000..f2884680 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcustomgeometrycollision/SnippetCustomGeometryCollision.cpp @@ -0,0 +1,307 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +// **************************************************************************** +// This snippet shows how to implement custom geometries generateContacts +// callback, using PhysX Immediate Mode contacts generation. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "PxImmediateMode.h" +#include "geomutils/PxContactBuffer.h" + +// temporary disable this snippet, cannot work without rendering we cannot include GL directly +#ifdef RENDER_SNIPPET + +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetrender/SnippetRender.h" + +using namespace physx; + +/* + 10x10 grid of boxes with even boxes removed. +*/ +struct CheckerBoard : PxCustomGeometry::Callbacks +{ + int boardSize; + float boxExtent; + + DECLARE_CUSTOM_GEOMETRY_TYPE + + CheckerBoard() + : + boardSize(10), + boxExtent(10.0f) + {} + + struct ContactRecorder : immediate::PxContactRecorder + { + PxContactBuffer* contactBuffer; + ContactRecorder(PxContactBuffer& _contactBuffer) : contactBuffer(&_contactBuffer) {} + virtual bool recordContacts(const PxContactPoint* contactPoints, PxU32 nbContacts, PxU32 /*index*/) + { + for (PxU32 i = 0; i < nbContacts; ++i) + if (!contactBuffer->contact(contactPoints[i])) + return false; + return true; + } + }; + struct ContactCacheAllocator : PxCacheAllocator + { + PxU8 buffer[1024]; + ContactCacheAllocator() { memset(buffer, 0, sizeof(buffer)); } + virtual PxU8* allocateCacheData(const PxU32 /*byteSize*/) { return (PxU8*)(size_t(buffer + 0xf) & ~0xf); } + }; + + PxBounds3 getBoardLocalBounds() const + { + return PxBounds3(-PxVec3(boardSize * boxExtent * 0.5f, boxExtent * 0.5f, boardSize * boxExtent * 0.5f), + PxVec3(boardSize * boxExtent * 0.5f, boxExtent * 0.5f, boardSize * boxExtent * 0.5f)); + } + + virtual PxBounds3 getLocalBounds(const PxGeometry&) const + { + return getBoardLocalBounds(); + } + virtual bool generateContacts(const PxGeometry&, const PxGeometry& geom1, const PxTransform& pose0, const PxTransform& pose1, + const PxReal contactDistance, const PxReal meshContactMargin, const PxReal toleranceLength, + PxContactBuffer& contactBuffer) const + { + PxBoxGeometry boxGeom(PxVec3(boxExtent * 0.5f)); + PxGeometry* pGeom0 = &boxGeom; + + const PxGeometry* pGeom1 = &geom1; + PxTransform pose1in0 = pose0.transformInv(pose1); + PxBounds3 bounds1; PxGeometryQuery::computeGeomBounds(bounds1, geom1, pose1in0, contactDistance); + + ContactRecorder contactRecorder(contactBuffer); + PxCache contactCache; + ContactCacheAllocator contactCacheAllocator; + + PxBounds3 bounds0 = getBoardLocalBounds(); + PxVec3 s = bounds1.minimum + bounds0.getExtents(); + PxVec3 e = bounds1.maximum + bounds0.getExtents(); + int sx = int(PxFloor(s.x / boxExtent)); + int sy = int(PxFloor(s.y / boxExtent)); + int sz = int(PxFloor(s.z / boxExtent)); + int ex = int(PxFloor(e.x / boxExtent)); + int ey = int(PxFloor(e.y / boxExtent)); + int ez = int(PxFloor(e.z / boxExtent)); + for (int x = sx; x <= ex; ++x) + for (int y = sy; y <= ey; ++y) + for (int z = sz; z <= ez; ++z) + if (x >= 0 && x < boardSize && + y >= 0 && y < boardSize && + z >= 0 && z < boardSize && + (x + z) & 1 && + y == 0) + { + PxVec3 boxPos = PxVec3((x + 0.5f) * boxExtent, (y + 0.5f) * boxExtent, (z + 0.5f) * boxExtent) - bounds0.getExtents(); + PxTransform p0 = pose0.transform(PxTransform(boxPos)); + immediate::PxGenerateContacts(&pGeom0, &pGeom1, &p0, &pose1, &contactCache, 1, contactRecorder, + contactDistance, meshContactMargin, toleranceLength, contactCacheAllocator); + } + + return true; + } + virtual PxU32 raycast(const PxVec3&, const PxVec3&, const PxGeometry&, const PxTransform&, + PxReal, PxHitFlags, PxU32, PxGeomRaycastHit*, PxU32, PxRaycastThreadContext*) const + { + return 0; + } + virtual bool overlap(const PxGeometry&, const PxTransform&, const PxGeometry&, const PxTransform&, PxOverlapThreadContext*) const + { + return false; + } + virtual bool sweep(const PxVec3&, const PxReal, + const PxGeometry&, const PxTransform&, const PxGeometry&, const PxTransform&, + PxGeomSweepHit&, PxHitFlags, const PxReal, PxSweepThreadContext*) const + { + return false; + } + virtual void visualize(const PxGeometry&, PxRenderOutput&, const PxTransform&, const PxBounds3&) const {} + virtual void computeMassProperties(const physx::PxGeometry&, physx::PxMassProperties&) const {} + virtual bool usePersistentContactManifold(const PxGeometry&, PxReal&) const { return false; } +}; + +IMPLEMENT_CUSTOM_GEOMETRY_TYPE(CheckerBoard) + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +static PxRigidStatic* gActor = NULL; + +static CheckerBoard gCheckerBoard; + +static PxRigidDynamic* createDynamic(const PxTransform& t, const PxGeometry& geometry, const PxVec3& velocity = PxVec3(0), PxReal density = 1.0f) +{ + PxRigidDynamic* dynamic = PxCreateDynamic(*gPhysics, t, geometry, *gMaterial, density); + dynamic->setLinearVelocity(velocity); + gScene->addActor(*dynamic); + return dynamic; +} + +static void createStack(const PxTransform& t, PxU32 size, PxReal halfExtent) +{ + PxShape* shape = gPhysics->createShape(PxBoxGeometry(halfExtent, halfExtent, halfExtent), *gMaterial); + for (PxU32 i = 0; i < size; i++) + { + for (PxU32 j = 0; j < size - i; j++) + { + PxTransform localTm(PxVec3(PxReal(j * 2) - PxReal(size - i), PxReal(i * 2 + 1), 0) * halfExtent); + PxRigidDynamic* body = gPhysics->createRigidDynamic(t.transform(localTm)); + body->attachShape(*shape); + PxRigidBodyExt::updateMassAndInertia(*body, 10.0f); + gScene->addActor(*body); + } + } + shape->release(); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport, PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f * 3, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(2); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + gScene = gPhysics->createScene(sceneDesc); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if (pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + // Create checker board actor + PxRigidStatic* checkerBoardActor = gPhysics->createRigidStatic(PxTransform(PxVec3(0, gCheckerBoard.boxExtent * 0.5f, 0))); + PxRigidActorExt::createExclusiveShape(*checkerBoardActor, PxCustomGeometry(gCheckerBoard), *gMaterial); + gScene->addActor(*checkerBoardActor); + gActor = checkerBoardActor; + + // Ground plane + PxRigidStatic* planeActor = gPhysics->createRigidStatic(PxTransform(PxQuat(PX_PIDIV2, PxVec3(0, 0, 1)))); + PxRigidActorExt::createExclusiveShape(*planeActor, PxPlaneGeometry(), *gMaterial); + gScene->addActor(*planeActor); + + createStack(PxTransform(PxVec3(0, 22, 0)), 10, 2.0f); +} + +void debugRender() +{ + float boxExtent = gCheckerBoard.boxExtent; + PxBounds3 boardBounds = gCheckerBoard.getBoardLocalBounds(); + PxGeometryHolder geom; + geom.storeAny(PxBoxGeometry(PxVec3(boxExtent * 0.5f))); + + for (int x = 0; x < gCheckerBoard.boardSize; ++x) + for (int y = 0; y < 1; ++y) + for (int z = 0; z < gCheckerBoard.boardSize; ++z) + if ((x + z) & 1) + { + PxVec3 boxPos = PxVec3((x + 0.5f) * boxExtent, (y + 0.5f) * boxExtent, (z + 0.5f) * boxExtent) - boardBounds.getExtents(); + PxTransform pose = gActor->getGlobalPose().transform(PxTransform(boxPos)); + Snippets::renderGeoms(1, &geom, &pose, false, PxVec3(0.5f)); + } +} + +void stepPhysics(bool /*interactive*/) +{ + gScene->simulate(1.0f / 60.0f); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if (gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetCustomGeometryCollision done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& camera) +{ + switch (toupper(key)) + { + case ' ': createDynamic(camera, PxSphereGeometry(3.0f), camera.rotate(PxVec3(0, 0, -1)) * 200, 3.0f); break; + } +} + +int snippetMain(int, const char* const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for (PxU32 i = 0; i < frameCount; i++) + stepPhysics(false); + cleanupPhysics(false); +#endif + + return 0; +} + +#else +int snippetMain(int, const char* const*) +{ + return 0; +} + +#endif + diff --git a/engine/third_party/physx/snippets/snippetcustomgeometrycollision/SnippetCustomGeometryCollisionRender.cpp b/engine/third_party/physx/snippets/snippetcustomgeometrycollision/SnippetCustomGeometryCollisionRender.cpp new file mode 100644 index 00000000..00ad226c --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcustomgeometrycollision/SnippetCustomGeometryCollisionRender.cpp @@ -0,0 +1,87 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#ifdef RENDER_SNIPPET + +#include "PxPhysicsAPI.h" + +#include "../snippetrender/SnippetRender.h" +#include "../snippetrender/SnippetCamera.h" + +using namespace physx; + +extern void initPhysics(bool interactive); +extern void stepPhysics(bool interactive); +extern void cleanupPhysics(bool interactive); +extern void keyPress(unsigned char key, const PxTransform& camera); +extern void debugRender(); + +namespace +{ + Snippets::Camera* sCamera; + + void renderCallback() + { + stepPhysics(true); + + Snippets::startRender(sCamera); + + PxScene* scene; + PxGetPhysics().getScenes(&scene, 1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if (nbActors) + { + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + + debugRender(); + + Snippets::finishRender(); + } + + void exitCallback() + { + delete sCamera; + cleanupPhysics(true); + } +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(70.0f, 70.0f, 70.0f), PxVec3(-0.6f, -0.3f, -0.6f)); + + Snippets::setupDefault("PhysX Snippet CustomGeometryCollision", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetcustomgeometryqueries/SnippetCustomGeometryQueries.cpp b/engine/third_party/physx/snippets/snippetcustomgeometryqueries/SnippetCustomGeometryQueries.cpp new file mode 100644 index 00000000..850ee44b --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcustomgeometryqueries/SnippetCustomGeometryQueries.cpp @@ -0,0 +1,269 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet shows how to implement custom geometries queries +// callbacks, using PhysX geometry queries. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" + +// temporary disable this snippet, cannot work without rendering we cannot include GL directly +#ifdef RENDER_SNIPPET + +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetrender/SnippetRender.h" + +using namespace physx; + +void renderRaycast(const PxVec3& origin, const PxVec3& unitDir, float maxDist, const PxRaycastHit* hit); +void renderSweepBox(const PxVec3& origin, const PxVec3& unitDir, float maxDist, const PxVec3& halfExtents, const PxSweepHit* hit); +void renderOverlapBox(const PxVec3& origin, const PxVec3& halfExtents, bool hit); + +/* + Two crossed bars. +*/ +struct BarCrosss : PxCustomGeometry::Callbacks +{ + PxVec3 barExtents; + + DECLARE_CUSTOM_GEOMETRY_TYPE + + BarCrosss() : barExtents(27, 9, 3) {} + + virtual PxBounds3 getLocalBounds(const PxGeometry&) const + { + return PxBounds3(-PxVec3(barExtents.x * 0.5f, barExtents.y * 0.5f, barExtents.x * 0.5f), + PxVec3(barExtents.x * 0.5f, barExtents.y * 0.5f, barExtents.x * 0.5f)); + } + virtual bool generateContacts(const PxGeometry&, const PxGeometry&, const PxTransform&, const PxTransform&, + const PxReal, const PxReal, const PxReal, + PxContactBuffer&) const + { + return false; + } + virtual PxU32 raycast(const PxVec3& origin, const PxVec3& unitDir, const PxGeometry&, const PxTransform& pose, + PxReal maxDist, PxHitFlags hitFlags, PxU32, PxGeomRaycastHit* rayHits, PxU32, PxRaycastThreadContext*) const + { + PxBoxGeometry barGeom(barExtents * 0.5f); + PxTransform p0 = pose; + PxGeomRaycastHit hits[2]; + PxGeometryQuery::raycast(origin, unitDir, barGeom, p0, maxDist, hitFlags, 1, hits + 0); + p0 = pose.transform(PxTransform(PxQuat(PX_PIDIV2, PxVec3(0, 1, 0)))); + PxGeometryQuery::raycast(origin, unitDir, barGeom, p0, maxDist, hitFlags, 1, hits + 1); + rayHits[0] = hits[0].distance < hits[1].distance ? hits[0] : hits[1]; + return hits[0].distance < PX_MAX_REAL || hits[1].distance < PX_MAX_REAL ? 1 : 0; + } + virtual bool overlap(const PxGeometry&, const PxTransform& pose0, const PxGeometry& geom1, const PxTransform& pose1, PxOverlapThreadContext*) const + { + PxBoxGeometry barGeom(barExtents * 0.5f); + PxTransform p0 = pose0; + if (PxGeometryQuery::overlap(barGeom, p0, geom1, pose1, PxGeometryQueryFlags(0))) + return true; + p0 = pose0.transform(PxTransform(PxQuat(PX_PIDIV2, PxVec3(0, 1, 0)))); + if (PxGeometryQuery::overlap(barGeom, p0, geom1, pose1, PxGeometryQueryFlags(0))) + return true; + return false; + } + virtual bool sweep(const PxVec3& unitDir, const PxReal maxDist, + const PxGeometry&, const PxTransform& pose0, const PxGeometry& geom1, const PxTransform& pose1, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation, PxSweepThreadContext*) const + { + PxBoxGeometry barGeom(barExtents * 0.5f); + PxTransform p0 = pose0; + PxGeomSweepHit hits[2]; + PxGeometryQuery::sweep(unitDir, maxDist, geom1, pose1, barGeom, p0, hits[0], hitFlags, inflation); + p0 = pose0.transform(PxTransform(PxQuat(PX_PIDIV2, PxVec3(0, 1, 0)))); + PxGeometryQuery::sweep(unitDir, maxDist, geom1, pose1, barGeom, p0, hits[1], hitFlags, inflation); + sweepHit = hits[0].distance < hits[1].distance ? hits[0] : hits[1]; + return hits[0].distance < PX_MAX_REAL || hits[1].distance < PX_MAX_REAL; + } + virtual void visualize(const PxGeometry&, PxRenderOutput&, const PxTransform&, const PxBounds3&) const {} + virtual void computeMassProperties(const PxGeometry&, PxMassProperties&) const {} + virtual bool usePersistentContactManifold(const PxGeometry&, PxReal&) const { return false; } +}; + +IMPLEMENT_CUSTOM_GEOMETRY_TYPE(BarCrosss) + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +static PxRigidDynamic* gActor = NULL; + +static BarCrosss gBarCrosss; +static PxReal gTime = 0; + +static PxRigidDynamic* createDynamic(const PxTransform& t, const PxGeometry& geometry, const PxVec3& velocity = PxVec3(0), PxReal density = 1.0f) +{ + PxRigidDynamic* dynamic = PxCreateDynamic(*gPhysics, t, geometry, *gMaterial, density); + dynamic->setLinearVelocity(velocity); + gScene->addActor(*dynamic); + return dynamic; +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport, PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f * 3, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(2); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + gScene = gPhysics->createScene(sceneDesc); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if (pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + // Create bar cross actor + PxRigidDynamic* barCrossActor = gPhysics->createRigidDynamic(PxTransform(PxVec3(0, gBarCrosss.barExtents.y * 0.5f, 0))); + barCrossActor->setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, true); + PxRigidActorExt::createExclusiveShape(*barCrossActor, PxCustomGeometry(gBarCrosss), *gMaterial); + gScene->addActor(*barCrossActor); + gActor = barCrossActor; +} + +void debugRender() +{ + PxGeometryHolder geom; + geom.storeAny(PxBoxGeometry(gBarCrosss.barExtents * 0.5f)); + PxTransform pose = gActor->getGlobalPose(); + Snippets::renderGeoms(1, &geom, &pose, false, PxVec3(0.7f)); + pose = pose.transform(PxTransform(PxQuat(PX_PIDIV2, PxVec3(0, 1, 0)))); + Snippets::renderGeoms(1, &geom, &pose, false, PxVec3(0.7f)); + + // Raycast + { + PxVec3 origin((gBarCrosss.barExtents.x + 10) * 0.5f, 0, 0); + PxVec3 unitDir(-1, 0, 0); + float maxDist = gBarCrosss.barExtents.x + 20; + PxRaycastBuffer buffer; + gScene->raycast(origin, unitDir, maxDist, buffer); + renderRaycast(origin, unitDir, maxDist, buffer.hasBlock ? &buffer.block : nullptr); + } + + // Sweep + { + PxVec3 origin(0, 0, (gBarCrosss.barExtents.x + 10) * 0.5f); + PxVec3 unitDir(0, 0, -1); + float maxDist = gBarCrosss.barExtents.x + 20; + PxVec3 halfExtents(1.5f, 0.5f, 1.0f); + PxSweepBuffer buffer; + gScene->sweep(PxBoxGeometry(halfExtents), PxTransform(origin), unitDir, maxDist, buffer); + renderSweepBox(origin, unitDir, maxDist, halfExtents, buffer.hasBlock ? &buffer.block : nullptr); + } + + // Overlap + { + PxVec3 origin((gBarCrosss.barExtents.x) * -0.4f, 0, (gBarCrosss.barExtents.x) * -0.4f); + PxVec3 halfExtents(gBarCrosss.barExtents.z * 1.5f, gBarCrosss.barExtents.y * 1.1f, gBarCrosss.barExtents.z * 1.5f); + PxOverlapBuffer buffer; + gScene->overlap(PxBoxGeometry(halfExtents), PxTransform(origin), buffer, PxQueryFilterData(PxQueryFlag::eANY_HIT | PxQueryFlag::eDYNAMIC)); + renderOverlapBox(origin, halfExtents, buffer.hasAnyHits()); + } +} + +void stepPhysics(bool /*interactive*/) +{ + gTime += 1.0f / 60.0f; + gActor->setKinematicTarget(PxTransform(PxQuat(gTime * 0.3f, PxVec3(0, 1, 0)))); + + gScene->simulate(1.0f / 60.0f); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if (gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetCustomGeometryQueries done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& camera) +{ + switch (toupper(key)) + { + case ' ': createDynamic(camera, PxSphereGeometry(3.0f), camera.rotate(PxVec3(0, 0, -1)) * 200, 3.0f); break; + } +} + +int snippetMain(int, const char* const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for (PxU32 i = 0; i < frameCount; i++) + stepPhysics(false); + cleanupPhysics(false); +#endif + + return 0; +} + +#else +int snippetMain(int, const char* const*) +{ + return 0; +} + +#endif + diff --git a/engine/third_party/physx/snippets/snippetcustomgeometryqueries/SnippetCustomGeometryQueriesRender.cpp b/engine/third_party/physx/snippets/snippetcustomgeometryqueries/SnippetCustomGeometryQueriesRender.cpp new file mode 100644 index 00000000..c83937dc --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcustomgeometryqueries/SnippetCustomGeometryQueriesRender.cpp @@ -0,0 +1,174 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#ifdef RENDER_SNIPPET + +#include "PxPhysicsAPI.h" + +#include "../snippetrender/SnippetRender.h" +#include "../snippetrender/SnippetCamera.h" + +using namespace physx; + +extern void initPhysics(bool interactive); +extern void stepPhysics(bool interactive); +extern void cleanupPhysics(bool interactive); +extern void keyPress(unsigned char key, const PxTransform& camera); +extern void debugRender(); + +namespace +{ + Snippets::Camera* sCamera; + + void renderCallback() + { + stepPhysics(true); + + Snippets::startRender(sCamera); + + PxScene* scene; + PxGetPhysics().getScenes(&scene, 1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if (nbActors) + { + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + + debugRender(); + + Snippets::finishRender(); + } + + void exitCallback() + { + delete sCamera; + cleanupPhysics(true); + } +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(30.0f, 30.0f, 30.0f), PxVec3(-0.6f, -0.5f, -0.6f)); + + Snippets::setupDefault("PhysX Snippet CustomGeometryQueries", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} + +static void PxVertex3f(const PxVec3& v) { ::glVertex3f(v.x, v.y, v.z); }; +static void PxScalef(const PxVec3& v) { ::glScalef(v.x, v.y, v.z); }; + +void renderRaycast(const PxVec3& origin, const PxVec3& unitDir, float maxDist, const PxRaycastHit* hit) +{ + glDisable(GL_LIGHTING); + if (hit) + { + glColor4f(1.0f, 0.0f, 0.0f, 1.0f); + glBegin(GL_LINES); + PxVertex3f(origin); + PxVertex3f(origin + unitDir * hit->distance); + PxVertex3f(hit->position); + PxVertex3f(hit->position + hit->normal); + glEnd(); + } + else + { + glColor4f(0.6f, 0.0f, 0.0f, 1.0f); + glBegin(GL_LINES); + PxVertex3f(origin); + PxVertex3f(origin + unitDir * maxDist); + glEnd(); + } + glEnable(GL_LIGHTING); +} + +void renderSweepBox(const PxVec3& origin, const PxVec3& unitDir, float maxDist, const PxVec3& halfExtents, const PxSweepHit* hit) +{ + glDisable(GL_LIGHTING); + if (hit) + { + glColor4f(0.0f, 0.6f, 0.0f, 1.0f); + glBegin(GL_LINES); + PxVertex3f(origin); + PxVertex3f(origin + unitDir * hit->distance); + PxVertex3f(hit->position); + PxVertex3f(hit->position + hit->normal); + glEnd(); + PxTransform boxPose(origin + unitDir * hit->distance); + PxMat44 boxMat(boxPose); + glPushMatrix(); + glMultMatrixf(&boxMat.column0.x); + PxScalef(halfExtents * 2); + glutWireCube(1); + glPopMatrix(); + } + else + { + glColor4f(0.0f, 0.3f, 0.0f, 1.0f); + glBegin(GL_LINES); + PxVertex3f(origin); + PxVertex3f(origin + unitDir * maxDist); + glEnd(); + } + glEnable(GL_LIGHTING); +} + +void renderOverlapBox(const PxVec3& origin, const PxVec3& halfExtents, bool hit) +{ + glDisable(GL_LIGHTING); + if (hit) + { + glColor4f(0.0f, 0.0f, 1.0f, 1.0f); + PxTransform boxPose(origin); + PxMat44 boxMat(boxPose); + glPushMatrix(); + glMultMatrixf(&boxMat.column0.x); + PxScalef(halfExtents * 2); + glutWireCube(1); + glPopMatrix(); + } + else + { + glColor4f(0.0f, 0.0f, 0.6f, 1.0f); + PxTransform boxPose(origin); + PxMat44 boxMat(boxPose); + glPushMatrix(); + glMultMatrixf(&boxMat.column0.x); + PxScalef(halfExtents * 2); + glutWireCube(1); + glPopMatrix(); + } + glEnable(GL_LIGHTING); +} + +#endif diff --git a/engine/third_party/physx/snippets/snippetcustomjoint/PulleyJoint.cpp b/engine/third_party/physx/snippets/snippetcustomjoint/PulleyJoint.cpp new file mode 100644 index 00000000..021d7f57 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcustomjoint/PulleyJoint.cpp @@ -0,0 +1,214 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#include "PulleyJoint.h" +#include +#include "PxConstraint.h" + +using namespace physx; + +//TAG:solverprepshader +static PxU32 solverPrep(Px1DConstraint* constraints, + PxVec3p& body0WorldOffset, + PxU32 maxConstraints, + PxConstraintInvMassScale&, + const void* constantBlock, + const PxTransform& bA2w, + const PxTransform& bB2w, + bool /*useExtendedLimits*/, + PxVec3p& cA2wOut, PxVec3p& cB2wOut) +{ + PX_UNUSED(maxConstraints); + + const PulleyJoint::PulleyJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w = bA2w.transform(data.c2b[0]); + PxTransform cB2w = bB2w.transform(data.c2b[1]); + + cA2wOut = cA2w.p; + cB2wOut = cB2w.p; + + body0WorldOffset = cB2w.p - bA2w.p; + + PxVec3 directionA = data.attachment0 - cA2w.p; + PxReal distanceA = directionA.normalize(); + + PxVec3 directionB = data.attachment1 - cB2w.p; + PxReal distanceB = directionB.normalize(); + + directionB *= data.ratio; + + PxReal totalDistance = distanceA + distanceB; + + // compute geometric error: + PxReal geometricError = (data.distance - totalDistance); + + Px1DConstraint *c = constraints; + // constraint is breakable, so we need to output forces + c->flags = Px1DConstraintFlag::eOUTPUT_FORCE; + + if (geometricError < 0.0f) + { + c->maxImpulse = PX_MAX_F32; + c->minImpulse = 0; + c->geometricError = geometricError; + } + else if(geometricError > 0.0f) + { + c->maxImpulse = 0; + c->minImpulse = -PX_MAX_F32; + c->geometricError = geometricError; + } + + c->linear0 = directionA; c->angular0 = (cA2w.p - bA2w.p).cross(c->linear0); + c->linear1 = -directionB; c->angular1 = (cB2w.p - bB2w.p).cross(c->linear1); + + return 1; +} + +static void visualize( PxConstraintVisualizer& viz, + const void* constantBlock, + const PxTransform& body0Transform, + const PxTransform& body1Transform, + PxU32 flags) +{ + PX_UNUSED(flags); + const PulleyJoint::PulleyJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w = body0Transform * data.c2b[0]; + PxTransform cB2w = body1Transform * data.c2b[1]; + viz.visualizeJointFrames(cA2w, cB2w); + viz.visualizeJointFrames(PxTransform(data.attachment0), PxTransform(data.attachment1)); +} + +static PxConstraintShaderTable sShaderTable = { solverPrep, visualize, PxConstraintFlag::Enum(0) }; + +PxConstraintSolverPrep PulleyJoint::getPrep() const { return solverPrep; } + +PulleyJoint::PulleyJoint(PxPhysics& physics, PxRigidBody& body0, const PxTransform& localFrame0, const PxVec3& attachment0, + PxRigidBody& body1, const PxTransform& localFrame1, const PxVec3& attachment1) +{ + mConstraint = physics.createConstraint(&body0, &body1, *this, sShaderTable, sizeof(PulleyJointData)); + + mBody[0] = &body0; + mBody[1] = &body1; + + // keep these around in case the CoM gets relocated + mLocalPose[0] = localFrame0.getNormalized(); + mLocalPose[1] = localFrame1.getNormalized(); + + // the data which will be fed to the joint solver and projection shaders + mData.attachment0 = attachment0; + mData.attachment1 = attachment1; + mData.distance = 1.0f; + mData.ratio = 1.0f; + mData.c2b[0] = body0.getCMassLocalPose().transformInv(mLocalPose[0]); + mData.c2b[1] = body1.getCMassLocalPose().transformInv(mLocalPose[1]); +} + +void PulleyJoint::release() +{ + mConstraint->release(); +} + +///////////////////////////////////////////// attribute accessors and mutators + +void PulleyJoint::setAttachment0(const PxVec3& pos) +{ + mData.attachment0 = pos; + mConstraint->markDirty(); +} + +PxVec3 PulleyJoint::getAttachment0() const +{ + return mData.attachment0; +} + +void PulleyJoint::setAttachment1(const PxVec3& pos) +{ + mData.attachment1 = pos; + mConstraint->markDirty(); +} + +PxVec3 PulleyJoint::getAttachment1() const +{ + return mData.attachment1; +} + +void PulleyJoint::setDistance(float totalDistance) +{ + mData.distance = totalDistance; + mConstraint->markDirty(); +} + +float PulleyJoint::getDistance() const +{ + return mData.distance; +} + +void PulleyJoint::setRatio(float ratio) +{ + mData.ratio = ratio; + mConstraint->markDirty(); +} + +float PulleyJoint::getRatio() const +{ + return mData.ratio; +} + +///////////////////////////////////////////// PxConstraintConnector methods + +void* PulleyJoint::prepareData() +{ + return &mData; +} + +void PulleyJoint::onConstraintRelease() +{ + delete this; +} + +void PulleyJoint::onComShift(PxU32 actor) +{ + mData.c2b[actor] = mBody[actor]->getCMassLocalPose().transformInv(mLocalPose[actor]); + mConstraint->markDirty(); +} + +void PulleyJoint::onOriginShift(const PxVec3& shift) +{ + mData.attachment0 -= shift; + mData.attachment1 -= shift; +} + +void* PulleyJoint::getExternalReference(PxU32& typeID) +{ + typeID = TYPE_ID; + return this; +} + diff --git a/engine/third_party/physx/snippets/snippetcustomjoint/PulleyJoint.h b/engine/third_party/physx/snippets/snippetcustomjoint/PulleyJoint.h new file mode 100644 index 00000000..f07b4964 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcustomjoint/PulleyJoint.h @@ -0,0 +1,111 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PULLEY_JOINT_H +#define PULLEY_JOINT_H + +#include "PxPhysicsAPI.h" + +// a pulley joint constrains two actors such that the sum of their distances from their respective anchor points at their attachment points +// is a fixed value (the parameter 'distance'). Only dynamic actors are supported. +// +// The constraint equation is as follows: +// +// |anchor0 - attachment0| + |anchor1 - attachment1| * ratio = distance +// +// where 'ratio' provides mechanical advantage. +// +// The above equation results in a singularity when the anchor point is coincident with the attachment point; for simplicity +// the constraint does not attempt to handle this case robustly. + +class PulleyJoint : public physx::PxConstraintConnector +{ +public: + + static const physx::PxU32 TYPE_ID = physx::PxConcreteType::eFIRST_USER_EXTENSION; + + PulleyJoint(physx::PxPhysics& physics, + physx::PxRigidBody& body0, const physx::PxTransform& localFrame0, const physx::PxVec3& attachment0, + physx::PxRigidBody& body1, const physx::PxTransform& localFrame1, const physx::PxVec3& attachment1); + + void release(); + + // attribute accessor and mutators + + void setAttachment0(const physx::PxVec3& pos); + physx::PxVec3 getAttachment0() const; + + void setAttachment1(const physx::PxVec3& pos); + physx::PxVec3 getAttachment1() const; + + void setDistance(physx::PxReal totalDistance); + physx::PxReal getDistance() const; + + void setRatio(physx::PxReal ratio); + physx::PxReal getRatio() const; + + // PxConstraintConnector boilerplate + + void* prepareData(); + void onConstraintRelease(); + void onComShift(physx::PxU32 actor); + void onOriginShift(const physx::PxVec3& shift); + void* getExternalReference(physx::PxU32& typeID); + + bool updatePvdProperties(physx::pvdsdk::PvdDataStream&, + const physx::PxConstraint*, + physx::PxPvdUpdateType::Enum) const { return true; } + void updateOmniPvdProperties() const { } + physx::PxBase* getSerializable() { return NULL; } + + virtual physx::PxConstraintSolverPrep getPrep() const; + + virtual const void* getConstantBlock() const { return &mData; } + + struct PulleyJointData + { + physx::PxTransform c2b[2]; + + physx::PxVec3 attachment0; + physx::PxVec3 attachment1; + + physx::PxReal distance; + physx::PxReal ratio; + physx::PxReal tolerance; + }; + + physx::PxRigidBody* mBody[2]; + physx::PxTransform mLocalPose[2]; + + physx::PxConstraint* mConstraint; + PulleyJointData mData; + + ~PulleyJoint() {} +}; + +#endif diff --git a/engine/third_party/physx/snippets/snippetcustomjoint/SnippetCustomJoint.cpp b/engine/third_party/physx/snippets/snippetcustomjoint/SnippetCustomJoint.cpp new file mode 100644 index 00000000..a02027b1 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcustomjoint/SnippetCustomJoint.cpp @@ -0,0 +1,133 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet illustrates the implementation and use of a pulley joint +// using physx' custom constraint framework. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#include "PulleyJoint.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(2); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + gScene = gPhysics->createScene(sceneDesc); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + // two boxes connected by the pulley, one twice the density of the other + + PxBoxGeometry boxGeom(1.0f, 1.0f, 1.0f); + PxRigidDynamic* box0 = PxCreateDynamic(*gPhysics, PxTransform(PxVec3(5,5,0)), boxGeom, *gMaterial, 1.0f); + PxRigidDynamic* box1 = PxCreateDynamic(*gPhysics, PxTransform(PxVec3(0,5,0)), boxGeom, *gMaterial, 2.0f); + + PulleyJoint* joint = new PulleyJoint(*gPhysics, *box0, PxTransform(PxVec3(0.0f,1.0f,0.0f)), PxVec3(5.0f,10.0f,0.0f), + *box1, PxTransform(PxVec3(0.0f,1.0f,0.0f)), PxVec3(0.0f,10.0f,0.0f)); + + joint->setDistance(8.0f); + + gScene->addActor(*box0); + gScene->addActor(*box1); +} + +void stepPhysics(bool /*interactive*/) +{ + gScene->simulate(1.0f/60.0f); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetCustomJoint done.\n"); +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true); + } + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + cleanupPhysics(true); +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(50.0f, 50.0f, 50.0f), PxVec3(-0.6f,-0.2f,-0.7f)); + + Snippets::setupDefault("PhysX Snippet Custom Joint", sCamera, NULL, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetcustomprofiler/SnippetCustomProfiler.cpp b/engine/third_party/physx/snippets/snippetcustomprofiler/SnippetCustomProfiler.cpp new file mode 100644 index 00000000..6dd1e87f --- /dev/null +++ b/engine/third_party/physx/snippets/snippetcustomprofiler/SnippetCustomProfiler.cpp @@ -0,0 +1,232 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet illustrates how to setup a custom profiler, and potentially +// re-route it to PVD's profiling functions. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; + +static PxReal stackZ = 10.0f; + +static PxRigidDynamic* createDynamic(const PxTransform& t, const PxGeometry& geometry, const PxVec3& velocity=PxVec3(0)) +{ + PxRigidDynamic* dynamic = PxCreateDynamic(*gPhysics, t, geometry, *gMaterial, 10.0f); + dynamic->setAngularDamping(0.5f); + dynamic->setLinearVelocity(velocity); + gScene->addActor(*dynamic); + return dynamic; +} + +static void createStack(const PxTransform& t, PxU32 size, PxReal halfExtent) +{ + PxShape* shape = gPhysics->createShape(PxBoxGeometry(halfExtent, halfExtent, halfExtent), *gMaterial); + for(PxU32 i=0; icreateRigidDynamic(t.transform(localTm)); + body->attachShape(*shape); + PxRigidBodyExt::updateMassAndInertia(*body, 10.0f); + gScene->addActor(*body); + } + } + shape->release(); +} + +static const bool gCallPVDProfilingFunctions = false; + +class CustomProfilerCallback : public PxProfilerCallback +{ +public: + virtual ~CustomProfilerCallback() {} + + virtual void* zoneStart(const char* eventName, bool detached, uint64_t contextId) + { + // Option 1: add your own profiling code here (before calling the PVD function). + // If you call the PVD profiling function below, adding your own profiling code here + // means it will capture the cost of the PVD zoneStart function. + + // NB: we don't have an actual profiler implementation in the snippet so we just call printf instead + printf("start: %s\n", eventName); + + // Optional: call the PVD function if you want to see the profiling results in PVD. + void* profilerData = gCallPVDProfilingFunctions ? gPvd->zoneStart(eventName, detached, contextId) : NULL; + + // Option 2: add your own profiling code here (after calling the PVD function). + // If you call the PVD profiling function above, adding your own profiling code here + // means its cost will be captured by the PVD profiler. + + return profilerData; + } + + virtual void zoneEnd(void* profilerData, const char* eventName, bool detached, uint64_t contextId) + { + // Option 2: add your own profiling code here (before calling the PVD function). + // If you call the PVD profiling function below, adding your own profiling code here + // means its cost will be captured by the PVD profiler. + + // Optional: call the PVD function if you want to see the profiling results in PVD. + if(gCallPVDProfilingFunctions) + gPvd->zoneEnd(profilerData, eventName, detached, contextId); + + // Option 1: add your own profiling code here (after calling the PVD function). + // If you call the PVD profiling function above, adding your own profiling code here + // means it will capture the cost of the PVD zoneEnd function. + + // NB: we don't have an actual profiler implementation in the snippet so we just call printf instead + printf("end: %s\n", eventName); + } + + virtual void recordData(int32_t value, const char* valueName, uint64_t contextId) + { + printf("data: %s (context ID %llu) = %d\n", valueName, (unsigned long long)contextId, value); + } + + virtual void recordData(float value, const char* valueName, uint64_t contextId) + { + printf("data: %s (context ID %llu) = %f\n", valueName, (unsigned long long)contextId, (double)value); + } + + virtual void recordFrame(const char* name, uint64_t contextId) + { + printf("frame: %s (context ID %llu)\n", name, (unsigned long long)contextId); + } + +}gCustomProfilerCallback; + +void initPhysics(bool interactive) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + + // During the "connect" call, PVD sets itself up as the profiler if PxPvdInstrumentationFlag::ePROFILE is used. + // That is, it internally calls PxSetProfilerCallback() to setup its own profiling callback. Any calls to + // PxSetProfilerCallback() prior to calling "connect" is thus lost. + gPvd->connect(*transport, PxPvdInstrumentationFlag::eALL); + + // This call should be performed after PVD is initialized, otherwise it will have no effect. + PxSetProfilerCallback(&gCustomProfilerCallback); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(2); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + gScene = gPhysics->createScene(sceneDesc); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + for(PxU32 i=0;i<5;i++) + createStack(PxTransform(PxVec3(0,0,stackZ-=10.0f)), 10, 2.0f); + + if(!interactive) + createDynamic(PxTransform(PxVec3(0,40,100)), PxSphereGeometry(10), PxVec3(0,-50,-100)); +} + +void stepPhysics(bool /*interactive*/) +{ + gScene->simulate(1.0f/60.0f); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) + +{ PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd);; + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + +#if (PX_DEBUG || PX_CHECKED || PX_PROFILE) + printf("SnippetCustomProfiler done.\n"); +#else + printf("Warning: SnippetCustomProfiler does not capture the profiler timings in release build.\n"); +#endif +} + +void keyPress(unsigned char key, const PxTransform& camera) +{ + switch(toupper(key)) + { + case 'B': createStack(PxTransform(PxVec3(0,0,stackZ-=10.0f)), 10, 2.0f); break; + case ' ': createDynamic(camera, PxSphereGeometry(3.0f), camera.rotate(PxVec3(0,0,-1))*200); break; + } +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true); + } + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + cleanupPhysics(true); +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(50.0f, 50.0f, 50.0f), PxVec3(-0.6f,-0.2f,-0.7f)); + + Snippets::setupDefault("PhysX Snippet CustomProfiler", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetdeformablemesh/SnippetDeformableMesh.cpp b/engine/third_party/physx/snippets/snippetdeformablemesh/SnippetDeformableMesh.cpp new file mode 100644 index 00000000..fab5a2b0 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablemesh/SnippetDeformableMesh.cpp @@ -0,0 +1,333 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet shows how to use deformable meshes in PhysX. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" + +// temporary disable this snippet, cannot work without rendering we cannot include GL directly +#ifdef RENDER_SNIPPET + +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetrender/SnippetRender.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +static PxTriangleMesh* gMesh = NULL; +static PxRigidStatic* gActor = NULL; + +static const PxU32 gGridSize = 8; +static const PxReal gGridStep = 512.0f / PxReal(gGridSize-1); +static float gTime = 0.0f; + +static PxRigidDynamic* createDynamic(const PxTransform& t, const PxGeometry& geometry, const PxVec3& velocity=PxVec3(0), PxReal density=1.0f) +{ + PxRigidDynamic* dynamic = PxCreateDynamic(*gPhysics, t, geometry, *gMaterial, density); + dynamic->setLinearVelocity(velocity); + gScene->addActor(*dynamic); + return dynamic; +} + +static void createStack(const PxTransform& t, PxU32 size, PxReal halfExtent) +{ + PxShape* shape = gPhysics->createShape(PxBoxGeometry(halfExtent, halfExtent, halfExtent), *gMaterial); + for(PxU32 i=0; icreateRigidDynamic(t.transform(localTm)); + body->attachShape(*shape); + PxRigidBodyExt::updateMassAndInertia(*body, 10.0f); + gScene->addActor(*body); + } + } + shape->release(); +} + +struct Triangle +{ + PxU32 ind0, ind1, ind2; +}; + +static void updateVertices(PxVec3* verts, float amplitude=0.0f) +{ + const PxU32 gridSize = gGridSize; + const PxReal gridStep = gGridStep; + + for(PxU32 a=0; agetPhysicsInsertionCallback()); + + return triMesh; +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(2); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + gScene = gPhysics->createScene(sceneDesc); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(1.0f, 1.0f, 0.0f); + + PxCookingParams cookingParams(gPhysics->getTolerancesScale()); + + if(0) + { + cookingParams.midphaseDesc.setToDefault(PxMeshMidPhase::eBVH33); + } + else + { + cookingParams.midphaseDesc.setToDefault(PxMeshMidPhase::eBVH34); + cookingParams.midphaseDesc.mBVH34Desc.quantized = false; + } + // We need to disable the mesh cleaning part so that the vertex mapping remains untouched. + cookingParams.meshPreprocessParams = PxMeshPreprocessingFlag::eDISABLE_CLEAN_MESH; + + PxTriangleMesh* mesh = createMeshGround(cookingParams); + gMesh = mesh; + + PxTriangleMeshGeometry geom(mesh); + + PxRigidStatic* groundMesh = gPhysics->createRigidStatic(PxTransform(PxVec3(0, 2, 0))); + gActor = groundMesh; + PxShape* shape = gPhysics->createShape(geom, *gMaterial); + + { + shape->setContactOffset(0.02f); + // A negative rest offset helps to avoid jittering when the deformed mesh moves away from objects resting on it. + shape->setRestOffset(-0.5f); + } + + groundMesh->attachShape(*shape); + gScene->addActor(*groundMesh); + + createStack(PxTransform(PxVec3(0,22,0)), 10, 2.0f); +} + +PxBounds3 gBounds; +void debugRender() +{ + const PxVec3 c = gBounds.getCenter(); + const PxVec3 e = gBounds.getExtents(); + + PxVec3 pts[8]; + pts[0] = c + PxVec3(-e.x, -e.y, e.z); + pts[1] = c + PxVec3(-e.x, e.y, e.z); + pts[2] = c + PxVec3( e.x, e.y, e.z); + pts[3] = c + PxVec3( e.x, -e.y, e.z); + pts[4] = c + PxVec3(-e.x, -e.y, -e.z); + pts[5] = c + PxVec3(-e.x, e.y, -e.z); + pts[6] = c + PxVec3( e.x, e.y, -e.z); + pts[7] = c + PxVec3( e.x, -e.y, -e.z); + + PxArray gContactVertices; + struct AddQuad + { + static void func(PxArray& v, const PxVec3* pts_, PxU32 index0, PxU32 index1, PxU32 index2, PxU32 index3) + { + v.pushBack(pts_[index0]); + v.pushBack(pts_[index1]); + + v.pushBack(pts_[index1]); + v.pushBack(pts_[index2]); + + v.pushBack(pts_[index2]); + v.pushBack(pts_[index3]); + + v.pushBack(pts_[index3]); + v.pushBack(pts_[index0]); + } + }; + + AddQuad::func(gContactVertices, pts, 0, 1, 2, 3); + AddQuad::func(gContactVertices, pts, 4, 5, 6, 7); + AddQuad::func(gContactVertices, pts, 0, 1, 5, 4); + AddQuad::func(gContactVertices, pts, 2, 3, 7, 6); + + glColor4f(1.0f, 0.0f, 0.0f, 1.0f); + glDisable(GL_LIGHTING); + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, &gContactVertices[0]); + glDrawArrays(GL_LINES, 0, GLint(gContactVertices.size())); + glDisableClientState(GL_VERTEX_ARRAY); + glEnable(GL_LIGHTING); +} + +void stepPhysics(bool /*interactive*/) +{ + { + PxVec3* verts = gMesh->getVerticesForModification(); + gTime += 0.01f; + updateVertices(verts, sinf(gTime)*20.0f); + + { +// unsigned long long time = __rdtsc(); + gBounds = gMesh->refitBVH(); +// time = __rdtsc() - time; +// printf("Time: %d\n", int(time)); + } + + // Reset filtering to tell the broadphase about the new mesh bounds. + gScene->resetFiltering(*gActor); + } + gScene->simulate(1.0f/60.0f); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetDeformableMesh done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& camera) +{ + switch(toupper(key)) + { + case ' ': createDynamic(camera, PxSphereGeometry(3.0f), camera.rotate(PxVec3(0,0,-1))*200, 3.0f); break; + } +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + + debugRender(); + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + cleanupPhysics(true); +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(50.0f, 50.0f, 50.0f), PxVec3(-0.6f,-0.2f,-0.7f)); + + Snippets::setupDefault("PhysX Snippet DeformableMesh", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetdeformablesurface/SnippetDeformableSurface.cpp b/engine/third_party/physx/snippets/snippetdeformablesurface/SnippetDeformableSurface.cpp new file mode 100644 index 00000000..77d19519 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablesurface/SnippetDeformableSurface.cpp @@ -0,0 +1,371 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +// **************************************************************************** +// This snippet demonstrates how to setup triangle meshes with SDFs. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "extensions/PxDeformableSurfaceExt.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetdeformablesurface/SnippetDeformableSurface.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxCudaContextManager* gCudaContextManager = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +static bool gIsRunning = true; +PxArray gTestSurfaces; + +PxRigidDynamic* sphere; + +static void initObstacles() +{ + PxShape* shape = gPhysics->createShape(PxSphereGeometry(3.0f), *gMaterial); + sphere = gPhysics->createRigidDynamic(PxTransform(PxVec3(0.f, 5.0f, 0.f))); + sphere->attachShape(*shape); + sphere->setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, true); + gScene->addActor(*sphere); + shape->release(); +} + +static PxDeformableSurface* createDeformableSurface(PxPhysics& physics, PxTriangleMesh* triangleMesh, PxDeformableSurfaceMaterial** materials, const PxU32 nbMaterials, PxCudaContextManager* cudaContextManager) +{ + if (!triangleMesh) + return NULL; + + PxDeformableSurface* deformableSurface = physics.createDeformableSurface(*cudaContextManager); + if (deformableSurface) + { + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE; + + PxTriangleMeshGeometry geometry(triangleMesh); + PxShape* shape = physics.createShape(geometry, materials, PxU16(nbMaterials), true, shapeFlags); + if (shape) + { + deformableSurface->attachShape(*shape); + } + } + + return deformableSurface; +} + +static PxDeformableSurface* createDeformableSurface(PxPhysics& physics, const PxCookingParams& ckParams, PxArray& vertices, PxArray& triangles, + PxDeformableSurfaceMaterial** materials, const PxU32 nbMaterials, PxCudaContextManager* cudaContextManager) +{ + PxTriangleMeshDesc meshDesc; + meshDesc.points.count = vertices.size(); + meshDesc.triangles.count = triangles.size() / 3; + meshDesc.points.stride = sizeof(float) * 3; + meshDesc.triangles.stride = sizeof(int) * 3; + meshDesc.points.data = vertices.begin(); + meshDesc.triangles.data = triangles.begin(); + + PxDeformableMaterialTableIndex* materialIndices = NULL; + if (nbMaterials > 1) + { + const PxU32 totalTriangles = meshDesc.triangles.count; + materialIndices = new PxDeformableMaterialTableIndex[totalTriangles]; + const PxU32 averageTrianglePerMaterials = totalTriangles / nbMaterials; + + PxU32 accumulatedTriangle = averageTrianglePerMaterials; + + PxU32 index = 0; + for (PxU32 i = 0; i < totalTriangles; ++i) + { + materialIndices[i] = PxDeformableMaterialTableIndex(index); + if (i == accumulatedTriangle) + { + index = index < (nbMaterials - 1) ? index + 1 : index; + accumulatedTriangle += averageTrianglePerMaterials; + } + } + meshDesc.materialIndices.stride = sizeof(PxDeformableMaterialTableIndex); + meshDesc.materialIndices.data = materialIndices; + } + + PxTriangleMesh* triangleMesh = PxCreateTriangleMesh(ckParams, meshDesc, physics.getPhysicsInsertionCallback()); + + return createDeformableSurface(physics, triangleMesh, materials, nbMaterials, cudaContextManager); +} + +static PX_FORCE_INLINE PxU32 id(PxU32 x, PxU32 y, PxU32 numY) +{ + return x * numY + y; +} + +static PX_FORCE_INLINE PxReal computeTriangleMass(const PxU32* triangle, const PxVec3* vertices, PxReal thickness, PxReal density) +{ + PxReal area = 0.5f * (vertices[triangle[1]] - vertices[triangle[0]]).cross(vertices[triangle[2]] - vertices[triangle[0]]).magnitude(); + return area * thickness * density; +} + +static PxDeformableSurface* addQuadDeformableSurface(PxPhysics& physics, const PxCookingParams& ckParams, const PxTransform& transform, PxU32 numX, PxU32 numZ, PxReal sizeX, PxReal sizeZ, + PxDeformableSurfaceMaterial** materials, const PxU32 nbMaterials, PxCudaContextManager* cudaContextManager, PxReal thickness, PxReal density) +{ + if (gCudaContextManager == NULL) + { + return NULL; + } + + PxArray vertices; + PxArray triangles; + PxArray velocity; + PxArray triangleMasses; + + vertices.reserve(numX * numZ); + velocity.reserve(numX * numZ); + triangles.reserve(3 * 2 * (numX - 1) * (numZ - 1)); + triangleMasses.reserve(2 * (numX - 1) * (numZ - 1)); + + PxReal scalingX = sizeX / (numX - 1); + PxReal scalingZ = sizeZ / (numZ - 1); + + for (PxU32 i = 0; i < numX; ++i) + { + for (PxU32 j = 0; j < numZ; ++j) + { + PxVec3 pos(i * scalingX, 0.0f, j * scalingZ); + vertices.pushBack(pos); + velocity.pushBack(PxVec3(0.0f)); + } + } + + for (PxU32 i = 1; i < numX; ++i) + { + for (PxU32 j = 1; j < numZ; ++j) + { + triangles.pushBack(id(i - 1, j - 1, numZ)); + triangles.pushBack(id(i, j - 1, numZ)); + triangles.pushBack(id(i - 1, j, numZ)); + triangleMasses.pushBack(computeTriangleMass(&triangles[triangles.size() - 3], vertices.begin(), thickness, density)); + + triangles.pushBack(id(i - 1, j, numZ)); + triangles.pushBack(id(i, j - 1, numZ)); + triangles.pushBack(id(i, j, numZ)); + triangleMasses.pushBack(computeTriangleMass(&triangles[triangles.size() - 3], vertices.begin(), thickness, density)); + } + } + + PxDeformableSurface* deformableSurface = createDeformableSurface(physics, ckParams, vertices, triangles, materials, nbMaterials, cudaContextManager); + gScene->addActor(*deformableSurface); + + PxVec4* posInvMassPinned; + PxVec4* velocityPinned; + PxVec4* restPositionPinned; + PxDeformableSurfaceExt::allocateAndInitializeHostMirror(*deformableSurface, vertices.begin(), velocity.begin(), vertices.begin(), 0.5f, + transform, cudaContextManager, posInvMassPinned, velocityPinned, restPositionPinned); + + PxDeformableSurfaceExt::distributeTriangleMassToVertices(*deformableSurface, triangleMasses.begin(), posInvMassPinned); + + PxShape* surfaceShape = deformableSurface->getShape(); + surfaceShape->setContactOffset(2.0f * thickness); + surfaceShape->setRestOffset(thickness); + surfaceShape->setDeformableSurfaceMaterials(materials, PxU16(nbMaterials)); + + PxDeformableSurfaceExt::copyToDevice(*deformableSurface, PxDeformableSurfaceDataFlag::eALL, vertices.size(), posInvMassPinned, velocityPinned, restPositionPinned); + + TestSurface testSurface(deformableSurface, gCudaContextManager); + + gTestSurfaces.pushBack(testSurface); + + PX_EXT_PINNED_MEMORY_FREE(*cudaContextManager, posInvMassPinned); + PX_EXT_PINNED_MEMORY_FREE(*cudaContextManager, velocityPinned); + PX_EXT_PINNED_MEMORY_FREE(*cudaContextManager, restPositionPinned); + + return deformableSurface; +} + +static void createScene(PxCookingParams& cookingParams) +{ + PxReal thickness = 0.01f; + PxReal bendingStiffness = 0.00001f; + + PxDeformableSurfaceMaterial* deformableSurfaceMaterial = gPhysics->createDeformableSurfaceMaterial(1.e10f, 0.3f, 0.5f, thickness, bendingStiffness); + + PxReal size = 15.0f; + PxDeformableSurface* deformableSurface = addQuadDeformableSurface(*gPhysics, cookingParams, + PxTransform(PxVec3(-0.5f * size, 10.0f, -0.5f * size)), 200, 200, size, size, &deformableSurfaceMaterial, 1, gCudaContextManager, thickness, 500.0f); + if (deformableSurface) + { + deformableSurface->setSelfCollisionFilterDistance(thickness * 2.5f); + deformableSurface->setLinearDamping(0.f); + deformableSurface->setDeformableBodyFlag(PxDeformableBodyFlag::eDISABLE_SELF_COLLISION, false); + + deformableSurface->setMaxVelocity(1000.0f); + + PxU32 collisionPairUpdateFrequency = 1; + PxU32 nbCollisionSubsteps = 1; + deformableSurface->setNbCollisionPairUpdatesPerTimestep(collisionPairUpdateFrequency); + deformableSurface->setNbCollisionSubsteps(nbCollisionSubsteps); + } + + initObstacles(); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + // initialize cuda + PxCudaContextManagerDesc cudaContextManagerDesc; + gCudaContextManager = PxCreateCudaContextManager(*gFoundation, cudaContextManagerDesc, PxGetProfilerCallback()); + if (gCudaContextManager && !gCudaContextManager->contextIsValid()) + { + PX_RELEASE(gCudaContextManager); + printf("Failed to initialize cuda context.\n"); + printf("The deformable surface feature is currently only supported on GPU.\n"); + } + + PxTolerancesScale scale; + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, scale, true, gPvd); + PxInitExtensions(*gPhysics, gPvd); + + PxCookingParams params(scale); + params.meshWeldTolerance = 0.001f; + params.meshPreprocessParams = PxMeshPreprocessingFlags(PxMeshPreprocessingFlag::eWELD_VERTICES); + params.buildTriangleAdjacencies = false; + params.buildGPUData = true; + params.midphaseDesc = PxMeshMidPhase::eBVH34; + //params.meshPreprocessParams |= PxMeshPreprocessingFlag::eFORCE_32BIT_INDICES; + params.meshPreprocessParams |= PxMeshPreprocessingFlag::eENABLE_VERT_MAPPING; + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + + if (!sceneDesc.cudaContextManager) + sceneDesc.cudaContextManager = gCudaContextManager; + + sceneDesc.flags |= PxSceneFlag::eENABLE_GPU_DYNAMICS; + sceneDesc.flags |= PxSceneFlag::eENABLE_PCM; + + PxU32 numCores = SnippetUtils::getNbPhysicalCores(); + gDispatcher = PxDefaultCpuDispatcherCreate(numCores == 0 ? 0 : numCores - 1); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + sceneDesc.broadPhaseType = PxBroadPhaseType::eGPU; + sceneDesc.gpuMaxNumPartitions = 8; + + sceneDesc.solverType = PxSolverType::eTGS; + + gScene = gPhysics->createScene(sceneDesc); + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + createScene(params); +} + +PxReal simTime = 0; +void stepPhysics(bool /*interactive*/) +{ + if (gIsRunning) + { + const PxReal dt = 1.0f / 60.0f; + + bool rotatingSphere = true; + if (rotatingSphere) + { + const PxReal speed = 2.0f; + PxTransform pose = sphere->getGlobalPose(); + sphere->setKinematicTarget(PxTransform(pose.p, PxQuat(PxCos(simTime*speed), PxVec3(0, 1, 0)))); + } + + gScene->simulate(dt); + gScene->fetchResults(true); + + for (PxU32 i = 0; i < gTestSurfaces.size(); i++) + { + TestSurface* c = &gTestSurfaces[i]; + c->copyDeformedVerticesFromGPU(); + } + + simTime += dt; + } +} + +void cleanupPhysics(bool /*interactive*/) +{ + for (PxU32 i = 0; i < gTestSurfaces.size(); i++) + gTestSurfaces[i].release(); + gTestSurfaces.reset(); + + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if (gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PxCloseExtensions(); + PX_RELEASE(gCudaContextManager); + PX_RELEASE(gFoundation); + + printf("SnippetDeformableSurface done.\n"); +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetShape(); + + const physx::PxTriangleMeshGeometry& triangleMeshGeom = static_cast(shape->getGeometry()); + mTriangleMesh = triangleMeshGeom.triangleMesh; + + mPositionsInvMass = PX_EXT_PINNED_MEMORY_ALLOC(physx::PxVec4, *cudaContextManager, mTriangleMesh->getNbVertices()); + } + + ~TestSurface() + { + } + + void release() + { + if (mDeformableSurface) + mDeformableSurface->release(); + PX_EXT_PINNED_MEMORY_FREE(*mCudaContextManager, mPositionsInvMass); + } + + void copyDeformedVerticesFromGPUAsync(CUstream stream) + { + physx::PxScopedCudaLock _lock(*mCudaContextManager); + mCudaContextManager->getCudaContext()->memcpyDtoHAsync(mPositionsInvMass, reinterpret_cast(mDeformableSurface->getPositionInvMassBufferD()), mTriangleMesh->getNbVertices() * sizeof(physx::PxVec4), stream); + } + + void copyDeformedVerticesFromGPU() + { + physx::PxScopedCudaLock _lock(*mCudaContextManager); + mCudaContextManager->getCudaContext()->memcpyDtoH(mPositionsInvMass, reinterpret_cast(mDeformableSurface->getPositionInvMassBufferD()), mTriangleMesh->getNbVertices() * sizeof(physx::PxVec4)); + } + + + physx::PxVec4* mPositionsInvMass; + physx::PxDeformableSurface* mDeformableSurface; + physx::PxCudaContextManager* mCudaContextManager; + physx::PxTriangleMesh* mTriangleMesh; +}; + +#endif // PHYSX_SNIPPET_DEFORMABLE_SURFACE_H diff --git a/engine/third_party/physx/snippets/snippetdeformablesurface/SnippetDeformableSurfaceRender.cpp b/engine/third_party/physx/snippets/snippetdeformablesurface/SnippetDeformableSurfaceRender.cpp new file mode 100644 index 00000000..612cb1a4 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablesurface/SnippetDeformableSurfaceRender.cpp @@ -0,0 +1,104 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#ifdef RENDER_SNIPPET + +#include "PxPhysicsAPI.h" + +#include "../snippetrender/SnippetRender.h" +#include "../snippetrender/SnippetCamera.h" +#include "SnippetDeformableSurface.h" + +using namespace physx; + +extern void initPhysics(bool interactive); +extern void stepPhysics(bool interactive); +extern void cleanupPhysics(bool interactive); +extern PxArray gTestSurfaces; + +namespace +{ +Snippets::Camera* sCamera; + +void renderCallback() +{ + stepPhysics(true); + + Snippets::startRender(sCamera); + + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + const PxVec3 rcaColor(0.6f*0.75f, 0.8f*0.75f, 1.0f*0.75f); + + PxScene* scene; + PxGetPhysics().getScenes(&scene,1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + for (PxU32 i = 0; i < gTestSurfaces.size(); i++) + { + TestSurface* testSurface = &gTestSurfaces[i]; + PxTriangleMesh* mesh = testSurface->mTriangleMesh; + Snippets::renderMesh(mesh->getNbVertices(), testSurface->mPositionsInvMass, mesh->getNbTriangles(), mesh->getTriangles(), + mesh->getTriangleMeshFlags() & PxTriangleMeshFlag::e16_BIT_INDICES, rcaColor, NULL, false, true); + Snippets::renderMesh(mesh->getNbVertices(), testSurface->mPositionsInvMass, mesh->getNbTriangles(), mesh->getTriangles(), + mesh->getTriangleMeshFlags() & PxTriangleMeshFlag::e16_BIT_INDICES, rcaColor, NULL, true, true); + } + + Snippets::showFPS(); + Snippets::finishRender(); +} + +void cleanup() +{ + delete sCamera; + cleanupPhysics(true); +} + +void exitCallback() +{ +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(15.0f, 10.0f, 15.0f), PxVec3(-0.6f, -0.2f, -0.6f)); + + Snippets::setupDefault("PhysX Snippet Deformable Surface", sCamera, NULL, renderCallback, exitCallback); + + initPhysics(true); + Snippets::initFPS(); + glutMainLoop(); + + cleanup(); +} + +#endif diff --git a/engine/third_party/physx/snippets/snippetdeformablesurfaceskinning/SnippetDeformableSurfaceSkinning.cpp b/engine/third_party/physx/snippets/snippetdeformablesurfaceskinning/SnippetDeformableSurfaceSkinning.cpp new file mode 100644 index 00000000..76ec588c --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablesurfaceskinning/SnippetDeformableSurfaceSkinning.cpp @@ -0,0 +1,617 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet demonstrates how to setup triangle meshes with SDFs. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetdeformablesurfaceskinning/SnippetDeformableSurfaceSkinning.h" +#include "PxDeformableSkinning.h" +#include "gpu/PxPhysicsGpu.h" +#include "extensions/PxCudaHelpersExt.h" +#include "extensions/PxDeformableSkinningExt.h" +#include "extensions/PxRemeshingExt.h" + +using namespace physx; +using namespace physx::Ext; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxCudaContextManager* gCudaContextManager = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +static bool gIsRunning = true; +PxArray gDeformableSurfaces; +PxArray gSkinnedMeshes; +BasePostSolveCallback* gSkinning; + +PxRigidDynamic* sphere; + +template +struct HostAndDeviceBuffer +{ + PxCudaContextManager* mContextManager; + T* mDeviceData; + T* mHostData; + PxU32 mNumElements; + + HostAndDeviceBuffer() : + mContextManager(NULL), mDeviceData(NULL), mHostData(NULL), mNumElements(0) + {} + + HostAndDeviceBuffer(PxCudaContextManager* contextManager, PxU32 numElements) : + mContextManager(contextManager), mDeviceData(NULL), mHostData(NULL), mNumElements(0) + { + allocate(numElements); + } + + void initialize(PxCudaContextManager* contextManager, PxU32 numElements) + { + mContextManager = contextManager; + allocate(numElements); + } + + void initialize(PxCudaContextManager* contextManager, const T* dataSource, PxU32 numElements) + { + mContextManager = contextManager; + allocate(numElements); + PxMemCopy(mHostData, dataSource, numElements * sizeof(T)); + } + + void allocate(PxU32 numElements) + { + release(); + mDeviceData = PxCudaHelpersExt::allocDeviceBuffer(*mContextManager, numElements); + mHostData = PxCudaHelpersExt::allocPinnedHostBuffer(*mContextManager, numElements); + mNumElements = numElements; + } + + void copyDeviceToHost(PxU32 numElementsToCopy = 0xFFFFFFFF) + { + PxCudaHelpersExt::copyDToH(*mContextManager, mHostData, mDeviceData, PxMin(numElementsToCopy, mNumElements)); + } + + void copyHostToDevice(PxU32 numElementsToCopy = 0xFFFFFFFF) + { + PxCudaHelpersExt::copyHToD(*mContextManager, mDeviceData, mHostData, PxMin(numElementsToCopy, mNumElements)); + } + + void copyDeviceToHostAsync(CUstream stream, PxU32 numElementsToCopy = 0xFFFFFFFF) + { + PxCudaHelpersExt::copyDToHAsync(*mContextManager, mHostData, mDeviceData, PxMin(numElementsToCopy, mNumElements), stream); + } + + void release() + { + PxCudaHelpersExt::freeDeviceBuffer(*mContextManager, mDeviceData); + PxCudaHelpersExt::freePinnedHostBuffer(*mContextManager, mHostData); + } +}; + + +struct SurfaceSkinningHelper +{ + PxDeformableSurface* mDeformableSurface; + HostAndDeviceBuffer mSurfaceTriangles; + HostAndDeviceBuffer mNormalVectors; + HostAndDeviceBuffer mSkinningInfo; + HostAndDeviceBuffer mSkinnedVertices; + PxU32 mNumSkinnedVertices; + PxReal mHalfThickness; + + + SurfaceSkinningHelper() : mDeformableSurface(NULL), mNumSkinnedVertices(0) + { } + + SurfaceSkinningHelper(PxCudaContextManager* contextManager, PxDeformableSurface* deformableSurface, PxVec3* skinnedPointsRestPosition, PxU32 nbSkinnedPoints) + : mDeformableSurface(deformableSurface) + { + const physx::PxTriangleMeshGeometry& triangleMeshGeom = + static_cast(deformableSurface->getShape()->getGeometry()); + + PxU32 nbTriangles = triangleMeshGeom.triangleMesh->getNbTriangles(); + + bool uses16bit = triangleMeshGeom.triangleMesh->getTriangleMeshFlags() & PxTriangleMeshFlag::e16_BIT_INDICES; + mSurfaceTriangles.initialize(contextManager, 3 * nbTriangles); + + if (uses16bit) + { + const PxU16* triangleIndices = reinterpret_cast(triangleMeshGeom.triangleMesh->getTriangles()); + for (PxU32 i = 0; i < mSurfaceTriangles.mNumElements; ++i) + mSurfaceTriangles.mHostData[i] = triangleIndices[i]; + } + else + { + const PxU32* triangleIndices = reinterpret_cast(triangleMeshGeom.triangleMesh->getTriangles()); + for (PxU32 i = 0; i < mSurfaceTriangles.mNumElements; ++i) + mSurfaceTriangles.mHostData[i] = triangleIndices[i]; + } + + mNormalVectors.initialize(contextManager, triangleMeshGeom.triangleMesh->getNbVertices()); + mSkinnedVertices.initialize(contextManager, skinnedPointsRestPosition, nbSkinnedPoints); + mNumSkinnedVertices = nbSkinnedPoints; + mSkinningInfo.initialize(contextManager, nbSkinnedPoints); + + PxDeformableSkinningExt::initializeInterpolatedVertices( + mSkinningInfo.mHostData, triangleMeshGeom.triangleMesh->getVertices(), NULL, mSurfaceTriangles.mHostData, + nbTriangles, skinnedPointsRestPosition, nbSkinnedPoints); + + mSurfaceTriangles.copyHostToDevice(); + mSkinnedVertices.copyHostToDevice(); + mSkinningInfo.copyHostToDevice(); + + PxShape* surfaceShape = deformableSurface->getShape(); + mHalfThickness = surfaceShape->getRestOffset(); + } + + void packageGpuData(PxTrimeshSkinningGpuData& target) + { + target.guideVerticesD.data = reinterpret_cast(mDeformableSurface->getPositionInvMassBufferD()); + target.guideVerticesD.stride = sizeof(PxVec4); + target.guideVerticesD.count = mNormalVectors.mNumElements; + + target.guideNormalsD = mNormalVectors.mDeviceData; + target.guideTrianglesD = mSurfaceTriangles.mDeviceData; + target.skinningInfoPerVertexD = mSkinningInfo.mDeviceData; + target.skinnedVerticesD.data = mSkinnedVertices.mHostData; //Works because host data is pinned memory + target.skinnedVerticesD.stride = sizeof(PxVec3); + target.skinnedVerticesD.count = mNumSkinnedVertices; + + target.halfSurfaceThickness = mHalfThickness; + target.nbGuideTriangles = mSurfaceTriangles.mNumElements / 3; + + } + + void release() + { + mSurfaceTriangles.release(); + mNormalVectors.release(); + mSkinnedVertices.release(); + mSkinningInfo.release(); + } +}; + +struct PostSolveCallback : BasePostSolveCallback, PxUserAllocated +{ + CUstream mSkinningStream; + PxCudaContextManager* mContextManager; + PxDeformableSkinning* skinning; + PxArray skinningHelpers; + HostAndDeviceBuffer packagedSkinningData; + + + PostSolveCallback(PxCudaContextManager* contextManager, PxU32 maxNumCloths) : + mContextManager(contextManager) + { + const PxU32 CU_STREAM_NON_BLOCKING = 0x1; + mContextManager->getCudaContext()->streamCreate(&mSkinningStream, CU_STREAM_NON_BLOCKING); + + skinning = PxGetPhysicsGpu()->createDeformableSkinning(contextManager); + + packagedSkinningData.initialize(contextManager, maxNumCloths); + skinningHelpers.resize(maxNumCloths); + } + + void setCloth(PxU32 index, PxDeformableSurface* deformableSurface, PxVec3* skinnedPointsRestPosition, PxU32 nbSkinnedPoints) + { + skinningHelpers[index] = SurfaceSkinningHelper(mContextManager, deformableSurface, skinnedPointsRestPosition, nbSkinnedPoints); + } + + virtual void onPostSolve(CUevent startEvent) + { + mContextManager->getCudaContext()->streamWaitEvent(mSkinningStream, startEvent); + + for (PxU32 i = 0; i < skinningHelpers.size(); ++i) + { + skinningHelpers[i].packageGpuData(packagedSkinningData.mHostData[i]); + } + packagedSkinningData.copyHostToDevice(skinningHelpers.size()); + + skinning->computeNormalVectors(packagedSkinningData.mDeviceData, skinningHelpers.size(), mSkinningStream); + skinning->evaluateVerticesEmbeddedIntoSurface(packagedSkinningData.mDeviceData, skinningHelpers.size(), mSkinningStream); + + //mSkinnedVertices.copyDeviceToHostAsync(mSkinningStream); + } + + virtual void synchronize() + { + mContextManager->getCudaContext()->streamSynchronize(mSkinningStream); + } + + virtual PxVec3* getSkinnedVertices(PxU32 clothIndex) + { + return skinningHelpers[clothIndex].mSkinnedVertices.mHostData; + } + + ~PostSolveCallback() + { + mContextManager->getCudaContext()->streamDestroy(mSkinningStream); + for (PxU32 i = 0; i < skinningHelpers.size(); ++i) + skinningHelpers[i].release(); + PX_DELETE(skinning); + } +}; + +PostSolveCallback* postSolveCallback; + + +static void initObstacles() +{ + PxShape* shape = gPhysics->createShape(PxSphereGeometry(3.0f), *gMaterial); + sphere = gPhysics->createRigidDynamic(PxTransform(PxVec3(0.f, 5.0f, 0.f))); + sphere->attachShape(*shape); + sphere->setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, true); + gScene->addActor(*sphere); + shape->release(); +} + +static PxDeformableSurface* createDeformableSurface(PxPhysics& physics, PxTriangleMesh* triangleMesh, PxDeformableSurfaceMaterial** materials, const PxU32 nbMaterials, PxCudaContextManager* cudaContextManager) +{ + if (!triangleMesh) + return NULL; + + PxDeformableSurface* deformableSurface = physics.createDeformableSurface(*cudaContextManager); + if (deformableSurface) + { + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE; + + PxTriangleMeshGeometry geometry(triangleMesh); + PxShape* shape = physics.createShape(geometry, materials, PxU16(nbMaterials), true, shapeFlags); + if (shape) + { + deformableSurface->attachShape(*shape); + } + } + + return deformableSurface; +} + +static PxDeformableSurface* createDeformableSurface(PxPhysics& physics, const PxCookingParams& ckParams, PxArray& vertices, PxArray& triangles, + PxDeformableSurfaceMaterial** materials, const PxU32 nbMaterials, PxCudaContextManager* cudaContextManager) +{ + PxTriangleMeshDesc meshDesc; + meshDesc.points.count = vertices.size(); + meshDesc.triangles.count = triangles.size() / 3; + meshDesc.points.stride = sizeof(float) * 3; + meshDesc.triangles.stride = sizeof(int) * 3; + meshDesc.points.data = vertices.begin(); + meshDesc.triangles.data = triangles.begin(); + + PxDeformableMaterialTableIndex* materialIndices = NULL; + if (nbMaterials > 1) + { + const PxU32 totalTriangles = meshDesc.triangles.count; + materialIndices = new PxDeformableMaterialTableIndex[totalTriangles]; + const PxU32 averageTrianglePerMaterials = totalTriangles / nbMaterials; + + PxU32 accumulatedTriangle = averageTrianglePerMaterials; + + PxU32 index = 0; + for (PxU32 i = 0; i < totalTriangles; ++i) + { + materialIndices[i] = PxDeformableMaterialTableIndex(index); + if (i == accumulatedTriangle) + { + index = index < (nbMaterials - 1) ? index + 1 : index; + accumulatedTriangle += averageTrianglePerMaterials; + } + } + meshDesc.materialIndices.stride = sizeof(PxDeformableMaterialTableIndex); + meshDesc.materialIndices.data = materialIndices; + } + + PxTriangleMesh* triangleMesh = PxCreateTriangleMesh(ckParams, meshDesc, physics.getPhysicsInsertionCallback()); + + return createDeformableSurface(physics, triangleMesh, materials, nbMaterials, cudaContextManager); +} + +static PX_FORCE_INLINE PxU32 id(PxU32 x, PxU32 y, PxU32 numY) +{ + return x * numY + y; +} + +static PX_FORCE_INLINE PxReal computeTriangleMass(const PxU32* triangle, const PxVec3* vertices, PxReal thickness, PxReal density) +{ + PxReal area = 0.5f * (vertices[triangle[1]] - vertices[triangle[0]]).cross(vertices[triangle[2]] - vertices[triangle[0]]).magnitude(); + return area * thickness * density; +} + +static PxDeformableSurface* addQuadDeformableSurface(PxPhysics& physics, const PxCookingParams& ckParams, const PxTransform& transform, PxU32 numX, PxU32 numZ, PxReal sizeX, PxReal sizeZ, + PxDeformableSurfaceMaterial** materials, const PxU32 nbMaterials, PxCudaContextManager* cudaContextManager, PxReal thickness, PxReal density) +{ + if (gCudaContextManager == NULL) + { + return NULL; + } + + PxArray vertices; + PxArray triangles; + PxArray velocity; + PxArray triangleMasses; + + vertices.reserve(numX * numZ); + velocity.reserve(numX * numZ); + triangles.reserve(3 * 2 * (numX - 1) * (numZ - 1)); + triangleMasses.reserve(2 * (numX - 1) * (numZ - 1)); + + PxReal scalingX = sizeX / (numX - 1); + PxReal scalingZ = sizeZ / (numZ - 1); + + for (PxU32 i = 0; i < numX; ++i) + { + for (PxU32 j = 0; j < numZ; ++j) + { + PxVec3 pos(i * scalingX, 0.0f, j * scalingZ); + vertices.pushBack(pos); + velocity.pushBack(PxVec3(0.0f)); + } + } + + for (PxU32 i = 1; i < numX; ++i) + { + for (PxU32 j = 1; j < numZ; ++j) + { + triangles.pushBack(id(i - 1, j - 1, numZ)); + triangles.pushBack(id(i, j - 1, numZ)); + triangles.pushBack(id(i - 1, j, numZ)); + triangleMasses.pushBack(computeTriangleMass(&triangles[triangles.size() - 3], vertices.begin(), thickness, density)); + + triangles.pushBack(id(i - 1, j, numZ)); + triangles.pushBack(id(i, j - 1, numZ)); + triangles.pushBack(id(i, j, numZ)); + triangleMasses.pushBack(computeTriangleMass(&triangles[triangles.size() - 3], vertices.begin(), thickness, density)); + } + } + + PxArray subdividedTriangles = triangles; + PxArray subdividedVertices = vertices; + PxRemeshingExt::limitMaxEdgeLength(subdividedTriangles, subdividedVertices, 0.0001f, 3); + + SkinnedMesh mesh; + for (PxU32 i = 0; i < subdividedTriangles.size(); ++i) + mesh.mTriangles.pushBack(subdividedTriangles[i]); + for (PxU32 i = 0; i < subdividedVertices.size(); ++i) + mesh.mVertices.pushBack(subdividedVertices[i]); + + gSkinnedMeshes.pushBack(mesh); + + + PxDeformableSurface* deformableSurface = createDeformableSurface(physics, ckParams, vertices, triangles, materials, nbMaterials, cudaContextManager); + gScene->addActor(*deformableSurface); + + PxVec4* posInvMassPinned; + PxVec4* velocityPinned; + PxVec4* restPositionPinned; + PxDeformableSurfaceExt::allocateAndInitializeHostMirror(*deformableSurface, vertices.begin(), velocity.begin(), vertices.begin(), 0.5f, + transform, cudaContextManager, posInvMassPinned, velocityPinned, restPositionPinned); + + PxDeformableSurfaceExt::distributeTriangleMassToVertices(*deformableSurface, triangleMasses.begin(), posInvMassPinned); + + PxShape* surfaceShape = deformableSurface->getShape(); + surfaceShape->setContactOffset(2.0f * thickness); + surfaceShape->setRestOffset(thickness); + surfaceShape->getDeformableSurfaceMaterials(materials, PxU16(nbMaterials)); + + PxDeformableSurfaceExt::copyToDevice(*deformableSurface, PxDeformableSurfaceDataFlag::eALL, vertices.size(), posInvMassPinned, velocityPinned, restPositionPinned); + + DeformableSurface cloth(deformableSurface, gCudaContextManager); + + gDeformableSurfaces.pushBack(cloth); + + PX_EXT_PINNED_MEMORY_FREE(*cudaContextManager, posInvMassPinned); + PX_EXT_PINNED_MEMORY_FREE(*cudaContextManager, velocityPinned); + PX_EXT_PINNED_MEMORY_FREE(*cudaContextManager, restPositionPinned); + + return deformableSurface; +} + +static void createScene(PxCookingParams& cookingParams) +{ + PxReal thickness = 0.075f; + PxReal bendingStiffness = 0.00001f; + + PxDeformableSurfaceMaterial* clothMaterial = gPhysics->createDeformableSurfaceMaterial(1.e8f, 0.3f, 0.5f, thickness, bendingStiffness); + + PxReal size = 15.0f; + + for (PxU32 i = 0; i < 2; ++i) + { + PxDeformableSurface* deformableSurface = addQuadDeformableSurface(*gPhysics, cookingParams, PxTransform(PxVec3(-0.5f * size, 10.0f + i, -0.5f * size)), 30, 30, size, size, &clothMaterial, 1, gCudaContextManager, thickness, 500.0f); + if (deformableSurface) + { + deformableSurface->setSelfCollisionFilterDistance(thickness * 2.5f); + deformableSurface->setLinearDamping(0.f); + deformableSurface->setDeformableBodyFlag(PxDeformableBodyFlag::eDISABLE_SELF_COLLISION, false); + deformableSurface->setMaxVelocity(1000.0f); + + PxU32 collisionPairUpdateFrequency = 1; + PxU32 nbCollisionSubsteps = 1; + deformableSurface->setNbCollisionPairUpdatesPerTimestep(collisionPairUpdateFrequency); + deformableSurface->setNbCollisionSubsteps(nbCollisionSubsteps); + + } + } + + postSolveCallback = PX_NEW(PostSolveCallback)(gCudaContextManager, PxU32(gSkinnedMeshes.size())); + gSkinning = postSolveCallback; + gScene->setDeformableSurfaceGpuPostSolveCallback(postSolveCallback); + + for (PxU32 i = 0; i < gSkinnedMeshes.size(); ++i) + { + SkinnedMesh& skinnedMesh = gSkinnedMeshes[i]; + postSolveCallback->setCloth(i, gDeformableSurfaces[i].mDeformableSurface, &skinnedMesh.mVertices[0], PxU32(skinnedMesh.mVertices.size())); + } + + + initObstacles(); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + // initialize cuda + PxCudaContextManagerDesc cudaContextManagerDesc; + gCudaContextManager = PxCreateCudaContextManager(*gFoundation, cudaContextManagerDesc, PxGetProfilerCallback()); + if (gCudaContextManager && !gCudaContextManager->contextIsValid()) + { + PX_RELEASE(gCudaContextManager); + printf("Failed to initialize cuda context.\n"); + printf("The DeformableSurface feature is currently only supported on GPU.\n"); + } + + PxTolerancesScale scale; + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, scale, true, gPvd); + PxInitExtensions(*gPhysics, gPvd); + + PxCookingParams params(scale); + params.meshWeldTolerance = 0.001f; + params.meshPreprocessParams = PxMeshPreprocessingFlags(PxMeshPreprocessingFlag::eWELD_VERTICES); + params.buildTriangleAdjacencies = false; + params.buildGPUData = true; + params.midphaseDesc = PxMeshMidPhase::eBVH34; + //params.meshPreprocessParams |= PxMeshPreprocessingFlag::eFORCE_32BIT_INDICES; + params.meshPreprocessParams |= PxMeshPreprocessingFlag::eENABLE_VERT_MAPPING; + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + + if (!sceneDesc.cudaContextManager) + sceneDesc.cudaContextManager = gCudaContextManager; + + sceneDesc.flags |= PxSceneFlag::eENABLE_GPU_DYNAMICS; + sceneDesc.flags |= PxSceneFlag::eENABLE_PCM; + + PxU32 numCores = SnippetUtils::getNbPhysicalCores(); + gDispatcher = PxDefaultCpuDispatcherCreate(numCores == 0 ? 0 : numCores - 1); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + sceneDesc.broadPhaseType = PxBroadPhaseType::eGPU; + sceneDesc.gpuMaxNumPartitions = 8; + + sceneDesc.solverType = PxSolverType::eTGS; + + gScene = gPhysics->createScene(sceneDesc); + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + createScene(params); +} + +PxReal simTime = 0; +void stepPhysics(bool /*interactive*/) +{ + if (gIsRunning) + { + const PxReal dt = 1.0f / 60.0f; + + bool rotatingSphere = true; + if (rotatingSphere) + { + const PxReal speed = 2.0f; + PxTransform pose = sphere->getGlobalPose(); + sphere->setKinematicTarget(PxTransform(pose.p, PxQuat(PxCos(simTime*speed), PxVec3(0, 1, 0)))); + } + + gScene->simulate(dt); + gScene->fetchResults(true); + + for (PxU32 i = 0; i < gDeformableSurfaces.size(); i++) + { + DeformableSurface* c = &gDeformableSurfaces[i]; + c->copyDeformedVerticesFromGPU(); + } + + simTime += dt; + } +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_DELETE(postSolveCallback); + + for (PxU32 i = 0; i < gDeformableSurfaces.size(); i++) + gDeformableSurfaces[i].release(); + gDeformableSurfaces.reset(); + + gSkinnedMeshes.reset(); + + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if (gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PxCloseExtensions(); + PX_RELEASE(gCudaContextManager); + PX_RELEASE(gFoundation); + + printf("SnippetDeformableSurfaceSkinning done.\n"); +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; i mVertices; + physx::PxArray mTriangles; +}; + +struct BasePostSolveCallback : physx::PxPostSolveCallback +{ + virtual void synchronize() = 0; + virtual physx::PxVec3* getSkinnedVertices(physx::PxU32 clothIndex) = 0; +}; + +class DeformableSurface +{ +public: + DeformableSurface() : + mPositionsInvMass(NULL), + mDeformableSurface(NULL), + mCudaContextManager(NULL), + mTriangleMesh(NULL) + { } + + DeformableSurface(physx::PxDeformableSurface* deformableSurface, physx::PxCudaContextManager* cudaContextManager) : + mDeformableSurface(deformableSurface), + mCudaContextManager(cudaContextManager) + { + physx::PxShape* shape = deformableSurface->getShape(); + + const physx::PxTriangleMeshGeometry& triangleMeshGeom = static_cast(shape->getGeometry()); + mTriangleMesh = triangleMeshGeom.triangleMesh; + + mPositionsInvMass = PX_EXT_PINNED_MEMORY_ALLOC(physx::PxVec4, *cudaContextManager, mTriangleMesh->getNbVertices()); + } + + ~DeformableSurface() + { + } + + void release() + { + if (mDeformableSurface) + mDeformableSurface->release(); + PX_EXT_PINNED_MEMORY_FREE(*mCudaContextManager, mPositionsInvMass); + } + + void copyDeformedVerticesFromGPUAsync(CUstream stream) + { + physx::PxScopedCudaLock _lock(*mCudaContextManager); + mCudaContextManager->getCudaContext()->memcpyDtoHAsync(mPositionsInvMass, reinterpret_cast(mDeformableSurface->getPositionInvMassBufferD()), mTriangleMesh->getNbVertices() * sizeof(physx::PxVec4), stream); + } + + void copyDeformedVerticesFromGPU() + { + physx::PxScopedCudaLock _lock(*mCudaContextManager); + mCudaContextManager->getCudaContext()->memcpyDtoH(mPositionsInvMass, reinterpret_cast(mDeformableSurface->getPositionInvMassBufferD()), mTriangleMesh->getNbVertices() * sizeof(physx::PxVec4)); + } + + + physx::PxVec4* mPositionsInvMass; + physx::PxDeformableSurface* mDeformableSurface; + physx::PxCudaContextManager* mCudaContextManager; + physx::PxTriangleMesh* mTriangleMesh; +}; + +#endif diff --git a/engine/third_party/physx/snippets/snippetdeformablesurfaceskinning/SnippetDeformableSurfaceSkinningRender.cpp b/engine/third_party/physx/snippets/snippetdeformablesurfaceskinning/SnippetDeformableSurfaceSkinningRender.cpp new file mode 100644 index 00000000..3efc2e48 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablesurfaceskinning/SnippetDeformableSurfaceSkinningRender.cpp @@ -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. + +#ifdef RENDER_SNIPPET + +#include + +#include "PxPhysicsAPI.h" + +#include "../snippetrender/SnippetRender.h" +#include "../snippetrender/SnippetCamera.h" +#include "SnippetDeformableSurfaceSkinning.h" + +using namespace physx; + +extern void initPhysics(bool interactive); +extern void stepPhysics(bool interactive); +extern void cleanupPhysics(bool interactive); +extern PxArray gDeformableSurfaces; +extern PxArray gSkinnedMeshes; +extern BasePostSolveCallback* gSkinning; + +namespace +{ +Snippets::Camera* sCamera; + +void renderCallback() +{ + stepPhysics(true); + + Snippets::startRender(sCamera); + + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + const PxVec3 rcaColor(0.6f*0.75f, 0.8f*0.75f, 1.0f*0.75f); + const PxVec3 rcaColor2(0.8f * 0.75f, 0.8f * 0.75f, 0.5f * 0.75f); + + PxScene* scene; + PxGetPhysics().getScenes(&scene,1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + std::vector actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + + gSkinning->synchronize(); + + for (PxU32 i = 0; i < gDeformableSurfaces.size(); i++) + { + SkinnedMesh& skinnedMesh = gSkinnedMeshes[i]; + + const PxVec3* skinnedVertices = gSkinning->getSkinnedVertices(i); + + Snippets::renderMesh(PxU32(skinnedMesh.mVertices.size()), skinnedVertices, PxU32(skinnedMesh.mTriangles.size()) / 3, &skinnedMesh.mTriangles[0], + rcaColor, NULL, false); + Snippets::renderMesh(PxU32(skinnedMesh.mVertices.size()), skinnedVertices, PxU32(skinnedMesh.mTriangles.size()) / 3, &skinnedMesh.mTriangles[0], + rcaColor, NULL, true); + + DeformableSurface* c = &gDeformableSurfaces[i]; + Snippets::renderMesh(c->mTriangleMesh->getNbVertices(), c->mPositionsInvMass, c->mTriangleMesh->getNbTriangles(), c->mTriangleMesh->getTriangles(), + c->mTriangleMesh->getTriangleMeshFlags() & PxTriangleMeshFlag::e16_BIT_INDICES, rcaColor2, NULL, false, true); + Snippets::renderMesh(c->mTriangleMesh->getNbVertices(), c->mPositionsInvMass, c->mTriangleMesh->getNbTriangles(), c->mTriangleMesh->getTriangles(), + c->mTriangleMesh->getTriangleMeshFlags() & PxTriangleMeshFlag::e16_BIT_INDICES, rcaColor2, NULL, true, true); + } + + Snippets::showFPS(); + Snippets::finishRender(); +} + +void cleanup() +{ + delete sCamera; + cleanupPhysics(true); +} + +void exitCallback() +{ +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(15.0f, 10.0f, 15.0f), PxVec3(-0.6f, -0.2f, -0.6f)); + + Snippets::setupDefault("PhysX Snippet Deformable Surface Skinning", sCamera, NULL, renderCallback, exitCallback); + + initPhysics(true); + Snippets::initFPS(); + glutMainLoop(); + + cleanup(); +} + +#endif diff --git a/engine/third_party/physx/snippets/snippetdeformablevolume/MeshGenerator.h b/engine/third_party/physx/snippets/snippetdeformablevolume/MeshGenerator.h new file mode 100644 index 00000000..c2fb9030 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablevolume/MeshGenerator.h @@ -0,0 +1,108 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PHYSX_MESHGENERATOR_H +#define PHYSX_MESHGENERATOR_H + +#include "PxPhysicsAPI.h" +#include "extensions/PxRemeshingExt.h" + +namespace meshgenerator +{ +using namespace physx; + +void createCube(PxArray& triVerts, PxArray& triIndices, const PxVec3& pos, PxReal scaling) +{ + triVerts.clear(); + triIndices.clear(); + triVerts.pushBack(scaling * PxVec3(0.5f, -0.5f, -0.5f) + pos); + triVerts.pushBack(scaling * PxVec3(0.5f, -0.5f, 0.5f) + pos); + triVerts.pushBack(scaling * PxVec3(-0.5f, -0.5f, 0.5f) + pos); + triVerts.pushBack(scaling * PxVec3(-0.5f, -0.5f, -0.5f) + pos); + triVerts.pushBack(scaling * PxVec3(0.5f, 0.5f, -0.5f) + pos); + triVerts.pushBack(scaling * PxVec3(0.5f, 0.5f, 0.5f) + pos); + triVerts.pushBack(scaling * PxVec3(-0.5f, 0.5f, 0.5f) + pos); + triVerts.pushBack(scaling * PxVec3(-0.5f, 0.5f, -0.5f) + pos); + + triIndices.pushBack(1); triIndices.pushBack(2); triIndices.pushBack(3); + triIndices.pushBack(7); triIndices.pushBack(6); triIndices.pushBack(5); + triIndices.pushBack(4); triIndices.pushBack(5); triIndices.pushBack(1); + triIndices.pushBack(5); triIndices.pushBack(6); triIndices.pushBack(2); + + triIndices.pushBack(2); triIndices.pushBack(6); triIndices.pushBack(7); + triIndices.pushBack(0); triIndices.pushBack(3); triIndices.pushBack(7); + triIndices.pushBack(0); triIndices.pushBack(1); triIndices.pushBack(3); + triIndices.pushBack(4); triIndices.pushBack(7); triIndices.pushBack(5); + + triIndices.pushBack(0); triIndices.pushBack(4); triIndices.pushBack(1); + triIndices.pushBack(1); triIndices.pushBack(5); triIndices.pushBack(2); + triIndices.pushBack(3); triIndices.pushBack(2); triIndices.pushBack(7); + triIndices.pushBack(4); triIndices.pushBack(0); triIndices.pushBack(7); +} + +void createConeY(PxArray& triVerts, PxArray& triIndices, const PxVec3& center, PxReal radius, PxReal height, PxU32 numPointsOnRing = 32) +{ + triVerts.clear(); + triIndices.clear(); + for (PxU32 i = 0; i < numPointsOnRing; ++i) + { + PxReal angle = i * 2.0f * 3.1415926535898f / numPointsOnRing; + triVerts.pushBack(center + radius * PxVec3(PxSin(angle), 0, PxCos(angle))); + } + + triVerts.pushBack(center); + triVerts.pushBack(center + PxVec3(0, height, 0)); + for (PxU32 i = 0; i < numPointsOnRing; ++i) + { + triIndices.pushBack(numPointsOnRing); triIndices.pushBack(i); triIndices.pushBack((i + 1) % numPointsOnRing); + triIndices.pushBack(numPointsOnRing + 1); triIndices.pushBack((i + 1) % numPointsOnRing); triIndices.pushBack(i); + } +} + +void projectPointsOntoSphere(PxArray& triVerts, const PxVec3& center, PxReal radius) +{ + for (PxU32 i = 0; i < triVerts.size(); ++i) + { + PxVec3 dir = triVerts[i] - center; + dir.normalize(); + triVerts[i] = center + radius * dir; + } +} + +void createSphere(PxArray& triVerts, PxArray& triIndices, const PxVec3& center, PxReal radius, const PxReal maxEdgeLength) +{ + triVerts.clear(); + triIndices.clear(); + createCube(triVerts, triIndices, center, radius); + projectPointsOntoSphere(triVerts, center, radius); + while (PxRemeshingExt::limitMaxEdgeLength(triIndices, triVerts, maxEdgeLength, 1)) + projectPointsOntoSphere(triVerts, center, radius); +} +} + +#endif diff --git a/engine/third_party/physx/snippets/snippetdeformablevolume/SnippetDeformableVolume.cpp b/engine/third_party/physx/snippets/snippetdeformablevolume/SnippetDeformableVolume.cpp new file mode 100644 index 00000000..77f0569b --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablevolume/SnippetDeformableVolume.cpp @@ -0,0 +1,271 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet demonstrates how to setup deformable volumes. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetdeformablevolume/SnippetDeformableVolume.h" +#include "../snippetdeformablevolume/MeshGenerator.h" +#include "extensions/PxTetMakerExt.h" +#include "extensions/PxDeformableVolumeExt.h" + +using namespace physx; +using namespace meshgenerator; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxCudaContextManager* gCudaContextManager = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +PxArray gDeformableVolumes; + +void addDeformableVolume(PxDeformableVolume* deformableVolume, const PxTransform& transform, const PxReal density, const PxReal scale) +{ + PxVec4* simPositionInvMassPinned; + PxVec4* simVelocityPinned; + PxVec4* collPositionInvMassPinned; + PxVec4* restPositionPinned; + + PxDeformableVolumeExt::allocateAndInitializeHostMirror(*deformableVolume, gCudaContextManager, simPositionInvMassPinned, simVelocityPinned, collPositionInvMassPinned, restPositionPinned); + + const PxReal maxInvMassRatio = 50.f; + + PxDeformableVolumeExt::transform(*deformableVolume, transform, scale, simPositionInvMassPinned, simVelocityPinned, collPositionInvMassPinned, restPositionPinned); + PxDeformableVolumeExt::updateMass(*deformableVolume, density, maxInvMassRatio, simPositionInvMassPinned); + PxDeformableVolumeExt::copyToDevice(*deformableVolume, PxDeformableVolumeDataFlag::eALL, simPositionInvMassPinned, simVelocityPinned, collPositionInvMassPinned, restPositionPinned); + + DeformableVolume volume(deformableVolume, gCudaContextManager); + + gDeformableVolumes.pushBack(volume); + + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, simPositionInvMassPinned); + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, simVelocityPinned); + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, collPositionInvMassPinned); + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, restPositionPinned); +} + +static PxDeformableVolume* createDeformableVolume(const PxCookingParams& params, const PxArray& triVerts, const PxArray& triIndices, bool useCollisionMeshForSimulation = false) +{ + PxDeformableVolumeMesh* deformableVolumeMesh; + + PxU32 numVoxelsAlongLongestAABBAxis = 8; + + PxSimpleTriangleMesh surfaceMesh; + surfaceMesh.points.count = triVerts.size(); + surfaceMesh.points.data = triVerts.begin(); + surfaceMesh.triangles.count = triIndices.size() / 3; + surfaceMesh.triangles.data = triIndices.begin(); + + if (useCollisionMeshForSimulation) + { + deformableVolumeMesh = PxDeformableVolumeExt::createDeformableVolumeMeshNoVoxels(params, surfaceMesh, gPhysics->getPhysicsInsertionCallback()); + } + else + { + deformableVolumeMesh = PxDeformableVolumeExt::createDeformableVolumeMesh(params, surfaceMesh, numVoxelsAlongLongestAABBAxis, gPhysics->getPhysicsInsertionCallback()); + } + + //Alternatively one can cook a deformable volume mesh in a single step + //tetMesh = cooking.createDeformableVolumeMesh(simulationMeshDesc, collisionMeshDesc, deformableVolumeDesc, physics.getPhysicsInsertionCallback()); + PX_ASSERT(deformableVolumeMesh); + + if (!gCudaContextManager) + return NULL; + PxDeformableVolume* deformableVolume = gPhysics->createDeformableVolume(*gCudaContextManager); + if (deformableVolume) + { + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE; + + PxDeformableVolumeMaterial* materialPtr = PxGetPhysics().createDeformableVolumeMaterial(2.e+5f, 0.3f, 0.1f); + PxTetrahedronMeshGeometry geometry(deformableVolumeMesh->getCollisionMesh()); + PxShape* shape = gPhysics->createShape(geometry, &materialPtr, 1, true, shapeFlags); + if (shape) + { + deformableVolume->attachShape(*shape); + shape->setSimulationFilterData(PxFilterData(0, 0, 2, 0)); + } + deformableVolume->attachSimulationMesh(*deformableVolumeMesh->getSimulationMesh(), *deformableVolumeMesh->getDeformableVolumeAuxData()); + + gScene->addActor(*deformableVolume); + + addDeformableVolume(deformableVolume, PxTransform(PxVec3(0.f, 0.f, 0.f), PxQuat(PxIdentity)), 100.f, 1.0f); + deformableVolume->setDeformableBodyFlag(PxDeformableBodyFlag::eDISABLE_SELF_COLLISION, true); + deformableVolume->setSolverIterationCounts(30); + } + return deformableVolume; +} + +static void createDeformableVolumes(const PxCookingParams& params) +{ + if (gCudaContextManager == NULL) + { + printf("The Deformable Volume feature is currently only supported on GPU\n"); + return; + } + + PxArray triVerts; + PxArray triIndices; + + PxReal maxEdgeLength = 1; + + createCube(triVerts, triIndices, PxVec3(0.0, 9, 0), 2.5); + PxRemeshingExt::limitMaxEdgeLength(triIndices, triVerts, maxEdgeLength); + createDeformableVolume(params, triVerts, triIndices); + + createSphere(triVerts, triIndices, PxVec3(0, 4.5, 0), 2.5, maxEdgeLength); + createDeformableVolume(params, triVerts, triIndices); + + createConeY(triVerts, triIndices, PxVec3(0.1, 11.5, 0), 2.0f, 3.5); + PxRemeshingExt::limitMaxEdgeLength(triIndices, triVerts, maxEdgeLength); + createDeformableVolume(params, triVerts, triIndices); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + // initialize cuda + PxCudaContextManagerDesc cudaContextManagerDesc; + gCudaContextManager = PxCreateCudaContextManager(*gFoundation, cudaContextManagerDesc, PxGetProfilerCallback()); + if (gCudaContextManager && !gCudaContextManager->contextIsValid()) + { + PX_RELEASE(gCudaContextManager); + printf("Failed to initialize cuda context.\n"); + } + + PxTolerancesScale scale; + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, scale, true, gPvd); + PxInitExtensions(*gPhysics, gPvd); + + PxCookingParams params(scale); + params.meshWeldTolerance = 0.001f; + params.meshPreprocessParams = PxMeshPreprocessingFlags(PxMeshPreprocessingFlag::eWELD_VERTICES); + params.buildTriangleAdjacencies = false; + params.buildGPUData = true; + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + + if (!sceneDesc.cudaContextManager) + sceneDesc.cudaContextManager = gCudaContextManager; + + sceneDesc.flags |= PxSceneFlag::eENABLE_GPU_DYNAMICS; + sceneDesc.flags |= PxSceneFlag::eENABLE_PCM; + + PxU32 numCores = SnippetUtils::getNbPhysicalCores(); + gDispatcher = PxDefaultCpuDispatcherCreate(numCores == 0 ? 0 : numCores - 1); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + sceneDesc.broadPhaseType = PxBroadPhaseType::eGPU; + sceneDesc.gpuMaxNumPartitions = 8; + + sceneDesc.solverType = PxSolverType::eTGS; + + gScene = gPhysics->createScene(sceneDesc); + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + createDeformableVolumes(params); +} + +void stepPhysics(bool /*interactive*/) +{ + const PxReal dt = 1.0f / 60.f; + + gScene->simulate(dt); + gScene->fetchResults(true); + + for (PxU32 i = 0; i < gDeformableVolumes.size(); i++) + { + DeformableVolume* dv = &gDeformableVolumes[i]; + dv->copyDeformedVerticesFromGPU(); + } +} + +void cleanupPhysics(bool /*interactive*/) +{ + for (PxU32 i = 0; i < gDeformableVolumes.size(); i++) + gDeformableVolumes[i].release(); + gDeformableVolumes.reset(); + + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if (gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PxCloseExtensions(); + + PX_RELEASE(gCudaContextManager); + PX_RELEASE(gFoundation); + + printf("SnippetDeformableVolume done.\n"); +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetCollisionMesh()->getNbVertices()); + } + + ~DeformableVolume() + { + } + + void release() + { + if (mDeformableVolume) + mDeformableVolume->release(); + + PX_EXT_PINNED_MEMORY_FREE(*mCudaContextManager, mPositionsInvMass); + } + + void copyDeformedVerticesFromGPUAsync(CUstream stream) + { + physx::PxTetrahedronMesh* tetMesh = mDeformableVolume->getCollisionMesh(); + + physx::PxScopedCudaLock _lock(*mCudaContextManager); + mCudaContextManager->getCudaContext()->memcpyDtoHAsync(mPositionsInvMass, reinterpret_cast(mDeformableVolume->getPositionInvMassBufferD()), tetMesh->getNbVertices() * sizeof(physx::PxVec4), stream); + } + + void copyDeformedVerticesFromGPU() + { + physx::PxTetrahedronMesh* tetMesh = mDeformableVolume->getCollisionMesh(); + + physx::PxScopedCudaLock _lock(*mCudaContextManager); + mCudaContextManager->getCudaContext()->memcpyDtoH(mPositionsInvMass, reinterpret_cast(mDeformableVolume->getPositionInvMassBufferD()), tetMesh->getNbVertices() * sizeof(physx::PxVec4)); + } + + + physx::PxVec4* mPositionsInvMass; + physx::PxDeformableVolume* mDeformableVolume; + physx::PxCudaContextManager* mCudaContextManager; +}; + +#endif // PHYSX_SNIPPET_DEFORMABLE_VOLUME_H diff --git a/engine/third_party/physx/snippets/snippetdeformablevolume/SnippetDeformableVolumeRender.cpp b/engine/third_party/physx/snippets/snippetdeformablevolume/SnippetDeformableVolumeRender.cpp new file mode 100644 index 00000000..bd526a0c --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablevolume/SnippetDeformableVolumeRender.cpp @@ -0,0 +1,98 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#ifdef RENDER_SNIPPET + +#include "PxPhysicsAPI.h" + +#include "../snippetrender/SnippetRender.h" +#include "../snippetrender/SnippetCamera.h" +#include "SnippetDeformableVolume.h" + +using namespace physx; + +extern void initPhysics(bool interactive); +extern void stepPhysics(bool interactive); +extern void cleanupPhysics(bool interactive); +extern PxArray gDeformableVolumes; + +namespace +{ +Snippets::Camera* sCamera; + +void renderCallback() +{ + stepPhysics(true); + + Snippets::startRender(sCamera); + + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + const PxVec3 rcaColor(0.6f*0.75f, 0.8f*0.75f, 1.0f*0.75f); + + PxScene* scene; + PxGetPhysics().getScenes(&scene,1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + for (PxU32 i = 0; i < gDeformableVolumes.size(); i++) + { + DeformableVolume* dv = &gDeformableVolumes[i]; + Snippets::renderDeformableVolume(dv->mDeformableVolume, dv->mPositionsInvMass, true, rcaColor); + } + + Snippets::finishRender(); +} + +void cleanup() +{ + delete sCamera; + cleanupPhysics(true); +} + +void exitCallback() +{ +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(10.0f, 10.0f, 10.0f), PxVec3(-0.6f, -0.2f, -0.7f)); + + Snippets::setupDefault("PhysX Snippet Deformable Volume", sCamera, NULL, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); + + cleanup(); +} + +#endif diff --git a/engine/third_party/physx/snippets/snippetdeformablevolumeattachment/SnippetDeformableVolumeAttachment.cpp b/engine/third_party/physx/snippets/snippetdeformablevolumeattachment/SnippetDeformableVolumeAttachment.cpp new file mode 100644 index 00000000..2c54e475 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablevolumeattachment/SnippetDeformableVolumeAttachment.cpp @@ -0,0 +1,381 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet demonstrates how to tie rigid and deformable volumes together. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetdeformablevolume/SnippetDeformableVolume.h" +#include "../snippetdeformablevolume/MeshGenerator.h" +#include "extensions/PxTetMakerExt.h" +#include "extensions/PxTetrahedronMeshExt.h" +#include "extensions/PxDeformableVolumeExt.h" + +using namespace physx; +using namespace meshgenerator; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxCudaContextManager* gCudaContextManager = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +PxArray gDeformableVolumes; + +static PxFilterFlags deformableVolumeRigidBodyFilter(PxFilterObjectAttributes attributes0, PxFilterData filterData0, + PxFilterObjectAttributes attributes1, PxFilterData filterData1, + PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize) +{ + PX_UNUSED(attributes0); + PX_UNUSED(attributes1); + PX_UNUSED(constantBlock); + PX_UNUSED(constantBlockSize); + if (filterData0.word2 != 0 && filterData0.word2 != filterData1.word2) + return PxFilterFlag::eKILL; + pairFlags |= PxPairFlag::eCONTACT_DEFAULT; + return PxFilterFlag::eDEFAULT; +} + +void addDeformableVolume(PxDeformableVolume* deformableVolume, PxDeformableVolumeMaterial* volumeMaterial, + const PxTransform& transform, const PxReal density, const PxReal scale) +{ + PxShape* shape = deformableVolume->getShape(); + + PxVec4* simPositionInvMassPinned; + PxVec4* simVelocityPinned; + PxVec4* collPositionInvMassPinned; + PxVec4* restPositionPinned; + + PxDeformableVolumeExt::allocateAndInitializeHostMirror(*deformableVolume, gCudaContextManager, simPositionInvMassPinned, simVelocityPinned, collPositionInvMassPinned, restPositionPinned); + + const PxReal maxInvMassRatio = 50.f; + + shape->setDeformableVolumeMaterials(&volumeMaterial, 1); + + PxDeformableVolumeExt::transform(*deformableVolume, transform, scale, simPositionInvMassPinned, simVelocityPinned, collPositionInvMassPinned, restPositionPinned); + PxDeformableVolumeExt::updateMass(*deformableVolume, density, maxInvMassRatio, simPositionInvMassPinned); + PxDeformableVolumeExt::copyToDevice(*deformableVolume, PxDeformableVolumeDataFlag::eALL, simPositionInvMassPinned, simVelocityPinned, collPositionInvMassPinned, restPositionPinned); + + + DeformableVolume volume(deformableVolume, gCudaContextManager); + + gDeformableVolumes.pushBack(volume); + + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, simPositionInvMassPinned); + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, simVelocityPinned); + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, collPositionInvMassPinned); + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, restPositionPinned); +} + +static PxDeformableVolume* createDeformableVolume(const PxCookingParams& params, const PxArray& triVerts, const PxArray& triIndices, bool useCollisionMeshForSimulation = false) +{ + PxDeformableVolumeMaterial* material = PxGetPhysics().createDeformableVolumeMaterial(1e+6f, 0.45f, 0.5f); + material->setDamping(0.005f); + + PxDeformableVolumeMesh* deformableVolumeMesh; + + PxU32 numVoxelsAlongLongestAABBAxis = 8; + + PxSimpleTriangleMesh surfaceMesh; + surfaceMesh.points.count = triVerts.size(); + surfaceMesh.points.data = triVerts.begin(); + surfaceMesh.triangles.count = triIndices.size() / 3; + surfaceMesh.triangles.data = triIndices.begin(); + + if (useCollisionMeshForSimulation) + { + deformableVolumeMesh = PxDeformableVolumeExt::createDeformableVolumeMeshNoVoxels(params, surfaceMesh, gPhysics->getPhysicsInsertionCallback()); + } + else + { + deformableVolumeMesh = PxDeformableVolumeExt::createDeformableVolumeMesh(params, surfaceMesh, numVoxelsAlongLongestAABBAxis, gPhysics->getPhysicsInsertionCallback()); + } + + //Alternatively one can cook a deformable volume mesh in a single step + //tetMesh = cooking.createDeformableVolumeMesh(simulationMeshDesc, collisionMeshDesc, deformableVolumeDesc, physics.getPhysicsInsertionCallback()); + PX_ASSERT(deformableVolumeMesh); + + if (!gCudaContextManager) + return NULL; + PxDeformableVolume* deformableVolume = gPhysics->createDeformableVolume(*gCudaContextManager); + if (deformableVolume) + { + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE; + + PxDeformableVolumeMaterial* materialPtr = PxGetPhysics().createDeformableVolumeMaterial(1e+6f, 0.45f, 0.5f); + PxTetrahedronMeshGeometry geometry(deformableVolumeMesh->getCollisionMesh()); + PxShape* shape = gPhysics->createShape(geometry, &materialPtr, 1, true, shapeFlags); + if (shape) + { + deformableVolume->attachShape(*shape); + shape->setSimulationFilterData(PxFilterData(0, 0, 2, 0)); + } + deformableVolume->attachSimulationMesh(*deformableVolumeMesh->getSimulationMesh(), *deformableVolumeMesh->getDeformableVolumeAuxData()); + + gScene->addActor(*deformableVolume); + + addDeformableVolume(deformableVolume, material, PxTransform(PxVec3(0.f, 0.f, 0.f), PxQuat(PxIdentity)), 100.f, 1.0f); + deformableVolume->setDeformableBodyFlag(PxDeformableBodyFlag::eDISABLE_SELF_COLLISION, true); + deformableVolume->setSolverIterationCounts(30); + } + return deformableVolume; +} + +static PxRigidDynamic* createRigidCube(PxReal halfExtent, const PxVec3& position) +{ + PxShape* shape = gPhysics->createShape(PxBoxGeometry(halfExtent, halfExtent, halfExtent), *gMaterial); + + shape->setSimulationFilterData(PxFilterData(0, 0, 1, 0)); + + PxTransform localTm(position); + PxRigidDynamic* body = gPhysics->createRigidDynamic(localTm); + body->attachShape(*shape); + PxRigidBodyExt::updateMassAndInertia(*body, 10.0f); + gScene->addActor(*body); + + shape->release(); + + return body; +} + +void convertCollisionToSim(PxDeformableVolume* deformableVolume, PxU32* tetId, PxVec4* barycentric, PxU32 size) +{ + for (PxU32 i = 0; i < size; i++) + { + PxDeformableVolumeExt::convertCollisionToSimulationTet(*deformableVolume, tetId[i], barycentric[i], tetId[i], barycentric[i]); + } +} + +static void connectCubeToDeformableVolume(PxRigidDynamic* cube, PxReal cubeHalfExtent, const PxVec3& cubePosition, PxDeformableVolume* deformableVolume, PxU32 pointGridResolution = 10) +{ + PxArray tetArray; + PxArray baryArray; + PxArray posArray; + + float f = 2.0f * cubeHalfExtent / (pointGridResolution - 1); + for (PxU32 ix = 0; ix < pointGridResolution; ++ix) + { + PxReal x = ix * f - cubeHalfExtent; + for (PxU32 iy = 0; iy < pointGridResolution; ++iy) + { + PxReal y = iy * f - cubeHalfExtent; + for (PxU32 iz = 0; iz < pointGridResolution; ++iz) + { + PxReal z = iz * f - cubeHalfExtent; + PxVec3 p(x, y, z); + PxVec4 bary; + PxI32 tet = PxTetrahedronMeshExt::findTetrahedronContainingPoint(deformableVolume->getCollisionMesh(), p + cubePosition, bary); + if (tet >= 0) + { + tetArray.pushBack(tet); + baryArray.pushBack(bary); + posArray.pushBack(PxVec4(p, 0.0f)); + } + } + } + } + + { + PxDeformableAttachmentData desc; + + desc.actor[0] = deformableVolume; + desc.type[0] = PxDeformableAttachmentTargetType::eTETRAHEDRON; + convertCollisionToSim(deformableVolume, tetArray.begin(), baryArray.begin(), tetArray.size()); + desc.indices[0].data = tetArray.begin(); + desc.indices[0].count = tetArray.size(); + desc.coords[0].data = baryArray.begin(); + desc.coords[0].count = baryArray.size(); + + desc.actor[1] = cube; + desc.type[1] = PxDeformableAttachmentTargetType::eRIGID; + desc.coords[1].data = posArray.begin(); + desc.coords[1].count = posArray.size(); + + gPhysics->createDeformableAttachment(desc); + } +} + +static void createDeformableVolumes(const PxCookingParams& params) +{ + if (gCudaContextManager == NULL) + { + printf("The Deformable Volumes feature is currently only supported on GPU\n"); + return; + } + + PxArray triVerts; + PxArray triIndices; + + PxReal maxEdgeLength = 1; + + createCube(triVerts, triIndices, PxVec3(0, 9.5, 0), 2.5); + PxRemeshingExt::limitMaxEdgeLength(triIndices, triVerts, maxEdgeLength); + PxDeformableVolume* deformableVolumeCube = createDeformableVolume(params, triVerts, triIndices, true); + + createSphere(triVerts, triIndices, PxVec3(0,4.5,0), 2.5, maxEdgeLength); + PxDeformableVolume* deformableVolumeSphere = createDeformableVolume(params, triVerts, triIndices); + + createConeY(triVerts, triIndices, PxVec3(0, 12.5, 0), 2.0f, 3.5); + PxRemeshingExt::limitMaxEdgeLength(triIndices, triVerts, maxEdgeLength); + PxDeformableVolume* deformableVolumeCone = createDeformableVolume(params, triVerts, triIndices); + + PxReal halfExtent = 1; + PxVec3 cubePosA(0, 7.25, 0); + PxVec3 cubePosB(0, 11.75, 0); + PxRigidDynamic* rigidCubeA = createRigidCube(halfExtent, cubePosA); + PxRigidDynamic* rigidCubeB = createRigidCube(halfExtent, cubePosB); + + connectCubeToDeformableVolume(rigidCubeA, 2*halfExtent, cubePosA, deformableVolumeSphere); + connectCubeToDeformableVolume(rigidCubeA, 2*halfExtent, cubePosA, deformableVolumeCube); + + connectCubeToDeformableVolume(rigidCubeB, 2*halfExtent, cubePosB, deformableVolumeCube); + connectCubeToDeformableVolume(rigidCubeB, 2*halfExtent, cubePosB, deformableVolumeCone); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + // initialize cuda + PxCudaContextManagerDesc cudaContextManagerDesc; + gCudaContextManager = PxCreateCudaContextManager(*gFoundation, cudaContextManagerDesc, PxGetProfilerCallback()); + if (gCudaContextManager && !gCudaContextManager->contextIsValid()) + { + PX_RELEASE(gCudaContextManager); + printf("Failed to initialize cuda context.\n"); + } + + PxTolerancesScale scale; + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, scale, true, gPvd); + PxInitExtensions(*gPhysics, gPvd); + + PxCookingParams params(scale); + params.meshWeldTolerance = 0.001f; + params.meshPreprocessParams = PxMeshPreprocessingFlags(PxMeshPreprocessingFlag::eWELD_VERTICES); + params.buildTriangleAdjacencies = false; + params.buildGPUData = true; + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + + if (!sceneDesc.cudaContextManager) + sceneDesc.cudaContextManager = gCudaContextManager; + + sceneDesc.flags |= PxSceneFlag::eENABLE_GPU_DYNAMICS; + sceneDesc.flags |= PxSceneFlag::eENABLE_PCM; + + PxU32 numCores = SnippetUtils::getNbPhysicalCores(); + gDispatcher = PxDefaultCpuDispatcherCreate(numCores == 0 ? 0 : numCores - 1); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + sceneDesc.broadPhaseType = PxBroadPhaseType::eGPU; + sceneDesc.gpuMaxNumPartitions = 8; + + sceneDesc.filterShader = deformableVolumeRigidBodyFilter; + sceneDesc.solverType = PxSolverType::ePGS; + + gScene = gPhysics->createScene(sceneDesc); + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + createDeformableVolumes(params); +} + +void stepPhysics(bool /*interactive*/) +{ + const PxReal dt = 1.0f / 60.f; + + gScene->simulate(dt); + gScene->fetchResults(true); + + for (PxU32 i = 0; i < gDeformableVolumes.size(); i++) + { + DeformableVolume* dv = &gDeformableVolumes[i]; + dv->copyDeformedVerticesFromGPU(); + } +} + +void cleanupPhysics(bool /*interactive*/) +{ + for (PxU32 i = 0; i < gDeformableVolumes.size(); i++) + gDeformableVolumes[i].release(); + gDeformableVolumes.reset(); + + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if (gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PxCloseExtensions(); + PX_RELEASE(gCudaContextManager); + PX_RELEASE(gFoundation); + + printf("SnippetDeformableVolumeAttachment done.\n"); +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; i gDeformableVolumes; + +namespace +{ +Snippets::Camera* sCamera; + +void renderCallback() +{ + stepPhysics(true); + + Snippets::startRender(sCamera); + + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + const PxVec3 rcaColor(0.6f*0.75f, 0.8f*0.75f, 1.0f*0.75f); + + PxScene* scene; + PxGetPhysics().getScenes(&scene,1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + for (PxU32 i = 0; i < gDeformableVolumes.size(); i++) + { + DeformableVolume* dv = &gDeformableVolumes[i]; + Snippets::renderDeformableVolume(dv->mDeformableVolume, dv->mPositionsInvMass, true, rcaColor); + } + + Snippets::finishRender(); +} + +void cleanup() +{ + delete sCamera; + cleanupPhysics(true); +} + +void exitCallback() +{ +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(10.0f, 10.0f, 10.0f), PxVec3(-0.6f, -0.2f, -0.7f)); + + Snippets::setupDefault("PhysX Snippet Deformable Volume Attachments", sCamera, NULL, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); + + cleanup(); +} + +#endif diff --git a/engine/third_party/physx/snippets/snippetdeformablevolumekinematic/MeshGenerator.h b/engine/third_party/physx/snippets/snippetdeformablevolumekinematic/MeshGenerator.h new file mode 100644 index 00000000..c3c45d90 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablevolumekinematic/MeshGenerator.h @@ -0,0 +1,108 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PHYSX_MESHGENERATOR_H +#define PHYSX_MESHGENERATOR_H + +#include "PxPhysicsAPI.h" +#include "extensions/PxRemeshingExt.h" + +namespace meshgenerator +{ +using namespace physx; + +void createCube(PxArray& triVerts, PxArray& triIndices, const PxVec3& pos, const PxVec3& scaling) +{ + triVerts.clear(); + triIndices.clear(); + triVerts.pushBack(scaling.multiply(PxVec3(0.5f, -0.5f, -0.5f)) + pos); + triVerts.pushBack(scaling.multiply(PxVec3(0.5f, -0.5f, 0.5f)) + pos); + triVerts.pushBack(scaling.multiply(PxVec3(-0.5f, -0.5f, 0.5f)) + pos); + triVerts.pushBack(scaling.multiply(PxVec3(-0.5f, -0.5f, -0.5f)) + pos); + triVerts.pushBack(scaling.multiply(PxVec3(0.5f, 0.5f, -0.5f)) + pos); + triVerts.pushBack(scaling.multiply(PxVec3(0.5f, 0.5f, 0.5f)) + pos); + triVerts.pushBack(scaling.multiply(PxVec3(-0.5f, 0.5f, 0.5f)) + pos); + triVerts.pushBack(scaling.multiply(PxVec3(-0.5f, 0.5f, -0.5f)) + pos); + + triIndices.pushBack(1); triIndices.pushBack(2); triIndices.pushBack(3); + triIndices.pushBack(7); triIndices.pushBack(6); triIndices.pushBack(5); + triIndices.pushBack(4); triIndices.pushBack(5); triIndices.pushBack(1); + triIndices.pushBack(5); triIndices.pushBack(6); triIndices.pushBack(2); + + triIndices.pushBack(2); triIndices.pushBack(6); triIndices.pushBack(7); + triIndices.pushBack(0); triIndices.pushBack(3); triIndices.pushBack(7); + triIndices.pushBack(0); triIndices.pushBack(1); triIndices.pushBack(3); + triIndices.pushBack(4); triIndices.pushBack(7); triIndices.pushBack(5); + + triIndices.pushBack(0); triIndices.pushBack(4); triIndices.pushBack(1); + triIndices.pushBack(1); triIndices.pushBack(5); triIndices.pushBack(2); + triIndices.pushBack(3); triIndices.pushBack(2); triIndices.pushBack(7); + triIndices.pushBack(4); triIndices.pushBack(0); triIndices.pushBack(7); +} + +void createConeY(PxArray& triVerts, PxArray& triIndices, const PxVec3& center, PxReal radius, PxReal height, PxU32 numPointsOnRing = 32) +{ + triVerts.clear(); + triIndices.clear(); + for (PxU32 i = 0; i < numPointsOnRing; ++i) + { + PxReal angle = i * 2.0f * 3.1415926535898f / numPointsOnRing; + triVerts.pushBack(center + radius * PxVec3(PxSin(angle), 0, PxCos(angle))); + } + + triVerts.pushBack(center); + triVerts.pushBack(center + PxVec3(0, height, 0)); + for (PxU32 i = 0; i < numPointsOnRing; ++i) + { + triIndices.pushBack(numPointsOnRing); triIndices.pushBack(i); triIndices.pushBack((i + 1) % numPointsOnRing); + triIndices.pushBack(numPointsOnRing + 1); triIndices.pushBack((i + 1) % numPointsOnRing); triIndices.pushBack(i); + } +} + +void projectPointsOntoSphere(PxArray& triVerts, const PxVec3& center, PxReal radius) +{ + for (PxU32 i = 0; i < triVerts.size(); ++i) + { + PxVec3 dir = triVerts[i] - center; + dir.normalize(); + triVerts[i] = center + radius * dir; + } +} + +void createSphere(PxArray& triVerts, PxArray& triIndices, const PxVec3& center, PxReal radius, const PxReal maxEdgeLength) +{ + triVerts.clear(); + triIndices.clear(); + createCube(triVerts, triIndices, center, PxVec3(radius)); + projectPointsOntoSphere(triVerts, center, radius); + while (PxRemeshingExt::limitMaxEdgeLength(triIndices, triVerts, maxEdgeLength, 1)) + projectPointsOntoSphere(triVerts, center, radius); +} +} + +#endif diff --git a/engine/third_party/physx/snippets/snippetdeformablevolumekinematic/SnippetDeformableVolumeKinematic.cpp b/engine/third_party/physx/snippets/snippetdeformablevolumekinematic/SnippetDeformableVolumeKinematic.cpp new file mode 100644 index 00000000..f95cf6ce --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablevolumekinematic/SnippetDeformableVolumeKinematic.cpp @@ -0,0 +1,413 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet demonstrates how to setup deformable volumes. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetdeformablevolumekinematic/SnippetDeformableVolumeKinematic.h" +#include "../snippetdeformablevolumekinematic/MeshGenerator.h" +#include "extensions/PxTetMakerExt.h" +#include "extensions/PxDeformableVolumeExt.h" +#include "extensions/PxCudaHelpersExt.h" + +using namespace physx; +using namespace meshgenerator; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxCudaContextManager* gCudaContextManager = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +PxArray gDeformableVolumes; + +void addDeformableVolume(PxDeformableVolume* deformableVolume, const PxTransform& transform, const PxReal density, const PxReal scale) +{ + PxVec4* simPositionInvMassPinned; + PxVec4* simVelocityPinned; + PxVec4* collPositionInvMassPinned; + PxVec4* restPositionPinned; + + PxDeformableVolumeExt::allocateAndInitializeHostMirror(*deformableVolume, gCudaContextManager, simPositionInvMassPinned, simVelocityPinned, collPositionInvMassPinned, restPositionPinned); + + const PxReal maxInvMassRatio = 50.f; + + PxDeformableVolumeExt::transform(*deformableVolume, transform, scale, simPositionInvMassPinned, simVelocityPinned, collPositionInvMassPinned, restPositionPinned); + PxDeformableVolumeExt::updateMass(*deformableVolume, density, maxInvMassRatio, simPositionInvMassPinned); + PxDeformableVolumeExt::copyToDevice(*deformableVolume, PxDeformableVolumeDataFlag::eALL, simPositionInvMassPinned, simVelocityPinned, collPositionInvMassPinned, restPositionPinned); + + DeformableVolume volume(deformableVolume, gCudaContextManager); + + gDeformableVolumes.pushBack(volume); + + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, simPositionInvMassPinned); + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, simVelocityPinned); + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, collPositionInvMassPinned); + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, restPositionPinned); +} + +static PxDeformableVolume* createDeformableVolume(const PxCookingParams& params, const PxArray& triVerts, const PxArray& triIndices, bool useCollisionMeshForSimulation = false) +{ + PxDeformableVolumeMaterial* material = PxGetPhysics().createDeformableVolumeMaterial(1e+6f, 0.45f, 0.5f); + material->setDamping(0.005f); + + PxDeformableVolumeMesh* deformableVolumeMesh; + + PxU32 numVoxelsAlongLongestAABBAxis = 8; + + PxSimpleTriangleMesh surfaceMesh; + surfaceMesh.points.count = triVerts.size(); + surfaceMesh.points.data = triVerts.begin(); + surfaceMesh.triangles.count = triIndices.size() / 3; + surfaceMesh.triangles.data = triIndices.begin(); + + if (useCollisionMeshForSimulation) + { + deformableVolumeMesh = PxDeformableVolumeExt::createDeformableVolumeMeshNoVoxels(params, surfaceMesh, gPhysics->getPhysicsInsertionCallback()); + } + else + { + deformableVolumeMesh = PxDeformableVolumeExt::createDeformableVolumeMesh(params, surfaceMesh, numVoxelsAlongLongestAABBAxis, gPhysics->getPhysicsInsertionCallback()); + } + + //Alternatively one can cook a deformable volume mesh in a single step + //tetMesh = cooking.createDeformableVolumeMesh(simulationMeshDesc, collisionMeshDesc, deformableVolumeDesc, physics.getPhysicsInsertionCallback()); + PX_ASSERT(deformableVolumeMesh); + + if (!gCudaContextManager) + return NULL; + PxDeformableVolume* deformableVolume = gPhysics->createDeformableVolume(*gCudaContextManager); + if (deformableVolume) + { + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE; + + PxDeformableVolumeMaterial* materialPtr = PxGetPhysics().createDeformableVolumeMaterial(1e+6f, 0.45f, 0.5f); + materialPtr->setMaterialModel(PxDeformableVolumeMaterialModel::eNEO_HOOKEAN); + PxTetrahedronMeshGeometry geometry(deformableVolumeMesh->getCollisionMesh()); + PxShape* shape = gPhysics->createShape(geometry, &materialPtr, 1, true, shapeFlags); + if (shape) + { + deformableVolume->attachShape(*shape); + shape->setSimulationFilterData(PxFilterData(0, 0, 2, 0)); + } + deformableVolume->attachSimulationMesh(*deformableVolumeMesh->getSimulationMesh(), *deformableVolumeMesh->getDeformableVolumeAuxData()); + + gScene->addActor(*deformableVolume); + + addDeformableVolume(deformableVolume, PxTransform(PxVec3(0.f, 0.f, 0.f), PxQuat(PxIdentity)), 100.f, 1.0f); + deformableVolume->setDeformableBodyFlag(PxDeformableBodyFlag::eDISABLE_SELF_COLLISION, true); + deformableVolume->setSolverIterationCounts(30); + + + } + return deformableVolume; +} + +static void createDeformableVolumes(const PxCookingParams& params) +{ + PxCudaContextManager* cudaContextManager = gScene->getCudaContextManager(); + if (!cudaContextManager) + { + printf("The Deformable Volumes feature currently only runs on GPU.\n"); + return; + } + + PxArray triVerts; + PxArray triIndices; + + PxReal maxEdgeLength = 0.75f; + + createCube(triVerts, triIndices, PxVec3(0, 0, 0), PxVec3(2.5f, 10, 2.5f)); + PxRemeshingExt::limitMaxEdgeLength(triIndices, triVerts, maxEdgeLength); + + PxVec3 position(0, 5.0f, 0); + for (PxU32 i = 0; i < triVerts.size(); ++i) + { + PxVec3& p = triVerts[i]; + PxReal corr = PxSqrt(p.x*p.x + p.z*p.z); + if (corr != 0) + corr = PxMax(PxAbs(p.x), PxAbs(p.z)) / corr; + PxReal scaling = 0.75f + 0.5f * (PxCos(1.5f*p.y) + 1.0f); + p.x *= scaling * corr; + p.z *= scaling * corr; + p += position; + } + PxRemeshingExt::limitMaxEdgeLength(triIndices, triVerts, maxEdgeLength); + + + PxDeformableVolume* deformableVolume = createDeformableVolume(params, triVerts, triIndices, true); + + + DeformableVolume* dv = &gDeformableVolumes[0]; + dv->copyDeformedVerticesFromGPU(); + + PxU32 vertexCount = dv->mDeformableVolume->getSimulationMesh()->getNbVertices(); + + PxVec4* kinematicTargets = PX_EXT_PINNED_MEMORY_ALLOC(PxVec4, *cudaContextManager, vertexCount); + PxVec4* positionInvMass = dv->mPositionsInvMass; + for (PxU32 i = 0; i < vertexCount; ++i) + { + PxVec4& p = positionInvMass[i]; + bool kinematic = false; + if (i < triVerts.size()) + { + if (p.y > 9.9f) + kinematic = true; + + if (p.y > 5 - 0.1f && p.y < 5 + 0.1f) + kinematic = true; + + if (p.y < 0.1f) + kinematic = true; + } + + kinematicTargets[i] = PxConfigureDeformableVolumeKinematicTarget(p, kinematic); + } + + PxVec4* kinematicTargetsD = PX_EXT_DEVICE_MEMORY_ALLOC(PxVec4, *cudaContextManager, vertexCount); + cudaContextManager->getCudaContext()->memcpyHtoD(reinterpret_cast(deformableVolume->getSimPositionInvMassBufferD()), positionInvMass, vertexCount * sizeof(PxVec4)); + cudaContextManager->getCudaContext()->memcpyHtoD(reinterpret_cast(kinematicTargetsD), kinematicTargets, vertexCount * sizeof(PxVec4)); + deformableVolume->setDeformableVolumeFlag(PxDeformableVolumeFlag::ePARTIALLY_KINEMATIC, true); + deformableVolume->setKinematicTargetBufferD(kinematicTargetsD); + + dv->mTargetPositionsH = kinematicTargets; + dv->mTargetPositionsD = kinematicTargetsD; + dv->mTargetCount = vertexCount; +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + // initialize cuda + PxCudaContextManagerDesc cudaContextManagerDesc; + gCudaContextManager = PxCreateCudaContextManager(*gFoundation, cudaContextManagerDesc, PxGetProfilerCallback()); + if (gCudaContextManager && !gCudaContextManager->contextIsValid()) + { + PX_RELEASE(gCudaContextManager); + printf("Failed to initialize cuda context.\n"); + } + + PxTolerancesScale scale; + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, scale, true, gPvd); + PxInitExtensions(*gPhysics, gPvd); + + PxCookingParams params(scale); + params.meshWeldTolerance = 0.001f; + params.meshPreprocessParams = PxMeshPreprocessingFlags(PxMeshPreprocessingFlag::eWELD_VERTICES); + params.buildTriangleAdjacencies = false; + params.buildGPUData = true; + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + + if (!sceneDesc.cudaContextManager) + sceneDesc.cudaContextManager = gCudaContextManager; + + sceneDesc.flags |= PxSceneFlag::eENABLE_GPU_DYNAMICS; + sceneDesc.flags |= PxSceneFlag::eENABLE_PCM; + + PxU32 numCores = SnippetUtils::getNbPhysicalCores(); + gDispatcher = PxDefaultCpuDispatcherCreate(numCores == 0 ? 0 : numCores - 1); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + sceneDesc.broadPhaseType = PxBroadPhaseType::eGPU; + sceneDesc.gpuMaxNumPartitions = 8; + + sceneDesc.solverType = PxSolverType::eTGS; + + gScene = gPhysics->createScene(sceneDesc); + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.f); + + createDeformableVolumes(params); + + // Setup rigid bodies + const PxReal dynamicsDensity = 10; + const PxReal boxSize = 0.5f; + const PxReal spacing = 0.6f; + const PxReal boxMass = boxSize * boxSize * boxSize * dynamicsDensity; + const PxU32 gridSizeA = 13; + const PxU32 gridSizeB = 3; + const PxReal initialRadius = 1.65f; + const PxReal distanceJointStiffness = 500.0f; + const PxReal distanceJointDamping = 0.5f; + PxShape* shape = gPhysics->createShape(PxBoxGeometry(0.5f * boxSize, 0.5f * boxSize, 0.5f * boxSize), *gMaterial); + shape->setDensityForFluid(dynamicsDensity); + PxArray rigids; + for (PxU32 i = 0; i < gridSizeA; ++i) + for (PxU32 j = 0; j < gridSizeB; ++j) + { + PxReal x = PxCos((2 * PxPi*i) / gridSizeA); + PxReal y = PxSin((2 * PxPi*i) / gridSizeA); + PxVec3 pos = PxVec3((x*j)*spacing + x * initialRadius, 8, (y *j)*spacing + y * initialRadius); + + PxReal d = 0.0f; + { + PxReal x2 = PxCos((2 * PxPi*(i + 1)) / gridSizeA); + PxReal y2 = PxSin((2 * PxPi*(i + 1)) / gridSizeA); + PxVec3 pos2 = PxVec3((x2*j)*spacing + x2 * initialRadius, 8, (y2 *j)*spacing + y2 * initialRadius); + d = (pos - pos2).magnitude(); + } + + PxRigidDynamic* body = gPhysics->createRigidDynamic(PxTransform(pos)); + body->attachShape(*shape); + PxRigidBodyExt::updateMassAndInertia(*body, boxMass); + gScene->addActor(*body); + rigids.pushBack(body); + + if (j > 0) + { + PxDistanceJoint* joint = PxDistanceJointCreate(*gPhysics, rigids[rigids.size() - 2], PxTransform(PxIdentity), body, PxTransform(PxIdentity)); + joint->setMaxDistance(spacing); + joint->setMinDistance(spacing*0.5f); + joint->setDistanceJointFlags(PxDistanceJointFlag::eMAX_DISTANCE_ENABLED | PxDistanceJointFlag::eMIN_DISTANCE_ENABLED | PxDistanceJointFlag::eSPRING_ENABLED); + joint->setStiffness(distanceJointStiffness); + joint->setDamping(distanceJointDamping); + joint->setConstraintFlags(PxConstraintFlag::eCOLLISION_ENABLED); + } + + if (i > 0) + { + PxDistanceJoint* joint = PxDistanceJointCreate(*gPhysics, rigids[rigids.size() - gridSizeB - 1], PxTransform(PxIdentity), body, PxTransform(PxIdentity)); + joint->setMaxDistance(d); + joint->setMinDistance(d*0.5f); + joint->setDistanceJointFlags(PxDistanceJointFlag::eMAX_DISTANCE_ENABLED | PxDistanceJointFlag::eMIN_DISTANCE_ENABLED | PxDistanceJointFlag::eSPRING_ENABLED); + joint->setStiffness(distanceJointStiffness); + joint->setDamping(distanceJointDamping); + joint->setConstraintFlags(PxConstraintFlag::eCOLLISION_ENABLED); + if (i == gridSizeA - 1) + { + PxDistanceJoint* joint2 = PxDistanceJointCreate(*gPhysics, rigids[j], PxTransform(PxIdentity), body, PxTransform(PxIdentity)); + joint2->setMaxDistance(d); + joint2->setMinDistance(d*0.5f); + joint2->setDistanceJointFlags(PxDistanceJointFlag::eMAX_DISTANCE_ENABLED | PxDistanceJointFlag::eMIN_DISTANCE_ENABLED | PxDistanceJointFlag::eSPRING_ENABLED); + joint2->setStiffness(distanceJointStiffness); + joint2->setDamping(distanceJointDamping); + joint->setConstraintFlags(PxConstraintFlag::eCOLLISION_ENABLED); + } + } + } + shape->release(); +} + +PxReal simTime = 0.0f; +void stepPhysics(bool /*interactive*/) +{ + const PxReal dt = 1.0f / 60.f; + + gScene->simulate(dt); + gScene->fetchResults(true); + + for (PxU32 i = 0; i < gDeformableVolumes.size(); i++) + { + DeformableVolume* dv = &gDeformableVolumes[i]; + dv->copyDeformedVerticesFromGPU(); + + + PxCudaContextManager* cudaContextManager = dv->mCudaContextManager; + //Update the kinematic targets to get some motion + if (i == 0) + { + PxReal scaling = PxMin(0.01f, simTime * 0.1f); + PxReal velocity = 1.0f; + for (PxU32 j = 0; j < dv->mTargetCount; ++j) + { + PxVec4& target = dv->mTargetPositionsH[j]; + if (target.w == 0.0f) + { + PxReal phase = target.y*2.0f; + target.x += scaling * PxSin(velocity * simTime + phase); + target.z += scaling * PxCos(velocity * simTime + phase); + } + } + + PxScopedCudaLock _lock(*cudaContextManager); + cudaContextManager->getCudaContext()->memcpyHtoD(reinterpret_cast(dv->mTargetPositionsD), dv->mTargetPositionsH, dv->mTargetCount * sizeof(PxVec4)); + } + } + simTime += dt; +} + +void cleanupPhysics(bool /*interactive*/) +{ + for (PxU32 i = 0; i < gDeformableVolumes.size(); i++) + gDeformableVolumes[i].release(); + gDeformableVolumes.reset(); + + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if (gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PxCloseExtensions(); + PX_RELEASE(gCudaContextManager); + PX_RELEASE(gFoundation); + + printf("SnippetDeformableVolumeKinematic done.\n"); +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetCollisionMesh()->getNbVertices()); + } + + ~DeformableVolume() + { + } + + void release() + { + if (mDeformableVolume) + mDeformableVolume->release(); + + PX_EXT_PINNED_MEMORY_FREE(*mCudaContextManager, mPositionsInvMass); + PX_EXT_PINNED_MEMORY_FREE(*mCudaContextManager, mTargetPositionsH); + PX_EXT_DEVICE_MEMORY_FREE(*mCudaContextManager, mTargetPositionsD); + } + + void copyDeformedVerticesFromGPUAsync(CUstream stream) + { + physx::PxTetrahedronMesh* tetMesh = mDeformableVolume->getCollisionMesh(); + + physx::PxScopedCudaLock _lock(*mCudaContextManager); + mCudaContextManager->getCudaContext()->memcpyDtoHAsync(mPositionsInvMass, reinterpret_cast(mDeformableVolume->getPositionInvMassBufferD()), tetMesh->getNbVertices() * sizeof(physx::PxVec4), stream); + } + + void copyDeformedVerticesFromGPU() + { + physx::PxTetrahedronMesh* tetMesh = mDeformableVolume->getCollisionMesh(); + + physx::PxScopedCudaLock _lock(*mCudaContextManager); + mCudaContextManager->getCudaContext()->memcpyDtoH(mPositionsInvMass, reinterpret_cast(mDeformableVolume->getPositionInvMassBufferD()), tetMesh->getNbVertices() * sizeof(physx::PxVec4)); + } + + + physx::PxVec4* mPositionsInvMass; + physx::PxDeformableVolume* mDeformableVolume; + physx::PxCudaContextManager* mCudaContextManager; + + physx::PxVec4* mTargetPositionsH; + physx::PxVec4* mTargetPositionsD; + physx::PxU32 mTargetCount; +}; + +#endif // PHYSX_SNIPPET_DEFORMABLE_VOLUME_KINEMATIC_H diff --git a/engine/third_party/physx/snippets/snippetdeformablevolumekinematic/SnippetDeformableVolumeKinematicRender.cpp b/engine/third_party/physx/snippets/snippetdeformablevolumekinematic/SnippetDeformableVolumeKinematicRender.cpp new file mode 100644 index 00000000..edd102aa --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablevolumekinematic/SnippetDeformableVolumeKinematicRender.cpp @@ -0,0 +1,98 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#ifdef RENDER_SNIPPET + +#include "PxPhysicsAPI.h" + +#include "../snippetrender/SnippetRender.h" +#include "../snippetrender/SnippetCamera.h" +#include "SnippetDeformableVolumeKinematic.h" + +using namespace physx; + +extern void initPhysics(bool interactive); +extern void stepPhysics(bool interactive); +extern void cleanupPhysics(bool interactive); +extern PxArray gDeformableVolumes; + +namespace +{ +Snippets::Camera* sCamera; + +void renderCallback() +{ + stepPhysics(true); + + Snippets::startRender(sCamera); + + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + const PxVec3 rcaColor(0.6f*0.75f, 0.8f*0.75f, 1.0f*0.75f); + + PxScene* scene; + PxGetPhysics().getScenes(&scene,1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + for (PxU32 i = 0; i < gDeformableVolumes.size(); i++) + { + DeformableVolume* dv = &gDeformableVolumes[i]; + Snippets::renderDeformableVolume(dv->mDeformableVolume, dv->mPositionsInvMass, true, rcaColor); + } + + Snippets::finishRender(); +} + +void cleanup() +{ + delete sCamera; + cleanupPhysics(true); +} + +void exitCallback() +{ +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(10.0f, 10.0f, 10.0f), PxVec3(-0.6f, -0.2f, -0.7f)); + + Snippets::setupDefault("PhysX Snippet Partially Kinematic Deformable Volume", sCamera, NULL, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); + + cleanup(); +} + +#endif diff --git a/engine/third_party/physx/snippets/snippetdeformablevolumeskinning/SnippetDeformableVolumeSkinning.cpp b/engine/third_party/physx/snippets/snippetdeformablevolumeskinning/SnippetDeformableVolumeSkinning.cpp new file mode 100644 index 00000000..4f851b6e --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablevolumeskinning/SnippetDeformableVolumeSkinning.cpp @@ -0,0 +1,496 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet demonstrates how to setup deformable volumes. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetdeformablevolumeskinning/SnippetDeformableVolumeSkinning.h" +#include "../snippetdeformablevolume/MeshGenerator.h" +#include "extensions/PxTetMakerExt.h" +#include "extensions/PxDeformableVolumeExt.h" + +#include "PxDeformableSkinning.h" +#include "gpu/PxPhysicsGpu.h" +#include "extensions/PxCudaHelpersExt.h" +#include "extensions/PxDeformableSkinningExt.h" +#include "extensions/PxRemeshingExt.h" + +using namespace physx; +using namespace physx::Ext; +using namespace meshgenerator; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxCudaContextManager* gCudaContextManager = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +PxArray gDeformableVolumes; +PxArray gSkinnedMeshes; +BasePostSolveCallback* gSkinning; + +template +class HostAndDeviceBuffer +{ +public: + PxCudaContextManager* mContextManager; + T* mDeviceData; + T* mHostData; //Pinned host memory + PxU32 mNumElements; + + HostAndDeviceBuffer() : + mContextManager(NULL), mDeviceData(NULL), mHostData(NULL), mNumElements(0) + {} + + HostAndDeviceBuffer(PxCudaContextManager* contextManager, PxU32 numElements) : + mContextManager(contextManager), mDeviceData(NULL), mHostData(NULL), mNumElements(0) + { + allocate(numElements); + } + + void initialize(PxCudaContextManager* contextManager, PxU32 numElements) + { + mContextManager = contextManager; + allocate(numElements); + } + + void initialize(PxCudaContextManager* contextManager, const T* dataSource, PxU32 numElements) + { + mContextManager = contextManager; + allocate(numElements); + PxMemCopy(mHostData, dataSource, numElements * sizeof(T)); + } + + void allocate(PxU32 numElements) + { + release(); + mDeviceData = PxCudaHelpersExt::allocDeviceBuffer(*mContextManager, numElements); + mHostData = PxCudaHelpersExt::allocPinnedHostBuffer(*mContextManager, numElements); + mNumElements = numElements; + } + + void copyDeviceToHost(PxU32 numElementsToCopy = 0xFFFFFFFF) + { + PxCudaHelpersExt::copyDToH(*mContextManager, mHostData, mDeviceData, PxMin(numElementsToCopy, mNumElements)); + } + + void copyHostToDevice(PxU32 numElementsToCopy = 0xFFFFFFFF) + { + PxCudaHelpersExt::copyHToD(*mContextManager, mDeviceData, mHostData, PxMin(numElementsToCopy, mNumElements)); + } + + void copyDeviceToHostAsync(CUstream stream, PxU32 numElementsToCopy = 0xFFFFFFFF) + { + PxCudaHelpersExt::copyDToHAsync(*mContextManager, mHostData, mDeviceData, PxMin(numElementsToCopy, mNumElements), stream); + } + + void release() + { + PxCudaHelpersExt::freeDeviceBuffer(*mContextManager, mDeviceData); + PxCudaHelpersExt::freePinnedHostBuffer(*mContextManager, mHostData); + } +}; + +struct VolumeSkinningHelper +{ + PxDeformableVolume* mDeformableVolume; + HostAndDeviceBuffer mDeformableVolumeTets; + HostAndDeviceBuffer mSkinningInfo; + HostAndDeviceBuffer mSkinnedVertices; + PxU32 mNumSkinnedVertices; + + VolumeSkinningHelper() : mDeformableVolume(NULL), mNumSkinnedVertices(0) + { } + + VolumeSkinningHelper(PxCudaContextManager* contextManager, PxDeformableVolume* deformableVolume, PxVec3* skinnedPointsRestPosition, PxU32 nbSkinnedPoints) + : mDeformableVolume(deformableVolume) + { + PxTetrahedronMesh& simulationMesh = *deformableVolume->getSimulationMesh(); + + PxU32 nbTetrahedra = simulationMesh.getNbTetrahedrons(); + + bool uses16bit = simulationMesh.getTetrahedronMeshFlags() & PxTetrahedronMeshFlag::e16_BIT_INDICES; + mDeformableVolumeTets.initialize(contextManager, 4 * nbTetrahedra); + + if (uses16bit) + { + const PxU16* tetIndices = reinterpret_cast(simulationMesh.getTetrahedrons()); + for (PxU32 i = 0; i < mDeformableVolumeTets.mNumElements; ++i) + mDeformableVolumeTets.mHostData[i] = tetIndices[i]; + } + else + { + const PxU32* tetIndices = reinterpret_cast(simulationMesh.getTetrahedrons()); + for (PxU32 i = 0; i < mDeformableVolumeTets.mNumElements; ++i) + mDeformableVolumeTets.mHostData[i] = tetIndices[i]; + } + + mSkinnedVertices.initialize(contextManager, skinnedPointsRestPosition, nbSkinnedPoints); + mNumSkinnedVertices = nbSkinnedPoints; + mSkinningInfo.initialize(contextManager, nbSkinnedPoints); + + PxDeformableSkinningExt::initializeInterpolatedVertices( + mSkinningInfo.mHostData, simulationMesh.getVertices(), mDeformableVolumeTets.mHostData, + nbTetrahedra, skinnedPointsRestPosition, nbSkinnedPoints); + + mDeformableVolumeTets.copyHostToDevice(); + mSkinnedVertices.copyHostToDevice(); + mSkinningInfo.copyHostToDevice(); + } + + void packageGpuData(PxTetmeshSkinningGpuData& target) + { + target.guideVerticesD.data = reinterpret_cast(mDeformableVolume->getSimPositionInvMassBufferD()); + target.guideVerticesD.stride = sizeof(PxVec4); + target.guideTetrahedraD = mDeformableVolumeTets.mDeviceData; + target.skinningInfoPerVertexD = mSkinningInfo.mDeviceData; + target.skinnedVerticesD.count = mNumSkinnedVertices; + target.skinnedVerticesD.stride = sizeof(PxVec3); + target.skinnedVerticesD.data = mSkinnedVertices.mHostData; //This works because it's pinned memory - no device to host transfer will be required + } + + void release() + { + mDeformableVolumeTets.release(); + mSkinnedVertices.release(); + mSkinningInfo.release(); + } +}; + + +struct PostSolveCallback : BasePostSolveCallback, PxUserAllocated +{ + CUstream mSkinningStream; + PxCudaContextManager* mContextManager; + PxDeformableSkinning* skinning; + PxArray skinningHelpers; + HostAndDeviceBuffer packagedSkinningData; + + + PostSolveCallback(PxCudaContextManager* contextManager, PxU32 maxNumDeformableVolumes) : + mContextManager(contextManager) + { + const PxU32 CU_STREAM_NON_BLOCKING = 0x1; + mContextManager->getCudaContext()->streamCreate(&mSkinningStream, CU_STREAM_NON_BLOCKING); + + skinning = PxGetPhysicsGpu()->createDeformableSkinning(contextManager); + + packagedSkinningData.initialize(contextManager, maxNumDeformableVolumes); + skinningHelpers.resize(maxNumDeformableVolumes); + } + + void setDeformableVolume(PxU32 index, PxDeformableVolume* deformableVolume, PxVec3* skinnedPointsRestPosition, PxU32 nbSkinnedPoints) + { + skinningHelpers[index] = VolumeSkinningHelper(mContextManager, deformableVolume, skinnedPointsRestPosition, nbSkinnedPoints); + } + + virtual void onPostSolve(CUevent startEvent) + { + mContextManager->getCudaContext()->streamWaitEvent(mSkinningStream, startEvent); + + for (PxU32 i = 0; i < skinningHelpers.size(); ++i) + skinningHelpers[i].packageGpuData(packagedSkinningData.mHostData[i]); + + packagedSkinningData.copyHostToDevice(skinningHelpers.size()); + + skinning->evaluateVerticesEmbeddedIntoVolume(packagedSkinningData.mDeviceData, skinningHelpers.size(), mSkinningStream); + + //mSkinnedVertices.copyDeviceToHostAsync(mSkinningStream); + } + + virtual void synchronize() + { + mContextManager->getCudaContext()->streamSynchronize(mSkinningStream); + } + + virtual PxVec3* getSkinnedVertices(PxU32 deformableVolumeIndex) + { + return skinningHelpers[deformableVolumeIndex].mSkinnedVertices.mHostData; + } + + ~PostSolveCallback() + { + mContextManager->getCudaContext()->streamDestroy(mSkinningStream); + for (PxU32 i = 0; i < skinningHelpers.size(); ++i) + skinningHelpers[i].release(); + PX_DELETE(skinning); + } +}; + +PostSolveCallback* postSolveCallback; + +void addDeformableVolume(PxDeformableVolume* deformableVolume, const PxTransform& transform, const PxReal density, const PxReal scale) +{ + PxVec4* simPositionInvMassPinned; + PxVec4* simVelocityPinned; + PxVec4* collPositionInvMassPinned; + PxVec4* restPositionPinned; + + PxDeformableVolumeExt::allocateAndInitializeHostMirror(*deformableVolume, gCudaContextManager, simPositionInvMassPinned, simVelocityPinned, collPositionInvMassPinned, restPositionPinned); + + const PxReal maxInvMassRatio = 50.f; + + PxDeformableVolumeExt::transform(*deformableVolume, transform, scale, simPositionInvMassPinned, simVelocityPinned, collPositionInvMassPinned, restPositionPinned); + PxDeformableVolumeExt::updateMass(*deformableVolume, density, maxInvMassRatio, simPositionInvMassPinned); + PxDeformableVolumeExt::copyToDevice(*deformableVolume, PxDeformableVolumeDataFlag::eALL, simPositionInvMassPinned, simVelocityPinned, collPositionInvMassPinned, restPositionPinned); + + DeformableVolume volume(deformableVolume, gCudaContextManager); + + gDeformableVolumes.pushBack(volume); + + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, simPositionInvMassPinned); + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, simVelocityPinned); + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, collPositionInvMassPinned); + PX_EXT_PINNED_MEMORY_FREE(*gCudaContextManager, restPositionPinned); +} + +static PxDeformableVolume* createDeformableVolume(const PxCookingParams& params, const PxArray& triVerts, const PxArray& triIndices, bool useCollisionMeshForSimulation = false) +{ + PxDeformableVolumeMesh* deformableVolumeMesh; + + PxU32 numVoxelsAlongLongestAABBAxis = 8; + + PxSimpleTriangleMesh surfaceMesh; + surfaceMesh.points.count = triVerts.size(); + surfaceMesh.points.data = triVerts.begin(); + surfaceMesh.triangles.count = triIndices.size() / 3; + surfaceMesh.triangles.data = triIndices.begin(); + + if (useCollisionMeshForSimulation) + { + deformableVolumeMesh = PxDeformableVolumeExt::createDeformableVolumeMeshNoVoxels(params, surfaceMesh, gPhysics->getPhysicsInsertionCallback()); + } + else + { + deformableVolumeMesh = PxDeformableVolumeExt::createDeformableVolumeMesh(params, surfaceMesh, numVoxelsAlongLongestAABBAxis, gPhysics->getPhysicsInsertionCallback()); + } + + //Alternatively one can cook a deformable volume mesh in a single step + //tetMesh = cooking.createDeformableVolumeMesh(simulationMeshDesc, collisionMeshDesc, deformableVolumeDesc, physics.getPhysicsInsertionCallback()); + PX_ASSERT(deformableVolumeMesh); + + if (!gCudaContextManager) + return NULL; + PxDeformableVolume* deformableVolume = gPhysics->createDeformableVolume(*gCudaContextManager); + if (deformableVolume) + { + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE; + + PxDeformableVolumeMaterial* materialPtr = PxGetPhysics().createDeformableVolumeMaterial(2.e+5f, 0.3f, 0.1f); + PxTetrahedronMeshGeometry geometry(deformableVolumeMesh->getCollisionMesh()); + PxShape* shape = gPhysics->createShape(geometry, &materialPtr, 1, true, shapeFlags); + if (shape) + { + deformableVolume->attachShape(*shape); + shape->setSimulationFilterData(PxFilterData(0, 0, 2, 0)); + } + deformableVolume->attachSimulationMesh(*deformableVolumeMesh->getSimulationMesh(), *deformableVolumeMesh->getDeformableVolumeAuxData()); + + gScene->addActor(*deformableVolume); + + addDeformableVolume(deformableVolume, PxTransform(PxVec3(0.f, 0.f, 0.f), PxQuat(PxIdentity)), 100.f, 1.0f); + deformableVolume->setDeformableBodyFlag(PxDeformableBodyFlag::eDISABLE_SELF_COLLISION, true); + deformableVolume->setSolverIterationCounts(30); + + + PxArray subdividedTriangles = triIndices; + PxArray subdividedVertices = triVerts; + PxRemeshingExt::limitMaxEdgeLength(subdividedTriangles, subdividedVertices, 0.0001f, 2); + + SkinnedMesh mesh; + for (PxU32 i = 0; i < subdividedTriangles.size(); ++i) + mesh.mTriangles.pushBack(subdividedTriangles[i]); + for (PxU32 i = 0; i < subdividedVertices.size(); ++i) + mesh.mVertices.pushBack(subdividedVertices[i]); + + gSkinnedMeshes.pushBack(mesh); + } + return deformableVolume; +} + +static void createDeformableVolumes(const PxCookingParams& params) +{ + if (gCudaContextManager == NULL) + { + printf("The Deformable Volume feature is currently only supported on GPU\n"); + return; + } + + PxArray triVerts; + PxArray triIndices; + + PxReal maxEdgeLength = 1; + + createCube(triVerts, triIndices, PxVec3(0.0, 9, 0), 2.5); + PxRemeshingExt::limitMaxEdgeLength(triIndices, triVerts, maxEdgeLength); + createDeformableVolume(params, triVerts, triIndices); + + createSphere(triVerts, triIndices, PxVec3(0, 4.5, 0), 2.5, maxEdgeLength); + createDeformableVolume(params, triVerts, triIndices); + + createConeY(triVerts, triIndices, PxVec3(0.1, 11.5, 0), 2.0f, 3.5); + PxRemeshingExt::limitMaxEdgeLength(triIndices, triVerts, maxEdgeLength); + createDeformableVolume(params, triVerts, triIndices); + + postSolveCallback = PX_NEW(PostSolveCallback)(gCudaContextManager, PxU32(gSkinnedMeshes.size())); + gSkinning = postSolveCallback; + + for (PxU32 i = 0; i < gSkinnedMeshes.size(); ++i) + { + SkinnedMesh& skinnedMesh = gSkinnedMeshes[i]; + postSolveCallback->setDeformableVolume(i, gDeformableVolumes[i].mDeformableVolume, &skinnedMesh.mVertices[0], PxU32(skinnedMesh.mVertices.size())); + } + + gScene->setDeformableVolumeGpuPostSolveCallback(postSolveCallback); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport, PxPvdInstrumentationFlag::eALL); + + // initialize cuda + PxCudaContextManagerDesc cudaContextManagerDesc; + gCudaContextManager = PxCreateCudaContextManager(*gFoundation, cudaContextManagerDesc, PxGetProfilerCallback()); + if (gCudaContextManager && !gCudaContextManager->contextIsValid()) + { + PX_RELEASE(gCudaContextManager); + printf("Failed to initialize cuda context.\n"); + } + + PxTolerancesScale scale; + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, scale, true, gPvd); + PxInitExtensions(*gPhysics, gPvd); + + PxCookingParams params(scale); + params.meshWeldTolerance = 0.001f; + params.meshPreprocessParams = PxMeshPreprocessingFlags(PxMeshPreprocessingFlag::eWELD_VERTICES); + params.buildTriangleAdjacencies = false; + params.buildGPUData = true; + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + + if (!sceneDesc.cudaContextManager) + sceneDesc.cudaContextManager = gCudaContextManager; + + sceneDesc.flags |= PxSceneFlag::eENABLE_GPU_DYNAMICS; + sceneDesc.flags |= PxSceneFlag::eENABLE_PCM; + + PxU32 numCores = SnippetUtils::getNbPhysicalCores(); + gDispatcher = PxDefaultCpuDispatcherCreate(numCores == 0 ? 0 : numCores - 1); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + sceneDesc.broadPhaseType = PxBroadPhaseType::eGPU; + sceneDesc.gpuMaxNumPartitions = 8; + + sceneDesc.solverType = PxSolverType::eTGS; + + gScene = gPhysics->createScene(sceneDesc); + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if (pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0, 1, 0, 0), *gMaterial); + gScene->addActor(*groundPlane); + + createDeformableVolumes(params); +} + +void stepPhysics(bool /*interactive*/) +{ + const PxReal dt = 1.0f / 60.f; + + gScene->simulate(dt); + gScene->fetchResults(true); + + for (PxU32 i = 0; i < gDeformableVolumes.size(); i++) + { + DeformableVolume* dv = &gDeformableVolumes[i]; + dv->copyDeformedVerticesFromGPU(); + } +} + +void cleanupPhysics(bool /*interactive*/) +{ + for (PxU32 i = 0; i < gDeformableVolumes.size(); i++) + gDeformableVolumes[i].release(); + gDeformableVolumes.reset(); + + gSkinnedMeshes.reset(); + + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if (gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PxCloseExtensions(); + + PX_RELEASE(gCudaContextManager); + PX_RELEASE(gFoundation); + + printf("SnippetDeformableVolumeSkinning done.\n"); +} + +int snippetMain(int, const char* const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for (PxU32 i = 0; i < frameCount; i++) + stepPhysics(false); + cleanupPhysics(false); +#endif + + return 0; +} diff --git a/engine/third_party/physx/snippets/snippetdeformablevolumeskinning/SnippetDeformableVolumeSkinning.h b/engine/third_party/physx/snippets/snippetdeformablevolumeskinning/SnippetDeformableVolumeSkinning.h new file mode 100644 index 00000000..cc3165ab --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablevolumeskinning/SnippetDeformableVolumeSkinning.h @@ -0,0 +1,99 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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 PHYSX_SNIPPET_DEFORMABLE_VOLUME_SKINNING_H +#define PHYSX_SNIPPET_DEFORMABLE_VOLUME_SKINNING_H + +#include "PxPhysicsAPI.h" +#include "cudamanager/PxCudaContextManager.h" +#include "cudamanager/PxCudaContext.h" +#include "extensions/PxCudaHelpersExt.h" + +struct SkinnedMesh +{ + physx::PxArray mVertices; + physx::PxArray mTriangles; +}; + +struct BasePostSolveCallback : physx::PxPostSolveCallback +{ + virtual void synchronize() = 0; + virtual physx::PxVec3* getSkinnedVertices(physx::PxU32 deformableVolumeIndex) = 0; +}; + +class DeformableVolume +{ +public: + DeformableVolume() : + mPositionsInvMass(NULL), + mDeformableVolume(NULL), + mCudaContextManager(NULL) + { } + + DeformableVolume(physx::PxDeformableVolume* deformableVolume, physx::PxCudaContextManager* cudaContextManager) : + mDeformableVolume(deformableVolume), + mCudaContextManager(cudaContextManager) + { + mPositionsInvMass = PX_EXT_PINNED_MEMORY_ALLOC(physx::PxVec4, *cudaContextManager, deformableVolume->getCollisionMesh()->getNbVertices()); + } + + ~DeformableVolume() + { + } + + void release() + { + if (mDeformableVolume) + mDeformableVolume->release(); + + PX_EXT_PINNED_MEMORY_FREE(*mCudaContextManager, mPositionsInvMass); + } + + void copyDeformedVerticesFromGPUAsync(CUstream stream) + { + physx::PxTetrahedronMesh* tetMesh = mDeformableVolume->getCollisionMesh(); + + physx::PxScopedCudaLock _lock(*mCudaContextManager); + mCudaContextManager->getCudaContext()->memcpyDtoHAsync(mPositionsInvMass, reinterpret_cast(mDeformableVolume->getPositionInvMassBufferD()), tetMesh->getNbVertices() * sizeof(physx::PxVec4), stream); + } + + void copyDeformedVerticesFromGPU() + { + physx::PxTetrahedronMesh* tetMesh = mDeformableVolume->getCollisionMesh(); + + physx::PxScopedCudaLock _lock(*mCudaContextManager); + mCudaContextManager->getCudaContext()->memcpyDtoH(mPositionsInvMass, reinterpret_cast(mDeformableVolume->getPositionInvMassBufferD()), tetMesh->getNbVertices() * sizeof(physx::PxVec4)); + } + + + physx::PxVec4* mPositionsInvMass; + physx::PxDeformableVolume* mDeformableVolume; + physx::PxCudaContextManager* mCudaContextManager; +}; + +#endif diff --git a/engine/third_party/physx/snippets/snippetdeformablevolumeskinning/SnippetDeformableVolumeSkinningRender.cpp b/engine/third_party/physx/snippets/snippetdeformablevolumeskinning/SnippetDeformableVolumeSkinningRender.cpp new file mode 100644 index 00000000..a5ed6228 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdeformablevolumeskinning/SnippetDeformableVolumeSkinningRender.cpp @@ -0,0 +1,111 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +#ifdef RENDER_SNIPPET + +#include + +#include "PxPhysicsAPI.h" + +#include "../snippetrender/SnippetRender.h" +#include "../snippetrender/SnippetCamera.h" +#include "SnippetDeformableVolumeSkinning.h" + +using namespace physx; + +extern void initPhysics(bool interactive); +extern void stepPhysics(bool interactive); +extern void cleanupPhysics(bool interactive); +extern PxArray gDeformableVolumes; +extern PxArray gSkinnedMeshes; +extern BasePostSolveCallback* gSkinning; + +namespace +{ + Snippets::Camera* sCamera; + + void renderCallback() + { + stepPhysics(true); + + Snippets::startRender(sCamera); + + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + const PxVec3 rcaColor(0.6f * 0.75f, 0.8f * 0.75f, 1.0f * 0.75f); + + PxScene* scene; + PxGetPhysics().getScenes(&scene, 1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if (nbActors) + { + std::vector actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + + gSkinning->synchronize(); + + for (PxU32 i = 0; i < gDeformableVolumes.size(); i++) + { + SkinnedMesh& skinnedMesh = gSkinnedMeshes[i]; + + const PxVec3* skinnedVertices = gSkinning->getSkinnedVertices(i); + + Snippets::renderMesh(PxU32(skinnedMesh.mVertices.size()), skinnedVertices, PxU32(skinnedMesh.mTriangles.size()) / 3, &skinnedMesh.mTriangles[0], + rcaColor, NULL, false); + Snippets::renderMesh(PxU32(skinnedMesh.mVertices.size()), skinnedVertices, PxU32(skinnedMesh.mTriangles.size()) / 3, &skinnedMesh.mTriangles[0], + rcaColor, NULL, true); + } + + Snippets::finishRender(); + } + + void cleanup() + { + delete sCamera; + cleanupPhysics(true); + } + + void exitCallback() + { + } +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(10.0f, 10.0f, 10.0f), PxVec3(-0.6f, -0.2f, -0.7f)); + + Snippets::setupDefault("PhysX Snippet Deformable Volume Skinning", sCamera, NULL, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); + + cleanup(); +} + +#endif diff --git a/engine/third_party/physx/snippets/snippetdelayloadhook/SnippetDelayLoadHook.cpp b/engine/third_party/physx/snippets/snippetdelayloadhook/SnippetDelayLoadHook.cpp new file mode 100644 index 00000000..ae6721b3 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdelayloadhook/SnippetDelayLoadHook.cpp @@ -0,0 +1,326 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet illustrates the use of the dll delay load hooks in physx. +// +// The hooks are needed if the application executable either doesn't reside +// in the same directory as the PhysX dlls, or if the PhysX dlls have been renamed. +// Some PhysX dlls delay load the PhysXFoundation, PhysXCommon or PhysXGpu dlls and +// the non-standard names or loactions of these dlls need to be communicated so the +// delay loading can succeed. +// +// This snippet shows how this can be done using the delay load hooks. +// +// In order to show functionality with the renamed dlls some basic physics +// simulation is performed. +// **************************************************************************** + +#include +#include +#include "PxPhysicsAPI.h" +// Include the delay load hook headers +#include "common/windows/PxWindowsDelayLoadHook.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" + +// This snippet uses the default PhysX distro dlls, making the example here somewhat artificial, +// as default locations and default naming makes implementing delay load hooks unnecessary. +#define APP_BIN_DIR "..\\" +#if PX_WIN64 + #define DLL_NAME_BITS "64" +#else + #define DLL_NAME_BITS "32" +#endif +#if PX_DEBUG + #define DLL_DIR "debug\\" +#elif PX_CHECKED + #define DLL_DIR "checked\\" +#elif PX_PROFILE + #define DLL_DIR "profile\\" +#else + #define DLL_DIR "release\\" +#endif + +const char* foundationLibraryPath = APP_BIN_DIR DLL_DIR "PhysXFoundation_" DLL_NAME_BITS ".dll"; +const char* commonLibraryPath = APP_BIN_DIR DLL_DIR "PhysXCommon_" DLL_NAME_BITS ".dll"; +const char* physxLibraryPath = APP_BIN_DIR DLL_DIR "PhysX_" DLL_NAME_BITS ".dll"; +const char* gpuLibraryPath = APP_BIN_DIR DLL_DIR "PhysXGpu_" DLL_NAME_BITS ".dll"; + +HMODULE foundationLibrary = NULL; +HMODULE commonLibrary = NULL; +HMODULE physxLibrary = NULL; + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; + +// typedef the PhysX entry points +typedef PxFoundation*(PxCreateFoundation_FUNC)(PxU32, PxAllocatorCallback&, PxErrorCallback&); +typedef PxPhysics* (PxCreatePhysics_FUNC)(PxU32,PxFoundation&,const PxTolerancesScale& scale,bool,PxPvd*); +typedef void (PxSetPhysXDelayLoadHook_FUNC)(const PxDelayLoadHook* hook); +typedef void (PxSetPhysXCommonDelayLoadHook_FUNC)(const PxDelayLoadHook* hook); +#if PX_SUPPORT_GPU_PHYSX +typedef void (PxSetPhysXGpuLoadHook_FUNC)(const PxGpuLoadHook* hook); +typedef int (PxGetSuggestedCudaDeviceOrdinal_FUNC)(PxErrorCallback& errc); +typedef PxCudaContextManager* (PxCreateCudaContextManager_FUNC)(PxFoundation& foundation, const PxCudaContextManagerDesc& desc, physx::PxProfilerCallback* profilerCallback); +#endif + +// set the function pointers to NULL +PxCreateFoundation_FUNC* s_PxCreateFoundation_Func = NULL; +PxCreatePhysics_FUNC* s_PxCreatePhysics_Func = NULL; +PxSetPhysXDelayLoadHook_FUNC* s_PxSetPhysXDelayLoadHook_Func = NULL; +PxSetPhysXCommonDelayLoadHook_FUNC* s_PxSetPhysXCommonDelayLoadHook_Func = NULL; +#if PX_SUPPORT_GPU_PHYSX +PxSetPhysXGpuLoadHook_FUNC* s_PxSetPhysXGpuLoadHook_Func = NULL; +PxGetSuggestedCudaDeviceOrdinal_FUNC* s_PxGetSuggestedCudaDeviceOrdinal_Func = NULL; +PxCreateCudaContextManager_FUNC* s_PxCreateCudaContextManager_Func = NULL; +#endif + +bool loadPhysicsExplicitely() +{ + // load the dlls + foundationLibrary = LoadLibraryA(foundationLibraryPath); + if(!foundationLibrary) + return false; + + commonLibrary = LoadLibraryA(commonLibraryPath); + if(!commonLibrary) + { + FreeLibrary(foundationLibrary); + return false; + } + + physxLibrary = LoadLibraryA(physxLibraryPath); + if(!physxLibrary) + { + FreeLibrary(foundationLibrary); + FreeLibrary(commonLibrary); + return false; + } + + // get the function pointers + s_PxCreateFoundation_Func = (PxCreateFoundation_FUNC*)GetProcAddress(foundationLibrary, "PxCreateFoundation"); + s_PxCreatePhysics_Func = (PxCreatePhysics_FUNC*)GetProcAddress(physxLibrary, "PxCreatePhysics"); + s_PxSetPhysXDelayLoadHook_Func = (PxSetPhysXDelayLoadHook_FUNC*)GetProcAddress(physxLibrary, "PxSetPhysXDelayLoadHook"); + s_PxSetPhysXCommonDelayLoadHook_Func = (PxSetPhysXCommonDelayLoadHook_FUNC*)GetProcAddress(commonLibrary, "PxSetPhysXCommonDelayLoadHook"); + +#if PX_SUPPORT_GPU_PHYSX + s_PxSetPhysXGpuLoadHook_Func = (PxSetPhysXGpuLoadHook_FUNC*)GetProcAddress(physxLibrary, "PxSetPhysXGpuLoadHook"); + s_PxGetSuggestedCudaDeviceOrdinal_Func = (PxGetSuggestedCudaDeviceOrdinal_FUNC*)GetProcAddress(physxLibrary, "PxGetSuggestedCudaDeviceOrdinal"); + s_PxCreateCudaContextManager_Func = (PxCreateCudaContextManager_FUNC*)GetProcAddress(physxLibrary, "PxCreateCudaContextManager"); +#endif + + // check if we have all required function pointers + if(s_PxCreateFoundation_Func == NULL || s_PxCreatePhysics_Func == NULL || s_PxSetPhysXDelayLoadHook_Func == NULL || s_PxSetPhysXCommonDelayLoadHook_Func == NULL) + return false; + +#if PX_SUPPORT_GPU_PHYSX + if(s_PxSetPhysXGpuLoadHook_Func == NULL || s_PxGetSuggestedCudaDeviceOrdinal_Func == NULL || s_PxCreateCudaContextManager_Func == NULL) + return false; +#endif + return true; +} + +// unload the dlls +void unloadPhysicsExplicitely() +{ + FreeLibrary(physxLibrary); + FreeLibrary(commonLibrary); + FreeLibrary(foundationLibrary); +} + +// Overriding the PxDelayLoadHook allows the load of a custom name dll inside PhysX, PhysXCommon and PhysXCooking dlls +struct SnippetDelayLoadHook : public PxDelayLoadHook +{ + virtual const char* getPhysXFoundationDllName() const + { + return foundationLibraryPath; + } + + virtual const char* getPhysXCommonDllName() const + { + return commonLibraryPath; + } +}; + +#if PX_SUPPORT_GPU_PHYSX +// Overriding the PxGpuLoadHook allows the load of a custom GPU name dll +struct SnippetGpuLoadHook : public PxGpuLoadHook +{ + virtual const char* getPhysXGpuDllName() const + { + return gpuLibraryPath; + } +}; +#endif + +PxReal stackZ = 10.0f; + +PxRigidDynamic* createDynamic(const PxTransform& t, const PxGeometry& geometry, const PxVec3& velocity=PxVec3(0)) +{ + PxRigidDynamic* dynamic = PxCreateDynamic(*gPhysics, t, geometry, *gMaterial, 10.0f); + dynamic->setAngularDamping(0.5f); + dynamic->setLinearVelocity(velocity); + gScene->addActor(*dynamic); + return dynamic; +} + +void createStack(const PxTransform& t, PxU32 size, PxReal halfExtent) +{ + PxShape* shape = gPhysics->createShape(PxBoxGeometry(halfExtent, halfExtent, halfExtent), *gMaterial); + for(PxU32 i=0; icreateRigidDynamic(t.transform(localTm)); + body->attachShape(*shape); + PxRigidBodyExt::updateMassAndInertia(*body, 10.0f); + gScene->addActor(*body); + } + } + shape->release(); +} + +void initPhysics(bool interactive) +{ + // load the explictely named dlls + const bool isLoaded = loadPhysicsExplicitely(); + if (!isLoaded) + return; + + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + // set PhysX and PhysXCommon delay load hook, this must be done before the create physics is called, before + // the PhysXFoundation, PhysXCommon delay load happens. + SnippetDelayLoadHook delayLoadHook; + s_PxSetPhysXDelayLoadHook_Func(&delayLoadHook); + s_PxSetPhysXCommonDelayLoadHook_Func(&delayLoadHook); + +#if PX_SUPPORT_GPU_PHYSX + // set PhysXGpu load hook + SnippetGpuLoadHook gpuLoadHook; + s_PxSetPhysXGpuLoadHook_Func(&gpuLoadHook); +#endif + + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + // We setup the delay load hooks first + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(2); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + gScene = gPhysics->createScene(sceneDesc); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + for(PxU32 i=0;i<5;i++) + createStack(PxTransform(PxVec3(0,0,stackZ-=10.0f)), 10, 2.0f); + + if(!interactive) + createDynamic(PxTransform(PxVec3(0,40,100)), PxSphereGeometry(10), PxVec3(0,-50,-100)); +} + +void stepPhysics(bool /*interactive*/) +{ + if (gScene) + { + gScene->simulate(1.0f/60.0f); + gScene->fetchResults(true); + } +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + + PX_RELEASE(gFoundation); + + unloadPhysicsExplicitely(); + + printf("SnippetDelayLoadHook done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& camera) +{ + switch(toupper(key)) + { + case 'B': createStack(PxTransform(PxVec3(0,0,stackZ-=10.0f)), 10, 2.0f); break; + case ' ': createDynamic(camera, PxSphereGeometry(3.0f), camera.rotate(PxVec3(0,0,-1))*200); break; + } +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + PxArray actors(nbActors); + gScene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true); + } + + } + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + cleanupPhysics(true); +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(50.0f, 50.0f, 50.0f), PxVec3(-0.6f,-0.2f,-0.7f)); + + Snippets::setupDefault("PhysX Snippet Delay Load Hook", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetdirectgpuapiarticulation/SnippetDirectGPUAPIArticulation.cpp b/engine/third_party/physx/snippets/snippetdirectgpuapiarticulation/SnippetDirectGPUAPIArticulation.cpp new file mode 100644 index 00000000..48f4be80 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetdirectgpuapiarticulation/SnippetDirectGPUAPIArticulation.cpp @@ -0,0 +1,610 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet illustrates the use of the Direct GPU API for articulations. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "cudamanager/PxCudaContext.h" +#include "../snippetutils/SnippetUtils.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxArticulationReducedCoordinate* gArticulation = NULL; +static PxArticulationJointReducedCoordinate* gDriveJoint = NULL; +static PxCudaContextManager* gCudaContextManager = NULL; + +static const PxVec3 gGravity(0.0f, -9.81f, 0.0f); +static const PxU32 gNbIterPos = 32; +static const PxReal gContactOffset = 0.2f; +static const PxReal gLinearDamping = 0.2f; +static const PxReal gAngularDamping = 0.2f; +static const PxReal gMaxLinearVelocity = 100.0f; +static const PxReal gMaxAngularVelocity = 20.0f; +static const PxReal gDriveStiffness = 100000.f; +static const PxReal gDriveDamping = 0.0f; + +static PxArray gRBIndices; +static PxArray gRBGeometries; +static PxArray gRBPoses; + +static PxArray gArtiIndices; +static PxArray gLinkGeometries; +static PxArray gLinkPoses; + +static PxArray gDriveValue; + +static CUdeviceptr gRBIndicesD; +static CUdeviceptr gRBPosesD; +static CUdeviceptr gLinkPosesD; + +static CUdeviceptr gArtiIndicesD; +static CUdeviceptr gDriveD; + +PxU32 getRBCount() +{ + return gRBIndices.size(); +} + +PxU32 getLinkCount() +{ + return gLinkPoses.size(); +} + +const PxGeometryHolder* getRBGeometries() +{ + return gRBGeometries.empty() ? NULL : &gRBGeometries[0]; +} + +const PxGeometryHolder* getLinkGeometries() +{ + return gLinkGeometries.empty() ? NULL : &gLinkGeometries[0]; +} + +const PxTransform* getRBPoses() +{ + return gRBPoses.empty() ? NULL : &gRBPoses[0]; +} + +const PxTransform* getLinkPoses() +{ + return gLinkPoses.empty() ? NULL : &gLinkPoses[0]; +} + +static PxFilterFlags scissorFilter( PxFilterObjectAttributes attributes0, PxFilterData filterData0, + PxFilterObjectAttributes attributes1, PxFilterData filterData1, + PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize) +{ + PX_UNUSED(attributes0); + PX_UNUSED(attributes1); + PX_UNUSED(constantBlock); + PX_UNUSED(constantBlockSize); + if (filterData0.word2 != 0 && filterData0.word2 == filterData1.word2) + return PxFilterFlag::eKILL; + pairFlags |= PxPairFlag::eCONTACT_DEFAULT; + return PxFilterFlag::eDEFAULT; +} + +static void createScissorLift() +{ + const PxReal runnerLength = 2.f; + const PxReal placementDistance = 1.8f; + const PxReal cosAng = (placementDistance) / (runnerLength); + const PxReal angle = PxAcos(cosAng); + const PxReal sinAng = PxSin(angle); + const PxQuat leftRot(-angle, PxVec3(1.f, 0.f, 0.f)); + const PxQuat rightRot(angle, PxVec3(1.f, 0.f, 0.f)); + + // create base... + PxArticulationLink* base = gArticulation->createLink(NULL, PxTransform(PxVec3(0.f, 0.25f, 0.f))); + PxRigidActorExt::createExclusiveShape(*base, PxBoxGeometry(0.5f, 0.25f, 1.5f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*base, 3.f); + + // now create the slider and fixed joints... + gArticulation->setSolverIterationCounts(gNbIterPos); + + PxArticulationLink* leftRoot = gArticulation->createLink(base, PxTransform(PxVec3(0.f, 0.55f, -0.9f))); + PxRigidActorExt::createExclusiveShape(*leftRoot, PxBoxGeometry(0.5f, 0.05f, 0.05f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*leftRoot, 1.f); + + PxArticulationLink* rightRoot = gArticulation->createLink(base, PxTransform(PxVec3(0.f, 0.55f, 0.9f))); + PxRigidActorExt::createExclusiveShape(*rightRoot, PxBoxGeometry(0.5f, 0.05f, 0.05f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*rightRoot, 1.f); + + PxArticulationJointReducedCoordinate* joint = leftRoot->getInboundJoint(); + joint->setJointType(PxArticulationJointType::eFIX); + joint->setParentPose(PxTransform(PxVec3(0.f, 0.25f, -0.9f))); + joint->setChildPose(PxTransform(PxVec3(0.f, -0.05f, 0.f))); + + // set up the drive joint... + gDriveJoint = rightRoot->getInboundJoint(); + gDriveJoint->setJointType(PxArticulationJointType::ePRISMATIC); + gDriveJoint->setMotion(PxArticulationAxis::eZ, PxArticulationMotion::eLIMITED); + gDriveJoint->setLimitParams(PxArticulationAxis::eZ, PxArticulationLimit(-1.4f, 0.2f)); + gDriveJoint->setDriveParams(PxArticulationAxis::eZ, PxArticulationDrive(gDriveStiffness, gDriveDamping, PX_MAX_F32)); + gDriveJoint->setParentPose(PxTransform(PxVec3(0.f, 0.25f, 0.9f))); + gDriveJoint->setChildPose(PxTransform(PxVec3(0.f, -0.05f, 0.f))); + + const PxU32 linkHeight = 3; + PxArticulationLink* currFrontLeft = leftRoot, *currFrontRight = rightRoot; + PxArticulationLink* currBackLeft = leftRoot, *currBackRight = rightRoot; + + // set up the scissor + PxQuat frontRightParentRot(PxIdentity); + PxQuat frontLeftParentRot(PxIdentity); + PxQuat backRightParentRot(PxIdentity); + PxQuat backLeftParentRot(PxIdentity); + for (PxU32 i = 0; i < linkHeight; ++i) + { + PxVec3 pos(0.5f, 0.55f + 0.1f*(1 + i), 0.f); + PxArticulationLink* frontLeftLink = gArticulation->createLink(currFrontLeft, PxTransform(pos + PxVec3(0.f, sinAng*(2 * i + 1), 0.f), leftRot)); + PxRigidActorExt::createExclusiveShape(*frontLeftLink, PxBoxGeometry(0.05f, 0.05f, 1.f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*frontLeftLink, 1.f); + + const PxVec3 frontLeftAnchorLocation = pos + PxVec3(0.f, sinAng*(2 * i), -0.9f); + + joint = frontLeftLink->getInboundJoint(); + joint->setParentPose(PxTransform(currFrontLeft->getGlobalPose().transformInv(frontLeftAnchorLocation), frontLeftParentRot)); + joint->setChildPose(PxTransform(PxVec3(0.f, 0.f, -1.f), rightRot)); + joint->setJointType(PxArticulationJointType::eREVOLUTE); + joint->setMotion(PxArticulationAxis::eTWIST, PxArticulationMotion::eLIMITED); + joint->setLimitParams(PxArticulationAxis::eTWIST, PxArticulationLimit(-PxPi, angle)); + frontLeftParentRot = leftRot; + + PxArticulationLink* frontRightLink = gArticulation->createLink(currFrontRight, PxTransform(pos + PxVec3(0.f, sinAng*(2 * i + 1), 0.f), rightRot)); + PxRigidActorExt::createExclusiveShape(*frontRightLink, PxBoxGeometry(0.05f, 0.05f, 1.f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*frontRightLink, 1.f); + + const PxVec3 frontRightAnchorLocation = pos + PxVec3(0.f, sinAng*(2 * i), 0.9f); + + joint = frontRightLink->getInboundJoint(); + joint->setJointType(PxArticulationJointType::eREVOLUTE); + joint->setParentPose(PxTransform(currFrontRight->getGlobalPose().transformInv(frontRightAnchorLocation), frontRightParentRot)); + joint->setChildPose(PxTransform(PxVec3(0.f, 0.f, 1.f), leftRot)); + joint->setMotion(PxArticulationAxis::eTWIST, PxArticulationMotion::eLIMITED); + joint->setLimitParams(PxArticulationAxis::eTWIST, PxArticulationLimit(-angle, PxPi)); + + frontRightParentRot = rightRot; + + pos = PxVec3(-0.5f, 0.55f + 0.1f*(1 + i), 0.f); + PxArticulationLink* backLeftLink = gArticulation->createLink(currBackLeft, PxTransform(pos + PxVec3(0.f, sinAng*(2 * i + 1), 0.f), leftRot)); + PxRigidActorExt::createExclusiveShape(*backLeftLink, PxBoxGeometry(0.05f, 0.05f, 1.f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*backLeftLink, 1.f); + + const PxVec3 backLeftAnchorLocation = pos + PxVec3(0.f, sinAng*(2 * i), -0.9f); + + joint = backLeftLink->getInboundJoint(); + joint->setJointType(PxArticulationJointType::eREVOLUTE); + joint->setParentPose(PxTransform(currBackLeft->getGlobalPose().transformInv(backLeftAnchorLocation), backLeftParentRot)); + joint->setChildPose(PxTransform(PxVec3(0.f, 0.f, -1.f), rightRot)); + joint->setMotion(PxArticulationAxis::eTWIST, PxArticulationMotion::eLIMITED); + joint->setLimitParams(PxArticulationAxis::eTWIST, PxArticulationLimit(-PxPi, angle)); + + backLeftParentRot = leftRot; + + PxArticulationLink* backRightLink = gArticulation->createLink(currBackRight, PxTransform(pos + PxVec3(0.f, sinAng*(2 * i + 1), 0.f), rightRot)); + PxRigidActorExt::createExclusiveShape(*backRightLink, PxBoxGeometry(0.05f, 0.05f, 1.f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*backRightLink, 1.f); + + const PxVec3 backRightAnchorLocation = pos + PxVec3(0.f, sinAng*(2 * i), 0.9f); + + joint = backRightLink->getInboundJoint(); + joint->setParentPose(PxTransform(currBackRight->getGlobalPose().transformInv(backRightAnchorLocation), backRightParentRot)); + joint->setJointType(PxArticulationJointType::eREVOLUTE); + joint->setChildPose(PxTransform(PxVec3(0.f, 0.f, 1.f), leftRot)); + joint->setMotion(PxArticulationAxis::eTWIST, PxArticulationMotion::eLIMITED); + joint->setLimitParams(PxArticulationAxis::eTWIST, PxArticulationLimit(-angle, PxPi)); + + backRightParentRot = rightRot; + + PxD6Joint* d6FrontJoint = PxD6JointCreate(*gPhysics, frontLeftLink, PxTransform(PxIdentity), frontRightLink, PxTransform(PxIdentity)); + + d6FrontJoint->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + d6FrontJoint->setMotion(PxD6Axis::eSWING1, PxD6Motion::eFREE); + d6FrontJoint->setMotion(PxD6Axis::eSWING2, PxD6Motion::eFREE); + + PxD6Joint* d6BackJoint = PxD6JointCreate(*gPhysics, backLeftLink, PxTransform(PxIdentity), backRightLink, PxTransform(PxIdentity)); + + d6BackJoint->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + d6BackJoint->setMotion(PxD6Axis::eSWING1, PxD6Motion::eFREE); + d6BackJoint->setMotion(PxD6Axis::eSWING2, PxD6Motion::eFREE); + + currFrontLeft = frontRightLink; + currFrontRight = frontLeftLink; + currBackLeft = backRightLink; + currBackRight = backLeftLink; + } + + // set up the top + PxArticulationLink* rightTop = gArticulation->createLink(currFrontRight, currFrontRight->getGlobalPose().transform(PxTransform(PxVec3(-0.5f, 0.f, 1.0f), frontRightParentRot))); + PxRigidActorExt::createExclusiveShape(*rightTop, PxCapsuleGeometry(0.05f, 0.8f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*rightTop, 1.f); + + PxArticulationLink* leftTop = gArticulation->createLink(currFrontLeft, currFrontLeft->getGlobalPose().transform(PxTransform(PxVec3(-0.5f, 0.f, -1.0f), frontLeftParentRot))); + PxRigidActorExt::createExclusiveShape(*leftTop, PxBoxGeometry(0.5f, 0.05f, 0.05f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*leftTop, 1.f); + + joint = leftTop->getInboundJoint(); + joint->setParentPose(PxTransform(PxVec3(0.f, 0.f, -1.f), currFrontLeft->getGlobalPose().q.getConjugate())); + joint->setChildPose(PxTransform(PxVec3(0.5f, 0.f, 0.f), leftTop->getGlobalPose().q.getConjugate())); + joint->setJointType(PxArticulationJointType::eREVOLUTE); + joint->setMotion(PxArticulationAxis::eTWIST, PxArticulationMotion::eFREE); + + joint = rightTop->getInboundJoint(); + joint->setParentPose(PxTransform(PxVec3(0.f, 0.f, 1.f), currFrontRight->getGlobalPose().q.getConjugate())); + joint->setChildPose(PxTransform(PxVec3(0.5f, 0.f, 0.f), rightTop->getGlobalPose().q.getConjugate())); + joint->setJointType(PxArticulationJointType::eREVOLUTE); + joint->setMotion(PxArticulationAxis::eTWIST, PxArticulationMotion::eFREE); + + PxD6Joint* d6joint = PxD6JointCreate(*gPhysics, currBackLeft, PxTransform(PxVec3(0.f, 0.f, -1.f)), leftTop, PxTransform(PxVec3(-0.5f, 0.f, 0.f))); + + d6joint->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + d6joint->setMotion(PxD6Axis::eSWING1, PxD6Motion::eFREE); + d6joint->setMotion(PxD6Axis::eSWING2, PxD6Motion::eFREE); + + d6joint = PxD6JointCreate(*gPhysics, currBackRight, PxTransform(PxVec3(0.f, 0.f, 1.f)), rightTop, PxTransform(PxVec3(-0.5f, 0.f, 0.f))); + + d6joint->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + d6joint->setMotion(PxD6Axis::eSWING1, PxD6Motion::eFREE); + d6joint->setMotion(PxD6Axis::eSWING2, PxD6Motion::eFREE); + + const PxTransform topPose(PxVec3(0.f, leftTop->getGlobalPose().p.y + 0.15f, 0.f)); + + PxArticulationLink* top = gArticulation->createLink(leftTop, topPose); + PxRigidActorExt::createExclusiveShape(*top, PxBoxGeometry(0.5f, 0.1f, 1.5f), *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*top, 1.f); + + joint = top->getInboundJoint(); + joint->setJointType(PxArticulationJointType::eFIX); + joint->setParentPose(PxTransform(PxVec3(0.f, 0.0f, 0.f))); + joint->setChildPose(PxTransform(PxVec3(0.f, -0.15f, -0.9f))); + + gScene->addArticulation(*gArticulation); + + for (PxU32 i = 0; i < gArticulation->getNbLinks(); ++i) + { + PxArticulationLink* link; + gArticulation->getLinks(&link, 1, i); + + link->setLinearDamping(gLinearDamping); + link->setAngularDamping(gAngularDamping); + + link->setMaxAngularVelocity(gMaxAngularVelocity); + link->setMaxLinearVelocity(gMaxLinearVelocity); + + if (link != top) + { + for (PxU32 b = 0; b < link->getNbShapes(); ++b) + { + PxShape* shape; + link->getShapes(&shape, 1, b); + + shape->setSimulationFilterData(PxFilterData(0, 0, 1, 0)); + } + } + } + + // set up the box stack + const PxVec3 halfExt(0.25f); + const PxReal density(0.5f); + + PxBoxGeometry boxGeometryBox0(halfExt); + PxTransform poseBox0(PxVec3(-0.25f, 5.f, 0.5f)); + PxRigidDynamic* box0 = gPhysics->createRigidDynamic(poseBox0); + PxShape* shape0 = PxRigidActorExt::createExclusiveShape(*box0, boxGeometryBox0, *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box0, density); + gScene->addActor(*box0); + + gRBIndices.pushBack(box0->getGPUIndex()); + gRBGeometries.pushBack(boxGeometryBox0); + gRBPoses.pushBack(poseBox0); + + PxBoxGeometry boxGeometryBox1(halfExt); + PxTransform poseBox1(PxVec3(0.25f, 5.f, 0.5f)); + PxRigidDynamic* box1 = gPhysics->createRigidDynamic(poseBox1); + PxShape* shape1 = PxRigidActorExt::createExclusiveShape(*box1, boxGeometryBox1, *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box1, density); + gScene->addActor(*box1); + + gRBIndices.pushBack(box1->getGPUIndex()); + gRBGeometries.pushBack(boxGeometryBox1); + gRBPoses.pushBack(poseBox1); + + PxBoxGeometry boxGeometryBox2(halfExt); + PxTransform poseBox2(PxVec3(-0.25f, 4.5f, 0.5f)); + PxRigidDynamic* box2 = gPhysics->createRigidDynamic(poseBox2); + PxShape* shape2 = PxRigidActorExt::createExclusiveShape(*box2, boxGeometryBox2, *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box2, density); + gScene->addActor(*box2); + + gRBIndices.pushBack(box2->getGPUIndex()); + gRBGeometries.pushBack(boxGeometryBox2); + gRBPoses.pushBack(poseBox2); + + PxBoxGeometry boxGeometryBox3(halfExt); + PxTransform poseBox3(PxVec3(0.25f, 4.5f, 0.5f)); + PxRigidDynamic* box3 = gPhysics->createRigidDynamic(poseBox3); + PxShape* shape3 = PxRigidActorExt::createExclusiveShape(*box3, boxGeometryBox3, *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box3, density); + gScene->addActor(*box3); + + gRBIndices.pushBack(box3->getGPUIndex()); + gRBGeometries.pushBack(boxGeometryBox3); + gRBPoses.pushBack(poseBox3); + + PxBoxGeometry boxGeometryBox4(halfExt); + PxTransform poseBox4(PxVec3(-0.25f, 5.f, 0.f)); + PxRigidDynamic* box4 = gPhysics->createRigidDynamic(poseBox4); + PxShape* shape4 = PxRigidActorExt::createExclusiveShape(*box4, boxGeometryBox4, *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box4, density); + gScene->addActor(*box4); + + gRBIndices.pushBack(box4->getGPUIndex()); + gRBGeometries.pushBack(boxGeometryBox4); + gRBPoses.pushBack(poseBox4); + + PxBoxGeometry boxGeometryBox5(halfExt); + PxTransform poseBox5(PxVec3(0.25f, 5.f, 0.f)); + PxRigidDynamic* box5 = gPhysics->createRigidDynamic(poseBox5); + PxShape* shape5 = PxRigidActorExt::createExclusiveShape(*box5, boxGeometryBox5, *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box5, density); + gScene->addActor(*box5); + + gRBIndices.pushBack(box5->getGPUIndex()); + gRBGeometries.pushBack(boxGeometryBox5); + gRBPoses.pushBack(poseBox5); + + PxBoxGeometry boxGeometryBox6(halfExt); + PxTransform poseBox6(PxVec3(-0.25f, 4.5f, 0.f)); + PxRigidDynamic* box6 = gPhysics->createRigidDynamic(poseBox6); + PxShape* shape6 = PxRigidActorExt::createExclusiveShape(*box6, boxGeometryBox6, *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box6, density); + gScene->addActor(*box6); + + gRBIndices.pushBack(box6->getGPUIndex()); + gRBGeometries.pushBack(boxGeometryBox6); + gRBPoses.pushBack(poseBox6); + + PxBoxGeometry boxGeometryBox7(halfExt); + PxTransform poseBox7(PxVec3(0.25f, 4.5f, 0.f)); + PxRigidDynamic* box7 = gPhysics->createRigidDynamic(poseBox7); + PxShape* shape7 = PxRigidActorExt::createExclusiveShape(*box7, boxGeometryBox7, *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*box7, density); + gScene->addActor(*box7); + + gRBIndices.pushBack(box7->getGPUIndex()); + gRBGeometries.pushBack(boxGeometryBox7); + gRBPoses.pushBack(poseBox7); + + shape0->setContactOffset(gContactOffset); + shape1->setContactOffset(gContactOffset); + shape2->setContactOffset(gContactOffset); + shape3->setContactOffset(gContactOffset); + shape4->setContactOffset(gContactOffset); + shape5->setContactOffset(gContactOffset); + shape6->setContactOffset(gContactOffset); + shape7->setContactOffset(gContactOffset); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale()); + + PxCudaContextManagerDesc cudaContextManagerDesc; + gCudaContextManager = PxCreateCudaContextManager(*gFoundation, cudaContextManagerDesc); + if (!gCudaContextManager || !gCudaContextManager->contextIsValid()) + { + PX_RELEASE(gCudaContextManager); + printf("Failed to initialize cuda context.\n"); + printf("The direct GPU API feature is only supported on the GPU.\n"); + return; + } + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = gGravity; + + PxU32 numCores = SnippetUtils::getNbPhysicalCores(); + gDispatcher = PxDefaultCpuDispatcherCreate(numCores == 0 ? 0 : numCores - 1); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + sceneDesc.cudaContextManager = gCudaContextManager; + + // enable GPU simulation and direct GPU access + sceneDesc.flags |= PxSceneFlag::eENABLE_GPU_DYNAMICS; + sceneDesc.flags |= PxSceneFlag::eENABLE_DIRECT_GPU_API; + sceneDesc.broadPhaseType = PxBroadPhaseType::eGPU; + + sceneDesc.solverType = PxSolverType::eTGS; + sceneDesc.filterShader = scissorFilter; + + gScene = gPhysics->createScene(sceneDesc); + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + gArticulation = gPhysics->createArticulationReducedCoordinate(); + + createScissorLift(); + + // run one step to initialize the direct GPU API + gScene->simulate(1.0f / 60.f); + gScene->fetchResults(true); + + // note that the link indexing in the direct GPU API does not follow the order + // in which the links are created, link geometries must follow the low level indexing, + // this is critical to render the scene properly. + // first put placeholders in the arrays + for (PxU32 i = 0; i < gArticulation->getNbLinks(); ++i) + { + gLinkGeometries.pushBack(PxGeometryHolder()); + gLinkPoses.pushBack(PxTransform(PxIdentity)); + } + // then populate the array in the correct order + for (PxU32 i = 0; i < gArticulation->getNbLinks(); ++i) + { + // getting the link + PxArticulationLink* link; + gArticulation->getLinks(&link, 1, i); + // getting the link geometry + PxShape* shape; + link->getShapes(&shape, 1, 0); + // adding the link geometry at the correct index + gLinkGeometries[link->getLinkIndex()] = shape->getGeometry(); + } + + PxCudaContext* cudaContext = gCudaContextManager->getCudaContext(); + + // prepare RBs indices + cudaContext->memAlloc(&gRBIndicesD, getRBCount() * sizeof(PxU32)); + cudaContext->memcpyHtoD(gRBIndicesD, &gRBIndices[0], getRBCount() * sizeof(PxU32)); + // a buffer to read box pose for rendering + cudaContext->memAlloc(&gRBPosesD, getRBCount() * sizeof(PxTransform)); + + // prepare link indices + const PxArticulationGPUIndex gpuIndex = gArticulation->getGPUIndex(); + PX_ASSERT(gpuIndex != 0xFFffFFff); + gArtiIndices.pushBack(gpuIndex); + cudaContext->memAlloc(&gArtiIndicesD, sizeof(PxU32)); + cudaContext->memcpyHtoD(gArtiIndicesD, &gArtiIndices[0], sizeof(PxU32)); + // a buffer to read link pose for rendering + cudaContext->memAlloc(&gLinkPosesD, getLinkCount() * sizeof(PxTransform)); + + // prepare joint target position + gDriveValue.pushBack(0.0); + const PxU32 nbDofs = gArticulation->getDofs(); + cudaContext->memAlloc(&gDriveD, sizeof(PxReal) * nbDofs); + cudaContext->memcpyHtoD(gDriveD, &gDriveValue[0], sizeof(PxReal)); +} + +static bool gClosing = true; + +void stepPhysics(bool /*interactive*/) +{ + if (gCudaContextManager) + { + PxCudaContext* cudaContext = gCudaContextManager->getCudaContext(); + + const PxReal dt = 1.0f / 60.f; + + // get drive value + gScene->getDirectGPUAPI().getArticulationData( + (void*)gDriveD, (const PxArticulationGPUIndex*)(gArtiIndicesD), + PxArticulationGPUAPIReadType::eJOINT_TARGET_POSITION, 1); + cudaContext->memcpyDtoH(&gDriveValue[0], gDriveD, sizeof(PxReal)); + + if (gClosing && gDriveValue[0] < -1.2f) + gClosing = false; + else if (!gClosing && gDriveValue[0] > 0.f) + gClosing = true; + + if (gClosing) + gDriveValue[0] -= dt*0.25f; + else + gDriveValue[0] += dt*0.25f; + // set drive value + cudaContext->memcpyHtoD(gDriveD, &gDriveValue[0], sizeof(PxReal)); + + gScene->getDirectGPUAPI().setArticulationData( + (void*)gDriveD, (const PxArticulationGPUIndex*)(gArtiIndicesD), + PxArticulationGPUAPIWriteType::eJOINT_TARGET_POSITION, 1); + + gScene->simulate(dt); + gScene->fetchResults(true); + + // read current poses of boxes for rendering + gScene->getDirectGPUAPI().getRigidDynamicData(reinterpret_cast(gRBPosesD), + reinterpret_cast(gRBIndicesD), + PxRigidDynamicGPUAPIReadType::eGLOBAL_POSE, + getRBCount()); + cudaContext->memcpyDtoH(&gRBPoses[0], gRBPosesD, getRBCount() * sizeof(PxTransform)); + + // read current poses of the scissor lift for rendering + gScene->getDirectGPUAPI().getArticulationData(reinterpret_cast(gLinkPosesD), + reinterpret_cast(gArtiIndicesD), + PxArticulationGPUAPIReadType::eLINK_GLOBAL_POSE, + 1); + cudaContext->memcpyDtoH(&gLinkPoses[0], gLinkPosesD, getLinkCount() * sizeof(PxTransform)); + } +} + +void cleanupPhysics(bool /*interactive*/) +{ + if (gCudaContextManager) + { + PxCudaContext* cudaContext = gCudaContextManager->getCudaContext(); + cudaContext->memFree(gArtiIndicesD); + cudaContext->memFree(gDriveD); + cudaContext->memFree(gRBPosesD); + cudaContext->memFree(gRBIndicesD); + cudaContext->memFree(gLinkPosesD); + } + gRBIndices.reset(); + gRBGeometries.reset(); + gRBPoses.reset(); + gArtiIndices.reset(); + gLinkGeometries.reset(); + gLinkPoses.reset(); + gDriveValue.reset(); + + PX_RELEASE(gArticulation); + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + PX_RELEASE(gCudaContextManager); + PX_RELEASE(gFoundation); + + printf("SnippetDirectGPUAPIArticulation done.\n"); +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; i +#include "PxPhysicsAPI.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +static PxArticulationReducedCoordinate* gArticulation = NULL; +static PxArticulationJointReducedCoordinate* gDriveJoint = NULL; +static const PxReal gGravity = 9.81f; +static PxReal gDriveTargetPos = 0.0f; + +static void createArticulation() +{ + gArticulation->setArticulationFlags(PxArticulationFlag::eFIX_BASE); + gArticulation->setSolverIterationCounts(10, 1); + + // link geometry and density: + const PxVec3 halfLengths(0.50f, 0.05f, 0.05f); + const PxBoxGeometry linkGeom = PxBoxGeometry(halfLengths); + const PxReal density = 1000.0f; + + //Create links + PxTransform pose = PxTransform(PxIdentity); + pose.p.y = 3.0f; + pose.p.x -= 2.0f * halfLengths.x; + PxArticulationLink* parent = NULL; + + const PxU32 numLinks = 3; + for(PxU32 j = 0; j < numLinks; ++j) + { + pose.p.x += 2.0f * halfLengths.x; + parent = gArticulation->createLink(parent, pose); + PxRigidActorExt::createExclusiveShape(*parent, linkGeom, *gMaterial); + PxRigidBodyExt::updateMassAndInertia(*parent, density); + PxArticulationJointReducedCoordinate* joint = parent->getInboundJoint(); + if(joint) + { + PxVec3 parentOffset(halfLengths.x, 0.0f, 0.0f); + PxVec3 childOffset(-halfLengths.x, 0.0f, 0.0f); + joint->setParentPose(PxTransform(parentOffset, PxQuat(PxIdentity))); + joint->setChildPose(PxTransform(childOffset, PxQuat(PxIdentity))); + joint->setJointType(PxArticulationJointType::eREVOLUTE); + joint->setMotion(PxArticulationAxis::eSWING2, PxArticulationMotion::eFREE); + } + } + + // tendon and drive stiffness sizing + // assuming all links extend horizontally, size to allow for two degrees + // deviation due to gravity + const PxReal linkMass = parent->getMass(); + const PxReal deflectionAngle = 2.0f * PxPi / 180.0f; // two degrees + // moment arm of first link is one half-length, for second it is three half-lengths + const PxReal gravityTorque = gGravity * linkMass * (halfLengths.x + 3.0f * halfLengths.x); + const PxReal driveStiffness = gravityTorque / deflectionAngle; + const PxReal driveDamping = 0.2f * driveStiffness; + // same idea for the tendon, but it has to support only a single link + const PxReal tendonStiffness = gGravity * linkMass * halfLengths.x / deflectionAngle; + const PxReal tendonDamping = 0.2f * tendonStiffness; + + // compute drive target angle that compensates, statically, for the first fixed tendon joint + // torque acting on the drive joint: + const PxReal targetAngle = PxPiDivFour; + const PxReal tendonTorque = targetAngle * tendonStiffness; + gDriveTargetPos = targetAngle + tendonTorque / driveStiffness; + + // setup fixed tendon + PxArticulationLink* links[numLinks]; + gArticulation->getLinks(links, numLinks, 0u); + PxArticulationFixedTendon* tendon = gArticulation->createFixedTendon(); + tendon->setLimitStiffness(0.0f); + tendon->setDamping(tendonDamping); + tendon->setStiffness(tendonStiffness); + tendon->setRestLength(0.f); + tendon->setOffset(0.f); + PxArticulationTendonJoint* tendonParentJoint = NULL; + // root fixed-tendon joint - does not contribute to length so its coefficient and axis are irrelevant + // but its parent link experiences all tendon-joint reaction forces + tendonParentJoint = tendon->createTendonJoint(tendonParentJoint, PxArticulationAxis::eSWING2, 42.0f, 1.f/42.f, links[0]); + // drive joint + tendonParentJoint = tendon->createTendonJoint(tendonParentJoint, PxArticulationAxis::eSWING2, 1.0f, 1.f, links[1]); + // second joint that is driven only by the tendon - negative coefficient to mirror angle of drive joint + tendonParentJoint = tendon->createTendonJoint(tendonParentJoint, PxArticulationAxis::eSWING2, -1.0f, -1.0f, links[2]); + + // configure joint drive + gDriveJoint = links[1]->getInboundJoint(); + PxArticulationDrive driveConfiguration; + driveConfiguration.damping = driveDamping; + driveConfiguration.stiffness = driveStiffness; + driveConfiguration.maxForce = PX_MAX_F32; + driveConfiguration.driveType = PxArticulationDriveType::eFORCE; + gDriveJoint->setDriveParams(PxArticulationAxis::eSWING2, driveConfiguration); + gDriveJoint->setDriveVelocity(PxArticulationAxis::eSWING2, 0.0f); + gDriveJoint->setDriveTarget(PxArticulationAxis::eSWING2, 0.0f); + + // add articulation to scene: + gScene->addArticulation(*gArticulation); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + PxInitExtensions(*gPhysics, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -gGravity, 0.0f); + + PxU32 numCores = SnippetUtils::getNbPhysicalCores(); + gDispatcher = PxDefaultCpuDispatcherCreate(numCores == 0 ? 0 : numCores - 1); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + sceneDesc.solverType = PxSolverType::eTGS; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + gScene = gPhysics->createScene(sceneDesc); + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.f); + gArticulation = gPhysics->createArticulationReducedCoordinate(); + + createArticulation(); +} + +void stepPhysics(bool /*interactive*/) +{ + static bool dir = false; + static PxReal time = 0.0f; + const PxReal switchTime = 3.0f; + const PxReal dt = 1.0f / 60.f; + + time += dt; + if(time > switchTime) + { + if(dir) + { + gDriveJoint->setDriveTarget(PxArticulationAxis::eSWING2, 0.0f); + } + else + { + gDriveJoint->setDriveTarget(PxArticulationAxis::eSWING2, gDriveTargetPos); + } + dir = !dir; + time = 0.0f; + } + + gScene->simulate(dt); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_RELEASE(gArticulation); + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + PxCloseExtensions(); + PX_RELEASE(gFoundation); + + printf("SnippetFixedTendon done.\n"); +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetNbArticulations(); + for(PxU32 i=0;igetArticulations(&articulation, 1, i); + + const PxU32 nbLinks = articulation->getNbLinks(); + PxArray links(nbLinks); + articulation->getLinks(&links[0], nbLinks); + + PxReal colorScale = 1.0f; + if(articulation->isSleeping()) + colorScale = 0.4f; + + const PxU32 numLinks = static_cast(links.size()); + Snippets::renderActors(reinterpret_cast(&links[0]), 1, true, colorScale * baseLinkColor); + Snippets::renderActors(reinterpret_cast(&links[1]), numLinks - 1, true, colorScale * dynLinkColor); + } + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + cleanupPhysics(true); +} +} + +void renderLoop() +{ + const PxVec3 camEye(3.3f, 2.95f, 3.2f); + const PxVec3 camDir(-0.5f, -0.078f, -0.86f); + + sCamera = new Snippets::Camera(camEye, camDir); + + Snippets::setupDefault("PhysX Snippet Articulation Fixed Tendon", sCamera, NULL, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} + +#endif diff --git a/engine/third_party/physx/snippets/snippetfrustumquery/SnippetFrustumQuery.cpp b/engine/third_party/physx/snippets/snippetfrustumquery/SnippetFrustumQuery.cpp new file mode 100644 index 00000000..010e12b5 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetfrustumquery/SnippetFrustumQuery.cpp @@ -0,0 +1,402 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet illustrates how to use a PxBVH to implement view-frustum culling. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "foundation/PxArray.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#ifdef RENDER_SNIPPET + #include "../snippetrender/SnippetCamera.h" + #include "../snippetrender/SnippetRender.h" +#endif + +//#define BENCHMARK_MODE + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; + +namespace +{ + class CustomScene + { + public: + CustomScene(); + ~CustomScene(); + + void release(); + void addGeom(const PxGeometry& geom, const PxTransform& pose); + void createBVH(); + void render() const; + + struct Object + { + PxGeometryHolder mGeom; + PxTransform mPose; + }; + + PxArray mObjects; + PxBVH* mBVH; + }; + +CustomScene::CustomScene() : mBVH(NULL) +{ +} + +CustomScene::~CustomScene() +{ +} + +void CustomScene::release() +{ + PX_RELEASE(mBVH); + mObjects.reset(); + PX_DELETE_THIS; +} + +void CustomScene::addGeom(const PxGeometry& geom, const PxTransform& pose) +{ + Object obj; + obj.mGeom.storeAny(geom); + obj.mPose = pose; + mObjects.pushBack(obj); +} + +void CustomScene::createBVH() +{ + const PxU32 nbObjects = mObjects.size(); + PxBounds3* bounds = new PxBounds3[nbObjects]; + for(PxU32 i=0;i mVisibles; + LocalCB& operator=(const LocalCB&){return *this;} + }; + + LocalCB cb(*this); + +#ifdef BENCHMARK_MODE + unsigned long long time = __rdtsc(); +#endif + mBVH->cull(6, planes, cb); + + char buffer[256]; +#ifdef BENCHMARK_MODE + time = __rdtsc() - time; + sprintf(buffer, "%d visible objects (%d)\n", cb.mVisibles.size(), int(time/1024)); +#else + sprintf(buffer, "%d visible objects\n", cb.mVisibles.size()); +#endif + const PxVec3 color(1.0f, 0.5f, 0.25f); + for(PxU32 i=0;igetNbBounds(); + for(PxU32 i=0;igetBounds()[i]); + } + + Snippets::print(buffer); + } +#endif +} + + +} + +static PxConvexMesh* createConvexMesh(const PxVec3* verts, const PxU32 numVerts, const PxCookingParams& params) +{ + PxConvexMeshDesc convexDesc; + convexDesc.points.count = numVerts; + convexDesc.points.stride = sizeof(PxVec3); + convexDesc.points.data = verts; + convexDesc.flags = PxConvexFlag::eCOMPUTE_CONVEX; + return PxCreateConvexMesh(params, convexDesc); +} + +static PxConvexMesh* createCylinderMesh(const PxF32 width, const PxF32 radius, const PxCookingParams& params) +{ + PxVec3 points[2*16]; + for(PxU32 i = 0; i < 16; i++) + { + const PxF32 cosTheta = PxCos(i*PxPi*2.0f/16.0f); + const PxF32 sinTheta = PxSin(i*PxPi*2.0f/16.0f); + const PxF32 y = radius*cosTheta; + const PxF32 z = radius*sinTheta; + points[2*i+0] = PxVec3(-width/2.0f, y, z); + points[2*i+1] = PxVec3(+width/2.0f, y, z); + } + return createConvexMesh(points, 32, params); +} + +static void initScene() +{ +} + +static void releaseScene() +{ +} + +static PxConvexMesh* gConvexMesh = NULL; +static PxTriangleMesh* gTriangleMesh = NULL; + +static CustomScene* gScene = NULL; + +void renderScene() +{ + if(gScene) + gScene->render(); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + const PxTolerancesScale scale; + PxCookingParams params(scale); + params.midphaseDesc.setToDefault(PxMeshMidPhase::eBVH34); +// params.midphaseDesc.mBVH34Desc.quantized = false; + params.meshPreprocessParams |= PxMeshPreprocessingFlag::eDISABLE_ACTIVE_EDGES_PRECOMPUTE; + params.meshPreprocessParams |= PxMeshPreprocessingFlag::eDISABLE_CLEAN_MESH; + + gConvexMesh = createCylinderMesh(3.0f, 1.0f, params); + + { + PxTriangleMeshDesc meshDesc; + meshDesc.points.count = SnippetUtils::Bunny_getNbVerts(); + meshDesc.points.stride = sizeof(PxVec3); + meshDesc.points.data = SnippetUtils::Bunny_getVerts(); + meshDesc.triangles.count = SnippetUtils::Bunny_getNbFaces(); + meshDesc.triangles.stride = sizeof(int)*3; + meshDesc.triangles.data = SnippetUtils::Bunny_getFaces(); + + gTriangleMesh = PxCreateTriangleMesh(params, meshDesc); + } + + gScene = new CustomScene; + +#ifdef BENCHMARK_MODE + { + SnippetUtils::BasicRandom rnd(42); + + PxVec3 v; + const float coeff = 30.0f; + for(int i=0;i<1000;i++) + { + rnd.unitRandomPt(v); v*=coeff; + gScene->addGeom(PxBoxGeometry(PxVec3(1.0f, 2.0f, 0.5f)), PxTransform(v+PxVec3(0.0f, 0.0f, 0.0f))); + rnd.unitRandomPt(v); v*=coeff; + gScene->addGeom(PxSphereGeometry(1.5f), PxTransform(v+PxVec3(4.0f, 0.0f, 0.0f))); + rnd.unitRandomPt(v); v*=coeff; + gScene->addGeom(PxCapsuleGeometry(1.0f, 1.0f), PxTransform(v+PxVec3(-4.0f, 0.0f, 0.0f))); + rnd.unitRandomPt(v); v*=coeff; + gScene->addGeom(PxConvexMeshGeometry(gConvexMesh), PxTransform(v+PxVec3(0.0f, 0.0f, 4.0f))); + rnd.unitRandomPt(v); v*=coeff; + gScene->addGeom(PxTriangleMeshGeometry(gTriangleMesh), PxTransform(v+PxVec3(0.0f, 0.0f, -4.0f))); + } + } +#else + { + gScene->addGeom(PxBoxGeometry(PxVec3(1.0f, 2.0f, 0.5f)), PxTransform(PxVec3(0.0f, 0.0f, 0.0f))); + gScene->addGeom(PxSphereGeometry(1.5f), PxTransform(PxVec3(4.0f, 0.0f, 0.0f))); + gScene->addGeom(PxCapsuleGeometry(1.0f, 1.0f), PxTransform(PxVec3(-4.0f, 0.0f, 0.0f))); + gScene->addGeom(PxConvexMeshGeometry(gConvexMesh), PxTransform(PxVec3(0.0f, 0.0f, 4.0f))); + gScene->addGeom(PxTriangleMeshGeometry(gTriangleMesh), PxTransform(PxVec3(0.0f, 0.0f, -4.0f))); + } +#endif + gScene->createBVH(); + + initScene(); +} + +void stepPhysics(bool /*interactive*/) +{ +} + +void cleanupPhysics(bool /*interactive*/) +{ + releaseScene(); + + PX_RELEASE(gScene); + PX_RELEASE(gConvexMesh); + PX_RELEASE(gFoundation); + + printf("SnippetFrustumQuery done.\n"); +} + +void keyPress(unsigned char /*key*/, const PxTransform& /*camera*/) +{ +/* if(key >= 1 && key <= gScenarioCount) + { + gScenario = key - 1; + releaseScene(); + initScene(); + } + + if(key == 'r' || key == 'R') + { + releaseScene(); + initScene(); + }*/ +} + +int snippetMain(int, const char*const*) +{ + printf("Frustum query snippet.\n"); + +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetEye(); +// PxVec3 camDir = sCamera->getDir(); +// printf("camPos: (%ff, %ff, %ff)\n", camPos.x, camPos.y, camPos.z); +// printf("camDir: (%ff, %ff, %ff)\n", camDir.x, camDir.y, camDir.z); + + renderScene(); + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + cleanupPhysics(true); +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(-1.301793f, 2.118334f, 7.282349f), PxVec3(0.209045f, -0.311980f, -0.926806f)); + + Snippets::setupDefault("PhysX Snippet Frustum Query", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetgearjoint/SnippetGearJoint.cpp b/engine/third_party/physx/snippets/snippetgearjoint/SnippetGearJoint.cpp new file mode 100644 index 00000000..98844355 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetgearjoint/SnippetGearJoint.cpp @@ -0,0 +1,195 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet illustrates simple use of gear joints +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; + +static PxRigidDynamic* createGearWithBoxes(PxPhysics& sdk, const PxBoxGeometry& boxGeom, const PxTransform& transform, PxMaterial& material, int nbShapes) +{ + PxRigidDynamic* actor = sdk.createRigidDynamic(transform); + + PxMat33 m(PxIdentity); + + for(int i=0;isetLocalPose(localPose); + + actor->attachShape(*shape); + } + PxRigidBodyExt::updateMassAndInertia(*actor, 1.0f); + + return actor; +} + +static PxRevoluteJoint* gHinge0 = NULL; + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(),true, gPvd); + PxInitExtensions(*gPhysics, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(2); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + gScene = gPhysics->createScene(sceneDesc); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + const float velocityTarget = 0.5f; + const float radius0 = 5.0f; + const float radius1 = 2.0f; + + const float extent0 = radius0 * sqrtf(2.0f); + const float extent1 = radius1 * sqrtf(2.0f); + const float teethLength0 = extent0 - radius0; + const float teethLength1 = extent1 - radius1; + const float extra = (teethLength0 + teethLength1)*0.75f; + + const PxBoxGeometry boxGeom0(radius0, radius0, 0.5f); + const PxBoxGeometry boxGeom1(radius1, radius1, 0.25f); + const PxVec3 boxPos0(0.0f, 10.0f, 0.0f); + const PxVec3 boxPos1(radius0+radius1+extra, 10.0f, 0.0f); + + PxRigidDynamic* actor0 = createGearWithBoxes(*gPhysics, boxGeom0, PxTransform(boxPos0), *gMaterial, int(radius0)); + gScene->addActor(*actor0); + + PxRigidDynamic* actor1= createGearWithBoxes(*gPhysics, boxGeom1, PxTransform(boxPos1), *gMaterial, int(radius1)); + gScene->addActor(*actor1); + + const PxQuat x2z = PxShortestRotation(PxVec3(1.0f, 0.0f, 0.0f), PxVec3(0.0f, 0.0f, 1.0f)); + + PxRevoluteJoint* hinge0 = PxRevoluteJointCreate(*gPhysics, NULL, PxTransform(boxPos0, x2z), actor0, PxTransform(PxVec3(0.0f), x2z)); + PxRevoluteJoint* hinge1 = PxRevoluteJointCreate(*gPhysics, NULL, PxTransform(boxPos1, x2z), actor1, PxTransform(PxVec3(0.0f), x2z)); + + hinge0->setDriveVelocity(velocityTarget); + hinge0->setRevoluteJointFlag(PxRevoluteJointFlag::eDRIVE_ENABLED, true); + gHinge0 = hinge0; + + PxGearJoint* gearJoint = PxGearJointCreate(*gPhysics, actor0, PxTransform(PxVec3(0.0f), x2z), actor1, PxTransform(PxVec3(0.0f), x2z)); + + gearJoint->setHinges(hinge0, hinge1); + + const float ratio = radius0/radius1; + gearJoint->setGearRatio(ratio); +} + +void stepPhysics(bool /*interactive*/) +{ + if(0) + { + static float globalTime = 0.0f; + globalTime += 1.0f/60.0f; + const float velocityTarget = sinf(globalTime)*3.0f; + gHinge0->setDriveVelocity(velocityTarget); + } + + gScene->simulate(1.0f/60.0f); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PxCloseExtensions(); + PX_RELEASE(gPhysics); + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetGearJoint done.\n"); +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetEye(); + PxVec3 camDir = sCamera->getDir(); + printf("camPos: (%ff, %ff, %ff)\n", camPos.x, camPos.y, camPos.z); + printf("camDir: (%ff, %ff, %ff)\n", camDir.x, camDir.y, camDir.z); + }*/ + + Snippets::startRender(sCamera); + + PxScene* scene; + PxGetPhysics().getScenes(&scene,1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + cleanupPhysics(true); +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(7.401237f, 11.224086f, 15.145986f), PxVec3(-0.315603f, -0.041489f, -0.947984f)); + + Snippets::setupDefault("PhysX Snippet GearJoint", sCamera, NULL, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetgeometryquery/SnippetGeometryQuery.cpp b/engine/third_party/physx/snippets/snippetgeometryquery/SnippetGeometryQuery.cpp new file mode 100644 index 00000000..1591f229 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetgeometryquery/SnippetGeometryQuery.cpp @@ -0,0 +1,211 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet illustrates how to use a PxGeometryQuery for raycasts. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#ifdef RENDER_SNIPPET + #include "../snippetrender/SnippetRender.h" +#endif + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; + +enum Geom +{ + GEOM_BOX, + GEOM_SPHERE, + GEOM_CAPSULE, + GEOM_CONVEX, + GEOM_MESH, + + GEOM_COUNT +}; + +static const PxU32 gScenarioCount = GEOM_COUNT; +static PxU32 gScenario = 0; + +static PxConvexMesh* createConvexMesh(const PxVec3* verts, const PxU32 numVerts, const PxCookingParams& params) +{ + PxConvexMeshDesc convexDesc; + convexDesc.points.count = numVerts; + convexDesc.points.stride = sizeof(PxVec3); + convexDesc.points.data = verts; + convexDesc.flags = PxConvexFlag::eCOMPUTE_CONVEX; + return PxCreateConvexMesh(params, convexDesc); +} + +static PxConvexMesh* createCylinderMesh(const PxF32 width, const PxF32 radius, const PxCookingParams& params) +{ + PxVec3 points[2*16]; + for(PxU32 i = 0; i < 16; i++) + { + const PxF32 cosTheta = PxCos(i*PxPi*2.0f/16.0f); + const PxF32 sinTheta = PxSin(i*PxPi*2.0f/16.0f); + const PxF32 y = radius*cosTheta; + const PxF32 z = radius*sinTheta; + points[2*i+0] = PxVec3(-width/2.0f, y, z); + points[2*i+1] = PxVec3(+width/2.0f, y, z); + } + return createConvexMesh(points, 32, params); +} + +static void initScene() +{ +} + +static void releaseScene() +{ +} + +static PxConvexMesh* gConvexMesh = NULL; +static PxTriangleMesh* gTriangleMesh = NULL; +static PxBoxGeometry gBoxGeom(PxVec3(1.0f, 2.0f, 0.5f)); +static PxSphereGeometry gSphereGeom(1.5f); +static PxCapsuleGeometry gCapsuleGeom(1.0f, 1.0f); +static PxConvexMeshGeometry gConvexGeom; +static PxTriangleMeshGeometry gMeshGeom; +const PxGeometry& getTestGeometry() +{ + switch(gScenario) + { + case GEOM_BOX: + return gBoxGeom; + case GEOM_SPHERE: + return gSphereGeom; + case GEOM_CAPSULE: + return gCapsuleGeom; + case GEOM_CONVEX: + gConvexGeom.convexMesh = gConvexMesh; + return gConvexGeom; + case GEOM_MESH: + gMeshGeom.triangleMesh = gTriangleMesh; + gMeshGeom.scale.scale = PxVec3(2.0f); + return gMeshGeom; + } + static PxSphereGeometry pt(0.0f); + return pt; +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + const PxTolerancesScale scale; + PxCookingParams params(scale); + params.midphaseDesc.setToDefault(PxMeshMidPhase::eBVH34); +// params.midphaseDesc.mBVH34Desc.quantized = false; + params.meshPreprocessParams |= PxMeshPreprocessingFlag::eDISABLE_ACTIVE_EDGES_PRECOMPUTE; + params.meshPreprocessParams |= PxMeshPreprocessingFlag::eDISABLE_CLEAN_MESH; + + gConvexMesh = createCylinderMesh(3.0f, 1.0f, params); + + { + PxTriangleMeshDesc meshDesc; + meshDesc.points.count = SnippetUtils::Bunny_getNbVerts(); + meshDesc.points.stride = sizeof(PxVec3); + meshDesc.points.data = SnippetUtils::Bunny_getVerts(); + meshDesc.triangles.count = SnippetUtils::Bunny_getNbFaces(); + meshDesc.triangles.stride = sizeof(int)*3; + meshDesc.triangles.data = SnippetUtils::Bunny_getFaces(); + + gTriangleMesh = PxCreateTriangleMesh(params, meshDesc); + } + + initScene(); +} + +void stepPhysics(bool /*interactive*/) +{ +} + +void cleanupPhysics(bool /*interactive*/) +{ + releaseScene(); + + PX_RELEASE(gConvexMesh); + PX_RELEASE(gFoundation); + + printf("SnippetGeometryQuery done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& /*camera*/) +{ + if(key >= 1 && key <= gScenarioCount) + { + gScenario = key - 1; + releaseScene(); + initScene(); + } + + if(key == 'r' || key == 'R') + { + releaseScene(); + initScene(); + } +} + +void renderText() +{ +#ifdef RENDER_SNIPPET + Snippets::print("Press F1 to F5 to select a geometry object."); +#endif +} + +int snippetMain(int, const char*const*) +{ + printf("GeometryQuery snippet. Use these keys:\n"); + printf(" F1 to F5 - select different geom\n"); + printf("\n"); + +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetEye(); + const PxVec3 camDir = sCamera->getDir(); + const PxU32 RAYTRACING_RENDER_WIDTH = 256; + const PxU32 RAYTRACING_RENDER_HEIGHT = 256; + + const PxU32 textureWidth = RAYTRACING_RENDER_WIDTH; + const PxU32 textureHeight = RAYTRACING_RENDER_HEIGHT; + + GLubyte* pixels = new GLubyte[textureWidth*textureHeight*4]; + + const float fScreenWidth = float(screenWidth)/float(RAYTRACING_RENDER_WIDTH); + const float fScreenHeight = float(screenHeight)/float(RAYTRACING_RENDER_HEIGHT); + + GLubyte* buffer = pixels; + for(PxU32 j=0;jgetEye(); +// PxVec3 camDir = sCamera->getDir(); +// printf("camPos: (%ff, %ff, %ff)\n", camPos.x, camPos.y, camPos.z); +// printf("camDir: (%ff, %ff, %ff)\n", camDir.x, camDir.y, camDir.z); + + const PxVec3 color(1.0f, 0.5f, 0.25f); + const PxGeometryHolder gh(geom); + Snippets::renderGeoms(1, &gh, &pose, false, color); + + renderText(); + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + cleanupPhysics(true); +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(-1.301793f, 2.118334f, 7.282349f), PxVec3(0.209045f, -0.311980f, -0.926806f)); + + Snippets::setupDefault("PhysX Snippet GeometryQuery", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetgyroscopic/SnippetGyroscopic.cpp b/engine/third_party/physx/snippets/snippetgyroscopic/SnippetGyroscopic.cpp new file mode 100644 index 00000000..32c1269e --- /dev/null +++ b/engine/third_party/physx/snippets/snippetgyroscopic/SnippetGyroscopic.cpp @@ -0,0 +1,203 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet illustrates how to enable gyroscopic forces. The behavior of +// the object is known as the Dzhanibekov effect. +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#ifdef RENDER_SNIPPET + #include "../snippetrender/SnippetRender.h" +#endif + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; + +static bool gPause = false; +static bool gOneFrame = false; +static const PxU32 gScenarioCount = 2; +static PxU32 gScenario = 0; + +static void initScene() +{ + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + gScene = gPhysics->createScene(sceneDesc); + + const PxTransform pose(PxVec3(0.0f, 1.0f, 0.0f)); + + PxRigidDynamic* actor = gPhysics->createRigidDynamic(pose); + + PxShape* shape0 = gPhysics->createShape(PxBoxGeometry(PxVec3(0.05f, 0.5f, 0.05f)), *gMaterial, true); + actor->attachShape(*shape0); + + PxShape* shape1 = gPhysics->createShape(PxBoxGeometry(PxVec3(0.1f, 0.05f, 0.05f)), *gMaterial, true); + shape1->setLocalPose(PxTransform(PxVec3(0.1f, 0.0f, 0.0f))); + actor->attachShape(*shape1); + + PxRigidBodyExt::updateMassAndInertia(*actor, 1.0f); + + actor->setAngularVelocity(PxVec3(30.f*0.25f, 20.1f*0.25f, 0.0f)); + actor->setAngularDamping(0.0f); + + if(gScenario==0) + actor->setRigidBodyFlag(PxRigidBodyFlag::eENABLE_GYROSCOPIC_FORCES, true); + + gScene->addActor(*actor); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if (pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } +} + +void renderText() +{ +#ifdef RENDER_SNIPPET + Snippets::print("Press F1 or F2 to run with or without gyroscopic forces enabled."); +#endif +} + +void initPhysics(bool /*interactive*/) +{ + printf("Gyroscopic snippet. Use these keys:\n"); + printf(" P - enable/disable pause\n"); + printf(" O - step simulation for one frame\n"); + printf(" R - reset scene\n"); + printf(" F1 to F2 - run with or without gyroscopic forces enabled\n"); + printf("\n"); + + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + const PxU32 numCores = SnippetUtils::getNbPhysicalCores(); + gDispatcher = PxDefaultCpuDispatcherCreate(numCores == 0 ? 0 : numCores - 1); + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.25f); + + initScene(); +} + +void stepPhysics(bool /*interactive*/) +{ + if (gPause && !gOneFrame) + return; + gOneFrame = false; + + gScene->simulate(1.0f/60.0f); + gScene->fetchResults(true); +} + +static void releaseScene() +{ + PX_RELEASE(gScene); +} + +void cleanupPhysics(bool /*interactive*/) +{ + releaseScene(); + + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetGyroscopic done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& /*camera*/) +{ + if(key == 'p' || key == 'P') + gPause = !gPause; + + if(key == 'o' || key == 'O') + { + gPause = true; + gOneFrame = true; + } + + if(gScene) + { + if(key >= 1 && key <= gScenarioCount) + { + gScenario = key - 1; + releaseScene(); + initScene(); + } + + if(key == 'r' || key == 'R') + { + releaseScene(); + initScene(); + } + } +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + + renderText(); + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + cleanupPhysics(true); +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(1.096285f, 0.440703f, 1.361662f), PxVec3(-0.650010f, 0.262604f, -0.713110f)); + + Snippets::setupDefault("PhysX Snippet Gyroscopic", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippethellogrb/SnippetHelloGRB.cpp b/engine/third_party/physx/snippets/snippethellogrb/SnippetHelloGRB.cpp new file mode 100644 index 00000000..49c4156e --- /dev/null +++ b/engine/third_party/physx/snippets/snippethellogrb/SnippetHelloGRB.cpp @@ -0,0 +1,190 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet illustrates GPU-accelerated rigid body simulation. +// +// It creates a number of box stacks on a plane, and allows the +// user to create new stacks and fire a ball from the camera position +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +static PxCudaContextManager* gCudaContextManager = NULL; + +static PxReal stackZ = 10.0f; + +static PxRigidDynamic* createDynamic(const PxTransform& t, const PxGeometry& geometry, const PxVec3& velocity=PxVec3(0)) +{ + PxRigidDynamic* dynamic = PxCreateDynamic(*gPhysics, t, geometry, *gMaterial, 10.0f); + dynamic->setAngularDamping(0.5f); + dynamic->setLinearVelocity(velocity); + gScene->addActor(*dynamic); + return dynamic; +} + +static void createStack(const PxTransform& t, PxU32 size, PxReal halfExtent) +{ + PxShape* shape = gPhysics->createShape(PxBoxGeometry(halfExtent, halfExtent, halfExtent), *gMaterial); + for(PxU32 i=0; icreateRigidDynamic(t.transform(localTm)); + body->attachShape(*shape); + PxRigidBodyExt::updateMassAndInertia(*body, 10.0f); + gScene->addActor(*body); + } + } + shape->release(); +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport, PxPvdInstrumentationFlag::ePROFILE); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + PxCudaContextManagerDesc cudaContextManagerDesc; + gCudaContextManager = PxCreateCudaContextManager(*gFoundation, cudaContextManagerDesc, PxGetProfilerCallback()); //Create the CUDA context manager, required for GRB to dispatch CUDA kernels. + if( gCudaContextManager ) + { + if( !gCudaContextManager->contextIsValid() ) + PX_RELEASE(gCudaContextManager); + } + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(4); //Create a CPU dispatcher using 4 worther threads + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + sceneDesc.cudaContextManager = gCudaContextManager; //Set the CUDA context manager, used by GRB. + + sceneDesc.flags |= PxSceneFlag::eENABLE_GPU_DYNAMICS; //Enable GPU dynamics - without this enabled, simulation (contact gen and solver) will run on the CPU. + sceneDesc.flags |= PxSceneFlag::eENABLE_PCM; //Enable PCM. PCM NP is supported on GPU. Legacy contact gen will fall back to CPU + sceneDesc.flags |= PxSceneFlag::eENABLE_STABILIZATION; //Improve solver stability by enabling post-stabilization. + sceneDesc.broadPhaseType = PxBroadPhaseType::eGPU; //Enable GPU broad phase. Without this set, broad phase will run on the CPU. + sceneDesc.gpuMaxNumPartitions = 8; //Defines the maximum number of partitions used by the solver. Only power-of-2 values are valid. + //A value of 8 generally gives best balance between performance and stability. + + gScene = gPhysics->createScene(sceneDesc); + + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if (pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, false); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, false); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, false); + } + + + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + for(PxU32 i=0;i<40;i++) + createStack(PxTransform(PxVec3(0,0,stackZ-=10.0f)), 20, 1.0f); + + //if(!interactive) + { + PxRigidDynamic* ball = createDynamic(PxTransform(PxVec3(0,20,100)), PxSphereGeometry(5), PxVec3(0,-25,-100)); + PxRigidBodyExt::updateMassAndInertia(*ball, 1000.f); + } +} + +void stepPhysics(bool /*interactive*/) +{ + gScene->simulate(1.0f/60.0f); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + + PX_RELEASE(gCudaContextManager); + PX_RELEASE(gFoundation); + + printf("SnippetHelloGRB done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& camera) +{ + switch(toupper(key)) + { + case 'B': createStack(PxTransform(PxVec3(0,0,stackZ-=10.0f)), 10, 2.0f); break; + case ' ': createDynamic(camera, PxSphereGeometry(3.0f), camera.rotate(PxVec3(0,0,-1))*200); break; + } +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, (PxActor**)&actors[0], nbActors); + Snippets::renderActors(&actors[0], (PxU32)actors.size(), true); + } + + Snippets::finishRender(); +} + +void cleanup() +{ + delete sCamera; + cleanupPhysics(true); +} + +void exitCallback() +{ +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(50.0f, 50.0f, 50.0f), PxVec3(-0.6f,-0.2f,-0.7f)); + + Snippets::setupDefault("PhysX Snippet HelloWorld GRB", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); + + cleanup(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippethelloworld/SnippetHelloWorld.cpp b/engine/third_party/physx/snippets/snippethelloworld/SnippetHelloWorld.cpp new file mode 100644 index 00000000..fac80b77 --- /dev/null +++ b/engine/third_party/physx/snippets/snippethelloworld/SnippetHelloWorld.cpp @@ -0,0 +1,162 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet illustrates simple use of physx +// +// It creates a number of box stacks on a plane, and if rendering, allows the +// user to create new stacks and fire a ball from the camera position +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; + +static PxReal stackZ = 10.0f; + +static PxRigidDynamic* createDynamic(const PxTransform& t, const PxGeometry& geometry, const PxVec3& velocity=PxVec3(0)) +{ + PxRigidDynamic* dynamic = PxCreateDynamic(*gPhysics, t, geometry, *gMaterial, 10.0f); + dynamic->setAngularDamping(0.5f); + dynamic->setLinearVelocity(velocity); + gScene->addActor(*dynamic); + return dynamic; +} + +static void createStack(const PxTransform& t, PxU32 size, PxReal halfExtent) +{ + PxShape* shape = gPhysics->createShape(PxBoxGeometry(halfExtent, halfExtent, halfExtent), *gMaterial); + for(PxU32 i=0; icreateRigidDynamic(t.transform(localTm)); + body->attachShape(*shape); + PxRigidBodyExt::updateMassAndInertia(*body, 10.0f); + gScene->addActor(*body); + } + } + shape->release(); +} + +void initPhysics(bool interactive) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(2); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + gScene = gPhysics->createScene(sceneDesc); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + for(PxU32 i=0;i<5;i++) + createStack(PxTransform(PxVec3(0,0,stackZ-=10.0f)), 10, 2.0f); + + if(!interactive) + createDynamic(PxTransform(PxVec3(0,40,100)), PxSphereGeometry(10), PxVec3(0,-50,-100)); +} + +void stepPhysics(bool /*interactive*/) +{ + gScene->simulate(1.0f/60.0f); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetHelloWorld done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& camera) +{ + switch(toupper(key)) + { + case 'B': createStack(PxTransform(PxVec3(0,0,stackZ-=10.0f)), 10, 2.0f); break; + case ' ': createDynamic(camera, PxSphereGeometry(3.0f), camera.rotate(PxVec3(0,0,-1))*200); break; + } +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true); + } + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + cleanupPhysics(true); +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(50.0f, 50.0f, 50.0f), PxVec3(-0.6f,-0.2f,-0.7f)); + + Snippets::setupDefault("PhysX Snippet HelloWorld", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetimmediatearticulation/SnippetImmediateArticulation.cpp b/engine/third_party/physx/snippets/snippetimmediatearticulation/SnippetImmediateArticulation.cpp new file mode 100644 index 00000000..6d5776b0 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetimmediatearticulation/SnippetImmediateArticulation.cpp @@ -0,0 +1,2242 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +// **************************************************************************** +// This snippet demonstrates the use of immediate articulations. +// **************************************************************************** + +#include "PxImmediateMode.h" +#include "PxMaterial.h" +#include "geometry/PxGeometryQuery.h" +#include "geometry/PxConvexMesh.h" +#include "foundation/PxPhysicsVersion.h" +#include "foundation/PxArray.h" +#include "foundation/PxHashSet.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxFPU.h" +#include "cooking/PxCooking.h" +#include "cooking/PxConvexMeshDesc.h" +#include "ExtConstraintHelper.h" +#include "extensions/PxMassProperties.h" +#include "extensions/PxDefaultAllocator.h" +#include "extensions/PxDefaultErrorCallback.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetutils/SnippetImmUtils.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#ifdef RENDER_SNIPPET + #include "../snippetrender/SnippetRender.h" +#endif + +//Enables TGS or PGS solver +#define USE_TGS 0 + +//#define PRINT_TIMINGS +#define TEST_IMMEDIATE_JOINTS + +//Enables whether we want persistent state caching (contact cache, friction caching) or not. Avoiding persistency results in one-shot collision detection and zero friction +//correlation but simplifies code by not longer needing to cache persistent pairs. +#define WITH_PERSISTENCY 1 + +//Toggles whether we batch constraints or not. Constraint batching is an optional process which can improve performance by grouping together independent constraints. These independent constraints +//can be solved in parallel by using multiple lanes of SIMD registers. +#define BATCH_CONTACTS 1 + +using namespace physx; +using namespace immediate; +using namespace SnippetImmUtils; + +static const PxVec3 gGravity(0.0f, -9.81f, 0.0f); +static const float gContactDistance = 0.1f; +static const float gMeshContactMargin = 0.01f; +static const float gToleranceLength = 1.0f; +static const float gBounceThreshold = -2.0f; +static const float gFrictionOffsetThreshold = 0.04f; +static const float gCorrelationDistance = 0.025f; +static const float gBoundsInflation = 0.02f; +static const float gStaticFriction = 0.5f; +static const float gDynamicFriction = 0.5f; +static const float gRestitution = 0.0f; +static const float gMaxDepenetrationVelocity = 10.0f; +static const float gMaxContactImpulse = FLT_MAX; +static const float gLinearDamping = 0.1f; +static const float gAngularDamping = 0.05f; +static const float gMaxLinearVelocity = 100.0f; +static const float gMaxAngularVelocity = 100.0f; +static const float gJointFrictionCoefficient = 0.05f; +static const PxU32 gNbIterPos = 4; +static const PxU32 gNbIterVel = 1; + +static bool gPause = false; +static bool gOneFrame = false; +static bool gDrawBounds = false; +static PxU32 gSceneIndex = 2; +static float gTime = 0.0f; + +#if WITH_PERSISTENCY +struct PersistentContactPair +{ + PersistentContactPair() + { + reset(); + } + + PxCache cache; + PxU8* frictions; + PxU32 nbFrictions; + + PX_FORCE_INLINE void reset() + { + cache = PxCache(); + frictions = NULL; + nbFrictions = 0; + } +}; +#endif + + struct IDS + { + PX_FORCE_INLINE IDS(PxU32 id0, PxU32 id1) : mID0(id0), mID1(id1) {} + PxU32 mID0; + PxU32 mID1; + + PX_FORCE_INLINE bool operator == (const IDS& other) const + { + return mID0 == other.mID0 && mID1 == other.mID1; + } + }; + + PX_FORCE_INLINE uint32_t PxComputeHash(const IDS& p) + { + return PxComputeHash(uint64_t(p.mID0)|(uint64_t(p.mID1)<<32)); + } + +struct MassProps +{ + PxVec3 mInvInertia; + float mInvMass; +}; + +static void computeMassProps(MassProps& props, const PxGeometry& geometry, float mass) +{ + if(mass!=0.0f) + { + PxMassProperties inertia(geometry); + inertia = inertia * (mass/inertia.mass); + + PxQuat orient; + const PxVec3 diagInertia = PxMassProperties::getMassSpaceInertia(inertia.inertiaTensor, orient); + props.mInvMass = 1.0f/inertia.mass; + props.mInvInertia.x = diagInertia.x == 0.0f ? 0.0f : 1.0f/diagInertia.x; + props.mInvInertia.y = diagInertia.y == 0.0f ? 0.0f : 1.0f/diagInertia.y; + props.mInvInertia.z = diagInertia.z == 0.0f ? 0.0f : 1.0f/diagInertia.z; + } + else + { + props.mInvMass = 0.0f; + props.mInvInertia = PxVec3(0.0f); + } +} + +#ifdef TEST_IMMEDIATE_JOINTS + struct MyJointData : Ext::JointData + { + PxU32 mActors[2]; + PxTransform mLocalFrames[2]; + + void initInvMassScale() + { + invMassScale.linear0 = 1.0f; + invMassScale.angular0 = 1.0f; + invMassScale.linear1 = 1.0f; + invMassScale.angular1 = 1.0f; + } + }; +#endif + + class ImmediateScene + { + PX_NOCOPY(ImmediateScene) + public: + ImmediateScene(); + ~ImmediateScene(); + + void reset(); + + PxU32 createActor(const PxGeometry& geometry, const PxTransform& pose, const MassProps* massProps=NULL, PxArticulationLinkCookie* linkCookie=0); + + void createGroundPlane() + { + createActor(PxPlaneGeometry(), PxTransformFromPlaneEquation(PxPlane(0.0f, 1.0f, 0.0f, 0.0f))); + } + + void createScene(); +#ifdef TEST_IMMEDIATE_JOINTS + void createSphericalJoint(PxU32 id0, PxU32 id1, const PxTransform& localFrame0, const PxTransform& localFrame1, const PxTransform* pose0=NULL, const PxTransform* pose1=NULL); +#endif + void updateArticulations(float dt); + void updateBounds(); + void broadPhase(); + void narrowPhase(); + void buildSolverBodyData(float dt); + void buildSolverConstraintDesc(); + void createContactConstraints(float dt, float invDt, float lengthScale, PxU32 nbPositionIterations); + void solveAndIntegrate(float dt); + + TestCacheAllocator* mCacheAllocator; + TestConstraintAllocator* mConstraintAllocator; + + // PT: TODO: revisit this basic design once everything works + PxArray mGeoms; + PxArray mPoses; + PxArray mBounds; + + class ImmediateActor + { + public: + ImmediateActor() {} + ~ImmediateActor() {} + + enum Type + { + eSTATIC, + eDYNAMIC, + eLINK, + }; + Type mType; + PxU32 mCollisionGroup; + MassProps mMassProps; + PxVec3 mLinearVelocity; + PxVec3 mAngularVelocity; + // PT: ### TODO: revisit, these two could be a union, the cookie is only needed for a brief time during scene creation + // Or move them to a completely different / hidden array + PxArticulationLinkCookie mLinkCookie; + PxArticulationLinkHandle mLink; + }; + PxArray mActors; +#if USE_TGS + PxArray mSolverBodyData; + PxArray mSolverBodies; + PxArray mSolverBodyTxInertias; +#else + PxArray mSolverBodyData; + PxArray mSolverBodies; +#endif + PxArray mArticulations; + PxArray mTempZ; + PxArray mTempDeltaV; +#ifdef TEST_IMMEDIATE_JOINTS + PxArray mJointData; +#endif + PxArray mBroadphasePairs; + PxHashSet mFilteredPairs; + + struct ContactPair + { + PxU32 mID0; + PxU32 mID1; + + PxU32 mNbContacts; + PxU32 mStartContactIndex; + }; + // PT: we use separate arrays here because the immediate mode API expects an array of PxContactPoint + PxArray mContactPairs; + PxArray mContactPoints; +#if WITH_PERSISTENCY + PxHashMap mPersistentPairs; +#endif + PxArray mSolverConstraintDesc; +#if BATCH_CONTACTS + PxArray mOrderedSolverConstraintDesc; +#endif + PxArray mHeaders; + PxArray mContactForces; + + PxArray mMotionLinearVelocity; // Persistent to avoid runtime allocations but could be managed on the stack + PxArray mMotionAngularVelocity; // Persistent to avoid runtime allocations but could be managed on the stack + + PxU32 mNbStaticActors; + PxU32 mNbArticulationLinks; + PxU32 mMaxNumArticulationsLinks; + + PX_FORCE_INLINE void disableCollision(PxU32 i, PxU32 j) + { + if(i>j) + PxSwap(i, j); + mFilteredPairs.insert(IDS(i, j)); + } + + PX_FORCE_INLINE bool isCollisionDisabled(PxU32 i, PxU32 j) const + { + if(i>j) + PxSwap(i, j); + return mFilteredPairs.contains(IDS(i, j)); + } + + PxArticulationLinkCookie mMotorLinkCookie; + PxArticulationLinkHandle mMotorLink; + + PxArticulationHandle endCreateImmediateArticulation(PxArticulationCookie immArt); + + void allocateTempBuffer(const PxU32 maxLinks); + }; + +ImmediateScene::ImmediateScene() : + mNbStaticActors (0), + mNbArticulationLinks (0), + mMaxNumArticulationsLinks (0), + mMotorLinkCookie (PxCreateArticulationLinkCookie()), + mMotorLink (PxArticulationLinkHandle()) +{ + mCacheAllocator = new TestCacheAllocator; + mConstraintAllocator = new TestConstraintAllocator; +} + +ImmediateScene::~ImmediateScene() +{ + reset(); + + PX_DELETE(mConstraintAllocator); + PX_DELETE(mCacheAllocator); +} + +void ImmediateScene::reset() +{ + mGeoms.clear(); + mPoses.clear(); + mBounds.clear(); + mActors.clear(); + mSolverBodyData.clear(); + mSolverBodies.clear(); +#if USE_TGS + mSolverBodyTxInertias.clear(); +#endif + mBroadphasePairs.clear(); + mFilteredPairs.clear(); + mContactPairs.clear(); + mContactPoints.clear(); + mSolverConstraintDesc.clear(); +#if BATCH_CONTACTS + mOrderedSolverConstraintDesc.clear(); +#endif + mHeaders.clear(); + mContactForces.clear(); + mMotionLinearVelocity.clear(); + mMotionAngularVelocity.clear(); + + const PxU32 size = mArticulations.size(); + for(PxU32 i=0;igetInverse().transformInv(localFrame0); + else + jointData.c2b[0] = localFrame0; + if(isStatic1) + jointData.c2b[1] = pose1->getInverse().transformInv(localFrame1); + else + jointData.c2b[1] = localFrame1; + + jointData.initInvMassScale(); + + mJointData.pushBack(jointData); + disableCollision(id0, id1); +} +#endif + +void ImmediateScene::createScene() +{ + mMotorLink = PxArticulationLinkHandle(); + + const PxU32 index = gSceneIndex; + if(index==0) + { + // Box stack + { + const PxVec3 extents(0.5f, 0.5f, 0.5f); + const PxBoxGeometry boxGeom(extents); + + MassProps massProps; + computeMassProps(massProps, boxGeom, 1.0f); + + // for(PxU32 i=0;i<8;i++) + // createBox(extents, PxTransform(PxVec3(0.0f, extents.y + float(i)*extents.y*2.0f, 0.0f)), 1.0f); + + PxU32 size = 8; +// PxU32 size = 2; +// PxU32 size = 1; + float y = extents.y; + float x = 0.0f; + while(size) + { + for(PxU32 i=0;imContactPoints.size(); + mScene->mContactPairs.pushBack(pair); + mHasContacts = true; + } + + for(PxU32 i=0; imContactPoints.pushBack(point); + } + return true; + } + + ImmediateScene* mScene; + PxU32 mID0; + PxU32 mID1; + bool mHasContacts; + }; + + mCacheAllocator->reset(); + mConstraintAllocator->release(); + mContactPairs.resize(0); + mContactPoints.resize(0); + + const PxU32 nbPairs = mBroadphasePairs.size(); + for(PxU32 i=0;i(const_cast(&pair)); + desc.constraintType = PxSolverConstraintDesc::eCONTACT_CONSTRAINT; + } + +#ifdef TEST_IMMEDIATE_JOINTS + for(PxU32 i=0; i(const_cast(&jointData)); + desc.constraintType = PxSolverConstraintDesc::eJOINT_CONSTRAINT; + } +#endif +} + +#ifdef TEST_IMMEDIATE_JOINTS + +// PT: this is copied from PxExtensions, it's the solver prep function for spherical joints +//TAG:solverprepshader +static PxU32 SphericalJointSolverPrep(Px1DConstraint* constraints, + PxVec3p& body0WorldOffset, + PxU32 /*maxConstraints*/, + PxConstraintInvMassScale& invMassScale, + const void* constantBlock, + const PxTransform& bA2w, + const PxTransform& bB2w, + bool /*useExtendedLimits*/, + PxVec3p& cA2wOut, PxVec3p& cB2wOut) +{ + const MyJointData& data = *reinterpret_cast(constantBlock); + + PxTransform32 cA2w, cB2w; + Ext::joint::ConstraintHelper ch(constraints, invMassScale, cA2w, cB2w, body0WorldOffset, data, bA2w, bB2w); + + Ext::joint::applyNeighborhoodOperator(cA2w, cB2w); + +/* if(data.jointFlags & PxSphericalJointFlag::eLIMIT_ENABLED) + { + PxQuat swing, twist; + PxSeparateSwingTwist(cA2w.q.getConjugate() * cB2w.q, swing, twist); + PX_ASSERT(PxAbs(swing.x)<1e-6f); + + // PT: TODO: refactor with D6 joint code + PxVec3 axis; + PxReal error; + const PxReal pad = data.limit.isSoft() ? 0.0f : data.limit.contactDistance; + const Cm::ConeLimitHelperTanLess coneHelper(data.limit.yAngle, data.limit.zAngle, pad); + const bool active = coneHelper.getLimit(swing, axis, error); + if(active) + ch.angularLimit(cA2w.rotate(axis), error, data.limit); + }*/ + + PxVec3 ra, rb; + ch.prepareLockedAxes(cA2w.q, cB2w.q, cA2w.transformInv(cB2w.p), 7, 0, ra, rb); + cA2wOut = ra + bA2w.p; + cB2wOut = rb + bB2w.p; + + return ch.getCount(); +} +#endif + +#if USE_TGS +static void setupDesc(PxTGSSolverContactDesc& contactDesc, const ImmediateScene::ImmediateActor* actors, PxTGSSolverBodyTxInertia* txInertias, PxTGSSolverBodyData* solverBodyData, PxTransform* poses, const PxU32 id, const bool aorb) +{ + PxTransform& bodyFrame = aorb ? contactDesc.bodyFrame1 : contactDesc.bodyFrame0; + PxSolverConstraintPrepDescBase::BodyState& bodyState = aorb ? contactDesc.bodyState1 : contactDesc.bodyState0; + const PxTGSSolverBodyData*& data = aorb ? contactDesc.bodyData1 : contactDesc.bodyData0; + const PxTGSSolverBodyTxInertia*& txI = aorb ? contactDesc.body1TxI : contactDesc.body0TxI; + + const PxArticulationLinkHandle& link = actors[id].mLink; + if(link.articulation) + { + PxArticulationLinkDerivedDataRC linkData; + bool status = PxGetLinkData(link, linkData); + PX_ASSERT(status); + PX_UNUSED(status); + + data = NULL; + txI = NULL; + bodyFrame = linkData.pose; + bodyState = PxSolverConstraintPrepDescBase::eARTICULATION; + } + else + { + data = &solverBodyData[id]; + txI = &txInertias[id]; + bodyFrame = poses[id]; + bodyState = actors[id].mType == ImmediateScene::ImmediateActor::eDYNAMIC ? PxSolverConstraintPrepDescBase::eDYNAMIC_BODY : PxSolverConstraintPrepDescBase::eSTATIC_BODY; + } +} +#else +static void setupDesc(PxSolverContactDesc& contactDesc, const ImmediateScene::ImmediateActor* actors, PxSolverBodyData* solverBodyData, const PxU32 id, const bool aorb) +{ + PxTransform& bodyFrame = aorb ? contactDesc.bodyFrame1 : contactDesc.bodyFrame0; + PxSolverConstraintPrepDescBase::BodyState& bodyState = aorb ? contactDesc.bodyState1 : contactDesc.bodyState0; + const PxSolverBodyData*& data = aorb ? contactDesc.data1 : contactDesc.data0; + + const PxArticulationLinkHandle& link = actors[id].mLink; + if(link.articulation) + { + PxArticulationLinkDerivedDataRC linkData; + bool status = PxGetLinkData(link, linkData); + PX_ASSERT(status); + PX_UNUSED(status); + + data = NULL; + bodyFrame = linkData.pose; + bodyState = PxSolverConstraintPrepDescBase::eARTICULATION; + } + else + { + data = &solverBodyData[id]; + bodyFrame = solverBodyData[id].body2World; + bodyState = actors[id].mType == ImmediateScene::ImmediateActor::eDYNAMIC ? PxSolverConstraintPrepDescBase::eDYNAMIC_BODY : PxSolverConstraintPrepDescBase::eSTATIC_BODY; + } +} +#endif + +#if USE_TGS +static void setupJointDesc(PxTGSSolverConstraintPrepDesc& jointDesc, const ImmediateScene::ImmediateActor* actors, PxTGSSolverBodyTxInertia* txInertias, PxTGSSolverBodyData* solverBodyData, PxTransform* poses, const PxU32 bodyDataIndex, const bool aorb) +{ + if(!aorb) + { + jointDesc.bodyData0 = &solverBodyData[bodyDataIndex]; + jointDesc.body0TxI = &txInertias[bodyDataIndex]; + } + else + { + jointDesc.bodyData1 = &solverBodyData[bodyDataIndex]; + jointDesc.body1TxI = &txInertias[bodyDataIndex]; + } + + PxTransform& bodyFrame = aorb ? jointDesc.bodyFrame1 : jointDesc.bodyFrame0; + PxSolverConstraintPrepDescBase::BodyState& bodyState = aorb ? jointDesc.bodyState1 : jointDesc.bodyState0; + + if(actors[bodyDataIndex].mLink.articulation) + { + PxArticulationLinkDerivedDataRC linkData; + bool status = PxGetLinkData(actors[bodyDataIndex].mLink, linkData); + PX_ASSERT(status); + PX_UNUSED(status); + + bodyFrame = linkData.pose; + bodyState = PxSolverConstraintPrepDescBase::eARTICULATION; + } + else + { + //This may seem redundant but the bodyFrame is not defined by the bodyData object when using articulations. + // PT: TODO: this is a bug in the immediate mode snippet + if(actors[bodyDataIndex].mType == ImmediateScene::ImmediateActor::eSTATIC) + { + bodyFrame = PxTransform(PxIdentity); + bodyState = PxSolverConstraintPrepDescBase::eSTATIC_BODY; + } + else + { + bodyFrame = poses[bodyDataIndex]; + bodyState = PxSolverConstraintPrepDescBase::eDYNAMIC_BODY; + } + } +} +#else +static void setupJointDesc(PxSolverConstraintPrepDesc& jointDesc, const ImmediateScene::ImmediateActor* actors, PxSolverBodyData* solverBodyData, const PxU32 bodyDataIndex, const bool aorb) +{ + if(!aorb) + jointDesc.data0 = &solverBodyData[bodyDataIndex]; + else + jointDesc.data1 = &solverBodyData[bodyDataIndex]; + + PxTransform& bodyFrame = aorb ? jointDesc.bodyFrame1 : jointDesc.bodyFrame0; + PxSolverConstraintPrepDescBase::BodyState& bodyState = aorb ? jointDesc.bodyState1 : jointDesc.bodyState0; + + if(actors[bodyDataIndex].mLink.articulation) + { + PxArticulationLinkDerivedDataRC linkData; + bool status = PxGetLinkData(actors[bodyDataIndex].mLink, linkData); + PX_ASSERT(status); + PX_UNUSED(status); + + bodyFrame = linkData.pose; + bodyState = PxSolverConstraintPrepDescBase::eARTICULATION; + } + else + { + //This may seem redundant but the bodyFrame is not defined by the bodyData object when using articulations. + // PT: TODO: this is a bug in the immediate mode snippet + if(actors[bodyDataIndex].mType == ImmediateScene::ImmediateActor::eSTATIC) + { + bodyFrame = PxTransform(PxIdentity); + bodyState = PxSolverConstraintPrepDescBase::eSTATIC_BODY; + } + else + { + bodyFrame = solverBodyData[bodyDataIndex].body2World; + bodyState = PxSolverConstraintPrepDescBase::eDYNAMIC_BODY; + } + } +} +#endif + +void ImmediateScene::createContactConstraints(float dt, float invDt, float lengthScale, const PxU32 nbPosIterations) +{ + //Only referenced if using TGS solver + PX_UNUSED(lengthScale); + PX_UNUSED(nbPosIterations); +#if USE_TGS + const float stepDt = dt/float(nbPosIterations); + const float stepInvDt = invDt*float(nbPosIterations); +#endif +#if BATCH_CONTACTS + mHeaders.resize(mSolverConstraintDesc.size()); + + const PxU32 nbBodies = mActors.size() - mNbStaticActors; + + mOrderedSolverConstraintDesc.resize(mSolverConstraintDesc.size()); + PxArray& orderedDescs = mOrderedSolverConstraintDesc; + +#if USE_TGS + const PxU32 nbContactHeaders = physx::immediate::PxBatchConstraintsTGS( mSolverConstraintDesc.begin(), mContactPairs.size(), mSolverBodies.begin(), nbBodies, + mHeaders.begin(), orderedDescs.begin(), + mArticulations.begin(), mArticulations.size()); + + //2 batch the joints... + const PxU32 nbJointHeaders = physx::immediate::PxBatchConstraintsTGS( mSolverConstraintDesc.begin() + mContactPairs.size(), mJointData.size(), mSolverBodies.begin(), nbBodies, + mHeaders.begin() + nbContactHeaders, orderedDescs.begin() + mContactPairs.size(), + mArticulations.begin(), mArticulations.size()); +#else + //1 batch the contacts + const PxU32 nbContactHeaders = physx::immediate::PxBatchConstraints(mSolverConstraintDesc.begin(), mContactPairs.size(), mSolverBodies.begin(), nbBodies, + mHeaders.begin(), orderedDescs.begin(), + mArticulations.begin(), mArticulations.size()); + + //2 batch the joints... + const PxU32 nbJointHeaders = physx::immediate::PxBatchConstraints( mSolverConstraintDesc.begin() + mContactPairs.size(), mJointData.size(), mSolverBodies.begin(), nbBodies, + mHeaders.begin() + nbContactHeaders, orderedDescs.begin() + mContactPairs.size(), + mArticulations.begin(), mArticulations.size()); +#endif + + const PxU32 totalHeaders = nbContactHeaders + nbJointHeaders; + + mHeaders.forceSize_Unsafe(totalHeaders); +#else + PxArray& orderedDescs = mSolverConstraintDesc; + + const PxU32 nbContactHeaders = mContactPairs.size(); + #ifdef TEST_IMMEDIATE_JOINTS + const PxU32 nbJointHeaders = mJointData.size(); + PX_ASSERT(nbContactHeaders+nbJointHeaders==mSolverConstraintDesc.size()); + mHeaders.resize(nbContactHeaders+nbJointHeaders); + #else + PX_ASSERT(nbContactHeaders==mSolverConstraintDesc.size()); + PX_UNUSED(dt); + mHeaders.resize(nbContactHeaders); + #endif + + // We are bypassing the constraint batching so we create dummy PxConstraintBatchHeaders + for(PxU32 i=0; i(constraintDesc.constraint); +#if USE_TGS + PxTGSSolverContactDesc& contactDesc = contactDescs[a]; + PxMemZero(&contactDesc, sizeof(contactDesc)); + + setupDesc(contactDesc, mActors.begin(), mSolverBodyTxInertias.begin(), mSolverBodyData.begin(), mPoses.begin(), pair.mID0, false); + setupDesc(contactDesc, mActors.begin(), mSolverBodyTxInertias.begin(), mSolverBodyData.begin(), mPoses.begin(), pair.mID1, true); + + contactDesc.body0 = constraintDesc.tgsBodyA; + contactDesc.body1 = constraintDesc.tgsBodyB; + + contactDesc.torsionalPatchRadius = 0.0f; + contactDesc.minTorsionalPatchRadius = 0.0f; +#else + PxSolverContactDesc& contactDesc = contactDescs[a]; + PxMemZero(&contactDesc, sizeof(contactDesc)); + + setupDesc(contactDesc, mActors.begin(), mSolverBodyData.begin(), pair.mID0, false); + setupDesc(contactDesc, mActors.begin(), mSolverBodyData.begin(), pair.mID1, true); + + contactDesc.body0 = constraintDesc.bodyA; + contactDesc.body1 = constraintDesc.bodyB; +#endif + contactDesc.contactForces = &mContactForces[pair.mStartContactIndex]; + contactDesc.contacts = &mContactPoints[pair.mStartContactIndex]; + contactDesc.numContacts = pair.mNbContacts; + +#if WITH_PERSISTENCY + const PxHashMap::Entry* e = mPersistentPairs.find(IDS(pair.mID0, pair.mID1)); + PX_ASSERT(e); + { + PersistentContactPair& pcp = const_cast(e->second); + contactDesc.frictionPtr = pcp.frictions; + contactDesc.frictionCount = PxU8(pcp.nbFrictions); + persistentPairs[a] = &pcp; + } +#else + contactDesc.frictionPtr = NULL; + contactDesc.frictionCount = 0; +#endif + contactDesc.maxCCDSeparation = PX_MAX_F32; + + contactDesc.desc = &constraintDesc; + contactDesc.invMassScales.angular0 = contactDesc.invMassScales.angular1 = contactDesc.invMassScales.linear0 = contactDesc.invMassScales.linear1 = 1.0f; + } + +#if USE_TGS + PxCreateContactConstraintsTGS(&header, 1, contactDescs, *mConstraintAllocator, stepInvDt, invDt, gBounceThreshold, gFrictionOffsetThreshold, gCorrelationDistance); +#else + PxCreateContactConstraints(&header, 1, contactDescs, *mConstraintAllocator, invDt, gBounceThreshold, gFrictionOffsetThreshold, gCorrelationDistance, mTempZ.begin()); +#endif + +#if WITH_PERSISTENCY + //Cache friction information... + for (PxU32 a = 0; a < header.stride; ++a) + { +#if USE_TGS + const PxTGSSolverContactDesc& contactDesc = contactDescs[a]; +#else + const PxSolverContactDesc& contactDesc = contactDescs[a]; +#endif + PersistentContactPair& pcp = *persistentPairs[a]; + pcp.frictions = contactDesc.frictionPtr; + pcp.nbFrictions = contactDesc.frictionCount; + } +#endif + } + +#ifdef TEST_IMMEDIATE_JOINTS + for(PxU32 i=0; i(constraintDesc.constraint); + + constraints[a].prep = SphericalJointSolverPrep; + constraints[a].constantBlock = &jd; +#if USE_TGS + PxTGSSolverConstraintPrepDesc& jointDesc = jointDescs[a]; + jointDesc.body0 = constraintDesc.tgsBodyA; + jointDesc.body1 = constraintDesc.tgsBodyB; + setupJointDesc(jointDesc, mActors.begin(), mSolverBodyTxInertias.begin(), mSolverBodyData.begin(), mPoses.begin(), constraintDesc.bodyADataIndex, false); + setupJointDesc(jointDesc, mActors.begin(), mSolverBodyTxInertias.begin(), mSolverBodyData.begin(), mPoses.begin(), constraintDesc.bodyBDataIndex, true); +#else + PxSolverConstraintPrepDesc& jointDesc = jointDescs[a]; + jointDesc.body0 = constraintDesc.bodyA; + jointDesc.body1 = constraintDesc.bodyB; + setupJointDesc(jointDesc, mActors.begin(), mSolverBodyData.begin(), constraintDesc.bodyADataIndex, false); + setupJointDesc(jointDesc, mActors.begin(), mSolverBodyData.begin(), constraintDesc.bodyBDataIndex, true); +#endif + jointDesc.desc = &constraintDesc; + jointDesc.writeback = NULL; + jointDesc.linBreakForce = PX_MAX_F32; + jointDesc.angBreakForce = PX_MAX_F32; + jointDesc.minResponseThreshold = 0; + jointDesc.disablePreprocessing = false; + jointDesc.improvedSlerp = false; + jointDesc.driveLimitsAreForces = false; + jointDesc.invMassScales.angular0 = jointDesc.invMassScales.angular1 = jointDesc.invMassScales.linear0 = jointDesc.invMassScales.linear1 = 1.0f; + } + +#if USE_TGS + immediate::PxCreateJointConstraintsWithImmediateShadersTGS(&header, 1, constraints, jointDescs, *mConstraintAllocator, stepDt, dt, stepInvDt, invDt, lengthScale); +#else + immediate::PxCreateJointConstraintsWithImmediateShaders(&header, 1, constraints, jointDescs, *mConstraintAllocator, dt, invDt, mTempZ.begin()); +#endif + } + } +#endif +} + +void ImmediateScene::solveAndIntegrate(float dt) +{ +#ifdef PRINT_TIMINGS + unsigned long long time0 = __rdtsc(); +#endif + const PxU32 totalNbActors = mActors.size(); + const PxU32 nbDynamicActors = totalNbActors - mNbStaticActors - mNbArticulationLinks; + const PxU32 nbDynamic = nbDynamicActors + mNbArticulationLinks; + + mMotionLinearVelocity.resize(nbDynamic); + mMotionAngularVelocity.resize(nbDynamic); + + const PxU32 nbArticulations = mArticulations.size(); + PxArticulationHandle* articulations = mArticulations.begin(); + +#if USE_TGS + const float stepDt = dt/float(gNbIterPos); + + immediate::PxSolveConstraintsTGS(mHeaders.begin(), mHeaders.size(), +#if BATCH_CONTACTS + mOrderedSolverConstraintDesc.begin(), +#else + mSolverConstraintDesc.begin(), +#endif + mSolverBodies.begin(), mSolverBodyTxInertias.begin(), + nbDynamic, gNbIterPos, gNbIterVel, stepDt, 1.0f / stepDt, nbArticulations, articulations, + mTempZ.begin(), mTempDeltaV.begin()); +#else + + PxMemZero(mSolverBodies.begin(), mSolverBodies.size() * sizeof(PxSolverBody)); + + PxSolveConstraints( mHeaders.begin(), mHeaders.size(), +#if BATCH_CONTACTS + mOrderedSolverConstraintDesc.begin(), +#else + mSolverConstraintDesc.begin(), +#endif + mSolverBodies.begin(), + mMotionLinearVelocity.begin(), mMotionAngularVelocity.begin(), nbDynamic, gNbIterPos, gNbIterVel, + dt, 1.0f/dt, nbArticulations, articulations, + mTempZ.begin(), mTempDeltaV.begin()); +#endif + +#ifdef PRINT_TIMINGS + unsigned long long time1 = __rdtsc(); +#endif + +#if USE_TGS + PxIntegrateSolverBodiesTGS(mSolverBodies.begin(), mSolverBodyTxInertias.begin(), mPoses.begin(), nbDynamicActors, dt); + for (PxU32 i = 0; imGeoms.size() : 0; +} + +const PxGeometryHolder* getGeoms() +{ + if(!gScene || !gScene->mGeoms.size()) + return NULL; + return &gScene->mGeoms[0]; +} + +const PxTransform* getGeomPoses() +{ + if(!gScene || !gScene->mPoses.size()) + return NULL; + return &gScene->mPoses[0]; +} + +PxU32 getNbArticulations() +{ + return gScene ? gScene->mArticulations.size() : 0; +} + +PxArticulationHandle* getArticulations() +{ + if(!gScene || !gScene->mArticulations.size()) + return NULL; + return &gScene->mArticulations[0]; +} + +PxU32 getNbBounds() +{ + if(!gDrawBounds) + return 0; + return gScene ? gScene->mBounds.size() : 0; +} + +const PxBounds3* getBounds() +{ + if(!gDrawBounds) + return NULL; + if(!gScene || !gScene->mBounds.size()) + return NULL; + return &gScene->mBounds[0]; +} + +PxU32 getNbContacts() +{ + return gScene ? gScene->mContactPoints.size() : 0; +} + +const PxContactPoint* getContacts() +{ + if(!gScene || !gScene->mContactPoints.size()) + return NULL; + return &gScene->mContactPoints[0]; +} + +/////////////////////////////////////////////////////////////////////////////// + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + gScene = new ImmediateScene; + gScene->createScene(); +} + +void stepPhysics(bool /*interactive*/) +{ + if(!gScene) + return; + + if(gPause && !gOneFrame) + return; + gOneFrame = false; + + const float dt = 1.0f/60.0f; + const float invDt = 60.0f; + + { +#ifdef PRINT_TIMINGS + unsigned long long time = __rdtsc(); +#endif + gScene->updateArticulations(dt); +#ifdef PRINT_TIMINGS + time = __rdtsc() - time; + printf("updateArticulations: %d \n", time/1024); +#endif + } + { +#ifdef PRINT_TIMINGS + unsigned long long time = __rdtsc(); +#endif + gScene->updateBounds(); +#ifdef PRINT_TIMINGS + time = __rdtsc() - time; + printf("updateBounds: %d \n", time/1024); +#endif + } + { +#ifdef PRINT_TIMINGS + unsigned long long time = __rdtsc(); +#endif + gScene->broadPhase(); +#ifdef PRINT_TIMINGS + time = __rdtsc() - time; + printf("broadPhase: %d \n", time/1024); +#endif + } + { +#ifdef PRINT_TIMINGS + unsigned long long time = __rdtsc(); +#endif + gScene->narrowPhase(); +#ifdef PRINT_TIMINGS + time = __rdtsc() - time; + printf("narrowPhase: %d \n", time/1024); +#endif + } + { +#ifdef PRINT_TIMINGS + unsigned long long time = __rdtsc(); +#endif + gScene->buildSolverBodyData(dt); +#ifdef PRINT_TIMINGS + time = __rdtsc() - time; + printf("buildSolverBodyData: %d \n", time/1024); +#endif + } + { +#ifdef PRINT_TIMINGS + unsigned long long time = __rdtsc(); +#endif + gScene->buildSolverConstraintDesc(); +#ifdef PRINT_TIMINGS + time = __rdtsc() - time; + printf("buildSolverConstraintDesc: %d \n", time/1024); +#endif + } + { +#ifdef PRINT_TIMINGS + unsigned long long time = __rdtsc(); +#endif + gScene->createContactConstraints(dt, invDt, 1.f, gNbIterPos); +#ifdef PRINT_TIMINGS + time = __rdtsc() - time; + printf("createContactConstraints: %d \n", time/1024); +#endif + } + { +#ifdef PRINT_TIMINGS +// unsigned long long time = __rdtsc(); +#endif + gScene->solveAndIntegrate(dt); +#ifdef PRINT_TIMINGS +// time = __rdtsc() - time; +// printf("solveAndIntegrate: %d \n", time/1024); +#endif + } + + if(gScene->mMotorLink.articulation) + { + gTime += 0.1f; + const float target = sinf(gTime) * 4.0f; +// printf("target: %f\n", target); + + PxArticulationJointDataRC data; + bool status = PxGetJointData(gScene->mMotorLink, data); + PX_ASSERT(status); + + data.targetVel[PxArticulationAxis::eTWIST] = target; + + const PxVec3 boxExtents(0.5f, 0.1f, 0.5f); + const float s = boxExtents.x*1.1f + fabsf(sinf(gTime))*0.5f; + + data.parentPose = PxTransform(PxVec3(0.0f, 0.0f, s)); + data.childPose = PxTransform(PxVec3(0.0f, 0.0f, -s)); + + status = PxSetJointData(gScene->mMotorLink, data); + PX_ASSERT(status); + PX_UNUSED(status); + } + +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_DELETE(gScene); + PX_RELEASE(gFoundation); + + printf("SnippetImmediateArticulation done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& /*camera*/) +{ + if(key=='b' || key=='B') + gDrawBounds = !gDrawBounds; + + if(key=='p' || key=='P') + gPause = !gPause; + + if(key=='o' || key=='O') + { + gPause = true; + gOneFrame = true; + } + + if(gScene) + { + if(key>=1 && key<=7) + { + gSceneIndex = key-1; + gScene->reset(); + gScene->createScene(); + } + + if(key=='r' || key=='R') + { + gScene->reset(); + gScene->createScene(); + } + } +} + +void renderText() +{ +#ifdef RENDER_SNIPPET + Snippets::print("Press F1 to F7 to select a scene."); +#endif +} + +int snippetMain(int, const char*const*) +{ + printf("Immediate articulation snippet. Use these keys:\n"); + printf(" P - enable/disable pause\n"); + printf(" O - step simulation for one frame\n"); + printf(" R - reset scene\n"); + printf(" F1 to F6 - select scene\n"); + printf("\n"); +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetEye(); + PxVec3 camDir = sCamera->getDir(); + printf("camPos: (%ff, %ff, %ff)\n", camPos.x, camPos.y, camPos.z); + printf("camDir: (%ff, %ff, %ff)\n", camDir.x, camDir.y, camDir.z); + }*/ + + Snippets::startRender(sCamera); + + const PxVec3 color(0.6f, 0.8f, 1.0f); +// const PxVec3 color(0.75f, 0.75f, 1.0f); +// const PxVec3 color(1.0f); + + Snippets::renderGeoms(getNbGeoms(), getGeoms(), getGeomPoses(), true, color); + +/* PxU32 getNbGeoms(); + const PxGeometry* getGeoms(); + const PxTransform* getGeomPoses(); + Snippets::renderGeoms(getNbGeoms(), getGeoms(), getGeomPoses(), true, PxVec3(1.0f));*/ + +/* PxBoxGeometry boxGeoms[10]; + for(PxU32 i=0;i<10;i++) + boxGeoms[i].halfExtents = PxVec3(1.0f); + + PxTransform poses[10]; + for(PxU32 i=0;i<10;i++) + { + poses[i] = PxTransform(PxIdentity); + poses[i].p.y += 1.5f; + poses[i].p.x = float(i)*2.5f; + } + + Snippets::renderGeoms(10, boxGeoms, poses, true, PxVec3(1.0f));*/ + + if(1) + { + const PxU32 nbContacts = getNbContacts(); + const PxContactPoint* contacts = getContacts(); + for(PxU32 j=0;j +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" +#include "../snippetutils/SnippetImmUtils.h" +#include "foundation/PxArray.h" +#include "PxImmediateMode.h" +#include "extensions/PxMassProperties.h" +#include "../snippetcommon/SnippetPrint.h" +#include "extensions/PxRigidActorExt.h" + +#define USE_TGS 1 + +//Enables whether we want persistent state caching (contact cache, friction caching) or not. Avoiding persistency results in one-shot collision detection and zero friction +//correlation but simplifies code by not longer needing to cache persistent pairs. +#define WITH_PERSISTENCY 1 + +//Toggles between using low-level inertia computation code or using the RigidBodyExt inertia computation code. The former can operate without the need for PxRigidDynamics being constructed. +#define USE_LOWLEVEL_INERTIA_COMPUTATION 1 + +//Toggles whether we batch constraints or not. Constraint batching is an optional process which can improve performance by grouping together independent constraints. These independent constraints +//can be solved in parallel by using multiple lanes of SIMD registers. +#define BATCH_CONTACTS 1 + +// Toggles whether we use PhysX' "immediate broadphase", or not. If we don't, a simple O(n^2) broadphase is used. +#define USE_IMMEDIATE_BROADPHASE 1 + +// Toggles profiling for the full step. Only for Windows. +#define PROFILE_STEP 0 + +using namespace physx; +using namespace immediate; +using namespace SnippetImmUtils; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; + +static physx::PxArray* gConstraints = NULL; + +static PxReal gStackZ = 10.0f; + +//Enable to 1 to use centimeter units instead of meter units. +//Instructive to demonstrate which values used in immediate mode are unit-dependent +#define USE_CM_UNITS 0 + +#if !USE_CM_UNITS + static const PxReal gUnitScale = 1.0f; + //static float cameraSpeed = 1.0f; +#else + static const PxReal gUnitScale = 100.0f; + //static float cameraSpeed = 100.0f; +#endif + +#if USE_IMMEDIATE_BROADPHASE && WITH_PERSISTENCY + static PxU32 gFrameIndex = 0; +#endif + +#if WITH_PERSISTENCY + #if USE_IMMEDIATE_BROADPHASE + static PxAABBManager* gAABBManager = NULL; + + struct PersistentPair + { + PersistentPair() {} + PersistentPair(PxU32 id0, PxU32 id1) : mID0(id0), mID1(id1) {} + + PX_INLINE bool operator == (const PersistentPair& a) const + { + return a.mID0 == mID0 && a.mID1 == mID1; + } + + PxU32 mID0; + PxU32 mID1; + }; + + struct PersistentPairData + { + PxRigidActor* actor0; + PxRigidActor* actor1; + + PxCache cache; + PxU8* frictions; + PxU32 nbFrictions; + }; + + static PX_INLINE uint32_t PxComputeHash(const PersistentPair& p) + { + return PxComputeHash(uint64_t(p.mID0)|(uint64_t(p.mID1)<<32)); + } + + static PxHashMap* gPersistentPairs = NULL; + #else + namespace + { + struct PersistentContactPair + { + PxCache cache; + PxU8* frictions; + PxU32 nbFrictions; + }; + } + + static PxArray* allContactCache = NULL; + #endif +#endif + +static TestCacheAllocator* gCacheAllocator = NULL; +static TestConstraintAllocator* gConstraintAllocator = NULL; + +namespace +{ +struct ContactPair +{ + PxRigidActor* actor0; + PxRigidActor* actor1; + + PxU32 idx0, idx1; + + PxU32 startContactIndex; + PxU32 nbContacts; +}; + +class TestContactRecorder : public immediate::PxContactRecorder +{ + PxArray& mContactPairs; + PxArray& mContactPoints; + PxRigidActor& mActor0; + PxRigidActor& mActor1; + PxU32 mIdx0, mIdx1; + bool mHasContacts; +public: + + TestContactRecorder(PxArray& contactPairs, PxArray& contactPoints, PxRigidActor& actor0, + PxRigidActor& actor1, PxU32 idx0, PxU32 idx1) : mContactPairs(contactPairs), mContactPoints(contactPoints), + mActor0(actor0), mActor1(actor1), mIdx0(idx0), mIdx1(idx1), mHasContacts(false) + { + } + + virtual bool recordContacts(const PxContactPoint* contactPoints, PxU32 nbContacts, PxU32 index) + { + PX_UNUSED(index); + { + ContactPair pair; + pair.actor0 = &mActor0; + pair.actor1 = &mActor1; + pair.nbContacts = nbContacts; + pair.startContactIndex = mContactPoints.size(); + pair.idx0 = mIdx0; + pair.idx1 = mIdx1; + mContactPairs.pushBack(pair); + mHasContacts = true; + } + + for (PxU32 c = 0; c < nbContacts; ++c) + { + //Fill in solver-specific data that our contact gen does not produce... + PxContactPoint point = contactPoints[c]; + point.maxImpulse = PX_MAX_F32; + point.targetVel = PxVec3(0.0f); + point.staticFriction = 0.5f; + point.dynamicFriction = 0.5f; + point.restitution = 0.0f; + point.damping = 0.0f; + point.materialFlags = 0; + mContactPoints.pushBack(point); + } + return true; + } + + PX_FORCE_INLINE bool hasContacts() const { return mHasContacts; } +private: + PX_NOCOPY(TestContactRecorder) +}; +} + +static bool generateContacts( const PxGeometryHolder& geom0, const PxGeometryHolder& geom1, PxRigidActor& actor0, PxRigidActor& actor1, PxCacheAllocator& cacheAllocator, + PxArray& contactPoints, PxArray& contactPairs, PxU32 idx0, PxU32 idx1, PxCache& cache) +{ + const PxTransform tr0 = actor0.getGlobalPose(); + const PxTransform tr1 = actor1.getGlobalPose(); + + TestContactRecorder recorder(contactPairs, contactPoints, actor0, actor1, idx0, idx1); + + const PxGeometry* pxGeom0 = &geom0.any(); + const PxGeometry* pxGeom1 = &geom1.any(); + + physx::immediate::PxGenerateContacts(&pxGeom0, &pxGeom1, &tr0, &tr1, &cache, 1, recorder, gUnitScale*0.04f, gUnitScale*0.01f, gUnitScale, cacheAllocator); + + return recorder.hasContacts(); +} + +static PxRigidDynamic* createDynamic(const PxTransform& t, const PxGeometry& geometry, const PxVec3& velocity=PxVec3(0)) +{ + PxRigidDynamic* dynamic = PxCreateDynamic(*gPhysics, t, geometry, *gMaterial, 10.0f); + dynamic->setAngularDamping(0.5f); + dynamic->setLinearVelocity(velocity); + gScene->addActor(*dynamic); + return dynamic; +} + +static void updateInertia(PxRigidBody* body, PxReal density) +{ +#if !USE_LOWLEVEL_INERTIA_COMPUTATION + PX_UNUSED(density); + //Compute the inertia of the rigid body using the helper function in PxRigidBodyExt + PxRigidBodyExt::updateMassAndInertia(*body, 10.0f); +#else + //Compute the inertia/mass of the bodies using the more low-level PxMassProperties interface + //This was written for readability rather than performance. Complexity can be avoided if you know that you are dealing with a single shape body + + PxU32 nbShapes = body->getNbShapes(); + + //Keep track of an array of inertia tensors and local poses. + physx::PxArray inertias; + physx::PxArray localPoses; + + for (PxU32 a = 0; a < nbShapes; ++a) + { + PxShape* shape; + + body->getShapes(&shape, 1, a); + //(1) initialize an inertia tensor based on the shape's geometry + PxMassProperties inertia(shape->getGeometry()); + //(2) Scale the inertia tensor based on density. If you use a single density instead of a density per-shape, this could be performed just prior to + //extracting the massSpaceInertiaTensor + inertia = inertia * density; + + inertias.pushBack(inertia); + localPoses.pushBack(shape->getLocalPose()); + } + + //(3)Sum all the inertia tensors - can be skipped if the shape count is 1 + PxMassProperties inertia = PxMassProperties::sum(inertias.begin(), localPoses.begin(), inertias.size()); + //(4)Get the diagonalized inertia component and frame of the mass space orientation + PxQuat orient; + const PxVec3 diagInertia = PxMassProperties::getMassSpaceInertia(inertia.inertiaTensor, orient); + //(4) Set properties on the rigid body + body->setMass(inertia.mass); + body->setCMassLocalPose(PxTransform(inertia.centerOfMass, orient)); + body->setMassSpaceInertiaTensor(diagInertia); +#endif +} + +/*static*/ void createStack(const PxTransform& t, PxU32 size, PxReal halfExtent) +{ + PxShape* shape = gPhysics->createShape(PxBoxGeometry(halfExtent, halfExtent, halfExtent), *gMaterial); + for (PxU32 i = 0; icreateRigidDynamic(t.transform(localTm)); + body->attachShape(*shape); + + updateInertia(body, 10.f); + + gScene->addActor(*body); + } + } + shape->release(); +} + +struct Triangle +{ + PxU32 ind0, ind1, ind2; +}; + +static PxTriangleMesh* createMeshGround() +{ + const PxU32 gridSize = 8; + const PxReal gridStep = 512.f / (gridSize-1); + + PxVec3 verts[gridSize * gridSize]; + + const PxU32 nbTriangles = 2 * (gridSize - 1) * (gridSize-1); + + Triangle indices[nbTriangles]; + + for (PxU32 a = 0; a < gridSize; ++a) + { + for (PxU32 b = 0; b < gridSize; ++b) + { + verts[a * gridSize + b] = PxVec3(-400.f + b*gridStep, 0.f, -400.f + a*gridStep); + } + } + + for (PxU32 a = 0; a < (gridSize-1); ++a) + { + for (PxU32 b = 0; b < (gridSize-1); ++b) + { + Triangle& tri0 = indices[(a * (gridSize-1) + b) * 2]; + Triangle& tri1 = indices[((a * (gridSize-1) + b) * 2) + 1]; + + tri0.ind0 = a * gridSize + b + 1; + tri0.ind1 = a * gridSize + b; + tri0.ind2 = (a + 1) * gridSize + b + 1; + + tri1.ind0 = (a + 1) * gridSize + b + 1; + tri1.ind1 = a * gridSize + b; + tri1.ind2 = (a + 1) * gridSize + b; + } + } + + PxTriangleMeshDesc meshDesc; + meshDesc.points.data = verts; + meshDesc.points.count = gridSize * gridSize; + meshDesc.points.stride = sizeof(PxVec3); + meshDesc.triangles.count = nbTriangles; + meshDesc.triangles.data = indices; + meshDesc.triangles.stride = sizeof(Triangle); + + PxCookingParams cookingParams(gPhysics->getTolerancesScale()); + PxTriangleMesh* triMesh = PxCreateTriangleMesh(cookingParams, meshDesc, gPhysics->getPhysicsInsertionCallback()); + + return triMesh; +} + +#if WITH_PERSISTENCY && USE_IMMEDIATE_BROADPHASE +static void createBroadPhase() +{ + PxBroadPhaseDesc bpDesc(PxBroadPhaseType::eABP); + PxBroadPhase* bp = PxCreateBroadPhase(bpDesc); + gAABBManager = PxCreateAABBManager(*bp); + + gPersistentPairs = new PxHashMap; +} + +static void releaseBroadPhase() +{ + PxBroadPhase* bp = &gAABBManager->getBroadPhase(); + PX_RELEASE(gAABBManager); + PX_RELEASE(bp); + delete gPersistentPairs; +} +#endif + +static void updateContactPairs() +{ +#if WITH_PERSISTENCY + #if USE_IMMEDIATE_BROADPHASE + // In this simple snippet we just recreate the broadphase structure here + releaseBroadPhase(); + createBroadPhase(); + gFrameIndex = 0; + #else + allContactCache->clear(); + + const PxU32 nbDynamic = gScene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC); + const PxU32 nbStatic = gScene->getNbActors(PxActorTypeFlag::eRIGID_STATIC); + + const PxU32 totalPairs = (nbDynamic * (nbDynamic - 1)) / 2 + nbDynamic * nbStatic; + + allContactCache->resize(totalPairs); + + for (PxU32 a = 0; a < totalPairs; ++a) + { + (*allContactCache)[a].frictions = NULL; + (*allContactCache)[a].nbFrictions = 0; + (*allContactCache)[a].cache.mCachedData = 0; + (*allContactCache)[a].cache.mCachedSize = 0; + (*allContactCache)[a].cache.mManifoldFlags = 0; + (*allContactCache)[a].cache.mPairData = 0; + } + #endif +#endif +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport, PxPvdInstrumentationFlag::ePROFILE); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f)*gUnitScale; + gDispatcher = PxDefaultCpuDispatcherCreate(0); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + + gScene = gPhysics->createScene(sceneDesc); + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.2f); + + gConstraints = new physx::PxArray(); + + const bool useGroundMesh = true; // Use a triangle mesh or a plane for the ground + if(useGroundMesh) + { + PxTriangleMesh* mesh = createMeshGround(); + + PxTriangleMeshGeometry geom(mesh); + + PxRigidStatic* groundMesh = gPhysics->createRigidStatic(PxTransform(PxVec3(0, 2, 0))); + PxRigidActorExt::createExclusiveShape(*groundMesh, geom, *gMaterial); + gScene->addActor(*groundMesh); + } + else + { + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + } + + for (PxU32 i = 0; i<4; i++) + createStack(PxTransform(PxVec3(0, 2, gStackZ -= 10.0f*gUnitScale)), 20, gUnitScale); + + PxRigidDynamic* ball = createDynamic(PxTransform(PxVec3(0, 20, 100)*gUnitScale), PxSphereGeometry(2 * gUnitScale), PxVec3(0, -25, -100)*gUnitScale); + PxRigidDynamic* ball2 = createDynamic(PxTransform(PxVec3(0, 24, 100)*gUnitScale), PxSphereGeometry(2 * gUnitScale), PxVec3(0, -25, -100)*gUnitScale); + PxRigidDynamic* ball3 = createDynamic(PxTransform(PxVec3(0, 27, 100)*gUnitScale), PxSphereGeometry(2 * gUnitScale), PxVec3(0, -25, -100)*gUnitScale); + updateInertia(ball, 1000.f); + updateInertia(ball2, 1000.f); + + PxD6Joint* joint = PxD6JointCreate(*gPhysics, ball, PxTransform(PxVec3(0, 4, 0)*gUnitScale), ball2, PxTransform(PxVec3(0, -2, 0)*gUnitScale)); + PxD6Joint* joint2 = PxD6JointCreate(*gPhysics, ball2, PxTransform(PxVec3(0, 4, 0)*gUnitScale), ball3, PxTransform(PxVec3(0, -2, 0)*gUnitScale)); + + gConstraints->pushBack(joint->getConstraint()); + gConstraints->pushBack(joint2->getConstraint()); + + gCacheAllocator = new TestCacheAllocator; + gConstraintAllocator = new TestConstraintAllocator; +#if WITH_PERSISTENCY + #if USE_IMMEDIATE_BROADPHASE + createBroadPhase(); + #else + allContactCache = new PxArray; + #endif +#endif + + updateContactPairs(); +} + +void stepPhysics(bool /*interactive*/) +{ +#if PROFILE_STEP + PxU64 time = __rdtsc(); +#endif + gCacheAllocator->reset(); + gConstraintAllocator->release(); + + const PxU32 nbStatics = gScene->getNbActors(PxActorTypeFlag::eRIGID_STATIC); + const PxU32 nbDynamics = gScene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC); + + const PxU32 totalActors = nbDynamics + nbStatics; + + PxArray activeContactPairs; + PxArray contactPoints; + + activeContactPairs.reserve(4 * totalActors); + + PxArray actors(totalActors); + PxArray shapeBounds(totalActors+1); + PxArray mGeometries(totalActors); + +#if USE_TGS + PxArray bodies(totalActors); + PxArray bodyData(totalActors); + PxArray txInertia(totalActors); + PxArray globalPoses(totalActors); +#else + PxArray bodies(totalActors); + PxArray bodyData(totalActors); +#endif + +#if USE_IMMEDIATE_BROADPHASE && !WITH_PERSISTENCY + PxArray handles(totalActors); + PxArray groups(totalActors); + PxArray distances(totalActors); +#endif + + gScene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC, actors.begin(), nbDynamics); + + gScene->getActors(PxActorTypeFlag::eRIGID_STATIC, actors.begin() + nbDynamics, nbStatics); + +#if USE_IMMEDIATE_BROADPHASE && WITH_PERSISTENCY + gFrameIndex++; +#endif + + //Now do collision detection...Brute force every dynamic against every dynamic/static + for (PxU32 a = 0; a < totalActors; ++a) + { + PxRigidActor* actor = actors[a]->is(); + + PxShape* shape; + actor->getShapes(&shape, 1); + + //Compute the AABBs. We inflate these by 2cm margins + shapeBounds[a] = PxShapeExt::getWorldBounds(*shape, *actor, 1.f); + shapeBounds[a].minimum -= PxVec3(0.02f)*gUnitScale; + shapeBounds[a].maximum += PxVec3(0.02f)*gUnitScale; + + mGeometries[a].storeAny(shape->getGeometry()); + +#if USE_IMMEDIATE_BROADPHASE + #if WITH_PERSISTENCY + if(gFrameIndex==1) + { + const PxBpFilterGroup group = a < nbDynamics ? PxGetBroadPhaseDynamicFilterGroup(a) : PxGetBroadPhaseStaticFilterGroup(); + gAABBManager->addObject(a, shapeBounds[a], group); + } + else if(a < nbDynamics) + { + gAABBManager->updateObject(a, &shapeBounds[a]); + } + #else + handles[a] = a; + distances[a]= 0.0f; + if(a < nbDynamics) + groups[a] = PxGetBroadPhaseDynamicFilterGroup(a); + else + groups[a] = PxGetBroadPhaseStaticFilterGroup(); + #endif +#endif + } + +#if USE_IMMEDIATE_BROADPHASE + { + PxBroadPhaseResults results; + #if WITH_PERSISTENCY + gAABBManager->updateAndFetchResults(results); + + const PxU32 nbCreatedPairs = results.mNbCreatedPairs; + for(PxU32 i=0;iis(); + data.actor1 = actors[id1]->is(); + data.frictions = NULL; + data.nbFrictions = 0; + data.cache = PxCache(); + + bool b = gPersistentPairs->insert(currentPair, data); + PX_ASSERT(b); + PX_UNUSED(b); + } + + const PxU32 nbDeletedPairs = results.mNbDeletedPairs; + for(PxU32 i=0;i::Entry removedEntry; + bool b = gPersistentPairs->erase(currentPair, removedEntry); + PX_ASSERT(b); + PX_UNUSED(b); + } + #else + PxBroadPhaseDesc bpDesc(PxBroadPhaseType::eABP); + PxBroadPhase* bp = PxCreateBroadPhase(bpDesc); + + const PxBroadPhaseUpdateData updateData(handles.begin(), totalActors, NULL, 0, NULL, 0, shapeBounds.begin(), groups.begin(), distances.begin(), totalActors); + bp->update(results, updateData); + + const PxU32 nbPairs = results.mNbCreatedPairs; + for(PxU32 i=0;iis(); + pair.actor1 = actors[id1]->is(); + pair.idx0 = id0; + pair.idx1 = id1; + + activeContactPairs.pushBack(pair); + } + PX_RELEASE(bp); + #endif + } +#else + { + //Broad phase for active pairs... + for (PxU32 a = 0; a < nbDynamics; ++a) + { + PxRigidDynamic* dyn0 = actors[a]->is(); + for (PxU32 b = a + 1; b < totalActors; ++b) + { + PxRigidActor* actor1 = actors[b]->is(); + + if (shapeBounds[a].intersects(shapeBounds[b])) + { + ContactPair pair; + pair.actor0 = dyn0; + pair.actor1 = actor1; + pair.idx0 = a; + pair.idx1 = b; + + activeContactPairs.pushBack(pair); + } + #if WITH_PERSISTENCY + else + { + const PxU32 startIndex = a == 0 ? 0 : (a * totalActors) - (a * (a + 1)) / 2; + + PersistentContactPair& persistentData = (*allContactCache)[startIndex + (b - a - 1)]; + + //No collision detection performed at all so clear contact cache and friction data + persistentData.frictions = NULL; + persistentData.nbFrictions = 0; + persistentData.cache = PxCache(); + } + #endif + } + } + } +#endif + +#if USE_IMMEDIATE_BROADPHASE && WITH_PERSISTENCY + const PxU32 nbActivePairs = gPersistentPairs->size(); + activeContactPairs.forceSize_Unsafe(0); + contactPoints.reserve(4 * nbActivePairs); + + for(PxHashMap::Iterator iter = gPersistentPairs->getIterator(); !iter.done(); ++iter) + { + const PxU32 id0 = iter->first.mID0; + const PxU32 id1 = iter->first.mID1; + PxRigidActor* dyn0 = iter->second.actor0; + const PxGeometryHolder& holder0 = mGeometries[id0]; + + PxRigidActor* actor1 = iter->second.actor1; + const PxGeometryHolder& holder1 = mGeometries[id1]; + + if (!generateContacts(holder0, holder1, *dyn0, *actor1, *gCacheAllocator, contactPoints, activeContactPairs, id0, id1, iter->second.cache)) + { + //Contact generation run but no touches found so clear cached friction data + iter->second.frictions = NULL; + iter->second.nbFrictions = 0; + } + } +#else + const PxU32 nbActivePairs = activeContactPairs.size(); + ContactPair* activePairs = activeContactPairs.begin(); + + activeContactPairs.forceSize_Unsafe(0); + + contactPoints.reserve(4 * nbActivePairs); + + for (PxU32 a = 0; a < nbActivePairs; ++a) + { + const ContactPair& pair = activePairs[a]; + + PxRigidActor* dyn0 = pair.actor0; + const PxGeometryHolder& holder0 = mGeometries[pair.idx0]; + + PxRigidActor* actor1 = pair.actor1; + const PxGeometryHolder& holder1 = mGeometries[pair.idx1]; + + #if WITH_PERSISTENCY + const PxU32 startIndex = pair.idx0 == 0 ? 0 : (pair.idx0 * totalActors) - (pair.idx0 * (pair.idx0 + 1)) / 2; + + PersistentContactPair& persistentData = (*allContactCache)[startIndex + (pair.idx1 - pair.idx0 - 1)]; + + if (!generateContacts(holder0, holder1, *dyn0, *actor1, *gCacheAllocator, contactPoints, activeContactPairs, pair.idx0, pair.idx1, persistentData.cache)) + { + //Contact generation run but no touches found so clear cached friction data + persistentData.frictions = NULL; + persistentData.nbFrictions = 0; + } + #else + PxCache cache; + generateContacts(holder0, holder1, *dyn0, *actor1, *gCacheAllocator, contactPoints, activeContactPairs, pair.idx0, pair.idx1, cache); + #endif + } +#endif + + const PxReal dt = 1.f / 60.f; + const PxReal invDt = 60.f; + + const PxU32 nbPositionIterations = 4; + const PxU32 nbVelocityIterations = 1; + +#if USE_TGS + const PxReal stepDt = dt/PxReal(nbPositionIterations); + const PxReal invStepDt = invDt * PxReal(nbPositionIterations); +#endif + + const PxVec3 gravity(0.f, -9.8f* gUnitScale, 0.f); + + //Construct solver bodies + for (PxU32 a = 0; a < nbDynamics; ++a) + { + PxRigidDynamic* dyn = actors[a]->is(); + + immediate::PxRigidBodyData data; + data.linearVelocity = dyn->getLinearVelocity(); + data.angularVelocity = dyn->getAngularVelocity(); + data.invMass = dyn->getInvMass(); + data.invInertia = dyn->getMassSpaceInvInertiaTensor(); + data.body2World = dyn->getGlobalPose(); + data.maxDepenetrationVelocity = dyn->getMaxDepenetrationVelocity(); + data.maxContactImpulse = dyn->getMaxContactImpulse(); + data.linearDamping = dyn->getLinearDamping(); + data.angularDamping = dyn->getAngularDamping(); + data.maxLinearVelocitySq = 100.f*100.f*gUnitScale*gUnitScale; + data.maxAngularVelocitySq = 7.f*7.f; + +#if USE_TGS + physx::immediate::PxConstructSolverBodiesTGS(&data, &bodies[a], &txInertia[a], &bodyData[a], 1, gravity, dt); + globalPoses[a] = data.body2World; +#else + physx::immediate::PxConstructSolverBodies(&data, &bodyData[a], 1, gravity, dt); +#endif + dyn->userData = reinterpret_cast(size_t(a)); + } + + //Construct static bodies + for (PxU32 a = nbDynamics; a < totalActors; ++a) + { + PxRigidStatic* sta = actors[a]->is(); +#if USE_TGS + physx::immediate::PxConstructStaticSolverBodyTGS(sta->getGlobalPose(), bodies[a], txInertia[a], bodyData[a]); + globalPoses[a] = sta->getGlobalPose(); +#else + physx::immediate::PxConstructStaticSolverBody(sta->getGlobalPose(), bodyData[a]); +#endif + sta->userData = reinterpret_cast(size_t(a)); + } + + PxArray descs(activeContactPairs.size() + gConstraints->size()); + + for (PxU32 a = 0; a < activeContactPairs.size(); ++a) + { + PxSolverConstraintDesc& desc = descs[a]; + ContactPair& pair = activeContactPairs[a]; + + //Set body pointers and bodyData idxs +#if USE_TGS + desc.tgsBodyA = &bodies[pair.idx0]; + desc.tgsBodyB = &bodies[pair.idx1]; +#else + desc.bodyA = &bodies[pair.idx0]; + desc.bodyB = &bodies[pair.idx1]; +#endif + + desc.bodyADataIndex = pair.idx0; + desc.bodyBDataIndex = pair.idx1; + desc.linkIndexA = PxSolverConstraintDesc::RIGID_BODY; + desc.linkIndexB = PxSolverConstraintDesc::RIGID_BODY; + + //Cache pointer to our contact data structure and identify which type of constraint this is. We'll need this later after batching. + //We store our pointer in the desc.constraint field as this field is ignored by PxBatchConstraints. It will later be overwritten by PxCreateContactConstraints. + //If we choose not to perform batching and instead just create a single header per-pair, then this would not be necessary because + //the constraintDescs would not have been reordered + desc.constraint = reinterpret_cast(&pair); + desc.constraintType = PxSolverConstraintDesc::eCONTACT_CONSTRAINT; + } + + for (PxU32 a = 0; a < gConstraints->size(); ++a) + { + PxConstraint* constraint = (*gConstraints)[a]; + + PxSolverConstraintDesc& desc = descs[activeContactPairs.size() + a]; + + PxRigidActor* actor0, *actor1; + constraint->getActors(actor0, actor1); + + const PxU32 id0 = PxU32(size_t(actor0->userData)); + const PxU32 id1 = PxU32(size_t(actor1->userData)); + +#if USE_TGS + desc.tgsBodyA = &bodies[id0]; + desc.tgsBodyB = &bodies[id1]; +#else + desc.bodyA = &bodies[id0]; + desc.bodyB = &bodies[id1]; +#endif + + desc.bodyADataIndex = PxU16(id0); + desc.bodyBDataIndex = PxU16(id1); + desc.linkIndexA = PxSolverConstraintDesc::RIGID_BODY; + desc.linkIndexB = PxSolverConstraintDesc::RIGID_BODY; + + desc.constraint = reinterpret_cast(constraint); + desc.constraintType = PxSolverConstraintDesc::eJOINT_CONSTRAINT; + } + + PxArray headers(descs.size()); + PxArray contactForces(contactPoints.size()); + + //Technically, you can batch the contacts and joints all at once using a single call but doing so mixes them in the orderedDescs array, which means that it is impossible to + //batch all contact or all joint dispatches into a single call. While we don't do this in this snippet (we instead process a single header at a time), our approach could be extended to + //dispatch all contact headers at once if that was necessary. + +#if BATCH_CONTACTS + PxArray tempOrderedDescs(descs.size()); + physx::PxArray& orderedDescs = tempOrderedDescs; + #if USE_TGS + //1 batch the contacts + const PxU32 nbContactHeaders = physx::immediate::PxBatchConstraintsTGS(descs.begin(), activeContactPairs.size(), bodies.begin(), nbDynamics, headers.begin(), orderedDescs.begin()); + + //2 batch the joints... + const PxU32 nbJointHeaders = physx::immediate::PxBatchConstraintsTGS(descs.begin() + activeContactPairs.size(), gConstraints->size(), bodies.begin(), nbDynamics, headers.begin() + nbContactHeaders, orderedDescs.begin() + activeContactPairs.size()); + #else + //1 batch the contacts + const PxU32 nbContactHeaders = physx::immediate::PxBatchConstraints(descs.begin(), activeContactPairs.size(), bodies.begin(), nbDynamics, headers.begin(), orderedDescs.begin()); + + //2 batch the joints... + const PxU32 nbJointHeaders = physx::immediate::PxBatchConstraints(descs.begin() + activeContactPairs.size(), gConstraints->size(), bodies.begin(), nbDynamics, headers.begin() + nbContactHeaders, orderedDescs.begin() + activeContactPairs.size()); + #endif +#else + physx::PxArray& orderedDescs = descs; + + //We are bypassing the constraint batching so we create dummy PxConstraintBatchHeaders + const PxU32 nbContactHeaders = activeContactPairs.size(); + const PxU32 nbJointHeaders = gConstraints->size(); + + for (PxU32 i = 0; i < nbContactHeaders; ++i) + { + PxConstraintBatchHeader& hdr = headers[i]; + hdr.startIndex = i; + hdr.stride = 1; + hdr.constraintType = PxSolverConstraintDesc::eCONTACT_CONSTRAINT; + } + + for (PxU32 i = 0; i < nbJointHeaders; ++i) + { + PxConstraintBatchHeader& hdr = headers[nbContactHeaders+i]; + hdr.startIndex = i; + hdr.stride = 1; + hdr.constraintType = PxSolverConstraintDesc::eJOINT_CONSTRAINT; + } +#endif + + const PxU32 totalHeaders = nbContactHeaders + nbJointHeaders; + + headers.forceSize_Unsafe(totalHeaders); + + //1 - Create all the contact constraints. We do this by looping over all the headers and, for each header, constructing the PxSolverContactDesc objects, then creating that contact constraint. + //We could alternatively create all the PxSolverContactDesc objects in a single pass, then create batch create that constraint + for (PxU32 i = 0; i < nbContactHeaders; ++i) + { + PxConstraintBatchHeader& header = headers[i]; + + PX_ASSERT(header.constraintType == PxSolverConstraintDesc::eCONTACT_CONSTRAINT); +#if USE_TGS + PxTGSSolverContactDesc contactDescs[4]; +#else + PxSolverContactDesc contactDescs[4]; +#endif + +#if WITH_PERSISTENCY + const ContactPair* pairs[4]; +#endif + for (PxU32 a = 0; a < header.stride; ++a) + { + PxSolverConstraintDesc& constraintDesc = orderedDescs[header.startIndex + a]; +#if USE_TGS + PxTGSSolverContactDesc& contactDesc = contactDescs[a]; +#else + PxSolverContactDesc& contactDesc = contactDescs[a]; +#endif + PxMemZero(&contactDesc, sizeof(contactDesc)); + //Extract the contact pair that we saved in this structure earlier. + const ContactPair& pair = *reinterpret_cast(constraintDesc.constraint); + +#if WITH_PERSISTENCY + pairs[a] = &pair; +#endif +#if USE_TGS + contactDesc.body0 = constraintDesc.tgsBodyA; + contactDesc.body1 = constraintDesc.tgsBodyB; + contactDesc.bodyData0 = &bodyData[constraintDesc.bodyADataIndex]; + contactDesc.bodyData1 = &bodyData[constraintDesc.bodyBDataIndex]; + contactDesc.body0TxI = &txInertia[constraintDesc.bodyADataIndex]; + contactDesc.body1TxI = &txInertia[constraintDesc.bodyBDataIndex]; + + //This may seem redundant but the bodyFrame is not defined by the bodyData object when using articulations. This + //example does not use articulations. + contactDesc.bodyFrame0 = globalPoses[constraintDesc.bodyADataIndex]; + contactDesc.bodyFrame1 = globalPoses[constraintDesc.bodyBDataIndex]; +#else + contactDesc.body0 = constraintDesc.bodyA; + contactDesc.body1 = constraintDesc.bodyB; + contactDesc.data0 = &bodyData[constraintDesc.bodyADataIndex]; + contactDesc.data1 = &bodyData[constraintDesc.bodyBDataIndex]; + + //This may seem redundant but the bodyFrame is not defined by the bodyData object when using articulations. This + //example does not use articulations. + contactDesc.bodyFrame0 = contactDesc.data0->body2World; + contactDesc.bodyFrame1 = contactDesc.data1->body2World; +#endif + contactDesc.contactForces = &contactForces[pair.startContactIndex]; + contactDesc.contacts = &contactPoints[pair.startContactIndex]; + contactDesc.numContacts = pair.nbContacts; + +#if WITH_PERSISTENCY + #if USE_IMMEDIATE_BROADPHASE + const PersistentPair currentPair(pair.idx0, pair.idx1); + const PxHashMap::Entry* e = gPersistentPairs->find(currentPair); + contactDesc.frictionPtr = e->second.frictions; + contactDesc.frictionCount = PxU8(e->second.nbFrictions); + #else + const PxU32 startIndex = pair.idx0 == 0 ? 0 : (pair.idx0 * totalActors) - (pair.idx0 * (pair.idx0 + 1)) / 2; + contactDesc.frictionPtr = (*allContactCache)[startIndex + (pair.idx1 - pair.idx0 - 1)].frictions; + contactDesc.frictionCount = PxU8((*allContactCache)[startIndex + (pair.idx1 - pair.idx0 - 1)].nbFrictions); + #endif +#else + contactDesc.frictionPtr = NULL; + contactDesc.frictionCount = 0; +#endif + contactDesc.shapeInteraction = NULL; + contactDesc.maxCCDSeparation = PX_MAX_F32; + + contactDesc.bodyState0 = PxSolverConstraintPrepDescBase::eDYNAMIC_BODY; + contactDesc.bodyState1 = pair.actor1->is() ? PxSolverConstraintPrepDescBase::eDYNAMIC_BODY : PxSolverConstraintPrepDescBase::eSTATIC_BODY; + contactDesc.desc = &constraintDesc; + contactDesc.invMassScales.angular0 = contactDesc.invMassScales.angular1 = contactDesc.invMassScales.linear0 = contactDesc.invMassScales.linear1 = 1.f; + } + +#if USE_TGS + immediate::PxCreateContactConstraintsTGS(&header, 1, contactDescs, *gConstraintAllocator, invStepDt, invDt, -2.f * gUnitScale, 0.04f * gUnitScale, 0.025f * gUnitScale); +#else + immediate::PxCreateContactConstraints(&header, 1, contactDescs, *gConstraintAllocator, invDt, -2.f * gUnitScale, 0.04f * gUnitScale, 0.025f * gUnitScale); +#endif + +#if WITH_PERSISTENCY + for (PxU32 a = 0; a < header.stride; ++a) + { + //Cache friction information... + #if USE_TGS + PxTGSSolverContactDesc& contactDesc = contactDescs[a]; + #else + PxSolverContactDesc& contactDesc = contactDescs[a]; + #endif + //PxSolverConstraintDesc& constraintDesc = orderedDescs[header.startIndex + a]; + const ContactPair& pair = *pairs[a]; + + #if USE_IMMEDIATE_BROADPHASE + const PersistentPair currentPair(pair.idx0, pair.idx1); + PxHashMap::Entry* e = const_cast::Entry*>(gPersistentPairs->find(currentPair)); + e->second.frictions = contactDesc.frictionPtr; + e->second.nbFrictions = contactDesc.frictionCount; + #else + const PxU32 startIndex = pair.idx0 == 0 ? 0 : (pair.idx0 * totalActors) - (pair.idx0 * (pair.idx0 + 1)) / 2; + (*allContactCache)[startIndex + (pair.idx1 - pair.idx0 - 1)].frictions = contactDesc.frictionPtr; + (*allContactCache)[startIndex + (pair.idx1 - pair.idx0 - 1)].nbFrictions = contactDesc.frictionCount; + #endif + } +#endif + } + + for (PxU32 i = nbContactHeaders; i < totalHeaders; ++i) + { + PxConstraintBatchHeader& header = headers[i]; + + PX_ASSERT(header.constraintType == PxSolverConstraintDesc::eJOINT_CONSTRAINT); + + { +#if USE_TGS + PxTGSSolverConstraintPrepDesc jointDescs[4]; +#else + PxSolverConstraintPrepDesc jointDescs[4]; +#endif + PxConstraint* constraints[4]; + + header.startIndex += activeContactPairs.size(); + + for (PxU32 a = 0; a < header.stride; ++a) + { + PxSolverConstraintDesc& constraintDesc = orderedDescs[header.startIndex + a]; + //Extract the contact pair that we saved in this structure earlier. + PxConstraint& constraint = *reinterpret_cast(constraintDesc.constraint); + + constraints[a] = &constraint; +#if USE_TGS + PxTGSSolverConstraintPrepDesc& jointDesc = jointDescs[a]; + jointDesc.body0 = constraintDesc.tgsBodyA; + jointDesc.body1 = constraintDesc.tgsBodyB; + jointDesc.bodyData0 = &bodyData[constraintDesc.bodyADataIndex]; + jointDesc.bodyData1 = &bodyData[constraintDesc.bodyBDataIndex]; + jointDesc.body0TxI = &txInertia[constraintDesc.bodyADataIndex]; + jointDesc.body1TxI = &txInertia[constraintDesc.bodyBDataIndex]; + + //This may seem redundant but the bodyFrame is not defined by the bodyData object when using articulations. This + //example does not use articulations. + jointDesc.bodyFrame0 = globalPoses[constraintDesc.bodyADataIndex]; + jointDesc.bodyFrame1 = globalPoses[constraintDesc.bodyBDataIndex]; +#else + PxSolverConstraintPrepDesc& jointDesc = jointDescs[a]; + jointDesc.body0 = constraintDesc.bodyA; + jointDesc.body1 = constraintDesc.bodyB; + jointDesc.data0 = &bodyData[constraintDesc.bodyADataIndex]; + jointDesc.data1 = &bodyData[constraintDesc.bodyBDataIndex]; + + //This may seem redundant but the bodyFrame is not defined by the bodyData object when using articulations. This + //example does not use articulations. + jointDesc.bodyFrame0 = jointDesc.data0->body2World; + jointDesc.bodyFrame1 = jointDesc.data1->body2World; +#endif + PxRigidActor* actor0, *actor1; + + constraint.getActors(actor0, actor1); + + jointDesc.bodyState0 = PxSolverConstraintPrepDescBase::eDYNAMIC_BODY; + jointDesc.bodyState1 = actor1 == NULL ? PxSolverConstraintPrepDescBase::eSTATIC_BODY : actor1->is() ? PxSolverConstraintPrepDescBase::eDYNAMIC_BODY : PxSolverConstraintPrepDescBase::eSTATIC_BODY; + jointDesc.desc = &constraintDesc; + jointDesc.invMassScales.angular0 = jointDesc.invMassScales.angular1 = jointDesc.invMassScales.linear0 = jointDesc.invMassScales.linear1 = 1.f; + jointDesc.writeback = NULL; + constraint.getBreakForce(jointDesc.linBreakForce, jointDesc.angBreakForce); + jointDesc.minResponseThreshold = constraint.getMinResponseThreshold(); + jointDesc.disablePreprocessing = !!(constraint.getFlags() & PxConstraintFlag::eDISABLE_PREPROCESSING); + jointDesc.improvedSlerp = !!(constraint.getFlags() & PxConstraintFlag::eIMPROVED_SLERP); + jointDesc.driveLimitsAreForces = !!(constraint.getFlags() & PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES); + } + +#if USE_TGS + immediate::PxCreateJointConstraintsWithShadersTGS(&header, 1, constraints, jointDescs, *gConstraintAllocator, stepDt, dt, invStepDt, invDt, 1.f); +#else + immediate::PxCreateJointConstraintsWithShaders(&header, 1, constraints, jointDescs, *gConstraintAllocator, dt, invDt); +#endif + } + } + +#if USE_TGS + immediate::PxSolveConstraintsTGS(headers.begin(), headers.size(), orderedDescs.begin(), bodies.begin(), txInertia.begin(), nbDynamics, nbPositionIterations, nbVelocityIterations, stepDt, invStepDt); + + immediate::PxIntegrateSolverBodiesTGS(bodies.begin(), txInertia.begin(), globalPoses.begin(), nbDynamics, dt); + + for (PxU32 a = 0; a < nbDynamics; ++a) + { + PxRigidDynamic* dynamic = actors[a]->is(); + + const PxTGSSolverBodyVel& body = bodies[a]; + + dynamic->setLinearVelocity(body.linearVelocity); + dynamic->setAngularVelocity(body.angularVelocity); + dynamic->setGlobalPose(globalPoses[a]); + } +#else + //Solve all the constraints produced earlier. Intermediate motion linear/angular velocity buffers are filled in. These contain intermediate delta velocity information that is used + //the PxIntegrateSolverBody + PxArray motionLinearVelocity(nbDynamics); + PxArray motionAngularVelocity(nbDynamics); + + //Zero the bodies array. This buffer contains the delta velocities and are accumulated during the simulation. For correct behavior, it is vital + //that this buffer is zeroed. + PxMemZero(bodies.begin(), bodies.size() * sizeof(PxSolverBody)); + + immediate::PxSolveConstraints(headers.begin(), headers.size(), orderedDescs.begin(), bodies.begin(), motionLinearVelocity.begin(), motionAngularVelocity.begin(), nbDynamics, nbPositionIterations, nbVelocityIterations); + + immediate::PxIntegrateSolverBodies(bodyData.begin(), bodies.begin(), motionLinearVelocity.begin(), motionAngularVelocity.begin(), nbDynamics, dt); + + for (PxU32 a = 0; a < nbDynamics; ++a) + { + PxRigidDynamic* dynamic = actors[a]->is(); + + const PxSolverBodyData& data = bodyData[a]; + + dynamic->setLinearVelocity(data.linearVelocity); + dynamic->setAngularVelocity(data.angularVelocity); + dynamic->setGlobalPose(data.body2World); + } +#endif + +#if PROFILE_STEP + time = __rdtsc() - time; + printf("Time: %d\n", PxU32(time/1024)); +#endif +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + + delete gCacheAllocator; + delete gConstraintAllocator; + +#if WITH_PERSISTENCY + #if USE_IMMEDIATE_BROADPHASE + releaseBroadPhase(); + #else + delete allContactCache; + #endif +#endif + + PX_RELEASE(gFoundation); + + printf("SnippetImmediateMode done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& camera) +{ + switch(toupper(key)) + { + case ' ': createDynamic(camera, PxSphereGeometry(3.0f*gUnitScale), camera.rotate(PxVec3(0, 0, -1)) * 200*gUnitScale); updateContactPairs(); break; + } +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], PxU32(actors.size()), true, dynColor); + } + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + cleanupPhysics(true); +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(50.0f, 50.0f, 50.0f), PxVec3(-0.6f,-0.2f,-0.7f)); + + Snippets::setupDefault("PhysX Snippet Immediate Mode", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetisosurface/SnippetIsosurface.cpp b/engine/third_party/physx/snippets/snippetisosurface/SnippetIsosurface.cpp new file mode 100644 index 00000000..327f5fab --- /dev/null +++ b/engine/third_party/physx/snippets/snippetisosurface/SnippetIsosurface.cpp @@ -0,0 +1,521 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet illustrates isosurface extraction from particle-based fluid +// simulation. The fluid simulation is performed using position-based dynamics. +// +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" + +#include "extensions/PxParticleExt.h" +#include "extensions/PxCudaHelpersExt.h" +#include "PxIsosurfaceExtraction.h" +#include "PxAnisotropy.h" +#include "PxSmoothing.h" + +#include "gpu/PxGpu.h" +#include "gpu/PxPhysicsGpu.h" +#include "PxArrayConverter.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxCudaContextManager* gCudaContextManager = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +static PxPBDParticleSystem* gParticleSystem = NULL; +static PxParticleBuffer* gParticleBuffer = NULL; +static bool gIsRunning = true; + + +PxRigidDynamic* movingWall; + +using namespace ExtGpu; + +PxArray gIsosurfaceVertices; +PxArray gIsosurfaceIndices; +PxArray gIsosurfaceNormals; +PxIsosurfaceExtractor* gIsosurfaceExtractor; +void* gVerticesGpu; +void* gNormalsGpu; +void* gInterleavedVerticesAndNormalsGpu; + +class IsosurfaceCallback : public PxParticleSystemCallback +{ +public: + PxIsosurfaceExtractor* mIsosurfaceExtractor; + PxAnisotropyGenerator* mAnisotropyGenerator; + PxSmoothedPositionGenerator* mSmoothedPositionGenerator; + PxArrayConverter* mArrayConverter; + PxVec4* mSmoothedPositionsDeviceBuffer; + + PxVec4* mAnisotropyDeviceBuffer1; + PxVec4* mAnisotropyDeviceBuffer2; + PxVec4* mAnisotropyDeviceBuffer3; + + PxU32 mMaxVertices; + PxCudaContextManager* mCudaContextManager; + + IsosurfaceCallback() : mIsosurfaceExtractor(NULL), mAnisotropyGenerator(NULL) { } + + void initialize(PxCudaContextManager* cudaContextManager, + const PxSparseGridParams& sparseGridParams, PxIsosurfaceParams& p, + PxU32 maxNumVertices, PxU32 maxNumTriangles, PxU32 maxNumParticles) + { + mCudaContextManager = cudaContextManager; + if (mCudaContextManager == NULL) + { + mMaxVertices = 0; + return; + } + mMaxVertices = maxNumVertices; + /*ExtGpu::PxIsosurfaceParams p; + p.isosurfaceValue = threshold; + p.clearFilteringPasses();*/ + + PxPhysicsGpu* pxGpu = PxGetPhysicsGpu(); + + mSmoothedPositionGenerator = pxGpu->createSmoothedPositionGenerator(cudaContextManager, maxNumParticles, 0.5f); + mSmoothedPositionsDeviceBuffer = PX_EXT_DEVICE_MEMORY_ALLOC(PxVec4, *cudaContextManager, maxNumParticles); + mSmoothedPositionGenerator->setResultBufferDevice(mSmoothedPositionsDeviceBuffer); + + //Too small minAnisotropy values will shrink particles to ellipsoids that are smaller than a isosurface grid cell which can lead to unpleasant aliasing/flickering + PxReal minAnisotropy = 1.0f;// 0.5f; // 0.1f; + PxReal anisotropyScale = 5.0f; + mAnisotropyGenerator = pxGpu->createAnisotropyGenerator(cudaContextManager, maxNumParticles, anisotropyScale, minAnisotropy, 2.0f); + mAnisotropyDeviceBuffer1 = PX_EXT_DEVICE_MEMORY_ALLOC(PxVec4, *cudaContextManager, maxNumParticles); + mAnisotropyDeviceBuffer2 = PX_EXT_DEVICE_MEMORY_ALLOC(PxVec4, *cudaContextManager, maxNumParticles); + mAnisotropyDeviceBuffer3 = PX_EXT_DEVICE_MEMORY_ALLOC(PxVec4, *cudaContextManager, maxNumParticles); + mAnisotropyGenerator->setResultBufferDevice(mAnisotropyDeviceBuffer1, mAnisotropyDeviceBuffer2, mAnisotropyDeviceBuffer3); + + gIsosurfaceVertices.resize(maxNumVertices); + gIsosurfaceNormals.resize(maxNumVertices); + gIsosurfaceIndices.resize(3 * maxNumTriangles); + + mIsosurfaceExtractor = pxGpu->createSparseGridIsosurfaceExtractor(cudaContextManager, sparseGridParams, p, maxNumParticles, maxNumVertices, maxNumTriangles); + + gIsosurfaceExtractor = mIsosurfaceExtractor; + mArrayConverter = pxGpu->createArrayConverter(cudaContextManager); + } + + virtual void onPostSolve(const PxGpuMirroredPointer& gpuParticleSystem, CUstream stream) + { +#if RENDER_SNIPPET + PxGpuParticleSystem& p = *gpuParticleSystem.mHostPtr; + + if (mAnisotropyGenerator) + { + mAnisotropyGenerator->generateAnisotropy(gpuParticleSystem.mDevicePtr, p.mCommonData.mMaxParticles, stream); + } + + mSmoothedPositionGenerator->generateSmoothedPositions(gpuParticleSystem.mDevicePtr, p.mCommonData.mMaxParticles, stream); + + mIsosurfaceExtractor->extractIsosurface(mSmoothedPositionsDeviceBuffer/*reinterpret_cast(p.mUnsortedPositions_InvMass)*/, p.mCommonData.mNumParticles, stream, p.mUnsortedPhaseArray, PxParticlePhaseFlag::eParticlePhaseFluid, + NULL, mAnisotropyDeviceBuffer1, mAnisotropyDeviceBuffer2, mAnisotropyDeviceBuffer3, p.mCommonData.mParticleContactDistance); + + if (gInterleavedVerticesAndNormalsGpu) + { + //Bring the data into a form that is better suited for rendering + mArrayConverter->interleaveGpuBuffers(static_cast(gVerticesGpu), static_cast(gNormalsGpu), mMaxVertices, static_cast(gInterleavedVerticesAndNormalsGpu), stream); + } +#else + PX_UNUSED(gpuParticleSystem); + PX_UNUSED(stream); +#endif + } + + virtual void onBegin(const PxGpuMirroredPointer& /*gpuParticleSystem*/, CUstream /*stream*/) { } + + virtual void onAdvance(const PxGpuMirroredPointer& /*gpuParticleSystem*/, CUstream /*stream*/) { } + + virtual ~IsosurfaceCallback() { } + + void release() + { + gIsosurfaceVertices.reset(); + gIsosurfaceIndices.reset(); + gIsosurfaceNormals.reset(); + + if (mIsosurfaceExtractor) + { + mIsosurfaceExtractor->release(); + PX_DELETE(mIsosurfaceExtractor); + } + + PX_DELETE(mArrayConverter); + + if (mAnisotropyGenerator) + { + mAnisotropyGenerator->release(); + PX_EXT_DEVICE_MEMORY_FREE(*mCudaContextManager, mAnisotropyDeviceBuffer1); + PX_EXT_DEVICE_MEMORY_FREE(*mCudaContextManager, mAnisotropyDeviceBuffer2); + PX_EXT_DEVICE_MEMORY_FREE(*mCudaContextManager, mAnisotropyDeviceBuffer3); + } + if (mSmoothedPositionGenerator) + { + mSmoothedPositionGenerator->release(); + PX_EXT_DEVICE_MEMORY_FREE(*mCudaContextManager, mSmoothedPositionsDeviceBuffer); + } + } +}; + +static IsosurfaceCallback gIsosuraceCallback; + +// ----------------------------------------------------------------------------------------------------------------- +static void initScene() +{ + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(2); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + sceneDesc.cudaContextManager = gCudaContextManager; + sceneDesc.staticStructure = PxPruningStructureType::eDYNAMIC_AABB_TREE; + sceneDesc.flags |= PxSceneFlag::eENABLE_PCM; + sceneDesc.flags |= PxSceneFlag::eENABLE_GPU_DYNAMICS; + sceneDesc.flags |= PxSceneFlag::eENABLE_EXTERNAL_FORCES_EVERY_ITERATION_TGS; + sceneDesc.broadPhaseType = PxBroadPhaseType::eGPU; + sceneDesc.solverType = PxSolverType::eTGS; + gScene = gPhysics->createScene(sceneDesc); +} + +// ----------------------------------------------------------------------------------------------------------------- +static PxReal initParticles(const PxU32 numX, const PxU32 numY, const PxU32 numZ, const PxVec3& position = PxVec3(0, 0, 0), const PxReal particleSpacing = 0.2f, const PxReal fluidDensity = 1000.f) +{ + PxCudaContextManager* cudaContextManager = gScene->getCudaContextManager(); + if (cudaContextManager == NULL) + return 0.0f; + + const PxU32 maxParticles = numX * numY * numZ; + + const PxReal fluidRestOffset = 0.5f * particleSpacing; + + // Material setup + PxPBDMaterial* defaultMat = gPhysics->createPBDMaterial(0.05f, 0.05f, 0.f, 0.001f, 0.5f, 0.005f, 0.01f, 0.f, 0.f, 0.5f); + + PxPBDParticleSystem *particleSystem = gPhysics->createPBDParticleSystem(*cudaContextManager, 96); + gParticleSystem = particleSystem; + + bool highCohesion = false; + if (highCohesion) + { + defaultMat->setViscosity(50.0f); + defaultMat->setSurfaceTension(0.f); + defaultMat->setCohesion(100.0f); + particleSystem->setSolverIterationCounts(20, 0); + } + else + { + defaultMat->setViscosity(0.001f); + defaultMat->setSurfaceTension(0.00704f); + defaultMat->setCohesion(0.704f); + defaultMat->setVorticityConfinement(10.f); + } + + // General particle system setting + + const PxReal restOffset = fluidRestOffset / 0.6f; + const PxReal solidRestOffset = restOffset; + const PxReal particleMass = fluidDensity * 1.333f * 3.14159f * particleSpacing * particleSpacing * particleSpacing; + particleSystem->setRestOffset(restOffset); + particleSystem->setContactOffset(restOffset + 0.01f); + particleSystem->setParticleContactOffset(fluidRestOffset / 0.6f); + particleSystem->setSolidRestOffset(solidRestOffset); + particleSystem->setFluidRestOffset(fluidRestOffset); + particleSystem->setParticleFlag(PxParticleFlag::eENABLE_SPECULATIVE_CCD, true); + particleSystem->setMaxVelocity(100.f); + + gScene->addActor(*particleSystem); + + + // Create particles and add them to the particle system + const PxU32 particlePhase = particleSystem->createPhase(defaultMat, PxParticlePhaseFlags(PxParticlePhaseFlag::eParticlePhaseFluid | PxParticlePhaseFlag::eParticlePhaseSelfCollide)); + + PxU32* phase = PX_EXT_PINNED_MEMORY_ALLOC(PxU32, *cudaContextManager, maxParticles); + PxVec4* positionInvMass = PX_EXT_PINNED_MEMORY_ALLOC(PxVec4, *cudaContextManager, maxParticles); + PxVec4* velocity = PX_EXT_PINNED_MEMORY_ALLOC(PxVec4, *cudaContextManager, maxParticles); + + PxReal x = position.x; + PxReal y = position.y; + PxReal z = position.z; + + for (PxU32 i = 0; i < numX; ++i) + { + for (PxU32 j = 0; j < numY; ++j) + { + for (PxU32 k = 0; k < numZ; ++k) + { + const PxU32 index = i * (numY * numZ) + j * numZ + k; + + PxVec4 pos(x, y, z, 1.0f / particleMass); + phase[index] = particlePhase; + positionInvMass[index] = pos; + velocity[index] = PxVec4(0.0f); + + z += particleSpacing; + } + z = position.z; + y += particleSpacing; + } + y = position.y; + x += particleSpacing; + } + + ExtGpu::PxParticleBufferDesc bufferDesc; + bufferDesc.maxParticles = maxParticles; + bufferDesc.numActiveParticles = maxParticles; + + + bufferDesc.positions = positionInvMass; + bufferDesc.velocities = velocity; + bufferDesc.phases = phase; + + gParticleBuffer = physx::ExtGpu::PxCreateAndPopulateParticleBuffer(bufferDesc, cudaContextManager); + gParticleSystem->addParticleBuffer(gParticleBuffer); + + PX_EXT_PINNED_MEMORY_FREE(*cudaContextManager, positionInvMass); + PX_EXT_PINNED_MEMORY_FREE(*cudaContextManager, velocity); + PX_EXT_PINNED_MEMORY_FREE(*cudaContextManager, phase); + + return particleSpacing; +} + +PxPBDParticleSystem* getParticleSystem() +{ + return gParticleSystem; +} + +PxParticleBuffer* getParticleBuffer() +{ + return gParticleBuffer; +} + +void addKinematicBox(PxVec3 boxSize, PxVec3 boxCenter) +{ + PxShape* shape = gPhysics->createShape(PxBoxGeometry(boxSize.x, boxSize.y, boxSize.z), *gMaterial); + PxRigidDynamic* body = gPhysics->createRigidDynamic(PxTransform(boxCenter)); + body->attachShape(*shape); + body->setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, true); + gScene->addActor(*body); + shape->release(); +} + +// ----------------------------------------------------------------------------------------------------------------- +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport, PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + // initialize cuda + PxCudaContextManagerDesc cudaContextManagerDesc; + gCudaContextManager = PxCreateCudaContextManager(*gFoundation, cudaContextManagerDesc, PxGetProfilerCallback()); + if (gCudaContextManager && !gCudaContextManager->contextIsValid()) + { + PX_RELEASE(gCudaContextManager); + printf("Failed to initialize cuda context.\n"); + printf("The Isosurface feature is currently only supported on the GPU.\n"); + } + + initScene(); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if (pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + // Setup PBF + bool useMovingWall = true; + + const PxReal fluidDensity = 1000.0f; + + PxU32 numX = 50; + PxU32 numY = 200; + PxU32 numZ = 100; + PxReal particleSpacing = initParticles(numX, numY, numZ, PxVec3(1.5f, /*3.f*/8, -4.f), 0.1f, fluidDensity); + + addKinematicBox(PxVec3(7.5f,0.25f,7.5f), PxVec3(3,7.5f,0)); + addKinematicBox(PxVec3(0.25f, 7.5f, 7.5f), PxVec3(-2.f, 7.5f+ 7.5f+0.5f, 0)); + + // Setup container + gScene->addActor(*PxCreatePlane(*gPhysics, PxPlane(0.f, 1.f, 0.f, 0.0f), *gMaterial)); + gScene->addActor(*PxCreatePlane(*gPhysics, PxPlane(-1.f, 0.f, 0.f, 7.5f), *gMaterial)); + gScene->addActor(*PxCreatePlane(*gPhysics, PxPlane(0.f, 0.f, 1.f, 7.5f), *gMaterial)); + gScene->addActor(*PxCreatePlane(*gPhysics, PxPlane(0.f, 0.f, -1.f, 7.5f), *gMaterial)); + + if (!useMovingWall) + { + gScene->addActor(*PxCreatePlane(*gPhysics, PxPlane(1.f, 0.f, 0.f, 7.5f), *gMaterial)); + movingWall = NULL; + } + else + { + PxTransform trans = PxTransformFromPlaneEquation(PxPlane(1.f, 0.f, 0.f, 20.f)); + movingWall = gPhysics->createRigidDynamic(trans); + movingWall->setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, true); + PxRigidActorExt::createExclusiveShape(*movingWall, PxPlaneGeometry(), *gMaterial); + gScene->addActor(*movingWall); + } + + const PxReal fluidRestOffset = 0.5f * particleSpacing; + + PxSparseGridParams sgIsosurfaceParams; + sgIsosurfaceParams.subgridSizeX = 16; + sgIsosurfaceParams.subgridSizeY = 16; + sgIsosurfaceParams.subgridSizeZ = 16; + sgIsosurfaceParams.haloSize = 0; + sgIsosurfaceParams.maxNumSubgrids = 4096; + sgIsosurfaceParams.gridSpacing = 1.5f*fluidRestOffset; + + PxIsosurfaceParams p; + p.particleCenterToIsosurfaceDistance = 1.6f*fluidRestOffset; + p.clearFilteringPasses(); + p.numMeshSmoothingPasses = 4; + p.numMeshNormalSmoothingPasses = 4; + + gIsosuraceCallback.initialize(gScene->getCudaContextManager(), sgIsosurfaceParams, p, 2*1024 * 1024, 4*1024 * 1024, numX * numY * numZ); + if (gParticleSystem) + { + gParticleSystem->setParticleSystemCallback(&gIsosuraceCallback); + } + + // Setup rigid bodies + const PxReal dynamicsDensity = fluidDensity * 0.5f; + const PxReal boxSize = 1.0f; + const PxReal boxMass = boxSize * boxSize * boxSize * dynamicsDensity; + PxShape* shape = gPhysics->createShape(PxBoxGeometry(0.5f * boxSize, 0.5f * boxSize, 0.5f * boxSize), *gMaterial); + for (int i = 0; i < 5; ++i) + { + PxRigidDynamic* body = gPhysics->createRigidDynamic(PxTransform(PxVec3(i - 8.0f, 10, 7.5f))); + body->attachShape(*shape); + PxRigidBodyExt::updateMassAndInertia(*body, boxMass); + gScene->addActor(*body); + } + shape->release(); +} + +// --------------------------------------------------- +PxI32 stepCounter = 0; +void stepPhysics(bool /*interactive*/) +{ + if (gIsRunning) + { + const PxReal dt = 1.0f / 60.0f; + + if (movingWall) + { + static bool moveOut = false; + const PxReal speed = stepCounter > 1200 ? 2.0f : 0.0f; + PxTransform pose = movingWall->getGlobalPose(); + if (moveOut) + { + pose.p.x += dt * speed; + if (pose.p.x > -7.f) + moveOut = false; + } + else + { + pose.p.x -= dt * speed; + if (pose.p.x < -11.5f) + moveOut = true; + } + movingWall->setKinematicTarget(pose); + } + + gScene->simulate(dt); + gScene->fetchResults(true); + gScene->fetchResultsParticleSystem(); + ++stepCounter; + } +} + +void cleanupPhysics(bool /*interactive*/) +{ + if (gParticleSystem) + { + gParticleSystem->setParticleSystemCallback(NULL); + } + gIsosuraceCallback.release(); + + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + PX_RELEASE(gCudaContextManager); + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetIsosurface done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& /*camera*/) +{ + switch(toupper(key)) + { + case 'P': gIsRunning = !gIsRunning; break; + } +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; i gIsosurfaceVertices; +extern PxArray gIsosurfaceIndices; +extern PxArray gIsosurfaceNormals; +extern PxIsosurfaceExtractor* gIsosurfaceExtractor; +extern void* gVerticesGpu; +extern void* gNormalsGpu; +extern void* gInterleavedVerticesAndNormalsGpu; +#endif + +namespace +{ + Snippets::Camera* sCamera; + +#if PX_SUPPORT_GPU_PHYSX + +#if USE_CUDA_INTEROP + bool directGpuRendering = true; +#else + bool directGpuRendering = false; +#endif + + Snippets::SharedGLBuffer sPosBuffer; + Snippets::SharedGLBuffer sNormalBuffer; + Snippets::SharedGLBuffer sTriangleBuffer; + Snippets::SharedGLBuffer sInterleavedPosNormalBuffer; + Snippets::SharedGLBuffer sParticlePosBuffer; + + void onBeforeRenderParticles() + { + PxPBDParticleSystem* particleSystem = getParticleSystem(); + if (particleSystem) + { + PxParticleBuffer* userBuffer = getParticleBuffer(); + PxVec4* positions = userBuffer->getPositionInvMasses(); + + const PxU32 numParticles = userBuffer->getNbActiveParticles(); + + PxScene* scene; + PxGetPhysics().getScenes(&scene, 1); + PxCudaContextManager* cudaContextManager = scene->getCudaContextManager(); + + cudaContextManager->acquireContext(); + + PxCudaContext* cudaContext = cudaContextManager->getCudaContext(); + cudaContext->memcpyDtoH(sParticlePosBuffer.map(), CUdeviceptr(positions), sizeof(PxVec4) * numParticles); + + cudaContextManager->releaseContext(); + } + } + + void renderParticles() + { + PxPBDParticleSystem* particleSystem = getParticleSystem(); + if (!particleSystem) + { + return; + } + sParticlePosBuffer.unmap(); + sPosBuffer.unmap(); + sNormalBuffer.unmap(); + sTriangleBuffer.unmap(); + if (directGpuRendering) + { + PxVec3 color(0.5f, 0.5f, 1); + Snippets::DrawMeshIndexed(sInterleavedPosNormalBuffer.vbo, sTriangleBuffer.vbo, gIsosurfaceExtractor->getNumTriangles(), color); + + //PxVec3 particleColor(1.0f, 1.0f, 0.0f); + //Snippets::DrawPoints(sParticlePosBuffer.vbo, sParticlePosBuffer.size / sizeof(PxVec4), particleColor, 2.f); + } + else + { + //Draw a triangle mesh where the data gets copied to the host and back to the device for rendering + Snippets::renderMesh(gIsosurfaceExtractor->getNumVertices(), gIsosurfaceVertices.begin(), gIsosurfaceExtractor->getNumTriangles(), + gIsosurfaceIndices.begin(), PxVec3(1, 0, 0), gIsosurfaceNormals.begin()); + + //Check for unused vertices + PxVec4 marker(10000000, 0, 0, 0); + PxU32 numIndices = 3 * gIsosurfaceExtractor->getNumTriangles(); + for (PxU32 i = 0; i < numIndices; ++i) + { + gIsosurfaceNormals[gIsosurfaceIndices[i]] = marker; + } + for (PxU32 i = 0; i < gIsosurfaceExtractor->getNumVertices(); ++i) + { + if (gIsosurfaceNormals[i] != marker) + { + printf("Isosurface mesh contains unreferenced vertices\n"); + } + } + } + + Snippets::DrawFrame(PxVec3(0, 0, 0)); + } + + void allocParticleBuffers() + { + PxScene* scene; + PxGetPhysics().getScenes(&scene, 1); + PxCudaContextManager* cudaContextManager = scene->getCudaContextManager(); + if (cudaContextManager) + { + PxU32 maxVertices = gIsosurfaceExtractor->getMaxVertices(); + PxU32 maxIndices = gIsosurfaceExtractor->getMaxTriangles() * 3; + + sParticlePosBuffer.initialize(cudaContextManager); + sParticlePosBuffer.allocate(gIsosurfaceExtractor->getMaxParticles() * sizeof(PxVec4)); + + sPosBuffer.initialize(cudaContextManager); + sPosBuffer.allocate(maxVertices * sizeof(PxVec4)); + gVerticesGpu = sPosBuffer.map(); + sNormalBuffer.initialize(cudaContextManager); + sNormalBuffer.allocate(maxVertices * sizeof(PxVec4)); + gNormalsGpu = sNormalBuffer.map(); + sTriangleBuffer.initialize(cudaContextManager); + sTriangleBuffer.allocate(maxIndices * sizeof(PxU32)); + + sInterleavedPosNormalBuffer.initialize(cudaContextManager); + sInterleavedPosNormalBuffer.allocate(2 * maxVertices * sizeof(PxVec3)); + gInterleavedVerticesAndNormalsGpu = sInterleavedPosNormalBuffer.map(); + + if (directGpuRendering) + { + gIsosurfaceExtractor->setResultBufferDevice(reinterpret_cast(sPosBuffer.map()), + reinterpret_cast(sTriangleBuffer.map()), reinterpret_cast(sNormalBuffer.map())); + } + else + { + gIsosurfaceExtractor->setResultBufferHost(gIsosurfaceVertices.begin(), gIsosurfaceIndices.begin(), gIsosurfaceNormals.begin()); + gInterleavedVerticesAndNormalsGpu = NULL; + } + } + } + + void clearupParticleBuffers() + { + sParticlePosBuffer.release(); + sPosBuffer.release(); + sNormalBuffer.release(); + sTriangleBuffer.release(); + sInterleavedPosNormalBuffer.release(); + } +#else + void onBeforeRenderParticles() + { + } + + void renderParticles() + { + } + + void allocParticleBuffers() + { + } + + void clearupParticleBuffers() + { + } +#endif + + void renderCallback() + { + onBeforeRenderParticles(); + + stepPhysics(true); + + Snippets::startRender(sCamera); + + PxScene* scene; + PxGetPhysics().getScenes(&scene, 1); + PxU32 nbActors = scene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if (nbActors) + { + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true); + } + + renderParticles(); + + Snippets::showFPS(); + + Snippets::finishRender(); + } + + void cleanup() + { + gIsosurfaceVertices.reset(); + gIsosurfaceIndices.reset(); + gIsosurfaceNormals.reset(); + + delete sCamera; + clearupParticleBuffers(); + cleanupPhysics(true); + } + + void exitCallback() + { + + } +} + + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(15.0f, 10.0f, 15.0f), PxVec3(-0.6f, -0.2f, -0.6f)); + + Snippets::setupDefault("PhysX Snippet Isosurface", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + + Snippets::initFPS(); + + allocParticleBuffers(); + + glutMainLoop(); + + cleanup(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetjoint/SnippetJoint.cpp b/engine/third_party/physx/snippets/snippetjoint/SnippetJoint.cpp new file mode 100644 index 00000000..fc7abfb0 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetjoint/SnippetJoint.cpp @@ -0,0 +1,193 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-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. + +// **************************************************************************** +// This snippet illustrates simple use of joints in physx +// +// It creates a chain of objects joined by limited spherical joints, a chain +// joined by fixed joints which is breakable, and a chain of damped D6 joints +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#include "../snippetutils/SnippetUtils.h" + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; + +static PxRigidDynamic* createDynamic(const PxTransform& t, const PxGeometry& geometry, const PxVec3& velocity=PxVec3(0)) +{ + PxRigidDynamic* dynamic = PxCreateDynamic(*gPhysics, t, geometry, *gMaterial, 10.0f); + dynamic->setAngularDamping(0.5f); + dynamic->setLinearVelocity(velocity); + gScene->addActor(*dynamic); + return dynamic; +} + +// spherical joint limited to an angle of at most pi/4 radians (45 degrees) +static PxJoint* createLimitedSpherical(PxRigidActor* a0, const PxTransform& t0, PxRigidActor* a1, const PxTransform& t1) +{ + PxSphericalJoint* j = PxSphericalJointCreate(*gPhysics, a0, t0, a1, t1); + j->setLimitCone(PxJointLimitCone(PxPi/4, PxPi/4)); + j->setSphericalJointFlag(PxSphericalJointFlag::eLIMIT_ENABLED, true); + return j; +} + +// fixed, breakable joint +static PxJoint* createBreakableFixed(PxRigidActor* a0, const PxTransform& t0, PxRigidActor* a1, const PxTransform& t1) +{ + PxFixedJoint* j = PxFixedJointCreate(*gPhysics, a0, t0, a1, t1); + j->setBreakForce(1000, 100000); + j->setConstraintFlag(PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES, true); + j->setConstraintFlag(PxConstraintFlag::eDISABLE_PREPROCESSING, true); + return j; +} + +// D6 joint with a spring maintaining its position +static PxJoint* createDampedD6(PxRigidActor* a0, const PxTransform& t0, PxRigidActor* a1, const PxTransform& t1) +{ + PxD6Joint* j = PxD6JointCreate(*gPhysics, a0, t0, a1, t1); + j->setAngularDriveConfig(PxD6AngularDriveConfig::eSLERP); + j->setMotion(PxD6Axis::eSWING1, PxD6Motion::eFREE); + j->setMotion(PxD6Axis::eSWING2, PxD6Motion::eFREE); + j->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + j->setDrive(PxD6Drive::eSLERP, PxD6JointDrive(0, 1000, FLT_MAX, true)); + return j; +} + +typedef PxJoint* (*JointCreateFunction)(PxRigidActor* a0, const PxTransform& t0, PxRigidActor* a1, const PxTransform& t1); + +// create a chain rooted at the origin and extending along the x-axis, all transformed by the argument t. + +static void createChain(const PxTransform& t, PxU32 length, const PxGeometry& g, PxReal separation, JointCreateFunction createJoint) +{ + PxVec3 offset(separation/2, 0, 0); + PxTransform localTm(offset); + PxRigidDynamic* prev = NULL; + + for(PxU32 i=0;iaddActor(*current); + prev = current; + localTm.p.x += separation; + } +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(),true, gPvd); + PxInitExtensions(*gPhysics, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(2); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + gScene = gPhysics->createScene(sceneDesc); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + createChain(PxTransform(PxVec3(0.0f, 20.0f, 0.0f)), 5, PxBoxGeometry(2.0f, 0.5f, 0.5f), 4.0f, createLimitedSpherical); + createChain(PxTransform(PxVec3(0.0f, 20.0f, -10.0f)), 5, PxBoxGeometry(2.0f, 0.5f, 0.5f), 4.0f, createBreakableFixed); + createChain(PxTransform(PxVec3(0.0f, 20.0f, -20.0f)), 5, PxBoxGeometry(2.0f, 0.5f, 0.5f), 4.0f, createDampedD6); +} + +void stepPhysics(bool /*interactive*/) +{ + gScene->simulate(1.0f/60.0f); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PxCloseExtensions(); + PX_RELEASE(gPhysics); + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } + PX_RELEASE(gFoundation); + + printf("SnippetJoint done.\n"); +} + +void keyPress(unsigned char key, const PxTransform& camera) +{ + switch(toupper(key)) + { + case ' ': createDynamic(camera, PxSphereGeometry(3.0f), camera.rotate(PxVec3(0,0,-1))*200); break; + } +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + + Snippets::finishRender(); +} + +void exitCallback() +{ + delete sCamera; + cleanupPhysics(true); +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(34.613838f, 27.653027f, 9.363596f), PxVec3(-0.754040f, -0.401930f, -0.519496f)); + + Snippets::setupDefault("PhysX Snippet Joint", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetjointdrive/SnippetJointDrive.cpp b/engine/third_party/physx/snippets/snippetjointdrive/SnippetJointDrive.cpp new file mode 100644 index 00000000..805a0810 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetjointdrive/SnippetJointDrive.cpp @@ -0,0 +1,341 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +// **************************************************************************** +// This snippet illustrates simple use of joint drives in physx +// **************************************************************************** + +#include +#include "PxPhysicsAPI.h" +#include "../snippetcommon/SnippetPrint.h" +#include "../snippetcommon/SnippetPVD.h" +#ifdef RENDER_SNIPPET + #include "../snippetrender/SnippetRender.h" +#endif + +using namespace physx; + +static PxDefaultAllocator gAllocator; +static PxDefaultErrorCallback gErrorCallback; +static PxFoundation* gFoundation = NULL; +static PxPhysics* gPhysics = NULL; +static PxDefaultCpuDispatcher* gDispatcher = NULL; +static PxScene* gScene = NULL; +static PxMaterial* gMaterial = NULL; +static PxPvd* gPvd = NULL; +#if PX_SUPPORT_GPU_PHYSX +static PxCudaContextManager* gCudaContextManager = NULL; +#endif +static bool gPause = false; +static bool gOneFrame = false; +static bool gChangeObjectAType = false; +static bool gChangeObjectBRotation = false; +static bool gChangeJointFrameARotation = false; +static bool gChangeJointFrameBRotation = false; +#if PX_SUPPORT_GPU_PHYSX +static bool gUseGPU = false; +#endif +static PxU32 gSceneIndex = 0; +static const PxU32 gMaxSceneIndex = 4; + +static void setupActor(PxRigidActor* actor) +{ + actor->setActorFlag(PxActorFlag::eVISUALIZATION, true); + gScene->addActor(*actor); +} + +static void createScene() +{ + PX_RELEASE(gScene); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + // Disable gravity so that the motion is only produced by the drive + sceneDesc.gravity = PxVec3(0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(2); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; +#if PX_SUPPORT_GPU_PHYSX + if(gUseGPU) + { + sceneDesc.cudaContextManager = gCudaContextManager; + sceneDesc.flags |= PxSceneFlag::eENABLE_GPU_DYNAMICS; + sceneDesc.flags |= PxSceneFlag::eENABLE_PCM; + sceneDesc.broadPhaseType = PxBroadPhaseType::eGPU; + sceneDesc.gpuMaxNumPartitions = 8; + } +#endif + gScene = gPhysics->createScene(sceneDesc); + // Visualize joint local frames + gScene->setVisualizationParameter(PxVisualizationParameter::eSCALE, 1.0f); + gScene->setVisualizationParameter(PxVisualizationParameter::eJOINT_LOCAL_FRAMES, 1.0f); + + PxPvdSceneClient* pvdClient = gScene->getScenePvdClient(); + if(pvdClient) + { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + + PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + if(gSceneIndexsetRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, true); + actor0 = actor; + } + else + { + actor0 = PxCreateStatic(*gPhysics, tr, boxGeom, *gMaterial); + } + setupActor(actor0); + + tr.p.x += boxGeom.halfExtents.x * 2.0f; + if(gChangeObjectBRotation) + tr.q = rotZ; + + PxRigidDynamic* actor1 = PxCreateDynamic(*gPhysics, tr, boxGeom, *gMaterial, 1.0f); + setupActor(actor1); + + PxTransform jointFrame0(PxIdentity); + PxTransform jointFrame1(PxIdentity); + + // We're going to setup a linear drive along "X" = actor0's joint frame's X axis. + // That axis will be either aligned with the actors' X axis or tilted 45 degrees. + if(gChangeJointFrameARotation) + jointFrame0.q = rotZ; + else + jointFrame0.q = PxQuat(PxIdentity); + + if(gChangeJointFrameBRotation) + jointFrame1.q = rotZ; + else + jointFrame1.q = PxQuat(PxIdentity); + + PxD6Joint* j = PxD6JointCreate(*gPhysics, actor0, jointFrame0, actor1, jointFrame1); + j->setAngularDriveConfig(PxD6AngularDriveConfig::eSWING_TWIST); + j->setConstraintFlag(PxConstraintFlag::eVISUALIZATION, true); + + // Locked axes would move the joint frames & snap them together. In this test we explicitly want them disjoint, + // to check in which direction the drives operates. So we set all DOFs free to make sure none of that interferes + // with the drive. + j->setMotion(PxD6Axis::eX, PxD6Motion::eFREE); + j->setMotion(PxD6Axis::eY, PxD6Motion::eFREE); + j->setMotion(PxD6Axis::eZ, PxD6Motion::eFREE); + j->setMotion(PxD6Axis::eSWING1, PxD6Motion::eFREE); + j->setMotion(PxD6Axis::eSWING2, PxD6Motion::eFREE); + j->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + + if(gSceneIndex==0) + { + // Linear drive along "X" = actor0's joint frame's X axis + j->setDrive(PxD6Drive::eX, PxD6JointDrive(0, 1000, FLT_MAX, true)); + j->setDriveVelocity(PxVec3(1.0f, 0.0f, 0.0f), PxVec3(0.0f), true); + } + else if(gSceneIndex==1) + { + j->setDrive(PxD6Drive::eTWIST, PxD6JointDrive(0, 1000, FLT_MAX, true)); + j->setDriveVelocity(PxVec3(0.0f), PxVec3(1.0f, 0.0f, 0.0f), true); + } + else if(gSceneIndex==2) + { + j->setDrive(PxD6Drive::eSWING1, PxD6JointDrive(0, 1000, FLT_MAX, true)); + j->setDriveVelocity(PxVec3(0.0f), PxVec3(0.0f, 1.0f, 0.0f), true); + } + else if(gSceneIndex==3) + { + j->setAngularDriveConfig(PxD6AngularDriveConfig::eSLERP); + j->setDrive(PxD6Drive::eSLERP, PxD6JointDrive(0, 1000, FLT_MAX, true)); + j->setDriveVelocity(PxVec3(0.0f), PxVec3(0.0f, 1.0f, 0.0f), true); + } + } +} + +void initPhysics(bool /*interactive*/) +{ + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport,PxPvdInstrumentationFlag::eALL); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(),true, gPvd); + PxInitExtensions(*gPhysics, gPvd); + +#if PX_SUPPORT_GPU_PHYSX + PxCudaContextManagerDesc cudaContextManagerDesc; + gCudaContextManager = PxCreateCudaContextManager(*gFoundation, cudaContextManagerDesc, PxGetProfilerCallback()); + if(gCudaContextManager) + { + if(!gCudaContextManager->contextIsValid()) + PX_RELEASE(gCudaContextManager); + } +#endif + + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + createScene(); +} + +void stepPhysics(bool /*interactive*/) +{ + if(gPause && !gOneFrame) + return; + gOneFrame = false; + + gScene->simulate(1.0f / 60.0f); + gScene->fetchResults(true); +} + +void cleanupPhysics(bool /*interactive*/) +{ + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PxCloseExtensions(); + PX_RELEASE(gPhysics); + if(gPvd) + { + PxPvdTransport* transport = gPvd->getTransport(); + PX_RELEASE(gPvd); + PX_RELEASE(transport); + } +#if PX_SUPPORT_GPU_PHYSX + PX_RELEASE(gCudaContextManager); +#endif + PX_RELEASE(gFoundation); + + printf("SnippetJointDrive done.\n"); +} + +void renderText() +{ +#ifdef RENDER_SNIPPET + Snippets::print("Press F1 to change body0's joint frame orientation"); + Snippets::print("Press F2 to change body0's type (static/kinematic)"); + Snippets::print("Press F3 to change body1's joint frame orientation"); + Snippets::print("Press F4 to change body1's orientation"); +#if PX_SUPPORT_GPU_PHYSX + Snippets::print("Press F5 to use CPU or GPU"); +#endif + Snippets::print("Press F6 to select the next drive"); + switch(gSceneIndex) + { + case 0: + Snippets::print("Current drive: linear X"); + break; + case 1: + Snippets::print("Current drive: angular twist (around X)"); + break; + case 2: + Snippets::print("Current drive: angular swing (around Y)"); + break; + case 3: + Snippets::print("Current drive: angular slerp (around Y)"); + break; + } +#if PX_SUPPORT_GPU_PHYSX + if(gUseGPU) + Snippets::print("Current mode: GPU"); + else + Snippets::print("Current mode: CPU"); +#endif + Snippets::print("body1's translation or rotation (drive) axis should only depend on body0's joint axes."); +#endif +} + +void keyPress(unsigned char key, const PxTransform&) +{ + if(key=='p' || key=='P') + gPause = !gPause; + + if(key=='o' || key=='O') + { + gPause = true; + gOneFrame = true; + } + + if(key==1) + { + gChangeJointFrameARotation = !gChangeJointFrameARotation; + createScene(); + } + else if(key==2) + { + gChangeObjectAType = !gChangeObjectAType; + createScene(); + } + else if(key==3) + { + gChangeJointFrameBRotation = !gChangeJointFrameBRotation; + createScene(); + } + else if(key==4) + { + gChangeObjectBRotation = !gChangeObjectBRotation; + createScene(); + } +#if PX_SUPPORT_GPU_PHYSX + else if(key==5) + { + gUseGPU = !gUseGPU; + createScene(); + } +#endif + else if(key==6) + { + gSceneIndex = gSceneIndex + 1; + if(gSceneIndex==gMaxSceneIndex) + gSceneIndex = 0; + createScene(); + } +} + +int snippetMain(int, const char*const*) +{ +#ifdef RENDER_SNIPPET + extern void renderLoop(); + renderLoop(); +#else + static const PxU32 frameCount = 100; + initPhysics(false); + for(PxU32 i=0; igetNbActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC); + if(nbActors) + { + const PxVec3 dynColor(1.0f, 0.5f, 0.25f); + + PxArray actors(nbActors); + scene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC | PxActorTypeFlag::eRIGID_STATIC, reinterpret_cast(&actors[0]), nbActors); + Snippets::renderActors(&actors[0], static_cast(actors.size()), true, dynColor); + } + + { + const PxRenderBuffer& renderBuffer = scene->getRenderBuffer(); + const PxDebugLine* lines = renderBuffer.getLines(); + const PxU32 nbLines = renderBuffer.getNbLines(); + for(PxU32 i=0;i>8) & 0xff))/255.0f; + const float r = float(((lines[i].color0>>16) & 0xff))/255.0f; + + Snippets::DrawLine(lines[i].pos0, lines[i].pos1, PxVec3(r, g, b)); + } + } + + renderText(); + + Snippets::finishRender(); +} + +void cleanup() +{ + delete sCamera; + cleanupPhysics(true); +} + +void exitCallback() +{ +} +} + +void renderLoop() +{ + sCamera = new Snippets::Camera(PxVec3(1.847750f, 2.8f, -15.241850f), PxVec3(-0.219386f, -0.289038f, -0.931841f)); + + Snippets::setupDefault("PhysX Snippet Joint Drive", sCamera, keyPress, renderCallback, exitCallback); + + initPhysics(true); + glutMainLoop(); + + cleanup(); +} +#endif diff --git a/engine/third_party/physx/snippets/snippetloadcollection/SnippetLoadCollection.cpp b/engine/third_party/physx/snippets/snippetloadcollection/SnippetLoadCollection.cpp new file mode 100644 index 00000000..03a3b799 --- /dev/null +++ b/engine/third_party/physx/snippets/snippetloadcollection/SnippetLoadCollection.cpp @@ -0,0 +1,426 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR 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. + +// **************************************************************************** +// This snippet illustrates loading xml or binary serialized collections and instantiating the objects in a scene. +// +// It only compiles and runs on authoring platforms (windows, osx and linux). +// The snippet supports connecting to PVD in order to display the scene. +// +// It is a simple command-line tool supporting the following options:: +// SnippetLoadCollection [--pvdhost= ] [--pvdport= ] [--pvdtimeout=