Compare commits

...

62 Commits
0.10 ... main

Author SHA1 Message Date
Jeff 559217d991 meta: Add vs2022 files to .gitignore
continuous-integration/drone/push Build encountered an error Details
Babe, new visual studio garbage file just dropped!
2024-02-03 23:30:48 +00:00
RaphaelIT7 c63e5211b3 Made JoltPhysicsObject::GetName() functional
continuous-integration/drone/push Build is passing Details
2023-10-02 13:02:52 -07:00
Joshua Ashton 50cef39716 vpc: Fix SSE4.2/AVX2 leaking into other builds
continuous-integration/drone/push Build is passing Details
Closes: #138
Closes: #182
2023-08-01 02:59:22 -07:00
Raphael 8ebdc6b77f
ci: Setup permissions for executing
continuous-integration/drone/push Build is passing Details
2023-07-31 18:50:44 -07:00
Joshua Ashton 17b5e73799 environment, spring: Use StiffnessAndDamping for springs
continuous-integration/drone/push Build encountered an error Details
Should improve springs significantly.
2023-08-01 02:27:27 -07:00
Joshua Ashton 2242614d4a vehicle: Use StiffnessAndDamping for spring
Removes my todo here, and improves vehicles a lot.
2023-08-01 02:27:21 -07:00
Joshua Ashton 457a95fca5 Rebase against latest JoltPhysics w/ CCD fix
Closes: #1
Closes: #28
Closes: #86
2023-08-01 02:27:16 -07:00
Josh Dowell 562458200c If we fail to create a convex hull from the supplied points, substitute it for a small sphere.
continuous-integration/drone/push Build encountered an error Details
I found exactly one model in a single map for gmod that causes this to happen, a better solution would be to re-calculate a valid hull from the supplied points, but this'll do since it's such a rare case.
2023-04-11 07:15:10 +01:00
Joshua Ashton d407472830 Support for GMod branch on Linux
continuous-integration/drone/push Build encountered an error Details
2023-04-10 02:13:30 +01:00
Joshua Ashton ae995e24bf compat: Support for GMod mini-source-sdk
continuous-integration/drone/push Build encountered an error Details
2023-04-10 01:24:51 +01:00
Joshua Ashton a7fece4d4e player: Only push objects if the normal < -0.7 (grounded)
continuous-integration/drone/push Build encountered an error Details
Improves: #3

Closes: #118
2023-03-29 19:04:23 +01:00
Joshua Ashton be6b64b31e all: Rebase against latest VPhysics Jolt
continuous-integration/drone/push Build encountered an error Details
Bump submodule to 172a99c718bded5faa169ac440517286684fa2f0 and fixup our code to support the latest version.

