commit
11adbb57bd
@ -0,0 +1,7 @@
|
||||
# This file is here so GitHub uses 4-space tabs...
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
@ -0,0 +1,52 @@
|
||||
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
|
@ -0,0 +1,3 @@
|
||||
[submodule "joltphysics/src"]
|
||||
path = joltphysics/src
|
||||
url = https://github.com/jrouwe/JoltPhysics/
|
@ -0,0 +1,7 @@
|
||||
Copyright 2022 Joshua Ashton and Josh Dowell (Slartibarty)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -0,0 +1,100 @@
|
||||

|
||||
|
||||
## What is Volt? โก
|
||||
|
||||
Volt (VPhysics Jolt) is a replacement for Source's VPhysics which uses IVP/Havok<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.
|
||||
|
||||
In our testing, the performance overhead from having thousands of objects moving at once, now comes from the client code needing to update/render, as going out of the PVS of these objects will still cause them to be simulated, but will no longer be rendered.
|
||||
|
||||
## Features
|
||||
|
||||
Volt is mostly feature complete, but is missing some things such as support for raycast vehicles, breakable constraints, and perhaps other things we've missed!
|
||||
|
||||
It is our goal to implement any missing features at some point.
|
||||
|
||||
Below is a feature table of Volt vs VPhysics and the Bullet VPhysics project.
|
||||
If we missed anything we don't support or we do, feel free to add to it.
|
||||
It is not meant to be a bash on anyone elses work however, the Bullet VPhysics project was a great inspiration to us!
|
||||
|
||||
| Feature | VPhysics | Volt (VPhysics Jolt) | Bullet VPhysics |
|
||||
|:--------------|:--------:|:-------------:|:---------------:|
|
||||
| Constraints (except Pulleys) | โ๏ธ | โ๏ธ | โ๏ธ |
|
||||
| Pulleys | โ๏ธ | โ | โ |
|
||||
| Breakable constraints | โ๏ธ | โ | โ |
|
||||
| Motors (Motion Controllers) | โ๏ธ | โ๏ธ | โ๏ธ |
|
||||
| Motors (Constraint) | โ๏ธ | โ๏ธ | โ |
|
||||
| Ragdolls | โ๏ธ | โ๏ธ (some bugs) | โ๏ธ |
|
||||
| Triggers | โ๏ธ | โ๏ธ | โ |
|
||||
| Object touch callbacks | โ๏ธ | โ๏ธ | โ |
|
||||
| Prop damage/breaking | โ๏ธ | โ๏ธ | โ |
|
||||
| Fluid events | โ๏ธ | โ๏ธ | โ |
|
||||
| Prop splashing effects | โ๏ธ | โ๏ธ | โ |
|
||||
| Wheeled Vehicles | โ๏ธ | โ๏ธ | โ๏ธ |
|
||||
| Raycast Vehicles (ie. Airboat) | โ๏ธ | โ | ใฐ๏ธ (janky) |
|
||||
| NPCs/Doors (Shadow Controllers) | โ๏ธ | โ๏ธ | โ๏ธ |
|
||||
| Save/Restore Support | โ๏ธ | โ๏ธ | โ |
|
||||
| Portal Support | โ๏ธ | โ๏ธ | โ |
|
||||
| Game per-object collide callback support<br>eg. no-collide | โ๏ธ | โ๏ธ | โ |
|
||||
| Crash-resistant solver | โ | โ๏ธ | (no data) |
|
||||
| Supports thousands of objects without lag | โ | โ๏ธ | โ |
|
||||
| Multithreaded | โ | โ๏ธ | โ๏ธ (partially) |
|
||||
| Proper player controller | โ๏ธ | โ (needs work!) | โ๏ธ (partially) |
|
||||
|
||||
## Bugs
|
||||
|
||||
VPhysics Jolt is not without its flaws, however. See the [issue tracker](https://github.com/Joshua-Ashton/VPhysics-Jolt/issues) for bugs that are known.
|
||||
|
||||
There are definitely going to be bugs that we don't know about or haven't encountered, or different quirks across engine branches.
|
||||
|
||||
## How to build
|
||||
|
||||
The Volt code is provided as-is, it is up to you to build it for your SDK, etc.
|
||||
|
||||
Volt should build fine against Source SDK 2013 and Alien Swarm SDK on a MSVC or GCC compiler with at least C++20 support.
|
||||
|
||||
*If you are building directly against the public SDK 2013 and Alien Swarm SDKs, you will need to do minor work to memoverride.cpp to make it compatible with the newer compilers and newer Windows SDKs.*
|
||||
|
||||
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.
|
||||
|
||||
## Download
|
||||
|
||||
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
|
||||
|
||||
### Lots of Melons + Dumpster
|
||||
[](https://www.youtube.com/watch?v=gPDQkmfQCsc "Lots of Melons + Dumpster")
|
||||
|
||||
### Physically Simulated Chain
|
||||
[](https://www.youtube.com/watch?v=tVmQTmbSJM0 "Physically Simulated Chain")
|
||||
|
||||
### Lots of Balls Test
|
||||
[](https://www.youtube.com/watch?v=tYfiTyRtmz8 "Lots of Balls Test")
|
||||
|
||||
### Wheels + Weld Car Dupe Test
|
||||
[](https://www.youtube.com/watch?v=5_QbbXbIrg8 "Weld Car Dupe Test")
|
||||
|
||||
### Door + NPC (Physics Shadowed Objects) Test
|
||||
[](https://www.youtube.com/watch?v=SdEj7HTuJmU "Door + NPC (Physics Shadowed Objects) Test")
|
||||
|
||||
### Lots of Cubes + Ragdolls + Funnel
|
||||
[](https://www.youtube.com/watch?v=CLVnSwg33Dk "Lots of Cubes + Ragdolls + Funnel")
|
||||
|
||||
### Slow Mo Cubes
|
||||
[](https://www.youtube.com/watch?v=GzW_4bufwEk "Slow Mo Cubes")
|
||||
|
||||
### Propane in Dumpster
|
||||
[](https://www.youtube.com/watch?v=10vvRJVHGQc "Propane in Dumpster")
|
||||
|
||||
*Have some cool media of stuff going on in Volt you'd like to add? Feel free to make a pull request!*
|
||||
|
||||
## Projects using Volt
|
||||
|
||||
### [Portal 2: Desolation](https://emberspark.games/desolation/)
|
||||
|
||||
### [Prelude Online](https://prelude.online/)
|
||||
|
||||
# Have fun! ๐ธโก
|
After Width: | Height: | Size: 1.9 MiB |
@ -0,0 +1,416 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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"
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
//
|
||||
// Configuration settings for Jolt Physics
|
||||
//
|
||||
|
||||
$Configuration
|
||||
{
|
||||
$Compiler
|
||||
{
|
||||
$AdditionalIncludeDirectories "$BASE;$SRCDIR\vphysics_jolt\joltphysics\src"
|
||||
|
||||
$PreprocessorDefinitions "$BASE;JPH_DISABLE_CUSTOM_ALLOCATOR;JPH_DEBUG_RENDERER"
|
||||
$PreprocessorDefinitions "$BASE;JPH_ENABLE_ASSERTS" [$DEVELOPMENT_ONLY]
|
||||
//$PreprocessorDefinitions "$BASE;JPH_PROFILE_ENABLED" [$DEVELOPMENT_ONLY]
|
||||
|
||||
// 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]
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
#include "Jolt/Jolt.h"
|
@ -0,0 +1 @@
|
||||
Subproject commit 22d675437edc441329ed244f632807a8789fa5a6
|
@ -0,0 +1,2 @@
|
||||
|
||||
#include "cbase.h"
|
@ -0,0 +1,114 @@
|
||||
//=================================================================================================
|
||||
//
|
||||
// This is the precompiled header
|
||||
//
|
||||
//=================================================================================================
|
||||
|
||||
#pragma once
|
||||
|
||||
// Tier0
|
||||
#include "tier0/basetypes.h"
|
||||
#include "tier0/dbg.h"
|
||||
#ifndef GAME_SDK2013
|
||||
#include "tier0/logging.h"
|
||||
#endif
|
||||
|
||||
#ifdef GAME_SDK2013
|
||||
#include "compat/compat_sdk2013.h"
|
||||
#endif
|
||||
|
||||
#include "compat/branch_overrides.h"
|
||||
|
||||
// STD
|
||||
// Ensure cmath is included everywhere
|
||||
// so we get those sweet overloaded maths functions
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
|
||||
// STL
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include <fstream>
|
||||
|
||||
// Mathlib
|
||||
#include "mathlib/mathlib.h"
|
||||
#include "mathlib/vector.h"
|
||||
|
||||
// Tier1
|
||||
#include "tier1/tier1.h"
|
||||
#include "tier1/strtools.h"
|
||||
#include "tier1/interface.h"
|
||||
#include "tier1/keyvalues.h"
|
||||
#include "tier1/UtlStringMap.h"
|
||||
#include "tier1/utlbuffer.h"
|
||||
|
||||
// Misc
|
||||
#ifdef JPH_DEBUG_RENDERER
|
||||
#include "engine/ivdebugoverlay.h"
|
||||
#endif
|
||||
#include "bspfile.h"
|
||||
#include "cmodel.h"
|
||||
#include "const.h"
|
||||
#include "isaverestore.h"
|
||||
#include "vcollide_parse.h"
|
||||
|
||||
// VPhysics Interface
|
||||
#include "vphysics_interface.h"
|
||||
#include "vphysics/collision_set.h"
|
||||
#include "vphysics/constraints.h"
|
||||
#include "vphysics/friction.h"
|
||||
#include "vphysics/object_hash.h"
|
||||
#include "vphysics/performance.h"
|
||||
#include "vphysics/player_controller.h"
|
||||
#include "vphysics/stats.h"
|
||||
#include "vphysics/vehicles.h"
|
||||
#include "vphysics/virtualmesh.h"
|
||||
|
||||
// Jolt
|
||||
#include <Jolt/Jolt.h>
|
||||
#include <Jolt/RegisterTypes.h>
|
||||
|
||||
#include <Jolt/Core/TempAllocator.h>
|
||||
#include <Jolt/Core/JobSystemThreadPool.h>
|
||||
#include <Jolt/Core/Factory.h>
|
||||
|
||||
#include <Jolt/Skeleton/Skeleton.h>
|
||||
|
||||
#include <Jolt/Physics/PhysicsSystem.h>
|
||||
#include <Jolt/Physics/PhysicsScene.h>
|
||||
#include <Jolt/Physics/Body/Body.h>
|
||||
#include <Jolt/Physics/Body/BodyCreationSettings.h>
|
||||
#include <Jolt/Physics/Collision/RayCast.h>
|
||||
#include <Jolt/Physics/Collision/CastResult.h>
|
||||
#include <Jolt/Physics/Collision/CollidePointResult.h>
|
||||
#include <Jolt/Physics/Collision/Shape/BoxShape.h>
|
||||
#include <Jolt/Physics/Collision/Shape/SphereShape.h>
|
||||
#include <Jolt/Physics/Collision/Shape/MeshShape.h>
|
||||
#include <Jolt/Physics/Collision/Shape/StaticCompoundShape.h>
|
||||
#include <Jolt/Physics/Collision/Shape/ConvexHullShape.h>
|
||||
#include <Jolt/Physics/Collision/Shape/RotatedTranslatedShape.h>
|
||||
#include <Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.h>
|
||||
#include <Jolt/Physics/Ragdoll/Ragdoll.h>
|
||||
#include <Jolt/Physics/Collision/ShapeCast.h>
|
||||
#include <Jolt/Physics/Collision/CollisionDispatch.h>
|
||||
#include <Jolt/Physics/Collision/CollisionCollectorImpl.h>
|
||||
#include <Jolt/Physics/Collision/GroupFilter.h>
|
||||
#include <Jolt/Physics/Collision/GroupFilterTable.h>
|
||||
#include <Jolt/Physics/Constraints/ConeConstraint.h>
|
||||
#include <Jolt/Physics/Constraints/PointConstraint.h>
|
||||
#include <Jolt/Physics/Constraints/HingeConstraint.h>
|
||||
#include <Jolt/Physics/Constraints/SwingTwistConstraint.h>
|
||||
#include <Jolt/Physics/Constraints/FixedConstraint.h>
|
||||
#include <Jolt/Physics/Constraints/SixDOFConstraint.h>
|
||||
#include <Jolt/Physics/Constraints/DistanceConstraint.h>
|
||||
#include <Jolt/Physics/Constraints/SliderConstraint.h>
|
||||
#include <Jolt/Physics/Vehicle/VehicleConstraint.h>
|
||||
#include <Jolt/Physics/Vehicle/VehicleCollisionTester.h>
|
||||
#include <Jolt/Physics/Vehicle/WheeledVehicleController.h>
|
||||
|
||||
// Ourselves
|
||||
#include "vjolt_interface.h"
|
||||
#include "vjolt_util.h"
|
@ -0,0 +1,39 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#define NOWINRES
|
||||
#define NOSERVICE
|
||||
#define NOMCX
|
||||
#define NOIME
|
||||
#define NOCRYPT
|
||||
#define NOMETAFILE
|
||||
#define NOMINMAX
|
||||
#define MMNOSOUND
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#undef PostMessage
|
||||
#undef CreateEvent
|
||||
#undef PlaySound
|
||||
#undef SetCursor
|
||||
#undef ProgressBox
|
||||
#undef RegisterClass
|
||||
#undef AddJob
|
||||
#undef GetJob
|
||||
#undef Yield
|
||||
#undef SetPort
|
||||
#undef CreateFont
|
||||
#undef ShellExecute
|
||||
#undef ShellExecuteEx
|
||||
#undef GetCurrentTime
|
||||
#undef GetTickCount
|
||||
#undef GetCurrentDirectory
|
||||
#undef GetObject
|
||||
#undef LoadCursorFromFile
|
||||
#undef GetCharABCWidths
|
||||
|
||||
#endif
|
@ -0,0 +1,38 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined( GAME_CSGO ) || defined( GAME_DESOLATION )
|
||||
#define GAME_CSGO_OR_NEWER
|
||||
#define override_csgo override
|
||||
#define override_not_csgo
|
||||
#else
|
||||
#define override_csgo
|
||||
#define override_not_csgo override
|
||||
#endif
|
||||
|
||||
#if defined( GAME_CSGO ) || defined( GAME_DESOLATION ) || defined( GAME_PORTAL2 )
|
||||
#define GAME_PORTAL2_OR_NEWER
|
||||
#define override_portal2 override
|
||||
#define override_not_portal2
|
||||
#else
|
||||
#define override_portal2
|
||||
#define override_not_portal2 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
|
||||
#define override_not_asw
|
||||
#else
|
||||
#define override_asw
|
||||
#define override_not_asw override
|
||||
#endif
|
||||
|
||||
#ifndef GAME_DESOLATION
|
||||
using strlen_t = int;
|
||||
#endif
|
||||
|
||||
#ifndef GAME_CSGO_OR_NEWER
|
||||
#define FastASCIIToUpper( c ) ( ( ( (c) >= 'a' ) && ( (c) <= 'z' ) ) ? ( (c) - 32 ) : (c) )
|
||||
#define FastASCIIToLower( c ) ( ( ( (c) >= 'A' ) && ( (c) <= 'Z' ) ) ? ( (c) + 32 ) : (c) )
|
||||
#endif
|
@ -0,0 +1,75 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// This file provides compatibility with stuff used from the Alien Swarm SDK and above
|
||||
// Source Engine branches for SDK 2013.
|
||||
|
||||
#include "Color.h"
|
||||
|
||||
enum LoggingSeverity_t
|
||||
{
|
||||
LS_MESSAGE = 0,
|
||||
LS_WARNING = 1,
|
||||
LS_ASSERT = 2,
|
||||
LS_ERROR = 3,
|
||||
LS_HIGHEST_SEVERITY = 4,
|
||||
};
|
||||
|
||||
struct LoggingChannelInfo_t
|
||||
{
|
||||
const char *pszName;
|
||||
int nFlags;
|
||||
LoggingSeverity_t nSeverity;
|
||||
Color color = Color(255, 255, 255);
|
||||
};
|
||||
|
||||
#define DECLARE_LOGGING_CHANNEL( Channel ) extern LoggingChannelInfo_t g_LoggingInfo##Channel;
|
||||
|
||||
#define DEFINE_LOGGING_CHANNEL_NO_TAGS( Channel, ChannelName, ... ) LoggingChannelInfo_t g_LoggingInfo##Channel = { ChannelName, __VA_ARGS__ };
|
||||
|
||||
static const int MAX_LOGGING_MESSAGE_LENGTH = 2048;
|
||||
|
||||
// TODO
|
||||
#define DevAssert( ... )
|
||||
#define DevAssertMsg( ... )
|
||||
#define AssertMsg_Internal( ... )
|
||||
#define InternalMsg( Channel, Fmt, ... ) ConColorMsg( g_LoggingInfo##Channel.color, "[%s]" Fmt, g_LoggingInfo##Channel.pszName, ##__VA_ARGS__ )
|
||||
#define Log_Msg( Channel, Fmt, ... ) InternalMsg( Channel, Fmt, ##__VA_ARGS__ )
|
||||
#define Log_Warning( Channel, Fmt, ... ) InternalMsg( Channel, Fmt, ##__VA_ARGS__ )
|
||||
#define Log_Error( Channel, Fmt, ... ) InternalMsg( Channel, Fmt, ##__VA_ARGS__ )
|
||||
|
||||
// Unused, just makes stuff cleaner to not have ifdef spam.
|
||||
enum collisionhints
|
||||
{
|
||||
COLLISION_HINT_DEBRIS = 0x0001,
|
||||
COLLISION_HINT_STATICSOLID = 0x0002,
|
||||
};
|
||||
|
||||
class IPhysicsCollisionSet;
|
||||
class IPhysics;
|
||||
|
||||
struct ragdollcollisionrules_t
|
||||
{
|
||||
void Defaults( IPhysics *pPhysics, IPhysicsCollisionSet *pSetIn )
|
||||
{
|
||||
pCollisionSet = pSetIn;
|
||||
bSelfCollisions = true;
|
||||
}
|
||||
int bSelfCollisions;
|
||||
IPhysicsCollisionSet *pCollisionSet;
|
||||
};
|
||||
|
||||
struct ragdollanimatedfriction_t
|
||||
{
|
||||
float minFriction;
|
||||
float maxFriction;
|
||||
float timeIn;
|
||||
float timeOut;
|
||||
float timeHold;
|
||||
};
|
||||
|
||||
enum PlayerContactState_t
|
||||
{
|
||||
PLAYER_CONTACT_PHYSICS = 1,
|
||||
PLAYER_CONTACT_GAMEOBJECT = 2,
|
||||
};
|
@ -0,0 +1,25 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "compat/better_winlite.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define VJOLT_RETURN_ADDRESS() _ReturnAddress()
|
||||
#else
|
||||
#define VJOLT_RETURN_ADDRESS() __builtin_return_address(0)
|
||||
#endif
|
||||
|
||||
FORCEINLINE void GetCallingFunctionModulePath( void *pReturnAddress, char *pszModulePath, size_t len )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
if ( ::VirtualQuery( pReturnAddress, &mbi, sizeof(mbi)) ) {
|
||||
HMODULE module = reinterpret_cast< HMODULE >( mbi.AllocationBase );
|
||||
|
||||
::GetModuleFileNameA( module, pszModulePath, DWORD( len ) );
|
||||
return;
|
||||
}
|
||||
#else
|
||||
V_strncpy( pszModulePath, "Unknown", len);
|
||||
#endif
|
||||
}
|
@ -0,0 +1,927 @@
|
||||
|
||||
#include "cbase.h"
|
||||
|
||||
#include "coordsize.h"
|
||||
#include "mathlib/polyhedron.h"
|
||||
|
||||
#include "vjolt_parse.h"
|
||||
#include "vjolt_querymodel.h"
|
||||
|
||||
#include "vjolt_collide.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
// Also in vjolt_collide_trace.cpp, should unify or just remove entirely
|
||||
static constexpr float kMaxConvexRadius = JPH::cDefaultConvexRadius;
|
||||
|
||||
JoltPhysicsCollision JoltPhysicsCollision::s_PhysicsCollision;
|
||||
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( JoltPhysicsCollision, IPhysicsCollision, VPHYSICS_COLLISION_INTERFACE_VERSION, JoltPhysicsCollision::GetInstance() );
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
// Creates a shape from shape settings, resolving the reference
|
||||
template < typename ShapeType, typename T >
|
||||
ShapeType *ShapeSettingsToShape( const T& settings )
|
||||
{
|
||||
auto result = settings.Create();
|
||||
if ( !result.IsValid() )
|
||||
{
|
||||
// Josh:
|
||||
// Need to handle degenerate convexes and stuff.
|
||||
const char *error = result.HasError()
|
||||
? result.GetError().c_str()
|
||||
: "Unknown";
|
||||
|
||||
Log_Warning( LOG_VJolt, "Failed to create shape: %s.\n", error );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return static_cast< ShapeType * >( ToDanglingRef( result.Get() ) );
|
||||
}
|
||||
|
||||
// Creates a JPH::ConvexShape from shape settings, and casts to a CPhysConvex
|
||||
template < typename T >
|
||||
CPhysConvex *ShapeSettingsToPhysConvex( const T& settings )
|
||||
{
|
||||
return CPhysConvex::FromConvexShape( ShapeSettingsToShape< JPH::ConvexShape >( settings ) );
|
||||
}
|
||||
|
||||
// Creates a JPH::Shape from shape settings, and casts to a CPhysCollide
|
||||
template < typename T >
|
||||
CPhysCollide *ShapeSettingsToPhysCollide( const T& settings )
|
||||
{
|
||||
return CPhysCollide::FromShape( ShapeSettingsToShape< JPH::Shape >( settings ) );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
CPhysConvex *JoltPhysicsCollision::ConvexFromVerts( Vector **pVerts, int vertCount )
|
||||
{
|
||||
// This uses this and not a CUtlVector or std::vector or whatever for two reasons:
|
||||
// 1: This is a single allocation we can then toss away instead of growing
|
||||
// 2: We do not want to initialize these vectors on allocation
|
||||
// 3: Automatic deletion when out of scope
|
||||
// Please do not change me to either.
|
||||
std::unique_ptr< JPH::Vec3[] > verts = std::make_unique< JPH::Vec3[] >( vertCount );
|
||||
for ( int i = 0; i < vertCount; i++ )
|
||||
verts[ i ] = SourceToJolt::Distance( *pVerts[ i ] );
|
||||
|
||||
JPH::ConvexHullShapeSettings settings( verts.get(), vertCount, kMaxConvexRadius, nullptr /* material */ );
|
||||
settings.mHullTolerance = 0.0f;
|
||||
return ShapeSettingsToPhysConvex( settings );
|
||||
}
|
||||
|
||||
CPhysConvex *JoltPhysicsCollision::ConvexFromPlanes( float *pPlanes, int planeCount, float mergeDistance )
|
||||
{
|
||||
Log_Stub( LOG_VJolt );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
float JoltPhysicsCollision::ConvexVolume( CPhysConvex *pConvex )
|
||||
{
|
||||
return JoltToSource::Volume( pConvex->ToConvexShape()->GetVolume() );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
float JoltPhysicsCollision::ConvexSurfaceArea( CPhysConvex *pConvex )
|
||||
{
|
||||
Log_Stub( LOG_VJolt );
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void JoltPhysicsCollision::SetConvexGameData( CPhysConvex *pConvex, unsigned int gameData )
|
||||
{
|
||||
pConvex->ToConvexShape()->SetUserData( gameData );
|
||||
}
|
||||
|
||||
void JoltPhysicsCollision::ConvexFree( CPhysConvex *pConvex )
|
||||
{
|
||||
pConvex->ToConvexShape()->Release();
|
||||
}
|
||||
|
||||
CPhysConvex *JoltPhysicsCollision::BBoxToConvex( const Vector &mins, const Vector &maxs )
|
||||
{
|
||||
JPH::AABox aabox = SourceToJolt::AABBBounds( mins, maxs );
|
||||
|
||||
JPH::BoxShape *pBoxShape = new JPH::BoxShape( aabox.GetExtent(), kMaxConvexRadius, nullptr /* material */ );
|
||||
|
||||
JPH::RotatedTranslatedShapeSettings rotatedSettings( aabox.mMin + aabox.GetExtent(), JPH::Quat::sIdentity(), pBoxShape );
|
||||
return ShapeSettingsToPhysConvex( rotatedSettings );
|
||||
}
|
||||
|
||||
CPhysConvex *JoltPhysicsCollision::ConvexFromConvexPolyhedron( const CPolyhedron &ConvexPolyhedron )
|
||||
{
|
||||
std::unique_ptr< JPH::Vec3[] > pPoints = std::make_unique< JPH::Vec3[] >( ConvexPolyhedron.iVertexCount );
|
||||
|
||||
// This loop fills me with rage
|
||||
for ( unsigned short i = 0; i < ConvexPolyhedron.iVertexCount; ++i )
|
||||
pPoints[i] = SourceToJolt::Distance( ConvexPolyhedron.pVertices[i] );
|
||||
|
||||
JPH::ConvexHullShapeSettings settings( pPoints.get(), ConvexPolyhedron.iVertexCount, kMaxConvexRadius, nullptr /* material */);
|
||||
settings.mHullTolerance = 0.0f; // Slart: Otherwise some polyhedrons crash :(
|
||||
CPhysConvex *pPhysConvex = ShapeSettingsToPhysConvex( settings );
|
||||
|
||||
return pPhysConvex;
|
||||
}
|
||||
|
||||
void JoltPhysicsCollision::ConvexesFromConvexPolygon( const Vector &vPolyNormal, const Vector *pPoints, int iPointCount, CPhysConvex **pOutput )
|
||||
{
|
||||
// Slart: Unused
|
||||
Log_Stub( LOG_VJolt );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
CPhysPolysoup *JoltPhysicsCollision::PolysoupCreate()
|
||||
{
|
||||
return new CPhysPolysoup;
|
||||
}
|
||||
|
||||
void JoltPhysicsCollision::PolysoupDestroy( CPhysPolysoup *pSoup )
|
||||
{
|
||||
delete pSoup;
|
||||
}
|
||||
|
||||
void JoltPhysicsCollision::PolysoupAddTriangle( CPhysPolysoup *pSoup, const Vector &a, const Vector &b, const Vector &c, int materialIndex7bits )
|
||||
{
|
||||
// Add both windings to make this two-faced.
|
||||
pSoup->Triangles.push_back( JPH::Triangle( SourceToJolt::DistanceFloat3( c ), SourceToJolt::DistanceFloat3( b ), SourceToJolt::DistanceFloat3( a ) ) );
|
||||
pSoup->Triangles.push_back( JPH::Triangle( SourceToJolt::DistanceFloat3( a ), SourceToJolt::DistanceFloat3( b ), SourceToJolt::DistanceFloat3( c ) ) );
|
||||
}
|
||||
|
||||
CPhysCollide *JoltPhysicsCollision::ConvertPolysoupToCollide( CPhysPolysoup *pSoup, bool useMOPP )
|
||||
{
|
||||
VJoltAssertMsg( !useMOPP, "MOPPs not supported\n" );
|
||||
|
||||
if ( useMOPP )
|
||||
return nullptr;
|
||||
|
||||
// ConvertPolysoupToCollide does NOT free the Polysoup.
|
||||
JPH::MeshShapeSettings settings( pSoup->Triangles );
|
||||
return ShapeSettingsToPhysCollide( settings );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
CPhysCollide *JoltPhysicsCollision::ConvertConvexToCollide( CPhysConvex **pConvex, int convexCount )
|
||||
{
|
||||
// If we only have one convex shape, we can just use that directly,
|
||||
// without making a compound shape.
|
||||
if ( convexCount == 1 )
|
||||
return pConvex[0]->ToPhysCollide();
|
||||
|
||||
JPH::StaticCompoundShapeSettings settings;
|
||||
for ( int i = 0; i < convexCount; i++ )
|
||||
settings.AddShape( JPH::Vec3::sZero(), JPH::Quat::sIdentity(), pConvex[i]->ToConvexShape() );
|
||||
|
||||
CPhysCollide *pCollide = ShapeSettingsToPhysCollide( settings );
|
||||
|
||||
// This function also 'frees' the convexes.
|
||||
for ( int i = 0; i < convexCount; i++ )
|
||||
pConvex[i]->ToConvexShape()->Release();
|
||||
|
||||
return pCollide;
|
||||
}
|
||||
|
||||
CPhysCollide *JoltPhysicsCollision::ConvertConvexToCollideParams( CPhysConvex **pConvex, int convexCount, const convertconvexparams_t &convertParams )
|
||||
{
|
||||
// Slart: The parameters are just IVP crap and the only one that isn't is never ever used. HA!
|
||||
return ConvertConvexToCollide( pConvex, convexCount );
|
||||
}
|
||||
|
||||
void JoltPhysicsCollision::DestroyCollide( CPhysCollide *pCollide )
|
||||
{
|
||||
if ( !pCollide )
|
||||
return;
|
||||
|
||||
pCollide->ToShape()->Release();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
int JoltPhysicsCollision::CollideSize( CPhysCollide *pCollide )
|
||||
{
|
||||
Log_Stub( LOG_VJolt );
|
||||
return 0;
|
||||
}
|
||||
|
||||
int JoltPhysicsCollision::CollideWrite( char *pDest, CPhysCollide *pCollide, bool bSwap /*= false*/ )
|
||||
{
|
||||
Log_Stub( LOG_VJolt );
|
||||
return 0;
|
||||
}
|
||||
|
||||
CPhysCollide *JoltPhysicsCollision::UnserializeCollide( char *pBuffer, int size, int index )
|
||||
{
|
||||
Log_Stub( LOG_VJolt );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
float JoltPhysicsCollision::CollideVolume( CPhysCollide *pCollide )
|
||||
{
|
||||
return JoltToSource::Volume( pCollide->ToShape()->GetVolume() );
|
||||
}
|
||||
|
||||
float JoltPhysicsCollision::CollideSurfaceArea( CPhysCollide *pCollide )
|
||||
{
|
||||
Log_Stub( LOG_VJolt );
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
Vector JoltPhysicsCollision::CollideGetExtent( const CPhysCollide *pCollide, const Vector &collideOrigin, const QAngle &collideAngles, const Vector &direction )
|
||||
{
|
||||
if ( !pCollide )
|
||||
return collideOrigin;
|
||||
|
||||
const JPH::Shape *pShape = pCollide->ToShape();
|
||||
|
||||
JPH::Vec3 vecDirection = JPH::Vec3( direction.x, direction.y, direction.z );
|
||||
|
||||
JPH::Mat44 matCollideTransform = JPH::Mat44::sRotationTranslation(
|
||||
SourceToJolt::Angle( collideAngles ), SourceToJolt::Distance( collideOrigin ) - pShape->GetCenterOfMass() );
|
||||
|
||||
float flMaxDot = -FLT_MAX;
|
||||
JPH::Vec3 vecMaxExtent = JPH::Vec3::sZero();
|
||||
ActOnSubShapes< JPH::ConvexShape >( pShape, [&]( const JPH::ConvexShape* pConvexShape, JPH::Mat44Arg matSubShapeTransform )
|
||||
{
|
||||
JPH::ConvexShape::SupportingFace supportingFace;
|
||||
pConvexShape->GetSupportingFace( vecDirection, JPH::Vec3::sReplicate( 1.0f ), supportingFace );
|
||||
|
||||
for ( const JPH::Vec3 &vecVertex : supportingFace )
|
||||
{
|
||||
JPH::Vec3 vecTransformedVertex = matCollideTransform * matSubShapeTransform * vecVertex;
|
||||
|
||||
const float flDot = vecTransformedVertex.Dot( vecDirection );
|
||||
if ( flDot > flMaxDot )
|
||||
{
|
||||
vecMaxExtent = vecTransformedVertex;
|
||||
flMaxDot = flDot;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return JoltToSource::Distance( vecMaxExtent );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
void JoltPhysicsCollision::CollideGetAABB( Vector *pMins, Vector *pMaxs, const CPhysCollide *pCollide, const Vector &collideOrigin, const QAngle &collideAngles )
|
||||
{
|
||||
JPH::Vec3 position = SourceToJolt::Distance( collideOrigin );
|
||||
JPH::Quat rotation = SourceToJolt::Angle( collideAngles );
|
||||
|
||||
const JPH::Shape *pShape = pCollide->ToShape();
|
||||
|
||||
const JPH::Mat44 translation = JPH::Mat44::sRotationTranslation( rotation, position + rotation * pShape->GetCenterOfMass() );
|
||||
const JPH::AABox worldBounds = pShape->GetWorldSpaceBounds( translation, JPH::Vec3::sReplicate( 1.0f ) );
|
||||
|
||||
JoltToSource::AABBBounds( worldBounds, *pMins, *pMaxs );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
void JoltPhysicsCollision::CollideGetMassCenter( CPhysCollide *pCollide, Vector *pOutMassCenter )
|
||||
{
|
||||
*pOutMassCenter = JoltToSource::Distance( pCollide->ToShape()->GetCenterOfMass() );
|
||||
}
|
||||
|
||||
void JoltPhysicsCollision::CollideSetMassCenter( CPhysCollide *pCollide, const Vector &massCenter )
|
||||
{
|
||||
// Slart: Only used in studiomdl
|
||||
Log_Stub( LOG_VJolt );
|
||||
}
|
||||
|
||||
Vector JoltPhysicsCollision::CollideGetOrthographicAreas( const CPhysCollide *pCollide )
|
||||
{
|
||||
// Slart: Only used in studiomdl... In a part that is #if 0'd out...
|
||||
Log_Stub( LOG_VJolt );
|
||||
return vec3_origin;
|
||||
}
|
||||
|
||||
void JoltPhysicsCollision::CollideSetOrthographicAreas( CPhysCollide *pCollide, const Vector &areas )
|
||||
{
|
||||
// Slart: Never used
|
||||
Log_Stub( LOG_VJolt );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
int JoltPhysicsCollision::CollideIndex( const CPhysCollide *pCollide )
|
||||
{
|
||||
// Slart: Only used by code behind #ifdef _DEBUG
|
||||
Log_Stub( LOG_VJolt );
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
CPhysCollide *JoltPhysicsCollision::BBoxToCollide( const Vector &mins, const Vector &maxs )
|
||||
{
|
||||
return BBoxToConvex( mins, maxs )->ToPhysCollide();
|
||||
}
|
||||
|
||||
int JoltPhysicsCollision::GetConvexesUsedInCollideable( const CPhysCollide *pCollideable, CPhysConvex **pOutputArray, int iOutputArrayLimit )
|
||||
{
|
||||
const JPH::Shape *pShape = pCollideable->ToShape();
|
||||
JPH::EShapeType shapeType = pShape->GetType();
|
||||
if ( shapeType != JPH::EShapeType::Compound )
|
||||
{
|
||||
pOutputArray[0] = const_cast<CPhysConvex *>( CPhysConvex::FromConvexShape( static_cast<const JPH::ConvexShape *>( pShape ) ) );
|
||||
return 1;
|
||||
}
|
||||
|
||||
const JPH::StaticCompoundShape *pCompoundShape = static_cast<const JPH::StaticCompoundShape *>( pShape );
|
||||
const JPH::StaticCompoundShape::SubShapes &subShapes = pCompoundShape->GetSubShapes();
|
||||
|
||||
const uint maxNumShapes = Min<uint>( pCompoundShape->GetNumSubShapes(), iOutputArrayLimit );
|
||||
for ( uint i = 0; i < maxNumShapes; ++i )
|
||||
pOutputArray[i] = const_cast<CPhysConvex *>( CPhysConvex::FromConvexShape( static_cast<const JPH::ConvexShape *>( subShapes[i].mShape.GetPtr() ) ) );
|
||||
|
||||
return maxNumShapes;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
bool JoltPhysicsCollision::IsBoxIntersectingCone( const Vector &boxAbsMins, const Vector &boxAbsMaxs, const truncatedcone_t &cone )
|
||||
{
|
||||
// Slart: Never used
|
||||
Log_Stub( LOG_VJolt );
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// See studiobyteswap from the public 2013 SDK for more info about these defines.
|
||||
// https://github.com/ValveSoftware/source-sdk-2013/blob/master/sp/src/common/studiobyteswap.cpp
|
||||
//
|
||||
|
||||
namespace ivp_compat
|
||||
{
|
||||
struct collideheader_t
|
||||
{
|
||||
int size;
|
||||
int vphysicsID;
|
||||
short version;
|
||||
short modelType;
|
||||
};
|
||||
|
||||
struct compactsurfaceheader_t
|
||||
{
|
||||
int surfaceSize;
|
||||
Vector dragAxisAreas;
|
||||
int axisMapSize;
|
||||
};
|
||||
|
||||
struct moppsurfaceheader_t
|
||||
{
|
||||
int moppSize;
|
||||
};
|
||||
|
||||
struct compactsurface_t
|
||||
{
|
||||
float mass_center[3];
|
||||
float rotation_inertia[3];
|
||||
float upper_limit_radius;
|
||||
|
||||
unsigned int max_factor_surface_deviation : 8;
|
||||
int byte_size : 24;
|
||||
int offset_ledgetree_root;
|
||||
int dummy[3];
|
||||
};
|
||||
|
||||
struct compactmopp_t
|
||||
{
|
||||
float mass_center[3];
|
||||
float rotation_inertia[3];
|
||||
float upper_limit_radius;
|
||||
|
||||
unsigned int max_factor_surface_deviation : 8;
|
||||
int byte_size : 24;
|
||||
int offset_ledgetree_root;
|
||||
int offset_ledges;
|
||||
int size_convex_hull;
|
||||
int dummy;
|
||||
};
|
||||
|
||||
struct compactledge_t
|
||||
{
|
||||
int c_point_offset;
|
||||
|
||||
union
|
||||
{
|
||||
int ledgetree_node_offset;
|
||||
int client_data;
|
||||
};
|
||||
|
||||
struct
|
||||
{
|
||||
uint has_children_flag : 2;
|
||||
int is_compact_flag : 2;
|
||||
uint dummy : 4;
|
||||
uint size_div_16 : 24;
|
||||
};
|
||||
|
||||
short n_triangles;
|
||||
short for_future_use;
|
||||
};
|
||||
|
||||
struct compactedge_t
|
||||
{
|
||||
uint start_point_index : 16;
|
||||
int opposite_index : 15;
|
||||
uint is_virtual : 1;
|
||||
};
|
||||
|
||||
struct compacttriangle_t
|
||||
{
|
||||
uint tri_index : 12;
|
||||
uint pierce_index : 12;
|
||||
uint material_index : 7;
|
||||
uint is_virtual : 1;
|
||||
compactedge_t c_three_edges[3];
|
||||
};
|
||||
|
||||
struct compactledgenode_t
|
||||
{
|
||||
int offset_right_node;
|
||||
int offset_compact_ledge;
|
||||
float center[3];
|
||||
float radius;
|
||||
unsigned char box_sizes[3];
|
||||
unsigned char free_0;
|
||||
|
||||
const compactledge_t *GetCompactLedge() const
|
||||
{
|
||||
VJoltAssert( this->offset_right_node == 0 );
|
||||
return ( compactledge_t * )( ( char * )this + this->offset_compact_ledge );
|
||||
}
|
||||
|
||||
const compactledgenode_t *GetLeftChild() const
|
||||
{
|
||||
VJoltAssert( this->offset_right_node );
|
||||
return this + 1;
|
||||
}
|
||||
|
||||
const compactledgenode_t *GetRightChild() const
|
||||
{
|
||||
VJoltAssert( this->offset_right_node );
|
||||
return ( compactledgenode_t * )( ( char * )this + this->offset_right_node );
|
||||
}
|
||||
|
||||
bool IsTerminal() const
|
||||
{
|
||||
return this->offset_right_node == 0;
|
||||
}
|
||||
|
||||
const compactledge_t *GetCompactHull() const
|
||||
{
|
||||
if ( this->offset_compact_ledge )
|
||||
return ( compactledge_t * )( ( char * )this + this->offset_compact_ledge );
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
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
|
||||
{
|
||||
COLLIDE_POLY = 0,
|
||||
COLLIDE_MOPP = 1,
|
||||
COLLIDE_BALL = 2,
|
||||
COLLIDE_VIRTUAL = 3,
|
||||
};
|
||||
|
||||
JPH::ConvexShape *IVPLedgeToConvexShape( const compactledge_t *pLedge )
|
||||
{
|
||||
if ( !pLedge->n_triangles )
|
||||
return nullptr;
|
||||
|
||||
const char *pVertices = reinterpret_cast< const char * >( pLedge ) + pLedge->c_point_offset;
|
||||
const compacttriangle_t *pTriangles = reinterpret_cast< const compacttriangle_t * >( pLedge + 1 );
|
||||
|
||||
const int nVertCount = pLedge->n_triangles * 3;
|
||||
|
||||
std::unique_ptr< JPH::Vec3[] > verts = std::make_unique< JPH::Vec3[] >( nVertCount );
|
||||
|
||||
// Each triangle
|
||||
for ( int i = 0; i < pLedge->n_triangles; i++ )
|
||||
{
|
||||
// For each point of the current triangle
|
||||
for ( int j = 0; j < 3; j++ )
|
||||
{
|
||||
static constexpr size_t IVPAlignedVectorSize = 16;
|
||||
|
||||
const int nIndex = pTriangles[ i ].c_three_edges[ j ].start_point_index;
|
||||
const float *pVertex = reinterpret_cast< const float * >( pVertices + ( nIndex * IVPAlignedVectorSize ) );
|
||||
|
||||
verts[ ( i * 3 ) + j ] = JPH::Vec3( pVertex[ 0 ], pVertex[ 2 ], -pVertex[ 1 ] );
|
||||
}
|
||||
}
|
||||
|
||||
JPH::ConvexHullShapeSettings settings{ verts.get(), nVertCount, kMaxConvexRadius, nullptr /* material */ };
|
||||
settings.mHullTolerance = 0.0f;
|
||||
JPH::ConvexShape *pConvexShape = ShapeSettingsToShape< JPH::ConvexShape >( settings );
|
||||
if ( !pConvexShape )
|
||||
return nullptr;
|
||||
|
||||
pConvexShape->SetUserData( pLedge->client_data );
|
||||
return pConvexShape;
|
||||
}
|
||||
|
||||
void GetAllIVPEdges( const compactledgenode_t *pNode, CUtlVector< const compactledge_t * >& vecOut )
|
||||
{
|
||||
if ( !pNode )
|
||||
return;
|
||||
|
||||
if ( !pNode->IsTerminal() )
|
||||
{
|
||||
GetAllIVPEdges( pNode->GetRightChild(), vecOut );
|
||||
GetAllIVPEdges( pNode->GetLeftChild(), vecOut );
|
||||
}
|
||||
else
|
||||
vecOut.AddToTail( pNode->GetCompactLedge() );
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
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 );
|
||||
|
||||
CUtlVector< const compactledge_t * > ledges;
|
||||
GetAllIVPEdges( pFirstLedgeNode, ledges );
|
||||
|
||||
VJoltAssert( !ledges.IsEmpty() );
|
||||
|
||||
if ( ledges.Count() != 1 )
|
||||
{
|
||||
JPH::StaticCompoundShapeSettings settings{};
|
||||
// One compound convex per ledge.
|
||||
for ( int i = 0; i < ledges.Count(); i++ )
|
||||
{
|
||||
const JPH::Shape* pShape = IVPLedgeToConvexShape( ledges[i] );
|
||||
// Josh:
|
||||
// Some models have degenerate convexes which fails to make
|
||||
// a subshape in Jolt, so we need to ignore those ledges.
|
||||
if ( pShape )
|
||||
settings.AddShape( JPH::Vec3::sZero(), JPH::Quat::sIdentity(), pShape );
|
||||
}
|
||||
CPhysCollide* pCollide = ShapeSettingsToPhysCollide( settings );
|
||||
return pCollide;
|
||||
}
|
||||
else
|
||||
{
|
||||
JPH::ConvexShape *pShape = IVPLedgeToConvexShape( ledges[ 0 ] );
|
||||
return CPhysConvex::FromConvexShape( pShape )->ToPhysCollide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JoltPhysicsCollision::VCollideLoad( vcollide_t *pOutput, int solidCount, const char *pBuffer, int size, bool swap /*= false*/ )
|
||||
{
|
||||
if ( swap )
|
||||
{
|
||||
Log_Error( LOG_VJolt, "If you got here. Tell me what you did!\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
pOutput->solidCount = solidCount;
|
||||
pOutput->solids = new CPhysCollide*[ solidCount ];
|
||||
|
||||
const char *pCursor = pBuffer;
|
||||
for ( int i = 0; i < solidCount; i++ )
|
||||
{
|
||||
// Be safe ahead of time as so much can go wrong with
|
||||
// this mess! :p
|
||||
pOutput->solids[ i ] = nullptr;
|
||||
|
||||
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 )
|
||||
{
|
||||
Log_Warning( LOG_VJolt, "Skipped solid %d due to invalid header (id: %.4s, version: 0x%x)\n", i, &pCollideHeader->vphysicsID, pCollideHeader->version );
|
||||
continue;
|
||||
}
|
||||
|
||||
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_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;
|
||||
}
|
||||
|
||||
// Size does not include the size of "size", ironically!
|
||||
// add sizeof( int ) for that.
|
||||
pCursor += pCollideHeader->size + sizeof( int );
|
||||