Additionally, some water changes/fixes.
2023-03-29 18:31:20 +01:00
Jeremy Lorelli 6c3e224561 object: Convert sphere radius to Source units
continuous-integration/drone/push Build encountered an error Details
2022-12-31 07:18:35 +00:00
Joshua Ashton 067cc7eb4e
README: Add reference to Jolt Physics repo in the readme.
continuous-integration/drone/push Build is passing Details
2022-10-25 01:11:24 +01:00
JJL772 860c66d09a environment: Fix GetBroadPhaseLayerName BroadPhaseLayers -> string mapping
continuous-integration/drone/push Build is passing Details
2022-09-28 17:28:12 +01:00
Bagel™ 49abdbbef7 meta: Add build.md
continuous-integration/drone/push Build is passing Details
2022-09-21 18:30:01 +00:00
Margen67 0b937b95ce artifacts.yml: Improvements
Set fail-fast to false (stopping jobs if one fails isn't always desirable)
Remove unused ids; These are only used for outputs, and outputs aren't used anywhere.
Remove unneeded shell; pwsh and bash are already the default shell of Windows and Linux.
Upgrade upload-artifact to v3.
2022-09-21 19:26:50 +01:00
Magnus Larsen 0c55d0082d collide: Deconstruct CPhysCollide properly
It is necessary to dispatch the correct JPH::Shape dtor, even though
it's stored as a a CPhysCollide*.

This should fix #58
2022-09-21 19:26:07 +01:00
Joshua Ashton 6c1ec77980 environment: Add stub for Get/SetPerformanceSettings
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-09-09 02:22:04 +01:00
Joshua Ashton 23bbdea910 util: Remove our impls of popcnt and tzcnt
continuous-integration/drone/push Build is passing Details
2022-09-09 02:00:43 +01:00
Joshua Ashton 6636409b10 listener_contact: Use JPH CountTrailingZeros 2022-09-09 02:00:33 +01:00
Joshua Ashton cfae6a7997 constraints: Use JPH CountBits and CountTrailingZeros 2022-09-09 02:00:20 +01:00
Joshua Ashton 6767ca8f32 object: Unmark body as dirty when destroyed
Fixes some crashes since this was introduced.
2022-09-09 01:59:56 +01:00
Joshua Ashton 954d301a2b constraints: Fix refcountning of constraint pt
continuous-integration/drone/push Build is failing Details
Closes: #17
2022-09-09 01:42:31 +01:00
Joshua Ashton 2931f2e5cf ci: Copy vphysics.so -> vphysics_client.so for GMod
continuous-integration/drone/push Build was killed Details
2022-09-09 00:07:08 +00:00
Joshua Ashton 8165375c73 vpc_scripts: Remove jolt_static group
continuous-integration/drone/push Build is failing Details
continuous-integration/drone Build is passing Details
Deprecated.
2022-09-09 00:19:12 +01:00
Joshua Ashton 6ec1d75b00 meta: Add .sentinel to gitignore
continuous-integration/drone/push Build is failing Details
2022-09-08 23:43:01 +01:00
Josh Dowell 5f145e8694 meta: Add .enc files to the gitignore 2022-09-08 23:43:01 +01:00
Josh Dowell 327a96ca54 all: Add multiple builds for different CPU feature sets and a wrapper DLL to go along with them
Closes: #46
2022-09-08 23:43:01 +01:00
Joshua Ashton b4ef78acea meta: Update readme to add info about downloading non-releases
continuous-integration/drone/push Build is passing Details
2022-09-02 20:29:14 +00:00
Joshua Ashton a28bbc8334 ci: Add drone CI for GMod builds
continuous-integration/drone Build is passing Details
2022-09-02 21:13:48 +01:00
Joshua Ashton 29cf7a0778 vpc_scripts: Add jolt_static group 2022-09-02 21:13:48 +01:00
Joshua Ashton 0aa85f9931 ci: Add Linux CI 2022-09-02 19:08:08 +01:00
Joshua Ashton 9130ae7dd2 vpc_scripts: Add -mbmi for now
A stop-gap until #71 is merged.
2022-09-02 18:28:19 +01:00
Joshua Ashton 08c0934acc cbase: Undef offsetof if present
Fixes Linux builds in SDK.
2022-09-02 18:28:19 +01:00
Joshua Ashton cf10810b35 vpc_scripts: Add groups and projects 2022-09-02 12:47:05 +01:00
Joshua Ashton 5adb1c9358 ci: Rename build-set-windows to windows
Shorter name makes it easier to see
2022-09-02 11:37:47 +01:00
Joshua Ashton 1512949ee7 ci: Add support for Alien Swarm
Closes: #10
2022-09-02 11:37:47 +01:00
Joshua Ashton d923d9a5b5 misc: Add compat defines for Alien Swarm 2022-09-02 10:59:04 +01:00
Joshua Ashton b01f9f5c0c environment: Use std::vector for m_pPhysicsControllers 2022-09-02 10:56:58 +01:00
Joshua Ashton ae9b5dcc8e controller_motion: Use std::vector for m_pObjects 2022-09-02 10:56:21 +01:00
Joshua Ashton 143b5b166c environment: Add list of dirty static bodies
Adds a vector of objects that were awake, and changed their
motion type from Dynamic -> Static, so that they can be
retrieved in GetActiveObjects, and have their visuals updated.

If we don't do this, objects that get moved, woken, and their
movement type changed to static will not get their transforms
updated on the game side.

Closes: #59
Closes: #63
2022-09-02 10:09:30 +01:00
Joshua Ashton 36711271be constraints: Use Erase helper in RemoveConstraint 2022-09-02 10:09:30 +01:00
Joshua Ashton 52ff0b3629 fluid: Use new Erase helper 2022-09-02 10:09:30 +01:00
Joshua Ashton bdd5b2ca9b objectpairhash: Use Contains helper 2022-09-02 10:09:30 +01:00
Joshua Ashton 9946d6847c util: Add Contains helper
Useful!
2022-09-02 10:09:30 +01:00
Joshua Ashton cb10f30fd8 util: Add Erase and EraseIf helpers
No std::erase_if in C++17 which is handy to have!
2022-09-02 10:09:30 +01:00
Joshua Ashton 9a44e687c6 ci: Add support for SDK 2013 SP to CI 2022-09-02 09:52:02 +01:00
Joshua Ashton 2812b58680
collide: Use std::swap instead of Swap
Swap is something that was added to Desolation's basetypes.h, not present in SDK 2013.
Just use std::swap from STL.
2022-09-01 12:29:36 +01:00
Joshua Ashton c6c1a6dba1 collide: Flip triangle winding in CreateDebugMesh
Closes: #44
2022-09-01 07:34:12 +01:00
Joshua Ashton db13ffba6e environment: Use resize when updating m_CachedObjects
This was a typo, otherwise the size is always 0.
2022-08-31 15:39:23 +01:00
Joshua Ashton d6e1214a19 listener: Re-target pInternalData on JoltPhysicsCollisionEvent copy/move
Needs this to match the parent structure, not some other object that
may be going to be destroyed.

Closes: #51
2022-08-31 15:39:15 +01:00
Jeremy Lorelli 347e78d122 state_recorder: Prefix call to move with std:: to silence warning 2022-08-30 06:11:40 +01:00
Joshua Ashton 25eecb1f35 collide: Support legacy style .phy files
These legacy style .phy files are literally just serialized compact surfaces
and nothing else, with some misc. data shoved into some dummy compartment.

Some props in shipping HL2 still use this format, as they have a .phy, even after their
.qc had the $collisionmodel removed, as they didn't get the stale .phy in the game files deleted.

Closes: #35
2022-08-30 06:06:58 +01:00
Joshua Ashton d75827b05e parse: Add dummy fallback KV for when parsing fails
There are lots of really broken models floating about, with complete garbage KV contents.

If we fail to parse the KV, use a dummy fallback instead of returning a NULL parser, which always just crashes.
2022-08-30 04:32:01 +01:00
caseytube 3047adf03c Update README.md
Minor Spelling Fix
2022-08-29 23:41:19 +01:00
Josh Dowell c9604f710f listener: Fix a typo causing collision damage to be applied in full
There was a typo in vjolt_listener_contact.h where it would get the velocity of the first object twice, which was wrong, and this was causing damage to be applied in full
2022-08-29 23:34:20 +01:00
Joshua Ashton 6d81c04454 pch: Use correctly cased KeyValues.h per-branch 2022-08-29 08:24:44 +01:00
Arthurdead 457b9923f5
build: Fix compiling with C++17 on Linux 2022-08-29 08:23:11 +01:00
Joshua Ashton 65bc5bd2fd vehicle: Implement per-wheel brake torque
Based upon the same calculations that regular VPhysics does, calculate the per-wheel brake torque.

Improves vehicle feel and matches it more closely.
2022-08-29 08:02:10 +01:00
Joshua Ashton a7209f3766 compat: Add GAME_L4D2_OR_NEWER define 2022-08-29 07:57:31 +01:00
Joshua Ashton fa1e0bd3e7 meta: Add .gitignore 2022-08-29 07:57:22 +01:00
50 changed files with 1888 additions and 735 deletions

77
.drone.yml Normal file
View File

@ -0,0 +1,77 @@
kind: pipeline
type: docker
name: Build and Push Windows Binaries
# This build script is used internally
# to provide GMod builds as those cannot be provided
# using any publicly available SDKs.
clone:
# Use our own cloning so we can grab both the
# src and game repos, submodules, depth etc.
disable: true
environment:
GIT_LFS_SKIP_SMUDGE: 1
WINEDEBUG: -all
WINEESYNC: 1
WINEFSYNC: 1
steps:
- name: Clone VitaminSource Code
image: alpine/git
commands:
- git clone --depth 1 --recursive https://git.froggi.es/joshua/MiniVitaminSource src
- git -C src checkout main
- name: Clone VPhysics Jolt
image: alpine/git
commands:
- cd src
- git clone --depth 1 --recursive https://git.froggi.es/joshua/vphysics_jolt vphysics_jolt
- git -C vphysics_jolt checkout $DRONE_COMMIT
depends_on:
- Clone VitaminSource Code
- name: Clone Builds
image: alpine/git
commands:
- git clone --depth 1 --recursive https://git.froggi.es/joshua/vphysics_jolt_gmod_builds game
- git -C game checkout $DRONE_BRANCH
- name: Build for Windows
pull: never
image: registry.froggi.es/joshua/msvc-wine
commands:
- cd src
- wine create_jolt_static.bat
- wine build_auto_jolt.bat
depends_on:
- Clone VitaminSource Code
- Clone VPhysics Jolt
- name: Build for Linux
pull: never
image: registry.froggi.es/joshua/debian11-vitamin
commands:
- cd src
- ./create_jolt_static_projects.sh
- make -f jolt.mak -j 8
depends_on:
- Clone VitaminSource Code
- Clone VPhysics Jolt
- name: Push Builds
image: alpine/git
commands:
- cd game
- cp bin/linux64/vphysics.so bin/linux64/vphysics_client.so
- cp bin/linux64/vphysics.so.dbg bin/linux64/vphysics_client.so.dbg
- git add .
- git commit -m "Update binaries as of $DRONE_COMMIT" || true
- git pull --rebase
- git push
depends_on:
- Build for Windows
- Build for Linux
- Clone Builds

View File

@ -1,52 +0,0 @@
name: Build Artifacts for Windows
on: [push, pull_request, workflow_dispatch]
jobs:
build-set-windows:
runs-on: windows-2022
steps:
- name: Checkout Mini Source SDK 2013
id: checkout-minisdk
uses: actions/checkout@v3
with:
repository: 'Joshua-Ashton/mini-source-sdk-2013'
- name: Checkout VPhysics Jolt
id: checkout-code
uses: actions/checkout@v3
with:
path: 'mp/src/vphysics_jolt'
submodules: recursive
- name: Find Visual Studio
id: find-vs
shell: pwsh
run: |
$installationPath = Get-VSSetupInstance `
| Select-VSSetupInstance -Require Microsoft.VisualStudio.Workload.NativeDesktop -Latest `
| Select-Object -ExpandProperty InstallationPath
Write-Output "VSDEVCMD=${installationPath}\Common7\Tools\VsDevCmd.bat" `
| Out-File -FilePath "${Env:GITHUB_ENV}" -Append
- name: Build MSVC x86
id: build
shell: pwsh
working-directory: 'mp/src'
run: |
& "${Env:COMSPEC}" /s /c "`"${Env:VSDEVCMD}`" -arch=x86 -host_arch=x64 -no_logo && set" `
| % { , ($_ -Split '=', 2) } `
| % { [System.Environment]::SetEnvironmentVariable($_[0], $_[1]) }
.\fix_registry.bat
.\createjoltprojects.bat
devenv jolt.sln /upgrade
msbuild jolt.sln /nodeReuse:false /t:Rebuild /p:Configuration=Release /p:Platform=x86 /m /v:minimal
- name: Upload artifacts
id: upload-artifacts
uses: actions/upload-artifact@v2
with:
name: vphysics_jolt_sdk2013_win32
path: mp/game
if-no-files-found: error

94
.github/workflows/artifacts.yml vendored Normal file
View File

@ -0,0 +1,94 @@
name: Build Artifacts
on: [push, pull_request, workflow_dispatch]
jobs:
windows:
strategy:
fail-fast: false
matrix:
source_branch: [sdk2013-sp, sdk2013-mp, asw, gmod]
runs-on: windows-2022
steps:
- name: Checkout Mini Source SDK
uses: actions/checkout@v3
with:
repository: Joshua-Ashton/mini-source-sdk
- name: Checkout VPhysics Jolt
uses: actions/checkout@v3
with:
path: ${{ matrix.source_branch }}/src/vphysics_jolt
submodules: recursive
- name: Find Visual Studio
run: |
$installationPath = Get-VSSetupInstance `
| Select-VSSetupInstance -Require Microsoft.VisualStudio.Workload.NativeDesktop -Latest `
| Select-Object -ExpandProperty InstallationPath
Write-Output "VSDEVCMD=${installationPath}\Common7\Tools\VsDevCmd.bat" `
| Out-File -FilePath "${Env:GITHUB_ENV}" -Append
- name: Build MSVC x86
working-directory: ${{ matrix.source_branch }}/src
run: |
& "${Env:COMSPEC}" /s /c "`"${Env:VSDEVCMD}`" -arch=x86 -host_arch=x64 -no_logo && set" `
| % { , ($_ -Split '=', 2) } `
| % { [System.Environment]::SetEnvironmentVariable($_[0], $_[1]) }
.\fix_registry.bat
.\createjoltprojects.bat
devenv jolt.sln /upgrade
msbuild jolt.sln /nodeReuse:false /t:Rebuild /p:Configuration=Release /p:Platform=x86 /m /v:minimal
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: vphysics_jolt_${{ matrix.source_branch }}_win32
path: ${{ matrix.source_branch }}/game
if-no-files-found: error
linux:
strategy:
fail-fast: false
matrix:
source_branch: [sdk2013-sp, sdk2013-mp, gmod]
runs-on: ubuntu-latest
container: debian:bullseye
steps:
- name: Install Dependencies
run: |
dpkg --add-architecture i386
apt update
apt install -y build-essential git libstdc++6:i386 gcc-multilib g++-multilib
- name: Checkout Mini Source SDK
uses: actions/checkout@v3
with:
repository: Joshua-Ashton/mini-source-sdk
- name: Checkout VPhysics Jolt
uses: actions/checkout@v3
with:
path: ${{ matrix.source_branch }}/src/vphysics_jolt
submodules: recursive
- name: Build GCC x86
working-directory: ${{ matrix.source_branch }}/src
run: |
chmod +x createjoltprojects.sh
chmod +x devtools/bin/vpc_linux
chmod +x devtools/bin/vpc
chmod +x devtools/gendbg.sh
./createjoltprojects.sh
make -f jolt.mak -j $(nproc)
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: vphysics_jolt_${{ matrix.source_branch }}_linux32
path: ${{ matrix.source_branch }}/game
if-no-files-found: error

60
.gitignore vendored Normal file
View File

@ -0,0 +1,60 @@
# Multi-platform
*.vpc_cache
*.vpc_crc
*.sentinel
.vscode
.cache
# Windows Stuff
*.vcxproj
*.sln
*.filters
.vs
enc_temp_folder/
*.enc
*.suo
*.user
*.FileListAbsolute.txt
*.sln.docstates
*.obj
*.pch
*.tlog
*.log
*.scc
*.exp
*.ilk
*.lastbuildstate
*.sdf
*.opensdf
*.idb
*.vcxproj.filters
*.pdb
*.recipe
*.iobj
*.ipdb
*.res
*.aps
UpgradeLog.htm
generated_code_*
*.dll
*.exe
*.lib
*.ixx.ifc.dt.module.json.command
*.ixx.ifc.dt.module.json
*.ixx.ifc.dt.d.json
# Linux Stuff
*.mak
*.o
*.a
*.P
*.map
*.so
*.so.dbg
manifest.txt
obj*/
# Mac Stuff
*.xcodeproj/

View File

@ -2,7 +2,7 @@
## What is Volt? ⚡
Volt (VPhysics Jolt) is a replacement for Source's VPhysics which uses IVP/Havok<br>
Volt (VPhysics Jolt) is a replacement for Source's VPhysics which uses IVP/Havok using [Jolt Physics](https://github.com/jrouwe/JoltPhysics/)<br>
Created by [Joshua Ashton (🐸✨)](https://github.com/Joshua-Ashton) [@phys_ballsocket](https://twitter.com/phys_ballsocket) and [Josh Dowell (Slartibarty)](https://github.com/Slartibarty) [@Slartbarty](https://twitter.com/Slartbarty).
Volt is designed to be incredibly high performance, supporting thousands of objects at once without bringing tick/framerate down to a crawl.
@ -59,8 +59,13 @@ Volt should build fine against Source SDK 2013 and Alien Swarm SDK on a MSVC or
Unfortunately we cannot redistribute the additional code/headers needed to build Volt for games such as Garry's Mod which uses a different VPhysics interface (CS:GO's) to what is found in the Valve-provided public SDKs.
For full build instructions pertaining to SDK 2013, refernce [build.md](/build.md).
## Download
Development builds for each commit for SDK2013 SP/MP + ASW are available as artifacts on each commit on GitHub through GitHub Actions.</br>
Development builds for each commit for Garry's Mod are available on [froggi.es](https://git.froggi.es/joshua/vphysics_jolt_gmod_builds).
For each release, binary builds are provided for Garry's Mod and Source SDK 2013 on the [Releases](https://github.com/Joshua-Ashton/VPhysics-Jolt/releases/) page.
## Media
@ -74,7 +79,7 @@ For each release, binary builds are provided for Garry's Mod and Source SDK 2013
### Lots of Balls Test
[![Lots of Balls Test](https://img.youtube.com/vi/tYfiTyRtmz8/0.jpg)](https://www.youtube.com/watch?v=tYfiTyRtmz8 "Lots of Balls Test")
### Wheels + Weld Car Dupe Test
### Wheels + Weld Car Dupe Test
[![Weld Car Dupe Test](https://img.youtube.com/vi/5_QbbXbIrg8/0.jpg)](https://www.youtube.com/watch?v=5_QbbXbIrg8 "Weld Car Dupe Test")
### Door + NPC (Physics Shadowed Objects) Test
@ -95,6 +100,6 @@ For each release, binary builds are provided for Garry's Mod and Source SDK 2013
### [Portal 2: Desolation](https://emberspark.games/desolation/)
### [Prelude Online](https://prelude.online/)
### [Prelude: Online](https://prelude.online/)
# Have fun! 🐸⚡
# Have fun! 🐸⚡

108
build.md Normal file
View File

@ -0,0 +1,108 @@
# Building Volt
###### Note: This repository can be built with the default SDK but will not be outlined in this guide.
###### Note: x64 platform builds will also not be outlined in this guide.
All build instructions start the same. Clone a local copy of [mini-source-sdk](https://github.com/Joshua-Ashton/mini-source-sdk). (A minified version of [Source SDK](https://github.com/ValveSoftware/source-sdk-2013) with support for Linux and added support for [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) and the [Windows 11 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/))
```bash
git clone https://github.com/Joshua-Ashton/mini-source-sdk.git
```
Following your clone of the mini-source-sdk, navigate to the "version" you would like to build (`sdk2013-mp`, `sdk2013-sp`, `asw`). As an example, the multiplayer version will be used from now on.
```bash
cd mini-source-sdk/sdk2013-mp/src/
```
At this time you should now recursively git clone the VPhysics-Jolt repository into your "src" directory.
```bash
git clone --recursive https://github.com/Joshua-Ashton/VPhysics-Jolt.git vphysics_jolt
```
<strong>From this point onward, please follow the rest of the guide specific to your chosen build platform. The current working directory is also assumed to be `mini-source-sdk/sdk2013-mp/src/` and should be adjusted to suit your own build if need be.</strong>
## Windows
Continuing on Windows, be sure you have both [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) and the [Windows 11 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/) installed on your system. (even if you run Windows 10 the SDK still applies)
### CLI
The next step is to run the fix registry script (as administrator). You can just Right-Click -> 'Run As Administrator' the `fix_registry.bat` file located in `mini-source-sdk/sdk2013-mp/src/`. If your command prompt or powershell instance are already running under administrator you can run the script from there:
```bash
.\fix_registry.bat
```
This is the final command to run before the CLI portion of this guide ends. It will generate your [Visual Studio](https://visualstudio.microsoft.com/vs/) project/solution file(s). (You may also just Double-Click the file `createjoltprojects.bat`)
```bash
.\createjoltprojects.bat
```
### Visual Studio
After running `createjoltprojects.bat` you should now have a file named `jolt.sln`. Open it. After opening, building should be simple. Press the shortcut `Ctrl+Shift+B` *OR* find the `Solution 'jolt'` bar in the Solution explorer window and Right-Click -> `Build Solution`.
Congratulations!
The built `vphysics_jolt.dll` file should now be located in `mini-source-sdk/sdk2013-mp/game/bin/`.
### Build errors
Common build errors you may run into building on Windows and their solutions.
> #### memoverride.cpp
If there is an error involving a symbol named ` size_t _msize` or `size_t __cdecl _msize_base`, it is most likely because you haven't updated your Windows SDK to the [Windows 11 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/). Please do so. If you still get this error make sure that your Visual Studio projects also default to the latest installed version if they don't already.
## Linux
Continuing on Linux, there are a few prerequisites to building regardless of distribution.
- gcc 10+
- g++ 10+
- gcc-multilib
- g++-multilib
- make
### Debian/Ubuntu
###### Note: Certain versions may also require version explicit packages (gcc/g++ 10 may not be the default installed version).
Before we continue building project files, lets get our dependencies out of the way.
Install the `build-essential` group to get common developer packages such as gcc, g++, and make, which are included.
```bash
sudo apt install build-essential
```
After installing the build-essential group packages, we now need to install the x86 dependencies.
```bash
sudo apt install gcc-multilib g++-multilib
```
The next step is to build our makefiles by running the premade script `createjoltprojects.sh`
```bash
./createjoltprojects.sh
```
Once the script has finished running you should now have a file name `jolt.mak` in the current directory. Verify you do and now run it with the command below. This command automatically will (and is recommended to) use all available CPU threads. If you want to specify it yourself, replace `$(nproc)` with a number less than or equal to your max number of threads. To be clear, this only affects compile speed.
```bash
make -j $(nproc) -f jolt.mak
```
Alternative example...
```bash
make -j 8 -f jolt.mak
```
Congratulations!
If the console outputs `LINKING` *and* `COPYING TO` messages, that means your build was successful and you may retrieve your `vphysics_jolt.so` and `vphysics_jolt_srv.so` files which will be located in `mini-source-sdk/sdk2013-mp/game/bin/`.
### Build errors (distribution independent)
Common build errors you may run into building on Linux and their solutions.
> #### error: unrecognized command line option -std=gnu++20; did you mean -std=gnu++2a? (make: *** [jolt.mak:28: all] Error 2)
This error is caused because the compile was not started with gcc/g++ v10 or higher. Please update.
## OSX
Unsupported.
¯\\\_(ツ)\_/¯

View File

@ -1,416 +0,0 @@
//-----------------------------------------------------------------------------
// JOLTPHYSICS.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro SRCDIR "..\.."
$Macro OUTLIBNAME "joltphysics"
$Include "$SRCDIR\vpc_scripts\source_lib_base.vpc"
$Include "joltphysics_settings.vpc"
$Configuration
{
$Compiler
{
$Create/UsePrecompiledHeader "Use Precompiled Header (/Yu)"
$Create/UsePCHThroughFile "Jolt/Jolt.h"
}
}
$Project "JoltPhysics"
{
$Folder "Precompiled Header"
{
$File "pch.cpp"
{
$Configuration
{
$Compiler
{
$Create/UsePrecompiledHeader "Create Precompiled Header (/Yc)"
}
}
}
}
$Folder "Source Files"
{
$File "src\Jolt\AABBTree\AABBTreeBuilder.cpp"
$File "src\Jolt\AABBTree\AABBTreeBuilder.h"
$File "src\Jolt\AABBTree\AABBTreeToBuffer.h"
$File "src\Jolt\AABBTree\NodeCodec\NodeCodecQuadTreeHalfFloat.h"
$File "src\Jolt\AABBTree\TriangleCodec\TriangleCodecIndexed8BitPackSOA4Flags.h"
$File "src\Jolt\Core\Atomics.h"
$File "src\Jolt\Core\ByteBuffer.h"
$File "src\Jolt\Core\Color.cpp"
$File "src\Jolt\Core\Color.h"
$File "src\Jolt\Core\Core.h"
$File "src\Jolt\Core\Factory.cpp"
$File "src\Jolt\Core\Factory.h"
$File "src\Jolt\Core\FixedSizeFreeList.h"
$File "src\Jolt\Core\FixedSizeFreeList.inl"
$File "src\Jolt\Core\FPControlWord.h"
$File "src\Jolt\Core\FPException.h"
$File "src\Jolt\Core\FPFlushDenormals.h"
$File "src\Jolt\Core\HashCombine.h"
$File "src\Jolt\Core\IssueReporting.cpp"
$File "src\Jolt\Core\IssueReporting.h"
$File "src\Jolt\Core\JobSystem.h"
$File "src\Jolt\Core\JobSystem.inl"
$File "src\Jolt\Core\JobSystemThreadPool.cpp"
$File "src\Jolt\Core\JobSystemThreadPool.h"
$File "src\Jolt\Core\LinearCurve.cpp"
$File "src\Jolt\Core\LinearCurve.h"
$File "src\Jolt\Core\LockFreeHashMap.h"
$File "src\Jolt\Core\LockFreeHashMap.inl"
$File "src\Jolt\Core\Memory.cpp"
$File "src\Jolt\Core\Memory.h"
$File "src\Jolt\Core\Mutex.h"
$File "src\Jolt\Core\MutexArray.h"
$File "src\Jolt\Core\NonCopyable.h"
$File "src\Jolt\Core\Profiler.cpp"
$File "src\Jolt\Core\Profiler.h"
$File "src\Jolt\Core\Profiler.inl"
$File "src\Jolt\Core\Reference.h"
$File "src\Jolt\Core\Result.h"
$File "src\Jolt\Core\RTTI.cpp"
$File "src\Jolt\Core\RTTI.h"
$File "src\Jolt\Core\StaticArray.h"
$File "src\Jolt\Core\StreamIn.h"
$File "src\Jolt\Core\StreamOut.h"
$File "src\Jolt\Core\StreamWrapper.h"
$File "src\Jolt\Core\StringTools.cpp"
$File "src\Jolt\Core\StringTools.h"
$File "src\Jolt\Core\TempAllocator.h"
$File "src\Jolt\Core\TickCounter.cpp"
$File "src\Jolt\Core\TickCounter.h"
$File "src\Jolt\Geometry\AABox.h"
$File "src\Jolt\Geometry\AABox4.h"
$File "src\Jolt\Geometry\ClipPoly.h"
$File "src\Jolt\Geometry\ClosestPoint.h"
$File "src\Jolt\Geometry\ConvexHullBuilder.cpp"
$File "src\Jolt\Geometry\ConvexHullBuilder.h"
$File "src\Jolt\Geometry\ConvexHullBuilder2D.cpp"
$File "src\Jolt\Geometry\ConvexHullBuilder2D.h"
$File "src\Jolt\Geometry\ConvexSupport.h"
$File "src\Jolt\Geometry\Ellipse.h"
$File "src\Jolt\Geometry\EPAConvexHullBuilder.h"
$File "src\Jolt\Geometry\EPAPenetrationDepth.h"
$File "src\Jolt\Geometry\GJKClosestPoint.h"
$File "src\Jolt\Geometry\IndexedTriangle.h"
$File "src\Jolt\Geometry\Indexify.cpp"
$File "src\Jolt\Geometry\Indexify.h"
$File "src\Jolt\Geometry\MortonCode.h"
$File "src\Jolt\Geometry\OrientedBox.cpp"
$File "src\Jolt\Geometry\OrientedBox.h"
$File "src\Jolt\Geometry\Plane.h"
$File "src\Jolt\Geometry\RayAABox.h"
$File "src\Jolt\Geometry\RayAABox8.h"
$File "src\Jolt\Geometry\RayCapsule.h"
$File "src\Jolt\Geometry\RayCylinder.h"
$File "src\Jolt\Geometry\RaySphere.h"
$File "src\Jolt\Geometry\RayTriangle.h"
$File "src\Jolt\Geometry\RayTriangle8.h"
$File "src\Jolt\Geometry\Sphere.h"
$File "src\Jolt\Geometry\Triangle.h"
$File "src\Jolt\Jolt.h"
$File "src\Jolt\Math\DVec3.h"
$File "src\Jolt\Math\DVec3.inl"
$File "src\Jolt\Math\EigenValueSymmetric.h"
$File "src\Jolt\Math\FindRoot.h"
$File "src\Jolt\Math\Float2.h"
$File "src\Jolt\Math\Float3.h"
$File "src\Jolt\Math\Float4.h"
$File "src\Jolt\Math\GaussianElimination.h"
$File "src\Jolt\Math\HalfFloat.h"
$File "src\Jolt\Math\Mat44.h"
$File "src\Jolt\Math\Mat44.inl"
$File "src\Jolt\Math\Math.h"
$File "src\Jolt\Math\MathTypes.h"
$File "src\Jolt\Math\Matrix.h"
$File "src\Jolt\Math\Quat.h"
$File "src\Jolt\Math\Quat.inl"
$File "src\Jolt\Math\Swizzle.h"
$File "src\Jolt\Math\UVec4.cpp"
$File "src\Jolt\Math\UVec4.h"
$File "src\Jolt\Math\UVec4.inl"
$File "src\Jolt\Math\UVec8.h"
$File "src\Jolt\Math\UVec8.inl"
$File "src\Jolt\Math\Vec3.cpp"
$File "src\Jolt\Math\Vec3.h"
$File "src\Jolt\Math\Vec3.inl"
$File "src\Jolt\Math\Vec4.h"
$File "src\Jolt\Math\Vec4.inl"
$File "src\Jolt\Math\Vec8.h"
$File "src\Jolt\Math\Vec8.inl"
$File "src\Jolt\Math\Vector.h"
$File "src\Jolt\ObjectStream\GetPrimitiveTypeOfType.h"
$File "src\Jolt\ObjectStream\ObjectStream.cpp"
$File "src\Jolt\ObjectStream\ObjectStream.h"
$File "src\Jolt\ObjectStream\ObjectStreamBinaryIn.cpp"
$File "src\Jolt\ObjectStream\ObjectStreamBinaryIn.h"
$File "src\Jolt\ObjectStream\ObjectStreamBinaryOut.cpp"
$File "src\Jolt\ObjectStream\ObjectStreamBinaryOut.h"
$File "src\Jolt\ObjectStream\ObjectStreamIn.cpp"
$File "src\Jolt\ObjectStream\ObjectStreamIn.h"
$File "src\Jolt\ObjectStream\ObjectStreamOut.cpp"
$File "src\Jolt\ObjectStream\ObjectStreamOut.h"
$File "src\Jolt\ObjectStream\ObjectStreamTextIn.cpp"
$File "src\Jolt\ObjectStream\ObjectStreamTextIn.h"
$File "src\Jolt\ObjectStream\ObjectStreamTextOut.cpp"
$File "src\Jolt\ObjectStream\ObjectStreamTextOut.h"
$File "src\Jolt\ObjectStream\ObjectStreamTypes.h"
$File "src\Jolt\ObjectStream\SerializableAttribute.h"
$File "src\Jolt\ObjectStream\SerializableAttributeEnum.h"
$File "src\Jolt\ObjectStream\SerializableAttributeTyped.h"
$File "src\Jolt\ObjectStream\SerializableObject.cpp"
$File "src\Jolt\ObjectStream\SerializableObject.h"
$File "src\Jolt\ObjectStream\TypeDeclarations.cpp"
$File "src\Jolt\ObjectStream\TypeDeclarations.h"
$File "src\Jolt\Physics\Body\Body.cpp"
$File "src\Jolt\Physics\Body\Body.h"
$File "src\Jolt\Physics\Body\Body.inl"
$File "src\Jolt\Physics\Body\BodyAccess.cpp"
$File "src\Jolt\Physics\Body\BodyAccess.h"
$File "src\Jolt\Physics\Body\BodyActivationListener.h"
$File "src\Jolt\Physics\Body\BodyCreationSettings.cpp"
$File "src\Jolt\Physics\Body\BodyCreationSettings.h"
$File "src\Jolt\Physics\Body\BodyFilter.h"
$File "src\Jolt\Physics\Body\BodyID.h"
$File "src\Jolt\Physics\Body\BodyInterface.cpp"
$File "src\Jolt\Physics\Body\BodyInterface.h"
$File "src\Jolt\Physics\Body\BodyLock.h"
$File "src\Jolt\Physics\Body\BodyLockInterface.h"
$File "src\Jolt\Physics\Body\BodyLockMulti.h"
$File "src\Jolt\Physics\Body\BodyManager.cpp"
$File "src\Jolt\Physics\Body\BodyManager.h"
$File "src\Jolt\Physics\Body\BodyPair.h"
$File "src\Jolt\Physics\Body\MassProperties.cpp"
$File "src\Jolt\Physics\Body\MassProperties.h"
$File "src\Jolt\Physics\Body\MotionProperties.cpp"
$File "src\Jolt\Physics\Body\MotionProperties.h"
$File "src\Jolt\Physics\Body\MotionProperties.inl"
$File "src\Jolt\Physics\Body\MotionQuality.h"
$File "src\Jolt\Physics\Body\MotionType.h"
$File "src\Jolt\Physics\Character\Character.cpp"
$File "src\Jolt\Physics\Character\Character.h"
$File "src\Jolt\Physics\Collision\AABoxCast.h"
$File "src\Jolt\Physics\Collision\ActiveEdgeMode.h"
$File "src\Jolt\Physics\Collision\ActiveEdges.h"
$File "src\Jolt\Physics\Collision\BackFaceMode.h"
$File "src\Jolt\Physics\Collision\BroadPhase\BroadPhase.cpp"
$File "src\Jolt\Physics\Collision\BroadPhase\BroadPhase.h"
$File "src\Jolt\Physics\Collision\BroadPhase\BroadPhaseBruteForce.cpp"
$File "src\Jolt\Physics\Collision\BroadPhase\BroadPhaseBruteForce.h"
$File "src\Jolt\Physics\Collision\BroadPhase\BroadPhaseLayer.h"
$File "src\Jolt\Physics\Collision\BroadPhase\BroadPhaseQuadTree.cpp"
$File "src\Jolt\Physics\Collision\BroadPhase\BroadPhaseQuadTree.h"
$File "src\Jolt\Physics\Collision\BroadPhase\BroadPhaseQuery.h"
$File "src\Jolt\Physics\Collision\BroadPhase\QuadTree.cpp"
$File "src\Jolt\Physics\Collision\BroadPhase\QuadTree.h"
$File "src\Jolt\Physics\Collision\CastConvexVsTriangles.cpp"
$File "src\Jolt\Physics\Collision\CastConvexVsTriangles.h"
$File "src\Jolt\Physics\Collision\CastSphereVsTriangles.cpp"
$File "src\Jolt\Physics\Collision\CastSphereVsTriangles.h"
$File "src\Jolt\Physics\Collision\CastResult.h"
$File "src\Jolt\Physics\Collision\CollectFacesMode.h"
$File "src\Jolt\Physics\Collision\CollideConvexVsTriangles.cpp"
$File "src\Jolt\Physics\Collision\CollideConvexVsTriangles.h"
$File "src\Jolt\Physics\Collision\CollidePointResult.h"
$File "src\Jolt\Physics\Collision\CollideShape.h"
$File "src\Jolt\Physics\Collision\CollideSphereVsTriangles.cpp"
$File "src\Jolt\Physics\Collision\CollideSphereVsTriangles.h"
$File "src\Jolt\Physics\Collision\CollisionCollector.h"
$File "src\Jolt\Physics\Collision\CollisionCollectorImpl.h"
$File "src\Jolt\Physics\Collision\CollisionDispatch.cpp"
$File "src\Jolt\Physics\Collision\CollisionDispatch.h"
$File "src\Jolt\Physics\Collision\CollisionGroup.cpp"
$File "src\Jolt\Physics\Collision\CollisionGroup.h"
$File "src\Jolt\Physics\Collision\ContactListener.h"
$File "src\Jolt\Physics\Collision\GroupFilter.cpp"
$File "src\Jolt\Physics\Collision\GroupFilter.h"
$File "src\Jolt\Physics\Collision\GroupFilterTable.cpp"
$File "src\Jolt\Physics\Collision\GroupFilterTable.h"
$File "src\Jolt\Physics\Collision\ManifoldBetweenTwoFaces.cpp"
$File "src\Jolt\Physics\Collision\ManifoldBetweenTwoFaces.h"
$File "src\Jolt\Physics\Collision\NarrowPhaseQuery.cpp"
$File "src\Jolt\Physics\Collision\NarrowPhaseQuery.h"
$File "src\Jolt\Physics\Collision\NarrowPhaseStats.cpp"
$File "src\Jolt\Physics\Collision\NarrowPhaseStats.h"
$File "src\Jolt\Physics\Collision\ObjectLayer.h"
$File "src\Jolt\Physics\Collision\PhysicsMaterial.cpp"
$File "src\Jolt\Physics\Collision\PhysicsMaterial.h"
$File "src\Jolt\Physics\Collision\PhysicsMaterialSimple.cpp"
$File "src\Jolt\Physics\Collision\PhysicsMaterialSimple.h"
$File "src\Jolt\Physics\Collision\RayCast.h"
$File "src\Jolt\Physics\Collision\Shape\BoxShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\BoxShape.h"
$File "src\Jolt\Physics\Collision\Shape\CapsuleShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\CapsuleShape.h"
$File "src\Jolt\Physics\Collision\Shape\CompoundShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\CompoundShape.h"
$File "src\Jolt\Physics\Collision\Shape\CompoundShapeVisitors.h"
$File "src\Jolt\Physics\Collision\Shape\ConvexHullShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\ConvexHullShape.h"
$File "src\Jolt\Physics\Collision\Shape\ConvexShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\ConvexShape.h"
$File "src\Jolt\Physics\Collision\Shape\CylinderShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\CylinderShape.h"
$File "src\Jolt\Physics\Collision\Shape\DecoratedShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\DecoratedShape.h"
$File "src\Jolt\Physics\Collision\Shape\GetTrianglesContext.h"
$File "src\Jolt\Physics\Collision\Shape\HeightFieldShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\HeightFieldShape.h"
$File "src\Jolt\Physics\Collision\Shape\MeshShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\MeshShape.h"
$File "src\Jolt\Physics\Collision\Shape\MutableCompoundShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\MutableCompoundShape.h"
$File "src\Jolt\Physics\Collision\Shape\OffsetCenterOfMassShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\OffsetCenterOfMassShape.h"
$File "src\Jolt\Physics\Collision\Shape\PolyhedronSubmergedVolumeCalculator.h"
$File "src\Jolt\Physics\Collision\Shape\RotatedTranslatedShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\RotatedTranslatedShape.h"
$File "src\Jolt\Physics\Collision\Shape\ScaledShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\ScaledShape.h"
$File "src\Jolt\Physics\Collision\Shape\ScaleHelpers.h"
$File "src\Jolt\Physics\Collision\Shape\Shape.cpp"
$File "src\Jolt\Physics\Collision\Shape\Shape.h"
$File "src\Jolt\Physics\Collision\Shape\SphereShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\SphereShape.h"
$File "src\Jolt\Physics\Collision\Shape\StaticCompoundShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\StaticCompoundShape.h"
$File "src\Jolt\Physics\Collision\Shape\SubShapeID.h"
$File "src\Jolt\Physics\Collision\Shape\SubShapeIDPair.h"
$File "src\Jolt\Physics\Collision\Shape\TaperedCapsuleShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\TaperedCapsuleShape.gliffy"
$File "src\Jolt\Physics\Collision\Shape\TaperedCapsuleShape.h"
$File "src\Jolt\Physics\Collision\Shape\TriangleShape.cpp"
$File "src\Jolt\Physics\Collision\Shape\TriangleShape.h"
$File "src\Jolt\Physics\Collision\ShapeCast.h"
$File "src\Jolt\Physics\Collision\ShapeFilter.h"
$File "src\Jolt\Physics\Collision\SortReverseAndStore.h"
$File "src\Jolt\Physics\Collision\TransformedShape.cpp"
$File "src\Jolt\Physics\Collision\TransformedShape.h"
$File "src\Jolt\Physics\Constraints\ConeConstraint.cpp"
$File "src\Jolt\Physics\Constraints\ConeConstraint.h"
$File "src\Jolt\Physics\Constraints\Constraint.cpp"
$File "src\Jolt\Physics\Constraints\Constraint.h"
$File "src\Jolt\Physics\Constraints\ConstraintManager.cpp"
$File "src\Jolt\Physics\Constraints\ConstraintManager.h"
$File "src\Jolt\Physics\Constraints\ConstraintPart\AngleConstraintPart.h"
$File "src\Jolt\Physics\Constraints\ConstraintPart\AxisConstraintPart.h"
$File "src\Jolt\Physics\Constraints\ConstraintPart\DualAxisConstraintPart.h"
$File "src\Jolt\Physics\Constraints\ConstraintPart\GearConstraintPart.h"
$File "src\Jolt\Physics\Constraints\ConstraintPart\HingeRotationConstraintPart.h"
$File "src\Jolt\Physics\Constraints\ConstraintPart\PointConstraintPart.h"
$File "src\Jolt\Physics\Constraints\ConstraintPart\RackAndPinionConstraintPart.h"
$File "src\Jolt\Physics\Constraints\ConstraintPart\RotationEulerConstraintPart.h"
$File "src\Jolt\Physics\Constraints\ConstraintPart\RotationQuatConstraintPart.h"
$File "src\Jolt\Physics\Constraints\ConstraintPart\SpringPart.h"
$File "src\Jolt\Physics\Constraints\ConstraintPart\SwingTwistConstraintPart.h"
$File "src\Jolt\Physics\Constraints\ContactConstraintManager.cpp"
$File "src\Jolt\Physics\Constraints\ContactConstraintManager.h"
$File "src\Jolt\Physics\Constraints\DistanceConstraint.cpp"
$File "src\Jolt\Physics\Constraints\DistanceConstraint.h"
$File "src\Jolt\Physics\Constraints\FixedConstraint.cpp"
$File "src\Jolt\Physics\Constraints\FixedConstraint.h"
$File "src\Jolt\Physics\Constraints\GearConstraint.cpp"
$File "src\Jolt\Physics\Constraints\GearConstraint.h"
$File "src\Jolt\Physics\Constraints\HingeConstraint.cpp"
$File "src\Jolt\Physics\Constraints\HingeConstraint.h"
$File "src\Jolt\Physics\Constraints\MotorSettings.cpp"
$File "src\Jolt\Physics\Constraints\MotorSettings.h"
$File "src\Jolt\Physics\Constraints\PathConstraint.cpp"
$File "src\Jolt\Physics\Constraints\PathConstraint.h"
$File "src\Jolt\Physics\Constraints\PathConstraintPath.cpp"
$File "src\Jolt\Physics\Constraints\PathConstraintPath.h"
$File "src\Jolt\Physics\Constraints\PathConstraintPathHermite.cpp"
$File "src\Jolt\Physics\Constraints\PathConstraintPathHermite.h"
$File "src\Jolt\Physics\Constraints\PointConstraint.cpp"
$File "src\Jolt\Physics\Constraints\PointConstraint.h"
$File "src\Jolt\Physics\Constraints\RackAndPinionConstraint.cpp"
$File "src\Jolt\Physics\Constraints\RackAndPinionConstraint.h"
$File "src\Jolt\Physics\Constraints\SixDOFConstraint.cpp"
$File "src\Jolt\Physics\Constraints\SixDOFConstraint.h"
$File "src\Jolt\Physics\Constraints\SliderConstraint.cpp"
$File "src\Jolt\Physics\Constraints\SliderConstraint.h"
$File "src\Jolt\Physics\Constraints\SwingTwistConstraint.cpp"
$File "src\Jolt\Physics\Constraints\SwingTwistConstraint.h"
$File "src\Jolt\Physics\Constraints\TwoBodyConstraint.cpp"
$File "src\Jolt\Physics\Constraints\TwoBodyConstraint.h"
$File "src\Jolt\Physics\EActivation.h"
$File "src\Jolt\Physics\IslandBuilder.cpp"
$File "src\Jolt\Physics\IslandBuilder.h"
$File "src\Jolt\Physics\PhysicsLock.cpp"
$File "src\Jolt\Physics\PhysicsLock.h"
$File "src\Jolt\Physics\PhysicsScene.cpp"
$File "src\Jolt\Physics\PhysicsScene.h"
$File "src\Jolt\Physics\PhysicsSettings.h"
$File "src\Jolt\Physics\PhysicsStepListener.h"
$File "src\Jolt\Physics\PhysicsSystem.cpp"
$File "src\Jolt\Physics\PhysicsSystem.h"
$File "src\Jolt\Physics\PhysicsUpdateContext.cpp"
$File "src\Jolt\Physics\PhysicsUpdateContext.h"
$File "src\Jolt\Physics\Ragdoll\Ragdoll.cpp"
$File "src\Jolt\Physics\Ragdoll\Ragdoll.h"
$File "src\Jolt\Physics\StateRecorder.h"
$File "src\Jolt\Physics\StateRecorderImpl.cpp"
$File "src\Jolt\Physics\StateRecorderImpl.h"
$File "src\Jolt\Physics\Vehicle\TrackedVehicleController.cpp"
$File "src\Jolt\Physics\Vehicle\TrackedVehicleController.h"
$File "src\Jolt\Physics\Vehicle\VehicleAntiRollBar.cpp"
$File "src\Jolt\Physics\Vehicle\VehicleAntiRollBar.h"
$File "src\Jolt\Physics\Vehicle\VehicleCollisionTester.cpp"
$File "src\Jolt\Physics\Vehicle\VehicleCollisionTester.h"
$File "src\Jolt\Physics\Vehicle\VehicleConstraint.cpp"
$File "src\Jolt\Physics\Vehicle\VehicleConstraint.h"
$File "src\Jolt\Physics\Vehicle\VehicleController.cpp"
$File "src\Jolt\Physics\Vehicle\VehicleController.h"
$File "src\Jolt\Physics\Vehicle\VehicleDifferential.cpp"
$File "src\Jolt\Physics\Vehicle\VehicleDifferential.h"
$File "src\Jolt\Physics\Vehicle\VehicleEngine.cpp"
$File "src\Jolt\Physics\Vehicle\VehicleEngine.h"
$File "src\Jolt\Physics\Vehicle\VehicleTrack.cpp"
$File "src\Jolt\Physics\Vehicle\VehicleTrack.h"
$File "src\Jolt\Physics\Vehicle\VehicleTransmission.cpp"
$File "src\Jolt\Physics\Vehicle\VehicleTransmission.h"
$File "src\Jolt\Physics\Vehicle\Wheel.cpp"
$File "src\Jolt\Physics\Vehicle\Wheel.h"
$File "src\Jolt\Physics\Vehicle\WheeledVehicleController.cpp"
$File "src\Jolt\Physics\Vehicle\WheeledVehicleController.h"
$File "src\Jolt\RegisterTypes.cpp"
$File "src\Jolt\RegisterTypes.h"
$File "src\Jolt\Renderer\DebugRenderer.cpp"
$File "src\Jolt\Renderer\DebugRenderer.h"
$File "src\Jolt\Renderer\DebugRendererPlayback.cpp"
$File "src\Jolt\Renderer\DebugRendererPlayback.h"
$File "src\Jolt\Renderer\DebugRendererRecorder.cpp"
$File "src\Jolt\Renderer\DebugRendererRecorder.h"
$File "src\Jolt\Skeleton\SkeletalAnimation.cpp"
$File "src\Jolt\Skeleton\SkeletalAnimation.h"
$File "src\Jolt\Skeleton\Skeleton.cpp"
$File "src\Jolt\Skeleton\Skeleton.h"
$File "src\Jolt\Skeleton\SkeletonPose.cpp"
$File "src\Jolt\Skeleton\SkeletonPose.h"
$File "src\Jolt\TriangleGrouper\TriangleGrouper.h"
$File "src\Jolt\TriangleGrouper\TriangleGrouperClosestCentroid.cpp"
$File "src\Jolt\TriangleGrouper\TriangleGrouperClosestCentroid.h"
$File "src\Jolt\TriangleGrouper\TriangleGrouperMorton.cpp"
$File "src\Jolt\TriangleGrouper\TriangleGrouperMorton.h"
$File "src\Jolt\TriangleSplitter\TriangleSplitter.cpp"
$File "src\Jolt\TriangleSplitter\TriangleSplitter.h"
$File "src\Jolt\TriangleSplitter\TriangleSplitterBinning.cpp"
$File "src\Jolt\TriangleSplitter\TriangleSplitterBinning.h"
$File "src\Jolt\TriangleSplitter\TriangleSplitterFixedLeafSize.cpp"
$File "src\Jolt\TriangleSplitter\TriangleSplitterFixedLeafSize.h"
$File "src\Jolt\TriangleSplitter\TriangleSplitterLongestAxis.cpp"
$File "src\Jolt\TriangleSplitter\TriangleSplitterLongestAxis.h"
$File "src\Jolt\TriangleSplitter\TriangleSplitterMean.cpp"
$File "src\Jolt\TriangleSplitter\TriangleSplitterMean.h"
$File "src\Jolt\TriangleSplitter\TriangleSplitterMorton.cpp"
$File "src\Jolt\TriangleSplitter\TriangleSplitterMorton.h"
}
}

View File

@ -1,9 +1,12 @@
//-----------------------------------------------------------------------------
// VPHYSICS_JOLT_STATIC.VPC
// JOLTPHYSICS_AVX2.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro PROJNAME "vphysics_jolt_static"
$Macro PROJNAME "joltphysics_avx2"
$Include "vphysics_jolt_inc.vpc"
$Conditional VOLT_AVX2 "1"
$Macro VOLTARCH "AVX2"
$Include "joltphysics_inc.vpc"

View File

@ -0,0 +1,471 @@
//-----------------------------------------------------------------------------
// JOLTPHYSICS.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro SRCDIR "..\.."
$Macro OUTLIBNAME "$PROJNAME"
$Include "$SRCDIR\vpc_scripts\source_lib_base.vpc"
$Include "joltphysics_settings.vpc"
$Configuration
{
$Compiler
{
$Create/UsePrecompiledHeader "Use Precompiled Header (/Yu)"
$Create/UsePCHThroughFile "Jolt/Jolt.h"
}
}
$Configuration "Debug"
{
$General
{
//$OutputDirectory ".\Debug_$VOLTARCH$PLATSUBDIR" [$WINDOWS]
$IntermediateDirectory ".\Debug_$VOLTARCH$PLATSUBDIR" [$WINDOWS]
}
}
$Configuration "Release"
{
$General
{
//$OutputDirectory ".\Release_$VOLTARCH$PLATSUBDIR" [$WINDOWS]
$IntermediateDirectory ".\Release_$VOLTARCH$PLATSUBDIR" [$WINDOWS]
}
}
$Macro JOLT_PHYSICS_ROOT "src/Jolt"
$Project "$PROJNAME"
{
$Folder "Precompiled Header"
{
$File "pch.cpp"
{
$Configuration
{
$Compiler
{
$Create/UsePrecompiledHeader "Create Precompiled Header (/Yc)"
}
}
}
}
$Folder "Source Files"
{
$File "$JOLT_PHYSICS_ROOT/AABBTree/AABBTreeBuilder.cpp"
$File "$JOLT_PHYSICS_ROOT/AABBTree/AABBTreeBuilder.h"
$File "$JOLT_PHYSICS_ROOT/AABBTree/AABBTreeToBuffer.h"
$File "$JOLT_PHYSICS_ROOT/AABBTree/NodeCodec/NodeCodecQuadTreeHalfFloat.h"
$File "$JOLT_PHYSICS_ROOT/AABBTree/TriangleCodec/TriangleCodecIndexed8BitPackSOA4Flags.h"
$File "$JOLT_PHYSICS_ROOT/Core/ARMNeon.h"
$File "$JOLT_PHYSICS_ROOT/Core/Atomics.h"
$File "$JOLT_PHYSICS_ROOT/Core/ByteBuffer.h"
$File "$JOLT_PHYSICS_ROOT/Core/Color.cpp"
$File "$JOLT_PHYSICS_ROOT/Core/Color.h"
$File "$JOLT_PHYSICS_ROOT/Core/Core.h"
$File "$JOLT_PHYSICS_ROOT/Core/Factory.cpp"
$File "$JOLT_PHYSICS_ROOT/Core/Factory.h"
$File "$JOLT_PHYSICS_ROOT/Core/FixedSizeFreeList.h"
$File "$JOLT_PHYSICS_ROOT/Core/FixedSizeFreeList.inl"
$File "$JOLT_PHYSICS_ROOT/Core/FPControlWord.h"
$File "$JOLT_PHYSICS_ROOT/Core/FPException.h"
$File "$JOLT_PHYSICS_ROOT/Core/FPFlushDenormals.h"
$File "$JOLT_PHYSICS_ROOT/Core/HashCombine.h"
$File "$JOLT_PHYSICS_ROOT/Core/InsertionSort.h"
$File "$JOLT_PHYSICS_ROOT/Core/IssueReporting.cpp"
$File "$JOLT_PHYSICS_ROOT/Core/IssueReporting.h"
$File "$JOLT_PHYSICS_ROOT/Core/JobSystem.h"
$File "$JOLT_PHYSICS_ROOT/Core/JobSystem.inl"
$File "$JOLT_PHYSICS_ROOT/Core/JobSystemThreadPool.cpp"
$File "$JOLT_PHYSICS_ROOT/Core/JobSystemThreadPool.h"
$File "$JOLT_PHYSICS_ROOT/Core/JobSystemWithBarrier.cpp"
$File "$JOLT_PHYSICS_ROOT/Core/JobSystemWithBarrier.h"
$File "$JOLT_PHYSICS_ROOT/Core/LinearCurve.cpp"
$File "$JOLT_PHYSICS_ROOT/Core/LinearCurve.h"
$File "$JOLT_PHYSICS_ROOT/Core/LockFreeHashMap.h"
$File "$JOLT_PHYSICS_ROOT/Core/LockFreeHashMap.inl"
$File "$JOLT_PHYSICS_ROOT/Core/Memory.cpp"
$File "$JOLT_PHYSICS_ROOT/Core/Memory.h"
$File "$JOLT_PHYSICS_ROOT/Core/Mutex.h"
$File "$JOLT_PHYSICS_ROOT/Core/MutexArray.h"
$File "$JOLT_PHYSICS_ROOT/Core/NonCopyable.h"
$File "$JOLT_PHYSICS_ROOT/Core/Profiler.cpp"
$File "$JOLT_PHYSICS_ROOT/Core/Profiler.h"
$File "$JOLT_PHYSICS_ROOT/Core/Profiler.inl"
$File "$JOLT_PHYSICS_ROOT/Core/QuickSort.h"
$File "$JOLT_PHYSICS_ROOT/Core/Reference.h"
$File "$JOLT_PHYSICS_ROOT/Core/Result.h"
$File "$JOLT_PHYSICS_ROOT/Core/RTTI.cpp"
$File "$JOLT_PHYSICS_ROOT/Core/RTTI.h"
$File "$JOLT_PHYSICS_ROOT/Core/Semaphore.cpp"
$File "$JOLT_PHYSICS_ROOT/Core/Semaphore.h"
$File "$JOLT_PHYSICS_ROOT/Core/StaticArray.h"
$File "$JOLT_PHYSICS_ROOT/Core/StreamIn.h"
$File "$JOLT_PHYSICS_ROOT/Core/StreamOut.h"
$File "$JOLT_PHYSICS_ROOT/Core/StreamWrapper.h"
$File "$JOLT_PHYSICS_ROOT/Core/StringTools.cpp"
$File "$JOLT_PHYSICS_ROOT/Core/StringTools.h"
$File "$JOLT_PHYSICS_ROOT/Core/STLAlignedAllocator.h"
$File "$JOLT_PHYSICS_ROOT/Core/STLAllocator.h"
$File "$JOLT_PHYSICS_ROOT/Core/STLTempAllocator.h"
$File "$JOLT_PHYSICS_ROOT/Core/TempAllocator.h"
$File "$JOLT_PHYSICS_ROOT/Core/TickCounter.cpp"
$File "$JOLT_PHYSICS_ROOT/Core/TickCounter.h"
$File "$JOLT_PHYSICS_ROOT/Core/UnorderedMap.h"
$File "$JOLT_PHYSICS_ROOT/Core/UnorderedSet.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/AABox.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/AABox4.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/ClipPoly.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/ClosestPoint.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/ConvexHullBuilder.cpp"
$File "$JOLT_PHYSICS_ROOT/Geometry/ConvexHullBuilder.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/ConvexHullBuilder2D.cpp"
$File "$JOLT_PHYSICS_ROOT/Geometry/ConvexHullBuilder2D.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/ConvexSupport.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/Ellipse.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/EPAConvexHullBuilder.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/EPAPenetrationDepth.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/GJKClosestPoint.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/IndexedTriangle.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/Indexify.cpp"
$File "$JOLT_PHYSICS_ROOT/Geometry/Indexify.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/MortonCode.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/OrientedBox.cpp"
$File "$JOLT_PHYSICS_ROOT/Geometry/OrientedBox.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/Plane.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/RayAABox.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/RayAABox8.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/RayCapsule.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/RayCylinder.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/RaySphere.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/RayTriangle.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/RayTriangle8.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/Sphere.h"
$File "$JOLT_PHYSICS_ROOT/Geometry/Triangle.h"
$File "$JOLT_PHYSICS_ROOT/Jolt.cmake"
$File "$JOLT_PHYSICS_ROOT/Jolt.h"
$File "$JOLT_PHYSICS_ROOT/Math/DMat44.h"
$File "$JOLT_PHYSICS_ROOT/Math/DMat44.inl"
$File "$JOLT_PHYSICS_ROOT/Math/Double3.h"
$File "$JOLT_PHYSICS_ROOT/Math/DVec3.h"
$File "$JOLT_PHYSICS_ROOT/Math/DVec3.inl"
$File "$JOLT_PHYSICS_ROOT/Math/DynMatrix.h"
$File "$JOLT_PHYSICS_ROOT/Math/EigenValueSymmetric.h"
$File "$JOLT_PHYSICS_ROOT/Math/FindRoot.h"
$File "$JOLT_PHYSICS_ROOT/Math/Float2.h"
$File "$JOLT_PHYSICS_ROOT/Math/Float3.h"
$File "$JOLT_PHYSICS_ROOT/Math/Float4.h"
$File "$JOLT_PHYSICS_ROOT/Math/GaussianElimination.h"
$File "$JOLT_PHYSICS_ROOT/Math/HalfFloat.h"
$File "$JOLT_PHYSICS_ROOT/Math/Mat44.h"
$File "$JOLT_PHYSICS_ROOT/Math/Mat44.inl"
$File "$JOLT_PHYSICS_ROOT/Math/Math.h"
$File "$JOLT_PHYSICS_ROOT/Math/MathTypes.h"
$File "$JOLT_PHYSICS_ROOT/Math/Matrix.h"
$File "$JOLT_PHYSICS_ROOT/Math/Quat.h"
$File "$JOLT_PHYSICS_ROOT/Math/Quat.inl"
$File "$JOLT_PHYSICS_ROOT/Math/Real.h"
$File "$JOLT_PHYSICS_ROOT/Math/Swizzle.h"
$File "$JOLT_PHYSICS_ROOT/Math/Trigonometry.h"
$File "$JOLT_PHYSICS_ROOT/Math/UVec4.h"
$File "$JOLT_PHYSICS_ROOT/Math/UVec4.inl"
$File "$JOLT_PHYSICS_ROOT/Math/UVec8.h"
$File "$JOLT_PHYSICS_ROOT/Math/UVec8.inl"
$File "$JOLT_PHYSICS_ROOT/Math/Vec3.cpp"
$File "$JOLT_PHYSICS_ROOT/Math/Vec3.h"
$File "$JOLT_PHYSICS_ROOT/Math/Vec3.inl"
$File "$JOLT_PHYSICS_ROOT/Math/Vec4.h"
$File "$JOLT_PHYSICS_ROOT/Math/Vec4.inl"
$File "$JOLT_PHYSICS_ROOT/Math/Vec8.h"
$File "$JOLT_PHYSICS_ROOT/Math/Vec8.inl"
$File "$JOLT_PHYSICS_ROOT/Math/Vector.h"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/GetPrimitiveTypeOfType.h"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStream.cpp"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStream.h"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStreamBinaryIn.cpp"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStreamBinaryIn.h"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStreamBinaryOut.cpp"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStreamBinaryOut.h"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStreamIn.cpp"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStreamIn.h"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStreamOut.cpp"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStreamOut.h"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStreamTextIn.cpp"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStreamTextIn.h"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStreamTextOut.cpp"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStreamTextOut.h"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/ObjectStreamTypes.h"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/SerializableAttribute.h"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/SerializableAttributeEnum.h"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/SerializableAttributeTyped.h"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/SerializableObject.cpp"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/SerializableObject.h"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/TypeDeclarations.cpp"
$File "$JOLT_PHYSICS_ROOT/ObjectStream/TypeDeclarations.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/Body.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/Body.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/Body.inl"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyAccess.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyAccess.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyActivationListener.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyCreationSettings.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyCreationSettings.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyFilter.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyID.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyInterface.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyInterface.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyLock.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyLockInterface.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyLockMulti.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyManager.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyManager.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/BodyPair.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/MassProperties.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/MassProperties.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/MotionProperties.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/MotionProperties.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/MotionProperties.inl"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/MotionQuality.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Body/MotionType.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Character/Character.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Character/Character.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Character/CharacterBase.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Character/CharacterBase.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Character/CharacterVirtual.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Character/CharacterVirtual.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/AABoxCast.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/ActiveEdgeMode.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/ActiveEdges.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/BackFaceMode.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/BroadPhase/BroadPhase.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/BroadPhase/BroadPhase.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/BroadPhase/BroadPhaseBruteForce.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/BroadPhase/BroadPhaseBruteForce.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/BroadPhase/BroadPhaseLayer.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/BroadPhase/BroadPhaseQuadTree.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/BroadPhase/BroadPhaseQuery.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/BroadPhase/QuadTree.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/BroadPhase/QuadTree.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CastConvexVsTriangles.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CastConvexVsTriangles.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CastSphereVsTriangles.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CastSphereVsTriangles.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CastResult.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CollectFacesMode.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CollideConvexVsTriangles.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CollideConvexVsTriangles.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CollidePointResult.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CollideShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CollideSphereVsTriangles.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CollideSphereVsTriangles.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CollisionCollector.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CollisionCollectorImpl.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CollisionDispatch.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CollisionDispatch.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CollisionGroup.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/CollisionGroup.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/ContactListener.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/EstimateCollisionResponse.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/EstimateCollisionResponse.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/GroupFilter.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/GroupFilter.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/GroupFilterTable.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/GroupFilterTable.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/ManifoldBetweenTwoFaces.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/ManifoldBetweenTwoFaces.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/NarrowPhaseQuery.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/NarrowPhaseQuery.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/NarrowPhaseStats.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/NarrowPhaseStats.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/ObjectLayer.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/PhysicsMaterial.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/PhysicsMaterial.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/PhysicsMaterialSimple.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/PhysicsMaterialSimple.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/RayCast.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/BoxShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/BoxShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/CapsuleShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/CapsuleShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/CompoundShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/CompoundShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/CompoundShapeVisitors.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/ConvexHullShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/ConvexHullShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/ConvexShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/ConvexShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/CylinderShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/CylinderShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/DecoratedShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/DecoratedShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/GetTrianglesContext.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/HeightFieldShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/HeightFieldShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/MeshShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/MeshShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/MutableCompoundShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/MutableCompoundShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/OffsetCenterOfMassShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/OffsetCenterOfMassShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/PolyhedronSubmergedVolumeCalculator.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/RotatedTranslatedShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/RotatedTranslatedShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/ScaledShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/ScaledShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/ScaleHelpers.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/Shape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/Shape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/SphereShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/SphereShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/StaticCompoundShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/StaticCompoundShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/SubShapeID.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/SubShapeIDPair.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/TaperedCapsuleShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/TaperedCapsuleShape.gliffy"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/TaperedCapsuleShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/TriangleShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/Shape/TriangleShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/ShapeCast.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/ShapeFilter.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/SortReverseAndStore.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/TransformedShape.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Collision/TransformedShape.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConeConstraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConeConstraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/Constraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/Constraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConstraintManager.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConstraintManager.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConstraintPart/AngleConstraintPart.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConstraintPart/AxisConstraintPart.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConstraintPart/DualAxisConstraintPart.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConstraintPart/GearConstraintPart.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConstraintPart/HingeRotationConstraintPart.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConstraintPart/IndependentAxisConstraintPart.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConstraintPart/PointConstraintPart.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConstraintPart/RackAndPinionConstraintPart.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConstraintPart/RotationQuatConstraintPart.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConstraintPart/SpringPart.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ContactConstraintManager.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/ContactConstraintManager.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/DistanceConstraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/DistanceConstraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/FixedConstraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/FixedConstraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/GearConstraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/GearConstraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/HingeConstraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/HingeConstraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/MotorSettings.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/MotorSettings.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/PathConstraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/PathConstraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/PathConstraintPath.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/PathConstraintPath.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/PathConstraintPathHermite.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/PathConstraintPathHermite.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/PointConstraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/PointConstraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/PulleyConstraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/PulleyConstraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/RackAndPinionConstraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/RackAndPinionConstraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/SixDOFConstraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/SixDOFConstraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/SliderConstraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/SliderConstraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/SpringSettings.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/SpringSettings.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/SwingTwistConstraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/SwingTwistConstraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/TwoBodyConstraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Constraints/TwoBodyConstraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/DeterminismLog.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/DeterminismLog.h"
$File "$JOLT_PHYSICS_ROOT/Physics/EActivation.h"
$File "$JOLT_PHYSICS_ROOT/Physics/IslandBuilder.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/IslandBuilder.h"
$File "$JOLT_PHYSICS_ROOT/Physics/LargeIslandSplitter.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/LargeIslandSplitter.h"
$File "$JOLT_PHYSICS_ROOT/Physics/PhysicsLock.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/PhysicsLock.h"
$File "$JOLT_PHYSICS_ROOT/Physics/PhysicsScene.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/PhysicsScene.h"
$File "$JOLT_PHYSICS_ROOT/Physics/PhysicsSettings.h"
$File "$JOLT_PHYSICS_ROOT/Physics/PhysicsStepListener.h"
$File "$JOLT_PHYSICS_ROOT/Physics/PhysicsSystem.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/PhysicsSystem.h"
$File "$JOLT_PHYSICS_ROOT/Physics/PhysicsUpdateContext.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/PhysicsUpdateContext.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Ragdoll/Ragdoll.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Ragdoll/Ragdoll.h"
$File "$JOLT_PHYSICS_ROOT/Physics/StateRecorder.h"
$File "$JOLT_PHYSICS_ROOT/Physics/StateRecorderImpl.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/StateRecorderImpl.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/TrackedVehicleController.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/TrackedVehicleController.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleAntiRollBar.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleAntiRollBar.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleCollisionTester.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleCollisionTester.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleConstraint.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleConstraint.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleController.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleController.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleDifferential.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleDifferential.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleEngine.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleEngine.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleTrack.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleTrack.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleTransmission.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/VehicleTransmission.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/Wheel.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/Wheel.h"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/WheeledVehicleController.cpp"
$File "$JOLT_PHYSICS_ROOT/Physics/Vehicle/WheeledVehicleController.h"
$File "$JOLT_PHYSICS_ROOT/RegisterTypes.cpp"
$File "$JOLT_PHYSICS_ROOT/RegisterTypes.h"
$File "$JOLT_PHYSICS_ROOT/Renderer/DebugRenderer.cpp"
$File "$JOLT_PHYSICS_ROOT/Renderer/DebugRenderer.h"
$File "$JOLT_PHYSICS_ROOT/Renderer/DebugRendererPlayback.cpp"
$File "$JOLT_PHYSICS_ROOT/Renderer/DebugRendererPlayback.h"
$File "$JOLT_PHYSICS_ROOT/Renderer/DebugRendererRecorder.cpp"
$File "$JOLT_PHYSICS_ROOT/Renderer/DebugRendererRecorder.h"
$File "$JOLT_PHYSICS_ROOT/Skeleton/SkeletalAnimation.cpp"
$File "$JOLT_PHYSICS_ROOT/Skeleton/SkeletalAnimation.h"
$File "$JOLT_PHYSICS_ROOT/Skeleton/Skeleton.cpp"
$File "$JOLT_PHYSICS_ROOT/Skeleton/Skeleton.h"
$File "$JOLT_PHYSICS_ROOT/Skeleton/SkeletonMapper.cpp"
$File "$JOLT_PHYSICS_ROOT/Skeleton/SkeletonMapper.h"
$File "$JOLT_PHYSICS_ROOT/Skeleton/SkeletonPose.cpp"
$File "$JOLT_PHYSICS_ROOT/Skeleton/SkeletonPose.h"
$File "$JOLT_PHYSICS_ROOT/TriangleGrouper/TriangleGrouper.h"
$File "$JOLT_PHYSICS_ROOT/TriangleGrouper/TriangleGrouperClosestCentroid.cpp"
$File "$JOLT_PHYSICS_ROOT/TriangleGrouper/TriangleGrouperClosestCentroid.h"
$File "$JOLT_PHYSICS_ROOT/TriangleGrouper/TriangleGrouperMorton.cpp"
$File "$JOLT_PHYSICS_ROOT/TriangleGrouper/TriangleGrouperMorton.h"
$File "$JOLT_PHYSICS_ROOT/TriangleSplitter/TriangleSplitter.cpp"
$File "$JOLT_PHYSICS_ROOT/TriangleSplitter/TriangleSplitter.h"
$File "$JOLT_PHYSICS_ROOT/TriangleSplitter/TriangleSplitterBinning.cpp"
$File "$JOLT_PHYSICS_ROOT/TriangleSplitter/TriangleSplitterBinning.h"
$File "$JOLT_PHYSICS_ROOT/TriangleSplitter/TriangleSplitterFixedLeafSize.cpp"
$File "$JOLT_PHYSICS_ROOT/TriangleSplitter/TriangleSplitterFixedLeafSize.h"
$File "$JOLT_PHYSICS_ROOT/TriangleSplitter/TriangleSplitterLongestAxis.cpp"
$File "$JOLT_PHYSICS_ROOT/TriangleSplitter/TriangleSplitterLongestAxis.h"
$File "$JOLT_PHYSICS_ROOT/TriangleSplitter/TriangleSplitterMean.cpp"
$File "$JOLT_PHYSICS_ROOT/TriangleSplitter/TriangleSplitterMean.h"
$File "$JOLT_PHYSICS_ROOT/TriangleSplitter/TriangleSplitterMorton.cpp"
$File "$JOLT_PHYSICS_ROOT/TriangleSplitter/TriangleSplitterMorton.h"
}
}

View File

@ -2,6 +2,8 @@
// Configuration settings for Jolt Physics
//
$MacroRequired "VOLTARCH"
$Configuration
{
$Compiler
@ -11,12 +13,18 @@ $Configuration
$PreprocessorDefinitions "$BASE;JPH_DISABLE_CUSTOM_ALLOCATOR;JPH_DEBUG_RENDERER"
$PreprocessorDefinitions "$BASE;JPH_ENABLE_ASSERTS" [$DEVELOPMENT_ONLY]
//$PreprocessorDefinitions "$BASE;JPH_PROFILE_ENABLED" [$DEVELOPMENT_ONLY]
// Feature test stuff for the AVX2 build
$PreprocessorDefinitions "$BASE;JPH_USE_SSE4_1;JPH_USE_SSE4_2;JPH_USE_AVX;JPH_USE_AVX2;JPH_USE_LZCNT;JPH_USE_TZCNT;JPH_USE_F16C;JPH_USE_FMADD" [$VOLT_AVX2]
$GCC_ExtraCompilerFlags "$BASE -msse4.1 -msse4.2 -mavx2 -mlzcnt -mf16c -mfma -mbmi" [$VOLT_AVX2]
$EnableEnhancedInstructionSet "Advanced Vector Extensions 2 (/arch:AVX2)" [$VOLT_AVX2]
// Feature test stuff for the SSE 4.2 build
$PreprocessorDefinitions "$BASE;JPH_USE_SSE4_1;JPH_USE_SSE4_2" [$VOLT_SSE42]
$GCC_ExtraCompilerFlags "$BASE -msse4.1 -msse4.2" [$VOLT_SSE42]
$EnableEnhancedInstructionSet "Streaming SIMD Extensions 2 (/arch:SSE2)" [$WIN32 && $VOLT_SSE42] // Source 2013 doesn't enable this by default
// CPU feature macros, we may want to tune these before release.
$PreprocessorDefinitions "$BASE;JPH_USE_SSE4_1;JPH_USE_SSE4_2;JPH_USE_LZCNT;JPH_USE_TZCNT;JPH_USE_F16C;JPH_USE_FMADD"
// We DO want to comment this line out for release, AVX 1 & 2 adoption isn't reliable enough yet
// $EnableEnhancedInstructionSet "Advanced Vector Extensions 2 (/arch:AVX2)" [$DEVELOPMENT_ONLY]
// Feature test stuff for the SSE 2 build
$EnableEnhancedInstructionSet "Streaming SIMD Extensions 2 (/arch:SSE2)" [$WIN32 && $VOLT_SSE2] // Source 2013 doesn't enable this by default
}
}

View File

@ -0,0 +1,12 @@
//-----------------------------------------------------------------------------
// JOLTPHYSICS_SSE2.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro PROJNAME "joltphysics_sse2"
$Conditional VOLT_SSE2 "1"
$Macro VOLTARCH "SSE2"
$Include "joltphysics_inc.vpc"

View File

@ -0,0 +1,12 @@
//-----------------------------------------------------------------------------
// JOLTPHYSICS_SSE42.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro PROJNAME "joltphysics_sse42"
$Conditional VOLT_SSE42 "1"
$Macro VOLTARCH "SSE42"
$Include "joltphysics_inc.vpc"

@ -1 +1 @@
Subproject commit 22d675437edc441329ed244f632807a8789fa5a6
Subproject commit 9ece1b49279210061bf7097c3bebb9fac23d93de

View File

@ -0,0 +1,23 @@
//-----------------------------------------------------------------------------
// VJOLT_GROUPS.VGC
//
// Group configurations for VPhysics Jolt
//-----------------------------------------------------------------------------
$Group "jolt"
{
"appframework"
"interfaces"
"tier0_static"
"tier1"
"tier2"
"mathlib"
"vstdlib_static"
"joltphysics_avx2"
"joltphysics_sse42"
"joltphysics_sse2"
"vphysics_jolt_avx2"
"vphysics_jolt_sse42"
"vphysics_jolt_sse2"
"vphysics_wrapper_external"
}

View File

@ -0,0 +1,50 @@
//-----------------------------------------------------------------------------
// VJOLT_PROJECTS.VGC
//
// Project configurations for VPhysics Jolt
//-----------------------------------------------------------------------------
$Project "joltphysics_avx2"
{
"vphysics_jolt/joltphysics/joltphysics_avx2.vpc"
}
$Project "joltphysics_sse42"
{
"vphysics_jolt/joltphysics/joltphysics_sse42.vpc"
}
$Project "joltphysics_sse2"
{
"vphysics_jolt/joltphysics/joltphysics_sse2.vpc"
}
$Project "vphysics_jolt_avx2"
{
"vphysics_jolt/vphysics_jolt/vphysics_jolt_avx2.vpc"
}
$Project "vphysics_jolt_sse42"
{
"vphysics_jolt/vphysics_jolt/vphysics_jolt_sse42.vpc"
}
$Project "vphysics_jolt_sse2"
{
"vphysics_jolt/vphysics_jolt/vphysics_jolt_sse2.vpc"
}
$Project "vphysics_wrapper_internal"
{
"vphysics_jolt/vphysics_wrapper/vphysics_wrapper_internal.vpc"
}
$Project "vphysics_wrapper_external"
{
"vphysics_jolt/vphysics_wrapper/vphysics_wrapper_external.vpc"
}
$Project "vphysics_jolt_static"
{
"vphysics_jolt/vphysics_jolt/vphysics_jolt_static.vpc"
}

View File

@ -9,12 +9,28 @@
// Tier0
#include "tier0/basetypes.h"
#include "tier0/dbg.h"
// Workaround mem.h #defining offsetof
// on public SDKs when on Linux.
// We don't want this behaviour.
#ifdef LINUX
#define WAS_LINUX
#undef LINUX
#endif
#include "tier0/mem.h"
#ifdef WAS_LINUX
#define LINUX
#undef WAS_LINUX
#endif
#ifndef GAME_SDK2013
#include "tier0/logging.h"
#endif
#ifdef GAME_SDK2013
#if defined( GAME_SDK2013 )
#include "compat/compat_sdk2013.h"
#elif defined( GAME_ASW )
#include "compat/compat_asw.h"
#endif
#include "compat/branch_overrides.h"
@ -41,7 +57,11 @@
#include "tier1/tier1.h"
#include "tier1/strtools.h"
#include "tier1/interface.h"
#ifndef GAME_L4D2_OR_NEWER
#include "tier1/KeyValues.h"
#else
#include "tier1/keyvalues.h"
#endif
#include "tier1/UtlStringMap.h"
#include "tier1/utlbuffer.h"

View File

@ -10,6 +10,15 @@
#define override_not_csgo override
#endif
// GMod SDK2013 x86 branch
#if defined( GAME_GMOD )
#define override_gmod override
#define override_not_gmod
#else
#define override_gmod
#define override_not_gmod override
#endif
#if defined( GAME_CSGO ) || defined( GAME_DESOLATION ) || defined( GAME_PORTAL2 )
#define GAME_PORTAL2_OR_NEWER
#define override_portal2 override
@ -19,6 +28,15 @@
#define override_not_portal2 override
#endif
#if defined( GAME_CSGO ) || defined( GAME_DESOLATION ) || defined( GAME_PORTAL2 ) || defined( GAME_L4D2 )
#define GAME_L4D2_OR_NEWER
#define override_l4d2 override
#define override_not_l4d2
#else
#define override_l4d2
#define override_not_l4d2 override
#endif
#if defined( GAME_CSGO ) || defined( GAME_DESOLATION ) || defined( GAME_PORTAL2 ) || defined( GAME_L4D2 ) || defined( GAME_ASW )
#define GAME_ASW_OR_NEWER
#define override_asw override

View File

@ -0,0 +1,49 @@
#pragma once
#include "memalloc.h"
#define DevAssert( ... )
#define DevAssertMsg( ... )
#define AssertMsg_Internal( ... )
template< typename A, typename B, typename C >
[[nodiscard]] constexpr A clamp( const A val, const B minVal, const C maxVal )
{
return MIN( MAX( val, minVal ), maxVal );
}
template< typename T >
[[nodiscard]] constexpr T Min( const T valMin, const T valMax )
{
return valMin < valMax ? valMin : valMax;
}
template< typename T >
[[nodiscard]] constexpr T Max( const T valMin, const T valMax )
{
return valMin > valMax ? valMin : valMax;
}
template< typename T >
[[nodiscard]] constexpr T Clamp( const T val, const T minVal, const T maxVal )
{
return Min( Max( val, minVal ), maxVal );
}
constexpr bool V_isdigit( char c )
{
return c >= '0' && c <= '9';
}
inline void MemAlloc_Free( void *pMemBlock )
{
g_pMemAlloc->Free( pMemBlock );
}
enum PlayerContactState_t
{
PLAYER_CONTACT_PHYSICS = 1,
PLAYER_CONTACT_GAMEOBJECT = 2,
};

View File

@ -252,17 +252,16 @@ Vector JoltPhysicsCollision::CollideGetExtent( const CPhysCollide *pCollide, con
JPH::Vec3 vecMaxExtent = JPH::Vec3::sZero();
ActOnSubShapes< JPH::ConvexShape >( pShape, [&]( const JPH::ConvexShape* pConvexShape, JPH::Mat44Arg matSubShapeTransform )
{
JPH::Mat44 matTransform = matCollideTransform * matSubShapeTransform;
JPH::ConvexShape::SupportingFace supportingFace;
pConvexShape->GetSupportingFace( vecDirection, JPH::Vec3::sReplicate( 1.0f ), supportingFace );
pConvexShape->GetSupportingFace( JPH::SubShapeID(), vecDirection, JPH::Vec3::sReplicate( 1.0f ), matTransform, supportingFace );
for ( const JPH::Vec3 &vecVertex : supportingFace )
{
JPH::Vec3 vecTransformedVertex = matCollideTransform * matSubShapeTransform * vecVertex;
const float flDot = vecTransformedVertex.Dot( vecDirection );
const float flDot = vecVertex.Dot( vecDirection );
if ( flDot > flMaxDot )
{
vecMaxExtent = vecTransformedVertex;
vecMaxExtent = vecVertex;
flMaxDot = flDot;
}
}
@ -368,7 +367,6 @@ namespace ivp_compat
{
struct collideheader_t
{
int size;
int vphysicsID;
short version;
short modelType;
@ -491,11 +489,12 @@ namespace ivp_compat
}
};
static constexpr int IVP_COMPACT_SURFACE_ID = MAKEID('I','V','P','S');
static constexpr int IVP_COMPACT_SURFACE_ID_SWAPPED = MAKEID('S','P','V','I');
static constexpr int IVP_COMPACT_MOPP_ID = MAKEID('M','O','P','P');
static constexpr int VPHYSICS_COLLISION_ID = MAKEID('V','P','H','Y');
static constexpr short VPHYSICS_COLLISION_VERSION = 0x0100;
static constexpr int IVP_COMPACT_SURFACE_SUPER_LEGACY = 0; // Really old .phy files, don't have anything here, and were just serialized compact headers directly.
static constexpr int IVP_COMPACT_SURFACE_ID = MAKEID('I','V','P','S');
static constexpr int IVP_COMPACT_SURFACE_ID_SWAPPED = MAKEID('S','P','V','I');
static constexpr int IVP_COMPACT_MOPP_ID = MAKEID('M','O','P','P');
static constexpr int VPHYSICS_COLLISION_ID = MAKEID('V','P','H','Y');
static constexpr short VPHYSICS_COLLISION_VERSION = 0x0100;
enum
{
@ -536,7 +535,20 @@ namespace ivp_compat
settings.mHullTolerance = 0.0f;
JPH::ConvexShape *pConvexShape = ShapeSettingsToShape< JPH::ConvexShape >( settings );
if ( !pConvexShape )
return nullptr;
{
// Wow that sucks, just mock up a small sphere to subsitute.
// This can happen for models with extremely broken collision hulls.
// If we don't do this, we'll crash later on because older versions of Source are missing
// an important nullptr check.
// A better solution would be to generate a valid convex hull from the points provided.
JPH::SphereShapeSettings sphereSettings( 1.0f );
pConvexShape = ShapeSettingsToShape< JPH::ConvexShape >( sphereSettings );
if ( !pConvexShape )
{
// This should never fail, but catching anyway
return nullptr;
}
}
pConvexShape->SetUserData( pLedge->client_data );
return pConvexShape;
@ -556,14 +568,8 @@ namespace ivp_compat
vecOut.AddToTail( pNode->GetCompactLedge() );
}
CPhysCollide *DeserializeIVP_Poly( const collideheader_t *pCollideHeader )
CPhysCollide *DeserializeIVP_Poly( const compactsurface_t* pSurface )
{
const compactsurfaceheader_t *pSurfaceHeader = reinterpret_cast< const compactsurfaceheader_t* >( pCollideHeader + 1 );
const compactsurface_t *pSurface = reinterpret_cast< const compactsurface_t* >( pSurfaceHeader + 1 );
if ( pSurface->dummy[2] != IVP_COMPACT_SURFACE_ID )
return nullptr;
const compactledgenode_t *pFirstLedgeNode = reinterpret_cast< const compactledgenode_t * >(
reinterpret_cast< const char * >( pSurface ) + pSurface->offset_ledgetree_root );
@ -594,6 +600,14 @@ namespace ivp_compat
return CPhysConvex::FromConvexShape( pShape )->ToPhysCollide();
}
}
CPhysCollide *DeserializeIVP_Poly( const collideheader_t *pCollideHeader )
{
const compactsurfaceheader_t *pSurfaceHeader = reinterpret_cast< const compactsurfaceheader_t* >( pCollideHeader + 1 );
const compactsurface_t *pSurface = reinterpret_cast< const compactsurface_t* >( pSurfaceHeader + 1 );
return DeserializeIVP_Poly( pSurface );
}
}
void JoltPhysicsCollision::VCollideLoad( vcollide_t *pOutput, int solidCount, const char *pBuffer, int size, bool swap /*= false*/ )
@ -614,41 +628,69 @@ void JoltPhysicsCollision::VCollideLoad( vcollide_t *pOutput, int solidCount, co
// this mess! :p
pOutput->solids[ i ] = nullptr;
const int solidSize = *reinterpret_cast<const int *>( pCursor );
pCursor += sizeof( int );
const ivp_compat::collideheader_t *pCollideHeader = reinterpret_cast<const ivp_compat::collideheader_t *>( pCursor );
if ( pCollideHeader->vphysicsID != ivp_compat::VPHYSICS_COLLISION_ID ||
pCollideHeader->version != ivp_compat::VPHYSICS_COLLISION_VERSION )
if ( pCollideHeader->vphysicsID == ivp_compat::VPHYSICS_COLLISION_ID )
{
Log_Warning( LOG_VJolt, "Skipped solid %d due to invalid header (id: %.4s, version: 0x%x)\n", i, &pCollideHeader->vphysicsID, pCollideHeader->version );
continue;
}
// This is the main path that everything falls down for a modern
// .phy file with the collide header.
switch ( pCollideHeader->modelType )
{
case ivp_compat::COLLIDE_POLY:
pOutput->solids[ i ] = DeserializeIVP_Poly( pCollideHeader );
break;
if ( pCollideHeader->version != ivp_compat::VPHYSICS_COLLISION_VERSION )
Log_Warning( LOG_VJolt, "Solid with unknown version: 0x%x, may crash!\n", pCollideHeader->version );
case ivp_compat::COLLIDE_MOPP:
Log_Warning( LOG_VJolt, "Unsupported solid type COLLIDE_MOPP on solid %d. Skipping...\n", i );
break;
switch ( pCollideHeader->modelType )
{
case ivp_compat::COLLIDE_POLY:
pOutput->solids[ i ] = DeserializeIVP_Poly( pCollideHeader );
break;
case ivp_compat::COLLIDE_MOPP:
Log_Warning( LOG_VJolt, "Unsupported solid type COLLIDE_MOPP on solid %d. Skipping...\n", i );
break;
case ivp_compat::COLLIDE_BALL:
Log_Warning( LOG_VJolt, "Unsupported solid type COLLIDE_BALL on solid %d. Skipping...\n", i );
break;
case ivp_compat::COLLIDE_BALL:
Log_Warning( LOG_VJolt, "Unsupported solid type COLLIDE_BALL on solid %d. Skipping...\n", i );
break;
case ivp_compat::COLLIDE_VIRTUAL:
Log_Warning( LOG_VJolt, "Unsupported solid type COLLIDE_VIRTUAL on solid %d. Skipping...\n", i );
break;
case ivp_compat::COLLIDE_VIRTUAL:
Log_Warning( LOG_VJolt, "Unsupported solid type COLLIDE_VIRTUAL on solid %d. Skipping...\n", i );
break;
default:
Log_Warning( LOG_VJolt, "Unsupported solid type 0x%x on solid %d. Skipping...\n", (int)pCollideHeader->modelType, i );
break;
default:
Log_Warning( LOG_VJolt, "Unsupported solid type 0x%x on solid %d. Skipping...\n", (int)pCollideHeader->modelType, i );
break;
}
}
else
{
// This must be a legacy style .phy where it is just a dumped compact surface.
// Some props in shipping HL2 still use this format, as they have a .phy, even after their
// .qc had the $collisionmodel removed, as they didn't get the stale .phy in the game files deleted.
const ivp_compat::compactsurface_t *pCompactSurface = reinterpret_cast<const ivp_compat::compactsurface_t *>( pCursor );
const int legacyModelType = pCompactSurface->dummy[2];
switch ( legacyModelType )
{
case ivp_compat::IVP_COMPACT_SURFACE_SUPER_LEGACY:
case ivp_compat::IVP_COMPACT_SURFACE_ID:
case ivp_compat::IVP_COMPACT_SURFACE_ID_SWAPPED:
pOutput->solids[i] = DeserializeIVP_Poly( pCompactSurface );
break;
case ivp_compat::IVP_COMPACT_MOPP_ID:
Log_Warning( LOG_VJolt, "Unsupported legacy solid type IVP_COMPACT_MOPP_ID on solid %d. Skipping...\n", i );
break;
default:
Log_Warning( LOG_VJolt, "Unsupported legacy solid type 0x%x on solid %d. Skipping...\n", legacyModelType, i);
break;
}
}
// Size does not include the size of "size", ironically!
// add sizeof( int ) for that.
pCursor += pCollideHeader->size + sizeof( int );
pCursor += solidSize;
}
// The rest of the buffer is KV.
@ -670,7 +712,7 @@ void JoltPhysicsCollision::VCollideUnload( vcollide_t *pVCollide )
{
VCollideFreeUserData( pVCollide );
for ( int i = 0; i < pVCollide->solidCount; i++ )
delete pVCollide->solids[ i ];
delete pVCollide->solids[ i ]->ToShape();
delete[] pVCollide->solids;
delete[] pVCollide->pKeyValues;
@ -717,7 +759,7 @@ int JoltPhysicsCollision::CreateDebugMesh( CPhysCollide const *pCollisionModel,
for ( auto &shape : collector.mHits )
{
JPH::Shape::GetTrianglesContext ctx;
shape.GetTrianglesStart( ctx, JPH::AABox::sBiggest() );
shape.GetTrianglesStart( ctx, JPH::AABox::sBiggest(), JPH::Vec3::sZero() );
for ( ;; )
{
int nSubShapeTriCount = shape.GetTrianglesNext( ctx, nRequestCount, reinterpret_cast<JPH::Float3*>( &pVerts[ nAccumTris * 3 ] ), nullptr /* materials */);
@ -728,6 +770,10 @@ int JoltPhysicsCollision::CreateDebugMesh( CPhysCollide const *pCollisionModel,
}
}
// Swap the winding of the triangles to match original VPhysics behaviour.
for ( int i = 0; i < nAccumTris; i++ )
std::swap( pVerts[ ( i * 3 ) + 0 ], pVerts[ ( i * 3 ) + 2 ] );
*outVerts = pVerts;
return nAccumTris * 3;
}

View File

@ -12,6 +12,8 @@
// Does not and will not contain *any* data.
class CPhysCollide
{
~CPhysCollide() = delete;
public:
JPH::Shape* ToShape()
{
@ -42,6 +44,8 @@ public:
// Does not and will not contain *any* data.
class CPhysConvex
{
~CPhysConvex() = delete;
public:
JPH::ConvexShape* ToConvexShape()
{

View File

@ -176,17 +176,17 @@ public:
ContentsFilter_Shape( const JPH::Shape *pShape, uint32 contentsMask, IConvexInfo *pConvexInfo )
: m_pShape( pShape ), m_ContentsMask( contentsMask ), m_pConvexInfo( pConvexInfo ) {}
bool ShouldCollide( const JPH::SubShapeID& inSubShapeID2 ) const override
bool ShouldCollide( const JPH::Shape *inShape2, const JPH::SubShapeID& inSubShapeID2 ) const override
{
const uint32 gameData = static_cast<uint32>( m_pShape->GetSubShapeUserData( inSubShapeID2 ) );
const uint32 gameData = static_cast<uint32>( inShape2->GetSubShapeUserData( inSubShapeID2 ) );
const uint32 contents = m_pConvexInfo ? m_pConvexInfo->GetContents( gameData ) : CONTENTS_SOLID;
return !!( contents & m_ContentsMask );
}
bool ShouldCollide( const JPH::SubShapeID &inSubShapeID1, const JPH::SubShapeID &inSubShapeID2 ) const override
bool ShouldCollide( const JPH::Shape *inShape1, const JPH::SubShapeID &inSubShapeIDOfShape1, const JPH::Shape *inShape2, const JPH::SubShapeID &inSubShapeIDOfShape2 ) const override
{
return ShouldCollide( inSubShapeID2 );
return ShouldCollide( inShape2, inSubShapeIDOfShape2 );
}
public:

View File

@ -70,8 +70,7 @@ void JoltPhysicsConstraintGroup::AddConstraint( JoltPhysicsConstraint *pConstrai
void JoltPhysicsConstraintGroup::RemoveConstraint( JoltPhysicsConstraint *pConstraint )
{
m_pConstraints.erase(
std::remove_if( m_pConstraints.begin(), m_pConstraints.end(), [&]( JoltPhysicsConstraint *pOther ) { return pOther == pConstraint; } ) );
Erase( m_pConstraints, pConstraint );
}
//-------------------------------------------------------------------------------------------------
@ -152,7 +151,7 @@ void JoltPhysicsConstraint::SetLinearMotor( float speed, float maxLinearImpulse
{
case CONSTRAINT_SLIDING:
{
JPH::SliderConstraint *pConstraint = static_cast<JPH::SliderConstraint *>( m_pConstraint );
JPH::SliderConstraint *pConstraint = static_cast<JPH::SliderConstraint *>( m_pConstraint.GetPtr() );
pConstraint->SetMotorState( speed ? JPH::EMotorState::Velocity : JPH::EMotorState::Off );
pConstraint->SetTargetVelocity( speed );
@ -185,7 +184,7 @@ void JoltPhysicsConstraint::SetAngularMotor( float rotSpeed, float maxAngularImp
// :/
VJoltAssert( m_pConstraint->GetSubType() == JPH::EConstraintSubType::SixDOF );
JPH::SixDOFConstraint *pConstraint = static_cast<JPH::SixDOFConstraint *>( m_pConstraint );
JPH::SixDOFConstraint *pConstraint = static_cast<JPH::SixDOFConstraint *>( m_pConstraint.GetPtr() );
pConstraint->SetTargetAngularVelocityCS( JPH::Vec3( rotSpeed, rotSpeed, rotSpeed ) );
pConstraint->SetMaxFriction( JPH::SixDOFConstraint::EAxis::RotationX, maxAngularImpulse );
pConstraint->SetMaxFriction( JPH::SixDOFConstraint::EAxis::RotationY, maxAngularImpulse );
@ -195,7 +194,7 @@ void JoltPhysicsConstraint::SetAngularMotor( float rotSpeed, float maxAngularImp
case CONSTRAINT_HINGE:
{
JPH::HingeConstraint *pConstraint = static_cast<JPH::HingeConstraint *>( m_pConstraint );
JPH::HingeConstraint *pConstraint = static_cast<JPH::HingeConstraint *>( m_pConstraint.GetPtr() );
pConstraint->SetMotorState( rotSpeed ? JPH::EMotorState::Velocity : JPH::EMotorState::Off );
pConstraint->SetTargetAngularVelocity( rotSpeed );
@ -286,12 +285,12 @@ static uint32 GetDegreesOfFreedom( const constraint_ragdollparams_t &ragdoll )
bool JoltPhysicsConstraint::InitialiseHingeFromRagdoll( IPhysicsConstraintGroup* pGroup, const constraint_ragdollparams_t& ragdoll )
{
const uint32 uDOFMask = GetDegreesOfFreedom( ragdoll );
const uint32 uDOFCount = popcnt( uDOFMask );
const uint32 uDOFCount = JPH::CountBits( uDOFMask );
if ( uDOFCount != 1 )
return false;
const uint32 uDOF = tzcnt( uDOFMask );
const uint32 uDOF = JPH::CountTrailingZeros( uDOFMask );
const Vector vecNextDOFAxis = DOFToAxis( NextDOF( uDOF ) );
matrix3x4_t refObjToWorld;
@ -479,7 +478,7 @@ void JoltPhysicsConstraint::InitialiseSliding( IPhysicsConstraintGroup *pGroup,
JPH::Body *attBody = m_pObjAttached->GetBody();
JPH::SliderConstraintSettings settings;
settings.SetPoint( *refBody, *attBody );
settings.mAutoDetectPoint = true;
settings.SetSliderAxis( JPH::Vec3( sliding.slideAxisRef.x, sliding.slideAxisRef.y, sliding.slideAxisRef.z ) );
if ( sliding.limitMin != sliding.limitMax )
@ -495,7 +494,7 @@ void JoltPhysicsConstraint::InitialiseSliding( IPhysicsConstraintGroup *pGroup,
if ( sliding.velocity )
{
JPH::SliderConstraint *pConstraint = static_cast<JPH::SliderConstraint *>( m_pConstraint );
JPH::SliderConstraint *pConstraint = static_cast<JPH::SliderConstraint *>( m_pConstraint.GetPtr() );
pConstraint->SetMotorState( JPH::EMotorState::Velocity );
pConstraint->SetTargetVelocity( SourceToJolt::Distance( sliding.velocity ) );
}
@ -541,7 +540,7 @@ void JoltPhysicsConstraint::InitialiseFixed( IPhysicsConstraintGroup *pGroup, co
JPH::Body *attBody = m_pObjAttached->GetBody();
JPH::FixedConstraintSettings settings;
settings.SetPoint( *refBody, *attBody );
settings.mAutoDetectPoint = true;
m_pConstraint = settings.Create( *refBody, *attBody );
@ -619,7 +618,6 @@ void JoltPhysicsConstraint::DestroyConstraint()
if ( m_pConstraint )
{
m_pPhysicsSystem->RemoveConstraint( m_pConstraint );
m_pConstraint->Release();
m_pConstraint = nullptr;
}
}

View File

@ -88,14 +88,14 @@ private:
void DestroyConstraint();
JoltPhysicsObject *m_pObjReference = nullptr;
JoltPhysicsObject *m_pObjAttached = nullptr;
JPH::Constraint *m_pConstraint = nullptr;
constraintType_t m_ConstraintType = CONSTRAINT_UNKNOWN;
JoltPhysicsObject *m_pObjReference = nullptr;
JoltPhysicsObject *m_pObjAttached = nullptr;
JPH::Ref< JPH::Constraint > m_pConstraint;
constraintType_t m_ConstraintType = CONSTRAINT_UNKNOWN;
JoltPhysicsConstraintGroup *m_pGroup = nullptr;
JoltPhysicsConstraintGroup *m_pGroup = nullptr;
void *m_pGameData = nullptr;
JoltPhysicsEnvironment *m_pPhysicsEnvironment = nullptr;
JPH::PhysicsSystem *m_pPhysicsSystem = nullptr;
void *m_pGameData = nullptr;
JoltPhysicsEnvironment *m_pPhysicsEnvironment = nullptr;
JPH::PhysicsSystem *m_pPhysicsSystem = nullptr;
};

View File

@ -103,11 +103,16 @@ void JoltPhysicsFluidController::OnJoltPhysicsObjectDestroyed( JoltPhysicsObject
if ( pObject == m_pFluidObject )
m_pFluidObject = nullptr;
std::erase_if( m_ObjectsInShape, [pObject]( JoltPhysicsObject *pCachedObject ) { return pObject == pCachedObject; } );
Erase( m_ObjectsInShape, pObject );
}
//-------------------------------------------------------------------------------------------------
static JPH::Vec3 ProjectPoint( const JPH::Plane &plane, JPH::Vec3Arg point )
{
return point - plane.SignedDistance(point) * plane.GetNormal();
}
// Applies buoyancy to any body that intersects with the water shape
class SourceFluidCollector : public JPH::CollideShapeCollector
{
@ -134,10 +139,6 @@ public:
m_ObjectsInShape.push_back( pObject );
// The original VPhysics ignores m_Params.torqueFactor and always has 0.01.
// But I think 0.05 looks better.
static constexpr float flTorqueFactor = 0.05f;
// Josh:
// The buoyancy ratio in Source works like this:
// fluid_density = m_flDensity * pObject->GetBuoyancyRatio()
@ -148,7 +149,12 @@ public:
const float flFluidDensity = m_flDensity * pObject->GetBuoyancyRatio();
float inBuoyancy = flFluidDensity * pObject->GetBody()->GetShape()->GetVolume() * pObject->GetInvMass();
if ( body.IsActive() )
body.ApplyBuoyancyImpulse( m_Surface, inBuoyancy, 0.3f /* m_Params.damping */, flTorqueFactor, SourceToJolt::Distance( m_Params.currentVelocity ), m_pPhysicsSystem->GetGravity(), m_DeltaTime);
{
// Project (0, 0, 0) onto plane to get a point on it.
JPH::Vec3 point = ProjectPoint( m_Surface, JPH::Vec3::sZero() );
JPH::Vec3 normal = m_Surface.GetNormal();
body.ApplyBuoyancyImpulse( point, normal, inBuoyancy, m_Params.damping, 0.1f, SourceToJolt::Distance( m_Params.currentVelocity ), m_pPhysicsSystem->GetGravity(), m_DeltaTime );
}
}
private:
@ -193,7 +199,7 @@ void JoltPhysicsFluidController::OnPreSimulate( float deltaTime )
const JPH::Shape *pShape = m_pFluidObject->GetCollide()->ToShape();
m_pPhysicsSystem->GetNarrowPhaseQueryNoLock().CollideShape(
pShape, JPH::Vec3::sReplicate( 1.0f ), queryTransform, collideSettings, collector,
pShape, JPH::Vec3::sReplicate( 1.0f ), queryTransform, collideSettings, JPH::Vec3::sZero(), collector,
JPH::SpecifiedBroadPhaseLayerFilter( BroadPhaseLayers::MOVING ), JPH::SpecifiedObjectLayerFilter( Layers::MOVING ), body_filter );
for ( JoltPhysicsObject *pObject : m_ObjectsInShape )

View File

@ -32,11 +32,11 @@ void JoltPhysicsMotionController::AttachObject( IPhysicsObject *pObject, bool bC
return;
JoltPhysicsObject *pPhysicsObject = static_cast< JoltPhysicsObject * >( pObject );
if ( bCheckIfAlreadyAttached && m_pObjects.HasElement( pPhysicsObject ) )
if ( bCheckIfAlreadyAttached && VectorContains( m_pObjects, pPhysicsObject ) )
return;
pPhysicsObject->AddDestroyedListener( this );
m_pObjects.AddToTail( pPhysicsObject );
m_pObjects.push_back( pPhysicsObject );
}
void JoltPhysicsMotionController::DetachObject( IPhysicsObject *pObject )
@ -45,7 +45,7 @@ void JoltPhysicsMotionController::DetachObject( IPhysicsObject *pObject )
return;
JoltPhysicsObject *pPhysicsObject = static_cast< JoltPhysicsObject * >( pObject );
m_pObjects.FindAndRemove( pPhysicsObject );
Erase( m_pObjects, pPhysicsObject );
pPhysicsObject->RemoveDestroyedListener( this );
}
@ -53,18 +53,18 @@ void JoltPhysicsMotionController::DetachObject( IPhysicsObject *pObject )
int JoltPhysicsMotionController::CountObjects( void )
{
return m_pObjects.Count();
return int( m_pObjects.size() );
}
void JoltPhysicsMotionController::GetObjects( IPhysicsObject **pObjectList )
{
for ( int i = 0; i < m_pObjects.Count(); i++ )
for ( size_t i = 0; i < m_pObjects.size(); i++ )
pObjectList[ i ] = m_pObjects[ i ];
}
void JoltPhysicsMotionController::ClearObjects( void )
{
m_pObjects.RemoveAll();
m_pObjects.clear();
}
void JoltPhysicsMotionController::WakeObjects( void )
@ -85,7 +85,7 @@ void JoltPhysicsMotionController::SetPriority( priority_t priority )
void JoltPhysicsMotionController::OnJoltPhysicsObjectDestroyed( JoltPhysicsObject *pObject )
{
JoltPhysicsObject *pPhysicsObject = static_cast< JoltPhysicsObject * >( pObject );
m_pObjects.FindAndRemove( pPhysicsObject );
Erase( m_pObjects, pPhysicsObject );
}
void JoltPhysicsMotionController::OnPreSimulate( float flDeltaTime )

View File

@ -29,5 +29,5 @@ public:
private:
IMotionEvent *m_pMotionEvent;
CUtlVector< JoltPhysicsObject * > m_pObjects;
std::vector< JoltPhysicsObject * > m_pObjects;
};

View File

@ -182,7 +182,7 @@ static void CheckCollision( JoltPhysicsObject *pObject, JPH::CollideShapeCollect
settings.mBackFaceMode = JPH::EBackFaceMode::IgnoreBackFaces;
settings.mMaxSeparationDistance = vjolt_player_collision_tolerance.GetFloat();
pSystem->GetNarrowPhaseQueryNoLock().CollideShape( pObject->GetBody()->GetShape(), JPH::Vec3::sReplicate( 1.0f ), query_transform, settings, ioCollector, broadphase_layer_filter, object_layer_filter, ioFilter );
pSystem->GetNarrowPhaseQueryNoLock().CollideShape( pObject->GetBody()->GetShape(), JPH::Vec3::sReplicate( 1.0f ), query_transform, settings, JPH::Vec3::sZero(), ioCollector, broadphase_layer_filter, object_layer_filter, ioFilter );
}
// Slart: This is a version of CheckCollision that projects the player by their velocity, to attempt to push objects that we'll walk into soon
@ -257,6 +257,48 @@ private:
JoltPhysicsObject *m_pSelfObject;
};
class NormalWeightedCollector : public JPH::CollideShapeCollector
{
public:
NormalWeightedCollector( JPH::PhysicsSystem *pPhysicsSystem )
: m_pPhysicsSystem( pPhysicsSystem )
{
}
void Reset() override
{
JPH::CollideShapeCollector::Reset();
m_bHadHit = false;
m_flLowestNormalZ = 1.0f;
}
void AddHit( const JPH::CollideShapeResult &inResult ) override
{
JPH::BodyLockRead lock( m_pPhysicsSystem->GetBodyLockInterfaceNoLock(), inResult.mBodyID2 );
const JPH::Body &body = lock.GetBody();
JPH::Vec3 normal = body.GetWorldSpaceSurfaceNormal( inResult.mSubShapeID2, inResult.mContactPointOn2 );
m_flLowestNormalZ = Min( m_flLowestNormalZ, -normal.GetZ() );
m_Hit = inResult;
m_bHadHit = true;
}
inline bool HadHit() const
{
return m_bHadHit;
}
float m_flLowestNormalZ = 1.0f;
JPH::CollideShapeCollector::ResultType m_Hit;
private:
JPH::PhysicsSystem *m_pPhysicsSystem;
bool m_bHadHit = false;
};
uint32 JoltPhysicsPlayerController::GetContactState( uint16 nGameFlags )
{
// This does not seem to affect much, we should aspire to have our physics be as 1:1 to brush collisions as possible anyway
@ -275,6 +317,13 @@ uint32 JoltPhysicsPlayerController::GetContactState( uint16 nGameFlags )
{
}
void Reset() override
{
JPH::CollideShapeCollector::Reset();
m_nFlagsOut = 0;
}
void AddHit( const JPH::CollideShapeResult &inResult ) override
{
JPH::BodyLockRead lock( m_pPhysicsSystem->GetBodyLockInterfaceNoLock(), inResult.mBodyID2 );
@ -351,13 +400,14 @@ void JoltPhysicsPlayerController::OnPreSimulate( float flDeltaTime )
JPH::BodyInterface &bodyInterface = pPhysicsSystem->GetBodyInterfaceNoLock();
// Project ourselves towards our velocity
JPH::AnyHitCollisionCollector<JPH::CollideShapeCollector> collector;
NormalWeightedCollector collector( pPhysicsSystem );
SourceHitFilter<true> filter( pPhysicsSystem, m_pObject );
CheckCollision( m_pObject, collector, filter );
if ( collector.HadHit() )
// Source typically uses -0.7 for ground.
if ( collector.HadHit() && collector.m_flLowestNormalZ < -0.7f )
{
JPH::BodyID otherID = collector.mHit.mBodyID2;
JPH::BodyID otherID = collector.m_Hit.mBodyID2;
//bodyInterface.AddImpulse( otherID, m_pObject->GetMass() * m_targetVelocity * flDeltaTime, m_pObject->GetBody()->GetPosition() );
bodyInterface.AddImpulse( otherID, m_pObject->GetMass() * pPhysicsSystem->GetGravity() * flDeltaTime, m_pObject->GetBody()->GetPosition());

View File

@ -403,9 +403,15 @@ void JoltPhysicsVehicleController::CreateWheel( JPH::VehicleConstraintSettings &
const float steeringAngle = DEG2RAD( Max( m_VehicleParams.steering.degreesSlow, m_VehicleParams.steering.degreesFast ) );
const float additionalLength = SourceToJolt::Distance( axle.wheels.springAdditionalLength );
Vector gravity;
m_pEnvironment->GetGravity( &gravity );
JPH::WheelSettingsWV *wheelSettings = new JPH::WheelSettingsWV;
wheelSettings->mPosition = SourceToJolt::Distance( wheelPositionLocal );
wheelSettings->mDirection = JPH::Vec3( 0, 0, -1 );
wheelSettings->mSuspensionDirection = JPH::Vec3( 0, 0, -1 );
wheelSettings->mSteeringAxis = JPH::Vec3( 0, 0, 1 );
wheelSettings->mWheelUp = JPH::Vec3( 0, 0, 1 );
wheelSettings->mWheelForward = JPH::Vec3( 0, 1, 0 );
wheelSettings->mAngularDamping = axle.wheels.rotdamping;
// TODO(Josh): What about more than 4 wheels?
wheelSettings->mMaxSteerAngle = axleIdx == 0 ? steeringAngle : 0.0f;
@ -414,23 +420,25 @@ void JoltPhysicsVehicleController::CreateWheel( JPH::VehicleConstraintSettings &
wheelSettings->mInertia = 0.5f * axle.wheels.mass * ( wheelSettings->mRadius * wheelSettings->mRadius );
wheelSettings->mSuspensionMinLength = 0;
wheelSettings->mSuspensionMaxLength = additionalLength;
wheelSettings->mSuspensionDamping = axle.suspension.springDamping;
// Josh:
// so to go from K (Spring Constant) -> freq we do
// sqrtf( K / Mass ) / ( 2.0f * PI )
// but it seems like it already has mass divided in Source so...
// sqrtf( K ) / ( 2.0f * PI )
wheelSettings->mSuspensionFrequency = sqrtf( axle.suspension.springConstant ) / ( 2.0f * M_PI_F );
// Josh: I don't know why but it looks and feels really wrong without this:
// TODO(Josh): Investigate more later, doesn't make much sense.
// May be related to mass of wheel or something.
wheelSettings->mSuspensionFrequency *= M_PI_F;
wheelSettings->mSuspensionSpring.mMode = JPH::ESpringMode::StiffnessAndDamping;
// Source has these divided by the mass of the vehicle for some reason.
// Convert these to a stiffness of k, in N/m...
wheelSettings->mSuspensionSpring.mStiffness = axle.suspension.springConstant * m_pCarBodyObject->GetMass();
wheelSettings->mSuspensionSpring.mDamping = axle.suspension.springDamping * m_pCarBodyObject->GetMass();
if ( axle.wheels.frictionScale )
{
wheelSettings->mLateralFriction.AddPoint( 1.0f, axle.wheels.frictionScale );
wheelSettings->mLongitudinalFriction.AddPoint( 1.0f, axle.wheels.frictionScale );
}
// TODO: We may want to update this every pre-simulation to account for changing gravity.
wheelSettings->mMaxBrakeTorque =
0.5f *
SourceToJolt::Distance( gravity.Length() ) *
( m_pCarBodyObject->GetMass() + m_TotalWheelMass ) *
axle.brakeFactor *
SourceToJolt::Distance( axle.wheels.radius );
vehicleSettings.mWheels.push_back( wheelSettings );
m_InternalState.LargestWheelRadius = Max( m_InternalState.LargestWheelRadius, SourceToJolt::Distance( wheelWidth ) );
}
@ -442,6 +450,10 @@ void JoltPhysicsVehicleController::CreateWheels( JPH::VehicleConstraintSettings
m_Wheels.reserve( m_VehicleParams.axleCount * m_VehicleParams.wheelsPerAxle );
vehicleSettings.mAntiRollBars.reserve( m_VehicleParams.axleCount );
m_TotalWheelMass = 0.0f;
for ( int axle = 0; axle < m_VehicleParams.axleCount; axle++ )
m_TotalWheelMass += m_VehicleParams.axles[ axle ].wheels.mass * m_VehicleParams.wheelsPerAxle;
for ( int axle = 0; axle < m_VehicleParams.axleCount; axle++ )
{
for ( int wheel = 0; wheel < m_VehicleParams.wheelsPerAxle; wheel++ )

View File

@ -83,6 +83,7 @@ private:
std::vector< JoltPhysicsWheel > m_Wheels;
float m_TotalWheelMass = 0.0f;
JoltPhysicsInternalVehicleState m_InternalState;
JPH::Ref< JPH::VehicleConstraint > m_VehicleConstraint;

View File

@ -45,7 +45,7 @@ JoltPhysicsDebugRenderer::~JoltPhysicsDebugRenderer()
{
}
void JoltPhysicsDebugRenderer::DrawLine( const JPH::Float3& inFrom, const JPH::Float3& inTo, JPH::ColorArg inColor )
void JoltPhysicsDebugRenderer::DrawLine( JPH::Vec3Arg inFrom, JPH::Vec3Arg inTo, JPH::ColorArg inColor )
{
Vector v1 = JoltToSource::Distance( inFrom );
Vector v2 = JoltToSource::Distance( inTo );

View File

@ -15,7 +15,7 @@ public:
// JPH::DebugRenderer + Draw Implementation
///////////////////////////////////////////
void DrawLine( const JPH::Float3 &inFrom, const JPH::Float3 &inTo, JPH::ColorArg inColor ) override;
void DrawLine( JPH::Vec3Arg inFrom, JPH::Vec3Arg inTo, JPH::ColorArg inColor ) override;
void DrawTriangle( JPH::Vec3Arg inV1, JPH::Vec3Arg inV2, JPH::Vec3Arg inV3, JPH::ColorArg inColor ) override;

View File

@ -53,46 +53,51 @@ static ConVar vjolt_linearcast( "vjolt_linearcast", "1", FCVAR_NONE, "Whether bo
static ConVar vjolt_initial_simulation( "vjolt_initial_simulation", "0", FCVAR_NONE, "Whether to pre-settle physics objects on map load." );
static ConVar vjolt_substeps_collision( "vjolt_substeps_collision", "1", FCVAR_NONE, "Number of collision steps to perform.", true, 0.0f, true, 4.0f );
static ConVar vjolt_substeps_integration( "vjolt_substeps_integration", "1", FCVAR_NONE, "Number of integration substeps to perform.", true, 0.0f, true, 4.0f );
static ConVar vjolt_baumgarte_factor( "vjolt_baumgarte_factor", "0.2", FCVAR_NONE, "Baumgarte stabilization factor (how much of the position error to 'fix' in 1 update). Changing this may help with constraint stability. Requires a map restart to change.", true, 0.0f, true, 1.0f );
//-------------------------------------------------------------------------------------------------
// Function that determines if two object layers can collide
static bool JoltObjectCanCollide( JPH::ObjectLayer inObject1, JPH::ObjectLayer inObject2 )
class JoltObjectLayerPairFilter final : public JPH::ObjectLayerPairFilter
{
switch ( inObject1 )
public:
// Function that determines if two object layers can collide
bool ShouldCollide( JPH::ObjectLayer inObject1, JPH::ObjectLayer inObject2 ) const override
{
// NO_COLLIDE collides with nothing.
case Layers::NO_COLLIDE:
return false;
// NON_MOVING collides with moving objects and debris.
case Layers::NON_MOVING_WORLD:
case Layers::NON_MOVING_OBJECT:
return inObject2 == Layers::MOVING ||
inObject2 == Layers::DEBRIS;
// MOVING collides with moving and non-moving objects.
case Layers::MOVING:
return inObject2 == Layers::MOVING ||
inObject2 == Layers::NON_MOVING_WORLD ||
inObject2 == Layers::NON_MOVING_OBJECT;
switch ( inObject1 )
{
// NO_COLLIDE collides with nothing.
case Layers::NO_COLLIDE:
return false;
// NON_MOVING collides with moving objects and debris.
case Layers::NON_MOVING_WORLD:
case Layers::NON_MOVING_OBJECT:
return inObject2 == Layers::MOVING ||
inObject2 == Layers::DEBRIS;
// MOVING collides with moving and non-moving objects.
case Layers::MOVING:
return inObject2 == Layers::MOVING ||
inObject2 == Layers::NON_MOVING_WORLD ||
inObject2 == Layers::NON_MOVING_OBJECT;
// DEBRIS only collides with non-moving objects.
case Layers::DEBRIS:
return inObject2 == Layers::NON_MOVING_WORLD || inObject2 == Layers::NON_MOVING_OBJECT;
default:
VJoltAssert( false );
return false;
// DEBRIS only collides with non-moving objects.
case Layers::DEBRIS:
return inObject2 == Layers::NON_MOVING_WORLD || inObject2 == Layers::NON_MOVING_OBJECT;
default:
VJoltAssert( false );
return false;
}
};
private:
};
// BroadPhaseLayerInterface implementation
// This defines a mapping between object and broadphase layers.
class JoltBPLayerInterfaceImpl final : public JPH::BroadPhaseLayerInterface
class JoltBroadPhaseLayerInterface final : public JPH::BroadPhaseLayerInterface
{
public:
JoltBPLayerInterfaceImpl()
JoltBroadPhaseLayerInterface()
{
// Create a mapping table from object to broad phase layer
mObjectToBroadPhase[Layers::NON_MOVING_WORLD] = BroadPhaseLayers::NON_MOVING_WORLD;
@ -118,9 +123,12 @@ public:
{
switch ( (JPH::BroadPhaseLayer::Type)inLayer )
{
case (JPH::BroadPhaseLayer::Type)BroadPhaseLayers::NON_MOVING: return "NON_MOVING";
case (JPH::BroadPhaseLayer::Type)BroadPhaseLayers::MOVING: return "MOVING";
default: VJoltAssert( false ); return "INVALID";
case (JPH::BroadPhaseLayer::Type)BroadPhaseLayers::NON_MOVING_WORLD: return "NON_MOVING_WORLD";
case (JPH::BroadPhaseLayer::Type)BroadPhaseLayers::NON_MOVING_OBJECT: return "NON_MOVING_OBJECT";
case (JPH::BroadPhaseLayer::Type)BroadPhaseLayers::NO_COLLIDE: return "NO_COLLIDE";
case (JPH::BroadPhaseLayer::Type)BroadPhaseLayers::DEBRIS: return "DEBRIS";
case (JPH::BroadPhaseLayer::Type)BroadPhaseLayers::MOVING: return "MOVING";
default: VJoltAssert( false ); return "INVALID";
}
}
#endif
@ -129,33 +137,41 @@ private:
JPH::BroadPhaseLayer mObjectToBroadPhase[Layers::NUM_LAYERS];
};
// Function that determines if two broadphase layers can collide
static bool JoltBroadPhaseCanCollide( JPH::ObjectLayer inLayer1, JPH::BroadPhaseLayer inLayer2 )
class JoltObjectVsBroadPhaseLayerFilter final : public JPH::ObjectVsBroadPhaseLayerFilter
{
switch (inLayer1)
public:
// Function that determines if two broadphase layers can collide
bool ShouldCollide( JPH::ObjectLayer inLayer1, JPH::BroadPhaseLayer inLayer2 ) const override
{
// NO_COLLIDE collides with nothing.
case Layers::NO_COLLIDE:
return false;
// NON_MOVING collides with moving objects and debris.
case Layers::NON_MOVING_WORLD:
case Layers::NON_MOVING_OBJECT:
return inLayer2 == BroadPhaseLayers::MOVING ||
inLayer2 == BroadPhaseLayers::DEBRIS;
// MOVING collides with moving and non-moving objects.
case Layers::MOVING:
return inLayer2 == BroadPhaseLayers::MOVING ||
inLayer2 == BroadPhaseLayers::NON_MOVING_WORLD ||
inLayer2 == BroadPhaseLayers::NON_MOVING_OBJECT;
switch (inLayer1)
{
// NO_COLLIDE collides with nothing.
case Layers::NO_COLLIDE:
return false;
// NON_MOVING collides with moving objects and debris.
case Layers::NON_MOVING_WORLD:
case Layers::NON_MOVING_OBJECT:
return inLayer2 == BroadPhaseLayers::MOVING ||
inLayer2 == BroadPhaseLayers::DEBRIS;
// MOVING collides with moving and non-moving objects.
case Layers::MOVING:
return inLayer2 == BroadPhaseLayers::MOVING ||
inLayer2 == BroadPhaseLayers::NON_MOVING_WORLD ||
inLayer2 == BroadPhaseLayers::NON_MOVING_OBJECT;
// DEBRIS only collides with non-moving objects.
case Layers::DEBRIS:
return inLayer2 == BroadPhaseLayers::NON_MOVING_WORLD || inLayer2 == BroadPhaseLayers::NON_MOVING_OBJECT;
default:
VJoltAssert( false );
return false;
// DEBRIS only collides with non-moving objects.
case Layers::DEBRIS:
return inLayer2 == BroadPhaseLayers::NON_MOVING_WORLD || inLayer2 == BroadPhaseLayers::NON_MOVING_OBJECT;
default:
VJoltAssert( false );
return false;
}
}
}
private:
};
//-------------------------------------------------------------------------------------------------
@ -177,14 +193,18 @@ CON_COMMAND( vjolt_environment_dump_server, "Dumps the next simulated environmen
//-------------------------------------------------------------------------------------------------
JoltBPLayerInterfaceImpl JoltPhysicsEnvironment::s_BPLayerInterface;
JoltBroadPhaseLayerInterface JoltPhysicsEnvironment::s_BroadPhaseLayerInterface;
JoltObjectVsBroadPhaseLayerFilter JoltPhysicsEnvironment::s_BroadPhaseFilter;
JoltObjectLayerPairFilter JoltPhysicsEnvironment::s_LayerPairFilter;
JoltPhysicsEnvironment::JoltPhysicsEnvironment()
: m_ContactListener( m_PhysicsSystem )
{
m_PerformanceParams.Defaults();
m_PhysicsSystem.Init(
kMaxBodies, kNumBodyMutexes, kMaxBodyPairs, kMaxContactConstraints,
s_BPLayerInterface, JoltBroadPhaseCanCollide, JoltObjectCanCollide );
s_BroadPhaseLayerInterface, s_BroadPhaseFilter, s_LayerPairFilter);
{
JPH::PhysicsSettings settings = m_PhysicsSystem.GetPhysicsSettings();
@ -401,14 +421,14 @@ IPhysicsFluidController *JoltPhysicsEnvironment::CreateFluidController( IPhysics
{
JoltPhysicsObject *pJoltObject = static_cast< JoltPhysicsObject * >( pFluidObject );
JoltPhysicsFluidController *pFluidController = new JoltPhysicsFluidController( &m_PhysicsSystem, pJoltObject, pParams );
m_pPhysicsControllers.AddToTail( pFluidController );
m_pPhysicsControllers.push_back( pFluidController );
return pFluidController;
}
void JoltPhysicsEnvironment::DestroyFluidController( IPhysicsFluidController *pFluidController )
{
JoltPhysicsFluidController *pInternalFluidController = static_cast<JoltPhysicsFluidController *>( pFluidController );
m_pPhysicsControllers.FindAndRemove( pInternalFluidController );
Erase( m_pPhysicsControllers, pInternalFluidController );
delete pInternalFluidController;
}
@ -458,9 +478,9 @@ JoltPhysicsSpring::JoltPhysicsSpring( JPH::PhysicsSystem *pPhysicsSystem, JoltPh
settings.mMinDistance = m_OnlyStretch ? 0.0f : SourceToJolt::Distance( pParams->naturalLength );
settings.mMaxDistance = SourceToJolt::Distance( pParams->naturalLength );
settings.mFrequency = GetSpringFrequency( pParams->constant, m_pObjectStart, m_pObjectEnd );
// TODO(Josh): The damping values are normally fucking crazy like 5500 from Source... wtf is going on here.
settings.mDamping = 0.0f;
settings.mLimitsSpringSettings.mMode = JPH::ESpringMode::StiffnessAndDamping;
settings.mLimitsSpringSettings.mFrequency = pParams->constant;
settings.mLimitsSpringSettings.mDamping = pParams->damping;
m_pConstraint = static_cast< JPH::DistanceConstraint * >( settings.Create( *refBody, *attBody ) );
m_pConstraint->SetEnabled( true );
@ -501,7 +521,8 @@ void JoltPhysicsSpring::SetSpringConstant( float flSpringConstant )
m_pObjectStart->Wake();
m_pObjectEnd->Wake();
m_pConstraint->SetFrequency( GetSpringFrequency( flSpringConstant, m_pObjectStart, m_pObjectEnd ) );
JPH::SpringSettings& springSettings = m_pConstraint->GetLimitsSpringSettings();
springSettings.mStiffness = flSpringConstant;
}
void JoltPhysicsSpring::SetSpringDamping( float flSpringDamping )
@ -509,7 +530,8 @@ void JoltPhysicsSpring::SetSpringDamping( float flSpringDamping )
m_pObjectStart->Wake();
m_pObjectEnd->Wake();
//m_pConstraint->SetDamping( flSpringDamping );
JPH::SpringSettings& springSettings = m_pConstraint->GetLimitsSpringSettings();
springSettings.mDamping = flSpringDamping;
}
void JoltPhysicsSpring::SetSpringLength( float flSpringLength )
@ -658,14 +680,14 @@ void JoltPhysicsEnvironment::DestroyConstraintGroup( IPhysicsConstraintGroup *pG
IPhysicsShadowController *JoltPhysicsEnvironment::CreateShadowController( IPhysicsObject *pObject, bool allowTranslation, bool allowRotation )
{
JoltPhysicsShadowController *pController = new JoltPhysicsShadowController( static_cast<JoltPhysicsObject *>( pObject ), allowTranslation, allowRotation );
m_pPhysicsControllers.AddToTail( pController );
m_pPhysicsControllers.push_back( pController );
return pController;
}
void JoltPhysicsEnvironment::DestroyShadowController( IPhysicsShadowController *pShadowController )
{
JoltPhysicsShadowController *pController = static_cast< JoltPhysicsShadowController * >( pShadowController );
m_pPhysicsControllers.FindAndRemove( pController );
Erase( m_pPhysicsControllers, pController );
delete pController;
}
@ -674,14 +696,14 @@ void JoltPhysicsEnvironment::DestroyShadowController( IPhysicsShadowController *
IPhysicsPlayerController *JoltPhysicsEnvironment::CreatePlayerController( IPhysicsObject *pObject )
{
JoltPhysicsPlayerController *pController = new JoltPhysicsPlayerController( static_cast<JoltPhysicsObject *>( pObject ) );
m_pPhysicsControllers.AddToTail( pController );
m_pPhysicsControllers.push_back( pController );
return pController;
}
void JoltPhysicsEnvironment::DestroyPlayerController( IPhysicsPlayerController *pPlayerController )
{
JoltPhysicsPlayerController *pController = static_cast< JoltPhysicsPlayerController * >( pPlayerController );
m_pPhysicsControllers.FindAndRemove( pController );
Erase( m_pPhysicsControllers, pController );
delete pController;
}
@ -690,14 +712,14 @@ void JoltPhysicsEnvironment::DestroyPlayerController( IPhysicsPlayerController *
IPhysicsMotionController *JoltPhysicsEnvironment::CreateMotionController( IMotionEvent *pHandler )
{
JoltPhysicsMotionController *pController = new JoltPhysicsMotionController( pHandler );
m_pPhysicsControllers.AddToTail( pController );
m_pPhysicsControllers.push_back( pController );
return pController;
}
void JoltPhysicsEnvironment::DestroyMotionController( IPhysicsMotionController *pController )
{
JoltPhysicsMotionController *pJoltController = static_cast< JoltPhysicsMotionController * >( pController );
m_pPhysicsControllers.FindAndRemove( pJoltController );
Erase( m_pPhysicsControllers, pJoltController );
delete pJoltController;
}
@ -708,14 +730,14 @@ IPhysicsVehicleController *JoltPhysicsEnvironment::CreateVehicleController( IPhy
JoltPhysicsObject *pJoltCarBodyObject = static_cast< JoltPhysicsObject * >( pVehicleBodyObject );
JoltPhysicsVehicleController *pController = new JoltPhysicsVehicleController( this, &m_PhysicsSystem, pJoltCarBodyObject, params, nVehicleType, pGameTrace );
m_pPhysicsControllers.AddToTail( pController );
m_pPhysicsControllers.push_back( pController );
return pController;
}
void JoltPhysicsEnvironment::DestroyVehicleController( IPhysicsVehicleController *pVehicleController )
{
JoltPhysicsVehicleController *pJoltController = static_cast<JoltPhysicsVehicleController *>( pVehicleController );
m_pPhysicsControllers.FindAndRemove( pJoltController );
Erase( m_pPhysicsControllers, pJoltController );
delete pJoltController;
}
@ -753,7 +775,6 @@ void JoltPhysicsEnvironment::Simulate( float deltaTime )
for ( IJoltPhysicsController *pController : m_pPhysicsControllers )
pController->OnPreSimulate( deltaTime );
const int nIntegrationSubSteps = vjolt_substeps_integration.GetInt();
const int nCollisionSubSteps = vjolt_substeps_collision.GetInt();
// If we haven't already, optimize the broadphase, currently this can only happen once per-environment
@ -772,20 +793,20 @@ void JoltPhysicsEnvironment::Simulate( float deltaTime )
int nIterCount = 0;
while ( m_PhysicsSystem.GetNumActiveBodies() && nIterCount < MaxInitialIterations )
{
m_PhysicsSystem.Update( InitialIterationTimescale, 1, InitialSubSteps, tempAllocator, jobSystem );
m_PhysicsSystem.Update( InitialIterationTimescale, InitialSubSteps, tempAllocator, jobSystem );
nIterCount++;
}
}
else
{
// Move things around!
m_PhysicsSystem.Update( deltaTime, nCollisionSubSteps, nIntegrationSubSteps, tempAllocator, jobSystem );
m_PhysicsSystem.Update( deltaTime, nCollisionSubSteps, tempAllocator, jobSystem );
}
}
else
{
// Move things around!
m_PhysicsSystem.Update( deltaTime, nCollisionSubSteps, nIntegrationSubSteps, tempAllocator, jobSystem );
m_PhysicsSystem.Update( deltaTime, nCollisionSubSteps, tempAllocator, jobSystem );
}
m_ContactListener.FlushCallbacks();
@ -878,16 +899,24 @@ void JoltPhysicsEnvironment::SetQuickDelete( bool bQuick )
int JoltPhysicsEnvironment::GetActiveObjectCount() const
{
// If this is the first call, then some objects may have become
// asleep from the initial simulation have their visuals not match where they are.
if ( m_bActiveObjectCountFirst )
m_PhysicsSystem.GetBodies( m_CachedActiveBodies );
else
if ( !m_bActiveObjectCountFirst )
{
m_PhysicsSystem.GetActiveBodies( m_CachedActiveBodies );
// Append any dirty static bodies we need the game side transforms
// to be updated for.
m_CachedActiveBodies.insert( m_CachedActiveBodies.end(), m_DirtyStaticBodies.begin(), m_DirtyStaticBodies.end() );
}
else
{
// If this is the first call, then some objects may have become
// asleep from the initial simulation have their visuals not match where they are.
m_PhysicsSystem.GetBodies( m_CachedActiveBodies );
m_bActiveObjectCountFirst = false;
}
m_bActiveObjectCountFirst = false;
const int nCount = int ( m_CachedActiveBodies.size() );
return nCount;
m_DirtyStaticBodies.clear();
return int( m_CachedActiveBodies.size() );
}
void JoltPhysicsEnvironment::GetActiveObjects( IPhysicsObject **pOutputObjectList ) const
@ -909,7 +938,7 @@ const IPhysicsObject **JoltPhysicsEnvironment::GetObjectList( int *pOutputObject
if ( pOutputObjectCount )
*pOutputObjectCount = nCount;
m_CachedObjects.reserve( nCount );
m_CachedObjects.resize( nCount );
for ( int i = 0; i < nCount; i++ )
{
JPH::Body *pBody = m_PhysicsSystem.GetBodyLockInterfaceNoLock().TryGetBody( m_CachedBodies[ i ] );
@ -1168,12 +1197,20 @@ void JoltPhysicsEnvironment::SweepCollideable( const CPhysCollide *pCollide, con
void JoltPhysicsEnvironment::GetPerformanceSettings( physics_performanceparams_t *pOutput ) const
{
Log_Stub( LOG_VJolt );
if ( pOutput )
*pOutput = m_PerformanceParams;
}
void JoltPhysicsEnvironment::SetPerformanceSettings( const physics_performanceparams_t *pSettings )
{
Log_Stub( LOG_VJolt );
if ( pSettings )
{
m_PerformanceParams = *pSettings;
// Normalize these values to match VPhysics behaviour.
m_PerformanceParams.minFrictionMass = Clamp( m_PerformanceParams.minFrictionMass, 1.0f, VPHYSICS_MAX_MASS );
m_PerformanceParams.maxFrictionMass = Clamp( m_PerformanceParams.maxFrictionMass, 1.0f, VPHYSICS_MAX_MASS );
}
}
//-------------------------------------------------------------------------------------------------
@ -1374,6 +1411,18 @@ void JoltPhysicsEnvironment::NotifyConstraintDisabled( JoltPhysicsConstraint* pC
//-------------------------------------------------------------------------------------------------
void JoltPhysicsEnvironment::AddDirtyStaticBody( const JPH::BodyID &id )
{
m_DirtyStaticBodies.push_back( id );
}
void JoltPhysicsEnvironment::RemoveDirtyStaticBody( const JPH::BodyID &id )
{
Erase( m_DirtyStaticBodies, id );
}
//-------------------------------------------------------------------------------------------------
void JoltPhysicsEnvironment::RemoveBodyAndDeleteObject( JoltPhysicsObject *pObject )
{
JPH::BodyInterface &bodyInterface = m_PhysicsSystem.GetBodyInterfaceNoLock();

View File

@ -11,7 +11,9 @@
#include "vjolt_constraints.h"
#include "vjolt_listener_contact.h"
class JoltBPLayerInterfaceImpl;
class JoltBroadPhaseLayerInterface;
class JoltObjectVsBroadPhaseLayerFilter;
class JoltObjectLayerPairFilter;
// StateRecorder implementation that saves to a fixed buffer
class VJoltStateRecorder final : public JPH::StateRecorder, public CUtlBuffer
@ -164,6 +166,9 @@ public:
void NotifyConstraintDisabled( JoltPhysicsConstraint* pConstraint );
void AddDirtyStaticBody( const JPH::BodyID &id );
void RemoveDirtyStaticBody( const JPH::BodyID &id );
private:
void RemoveBodyAndDeleteObject( JoltPhysicsObject* pObject );
@ -185,7 +190,9 @@ private:
float m_flStepTime = 1.0f / 60.0f;
float m_flAirDensity = 2.0f;
static JoltBPLayerInterfaceImpl s_BPLayerInterface;
static JoltBroadPhaseLayerInterface s_BroadPhaseLayerInterface;
static JoltObjectVsBroadPhaseLayerFilter s_BroadPhaseFilter;
static JoltObjectLayerPairFilter s_LayerPairFilter;
// For GetObjectList
mutable JPH::BodyIDVector m_CachedBodies;
@ -196,11 +203,19 @@ private:
JPH::PhysicsSystem m_PhysicsSystem;
// A vector of objects that were awake, and changed their
// motion type from Dynamic -> Static, so that they can be
// retrieved in GetActiveObjects, and have their visuals updated.
// If we don't do this, objects that get moved, woken, and their
// movement type changed to static will not get their transforms
// updated on the game side.
mutable JPH::BodyIDVector m_DirtyStaticBodies;
std::vector< JoltPhysicsObject * > m_pDeadObjects;
std::vector< JoltPhysicsConstraint * > m_pDeadConstraints;
std::vector< CPhysCollide * > m_pDeadObjectCollides;
CUtlVector< IJoltPhysicsController * > m_pPhysicsControllers;
std::vector< IJoltPhysicsController * > m_pPhysicsControllers;
std::unordered_map< uintp, void * > m_SaveRestorePointerMap;
@ -214,4 +229,6 @@ private:
bool m_EnableConstraintNotify = false;
mutable bool m_bActiveObjectCountFirst = true;
physics_performanceparams_t m_PerformanceParams;
};

View File

@ -5,6 +5,11 @@
struct JoltPhysicsContactPair
{
JoltPhysicsContactPair( JoltPhysicsObject *pObject1, JoltPhysicsObject *pObject2 )
: pObject1(pObject1), pObject2(pObject2)
{
}
JoltPhysicsObject *pObject1 = nullptr;
JoltPhysicsObject *pObject2 = nullptr;
};
@ -35,7 +40,7 @@ public:
{
}
JPH::ValidateResult OnContactValidate( const JPH::Body &inBody1, const JPH::Body &inBody2, const JPH::CollideShapeResult &inCollisionResult ) override
JPH::ValidateResult OnContactValidate( const JPH::Body &inBody1, const JPH::Body &inBody2, JPH::Vec3Arg inBaseOffset, const JPH::CollideShapeResult &inCollisionResult ) override
{
return JPH::ValidateResult::AcceptAllContactsForThisBodyPair;
}
@ -409,11 +414,11 @@ private:
: m_CollisionPair{ pObject1, pObject2 }
// Slart: Note this negated vector, it is important, Portal 2 bouncy paint needs it negated otherwise things fly into the surface they hit
, m_SurfaceNormal( -Vector( inManifold.mWorldSpaceNormal.GetX(), inManifold.mWorldSpaceNormal.GetY(), inManifold.mWorldSpaceNormal.GetZ() ) )
, m_ContactPoint( JoltToSource::Distance( inManifold.mWorldSpaceContactPointsOn1[0] ) )
, m_ContactPoint( JoltToSource::Distance( inManifold.GetWorldSpaceContactPointOn1( 0 ) ) )
// Unused...
, m_ContactSpeed( vec3_origin )
, m_Velocity0( pObject1->GetBody()->GetLinearVelocity() )
, m_Velocity1( pObject1->GetBody()->GetLinearVelocity() )
, m_Velocity1( pObject2->GetBody()->GetLinearVelocity() )
{
}
@ -488,6 +493,22 @@ private:
m_Event.pInternalData = &m_Data;
}
JoltPhysicsCollisionEvent( const JoltPhysicsCollisionEvent &other )
: m_Event( other.m_Event )
, m_Data ( other.m_Data )
{
// Re-target the event's internal data pointer to our own structure.
m_Event.pInternalData = &m_Data;
}
JoltPhysicsCollisionEvent( JoltPhysicsCollisionEvent &&other )
: m_Event( std::move( other.m_Event ) )
, m_Data ( std::move( other.m_Data ) )
{
// Re-target the event's internal data pointer to our own structure.
m_Event.pInternalData = &m_Data;
}
static bool IsCollision( JoltPhysicsObject *pObject1, JoltPhysicsObject *pObject2 )
{
bool bIsCollision = ( pObject1->GetCallbackFlags() & pObject2->GetCallbackFlags() ) & CALLBACK_GLOBAL_COLLISION;
@ -531,7 +552,7 @@ private:
{
for ( uint32 thread = m_Mask; thread; thread &= thread - 1 )
{
const uint32 i = tzcnt( thread );
const uint32 i = JPH::CountTrailingZeros( thread );
for ( auto &event : m_Events[ i ] )
func( event );

View File

@ -31,6 +31,7 @@ JoltPhysicsObject::JoltPhysicsObject( JPH::Body *pBody, JoltPhysicsEnvironment *
, m_pGameData( pParams->pGameData )
, m_materialIndex( Max( nMaterialIndex, 0 ) ) // Sometimes we get passed -1.
, m_flVolume( pParams->volume )
, m_pName( pParams->pName )
{
// Josh:
// Assert that m_pGameData is the first element, some games
@ -68,6 +69,8 @@ JoltPhysicsObject::~JoltPhysicsObject()
for ( int i = m_destroyedListeners.Count() - 1; i >= 0; i-- )
m_destroyedListeners[ i ]->OnJoltPhysicsObjectDestroyed( this );
m_pEnvironment->RemoveDirtyStaticBody( GetBodyID() );
JPH::BodyInterface& bodyInterface = m_pPhysicsSystem->GetBodyInterfaceNoLock();
bodyInterface.DestroyBody( GetBodyID() );
}
@ -229,6 +232,11 @@ void JoltPhysicsObject::Wake()
JPH::BodyInterface& bodyInterface = m_pPhysicsSystem->GetBodyInterfaceNoLock();
bodyInterface.ActivateBody( m_pBody->GetID() );
}
else
{
// See other comments in UpdateLayer.
m_pEnvironment->AddDirtyStaticBody( m_pBody->GetID() );
}
}
void JoltPhysicsObject::Sleep()
@ -273,7 +281,7 @@ void JoltPhysicsObject::SetMass( float mass )
JPH::MassProperties massProperties = m_pBody->GetShape()->GetMassProperties();
massProperties.ScaleToMass( mass );
massProperties.mInertia( 3, 3 ) = 1.0f;
pMotionProperties->SetMassProperties( massProperties );
pMotionProperties->SetMassProperties( JPH::EAllowedDOFs::All, massProperties );
CalculateBuoyancy();
}
@ -389,7 +397,7 @@ float JoltPhysicsObject::GetSphereRadius() const
return 0.0f;
const JPH::SphereShape *pSphereShape = static_cast< const JPH::SphereShape * >( m_pBody->GetShape() );
return pSphereShape->GetRadius();
return JoltToSource::Distance( pSphereShape->GetRadius() );
}
void JoltPhysicsObject::SetSphereRadius( float radius )
@ -909,8 +917,7 @@ const CPhysCollide *JoltPhysicsObject::GetCollide() const
const char *JoltPhysicsObject::GetName() const
{
// Slart: Jolt used to store debug names in JPH::Body, but it was removed. So now everybody's NoName.
return "NoName";
return m_pName;
}
//-------------------------------------------------------------------------------------------------
@ -972,7 +979,7 @@ void JoltPhysicsObject::RemoveTrigger()
const JPH::Shape *pShape = GetCollide()->ToShape();
m_pPhysicsSystem->GetNarrowPhaseQueryNoLock().CollideShape(
pShape, JPH::Vec3::sReplicate( 1.0f ), queryTransform, collideSettings, collector,
pShape, JPH::Vec3::sReplicate( 1.0f ), queryTransform, collideSettings, JPH::Vec3::sZero(), collector,
JPH::SpecifiedBroadPhaseLayerFilter( BroadPhaseLayers::MOVING ), JPH::SpecifiedObjectLayerFilter( Layers::MOVING ), body_filter );
}
@ -1222,6 +1229,17 @@ void JoltPhysicsObject::UpdateLayer()
if ( !bStatic && !IsControlledByGame() )
{
bool bStaticMotionType = bStaticSolid || bPinned;
// If we are transfering to being static, and we were active
// add us to a list of bodies on the environment so we can be included in
// GetActiveObjects for the next step.
// This way the game can correctly update the transforms on the game side
// when move -> wake -> become pinned happens.
if ( bStaticMotionType && m_pBody->IsActive() )
m_pEnvironment->AddDirtyStaticBody( m_pBody->GetID() );
else if ( !bStaticMotionType )
m_pEnvironment->RemoveDirtyStaticBody( m_pBody->GetID() );
bodyInterface.SetMotionType( m_pBody->GetID(), bStaticMotionType ? JPH::EMotionType::Static : JPH::EMotionType::Dynamic, JPH::EActivation::Activate );
}

View File

@ -239,6 +239,7 @@ private:
// remain un-named offset by the vtable to get to this
// instead of calling GetGameData().
void *m_pGameData = nullptr;
const char *m_pName = "NoName";
uint16 m_gameFlags = 0;
uint16 m_gameIndex = 0;
@ -283,7 +284,3 @@ inline float GetInvEffectiveMass( JoltPhysicsObject *pObject0, JoltPhysicsObject
return ( pObject0->IsStatic() ? 0.0f : pObject0->GetInvMass() ) + ( pObject1->IsStatic() ? 0.0f : pObject1->GetInvMass() );
}
inline float GetSpringFrequency( float flConstant, JoltPhysicsObject *pObject0, JoltPhysicsObject *pObject1 )
{
return sqrt( flConstant * GetInvEffectiveMass( pObject0, pObject1 ) ) / ( 2.0f * M_PI_F );
}

View File

@ -54,7 +54,7 @@ void JoltPhysicsObjectPairHash::RemoveObjectPair( void *pObject0, void *pObject1
bool JoltPhysicsObjectPairHash::IsObjectPairInHash( void *pObject0, void *pObject1 )
{
auto pair = CreateSortedPair( pObject0, pObject1 );
return m_PairHashes[ GetHashArrayIndex( PointerHasher{}( pair ) ) ].contains( pair );
return Contains( m_PairHashes[GetHashArrayIndex( PointerHasher{}( pair ) )], pair );
}
void JoltPhysicsObjectPairHash::RemoveAllPairsForObject( void *pObject0 )
@ -71,7 +71,7 @@ void JoltPhysicsObjectPairHash::RemoveAllPairsForObject( void *pObject0 )
bool JoltPhysicsObjectPairHash::IsObjectInHash( void *pObject0 )
{
return m_Objects.contains( pObject0 );
return Contains( m_Objects, pObject0 );
}
//-------------------------------------------------------------------------------------------------

View File

@ -475,6 +475,36 @@ void JoltPhysicsParseKV::NextBlock()
//-------------------------------------------------------------------------------------------------
static constexpr const char* DummyParserKeyValues = R"(
"PhysProps_Fallback"
{
"solid"
{
"dummy" "1"
}
"vehicle"
{
"dummy" "1"
}
"vehicle_sounds"
{
"dummy" "1"
}
"vehicle_view"
{
"dummy" "1"
}
"ragdollconstraint"
{
"dummy" "1"
}
"collisionrules"
{
"dummy" "1"
}
}
)";
IVPhysicsKeyParser *CreateVPhysicsKeyParser( const char *pKeyData, bool bIsPacked )
{
VJoltAssertMsg( !bIsPacked, "Packed VPhysics KV not supported. You should not get here anyway as we do not emit it." );
@ -483,8 +513,17 @@ IVPhysicsKeyParser *CreateVPhysicsKeyParser( const char *pKeyData, bool bIsPacke
KeyValues *pszKV = HeaderlessKVBufferToKeyValues( pKeyData, "VPhysicsKeyParse" );
// Josh: Ideally we would return nullptr here, but that breaks a lot of things.
// If we fail to parse the KV, simply just fall-back to a dummy KV that will cause things
// to get zero-initialized.
// In the future, we may want to add a KV patching pass to fix up broken model and vehicle data.
if ( !pszKV )
return nullptr;
{
Log_Warning( LOG_VJolt, "CreateVPhysicsKeyParser: Encountered invalid KV data. Falling back to a dummy KV. You may notice a broken prop/vehicle.\n" );
pszKV = new KeyValues( "VPhysicsKeyParse_Fallback" );
pszKV->LoadFromBuffer( "VPhysicsKeyParse_Fallback", DummyParserKeyValues );
}
return new JoltPhysicsParseKV( pszKV );
}

View File

@ -11,7 +11,7 @@ public:
JoltStateRecorderFile( JoltStateRecorderFile &&other )
: StateRecorder( other )
, m_Stream( move( other.m_Stream ) )
, m_Stream( std::move( other.m_Stream ) )
{
}

View File

@ -234,6 +234,38 @@ KeyValues *JoltPhysicsSurfaceProps::SurfacePropsToKeyValues( const char *pszBuff
//-------------------------------------------------------------------------------------------------
void *JoltPhysicsSurfaceProps::GetIVPMaterial( int nIndex )
{
Log_Stub( LOG_VJolt );
return nullptr;
}
int JoltPhysicsSurfaceProps::GetIVPMaterialIndex( const void *pMaterial ) const
{
Log_Stub( LOG_VJolt );
return (int)(uintp)( pMaterial );
}
void *JoltPhysicsSurfaceProps::GetIVPManager( void )
{
Log_Stub( LOG_VJolt );
return nullptr;
}
int JoltPhysicsSurfaceProps::RemapIVPMaterialIndex( int nIndex ) const
{
Log_Stub( LOG_VJolt );
return nIndex;
}
const char *JoltPhysicsSurfaceProps::GetReservedMaterialName( int nMaterialIndex ) const
{
Log_Stub( LOG_VJolt );
return "default";
}
//-------------------------------------------------------------------------------------------------
JoltPhysicsMaterialIndexSaveOps JoltPhysicsMaterialIndexSaveOps::s_Instance;
void JoltPhysicsMaterialIndexSaveOps::Save( const SaveRestoreFieldInfo_t &fieldInfo, ISave *pSave )

View File

@ -43,6 +43,13 @@ public:
ISaveRestoreOps *GetMaterialIndexDataOps() const override_portal2;
// GMod-specific internal gubbins that was exposed in the public interface.
void *GetIVPMaterial( int nIndex ) override_gmod;
int GetIVPMaterialIndex( const void *pMaterial ) const override_gmod;
void *GetIVPManager( void ) override_gmod;
int RemapIVPMaterialIndex( int nIndex ) const override_gmod;
const char *GetReservedMaterialName( int nMaterialIndex ) const override_gmod;
public:
static JoltPhysicsSurfaceProps& GetInstance() { return s_PhysicsSurfaceProps; }

View File

@ -312,53 +312,22 @@ void ActOnSubShapes( const JPH::Shape *pShape, Func ShapeFunc )
ShapeFunc( static_cast< const ShapeType * >( UndecorateShape( pShape ) ), JPH::Mat44::sIdentity() );
}
inline uint32 popcntStep( uint32 n, uint32 mask, uint32 shift )
template< typename T, typename Value >
constexpr void Erase( T &c, const Value &value )
{
return ( n & mask ) + ( ( n & ~mask ) >> shift );
}
inline uint32 popcnt( uint32 n )
{
n = popcntStep(n, 0x55555555, 1);
n = popcntStep(n, 0x33333333, 2);
n = popcntStep(n, 0x0F0F0F0F, 4);
n = popcntStep(n, 0x00FF00FF, 8);
n = popcntStep(n, 0x0000FFFF, 16);
return n;
auto it = std::remove( c.begin(), c.end(), value );
c.erase( it, c.end() );
}
inline uint32 tzcnt( uint32 n )
template< typename T, typename Pred >
constexpr void EraseIf( T &c, Pred pred )
{
#if defined(_MSC_VER) && !defined(__clang__)
return _tzcnt_u32( n );
#elif defined(__BMI__)
return __tzcnt_u32( n );
#elif defined(__GNUC__) || defined(__clang__)
// tzcnt is encoded as rep bsf, so we can use it on all
// processors, but the behaviour of zero inputs differs:
// - bsf: zf = 1, cf = ?, result = ?
// - tzcnt: zf = 0, cf = 1, result = 32
// We'll have to handle this case manually.
uint32 res;
uint32 tmp;
asm (
"tzcnt %2, %0;"
"mov $32, %1;"
"test %2, %2;"
"cmovz %1, %0;"
: "=&r" (res), "=&r" (tmp)
: "r" (n)
: "cc");
return res;
#else
uint32 r = 31;
n &= -n;
r -= ( n & 0x0000FFFF ) ? 16 : 0;
r -= ( n & 0x00FF00FF ) ? 8 : 0;
r -= ( n & 0x0F0F0F0F ) ? 4 : 0;
r -= ( n & 0x33333333 ) ? 2 : 0;
r -= ( n & 0x55555555 ) ? 1 : 0;
return n != 0 ? r : 32;
#endif
auto it = std::remove_if( c.begin(), c.end(), pred );
c.erase( it, c.end() );
}
template< typename T, typename Value >
constexpr bool Contains( const T &c, const Value &value )
{
return c.find( value ) != c.end();
}

View File

@ -0,0 +1,14 @@
//-----------------------------------------------------------------------------
// VPHYSICS_JOLT_AVX2.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro PROJNAME "vphysics_jolt_avx2"
$Conditional VOLT_SSE2 "0"
$Conditional VOLT_SSE42 "0"
$Conditional VOLT_AVX2 "1"
$Macro VOLTARCH "AVX2"
$Include "vphysics_jolt_inc.vpc"

View File

@ -1,5 +1,5 @@
//-----------------------------------------------------------------------------
// VPHYSICS_JOLT_INC.INC
// VPHYSICS_JOLT_INC.VPC
//
// Project Script
//-----------------------------------------------------------------------------
@ -20,6 +20,32 @@ $Configuration
$Create/UsePrecompiledHeader "Use Precompiled Header (/Yu)"
$Create/UsePCHThroughFile "cbase.h"
}
$Linker
{
// For Alien Swarm, we don't get the ability to build our own tier1 or mathlib
// which means we need to be compatible with the .libs provided built for
// ancient Visual Studio.
$AdditionalDependencies "$BASE legacy_stdio_definitions.lib" [$GAME_ASW]
}
}
$Configuration "Debug"
{
$General
{
$OutputDirectory ".\Debug_$VOLTARCH$PLATSUBDIR" [$WINDOWS]
$IntermediateDirectory ".\Debug_$VOLTARCH$PLATSUBDIR" [$WINDOWS]
}
}
$Configuration "Release"
{
$General
{
$OutputDirectory ".\Release_$VOLTARCH$PLATSUBDIR" [$WINDOWS]
$IntermediateDirectory ".\Release_$VOLTARCH$PLATSUBDIR" [$WINDOWS]
}
}
$Project "$PROJNAME"
@ -134,7 +160,9 @@ $Project "$PROJNAME"
$Folder "Link Libraries"
{
$Lib "joltphysics"
$Lib "joltphysics_avx2" [$VOLT_AVX2]
$Lib "joltphysics_sse42" [$VOLT_SSE42]
$Lib "joltphysics_sse2" [$VOLT_SSE2]
$Lib "mathlib"
$Lib "tier2"
}

View File

@ -0,0 +1,14 @@
//-----------------------------------------------------------------------------
// VPHYSICS_JOLT_SSE2.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro PROJNAME "vphysics_jolt_sse2"
$Conditional VOLT_SSE2 "1"
$Conditional VOLT_SSE42 "0"
$Conditional VOLT_AVX2 "0"
$Macro VOLTARCH "SSE2"
$Include "vphysics_jolt_inc.vpc"

View File

@ -4,6 +4,11 @@
// Project Script
//-----------------------------------------------------------------------------
$Macro PROJNAME "vphysics_jolt"
$Macro PROJNAME "vphysics_jolt_sse42"
$Conditional VOLT_SSE2 "0"
$Conditional VOLT_SSE42 "1"
$Conditional VOLT_AVX2 "0"
$Macro VOLTARCH "SSE42"
$Include "vphysics_jolt_inc.vpc"

View File

@ -0,0 +1,208 @@
//=================================================================================================
//
// The base physics DLL interface
//
// This is a thin CPU-agnostic wrapper for the actual Volt DLLs which are named
// vphysics_jolt_sse2.dll, vphysics_jolt_sse42.dll and vphysics_jolt_avx2.dll
//
//=================================================================================================
#include "tier0/basetypes.h"
#include "tier1/interface.h"
#include "vphysics_interface.h"
#ifdef _WIN32
#include <intrin.h>
#else
#include <cpuid.h>
#endif
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-------------------------------------------------------------------------------------------------
class PhysicsWrapper final : public CBaseAppSystem<IPhysics>
{
public:
bool Connect( CreateInterfaceFn factory ) override;
void Disconnect() override;
InitReturnVal_t Init() override;
void Shutdown() override;
void *QueryInterface( const char *pInterfaceName ) override;
IPhysicsEnvironment *CreateEnvironment() override;
void DestroyEnvironment( IPhysicsEnvironment *pEnvironment ) override;
IPhysicsEnvironment *GetActiveEnvironmentByIndex( int index ) override;
IPhysicsObjectPairHash *CreateObjectPairHash() override;
void DestroyObjectPairHash( IPhysicsObjectPairHash *pHash ) override;
IPhysicsCollisionSet *FindOrCreateCollisionSet( unsigned int id, int maxElementCount ) override;
IPhysicsCollisionSet *FindCollisionSet( unsigned int id ) override;
void DestroyAllCollisionSets() override;
public:
static PhysicsWrapper &GetInstance() { return s_PhysicsInterface; }
private:
bool InitWrapper();
CSysModule *m_pActualPhysicsModule;
IPhysics *m_pActualPhysicsInterface;
static PhysicsWrapper s_PhysicsInterface;
};
PhysicsWrapper PhysicsWrapper::s_PhysicsInterface;
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( PhysicsWrapper, IPhysics, VPHYSICS_INTERFACE_VERSION, PhysicsWrapper::GetInstance() );
//-------------------------------------------------------------------------------------------------
enum CPULevel_t
{
CPU_HAS_SSE2,
CPU_HAS_SSE42,
CPU_HAS_AVX2,
};
static void GetCPUID( int *pInfo, int func, int subfunc )
{
#ifdef _WIN32
__cpuidex( pInfo, func, subfunc );
#else
__cpuid_count( func, subfunc, pInfo[0], pInfo[1], pInfo[2], pInfo[3] );
#endif
}
static CPULevel_t GetCPULevel()
{
int cpuInfo[4];
CPULevel_t cpuLevel = CPU_HAS_SSE2;
GetCPUID( cpuInfo, 0, 0 ); // Get the number of functions
const int numFuncs = cpuInfo[0];
if ( numFuncs >= 7 )
{
GetCPUID( cpuInfo, 7, 0 ); // Call function 7
bool hasAVX2 = cpuInfo[1] & ( 1 << 5 ); // 5 is the AVX2 bit
if ( hasAVX2 )
cpuLevel = CPU_HAS_AVX2;
}
else
{
GetCPUID( cpuInfo, 1, 0 ); // Call function 1
bool hasSSE42 = cpuInfo[2] & ( 1 << 20 ); // 20 is the SSE42 bit
if ( hasSSE42 )
cpuLevel = CPU_HAS_SSE42;
}
return cpuLevel;
}
static const char *GetModuleFromCPULevel( CPULevel_t level )
{
switch ( level )
{
case CPU_HAS_AVX2: return "vphysics_jolt_avx2" DLL_EXT_STRING;
case CPU_HAS_SSE42: return "vphysics_jolt_sse42" DLL_EXT_STRING;
default: return "vphysics_jolt_sse2" DLL_EXT_STRING;
}
}
// Tries to load the actual vphysics DLL
bool PhysicsWrapper::InitWrapper()
{
if ( m_pActualPhysicsInterface )
return true;
const char *pModuleName = GetModuleFromCPULevel( GetCPULevel() );
if ( !Sys_LoadInterface( pModuleName, VPHYSICS_INTERFACE_VERSION, &m_pActualPhysicsModule, (void **)&m_pActualPhysicsInterface ) )
return false;
return true;
}
bool PhysicsWrapper::Connect( CreateInterfaceFn factory )
{
if ( !InitWrapper() )
return false;
return m_pActualPhysicsInterface->Connect( factory );
}
void PhysicsWrapper::Disconnect()
{
m_pActualPhysicsInterface->Disconnect();
Sys_UnloadModule( m_pActualPhysicsModule );
}
//-------------------------------------------------------------------------------------------------
InitReturnVal_t PhysicsWrapper::Init()
{
return m_pActualPhysicsInterface->Init();
}
void PhysicsWrapper::Shutdown()
{
m_pActualPhysicsInterface->Shutdown();
}
void *PhysicsWrapper::QueryInterface( const char *pInterfaceName )
{
// This function can be called before Connect, so try and load the real DLL early
if ( !InitWrapper() )
return nullptr;
return m_pActualPhysicsInterface->QueryInterface( pInterfaceName );
}
//-------------------------------------------------------------------------------------------------
IPhysicsEnvironment *PhysicsWrapper::CreateEnvironment()
{
return m_pActualPhysicsInterface->CreateEnvironment();
}
void PhysicsWrapper::DestroyEnvironment( IPhysicsEnvironment *pEnvironment )
{
m_pActualPhysicsInterface->DestroyEnvironment( pEnvironment );
}
IPhysicsEnvironment *PhysicsWrapper::GetActiveEnvironmentByIndex( int index )
{
return m_pActualPhysicsInterface->GetActiveEnvironmentByIndex( index );
}
//-------------------------------------------------------------------------------------------------
IPhysicsObjectPairHash *PhysicsWrapper::CreateObjectPairHash()
{
return m_pActualPhysicsInterface->CreateObjectPairHash();
}
void PhysicsWrapper::DestroyObjectPairHash( IPhysicsObjectPairHash *pHash )
{
m_pActualPhysicsInterface->DestroyObjectPairHash( pHash );
}
//-------------------------------------------------------------------------------------------------
IPhysicsCollisionSet *PhysicsWrapper::FindOrCreateCollisionSet( unsigned int id, int maxElementCount )
{
return m_pActualPhysicsInterface->FindOrCreateCollisionSet( id, maxElementCount );
}
IPhysicsCollisionSet *PhysicsWrapper::FindCollisionSet( unsigned int id )
{
return m_pActualPhysicsInterface->FindCollisionSet( id );
}
void PhysicsWrapper::DestroyAllCollisionSets()
{
m_pActualPhysicsInterface->DestroyAllCollisionSets();
}

View File

@ -0,0 +1,12 @@
//-----------------------------------------------------------------------------
// VPHYSICS_WRAPPER_EXTERNAL.VPC
//
// Project Script
//-----------------------------------------------------------------------------
// Existing Source engine games don't know about Volt, so public wrapper builds
// just output "vphysics.dll"
$Macro WRAPPER_NAME "vphysics"
$Include "vphysics_wrapper_inc.vpc"

View File

@ -0,0 +1,53 @@
//-----------------------------------------------------------------------------
// VPHYSICS_WRAPPER.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$MacroRequired "WRAPPER_NAME"
$Macro SRCDIR "..\.."
$Macro OUTBINNAME "$WRAPPER_NAME"
$Macro OUTBINDIR "$SRCDIR\..\$GAMEDIR\bin"
$Include "$SRCDIR\vpc_scripts\source_dll_base.vpc"
$Configuration
{
$Linker
{
// For Alien Swarm, we don't get the ability to build our own tier1 or mathlib
// which means we need to be compatible with the .libs provided built for
// ancient Visual Studio.
$AdditionalDependencies "$BASE legacy_stdio_definitions.lib" [$GAME_ASW]
}
}
$Project "vphysics_wrapper"
{
$Folder "Source Files"
{
$File "vphysics_wrapper.cpp"
}
$Folder "Header Files"
{
}
$Folder "Interface"
{
$File "$SRCDIR\public\vphysics_interface.h"
$File "$SRCDIR\public\vphysics\collision_set.h"
$File "$SRCDIR\public\vphysics\constraints.h"
$File "$SRCDIR\public\vphysics\friction.h"
$File "$SRCDIR\public\vphysics\object_hash.h"
$File "$SRCDIR\public\vphysics\performance.h"
$File "$SRCDIR\public\vphysics\player_controller.h"
$File "$SRCDIR\public\vphysics\stats.h"
$File "$SRCDIR\public\vphysics\vehicles.h"
}
$Folder "Link Libraries"
{
}
}

View File

@ -0,0 +1,11 @@
//-----------------------------------------------------------------------------
// VPHYSICS_WRAPPER_INTERNAL.VPC
//
// Project Script
//-----------------------------------------------------------------------------
// This file is used when building for an engine that is aware of vphysics_jolt
$Macro WRAPPER_NAME "vphysics_jolt"
$Include "vphysics_wrapper_inc.vpc"