diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 25e2c954..aa510fbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,22 +36,6 @@ jobs: VERSION_TYPE=$(./gradlew -q --console=plain --no-daemon printVersionType) echo VERSION_TYPE=$VERSION_TYPE echo VERSION_TYPE=$VERSION_TYPE >> $GITHUB_ENV - - name: "Publish snapshot" - if: ${{ env.VERSION_TYPE == 'snapshot' && github.event_name == 'push' && github.ref == 'refs/heads/main' }} - run: ./gradlew publish - env: - CI_PUBLISH_CORE: true - ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} - ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} - - name: "Publish release" - if: ${{ env.VERSION_TYPE == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }} - run: ./gradlew -PforceSign=true publishToSonatype closeSonatypeStagingRepository - env: - CI_PUBLISH_CORE: true - ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} - ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} - ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} - ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} windows-mingw: name: "Windows MinGW GCC" @@ -85,19 +69,3 @@ jobs: VERSION_TYPE=$(./gradlew -q --console=plain --no-daemon printVersionType) echo VERSION_TYPE=$VERSION_TYPE echo VERSION_TYPE=$VERSION_TYPE >> $GITHUB_ENV - - name: "Publish snapshot" - if: ${{ env.VERSION_TYPE == 'snapshot' && github.event_name == 'push' && github.ref == 'refs/heads/main' }} - run: ./gradlew publish -x requireClean - env: - CI_PUBLISH_CORE: false - ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} - ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} - - name: "Publish release" - if: ${{ env.VERSION_TYPE == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }} - run: ./gradlew -PforceSign=true publishToSonatype closeSonatypeStagingRepository -x requireClean - env: - CI_PUBLISH_CORE: false - ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} - ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} - ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} - ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} diff --git a/JoltPhysicsC/Jolt/AABBTree/AABBTreeBuilder.h b/JoltPhysicsC/Jolt/AABBTree/AABBTreeBuilder.h index dacae5e0..c8281f4f 100644 --- a/JoltPhysicsC/Jolt/AABBTree/AABBTreeBuilder.h +++ b/JoltPhysicsC/Jolt/AABBTree/AABBTreeBuilder.h @@ -32,7 +32,7 @@ struct AABBTreeBuilderStats }; /// Helper class to build an AABB tree -class JPH_EXPORT AABBTreeBuilder +class AABBTreeBuilder { public: /// A node in the tree, contains the AABox for the tree and any child nodes or triangles diff --git a/JoltPhysicsC/Jolt/Core/Color.h b/JoltPhysicsC/Jolt/Core/Color.h index 1d3fa79f..ff55c7d8 100644 --- a/JoltPhysicsC/Jolt/Core/Color.h +++ b/JoltPhysicsC/Jolt/Core/Color.h @@ -12,7 +12,7 @@ class Color; using ColorArg = Color; /// Class that holds an RGBA color with 8-bits per component -class [[nodiscard]] JPH_EXPORT Color +class [[nodiscard]] Color { public: /// Constructors diff --git a/JoltPhysicsC/Jolt/Core/Core.h b/JoltPhysicsC/Jolt/Core/Core.h index 39c49fa7..4fec4809 100644 --- a/JoltPhysicsC/Jolt/Core/Core.h +++ b/JoltPhysicsC/Jolt/Core/Core.h @@ -123,45 +123,14 @@ #error Unsupported CPU architecture #endif -// If this define is set, Jolt is compiled as a shared library -#ifdef JPH_SHARED_LIBRARY - #ifdef JPH_BUILD_SHARED_LIBRARY - // While building the shared library, we must export these symbols - #ifdef JPH_PLATFORM_WINDOWS - #define JPH_EXPORT __declspec(dllexport) - #else - #define JPH_EXPORT __attribute__ ((visibility ("default"))) - #endif - #else - // When linking against Jolt, we must import these symbols - #ifdef JPH_PLATFORM_WINDOWS - #define JPH_EXPORT __declspec(dllimport) - #else - #define JPH_EXPORT __attribute__ ((visibility ("default"))) - #endif - #endif -#else - // If the define is not set, we use static linking and symbols don't need to be imported or exported - #define JPH_EXPORT -#endif - -// Macro used by the RTTI macros to not export a function -#define JPH_NO_EXPORT - // Pragmas to store / restore the warning state and to disable individual warnings #ifdef JPH_COMPILER_CLANG #define JPH_PRAGMA(x) _Pragma(#x) #define JPH_SUPPRESS_WARNING_PUSH JPH_PRAGMA(clang diagnostic push) #define JPH_SUPPRESS_WARNING_POP JPH_PRAGMA(clang diagnostic pop) #define JPH_CLANG_SUPPRESS_WARNING(w) JPH_PRAGMA(clang diagnostic ignored w) -#if __clang_major__ >= 13 - #define JPH_CLANG_13_PLUS_SUPPRESS_WARNING(w) JPH_CLANG_SUPPRESS_WARNING(w) -#else - #define JPH_CLANG_13_PLUS_SUPPRESS_WARNING(w) -#endif #else #define JPH_CLANG_SUPPRESS_WARNING(w) -#define JPH_CLANG_13_PLUS_SUPPRESS_WARNING(w) #endif #ifdef JPH_COMPILER_GCC #define JPH_PRAGMA(x) _Pragma(#x) @@ -208,7 +177,6 @@ JPH_CLANG_SUPPRESS_WARNING("-Wdocumentation-unknown-command") \ JPH_CLANG_SUPPRESS_WARNING("-Wctad-maybe-unsupported") \ JPH_CLANG_SUPPRESS_WARNING("-Wdeprecated-copy") \ - JPH_CLANG_13_PLUS_SUPPRESS_WARNING("-Wdeprecated-copy-with-dtor") \ JPH_IF_NOT_ANDROID(JPH_CLANG_SUPPRESS_WARNING("-Wimplicit-int-float-conversion")) \ \ JPH_GCC_SUPPRESS_WARNING("-Wcomment") \ @@ -236,7 +204,6 @@ JPH_MSVC_SUPPRESS_WARNING(5219) /* implicit conversion from 'X' to 'Y', possible loss of data */ \ JPH_MSVC_SUPPRESS_WARNING(4826) /* Conversion from 'X *' to 'JPH::uint64' is sign-extended. This may cause unexpected runtime behavior. (32-bit) */ \ JPH_MSVC_SUPPRESS_WARNING(5264) /* 'X': 'const' variable is not used */ \ - JPH_MSVC_SUPPRESS_WARNING(4251) /* class 'X' needs to have DLL-interface to be used by clients of class 'Y' */ \ JPH_MSVC2019_SUPPRESS_WARNING(5246) /* the initialization of a subobject should be wrapped in braces */ // OS-specific includes diff --git a/JoltPhysicsC/Jolt/Core/Factory.h b/JoltPhysicsC/Jolt/Core/Factory.h index 4d6fd7a2..d9f1ef08 100644 --- a/JoltPhysicsC/Jolt/Core/Factory.h +++ b/JoltPhysicsC/Jolt/Core/Factory.h @@ -10,7 +10,7 @@ JPH_NAMESPACE_BEGIN /// Factory, to create RTTI objects -class JPH_EXPORT Factory +class Factory { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Core/IssueReporting.h b/JoltPhysicsC/Jolt/Core/IssueReporting.h index c04e42ef..089c528d 100644 --- a/JoltPhysicsC/Jolt/Core/IssueReporting.h +++ b/JoltPhysicsC/Jolt/Core/IssueReporting.h @@ -8,7 +8,7 @@ JPH_NAMESPACE_BEGIN /// Trace function, needs to be overridden by application. This should output a line of text to the log / TTY. using TraceFunction = void (*)(const char *inFMT, ...); -JPH_EXPORT extern TraceFunction Trace; +extern TraceFunction Trace; // Always turn on asserts in Debug mode #if defined(_DEBUG) && !defined(JPH_ENABLE_ASSERTS) @@ -18,7 +18,7 @@ JPH_EXPORT extern TraceFunction Trace; #ifdef JPH_ENABLE_ASSERTS /// Function called when an assertion fails. This function should return true if a breakpoint needs to be triggered using AssertFailedFunction = bool(*)(const char *inExpression, const char *inMessage, const char *inFile, uint inLine); - JPH_EXPORT extern AssertFailedFunction AssertFailed; + extern AssertFailedFunction AssertFailed; // Helper functions to pass message on to failed function struct AssertLastParam { }; diff --git a/JoltPhysicsC/Jolt/Core/JobSystem.h b/JoltPhysicsC/Jolt/Core/JobSystem.h index 1d0b7461..1f82b337 100644 --- a/JoltPhysicsC/Jolt/Core/JobSystem.h +++ b/JoltPhysicsC/Jolt/Core/JobSystem.h @@ -66,7 +66,7 @@ JPH_NAMESPACE_BEGIN /// to wait for these in this function after the barrier is finished waiting. /// /// An example implementation is JobSystemThreadPool. If you don't want to write the Barrier class you can also inherit from JobSystemWithBarrier. -class JPH_EXPORT JobSystem : public NonCopyable +class JobSystem : public NonCopyable { protected: class Job; diff --git a/JoltPhysicsC/Jolt/Core/JobSystemThreadPool.h b/JoltPhysicsC/Jolt/Core/JobSystemThreadPool.h index 2232b684..f415269f 100644 --- a/JoltPhysicsC/Jolt/Core/JobSystemThreadPool.h +++ b/JoltPhysicsC/Jolt/Core/JobSystemThreadPool.h @@ -22,7 +22,7 @@ using std::thread; /// Note that this is considered an example implementation. It is expected that when you integrate /// the physics engine into your own project that you'll provide your own implementation of the /// JobSystem built on top of whatever job system your project uses. -class JPH_EXPORT JobSystemThreadPool final : public JobSystemWithBarrier +class JobSystemThreadPool final : public JobSystemWithBarrier { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Core/JobSystemWithBarrier.h b/JoltPhysicsC/Jolt/Core/JobSystemWithBarrier.h index 0428824a..633e82ee 100644 --- a/JoltPhysicsC/Jolt/Core/JobSystemWithBarrier.h +++ b/JoltPhysicsC/Jolt/Core/JobSystemWithBarrier.h @@ -20,7 +20,7 @@ JPH_NAMESPACE_BEGIN /// * JobSystem::QueueJob/QueueJobs /// /// See instructions in JobSystem for more information on how to implement these. -class JPH_EXPORT JobSystemWithBarrier : public JobSystem +class JobSystemWithBarrier : public JobSystem { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Core/LinearCurve.h b/JoltPhysicsC/Jolt/Core/LinearCurve.h index ed77341a..69df57d4 100644 --- a/JoltPhysicsC/Jolt/Core/LinearCurve.h +++ b/JoltPhysicsC/Jolt/Core/LinearCurve.h @@ -13,16 +13,16 @@ class StreamOut; class StreamIn; // A set of points (x, y) that form a linear curve -class JPH_EXPORT LinearCurve +class LinearCurve { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, LinearCurve) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(LinearCurve) /// A point on the curve class Point { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, Point) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(Point) float mX = 0.0f; float mY = 0.0f; diff --git a/JoltPhysicsC/Jolt/Core/Memory.h b/JoltPhysicsC/Jolt/Core/Memory.h index ce28ac40..3b83ec02 100644 --- a/JoltPhysicsC/Jolt/Core/Memory.h +++ b/JoltPhysicsC/Jolt/Core/Memory.h @@ -17,13 +17,13 @@ using AlignedAllocateFunction = void *(*)(size_t inSize, size_t inAlignment); using AlignedFreeFunction = void (*)(void *inBlock); // User defined allocation / free functions -JPH_EXPORT extern AllocateFunction Allocate; -JPH_EXPORT extern FreeFunction Free; -JPH_EXPORT extern AlignedAllocateFunction AlignedAllocate; -JPH_EXPORT extern AlignedFreeFunction AlignedFree; +extern AllocateFunction Allocate; +extern FreeFunction Free; +extern AlignedAllocateFunction AlignedAllocate; +extern AlignedFreeFunction AlignedFree; /// Register platform default allocation / free functions -JPH_EXPORT void RegisterDefaultAllocator(); +void RegisterDefaultAllocator(); /// Macro to override the new and delete functions #define JPH_OVERRIDE_NEW_DELETE \ @@ -39,10 +39,10 @@ JPH_EXPORT void RegisterDefaultAllocator(); #else // Directly define the allocation functions -JPH_EXPORT void *Allocate(size_t inSize); -JPH_EXPORT void Free(void *inBlock); -JPH_EXPORT void *AlignedAllocate(size_t inSize, size_t inAlignment); -JPH_EXPORT void AlignedFree(void *inBlock); +void *Allocate(size_t inSize); +void Free(void *inBlock); +void *AlignedAllocate(size_t inSize, size_t inAlignment); +void AlignedFree(void *inBlock); // Don't implement allocator registering inline void RegisterDefaultAllocator() { } diff --git a/JoltPhysicsC/Jolt/Core/NonCopyable.h b/JoltPhysicsC/Jolt/Core/NonCopyable.h index 18b431e9..0284ec5f 100644 --- a/JoltPhysicsC/Jolt/Core/NonCopyable.h +++ b/JoltPhysicsC/Jolt/Core/NonCopyable.h @@ -7,7 +7,7 @@ JPH_NAMESPACE_BEGIN /// Class that makes another class non-copyable. Usage: Inherit from NonCopyable. -class JPH_EXPORT NonCopyable +class NonCopyable { public: NonCopyable() = default; diff --git a/JoltPhysicsC/Jolt/Core/Profiler.cpp b/JoltPhysicsC/Jolt/Core/Profiler.cpp index 76bd1561..6f763781 100644 --- a/JoltPhysicsC/Jolt/Core/Profiler.cpp +++ b/JoltPhysicsC/Jolt/Core/Profiler.cpp @@ -22,22 +22,7 @@ JPH_NAMESPACE_BEGIN ////////////////////////////////////////////////////////////////////////////////////////// Profiler *Profiler::sInstance = nullptr; - -#ifdef JPH_SHARED_LIBRARY - static thread_local ProfileThread *sInstance = nullptr; - - ProfileThread *ProfileThread::sGetInstance() - { - return sInstance; - } - - void ProfileThread::sSetInstance(ProfileThread *inInstance) - { - sInstance = inInstance; - } -#else - thread_local ProfileThread *ProfileThread::sInstance = nullptr; -#endif +thread_local ProfileThread *ProfileThread::sInstance = nullptr; bool ProfileMeasurement::sOutOfSamplesReported = false; diff --git a/JoltPhysicsC/Jolt/Core/Profiler.h b/JoltPhysicsC/Jolt/Core/Profiler.h index c6f07897..634d7d68 100644 --- a/JoltPhysicsC/Jolt/Core/Profiler.h +++ b/JoltPhysicsC/Jolt/Core/Profiler.h @@ -74,7 +74,7 @@ class ProfileSample; class ProfileThread; /// Singleton class for managing profiling information -class JPH_EXPORT Profiler : public NonCopyable +class Profiler : public NonCopyable { public: JPH_OVERRIDE_NEW_DELETE @@ -157,7 +157,7 @@ class JPH_EXPORT Profiler : public NonCopyable }; // Class that contains the information of a single scoped measurement -class alignas(16) JPH_EXPORT ProfileSample : public NonCopyable +class alignas(16) ProfileSample : public NonCopyable { public: JPH_OVERRIDE_NEW_DELETE @@ -186,20 +186,11 @@ class ProfileThread : public NonCopyable ProfileSample mSamples[cMaxSamples]; ///< Buffer of samples uint mCurrentSample = 0; ///< Next position to write a sample to -#ifdef JPH_SHARED_LIBRARY - JPH_EXPORT static void sSetInstance(ProfileThread *inInstance); - JPH_EXPORT static ProfileThread *sGetInstance(); -#else - static inline void sSetInstance(ProfileThread *inInstance) { sInstance = inInstance; } - static inline ProfileThread *sGetInstance() { return sInstance; } - -private: static thread_local ProfileThread *sInstance; -#endif }; /// Create this class on the stack to start sampling timing information of a particular scope -class JPH_EXPORT ProfileMeasurement : public NonCopyable +class ProfileMeasurement : public NonCopyable { public: /// Constructor @@ -231,10 +222,10 @@ JPH_CLANG_SUPPRESS_WARNING("-Wc++98-compat-pedantic") #define JPH_PROFILE_END() do { JPH_PROFILE_THREAD_END(); delete Profiler::sInstance; Profiler::sInstance = nullptr; } while (false) /// Start instrumenting a thread -#define JPH_PROFILE_THREAD_START(name) do { if (Profiler::sInstance) ProfileThread::sSetInstance(new ProfileThread(name)); } while (false) +#define JPH_PROFILE_THREAD_START(name) do { if (Profiler::sInstance) ProfileThread::sInstance = new ProfileThread(name); } while (false) /// End instrumenting a thread -#define JPH_PROFILE_THREAD_END() do { delete ProfileThread::sGetInstance(); ProfileThread::sSetInstance(nullptr); } while (false) +#define JPH_PROFILE_THREAD_END() do { delete ProfileThread::sInstance; ProfileThread::sInstance = nullptr; } while (false) /// Scope profiling measurement #define JPH_PROFILE_TAG2(line) profile##line diff --git a/JoltPhysicsC/Jolt/Core/Profiler.inl b/JoltPhysicsC/Jolt/Core/Profiler.inl index 25bb7253..16fa4137 100644 --- a/JoltPhysicsC/Jolt/Core/Profiler.inl +++ b/JoltPhysicsC/Jolt/Core/Profiler.inl @@ -25,16 +25,15 @@ ProfileThread::~ProfileThread() ProfileMeasurement::ProfileMeasurement(const char *inName, uint32 inColor) { - ProfileThread *current_thread = ProfileThread::sGetInstance(); - if (current_thread == nullptr) + if (ProfileThread::sInstance == nullptr) { // Thread not instrumented mSample = nullptr; } - else if (current_thread->mCurrentSample < ProfileThread::cMaxSamples) + else if (ProfileThread::sInstance->mCurrentSample < ProfileThread::cMaxSamples) { // Get pointer to write data to - mSample = ¤t_thread->mSamples[current_thread->mCurrentSample++]; + mSample = &ProfileThread::sInstance->mSamples[ProfileThread::sInstance->mCurrentSample++]; // Start constructing sample (will end up on stack) mTemp.mName = inName; diff --git a/JoltPhysicsC/Jolt/Core/RTTI.h b/JoltPhysicsC/Jolt/Core/RTTI.h index 13b8516d..fc11e796 100644 --- a/JoltPhysicsC/Jolt/Core/RTTI.h +++ b/JoltPhysicsC/Jolt/Core/RTTI.h @@ -118,7 +118,7 @@ JPH_NAMESPACE_BEGIN /// B *b = DynamicCast(a); /// /// does the correct cast -class JPH_EXPORT RTTI +class RTTI { public: /// Function to create an object @@ -188,10 +188,10 @@ class JPH_EXPORT RTTI ////////////////////////////////////////////////////////////////////////////////////////// // JPH_DECLARE_RTTI_NON_VIRTUAL -#define JPH_DECLARE_RTTI_NON_VIRTUAL(linkage, class_name) \ +#define JPH_DECLARE_RTTI_NON_VIRTUAL(class_name) \ public: \ JPH_OVERRIDE_NEW_DELETE \ - friend linkage RTTI * GetRTTIOfType(class_name *); \ + friend RTTI * GetRTTIOfType(class_name *); \ friend inline const RTTI * GetRTTI(const class_name *inObject) { return GetRTTIOfType((class_name *)nullptr); }\ static void sCreateRTTI(RTTI &inRTTI); \ @@ -210,8 +210,8 @@ public: \ ////////////////////////////////////////////////////////////////////////////////////////// // JPH_DECLARE_RTTI_OUTSIDE_CLASS -#define JPH_DECLARE_RTTI_OUTSIDE_CLASS(linkage, class_name) \ - linkage RTTI * GetRTTIOfType(class_name *); \ +#define JPH_DECLARE_RTTI_OUTSIDE_CLASS(class_name) \ + RTTI * GetRTTIOfType(class_name *); \ inline const RTTI * GetRTTI(const class_name *inObject) { return GetRTTIOfType((class_name *)nullptr); }\ void CreateRTTI##class_name(RTTI &inRTTI); \ @@ -228,22 +228,22 @@ public: \ // Same as above, but for classes that have virtual functions ////////////////////////////////////////////////////////////////////////////////////////// -#define JPH_DECLARE_RTTI_HELPER(linkage, class_name, modifier) \ +#define JPH_DECLARE_RTTI_HELPER(class_name, modifier) \ public: \ JPH_OVERRIDE_NEW_DELETE \ - friend linkage RTTI * GetRTTIOfType(class_name *); \ + friend RTTI * GetRTTIOfType(class_name *); \ friend inline const RTTI * GetRTTI(const class_name *inObject) { return inObject->GetRTTI(); } \ virtual const RTTI * GetRTTI() const modifier; \ virtual const void * CastTo(const RTTI *inRTTI) const modifier; \ static void sCreateRTTI(RTTI &inRTTI); \ // JPH_DECLARE_RTTI_VIRTUAL - for derived classes with RTTI -#define JPH_DECLARE_RTTI_VIRTUAL(linkage, class_name) \ - JPH_DECLARE_RTTI_HELPER(linkage, class_name, override) +#define JPH_DECLARE_RTTI_VIRTUAL(class_name) \ + JPH_DECLARE_RTTI_HELPER(class_name, override) // JPH_IMPLEMENT_RTTI_VIRTUAL #define JPH_IMPLEMENT_RTTI_VIRTUAL(class_name) \ - RTTI * GetRTTIOfType(class_name *) \ + RTTI * GetRTTIOfType(class_name *) \ { \ static RTTI rtti(#class_name, sizeof(class_name), []() -> void * { return new class_name; }, [](void *inObject) { delete (class_name *)inObject; }, &class_name::sCreateRTTI); \ return &rtti; \ @@ -259,16 +259,16 @@ public: \ void class_name::sCreateRTTI(RTTI &inRTTI) \ // JPH_DECLARE_RTTI_VIRTUAL_BASE - for concrete base class that has RTTI -#define JPH_DECLARE_RTTI_VIRTUAL_BASE(linkage, class_name) \ - JPH_DECLARE_RTTI_HELPER(linkage, class_name, ) +#define JPH_DECLARE_RTTI_VIRTUAL_BASE(class_name) \ + JPH_DECLARE_RTTI_HELPER(class_name, ) // JPH_IMPLEMENT_RTTI_VIRTUAL_BASE #define JPH_IMPLEMENT_RTTI_VIRTUAL_BASE(class_name) \ JPH_IMPLEMENT_RTTI_VIRTUAL(class_name) // JPH_DECLARE_RTTI_ABSTRACT - for derived abstract class that have RTTI -#define JPH_DECLARE_RTTI_ABSTRACT(linkage, class_name) \ - JPH_DECLARE_RTTI_HELPER(linkage, class_name, override) +#define JPH_DECLARE_RTTI_ABSTRACT(class_name) \ + JPH_DECLARE_RTTI_HELPER(class_name, override) // JPH_IMPLEMENT_RTTI_ABSTRACT #define JPH_IMPLEMENT_RTTI_ABSTRACT(class_name) \ @@ -288,8 +288,8 @@ public: \ void class_name::sCreateRTTI(RTTI &inRTTI) \ // JPH_DECLARE_RTTI_ABSTRACT_BASE - for abstract base class that has RTTI -#define JPH_DECLARE_RTTI_ABSTRACT_BASE(linkage, class_name) \ - JPH_DECLARE_RTTI_HELPER(linkage, class_name, ) +#define JPH_DECLARE_RTTI_ABSTRACT_BASE(class_name) \ + JPH_DECLARE_RTTI_HELPER(class_name, ) // JPH_IMPLEMENT_RTTI_ABSTRACT_BASE #define JPH_IMPLEMENT_RTTI_ABSTRACT_BASE(class_name) \ @@ -299,13 +299,13 @@ public: \ // Declare an RTTI class for registering with the factory ////////////////////////////////////////////////////////////////////////////////////////// -#define JPH_DECLARE_RTTI_FOR_FACTORY(linkage, class_name) \ - linkage RTTI * GetRTTIOfType(class class_name *); +#define JPH_DECLARE_RTTI_FOR_FACTORY(class_name) \ + RTTI * GetRTTIOfType(class class_name *); -#define JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(linkage, name_space, class_name) \ +#define JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(name_space, class_name) \ namespace name_space { \ class class_name; \ - linkage RTTI * GetRTTIOfType(class class_name *); \ + RTTI * GetRTTIOfType(class class_name *); \ } ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/JoltPhysicsC/Jolt/Core/Reference.h b/JoltPhysicsC/Jolt/Core/Reference.h index 787efbd1..eb114e09 100644 --- a/JoltPhysicsC/Jolt/Core/Reference.h +++ b/JoltPhysicsC/Jolt/Core/Reference.h @@ -78,7 +78,7 @@ class RefTarget }; /// Pure virtual version of RefTarget -class JPH_EXPORT RefTargetVirtual +class RefTargetVirtual { public: /// Virtual destructor diff --git a/JoltPhysicsC/Jolt/Core/Semaphore.h b/JoltPhysicsC/Jolt/Core/Semaphore.h index 85367f23..959dbc18 100644 --- a/JoltPhysicsC/Jolt/Core/Semaphore.h +++ b/JoltPhysicsC/Jolt/Core/Semaphore.h @@ -19,7 +19,7 @@ using std::condition_variable; /// Implements a semaphore /// When we switch to C++20 we can use counting_semaphore to unify this -class JPH_EXPORT Semaphore +class Semaphore { public: /// Constructor diff --git a/JoltPhysicsC/Jolt/Core/StreamIn.h b/JoltPhysicsC/Jolt/Core/StreamIn.h index d5ec4c5c..6e682058 100644 --- a/JoltPhysicsC/Jolt/Core/StreamIn.h +++ b/JoltPhysicsC/Jolt/Core/StreamIn.h @@ -7,7 +7,7 @@ JPH_NAMESPACE_BEGIN /// Simple binary input stream -class JPH_EXPORT StreamIn +class StreamIn { public: /// Virtual destructor diff --git a/JoltPhysicsC/Jolt/Core/StreamOut.h b/JoltPhysicsC/Jolt/Core/StreamOut.h index c2d0b53f..ea0befef 100644 --- a/JoltPhysicsC/Jolt/Core/StreamOut.h +++ b/JoltPhysicsC/Jolt/Core/StreamOut.h @@ -7,7 +7,7 @@ JPH_NAMESPACE_BEGIN /// Simple binary output stream -class JPH_EXPORT StreamOut +class StreamOut { public: /// Virtual destructor diff --git a/JoltPhysicsC/Jolt/Core/StringTools.h b/JoltPhysicsC/Jolt/Core/StringTools.h index d3def935..a98551bb 100644 --- a/JoltPhysicsC/Jolt/Core/StringTools.h +++ b/JoltPhysicsC/Jolt/Core/StringTools.h @@ -8,7 +8,7 @@ JPH_NAMESPACE_BEGIN /// Create a formatted text string for debugging purposes. /// Note that this function has an internal buffer of 1024 characters, so long strings will be trimmed. -JPH_EXPORT String StringFormat(const char *inFMT, ...); +String StringFormat(const char *inFMT, ...); /// Convert type to string template @@ -34,18 +34,18 @@ constexpr uint64 HashString(const char *inString) } /// Replace substring with other string -JPH_EXPORT void StringReplace(String &ioString, const string_view &inSearch, const string_view &inReplace); +void StringReplace(String &ioString, const string_view &inSearch, const string_view &inReplace); /// Convert a delimited string to an array of strings -JPH_EXPORT void StringToVector(const string_view &inString, Array &outVector, const string_view &inDelimiter = ",", bool inClearVector = true); +void StringToVector(const string_view &inString, Array &outVector, const string_view &inDelimiter = ",", bool inClearVector = true); /// Convert an array strings to a delimited string -JPH_EXPORT void VectorToString(const Array &inVector, String &outString, const string_view &inDelimiter = ","); +void VectorToString(const Array &inVector, String &outString, const string_view &inDelimiter = ","); /// Convert a string to lower case -JPH_EXPORT String ToLower(const string_view &inString); +String ToLower(const string_view &inString); /// Converts the lower 4 bits of inNibble to a string that represents the number in binary format -JPH_EXPORT const char *NibbleToBinary(uint32 inNibble); +const char *NibbleToBinary(uint32 inNibble); JPH_NAMESPACE_END diff --git a/JoltPhysicsC/Jolt/Core/TempAllocator.h b/JoltPhysicsC/Jolt/Core/TempAllocator.h index 1417eb28..e8d74c79 100644 --- a/JoltPhysicsC/Jolt/Core/TempAllocator.h +++ b/JoltPhysicsC/Jolt/Core/TempAllocator.h @@ -12,7 +12,7 @@ JPH_NAMESPACE_BEGIN /// This allocator works as a stack: The blocks must always be freed in the reverse order as they are allocated. /// Note that allocations and frees can take place from different threads, but the order is guaranteed though /// job dependencies, so it is not needed to use any form of locking. -class JPH_EXPORT TempAllocator : public NonCopyable +class TempAllocator : public NonCopyable { public: JPH_OVERRIDE_NEW_DELETE @@ -28,7 +28,7 @@ class JPH_EXPORT TempAllocator : public NonCopyable }; /// Default implementation of the temp allocator that allocates a large block through malloc upfront -class JPH_EXPORT TempAllocatorImpl final : public TempAllocator +class TempAllocatorImpl final : public TempAllocator { public: JPH_OVERRIDE_NEW_DELETE @@ -94,7 +94,7 @@ class JPH_EXPORT TempAllocatorImpl final : public TempAllocator /// Implementation of the TempAllocator that just falls back to malloc/free /// Note: This can be quite slow when running in the debugger as large memory blocks need to be initialized with 0xcd -class JPH_EXPORT TempAllocatorMalloc final : public TempAllocator +class TempAllocatorMalloc final : public TempAllocator { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Core/TickCounter.h b/JoltPhysicsC/Jolt/Core/TickCounter.h index 75caec03..9a8967d3 100644 --- a/JoltPhysicsC/Jolt/Core/TickCounter.h +++ b/JoltPhysicsC/Jolt/Core/TickCounter.h @@ -43,6 +43,6 @@ JPH_INLINE uint64 GetProcessorTickCount() #endif // JPH_PLATFORM_WINDOWS_UWP || (JPH_PLATFORM_WINDOWS && JPH_CPU_ARM) /// Get the amount of ticks per second, note that this number will never be fully accurate as the amound of ticks per second may vary with CPU load, so this number is only to be used to give an indication of time for profiling purposes -JPH_EXPORT uint64 GetProcessorTicksPerSecond(); +uint64 GetProcessorTicksPerSecond(); JPH_NAMESPACE_END diff --git a/JoltPhysicsC/Jolt/Geometry/ClosestPoint.h b/JoltPhysicsC/Jolt/Geometry/ClosestPoint.h index 51c6b5d4..5ecfdac8 100644 --- a/JoltPhysicsC/Jolt/Geometry/ClosestPoint.h +++ b/JoltPhysicsC/Jolt/Geometry/ClosestPoint.h @@ -64,7 +64,7 @@ namespace ClosestPoint float d01 = v0.Dot(v1); float denominator = d00 * d11 - d01 * d01; - if (abs(denominator) < 1.0e-12f) + if (abs(denominator) < FLT_EPSILON) { // Degenerate triangle, return coordinates along longest edge if (d00 > d11) @@ -93,7 +93,7 @@ namespace ClosestPoint float d12 = v1.Dot(v2); float denominator = d11 * d22 - d12 * d12; - if (abs(denominator) < 1.0e-12f) + if (abs(denominator) < FLT_EPSILON) { // Degenerate triangle, return coordinates along longest edge if (d11 > d22) diff --git a/JoltPhysicsC/Jolt/Geometry/ConvexHullBuilder.h b/JoltPhysicsC/Jolt/Geometry/ConvexHullBuilder.h index a4aaf579..63bf556f 100644 --- a/JoltPhysicsC/Jolt/Geometry/ConvexHullBuilder.h +++ b/JoltPhysicsC/Jolt/Geometry/ConvexHullBuilder.h @@ -17,7 +17,7 @@ JPH_NAMESPACE_BEGIN /// A convex hull builder that tries to create hulls as accurately as possible. Used for offline processing. -class JPH_EXPORT ConvexHullBuilder : public NonCopyable +class ConvexHullBuilder : public NonCopyable { public: // Forward declare diff --git a/JoltPhysicsC/Jolt/Geometry/ConvexHullBuilder2D.h b/JoltPhysicsC/Jolt/Geometry/ConvexHullBuilder2D.h index b6cbe51a..ce3ba9d3 100644 --- a/JoltPhysicsC/Jolt/Geometry/ConvexHullBuilder2D.h +++ b/JoltPhysicsC/Jolt/Geometry/ConvexHullBuilder2D.h @@ -11,7 +11,7 @@ JPH_NAMESPACE_BEGIN /// A convex hull builder that tries to create 2D hulls as accurately as possible. Used for offline processing. -class JPH_EXPORT ConvexHullBuilder2D : public NonCopyable +class ConvexHullBuilder2D : public NonCopyable { public: using Positions = Array; diff --git a/JoltPhysicsC/Jolt/Geometry/Indexify.h b/JoltPhysicsC/Jolt/Geometry/Indexify.h index 01fb8053..7b1f1318 100644 --- a/JoltPhysicsC/Jolt/Geometry/Indexify.h +++ b/JoltPhysicsC/Jolt/Geometry/Indexify.h @@ -11,9 +11,9 @@ JPH_NAMESPACE_BEGIN /// Take a list of triangles and get the unique set of vertices and use them to create indexed triangles. /// Vertices that are less than inVertexWeldDistance apart will be combined to a single vertex. -JPH_EXPORT void Indexify(const TriangleList &inTriangles, VertexList &outVertices, IndexedTriangleList &outTriangles, float inVertexWeldDistance = 1.0e-4f); +void Indexify(const TriangleList &inTriangles, VertexList &outVertices, IndexedTriangleList &outTriangles, float inVertexWeldDistance = 1.0e-4f); /// Take a list of indexed triangles and unpack them -JPH_EXPORT void Deindexify(const VertexList &inVertices, const IndexedTriangleList &inTriangles, TriangleList &outTriangles); +void Deindexify(const VertexList &inVertices, const IndexedTriangleList &inTriangles, TriangleList &outTriangles); JPH_NAMESPACE_END diff --git a/JoltPhysicsC/Jolt/Geometry/OrientedBox.h b/JoltPhysicsC/Jolt/Geometry/OrientedBox.h index 5a4f8a34..4ab85f53 100644 --- a/JoltPhysicsC/Jolt/Geometry/OrientedBox.h +++ b/JoltPhysicsC/Jolt/Geometry/OrientedBox.h @@ -14,7 +14,7 @@ JPH_NAMESPACE_BEGIN class AABox; /// Oriented box -class [[nodiscard]] JPH_EXPORT OrientedBox +class [[nodiscard]] OrientedBox { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Jolt.cmake b/JoltPhysicsC/Jolt/Jolt.cmake deleted file mode 100644 index edefdf3f..00000000 --- a/JoltPhysicsC/Jolt/Jolt.cmake +++ /dev/null @@ -1,568 +0,0 @@ -# Requires C++ 17 -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -# Root -set(JOLT_PHYSICS_ROOT ${PHYSICS_REPO_ROOT}/Jolt) - -# Source files -set(JOLT_PHYSICS_SRC_FILES - ${JOLT_PHYSICS_ROOT}/AABBTree/AABBTreeBuilder.cpp - ${JOLT_PHYSICS_ROOT}/AABBTree/AABBTreeBuilder.h - ${JOLT_PHYSICS_ROOT}/AABBTree/AABBTreeToBuffer.h - ${JOLT_PHYSICS_ROOT}/AABBTree/NodeCodec/NodeCodecQuadTreeHalfFloat.h - ${JOLT_PHYSICS_ROOT}/AABBTree/TriangleCodec/TriangleCodecIndexed8BitPackSOA4Flags.h - ${JOLT_PHYSICS_ROOT}/Core/ARMNeon.h - ${JOLT_PHYSICS_ROOT}/Core/Atomics.h - ${JOLT_PHYSICS_ROOT}/Core/ByteBuffer.h - ${JOLT_PHYSICS_ROOT}/Core/Color.cpp - ${JOLT_PHYSICS_ROOT}/Core/Color.h - ${JOLT_PHYSICS_ROOT}/Core/Core.h - ${JOLT_PHYSICS_ROOT}/Core/Factory.cpp - ${JOLT_PHYSICS_ROOT}/Core/Factory.h - ${JOLT_PHYSICS_ROOT}/Core/FixedSizeFreeList.h - ${JOLT_PHYSICS_ROOT}/Core/FixedSizeFreeList.inl - ${JOLT_PHYSICS_ROOT}/Core/FPControlWord.h - ${JOLT_PHYSICS_ROOT}/Core/FPException.h - ${JOLT_PHYSICS_ROOT}/Core/FPFlushDenormals.h - ${JOLT_PHYSICS_ROOT}/Core/HashCombine.h - ${JOLT_PHYSICS_ROOT}/Core/InsertionSort.h - ${JOLT_PHYSICS_ROOT}/Core/IssueReporting.cpp - ${JOLT_PHYSICS_ROOT}/Core/IssueReporting.h - ${JOLT_PHYSICS_ROOT}/Core/JobSystem.h - ${JOLT_PHYSICS_ROOT}/Core/JobSystem.inl - ${JOLT_PHYSICS_ROOT}/Core/JobSystemThreadPool.cpp - ${JOLT_PHYSICS_ROOT}/Core/JobSystemThreadPool.h - ${JOLT_PHYSICS_ROOT}/Core/JobSystemWithBarrier.cpp - ${JOLT_PHYSICS_ROOT}/Core/JobSystemWithBarrier.h - ${JOLT_PHYSICS_ROOT}/Core/LinearCurve.cpp - ${JOLT_PHYSICS_ROOT}/Core/LinearCurve.h - ${JOLT_PHYSICS_ROOT}/Core/LockFreeHashMap.h - ${JOLT_PHYSICS_ROOT}/Core/LockFreeHashMap.inl - ${JOLT_PHYSICS_ROOT}/Core/Memory.cpp - ${JOLT_PHYSICS_ROOT}/Core/Memory.h - ${JOLT_PHYSICS_ROOT}/Core/Mutex.h - ${JOLT_PHYSICS_ROOT}/Core/MutexArray.h - ${JOLT_PHYSICS_ROOT}/Core/NonCopyable.h - ${JOLT_PHYSICS_ROOT}/Core/Profiler.cpp - ${JOLT_PHYSICS_ROOT}/Core/Profiler.h - ${JOLT_PHYSICS_ROOT}/Core/Profiler.inl - ${JOLT_PHYSICS_ROOT}/Core/QuickSort.h - ${JOLT_PHYSICS_ROOT}/Core/Reference.h - ${JOLT_PHYSICS_ROOT}/Core/Result.h - ${JOLT_PHYSICS_ROOT}/Core/RTTI.cpp - ${JOLT_PHYSICS_ROOT}/Core/RTTI.h - ${JOLT_PHYSICS_ROOT}/Core/Semaphore.cpp - ${JOLT_PHYSICS_ROOT}/Core/Semaphore.h - ${JOLT_PHYSICS_ROOT}/Core/StaticArray.h - ${JOLT_PHYSICS_ROOT}/Core/StreamIn.h - ${JOLT_PHYSICS_ROOT}/Core/StreamOut.h - ${JOLT_PHYSICS_ROOT}/Core/StreamWrapper.h - ${JOLT_PHYSICS_ROOT}/Core/StringTools.cpp - ${JOLT_PHYSICS_ROOT}/Core/StringTools.h - ${JOLT_PHYSICS_ROOT}/Core/STLAlignedAllocator.h - ${JOLT_PHYSICS_ROOT}/Core/STLAllocator.h - ${JOLT_PHYSICS_ROOT}/Core/STLTempAllocator.h - ${JOLT_PHYSICS_ROOT}/Core/TempAllocator.h - ${JOLT_PHYSICS_ROOT}/Core/TickCounter.cpp - ${JOLT_PHYSICS_ROOT}/Core/TickCounter.h - ${JOLT_PHYSICS_ROOT}/Core/UnorderedMap.h - ${JOLT_PHYSICS_ROOT}/Core/UnorderedSet.h - ${JOLT_PHYSICS_ROOT}/Geometry/AABox.h - ${JOLT_PHYSICS_ROOT}/Geometry/AABox4.h - ${JOLT_PHYSICS_ROOT}/Geometry/ClipPoly.h - ${JOLT_PHYSICS_ROOT}/Geometry/ClosestPoint.h - ${JOLT_PHYSICS_ROOT}/Geometry/ConvexHullBuilder.cpp - ${JOLT_PHYSICS_ROOT}/Geometry/ConvexHullBuilder.h - ${JOLT_PHYSICS_ROOT}/Geometry/ConvexHullBuilder2D.cpp - ${JOLT_PHYSICS_ROOT}/Geometry/ConvexHullBuilder2D.h - ${JOLT_PHYSICS_ROOT}/Geometry/ConvexSupport.h - ${JOLT_PHYSICS_ROOT}/Geometry/Ellipse.h - ${JOLT_PHYSICS_ROOT}/Geometry/EPAConvexHullBuilder.h - ${JOLT_PHYSICS_ROOT}/Geometry/EPAPenetrationDepth.h - ${JOLT_PHYSICS_ROOT}/Geometry/GJKClosestPoint.h - ${JOLT_PHYSICS_ROOT}/Geometry/IndexedTriangle.h - ${JOLT_PHYSICS_ROOT}/Geometry/Indexify.cpp - ${JOLT_PHYSICS_ROOT}/Geometry/Indexify.h - ${JOLT_PHYSICS_ROOT}/Geometry/MortonCode.h - ${JOLT_PHYSICS_ROOT}/Geometry/OrientedBox.cpp - ${JOLT_PHYSICS_ROOT}/Geometry/OrientedBox.h - ${JOLT_PHYSICS_ROOT}/Geometry/Plane.h - ${JOLT_PHYSICS_ROOT}/Geometry/RayAABox.h - ${JOLT_PHYSICS_ROOT}/Geometry/RayAABox8.h - ${JOLT_PHYSICS_ROOT}/Geometry/RayCapsule.h - ${JOLT_PHYSICS_ROOT}/Geometry/RayCylinder.h - ${JOLT_PHYSICS_ROOT}/Geometry/RaySphere.h - ${JOLT_PHYSICS_ROOT}/Geometry/RayTriangle.h - ${JOLT_PHYSICS_ROOT}/Geometry/RayTriangle8.h - ${JOLT_PHYSICS_ROOT}/Geometry/Sphere.h - ${JOLT_PHYSICS_ROOT}/Geometry/Triangle.h - ${JOLT_PHYSICS_ROOT}/Jolt.cmake - ${JOLT_PHYSICS_ROOT}/Jolt.h - ${JOLT_PHYSICS_ROOT}/Math/DMat44.h - ${JOLT_PHYSICS_ROOT}/Math/DMat44.inl - ${JOLT_PHYSICS_ROOT}/Math/Double3.h - ${JOLT_PHYSICS_ROOT}/Math/DVec3.h - ${JOLT_PHYSICS_ROOT}/Math/DVec3.inl - ${JOLT_PHYSICS_ROOT}/Math/DynMatrix.h - ${JOLT_PHYSICS_ROOT}/Math/EigenValueSymmetric.h - ${JOLT_PHYSICS_ROOT}/Math/FindRoot.h - ${JOLT_PHYSICS_ROOT}/Math/Float2.h - ${JOLT_PHYSICS_ROOT}/Math/Float3.h - ${JOLT_PHYSICS_ROOT}/Math/Float4.h - ${JOLT_PHYSICS_ROOT}/Math/GaussianElimination.h - ${JOLT_PHYSICS_ROOT}/Math/HalfFloat.h - ${JOLT_PHYSICS_ROOT}/Math/Mat44.h - ${JOLT_PHYSICS_ROOT}/Math/Mat44.inl - ${JOLT_PHYSICS_ROOT}/Math/Math.h - ${JOLT_PHYSICS_ROOT}/Math/MathTypes.h - ${JOLT_PHYSICS_ROOT}/Math/Matrix.h - ${JOLT_PHYSICS_ROOT}/Math/Quat.h - ${JOLT_PHYSICS_ROOT}/Math/Quat.inl - ${JOLT_PHYSICS_ROOT}/Math/Real.h - ${JOLT_PHYSICS_ROOT}/Math/Swizzle.h - ${JOLT_PHYSICS_ROOT}/Math/Trigonometry.h - ${JOLT_PHYSICS_ROOT}/Math/UVec4.h - ${JOLT_PHYSICS_ROOT}/Math/UVec4.inl - ${JOLT_PHYSICS_ROOT}/Math/UVec8.h - ${JOLT_PHYSICS_ROOT}/Math/UVec8.inl - ${JOLT_PHYSICS_ROOT}/Math/Vec3.cpp - ${JOLT_PHYSICS_ROOT}/Math/Vec3.h - ${JOLT_PHYSICS_ROOT}/Math/Vec3.inl - ${JOLT_PHYSICS_ROOT}/Math/Vec4.h - ${JOLT_PHYSICS_ROOT}/Math/Vec4.inl - ${JOLT_PHYSICS_ROOT}/Math/Vec8.h - ${JOLT_PHYSICS_ROOT}/Math/Vec8.inl - ${JOLT_PHYSICS_ROOT}/Math/Vector.h - ${JOLT_PHYSICS_ROOT}/ObjectStream/GetPrimitiveTypeOfType.h - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStream.cpp - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStream.h - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStreamBinaryIn.cpp - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStreamBinaryIn.h - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStreamBinaryOut.cpp - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStreamBinaryOut.h - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStreamIn.cpp - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStreamIn.h - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStreamOut.cpp - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStreamOut.h - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStreamTextIn.cpp - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStreamTextIn.h - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStreamTextOut.cpp - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStreamTextOut.h - ${JOLT_PHYSICS_ROOT}/ObjectStream/ObjectStreamTypes.h - ${JOLT_PHYSICS_ROOT}/ObjectStream/SerializableAttribute.h - ${JOLT_PHYSICS_ROOT}/ObjectStream/SerializableAttributeEnum.h - ${JOLT_PHYSICS_ROOT}/ObjectStream/SerializableAttributeTyped.h - ${JOLT_PHYSICS_ROOT}/ObjectStream/SerializableObject.cpp - ${JOLT_PHYSICS_ROOT}/ObjectStream/SerializableObject.h - ${JOLT_PHYSICS_ROOT}/ObjectStream/TypeDeclarations.cpp - ${JOLT_PHYSICS_ROOT}/ObjectStream/TypeDeclarations.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/Body.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Body/Body.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/Body.inl - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyAccess.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyAccess.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyActivationListener.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyCreationSettings.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyCreationSettings.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyFilter.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyID.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyInterface.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyInterface.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyLock.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyLockInterface.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyLockMulti.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyManager.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyManager.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/BodyPair.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/MassProperties.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Body/MassProperties.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/MotionProperties.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Body/MotionProperties.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/MotionProperties.inl - ${JOLT_PHYSICS_ROOT}/Physics/Body/MotionQuality.h - ${JOLT_PHYSICS_ROOT}/Physics/Body/MotionType.h - ${JOLT_PHYSICS_ROOT}/Physics/Character/Character.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Character/Character.h - ${JOLT_PHYSICS_ROOT}/Physics/Character/CharacterBase.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Character/CharacterBase.h - ${JOLT_PHYSICS_ROOT}/Physics/Character/CharacterVirtual.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Character/CharacterVirtual.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/AABoxCast.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/ActiveEdgeMode.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/ActiveEdges.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/BackFaceMode.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/BroadPhase/BroadPhase.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/BroadPhase/BroadPhase.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/BroadPhase/BroadPhaseBruteForce.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/BroadPhase/BroadPhaseBruteForce.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/BroadPhase/BroadPhaseLayer.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/BroadPhase/BroadPhaseQuadTree.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/BroadPhase/BroadPhaseQuery.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/BroadPhase/QuadTree.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/BroadPhase/QuadTree.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CastConvexVsTriangles.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CastConvexVsTriangles.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CastSphereVsTriangles.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CastSphereVsTriangles.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CastResult.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CollectFacesMode.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CollideConvexVsTriangles.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CollideConvexVsTriangles.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CollidePointResult.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CollideShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CollideSphereVsTriangles.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CollideSphereVsTriangles.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CollisionCollector.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CollisionCollectorImpl.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CollisionDispatch.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CollisionDispatch.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CollisionGroup.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/CollisionGroup.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/ContactListener.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/EstimateCollisionResponse.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/EstimateCollisionResponse.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/GroupFilter.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/GroupFilter.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/GroupFilterTable.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/GroupFilterTable.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/ManifoldBetweenTwoFaces.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/ManifoldBetweenTwoFaces.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/NarrowPhaseQuery.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/NarrowPhaseQuery.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/NarrowPhaseStats.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/NarrowPhaseStats.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/ObjectLayer.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/PhysicsMaterial.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/PhysicsMaterial.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/PhysicsMaterialSimple.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/PhysicsMaterialSimple.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/RayCast.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/BoxShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/BoxShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/CapsuleShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/CapsuleShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/CompoundShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/CompoundShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/CompoundShapeVisitors.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/ConvexHullShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/ConvexHullShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/ConvexShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/ConvexShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/CylinderShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/CylinderShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/DecoratedShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/DecoratedShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/GetTrianglesContext.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/HeightFieldShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/HeightFieldShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/MeshShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/MeshShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/MutableCompoundShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/MutableCompoundShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/OffsetCenterOfMassShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/OffsetCenterOfMassShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/PolyhedronSubmergedVolumeCalculator.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/RotatedTranslatedShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/RotatedTranslatedShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/ScaledShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/ScaledShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/ScaleHelpers.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/Shape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/Shape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/SphereShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/SphereShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/StaticCompoundShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/StaticCompoundShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/SubShapeID.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/SubShapeIDPair.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/TaperedCapsuleShape.cpp - # ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/TaperedCapsuleShape.gliffy - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/TaperedCapsuleShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/TriangleShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/Shape/TriangleShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/ShapeCast.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/ShapeFilter.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/SortReverseAndStore.h - ${JOLT_PHYSICS_ROOT}/Physics/Collision/TransformedShape.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Collision/TransformedShape.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConeConstraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConeConstraint.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/Constraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/Constraint.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConstraintManager.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConstraintManager.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConstraintPart/AngleConstraintPart.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConstraintPart/AxisConstraintPart.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConstraintPart/DualAxisConstraintPart.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConstraintPart/GearConstraintPart.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConstraintPart/HingeRotationConstraintPart.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConstraintPart/IndependentAxisConstraintPart.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConstraintPart/PointConstraintPart.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConstraintPart/RackAndPinionConstraintPart.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConstraintPart/RotationQuatConstraintPart.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConstraintPart/SpringPart.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ContactConstraintManager.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/ContactConstraintManager.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/DistanceConstraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/DistanceConstraint.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/FixedConstraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/FixedConstraint.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/GearConstraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/GearConstraint.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/HingeConstraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/HingeConstraint.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/MotorSettings.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/MotorSettings.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/PathConstraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/PathConstraint.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/PathConstraintPath.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/PathConstraintPath.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/PathConstraintPathHermite.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/PathConstraintPathHermite.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/PointConstraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/PointConstraint.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/PulleyConstraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/PulleyConstraint.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/RackAndPinionConstraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/RackAndPinionConstraint.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/SixDOFConstraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/SixDOFConstraint.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/SliderConstraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/SliderConstraint.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/SwingTwistConstraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/SwingTwistConstraint.h - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/TwoBodyConstraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Constraints/TwoBodyConstraint.h - ${JOLT_PHYSICS_ROOT}/Physics/DeterminismLog.cpp - ${JOLT_PHYSICS_ROOT}/Physics/DeterminismLog.h - ${JOLT_PHYSICS_ROOT}/Physics/EActivation.h - ${JOLT_PHYSICS_ROOT}/Physics/EPhysicsUpdateError.h - ${JOLT_PHYSICS_ROOT}/Physics/IslandBuilder.cpp - ${JOLT_PHYSICS_ROOT}/Physics/IslandBuilder.h - ${JOLT_PHYSICS_ROOT}/Physics/LargeIslandSplitter.cpp - ${JOLT_PHYSICS_ROOT}/Physics/LargeIslandSplitter.h - ${JOLT_PHYSICS_ROOT}/Physics/PhysicsLock.cpp - ${JOLT_PHYSICS_ROOT}/Physics/PhysicsLock.h - ${JOLT_PHYSICS_ROOT}/Physics/PhysicsScene.cpp - ${JOLT_PHYSICS_ROOT}/Physics/PhysicsScene.h - ${JOLT_PHYSICS_ROOT}/Physics/PhysicsSettings.h - ${JOLT_PHYSICS_ROOT}/Physics/PhysicsStepListener.h - ${JOLT_PHYSICS_ROOT}/Physics/PhysicsSystem.cpp - ${JOLT_PHYSICS_ROOT}/Physics/PhysicsSystem.h - ${JOLT_PHYSICS_ROOT}/Physics/PhysicsUpdateContext.cpp - ${JOLT_PHYSICS_ROOT}/Physics/PhysicsUpdateContext.h - ${JOLT_PHYSICS_ROOT}/Physics/Ragdoll/Ragdoll.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Ragdoll/Ragdoll.h - ${JOLT_PHYSICS_ROOT}/Physics/StateRecorder.h - ${JOLT_PHYSICS_ROOT}/Physics/StateRecorderImpl.cpp - ${JOLT_PHYSICS_ROOT}/Physics/StateRecorderImpl.h - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/MotorcycleController.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/MotorcycleController.h - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/TrackedVehicleController.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/TrackedVehicleController.h - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleAntiRollBar.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleAntiRollBar.h - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleCollisionTester.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleCollisionTester.h - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleConstraint.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleConstraint.h - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleController.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleController.h - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleDifferential.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleDifferential.h - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleEngine.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleEngine.h - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleTrack.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleTrack.h - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleTransmission.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/VehicleTransmission.h - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/Wheel.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/Wheel.h - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/WheeledVehicleController.cpp - ${JOLT_PHYSICS_ROOT}/Physics/Vehicle/WheeledVehicleController.h - ${JOLT_PHYSICS_ROOT}/RegisterTypes.cpp - ${JOLT_PHYSICS_ROOT}/RegisterTypes.h - ${JOLT_PHYSICS_ROOT}/Renderer/DebugRenderer.cpp - ${JOLT_PHYSICS_ROOT}/Renderer/DebugRenderer.h - ${JOLT_PHYSICS_ROOT}/Renderer/DebugRendererPlayback.cpp - ${JOLT_PHYSICS_ROOT}/Renderer/DebugRendererPlayback.h - ${JOLT_PHYSICS_ROOT}/Renderer/DebugRendererRecorder.cpp - ${JOLT_PHYSICS_ROOT}/Renderer/DebugRendererRecorder.h - ${JOLT_PHYSICS_ROOT}/Skeleton/SkeletalAnimation.cpp - ${JOLT_PHYSICS_ROOT}/Skeleton/SkeletalAnimation.h - ${JOLT_PHYSICS_ROOT}/Skeleton/Skeleton.cpp - ${JOLT_PHYSICS_ROOT}/Skeleton/Skeleton.h - ${JOLT_PHYSICS_ROOT}/Skeleton/SkeletonMapper.cpp - ${JOLT_PHYSICS_ROOT}/Skeleton/SkeletonMapper.h - ${JOLT_PHYSICS_ROOT}/Skeleton/SkeletonPose.cpp - ${JOLT_PHYSICS_ROOT}/Skeleton/SkeletonPose.h - ${JOLT_PHYSICS_ROOT}/TriangleGrouper/TriangleGrouper.h - ${JOLT_PHYSICS_ROOT}/TriangleGrouper/TriangleGrouperClosestCentroid.cpp - ${JOLT_PHYSICS_ROOT}/TriangleGrouper/TriangleGrouperClosestCentroid.h - ${JOLT_PHYSICS_ROOT}/TriangleGrouper/TriangleGrouperMorton.cpp - ${JOLT_PHYSICS_ROOT}/TriangleGrouper/TriangleGrouperMorton.h - ${JOLT_PHYSICS_ROOT}/TriangleSplitter/TriangleSplitter.cpp - ${JOLT_PHYSICS_ROOT}/TriangleSplitter/TriangleSplitter.h - ${JOLT_PHYSICS_ROOT}/TriangleSplitter/TriangleSplitterBinning.cpp - ${JOLT_PHYSICS_ROOT}/TriangleSplitter/TriangleSplitterBinning.h - ${JOLT_PHYSICS_ROOT}/TriangleSplitter/TriangleSplitterFixedLeafSize.cpp - ${JOLT_PHYSICS_ROOT}/TriangleSplitter/TriangleSplitterFixedLeafSize.h - ${JOLT_PHYSICS_ROOT}/TriangleSplitter/TriangleSplitterLongestAxis.cpp - ${JOLT_PHYSICS_ROOT}/TriangleSplitter/TriangleSplitterLongestAxis.h - ${JOLT_PHYSICS_ROOT}/TriangleSplitter/TriangleSplitterMean.cpp - ${JOLT_PHYSICS_ROOT}/TriangleSplitter/TriangleSplitterMean.h - ${JOLT_PHYSICS_ROOT}/TriangleSplitter/TriangleSplitterMorton.cpp - ${JOLT_PHYSICS_ROOT}/TriangleSplitter/TriangleSplitterMorton.h -) - -if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") - # Add natvis file - # JoltJava: Don't add natvis file - # set(JOLT_PHYSICS_SRC_FILES ${JOLT_PHYSICS_SRC_FILES} ${JOLT_PHYSICS_ROOT}/Jolt.natvis) -endif() - -# Group source files -source_group(TREE ${JOLT_PHYSICS_ROOT} FILES ${JOLT_PHYSICS_SRC_FILES}) - -# Create Jolt lib - -if (COMPILE_AS_SHARED_LIBRARY) - add_library(Jolt SHARED ${JOLT_PHYSICS_SRC_FILES}) - - # Set default visibility to hidden - set(CMAKE_CXX_VISIBILITY_PRESET hidden) - - if (MSVC) - # MSVC specific option to enable PDB generation - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG:FASTLINK") - else() - # Clang/GCC option to enable debug symbol generation - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -g") - endif() - - # Set linker flags for other build types to be the same as release - set(CMAKE_SHARED_LINKER_FLAGS_RELEASEASAN "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") - set(CMAKE_SHARED_LINKER_FLAGS_RELEASEUBSAN "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") - set(CMAKE_SHARED_LINKER_FLAGS_RELEASECOVERAGE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") - set(CMAKE_SHARED_LINKER_FLAGS_DISTRIBUTION "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") - - # Public define to instruct user code to import Jolt symbols (rather than use static linking) - target_compile_definitions(Jolt PUBLIC JPH_SHARED_LIBRARY) - - # Private define to instruct the library to export symbols for shared linking - target_compile_definitions(Jolt PRIVATE JPH_BUILD_SHARED_LIBRARY) -else() - add_library(Jolt STATIC ${JOLT_PHYSICS_SRC_FILES}) -endif() - -target_include_directories(Jolt PUBLIC ${PHYSICS_REPO_ROOT}) -target_precompile_headers(Jolt PRIVATE ${JOLT_PHYSICS_ROOT}/Jolt.h) -target_compile_definitions(Jolt PUBLIC "$<$:_DEBUG;JPH_PROFILE_ENABLED;JPH_DEBUG_RENDERER>") -target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG;JPH_PROFILE_ENABLED;JPH_DEBUG_RENDERER>") -target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG>") -target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG;JPH_PROFILE_ENABLED;JPH_DISABLE_TEMP_ALLOCATOR;JPH_DISABLE_CUSTOM_ALLOCATOR;JPH_DEBUG_RENDERER>") -target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG;JPH_PROFILE_ENABLED;JPH_DEBUG_RENDERER>") -target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG>") - -# Setting floating point exceptions -if (FLOATING_POINT_EXCEPTIONS_ENABLED AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - target_compile_definitions(Jolt PUBLIC "$<$:JPH_FLOATING_POINT_EXCEPTIONS_ENABLED>") - target_compile_definitions(Jolt PUBLIC "$<$:JPH_FLOATING_POINT_EXCEPTIONS_ENABLED>") -endif() - -# Setting double precision flag -if (DOUBLE_PRECISION) - target_compile_definitions(Jolt PUBLIC JPH_DOUBLE_PRECISION) -endif() - -# Setting to attempt cross platform determinism -if (CROSS_PLATFORM_DETERMINISTIC) - target_compile_definitions(Jolt PUBLIC JPH_CROSS_PLATFORM_DETERMINISTIC) -endif() - -# Setting to determine number of bits in ObjectLayer -if (OBJECT_LAYER_BITS) - target_compile_definitions(Jolt PUBLIC JPH_OBJECT_LAYER_BITS=${OBJECT_LAYER_BITS}) -endif() - -# Emit the instruction set definitions to ensure that child projects use the same settings even if they override the used instruction sets (a mismatch causes link errors) -function(EMIT_X86_INSTRUCTION_SET_DEFINITIONS) - if (USE_AVX512) - target_compile_definitions(Jolt PUBLIC JPH_USE_AVX512) - endif() - if (USE_AVX2) - target_compile_definitions(Jolt PUBLIC JPH_USE_AVX2) - endif() - if (USE_AVX) - target_compile_definitions(Jolt PUBLIC JPH_USE_AVX) - endif() - if (USE_SSE4_1) - target_compile_definitions(Jolt PUBLIC JPH_USE_SSE4_1) - endif() - if (USE_SSE4_2) - target_compile_definitions(Jolt PUBLIC JPH_USE_SSE4_2) - endif() - if (USE_LZCNT) - target_compile_definitions(Jolt PUBLIC JPH_USE_LZCNT) - endif() - if (USE_TZCNT) - target_compile_definitions(Jolt PUBLIC JPH_USE_TZCNT) - endif() - if (USE_F16C) - target_compile_definitions(Jolt PUBLIC JPH_USE_F16C) - endif() - if (USE_FMADD AND NOT CROSS_PLATFORM_DETERMINISTIC) - target_compile_definitions(Jolt PUBLIC JPH_USE_FMADD) - endif() -endfunction() - -# Add the compiler commandline flags to select the right instruction sets -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - if ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86" OR "${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") - if (USE_AVX512) - target_compile_options(Jolt PUBLIC /arch:AVX512) - elseif (USE_AVX2) - target_compile_options(Jolt PUBLIC /arch:AVX2) - elseif (USE_AVX) - target_compile_options(Jolt PUBLIC /arch:AVX) - endif() - EMIT_X86_INSTRUCTION_SET_DEFINITIONS() - endif() -else() - if (CROSS_COMPILE_ARM OR CMAKE_OSX_ARCHITECTURES MATCHES "arm64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64") - # ARM64 uses no special commandline flags - elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64") - # x64 - if (USE_AVX512) - target_compile_options(Jolt PUBLIC -mavx512f -mavx512vl -mavx512dq -mavx2 -mbmi -mpopcnt -mlzcnt -mf16c) - elseif (USE_AVX2) - target_compile_options(Jolt PUBLIC -mavx2 -mbmi -mpopcnt -mlzcnt -mf16c) - elseif (USE_AVX) - target_compile_options(Jolt PUBLIC -mavx -mpopcnt) - elseif (USE_SSE4_2) - target_compile_options(Jolt PUBLIC -msse4.2 -mpopcnt) - elseif (USE_SSE4_1) - target_compile_options(Jolt PUBLIC -msse4.1) - else() - target_compile_options(Jolt PUBLIC -msse2) - endif() - if (USE_LZCNT) - target_compile_options(Jolt PUBLIC -mlzcnt) - endif() - if (USE_TZCNT) - target_compile_options(Jolt PUBLIC -mbmi) - endif() - if (USE_F16C) - target_compile_options(Jolt PUBLIC -mf16c) - endif() - if (USE_FMADD AND NOT CROSS_PLATFORM_DETERMINISTIC) - target_compile_options(Jolt PUBLIC -mfma) - endif() - EMIT_X86_INSTRUCTION_SET_DEFINITIONS() - endif() -endif() diff --git a/JoltPhysicsC/Jolt/Math/UVec4.h b/JoltPhysicsC/Jolt/Math/UVec4.h index fa4a56d2..7777eea3 100644 --- a/JoltPhysicsC/Jolt/Math/UVec4.h +++ b/JoltPhysicsC/Jolt/Math/UVec4.h @@ -210,6 +210,9 @@ class [[nodiscard]] alignas(JPH_VECTOR_ALIGNMENT) UVec4 Type mValue; uint32 mU32[4]; }; + +private: + static const UVec4 sFourMinusXShuffle[]; }; static_assert(is_trivial(), "Is supposed to be a trivial type!"); diff --git a/JoltPhysicsC/Jolt/Math/UVec4.inl b/JoltPhysicsC/Jolt/Math/UVec4.inl index f61b6716..2f717657 100644 --- a/JoltPhysicsC/Jolt/Math/UVec4.inl +++ b/JoltPhysicsC/Jolt/Math/UVec4.inl @@ -546,21 +546,10 @@ UVec4 UVec4::Expand4Byte12() const UVec4 UVec4::ShiftComponents4Minus(int inCount) const { -#if defined(JPH_USE_SSE4_1) || defined(JPH_USE_NEON) - alignas(UVec4) static constexpr uint32 sFourMinusXShuffle[5][4] = - { - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }, - { 0x0f0e0d0c, 0xffffffff, 0xffffffff, 0xffffffff }, - { 0x0b0a0908, 0x0f0e0d0c, 0xffffffff, 0xffffffff }, - { 0x07060504, 0x0b0a0908, 0x0f0e0d0c, 0xffffffff }, - { 0x03020100, 0x07060504, 0x0b0a0908, 0x0f0e0d0c } - }; -#endif - #if defined(JPH_USE_SSE4_1) - return _mm_shuffle_epi8(mValue, *reinterpret_cast(sFourMinusXShuffle[inCount])); + return _mm_shuffle_epi8(mValue, sFourMinusXShuffle[inCount].mValue); #elif defined(JPH_USE_NEON) - uint8x16_t idx = vreinterpretq_u8_u32(*reinterpret_cast(sFourMinusXShuffle[inCount])); + uint8x16_t idx = vreinterpretq_u8_u32(sFourMinusXShuffle[inCount].mValue); return vreinterpretq_u32_s8(vqtbl1q_s8(vreinterpretq_s8_u32(mValue), idx)); #else UVec4 result = UVec4::sZero(); diff --git a/JoltPhysicsC/Jolt/Math/Vec3.h b/JoltPhysicsC/Jolt/Math/Vec3.h index 860ccd96..fa0001a0 100644 --- a/JoltPhysicsC/Jolt/Math/Vec3.h +++ b/JoltPhysicsC/Jolt/Math/Vec3.h @@ -103,7 +103,7 @@ class [[nodiscard]] alignas(JPH_VECTOR_ALIGNMENT) Vec3 static JPH_INLINE Vec3 sUnitSpherical(float inTheta, float inPhi); /// A set of vectors uniformly spanning the surface of a unit sphere, usable for debug purposes - JPH_EXPORT static const std::vector sUnitSphere; + static const std::vector sUnitSphere; /// Get random unit vector template diff --git a/JoltPhysicsC/Jolt/ObjectStream/ObjectStream.h b/JoltPhysicsC/Jolt/ObjectStream/ObjectStream.h index 46567c9e..6b271cda 100644 --- a/JoltPhysicsC/Jolt/ObjectStream/ObjectStream.h +++ b/JoltPhysicsC/Jolt/ObjectStream/ObjectStream.h @@ -12,7 +12,7 @@ JPH_NAMESPACE_BEGIN /// Base class for object stream input and output streams. -class JPH_EXPORT ObjectStream +class ObjectStream { public: /// Stream type @@ -35,7 +35,7 @@ class JPH_EXPORT ObjectStream }; /// Interface class for reading from an object stream -class JPH_EXPORT IObjectStreamIn : public ObjectStream +class IObjectStreamIn : public ObjectStream { public: ///@name Input type specific operations @@ -69,7 +69,7 @@ class JPH_EXPORT IObjectStreamIn : public ObjectStream }; /// Interface class for writing to an object stream -class JPH_EXPORT IObjectStreamOut : public ObjectStream +class IObjectStreamOut : public ObjectStream { public: ///@name Output type specific operations @@ -108,11 +108,11 @@ class JPH_EXPORT IObjectStreamOut : public ObjectStream }; // Define macro to declare functions for a specific primitive type -#define JPH_DECLARE_PRIMITIVE(name) \ - JPH_EXPORT bool OSIsType(name *, int inArrayDepth, EOSDataType inDataType, const char *inClassName); \ - JPH_EXPORT bool OSReadData(IObjectStreamIn &ioStream, name &outPrimitive); \ - JPH_EXPORT void OSWriteDataType(IObjectStreamOut &ioStream, name *); \ - JPH_EXPORT void OSWriteData(IObjectStreamOut &ioStream, const name &inPrimitive); +#define JPH_DECLARE_PRIMITIVE(name) \ + bool OSIsType(name *, int inArrayDepth, EOSDataType inDataType, const char *inClassName); \ + bool OSReadData(IObjectStreamIn &ioStream, name &outPrimitive); \ + void OSWriteDataType(IObjectStreamOut &ioStream, name *); \ + void OSWriteData(IObjectStreamOut &ioStream, const name &inPrimitive); // This file uses the JPH_DECLARE_PRIMITIVE macro to define all types #include diff --git a/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamBinaryIn.h b/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamBinaryIn.h index 553282e6..41d130d6 100644 --- a/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamBinaryIn.h +++ b/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamBinaryIn.h @@ -9,7 +9,7 @@ JPH_NAMESPACE_BEGIN /// Implementation of ObjectStream binary input stream. -class JPH_EXPORT ObjectStreamBinaryIn : public ObjectStreamIn +class ObjectStreamBinaryIn : public ObjectStreamIn { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamBinaryOut.h b/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamBinaryOut.h index e321e79b..abfa2ce6 100644 --- a/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamBinaryOut.h +++ b/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamBinaryOut.h @@ -9,7 +9,7 @@ JPH_NAMESPACE_BEGIN /// Implementation of ObjectStream binary output stream. -class JPH_EXPORT ObjectStreamBinaryOut : public ObjectStreamOut +class ObjectStreamBinaryOut : public ObjectStreamOut { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamIn.h b/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamIn.h index bb44c460..f3508a17 100644 --- a/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamIn.h +++ b/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamIn.h @@ -17,7 +17,7 @@ JPH_NAMESPACE_BEGIN /// ObjectStreamIn contains all logic for reading an object from disk. It is the base /// class for the text and binary input streams (ObjectStreamTextIn and ObjectStreamBinaryIn). -class JPH_EXPORT ObjectStreamIn : public IObjectStreamIn +class ObjectStreamIn : public IObjectStreamIn { private: struct ClassDescription; diff --git a/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamOut.h b/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamOut.h index 8ab00cbd..83c63553 100644 --- a/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamOut.h +++ b/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamOut.h @@ -20,7 +20,7 @@ template using Queue = std::queue>>; /// ObjectStreamOut contains all logic for writing an object to disk. It is the base /// class for the text and binary output streams (ObjectStreamTextOut and ObjectStreamBinaryOut). -class JPH_EXPORT ObjectStreamOut : public IObjectStreamOut +class ObjectStreamOut : public IObjectStreamOut { private: struct ObjectInfo; diff --git a/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamTextIn.h b/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamTextIn.h index 5c7e7428..a67957c7 100644 --- a/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamTextIn.h +++ b/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamTextIn.h @@ -9,7 +9,7 @@ JPH_NAMESPACE_BEGIN /// Implementation of ObjectStream text input stream. -class JPH_EXPORT ObjectStreamTextIn : public ObjectStreamIn +class ObjectStreamTextIn : public ObjectStreamIn { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamTextOut.h b/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamTextOut.h index 541f04de..4e5f69a8 100644 --- a/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamTextOut.h +++ b/JoltPhysicsC/Jolt/ObjectStream/ObjectStreamTextOut.h @@ -9,7 +9,7 @@ JPH_NAMESPACE_BEGIN /// Implementation of ObjectStream text output stream. -class JPH_EXPORT ObjectStreamTextOut : public ObjectStreamOut +class ObjectStreamTextOut : public ObjectStreamOut { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/ObjectStream/SerializableObject.h b/JoltPhysicsC/Jolt/ObjectStream/SerializableObject.h index 9656fe46..a52c81cc 100644 --- a/JoltPhysicsC/Jolt/ObjectStream/SerializableObject.h +++ b/JoltPhysicsC/Jolt/ObjectStream/SerializableObject.h @@ -13,51 +13,51 @@ JPH_NAMESPACE_BEGIN ////////////////////////////////////////////////////////////////////////////////////////// // JPH_DECLARE_SERIALIZATION_FUNCTIONS -#define JPH_DECLARE_SERIALIZATION_FUNCTIONS(linkage, prefix, class_name) \ - linkage prefix bool OSReadData(IObjectStreamIn &ioStream, class_name &inInstance); \ - linkage prefix bool OSReadData(IObjectStreamIn &ioStream, class_name *&inPointer); \ - linkage prefix bool OSIsType(class_name *, int inArrayDepth, EOSDataType inDataType, const char *inClassName); \ - linkage prefix bool OSIsType(class_name **, int inArrayDepth, EOSDataType inDataType, const char *inClassName); \ - linkage prefix void OSWriteData(IObjectStreamOut &ioStream, const class_name &inInstance); \ - linkage prefix void OSWriteData(IObjectStreamOut &ioStream, class_name *const &inPointer); \ - linkage prefix void OSWriteDataType(IObjectStreamOut &ioStream, class_name *); \ - linkage prefix void OSWriteDataType(IObjectStreamOut &ioStream, class_name **); +#define JPH_DECLARE_SERIALIZATION_FUNCTIONS(prefix, class_name) \ + prefix bool OSReadData(IObjectStreamIn &ioStream, class_name &inInstance); \ + prefix bool OSReadData(IObjectStreamIn &ioStream, class_name *&inPointer); \ + prefix bool OSIsType(class_name *, int inArrayDepth, EOSDataType inDataType, const char *inClassName); \ + prefix bool OSIsType(class_name **, int inArrayDepth, EOSDataType inDataType, const char *inClassName); \ + prefix void OSWriteData(IObjectStreamOut &ioStream, const class_name &inInstance); \ + prefix void OSWriteData(IObjectStreamOut &ioStream, class_name *const &inPointer); \ + prefix void OSWriteDataType(IObjectStreamOut &ioStream, class_name *); \ + prefix void OSWriteDataType(IObjectStreamOut &ioStream, class_name **); // JPH_IMPLEMENT_SERIALIZATION_FUNCTIONS #define JPH_IMPLEMENT_SERIALIZATION_FUNCTIONS(class_name) \ - bool OSReadData(IObjectStreamIn &ioStream, class_name &inInstance) \ + bool OSReadData(IObjectStreamIn &ioStream, class_name &inInstance) \ { \ return ioStream.ReadClassData(#class_name, (void *)&inInstance); \ } \ - bool OSReadData(IObjectStreamIn &ioStream, class_name *&inPointer) \ + bool OSReadData(IObjectStreamIn &ioStream, class_name *&inPointer) \ { \ return ioStream.ReadPointerData(JPH_RTTI(class_name), (void **)&inPointer); \ } \ - bool OSIsType(class_name *, int inArrayDepth, EOSDataType inDataType, const char *inClassName) \ + bool OSIsType(class_name *, int inArrayDepth, EOSDataType inDataType, const char *inClassName) \ { \ return inArrayDepth == 0 && inDataType == EOSDataType::Instance && strcmp(inClassName, #class_name) == 0; \ } \ - bool OSIsType(class_name **, int inArrayDepth, EOSDataType inDataType, const char *inClassName) \ + bool OSIsType(class_name **, int inArrayDepth, EOSDataType inDataType, const char *inClassName) \ { \ return inArrayDepth == 0 && inDataType == EOSDataType::Pointer && strcmp(inClassName, #class_name) == 0; \ } \ - void OSWriteData(IObjectStreamOut &ioStream, const class_name &inInstance) \ + void OSWriteData(IObjectStreamOut &ioStream, const class_name &inInstance) \ { \ ioStream.WriteClassData(JPH_RTTI(class_name), (void *)&inInstance); \ } \ - void OSWriteData(IObjectStreamOut &ioStream, class_name *const &inPointer) \ + void OSWriteData(IObjectStreamOut &ioStream, class_name *const &inPointer) \ { \ if (inPointer) \ ioStream.WritePointerData(GetRTTI(inPointer), (void *)inPointer); \ else \ ioStream.WritePointerData(nullptr, nullptr); \ } \ - void OSWriteDataType(IObjectStreamOut &ioStream, class_name *) \ + void OSWriteDataType(IObjectStreamOut &ioStream, class_name *) \ { \ ioStream.WriteDataType(EOSDataType::Instance); \ ioStream.WriteName(#class_name); \ } \ - void OSWriteDataType(IObjectStreamOut &ioStream, class_name **) \ + void OSWriteDataType(IObjectStreamOut &ioStream, class_name **) \ { \ ioStream.WriteDataType(EOSDataType::Pointer); \ ioStream.WriteName(#class_name); \ @@ -68,10 +68,10 @@ JPH_NAMESPACE_BEGIN ////////////////////////////////////////////////////////////////////////////////////////// // JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL -#define JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(linkage, class_name) \ +#define JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(class_name) \ public: \ - JPH_DECLARE_RTTI_NON_VIRTUAL(linkage, class_name) \ - JPH_DECLARE_SERIALIZATION_FUNCTIONS(linkage, friend, class_name) \ + JPH_DECLARE_RTTI_NON_VIRTUAL(class_name) \ + JPH_DECLARE_SERIALIZATION_FUNCTIONS(friend, class_name) \ // JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL #define JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(class_name) \ @@ -83,9 +83,9 @@ public: \ ////////////////////////////////////////////////////////////////////////////////////////// // JPH_DECLARE_SERIALIZABLE_OUTSIDE_CLASS -#define JPH_DECLARE_SERIALIZABLE_OUTSIDE_CLASS(linkage, class_name) \ - JPH_DECLARE_RTTI_OUTSIDE_CLASS(linkage, class_name) \ - JPH_DECLARE_SERIALIZATION_FUNCTIONS(linkage, extern, class_name) \ +#define JPH_DECLARE_SERIALIZABLE_OUTSIDE_CLASS(class_name) \ + JPH_DECLARE_RTTI_OUTSIDE_CLASS(class_name) \ + JPH_DECLARE_SERIALIZATION_FUNCTIONS(extern, class_name) \ // JPH_IMPLEMENT_SERIALIZABLE_OUTSIDE_CLASS #define JPH_IMPLEMENT_SERIALIZABLE_OUTSIDE_CLASS(class_name) \ @@ -97,10 +97,10 @@ public: \ ////////////////////////////////////////////////////////////////////////////////////////// // JPH_DECLARE_SERIALIZABLE_VIRTUAL - Use for concrete, non-base classes -#define JPH_DECLARE_SERIALIZABLE_VIRTUAL(linkage, class_name) \ +#define JPH_DECLARE_SERIALIZABLE_VIRTUAL(class_name) \ public: \ - JPH_DECLARE_RTTI_VIRTUAL(linkage, class_name) \ - JPH_DECLARE_SERIALIZATION_FUNCTIONS(linkage, friend, class_name) \ + JPH_DECLARE_RTTI_VIRTUAL(class_name) \ + JPH_DECLARE_SERIALIZATION_FUNCTIONS(friend, class_name) \ // JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL #define JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL(class_name) \ @@ -108,10 +108,10 @@ public: \ JPH_IMPLEMENT_RTTI_VIRTUAL(class_name) \ // JPH_DECLARE_SERIALIZABLE_ABSTRACT - Use for abstract, non-base classes -#define JPH_DECLARE_SERIALIZABLE_ABSTRACT(linkage, class_name) \ +#define JPH_DECLARE_SERIALIZABLE_ABSTRACT(class_name) \ public: \ - JPH_DECLARE_RTTI_ABSTRACT(linkage, class_name) \ - JPH_DECLARE_SERIALIZATION_FUNCTIONS(linkage, friend, class_name) \ + JPH_DECLARE_RTTI_ABSTRACT(class_name) \ + JPH_DECLARE_SERIALIZATION_FUNCTIONS(friend, class_name) \ // JPH_IMPLEMENT_SERIALIZABLE_ABSTRACT #define JPH_IMPLEMENT_SERIALIZABLE_ABSTRACT(class_name) \ @@ -119,10 +119,10 @@ public: \ JPH_IMPLEMENT_RTTI_ABSTRACT(class_name) \ // JPH_DECLARE_SERIALIZABLE_VIRTUAL_BASE - Use for concrete base classes -#define JPH_DECLARE_SERIALIZABLE_VIRTUAL_BASE(linkage, class_name) \ +#define JPH_DECLARE_SERIALIZABLE_VIRTUAL_BASE(class_name) \ public: \ - JPH_DECLARE_RTTI_VIRTUAL_BASE(linkage, class_name) \ - JPH_DECLARE_SERIALIZATION_FUNCTIONS(linkage, friend, class_name) \ + JPH_DECLARE_RTTI_VIRTUAL_BASE(class_name) \ + JPH_DECLARE_SERIALIZATION_FUNCTIONS(friend, class_name) \ // JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL_BASE #define JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL_BASE(class_name) \ @@ -130,10 +130,10 @@ public: \ JPH_IMPLEMENT_RTTI_VIRTUAL_BASE(class_name) \ // JPH_DECLARE_SERIALIZABLE_ABSTRACT_BASE - Use for abstract base class -#define JPH_DECLARE_SERIALIZABLE_ABSTRACT_BASE(linkage, class_name) \ +#define JPH_DECLARE_SERIALIZABLE_ABSTRACT_BASE(class_name) \ public: \ - JPH_DECLARE_RTTI_ABSTRACT_BASE(linkage, class_name) \ - JPH_DECLARE_SERIALIZATION_FUNCTIONS(linkage, friend, class_name) \ + JPH_DECLARE_RTTI_ABSTRACT_BASE(class_name) \ + JPH_DECLARE_SERIALIZATION_FUNCTIONS(friend, class_name) \ // JPH_IMPLEMENT_SERIALIZABLE_ABSTRACT_BASE #define JPH_IMPLEMENT_SERIALIZABLE_ABSTRACT_BASE(class_name) \ @@ -143,9 +143,9 @@ public: \ /// Classes must be derived from SerializableObject if you want to be able to save pointers or /// reference counting pointers to objects of this or derived classes. The type will automatically /// be determined during serialization and upon deserialization it will be restored correctly. -class JPH_EXPORT SerializableObject +class SerializableObject { - JPH_DECLARE_SERIALIZABLE_ABSTRACT_BASE(JPH_EXPORT, SerializableObject) + JPH_DECLARE_SERIALIZABLE_ABSTRACT_BASE(SerializableObject) public: /// Constructor diff --git a/JoltPhysicsC/Jolt/ObjectStream/TypeDeclarations.h b/JoltPhysicsC/Jolt/ObjectStream/TypeDeclarations.h index 2a61c306..8c0aea47 100644 --- a/JoltPhysicsC/Jolt/ObjectStream/TypeDeclarations.h +++ b/JoltPhysicsC/Jolt/ObjectStream/TypeDeclarations.h @@ -12,27 +12,27 @@ JPH_NAMESPACE_BEGIN -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, uint8); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, uint16); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, int); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, uint32); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, uint64); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, float); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, double); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, bool); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, String); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, Float3); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, Double3); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, Vec3); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, DVec3); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, Vec4); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, Quat); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, Mat44); -JPH_DECLARE_RTTI_OUTSIDE_CLASS(JPH_EXPORT, DMat44); -JPH_DECLARE_SERIALIZABLE_OUTSIDE_CLASS(JPH_EXPORT, Color); -JPH_DECLARE_SERIALIZABLE_OUTSIDE_CLASS(JPH_EXPORT, AABox); -JPH_DECLARE_SERIALIZABLE_OUTSIDE_CLASS(JPH_EXPORT, Triangle); -JPH_DECLARE_SERIALIZABLE_OUTSIDE_CLASS(JPH_EXPORT, IndexedTriangle); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(uint8); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(uint16); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(int); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(uint32); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(uint64); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(float); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(double); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(bool); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(String); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(Float3); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(Double3); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(Vec3); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(DVec3); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(Vec4); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(Quat); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(Mat44); +JPH_DECLARE_RTTI_OUTSIDE_CLASS(DMat44); +JPH_DECLARE_SERIALIZABLE_OUTSIDE_CLASS(Color); +JPH_DECLARE_SERIALIZABLE_OUTSIDE_CLASS(AABox); +JPH_DECLARE_SERIALIZABLE_OUTSIDE_CLASS(Triangle); +JPH_DECLARE_SERIALIZABLE_OUTSIDE_CLASS(IndexedTriangle); JPH_NAMESPACE_END diff --git a/JoltPhysicsC/Jolt/Physics/Body/Body.h b/JoltPhysicsC/Jolt/Physics/Body/Body.h index 4e0fe9f3..8cf76af3 100644 --- a/JoltPhysicsC/Jolt/Physics/Body/Body.h +++ b/JoltPhysicsC/Jolt/Physics/Body/Body.h @@ -29,7 +29,7 @@ class BodyCreationSettings; /// The functions that get/set the position of the body all indicate if they are relative to the center of mass or to the original position in which the shape was created. /// /// The linear velocity is also velocity of the center of mass, to correct for this: \f$VelocityCOM = Velocity - AngularVelocity \times ShapeCOM\f$. -class alignas(JPH_RVECTOR_ALIGNMENT) JPH_EXPORT Body : public NonCopyable +class alignas(JPH_RVECTOR_ALIGNMENT) Body : public NonCopyable { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Body/BodyCreationSettings.h b/JoltPhysicsC/Jolt/Physics/Body/BodyCreationSettings.h index 9fcb6bf8..2429d21e 100644 --- a/JoltPhysicsC/Jolt/Physics/Body/BodyCreationSettings.h +++ b/JoltPhysicsC/Jolt/Physics/Body/BodyCreationSettings.h @@ -25,10 +25,10 @@ enum class EOverrideMassProperties : uint8 }; /// Settings for constructing a rigid body -class JPH_EXPORT BodyCreationSettings +class BodyCreationSettings { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, BodyCreationSettings) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(BodyCreationSettings) /// Constructor BodyCreationSettings() = default; diff --git a/JoltPhysicsC/Jolt/Physics/Body/BodyInterface.h b/JoltPhysicsC/Jolt/Physics/Body/BodyInterface.h index fd04150d..063555b9 100644 --- a/JoltPhysicsC/Jolt/Physics/Body/BodyInterface.h +++ b/JoltPhysicsC/Jolt/Physics/Body/BodyInterface.h @@ -27,7 +27,7 @@ class TwoBodyConstraint; /// Class that provides operations on bodies using a body ID. Note that if you need to do multiple operations on a single body, it is more efficient to lock the body once and combine the operations. /// All quantities are in world space unless otherwise specified. -class JPH_EXPORT BodyInterface : public NonCopyable +class BodyInterface : public NonCopyable { public: /// Initialize the interface (should only be called by PhysicsSystem) diff --git a/JoltPhysicsC/Jolt/Physics/Body/BodyManager.cpp b/JoltPhysicsC/Jolt/Physics/Body/BodyManager.cpp index 0725c5d8..0cd25938 100644 --- a/JoltPhysicsC/Jolt/Physics/Body/BodyManager.cpp +++ b/JoltPhysicsC/Jolt/Physics/Body/BodyManager.cpp @@ -20,28 +20,8 @@ JPH_NAMESPACE_BEGIN #ifdef JPH_ENABLE_ASSERTS - static thread_local bool sOverrideAllowActivation = false; - static thread_local bool sOverrideAllowDeactivation = false; - - bool BodyManager::sGetOverrideAllowActivation() - { - return sOverrideAllowActivation; - } - - void BodyManager::sSetOverrideAllowActivation(bool inValue) - { - sOverrideAllowActivation = inValue; - } - - bool BodyManager::sGetOverrideAllowDeactivation() - { - return sOverrideAllowDeactivation; - } - - void BodyManager::sSetOverrideAllowDeactivation(bool inValue) - { - sOverrideAllowDeactivation = inValue; - } + thread_local bool BodyManager::sOverrideAllowActivation = false; + thread_local bool BodyManager::sOverrideAllowDeactivation = false; #endif // Helper class that combines a body and its motion properties diff --git a/JoltPhysicsC/Jolt/Physics/Body/BodyManager.h b/JoltPhysicsC/Jolt/Physics/Body/BodyManager.h index 3dd6527b..c0fa9f4b 100644 --- a/JoltPhysicsC/Jolt/Physics/Body/BodyManager.h +++ b/JoltPhysicsC/Jolt/Physics/Body/BodyManager.h @@ -26,7 +26,7 @@ using BodyVector = Array; using BodyIDVector = Array; /// Class that contains all bodies -class JPH_EXPORT BodyManager : public NonCopyable +class BodyManager : public NonCopyable { public: JPH_OVERRIDE_NEW_DELETE @@ -209,17 +209,17 @@ class JPH_EXPORT BodyManager : public NonCopyable public: inline GrantActiveBodiesAccess(bool inAllowActivation, bool inAllowDeactivation) { - JPH_ASSERT(!sGetOverrideAllowActivation()); - sSetOverrideAllowActivation(inAllowActivation); + JPH_ASSERT(!sOverrideAllowActivation); + sOverrideAllowActivation = inAllowActivation; - JPH_ASSERT(!sGetOverrideAllowDeactivation()); - sSetOverrideAllowDeactivation(inAllowDeactivation); + JPH_ASSERT(!sOverrideAllowDeactivation); + sOverrideAllowDeactivation = inAllowDeactivation; } inline ~GrantActiveBodiesAccess() { - sSetOverrideAllowActivation(false); - sSetOverrideAllowDeactivation(false); + sOverrideAllowActivation = false; + sOverrideAllowDeactivation = false; } }; #endif @@ -300,14 +300,10 @@ class JPH_EXPORT BodyManager : public NonCopyable const BroadPhaseLayerInterface *mBroadPhaseLayerInterface = nullptr; #ifdef JPH_ENABLE_ASSERTS - static bool sGetOverrideAllowActivation(); - static void sSetOverrideAllowActivation(bool inValue); - - static bool sGetOverrideAllowDeactivation(); - static void sSetOverrideAllowDeactivation(bool inValue); - /// Debug system that tries to limit changes to active bodies during the PhysicsSystem::Update() bool mActiveBodiesLocked = false; + static thread_local bool sOverrideAllowActivation; + static thread_local bool sOverrideAllowDeactivation; #endif }; diff --git a/JoltPhysicsC/Jolt/Physics/Body/MassProperties.h b/JoltPhysicsC/Jolt/Physics/Body/MassProperties.h index 5b464193..2df1332b 100644 --- a/JoltPhysicsC/Jolt/Physics/Body/MassProperties.h +++ b/JoltPhysicsC/Jolt/Physics/Body/MassProperties.h @@ -12,10 +12,10 @@ class StreamIn; class StreamOut; /// Describes the mass and inertia properties of a body. Used during body construction only. -class JPH_EXPORT MassProperties +class MassProperties { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, MassProperties) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(MassProperties) /// Using eigendecomposition, decompose the inertia tensor into a diagonal matrix D and a right-handed rotation matrix R so that the inertia tensor is \f$R \: D \: R^{-1}\f$. /// @see https://en.wikipedia.org/wiki/Moment_of_inertia section 'Principal axes' diff --git a/JoltPhysicsC/Jolt/Physics/Body/MotionProperties.h b/JoltPhysicsC/Jolt/Physics/Body/MotionProperties.h index 7f7efdee..d5dcc452 100644 --- a/JoltPhysicsC/Jolt/Physics/Body/MotionProperties.h +++ b/JoltPhysicsC/Jolt/Physics/Body/MotionProperties.h @@ -16,7 +16,7 @@ JPH_NAMESPACE_BEGIN class StateRecorder; /// The Body class only keeps track of state for static bodies, the MotionProperties class keeps the additional state needed for a moving Body. It has a 1-on-1 relationship with the body. -class JPH_EXPORT MotionProperties +class MotionProperties { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Character/Character.h b/JoltPhysicsC/Jolt/Physics/Character/Character.h index 1dbb339d..782a671a 100644 --- a/JoltPhysicsC/Jolt/Physics/Character/Character.h +++ b/JoltPhysicsC/Jolt/Physics/Character/Character.h @@ -10,7 +10,7 @@ JPH_NAMESPACE_BEGIN /// Contains the configuration of a character -class JPH_EXPORT CharacterSettings : public CharacterBaseSettings +class CharacterSettings : public CharacterBaseSettings { public: JPH_OVERRIDE_NEW_DELETE @@ -32,7 +32,7 @@ class JPH_EXPORT CharacterSettings : public CharacterBaseSettings /// This object usually represents the player or a humanoid AI. It uses a single rigid body, /// usually with a capsule shape to simulate movement and collision for the character. /// The character is a keyframed object, the application controls it by setting the velocity. -class JPH_EXPORT Character : public CharacterBase +class Character : public CharacterBase { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Character/CharacterBase.h b/JoltPhysicsC/Jolt/Physics/Character/CharacterBase.h index 94806015..1737846c 100644 --- a/JoltPhysicsC/Jolt/Physics/Character/CharacterBase.h +++ b/JoltPhysicsC/Jolt/Physics/Character/CharacterBase.h @@ -17,7 +17,7 @@ class PhysicsSystem; class StateRecorder; /// Base class for configuration of a character -class JPH_EXPORT CharacterBaseSettings : public RefTarget +class CharacterBaseSettings : public RefTarget { public: JPH_OVERRIDE_NEW_DELETE @@ -42,7 +42,7 @@ class JPH_EXPORT CharacterBaseSettings : public RefTarget }; /// Base class for character class -class JPH_EXPORT CharacterBase : public RefTarget, public NonCopyable +class CharacterBase : public RefTarget, public NonCopyable { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Character/CharacterVirtual.cpp b/JoltPhysicsC/Jolt/Physics/Character/CharacterVirtual.cpp index 1fbeb034..a61fa2ac 100644 --- a/JoltPhysicsC/Jolt/Physics/Character/CharacterVirtual.cpp +++ b/JoltPhysicsC/Jolt/Physics/Character/CharacterVirtual.cpp @@ -1168,43 +1168,13 @@ bool CharacterVirtual::WalkStairs(float inDeltaTime, Vec3Arg inStepUp, Vec3Arg i DebugRenderer::sInstance->DrawArrow(mPosition, up_position, Color::sWhite, 0.01f); #endif // JPH_DEBUG_RENDERER - // Collect normals of steep slopes that we would like to walk stairs on. - // We need to do this before calling MoveShape because it will update mActiveContacts. - Vec3 character_velocity = inStepForward / inDeltaTime; - Vec3 horizontal_velocity = character_velocity - character_velocity.Dot(mUp) * mUp; - std::vector> steep_slope_normals(inAllocator); - steep_slope_normals.reserve(mActiveContacts.size()); - for (const Contact &c : mActiveContacts) - if (c.mHadCollision - && c.mSurfaceNormal.Dot(horizontal_velocity - c.mLinearVelocity) < 0.0f // Pushing into the contact - && IsSlopeTooSteep(c.mSurfaceNormal)) // Slope too steep - steep_slope_normals.push_back(c.mSurfaceNormal); - if (steep_slope_normals.empty()) - return false; // No steep slopes, cancel - // Horizontal movement RVec3 new_position = up_position; - MoveShape(new_position, character_velocity, inDeltaTime, nullptr, inBroadPhaseLayerFilter, inObjectLayerFilter, inBodyFilter, inShapeFilter, inAllocator); - Vec3 horizontal_movement = Vec3(new_position - up_position); - float horizontal_movement_sq = horizontal_movement.LengthSq(); + MoveShape(new_position, inStepForward / inDeltaTime, inDeltaTime, nullptr, inBroadPhaseLayerFilter, inObjectLayerFilter, inBodyFilter, inShapeFilter, inAllocator); + float horizontal_movement_sq = Vec3(new_position - up_position).LengthSq(); if (horizontal_movement_sq < 1.0e-8f) return false; // No movement, cancel - // Check if we made any progress towards any of the steep slopes, if not we just slid along the slope - // so we need to cancel the stair walk or else we will move faster than we should as we've done - // normal movement first and then stair walk. - bool made_progress = false; - float max_dot = -0.05f * inStepForward.Length(); - for (const Vec3 &normal : steep_slope_normals) - if (normal.Dot(horizontal_movement) < max_dot) - { - // We moved more than 5% of the forward step against a steep slope, accept this as progress - made_progress = true; - break; - } - if (!made_progress) - return false; - #ifdef JPH_DEBUG_RENDERER // Draw horizontal sweep if (sDrawWalkStairs) diff --git a/JoltPhysicsC/Jolt/Physics/Character/CharacterVirtual.h b/JoltPhysicsC/Jolt/Physics/Character/CharacterVirtual.h index f65e1a60..7ec3a12d 100644 --- a/JoltPhysicsC/Jolt/Physics/Character/CharacterVirtual.h +++ b/JoltPhysicsC/Jolt/Physics/Character/CharacterVirtual.h @@ -16,7 +16,7 @@ JPH_NAMESPACE_BEGIN class CharacterVirtual; /// Contains the configuration of a character -class JPH_EXPORT CharacterVirtualSettings : public CharacterBaseSettings +class CharacterVirtualSettings : public CharacterBaseSettings { public: JPH_OVERRIDE_NEW_DELETE @@ -52,7 +52,7 @@ class CharacterContactSettings }; /// This class receives callbacks when a virtual character hits something. -class JPH_EXPORT CharacterContactListener +class CharacterContactListener { public: /// Destructor @@ -92,7 +92,7 @@ class JPH_EXPORT CharacterContactListener /// The advantage of this is that you can determine when the character moves in the frame (usually this has to happen at a very particular point in the frame) /// but the downside is that other objects don't see this virtual character. In order to make this work it is recommended to pair a CharacterVirtual with a Character that /// moves along. This Character should be keyframed (or at least have no gravity) and move along with the CharacterVirtual so that other rigid bodies can collide with it. -class JPH_EXPORT CharacterVirtual : public CharacterBase +class CharacterVirtual : public CharacterBase { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhase.h b/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhase.h index 4f580468..7c244eee 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhase.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhase.h @@ -22,7 +22,7 @@ struct BodyPair; using BodyPairCollector = CollisionCollector; /// Used to do coarse collision detection operations to quickly prune out bodies that will not collide. -class JPH_EXPORT BroadPhase : public BroadPhaseQuery +class BroadPhase : public BroadPhaseQuery { public: /// Initialize the broadphase. diff --git a/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.h b/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.h index 4ec13028..e4639a2e 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.h @@ -10,7 +10,7 @@ JPH_NAMESPACE_BEGIN /// Test BroadPhase implementation that does not do anything to speed up the operations. Can be used as a reference implementation. -class JPH_EXPORT BroadPhaseBruteForce final : public BroadPhase +class BroadPhaseBruteForce final : public BroadPhase { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h b/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h index f200e8d9..cc7b441c 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h @@ -11,7 +11,7 @@ JPH_NAMESPACE_BEGIN /// Fast SIMD based quad tree BroadPhase that is multithreading aware and tries to do a minimal amount of locking. -class JPH_EXPORT BroadPhaseQuadTree final : public BroadPhase +class BroadPhaseQuadTree final : public BroadPhase { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h b/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h index 10085e66..e6481f2c 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h @@ -25,7 +25,7 @@ using CollideShapeBodyCollector = CollisionCollector +class GroupFilter : public SerializableObject, public RefTarget { public: - JPH_DECLARE_SERIALIZABLE_ABSTRACT(JPH_EXPORT, GroupFilter) + JPH_DECLARE_SERIALIZABLE_ABSTRACT(GroupFilter) /// Virtual destructor virtual ~GroupFilter() override = default; diff --git a/JoltPhysicsC/Jolt/Physics/Collision/GroupFilterTable.h b/JoltPhysicsC/Jolt/Physics/Collision/GroupFilterTable.h index fc3a2efe..854511c9 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/GroupFilterTable.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/GroupFilterTable.h @@ -32,9 +32,9 @@ JPH_NAMESPACE_BEGIN /// . is a bit we don't need to store because the table is symmetric, we take care that group 2 > group 1 always by swapping the elements if needed /// /// The total number of bits we need to store is (N * (N - 1)) / 2 -class JPH_EXPORT GroupFilterTable final : public GroupFilter +class GroupFilterTable final : public GroupFilter { - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, GroupFilterTable) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(GroupFilterTable) private: using GroupID = CollisionGroup::GroupID; diff --git a/JoltPhysicsC/Jolt/Physics/Collision/ManifoldBetweenTwoFaces.h b/JoltPhysicsC/Jolt/Physics/Collision/ManifoldBetweenTwoFaces.h index 570dccfe..095bf683 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/ManifoldBetweenTwoFaces.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/ManifoldBetweenTwoFaces.h @@ -17,7 +17,7 @@ JPH_NAMESPACE_BEGIN #ifdef JPH_DEBUG_RENDERER /// @param inCenterOfMass Center of mass position of body 1 #endif -JPH_EXPORT void PruneContactPoints(Vec3Arg inPenetrationAxis, ContactPoints &ioContactPointsOn1, ContactPoints &ioContactPointsOn2 +void PruneContactPoints(Vec3Arg inPenetrationAxis, ContactPoints &ioContactPointsOn1, ContactPoints &ioContactPointsOn2 #ifdef JPH_DEBUG_RENDERER , RVec3Arg inCenterOfMass #endif @@ -35,7 +35,7 @@ JPH_EXPORT void PruneContactPoints(Vec3Arg inPenetrationAxis, ContactPoints &ioC #ifdef JPH_DEBUG_RENDERER /// @param inCenterOfMass Center of mass position of body 1 #endif -JPH_EXPORT void ManifoldBetweenTwoFaces(Vec3Arg inContactPoint1, Vec3Arg inContactPoint2, Vec3Arg inPenetrationAxis, float inSpeculativeContactDistanceSq, const ConvexShape::SupportingFace &inShape1Face, const ConvexShape::SupportingFace &inShape2Face, ContactPoints &outContactPoints1, ContactPoints &outContactPoints2 +void ManifoldBetweenTwoFaces(Vec3Arg inContactPoint1, Vec3Arg inContactPoint2, Vec3Arg inPenetrationAxis, float inSpeculativeContactDistanceSq, const ConvexShape::SupportingFace &inShape1Face, const ConvexShape::SupportingFace &inShape2Face, ContactPoints &outContactPoints1, ContactPoints &outContactPoints2 #ifdef JPH_DEBUG_RENDERER , RVec3Arg inCenterOfMass #endif diff --git a/JoltPhysicsC/Jolt/Physics/Collision/NarrowPhaseQuery.h b/JoltPhysicsC/Jolt/Physics/Collision/NarrowPhaseQuery.h index 4530baf5..0fd53808 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/NarrowPhaseQuery.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/NarrowPhaseQuery.h @@ -19,7 +19,7 @@ class RayCastResult; /// Class that provides an interface for doing precise collision detection against the broad and then the narrow phase. /// Unlike a BroadPhaseQuery, the NarrowPhaseQuery will test against shapes and will return collision information against triangles, spheres etc. -class JPH_EXPORT NarrowPhaseQuery : public NonCopyable +class NarrowPhaseQuery : public NonCopyable { public: /// Initialize the interface (should only be called by PhysicsSystem) diff --git a/JoltPhysicsC/Jolt/Physics/Collision/PhysicsMaterial.h b/JoltPhysicsC/Jolt/Physics/Collision/PhysicsMaterial.h index d24e344d..9cd2733f 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/PhysicsMaterial.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/PhysicsMaterial.h @@ -19,10 +19,10 @@ class StreamOut; /// to decide which sound or particle effects to play. /// /// If you inherit from this material, don't forget to create a suitable default material in sDefault -class JPH_EXPORT PhysicsMaterial : public SerializableObject, public RefTarget +class PhysicsMaterial : public SerializableObject, public RefTarget { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, PhysicsMaterial) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(PhysicsMaterial) /// Virtual destructor virtual ~PhysicsMaterial() override = default; diff --git a/JoltPhysicsC/Jolt/Physics/Collision/PhysicsMaterialSimple.h b/JoltPhysicsC/Jolt/Physics/Collision/PhysicsMaterialSimple.h index 21c1e634..a4b7bf6f 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/PhysicsMaterialSimple.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/PhysicsMaterialSimple.h @@ -9,10 +9,10 @@ JPH_NAMESPACE_BEGIN /// Sample implementation of PhysicsMaterial that just holds the needed properties directly -class JPH_EXPORT PhysicsMaterialSimple : public PhysicsMaterial +class PhysicsMaterialSimple : public PhysicsMaterial { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, PhysicsMaterialSimple) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(PhysicsMaterialSimple) /// Constructor PhysicsMaterialSimple() = default; diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/BoxShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/BoxShape.h index 621f41e1..ee8751f2 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/BoxShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/BoxShape.h @@ -10,10 +10,10 @@ JPH_NAMESPACE_BEGIN /// Class that constructs a BoxShape -class JPH_EXPORT BoxShapeSettings final : public ConvexShapeSettings +class BoxShapeSettings final : public ConvexShapeSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, BoxShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(BoxShapeSettings) /// Default constructor for deserialization BoxShapeSettings() = default; @@ -30,7 +30,7 @@ class JPH_EXPORT BoxShapeSettings final : public ConvexShapeSettings }; /// A box, centered around the origin -class JPH_EXPORT BoxShape final : public ConvexShape +class BoxShape final : public ConvexShape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/CapsuleShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/CapsuleShape.h index 0118bb3a..81d76bce 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/CapsuleShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/CapsuleShape.h @@ -9,9 +9,9 @@ JPH_NAMESPACE_BEGIN /// Class that constructs a CapsuleShape -class JPH_EXPORT CapsuleShapeSettings final : public ConvexShapeSettings +class CapsuleShapeSettings final : public ConvexShapeSettings { - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, CapsuleShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(CapsuleShapeSettings) /// Default constructor for deserialization CapsuleShapeSettings() = default; @@ -33,7 +33,7 @@ class JPH_EXPORT CapsuleShapeSettings final : public ConvexShapeSettings }; /// A capsule, implemented as a line segment with convex radius -class JPH_EXPORT CapsuleShape final : public ConvexShape +class CapsuleShape final : public ConvexShape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/CompoundShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/CompoundShape.h index 4b47b4ae..79f458dd 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/CompoundShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/CompoundShape.h @@ -14,10 +14,10 @@ class CollideShapeSettings; class OrientedBox; /// Base class settings to construct a compound shape -class JPH_EXPORT CompoundShapeSettings : public ShapeSettings +class CompoundShapeSettings : public ShapeSettings { public: - JPH_DECLARE_SERIALIZABLE_ABSTRACT(JPH_EXPORT, CompoundShapeSettings) + JPH_DECLARE_SERIALIZABLE_ABSTRACT(CompoundShapeSettings) /// Constructor. Use AddShape to add the parts. CompoundShapeSettings() = default; @@ -30,7 +30,7 @@ class JPH_EXPORT CompoundShapeSettings : public ShapeSettings struct SubShapeSettings { - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, SubShapeSettings) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(SubShapeSettings) RefConst mShape; ///< Sub shape (either this or mShapePtr needs to be filled up) RefConst mShapePtr; ///< Sub shape (either this or mShape needs to be filled up) @@ -45,7 +45,7 @@ class JPH_EXPORT CompoundShapeSettings : public ShapeSettings }; /// Base class for a compound shape -class JPH_EXPORT CompoundShape : public Shape +class CompoundShape : public Shape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/ConvexHullShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/ConvexHullShape.h index 8bebcf03..a249dd18 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/ConvexHullShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/ConvexHullShape.h @@ -14,10 +14,10 @@ JPH_NAMESPACE_BEGIN /// Class that constructs a ConvexHullShape -class JPH_EXPORT ConvexHullShapeSettings final : public ConvexShapeSettings +class ConvexHullShapeSettings final : public ConvexShapeSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, ConvexHullShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(ConvexHullShapeSettings) /// Default constructor for deserialization ConvexHullShapeSettings() = default; @@ -37,7 +37,7 @@ class JPH_EXPORT ConvexHullShapeSettings final : public ConvexShapeSettings }; /// A convex hull -class JPH_EXPORT ConvexHullShape final : public ConvexShape +class ConvexHullShape final : public ConvexShape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/ConvexShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/ConvexShape.h index 57585100..3facc40d 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/ConvexShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/ConvexShape.h @@ -14,10 +14,10 @@ JPH_NAMESPACE_BEGIN class CollideShapeSettings; /// Class that constructs a ConvexShape (abstract) -class JPH_EXPORT ConvexShapeSettings : public ShapeSettings +class ConvexShapeSettings : public ShapeSettings { public: - JPH_DECLARE_SERIALIZABLE_ABSTRACT(JPH_EXPORT, ConvexShapeSettings) + JPH_DECLARE_SERIALIZABLE_ABSTRACT(ConvexShapeSettings) /// Constructor ConvexShapeSettings() = default; @@ -32,7 +32,7 @@ class JPH_EXPORT ConvexShapeSettings : public ShapeSettings }; /// Base class for all convex shapes. Defines a virtual interface. -class JPH_EXPORT ConvexShape : public Shape +class ConvexShape : public Shape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/CylinderShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/CylinderShape.h index 21783562..f91d0dfc 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/CylinderShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/CylinderShape.h @@ -10,10 +10,10 @@ JPH_NAMESPACE_BEGIN /// Class that constructs a CylinderShape -class JPH_EXPORT CylinderShapeSettings final : public ConvexShapeSettings +class CylinderShapeSettings final : public ConvexShapeSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, CylinderShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(CylinderShapeSettings) /// Default constructor for deserialization CylinderShapeSettings() = default; @@ -31,7 +31,7 @@ class JPH_EXPORT CylinderShapeSettings final : public ConvexShapeSettings }; /// A cylinder -class JPH_EXPORT CylinderShape final : public ConvexShape +class CylinderShape final : public ConvexShape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/DecoratedShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/DecoratedShape.h index 5c97dceb..cdd6a504 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/DecoratedShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/DecoratedShape.h @@ -9,9 +9,9 @@ JPH_NAMESPACE_BEGIN /// Class that constructs a DecoratedShape -class JPH_EXPORT DecoratedShapeSettings : public ShapeSettings +class DecoratedShapeSettings : public ShapeSettings { - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, DecoratedShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(DecoratedShapeSettings) /// Default constructor for deserialization DecoratedShapeSettings() = default; @@ -25,7 +25,7 @@ class JPH_EXPORT DecoratedShapeSettings : public ShapeSettings }; /// Base class for shapes that decorate another shape with extra functionality (e.g. scale, translation etc.) -class JPH_EXPORT DecoratedShape : public Shape +class DecoratedShape : public Shape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/HeightFieldShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/HeightFieldShape.h index c61134e8..aeb51f67 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/HeightFieldShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/HeightFieldShape.h @@ -35,10 +35,10 @@ namespace HeightFieldShapeConstants }; /// Class that constructs a HeightFieldShape -class JPH_EXPORT HeightFieldShapeSettings final : public ShapeSettings +class HeightFieldShapeSettings final : public ShapeSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, HeightFieldShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(HeightFieldShapeSettings) /// Default constructor for deserialization HeightFieldShapeSettings() = default; @@ -89,7 +89,7 @@ class JPH_EXPORT HeightFieldShapeSettings final : public ShapeSettings }; /// A height field shape. Cannot be used as a dynamic object. -class JPH_EXPORT HeightFieldShape final : public Shape +class HeightFieldShape final : public Shape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/MeshShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/MeshShape.h index 9ace715e..130c3424 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/MeshShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/MeshShape.h @@ -19,10 +19,10 @@ class ConvexShape; class CollideShapeSettings; /// Class that constructs a MeshShape -class JPH_EXPORT MeshShapeSettings final : public ShapeSettings +class MeshShapeSettings final : public ShapeSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, MeshShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(MeshShapeSettings) /// Default constructor for deserialization MeshShapeSettings() = default; @@ -49,10 +49,8 @@ class JPH_EXPORT MeshShapeSettings final : public ShapeSettings uint mMaxTrianglesPerLeaf = 8; }; -/// A mesh shape, consisting of triangles. Mesh shapes are mostly used for static geometry. -/// They can be used by dynamic or kinematic objects but only if they don't collide with other mesh or heightfield shapes as those collisions are currently not supported. -/// Note that if you make a mesh shape a dynamic or kinematic object, you need to provide a mass yourself as mesh shapes don't need to form a closed hull so don't have a well defined volume from which the mass can be calculated. -class JPH_EXPORT MeshShape final : public Shape +/// A mesh shape, consisting of triangles. Cannot be used as a dynamic object. +class MeshShape final : public Shape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/MutableCompoundShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/MutableCompoundShape.h index de2763fe..e7908b4b 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/MutableCompoundShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/MutableCompoundShape.h @@ -11,10 +11,10 @@ JPH_NAMESPACE_BEGIN class CollideShapeSettings; /// Class that constructs a MutableCompoundShape. -class JPH_EXPORT MutableCompoundShapeSettings final : public CompoundShapeSettings +class MutableCompoundShapeSettings final : public CompoundShapeSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, MutableCompoundShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(MutableCompoundShapeSettings) // See: ShapeSettings virtual ShapeResult Create() const override; @@ -27,7 +27,7 @@ class JPH_EXPORT MutableCompoundShapeSettings final : public CompoundShapeSettin /// Note: If you're using MutableCompoundShapes and are querying data while modifying the shape you'll have a race condition. /// In this case it is best to create a new MutableCompoundShape and set the new shape on the body using BodyInterface::SetShape. If a /// query is still working on the old shape, it will have taken a reference and keep the old shape alive until the query finishes. -class JPH_EXPORT MutableCompoundShape final : public CompoundShape +class MutableCompoundShape final : public CompoundShape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.h index d037cb28..a542a9e2 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.h @@ -11,10 +11,10 @@ JPH_NAMESPACE_BEGIN class CollideShapeSettings; /// Class that constructs an OffsetCenterOfMassShape -class JPH_EXPORT OffsetCenterOfMassShapeSettings final : public DecoratedShapeSettings +class OffsetCenterOfMassShapeSettings final : public DecoratedShapeSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, OffsetCenterOfMassShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(OffsetCenterOfMassShapeSettings) /// Constructor OffsetCenterOfMassShapeSettings() = default; @@ -32,7 +32,7 @@ class JPH_EXPORT OffsetCenterOfMassShapeSettings final : public DecoratedShapeSe }; /// This shape will shift the center of mass of a child shape, it can e.g. be used to lower the center of mass of an unstable object like a boat to make it stable -class JPH_EXPORT OffsetCenterOfMassShape final : public DecoratedShape +class OffsetCenterOfMassShape final : public DecoratedShape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/RotatedTranslatedShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/RotatedTranslatedShape.h index 34fa69c1..5278cc2f 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/RotatedTranslatedShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/RotatedTranslatedShape.h @@ -12,10 +12,10 @@ JPH_NAMESPACE_BEGIN class CollideShapeSettings; /// Class that constructs a RotatedTranslatedShape -class JPH_EXPORT RotatedTranslatedShapeSettings final : public DecoratedShapeSettings +class RotatedTranslatedShapeSettings final : public DecoratedShapeSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, RotatedTranslatedShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(RotatedTranslatedShapeSettings) /// Constructor RotatedTranslatedShapeSettings() = default; @@ -35,7 +35,7 @@ class JPH_EXPORT RotatedTranslatedShapeSettings final : public DecoratedShapeSet /// A rotated translated shape will rotate and translate a child shape. /// Shifts the child object so that it is centered around the center of mass. -class JPH_EXPORT RotatedTranslatedShape final : public DecoratedShape +class RotatedTranslatedShape final : public DecoratedShape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/ScaledShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/ScaledShape.h index 1b35e8a3..a4fba468 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/ScaledShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/ScaledShape.h @@ -12,9 +12,9 @@ class SubShapeIDCreator; class CollideShapeSettings; /// Class that constructs a ScaledShape -class JPH_EXPORT ScaledShapeSettings final : public DecoratedShapeSettings +class ScaledShapeSettings final : public DecoratedShapeSettings { - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, ScaledShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(ScaledShapeSettings) /// Default constructor for deserialization ScaledShapeSettings() = default; @@ -32,7 +32,7 @@ class JPH_EXPORT ScaledShapeSettings final : public DecoratedShapeSettings }; /// A shape that scales a child shape in local space of that shape. The scale can be non-uniform and can even turn it inside out when one or three components of the scale are negative. -class JPH_EXPORT ScaledShape final : public DecoratedShape +class ScaledShape final : public DecoratedShape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/Shape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/Shape.h index cf9e066a..9b846c8c 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/Shape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/Shape.h @@ -131,10 +131,10 @@ static_assert(size(sSubShapeTypeNames) == NumSubShapeTypes); /// in a form that is optimized for collision detection. After this, the ShapeSettings object is no longer needed /// and can be destroyed. Each shape class has a derived class of the ShapeSettings object to store shape specific /// data. -class JPH_EXPORT ShapeSettings : public SerializableObject, public RefTarget +class ShapeSettings : public SerializableObject, public RefTarget { public: - JPH_DECLARE_SERIALIZABLE_ABSTRACT(JPH_EXPORT, ShapeSettings) + JPH_DECLARE_SERIALIZABLE_ABSTRACT(ShapeSettings) using ShapeResult = Result>; @@ -149,7 +149,7 @@ class JPH_EXPORT ShapeSettings : public SerializableObject, public RefTarget, public NonCopyable +class Shape : public RefTarget, public NonCopyable { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/SphereShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/SphereShape.h index 8ae770c6..ff19e2d3 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/SphereShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/SphereShape.h @@ -9,10 +9,10 @@ JPH_NAMESPACE_BEGIN /// Class that constructs a SphereShape -class JPH_EXPORT SphereShapeSettings final : public ConvexShapeSettings +class SphereShapeSettings final : public ConvexShapeSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, SphereShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(SphereShapeSettings) /// Default constructor for deserialization SphereShapeSettings() = default; @@ -28,7 +28,7 @@ class JPH_EXPORT SphereShapeSettings final : public ConvexShapeSettings /// A sphere, centered around the origin. /// Note that it is implemented as a point with convex radius. -class JPH_EXPORT SphereShape final : public ConvexShape +class SphereShape final : public ConvexShape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/StaticCompoundShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/StaticCompoundShape.h index 30e105e3..a01de498 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/StaticCompoundShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/StaticCompoundShape.h @@ -14,10 +14,10 @@ class CollideShapeSettings; class TempAllocator; /// Class that constructs a StaticCompoundShape. Note that if you only want a compound of 1 shape, use a RotatedTranslatedShape instead. -class JPH_EXPORT StaticCompoundShapeSettings final : public CompoundShapeSettings +class StaticCompoundShapeSettings final : public CompoundShapeSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, StaticCompoundShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(StaticCompoundShapeSettings) // See: ShapeSettings virtual ShapeResult Create() const override; @@ -29,7 +29,7 @@ class JPH_EXPORT StaticCompoundShapeSettings final : public CompoundShapeSetting /// A compound shape, sub shapes can be rotated and translated. /// Sub shapes cannot be modified once the shape is constructed. /// Shifts all child objects so that they're centered around the center of mass. -class JPH_EXPORT StaticCompoundShape final : public CompoundShape +class StaticCompoundShape final : public CompoundShape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.gliffy b/JoltPhysicsC/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.gliffy deleted file mode 100644 index 3e5221b8..00000000 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.gliffy +++ /dev/null @@ -1 +0,0 @@ -{"contentType":"application/gliffy+json","version":"1.1","metadata":{"title":"untitled","revision":0,"exportBorder":false},"embeddedResources":{"index":0,"resources":[]},"stage":{"objects":[{"x":870,"y":406,"rotation":0,"id":62,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":62,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":"1.0,1.0","startArrow":0,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[1.5,5.5],[1.5,-46.196228102251325]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":4,"px":0.5,"py":0.5}}},"linkMap":[]},{"x":410,"y":406,"rotation":0,"id":60,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":60,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":"1.0,1.0","startArrow":0,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[0,5.5],[0,-49.03668490108288]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":0,"px":0.5,"py":0.5}}},"linkMap":[]},{"x":614,"y":385,"rotation":0,"id":58,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":58,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[0,0],[-204.06126531020038,0]],"lockSegments":{}}},"children":null,"linkMap":[]},{"x":626,"y":385,"rotation":0,"id":57,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":57,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[0,0],[248.0020161208372,0]],"lockSegments":{}}},"children":null,"linkMap":[]},{"x":818,"y":520,"rotation":0,"id":55,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":55,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[0,0],[-48,76]],"lockSegments":{}}},"children":null,"linkMap":[]},{"x":830,"y":502,"rotation":0,"id":54,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":54,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[0,0],[48,-82]],"lockSegments":{}}},"children":null,"linkMap":[]},{"x":373,"y":410,"rotation":0,"id":50,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":28,"height":23,"lockAspectRatio":false,"lockShape":false,"order":19,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

tx

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":387,"y":392,"rotation":0,"id":49,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":26,"height":23,"lockAspectRatio":false,"lockShape":false,"order":18,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

ty

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":722,"y":488,"rotation":0,"id":45,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":20,"height":20,"lockAspectRatio":false,"lockShape":false,"order":16,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

bx

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":440,"y":411.5,"rotation":0,"id":40,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":29,"height":28.500000000000004,"lockAspectRatio":false,"lockShape":false,"order":13,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

α

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":411,"y":414,"rotation":0,"id":34,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":12,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":"1.0,1.0","startArrow":0,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[-1,-2.5],[349,180]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":0,"px":0.5,"py":0.5}}},"linkMap":[]},{"x":744,"y":613,"rotation":0,"id":32,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":11,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":"1.0,1.0","startArrow":0,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[0,0],[-1.1368683772161603e-13,-201.00995000248122]],"lockSegments":{}}},"children":null,"linkMap":[]},{"x":394,"y":436,"rotation":0,"id":30,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":10,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":"1.0,1.0","startArrow":0,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[0,0],[0,-26.076809620810593]],"lockSegments":{}}},"children":null,"linkMap":[]},{"x":607,"y":368.5,"rotation":0,"id":26,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":20,"height":30,"lockAspectRatio":false,"lockShape":false,"order":9,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

h

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":401,"y":412.5,"rotation":0,"id":25,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":20,"height":30,"lockAspectRatio":false,"lockShape":false,"order":8,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

tr

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":808.5,"y":500,"rotation":0,"id":23,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":49,"height":27,"lockAspectRatio":false,"lockShape":false,"order":7,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

br - tr

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":402,"y":416,"rotation":0,"id":21,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":6,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[8,-4.5],[-7,21]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":0,"px":0.5,"py":0.5}}},"linkMap":[]},{"x":347,"y":412,"rotation":0,"id":16,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":5,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[0,0],[523.5,2.5]],"lockSegments":{}}},"children":null,"linkMap":[]},{"x":854,"y":433,"rotation":0,"id":14,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":4,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[17.5,-21.5],[-106,184]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":4,"px":0.5,"py":0.5}}},"linkMap":[]},{"x":395,"y":437,"rotation":0,"id":9,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":3,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[-52,-25],[695,360]],"lockSegments":{}}},"children":null,"linkMap":[]},{"x":395,"y":384,"rotation":0,"id":7,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":2,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[-49,26],[703,-359]],"lockSegments":{}}},"children":null,"linkMap":[]},{"x":630,"y":169.99999999999997,"rotation":0,"id":4,"uid":"com.gliffy.shape.basic.basic_v1.default.circle","width":483.00000000000006,"height":483.00000000000006,"lockAspectRatio":true,"lockShape":false,"order":1,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.ellipse.basic_v1","strokeWidth":2,"strokeColor":"#333333","fillColor":"#FFFFFF","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[],"linkMap":[]},{"x":380,"y":381.5,"rotation":0,"id":0,"uid":"com.gliffy.shape.basic.basic_v1.default.circle","width":60,"height":60,"lockAspectRatio":true,"lockShape":false,"order":0,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.ellipse.basic_v1","strokeWidth":2,"strokeColor":"#333333","fillColor":"#FFFFFF","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[],"linkMap":[]},{"x":728,"y":612,"rotation":0,"id":41,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":29,"height":28.500000000000004,"lockAspectRatio":false,"lockShape":false,"order":14,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

α

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":375,"y":432.5,"rotation":0,"id":42,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":29,"height":28.500000000000004,"lockAspectRatio":false,"lockShape":false,"order":15,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

α

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":753,"y":595.5,"rotation":0,"id":53,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":20,"height":30,"lockAspectRatio":false,"lockShape":false,"order":20,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

tr

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":794,"y":400,"rotation":0,"id":65,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":65,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[0,0],[-48.01041553663117,0]],"lockSegments":{}}},"children":null,"linkMap":[]},{"x":790,"y":393.25,"rotation":0,"id":46,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":29,"height":14,"lockAspectRatio":false,"lockShape":false,"order":17,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"

by

","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":818,"y":400,"rotation":0,"id":66,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":66,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":2,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":false,"interpolationType":"linear","cornerRadius":null,"controlPath":[[0,0],[54.230987451824944,0]],"lockSegments":{}}},"children":null,"linkMap":[]}],"background":"#FFFFFF","width":1113,"height":802,"maxWidth":5000,"maxHeight":5000,"nodeIndex":69,"autoFit":true,"exportBorder":false,"gridOn":true,"snapToGrid":false,"drawingGuidesOn":false,"pageBreaksOn":false,"printGridOn":false,"printPaper":"LETTER","printShrinkToFit":false,"printPortrait":true,"shapeStyles":{"com.gliffy.shape.basic.basic_v1.default":{"fill":"#FFFFFF","stroke":"#333333","strokeWidth":2}},"lineStyles":{"global":{"dashStyle":null,"endArrow":2,"startArrow":0}},"textStyles":{},"themeData":null}} \ No newline at end of file diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.h index 8dec56f6..312c03df 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.h @@ -12,9 +12,9 @@ JPH_NAMESPACE_BEGIN /// Class that constructs a TaperedCapsuleShape -class JPH_EXPORT TaperedCapsuleShapeSettings final : public ConvexShapeSettings +class TaperedCapsuleShapeSettings final : public ConvexShapeSettings { - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, TaperedCapsuleShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(TaperedCapsuleShapeSettings) /// Default constructor for deserialization TaperedCapsuleShapeSettings() = default; @@ -37,7 +37,7 @@ class JPH_EXPORT TaperedCapsuleShapeSettings final : public ConvexShapeSettings }; /// A capsule with different top and bottom radii -class JPH_EXPORT TaperedCapsuleShape final : public ConvexShape +class TaperedCapsuleShape final : public ConvexShape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/Shape/TriangleShape.h b/JoltPhysicsC/Jolt/Physics/Collision/Shape/TriangleShape.h index cd202e72..aee82436 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/Shape/TriangleShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/Shape/TriangleShape.h @@ -9,10 +9,10 @@ JPH_NAMESPACE_BEGIN /// Class that constructs a TriangleShape -class JPH_EXPORT TriangleShapeSettings final : public ConvexShapeSettings +class TriangleShapeSettings final : public ConvexShapeSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, TriangleShapeSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(TriangleShapeSettings) /// Default constructor for deserialization TriangleShapeSettings() = default; @@ -31,7 +31,7 @@ class JPH_EXPORT TriangleShapeSettings final : public ConvexShapeSettings }; /// A single triangle, not the most efficient way of creating a world filled with triangles but can be used as a query shape for example. -class JPH_EXPORT TriangleShape final : public ConvexShape +class TriangleShape final : public ConvexShape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Collision/TransformedShape.h b/JoltPhysicsC/Jolt/Physics/Collision/TransformedShape.h index 2a66bb3d..263c4938 100644 --- a/JoltPhysicsC/Jolt/Physics/Collision/TransformedShape.h +++ b/JoltPhysicsC/Jolt/Physics/Collision/TransformedShape.h @@ -22,7 +22,7 @@ class RayCastResult; /// This structure can be obtained from a body (e.g. after a broad phase query) under lock protection. /// The lock can then be released and collision detection operations can be safely performed since /// the class takes a reference on the shape and does not use anything from the body anymore. -class JPH_EXPORT TransformedShape +class TransformedShape { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/ConeConstraint.h b/JoltPhysicsC/Jolt/Physics/Constraints/ConeConstraint.h index 2a5e9f7b..08ab190e 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/ConeConstraint.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/ConeConstraint.h @@ -11,10 +11,10 @@ JPH_NAMESPACE_BEGIN /// Cone constraint settings, used to create a cone constraint -class JPH_EXPORT ConeConstraintSettings final : public TwoBodyConstraintSettings +class ConeConstraintSettings final : public TwoBodyConstraintSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, ConeConstraintSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(ConeConstraintSettings) // See: ConstraintSettings::SaveBinaryState virtual void SaveBinaryState(StreamOut &inStream) const override; @@ -66,7 +66,7 @@ class JPH_EXPORT ConeConstraintSettings final : public TwoBodyConstraintSettings /// Where J is the Jacobian. /// /// Note that this is the exact same equation as used in AngleConstraintPart if we use t2 x t1 as the world space axis -class JPH_EXPORT ConeConstraint final : public TwoBodyConstraint +class ConeConstraint final : public TwoBodyConstraint { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/Constraint.h b/JoltPhysicsC/Jolt/Physics/Constraints/Constraint.h index 7da28679..1516621e 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/Constraint.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/Constraint.h @@ -61,10 +61,10 @@ enum class EConstraintSpace }; /// Class used to store the configuration of a constraint. Allows run-time creation of constraints. -class JPH_EXPORT ConstraintSettings : public SerializableObject, public RefTarget +class ConstraintSettings : public SerializableObject, public RefTarget { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, ConstraintSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(ConstraintSettings) using ConstraintResult = Result>; @@ -95,7 +95,7 @@ class JPH_EXPORT ConstraintSettings : public SerializableObject, public RefTarge }; /// Base class for all physics constraints. A constraint removes one or more degrees of freedom for a rigid body. -class JPH_EXPORT Constraint : public RefTarget, public NonCopyable +class Constraint : public RefTarget, public NonCopyable { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/ConstraintManager.h b/JoltPhysicsC/Jolt/Physics/Constraints/ConstraintManager.h index f722d11b..ba1ab533 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/ConstraintManager.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/ConstraintManager.h @@ -20,7 +20,7 @@ class DebugRenderer; using Constraints = Array>; /// A constraint manager manages all constraints of the same type -class JPH_EXPORT ConstraintManager : public NonCopyable +class ConstraintManager : public NonCopyable { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/ContactConstraintManager.h b/JoltPhysicsC/Jolt/Physics/Constraints/ContactConstraintManager.h index 4fc213a2..50a52588 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/ContactConstraintManager.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/ContactConstraintManager.h @@ -24,7 +24,7 @@ JPH_NAMESPACE_BEGIN struct PhysicsSettings; class PhysicsUpdateContext; -class JPH_EXPORT ContactConstraintManager : public NonCopyable +class ContactConstraintManager : public NonCopyable { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/DistanceConstraint.h b/JoltPhysicsC/Jolt/Physics/Constraints/DistanceConstraint.h index 37337f19..1c34eac5 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/DistanceConstraint.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/DistanceConstraint.h @@ -10,10 +10,10 @@ JPH_NAMESPACE_BEGIN /// Distance constraint settings, used to create a distance constraint -class JPH_EXPORT DistanceConstraintSettings final : public TwoBodyConstraintSettings +class DistanceConstraintSettings final : public TwoBodyConstraintSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, DistanceConstraintSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(DistanceConstraintSettings) // See: ConstraintSettings::SaveBinaryState virtual void SaveBinaryState(StreamOut &inStream) const override; @@ -49,7 +49,7 @@ class JPH_EXPORT DistanceConstraintSettings final : public TwoBodyConstraintSett }; /// This constraint is a stiff spring that holds 2 points at a fixed distance from each other -class JPH_EXPORT DistanceConstraint final : public TwoBodyConstraint +class DistanceConstraint final : public TwoBodyConstraint { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/FixedConstraint.h b/JoltPhysicsC/Jolt/Physics/Constraints/FixedConstraint.h index 299cc806..b6b8f878 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/FixedConstraint.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/FixedConstraint.h @@ -11,10 +11,10 @@ JPH_NAMESPACE_BEGIN /// Fixed constraint settings, used to create a fixed constraint -class JPH_EXPORT FixedConstraintSettings final : public TwoBodyConstraintSettings +class FixedConstraintSettings final : public TwoBodyConstraintSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, FixedConstraintSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(FixedConstraintSettings) // See: ConstraintSettings::SaveBinaryState virtual void SaveBinaryState(StreamOut &inStream) const override; @@ -45,7 +45,7 @@ class JPH_EXPORT FixedConstraintSettings final : public TwoBodyConstraintSetting /// A fixed constraint welds two bodies together removing all degrees of freedom between them. /// This variant uses euler angles for the rotation constraint. -class JPH_EXPORT FixedConstraint final : public TwoBodyConstraint +class FixedConstraint final : public TwoBodyConstraint { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/GearConstraint.h b/JoltPhysicsC/Jolt/Physics/Constraints/GearConstraint.h index 6f52138d..722986b6 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/GearConstraint.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/GearConstraint.h @@ -10,10 +10,10 @@ JPH_NAMESPACE_BEGIN /// Gear constraint settings -class JPH_EXPORT GearConstraintSettings final : public TwoBodyConstraintSettings +class GearConstraintSettings final : public TwoBodyConstraintSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, GearConstraintSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(GearConstraintSettings) // See: ConstraintSettings::SaveBinaryState virtual void SaveBinaryState(StreamOut &inStream) const override; @@ -49,7 +49,7 @@ class JPH_EXPORT GearConstraintSettings final : public TwoBodyConstraintSettings /// A gear constraint constrains the rotation of body1 to the rotation of body 2 using a gear. /// Note that this constraint needs to be used in conjunction with a two hinge constraints. -class JPH_EXPORT GearConstraint final : public TwoBodyConstraint +class GearConstraint final : public TwoBodyConstraint { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/HingeConstraint.h b/JoltPhysicsC/Jolt/Physics/Constraints/HingeConstraint.h index c7e56c93..6208fe52 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/HingeConstraint.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/HingeConstraint.h @@ -13,10 +13,10 @@ JPH_NAMESPACE_BEGIN /// Hinge constraint settings, used to create a hinge constraint -class JPH_EXPORT HingeConstraintSettings final : public TwoBodyConstraintSettings +class HingeConstraintSettings final : public TwoBodyConstraintSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, HingeConstraintSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(HingeConstraintSettings) // See: ConstraintSettings::SaveBinaryState virtual void SaveBinaryState(StreamOut &inStream) const override; @@ -55,7 +55,7 @@ class JPH_EXPORT HingeConstraintSettings final : public TwoBodyConstraintSetting }; /// A hinge constraint constrains 2 bodies on a single point and allows only a single axis of rotation -class JPH_EXPORT HingeConstraint final : public TwoBodyConstraint +class HingeConstraint final : public TwoBodyConstraint { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/MotorSettings.h b/JoltPhysicsC/Jolt/Physics/Constraints/MotorSettings.h index 2c835058..af4a616b 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/MotorSettings.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/MotorSettings.h @@ -21,10 +21,10 @@ enum class EMotorState /// Class that contains the settings for a constraint motor. /// See the main page of the API documentation for more information on how to configure a motor. -class JPH_EXPORT MotorSettings +class MotorSettings { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, MotorSettings) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(MotorSettings) /// Constructor MotorSettings() = default; diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/PathConstraint.h b/JoltPhysicsC/Jolt/Physics/Constraints/PathConstraint.h index 0125b8d2..35082550 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/PathConstraint.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/PathConstraint.h @@ -26,10 +26,10 @@ enum class EPathRotationConstraintType }; /// Path constraint settings, used to constrain the degrees of freedom between two bodies to a path -class JPH_EXPORT PathConstraintSettings final : public TwoBodyConstraintSettings +class PathConstraintSettings final : public TwoBodyConstraintSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, PathConstraintSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(PathConstraintSettings) // See: ConstraintSettings::SaveBinaryState virtual void SaveBinaryState(StreamOut &inStream) const override; @@ -64,7 +64,7 @@ class JPH_EXPORT PathConstraintSettings final : public TwoBodyConstraintSettings }; /// Path constraint, used to constrain the degrees of freedom between two bodies to a path -class JPH_EXPORT PathConstraint final : public TwoBodyConstraint +class PathConstraint final : public TwoBodyConstraint { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/PathConstraintPath.h b/JoltPhysicsC/Jolt/Physics/Constraints/PathConstraintPath.h index bd0853fc..31db8f36 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/PathConstraintPath.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/PathConstraintPath.h @@ -17,10 +17,10 @@ class DebugRenderer; #endif // JPH_DEBUG_RENDERER /// The path for a path constraint. It allows attaching two bodies to each other while giving the second body the freedom to move along a path relative to the first. -class JPH_EXPORT PathConstraintPath : public SerializableObject, public RefTarget +class PathConstraintPath : public SerializableObject, public RefTarget { public: - JPH_DECLARE_SERIALIZABLE_ABSTRACT(JPH_EXPORT, PathConstraintPath) + JPH_DECLARE_SERIALIZABLE_ABSTRACT(PathConstraintPath) using PathResult = Result>; diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/PathConstraintPathHermite.h b/JoltPhysicsC/Jolt/Physics/Constraints/PathConstraintPathHermite.h index 495fcf21..ac9a011a 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/PathConstraintPathHermite.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/PathConstraintPathHermite.h @@ -9,10 +9,10 @@ JPH_NAMESPACE_BEGIN /// A path that follows a Hermite spline -class JPH_EXPORT PathConstraintPathHermite final : public PathConstraintPath +class PathConstraintPathHermite final : public PathConstraintPath { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, PathConstraintPathHermite) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(PathConstraintPathHermite) // See PathConstraintPath::GetPathMaxFraction virtual float GetPathMaxFraction() const override { return float(IsLooping()? mPoints.size() : mPoints.size() - 1); } @@ -31,7 +31,7 @@ class JPH_EXPORT PathConstraintPathHermite final : public PathConstraintPath struct Point { - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, Point) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(Point) Vec3 mPosition; ///< Position on the path Vec3 mTangent; ///< Tangent of the path, does not need to be normalized (in the direction of the path) diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/PointConstraint.h b/JoltPhysicsC/Jolt/Physics/Constraints/PointConstraint.h index c4449deb..8b70c375 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/PointConstraint.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/PointConstraint.h @@ -10,10 +10,10 @@ JPH_NAMESPACE_BEGIN /// Point constraint settings, used to create a point constraint -class JPH_EXPORT PointConstraintSettings final : public TwoBodyConstraintSettings +class PointConstraintSettings final : public TwoBodyConstraintSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, PointConstraintSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(PointConstraintSettings) // See: ConstraintSettings::SaveBinaryState virtual void SaveBinaryState(StreamOut &inStream) const override; @@ -37,7 +37,7 @@ class JPH_EXPORT PointConstraintSettings final : public TwoBodyConstraintSetting }; /// A point constraint constrains 2 bodies on a single point (removing 3 degrees of freedom) -class JPH_EXPORT PointConstraint final : public TwoBodyConstraint +class PointConstraint final : public TwoBodyConstraint { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/PulleyConstraint.h b/JoltPhysicsC/Jolt/Physics/Constraints/PulleyConstraint.h index 45d41118..3f2f1c0c 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/PulleyConstraint.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/PulleyConstraint.h @@ -15,10 +15,10 @@ JPH_NAMESPACE_BEGIN /// Length2 = |BodyPoint2 - FixedPoint2| /// The constraint keeps the two line segments constrained so that /// MinDistance <= Length1 + Ratio * Length2 <= MaxDistance -class JPH_EXPORT PulleyConstraintSettings final : public TwoBodyConstraintSettings +class PulleyConstraintSettings final : public TwoBodyConstraintSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, PulleyConstraintSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(PulleyConstraintSettings) // See: ConstraintSettings::SaveBinaryState virtual void SaveBinaryState(StreamOut &inStream) const override; @@ -56,7 +56,7 @@ class JPH_EXPORT PulleyConstraintSettings final : public TwoBodyConstraintSettin }; /// A pulley constraint. -class JPH_EXPORT PulleyConstraint final : public TwoBodyConstraint +class PulleyConstraint final : public TwoBodyConstraint { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/RackAndPinionConstraint.h b/JoltPhysicsC/Jolt/Physics/Constraints/RackAndPinionConstraint.h index cd1bebbd..ab731e83 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/RackAndPinionConstraint.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/RackAndPinionConstraint.h @@ -10,10 +10,10 @@ JPH_NAMESPACE_BEGIN /// Rack and pinion constraint (slider & gear) settings -class JPH_EXPORT RackAndPinionConstraintSettings final : public TwoBodyConstraintSettings +class RackAndPinionConstraintSettings final : public TwoBodyConstraintSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, RackAndPinionConstraintSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(RackAndPinionConstraintSettings) // See: ConstraintSettings::SaveBinaryState virtual void SaveBinaryState(StreamOut &inStream) const override; @@ -51,7 +51,7 @@ class JPH_EXPORT RackAndPinionConstraintSettings final : public TwoBodyConstrain /// A rack and pinion constraint constrains the rotation of body1 to the translation of body 2. /// Note that this constraint needs to be used in conjunction with a hinge constraint for body 1 and a slider constraint for body 2. -class JPH_EXPORT RackAndPinionConstraint final : public TwoBodyConstraint +class RackAndPinionConstraint final : public TwoBodyConstraint { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/SixDOFConstraint.h b/JoltPhysicsC/Jolt/Physics/Constraints/SixDOFConstraint.h index 6ff5ac1e..81bce6e5 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/SixDOFConstraint.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/SixDOFConstraint.h @@ -15,10 +15,10 @@ JPH_NAMESPACE_BEGIN /// 6 Degree Of Freedom Constraint setup structure. Allows control over each of the 6 degrees of freedom. -class JPH_EXPORT SixDOFConstraintSettings final : public TwoBodyConstraintSettings +class SixDOFConstraintSettings final : public TwoBodyConstraintSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, SixDOFConstraintSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(SixDOFConstraintSettings) /// Constraint is split up into translation/rotation around X, Y and Z axis. enum EAxis @@ -88,7 +88,7 @@ class JPH_EXPORT SixDOFConstraintSettings final : public TwoBodyConstraintSettin }; /// 6 Degree Of Freedom Constraint. Allows control over each of the 6 degrees of freedom. -class JPH_EXPORT SixDOFConstraint final : public TwoBodyConstraint +class SixDOFConstraint final : public TwoBodyConstraint { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/SliderConstraint.h b/JoltPhysicsC/Jolt/Physics/Constraints/SliderConstraint.h index d6f41e36..ac8554e7 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/SliderConstraint.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/SliderConstraint.h @@ -13,10 +13,10 @@ JPH_NAMESPACE_BEGIN /// Slider constraint settings, used to create a slider constraint -class JPH_EXPORT SliderConstraintSettings final : public TwoBodyConstraintSettings +class SliderConstraintSettings final : public TwoBodyConstraintSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, SliderConstraintSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(SliderConstraintSettings) // See: ConstraintSettings::SaveBinaryState virtual void SaveBinaryState(StreamOut &inStream) const override; @@ -66,7 +66,7 @@ class JPH_EXPORT SliderConstraintSettings final : public TwoBodyConstraintSettin }; /// A slider constraint allows movement in only 1 axis (and no rotation). Also known as a prismatic constraint. -class JPH_EXPORT SliderConstraint final : public TwoBodyConstraint +class SliderConstraint final : public TwoBodyConstraint { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/SwingTwistConstraint.h b/JoltPhysicsC/Jolt/Physics/Constraints/SwingTwistConstraint.h index c3a9bbf5..3787e9b6 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/SwingTwistConstraint.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/SwingTwistConstraint.h @@ -17,10 +17,10 @@ JPH_NAMESPACE_BEGIN /// /// This image describes the limit settings: /// @image html Docs/SwingTwistConstraint.png -class JPH_EXPORT SwingTwistConstraintSettings final : public TwoBodyConstraintSettings +class SwingTwistConstraintSettings final : public TwoBodyConstraintSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, SwingTwistConstraintSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(SwingTwistConstraintSettings) // See: ConstraintSettings::SaveBinaryState virtual void SaveBinaryState(StreamOut &inStream) const override; @@ -64,7 +64,7 @@ class JPH_EXPORT SwingTwistConstraintSettings final : public TwoBodyConstraintSe /// A swing twist constraint is a specialized constraint for humanoid ragdolls that allows limited rotation only /// /// @see SwingTwistConstraintSettings for a description of the limits -class JPH_EXPORT SwingTwistConstraint final : public TwoBodyConstraint +class SwingTwistConstraint final : public TwoBodyConstraint { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Constraints/TwoBodyConstraint.h b/JoltPhysicsC/Jolt/Physics/Constraints/TwoBodyConstraint.h index 9cdbfc0e..e92c62a9 100644 --- a/JoltPhysicsC/Jolt/Physics/Constraints/TwoBodyConstraint.h +++ b/JoltPhysicsC/Jolt/Physics/Constraints/TwoBodyConstraint.h @@ -12,10 +12,10 @@ JPH_NAMESPACE_BEGIN class TwoBodyConstraint; /// Base class for settings for all constraints that involve 2 bodies -class JPH_EXPORT TwoBodyConstraintSettings : public ConstraintSettings +class TwoBodyConstraintSettings : public ConstraintSettings { public: - JPH_DECLARE_SERIALIZABLE_ABSTRACT(JPH_EXPORT, TwoBodyConstraintSettings) + JPH_DECLARE_SERIALIZABLE_ABSTRACT(TwoBodyConstraintSettings) /// Create an an instance of this constraint /// You can use Body::sFixedToWorld for inBody1 if you want to attach inBody2 to the world @@ -23,7 +23,7 @@ class JPH_EXPORT TwoBodyConstraintSettings : public ConstraintSettings }; /// Base class for all constraints that involve 2 bodies. Body1 is usually considered the parent, Body2 the child. -class JPH_EXPORT TwoBodyConstraint : public Constraint +class TwoBodyConstraint : public Constraint { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/PhysicsScene.h b/JoltPhysicsC/Jolt/Physics/PhysicsScene.h index 792da831..f823592b 100644 --- a/JoltPhysicsC/Jolt/Physics/PhysicsScene.h +++ b/JoltPhysicsC/Jolt/Physics/PhysicsScene.h @@ -13,10 +13,10 @@ JPH_NAMESPACE_BEGIN class PhysicsSystem; /// Contains the creation settings of a set of bodies -class JPH_EXPORT PhysicsScene : public RefTarget +class PhysicsScene : public RefTarget { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, PhysicsScene) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(PhysicsScene) /// Add a body to the scene void AddBody(const BodyCreationSettings &inBody); @@ -41,7 +41,7 @@ class JPH_EXPORT PhysicsScene : public RefTarget class ConnectedConstraint { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, ConnectedConstraint) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(ConnectedConstraint) ConnectedConstraint() = default; ConnectedConstraint(const TwoBodyConstraintSettings *inSettings, uint inBody1, uint inBody2) : mSettings(inSettings), mBody1(inBody1), mBody2(inBody2) { } diff --git a/JoltPhysicsC/Jolt/Physics/PhysicsStepListener.h b/JoltPhysicsC/Jolt/Physics/PhysicsStepListener.h index 80cf0519..8839c57b 100644 --- a/JoltPhysicsC/Jolt/Physics/PhysicsStepListener.h +++ b/JoltPhysicsC/Jolt/Physics/PhysicsStepListener.h @@ -9,7 +9,7 @@ JPH_NAMESPACE_BEGIN class PhysicsSystem; /// A listener class that receives a callback before every physics simulation step -class JPH_EXPORT PhysicsStepListener +class PhysicsStepListener { public: /// Ensure virtual destructor diff --git a/JoltPhysicsC/Jolt/Physics/PhysicsSystem.h b/JoltPhysicsC/Jolt/Physics/PhysicsSystem.h index 2f546cac..58acdbd3 100644 --- a/JoltPhysicsC/Jolt/Physics/PhysicsSystem.h +++ b/JoltPhysicsC/Jolt/Physics/PhysicsSystem.h @@ -24,7 +24,7 @@ class PhysicsStepListener; /// The main class for the physics system. It contains all rigid bodies and simulates them. /// /// The main simulation is performed by the Update() call on multiple threads (if the JobSystem is configured to use them). Please refer to the general architecture overview in the Docs folder for more information. -class JPH_EXPORT PhysicsSystem : public NonCopyable +class PhysicsSystem : public NonCopyable { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Ragdoll/Ragdoll.h b/JoltPhysicsC/Jolt/Physics/Ragdoll/Ragdoll.h index 46798dca..ea69fd53 100644 --- a/JoltPhysicsC/Jolt/Physics/Ragdoll/Ragdoll.h +++ b/JoltPhysicsC/Jolt/Physics/Ragdoll/Ragdoll.h @@ -18,10 +18,10 @@ class Ragdoll; class PhysicsSystem; /// Contains the structure of a ragdoll -class JPH_EXPORT RagdollSettings : public RefTarget +class RagdollSettings : public RefTarget { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, RagdollSettings) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(RagdollSettings) /// Stabilize the constraints of the ragdoll /// @return True on success, false on failure. @@ -84,7 +84,7 @@ class JPH_EXPORT RagdollSettings : public RefTarget class Part : public BodyCreationSettings { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, Part) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(Part) Ref mToParent; }; @@ -107,7 +107,7 @@ class JPH_EXPORT RagdollSettings : public RefTarget }; /// Runtime ragdoll information -class JPH_EXPORT Ragdoll : public RefTarget, public NonCopyable +class Ragdoll : public RefTarget, public NonCopyable { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/StateRecorder.h b/JoltPhysicsC/Jolt/Physics/StateRecorder.h index c77459f6..f592f690 100644 --- a/JoltPhysicsC/Jolt/Physics/StateRecorder.h +++ b/JoltPhysicsC/Jolt/Physics/StateRecorder.h @@ -11,7 +11,7 @@ JPH_NAMESPACE_BEGIN /// Class that records the state of a physics system. Can be used to check if the simulation is deterministic by putting the recorder in validation mode. /// Can be used to restore the state to an earlier point in time. -class JPH_EXPORT StateRecorder : public StreamIn, public StreamOut +class StateRecorder : public StreamIn, public StreamOut { public: /// Constructor diff --git a/JoltPhysicsC/Jolt/Physics/StateRecorderImpl.h b/JoltPhysicsC/Jolt/Physics/StateRecorderImpl.h index 17358268..8e4915bf 100644 --- a/JoltPhysicsC/Jolt/Physics/StateRecorderImpl.h +++ b/JoltPhysicsC/Jolt/Physics/StateRecorderImpl.h @@ -9,7 +9,7 @@ JPH_NAMESPACE_BEGIN /// Implementation of the StateRecorder class that uses a stringstream as underlying store and that implements checking if the state doesn't change upon reading -class JPH_EXPORT StateRecorderImpl final : public StateRecorder +class StateRecorderImpl final : public StateRecorder { public: /// Constructor diff --git a/JoltPhysicsC/Jolt/Physics/Vehicle/MotorcycleController.cpp b/JoltPhysicsC/Jolt/Physics/Vehicle/MotorcycleController.cpp index 04adfb14..4b4f3b2c 100644 --- a/JoltPhysicsC/Jolt/Physics/Vehicle/MotorcycleController.cpp +++ b/JoltPhysicsC/Jolt/Physics/Vehicle/MotorcycleController.cpp @@ -82,6 +82,10 @@ void MotorcycleController::PreCollide(float inDeltaTime, PhysicsSystem &inPhysic { WheeledVehicleController::PreCollide(inDeltaTime, inPhysicsSystem); + Vec3 gravity = inPhysicsSystem.GetGravity(); + float gravity_len = gravity.Length(); + Vec3 world_up = gravity_len > 0.0f? -gravity / gravity_len : mConstraint.GetLocalUp(); + const Body *body = mConstraint.GetVehicleBody(); Vec3 forward = body->GetRotation() * mConstraint.GetLocalForward(); float wheel_base = GetWheelBase(); @@ -95,7 +99,6 @@ void MotorcycleController::PreCollide(float inDeltaTime, PhysicsSystem &inPhysic target_lean += w->GetContactNormal() * w->GetSuspensionLambda() + w->GetContactLateral() * w->GetLateralLambda(); // Normalize the impulse - Vec3 world_up = mConstraint.GetWorldUp(); target_lean = target_lean.NormalizedOr(world_up); // Smooth the impulse to avoid jittery behavior @@ -115,7 +118,7 @@ void MotorcycleController::PreCollide(float inDeltaTime, PhysicsSystem &inPhysic // TurnRadius = WheelBase / (Sin(SteerAngle) * Cos(CasterAngle)) // => SteerAngle = ASin(WheelBase * Tan(LeanAngle) * Gravity / (Velocity^2 * Cos(CasterAngle)) // The caster angle is different for each wheel so we can only calculate part of the equation here - float max_steer_angle_factor = wheel_base * Tan(mMaxLeanAngle) * inPhysicsSystem.GetGravity().Length(); + float max_steer_angle_factor = wheel_base * Tan(mMaxLeanAngle) * gravity_len; // Decompose steering into sign and direction float steer_strength = abs(mRightInput); @@ -136,7 +139,7 @@ void MotorcycleController::PreCollide(float inDeltaTime, PhysicsSystem &inPhysic float steer_angle = steer_strength * w->GetSettings()->mMaxSteerAngle; // Clamp to max steering angle - if (velocity_sq > 1.0e-6f && cos_caster_angle > 1.0e-6f) + if (velocity_sq > 1.0e-6f) { float max_steer_angle = ASin(max_steer_angle_factor / (velocity_sq * cos_caster_angle)); steer_angle = min(steer_angle, max_steer_angle); diff --git a/JoltPhysicsC/Jolt/Physics/Vehicle/MotorcycleController.h b/JoltPhysicsC/Jolt/Physics/Vehicle/MotorcycleController.h index 5ef00f8e..8835ff37 100644 --- a/JoltPhysicsC/Jolt/Physics/Vehicle/MotorcycleController.h +++ b/JoltPhysicsC/Jolt/Physics/Vehicle/MotorcycleController.h @@ -10,10 +10,10 @@ JPH_NAMESPACE_BEGIN /// Settings of a two wheeled motorcycle (adds a spring to balance the motorcycle) /// Note: The motor cycle controller is still in development and may need a lot of tweaks/hacks to work properly! -class JPH_EXPORT MotorcycleControllerSettings : public WheeledVehicleControllerSettings +class MotorcycleControllerSettings : public WheeledVehicleControllerSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, MotorcycleControllerSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(MotorcycleControllerSettings) // See: VehicleControllerSettings virtual VehicleController * ConstructController(VehicleConstraint &inConstraint) const override; @@ -35,7 +35,7 @@ class JPH_EXPORT MotorcycleControllerSettings : public WheeledVehicleControllerS }; /// Runtime controller class -class JPH_EXPORT MotorcycleController : public WheeledVehicleController +class MotorcycleController : public WheeledVehicleController { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Vehicle/TrackedVehicleController.h b/JoltPhysicsC/Jolt/Physics/Vehicle/TrackedVehicleController.h index cd7659e8..da17cd2a 100644 --- a/JoltPhysicsC/Jolt/Physics/Vehicle/TrackedVehicleController.h +++ b/JoltPhysicsC/Jolt/Physics/Vehicle/TrackedVehicleController.h @@ -15,10 +15,10 @@ JPH_NAMESPACE_BEGIN class PhysicsSystem; /// WheelSettings object specifically for TrackedVehicleController -class JPH_EXPORT WheelSettingsTV : public WheelSettings +class WheelSettingsTV : public WheelSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, WheelSettingsTV) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(WheelSettingsTV) // See: WheelSettings virtual void SaveBinaryState(StreamOut &inStream) const override; @@ -29,7 +29,7 @@ class JPH_EXPORT WheelSettingsTV : public WheelSettings }; /// Wheel object specifically for TrackedVehicleController -class JPH_EXPORT WheelTV : public Wheel +class WheelTV : public Wheel { public: JPH_OVERRIDE_NEW_DELETE @@ -56,10 +56,10 @@ class JPH_EXPORT WheelTV : public Wheel /// /// Default settings are based around what I could find about the M1 Abrams tank. /// Note to avoid issues with very heavy objects vs very light objects the mass of the tank should be a lot lower (say 10x) than that of a real tank. That means that the engine/brake torque is also 10x less. -class JPH_EXPORT TrackedVehicleControllerSettings : public VehicleControllerSettings +class TrackedVehicleControllerSettings : public VehicleControllerSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, TrackedVehicleControllerSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(TrackedVehicleControllerSettings) // Constructor TrackedVehicleControllerSettings(); @@ -75,7 +75,7 @@ class JPH_EXPORT TrackedVehicleControllerSettings : public VehicleControllerSett }; /// Runtime controller class for vehicle with tank tracks -class JPH_EXPORT TrackedVehicleController : public VehicleController +class TrackedVehicleController : public VehicleController { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleAntiRollBar.h b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleAntiRollBar.h index c72895ca..816d42b0 100644 --- a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleAntiRollBar.h +++ b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleAntiRollBar.h @@ -12,10 +12,10 @@ JPH_NAMESPACE_BEGIN /// An anti rollbar is a stiff spring that connects two wheels to reduce the amount of roll the vehicle makes in sharp corners /// See: https://en.wikipedia.org/wiki/Anti-roll_bar -class JPH_EXPORT VehicleAntiRollBar +class VehicleAntiRollBar { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, VehicleAntiRollBar) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(VehicleAntiRollBar) /// Saves the contents in binary form to inStream. void SaveBinaryState(StreamOut &inStream) const; diff --git a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleCollisionTester.h b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleCollisionTester.h index 4a0a449a..ed6bb996 100644 --- a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleCollisionTester.h +++ b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleCollisionTester.h @@ -15,7 +15,7 @@ class ObjectLayerFilter; class BodyFilter; /// Class that does collision detection between wheels and ground -class JPH_EXPORT VehicleCollisionTester : public RefTarget +class VehicleCollisionTester : public RefTarget { public: JPH_OVERRIDE_NEW_DELETE @@ -66,7 +66,7 @@ class JPH_EXPORT VehicleCollisionTester : public RefTargetPreCollide(inDeltaTime, inPhysicsSystem); @@ -324,15 +320,15 @@ void VehicleConstraint::CalculateWheelContactPoint(const Wheel &inWheel, Vec3 &o void VehicleConstraint::CalculatePitchRollConstraintProperties(float inDeltaTime, RMat44Arg inBodyTransform) { // Check if a limit was specified - if (mCosMaxPitchRollAngle > -1.0f) + if (mCosMaxPitchRollAngle < JPH_PI) { // Calculate cos of angle between world up vector and vehicle up vector Vec3 vehicle_up = inBodyTransform.Multiply3x3(mUp); - mCosPitchRollAngle = mWorldUp.Dot(vehicle_up); + mCosPitchRollAngle = mUp.Dot(vehicle_up); if (mCosPitchRollAngle < mCosMaxPitchRollAngle) { // Calculate rotation axis to rotate vehicle towards up - Vec3 rotation_axis = mWorldUp.Cross(vehicle_up); + Vec3 rotation_axis = mUp.Cross(vehicle_up); float len = rotation_axis.Length(); if (len > 0.0f) mPitchRollRotationAxis = rotation_axis / len; diff --git a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleConstraint.h b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleConstraint.h index 850a028c..d1068f6d 100644 --- a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleConstraint.h +++ b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleConstraint.h @@ -10,20 +10,21 @@ #include #include #include -#include JPH_NAMESPACE_BEGIN class PhysicsSystem; +class VehicleController; +class VehicleControllerSettings; /// Configuration for constraint that simulates a wheeled vehicle. /// /// The properties in this constraint are largely based on "Car Physics for Games" by Marco Monster. /// See: https://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html -class JPH_EXPORT VehicleConstraintSettings : public ConstraintSettings +class VehicleConstraintSettings : public ConstraintSettings { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, VehicleConstraintSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(VehicleConstraintSettings) /// Saves the contents of the constraint settings in binary form to inStream. virtual void SaveBinaryState(StreamOut &inStream) const override; @@ -62,7 +63,7 @@ class JPH_EXPORT VehicleConstraintSettings : public ConstraintSettings /// /// Note that when driving over rubble, you may see the wheel jump up and down quite quickly because one frame a collision is found and the next frame not. /// To alleviate this, it may be needed to smooth the motion of the visual mesh for the wheel. -class JPH_EXPORT VehicleConstraint : public Constraint, public PhysicsStepListener +class VehicleConstraint : public Constraint, public PhysicsStepListener { public: /// Constructor / destructor @@ -84,9 +85,6 @@ class JPH_EXPORT VehicleConstraint : public Constraint, public PhysicsStepListen /// Get the local space up vector of the vehicle Vec3 GetLocalUp() const { return mUp; } - /// Vector indicating the world space up direction (used to limit vehicle pitch/roll), calculated every frame by inverting gravity - Vec3 GetWorldUp() const { return mWorldUp; } - /// Access to the vehicle body Body * GetVehicleBody() const { return mBody; } @@ -156,7 +154,6 @@ class JPH_EXPORT VehicleConstraint : public Constraint, public PhysicsStepListen Body * mBody; ///< Body of the vehicle Vec3 mForward; ///< Local space forward vector for the vehicle Vec3 mUp; ///< Local space up vector for the vehicle - Vec3 mWorldUp; ///< Vector indicating the world space up direction (used to limit vehicle pitch/roll) Wheels mWheels; ///< Wheel states of the vehicle Array mAntiRollBars; ///< Anti rollbars of the vehicle VehicleController * mController; ///< Controls the acceleration / declerration of the vehicle diff --git a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleController.h b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleController.h index 20dcc020..037698d1 100644 --- a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleController.h +++ b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleController.h @@ -4,27 +4,20 @@ #pragma once +#include #include #include #include -#ifdef JPH_DEBUG_RENDERER - #include -#endif // JPH_DEBUG_RENDERER JPH_NAMESPACE_BEGIN -class PhysicsSystem; class VehicleController; -class VehicleConstraint; -class WheelSettings; -class Wheel; -class StateRecorder; /// Basic settings object for interface that controls acceleration / decelleration of the vehicle -class JPH_EXPORT VehicleControllerSettings : public SerializableObject, public RefTarget +class VehicleControllerSettings : public SerializableObject, public RefTarget { public: - JPH_DECLARE_SERIALIZABLE_ABSTRACT(JPH_EXPORT, VehicleControllerSettings) + JPH_DECLARE_SERIALIZABLE_ABSTRACT(VehicleControllerSettings) /// Saves the contents of the controller settings in binary form to inStream. virtual void SaveBinaryState(StreamOut &inStream) const = 0; @@ -37,7 +30,7 @@ class JPH_EXPORT VehicleControllerSettings : public SerializableObject, public R }; /// Runtime data for interface that controls acceleration / decelleration of the vehicle -class JPH_EXPORT VehicleController : public RefTarget +class VehicleController : public RefTarget { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleDifferential.h b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleDifferential.h index 34a50115..cb09b7d4 100644 --- a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleDifferential.h +++ b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleDifferential.h @@ -10,10 +10,10 @@ JPH_NAMESPACE_BEGIN -class JPH_EXPORT VehicleDifferentialSettings +class VehicleDifferentialSettings { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, VehicleDifferentialSettings) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(VehicleDifferentialSettings) /// Saves the contents in binary form to inStream. void SaveBinaryState(StreamOut &inStream) const; diff --git a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleEngine.h b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleEngine.h index 5f0e2401..1270905f 100644 --- a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleEngine.h +++ b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleEngine.h @@ -17,10 +17,10 @@ JPH_NAMESPACE_BEGIN #endif // JPH_DEBUG_RENDERER /// Generic properties for a vehicle engine -class JPH_EXPORT VehicleEngineSettings +class VehicleEngineSettings { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, VehicleEngineSettings) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(VehicleEngineSettings) /// Constructor VehicleEngineSettings(); @@ -40,7 +40,7 @@ class JPH_EXPORT VehicleEngineSettings }; /// Runtime data for engine -class JPH_EXPORT VehicleEngine : public VehicleEngineSettings +class VehicleEngine : public VehicleEngineSettings { public: /// Multiply an angular velocity (rad/s) with this value to get rounds per minute (RPM) diff --git a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleTrack.h b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleTrack.h index c90acccc..a335d9c3 100644 --- a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleTrack.h +++ b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleTrack.h @@ -21,10 +21,10 @@ enum class ETrackSide : uint }; /// Generic properties for tank tracks -class JPH_EXPORT VehicleTrackSettings +class VehicleTrackSettings { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, VehicleTrackSettings) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(VehicleTrackSettings) /// Saves the contents in binary form to inStream. void SaveBinaryState(StreamOut &inStream) const; @@ -41,7 +41,7 @@ class JPH_EXPORT VehicleTrackSettings }; /// Runtime data for tank tracks -class JPH_EXPORT VehicleTrack : public VehicleTrackSettings +class VehicleTrack : public VehicleTrackSettings { public: /// Saving state for replay diff --git a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleTransmission.h b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleTransmission.h index c27ba98e..d358a1cd 100644 --- a/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleTransmission.h +++ b/JoltPhysicsC/Jolt/Physics/Vehicle/VehicleTransmission.h @@ -19,10 +19,10 @@ enum class ETransmissionMode : uint8 }; /// Configuration for the transmission of a vehicle (gear box) -class JPH_EXPORT VehicleTransmissionSettings +class VehicleTransmissionSettings { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, VehicleTransmissionSettings) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(VehicleTransmissionSettings) /// Saves the contents in binary form to inStream. void SaveBinaryState(StreamOut &inStream) const; @@ -42,7 +42,7 @@ class JPH_EXPORT VehicleTransmissionSettings }; /// Runtime data for transmission -class JPH_EXPORT VehicleTransmission : public VehicleTransmissionSettings +class VehicleTransmission : public VehicleTransmissionSettings { public: /// Set input from driver regarding the transmission (only relevant when transmission is set to manual mode) diff --git a/JoltPhysicsC/Jolt/Physics/Vehicle/Wheel.h b/JoltPhysicsC/Jolt/Physics/Vehicle/Wheel.h index f9c5d3f3..399e6291 100644 --- a/JoltPhysicsC/Jolt/Physics/Vehicle/Wheel.h +++ b/JoltPhysicsC/Jolt/Physics/Vehicle/Wheel.h @@ -15,10 +15,10 @@ JPH_NAMESPACE_BEGIN class VehicleConstraint; /// Base class for wheel settings, each VehicleController can implement a derived class of this -class JPH_EXPORT WheelSettings : public SerializableObject, public RefTarget, public NonCopyable +class WheelSettings : public SerializableObject, public RefTarget, public NonCopyable { public: - JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, WheelSettings) + JPH_DECLARE_SERIALIZABLE_VIRTUAL(WheelSettings) /// Saves the contents in binary form to inStream. virtual void SaveBinaryState(StreamOut &inStream) const; @@ -41,7 +41,7 @@ class JPH_EXPORT WheelSettings : public SerializableObject, public RefTarget #include -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, Skeleton) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, SkeletalAnimation) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, CompoundShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, StaticCompoundShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, MutableCompoundShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, TriangleShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, SphereShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, BoxShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, CapsuleShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, TaperedCapsuleShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, CylinderShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, ScaledShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, MeshShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, ConvexHullShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, HeightFieldShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, RotatedTranslatedShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, OffsetCenterOfMassShapeSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, RagdollSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, PointConstraintSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, SixDOFConstraintSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, SliderConstraintSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, SwingTwistConstraintSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, DistanceConstraintSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, HingeConstraintSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, FixedConstraintSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, ConeConstraintSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, PathConstraintSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, PathConstraintPath) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, PathConstraintPathHermite) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, VehicleConstraintSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, WheeledVehicleControllerSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, RackAndPinionConstraintSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, GearConstraintSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, PulleyConstraintSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, MotorSettings) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, PhysicsScene) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, PhysicsMaterial) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, GroupFilter) -JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH_EXPORT, JPH, GroupFilterTable) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, Skeleton) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, SkeletalAnimation) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, CompoundShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, StaticCompoundShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, MutableCompoundShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, TriangleShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, SphereShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, BoxShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, CapsuleShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, TaperedCapsuleShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, CylinderShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, ScaledShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, MeshShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, ConvexHullShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, HeightFieldShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, RotatedTranslatedShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, OffsetCenterOfMassShapeSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, RagdollSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, PointConstraintSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, SixDOFConstraintSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, SliderConstraintSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, SwingTwistConstraintSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, DistanceConstraintSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, HingeConstraintSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, FixedConstraintSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, ConeConstraintSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, PathConstraintSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, PathConstraintPath) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, PathConstraintPathHermite) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, VehicleConstraintSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, WheeledVehicleControllerSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, RackAndPinionConstraintSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, GearConstraintSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, PulleyConstraintSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, MotorSettings) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, PhysicsScene) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, PhysicsMaterial) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, GroupFilter) +JPH_DECLARE_RTTI_WITH_NAMESPACE_FOR_FACTORY(JPH, GroupFilterTable) JPH_NAMESPACE_BEGIN diff --git a/JoltPhysicsC/Jolt/RegisterTypes.h b/JoltPhysicsC/Jolt/RegisterTypes.h index 13333f48..4d851ca0 100644 --- a/JoltPhysicsC/Jolt/RegisterTypes.h +++ b/JoltPhysicsC/Jolt/RegisterTypes.h @@ -7,9 +7,9 @@ JPH_NAMESPACE_BEGIN /// Register all physics types with the factory -JPH_EXPORT extern void RegisterTypes(); +extern void RegisterTypes(); /// Unregisters all types with the factory and cleans up the default material -JPH_EXPORT extern void UnregisterTypes(); +extern void UnregisterTypes(); JPH_NAMESPACE_END diff --git a/JoltPhysicsC/Jolt/Renderer/DebugRenderer.h b/JoltPhysicsC/Jolt/Renderer/DebugRenderer.h index e88bf58d..fb7bf6c3 100644 --- a/JoltPhysicsC/Jolt/Renderer/DebugRenderer.h +++ b/JoltPhysicsC/Jolt/Renderer/DebugRenderer.h @@ -8,11 +8,6 @@ #error This file should only be included when JPH_DEBUG_RENDERER is defined #endif // !JPH_DEBUG_RENDERER -#ifndef JPH_DEBUG_RENDERER_EXPORT - // By default export the debug renderer - #define JPH_DEBUG_RENDERER_EXPORT JPH_EXPORT -#endif // !JPH_DEBUG_RENDERER_EXPORT - #include #include #include @@ -26,7 +21,7 @@ JPH_NAMESPACE_BEGIN class OrientedBox; /// Simple triangle renderer for debugging purposes. -class JPH_DEBUG_RENDERER_EXPORT DebugRenderer +class DebugRenderer { public: JPH_OVERRIDE_NEW_DELETE @@ -146,7 +141,7 @@ class JPH_DEBUG_RENDERER_EXPORT DebugRenderer }; /// A single triangle - class JPH_DEBUG_RENDERER_EXPORT Triangle + class Triangle { public: Triangle() = default; diff --git a/JoltPhysicsC/Jolt/Renderer/DebugRendererPlayback.h b/JoltPhysicsC/Jolt/Renderer/DebugRendererPlayback.h index 75f5a3fd..cdbe318c 100644 --- a/JoltPhysicsC/Jolt/Renderer/DebugRendererPlayback.h +++ b/JoltPhysicsC/Jolt/Renderer/DebugRendererPlayback.h @@ -15,7 +15,7 @@ JPH_NAMESPACE_BEGIN /// Class that can read a recorded stream from DebugRendererRecorder and plays it back trough a DebugRenderer -class JPH_DEBUG_RENDERER_EXPORT DebugRendererPlayback +class DebugRendererPlayback { public: /// Constructor diff --git a/JoltPhysicsC/Jolt/Renderer/DebugRendererRecorder.h b/JoltPhysicsC/Jolt/Renderer/DebugRendererRecorder.h index f0a2600c..144ba58e 100644 --- a/JoltPhysicsC/Jolt/Renderer/DebugRendererRecorder.h +++ b/JoltPhysicsC/Jolt/Renderer/DebugRendererRecorder.h @@ -16,7 +16,7 @@ JPH_NAMESPACE_BEGIN /// Implementation of DebugRenderer that records the API invocations to be played back later -class JPH_DEBUG_RENDERER_EXPORT DebugRendererRecorder final : public DebugRenderer +class DebugRendererRecorder final : public DebugRenderer { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/Skeleton/SkeletalAnimation.h b/JoltPhysicsC/Jolt/Skeleton/SkeletalAnimation.h index 597c7337..c8cf1dec 100644 --- a/JoltPhysicsC/Jolt/Skeleton/SkeletalAnimation.h +++ b/JoltPhysicsC/Jolt/Skeleton/SkeletalAnimation.h @@ -12,16 +12,16 @@ JPH_NAMESPACE_BEGIN class SkeletonPose; /// Resource for a skinned animation -class JPH_EXPORT SkeletalAnimation : public RefTarget +class SkeletalAnimation : public RefTarget { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, SkeletalAnimation) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(SkeletalAnimation) /// Constains the current state of a joint, a local space transformation relative to its parent joint class JointState { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, JointState) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JointState) /// Convert from a local space matrix void FromMatrix(Mat44Arg inMatrix); @@ -37,7 +37,7 @@ class JPH_EXPORT SkeletalAnimation : public RefTarget class Keyframe : public JointState { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, Keyframe) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(Keyframe) float mTime = 0.0f; ///< Time of keyframe in seconds }; @@ -48,7 +48,7 @@ class JPH_EXPORT SkeletalAnimation : public RefTarget class AnimatedJoint { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, AnimatedJoint) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(AnimatedJoint) String mJointName; ///< Name of the joint KeyframeVector mKeyframes; ///< List of keyframes over time diff --git a/JoltPhysicsC/Jolt/Skeleton/Skeleton.h b/JoltPhysicsC/Jolt/Skeleton/Skeleton.h index 3c2b84c6..8501715f 100644 --- a/JoltPhysicsC/Jolt/Skeleton/Skeleton.h +++ b/JoltPhysicsC/Jolt/Skeleton/Skeleton.h @@ -14,10 +14,10 @@ class StreamIn; class StreamOut; /// Resource that contains the joint hierarchy for a skeleton -class JPH_EXPORT Skeleton : public RefTarget +class Skeleton : public RefTarget { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, Skeleton) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(Skeleton) using SkeletonResult = Result>; @@ -25,7 +25,7 @@ class JPH_EXPORT Skeleton : public RefTarget class Joint { public: - JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, Joint) + JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(Joint) Joint() = default; Joint(const string_view &inName, const string_view &inParentName, int inParentJointIndex) : mName(inName), mParentName(inParentName), mParentJointIndex(inParentJointIndex) { } diff --git a/JoltPhysicsC/Jolt/Skeleton/SkeletonMapper.h b/JoltPhysicsC/Jolt/Skeleton/SkeletonMapper.h index a81d23ea..0b11bfab 100644 --- a/JoltPhysicsC/Jolt/Skeleton/SkeletonMapper.h +++ b/JoltPhysicsC/Jolt/Skeleton/SkeletonMapper.h @@ -10,7 +10,7 @@ JPH_NAMESPACE_BEGIN /// Class that is able to map a low detail (ragdoll) skeleton to a high detail (animation) skeleton and vice versa -class JPH_EXPORT SkeletonMapper : public RefTarget +class SkeletonMapper : public RefTarget { public: /// A joint that maps 1-on-1 to a joint in the other skeleton diff --git a/JoltPhysicsC/Jolt/Skeleton/SkeletonPose.h b/JoltPhysicsC/Jolt/Skeleton/SkeletonPose.h index 326227e4..240d9582 100644 --- a/JoltPhysicsC/Jolt/Skeleton/SkeletonPose.h +++ b/JoltPhysicsC/Jolt/Skeleton/SkeletonPose.h @@ -14,7 +14,7 @@ class DebugRenderer; #endif // JPH_DEBUG_RENDERER /// Instance of a skeleton, contains the pose the current skeleton is in -class JPH_EXPORT SkeletonPose +class SkeletonPose { public: JPH_OVERRIDE_NEW_DELETE diff --git a/JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouper.h b/JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouper.h index f4f4400e..7d0e4ca1 100644 --- a/JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouper.h +++ b/JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouper.h @@ -9,7 +9,7 @@ JPH_NAMESPACE_BEGIN /// A class that groups triangles in batches of N (according to closeness) -class JPH_EXPORT TriangleGrouper +class TriangleGrouper { public: /// Virtual destructor diff --git a/JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouperClosestCentroid.h b/JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouperClosestCentroid.h index 58322741..481caa1a 100644 --- a/JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouperClosestCentroid.h +++ b/JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouperClosestCentroid.h @@ -11,7 +11,7 @@ JPH_NAMESPACE_BEGIN /// A class that groups triangles in batches of N. /// Starts with centroid with lowest X coordinate and finds N closest centroids, this repeats until all groups have been found. /// Time complexity: O(N^2) -class JPH_EXPORT TriangleGrouperClosestCentroid : public TriangleGrouper +class TriangleGrouperClosestCentroid : public TriangleGrouper { public: // See: TriangleGrouper::Group diff --git a/JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouperMorton.h b/JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouperMorton.h index a35f9af0..d3fb4f73 100644 --- a/JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouperMorton.h +++ b/JoltPhysicsC/Jolt/TriangleGrouper/TriangleGrouperMorton.h @@ -10,7 +10,7 @@ JPH_NAMESPACE_BEGIN /// A class that groups triangles in batches of N according to morton code of centroid. /// Time complexity: O(N log(N)) -class JPH_EXPORT TriangleGrouperMorton : public TriangleGrouper +class TriangleGrouperMorton : public TriangleGrouper { public: // See: TriangleGrouper::Group diff --git a/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitter.h b/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitter.h index 48707511..1533c17f 100644 --- a/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitter.h +++ b/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitter.h @@ -9,7 +9,7 @@ JPH_NAMESPACE_BEGIN /// A class that splits a triangle list into two parts for building a tree -class JPH_EXPORT TriangleSplitter +class TriangleSplitter { public: /// Constructor diff --git a/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterBinning.h b/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterBinning.h index f37d1ac7..86880206 100644 --- a/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterBinning.h +++ b/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterBinning.h @@ -10,7 +10,7 @@ JPH_NAMESPACE_BEGIN /// Binning splitter approach taken from: Realtime Ray Tracing on GPU with BVH-based Packet Traversal by Johannes Gunther et al. -class JPH_EXPORT TriangleSplitterBinning : public TriangleSplitter +class TriangleSplitterBinning : public TriangleSplitter { public: /// Constructor diff --git a/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterFixedLeafSize.h b/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterFixedLeafSize.h index b3931b22..644faa07 100644 --- a/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterFixedLeafSize.h +++ b/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterFixedLeafSize.h @@ -11,7 +11,7 @@ JPH_NAMESPACE_BEGIN /// Same as TriangleSplitterBinning, but ensuring that leaves have a fixed amount of triangles /// The resulting tree should be suitable for processing on GPU where we want all threads to process an equal amount of triangles -class JPH_EXPORT TriangleSplitterFixedLeafSize : public TriangleSplitter +class TriangleSplitterFixedLeafSize : public TriangleSplitter { public: /// Constructor diff --git a/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterLongestAxis.h b/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterLongestAxis.h index daf0d437..d2b44b34 100644 --- a/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterLongestAxis.h +++ b/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterLongestAxis.h @@ -9,7 +9,7 @@ JPH_NAMESPACE_BEGIN /// Splitter using center of bounding box with longest axis -class JPH_EXPORT TriangleSplitterLongestAxis : public TriangleSplitter +class TriangleSplitterLongestAxis : public TriangleSplitter { public: /// Constructor diff --git a/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterMean.h b/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterMean.h index 737d76e1..6a58c697 100644 --- a/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterMean.h +++ b/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterMean.h @@ -9,7 +9,7 @@ JPH_NAMESPACE_BEGIN /// Splitter using mean of axis with biggest centroid deviation -class JPH_EXPORT TriangleSplitterMean : public TriangleSplitter +class TriangleSplitterMean : public TriangleSplitter { public: /// Constructor diff --git a/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterMorton.h b/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterMorton.h index 2f48c0ea..bcdfa8d0 100644 --- a/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterMorton.h +++ b/JoltPhysicsC/Jolt/TriangleSplitter/TriangleSplitterMorton.h @@ -9,7 +9,7 @@ JPH_NAMESPACE_BEGIN /// Splitter using Morton codes, see: http://devblogs.nvidia.com/parallelforall/thinking-parallel-part-iii-tree-construction-gpu/ -class JPH_EXPORT TriangleSplitterMorton : public TriangleSplitter +class TriangleSplitterMorton : public TriangleSplitter { public: /// Constructor diff --git a/JoltPhysicsC/JoltC/JoltPhysicsC.cpp b/JoltPhysicsC/JoltC/JoltPhysicsC.cpp index fdacec23..c1d3af66 100644 --- a/JoltPhysicsC/JoltC/JoltPhysicsC.cpp +++ b/JoltPhysicsC/JoltC/JoltPhysicsC.cpp @@ -9,18 +9,11 @@ #include #include #include -#include -#include #include #include -#include +#include #include #include -#include -#include -#include -#include -#include #include #include #include @@ -30,25 +23,25 @@ #include #include #include -#include -#include -#include -#include #include +#include #include -#include -#include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include #include #include #include +#include +#include +#include +#include + +#if JPC_DEBUG_RENDERER == 1 +#include +#include +#endif //JPC_DEBUG_RENDERER JPH_SUPPRESS_WARNINGS @@ -66,16 +59,8 @@ JPH_SUPPRESS_WARNINGS #define FN(name) static auto name -FN(toJpc)(JPH::BodyID in) { return in.GetIndexAndSequenceNumber(); } FN(toJph)(JPC_BodyID in) { return JPH::BodyID(in); } - -FN(subShapeIDJph)(JPC_SubShapeID in) { auto r = JPH::SubShapeID(); r.SetValue(in); return r; } -FN(subShapeIDJpc)(JPH::SubShapeID in) { return in.GetValue(); } - -FN(toJpc)(const JPH::BodyID *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_BodyID *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::BodyID *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_BodyID *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::BodyID in) { return in.GetIndexAndSequenceNumber(); } FN(toJpc)(const JPH::Body *in) { assert(in); return reinterpret_cast(in); } FN(toJph)(const JPC_Body *in) { assert(in); return reinterpret_cast(in); } @@ -85,9 +70,6 @@ FN(toJph)(JPC_Body *in) { assert(in); return reinterpret_cast(in); FN(toJph)(const JPC_PhysicsMaterial *in) { return reinterpret_cast(in); } FN(toJpc)(const JPH::PhysicsMaterial *in) { return reinterpret_cast(in); } -FN(toJph)(JPC_TempAllocator *in) { return reinterpret_cast(in); } -FN(toJpc)(JPH::TempAllocator *in) { return reinterpret_cast(in); } - FN(toJph)(const JPC_ShapeSettings *in) { ENSURE_TYPE(in, JPH::ShapeSettings); return reinterpret_cast(in); @@ -200,41 +182,6 @@ FN(toJpc)(JPH::MeshShapeSettings *in) { return reinterpret_cast(in); } -FN(toJpc)(const JPH::CompoundShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_CompoundShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::CompoundShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_CompoundShapeSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::StaticCompoundShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_StaticCompoundShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::StaticCompoundShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_StaticCompoundShapeSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::MutableCompoundShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_MutableCompoundShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::MutableCompoundShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_MutableCompoundShapeSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::DecoratedShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_DecoratedShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::DecoratedShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_DecoratedShapeSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::ScaledShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_ScaledShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::ScaledShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_ScaledShapeSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::RotatedTranslatedShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_RotatedTranslatedShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::RotatedTranslatedShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_RotatedTranslatedShapeSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::OffsetCenterOfMassShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_OffsetCenterOfMassShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::OffsetCenterOfMassShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_OffsetCenterOfMassShapeSettings *in) { assert(in); return reinterpret_cast(in); } - FN(toJph)(const JPC_ConvexShapeSettings *in) { ENSURE_TYPE(in, JPH::ConvexShapeSettings); return reinterpret_cast(in); @@ -244,10 +191,74 @@ FN(toJph)(JPC_ConvexShapeSettings *in) { return reinterpret_cast(in); } +FN(toJpc)(JPH::RotatedTranslatedShapeSettings *in) { + assert(in); + return reinterpret_cast(in); +} +FN(toJpc)(JPH::ScaledShapeSettings *in) { + assert(in); + return reinterpret_cast(in); +} +FN(toJpc)(JPH::OffsetCenterOfMassShapeSettings *in) { + assert(in); + return reinterpret_cast(in); +} +FN(toJph)(JPC_DecoratedShapeSettings *in) { + ENSURE_TYPE(in, JPH::DecoratedShapeSettings); + return reinterpret_cast(in); +} + +FN(toJpc)(JPH::StaticCompoundShapeSettings *in) { + assert(in); + return reinterpret_cast(in); +} +FN(toJpc)(JPH::MutableCompoundShapeSettings *in) { + assert(in); + return reinterpret_cast(in); +} +FN(toJph)(JPC_CompoundShapeSettings *in) { + ENSURE_TYPE(in, JPH::CompoundShapeSettings); + return reinterpret_cast(in); +} + +FN(toJph)(const JPC_ConstraintSettings *in) { + ENSURE_TYPE(in, JPH::ConstraintSettings); + return reinterpret_cast(in); +} +FN(toJph)(JPC_ConstraintSettings *in) { + ENSURE_TYPE(in, JPH::ConstraintSettings); + return reinterpret_cast(in); +} +FN(toJpc)(const JPH::ConstraintSettings *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::ConstraintSettings *in) { assert(in); return reinterpret_cast(in); } + +FN(toJph)(const JPC_TwoBodyConstraintSettings *in) { + ENSURE_TYPE(in, JPH::TwoBodyConstraintSettings); + return reinterpret_cast(in); +} +FN(toJph)(JPC_TwoBodyConstraintSettings *in) { + ENSURE_TYPE(in, JPH::TwoBodyConstraintSettings); + return reinterpret_cast(in); +} +FN(toJpc)(const JPH::TwoBodyConstraintSettings *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::TwoBodyConstraintSettings *in) { assert(in); return reinterpret_cast(in); } + +FN(toJph)(const JPC_FixedConstraintSettings *in) { + ENSURE_TYPE(in, JPH::FixedConstraintSettings); + return reinterpret_cast(in); +} +FN(toJph)(JPC_FixedConstraintSettings *in) { + ENSURE_TYPE(in, JPH::FixedConstraintSettings); + return reinterpret_cast(in); +} +FN(toJpc)(JPH::FixedConstraintSettings *in) { assert(in); return reinterpret_cast(in); } + FN(toJph)(const JPC_CollisionGroup *in) { assert(in); return reinterpret_cast(in); } FN(toJpc)(const JPH::CollisionGroup *in) { assert(in); return reinterpret_cast(in); } FN(toJpc)(JPH::CollisionGroup *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(const JPC_SubShapeID *in) { assert(in); return reinterpret_cast(in); } + FN(toJph)(const JPC_BodyLockInterface *in) { assert(in); return reinterpret_cast(in); } @@ -255,6 +266,10 @@ FN(toJpc)(const JPH::BodyLockInterface *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(const JPH::NarrowPhaseQuery *in) { + assert(in); return reinterpret_cast(in); +} + FN(toJph)(const JPC_PhysicsSystem *in) { assert(in); return reinterpret_cast(in); } FN(toJph)(JPC_PhysicsSystem *in) { assert(in); return reinterpret_cast(in); } FN(toJpc)(JPH::PhysicsSystem *in) { assert(in); return reinterpret_cast(in); } @@ -264,294 +279,35 @@ FN(toJph)(const JPC_Shape *in) { assert(in); return reinterpret_cast(in); } FN(toJph)(JPC_Shape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::ConvexShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_ConvexShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::ConvexShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_ConvexShape *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(const JPH::Constraint *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(const JPC_Constraint *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::Constraint *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(JPC_Constraint *in) { assert(in); return reinterpret_cast(in); } FN(toJpc)(const JPH::BodyInterface *in) { assert(in); return reinterpret_cast(in); } FN(toJph)(const JPC_BodyInterface *in) { assert(in); return reinterpret_cast(in); } FN(toJpc)(JPH::BodyInterface *in) { assert(in); return reinterpret_cast(in); } FN(toJph)(JPC_BodyInterface *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::MassProperties *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(const JPH::TransformedShape *in) { assert(in); return reinterpret_cast(in); } + FN(toJph)(const JPC_MassProperties *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::MassProperties *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_MassProperties *in) { assert(in); return reinterpret_cast(in); } FN(toJph)(JPC_BodyLockRead *in) { assert(in); return reinterpret_cast(in); } FN(toJph)(JPC_BodyLockWrite *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_SphereShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::SphereShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_SphereShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::SphereShape *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_BoxShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::BoxShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_BoxShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::BoxShape *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_TriangleShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::TriangleShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_TriangleShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::TriangleShape *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_CapsuleShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::CapsuleShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_CapsuleShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::CapsuleShape *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_TaperedCapsuleShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::TaperedCapsuleShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_TaperedCapsuleShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::TaperedCapsuleShape *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_CylinderShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::CylinderShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_CylinderShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::CylinderShape *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_ConvexHullShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::ConvexHullShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_ConvexHullShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::ConvexHullShape *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::DecoratedShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_DecoratedShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::DecoratedShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_DecoratedShape *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::ScaledShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_ScaledShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::ScaledShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_ScaledShape *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::RotatedTranslatedShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_RotatedTranslatedShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::RotatedTranslatedShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_RotatedTranslatedShape *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::OffsetCenterOfMassShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_OffsetCenterOfMassShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::OffsetCenterOfMassShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_OffsetCenterOfMassShape *in) { assert(in); return reinterpret_cast(in); } - - -FN(toJph)(const JPC_Constraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::Constraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_Constraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::Constraint *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_TwoBodyConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::TwoBodyConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_TwoBodyConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::TwoBodyConstraint *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_FixedConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::FixedConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_FixedConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::FixedConstraint *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_DistanceConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::DistanceConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_DistanceConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::DistanceConstraint *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_PointConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::PointConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_PointConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::PointConstraint *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_HingeConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::HingeConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_HingeConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::HingeConstraint *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_ConeConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::ConeConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_ConeConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::ConeConstraint *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_SliderConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::SliderConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_SliderConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::SliderConstraint *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_SwingTwistConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::SwingTwistConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_SwingTwistConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::SwingTwistConstraint *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_SixDOFConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::SixDOFConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_SixDOFConstraint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::SixDOFConstraint *in) { assert(in); return reinterpret_cast(in); } - - - -FN(toJph)(const JPC_ConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::ConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_ConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::ConstraintSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_TwoBodyConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::TwoBodyConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_TwoBodyConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::TwoBodyConstraintSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_FixedConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::FixedConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_FixedConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::FixedConstraintSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_DistanceConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::DistanceConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_DistanceConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::DistanceConstraintSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_PointConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::PointConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_PointConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::PointConstraintSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_HingeConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::HingeConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_HingeConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::HingeConstraintSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_ConeConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::ConeConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_ConeConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::ConeConstraintSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_SliderConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::SliderConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_SliderConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::SliderConstraintSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_SwingTwistConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::SwingTwistConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_SwingTwistConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::SwingTwistConstraintSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_SixDOFConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::SixDOFConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_SixDOFConstraintSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::SixDOFConstraintSettings *in) { assert(in); return reinterpret_cast(in); } - - -FN(toJph)(const JPC_MotorSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::MotorSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_MotorSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::MotorSettings *in) { assert(in); return reinterpret_cast(in); } - - -FN(toJph)(const JPC_BroadPhaseCastResult *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::BroadPhaseCastResult *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_BroadPhaseCastResult *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::BroadPhaseCastResult *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_RayCastResult *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::RayCastResult *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_RayCastResult *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::RayCastResult *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_RayCastSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::RayCastSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_RayCastSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::RayCastSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_CollideShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::CollideShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_CollideShapeSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::CollideShapeSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_ShapeCastSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::ShapeCastSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_ShapeCastSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::ShapeCastSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJph)(const JPC_ShapeResult *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::Shape::ShapeResult *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_ShapeResult *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::Shape::ShapeResult *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::TransformedShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_TransformedShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::TransformedShape *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_TransformedShape *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::BodyCreationSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_BodyCreationSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::BodyCreationSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_BodyCreationSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::PhysicsSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_PhysicsSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::PhysicsSettings *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_PhysicsSettings *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::CollideShapeResult *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_CollideShapeResult *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::CollideShapeResult *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_CollideShapeResult *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(const JPH::BodyCreationSettings *in) { + assert(in); return reinterpret_cast(in); +} +FN(toJph)(const JPC_BodyCreationSettings *in) { + assert(in); return reinterpret_cast(in); +} FN(toJpc)(const JPH::MotionProperties *in) { assert(in); return reinterpret_cast(in); } FN(toJph)(const JPC_MotionProperties *in) { assert(in); return reinterpret_cast(in); } FN(toJpc)(JPH::MotionProperties *in) { assert(in); return reinterpret_cast(in); } FN(toJph)(JPC_MotionProperties *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::BroadPhaseQuery *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_BroadPhaseQuery *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::BroadPhaseQuery *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_BroadPhaseQuery *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::NarrowPhaseQuery *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_NarrowPhaseQuery *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::NarrowPhaseQuery *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_NarrowPhaseQuery *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::RayCast *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_RayCast *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::RayCast *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_RayCast *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::RRayCast *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_RRayCast *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::RRayCast *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_RRayCast *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::AABox *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_AABox *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::AABox *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_AABox *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::OrientedBox *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_OrientedBox *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::OrientedBox *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_OrientedBox *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::AABoxCast *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_AABoxCast *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::AABoxCast *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_AABoxCast *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::Shape::SupportingFace *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_SupportingFace *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::Shape::SupportingFace *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_SupportingFace *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::SubShapeIDCreator *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_SubShapeIDCreator *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::SubShapeIDCreator *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_SubShapeIDCreator *in) { assert(in); return reinterpret_cast(in); } - -FN(toJpc)(const JPH::GJKClosestPoint *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(const JPC_GJKClosestPoint *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::GJKClosestPoint *in) { assert(in); return reinterpret_cast(in); } -FN(toJph)(JPC_GJKClosestPoint *in) { assert(in); return reinterpret_cast(in); } - FN(toJpc)(const JPH::SubShapeIDPair *in) { assert(in); return reinterpret_cast(in); } @@ -560,57 +316,84 @@ FN(toJpc)(const JPH::ContactManifold *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(const JPH::CollideShapeResult *in) { + assert(in); return reinterpret_cast(in); +} + FN(toJpc)(JPH::ContactSettings *in) { assert(in); return reinterpret_cast(in); } FN(toJpc)(JPH::BroadPhaseLayer in) { return static_cast(in); } -FN(broadPhaseLayerToJph)(JPC_BroadPhaseLayer in) { return static_cast(in); } - FN(toJpc)(JPH::ObjectLayer in) { return static_cast(in); } -FN(objectLayerToJph)(JPC_ObjectLayer in) { return static_cast(in); } - FN(toJpc)(JPH::EShapeType in) { return static_cast(in); } -FN(shapeTypeToJph)(JPC_ShapeType in) { return static_cast(in); } - FN(toJpc)(JPH::EShapeSubType in) { return static_cast(in); } -FN(shapeSubTypeToJph)(JPC_ShapeSubType in) { return static_cast(in); } - +FN(toJpc)(JPH::EConstraintType in) { return static_cast(in); } +FN(toJpc)(JPH::EConstraintSubType in) { return static_cast(in); } +FN(toJpc)(JPH::EConstraintSpace in) { return static_cast(in); } FN(toJpc)(JPH::EMotionType in) { return static_cast(in); } -FN(motionTypeToJph)(JPC_MotionType in) { return static_cast(in); } - FN(toJpc)(JPH::EActivation in) { return static_cast(in); } -FN(activationToJph)(JPC_Activation in) { return static_cast(in); } - FN(toJpc)(JPH::EMotionQuality in) { return static_cast(in); } -FN(motionQualityToJph)(JPC_MotionQuality in) { return static_cast(in); } - -FN(toJpc)(JPH::EConstraintType in) { return static_cast(in); } -FN(constraintTypeToJph)(JPC_ConstraintType in) { return static_cast(in); } - -FN(toJpc)(JPH::EConstraintSubType in) { return static_cast(in); } -FN(constraintSubTypeToJph)(JPC_ConstraintSubType in) { return static_cast(in); } +FN(toJpc)(JPH::CharacterBase::EGroundState in) { return static_cast(in); } + +FN(toJph)(JPC_ConstraintSpace in) { return static_cast(in); } + +FN(toJph)(const JPC_Character *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(JPC_Character *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(const JPH::Character *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::Character *in) { assert(in); return reinterpret_cast(in); } + +FN(toJph)(const JPC_CharacterSettings *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(JPC_CharacterSettings *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(const JPH::CharacterSettings *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::CharacterSettings *in) { assert(in); return reinterpret_cast(in); } + +FN(toJph)(const JPC_CharacterVirtual *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(JPC_CharacterVirtual *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(const JPH::CharacterVirtual *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::CharacterVirtual *in) { assert(in); return reinterpret_cast(in); } + +FN(toJph)(const JPC_CharacterVirtualSettings *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(JPC_CharacterVirtualSettings *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(const JPH::CharacterVirtualSettings *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::CharacterVirtualSettings *in) { assert(in); return reinterpret_cast(in); } + +#if JPC_DEBUG_RENDERER == 1 +FN(toJpc)(const JPH::BodyManager::DrawSettings *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(const JPC_BodyManager_DrawSettings *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::BodyManager::DrawSettings *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(JPC_BodyManager_DrawSettings *in) { assert(in); return reinterpret_cast(in); } + +FN(toJpc)(const JPH::BodyDrawFilter *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(const JPC_BodyDrawFilter *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::BodyDrawFilter *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(JPC_BodyDrawFilter *in) { assert(in); return reinterpret_cast(in); } + +FN(toJpc)(const JPH::ColorArg *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(const JPC_Color *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::ColorArg *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(JPC_Color *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::EConstraintSpace in) { return static_cast(in); } -FN(constraintSpaceToJph)(JPC_ConstraintSpace in) { return static_cast(in); } +FN(toJpc)(const JPH::AABox *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(const JPC_AABox *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::AABox *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(JPC_AABox *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::EMotorState in) { return static_cast(in); } -FN(motorStateToJph)(JPC_MotorState in) { return static_cast(in); } +FN(toJpc)(const JPH::DebugRenderer::Vertex *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(const JPC_DebugRenderer_Vertex *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::DebugRenderer::Vertex *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(JPC_DebugRenderer_Vertex *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(JPH::SixDOFConstraint::EAxis in) { return static_cast(in); } -FN(sixDofConstraintAxisToJph)(JPC_SixDOFConstraintAxis in) { return static_cast(in); } +FN(toJpc)(const JPH::DebugRenderer::Triangle *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(const JPC_DebugRenderer_Triangle *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::DebugRenderer::Triangle *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(JPC_DebugRenderer_Triangle *in) { assert(in); return reinterpret_cast(in); } -FN(toJpc)(const JPH::Shape::ShapeResult& in) { - auto result = JPC_ShapeResult { - .result = in.IsValid() ? toJpc(in.Get().GetPtr()) : nullptr, - }; - if (in.HasError()) { - in.GetError().copy(result.error, 256); - } else { - const_cast(in.Get().GetPtr())->AddRef(); - } - return result; -} +FN(toJpc)(const JPH::DebugRenderer::LOD *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(const JPC_DebugRenderer_LOD *in) { assert(in); return reinterpret_cast(in); } +FN(toJpc)(JPH::DebugRenderer::LOD *in) { assert(in); return reinterpret_cast(in); } +FN(toJph)(JPC_DebugRenderer_LOD *in) { assert(in); return reinterpret_cast(in); } +#endif //JPC_DEBUG_RENDERER #undef FN @@ -619,87 +402,37 @@ static inline JPH::Vec3 loadVec3(const float in[3]) { return JPH::Vec3(*reinterpret_cast(in)); } -static inline JPH::DVec3 loadDVec3(const double in[3]) { - assert(in != nullptr); - return JPH::DVec3(*reinterpret_cast(in)); -} - -static inline JPH::RVec3 loadRVec3(const JPC_Real in[3]) { - assert(in != nullptr); -#if JPC_DOUBLE_PRECISION == 0 - return loadVec3(in); -#else - return loadDVec3(in); -#endif -} - static inline JPH::Vec4 loadVec4(const float in[4]) { assert(in != nullptr); return JPH::Vec4::sLoadFloat4(reinterpret_cast(in)); } -static inline JPH::Quat loadQuat(const float in[4]) { - assert(in != nullptr); - return {in[0], in[1], in[2], in[3]}; -} - static inline JPH::Mat44 loadMat44(const float in[16]) { assert(in != nullptr); return JPH::Mat44::sLoadFloat4x4(reinterpret_cast(in)); } -static inline JPH::Mat44 loadMat44(const float in_rotation[9], const float in_translation[3]) { - assert(in_rotation != nullptr && in_translation != nullptr); - JPH::Mat44 result{}; - result.SetColumn3(0, loadVec3(&in_rotation[0])); - result.SetColumn3(1, loadVec3(&in_rotation[3])); - result.SetColumn3(2, loadVec3(&in_rotation[6])); - result.SetTranslation(loadVec3(in_translation)); - return result; -} - -static inline JPH::DMat44 loadDMat44(const float in_rotation[9], const double in_translation[3]) { - assert(in_rotation != nullptr && in_translation != nullptr); - JPH::DMat44 result{}; - result.SetColumn3(0, loadVec3(&in_rotation[0])); - result.SetColumn3(1, loadVec3(&in_rotation[3])); - result.SetColumn3(2, loadVec3(&in_rotation[6])); - result.SetTranslation(loadDVec3(in_translation)); - return result; -} - -static inline JPH::RMat44 loadRMat44(const float in_rotation[9], const JPC_Real in_translation[3]) { +static inline JPH::RVec3 loadRVec3(const JPC_Real in[3]) { + assert(in != nullptr); #if JPC_DOUBLE_PRECISION == 0 - return loadMat44(in_rotation, in_translation); + return JPH::Vec3(*reinterpret_cast(in)); #else - return loadDMat44(in_rotation, in_translation); + return JPH::DVec3(in[0], in[1], in[2]); #endif } -static inline void storeVec3(float out[3], JPH::Vec3Arg in) { - assert(out != nullptr); - in.StoreFloat3(reinterpret_cast(out)); -} - -static inline void storeDVec3(double out[3], JPH::DVec3Arg in) { - assert(out != nullptr); - in.StoreDouble3(reinterpret_cast(out)); -} - static inline void storeRVec3(JPC_Real out[3], JPH::RVec3Arg in) { + assert(out != nullptr); #if JPC_DOUBLE_PRECISION == 0 - storeVec3(out, in); + in.StoreFloat3(reinterpret_cast(out)); #else - storeDVec3(out, in); + in.StoreDouble3(reinterpret_cast(out)); #endif } -static inline void storeQuat(float out[4], JPH::QuatArg in) { +static inline void storeVec3(float out[3], JPH::Vec3Arg in) { assert(out != nullptr); - out[0] = in.GetX(); - out[1] = in.GetY(); - out[2] = in.GetZ(); - out[3] = in.GetW(); + in.StoreFloat3(reinterpret_cast(out)); } static inline void storeVec4(float out[4], JPH::Vec4Arg in) { @@ -712,30 +445,6 @@ static inline void storeMat44(float out[16], JPH::Mat44Arg in) { in.StoreFloat4x4(reinterpret_cast(out)); } -static inline void storeMat44(float out_rotation[9], float out_translation[3], JPH::Mat44Arg in) { - assert(out_rotation != nullptr && out_translation != nullptr); - storeVec3(&out_rotation[0], in.GetColumn3(0)); - storeVec3(&out_rotation[3], in.GetColumn3(1)); - storeVec3(&out_rotation[6], in.GetColumn3(2)); - storeVec3(out_translation, in.GetTranslation()); -} - -static inline void storeDMat44(float out_rotation[9], double out_translation[3], JPH::DMat44Arg in) { - assert(out_rotation != nullptr && out_translation != nullptr); - storeVec3(&out_rotation[0], in.GetColumn3(0)); - storeVec3(&out_rotation[3], in.GetColumn3(1)); - storeVec3(&out_rotation[6], in.GetColumn3(2)); - storeDVec3(&out_translation[0], in.GetTranslation()); -} - -static inline void storeRMat44(float out_rotation[9], JPC_Real out_translation[3], JPH::RMat44Arg in) { -#if JPC_DOUBLE_PRECISION == 0 - storeMat44(out_rotation, out_translation, in); -#else - storeDMat44(out_rotation, out_translation, in); -#endif -} - #ifdef JPH_ENABLE_ASSERTS static bool @@ -750,37 +459,6 @@ AssertFailedImpl(const char *in_expression, #endif //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyIDVector_Destroy(JPC_BodyIDVector *in_vector) -{ - delete reinterpret_cast(in_vector); -} -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_SupportingFace * -JPC_SupportingFace_Create() -{ - auto out = new JPH::Shape::SupportingFace(); - return toJpc(out); -} - -JPC_API uint32_t -JPC_SupportingFace_Size(JPC_SupportingFace *in_face) -{ - return toJph(in_face)->size(); -} - -JPC_API float ** -JPC_SupportingFace_Data(JPC_SupportingFace *in_face) -{ - return reinterpret_cast(toJph(in_face)->data()); -} - -JPC_API void -JPC_SupportingFace_Destroy(JPC_SupportingFace *in_face) -{ - delete toJph(in_face); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void JPC_RegisterDefaultAllocator(void) { JPH::RegisterDefaultAllocator(); @@ -857,155 +535,47 @@ JPC_BodyCreationSettings_Set(JPC_BodyCreationSettings *out_settings, *out_settings = settings; } //-------------------------------------------------------------------------------------------------- -JPC_API const JPC_ShapeSettings * -JPC_BodyCreationSettings_GetShapeSettings(const JPC_BodyCreationSettings *in_settings) -{ - return toJpc(toJph(in_settings)->GetShapeSettings()); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyCreationSettings_SetShapeSettings(JPC_BodyCreationSettings *in_settings, - const JPC_ShapeSettings *in_shape) -{ - toJph(in_settings)->SetShapeSettings(toJph(in_shape)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_ShapeResult -JPC_BodyCreationSettings_ConvertShapeSettings(JPC_BodyCreationSettings *in_settings) -{ - auto result = toJph(in_settings)->ConvertShapeSettings(); - return toJpc(result); -} +// +// JPC_TempAllocator +// //-------------------------------------------------------------------------------------------------- -JPC_API const JPC_Shape * -JPC_BodyCreationSettings_GetShape(const JPC_BodyCreationSettings *in_settings) +JPC_API JPC_TempAllocator * +JPC_TempAllocator_Create(uint32_t in_size) { - return toJpc(toJph(in_settings)->GetShape()); + auto impl = new JPH::TempAllocatorImpl(in_size); + return reinterpret_cast(impl); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyCreationSettings_SetShape(JPC_BodyCreationSettings *in_settings, - const JPC_Shape *in_shape) +JPC_TempAllocator_Destroy(JPC_TempAllocator *in_allocator) { - toJph(in_settings)->SetShape(toJph(in_shape)); + assert(in_allocator != nullptr); + delete reinterpret_cast(in_allocator); } //-------------------------------------------------------------------------------------------------- -JPC_API bool -JPC_BodyCreationSettings_HasMassProperties(const JPC_BodyCreationSettings *in_settings) +// +// JPC_JobSystem +// +//-------------------------------------------------------------------------------------------------- +JPC_API JPC_JobSystem * +JPC_JobSystem_Create(uint32_t in_max_jobs, uint32_t in_max_barriers, int in_num_threads) { - return toJph(in_settings)->HasMassProperties(); + auto job_system = new JPH::JobSystemThreadPool(in_max_jobs, in_max_barriers, in_num_threads); + return reinterpret_cast(job_system); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyCreationSettings_GetMassProperties(const JPC_BodyCreationSettings *in_settings, - JPC_MassProperties *out_properties) +JPC_JobSystem_Destroy(JPC_JobSystem *in_job_system) { - auto out = toJph(in_settings)->GetMassProperties(); - *out_properties = *toJpc(&out); + assert(in_job_system != nullptr); + delete reinterpret_cast(in_job_system); } //-------------------------------------------------------------------------------------------------- -JPC_API bool -JPC_CollisionGroup_CanCollide(const JPC_CollisionGroup *in_group, const JPC_CollisionGroup *in_other) -{ - return toJph(in_group)->CanCollide(*toJph(in_other)); -} +// +// JPC_PhysicsSystem +// //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_PhysicsSettings_SetDefault(JPC_PhysicsSettings *out_settings) -{ - const JPH::PhysicsSettings settings; - *out_settings = *toJpc(&settings); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BroadPhaseCastResult_SetDefault(JPC_BroadPhaseCastResult *out_result) -{ - const JPH::BroadPhaseCastResult result; - *out_result = *toJpc(&result); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_RayCastResult_SetDefault(JPC_RayCastResult *out_result) -{ - const JPH::RayCastResult result; - *out_result = *toJpc(&result); -} -//-------------------------------------------------------------------------------------------------- -JPC_API float -JPC_CollideShapeResult_GetEarlyOutFraction(JPC_CollideShapeResult *in_settings) -{ - return toJph(in_settings)->GetEarlyOutFraction(); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CollideShapeResult_Reversed(JPC_CollideShapeResult *in_settings, JPC_CollideShapeResult *out_settings) -{ - const auto out = toJph(in_settings)->Reversed(); - *out_settings = *toJpc(&out); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_RayCastSettings_SetDefault(JPC_RayCastSettings *out_settings) -{ - const JPH::RayCastSettings settings; - *out_settings = *toJpc(&settings); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CollideShapeSettings_SetDefault(JPC_CollideShapeSettings *out_settings) -{ - const JPH::CollideShapeSettings settings; - *out_settings = *toJpc(&settings); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_ShapeCastSettings_SetDefault(JPC_ShapeCastSettings *out_settings) -{ - const JPH::ShapeCastSettings settings; - *out_settings = *toJpc(&settings); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_TempAllocator -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_TempAllocator * -JPC_TempAllocator_Create(uint32_t in_size) -{ - auto impl = new JPH::TempAllocatorImpl(in_size); - return reinterpret_cast(impl); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_TempAllocator_Destroy(JPC_TempAllocator *in_allocator) -{ - assert(in_allocator != nullptr); - delete reinterpret_cast(in_allocator); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_JobSystem -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_JobSystem * -JPC_JobSystem_Create(uint32_t in_max_jobs, uint32_t in_max_barriers, int in_num_threads) -{ - auto job_system = new JPH::JobSystemThreadPool(in_max_jobs, in_max_barriers, in_num_threads); - return reinterpret_cast(job_system); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_JobSystem_Destroy(JPC_JobSystem *in_job_system) -{ - assert(in_job_system != nullptr); - delete reinterpret_cast(in_job_system); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_PhysicsSystem -// -//-------------------------------------------------------------------------------------------------- -class ContactListener : public JPH::ContactListener +class ContactListener : public JPH::ContactListener { public: JPH::ValidateResult OnContactValidate( @@ -1066,6 +636,225 @@ class ContactListener : public JPH::ContactListener CListener *c_listener; }; +#if JPC_DEBUG_RENDERER == 1 + +class DebugRendererImpl final : public JPH::DebugRenderer +{ +public: + + class RenderPrimitive : public JPH::RefTarget + { + protected: + RenderPrimitive(const JPC_DebugRenderer_Primitive *prim) : c_primitive(prim) { } + const JPC_DebugRenderer_Primitive *c_primitive; + }; + + class BatchImpl : public JPH::RefTargetVirtual, public RenderPrimitive + { + public: + JPH_OVERRIDE_NEW_DELETE + BatchImpl(const JPC_DebugRenderer_Primitive *prim) : RenderPrimitive(prim) { } + + virtual void AddRef() override + { + RenderPrimitive::AddRef(); + } + virtual void Release() override + { + if (--mRefCount == 0) delete this; + } + const JPC_DebugRenderer_Primitive *GetPrimitive() const + { + return c_primitive; + } + }; + + class BodyDrawFilter : public JPH::BodyDrawFilter + { + JPC_BodyDrawFilterFunc func = nullptr; + public: + JPH_OVERRIDE_NEW_DELETE + BodyDrawFilter(const JPC_BodyDrawFilterFunc func) : func(func) {} + virtual bool ShouldDraw(const JPH::Body& inBody) const override + { + return func(toJpc(&inBody)); + } + }; + + struct CRenderer + { + JPC_DebugRendererVTable *vtbl; + }; + CRenderer *c_renderer; + static DebugRendererImpl *sInstance; + + JPH_OVERRIDE_NEW_DELETE + DebugRendererImpl(CRenderer *in_renderer) : c_renderer(in_renderer) + { + DebugRenderer::Initialize(); + } + JPC_DebugRendererResult ValidateCallbacks() + { + bool valid = true; + valid &= (c_renderer->vtbl->DrawLine != nullptr); + valid &= (c_renderer->vtbl->DrawTriangle != nullptr); + valid &= (c_renderer->vtbl->CreateTriangleBatch != nullptr); + valid &= (c_renderer->vtbl->CreateTriangleBatchIndexed != nullptr); + valid &= (c_renderer->vtbl->DrawGeometry != nullptr); + valid &= (c_renderer->vtbl->DrawText3D != nullptr); + return valid ? JPC_DEBUGRENDERER_SUCCESS : JPC_DEBUGRENDERER_INCOMPLETE_IMPL; + } + virtual void DrawLine(JPH::RVec3Arg inFrom, JPH::RVec3Arg inTo, JPH::ColorArg inColor) override + { + JPC_Real in_from[3]; + storeRVec3(in_from, inFrom); + JPC_Real in_to[3]; + storeRVec3(in_to, inTo); + c_renderer->vtbl->DrawLine(c_renderer, in_from, in_to, *toJpc(&inColor)); + } + virtual void DrawTriangle( + JPH::RVec3Arg inV1, + JPH::RVec3Arg inV2, + JPH::RVec3Arg inV3, + JPH::ColorArg inColor) override + { + JPC_Real in_v1[3]; + storeRVec3(in_v1, inV1); + JPC_Real in_v2[3]; + storeRVec3(in_v2, inV2); + JPC_Real in_v3[3]; + storeRVec3(in_v3, inV3); + c_renderer->vtbl->DrawTriangle(c_renderer, in_v1, in_v2, in_v3, *toJpc(&inColor)); + } + virtual JPH::DebugRenderer::Batch CreateTriangleBatch( + const JPH::DebugRenderer::Triangle *inTriangles, + int inTriangleCount) override + { + JPC_DebugRenderer_TriangleBatch *c_batch = c_renderer->vtbl->CreateTriangleBatch( + c_renderer, + toJpc(inTriangles), + inTriangleCount); + auto jph_batch = reinterpret_cast(c_batch); + return jph_batch; + } + virtual JPH::DebugRenderer::Batch CreateTriangleBatch( + const JPH::DebugRenderer::Vertex *inVertices, + int inVertexCount, + const uint32_t *inIndices, + int inIndexCount) override + { + JPC_DebugRenderer_TriangleBatch *c_batch = c_renderer->vtbl->CreateTriangleBatchIndexed( + c_renderer, + toJpc(inVertices), + inVertexCount, + inIndices, + inIndexCount); + auto jph_batch = reinterpret_cast(c_batch); + return jph_batch; + } + virtual void DrawGeometry( + JPH::RMat44Arg inModelMatrix, + const JPH::AABox &inWorldSpaceBounds, + float inLODScaleSq, + JPH::ColorArg inModelColor, + const JPH::DebugRenderer::GeometryRef &inGeometry, + JPH::DebugRenderer::ECullMode inCullMode, + JPH::DebugRenderer::ECastShadow inCastShadow, + JPH::DebugRenderer::EDrawMode inDrawMode) override + { + float in_model_matrix[16]; // Model matrix will always be rounded to floats (JPH samples assume the same). + storeMat44(in_model_matrix, inModelMatrix.ToMat44()); + JPC_DebugRenderer_Geometry in_geometry { + toJpc(&inGeometry.GetPtr()->mLODs[0]), + static_cast(inGeometry.GetPtr()->mLODs.size()), + toJpc(&inGeometry.GetPtr()->mBounds) + }; + c_renderer->vtbl->DrawGeometry( + c_renderer, + in_model_matrix, + toJpc(&inWorldSpaceBounds), + inLODScaleSq, + *toJpc(&inModelColor), + &in_geometry, + static_cast(inCullMode), + static_cast(inCastShadow), + static_cast(inDrawMode)); + } + virtual void DrawText3D( + JPH::RVec3Arg inPosition, + const std::string_view &inString, + JPH::ColorArg inColor, + float inHeight) override + { + JPC_Real in_position[3]; + storeRVec3(in_position, inPosition); + c_renderer->vtbl->DrawText3D( + c_renderer, + in_position, + std::string(inString).c_str(), + *toJpc(&inColor), + inHeight); + } +}; +DebugRendererImpl *DebugRendererImpl::sInstance = nullptr; +//-------------------------------------------------------------------------------------------------- +JPC_API JPC_DebugRendererResult +JPC_CreateDebugRendererSingleton(void *in_debug_renderer) +{ + assert(JPH::DebugRenderer::sInstance == nullptr); //Only one instance of JPH::DebugRenderer may ever be made + if (JPH::DebugRenderer::sInstance != nullptr) return JPC_DEBUGRENDERER_DUPLICATE_SINGLETON; //No assert in release + DebugRendererImpl::sInstance = + new DebugRendererImpl(reinterpret_cast(in_debug_renderer)); + // At this point, a pointer to the created instance is also kept in JPH::DebugRenderer::sInstance. + return DebugRendererImpl::sInstance->ValidateCallbacks(); +} + +JPC_API JPC_DebugRendererResult +JPC_DestroyDebugRendererSingleton() +{ + assert(JPH::DebugRenderer::sInstance != nullptr); //The singleton must have already been instantiated + if (JPH::DebugRenderer::sInstance == nullptr) return JPC_DEBUGRENDERER_MISSING_SINGLETON; //No assert in release + delete DebugRendererImpl::sInstance; + return JPC_DEBUGRENDERER_SUCCESS; +} + +JPC_API JPC_DebugRenderer_TriangleBatch * +JPC_DebugRenderer_TriangleBatch_Create(const void *in_c_primitive) +{ + auto batch = static_cast(JPH::Allocate(sizeof(DebugRendererImpl::BatchImpl))); + ::new (batch) DebugRendererImpl::BatchImpl(reinterpret_cast(in_c_primitive)); + return reinterpret_cast(batch); +} + +JPC_API const JPC_DebugRenderer_Primitive * +JPC_DebugRenderer_TriangleBatch_GetPrimitive(const JPC_DebugRenderer_TriangleBatch * in_batch) +{ + auto fat_batch = reinterpret_cast(in_batch); + return fat_batch->GetPrimitive(); +} + +JPC_API void +JPC_DebugRenderer_TriangleBatch_AddRef(JPC_DebugRenderer_TriangleBatch *in_batch) +{ + assert(in_batch); + reinterpret_cast(in_batch)->AddRef(); +} + +JPC_API void +JPC_DebugRenderer_TriangleBatch_Release(JPC_DebugRenderer_TriangleBatch *in_batch) +{ + assert(in_batch); + reinterpret_cast(in_batch)->Release(); +} + +JPC_API uint32_t +JPC_DebugRenderer_TriangleBatch_GetRefCount(const JPC_DebugRenderer_TriangleBatch *in_batch) +{ + assert(in_batch); + return reinterpret_cast(in_batch)->GetRefCount(); +} +#endif //JPC_DEBUG_RENDERER + struct PhysicsSystemData { uint64_t safety_token = 0xC0DEC0DEC0DEC0DE; @@ -1168,99 +957,41 @@ JPC_PhysicsSystem_GetContactListener(const JPC_PhysicsSystem *in_physics_system) return listener->c_listener; } //-------------------------------------------------------------------------------------------------- -// TODO this is way too complicated for my limited C++ knowledge -//class ContactCombineFunctor { -//public: -// explicit ContactCombineFunctor(float (*fn)( -// const JPC_Body *, -// const JPC_SubShapeID, -// const JPC_Body *, -// const JPC_SubShapeID)) : mFn(fn) {} -// -// float operator () ( -// const JPH::Body &inBody1, -// const JPH::SubShapeID &inSubShapeID1, -// const JPH::Body &inBody2, -// const JPH::SubShapeID &inSubShapeID2 -// ) { -// return mFn(toJpc(&inBody1), toJpc(inSubShapeID1), toJpc(&inBody2), toJpc(inSubShapeID2)); -// } -// -// JPH::ContactConstraintManager::CombineFunction thing() { -// return [this]( -// const JPH::Body &inBody1, -// const JPH::SubShapeID &inSubShapeID1, -// const JPH::Body &inBody2, -// const JPH::SubShapeID &inSubShapeID2 -// ) -> float { -// return mFn(toJpc(&inBody1), toJpc(inSubShapeID1), toJpc(&inBody2), toJpc(inSubShapeID2)); -// } -// } -// -//private: -// float (*mFn)(const JPC_Body *, const JPC_SubShapeID, const JPC_Body *, const JPC_SubShapeID); -//}; -// -//JPC_API void -//JPC_PhysicsSystem_SetCombineFriction(JPC_PhysicsSystem *in_physics_system, -// const JPC_CombineFunctor *in_combine) -//{ -// ContactCombineFunctor functor(in_combine->fn); -// toJph(in_physics_system)->SetCombineFriction(functor); -//} -//class CombineFunctor { -//public: -// explicit CombineFunctor(float (*mCombine)(const JPC_Body *in_body_1, -// const JPC_SubShapeID in_sub_shape_id_1, -// const JPC_Body *in_body_2, -// const JPC_SubShapeID in_sub_shape_id_2)) : mCombine(mCombine) {} -// -// float operator() (const JPH::Body &inBody1, -// const JPH::SubShapeID &inSubShapeID1, -// const JPH::Body &inBody2, -// const JPH::SubShapeID &inSubShapeID2) const { -// return mCombine(toJpc(&inBody1), toJpc(inSubShapeID1), toJpc(&inBody2), toJpc(inSubShapeID2)); -// } -//private: -// float -// (*mCombine)(const JPC_Body *in_body_1, -// const JPC_SubShapeID in_sub_shape_id_1, -// const JPC_Body *in_body_2, -// const JPC_SubShapeID in_sub_shape_id_2); -//}; -// -//JPC_API void -//JPC_PhysicsSystem_SetCombineFriction(JPC_PhysicsSystem *in_physics_system, -// float -// (*in_combine)(const JPC_Body *in_body_1, -// JPC_SubShapeID in_sub_shape_id_1, -// const JPC_Body *in_body_2, -// JPC_SubShapeID in_sub_shape_id_2)) -//{ -// CombineFunctor fn(in_combine); -// -// auto function = reinterpret_cast(&CombineFunctor::operator()); -// toJph(in_physics_system)->SetCombineFriction(function); -//} +#if JPC_DEBUG_RENDERER == 1 +JPC_API void +JPC_PhysicsSystem_DrawBodies(JPC_PhysicsSystem *in_physics_system, + const JPC_BodyManager_DrawSettings *in_draw_settings, + const JPC_BodyDrawFilter *in_draw_filter = nullptr) +{ + // It's weird that JPH has both a singleton DebugRenderer and a DebugRenderer pointer passed into + // some of the draw functions. The pointer should always be the singleton instance, right? + assert(JPH::DebugRenderer::sInstance != nullptr); + const JPH::BodyManager::DrawSettings *settings = toJph(in_draw_settings); + const JPH::BodyDrawFilter *filter = (in_draw_filter != nullptr) ? toJph(in_draw_filter) : nullptr; + toJph(in_physics_system)->DrawBodies(*settings, JPH::DebugRenderer::sInstance, filter); +} //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_PhysicsSystem_SetPhysicsSettings(JPC_PhysicsSystem *in_physics_system, - const JPC_PhysicsSettings *in_settings) +JPC_PhysicsSystem_DrawConstraints(JPC_PhysicsSystem *in_physics_system) { - toJph(in_physics_system)->SetPhysicsSettings(*toJph(in_settings)); + assert(JPH::DebugRenderer::sInstance != nullptr); + toJph(in_physics_system)->DrawConstraints(JPH::DebugRenderer::sInstance); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_PhysicsSystem_GetPhysicsSettings(const JPC_PhysicsSystem *in_physics_system, - JPC_PhysicsSettings *out_settings) +JPC_PhysicsSystem_DrawConstraintLimits(JPC_PhysicsSystem *in_physics_system) { - const auto out = toJph(in_physics_system)->GetPhysicsSettings(); - *out_settings = *toJpc(&out); + assert(JPH::DebugRenderer::sInstance != nullptr); + toJph(in_physics_system)->DrawConstraintLimits(JPH::DebugRenderer::sInstance); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_PhysicsSystem_SetCombineRestitution(JPC_PhysicsSystem *in_physics_system, - float (*in_combine)(const JPC_Body *in_body_1, JPC_SubShapeID in_sub_shape_id_1, JPC_Body *in_body_2, JPC_SubShapeID in_sub_shape_id_2)); +JPC_PhysicsSystem_DrawConstraintReferenceFrame(JPC_PhysicsSystem *in_physics_system) +{ + assert(JPH::DebugRenderer::sInstance != nullptr); + toJph(in_physics_system)->DrawConstraintReferenceFrame(JPH::DebugRenderer::sInstance); +} +#endif //JPC_DEBUG_RENDERER //-------------------------------------------------------------------------------------------------- JPC_API uint32_t JPC_PhysicsSystem_GetNumBodies(const JPC_PhysicsSystem *in_physics_system) @@ -1280,34 +1011,6 @@ JPC_PhysicsSystem_GetMaxBodies(const JPC_PhysicsSystem *in_physics_system) return toJph(in_physics_system)->GetMaxBodies(); } //-------------------------------------------------------------------------------------------------- -JPC_API JPC_BodyIDVector * -JPC_PhysicsSystem_GetBodyIDs(const JPC_PhysicsSystem *in_physics_system, - uint32_t *out_num_body_ids, - JPC_BodyID **out_body_ids) -{ - auto out = new JPH::BodyIDVector(); - toJph(in_physics_system)->GetBodies(*out); - auto size = out->size(); - *out_num_body_ids = size; - if (size > 0) - *out_body_ids = toJpc(out->data()); - return reinterpret_cast(out); -} -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_BodyIDVector * -JPC_PhysicsSystem_GetActiveBodyIDs(const JPC_PhysicsSystem *in_physics_system, - uint32_t *out_num_body_ids, - JPC_BodyID **out_body_ids) -{ - auto out = new JPH::BodyIDVector(); - toJph(in_physics_system)->GetActiveBodies(*out); - auto size = out->size(); - *out_num_body_ids = size; - if (size > 0) - *out_body_ids = toJpc(out->data()); - return reinterpret_cast(out); -} -//-------------------------------------------------------------------------------------------------- JPC_API void JPC_PhysicsSystem_GetGravity(const JPC_PhysicsSystem *in_physics_system, float out_gravity[3]) { @@ -1332,6 +1035,40 @@ JPC_PhysicsSystem_GetBodyInterfaceNoLock(JPC_PhysicsSystem *in_physics_system) } //-------------------------------------------------------------------------------------------------- JPC_API void +JPC_PhysicsSystem_OptimizeBroadPhase(JPC_PhysicsSystem *in_physics_system) +{ + toJph(in_physics_system)->OptimizeBroadPhase(); +} +//-------------------------------------------------------------------------------------------------- +JPC_API void +JPC_PhysicsSystem_AddStepListener(JPC_PhysicsSystem *in_physics_system, void *in_listener) +{ + assert(in_listener != nullptr); + toJph(in_physics_system)->AddStepListener(static_cast(in_listener)); +} +//-------------------------------------------------------------------------------------------------- +JPC_API void +JPC_PhysicsSystem_RemoveStepListener(JPC_PhysicsSystem *in_physics_system, void *in_listener) +{ + assert(in_listener != nullptr); + toJph(in_physics_system)->RemoveStepListener(static_cast(in_listener)); +} +//-------------------------------------------------------------------------------------------------- +JPC_API void +JPC_PhysicsSystem_AddConstraint(JPC_PhysicsSystem *in_physics_system, void *in_two_body_constraint) +{ + assert(in_two_body_constraint != nullptr); + toJph(in_physics_system)->AddConstraint(static_cast(in_two_body_constraint)); +} +//-------------------------------------------------------------------------------------------------- +JPC_API void +JPC_PhysicsSystem_RemoveConstraint(JPC_PhysicsSystem *in_physics_system, void *in_two_body_constraint) +{ + assert(in_two_body_constraint != nullptr); + toJph(in_physics_system)->RemoveConstraint(static_cast(in_two_body_constraint)); +} +//-------------------------------------------------------------------------------------------------- +JPC_API JPC_PhysicsUpdateError JPC_PhysicsSystem_Update(JPC_PhysicsSystem *in_physics_system, float in_delta_time, int in_collision_steps, @@ -1340,12 +1077,13 @@ JPC_PhysicsSystem_Update(JPC_PhysicsSystem *in_physics_system, JPC_JobSystem *in_job_system) { assert(in_temp_allocator != nullptr && in_job_system != nullptr); - toJph(in_physics_system)->Update( + JPC_PhysicsUpdateError error = (JPC_PhysicsUpdateError)toJph(in_physics_system)->Update( in_delta_time, in_collision_steps, in_integration_sub_steps, reinterpret_cast(in_temp_allocator), reinterpret_cast(in_job_system)); + return error; } //-------------------------------------------------------------------------------------------------- JPC_API const JPC_BodyLockInterface * @@ -1359,74 +1097,17 @@ JPC_PhysicsSystem_GetBodyLockInterfaceNoLock(const JPC_PhysicsSystem *in_physics return toJpc(&toJph(in_physics_system)->GetBodyLockInterfaceNoLock()); } //-------------------------------------------------------------------------------------------------- -JPC_API const JPC_BroadPhaseQuery * -JPC_PhysicsSystem_GetBroadPhaseQuery(const JPC_PhysicsSystem *in_physics_system) -{ - return toJpc(&toJph(in_physics_system)->GetBroadPhaseQuery()); -} -//-------------------------------------------------------------------------------------------------- JPC_API const JPC_NarrowPhaseQuery * JPC_PhysicsSystem_GetNarrowPhaseQuery(const JPC_PhysicsSystem *in_physics_system) { return toJpc(&toJph(in_physics_system)->GetNarrowPhaseQuery()); } -//-------------------------------------------------------------------------------------------------- JPC_API const JPC_NarrowPhaseQuery * JPC_PhysicsSystem_GetNarrowPhaseQueryNoLock(const JPC_PhysicsSystem *in_physics_system) { return toJpc(&toJph(in_physics_system)->GetNarrowPhaseQueryNoLock()); } //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_PhysicsSystem_AddConstraint(JPC_PhysicsSystem *in_physics_system, JPC_Constraint *in_constraint) -{ - toJph(in_physics_system)->AddConstraint(toJph(in_constraint)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_PhysicsSystem_RemoveConstraint(JPC_PhysicsSystem *in_physics_system, JPC_Constraint *in_constraint) -{ - toJph(in_physics_system)->RemoveConstraint(toJph(in_constraint)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_PhysicsSystem_AddConstraints(JPC_PhysicsSystem *in_physics_system, JPC_Constraint *in_constraints[], int in_number) -{ - toJph(in_physics_system)->AddConstraints(reinterpret_cast(in_constraints), in_number); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_PhysicsSystem_RemoveConstraints(JPC_PhysicsSystem *in_physics_system, JPC_Constraint *in_constraints[], int in_number) -{ - toJph(in_physics_system)->RemoveConstraints(reinterpret_cast(in_constraints), in_number); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_PhysicsSystem_OptimizeBroadPhase(JPC_PhysicsSystem *in_physics_system) -{ - toJph(in_physics_system)->OptimizeBroadPhase(); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_PhysicsSystem_AddStepListener(JPC_PhysicsSystem *in_physics_system, void *in_listener) -{ - toJph(in_physics_system)->AddStepListener(static_cast(in_listener)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_PhysicsSystem_RemoveStepListener(JPC_PhysicsSystem *in_physics_system, void *in_listener) -{ - toJph(in_physics_system)->RemoveStepListener(static_cast(in_listener)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API bool -JPC_PhysicsSystem_WereBodiesInContact(const JPC_PhysicsSystem *in_physics_system, - JPC_BodyID in_body_id1, - JPC_BodyID in_body_id2) -{ - return toJph(in_physics_system)->WereBodiesInContact(toJph(in_body_id1), toJph(in_body_id2)); -} -//-------------------------------------------------------------------------------------------------- // // JPC_BodyLockInterface // @@ -1468,602 +1149,66 @@ JPC_BodyLockInterface_UnlockWrite(const JPC_BodyLockInterface *in_lock_interface } //-------------------------------------------------------------------------------------------------- // -// (collector structs) +// JPC_NarrowPhaseQuery // //-------------------------------------------------------------------------------------------------- -// note: it doesn't matter what type we cast to, as long as it's a template of JPH::CollisionCollector -JPC_API void -JPC_CollisionCollector_Reset(void *in_collector) +JPC_API bool +JPC_NarrowPhaseQuery_CastRay(const JPC_NarrowPhaseQuery *in_query, + const JPC_RRayCast *in_ray, + JPC_RayCastResult *io_hit, + const void *in_broad_phase_layer_filter, + const void *in_object_layer_filter, + const void *in_body_filter) { - static_cast(in_collector)->Reset(); + assert(in_query && in_ray && io_hit); + + const JPH::BroadPhaseLayerFilter broad_phase_layer_filter{}; + const JPH::ObjectLayerFilter object_layer_filter{}; + const JPH::BodyFilter body_filter{}; + + auto query = reinterpret_cast(in_query); + return query->CastRay( + *reinterpret_cast(in_ray), + *reinterpret_cast(io_hit), + in_broad_phase_layer_filter ? + *static_cast(in_broad_phase_layer_filter) : + broad_phase_layer_filter, + in_object_layer_filter ? + *static_cast(in_object_layer_filter) : object_layer_filter, + in_body_filter ? + *static_cast(in_body_filter) : body_filter); } //-------------------------------------------------------------------------------------------------- +// +// JPC_ShapeSettings +// +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_CollisionCollector_UpdateEarlyOutFraction(void *in_collector, float in_fraction) +JPC_ShapeSettings_AddRef(JPC_ShapeSettings *in_settings) { - static_cast(in_collector)->UpdateEarlyOutFraction(in_fraction); + toJph(in_settings)->AddRef(); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_CollisionCollector_ResetEarlyOutFraction(void *in_collector, float in_fraction) +JPC_ShapeSettings_Release(JPC_ShapeSettings *in_settings) { - static_cast(in_collector)->ResetEarlyOutFraction(in_fraction); + toJph(in_settings)->Release(); } //-------------------------------------------------------------------------------------------------- -// -// (RayCastBodyCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_RayCastBodyCollector_ForceEarlyOut(void *in_collector) +JPC_API uint32_t +JPC_ShapeSettings_GetRefCount(const JPC_ShapeSettings *in_settings) { - static_cast(in_collector)->ForceEarlyOut(); + return toJph(in_settings)->GetRefCount(); } - -JPC_API bool -JPC_RayCastBodyCollector_ShouldEarlyOut(void *in_collector) +//-------------------------------------------------------------------------------------------------- +JPC_API JPC_Shape * +JPC_ShapeSettings_CreateShape(const JPC_ShapeSettings *in_settings) { - return static_cast(in_collector)->ShouldEarlyOut(); -} -//-------------------------------------------------------------------------------------------------- -// -// (CollideShapeBodyCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CollideShapeBodyCollector_ForceEarlyOut(void *in_collector) -{ - static_cast(in_collector)->ForceEarlyOut(); -} - -JPC_API bool -JPC_CollideShapeBodyCollector_ShouldEarlyOut(void *in_collector) -{ - return static_cast(in_collector)->ShouldEarlyOut(); -} -//-------------------------------------------------------------------------------------------------- -// -// (CastShapeBodyCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CastShapeBodyCollector_ForceEarlyOut(void *in_collector) -{ - static_cast(in_collector)->ForceEarlyOut(); -} - -JPC_API bool -JPC_CastShapeBodyCollector_ShouldEarlyOut(void *in_collector) -{ - return static_cast(in_collector)->ShouldEarlyOut(); -} -//-------------------------------------------------------------------------------------------------- -// -// (CastRayCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CastRayCollector_ForceEarlyOut(void *in_collector) -{ - static_cast(in_collector)->ForceEarlyOut(); -} - -JPC_API bool -JPC_CastRayCollector_ShouldEarlyOut(void *in_collector) -{ - return static_cast(in_collector)->ShouldEarlyOut(); -} -//-------------------------------------------------------------------------------------------------- -// -// (CastShapeCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CastShapeCollector_ForceEarlyOut(void *in_collector) -{ - static_cast(in_collector)->ForceEarlyOut(); -} - -JPC_API bool -JPC_CastShapeCollector_ShouldEarlyOut(void *in_collector) -{ - return static_cast(in_collector)->ShouldEarlyOut(); -} -//-------------------------------------------------------------------------------------------------- -// -// (CollidePointCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CollidePointCollector_ForceEarlyOut(void *in_collector) -{ - static_cast(in_collector)->ForceEarlyOut(); -} - -JPC_API bool -JPC_CollidePointCollector_ShouldEarlyOut(void *in_collector) -{ - return static_cast(in_collector)->ShouldEarlyOut(); -} -//-------------------------------------------------------------------------------------------------- -// -// (CollideShapeCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CollideShapeCollector_ForceEarlyOut(void *in_collector) -{ - static_cast(in_collector)->ForceEarlyOut(); -} - -JPC_API bool -JPC_CollideShapeCollector_ShouldEarlyOut(void *in_collector) -{ - return static_cast(in_collector)->ShouldEarlyOut(); -} -//-------------------------------------------------------------------------------------------------- -// -// (TransformedShapeCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_TransformedShapeCollector_ForceEarlyOut(void *in_collector) -{ - static_cast(in_collector)->ForceEarlyOut(); -} - -JPC_API bool -JPC_TransformedShapeCollector_ShouldEarlyOut(void *in_collector) -{ - return static_cast(in_collector)->ShouldEarlyOut(); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_BroadPhaseQuery -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BroadPhaseQuery_CastRay(const JPC_BroadPhaseQuery *in_query, - const JPC_RayCast *in_ray, - void *io_collector, - const void *in_broad_phase_layer_filter, - const void *in_object_layer_filter) -{ - auto collector = static_cast(io_collector); - collector->Reset(); - const JPH::BroadPhaseLayerFilter broad_phase_layer_filter{}; - const JPH::ObjectLayerFilter object_layer_filter{}; - - toJph(in_query)->CastRay( - *toJph(in_ray), - *collector, - in_broad_phase_layer_filter - ? *static_cast(in_broad_phase_layer_filter) - : broad_phase_layer_filter, - in_object_layer_filter - ? *static_cast(in_object_layer_filter) - : object_layer_filter); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BroadPhaseQuery_CollideAABox(const JPC_BroadPhaseQuery *in_query, - const JPC_AABox *in_box, - void *io_collector, - const void *in_broad_phase_layer_filter, - const void *in_object_layer_filter) -{ - auto collector = static_cast(io_collector); - collector->Reset(); - const JPH::BroadPhaseLayerFilter broad_phase_layer_filter{}; - const JPH::ObjectLayerFilter object_layer_filter{}; - - toJph(in_query)->CollideAABox( - *toJph(in_box), - *collector, - in_broad_phase_layer_filter - ? *static_cast(in_broad_phase_layer_filter) - : broad_phase_layer_filter, - in_object_layer_filter - ? *static_cast(in_object_layer_filter) - : object_layer_filter); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BroadPhaseQuery_CollideSphere(const JPC_BroadPhaseQuery *in_query, - const float in_center[3], - float in_radius, - void *io_collector, - const void *in_broad_phase_layer_filter, - const void *in_object_layer_filter) -{ - auto collector = static_cast(io_collector); - collector->Reset(); - const JPH::BroadPhaseLayerFilter broad_phase_layer_filter{}; - const JPH::ObjectLayerFilter object_layer_filter{}; - - toJph(in_query)->CollideSphere( - loadVec3(in_center), - in_radius, - *collector, - in_broad_phase_layer_filter - ? *static_cast(in_broad_phase_layer_filter) - : broad_phase_layer_filter, - in_object_layer_filter - ? *static_cast(in_object_layer_filter) - : object_layer_filter); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BroadPhaseQuery_CollidePoint(const JPC_BroadPhaseQuery *in_query, - const float in_point[3], - void *io_collector, - const void *in_broad_phase_layer_filter, - const void *in_object_layer_filter) -{ - auto collector = static_cast(io_collector); - collector->Reset(); - const JPH::BroadPhaseLayerFilter broad_phase_layer_filter{}; - const JPH::ObjectLayerFilter object_layer_filter{}; - - toJph(in_query)->CollidePoint( - loadVec3(in_point), - *collector, - in_broad_phase_layer_filter - ? *static_cast(in_broad_phase_layer_filter) - : broad_phase_layer_filter, - in_object_layer_filter - ? *static_cast(in_object_layer_filter) - : object_layer_filter); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BroadPhaseQuery_CollideOrientedBox(const JPC_BroadPhaseQuery *in_query, - const JPC_OrientedBox *in_box, - void *io_collector, - const void *in_broad_phase_layer_filter, - const void *in_object_layer_filter) -{ - auto collector = static_cast(io_collector); - collector->Reset(); - const JPH::BroadPhaseLayerFilter broad_phase_layer_filter{}; - const JPH::ObjectLayerFilter object_layer_filter{}; - - toJph(in_query)->CollideOrientedBox( - *toJph(in_box), - *collector, - in_broad_phase_layer_filter - ? *static_cast(in_broad_phase_layer_filter) - : broad_phase_layer_filter, - in_object_layer_filter - ? *static_cast(in_object_layer_filter) - : object_layer_filter); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BroadPhaseQuery_CastAABox(const JPC_BroadPhaseQuery *in_query, - const JPC_AABoxCast *in_box, - void *io_collector, - const void *in_broad_phase_layer_filter, - const void *in_object_layer_filter) -{ - auto collector = static_cast(io_collector); - collector->Reset(); - const JPH::BroadPhaseLayerFilter broad_phase_layer_filter{}; - const JPH::ObjectLayerFilter object_layer_filter{}; - - toJph(in_query)->CastAABox( - *toJph(in_box), - *collector, - in_broad_phase_layer_filter - ? *static_cast(in_broad_phase_layer_filter) - : broad_phase_layer_filter, - in_object_layer_filter - ? *static_cast(in_object_layer_filter) - : object_layer_filter); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_NarrowPhaseQuery -// -//-------------------------------------------------------------------------------------------------- -JPC_API bool -JPC_NarrowPhaseQuery_GetCastRay(const JPC_NarrowPhaseQuery *in_query, - const JPC_RRayCast *in_ray, - JPC_RayCastResult *io_hit, - const void *in_broad_phase_layer_filter, - const void *in_object_layer_filter, - const void *in_body_filter) -{ - const JPH::BroadPhaseLayerFilter broad_phase_layer_filter{}; - const JPH::ObjectLayerFilter object_layer_filter{}; - const JPH::BodyFilter body_filter{}; - - return toJph(in_query)->CastRay( - *toJph(in_ray), - *toJph(io_hit), - in_broad_phase_layer_filter - ? *static_cast(in_broad_phase_layer_filter) - : broad_phase_layer_filter, - in_object_layer_filter - ? *static_cast(in_object_layer_filter) - : object_layer_filter, - in_body_filter - ? *static_cast(in_body_filter) - : body_filter); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_NarrowPhaseQuery_CollectCastRay(const JPC_NarrowPhaseQuery *in_query, - const JPC_RRayCast *in_ray, - const JPC_RayCastSettings *in_settings, - void *io_collector, - const void *in_broad_phase_layer_filter, - const void *in_object_layer_filter, - const void *in_body_filter, - const void *in_shape_filter) -{ - auto collector = static_cast(io_collector); - collector->Reset(); - const JPH::BroadPhaseLayerFilter broad_phase_layer_filter{}; - const JPH::ObjectLayerFilter object_layer_filter{}; - const JPH::BodyFilter body_filter{}; - const JPH::ShapeFilter shape_filter{}; - - toJph(in_query)->CastRay( - *toJph(in_ray), - *toJph(in_settings), - *collector, - in_broad_phase_layer_filter - ? *static_cast(in_broad_phase_layer_filter) - : broad_phase_layer_filter, - in_object_layer_filter - ? *static_cast(in_object_layer_filter) - : object_layer_filter, - in_body_filter - ? *static_cast(in_body_filter) - : body_filter); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_NarrowPhaseQuery_CollidePoint(const JPC_NarrowPhaseQuery *in_query, - const JPC_Real in_point[3], - void *io_collector, - const void *in_broad_phase_layer_filter, - const void *in_object_layer_filter, - const void *in_body_filter, - const void *in_shape_filter) -{ - auto collector = static_cast(io_collector); - collector->Reset(); - const JPH::BroadPhaseLayerFilter broad_phase_layer_filter{}; - const JPH::ObjectLayerFilter object_layer_filter{}; - const JPH::BodyFilter body_filter{}; - const JPH::ShapeFilter shape_filter{}; - - toJph(in_query)->CollidePoint( - loadRVec3(in_point), - *collector, - in_broad_phase_layer_filter - ? *static_cast(in_broad_phase_layer_filter) - : broad_phase_layer_filter, - in_object_layer_filter - ? *static_cast(in_object_layer_filter) - : object_layer_filter, - in_body_filter - ? *static_cast(in_body_filter) - : body_filter); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_NarrowPhaseQuery_CollideShape(const JPC_NarrowPhaseQuery *in_query, - const JPC_Shape *in_shape, - const float in_shape_scale[3], - const float in_com_rotation[9], - const JPC_Real in_com_translation[3], - const JPC_CollideShapeSettings *in_settings, - const JPC_Real in_base_offset[3], - void *io_collector, - const void *in_broad_phase_layer_filter, - const void *in_object_layer_filter, - const void *in_body_filter, - const void *in_shape_filter) -{ - auto collector = static_cast(io_collector); - collector->Reset(); - const JPH::BroadPhaseLayerFilter broad_phase_layer_filter{}; - const JPH::ObjectLayerFilter object_layer_filter{}; - const JPH::BodyFilter body_filter{}; - const JPH::ShapeFilter shape_filter{}; - - toJph(in_query)->CollideShape( - toJph(in_shape), - loadVec3(in_shape_scale), - loadRMat44(in_com_rotation, in_com_translation), - *toJph(in_settings), - loadRVec3(in_base_offset), - *collector, - in_broad_phase_layer_filter - ? *static_cast(in_broad_phase_layer_filter) - : broad_phase_layer_filter, - in_object_layer_filter - ? *static_cast(in_object_layer_filter) - : object_layer_filter, - in_body_filter - ? *static_cast(in_body_filter) - : body_filter); -} -//-------------------------------------------------------------------------------------------------- -// TODO -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_NarrowPhaseQuery_CollectTransformedShapes(const JPC_NarrowPhaseQuery *in_query, - const JPC_AABox *in_box, - void *io_collector, - const void *in_broad_phase_layer_filter, - const void *in_object_layer_filter, - const void *in_body_filter, - const void *in_shape_filter) -{ - auto collector = static_cast(io_collector); - collector->Reset(); - const JPH::BroadPhaseLayerFilter broad_phase_layer_filter{}; - const JPH::ObjectLayerFilter object_layer_filter{}; - const JPH::BodyFilter body_filter{}; - const JPH::ShapeFilter shape_filter{}; - - toJph(in_query)->CollectTransformedShapes( - *toJph(in_box), - *collector, - in_broad_phase_layer_filter - ? *static_cast(in_broad_phase_layer_filter) - : broad_phase_layer_filter, - in_object_layer_filter - ? *static_cast(in_object_layer_filter) - : object_layer_filter, - in_body_filter - ? *static_cast(in_body_filter) - : body_filter); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_SphereShape (-> JPC_ConvexShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_SphereShape * -JPC_SphereShape_Create(float in_radius, const JPC_PhysicsMaterial *in_material) -{ - auto result = new JPH::SphereShape(in_radius, toJph(in_material)); - result->AddRef(); - return toJpc(result); -} - -JPC_API float -JPC_SphereShape_GetRadius(const JPC_SphereShape *in_shape) -{ - return toJph(in_shape)->GetRadius(); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_BoxShape (-> JPC_ConvexShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_BoxShape * -JPC_BoxShape_Create(const float in_half_extent[3], float in_convex_radius, const JPC_PhysicsMaterial *in_material) -{ - auto result = new JPH::BoxShape(loadVec3(in_half_extent), in_convex_radius, toJph(in_material)); - result->AddRef(); - return toJpc(result); -} - -JPC_API void -JPC_BoxShape_GetHalfExtent(const JPC_BoxShape *in_shape, float out_half_extent[3]) -{ - storeVec3(out_half_extent, toJph(in_shape)->GetHalfExtent()); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_TriangleShape (-> JPC_ConvexShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_TriangleShape * -JPC_TriangleShape_Create(const float in_v1[3], - const float in_v2[3], - const float in_v3[3], - float in_convex_radius, - const JPC_PhysicsMaterial *in_material) -{ - auto result = new JPH::TriangleShape(loadVec3(in_v1), loadVec3(in_v2), loadVec3(in_v3), in_convex_radius, toJph(in_material)); - result->AddRef(); - return toJpc(result); -} - -JPC_API float -JPC_TriangleShape_GetConvexRadius(const JPC_TriangleShape *in_shape) -{ - return toJph(in_shape)->GetConvexRadius(); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_CapsuleShape (-> JPC_ConvexShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_CapsuleShape * -JPC_CapsuleShape_Create(float in_half_height_of_cylinder, - float in_radius, - const JPC_PhysicsMaterial *in_material) -{ - auto result = new JPH::CapsuleShape(in_half_height_of_cylinder, in_radius, toJph(in_material)); - result->AddRef(); - return toJpc(result); -} - -JPC_API float -JPC_CapsuleShape_GetRadius(const JPC_CapsuleShape *in_shape) -{ - return toJph(in_shape)->GetRadius(); -} - -JPC_API float -JPC_CapsuleShape_GetHalfHeightOfCylinder(const JPC_CapsuleShape *in_shape) -{ - return toJph(in_shape)->GetHalfHeightOfCylinder(); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_CylinderShape (-> JPC_ConvexShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_CylinderShape * -JPC_CylinderShape_Create(float in_half_height, - float in_radius, - float in_convex_radius, - const JPC_PhysicsMaterial *in_material) -{ - auto result = new JPH::CylinderShape(in_half_height, in_radius, in_convex_radius, toJph(in_material)); - result->AddRef(); - return toJpc(result); -} - -JPC_API float -JPC_CylinderShape_GetHalfHeight(const JPC_CylinderShape *in_shape) -{ - return toJph(in_shape)->GetHalfHeight(); -} - -JPC_API float -JPC_CylinderShape_GetRadius(const JPC_CylinderShape *in_shape) -{ - return toJph(in_shape)->GetRadius(); - -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_ShapeSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_ShapeSettings_AddRef(JPC_ShapeSettings *in_settings) -{ - toJph(in_settings)->AddRef(); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_ShapeSettings_Release(JPC_ShapeSettings *in_settings) -{ - toJph(in_settings)->Release(); -} -//-------------------------------------------------------------------------------------------------- -JPC_API uint32_t -JPC_ShapeSettings_GetRefCount(const JPC_ShapeSettings *in_settings) -{ - return toJph(in_settings)->GetRefCount(); -} -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_ShapeResult -JPC_ShapeSettings_CreateShape(const JPC_ShapeSettings *in_settings) -{ - const auto result = toJph(in_settings)->Create(); - return toJpc(result); + const JPH::Result result = toJph(in_settings)->Create(); + if (result.HasError()) return nullptr; + JPH::Shape *shape = const_cast(result.Get().GetPtr()); + shape->AddRef(); + return toJpc(shape); } //-------------------------------------------------------------------------------------------------- JPC_API uint64_t @@ -2113,9 +1258,9 @@ JPC_ConvexShapeSettings_SetDensity(JPC_ConvexShapeSettings *in_settings, float i // //-------------------------------------------------------------------------------------------------- JPC_API JPC_BoxShapeSettings * -JPC_BoxShapeSettings_Create(const float in_half_extent[3], float in_convex_radius, const JPC_PhysicsMaterial *in_material) +JPC_BoxShapeSettings_Create(const float in_half_extent[3]) { - auto settings = new JPH::BoxShapeSettings(loadVec3(in_half_extent), in_convex_radius, toJph(in_material)); + auto settings = new JPH::BoxShapeSettings(loadVec3(in_half_extent)); settings->AddRef(); return toJpc(settings); } @@ -2149,9 +1294,9 @@ JPC_BoxShapeSettings_SetConvexRadius(JPC_BoxShapeSettings *in_settings, float in // //-------------------------------------------------------------------------------------------------- JPC_API JPC_SphereShapeSettings * -JPC_SphereShapeSettings_Create(float in_radius, const JPC_PhysicsMaterial *in_material) +JPC_SphereShapeSettings_Create(float in_radius) { - auto settings = new JPH::SphereShapeSettings(in_radius, toJph(in_material)); + auto settings = new JPH::SphereShapeSettings(in_radius); settings->AddRef(); return toJpc(settings); } @@ -2173,13 +1318,9 @@ JPC_SphereShapeSettings_SetRadius(JPC_SphereShapeSettings *in_settings, float in // //-------------------------------------------------------------------------------------------------- JPC_API JPC_TriangleShapeSettings * -JPC_TriangleShapeSettings_Create(const float in_v1[3], - const float in_v2[3], - const float in_v3[3], - float in_convex_radius, - const JPC_PhysicsMaterial *in_material) +JPC_TriangleShapeSettings_Create(const float in_v1[3], const float in_v2[3], const float in_v3[3]) { - auto settings = new JPH::TriangleShapeSettings(loadVec3(in_v1), loadVec3(in_v2), loadVec3(in_v3), in_convex_radius, toJph(in_material)); + auto settings = new JPH::TriangleShapeSettings(loadVec3(in_v1), loadVec3(in_v2), loadVec3(in_v3)); settings->AddRef(); return toJpc(settings); } @@ -2225,11 +1366,9 @@ JPC_TriangleShapeSettings_SetConvexRadius(JPC_TriangleShapeSettings *in_settings // //-------------------------------------------------------------------------------------------------- JPC_API JPC_CapsuleShapeSettings * -JPC_CapsuleShapeSettings_Create(float in_half_height_of_cylinder, - float in_radius, - const JPC_PhysicsMaterial *in_material) +JPC_CapsuleShapeSettings_Create(float in_half_height_of_cylinder, float in_radius) { - auto settings = new JPH::CapsuleShapeSettings(in_half_height_of_cylinder, in_radius, toJph(in_material)); + auto settings = new JPH::CapsuleShapeSettings(in_half_height_of_cylinder, in_radius); settings->AddRef(); return toJpc(settings); } @@ -2264,12 +1403,9 @@ JPC_CapsuleShapeSettings_SetRadius(JPC_CapsuleShapeSettings *in_settings, float // //-------------------------------------------------------------------------------------------------- JPC_API JPC_TaperedCapsuleShapeSettings * -JPC_TaperedCapsuleShapeSettings_Create(float in_half_height, - float in_top_radius, - float in_bottom_radius, - const JPC_PhysicsMaterial *in_material) +JPC_TaperedCapsuleShapeSettings_Create(float in_half_height, float in_top_radius, float in_bottom_radius) { - auto settings = new JPH::TaperedCapsuleShapeSettings(in_half_height, in_top_radius, in_bottom_radius, toJph(in_material)); + auto settings = new JPH::TaperedCapsuleShapeSettings(in_half_height, in_top_radius, in_bottom_radius); settings->AddRef(); return toJpc(settings); } @@ -2317,12 +1453,9 @@ JPC_TaperedCapsuleShapeSettings_SetBottomRadius(JPC_TaperedCapsuleShapeSettings // //-------------------------------------------------------------------------------------------------- JPC_API JPC_CylinderShapeSettings * -JPC_CylinderShapeSettings_Create(float in_half_height, - float in_radius, - float in_convex_radius, - const JPC_PhysicsMaterial *in_material) +JPC_CylinderShapeSettings_Create(float in_half_height, float in_radius) { - auto settings = new JPH::CylinderShapeSettings(in_half_height, in_radius, in_convex_radius, toJph(in_material)); + auto settings = new JPH::CylinderShapeSettings(in_half_height, in_radius); settings->AddRef(); return toJpc(settings); } @@ -2368,11 +1501,7 @@ JPC_CylinderShapeSettings_SetRadius(JPC_CylinderShapeSettings *in_settings, floa // //-------------------------------------------------------------------------------------------------- JPC_API JPC_ConvexHullShapeSettings * -JPC_ConvexHullShapeSettings_Create(const void *in_vertices, - uint32_t in_num_vertices, - uint32_t in_vertex_size, - float in_convex_radius, - const JPC_PhysicsMaterial *in_material) +JPC_ConvexHullShapeSettings_Create(const void *in_vertices, uint32_t in_num_vertices, uint32_t in_vertex_size) { assert(in_vertices && in_num_vertices >= 3); assert(in_vertex_size >= 3 * sizeof(float)); @@ -2386,7 +1515,7 @@ JPC_ConvexHullShapeSettings_Create(const void *in_vertices, points.push_back(loadVec3(reinterpret_cast(base))); } - auto settings = new JPH::ConvexHullShapeSettings(points, in_convex_radius, toJph(in_material)); + auto settings = new JPH::ConvexHullShapeSettings(points); settings->AddRef(); return toJpc(settings); } @@ -2435,32 +1564,11 @@ JPC_ConvexHullShapeSettings_SetHullTolerance(JPC_ConvexHullShapeSettings *in_set // //-------------------------------------------------------------------------------------------------- JPC_API JPC_HeightFieldShapeSettings * -JPC_HeightFieldShapeSettings_Create(const float *in_samples, - uint32_t in_height_field_size, - float in_offset[3], - float in_scale[3], - const uint8_t *in_material_indices, - const JPC_PhysicsMaterial **in_materials, - uint32_t in_num_materials) +JPC_HeightFieldShapeSettings_Create(const float *in_samples, uint32_t in_height_field_size) { assert(in_samples != nullptr && in_height_field_size >= 2); - - JPH::PhysicsMaterialList materials; - materials.reserve(in_num_materials); - - for (uint32_t i = 0; i < in_num_materials; ++i) - { - materials.emplace_back(toJph(in_materials[i])); - } - auto settings = new JPH::HeightFieldShapeSettings( - in_samples, - loadVec3(in_offset), - loadVec3(in_scale), - in_height_field_size, - in_material_indices, - materials - ); + in_samples, JPH::Vec3(0,0,0), JPH::Vec3(1,1,1), in_height_field_size); settings->AddRef(); return toJpc(settings); } @@ -2522,23 +1630,21 @@ JPC_MeshShapeSettings_Create(const void *in_vertices, uint32_t in_num_vertices, uint32_t in_vertex_size, const uint32_t *in_indices, - uint32_t in_num_indices, - const JPC_PhysicsMaterial **in_materials, - uint32_t in_num_materials) + uint32_t in_num_indices) { assert(in_vertices && in_indices); assert(in_num_vertices >= 3); assert(in_vertex_size >= 3 * sizeof(float)); - assert(in_num_indices >= 4 && in_num_indices % 4 == 0); + assert(in_num_indices >= 3 && in_num_indices % 3 == 0); JPH::VertexList vertices; vertices.reserve(in_num_vertices); for (uint32_t i = 0; i < in_num_vertices; ++i) { - const auto *base = reinterpret_cast( + const float *base = reinterpret_cast( static_cast(in_vertices) + i * in_vertex_size); - vertices.emplace_back(base[0], base[1], base[2]); + vertices.push_back(JPH::Float3(base[0], base[1], base[2])); } JPH::IndexedTriangleList triangles; @@ -2546,19 +1652,11 @@ JPC_MeshShapeSettings_Create(const void *in_vertices, for (uint32_t i = 0; i < in_num_indices / 3; ++i) { - triangles.emplace_back( - in_indices[i * 3], in_indices[i * 3 + 1], in_indices[i * 3 + 2], in_indices[i * 3 + 3]); - } - - JPH::PhysicsMaterialList materials; - materials.reserve(in_num_materials); - - for (uint32_t i = 0; i < in_num_materials; ++i) - { - materials.emplace_back(toJph(in_materials[i])); + triangles.push_back( + JPH::IndexedTriangle(in_indices[i * 3], in_indices[i * 3 + 1], in_indices[i * 3 + 2], 0)); } - auto settings = new JPH::MeshShapeSettings(vertices, triangles, materials); + auto settings = new JPH::MeshShapeSettings(vertices, triangles); settings->AddRef(); return toJpc(settings); } @@ -2582,55 +1680,53 @@ JPC_MeshShapeSettings_Sanitize(JPC_MeshShapeSettings *in_settings) } //-------------------------------------------------------------------------------------------------- // -// JPC_CompoundShapeSettings (-> JPC_ShapeSettings) +// JPC_DecoratedShapeSettings (-> JPC_ShapeSettings) // //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CompoundShapeSettings_AddShapeSettings(JPC_CompoundShapeSettings *in_settings, - const float in_position[3], - const float in_rotation[4], - const JPC_ShapeSettings *in_shape, - uint32_t in_user_data) +JPC_API JPC_DecoratedShapeSettings * +JPC_RotatedTranslatedShapeSettings_Create(const JPC_ShapeSettings *in_inner_shape_settings, + const JPC_Real in_rotated[4], + const JPC_Real in_translated[3]) { - toJph(in_settings)->AddShape(loadVec3(in_position), loadQuat(in_rotation), toJph(in_shape), in_user_data); + auto settings = new JPH::RotatedTranslatedShapeSettings(loadRVec3(in_translated), + JPH::Quat(loadVec4(in_rotated)), + toJph(in_inner_shape_settings)); + settings->AddRef(); + return toJpc(settings); } //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CompoundShapeSettings_AddShape(JPC_CompoundShapeSettings *in_settings, - const float in_position[3], - const float in_rotation[4], - const JPC_Shape *in_shape, - uint32_t in_user_data) +JPC_API JPC_DecoratedShapeSettings * +JPC_ScaledShapeSettings_Create(const JPC_ShapeSettings *in_inner_shape_settings, + const JPC_Real in_scale[3]) +{ + auto settings = new JPH::ScaledShapeSettings(toJph(in_inner_shape_settings), loadRVec3(in_scale)); + settings->AddRef(); + return toJpc(settings); +} +//-------------------------------------------------------------------------------------------------- +JPC_API JPC_DecoratedShapeSettings * +JPC_OffsetCenterOfMassShapeSettings_Create(const JPC_ShapeSettings *in_inner_shape_settings, + const JPC_Real in_center_of_mass[3]) { - toJph(in_settings)->AddShape(loadVec3(in_position), loadQuat(in_rotation), toJph(in_shape), in_user_data); + auto settings = new JPH::OffsetCenterOfMassShapeSettings(loadRVec3(in_center_of_mass), + toJph(in_inner_shape_settings)); + settings->AddRef(); + return toJpc(settings); } //-------------------------------------------------------------------------------------------------- // -// JPC_StaticCompoundShapeSettings (-> JPC_CompoundShapeSettings -> JPC_ShapeSettings) +// JPC_CompoundShapeSettings (-> JPC_ShapeSettings) // - //-------------------------------------------------------------------------------------------------- -JPC_API JPC_StaticCompoundShapeSettings * +JPC_API JPC_CompoundShapeSettings * JPC_StaticCompoundShapeSettings_Create() { auto settings = new JPH::StaticCompoundShapeSettings(); settings->AddRef(); return toJpc(settings); } - -JPC_API JPC_ShapeResult -JPC_StaticCompoundShapeSettings_CreateShape(const JPC_StaticCompoundShapeSettings *in_settings, - JPC_TempAllocator *in_temp_allocator) -{ - auto result = toJph(in_settings)->Create(*toJph(in_temp_allocator)); - return toJpc(result); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_MutableCompoundShapeSettings (-> JPC_CompoundShapeSettings -> JPC_ShapeSettings) -// //-------------------------------------------------------------------------------------------------- -JPC_API JPC_MutableCompoundShapeSettings * +JPC_API JPC_CompoundShapeSettings * JPC_MutableCompoundShapeSettings_Create() { auto settings = new JPH::MutableCompoundShapeSettings(); @@ -2638,145 +1734,58 @@ JPC_MutableCompoundShapeSettings_Create() return toJpc(settings); } //-------------------------------------------------------------------------------------------------- +JPC_API void +JPC_CompoundShapeSettings_AddShape(JPC_CompoundShapeSettings *in_settings, + const JPC_Real in_position[3], + const JPC_Real in_rotation[4], + const JPC_ShapeSettings *in_shape, + const uint32_t in_user_data) +{ + toJph(in_settings)->AddShape(loadRVec3(in_position), + JPH::Quat(loadVec4(in_rotation)), + toJph(in_shape), + in_user_data); +} +//-------------------------------------------------------------------------------------------------- // -// JPC_DecoratedShapeSettings (-> JPC_ShapeSettings) +// JPC_BodyManager_DrawSettings // //-------------------------------------------------------------------------------------------------- -JPC_API const JPC_ShapeSettings * -JPC_DecoratedShapeSettings_GetInnerShape(const JPC_DecoratedShapeSettings *in_settings) +#if JPC_DEBUG_RENDERER == 1 +JPC_API JPC_BodyManager_DrawSettings * +JPC_BodyManager_DrawSettings_Create() { - return toJpc(toJph(in_settings)->mInnerShape); + auto settings = + static_cast + (JPH::Allocate(sizeof(JPH::BodyManager::DrawSettings))); + ::new (settings) JPH::BodyManager::DrawSettings(); + return toJpc(reinterpret_cast(settings)); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_DecoratedShapeSettings_SetInnerShape(JPC_DecoratedShapeSettings *in_settings, const JPC_ShapeSettings *in_shape) +JPC_BodyManager_DrawSettings_Destroy(JPC_BodyManager_DrawSettings *settings) { - toJph(in_settings)->mInnerShape = toJph(in_shape); -} -//-------------------------------------------------------------------------------------------------- -JPC_API const JPC_Shape * -JPC_DecoratedShapeSettings_GetInnerShapePtr(const JPC_DecoratedShapeSettings *in_settings) -{ - return toJpc(toJph(in_settings)->mInnerShapePtr); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_DecoratedShapeSettings_SetInnerShapePtr(JPC_DecoratedShapeSettings *in_settings, const JPC_Shape *in_shape) -{ - toJph(in_settings)->mInnerShapePtr = toJph(in_shape); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_ScaledShapeSettings (-> JPC_DecoratedShapeSettings -> JPC_ShapeSettings) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_ScaledShapeSettings * -JPC_ScaledShapeSettings_CreateFromShape(const JPC_Shape *in_shape, const float in_scale[3]) -{ - auto settings = new JPH::ScaledShapeSettings(toJph(in_shape), loadVec3(in_scale)); - settings->AddRef(); - return toJpc(settings); -} -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_ScaledShapeSettings * -JPC_ScaledShapeSettings_CreateFromSettings(const JPC_ShapeSettings *in_shape, const float in_scale[3]) -{ - auto settings = new JPH::ScaledShapeSettings(toJph(in_shape), loadVec3(in_scale)); - settings->AddRef(); - return toJpc(settings); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_ScaledShapeSettings_GetScale(const JPC_ScaledShapeSettings *in_settings, float out_scale[3]) -{ - storeVec3(out_scale, toJph(in_settings)->mScale); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_ScaledShapeSettings_SetScale(JPC_ScaledShapeSettings *in_settings, const float in_scale[3]) -{ - toJph(in_settings)->mScale = loadVec3(in_scale); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_RotatedTranslatedShapeSettings (-> JPC_DecoratedShapeSettings -> JPC_ShapeSettings) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_RotatedTranslatedShapeSettings * -JPC_RotatedTranslatedShapeSettings_CreateFromShape(const JPC_Shape *in_shape, - const float in_position[3], - const float in_rotation[4]) -{ - auto settings = new JPH::RotatedTranslatedShapeSettings(loadVec3(in_position), loadQuat(in_rotation), toJph(in_shape)); - settings->AddRef(); - return toJpc(settings); -} -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_RotatedTranslatedShapeSettings * -JPC_RotatedTranslatedShapeSettings_CreateFromSettings(const JPC_ShapeSettings *in_shape, - const float in_position[3], - const float in_rotation[4]) -{ - auto settings = new JPH::RotatedTranslatedShapeSettings(loadVec3(in_position), loadQuat(in_rotation), toJph(in_shape)); - settings->AddRef(); - return toJpc(settings); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_RotatedTranslatedShapeSettings_GetPosition(const JPC_RotatedTranslatedShapeSettings *in_settings, float out_position[3]) -{ - storeVec3(out_position, toJph(in_settings)->mPosition); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_RotatedTranslatedShapeSettings_SetPosition(JPC_RotatedTranslatedShapeSettings *in_settings, const float in_position[3]) -{ - toJph(in_settings)->mPosition = loadVec3(in_position); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_RotatedTranslatedShapeSettings_GetRotation(const JPC_RotatedTranslatedShapeSettings *in_settings, float out_rotation[4]) -{ - storeQuat(out_rotation, toJph(in_settings)->mRotation); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_RotatedTranslatedShapeSettings_SetRotation(JPC_RotatedTranslatedShapeSettings *in_settings, const float in_rotation[4]) -{ - toJph(in_settings)->mRotation = loadQuat(in_rotation); + JPH::Free(reinterpret_cast(settings)); } +#endif //JPC_DEBUG_RENDERER //-------------------------------------------------------------------------------------------------- // -// JPC_OffsetCenterOfMassShapeSettings (-> JPC_DecoratedShapeSettings -> JPC_ShapeSettings) +// JPC_BodyDrawFilter // //-------------------------------------------------------------------------------------------------- -JPC_API JPC_OffsetCenterOfMassShapeSettings * -JPC_OffsetCenterOfMassShapeSettings_CreateFromShape(const JPC_Shape *in_shape, const float in_offset[3]) -{ - auto settings = new JPH::OffsetCenterOfMassShapeSettings(loadVec3(in_offset), toJph(in_shape)); - settings->AddRef(); - return toJpc(settings); -} -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_OffsetCenterOfMassShapeSettings * -JPC_OffsetCenterOfMassShapeSettings_CreateFromSettings(const JPC_ShapeSettings *in_shape, const float in_offset[3]) -{ - auto settings = new JPH::OffsetCenterOfMassShapeSettings(loadVec3(in_offset), toJph(in_shape)); - settings->AddRef(); - return toJpc(settings); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_OffsetCenterOfMassShapeSettings_GetOffset(const JPC_OffsetCenterOfMassShapeSettings *in_settings, float out_offset[3]) +#if JPC_DEBUG_RENDERER == 1 +JPC_API JPC_BodyDrawFilter * +JPC_BodyDrawFilter_Create(const JPC_BodyDrawFilterFunc func) { - storeVec3(out_offset, toJph(in_settings)->mOffset); + return toJpc(new DebugRendererImpl::BodyDrawFilter(func)); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_OffsetCenterOfMassShapeSettings_SetOffset(JPC_OffsetCenterOfMassShapeSettings *in_settings, const float in_offset[3]) +JPC_BodyDrawFilter_Destroy(JPC_BodyDrawFilter *filter) { - toJph(in_settings)->mOffset = loadVec3(in_offset); + JPH::Free(reinterpret_cast(filter)); } +#endif //JPC_DEBUG_RENDERER //-------------------------------------------------------------------------------------------------- // // JPC_Shape @@ -2824,320 +1833,128 @@ JPC_Shape_SetUserData(JPC_Shape *in_shape, uint64_t in_user_data) return toJph(in_shape)->SetUserData(in_user_data); } //-------------------------------------------------------------------------------------------------- -JPC_API bool -JPC_Shape_MustBeStatic(const JPC_Shape *in_shape) -{ - return toJph(in_shape)->MustBeStatic(); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_Shape_GetCenterOfMass(const JPC_Shape *in_shape, float out_center_of_mass[3]) -{ - storeVec3(out_center_of_mass, toJph(in_shape)->GetCenterOfMass()); -} -//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_Shape_GetLocalBounds(const JPC_Shape *in_shape, JPC_AABox *out_local_bounds) +JPC_Shape_GetCenterOfMass(const JPC_Shape *in_shape, JPC_Real out_position[3]) { - const auto out = toJph(in_shape)->GetLocalBounds(); - *out_local_bounds = *toJpc(&out); + storeRVec3(out_position, toJph(in_shape)->GetCenterOfMass()); } //-------------------------------------------------------------------------------------------------- -JPC_API uint32_t -JPC_Shape_GetSubShapeIDBitsRecursive(const JPC_Shape *in_shape) -{ - return toJph(in_shape)->GetSubShapeIDBitsRecursive(); -} +// +// JPC_ConstraintSettings +// //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_Shape_GetWorldSpaceBounds(const JPC_Shape *in_shape, - const float in_center_of_mass_transform[16], - const float in_scale[3], - JPC_AABox *out_world_space_bounds) -{ - const auto out = toJph(in_shape)->GetWorldSpaceBounds( - loadMat44(in_center_of_mass_transform), - loadVec3(in_scale) - ); - *out_world_space_bounds = *toJpc(&out); -} -//-------------------------------------------------------------------------------------------------- -JPC_API float -JPC_Shape_GetInnerRadius(const JPC_Shape *in_shape) -{ - return toJph(in_shape)->GetInnerRadius(); -} -//-------------------------------------------------------------------------------------------------- -JPC_API const JPC_PhysicsMaterial * -JPC_Shape_GetMaterial(const JPC_Shape *in_shape, JPC_SubShapeID in_sub_shape_id) +JPC_ConstraintSettings_AddRef(JPC_ConstraintSettings *in_settings) { - return toJpc(toJph(in_shape)->GetMaterial(subShapeIDJph(in_sub_shape_id))); + toJph(in_settings)->AddRef(); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_Shape_GetSurfaceNormal(const JPC_Shape *in_shape, - JPC_SubShapeID in_sub_shape_id, - const float in_local_surface_position[3], - float out_surface_normal[3]) +JPC_ConstraintSettings_Release(JPC_ConstraintSettings *in_settings) { - storeVec3(out_surface_normal, toJph(in_shape)->GetSurfaceNormal(subShapeIDJph(in_sub_shape_id), loadVec3(in_local_surface_position))); + toJph(in_settings)->Release(); } //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_Shape_GetSupportingFace(const JPC_Shape* in_shape, - JPC_SubShapeID in_sub_shape_id, - const float in_direction[3], - const float in_scale[3], - const float in_com_transform[16], - JPC_SupportingFace *out_vertices) +JPC_API uint32_t +JPC_ConstraintSettings_GetRefCount(const JPC_ConstraintSettings *in_settings) { - toJph(in_shape)->GetSupportingFace( - subShapeIDJph(in_sub_shape_id), - loadVec3(in_direction), - loadVec3(in_scale), - loadMat44(in_com_transform), - *toJph(out_vertices) - ); + return toJph(in_settings)->GetRefCount(); } //-------------------------------------------------------------------------------------------------- JPC_API uint64_t -JPC_Shape_GetSubShapeUserData(const JPC_Shape *in_shape, JPC_SubShapeID in_sub_shape_id) +JPC_ConstraintSettings_GetUserData(const JPC_ConstraintSettings *in_settings) { - return toJph(in_shape)->GetSubShapeUserData(subShapeIDJph(in_sub_shape_id)); + return toJph(in_settings)->mUserData; } //-------------------------------------------------------------------------------------------------- -JPC_API JPC_TransformedShape -JPC_Shape_GetSubShapeTransformedShape(const JPC_Shape *in_shape, - JPC_SubShapeID in_sub_shape_id, - const float in_position_com[3], - const float in_rotation[4], - const float in_scale[3]) -{ - JPH::SubShapeID outRemainder; - auto result = toJph(in_shape)->GetSubShapeTransformedShape(subShapeIDJph(in_sub_shape_id), loadVec3(in_position_com), loadQuat(in_rotation), loadVec3(in_scale), outRemainder); - return *toJpc(&result); -} - -JPC_API void -JPC_Shape_GetSubmergedVolume(const JPC_Shape *in_shape, - const float in_com_transform[16], - const float in_scale[3], - const float in_surface_normal[3], - float in_surface_constant, - float *out_total_volume, - float *out_submerged_volume, - float out_center_of_buoyancy[3]) -{ - JPH::Vec3 centerOfBuoyancy{}; - toJph(in_shape)->GetSubmergedVolume( - loadMat44(in_com_transform), - loadVec3(in_scale), - JPH::Plane(loadVec3(in_surface_normal), in_surface_constant), - *out_total_volume, - *out_submerged_volume, - centerOfBuoyancy - ); - storeVec3(out_center_of_buoyancy, centerOfBuoyancy); -} - -JPC_API bool -JPC_Shape_GetCastRay(const JPC_Shape *in_shape, - const JPC_RayCast *in_ray, - const JPC_SubShapeIDCreator *in_sub_shape_id_creator, - JPC_RayCastResult *io_hit) -{ - return toJph(in_shape)->CastRay( - *toJph(in_ray), - *toJph(in_sub_shape_id_creator), - *toJph(io_hit) - ); -} - -JPC_API void -JPC_Shape_CollectCastRay(const JPC_Shape *in_shape, - const JPC_RayCast *in_ray, - const JPC_RayCastSettings *in_settings, - const JPC_SubShapeIDCreator *in_sub_shape_id_creator, - void *io_collector, - void *in_shape_filter) -{ - toJph(in_shape)->CastRay( - *toJph(in_ray), - *toJph(in_settings), - *toJph(in_sub_shape_id_creator), - *reinterpret_cast(io_collector), - *reinterpret_cast(in_shape_filter) - ); -} - JPC_API void -JPC_Shape_CollidePoint(const JPC_Shape *in_shape, - const float in_point[3], - const JPC_SubShapeIDCreator *in_sub_shape_id_creator, - void *io_collector, - void *in_shape_filter) +JPC_ConstraintSettings_SetUserData(JPC_ConstraintSettings *in_settings, uint64_t in_user_data) { - toJph(in_shape)->CollidePoint( - loadVec3(in_point), - *toJph(in_sub_shape_id_creator), - *reinterpret_cast(io_collector), - *reinterpret_cast(in_shape_filter) - ); -} - -JPC_API void -JPC_Shape_CollectTransformedShapes(const JPC_Shape *in_shape, - const JPC_AABox *in_box, - const float in_position_com[3], - const float in_rotation[4], - const float in_scale[3], - const JPC_SubShapeIDCreator *in_sub_shape_id_creator, - void *io_collector, - void *in_shape_filter) -{ - toJph(in_shape)->CollectTransformedShapes( - *toJph(in_box), - loadVec3(in_position_com), - loadQuat(in_rotation), - loadVec3(in_scale), - *toJph(in_sub_shape_id_creator), - *reinterpret_cast(io_collector), - *reinterpret_cast(in_shape_filter) - ); -} - -JPC_API void -JPC_Shape_TransformShape(const JPC_Shape *in_shape, - const float in_com_transform[16], - void *io_collector) -{ - toJph(in_shape)->TransformShape( - loadMat44(in_com_transform), - *reinterpret_cast(io_collector) - ); -} - -JPC_API JPC_ShapeResult -JPC_Shape_ScaleShape(const JPC_Shape *in_shape, const float in_scale[3]) -{ - return toJpc(toJph(in_shape)->ScaleShape(loadVec3(in_scale))); + toJph(in_settings)->mUserData = in_user_data; } //-------------------------------------------------------------------------------------------------- -JPC_API float -JPC_Shape_GetVolume(const JPC_Shape *in_shape) -{ - return toJph(in_shape)->GetVolume(); -} +// +// JPC_TwoBodyConstraintSettings (-> JPC_ConstraintSettings) +// //-------------------------------------------------------------------------------------------------- -JPC_API bool -JPC_Shape_IsValidScale(const JPC_Shape *in_shape, const float in_scale[3]) +JPC_API JPC_Constraint * +JPC_TwoBodyConstraintSettings_CreateConstraint(const JPC_TwoBodyConstraintSettings *in_settings, + JPC_Body *in_body1, + JPC_Body *in_body2) { - return toJph(in_shape)->IsValidScale(loadVec3(in_scale)); + auto constraint = toJph(in_settings)->Create(*toJph(in_body1), *toJph(in_body2)); + if (constraint != nullptr) constraint->AddRef(); + return toJpc(constraint); } //-------------------------------------------------------------------------------------------------- // -// JPC_ConvexShape (-> JPC_Shape) +// JPC_FixedConstraintSettings (-> JPC_TwoBodyConstraintSettings -> JPC_ConstraintSettings) // //-------------------------------------------------------------------------------------------------- -JPC_API const JPC_ConvexShapeSupport * -JPC_ConvexShape_GetSupportFunction(const JPC_ConvexShape *in_shape, - JPC_SupportMode in_mode, - JPC_SupportBuffer *in_buffer, - const float in_scale[3]) -{ - auto a = toJph(in_shape); - auto b = a->GetSupportFunction( - static_cast(in_mode), - *reinterpret_cast(in_buffer), - loadVec3(in_scale) - ); - // this is so hacky - return reinterpret_cast(b); -} - -JPC_API void -JPC_ConvexShape_SetMaterial(JPC_ConvexShape *in_shape, const JPC_PhysicsMaterial *in_material) -{ - toJph(in_shape)->SetMaterial(toJph(in_material)); -} -//--------------------------------------------------------------------------------------------------/ -JPC_API const JPC_PhysicsMaterial * -JPC_ConvexShape_GetMaterial(const JPC_ConvexShape *in_shape) +JPC_API JPC_FixedConstraintSettings * +JPC_FixedConstraintSettings_Create() { - return toJpc(toJph(in_shape)->GetMaterial()); + auto settings = new JPH::FixedConstraintSettings(); + settings->AddRef(); + return toJpc(settings); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_ConvexShape_SetDensity(JPC_ConvexShape *in_shape, float in_density) +JPC_FixedConstraintSettings_SetSpace(JPC_FixedConstraintSettings *in_settings, JPC_ConstraintSpace in_space) { - return toJph(in_shape)->SetDensity(in_density); + toJph(in_settings)->mSpace = toJph(in_space); } //-------------------------------------------------------------------------------------------------- -JPC_API float -JPC_ConvexShape_GetDensity(const JPC_ConvexShape *in_shape) +JPC_API void +JPC_FixedConstraintSettings_SetAutoDetectPoint(JPC_FixedConstraintSettings *in_settings, bool in_enabled) { - return toJph(in_shape)->GetDensity(); + toJph(in_settings)->mAutoDetectPoint = in_enabled; } //-------------------------------------------------------------------------------------------------- // -// JPC_DecoratedShape (-> JPC_Shape) +// JPC_Constraint // //-------------------------------------------------------------------------------------------------- -JPC_API const JPC_Shape * -JPC_DecoratedShape_GetInnerShape(const JPC_DecoratedShape *in_shape) +JPC_API void +JPC_Constraint_AddRef(JPC_Constraint *in_shape) { - return toJpc(toJph(in_shape)->GetInnerShape()); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_ScaledShape (-> JPC_DecoratedShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_ScaledShape * -JPC_ScaledShape_Create(const JPC_Shape *in_shape, const float in_scale[3]) { - auto result = new JPH::ScaledShape(toJph(in_shape), loadVec3(in_scale)); - result->AddRef(); - return toJpc(result); + toJph(in_shape)->AddRef(); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_ScaledShape_GetScale(const JPC_ScaledShape *in_shape, float out_scale[3]) +JPC_Constraint_Release(JPC_Constraint *in_shape) { - storeVec3(out_scale, toJph(in_shape)->GetScale()); + toJph(in_shape)->Release(); } //-------------------------------------------------------------------------------------------------- -// -// JPC_RotatedTranslatedShape (-> JPC_DecoratedShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_RotatedTranslatedShape * -JPC_RotatedTranslatedShape_Create(const JPC_Shape *in_shape, const float in_position[3], const float in_rotation[4]) +JPC_API uint32_t +JPC_Constraint_GetRefCount(const JPC_Constraint *in_shape) { - auto result = new JPH::RotatedTranslatedShape(loadVec3(in_position), loadQuat(in_rotation), toJph(in_shape)); - result->AddRef(); - return toJpc(result); + return toJph(in_shape)->GetRefCount(); } //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_RotatedTranslatedShape_GetPosition(const JPC_RotatedTranslatedShape *in_shape, float out_position[3]) +JPC_API JPC_ConstraintType +JPC_Constraint_GetType(const JPC_Constraint *in_shape) { - storeVec3(out_position, toJph(in_shape)->GetPosition()); + return toJpc(toJph(in_shape)->GetType()); } //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_RotatedTranslatedShape_GetRotation(const JPC_RotatedTranslatedShape *in_shape, float out_rotation[4]) +JPC_API JPC_ConstraintSubType +JPC_Constraint_GetSubType(const JPC_Constraint *in_shape) { - storeQuat(out_rotation, toJph(in_shape)->GetRotation()); + return toJpc(toJph(in_shape)->GetSubType()); } //-------------------------------------------------------------------------------------------------- -// -// JPC_OffsetCenterOfMassShape (-> JPC_DecoratedShape -> JPC_Shape) -// +JPC_API uint64_t +JPC_Constraint_GetUserData(const JPC_Constraint *in_shape) +{ + return toJph(in_shape)->GetUserData(); +} //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_OffsetCenterOfMassShape_GetOffset(const JPC_OffsetCenterOfMassShape *in_shape, float out_offset[3]) +JPC_Constraint_SetUserData(JPC_Constraint *in_shape, uint64_t in_user_data) { - storeVec3(out_offset, toJph(in_shape)->GetOffset()); + return toJph(in_shape)->SetUserData(in_user_data); } //-------------------------------------------------------------------------------------------------- // @@ -3158,50 +1975,6 @@ JPC_BodyInterface_CreateBodyWithID(JPC_BodyInterface *in_iface, return toJpc(toJph(in_iface)->CreateBodyWithID(toJph(in_body_id), *toJph(in_settings))); } //-------------------------------------------------------------------------------------------------- -JPC_API JPC_Body * -JPC_BodyInterface_CreateBodyWithoutID(JPC_BodyInterface *in_iface, - const JPC_BodyCreationSettings *in_settings) -{ - return toJpc(toJph(in_iface)->CreateBodyWithoutID(*toJph(in_settings))); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_DestroyBodyWithoutID(JPC_BodyInterface *in_iface, JPC_Body *in_body) -{ - toJph(in_iface)->DestroyBodyWithoutID(toJph(in_body)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API bool -JPC_BodyInterface_AssignNextBodyID(JPC_BodyInterface *in_iface, JPC_Body *in_body) -{ - return toJph(in_iface)->AssignBodyID(toJph(in_body)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API bool -JPC_BodyInterface_AssignBodyID(JPC_BodyInterface *in_iface, JPC_Body *in_body, JPC_BodyID in_body_id) -{ - return toJph(in_iface)->AssignBodyID(toJph(in_body), toJph(in_body_id)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_Body * -JPC_BodyInterface_UnassignBodyID(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) -{ - return toJpc(toJph(in_iface)->UnassignBodyID(toJph(in_body_id))); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_UnassignBodyIDs(JPC_BodyInterface *in_iface, - const JPC_BodyID *in_body_ids, - int in_number, - JPC_Body **out_bodies) -{ - toJph(in_iface)->UnassignBodyIDs( - toJph(in_body_ids), - in_number, - reinterpret_cast(out_bodies) - ); -} -//-------------------------------------------------------------------------------------------------- JPC_API void JPC_BodyInterface_DestroyBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) { @@ -3209,15 +1982,9 @@ JPC_BodyInterface_DestroyBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyInterface_DestroyBodies(JPC_BodyInterface *in_iface, const JPC_BodyID *in_body_ids, int in_number) -{ - toJph(in_iface)->DestroyBodies(toJph(in_body_ids), in_number); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void JPC_BodyInterface_AddBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, JPC_Activation in_mode) { - toJph(in_iface)->AddBody(toJph(in_body_id), activationToJph(in_mode)); + toJph(in_iface)->AddBody(toJph(in_body_id), static_cast(in_mode)); } //-------------------------------------------------------------------------------------------------- JPC_API void @@ -3226,12 +1993,6 @@ JPC_BodyInterface_RemoveBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) toJph(in_iface)->RemoveBody(toJph(in_body_id)); } //-------------------------------------------------------------------------------------------------- -JPC_API bool -JPC_BodyInterface_IsAdded(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) -{ - return toJph(in_iface)->IsAdded(toJph(in_body_id)); -} -//-------------------------------------------------------------------------------------------------- JPC_API JPC_BodyID JPC_BodyInterface_CreateAndAddBody(JPC_BodyInterface *in_iface, const JPC_BodyCreationSettings *in_settings, @@ -3241,179 +2002,108 @@ JPC_BodyInterface_CreateAndAddBody(JPC_BodyInterface *in_iface, static_cast(in_mode))); } //-------------------------------------------------------------------------------------------------- -JPC_API JPC_BodyInterfaceAddState -JPC_BodyInterface_AddBodiesPrepare(JPC_BodyInterface *in_iface, JPC_BodyID *io_bodies, int in_number) +JPC_API bool +JPC_BodyInterface_IsAdded(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) { - return toJph(in_iface)->AddBodiesPrepare(toJph(io_bodies), in_number); + return toJph(in_iface)->IsAdded(toJph(in_body_id)); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyInterface_AddBodiesFinalize(JPC_BodyInterface *in_iface, - JPC_BodyID *io_bodies, - int in_number, - JPC_BodyInterfaceAddState *in_add_state, - JPC_Activation in_activation_mode) +JPC_BodyInterface_SetLinearAndAngularVelocity(JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + const float in_linear_velocity[3], + const float in_angular_velocity[3]) { - toJph(in_iface)->AddBodiesFinalize( - toJph(io_bodies), - in_number, - in_add_state, - activationToJph(in_activation_mode) - ); + toJph(in_iface)->SetLinearAndAngularVelocity( + toJph(in_body_id), loadVec3(in_linear_velocity), loadVec3(in_angular_velocity)); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyInterface_AddBodiesAbort(JPC_BodyInterface *in_iface, - JPC_BodyID *io_bodies, - int in_number, - JPC_BodyInterfaceAddState *in_add_state) +JPC_BodyInterface_GetLinearAndAngularVelocity(const JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + float out_linear_velocity[3], + float out_angular_velocity[3]) { - toJph(in_iface)->AddBodiesAbort(toJph(io_bodies), in_number, in_add_state); + JPH::Vec3 linear, angular; + toJph(in_iface)->GetLinearAndAngularVelocity(toJph(in_body_id), linear, angular); + storeVec3(out_linear_velocity, linear); + storeVec3(out_angular_velocity, angular); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyInterface_RemoveBodies(JPC_BodyInterface *in_iface, - JPC_BodyID *io_bodies, - int in_number) +JPC_BodyInterface_SetLinearVelocity(JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + const float in_velocity[3]) { - toJph(in_iface)->RemoveBodies(toJph(io_bodies), in_number); + toJph(in_iface)->SetLinearVelocity(toJph(in_body_id), loadVec3(in_velocity)); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyInterface_ActivateBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) +JPC_BodyInterface_GetLinearVelocity(const JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + float out_velocity[3]) { - toJph(in_iface)->ActivateBody(toJph(in_body_id)); + storeVec3(out_velocity, toJph(in_iface)->GetLinearVelocity(toJph(in_body_id))); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyInterface_ActivateBodies(JPC_BodyInterface *in_iface, - const JPC_BodyID *in_body_ids, - int in_number) +JPC_BodyInterface_AddLinearVelocity(JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + const float in_velocity[3]) { - toJph(in_iface)->ActivateBodies(toJph(in_body_ids), in_number); + toJph(in_iface)->AddLinearVelocity(toJph(in_body_id), loadVec3(in_velocity)); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyInterface_DeactivateBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) +JPC_BodyInterface_AddLinearAndAngularVelocity(JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + const float in_linear_velocity[3], + const float in_angular_velocity[3]) { - toJph(in_iface)->DeactivateBody(toJph(in_body_id)); + toJph(in_iface)->AddLinearAndAngularVelocity( + toJph(in_body_id), loadVec3(in_linear_velocity), loadVec3(in_angular_velocity)); } //-------------------------------------------------------------------------------------------------- -JPC_API bool -JPC_BodyInterface_IsActive(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) +JPC_API void +JPC_BodyInterface_SetAngularVelocity(JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + const float in_velocity[3]) { - return toJph(in_iface)->IsActive(toJph(in_body_id)); + toJph(in_iface)->SetAngularVelocity(toJph(in_body_id), loadVec3(in_velocity)); } //-------------------------------------------------------------------------------------------------- -JPC_API const JPC_Shape * -JPC_BodyInterface_GetShape(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) +JPC_API void +JPC_BodyInterface_GetAngularVelocity(const JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + float out_velocity[3]) { - auto result = toJph(in_iface)->GetShape(toJph(in_body_id)); - result->AddRef(); - return toJpc(result); + storeVec3(out_velocity, toJph(in_iface)->GetAngularVelocity(toJph(in_body_id))); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyInterface_SetShape(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const JPC_Shape *in_shape, - bool in_update_mass_properties, - JPC_Activation in_activation_mode) -{ - toJph(in_iface)->SetShape( - toJph(in_body_id), - toJph(in_shape), - in_update_mass_properties, - activationToJph(in_activation_mode) - ); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_NotifyShapeChanged(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const float in_previous_center_of_mass[3], - bool in_update_mass_properties, - JPC_Activation in_activation_mode) -{ - toJph(in_iface)->NotifyShapeChanged( - toJph(in_body_id), - loadVec3(in_previous_center_of_mass), - in_update_mass_properties, - activationToJph(in_activation_mode) - ); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_SetObjectLayer(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, JPC_ObjectLayer in_layer) -{ - toJph(in_iface)->SetObjectLayer(toJph(in_body_id), objectLayerToJph(in_layer)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_ObjectLayer -JPC_BodyInterface_GetObjectLayer(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) -{ - return toJph(in_iface)->GetObjectLayer(toJph(in_body_id)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_SetPositionAndRotation(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const JPC_Real in_position[3], - const float in_rotation[4], - JPC_Activation in_activation_mode) -{ - toJph(in_iface)->SetPositionAndRotation( - toJph(in_body_id), - loadRVec3(in_position), - loadQuat(in_rotation), - activationToJph(in_activation_mode) - ); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_SetPositionAndRotationWhenChanged(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const JPC_Real in_position[3], - const float in_rotation[4], - JPC_Activation in_activation_mode) -{ - toJph(in_iface)->SetPositionAndRotationWhenChanged( - toJph(in_body_id), - loadRVec3(in_position), - loadQuat(in_rotation), - activationToJph(in_activation_mode) - ); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_GetPositionAndRotation(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - JPC_Real out_position[3], - float out_rotation[4]) +JPC_BodyInterface_GetPointVelocity(const JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + const JPC_Real in_point[3], + float out_velocity[3]) { - JPH::RVec3 position; - JPH::Quat rotation; - toJph(in_iface)->GetPositionAndRotation(toJph(in_body_id), position, rotation); - storeRVec3(out_position, position); - storeQuat(out_rotation, rotation); + storeVec3(out_velocity, toJph(in_iface)->GetPointVelocity(toJph(in_body_id), loadRVec3(in_point))); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyInterface_SetPosition(JPC_BodyInterface *in_iface, +JPC_BodyInterface_GetPosition(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, - const JPC_Real in_position[3], - JPC_Activation in_activation_mode) + JPC_Real out_position[3]) { - toJph(in_iface)->SetPosition(toJph(in_body_id), loadRVec3(in_position), activationToJph(in_activation_mode)); + storeRVec3(out_position, toJph(in_iface)->GetPosition(toJph(in_body_id))); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyInterface_GetPosition(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - JPC_Real out_position[3]) +JPC_BodyInterface_SetPosition(JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + const JPC_Real in_position[3], + JPC_Activation in_activation) { - auto result = toJph(in_iface)->GetPosition(toJph(in_body_id)); - storeRVec3(out_position, result); + toJph(in_iface)->SetPosition(toJph(in_body_id), loadRVec3(in_position), static_cast(in_activation)); } //-------------------------------------------------------------------------------------------------- JPC_API void @@ -3421,17 +2111,16 @@ JPC_BodyInterface_GetCenterOfMassPosition(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, JPC_Real out_position[3]) { - auto result = toJph(in_iface)->GetCenterOfMassPosition(toJph(in_body_id)); - storeRVec3(out_position, result); + storeRVec3(out_position, toJph(in_iface)->GetCenterOfMassPosition(toJph(in_body_id))); } //-------------------------------------------------------------------------------------------------- JPC_API void JPC_BodyInterface_SetRotation(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, - const float in_rotation[4], - JPC_Activation in_activation_mode) + const JPC_Real in_rotation[4], + JPC_Activation in_activation) { - toJph(in_iface)->SetRotation(toJph(in_body_id), loadQuat(in_rotation), activationToJph(in_activation_mode)); + toJph(in_iface)->SetRotation(toJph(in_body_id), JPH::Quat(loadVec4(in_rotation)), static_cast(in_activation)); } //-------------------------------------------------------------------------------------------------- JPC_API void @@ -3439,124 +2128,25 @@ JPC_BodyInterface_GetRotation(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, float out_rotation[4]) { - auto result = toJph(in_iface)->GetRotation(toJph(in_body_id)); - storeQuat(out_rotation, result); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_GetWorldTransform(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float out_rotation[9], - JPC_Real out_translation[3]) -{ - auto result = toJph(in_iface)->GetWorldTransform(toJph(in_body_id)); - storeRMat44(out_rotation, out_translation, result); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_GetCenterOfMassTransform(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float out_rotation[9], - JPC_Real out_translation[3]) -{ - auto result = toJph(in_iface)->GetCenterOfMassTransform(toJph(in_body_id)); - storeRMat44(out_rotation, out_translation, result); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_MoveKinematic(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const JPC_Real in_target_position[3], - const float in_target_rotation[4], - float in_delta_time) -{ - toJph(in_iface)->MoveKinematic( - toJph(in_body_id), - loadRVec3(in_target_position), - loadQuat(in_target_rotation), - in_delta_time - ); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_SetLinearAndAngularVelocity(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const float in_linear_velocity[3], - const float in_angular_velocity[3]) -{ - toJph(in_iface)->SetLinearAndAngularVelocity( - toJph(in_body_id), loadVec3(in_linear_velocity), loadVec3(in_angular_velocity)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_GetLinearAndAngularVelocity(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float out_linear_velocity[3], - float out_angular_velocity[3]) -{ - JPH::Vec3 linear, angular; - toJph(in_iface)->GetLinearAndAngularVelocity(toJph(in_body_id), linear, angular); - storeVec3(out_linear_velocity, linear); - storeVec3(out_angular_velocity, angular); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_SetLinearVelocity(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const float in_velocity[3]) -{ - toJph(in_iface)->SetLinearVelocity(toJph(in_body_id), loadVec3(in_velocity)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_GetLinearVelocity(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float out_velocity[3]) -{ - storeVec3(out_velocity, toJph(in_iface)->GetLinearVelocity(toJph(in_body_id))); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_AddLinearVelocity(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const float in_velocity[3]) -{ - toJph(in_iface)->AddLinearVelocity(toJph(in_body_id), loadVec3(in_velocity)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_AddLinearAndAngularVelocity(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const float in_linear_velocity[3], - const float in_angular_velocity[3]) -{ - toJph(in_iface)->AddLinearAndAngularVelocity( - toJph(in_body_id), loadVec3(in_linear_velocity), loadVec3(in_angular_velocity)); + storeVec4(out_rotation, toJph(in_iface)->GetRotation(toJph(in_body_id)).GetXYZW()); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyInterface_SetAngularVelocity(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const float in_velocity[3]) +JPC_BodyInterface_ActivateBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) { - toJph(in_iface)->SetAngularVelocity(toJph(in_body_id), loadVec3(in_velocity)); + toJph(in_iface)->ActivateBody(toJph(in_body_id)); } -//-------------------------------------------------------------------------------------------------- + JPC_API void -JPC_BodyInterface_GetAngularVelocity(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float out_velocity[3]) +JPC_BodyInterface_DeactivateBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) { - storeVec3(out_velocity, toJph(in_iface)->GetAngularVelocity(toJph(in_body_id))); + toJph(in_iface)->DeactivateBody(toJph(in_body_id)); } -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_GetPointVelocity(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const JPC_Real in_point[3], - float out_velocity[3]) + +JPC_API bool +JPC_BodyInterface_IsActive(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) { - storeVec3(out_velocity, toJph(in_iface)->GetPointVelocity(toJph(in_body_id), loadRVec3(in_point))); + return toJph(in_iface)->IsActive(toJph(in_body_id)); } //-------------------------------------------------------------------------------------------------- JPC_API void @@ -3626,114 +2216,28 @@ JPC_BodyInterface_AddAngularImpulse(JPC_BodyInterface *in_iface, JPC_BodyID in_b toJph(in_iface)->AddAngularImpulse(toJph(in_body_id), loadVec3(in_impulse)); } //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_SetMotionType(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - JPC_MotionType in_motion_type, - JPC_Activation in_activation_mode) -{ - toJph(in_iface)->SetMotionType( - toJph(in_body_id), motionTypeToJph(in_motion_type), activationToJph(in_activation_mode)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_MotionType -JPC_BodyInterface_GetMotionType(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id) +JPC_API JPC_MotionType +JPC_BodyInterface_GetMotionType(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) { return toJpc(toJph(in_iface)->GetMotionType(toJph(in_body_id))); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyInterface_SetMotionQuality(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - JPC_MotionQuality in_motion_quality) -{ - toJph(in_iface)->SetMotionQuality(toJph(in_body_id), motionQualityToJph(in_motion_quality)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_GetInverseInertia(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float out_inverse_inertia[16]) -{ - auto result = toJph(in_iface)->GetInverseInertia(toJph(in_body_id)); - storeMat44(out_inverse_inertia, result); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_SetRestitution(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float in_restitution) -{ - toJph(in_iface)->SetRestitution(toJph(in_body_id), in_restitution); -} -//-------------------------------------------------------------------------------------------------- -JPC_API float -JPC_BodyInterface_GetRestitution(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id) -{ - return toJph(in_iface)->GetRestitution(toJph(in_body_id)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_SetFriction(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float in_friction) -{ - toJph(in_iface)->SetFriction(toJph(in_body_id), in_friction); -} -//-------------------------------------------------------------------------------------------------- -JPC_API float -JPC_BodyInterface_GetFriction(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id) -{ - return toJph(in_iface)->GetFriction(toJph(in_body_id)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_SetGravityFactor(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float in_gravity_factor) -{ - toJph(in_iface)->SetGravityFactor(toJph(in_body_id), in_gravity_factor); -} -//-------------------------------------------------------------------------------------------------- -JPC_API float -JPC_BodyInterface_GetGravityFactor(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id) -{ - return toJph(in_iface)->GetGravityFactor(toJph(in_body_id)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyInterface_GetTransformedShape(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - JPC_TransformedShape *out_shape) +JPC_BodyInterface_SetMotionType(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, JPC_MotionType in_motion_type, JPC_Activation in_activation) { - auto out = toJph(in_iface)->GetTransformedShape(toJph(in_body_id)); - *out_shape = *toJpc(&out); + toJph(in_iface)->SetMotionType(toJph(in_body_id), static_cast(in_motion_type), static_cast(in_activation)); } //-------------------------------------------------------------------------------------------------- -JPC_API uint64_t -JPC_BodyInterface_GetUserData(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id) -{ - return toJph(in_iface)->GetUserData(toJph(in_body_id)); -} -//-------------------------------------------------------------------------------------------------- -JPC_API const JPC_PhysicsMaterial * -JPC_BodyInterface_GetMaterial(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - JPC_SubShapeID in_sub_shape_id) +JPC_API JPC_ObjectLayer +JPC_BodyInterface_GetObjectLayer(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id) { - return toJpc(toJph(in_iface)->GetMaterial(toJph(in_body_id), subShapeIDJph(in_sub_shape_id))); + return toJpc(toJph(in_iface)->GetObjectLayer(toJph(in_body_id))); } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_BodyInterface_InvalidateContactCache(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id) +JPC_BodyInterface_SetObjectLayer(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, JPC_ObjectLayer in_layer) { - toJph(in_iface)->InvalidateContactCache(toJph(in_body_id)); + toJph(in_iface)->SetObjectLayer(toJph(in_body_id), static_cast(in_layer)); } //-------------------------------------------------------------------------------------------------- // @@ -3788,24 +2292,6 @@ JPC_Body_IsSensor(const JPC_Body *in_body) return toJph(in_body)->IsSensor(); } //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_Body_SetUseManifoldReduction(JPC_Body *in_body, bool in_use_reduction) -{ - toJph(in_body)->SetUseManifoldReduction(in_use_reduction); -} -//-------------------------------------------------------------------------------------------------- -JPC_API bool -JPC_Body_GetUseManifoldReduction(const JPC_Body *in_body) -{ - return toJph(in_body)->GetUseManifoldReduction(); -} -//-------------------------------------------------------------------------------------------------- -JPC_API bool -JPC_Body_GetUseManifoldReductionWithBody(const JPC_Body *in_body, const JPC_Body *in_other) -{ - return toJph(in_body)->GetUseManifoldReductionWithBody(*toJph(in_other)); -} -//-------------------------------------------------------------------------------------------------- JPC_API JPC_MotionType JPC_Body_GetMotionType(const JPC_Body *in_body) { @@ -3947,18 +2433,6 @@ JPC_Body_AddTorque(JPC_Body *in_body, const float in_torque[3]) } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_Body_GetAccumulatedForce(JPC_Body *in_body, float out_force[3]) -{ - storeVec3(out_force, toJph(in_body)->GetAccumulatedForce()); -} - -JPC_API void -JPC_Body_GetAccumulatedTorque(JPC_Body *in_body, float out_torque[3]) -{ - storeVec3(out_torque, toJph(in_body)->GetAccumulatedTorque()); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void JPC_Body_GetInverseInertia(const JPC_Body *in_body, float out_inverse_inertia[16]) { storeMat44(out_inverse_inertia, toJph(in_body)->GetInverseInertia()); @@ -3992,7 +2466,7 @@ JPC_Body_MoveKinematic(JPC_Body *in_body, loadRVec3(in_target_position), JPH::Quat(loadVec4(in_target_rotation)), in_delta_time); } //-------------------------------------------------------------------------------------------------- -JPC_API bool +JPC_API void JPC_Body_ApplyBuoyancyImpulse(JPC_Body *in_body, const JPC_Real in_surface_position[3], const float in_surface_normal[3], @@ -4003,7 +2477,7 @@ JPC_Body_ApplyBuoyancyImpulse(JPC_Body *in_body, const float in_gravity[3], float in_delta_time) { - return toJph(in_body)->ApplyBuoyancyImpulse( + toJph(in_body)->ApplyBuoyancyImpulse( loadRVec3(in_surface_position), loadVec3(in_surface_normal), in_buoyancy, @@ -4089,7 +2563,7 @@ JPC_Body_GetWorldSpaceBounds(const JPC_Body *in_body, float out_min[3], float ou { const JPH::AABox& aabb = toJph(in_body)->GetWorldSpaceBounds(); storeVec3(out_min, aabb.mMin); - storeVec3(out_min, aabb.mMax); + storeVec3(out_max, aabb.mMax); } //-------------------------------------------------------------------------------------------------- JPC_API JPC_MotionProperties * @@ -4111,35 +2585,15 @@ JPC_Body_SetUserData(JPC_Body *in_body, uint64_t in_user_data) } //-------------------------------------------------------------------------------------------------- JPC_API void -JPC_Body_GetTransformedShape(JPC_Body *in_body, JPC_TransformedShape *out_shape) -{ - auto out = toJph(in_body)->GetTransformedShape(); - *out_shape = *toJpc(&out); -} - -JPC_API void -JPC_Body_GetBodyCreationSettings(JPC_Body *in_body, JPC_BodyCreationSettings *out_settings) -{ - auto out = toJph(in_body)->GetBodyCreationSettings(); - *out_settings = *toJpc(&out); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void JPC_Body_GetWorldSpaceSurfaceNormal(const JPC_Body *in_body, JPC_SubShapeID in_sub_shape_id, const JPC_Real in_position[3], float out_normal_vector[3]) { const JPH::Vec3 v = toJph(in_body)->GetWorldSpaceSurfaceNormal( - subShapeIDJph(in_sub_shape_id), loadRVec3(in_position)); + *toJph(&in_sub_shape_id), loadRVec3(in_position)); storeVec3(out_normal_vector, v); } - -JPC_API JPC_Body * -JPC_Body_FixedToWorld() -{ - return toJpc(&JPH::Body::sFixedToWorld); -} //-------------------------------------------------------------------------------------------------- // // JPC_MotionProperties @@ -4331,20 +2785,6 @@ JPC_MotionProperties_GetPointVelocityCOM(const JPC_MotionProperties *in_properti storeVec3(out_point, toJph(in_properties)->GetPointVelocityCOM(loadVec3(in_point_relative_to_com))); } //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_MotionProperties_GetAccumulatedForce(const JPC_MotionProperties *in_properties, - float out_force[3]) -{ - storeVec3(out_force, toJph(in_properties)->GetAccumulatedForce()); -} -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_MotionProperties_GetAccumulatedTorque(const JPC_MotionProperties *in_properties, - float out_torque[3]) -{ - storeVec3(out_torque, toJph(in_properties)->GetAccumulatedTorque()); -} -//-------------------------------------------------------------------------------------------------- JPC_API float JPC_MotionProperties_GetMaxLinearVelocity(const JPC_MotionProperties *in_properties) { @@ -4394,1959 +2834,216 @@ JPC_BodyID_IsInvalid(JPC_BodyID in_body_id) } //-------------------------------------------------------------------------------------------------- // -// JPC_Constraint +// JPC_CharacterSettings // //-------------------------------------------------------------------------------------------------- +JPC_API JPC_CharacterSettings * +JPC_CharacterSettings_Create() +{ + auto settings = new JPH::CharacterSettings(); + settings->AddRef(); + return toJpc(settings); +} +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_Constraint_Release(JPC_Constraint *in_constraint) +JPC_CharacterSettings_Release(JPC_CharacterSettings *in_settings) { - toJph(in_constraint)->Release(); + toJph(in_settings)->Release(); } - -JPC_API JPC_ConstraintType -JPC_Constraint_GetType(const JPC_Constraint *in_constraint) +//-------------------------------------------------------------------------------------------------- +JPC_API void +JPC_CharacterSettings_AddRef(JPC_CharacterSettings *in_settings) { - return toJpc(toJph(in_constraint)->GetType()); + toJph(in_settings)->AddRef(); } - -JPC_API JPC_ConstraintSubType -JPC_Constraint_GetSubType(const JPC_Constraint *in_constraint) +//-------------------------------------------------------------------------------------------------- +// +// JPC_Character +// +//-------------------------------------------------------------------------------------------------- +JPC_API JPC_Character * +JPC_Character_Create(const JPC_CharacterSettings *in_settings, + const JPC_Real in_position[3], + const float in_rotation[4], + uint64_t in_user_data, + JPC_PhysicsSystem *in_physics_system) { - return toJpc(toJph(in_constraint)->GetSubType()); + auto character = new JPH::Character(toJph(in_settings), + loadVec3(in_position), + JPH::Quat(loadVec4(in_rotation)), + in_user_data, + toJph(in_physics_system)); + return toJpc(character); } - +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_Constraint_SetNumVelocityStepsOverride(JPC_Constraint *in_constraint, int in_num_velocity_steps_override) +JPC_Character_Destroy(JPC_Character *in_character) { - toJph(in_constraint)->SetNumVelocityStepsOverride(in_num_velocity_steps_override); + delete toJph(in_character); } - -JPC_API int -JPC_Constraint_GetNumVelocityStepsOverride(const JPC_Constraint *in_constraint) +//-------------------------------------------------------------------------------------------------- +JPC_API void +JPC_Character_AddToPhysicsSystem(JPC_Character *in_character, JPC_Activation in_activation, bool in_lock_bodies) { - return toJph(in_constraint)->GetNumVelocityStepsOverride(); + toJph(in_character)->AddToPhysicsSystem(static_cast(in_activation), in_lock_bodies); } - +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_Constraint_SetNumPositionStepsOverride(JPC_Constraint *in_constraint, int in_num_position_steps_override) +JPC_Character_RemoveFromPhysicsSystem(JPC_Character *in_character, bool in_lock_bodies) { - toJph(in_constraint)->SetNumPositionStepsOverride(in_num_position_steps_override); + toJph(in_character)->RemoveFromPhysicsSystem(in_lock_bodies); } - -JPC_API int -JPC_Constraint_GetNumPositionStepsOverride(const JPC_Constraint *in_constraint) +//-------------------------------------------------------------------------------------------------- +JPC_API void +JPC_Character_GetPosition(const JPC_Character *in_character, JPC_Real out_position[3]) { - return toJph(in_constraint)->GetNumPositionStepsOverride(); + storeRVec3(out_position, toJph(in_character)->GetPosition()); } - +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_Constraint_SetEnabled(JPC_Constraint *in_constraint, bool in_enabled) +JPC_Character_SetPosition(JPC_Character *in_character, const JPC_Real in_position[3]) { - toJph(in_constraint)->SetEnabled(in_enabled); -} - -JPC_API bool -JPC_Constraint_GetEnabled(const JPC_Constraint *in_constraint) -{ - return toJph(in_constraint)->GetEnabled(); + toJph(in_character)->SetPosition(loadRVec3(in_position)); } //-------------------------------------------------------------------------------------------------- -// -// JPC_TwoBodyConstraint -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_Body * -JPC_TwoBodyConstraint_GetBody1(const JPC_TwoBodyConstraint *in_constraint) -{ - return toJpc(toJph(in_constraint)->GetBody1()); -} - -JPC_API JPC_Body * -JPC_TwoBodyConstraint_GetBody2(const JPC_TwoBodyConstraint *in_constraint) -{ - return toJpc(toJph(in_constraint)->GetBody2()); -} - -JPC_API void -JPC_TwoBodyConstraint_GetConstraintToBody1Matrix(const JPC_TwoBodyConstraint *in_constraint, float out_matrix[16]) -{ - storeMat44(out_matrix, toJph(in_constraint)->GetConstraintToBody1Matrix()); -} - JPC_API void -JPC_TwoBodyConstraint_GetConstraintToBody2Matrix(const JPC_TwoBodyConstraint *in_constraint, float out_matrix[16]) +JPC_Character_GetLinearVelocity(const JPC_Character *in_character, float out_linear_velocity[3]) { - storeMat44(out_matrix, toJph(in_constraint)->GetConstraintToBody2Matrix()); + storeVec3(out_linear_velocity, toJph(in_character)->GetLinearVelocity()); } //-------------------------------------------------------------------------------------------------- -// -// JPC_FixedConstraint -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_FixedConstraint_GetTotalLambdaPosition(const JPC_FixedConstraint *in_constraint, float out_lambda[3]) -{ - storeVec3(out_lambda, toJph(in_constraint)->GetTotalLambdaPosition()); -} - JPC_API void -JPC_FixedConstraint_GetTotalLambdaRotation(const JPC_FixedConstraint *in_constraint, float out_lambda[3]) +JPC_Character_SetLinearVelocity(JPC_Character *in_character, const float in_linear_velocity[3]) { - storeVec3(out_lambda, toJph(in_constraint)->GetTotalLambdaRotation()); + toJph(in_character)->SetLinearVelocity(loadVec3(in_linear_velocity)); } //-------------------------------------------------------------------------------------------------- // -// JPC_DistanceConstraint +// JPC_CharacterVirtualSettings // //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_DistanceConstraint_SetDistance(JPC_DistanceConstraint *in_constraint, float in_min_distance, float in_max_distance) -{ - toJph(in_constraint)->SetDistance(in_min_distance, in_max_distance); -} - -JPC_API float -JPC_DistanceConstraint_GetMinDistance(const JPC_DistanceConstraint *in_constraint) -{ - return toJph(in_constraint)->GetMinDistance(); -} - -JPC_API float -JPC_DistanceConstraint_GetMaxDistance(const JPC_DistanceConstraint *in_constraint) -{ - return toJph(in_constraint)->GetMaxDistance(); -} - -JPC_API void -JPC_DistanceConstraint_SetFrequency(JPC_DistanceConstraint *in_constraint, float in_frequency) -{ - toJph(in_constraint)->SetFrequency(in_frequency); -} - -JPC_API float -JPC_DistanceConstraint_GetFrequency(const JPC_DistanceConstraint *in_constraint) -{ - return toJph(in_constraint)->GetFrequency(); -} - -JPC_API void -JPC_DistanceConstraint_SetDamping(JPC_DistanceConstraint *in_constraint, float in_damping) -{ - toJph(in_constraint)->SetDamping(in_damping); -} - -JPC_API float -JPC_DistanceConstraint_GetDamping(const JPC_DistanceConstraint *in_constraint) -{ - return toJph(in_constraint)->GetDamping(); -} - -JPC_API float -JPC_DistanceConstraint_GetTotalLambdaPosition(const JPC_DistanceConstraint *in_constraint) +JPC_API JPC_CharacterVirtualSettings * +JPC_CharacterVirtualSettings_Create() { - return toJph(in_constraint)->GetTotalLambdaPosition(); + auto settings = new JPH::CharacterVirtualSettings(); + settings->AddRef(); + return toJpc(settings); } //-------------------------------------------------------------------------------------------------- -// -// JPC_PointConstraint -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_PointConstraint_SetPoint1(JPC_PointConstraint *in_constraint, const JPC_ConstraintSpace in_space, const JPC_Real in_point1[3]) -{ - toJph(in_constraint)->SetPoint1(constraintSpaceToJph(in_space), loadRVec3(in_point1)); -} - JPC_API void -JPC_PointConstraint_SetPoint2(JPC_PointConstraint *in_constraint, const JPC_ConstraintSpace in_space, const JPC_Real in_point2[3]) +JPC_CharacterVirtualSettings_Release(JPC_CharacterVirtualSettings *in_settings) { - toJph(in_constraint)->SetPoint2(constraintSpaceToJph(in_space), loadRVec3(in_point2)); -} - -JPC_API void -JPC_PointConstraint_GetLocalSpacePoint1(const JPC_PointConstraint *in_constraint, float out_point[3]) -{ - storeVec3(out_point, toJph(in_constraint)->GetLocalSpacePoint1()); -} - -JPC_API void -JPC_PointConstraint_GetLocalSpacePoint2(const JPC_PointConstraint *in_constraint, float out_point[3]) -{ - storeVec3(out_point, toJph(in_constraint)->GetLocalSpacePoint2()); -} - -JPC_API void -JPC_PointConstraint_GetTotalLambdaPosition(const JPC_PointConstraint *in_constraint, float out_lambda[3]) -{ - storeVec3(out_lambda, toJph(in_constraint)->GetTotalLambdaPosition()); + toJph(in_settings)->Release(); } //-------------------------------------------------------------------------------------------------- // -// JPC_HingeConstraint +// JPC_CharacterVirtual // //-------------------------------------------------------------------------------------------------- -JPC_API float -JPC_HingeConstraint_GetCurrentAngle(const JPC_HingeConstraint *in_constraint) -{ - return toJph(in_constraint)->GetCurrentAngle(); -} - -JPC_API void -JPC_HingeConstraint_SetMaxFrictionTorque(JPC_HingeConstraint *in_constraint, float in_friction_torque) -{ - toJph(in_constraint)->SetMaxFrictionTorque(in_friction_torque); -} - -JPC_API float -JPC_HingeConstraint_GetMaxFrictionTorque(const JPC_HingeConstraint *in_constraint) -{ - return toJph(in_constraint)->GetMaxFrictionTorque(); -} - -JPC_API JPC_MotorSettings * -JPC_HingeConstraint_GetMotorSettings(JPC_HingeConstraint *in_constraint) -{ - return toJpc(&toJph(in_constraint)->GetMotorSettings()); -} - -JPC_API void -JPC_HingeConstraint_SetMotorState(JPC_HingeConstraint *in_constraint, JPC_MotorState in_state) -{ - toJph(in_constraint)->SetMotorState(motorStateToJph(in_state)); -} - -JPC_API JPC_MotorState -JPC_HingeConstraint_GetMotorState(const JPC_HingeConstraint *in_constraint) -{ - return toJpc(toJph(in_constraint)->GetMotorState()); -} - -JPC_API void -JPC_HingeConstraint_SetTargetAngularVelocity(JPC_HingeConstraint *in_constraint, float in_angular_velocity) -{ - toJph(in_constraint)->SetTargetAngularVelocity(in_angular_velocity); -} - -JPC_API float -JPC_HingeConstraint_GetTargetAngularVelocity(const JPC_HingeConstraint *in_constraint) -{ - return toJph(in_constraint)->GetTargetAngularVelocity(); -} - -JPC_API void -JPC_HingeConstraint_SetTargetAngle(JPC_HingeConstraint *in_constraint, float in_angle) -{ - toJph(in_constraint)->SetTargetAngle(in_angle); -} - -JPC_API float -JPC_HingeConstraint_GetTargetAngle(const JPC_HingeConstraint *in_constraint) -{ - return toJph(in_constraint)->GetTargetAngle(); -} - -JPC_API void -JPC_HingeConstraint_SetLimits(JPC_HingeConstraint *in_constraint, float in_limits_min, float in_limits_max) -{ - toJph(in_constraint)->SetLimits(in_limits_min, in_limits_max); -} - -JPC_API float -JPC_HingeConstraint_GetLimitsMin(const JPC_HingeConstraint *in_constraint) -{ - return toJph(in_constraint)->GetLimitsMin(); -} - -JPC_API float -JPC_HingeConstraint_GetLimitsMax(const JPC_HingeConstraint *in_constraint) -{ - return toJph(in_constraint)->GetLimitsMax(); -} - -JPC_API bool -JPC_HingeConstraint_HasLimits(const JPC_HingeConstraint *in_constraint) +JPC_API JPC_CharacterVirtual * +JPC_CharacterVirtual_Create(const JPC_CharacterVirtualSettings *in_settings, + const JPC_Real in_position[3], + const float in_rotation[4], + JPC_PhysicsSystem *in_physics_system) { - return toJph(in_constraint)->HasLimits(); -} - -JPC_API void -JPC_HingeConstraint_GetTotalLambdaPosition(const JPC_HingeConstraint *in_constraint, float out_lambda[3]) -{ - storeVec3(out_lambda, toJph(in_constraint)->GetTotalLambdaPosition()); -} - -JPC_API void -JPC_HingeConstraint_GetTotalLambdaRotation(const JPC_HingeConstraint *in_constraint, float *out_x, float *out_y) -{ - auto out = toJph(in_constraint)->GetTotalLambdaRotation(); - *out_x = out[0]; - *out_y = out[1]; -} - -JPC_API float -JPC_HingeConstraint_GetTotalLambdaRotationLimits(const JPC_HingeConstraint *in_constraint) -{ - return toJph(in_constraint)->GetTotalLambdaRotationLimits(); -} - -JPC_API float -JPC_HingeConstraint_GetTotalLambdaMotor(const JPC_HingeConstraint *in_constraint) -{ - return toJph(in_constraint)->GetTotalLambdaMotor(); + auto character = new JPH::CharacterVirtual( + toJph(in_settings), loadVec3(in_position), JPH::Quat(loadVec4(in_rotation)), toJph(in_physics_system)); + return toJpc(character); } //-------------------------------------------------------------------------------------------------- -// -// JPC_ConeConstraint -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_ConeConstraint_SetHalfConeAngle(JPC_ConeConstraint *in_self, float in_half_cone_angle) -{ - toJph(in_self)->SetHalfConeAngle(in_half_cone_angle); -} - -JPC_API float -JPC_ConeConstraint_GetCosHalfConeAngle(const JPC_ConeConstraint *in_self) -{ - return toJph(in_self)->GetCosHalfConeAngle(); -} - JPC_API void -JPC_ConeConstraint_GetTotalLambdaPosition(const JPC_ConeConstraint *in_self, float out_lambda[3]) -{ - storeVec3(out_lambda, toJph(in_self)->GetTotalLambdaPosition()); -} - -JPC_API float -JPC_ConeConstraint_GetTotalLambdaRotation(const JPC_ConeConstraint *in_self) +JPC_CharacterVirtual_Destroy(JPC_CharacterVirtual *in_character) { - return toJph(in_self)->GetTotalLambdaRotation(); + delete toJph(in_character); } //-------------------------------------------------------------------------------------------------- -// -// JPC_SliderConstraint -// -//-------------------------------------------------------------------------------------------------- -JPC_API float -JPC_SliderConstraint_GetCurrentPosition(const JPC_SliderConstraint *in_self) -{ - return toJph(in_self)->GetCurrentPosition(); -} - -JPC_API float -JPC_SliderConstraint_GetMaxFrictionForce(const JPC_SliderConstraint *in_self) -{ - return toJph(in_self)->GetMaxFrictionForce(); -} - -JPC_API void -JPC_SliderConstraint_SetMaxFrictionForce(JPC_SliderConstraint *in_self, float in_friction) -{ - toJph(in_self)->SetMaxFrictionForce(in_friction); -} - -JPC_API JPC_MotorSettings * -JPC_SliderConstraint_GetMotorSettings(JPC_SliderConstraint *in_self) -{ - return toJpc(&toJph(in_self)->GetMotorSettings()); -} - -JPC_API void -JPC_SliderConstraint_SetMotorState(JPC_SliderConstraint *in_self, JPC_MotorState in_state) -{ - toJph(in_self)->SetMotorState(motorStateToJph(in_state)); -} - -JPC_API JPC_MotorState -JPC_SliderConstraint_GetMotorState(const JPC_SliderConstraint *in_self) -{ - return toJpc(toJph(in_self)->GetMotorState()); -} - -JPC_API void -JPC_SliderConstraint_SetTargetVelocity(JPC_SliderConstraint *in_self, float in_velocity) -{ - toJph(in_self)->SetTargetVelocity(in_velocity); -} - -JPC_API float -JPC_SliderConstraint_GetTargetVelocity(const JPC_SliderConstraint *in_self) -{ - return toJph(in_self)->GetTargetVelocity(); -} - JPC_API void -JPC_SliderConstraint_SetTargetPosition(JPC_SliderConstraint *in_self, float in_position) +JPC_CharacterVirtual_Update(JPC_CharacterVirtual *in_character, + float in_delta_time, + const float in_gravity[3], + const void *in_broad_phase_layer_filter, + const void *in_object_layer_filter, + const void *in_body_filter, + const void *in_shape_filter, + JPC_TempAllocator *in_temp_allocator) { - toJph(in_self)->SetTargetPosition(in_position); + const JPH::BroadPhaseLayerFilter broad_phase_layer_filter{}; + const JPH::ObjectLayerFilter object_layer_filter{}; + const JPH::BodyFilter body_filter{}; + const JPH::ShapeFilter shape_filter{}; + toJph(in_character)->Update( + in_delta_time, + loadVec3(in_gravity), + in_broad_phase_layer_filter ? + *static_cast(in_broad_phase_layer_filter) : broad_phase_layer_filter, + in_object_layer_filter ? + *static_cast(in_object_layer_filter) : object_layer_filter, + in_body_filter ? *static_cast(in_body_filter) : body_filter, + in_shape_filter ? *static_cast(in_shape_filter) : shape_filter, + *reinterpret_cast(in_temp_allocator)); } - -JPC_API float -JPC_SliderConstraint_GetTargetPosition(const JPC_SliderConstraint *in_self) +//-------------------------------------------------------------------------------------------------- +JPC_API JPC_CharacterGroundState +JPC_CharacterVirtual_GetGroundState(JPC_CharacterVirtual *in_character) { - return toJph(in_self)->GetTargetPosition(); + return toJpc(toJph(in_character)->GetGroundState()); } - +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_SliderConstraint_SetLimits(JPC_SliderConstraint *in_self, float in_limits_min, float in_limits_max) -{ - toJph(in_self)->SetLimits(in_limits_min, in_limits_max); -} - -JPC_API float -JPC_SliderConstraint_GetLimitsMin(const JPC_SliderConstraint *in_self) +JPC_CharacterVirtual_SetListener(JPC_CharacterVirtual *in_character, void *in_listener) { - return toJph(in_self)->GetLimitsMin(); -} - -JPC_API float -JPC_SliderConstraint_GetLimitsMax(const JPC_SliderConstraint *in_self) -{ - return toJph(in_self)->GetLimitsMax(); -} - -JPC_API bool -JPC_SliderConstraint_HasLimits(const JPC_SliderConstraint *in_self) -{ - return toJph(in_self)->HasLimits(); + if (in_listener == nullptr) + { + toJph(in_character)->SetListener(nullptr); + return; + } + toJph(in_character)->SetListener(static_cast(in_listener)); } - +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_SliderConstraint_SetFrequency(JPC_SliderConstraint *in_self, float in_frequency) -{ - toJph(in_self)->SetFrequency(in_frequency); -} - -JPC_API float -JPC_SliderConstraint_GetFrequency(const JPC_SliderConstraint *in_self) +JPC_CharacterVirtual_UpdateGroundVelocity(JPC_CharacterVirtual *in_character) { - return toJph(in_self)->GetFrequency(); + toJph(in_character)->UpdateGroundVelocity(); } - +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_SliderConstraint_SetDamping(JPC_SliderConstraint *in_self, float in_damping) -{ - toJph(in_self)->SetDamping(in_damping); -} - -JPC_API float -JPC_SliderConstraint_GetDamping(const JPC_SliderConstraint *in_self) +JPC_CharacterVirtual_GetGroundVelocity(const JPC_CharacterVirtual *in_character, float out_ground_velocity[3]) { - return toJph(in_self)->GetDamping(); + storeVec3(out_ground_velocity, toJph(in_character)->GetGroundVelocity()); } - +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_SliderConstraint_GetTotalLambdaPosition(const JPC_SliderConstraint *in_self, float *out_x, float *out_y) -{ - auto out = toJph(in_self)->GetTotalLambdaPosition(); - *out_x = out[0]; - *out_y = out[1]; -} - -JPC_API float -JPC_SliderConstraint_GetTotalLambdaPositionLimits(const JPC_SliderConstraint *in_self) +JPC_CharacterVirtual_GetPosition(const JPC_CharacterVirtual *in_character, JPC_Real out_position[3]) { - return toJph(in_self)->GetTotalLambdaPositionLimits(); + storeRVec3(out_position, toJph(in_character)->GetPosition()); } - +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_SliderConstraint_GetTotalLambdaRotation(const JPC_SliderConstraint *in_self, float out_rotation[3]) +JPC_CharacterVirtual_SetPosition(JPC_CharacterVirtual *in_character, const JPC_Real in_position[3]) { - storeVec3(out_rotation, toJph(in_self)->GetTotalLambdaRotation()); -} - -JPC_API float -JPC_SliderConstraint_GetTotalLambdaMotor(const JPC_SliderConstraint *in_self) -{ - return toJph(in_self)->GetTotalLambdaMotor(); + toJph(in_character)->SetPosition(loadRVec3(in_position)); } //-------------------------------------------------------------------------------------------------- -// -// JPC_SwingTwistConstraint -// -//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_SwingTwistConstraint_GetLocalSpacePosition1(const JPC_SwingTwistConstraint *in_self, float out_position[3]) +JPC_CharacterVirtual_GetRotation(const JPC_CharacterVirtual *in_character, float out_rotation[4]) { - storeVec3(out_position, toJph(in_self)->GetLocalSpacePosition1()); + storeVec4(out_rotation, toJph(in_character)->GetRotation().GetXYZW()); } - +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_SwingTwistConstraint_GetLocalSpacePosition2(const JPC_SwingTwistConstraint *in_self, float out_position[3]) +JPC_CharacterVirtual_SetRotation(JPC_CharacterVirtual *in_character, const float in_rotation[4]) { - storeVec3(out_position, toJph(in_self)->GetLocalSpacePosition2()); + toJph(in_character)->SetRotation(JPH::Quat(loadVec4(in_rotation))); } - +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_SwingTwistConstraint_GetConstraintToBody1(const JPC_SwingTwistConstraint *in_self, float out_rotation[4]) +JPC_CharacterVirtual_GetLinearVelocity(const JPC_CharacterVirtual *in_character, float out_linear_velocity[3]) { - storeQuat(out_rotation, toJph(in_self)->GetConstraintToBody1()); + storeVec3(out_linear_velocity, toJph(in_character)->GetLinearVelocity()); } - +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_SwingTwistConstraint_GetConstraintToBody2(const JPC_SwingTwistConstraint *in_self, float out_rotation[4]) +JPC_CharacterVirtual_SetLinearVelocity(JPC_CharacterVirtual *in_character, const float in_linear_velocity[3]) { - storeQuat(out_rotation, toJph(in_self)->GetConstraintToBody2()); -} - -JPC_API float -JPC_SwingTwistConstraint_GetNormalHalfConeAngle(const JPC_SwingTwistConstraint *in_self) -{ - return toJph(in_self)->GetNormalHalfConeAngle(); -} - -JPC_API void -JPC_SwingTwistConstraint_SetNormalHalfConeAngle(JPC_SwingTwistConstraint *in_self, float in_angle) -{ - toJph(in_self)->SetNormalHalfConeAngle(in_angle); -} - -JPC_API float -JPC_SwingTwistConstraint_GetPlaneHalfConeAngle(const JPC_SwingTwistConstraint *in_self) -{ - return toJph(in_self)->GetPlaneHalfConeAngle(); -} - -JPC_API void -JPC_SwingTwistConstraint_SetPlaneHalfConeAngle(JPC_SwingTwistConstraint *in_self, float in_angle) -{ - toJph(in_self)->SetPlaneHalfConeAngle(in_angle); -} - -JPC_API float -JPC_SwingTwistConstraint_GetTwistMinAngle(const JPC_SwingTwistConstraint *in_self) -{ - return toJph(in_self)->GetTwistMinAngle(); -} - -JPC_API void -JPC_SwingTwistConstraint_SetTwistMinAngle(JPC_SwingTwistConstraint *in_self, float in_angle) -{ - toJph(in_self)->SetTwistMinAngle(in_angle); -} - -JPC_API float -JPC_SwingTwistConstraint_GetTwistMaxAngle(const JPC_SwingTwistConstraint *in_self) -{ - return toJph(in_self)->GetTwistMaxAngle(); -} - -JPC_API void -JPC_SwingTwistConstraint_SetTwistMaxAngle(JPC_SwingTwistConstraint *in_self, float in_angle) -{ - toJph(in_self)->SetTwistMaxAngle(in_angle); -} - -JPC_API JPC_MotorSettings * -JPC_SwingTwistConstraint_GetSwingMotorSettings(JPC_SwingTwistConstraint *in_self) -{ - return toJpc(&toJph(in_self)->GetSwingMotorSettings()); -} - -JPC_API JPC_MotorSettings * -JPC_SwingTwistConstraint_GetTwistMotorSettings(JPC_SwingTwistConstraint *in_self) -{ - return toJpc(&toJph(in_self)->GetTwistMotorSettings()); -} - -JPC_API void -JPC_SwingTwistConstraint_SetMaxFrictionTorque(JPC_SwingTwistConstraint *in_self, float in_friction_torque) -{ - toJph(in_self)->SetMaxFrictionTorque(in_friction_torque); -} - -JPC_API float -JPC_SwingTwistConstraint_GetMaxFrictionTorque(const JPC_SwingTwistConstraint *in_self) -{ - return toJph(in_self)->GetMaxFrictionTorque(); -} - -JPC_API void -JPC_SwingTwistConstraint_SetSwingMotorState(JPC_SwingTwistConstraint *in_self, JPC_MotorState in_state) -{ - toJph(in_self)->SetSwingMotorState(motorStateToJph(in_state)); -} - -JPC_API JPC_MotorState -JPC_SwingTwistConstraint_GetSwingMotorState(const JPC_SwingTwistConstraint *in_self) -{ - return toJpc(toJph(in_self)->GetSwingMotorState()); -} - -JPC_API void -JPC_SwingTwistConstraint_SetTwistMotorState(JPC_SwingTwistConstraint *in_self, JPC_MotorState in_state) -{ - toJph(in_self)->SetTwistMotorState(motorStateToJph(in_state)); -} - -JPC_API JPC_MotorState -JPC_SwingTwistConstraint_GetTwistMotorState(const JPC_SwingTwistConstraint *in_self) -{ - return toJpc(toJph(in_self)->GetTwistMotorState()); -} - -JPC_API void -JPC_SwingTwistConstraint_SetTargetAngularVelocityCS(JPC_SwingTwistConstraint *in_self, const float in_angular_velocity[3]) -{ - toJph(in_self)->SetTargetAngularVelocityCS(loadVec3(in_angular_velocity)); -} - -JPC_API void -JPC_SwingTwistConstraint_GetTargetAngularVelocityCS(const JPC_SwingTwistConstraint *in_self, float out_angular_velocity[3]) -{ - storeVec3(out_angular_velocity, toJph(in_self)->GetTargetAngularVelocityCS()); -} - -JPC_API void -JPC_SwingTwistConstraint_SetTargetOrientationCS(JPC_SwingTwistConstraint *in_self, const float in_orientation[4]) -{ - toJph(in_self)->SetTargetOrientationCS(loadQuat(in_orientation)); -} - -JPC_API void -JPC_SwingTwistConstraint_GetTargetOrientationCS(const JPC_SwingTwistConstraint *in_self, float out_orientation[4]) -{ - storeQuat(out_orientation, toJph(in_self)->GetTargetOrientationCS()); -} - -JPC_API void -JPC_SwingTwistConstraint_SetTargetOrientationBS(JPC_SwingTwistConstraint *in_self, const float in_orientation[4]) -{ - toJph(in_self)->SetTargetOrientationBS(loadQuat(in_orientation)); -} - -// JPC_API void -// JPC_SwingTwistConstraint_GetRotationInConstraintSpace(const JPC_SwingTwistConstraint *in_self, float out_rotation[4]) -// { -// storeQuat(out_rotation, toJph(in_self)->GetRotationInConstraintSpace()); -// } - -JPC_API void -JPC_SwingTwistConstraint_GetTotalLambdaPosition(const JPC_SwingTwistConstraint *in_self, float out_position[3]) -{ - storeVec3(out_position, toJph(in_self)->GetTotalLambdaPosition()); -} - -JPC_API float -JPC_SwingTwistConstraint_GetTotalLambdaTwist(const JPC_SwingTwistConstraint *in_self) -{ - return toJph(in_self)->GetTotalLambdaTwist(); -} - -JPC_API float -JPC_SwingTwistConstraint_GetTotalLambdaSwingY(const JPC_SwingTwistConstraint *in_self) -{ - return toJph(in_self)->GetTotalLambdaSwingY(); -} - -JPC_API float -JPC_SwingTwistConstraint_GetTotalLambdaSwingZ(const JPC_SwingTwistConstraint *in_self) -{ - return toJph(in_self)->GetTotalLambdaSwingZ(); -} - -JPC_API void -JPC_SwingTwistConstraint_GetTotalLambdaMotor(const JPC_SwingTwistConstraint *in_self, float out_motor[3]) -{ - storeVec3(out_motor, toJph(in_self)->GetTotalLambdaMotor()); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_SixDOFConstraint -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_SixDOFConstraint_SetTranslationLimits(JPC_SixDOFConstraint *in_self, const float in_limit_min[3], const float in_limit_max[3]) -{ - toJph(in_self)->SetTranslationLimits(loadVec3(in_limit_min), loadVec3(in_limit_max)); -} - -JPC_API void -JPC_SixDOFConstraint_SetRotationLimits(JPC_SixDOFConstraint *in_self, const float in_limit_min[3], const float in_limit_max[3]) -{ - toJph(in_self)->SetRotationLimits(loadVec3(in_limit_min), loadVec3(in_limit_max)); -} - -JPC_API float -JPC_SixDOFConstraint_GetLimitsMin(const JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis) -{ - return toJph(in_self)->GetLimitsMin(sixDofConstraintAxisToJph(in_axis)); -} - -JPC_API float -JPC_SixDOFConstraint_GetLimitsMax(const JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis) -{ - return toJph(in_self)->GetLimitsMax(sixDofConstraintAxisToJph(in_axis)); -} - -JPC_API bool -JPC_SixDOFConstraint_IsFixedAxis(const JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis) -{ - return toJph(in_self)->IsFixedAxis(sixDofConstraintAxisToJph(in_axis)); -} - -JPC_API bool -JPC_SixDOFConstraint_IsFreeAxis(const JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis) -{ - return toJph(in_self)->IsFreeAxis(sixDofConstraintAxisToJph(in_axis)); -} - -JPC_API void -JPC_SixDOFConstraint_SetMaxFriction(JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis, float in_friction) -{ - toJph(in_self)->SetMaxFriction(sixDofConstraintAxisToJph(in_axis), in_friction); -} - -JPC_API float -JPC_SixDOFConstraint_GetMaxFriction(const JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis) -{ - return toJph(in_self)->GetMaxFriction(sixDofConstraintAxisToJph(in_axis)); -} - -// JPC_API void -// JPC_SixDOFConstraint_GetRotationInConstraintSpace(const JPC_SixDOFConstraint *in_self, float out_rotation[4]) -// { -// return storeQuat(out_rotation, toJph(in_self)->GetRotationInConstraintSpace()); -// } - -JPC_API JPC_MotorSettings * -JPC_SixDOFConstraint_GetMotorSettings(JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis) -{ - return toJpc(&toJph(in_self)->GetMotorSettings(sixDofConstraintAxisToJph(in_axis))); -} - -JPC_API void -JPC_SixDOFConstraint_SetMotorState(JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis, JPC_MotorState in_state) -{ - toJph(in_self)->SetMotorState(sixDofConstraintAxisToJph(in_axis), motorStateToJph(in_state)); -} - -JPC_API JPC_MotorState -JPC_SixDOFConstraint_GetMotorState(const JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis) -{ - return toJpc(toJph(in_self)->GetMotorState(sixDofConstraintAxisToJph(in_axis))); -} - -JPC_API void -JPC_SixDOFConstraint_GetTargetVelocityCS(const JPC_SixDOFConstraint *in_self, float out_velocity[3]) -{ - storeVec3(out_velocity, toJph(in_self)->GetTargetVelocityCS()); -} - -JPC_API void -JPC_SixDOFConstraint_SetTargetVelocityCS(JPC_SixDOFConstraint *in_self, const float in_velocity[3]) -{ - toJph(in_self)->SetTargetVelocityCS(loadVec3(in_velocity)); -} - -JPC_API void -JPC_SixDOFConstraint_SetTargetAngularVelocityCS(JPC_SixDOFConstraint *in_self, const float in_angular_velocity[3]) -{ - toJph(in_self)->SetTargetAngularVelocityCS(loadVec3(in_angular_velocity)); -} - -JPC_API void -JPC_SixDOFConstraint_GetTargetAngularVelocityCS(const JPC_SixDOFConstraint *in_self, float out_angular_velocity[3]) -{ - storeVec3(out_angular_velocity, toJph(in_self)->GetTargetAngularVelocityCS()); -} - -JPC_API void -JPC_SixDOFConstraint_GetTargetPositionCS(const JPC_SixDOFConstraint *in_self, float out_position[3]) -{ - storeVec3(out_position, toJph(in_self)->GetTargetPositionCS()); -} - -JPC_API void -JPC_SixDOFConstraint_SetTargetPositionCS(JPC_SixDOFConstraint *in_self, const float in_position[3]) -{ - toJph(in_self)->SetTargetPositionCS(loadVec3(in_position)); -} - -JPC_API void -JPC_SixDOFConstraint_SetTargetOrientationCS(JPC_SixDOFConstraint *in_self, const float in_orientation[4]) -{ - toJph(in_self)->SetTargetOrientationCS(loadQuat(in_orientation)); -} - -JPC_API void -JPC_SixDOFConstraint_GetTargetOrientationCS(const JPC_SixDOFConstraint *in_self, float out_orientation[4]) -{ - storeQuat(out_orientation, toJph(in_self)->GetTargetOrientationCS()); -} - -JPC_API void -JPC_SixDOFConstraint_SetTargetOrientationBS(JPC_SixDOFConstraint *in_self, const float in_orientation[4]) -{ - toJph(in_self)->SetTargetOrientationBS(loadQuat(in_orientation)); -} - -JPC_API void -JPC_SixDOFConstraint_GetTotalLambdaPosition(const JPC_SixDOFConstraint *in_self, float out_position[3]) -{ - storeVec3(out_position, toJph(in_self)->GetTotalLambdaPosition()); -} - -JPC_API void -JPC_SixDOFConstraint_GetTotalLambdaRotation(const JPC_SixDOFConstraint *in_self, float out_rotation[3]) -{ - storeVec3(out_rotation, toJph(in_self)->GetTotalLambdaRotation()); -} - -JPC_API void -JPC_SixDOFConstraint_GetTotalLambdaMotorTranslation(const JPC_SixDOFConstraint *in_self, float out_translation[3]) -{ - storeVec3(out_translation, toJph(in_self)->GetTotalLambdaMotorTranslation()); -} - -JPC_API void -JPC_SixDOFConstraint_GetTotalLambdaMotorRotation(const JPC_SixDOFConstraint *in_self, float out_rotation[3]) -{ - storeVec3(out_rotation, toJph(in_self)->GetTotalLambdaMotorRotation()); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_MotorSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_MotorSettings_SetForceLimits(JPC_MotorSettings *in_settings, float in_min, float in_max) -{ - toJph(in_settings)->SetForceLimits(in_min, in_max); -} - -JPC_API void -JPC_MotorSettings_SetTorqueLimits(JPC_MotorSettings *in_settings, float in_min, float in_max) -{ - toJph(in_settings)->SetTorqueLimits(in_min, in_max); -} - -JPC_API void -JPC_MotorSettings_SetForceLimit(JPC_MotorSettings *in_settings, float in_limit) -{ - toJph(in_settings)->SetForceLimit(in_limit); -} - -JPC_API void -JPC_MotorSettings_SetTorqueLimit(JPC_MotorSettings *in_settings, float in_limit) -{ - toJph(in_settings)->SetTorqueLimit(in_limit); -} - -JPC_API bool -JPC_MotorSettings_IsValid(const JPC_MotorSettings *in_settings) -{ - return toJph(in_settings)->IsValid(); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_ConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_ConstraintSettings_Release(JPC_ConstraintSettings *in_self) -{ - toJph(in_self)->Release(); -} - -JPC_API bool -JPC_ConstraintSettings_GetEnabled(const JPC_ConstraintSettings *in_self) -{ - return toJph(in_self)->mEnabled; -} - -JPC_API void -JPC_ConstraintSettings_SetEnabled(JPC_ConstraintSettings *in_self, bool in_enabled) -{ - toJph(in_self)->mEnabled = in_enabled; -} - -JPC_API int -JPC_ConstraintSettings_GetNumVelocityStepsOverride(const JPC_ConstraintSettings *in_self) -{ - return toJph(in_self)->mNumVelocityStepsOverride; -} - -JPC_API void -JPC_ConstraintSettings_SetNumVelocityStepsOverride(JPC_ConstraintSettings *in_self, int in_num_velocity_steps_override) -{ - toJph(in_self)->mNumVelocityStepsOverride = in_num_velocity_steps_override; -} - -JPC_API int -JPC_ConstraintSettings_GetNumPositionStepsOverride(const JPC_ConstraintSettings *in_self) -{ - return toJph(in_self)->mNumPositionStepsOverride; -} - -JPC_API void -JPC_ConstraintSettings_SetNumPositionStepsOverride(JPC_ConstraintSettings *in_self, int in_num_position_steps_override) -{ - toJph(in_self)->mNumPositionStepsOverride = in_num_position_steps_override; -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_TwoBodyConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_TwoBodyConstraint * -JPC_TwoBodyConstraintSettings_CreateConstraint(const JPC_TwoBodyConstraintSettings *in_self, JPC_Body *in_body1, JPC_Body *in_body2) -{ - return toJpc(toJph(in_self)->Create(*toJph(in_body1), *toJph(in_body2))); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_FixedConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_FixedConstraintSettings * -JPC_FixedConstraintSettings_Create() -{ - auto result = new JPH::FixedConstraintSettings(); - result->AddRef(); - return toJpc(result); -} - -JPC_API JPC_ConstraintSpace -JPC_FixedConstraintSettings_GetSpace(const JPC_FixedConstraintSettings *in_self) -{ - return toJpc(toJph(in_self)->mSpace); -} - -JPC_API void -JPC_FixedConstraintSettings_SetSpace(JPC_FixedConstraintSettings *in_self, JPC_ConstraintSpace in_space) -{ - toJph(in_self)->mSpace = constraintSpaceToJph(in_space); -} - -JPC_API bool -JPC_FixedConstraintSettings_GetAutoDetectPoint(const JPC_FixedConstraintSettings *in_self) -{ - return toJph(in_self)->mAutoDetectPoint; -} - -JPC_API void -JPC_FixedConstraintSettings_SetAutoDetectPoint(JPC_FixedConstraintSettings *in_self, bool in_auto_detect_point) -{ - toJph(in_self)->mAutoDetectPoint = in_auto_detect_point; -} - -JPC_API void -JPC_FixedConstraintSettings_GetPoint1(const JPC_FixedConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPoint1); -} - -JPC_API void -JPC_FixedConstraintSettings_SetPoint1(JPC_FixedConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPoint1 = loadRVec3(in_point); -} - -JPC_API void -JPC_FixedConstraintSettings_GetAxisX1(const JPC_FixedConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mAxisX1); -} - -JPC_API void -JPC_FixedConstraintSettings_SetAxisX1(JPC_FixedConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mAxisX1 = loadVec3(in_axis); -} - -JPC_API void -JPC_FixedConstraintSettings_GetAxisY1(const JPC_FixedConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mAxisY1); -} - -JPC_API void -JPC_FixedConstraintSettings_SetAxisY1(JPC_FixedConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mAxisY1 = loadVec3(in_axis); -} - -JPC_API void -JPC_FixedConstraintSettings_GetPoint2(const JPC_FixedConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPoint2); -} - -JPC_API void -JPC_FixedConstraintSettings_SetPoint2(JPC_FixedConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPoint2 = loadRVec3(in_point); -} - -JPC_API void -JPC_FixedConstraintSettings_GetAxisX2(const JPC_FixedConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mAxisX2); -} - -JPC_API void -JPC_FixedConstraintSettings_SetAxisX2(JPC_FixedConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mAxisX2 = loadVec3(in_axis); -} - -JPC_API void -JPC_FixedConstraintSettings_GetAxisY2(const JPC_FixedConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mAxisY2); -} - -JPC_API void -JPC_FixedConstraintSettings_SetAxisY2(JPC_FixedConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mAxisY2 = loadVec3(in_axis); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_DistanceConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_DistanceConstraintSettings * -JPC_DistanceConstraintSettings_Create() -{ - auto result = new JPH::DistanceConstraintSettings(); - result->AddRef(); - return toJpc(result); -} - -JPC_API JPC_ConstraintSpace -JPC_DistanceConstraintSettings_GetSpace(const JPC_DistanceConstraintSettings *in_self) -{ - return toJpc(toJph(in_self)->mSpace); -} - -JPC_API void -JPC_DistanceConstraintSettings_SetSpace(JPC_DistanceConstraintSettings *in_self, JPC_ConstraintSpace in_space) -{ - toJph(in_self)->mSpace = constraintSpaceToJph(in_space); -} - -JPC_API void -JPC_DistanceConstraintSettings_GetPoint1(const JPC_DistanceConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPoint1); -} - -JPC_API void -JPC_DistanceConstraintSettings_SetPoint1(JPC_DistanceConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPoint1 = loadRVec3(in_point); -} - -JPC_API void -JPC_DistanceConstraintSettings_GetPoint2(const JPC_DistanceConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPoint2); -} - -JPC_API void -JPC_DistanceConstraintSettings_SetPoint2(JPC_DistanceConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPoint2 = loadRVec3(in_point); -} - -JPC_API float -JPC_DistanceConstraintSettings_GetMinDistance(const JPC_DistanceConstraintSettings *in_self) -{ - return toJph(in_self)->mMinDistance; -} - -JPC_API void -JPC_DistanceConstraintSettings_SetMinDistance(JPC_DistanceConstraintSettings *in_self, float in_distance) -{ - toJph(in_self)->mMinDistance = in_distance; -} - -JPC_API float -JPC_DistanceConstraintSettings_GetMaxDistance(const JPC_DistanceConstraintSettings *in_self) -{ - return toJph(in_self)->mMaxDistance; -} - -JPC_API void -JPC_DistanceConstraintSettings_SetMaxDistance(JPC_DistanceConstraintSettings *in_self, float in_distance) -{ - toJph(in_self)->mMaxDistance = in_distance; -} - -JPC_API float -JPC_DistanceConstraintSettings_GetFrequency(const JPC_DistanceConstraintSettings *in_self) -{ - return toJph(in_self)->mFrequency; -} - -JPC_API void -JPC_DistanceConstraintSettings_SetFrequency(JPC_DistanceConstraintSettings *in_self, float in_frequency) -{ - toJph(in_self)->mFrequency = in_frequency; -} - -JPC_API float -JPC_DistanceConstraintSettings_GetDamping(const JPC_DistanceConstraintSettings *in_self) -{ - return toJph(in_self)->mDamping; -} - -JPC_API void -JPC_DistanceConstraintSettings_SetDamping(JPC_DistanceConstraintSettings *in_self, float in_damping) -{ - toJph(in_self)->mDamping = in_damping; -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_PointConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_PointConstraintSettings * -JPC_PointConstraintSettings_Create() -{ - auto result = new JPH::PointConstraintSettings(); - result->AddRef(); - return toJpc(result); -} - -JPC_API JPC_ConstraintSpace -JPC_PointConstraintSettings_GetSpace(const JPC_PointConstraintSettings *in_self) -{ - return toJpc(toJph(in_self)->mSpace); -} - -JPC_API void -JPC_PointConstraintSettings_SetSpace(JPC_PointConstraintSettings *in_self, JPC_ConstraintSpace in_space) -{ - toJph(in_self)->mSpace = constraintSpaceToJph(in_space); -} - -JPC_API void -JPC_PointConstraintSettings_GetPoint1(const JPC_PointConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPoint1); -} - -JPC_API void -JPC_PointConstraintSettings_SetPoint1(JPC_PointConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPoint2 = loadRVec3(in_point); -} - -JPC_API void -JPC_PointConstraintSettings_GetPoint2(const JPC_PointConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPoint2); -} - -JPC_API void -JPC_PointConstraintSettings_SetPoint2(JPC_PointConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPoint2 = loadRVec3(in_point); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_HingeConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_HingeConstraintSettings * -JPC_HingeConstraintSettings_Create() -{ - auto result = new JPH::HingeConstraintSettings(); - result->AddRef(); - return toJpc(result); -} - -JPC_API JPC_ConstraintSpace -JPC_HingeConstraintSettings_GetSpace(const JPC_HingeConstraintSettings *in_self) -{ - return toJpc(toJph(in_self)->mSpace); -} - -JPC_API void -JPC_HingeConstraintSettings_SetSpace(JPC_HingeConstraintSettings *in_self, JPC_ConstraintSpace in_space) -{ - toJph(in_self)->mSpace = constraintSpaceToJph(in_space); -} - -JPC_API void -JPC_HingeConstraintSettings_GetPoint1(const JPC_HingeConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPoint1); -} - -JPC_API void -JPC_HingeConstraintSettings_SetPoint1(JPC_HingeConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPoint1 = loadRVec3(in_point); -} - -JPC_API void -JPC_HingeConstraintSettings_GetHingeAxis1(const JPC_HingeConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mHingeAxis1); -} - -JPC_API void -JPC_HingeConstraintSettings_SetHingeAxis1(JPC_HingeConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mHingeAxis1 = loadVec3(in_axis); -} - -JPC_API void -JPC_HingeConstraintSettings_GetNormalAxis1(const JPC_HingeConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mNormalAxis1); -} - -JPC_API void -JPC_HingeConstraintSettings_SetNormalAxis1(JPC_HingeConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mNormalAxis1 = loadVec3(in_axis); -} - -JPC_API void -JPC_HingeConstraintSettings_GetPoint2(const JPC_HingeConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPoint2); -} - -JPC_API void -JPC_HingeConstraintSettings_SetPoint2(JPC_HingeConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPoint2 = loadRVec3(in_point); -} - -JPC_API void -JPC_HingeConstraintSettings_GetHingeAxis2(const JPC_HingeConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mHingeAxis2); -} - -JPC_API void -JPC_HingeConstraintSettings_SetHingeAxis2(JPC_HingeConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mHingeAxis2 = loadVec3(in_axis); -} - -JPC_API void -JPC_HingeConstraintSettings_GetNormalAxis2(const JPC_HingeConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mNormalAxis2); -} - -JPC_API void -JPC_HingeConstraintSettings_SetNormalAxis2(JPC_HingeConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mNormalAxis2 = loadVec3(in_axis); -} - -JPC_API float -JPC_HingeConstraintSettings_GetLimitsMin(const JPC_HingeConstraintSettings *in_self) -{ - return toJph(in_self)->mLimitsMin; -} - -JPC_API void -JPC_HingeConstraintSettings_SetLimitsMin(JPC_HingeConstraintSettings *in_self, float in_limits) -{ - toJph(in_self)->mLimitsMin = in_limits; -} - -JPC_API float -JPC_HingeConstraintSettings_GetLimitsMax(const JPC_HingeConstraintSettings *in_self) -{ - return toJph(in_self)->mLimitsMax; -} - -JPC_API void -JPC_HingeConstraintSettings_SetLimitsMax(JPC_HingeConstraintSettings *in_self, float in_limits) -{ - toJph(in_self)->mLimitsMax = in_limits; -} - -JPC_API float -JPC_HingeConstraintSettings_GetMaxFrictionTorque(const JPC_HingeConstraintSettings *in_self) -{ - return toJph(in_self)->mMaxFrictionTorque; -} - -JPC_API void -JPC_HingeConstraintSettings_SetMaxFrictionTorque(JPC_HingeConstraintSettings *in_self, float in_max_friction_torque) -{ - toJph(in_self)->mMaxFrictionTorque = in_max_friction_torque; -} - -JPC_API JPC_MotorSettings * -JPC_HingeConstraintSettings_GetMotorSettings(JPC_HingeConstraintSettings *in_self) -{ - return toJpc(&toJph(in_self)->mMotorSettings); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_ConeConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_ConeConstraintSettings * -JPC_ConeConstraintSettings_Create() -{ - auto result = new JPH::ConeConstraintSettings(); - result->AddRef(); - return toJpc(result); -} - -JPC_API JPC_ConstraintSpace -JPC_ConeConstraintSettings_GetSpace(const JPC_ConeConstraintSettings *in_self) -{ - return toJpc(toJph(in_self)->mSpace); -} - -JPC_API void -JPC_ConeConstraintSettings_SetSpace(JPC_ConeConstraintSettings *in_self, JPC_ConstraintSpace in_space) -{ - toJph(in_self)->mSpace = constraintSpaceToJph(in_space); -} - -JPC_API void -JPC_ConeConstraintSettings_GetPoint1(const JPC_ConeConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPoint1); -} - -JPC_API void -JPC_ConeConstraintSettings_SetPoint1(JPC_ConeConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPoint1 = loadRVec3(in_point); -} - -JPC_API void -JPC_ConeConstraintSettings_GetTwistAxis1(const JPC_ConeConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mTwistAxis1); -} - -JPC_API void -JPC_ConeConstraintSettings_SetTwistAxis1(JPC_ConeConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mTwistAxis1 = loadVec3(in_axis); -} - -JPC_API void -JPC_ConeConstraintSettings_GetPoint2(const JPC_ConeConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPoint2); -} - -JPC_API void -JPC_ConeConstraintSettings_SetPoint2(JPC_ConeConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPoint2 = loadRVec3(in_point); -} - -JPC_API void -JPC_ConeConstraintSettings_GetTwistAxis2(const JPC_ConeConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mTwistAxis2); -} - -JPC_API void -JPC_ConeConstraintSettings_SetTwistAxis2(JPC_ConeConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mTwistAxis2 = loadVec3(in_axis); -} - -JPC_API float -JPC_ConeConstraintSettings_GetHalfConeAngle(const JPC_ConeConstraintSettings *in_self) -{ - return toJph(in_self)->mHalfConeAngle; -} - -JPC_API void -JPC_ConeConstraintSettings_SetHalfConeAngle(JPC_ConeConstraintSettings *in_self, float in_half_cone_angle) -{ - toJph(in_self)->mHalfConeAngle = in_half_cone_angle; -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_SliderConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_SliderConstraintSettings * -JPC_SliderConstraintSettings_Create() -{ - auto result = new JPH::SliderConstraintSettings(); - result->AddRef(); - return toJpc(result); -} - -JPC_API void -JPC_SliderConstraintSettings_SetSliderAxis(JPC_SliderConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->SetSliderAxis(loadVec3(in_axis)); -} - -JPC_API JPC_ConstraintSpace -JPC_SliderConstraintSettings_GetSpace(const JPC_SliderConstraintSettings *in_self) -{ - return toJpc(toJph(in_self)->mSpace); -} - -JPC_API void -JPC_SliderConstraintSettings_SetSpace(JPC_SliderConstraintSettings *in_self, JPC_ConstraintSpace in_space) -{ - toJph(in_self)->mSpace = constraintSpaceToJph(in_space); -} - -JPC_API bool -JPC_SliderConstraintSettings_GetAutoDetectPoint(const JPC_SliderConstraintSettings *in_self) -{ - return toJph(in_self)->mAutoDetectPoint; -} - -JPC_API void -JPC_SliderConstraintSettings_SetAutoDetectPoint(JPC_SliderConstraintSettings *in_self, bool in_auto_detect_point) -{ - toJph(in_self)->mAutoDetectPoint = in_auto_detect_point; -} - -JPC_API void -JPC_SliderConstraintSettings_GetPoint1(const JPC_SliderConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPoint1); -} - -JPC_API void -JPC_SliderConstraintSettings_SetPoint1(JPC_SliderConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPoint1 = loadRVec3(in_point); -} - -JPC_API void -JPC_SliderConstraintSettings_GetSliderAxis1(const JPC_SliderConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mSliderAxis1); -} - -JPC_API void -JPC_SliderConstraintSettings_SetSliderAxis1(JPC_SliderConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mSliderAxis1 = loadVec3(in_axis); -} - -JPC_API void -JPC_SliderConstraintSettings_GetNormalAxis1(const JPC_SliderConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mNormalAxis1); -} - -JPC_API void -JPC_SliderConstraintSettings_SetNormalAxis1(JPC_SliderConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mNormalAxis1 = loadVec3(in_axis); -} - -JPC_API void -JPC_SliderConstraintSettings_GetPoint2(const JPC_SliderConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPoint2); -} - -JPC_API void -JPC_SliderConstraintSettings_SetPoint2(JPC_SliderConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPoint2 = loadRVec3(in_point); -} - -JPC_API void -JPC_SliderConstraintSettings_GetSliderAxis2(const JPC_SliderConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mSliderAxis2); -} - -JPC_API void -JPC_SliderConstraintSettings_SetSliderAxis2(JPC_SliderConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mSliderAxis2 = loadVec3(in_axis); -} - -JPC_API void -JPC_SliderConstraintSettings_GetNormalAxis2(const JPC_SliderConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mNormalAxis2); -} - -JPC_API void -JPC_SliderConstraintSettings_SetNormalAxis2(JPC_SliderConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mNormalAxis2 = loadVec3(in_axis); -} - -JPC_API float -JPC_SliderConstraintSettings_GetLimitsMin(const JPC_SliderConstraintSettings *in_self) -{ - return toJph(in_self)->mLimitsMin; -} - -JPC_API void -JPC_SliderConstraintSettings_SetLimitsMin(JPC_SliderConstraintSettings *in_self, float in_limits) -{ - toJph(in_self)->mLimitsMin = in_limits; -} - -JPC_API float -JPC_SliderConstraintSettings_GetLimitsMax(const JPC_SliderConstraintSettings *in_self) -{ - return toJph(in_self)->mLimitsMax; -} - -JPC_API void -JPC_SliderConstraintSettings_SetLimitsMax(JPC_SliderConstraintSettings *in_self, float in_limits) -{ - toJph(in_self)->mLimitsMax = in_limits; -} - -JPC_API float -JPC_SliderConstraintSettings_GetFrequency(const JPC_SliderConstraintSettings *in_self) -{ - return toJph(in_self)->mFrequency; -} - -JPC_API void -JPC_SliderConstraintSettings_SetFrequency(JPC_SliderConstraintSettings *in_self, float in_frequency) -{ - toJph(in_self)->mFrequency = in_frequency; -} - -JPC_API float -JPC_SliderConstraintSettings_GetDamping(const JPC_SliderConstraintSettings *in_self) -{ - return toJph(in_self)->mDamping; -} - -JPC_API void -JPC_SliderConstraintSettings_SetDamping(JPC_SliderConstraintSettings *in_self, float in_damping) -{ - toJph(in_self)->mDamping = in_damping; -} - -JPC_API float -JPC_SliderConstraintSettings_GetMaxFrictionForce(const JPC_SliderConstraintSettings *in_self) -{ - return toJph(in_self)->mMaxFrictionForce; -} - -JPC_API void -JPC_SliderConstraintSettings_SetMaxFrictionForce(JPC_SliderConstraintSettings *in_self, float in_max_friction_force) -{ - toJph(in_self)->mMaxFrictionForce = in_max_friction_force; -} - -JPC_API JPC_MotorSettings * -JPC_SliderConstraintSettings_GetMotorSettings(JPC_SliderConstraintSettings *in_self) -{ - return toJpc(&toJph(in_self)->mMotorSettings); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_SwingTwistConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_SwingTwistConstraintSettings * -JPC_SwingTwistConstraintSettings_Create() -{ - auto result = new JPH::SwingTwistConstraintSettings(); - result->AddRef(); - return toJpc(result); -} - -JPC_API JPC_ConstraintSpace -JPC_SwingTwistConstraintSettings_GetSpace(const JPC_SwingTwistConstraintSettings *in_self) -{ - return toJpc(toJph(in_self)->mSpace); -} - -JPC_API void -JPC_SwingTwistConstraintSettings_SetSpace(JPC_SwingTwistConstraintSettings *in_self, JPC_ConstraintSpace in_space) -{ - toJph(in_self)->mSpace = constraintSpaceToJph(in_space); -} - -JPC_API void -JPC_SwingTwistConstraintSettings_GetPosition1(const JPC_SwingTwistConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPosition1); -} - -JPC_API void -JPC_SwingTwistConstraintSettings_SetPosition1(JPC_SwingTwistConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPosition1 = loadRVec3(in_point); -} - -JPC_API void -JPC_SwingTwistConstraintSettings_GetTwistAxis1(const JPC_SwingTwistConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mTwistAxis1); -} - -JPC_API void -JPC_SwingTwistConstraintSettings_SetTwistAxis1(JPC_SwingTwistConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mTwistAxis1 = loadVec3(in_axis); -} - -JPC_API void -JPC_SwingTwistConstraintSettings_GetPlaneAxis1(const JPC_SwingTwistConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mPlaneAxis1); -} - -JPC_API void -JPC_SwingTwistConstraintSettings_SetPlaneAxis1(JPC_SwingTwistConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mPlaneAxis1 = loadVec3(in_axis); -} - -JPC_API void -JPC_SwingTwistConstraintSettings_GetPosition2(const JPC_SwingTwistConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPosition2); -} - -JPC_API void -JPC_SwingTwistConstraintSettings_SetPosition2(JPC_SwingTwistConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPosition2 = loadRVec3(in_point); -} - -JPC_API void -JPC_SwingTwistConstraintSettings_GetTwistAxis2(const JPC_SwingTwistConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mTwistAxis2); -} - -JPC_API void -JPC_SwingTwistConstraintSettings_SetTwistAxis2(JPC_SwingTwistConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mTwistAxis2 = loadVec3(in_axis); -} - -JPC_API void -JPC_SwingTwistConstraintSettings_GetPlaneAxis2(const JPC_SwingTwistConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mPlaneAxis2); -} - -JPC_API void -JPC_SwingTwistConstraintSettings_SetPlaneAxis2(JPC_SwingTwistConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mPlaneAxis2 = loadVec3(in_axis); -} - -JPC_API float -JPC_SwingTwistConstraintSettings_GetNormalHalfConeAngle(const JPC_SwingTwistConstraintSettings *in_self) -{ - return toJph(in_self)->mNormalHalfConeAngle; -} - -JPC_API void -JPC_SwingTwistConstraintSettings_SetNormalHalfConeAngle(JPC_SwingTwistConstraintSettings *in_self, float in_angle) -{ - toJph(in_self)->mNormalHalfConeAngle = in_angle; -} - -JPC_API float -JPC_SwingTwistConstraintSettings_GetPlaneHalfConeAngle(const JPC_SwingTwistConstraintSettings *in_self) -{ - return toJph(in_self)->mPlaneHalfConeAngle; -} - -JPC_API void -JPC_SwingTwistConstraintSettings_SetPlaneHalfConeAngle(JPC_SwingTwistConstraintSettings *in_self, float in_angle) -{ - toJph(in_self)->mPlaneHalfConeAngle = in_angle; -} - -JPC_API float -JPC_SwingTwistConstraintSettings_GetTwistMinAngle(const JPC_SwingTwistConstraintSettings *in_self) -{ - return toJph(in_self)->mTwistMinAngle; -} - -JPC_API void -JPC_SwingTwistConstraintSettings_SetTwistMinAngle(JPC_SwingTwistConstraintSettings *in_self, float in_angle) -{ - toJph(in_self)->mTwistMinAngle = in_angle; -} - -JPC_API float -JPC_SwingTwistConstraintSettings_GetTwistMaxAngle(const JPC_SwingTwistConstraintSettings *in_self) -{ - return toJph(in_self)->mTwistMaxAngle; -} - -JPC_API void -JPC_SwingTwistConstraintSettings_SetTwistMaxAngle(JPC_SwingTwistConstraintSettings *in_self, float in_angle) -{ - toJph(in_self)->mTwistMaxAngle = in_angle; -} - -JPC_API float -JPC_SwingTwistConstraintSettings_GetMaxFrictionTorque(const JPC_SwingTwistConstraintSettings *in_self) -{ - return toJph(in_self)->mMaxFrictionTorque; -} - -JPC_API void -JPC_SwingTwistConstraintSettings_SetMaxFrictionTorque(JPC_SwingTwistConstraintSettings *in_self, float in_max_friction_torque) -{ - toJph(in_self)->mMaxFrictionTorque = in_max_friction_torque; -} - -JPC_API JPC_MotorSettings * -JPC_SwingTwistConstraintSettings_GetSwingMotorSettings(JPC_SwingTwistConstraintSettings *in_self) -{ - return toJpc(&toJph(in_self)->mSwingMotorSettings); -} - -JPC_API JPC_MotorSettings * -JPC_SwingTwistConstraintSettings_GetTwistMotorSettings(JPC_SwingTwistConstraintSettings *in_self) -{ - return toJpc(&toJph(in_self)->mTwistMotorSettings); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_SixDOFConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_SixDOFConstraintSettings * -JPC_SixDOFConstraintSettings_Create() -{ - auto result = new JPH::SixDOFConstraintSettings(); - result->AddRef(); - return toJpc(result); -} - -JPC_API JPC_ConstraintSpace -JPC_SixDOFConstraintSettings_GetSpace(const JPC_SixDOFConstraintSettings *in_self) -{ - return toJpc(toJph(in_self)->mSpace); -} - -JPC_API void -JPC_SixDOFConstraintSettings_SetSpace(JPC_SixDOFConstraintSettings *in_self, JPC_ConstraintSpace in_space) -{ - toJph(in_self)->mSpace = constraintSpaceToJph(in_space); -} - -JPC_API void -JPC_SixDOFConstraintSettings_GetPosition1(const JPC_SixDOFConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPosition1); -} - -JPC_API void -JPC_SixDOFConstraintSettings_SetPosition1(JPC_SixDOFConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPosition1 = loadRVec3(in_point); -} - -JPC_API void -JPC_SixDOFConstraintSettings_GetAxisX1(const JPC_SixDOFConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mAxisX1); -} - -JPC_API void -JPC_SixDOFConstraintSettings_SetAxisX1(JPC_SixDOFConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mAxisX1 = loadVec3(in_axis); -} - -JPC_API void -JPC_SixDOFConstraintSettings_GetAxisY1(const JPC_SixDOFConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mAxisY1); -} - -JPC_API void -JPC_SixDOFConstraintSettings_SetAxisY1(JPC_SixDOFConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mAxisY1 = loadVec3(in_axis); -} - -JPC_API void -JPC_SixDOFConstraintSettings_GetPosition2(const JPC_SixDOFConstraintSettings *in_self, JPC_Real out_point[3]) -{ - storeRVec3(out_point, toJph(in_self)->mPosition2); -} - -JPC_API void -JPC_SixDOFConstraintSettings_SetPosition2(JPC_SixDOFConstraintSettings *in_self, const JPC_Real in_point[3]) -{ - toJph(in_self)->mPosition2 = loadRVec3(in_point); -} - -JPC_API void -JPC_SixDOFConstraintSettings_GetAxisX2(const JPC_SixDOFConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mAxisX2); -} - -JPC_API void -JPC_SixDOFConstraintSettings_SetAxisX2(JPC_SixDOFConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mAxisX2 = loadVec3(in_axis); -} - -JPC_API void -JPC_SixDOFConstraintSettings_GetAxisY2(const JPC_SixDOFConstraintSettings *in_self, float out_axis[3]) -{ - storeVec3(out_axis, toJph(in_self)->mAxisY2); -} - -JPC_API void -JPC_SixDOFConstraintSettings_SetAxisY2(JPC_SixDOFConstraintSettings *in_self, const float in_axis[3]) -{ - toJph(in_self)->mAxisY2 = loadVec3(in_axis); -} - -JPC_API float * -JPC_SixDOFConstraintSettings_GetMaxFriction(JPC_SixDOFConstraintSettings *in_self) { - return toJph(in_self)->mMaxFriction; -} - -JPC_API float * -JPC_SixDOFConstraintSettings_GetLimitMin(JPC_SixDOFConstraintSettings *in_self) -{ - return toJph(in_self)->mLimitMin; -} - -JPC_API float * -JPC_SixDOFConstraintSettings_GetLimitMax(JPC_SixDOFConstraintSettings *in_self) -{ - return toJph(in_self)->mLimitMax; -} - -JPC_API void -JPC_SixDOFConstraintSettings_MakeFreeAxis(JPC_SixDOFConstraintSettings *in_self, JPC_SixDOFConstraintAxis in_axis) -{ - toJph(in_self)->MakeFreeAxis(sixDofConstraintAxisToJph(in_axis)); -} - -JPC_API bool -JPC_SixDOFConstraintSettings_IsFreeAxis(const JPC_SixDOFConstraintSettings *in_self, JPC_SixDOFConstraintAxis in_axis) -{ - return toJph(in_self)->IsFreeAxis(sixDofConstraintAxisToJph(in_axis)); -} - -JPC_API void -JPC_SixDOFConstraintSettings_MakeFixedAxis(JPC_SixDOFConstraintSettings *in_self, JPC_SixDOFConstraintAxis in_axis) -{ - toJph(in_self)->MakeFixedAxis(sixDofConstraintAxisToJph(in_axis)); -} - -JPC_API bool -JPC_SixDOFConstraintSettings_IsFixedAxis(const JPC_SixDOFConstraintSettings *in_self, JPC_SixDOFConstraintAxis in_axis) -{ - return toJph(in_self)->IsFixedAxis(sixDofConstraintAxisToJph(in_axis)); -} - -JPC_API void -JPC_SixDOFConstraintSettings_SetLimitedAxis(JPC_SixDOFConstraintSettings *in_self, JPC_SixDOFConstraintAxis in_axis, float in_min, float in_max) -{ - toJph(in_self)->SetLimitedAxis(sixDofConstraintAxisToJph(in_axis), in_min, in_max); -} - -JPC_API JPC_MotorSettings ** -JPC_SixDOFConstraintSettings_GetMotorSettings(JPC_SixDOFConstraintSettings *in_self) -{ - return reinterpret_cast(toJph(in_self)->mMotorSettings); -} -//-------------------------------------------------------------------------------------------------- -// -// JPC_GJKClosestPoint -// -//-------------------------------------------------------------------------------------------------- -#define GJK(Name1, Name2, JpcA, JpcB, JphA, JphB) \ -JPC_API bool \ -Name1(JPC_GJKClosestPoint *in_gjk, \ - const JpcA *in_a, \ - const JpcB *in_b, \ - float in_tolerance, \ - float io_v[3]) \ -{ \ - return toJph(in_gjk)->Intersects( \ - *reinterpret_cast(in_a), \ - *reinterpret_cast(in_b), \ - in_tolerance, \ - *reinterpret_cast(io_v) \ - ); \ -} \ - \ -JPC_API float \ -Name2(JPC_GJKClosestPoint *in_gjk, \ - const JpcA *in_a, \ - const JpcB *in_b, \ - float in_tolerance, \ - float in_max_dist_sq, \ - float io_v[3], \ - float out_point_a[3], \ - float out_point_b[3]) \ -{ \ - return toJph(in_gjk)->GetClosestPoints( \ - *reinterpret_cast(in_a), \ - *reinterpret_cast(in_b), \ - in_tolerance, \ - in_max_dist_sq, \ - *reinterpret_cast(io_v), \ - *reinterpret_cast(out_point_a), \ - *reinterpret_cast(out_point_b) \ - ); \ -} - -GJK(JPC_GJKClosestPoint_IntersectsConvexConvex, JPC_GJKClosestPoint_GetClosestPointsConvexConvex, JPC_ConvexShapeSupport, JPC_ConvexShape, JPH::ConvexShape::Support, JPH::ConvexShape::Support) -GJK(JPC_GJKClosestPoint_IntersectsConvexPoint, JPC_GJKClosestPoint_GetClosestPointsConvexPoint, JPC_ConvexShapeSupport, JPC_PointConvexSupport, JPH::ConvexShape::Support, JPH::PointConvexSupport) - -#undef GJK -//-------------------------------------------------------------------------------------------------- -// JoltJava: Java support -JPC_API uint32_t -JPJ_GetFeatures() -{ - uint32_t features = 0; -#ifdef JPH_DOUBLE_PRECISION - features |= 0x1; -#endif -#ifdef JPH_USE_SSE4_1 - features |= 0x2; -#endif -#ifdef JPH_USE_SSE4_2 - features |= 0x4; -#endif -#ifdef JPH_USE_AVX - features |= 0x8; -#endif -#ifdef JPH_USE_AVX2 - features |= 0x10; -#endif -#ifdef JPH_USE_AVX512 - features |= 0x20; -#endif -#ifdef JPH_USE_LZCNT - features |= 0x40; -#endif -#ifdef JPH_USE_TZCNT - features |= 0x80; -#endif -#ifdef JPH_USE_F16C - features |= 0x100; -#endif -#ifdef JPH_USE_FMADD - features |= 0x200; -#endif - return features; + toJph(in_character)->SetLinearVelocity(loadVec3(in_linear_velocity)); } -// END JoltJava diff --git a/JoltPhysicsC/JoltC/JoltPhysicsC.h b/JoltPhysicsC/JoltC/JoltPhysicsC.h index 73ed2266..d50d8fa8 100644 --- a/JoltPhysicsC/JoltC/JoltPhysicsC.h +++ b/JoltPhysicsC/JoltC/JoltPhysicsC.h @@ -1,4 +1,4 @@ -// JoltPhysicsC v0.0.4 - C API for Jolt Physics C++ library +// JoltPhysicsC v0.0.6 - C API for Jolt Physics C++ library #pragma once #include @@ -20,10 +20,6 @@ #define JPC_ENABLE_ASSERTS 0 #endif -#if defined(JPH_DEBUG_RENDERER) - #undef JPH_DEBUG_RENDERER -#endif - #if defined(JPH_DOUBLE_PRECISION) #define JPC_DOUBLE_PRECISION 1 #else @@ -38,6 +34,14 @@ typedef float JPC_Real; #define JPC_RVEC_ALIGN alignas(16) #endif +#if defined(JPH_DEBUG_RENDERER) + #define JPC_DEBUG_RENDERER 1 +#else + #define JPC_DEBUG_RENDERER 0 +#endif + +#define JPC_PI 3.14159265358979323846f + #define JPC_COLLISION_GROUP_INVALID_GROUP 0xffffffff #define JPC_COLLISION_GROUP_INVALID_SUB_GROUP 0xffffffff @@ -61,6 +65,15 @@ enum JPC_MAX_PHYSICS_BARRIERS = 8 }; +typedef uint8_t JPC_PhysicsUpdateError; +enum +{ + JPC_PHYSICS_UPDATE_NO_ERROR = 0, + JPC_PHYSICS_UPDATE_MANIFOLD_CACHE_FULL = 1 << 0, + JPC_PHYSICS_UPDATE_BODY_PAIR_CACHE_FULL = 1 << 1, + JPC_PHYSICS_UPDATE_CONTACT_CONSTRAINTS_FULL = 1 << 2, +}; + typedef uint8_t JPC_ShapeType; enum { @@ -99,9 +112,53 @@ enum JPC_SHAPE_SUB_TYPE_USER5 = 18, JPC_SHAPE_SUB_TYPE_USER6 = 19, JPC_SHAPE_SUB_TYPE_USER7 = 20, - JPC_SHAPE_SUB_TYPE_USER8 = 21 + JPC_SHAPE_SUB_TYPE_USER8 = 21, + JPC_SHAPE_SUB_TYPE_USER_CONVEX1 = 22, + JPC_SHAPE_SUB_TYPE_USER_CONVEX2 = 23, + JPC_SHAPE_SUB_TYPE_USER_CONVEX3 = 24, + JPC_SHAPE_SUB_TYPE_USER_CONVEX4 = 25, + JPC_SHAPE_SUB_TYPE_USER_CONVEX5 = 26, + JPC_SHAPE_SUB_TYPE_USER_CONVEX6 = 27, + JPC_SHAPE_SUB_TYPE_USER_CONVEX7 = 28, + JPC_SHAPE_SUB_TYPE_USER_CONVEX8 = 29, }; +typedef enum JPC_ConstraintType +{ + JPC_CONSTRAINT_TYPE_CONSTRAINT = 0, + JPC_CONSTRAINT_TYPE_TWO_BODY_CONSTRAINT = 1, + _JPC_CONSTRAINT_TYPE_FORCEU32 = 0x7fffffff +} JPC_ConstraintType; + +typedef enum JPC_ConstraintSubType +{ + JPC_CONSTRAINT_SUB_TYPE_FIXED = 0, + JPC_CONSTRAINT_SUB_TYPE_POINT = 1, + JPC_CONSTRAINT_SUB_TYPE_HINGE = 2, + JPC_CONSTRAINT_SUB_TYPE_SLIDER = 3, + JPC_CONSTRAINT_SUB_TYPE_DISTANCE = 4, + JPC_CONSTRAINT_SUB_TYPE_CONE = 5, + JPC_CONSTRAINT_SUB_TYPE_SWING_TWIST = 6, + JPC_CONSTRAINT_SUB_TYPE_SIX_DOF = 7, + JPC_CONSTRAINT_SUB_TYPE_PATH = 8, + JPC_CONSTRAINT_SUB_TYPE_VEHICLE = 9, + JPC_CONSTRAINT_SUB_TYPE_RACK_AND_PINION = 10, + JPC_CONSTRAINT_SUB_TYPE_GEAR = 11, + JPC_CONSTRAINT_SUB_TYPE_PULLEY = 12, + JPC_CONSTRAINT_SUB_TYPE_USER1 = 13, + JPC_CONSTRAINT_SUB_TYPE_USER2 = 14, + JPC_CONSTRAINT_SUB_TYPE_USER3 = 15, + JPC_CONSTRAINT_SUB_TYPE_USER4 = 16, + _JPC_CONSTRAINT_SUB_TYPE_FORCEU32 = 0x7fffffff +} JPC_ConstraintSubType; + +typedef enum JPC_ConstraintSpace +{ + JPC_CONSTRAINT_SPACE_LOCAL_TO_BODY_COM = 0, + JPC_CONSTRAINT_SPACE_WORLD_SPACE = 1, + _JPC_CONSTRAINT_SPACE_FORCEU32 = 0x7fffffff +} JPC_ConstraintSpace; + typedef uint8_t JPC_MotionType; enum { @@ -125,6 +182,15 @@ enum JPC_OVERRIDE_MASS_PROPS_MASS_INERTIA_PROVIDED = 2 }; +typedef enum JPC_CharacterGroundState +{ + JPC_CHARACTER_GROUND_STATE_ON_GROUND = 0, + JPC_CHARACTER_GROUND_STATE_ON_STEEP_GROUND = 1, + JPC_CHARACTER_GROUND_STATE_NOT_SUPPORTED = 2, + JPC_CHARACTER_GROUND_STATE_IN_AIR = 3, + _JPC_CHARACTER_GROUND_FORCEU32 = 0x7fffffff +} JPC_CharacterGroundState; + typedef enum JPC_Activation { JPC_ACTIVATION_ACTIVATE = 0, @@ -132,18 +198,6 @@ typedef enum JPC_Activation _JPC_ACTIVATION_FORCEU32 = 0x7fffffff } JPC_Activation; -typedef enum JPC_ActiveEdgeMode -{ - JPC_COLLIDE_ONLY_WITH_ACTIVE = 0, - JPC_COLLIDE_WITH_ALL = 1 -} JPC_ActiveEdgeMode; - -typedef enum JPC_CollectFacesMode -{ - JPC_COLLECT_FACES = 0, - JPC_NO_FACES = 1 -} JPC_CollectFacesMode; - typedef enum JPC_ValidateResult { JPC_VALIDATE_RESULT_ACCEPT_ALL_CONTACTS = 0, @@ -154,67 +208,48 @@ typedef enum JPC_ValidateResult } JPC_ValidateResult; typedef uint8_t JPC_BackFaceMode; -enum { - JPC_BACK_FACE_IGNORE = 0, +enum +{ + JPC_BACK_FACE_IGNORE = 0, JPC_BACK_FACE_COLLIDE = 1 }; -typedef uint8_t JPC_ConstraintType; -enum { - JPC_CONSTRAINT_TYPE_CONSTRAINT = 0, - JPC_CONSTRAINT_TYPE_TWO_BODY_CONSTRAINT = 1 -}; - -typedef uint8_t JPC_ConstraintSubType; -enum { - JPC_CONSTRAINT_SUB_TYPE_FIXED = 0, - JPC_CONSTRAINT_SUB_TYPE_POINT = 1, - JPC_CONSTRAINT_SUB_TYPE_HINGE = 2, - JPC_CONSTRAINT_SUB_TYPE_SLIDER = 3, - JPC_CONSTRAINT_SUB_TYPE_DISTANCE = 4, - JPC_CONSTRAINT_SUB_TYPE_CONE = 5, - JPC_CONSTRAINT_SUB_TYPE_SWING_TWIST = 6, - JPC_CONSTRAINT_SUB_TYPE_SIX_DOF = 7, - JPC_CONSTRAINT_SUB_TYPE_PATH = 8, - JPC_CONSTRAINT_SUB_TYPE_VEHICLE = 9, - JPC_CONSTRAINT_SUB_TYPE_RACK_AND_PINION = 10, - JPC_CONSTRAINT_SUB_TYPE_GEAR = 11, - JPC_CONSTRAINT_SUB_TYPE_PULLEY = 12, - JPC_CONSTRAINT_SUB_TYPE_USER1 = 13, - JPC_CONSTRAINT_SUB_TYPE_USER2 = 14, - JPC_CONSTRAINT_SUB_TYPE_USER3 = 15, - JPC_CONSTRAINT_SUB_TYPE_USER4 = 16 -}; - -typedef uint8_t JPC_ConstraintSpace; -enum { - JPC_CONSTRAINT_SPACE_LOCAL_TO_BODY_COM = 0, - JPC_CONSTRAINT_SPACE_WORLD_SPACE = 1 -}; - -typedef uint8_t JPC_MotorState; -enum { - JPC_MOTOR_STATE_OFF = 0, - JPC_MOTOR_STATE_VELOCITY = 1, - JPC_MOTOR_STATE_POSITION = 2 -}; - -typedef uint8_t JPC_SixDOFConstraintAxis; -enum { - JPC_SIX_DOF_CONSTRAINT_AXIS_TRANSLATION_X = 0, - JPC_SIX_DOF_CONSTRAINT_AXIS_TRANSLATION_Y = 1, - JPC_SIX_DOF_CONSTRAINT_AXIS_TRANSLATION_Z = 2, - - JPC_SIX_DOF_CONSTRAINT_AXIS_ROTATION_X = 3, - JPC_SIX_DOF_CONSTRAINT_AXIS_ROTATION_Y = 4, - JPC_SIX_DOF_CONSTRAINT_AXIS_ROTATION_Z = 5, -}; - -typedef uint8_t JPC_SupportMode; -enum { - JPC_SUPPORT_MODE_EXCLUDE_CONVEX_RADIUS = 0, - JPC_SUPPORT_MODE_INCLUDE_CONVEX_RADIUS = 1 -}; +#if JPC_DEBUG_RENDERER == 1 +typedef enum JPC_DebugRendererResult { + JPC_DEBUGRENDERER_SUCCESS, + JPC_DEBUGRENDERER_DUPLICATE_SINGLETON, + JPC_DEBUGRENDERER_MISSING_SINGLETON, + JPC_DEBUGRENDERER_INCOMPLETE_IMPL +} JPC_DebugRendererResult; + +typedef enum JPC_CullMode { + JPC_CULL_BACK_FACE = 0, + JPC_CULL_FRONT_FACE = 1, + JPC_CULLING_OFF = 2, + _JPC_CULLING_FORCEU32 = 0x7fffffff +} JPC_CullMode; + +typedef enum JPC_CastShadow { + JPC_CAST_SHADOW_ON = 0, + JPC_CAST_SHADOW_OFF = 1, + _JPC_CAST_SHADOW_FORCEU32 = 0x7fffffff +} JPC_CastShadow; + +typedef enum JPC_DrawMode { + JPC_DRAW_MODE_SOLID = 0, + JPC_DRAW_MODE_WIREFRAME = 1, + _JPC_DRAW_MODE_FORCEU32 = 0x7fffffff +} JPC_DrawMode; + +typedef enum JPC_ShapeColor { + JPC_INSTANCE_COLOR, // Random color per instance + JPC_SHAPE_TYPE_COLOR, // Convex = green, scaled = yellow, compound = orange, mesh = red + JPC_MOTION_TYPE_COLOR, // Static = grey, keyframed = green, dynamic = random color per instance + JPC_SLEEP_COLOR, // Static = grey, keyframed = green, dynamic = yellow, sleeping = red + JPC_ISLAND_COLOR, // Static = grey, active = random color per island, sleeping = light grey + JPC_MATERIAL_COLOR, // Color as defined by the PhysicsMaterial of the shape +} JPC_ShapeColor; +#endif //JPC_DEBUG_RENDERER //-------------------------------------------------------------------------------------------------- // // Types @@ -229,8 +264,6 @@ typedef uint32_t JPC_SubShapeID; typedef uint32_t JPC_CollisionGroupID; typedef uint32_t JPC_CollisionSubGroupID; -typedef void * JPC_BodyInterfaceAddState; - // Must be 16 byte aligned typedef void *(*JPC_AllocateFunction)(size_t in_size); typedef void (*JPC_FreeFunction)(void *in_block); @@ -242,92 +275,51 @@ typedef void (*JPC_AlignedFreeFunction)(void *in_block); // Opaque Types // //-------------------------------------------------------------------------------------------------- -typedef struct JPC_BodyIDVector JPC_BodyIDVector; typedef struct JPC_TempAllocator JPC_TempAllocator; typedef struct JPC_JobSystem JPC_JobSystem; typedef struct JPC_BodyInterface JPC_BodyInterface; typedef struct JPC_BodyLockInterface JPC_BodyLockInterface; -typedef struct JPC_BroadPhaseQuery JPC_BroadPhaseQuery; typedef struct JPC_NarrowPhaseQuery JPC_NarrowPhaseQuery; -typedef struct JPC_SupportingFace JPC_SupportingFace; -typedef struct JPC_ConvexShapeSupport JPC_ConvexShapeSupport; -typedef struct JPC_Shape JPC_Shape; -typedef struct JPC_ConvexShape JPC_ConvexShape; -typedef struct JPC_BoxShape JPC_BoxShape; -typedef struct JPC_SphereShape JPC_SphereShape; -typedef struct JPC_TriangleShape JPC_TriangleShape; -typedef struct JPC_CapsuleShape JPC_CapsuleShape; -typedef struct JPC_TaperedCapsuleShape JPC_TaperedCapsuleShape; -typedef struct JPC_CylinderShape JPC_CylinderShape; -typedef struct JPC_ConvexHullShape JPC_ConvexHullShape; -typedef struct JPC_HeightFieldShape JPC_HeightFieldShape; -typedef struct JPC_MeshShape JPC_MeshShape; -typedef struct JPC_CompoundShape JPC_CompoundShape; -typedef struct JPC_StaticCompoundShape JPC_StaticCompoundShape; -typedef struct JPC_MutableCompoundShape JPC_MutableCompoundShape; -typedef struct JPC_DecoratedShape JPC_DecoratedShape; -typedef struct JPC_ScaledShape JPC_ScaledShape; -typedef struct JPC_RotatedTranslatedShape JPC_RotatedTranslatedShape; -typedef struct JPC_OffsetCenterOfMassShape JPC_OffsetCenterOfMassShape; - -typedef struct JPC_ShapeSettings JPC_ShapeSettings; -typedef struct JPC_ConvexShapeSettings JPC_ConvexShapeSettings; -typedef struct JPC_BoxShapeSettings JPC_BoxShapeSettings; -typedef struct JPC_SphereShapeSettings JPC_SphereShapeSettings; -typedef struct JPC_TriangleShapeSettings JPC_TriangleShapeSettings; -typedef struct JPC_CapsuleShapeSettings JPC_CapsuleShapeSettings; -typedef struct JPC_TaperedCapsuleShapeSettings JPC_TaperedCapsuleShapeSettings; -typedef struct JPC_CylinderShapeSettings JPC_CylinderShapeSettings; -typedef struct JPC_ConvexHullShapeSettings JPC_ConvexHullShapeSettings; -typedef struct JPC_HeightFieldShapeSettings JPC_HeightFieldShapeSettings; -typedef struct JPC_MeshShapeSettings JPC_MeshShapeSettings; -typedef struct JPC_CompoundShapeSettings JPC_CompoundShapeSettings; -typedef struct JPC_StaticCompoundShapeSettings JPC_StaticCompoundShapeSettings; -typedef struct JPC_MutableCompoundShapeSettings JPC_MutableCompoundShapeSettings; -typedef struct JPC_DecoratedShapeSettings JPC_DecoratedShapeSettings; -typedef struct JPC_ScaledShapeSettings JPC_ScaledShapeSettings; -typedef struct JPC_RotatedTranslatedShapeSettings JPC_RotatedTranslatedShapeSettings; -typedef struct JPC_OffsetCenterOfMassShapeSettings JPC_OffsetCenterOfMassShapeSettings; +typedef struct JPC_ShapeSettings JPC_ShapeSettings; +typedef struct JPC_ConvexShapeSettings JPC_ConvexShapeSettings; +typedef struct JPC_BoxShapeSettings JPC_BoxShapeSettings; +typedef struct JPC_SphereShapeSettings JPC_SphereShapeSettings; +typedef struct JPC_TriangleShapeSettings JPC_TriangleShapeSettings; +typedef struct JPC_CapsuleShapeSettings JPC_CapsuleShapeSettings; +typedef struct JPC_TaperedCapsuleShapeSettings JPC_TaperedCapsuleShapeSettings; +typedef struct JPC_CylinderShapeSettings JPC_CylinderShapeSettings; +typedef struct JPC_ConvexHullShapeSettings JPC_ConvexHullShapeSettings; +typedef struct JPC_HeightFieldShapeSettings JPC_HeightFieldShapeSettings; +typedef struct JPC_MeshShapeSettings JPC_MeshShapeSettings; +typedef struct JPC_DecoratedShapeSettings JPC_DecoratedShapeSettings; +typedef struct JPC_CompoundShapeSettings JPC_CompoundShapeSettings; +typedef struct JPC_CharacterContactSettings JPC_CharacterContactSettings; + +typedef struct JPC_ConstraintSettings JPC_ConstraintSettings; +typedef struct JPC_TwoBodyConstraintSettings JPC_TwoBodyConstraintSettings; +typedef struct JPC_FixedConstraintSettings JPC_FixedConstraintSettings; typedef struct JPC_PhysicsSystem JPC_PhysicsSystem; typedef struct JPC_SharedMutex JPC_SharedMutex; -typedef struct JPC_PhysicsMaterial JPC_PhysicsMaterial; -typedef struct JPC_GroupFilter JPC_GroupFilter; - -typedef struct JPC_Constraint JPC_Constraint; -typedef struct JPC_TwoBodyConstraint JPC_TwoBodyConstraint; -typedef struct JPC_FixedConstraint JPC_FixedConstraint; -typedef struct JPC_DistanceConstraint JPC_DistanceConstraint; -typedef struct JPC_PointConstraint JPC_PointConstraint; -typedef struct JPC_HingeConstraint JPC_HingeConstraint; -typedef struct JPC_ConeConstraint JPC_ConeConstraint; -typedef struct JPC_SliderConstraint JPC_SliderConstraint; -typedef struct JPC_SwingTwistConstraint JPC_SwingTwistConstraint; -typedef struct JPC_SixDOFConstraint JPC_SixDOFConstraint; - -typedef struct JPC_ConstraintSettings JPC_ConstraintSettings; -typedef struct JPC_TwoBodyConstraintSettings JPC_TwoBodyConstraintSettings; -typedef struct JPC_FixedConstraintSettings JPC_FixedConstraintSettings; -typedef struct JPC_DistanceConstraintSettings JPC_DistanceConstraintSettings; -typedef struct JPC_PointConstraintSettings JPC_PointConstraintSettings; -typedef struct JPC_HingeConstraintSettings JPC_HingeConstraintSettings; -typedef struct JPC_ConeConstraintSettings JPC_ConeConstraintSettings; -typedef struct JPC_SliderConstraintSettings JPC_SliderConstraintSettings; -typedef struct JPC_SwingTwistConstraintSettings JPC_SwingTwistConstraintSettings; -typedef struct JPC_SixDOFConstraintSettings JPC_SixDOFConstraintSettings; +typedef struct JPC_Shape JPC_Shape; +typedef struct JPC_Constraint JPC_Constraint; +typedef struct JPC_PhysicsMaterial JPC_PhysicsMaterial; +typedef struct JPC_GroupFilter JPC_GroupFilter; +typedef struct JPC_Character JPC_Character; +typedef struct JPC_CharacterVirtual JPC_CharacterVirtual; + +#if JPC_DEBUG_RENDERER == 1 +typedef struct JPC_BodyDrawFilter JPC_BodyDrawFilter; +typedef struct JPC_DebugRenderer_TriangleBatch JPC_DebugRenderer_TriangleBatch; +typedef struct JPC_DebugRenderer_Primitive JPC_DebugRenderer_Primitive; +#endif //JPC_DEBUG_RENDERER //-------------------------------------------------------------------------------------------------- // // Structures // //-------------------------------------------------------------------------------------------------- -typedef struct JPC_ShapeResult -{ - const JPC_Shape *result; - char error[256]; -} JPC_ShapeResult; - // NOTE: Needs to be kept in sync with JPH::MassProperties typedef struct JPC_MassProperties { @@ -340,14 +332,14 @@ typedef struct JPC_MotionProperties { alignas(16) float linear_velocity[4]; // 4th element is ignored alignas(16) float angular_velocity[4]; // 4th element is ignored - alignas(16) float inv_inertia_diagonal[4]; // 4th element is ignored + alignas(16) float inv_inertia_diagnonal[4]; // 4th element is ignored alignas(16) float inertia_rotation[4]; float force[3]; float torque[3]; float inv_mass; float linear_damping; - float angular_damping; + float angular_daming; float max_linear_velocity; float max_angular_velocity; float gravity_factor; @@ -364,7 +356,7 @@ typedef struct JPC_MotionProperties #endif #if JPC_ENABLE_ASSERTS == 1 - JPC_MotionType cached_motion_type; + JPC_MotionType cached_motion_type; #endif } JPC_MotionProperties; @@ -430,6 +422,49 @@ typedef struct JPC_Body uint8_t flags; } JPC_Body; +// NOTE: Needs to be kept in sync +typedef struct JPC_CharacterBaseSettings +{ +# if defined(_MSC_VER) + const void* __vtable_header[1]; +# else + const void* __vtable_header[2]; +# endif + alignas(16) float up[4]; // 4th element is ignored + alignas(16) float supporting_volume[4]; + float max_slope_angle; + const JPC_Shape * shape; +} JPC_CharacterBaseSettings; + +// NOTE: Needs to be kept in sync +typedef struct JPC_CharacterSettings +{ + JPC_CharacterBaseSettings base; + JPC_ObjectLayer layer; + float mass; + float friction; + float gravity_factor; +} JPC_CharacterSettings; + +// NOTE: Needs to be kept in sync +typedef struct JPC_CharacterVirtualSettings +{ + JPC_CharacterBaseSettings base; + float mass; + float max_strength; + alignas(16) float shape_offset[4]; + JPC_BackFaceMode back_face_mode; + float predictive_contact_distance; + uint32_t max_collision_iterations; + uint32_t max_constraint_iterations; + float min_time_remaining; + float collision_tolerance; + float character_padding; + uint32_t max_num_hits; + float hit_reduction_cos_max_angle; + float penetration_recovery_speed; +} JPC_CharacterVirtualSettings; + // NOTE: Needs to be kept in sync with JPH::SubShapeIDCreator typedef struct JPC_SubShapeIDCreator { @@ -501,7 +536,7 @@ typedef struct JPC_TransformedShape { JPC_RVEC_ALIGN JPC_Real shape_position_com[4]; // 4th element is ignored alignas(16) float shape_rotation[4]; - JPC_Shape * shape; + const JPC_Shape * shape; float shape_scale[3]; JPC_BodyID body_id; JPC_SubShapeIDCreator sub_shape_id_creator; @@ -523,13 +558,6 @@ typedef struct JPC_BodyLockWrite JPC_Body * body; } JPC_BodyLockWrite; -// NOTE: Needs to be kept in sync with JPH::RayCast -typedef struct JPC_RayCast -{ - alignas(16) float origin[4]; // 4th element is ignored - alignas(16) float direction[4]; // length of the vector is important; 4th element is ignored -} JPC_RayCast; - // NOTE: Needs to be kept in sync with JPH::RRayCast typedef struct JPC_RRayCast { @@ -537,34 +565,13 @@ typedef struct JPC_RRayCast alignas(16) float direction[4]; // length of the vector is important; 4th element is ignored } JPC_RRayCast; -// NOTE: Needs to be kept in sync with JPH::RayCastResultBroadPhaseCastResult -typedef struct JPC_BroadPhaseCastResult -{ - JPC_BodyID body_id; // JPC_BODY_ID_INVALID - float fraction; // 1.0 + JPC_FLT_EPSILON -} JPC_BroadPhaseCastResult; - // NOTE: Needs to be kept in sync with JPH::RayCastResult typedef struct JPC_RayCastResult { - JPC_BroadPhaseCastResult base; - JPC_SubShapeID sub_shape_id; -} JPC_RayCastResult; - -// NOTE: Needs to be kept in sync with JPH::ShapeCastResult -typedef struct JPC_ShapeCastResult -{ - JPC_CollideShapeResult base; - float fraction; - bool is_back_face_hit; -} JPC_ShapeCastResult; - -// NOTE: Needs to be kept in sync with JPH::CollidePointResult -typedef struct JPC_CollidePointResult -{ - JPC_BodyID body_id; + JPC_BodyID body_id; // JPC_BODY_ID_INVALID + float fraction; // 1.0 + JPC_FLT_EPSILON JPC_SubShapeID sub_shape_id; -} JPC_CollidePointResult; +} JPC_RayCastResult; // NOTE: Needs to be kept in sync with JPH::RayCastSettings typedef struct JPC_RayCastSettings @@ -573,150 +580,110 @@ typedef struct JPC_RayCastSettings bool treat_convex_as_solid; } JPC_RayCastSettings; -// NOTE: Needs to be kept in sync with JPH::CollideSettingsBase -typedef struct JPC_CollideSettingsBase -{ - JPC_ActiveEdgeMode active_edge_mode; - JPC_CollectFacesMode collect_faces_mode; - float collision_tolerance; - float penetration_tolerance; - alignas(16) float active_edge_movement_direction[3]; -} JPC_CollideSettingsBase; - -// NOTE: Needs to be kept in sync with JPH::CollideShapeSettings -typedef struct JPC_CollideShapeSettings -{ - JPC_CollideSettingsBase base; - float max_separation_distance; - JPC_BackFaceMode back_face_mode; -} JPC_CollideShapeSettings; - -// NOTE: Needs to be kept in sync with JPH::ShapeCastSettings -typedef struct JPC_ShapeCastSettings -{ - JPC_CollideSettingsBase base; - JPC_BackFaceMode back_face_mode_triangles; - JPC_BackFaceMode back_face_mode_convex; - bool use_shrunken_shape_and_convex_radius; - bool return_deepest_point; -} JPC_ShapeCastSettings; - +#if JPC_DEBUG_RENDERER == 1 // NOTE: Needs to be kept in sync with JPH::AABox typedef struct JPC_AABox { - alignas(16) float min[4]; // 4th element is ignored - alignas(16) float max[4]; // 4th element is ignored + float min[3]; + float max[3]; } JPC_AABox; -// NOTE: Needs to be kept in sync with JPH::OrientedBox -typedef struct JPC_OrientedBox -{ - alignas(64) float orientation[16]; - alignas(16) float half_extent[3]; -} JPC_OrientedBox; - -// NOTE: Needs to be kept in sync with JPH::AABoxCast -typedef struct JPC_AABoxCast +// NOTE: Needs to be kept in sync with JPH::Color +typedef union JPC_Color { - JPC_AABox box; - alignas(16) float direction[3]; -} JPC_AABoxCast; - -//// NOTE: Needs to be kept in sync with JPH::AABoxCast -//typedef struct JPC_RShapeCast -//{ -// JPC_Shape *shape; -// alignas(16) float scale[3]; -// // todo -// -// JPC_AABox box; -// alignas(16) float direction[3]; -//} JPC_RShapeCast; - -typedef struct JPC_PhysicsSettings + uint32_t u32; + struct + { + uint8_t r; + uint8_t g; + uint8_t b; + uint8_t a; + }; +} JPC_Color; + +// NOTE: Needs to be kept in sync with JPH::DebugRenderer::Vertex +typedef struct JPC_DebugRenderer_Vertex { - int max_in_flight_body_pairs; // 16384 - int step_listeners_batch_size; // 8 - int step_listener_batches_per_job; // 1 - float baumgarte; // 0.2f - float speculative_contact_distance; // 0.02f - float penetration_slop; // 0.02f - float linear_cast_threshold; // 0.75f - float linear_cast_max_penetration; // 0.25f - float manifold_tolerance_sq; // 1.0e-6f - float max_penetration_distance; // 0.2f - float body_pair_cache_max_delta_position_sq; // 0.001f * 0.001f - float body_pair_cache_cos_max_delta_rotation_div_2; // cos(2 degrees / 2) - float contact_normal_cos_max_delta_rotation; // cos(5 degrees) - float contact_point_preserve_lambda_max_dist_sq; // 0.01f * 0.01f - int num_velocity_steps; // 10 - int num_position_steps; // 2 - float min_velocity_for_restitution; // 1.0f - float time_before_sleep; // 0.5f - float point_velocity_sleep_threshold; // 0.03f - bool constraint_warm_start; // true - bool use_body_pair_contact_cache; // true - bool use_manifold_reduction; // true - bool allow_sleeping; // true - bool check_active_edges; // true -} JPC_PhysicsSettings; - -typedef struct JPC_CollisionCollector + float position[3]; + float normal[3]; + float uv[2]; + JPC_Color color; +} JPC_DebugRenderer_Vertex; + +// NOTE: Needs to be kept in sync with JPH::DebugRenderer::Triangle +typedef struct JPC_DebugRenderer_Triangle { - float early_out_fraction; - const JPC_TransformedShape * context; -} JPC_CollisionCollector; + JPC_DebugRenderer_Vertex v[3]; +} JPC_DebugRenderer_Triangle; -typedef struct JPC_MotorSettings -{ - float frequency; - float damping; - float min_force_limit; - float max_force_limit; - float min_torque_limit; - float max_torque_limit; -} JPC_MotorSettings; - -typedef struct JPC_PointConvexSupport +// NOTE: Needs to be kept in sync with JPH::DebugRenderer::LOD +typedef struct JPC_DebugRenderer_LOD { - alignas(16) float point[3]; -} JPC_PointConvexSupport; + JPC_DebugRenderer_TriangleBatch *batch; + float distance; +} JPC_DebugRenderer_LOD; -typedef struct JPC_GJKClosestPoint +// NOTE: NOT kept in sync - some translation required due to JPH::DebugRenderer::Geometry using std::vector. +typedef struct JPC_DebugRenderer_Geometry { - alignas(16) float y[4]; - alignas(16) float p[4]; - alignas(16) float q[4]; - int num_points; -} JPC_GJKClosestPoint; - -typedef struct JPC_SupportBuffer + JPC_DebugRenderer_LOD *LODs; + uint64_t num_LODs; + JPC_AABox *bounds; +} JPC_DebugRenderer_Geometry; + +// NOTE: Needs to be kept in sync with JPH::BodyManager::DrawSettings +// For each boolean field, if it's true, that thing will be drawn. +typedef struct JPC_BodyManager_DrawSettings { - alignas(16) uint8_t data[4160]; -} JPC_SupportBuffer; + bool get_support_func; // = false | Draw the GetSupport() function, used for convex collision detection + bool get_support_dir; // = false | If above true, also draw direction mapped to a specific support point + bool get_supporting_face; // = false | Draw the faces that were found colliding during collision detection + bool shape; // = true | Draw the shapes of all bodies + bool shape_wireframe; // = false | If 'shape' true, the shapes will be drawn in wireframe instead of solid. + JPC_ShapeColor shape_color; // = JPC_MOTION_TYPE_COLOR | Coloring scheme to use for shapes + bool bounding_box; // = false | Draw a bounding box per body + bool center_of_mass_transform; // = false | Draw the center of mass for each body + bool world_transform; // = false | Draw the world transform (which can be different than CoM) for each body + bool velocity; // = false | Draw the velocity vector for each body + bool mass_and_inertia; // = false | Draw the mass and inertia (as the box equivalent) for each body + bool sleep_stats; // = false | Draw stats regarding the sleeping algorithm of each body +} JPC_BodyManager_DrawSettings; + +typedef bool (*JPC_BodyDrawFilterFunc)(const JPC_Body *); +#endif //JPC_DEBUG_RENDERER //-------------------------------------------------------------------------------------------------- // // Interfaces (virtual tables) // //-------------------------------------------------------------------------------------------------- +#if defined(_MSC_VER) +#define _JPC_VTABLE_HEADER const void* __vtable_header[1] +#else +#define _JPC_VTABLE_HEADER const void* __vtable_header[2] +#endif + typedef struct JPC_BroadPhaseLayerInterfaceVTable { - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. + _JPC_VTABLE_HEADER; // Required, *cannot* be NULL. uint32_t (*GetNumBroadPhaseLayers)(const void *in_self); +#ifdef _MSC_VER + // Required, *cannot* be NULL. + const JPC_BroadPhaseLayer * + (*GetBroadPhaseLayer)(const void *in_self, JPC_BroadPhaseLayer *out_layer, JPC_ObjectLayer in_layer); +#else // Required, *cannot* be NULL. JPC_BroadPhaseLayer (*GetBroadPhaseLayer)(const void *in_self, JPC_ObjectLayer in_layer); +#endif } JPC_BroadPhaseLayerInterfaceVTable; typedef struct JPC_ObjectVsBroadPhaseLayerFilterVTable { - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. + _JPC_VTABLE_HEADER; // Required, *cannot* be NULL. bool @@ -725,8 +692,7 @@ typedef struct JPC_ObjectVsBroadPhaseLayerFilterVTable typedef struct JPC_BroadPhaseLayerFilterVTable { - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. + _JPC_VTABLE_HEADER; // Required, *cannot* be NULL. bool @@ -735,8 +701,7 @@ typedef struct JPC_BroadPhaseLayerFilterVTable typedef struct JPC_ObjectLayerPairFilterVTable { - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. + _JPC_VTABLE_HEADER; // Required, *cannot* be NULL. bool @@ -745,8 +710,7 @@ typedef struct JPC_ObjectLayerPairFilterVTable typedef struct JPC_ObjectLayerFilterVTable { - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. + _JPC_VTABLE_HEADER; // Required, *cannot* be NULL. bool @@ -755,26 +719,24 @@ typedef struct JPC_ObjectLayerFilterVTable typedef struct JPC_BodyActivationListenerVTable { - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. + _JPC_VTABLE_HEADER; // Required, *cannot* be NULL. void - (*OnBodyActivated)(void *in_self, JPC_BodyID in_body_id, uint64_t in_user_data); + (*OnBodyActivated)(void *in_self, const JPC_BodyID *in_body_id, uint64_t in_user_data); // Required, *cannot* be NULL. void - (*OnBodyDeactivated)(void *in_self, JPC_BodyID in_body_id, uint64_t in_user_data); + (*OnBodyDeactivated)(void *in_self, const JPC_BodyID *in_body_id, uint64_t in_user_data); } JPC_BodyActivationListenerVTable; typedef struct JPC_BodyFilterVTable { - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. + _JPC_VTABLE_HEADER; // Required, *cannot* be NULL. bool - (*ShouldCollide)(const void *in_self, JPC_BodyID in_body_id); + (*ShouldCollide)(const void *in_self, const JPC_BodyID *in_body_id); // Required, *cannot* be NULL. bool @@ -783,23 +745,79 @@ typedef struct JPC_BodyFilterVTable typedef struct JPC_ShapeFilterVTable { - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. + _JPC_VTABLE_HEADER; // Required, *cannot* be NULL. bool - (*ShouldCollide)(const void *in_self, JPC_SubShapeID in_sub_shape_id); + (*ShouldCollide)(const void *in_self, const JPC_Shape *in_shape, const JPC_SubShapeID *in_sub_shape_id); // Required, *cannot* be NULL. bool - (*ShouldPairCollide)(const void *in_self, JPC_SubShapeID in_sub_shape_id1, JPC_SubShapeID in_sub_shape_id2); + (*PairShouldCollide)(const void *in_self, + const JPC_Shape *in_shape1, + const JPC_SubShapeID *in_sub_shape_id1, + const JPC_Shape *in_shape2, + const JPC_SubShapeID *in_sub_shape_id2); + + // Set by the collision detection functions to the body ID of the "receiving" body before ShouldCollide is called. + uint32_t bodyId2; } JPC_ShapeFilterVTable; -typedef struct JPC_ContactListenerVTable +typedef struct JPC_PhysicsStepListenerVTable +{ + _JPC_VTABLE_HEADER; + + // Required, *cannot* be NULL. + void + (*OnStep)(float in_delta_time, JPC_PhysicsSystem *in_physics_system); +} JPC_PhysicsStepListener; + +// Made all callbacks required for this one for simplicity's sake, but can be modified to imitate ContactListener later. +typedef struct JPC_CharacterContactListenerVTable { - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. + _JPC_VTABLE_HEADER; + + // Required, *cannot* be NULL. + void + (*OnAdjustBodyVelocity)(void *in_self, + const JPC_CharacterVirtual *in_character, + const JPC_Body *in_body2, + const float io_linear_velocity[3], + const float io_angular_velocity[3]); + + // Required, *cannot* be NULL. + bool + (*OnContactValidate)(void *in_self, + const JPC_CharacterVirtual *in_character, + const JPC_Body *in_body2, + const JPC_SubShapeID *sub_shape_id); + // Required, *cannot* be NULL. + void + (*OnContactAdded)(void *in_self, + const JPC_CharacterVirtual *in_character, + const JPC_Body *in_body2, + const JPC_SubShapeID *sub_shape_id, + const JPC_Real contact_position[3], + const float contact_normal[3], + JPC_CharacterContactSettings *io_settings); + + // Required, *cannot* be NULL. + void + (*OnContactSolve)(void *in_self, + const JPC_CharacterVirtual *in_character, + const JPC_Body *in_body2, + const JPC_SubShapeID *sub_shape_id, + const JPC_Real contact_position[3], + const float contact_normal[3], + const float contact_velocity[3], + const JPC_PhysicsMaterial *contact_material, + const float character_velocity_in[3], + float character_velocity_out[3]); +} JPC_CharacterContactListenerVTable; + +typedef struct JPC_ContactListenerVTable +{ // Optional, can be NULL. JPC_ValidateResult (*OnContactValidate)(void *in_self, @@ -829,190 +847,55 @@ typedef struct JPC_ContactListenerVTable (*OnContactRemoved)(void *in_self, const JPC_SubShapeIDPair *in_sub_shape_pair); } JPC_ContactListenerVTable; -typedef struct JPC_PhysicsStepListenerVTable -{ - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. - - // Required, *cannot* be NULL. - void - (*OnStep)(void *in_self, float in_delta_time, JPC_PhysicsSystem *in_physics_system); -} JPC_PhysicsStepListenerVTable; - -typedef struct JPC_RayCastBodyCollectorVTable -{ - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. - - // Required, *cannot* be NULL. - void - (*Reset)(void *in_self); - - // Required, *cannot* be NULL. - void - (*OnBody)(void *in_self, const JPC_Body *in_body); - - // Required, *cannot* be NULL. - void - (*AddHit)(void *in_self, const JPC_BroadPhaseCastResult *in_result); -} JPC_RayCastBodyCollectorVTable; - -typedef struct JPC_CollideShapeBodyCollectorVTable -{ - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. - - // Required, *cannot* be NULL. - void - (*Reset)(void *in_self); - - // Required, *cannot* be NULL. - void - (*OnBody)(void *in_self, const JPC_Body *in_body); - - // Required, *cannot* be NULL. - void - (*AddHit)(void *in_self, const JPC_BodyID *in_result); -} JPC_CollideShapeBodyCollectorVTable; - -typedef struct JPC_CastShapeBodyCollectorVTable -{ - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. - - // Required, *cannot* be NULL. - void - (*Reset)(void *in_self); - - // Required, *cannot* be NULL. - void - (*OnBody)(void *in_self, const JPC_Body *in_body); - - // Required, *cannot* be NULL. - void - (*AddHit)(void *in_self, const JPC_BroadPhaseCastResult *in_result); -} JPC_CastShapeBodyCollectorVTable; - -typedef struct JPC_CastRayCollectorVTable -{ - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. - - // Required, *cannot* be NULL. - void - (*Reset)(void *in_self); - - // Required, *cannot* be NULL. - void - (*OnBody)(void *in_self, const JPC_Body *in_body); - - // Required, *cannot* be NULL. - void - (*AddHit)(void *in_self, const JPC_RayCastResult *in_result); -} JPC_CastRayCollectorVTable; - -typedef struct JPC_CastShapeCollectorVTable -{ - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. - - // Required, *cannot* be NULL. - void - (*Reset)(void *in_self); - - // Required, *cannot* be NULL. - void - (*OnBody)(void *in_self, const JPC_Body *in_body); - - // Required, *cannot* be NULL. - void - (*AddHit)(void *in_self, const JPC_ShapeCastResult *in_result); -} JPC_CastShapeCollectorVTable; - -typedef struct JPC_CollidePointCollectorVTable -{ - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. - - // Required, *cannot* be NULL. - void - (*Reset)(void *in_self); - - // Required, *cannot* be NULL. - void - (*OnBody)(void *in_self, const JPC_Body *in_body); - - // Required, *cannot* be NULL. - void - (*AddHit)(void *in_self, const JPC_CollidePointResult *in_result); -} JPC_CollidePointCollectorVTable; - -typedef struct JPC_CollideShapeCollectorVTable +#if JPC_DEBUG_RENDERER == 1 +/// Although used similarly to the VTables above, this struct is not pointer-compatible with JPH::DebugRenderer +/// Instead, it's wrapped by the DebugRendererImpl inheritor class (as seen in JoltPhysicsC.cpp), because +/// of the design of JPH::DebugRenderer not playing as nicely with C as the other structures in Jolt. +/// Since debug rendering should never be used in production code, a wrapper seems ok in this case. +typedef struct JPC_DebugRendererVTable { - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. - // Required, *cannot* be NULL. void - (*Reset)(void *in_self); + (*DrawLine)(void *in_self, JPC_Real in_from[3], JPC_Real in_to[3], JPC_Color in_color); // Required, *cannot* be NULL. void - (*OnBody)(void *in_self, const JPC_Body *in_body); + (*DrawTriangle)(void *in_self, JPC_Real in_v1[3], JPC_Real in_v2[3], JPC_Real in_v3[3], JPC_Color in_color); // Required, *cannot* be NULL. - void - (*AddHit)(void *in_self, const JPC_CollideShapeResult *in_result); -} JPC_CollideShapeCollectorVTable; - -typedef struct JPC_TransformedShapeCollectorVTable -{ - const void *__unused0; // Unused, *must* be NULL. - const void *__unused1; // Unused, *must* be NULL. + JPC_DebugRenderer_TriangleBatch * + (*CreateTriangleBatch)(void *in_self, const JPC_DebugRenderer_Triangle *in_triangles, uint32_t in_triangle_count); // Required, *cannot* be NULL. - void - (*Reset)(void *in_self); + JPC_DebugRenderer_TriangleBatch * + (*CreateTriangleBatchIndexed)(void *in_self, + const JPC_DebugRenderer_Vertex *in_vertices, + uint32_t in_vertex_count, + const uint32_t *in_indices, + uint32_t in_index_count); // Required, *cannot* be NULL. void - (*OnBody)(void *in_self, const JPC_Body *in_body); + (*DrawGeometry)(void *in_self, + const float inModelMatrix[16], + const JPC_AABox *inWorldSpaceBounds, + float inLODScaleSq, + JPC_Color in_color, + const JPC_DebugRenderer_Geometry *in_geometry, + JPC_CullMode in_cull_mode, + JPC_CastShadow in_cast_shadow, + JPC_DrawMode in_draw_mode); // Required, *cannot* be NULL. void - (*AddHit)(void *in_self, const JPC_TransformedShape *in_result); -} JPC_TransformedShapeCollectorVTable; - -// TODO combine -//typedef struct JPC_CombineFunctor -//{ -// // Required, *cannot* be NULL. -// float -// (*fn)(const JPC_Body *in_body_1, -// const JPC_SubShapeID in_sub_shape_id_1, -// const JPC_Body *in_body_2, -// const JPC_SubShapeID in_sub_shape_id_2); -//} JPC_CombineFunctor; + (*DrawText3D)(void *in_self, JPC_Real in_position[3], const char *in_string, JPC_Color in_color, float in_height); +} JPC_DebugRendererVTable; +#endif //JPC_DEBUG_RENDERER //-------------------------------------------------------------------------------------------------- // // Misc functions // //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BodyIDVector_Destroy(JPC_BodyIDVector *in_vector); - -JPC_API JPC_SupportingFace * -JPC_SupportingFace_Create(); - -JPC_API uint32_t -JPC_SupportingFace_Size(JPC_SupportingFace *in_face); - -JPC_API float ** -JPC_SupportingFace_Data(JPC_SupportingFace *in_face); - -JPC_API void -JPC_SupportingFace_Destroy(JPC_SupportingFace *in_face); - JPC_API void JPC_RegisterDefaultAllocator(void); @@ -1041,56 +924,49 @@ JPC_BodyCreationSettings_Set(JPC_BodyCreationSettings *out_settings, JPC_MotionType in_motion_type, JPC_ObjectLayer in_layer); -JPC_API const JPC_ShapeSettings * -JPC_BodyCreationSettings_GetShapeSettings(const JPC_BodyCreationSettings *in_settings); - -JPC_API void -JPC_BodyCreationSettings_SetShapeSettings(JPC_BodyCreationSettings *in_settings, - const JPC_ShapeSettings *in_shape); - -JPC_API JPC_ShapeResult -JPC_BodyCreationSettings_ConvertShapeSettings(JPC_BodyCreationSettings *in_settings); - -JPC_API const JPC_Shape * -JPC_BodyCreationSettings_GetShape(const JPC_BodyCreationSettings *in_settings); - -JPC_API void -JPC_BodyCreationSettings_SetShape(JPC_BodyCreationSettings *in_settings, - const JPC_Shape *in_shape); - -JPC_API bool -JPC_BodyCreationSettings_HasMassProperties(const JPC_BodyCreationSettings *in_settings); - -JPC_API void -JPC_BodyCreationSettings_GetMassProperties(const JPC_BodyCreationSettings *in_settings, - JPC_MassProperties *out_properties); - -JPC_API bool -JPC_CollisionGroup_CanCollide(const JPC_CollisionGroup *in_group, const JPC_CollisionCollector *in_other); - -JPC_API void -JPC_PhysicsSettings_SetDefault(JPC_PhysicsSettings *out_settings); - -JPC_API void -JPC_BroadPhaseCastResult_SetDefault(JPC_BroadPhaseCastResult *out_result); - -JPC_API void -JPC_RayCastResult_SetDefault(JPC_RayCastResult *out_result); - -JPC_API float -JPC_CollideShapeResult_GetEarlyOutFraction(JPC_CollideShapeResult *in_settings); +#if JPC_DEBUG_RENDERER == 1 +/// Provide an instantiated VTable to get wrapped by the singleton implementation of JPH::DebugRenderer. This should be +/// called only once, at program initialization, as when instantiating a DebugRenderer implementation in Jolt proper. +/// You may pass a pointer to any struct, as long as its first member is a pointer to your JPC_DebugRendererVTable. +JPC_API enum JPC_DebugRendererResult +JPC_CreateDebugRendererSingleton(void *in_debug_renderer); +/// Iff there is a debug renderer currently instantiated, destroy it. This may allow another call to CreateDebugRenderer +/// to be made without breaking things, but this isn't sufficiently tested to be a guarantee. This is used, for example, +/// in the unit tests when more than one test needs to instantiate a debug renderer. Shouldn't be necessary for a game. +JPC_API enum JPC_DebugRendererResult +JPC_DestroyDebugRendererSingleton(); +#endif //JPC_DEBUG_RENDERER +//-------------------------------------------------------------------------------------------------- +// +// JPC_DebugRenderer_TriangleBatch +// +//-------------------------------------------------------------------------------------------------- +#if JPC_DEBUG_RENDERER == 1 +/// Within the user's DebugRendererVTable callbacks to create triangle batches, the user creates whatever +/// structure their rendering engine requires to represent the triangle batch Jolt requests. The user passes a +/// pointer to that structure into this function to be stored as one of Jolt's reference-counted objects internally. +/// +/// \return An opaque JPC_DebugRenderer_TriangleBatch* for the user to keep as a handle to their primitive +JPC_API JPC_DebugRenderer_TriangleBatch * +JPC_DebugRenderer_TriangleBatch_Create(const void *in_c_primitive); -JPC_API void -JPC_CollideShapeResult_Reversed(JPC_CollideShapeResult *in_settings, JPC_CollideShapeResult *out_settings); +/// When Jolt calls the user's DrawGeometry, it passes the user a JPC_DebugRenderer_Geometry *. This structure +/// contains, among other things, at least one JPC_DebugRenderer_TriangleBatch * (inside LOD levels). The user +/// may retrieve the pointer to the corresponding primitive they made by passing the batch pointer to this function. +/// +/// \return An opaque JPC_DebugRenderer_Primitive * wherein the user is keeping rendering data for that batch +JPC_API const JPC_DebugRenderer_Primitive * +JPC_DebugRenderer_TriangleBatch_GetPrimitive(const JPC_DebugRenderer_TriangleBatch *in_batch); JPC_API void -JPC_RayCastSettings_SetDefault(JPC_RayCastSettings *out_settings); +JPC_DebugRenderer_TriangleBatch_AddRef(JPC_DebugRenderer_TriangleBatch *in_batch); JPC_API void -JPC_CollideShapeSettings_SetDefault(JPC_CollideShapeSettings *out_settings); +JPC_DebugRenderer_TriangleBatch_Release(JPC_DebugRenderer_TriangleBatch *in_batch); -JPC_API void -JPC_ShapeCastSettings_SetDefault(JPC_ShapeCastSettings *out_settings); +JPC_API uint32_t +JPC_DebugRenderer_TriangleBatch_GetRefCount(const JPC_DebugRenderer_TriangleBatch *in_batch); +#endif //JPC_DEBUG_RENDERER //-------------------------------------------------------------------------------------------------- // // JPC_MotionProperties @@ -1181,15 +1057,6 @@ JPC_API void JPC_MotionProperties_GetPointVelocityCOM(const JPC_MotionProperties *in_properties, const float in_point_relative_to_com[3], float out_point[3]); - -JPC_API void -JPC_MotionProperties_GetAccumulatedForce(const JPC_MotionProperties *in_properties, - float out_force[3]); - -JPC_API void -JPC_MotionProperties_GetAccumulatedTorque(const JPC_MotionProperties *in_properties, - float out_torque[3]); - JPC_API float JPC_MotionProperties_GetMaxLinearVelocity(const JPC_MotionProperties *in_properties); @@ -1250,43 +1117,26 @@ JPC_PhysicsSystem_SetContactListener(JPC_PhysicsSystem *in_physics_system, void JPC_API void * JPC_PhysicsSystem_GetContactListener(const JPC_PhysicsSystem *in_physics_system); -// TODO combine -//JPC_API void -//JPC_PhysicsSystem_SetCombineFriction(JPC_PhysicsSystem *in_physics_system, -// const JPC_CombineFunctor *in_combine); -// -//JPC_API void -//JPC_PhysicsSystem_SetCombineRestitution(JPC_PhysicsSystem *in_physics_system, -// const JPC_CombineFunctor *in_combine); - -JPC_API void -JPC_PhysicsSystem_SetPhysicsSettings(JPC_PhysicsSystem *in_physics_system, - const JPC_PhysicsSettings *in_settings); - -JPC_API void -JPC_PhysicsSystem_GetPhysicsSettings(const JPC_PhysicsSystem *in_physics_system, - JPC_PhysicsSettings *out_settings); - -JPC_API const JPC_BroadPhaseQuery * -JPC_PhysicsSystem_GetBroadPhaseQuery(const JPC_PhysicsSystem *in_physics_system); +JPC_API uint32_t +JPC_PhysicsSystem_GetNumBodies(const JPC_PhysicsSystem *in_physics_system); -JPC_API const JPC_NarrowPhaseQuery * -JPC_PhysicsSystem_GetNarrowPhaseQuery(const JPC_PhysicsSystem *in_physics_system); +JPC_API uint32_t +JPC_PhysicsSystem_GetNumActiveBodies(const JPC_PhysicsSystem *in_physics_system); -JPC_API const JPC_NarrowPhaseQuery * -JPC_PhysicsSystem_GetNarrowPhaseQueryNoLock(const JPC_PhysicsSystem *in_physics_system); +JPC_API uint32_t +JPC_PhysicsSystem_GetMaxBodies(const JPC_PhysicsSystem *in_physics_system); JPC_API void -JPC_PhysicsSystem_AddConstraint(JPC_PhysicsSystem *in_self, JPC_Constraint *in_constraint); +JPC_PhysicsSystem_GetGravity(const JPC_PhysicsSystem *in_physics_system, float out_gravity[3]); JPC_API void -JPC_PhysicsSystem_AddConstraints(JPC_PhysicsSystem *in_self, JPC_Constraint *in_constraints[], int in_number); +JPC_PhysicsSystem_SetGravity(JPC_PhysicsSystem *in_physics_system, const float in_gravity[3]); -JPC_API void -JPC_PhysicsSystem_RemoveConstraint(JPC_PhysicsSystem *in_self, JPC_Constraint *in_constraint); +JPC_API JPC_BodyInterface * +JPC_PhysicsSystem_GetBodyInterface(JPC_PhysicsSystem *in_physics_system); -JPC_API void -JPC_PhysicsSystem_RemoveConstraints(JPC_PhysicsSystem *in_self, JPC_Constraint *in_constraints[], int in_number); +JPC_API JPC_BodyInterface * +JPC_PhysicsSystem_GetBodyInterfaceNoLock(JPC_PhysicsSystem *in_physics_system); JPC_API void JPC_PhysicsSystem_OptimizeBroadPhase(JPC_PhysicsSystem *in_physics_system); @@ -1298,6 +1148,12 @@ JPC_API void JPC_PhysicsSystem_RemoveStepListener(JPC_PhysicsSystem *in_physics_system, void *in_listener); JPC_API void +JPC_PhysicsSystem_AddConstraint(JPC_PhysicsSystem *in_physics_system, void *in_two_body_constraint); + +JPC_API void +JPC_PhysicsSystem_RemoveConstraint(JPC_PhysicsSystem *in_physics_system, void *in_two_body_constraint); + +JPC_API JPC_PhysicsUpdateError JPC_PhysicsSystem_Update(JPC_PhysicsSystem *in_physics_system, float in_delta_time, int in_collision_steps, @@ -1305,44 +1161,31 @@ JPC_PhysicsSystem_Update(JPC_PhysicsSystem *in_physics_system, JPC_TempAllocator *in_temp_allocator, JPC_JobSystem *in_job_system); -JPC_API void -JPC_PhysicsSystem_SetGravity(JPC_PhysicsSystem *in_physics_system, const float in_gravity[3]); - -JPC_API void -JPC_PhysicsSystem_GetGravity(const JPC_PhysicsSystem *in_physics_system, float out_gravity[3]); - -JPC_API JPC_BodyInterface * -JPC_PhysicsSystem_GetBodyInterfaceNoLock(JPC_PhysicsSystem *in_physics_system); - -JPC_API JPC_BodyInterface * -JPC_PhysicsSystem_GetBodyInterface(JPC_PhysicsSystem *in_physics_system); - JPC_API const JPC_BodyLockInterface * JPC_PhysicsSystem_GetBodyLockInterface(const JPC_PhysicsSystem *in_physics_system); JPC_API const JPC_BodyLockInterface * JPC_PhysicsSystem_GetBodyLockInterfaceNoLock(const JPC_PhysicsSystem *in_physics_system); -JPC_API uint32_t -JPC_PhysicsSystem_GetNumBodies(const JPC_PhysicsSystem *in_physics_system); - -JPC_API uint32_t -JPC_PhysicsSystem_GetNumActiveBodies(const JPC_PhysicsSystem *in_physics_system); +JPC_API const JPC_NarrowPhaseQuery * +JPC_PhysicsSystem_GetNarrowPhaseQuery(const JPC_PhysicsSystem *in_physics_system); -JPC_API uint32_t -JPC_PhysicsSystem_GetMaxBodies(const JPC_PhysicsSystem *in_physics_system); +JPC_API const JPC_NarrowPhaseQuery * +JPC_PhysicsSystem_GetNarrowPhaseQueryNoLock(const JPC_PhysicsSystem *in_physics_system); /// Get copy of the list of all bodies under protection of a lock. -JPC_API JPC_BodyIDVector * +JPC_API void JPC_PhysicsSystem_GetBodyIDs(const JPC_PhysicsSystem *in_physics_system, + uint32_t in_max_body_ids, uint32_t *out_num_body_ids, - JPC_BodyID **out_body_ids); + JPC_BodyID *out_body_ids); /// Get copy of the list of active bodies under protection of a lock. -JPC_API JPC_BodyIDVector * +JPC_API void JPC_PhysicsSystem_GetActiveBodyIDs(const JPC_PhysicsSystem *in_physics_system, + uint32_t in_max_body_ids, uint32_t *out_num_body_ids, - JPC_BodyID **out_body_ids); + JPC_BodyID *out_body_ids); /// /// Low-level access for advanced usage and zero CPU overhead (access *not* protected by a lock) /// @@ -1363,10 +1206,21 @@ JPC_PhysicsSystem_GetActiveBodyIDs(const JPC_PhysicsSystem *in_physics_system, JPC_API JPC_Body ** JPC_PhysicsSystem_GetBodiesUnsafe(JPC_PhysicsSystem *in_physics_system); -JPC_API bool -JPC_PhysicsSystem_WereBodiesInContact(const JPC_PhysicsSystem *in_physics_system, - JPC_BodyID in_body_id1, - JPC_BodyID in_body_id2); +#if JPC_DEBUG_RENDERER == 1 +JPC_API void +JPC_PhysicsSystem_DrawBodies(JPC_PhysicsSystem *in_physics_system, + const JPC_BodyManager_DrawSettings *in_draw_settings, + const JPC_BodyDrawFilter *in_draw_filter); // Can be NULL (no filter) + +JPC_API void +JPC_PhysicsSystem_DrawConstraints(JPC_PhysicsSystem *in_physics_system); + +JPC_API void +JPC_PhysicsSystem_DrawConstraintLimits(JPC_PhysicsSystem *in_physics_system); + +JPC_API void +JPC_PhysicsSystem_DrawConstraintReferenceFrame(JPC_PhysicsSystem *in_physics_system); +#endif //JPC_DEBUG_RENDERER //-------------------------------------------------------------------------------------------------- // // JPC_BodyLockInterface @@ -1388,275 +1242,16 @@ JPC_BodyLockInterface_UnlockWrite(const JPC_BodyLockInterface *in_lock_interface JPC_BodyLockWrite *io_lock); //-------------------------------------------------------------------------------------------------- // -// (collector structs) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CollisionCollector_Reset(void *in_collector); - -JPC_API void -JPC_CollisionCollector_UpdateEarlyOutFraction(void *in_collector, float in_fraction); - -JPC_API void -JPC_CollisionCollector_ResetEarlyOutFraction(void *in_collector, float in_fraction); -//-------------------------------------------------------------------------------------------------- -// -// (RayCastBodyCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_RayCastBodyCollector_ForceEarlyOut(void *in_collector); - -JPC_API bool -JPC_RayCastBodyCollector_ShouldEarlyOut(void *in_collector); -//-------------------------------------------------------------------------------------------------- -// -// (CollideShapeBodyCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CollideShapeBodyCollector_ForceEarlyOut(void *in_collector); - -JPC_API bool -JPC_CollideShapeBodyCollector_ShouldEarlyOut(void *in_collector); -//-------------------------------------------------------------------------------------------------- -// -// (CastShapeBodyCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CastShapeBodyCollector_ForceEarlyOut(void *in_collector); - -JPC_API bool -JPC_CastShapeBodyCollector_ShouldEarlyOut(void *in_collector); -//-------------------------------------------------------------------------------------------------- -// -// (CastRayCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CastRayCollector_ForceEarlyOut(void *in_collector); - -JPC_API bool -JPC_CastRayCollector_ShouldEarlyOut(void *in_collector); -//-------------------------------------------------------------------------------------------------- -// -// (CastShapeCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CastShapeCollector_ForceEarlyOut(void *in_collector); - -JPC_API bool -JPC_CastShapeCollector_ShouldEarlyOut(void *in_collector); -//-------------------------------------------------------------------------------------------------- -// -// (CollidePointCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CollidePointCollector_ForceEarlyOut(void *in_collector); - -JPC_API bool -JPC_CollidePointCollector_ShouldEarlyOut(void *in_collector); -//-------------------------------------------------------------------------------------------------- -// -// (CollideShapeCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CollideShapeCollector_ForceEarlyOut(void *in_collector); - -JPC_API bool -JPC_CollideShapeCollector_ShouldEarlyOut(void *in_collector); -//-------------------------------------------------------------------------------------------------- -// -// (TransformedShapeCollector) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_TransformedShapeCollector_ForceEarlyOut(void *in_collector); - -JPC_API bool -JPC_TransformedShapeCollector_ShouldEarlyOut(void *in_collector); -//-------------------------------------------------------------------------------------------------- -// -// JPC_BroadPhaseQuery -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_BroadPhaseQuery_CastRay(const JPC_BroadPhaseQuery *in_query, - const JPC_RayCast *in_ray, - void *io_collector, - const void *in_broad_phase_layer_filter, // Can be NULL (no filter) - const void *in_object_layer_filter); // Can be NULL (no filter) - -JPC_API void -JPC_BroadPhaseQuery_CollideAABox(const JPC_BroadPhaseQuery *in_query, - const JPC_AABox *in_box, - void *io_collector, - const void *in_broad_phase_layer_filter, // Can be NULL (no filter) - const void *in_object_layer_filter); // Can be NULL (no filter) - -JPC_API void -JPC_BroadPhaseQuery_CollideSphere(const JPC_BroadPhaseQuery *in_query, - const float in_center[3], - float in_radius, - void *io_collector, - const void *in_broad_phase_layer_filter, // Can be NULL (no filter) - const void *in_object_layer_filter); // Can be NULL (no filter) - -JPC_API void -JPC_BroadPhaseQuery_CollidePoint(const JPC_BroadPhaseQuery *in_query, - const float in_point[3], - void *io_collector, - const void *in_broad_phase_layer_filter, // Can be NULL (no filter) - const void *in_object_layer_filter); // Can be NULL (no filter) - -JPC_API void -JPC_BroadPhaseQuery_CollideOrientedBox(const JPC_BroadPhaseQuery *in_query, - const JPC_OrientedBox *in_box, - void *io_collector, - const void *in_broad_phase_layer_filter, // Can be NULL (no filter) - const void *in_object_layer_filter); // Can be NULL (no filter) - -JPC_API void -JPC_BroadPhaseQuery_CastAABox(const JPC_BroadPhaseQuery *in_query, - const JPC_AABoxCast *in_box, - void *io_collector, - const void *in_broad_phase_layer_filter, // Can be NULL (no filter) - const void *in_object_layer_filter); // Can be NULL (no filter) -//-------------------------------------------------------------------------------------------------- -// // JPC_NarrowPhaseQuery // //-------------------------------------------------------------------------------------------------- JPC_API bool -JPC_NarrowPhaseQuery_GetCastRay(const JPC_NarrowPhaseQuery *in_query, - const JPC_RRayCast *in_ray, - JPC_RayCastResult *io_hit, // *Must* be default initialized (see JPC_RayCastResult) - const void *in_broad_phase_layer_filter, // Can be NULL (no filter) - const void *in_object_layer_filter, // Can be NULL (no filter) - const void *in_body_filter); // Can be NULL (no filter) - -JPC_API void -JPC_NarrowPhaseQuery_CollectCastRay(const JPC_NarrowPhaseQuery *in_query, - const JPC_RRayCast *in_ray, - const JPC_RayCastSettings *in_settings, - void *io_collector, - const void *in_broad_phase_layer_filter, // Can be NULL (no filter) - const void *in_object_layer_filter, // Can be NULL (no filter) - const void *in_body_filter, // Can be NULL (no filter) - const void *in_shape_filter); // Can be NULL (no filter) - -JPC_API void -JPC_NarrowPhaseQuery_CollidePoint(const JPC_NarrowPhaseQuery *in_query, - const JPC_Real in_point[3], - void *io_collector, - const void *in_broad_phase_layer_filter, // Can be NULL (no filter) - const void *in_object_layer_filter, // Can be NULL (no filter) - const void *in_body_filter, // Can be NULL (no filter) - const void *in_shape_filter); // Can be NULL (no filter) - -JPC_API void -JPC_NarrowPhaseQuery_CollideShape(const JPC_NarrowPhaseQuery *in_query, - const JPC_Shape *in_shape, - const float in_shape_scale[3], - const float in_com_rotation[9], - const JPC_Real in_com_translation[3], - const JPC_CollideShapeSettings *in_settings, - const JPC_Real in_base_offset[3], - void *io_collector, - const void *in_broad_phase_layer_filter, // Can be NULL (no filter) - const void *in_object_layer_filter, // Can be NULL (no filter) - const void *in_body_filter, // Can be NULL (no filter) - const void *in_shape_filter); // Can be NULL (no filter) - -// TODO -//JPC_API void -//JPC_NarrowPhaseQuery_CastShape(const JPC_NarrowPhaseQuery *in_query, -// const JPC_RShapeCast *in_shape_cast, -// const JPC_ShapeCastSettings *in_settings, -// const JPC_Real in_base_offset[3], -// void *io_collector, -// const void *in_broad_phase_layer_filter, // Can be NULL (no filter) -// const void *in_object_layer_filter, // Can be NULL (no filter) -// const void *in_body_filter, // Can be NULL (no filter) -// const void *in_shape_filter); // Can be NULL (no filter) - -JPC_API void -JPC_NarrowPhaseQuery_CollectTransformedShapes(const JPC_NarrowPhaseQuery *in_query, - const JPC_AABox *in_box, - void *io_collector, - const void *in_broad_phase_layer_filter, // Can be NULL (no filter) - const void *in_object_layer_filter, // Can be NULL (no filter) - const void *in_body_filter, // Can be NULL (no filter) - const void *in_shape_filter); // Can be NULL (no filter) -//-------------------------------------------------------------------------------------------------- -// -// JPC_SphereShape (-> JPC_ConvexShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_SphereShape * -JPC_SphereShape_Create(float in_radius, const JPC_PhysicsMaterial *in_material); - -JPC_API float -JPC_SphereShape_GetRadius(const JPC_SphereShape *in_shape); -//-------------------------------------------------------------------------------------------------- -// -// JPC_BoxShape (-> JPC_ConvexShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_BoxShape * -JPC_BoxShape_Create(const float in_half_extent[3], float in_convex_radius, const JPC_PhysicsMaterial *in_material); - -JPC_API void -JPC_BoxShape_GetHalfExtent(const JPC_BoxShape *in_shape, float out_half_extent[3]); -//-------------------------------------------------------------------------------------------------- -// -// JPC_TriangleShape (-> JPC_ConvexShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_TriangleShape * -JPC_TriangleShape_Create(const float in_v1[3], - const float in_v2[3], - const float in_v3[3], - float in_convex_radius, - const JPC_PhysicsMaterial *in_material); - -JPC_API float -JPC_TriangleShape_GetConvexRadius(const JPC_TriangleShape *in_shape); -//-------------------------------------------------------------------------------------------------- -// -// JPC_CapsuleShape (-> JPC_ConvexShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_CapsuleShape * -JPC_CapsuleShape_Create(float in_half_height_of_cylinder, - float in_radius, - const JPC_PhysicsMaterial *in_material); - -JPC_API float -JPC_CapsuleShape_GetRadius(const JPC_CapsuleShape *in_shape); - -JPC_API float -JPC_CapsuleShape_GetHalfHeightOfCylinder(const JPC_CapsuleShape *in_shape); -//-------------------------------------------------------------------------------------------------- -// -// JPC_CylinderShape (-> JPC_ConvexShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_CylinderShape * -JPC_CylinderShape_Create(float in_half_height, - float in_radius, - float in_convex_radius, - const JPC_PhysicsMaterial *in_material); - -JPC_API float -JPC_CylinderShape_GetHalfHeight(const JPC_CylinderShape *in_shape); - -JPC_API float -JPC_CylinderShape_GetRadius(const JPC_CylinderShape *in_shape); +JPC_NarrowPhaseQuery_CastRay(const JPC_NarrowPhaseQuery *in_query, + const JPC_RRayCast *in_ray, + JPC_RayCastResult *io_hit, // *Must* be default initialized (see JPC_RayCastResult) + const void *in_broad_phase_layer_filter, // Can be NULL (no filter) + const void *in_object_layer_filter, // Can be NULL (no filter) + const void *in_body_filter); // Can be NULL (no filter) //-------------------------------------------------------------------------------------------------- // // JPC_ShapeSettings @@ -1673,7 +1268,7 @@ JPC_ShapeSettings_GetRefCount(const JPC_ShapeSettings *in_settings); /// First call creates the shape, subsequent calls return the same pointer and increments reference count. /// Call `JPC_Shape_Release()` when you don't need returned pointer anymore. -JPC_API JPC_ShapeResult +JPC_API JPC_Shape * JPC_ShapeSettings_CreateShape(const JPC_ShapeSettings *in_settings); JPC_API uint64_t @@ -1686,12 +1281,6 @@ JPC_ShapeSettings_SetUserData(JPC_ShapeSettings *in_settings, uint64_t in_user_d // JPC_ConvexShapeSettings (-> JPC_ShapeSettings) // //-------------------------------------------------------------------------------------------------- -JPC_API const JPC_ConvexShapeSupport * -JPC_ConvexShape_GetSupportFunction(const JPC_ConvexShape *in_shape, - JPC_SupportMode in_mode, - JPC_SupportBuffer *in_buffer, - const float in_scale[3]); - JPC_API const JPC_PhysicsMaterial * JPC_ConvexShapeSettings_GetMaterial(const JPC_ConvexShapeSettings *in_settings); @@ -1710,9 +1299,7 @@ JPC_ConvexShapeSettings_SetDensity(JPC_ConvexShapeSettings *in_settings, float i // //-------------------------------------------------------------------------------------------------- JPC_API JPC_BoxShapeSettings * -JPC_BoxShapeSettings_Create(const float in_half_extent[3], - float in_convex_radius, - const JPC_PhysicsMaterial *in_material); +JPC_BoxShapeSettings_Create(const float in_half_extent[3]); JPC_API void JPC_BoxShapeSettings_GetHalfExtent(const JPC_BoxShapeSettings *in_settings, float out_half_extent[3]); @@ -1731,7 +1318,7 @@ JPC_BoxShapeSettings_SetConvexRadius(JPC_BoxShapeSettings *in_settings, float in // //-------------------------------------------------------------------------------------------------- JPC_API JPC_SphereShapeSettings * -JPC_SphereShapeSettings_Create(float in_radius, const JPC_PhysicsMaterial *in_material); +JPC_SphereShapeSettings_Create(float in_radius); JPC_API float JPC_SphereShapeSettings_GetRadius(const JPC_SphereShapeSettings *in_settings); @@ -1744,11 +1331,7 @@ JPC_SphereShapeSettings_SetRadius(JPC_SphereShapeSettings *in_settings, float in // //-------------------------------------------------------------------------------------------------- JPC_API JPC_TriangleShapeSettings * -JPC_TriangleShapeSettings_Create(const float in_v1[3], - const float in_v2[3], - const float in_v3[3], - float in_convex_radius, - const JPC_PhysicsMaterial *in_material); +JPC_TriangleShapeSettings_Create(const float in_v1[3], const float in_v2[3], const float in_v3[3]); JPC_API void JPC_TriangleShapeSettings_SetVertices(JPC_TriangleShapeSettings *in_settings, @@ -1772,9 +1355,7 @@ JPC_TriangleShapeSettings_SetConvexRadius(JPC_TriangleShapeSettings *in_settings // //-------------------------------------------------------------------------------------------------- JPC_API JPC_CapsuleShapeSettings * -JPC_CapsuleShapeSettings_Create(float in_half_height_of_cylinder, - float in_radius, - const JPC_PhysicsMaterial *in_material); +JPC_CapsuleShapeSettings_Create(float in_half_height_of_cylinder, float in_radius); JPC_API float JPC_CapsuleShapeSettings_GetHalfHeight(const JPC_CapsuleShapeSettings *in_settings); @@ -1793,10 +1374,7 @@ JPC_CapsuleShapeSettings_SetRadius(JPC_CapsuleShapeSettings *in_settings, float // //-------------------------------------------------------------------------------------------------- JPC_API JPC_TaperedCapsuleShapeSettings * -JPC_TaperedCapsuleShapeSettings_Create(float in_half_height, - float in_top_radius, - float in_bottom_radius, - const JPC_PhysicsMaterial *in_material); +JPC_TaperedCapsuleShapeSettings_Create(float in_half_height, float in_top_radius, float in_bottom_radius); JPC_API float JPC_TaperedCapsuleShapeSettings_GetHalfHeight(const JPC_TaperedCapsuleShapeSettings *in_settings); @@ -1822,10 +1400,7 @@ JPC_TaperedCapsuleShapeSettings_SetBottomRadius(JPC_TaperedCapsuleShapeSettings // //-------------------------------------------------------------------------------------------------- JPC_API JPC_CylinderShapeSettings * -JPC_CylinderShapeSettings_Create(float in_half_height, - float in_radius, - float in_convex_radius, - const JPC_PhysicsMaterial *in_material); +JPC_CylinderShapeSettings_Create(float in_half_height, float in_radius); JPC_API float JPC_CylinderShapeSettings_GetConvexRadius(const JPC_CylinderShapeSettings *in_settings); @@ -1850,11 +1425,7 @@ JPC_CylinderShapeSettings_SetRadius(JPC_CylinderShapeSettings *in_settings, floa // //-------------------------------------------------------------------------------------------------- JPC_API JPC_ConvexHullShapeSettings * -JPC_ConvexHullShapeSettings_Create(const void *in_vertices, - uint32_t in_num_vertices, - uint32_t in_vertex_size, - float in_convex_radius, - const JPC_PhysicsMaterial *in_material); +JPC_ConvexHullShapeSettings_Create(const void *in_vertices, uint32_t in_num_vertices, uint32_t in_vertex_size); JPC_API float JPC_ConvexHullShapeSettings_GetMaxConvexRadius(const JPC_ConvexHullShapeSettings *in_settings); @@ -1880,13 +1451,7 @@ JPC_ConvexHullShapeSettings_SetHullTolerance(JPC_ConvexHullShapeSettings *in_set // //-------------------------------------------------------------------------------------------------- JPC_API JPC_HeightFieldShapeSettings * -JPC_HeightFieldShapeSettings_Create(const float *in_samples, - uint32_t in_height_field_size, - float in_offset[3], - float in_scale[3], - const uint8_t *in_material_indices, - const JPC_PhysicsMaterial **in_materials, - uint32_t in_num_materials); +JPC_HeightFieldShapeSettings_Create(const float *in_samples, uint32_t in_height_field_size); JPC_API void JPC_HeightFieldShapeSettings_GetOffset(const JPC_HeightFieldShapeSettings *in_settings, float out_offset[3]); @@ -1921,9 +1486,7 @@ JPC_MeshShapeSettings_Create(const void *in_vertices, uint32_t in_num_vertices, uint32_t in_vertex_size, const uint32_t *in_indices, - uint32_t in_num_indices, - const JPC_PhysicsMaterial **in_materials, - uint32_t in_num_materials); + uint32_t in_num_indices); JPC_API uint32_t JPC_MeshShapeSettings_GetMaxTrianglesPerLeaf(const JPC_MeshShapeSettings *in_settings); @@ -1933,111 +1496,63 @@ JPC_MeshShapeSettings_SetMaxTrianglesPerLeaf(JPC_MeshShapeSettings *in_settings, JPC_API void JPC_MeshShapeSettings_Sanitize(JPC_MeshShapeSettings *in_settings); //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_CompoundShapeSettings_AddShapeSettings(JPC_CompoundShapeSettings *in_settings, - const float in_position[3], - const float in_rotation[4], - const JPC_ShapeSettings *in_shape, - uint32_t in_user_data); - -JPC_API void -JPC_CompoundShapeSettings_AddShape(JPC_CompoundShapeSettings *in_settings, - const float in_position[3], - const float in_rotation[4], - const JPC_Shape *in_shape, - uint32_t in_user_data); -//-------------------------------------------------------------------------------------------------- -// -// JPC_StaticCompoundShapeSettings (-> JPC_CompoundShapeSettings -> JPC_ShapeSettings) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_StaticCompoundShapeSettings * -JPC_StaticCompoundShapeSettings_Create(); - -JPC_API JPC_ShapeResult -JPC_StaticCompoundShapeSettings_CreateShape(const JPC_StaticCompoundShapeSettings *in_settings, - JPC_TempAllocator *in_temp_allocator); -//-------------------------------------------------------------------------------------------------- -// -// JPC_MutableCompoundShapeSettings (-> JPC_CompoundShapeSettings -> JPC_ShapeSettings) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_MutableCompoundShapeSettings * -JPC_MutableCompoundShapeSettings_Create(); -//-------------------------------------------------------------------------------------------------- // // JPC_DecoratedShapeSettings (-> JPC_ShapeSettings) // //-------------------------------------------------------------------------------------------------- -JPC_API const JPC_ShapeSettings * -JPC_DecoratedShapeSettings_GetInnerShape(const JPC_DecoratedShapeSettings *in_settings); - -JPC_API void -JPC_DecoratedShapeSettings_SetInnerShape(JPC_DecoratedShapeSettings *in_settings, const JPC_ShapeSettings *in_shape); +JPC_API JPC_DecoratedShapeSettings * +JPC_RotatedTranslatedShapeSettings_Create(const JPC_ShapeSettings *in_inner_shape_settings, + const JPC_Real in_rotated[4], + const JPC_Real in_translated[3]); -JPC_API const JPC_Shape * -JPC_DecoratedShapeSettings_GetInnerShapePtr(const JPC_DecoratedShapeSettings *in_settings); +JPC_API JPC_DecoratedShapeSettings * +JPC_ScaledShapeSettings_Create(const JPC_ShapeSettings *in_inner_shape_settings, + const JPC_Real in_scale[3]); -JPC_API void -JPC_DecoratedShapeSettings_SetInnerShapePtr(JPC_DecoratedShapeSettings *in_settings, const JPC_Shape *in_shape); +JPC_API JPC_DecoratedShapeSettings * +JPC_OffsetCenterOfMassShapeSettings_Create(const JPC_ShapeSettings *in_inner_shape_settings, + const JPC_Real in_center_of_mass[3]); //-------------------------------------------------------------------------------------------------- // -// JPC_ScaledShapeSettings (-> JPC_DecoratedShapeSettings -> JPC_ShapeSettings) +// JPC_CompoundShapeSettings (-> JPC_ShapeSettings) // //-------------------------------------------------------------------------------------------------- -JPC_API JPC_ScaledShapeSettings * -JPC_ScaledShapeSettings_CreateFromShape(const JPC_Shape *in_shape, const float in_scale[3]); - -JPC_API JPC_ScaledShapeSettings * -JPC_ScaledShapeSettings_CreateFromSettings(const JPC_ShapeSettings *in_shape, const float in_scale[3]); +JPC_API JPC_CompoundShapeSettings * +JPC_StaticCompoundShapeSettings_Create(); -JPC_API void -JPC_ScaledShapeSettings_GetScale(const JPC_ScaledShapeSettings *in_settings, float out_scale[3]); +JPC_API JPC_CompoundShapeSettings * +JPC_MutableCompoundShapeSettings_Create(); JPC_API void -JPC_ScaledShapeSettings_SetScale(JPC_ScaledShapeSettings *in_settings, const float in_scale[3]); +JPC_CompoundShapeSettings_AddShape(JPC_CompoundShapeSettings *in_settings, + const JPC_Real in_position[3], + const JPC_Real in_rotation[4], + const JPC_ShapeSettings *in_shape, + const uint32_t in_user_data); //-------------------------------------------------------------------------------------------------- // -// JPC_RotatedTranslatedShapeSettings (-> JPC_DecoratedShapeSettings -> JPC_ShapeSettings) +// JPC_BodyManager_DrawSettings // //-------------------------------------------------------------------------------------------------- -JPC_API JPC_RotatedTranslatedShapeSettings * -JPC_RotatedTranslatedShapeSettings_CreateFromShape(const JPC_Shape *in_shape, - const float in_position[3], - const float in_rotation[4]); - -JPC_API JPC_RotatedTranslatedShapeSettings * -JPC_RotatedTranslatedShapeSettings_CreateFromSettings(const JPC_ShapeSettings *in_shape, - const float in_position[3], - const float in_rotation[4]); - -JPC_API void -JPC_RotatedTranslatedShapeSettings_GetPosition(const JPC_RotatedTranslatedShapeSettings *in_settings, float out_position[3]); - -JPC_API void -JPC_RotatedTranslatedShapeSettings_SetPosition(JPC_RotatedTranslatedShapeSettings *in_settings, const float in_position[3]); - -JPC_API void -JPC_RotatedTranslatedShapeSettings_GetRotation(const JPC_RotatedTranslatedShapeSettings *in_settings, float out_rotation[4]); +#if JPC_DEBUG_RENDERER == 1 +JPC_API JPC_BodyManager_DrawSettings * +JPC_BodyManager_DrawSettings_Create(); JPC_API void -JPC_RotatedTranslatedShapeSettings_SetRotation(JPC_RotatedTranslatedShapeSettings *in_settings, const float in_rotation[4]); +JPC_BodyManager_DrawSettings_Destroy(JPC_BodyManager_DrawSettings *); +#endif // JPC_DEBUG_RENDERER //-------------------------------------------------------------------------------------------------- // -// JPC_OffsetCenterOfMassShapeSettings (-> JPC_DecoratedShapeSettings -> JPC_ShapeSettings) +// JPC_BodyDrawFilter // //-------------------------------------------------------------------------------------------------- -JPC_API JPC_OffsetCenterOfMassShapeSettings * -JPC_OffsetCenterOfMassShapeSettings_CreateFromShape(const JPC_Shape *in_shape, const float in_offset[3]); - -JPC_API JPC_OffsetCenterOfMassShapeSettings * -JPC_OffsetCenterOfMassShapeSettings_CreateFromSettings(const JPC_ShapeSettings *in_shape, const float in_offset[3]); +#if JPC_DEBUG_RENDERER == 1 +JPC_API JPC_BodyDrawFilter * +JPC_BodyDrawFilter_Create(const JPC_BodyDrawFilterFunc); JPC_API void -JPC_OffsetCenterOfMassShapeSettings_GetOffset(const JPC_OffsetCenterOfMassShapeSettings *in_settings, float out_offset[3]); - -JPC_API void -JPC_OffsetCenterOfMassShapeSettings_SetOffset(JPC_OffsetCenterOfMassShapeSettings *in_settings, const float in_offset[3]); +JPC_BodyDrawFilter_Destroy(JPC_BodyDrawFilter *); +#endif // JPC_DEBUG_RENDERER //-------------------------------------------------------------------------------------------------- // // JPC_Shape @@ -2064,171 +1579,77 @@ JPC_Shape_GetUserData(const JPC_Shape *in_shape); JPC_API void JPC_Shape_SetUserData(JPC_Shape *in_shape, uint64_t in_user_data); -JPC_API bool -JPC_Shape_MustBeStatic(const JPC_Shape *in_shape); - JPC_API void -JPC_Shape_GetCenterOfMass(const JPC_Shape *in_shape, float out_center_of_mass[3]); - +JPC_Shape_GetCenterOfMass(const JPC_Shape *in_shape, JPC_Real out_position[3]); +//-------------------------------------------------------------------------------------------------- +// +// JPC_ConstraintSettings +// +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_Shape_GetLocalBounds(const JPC_Shape *in_shape, JPC_AABox *out_local_bounds); - -JPC_API uint32_t -JPC_Shape_GetSubShapeIDBitsRecursive(const JPC_Shape *in_shape); +JPC_ConstraintSettings_AddRef(JPC_ConstraintSettings *in_settings); JPC_API void -JPC_Shape_GetWorldSpaceBounds(const JPC_Shape *in_shape, - const float in_center_of_mass_transform[16], - const float in_scale[3], - JPC_AABox *out_world_space_bounds); +JPC_ConstraintSettings_Release(JPC_ConstraintSettings *in_settings); -JPC_API float -JPC_Shape_GetInnerRadius(const JPC_Shape *in_shape); - -// TODO -//JPC_API void -//JPC_Shape_GetMassProperties(const JPC_Shape *in_shape, JPC_MassProperties* out_mass_properties); +JPC_API uint32_t +JPC_ConstraintSettings_GetRefCount(const JPC_ConstraintSettings *in_settings); -JPC_API const JPC_PhysicsMaterial * -JPC_Shape_GetMaterial(const JPC_Shape *in_shape, JPC_SubShapeID in_sub_shape_id); +JPC_API uint64_t +JPC_ConstraintSettings_GetUserData(const JPC_ConstraintSettings *in_settings); JPC_API void -JPC_Shape_GetSurfaceNormal(const JPC_Shape *in_shape, - JPC_SubShapeID in_sub_shape_id, - const float in_local_surface_position[3], - float out_surface_normal[3]); +JPC_ConstraintSettings_SetUserData(JPC_ConstraintSettings *in_settings, uint64_t in_user_data); +//-------------------------------------------------------------------------------------------------- +// +// JPC_TwoBodyConstraintSettings (-> JPC_ConstraintSettings) +// +//-------------------------------------------------------------------------------------------------- +JPC_API JPC_Constraint * +JPC_TwoBodyConstraintSettings_CreateConstraint(const JPC_TwoBodyConstraintSettings *in_settings, + JPC_Body *in_body1, + JPC_Body *in_body2); +//-------------------------------------------------------------------------------------------------- +// +// JPC_FixedConstraintSettings (-> JPC_TwoBodyConstraintSettings -> JPC_ConstraintSettings) +// +//-------------------------------------------------------------------------------------------------- +JPC_API JPC_FixedConstraintSettings * +JPC_FixedConstraintSettings_Create(); JPC_API void -JPC_Shape_GetSupportingFace(const JPC_Shape* in_shape, - JPC_SubShapeID in_sub_shape_id, - const float in_direction[3], - const float in_scale[3], - const float in_com_transform[16], - JPC_SupportingFace *out_vertices); - -JPC_API uint64_t -JPC_Shape_GetSubShapeUserData(const JPC_Shape *in_shape, JPC_SubShapeID in_sub_shape_id); - -JPC_API JPC_TransformedShape -JPC_Shape_GetSubShapeTransformedShape(const JPC_Shape *in_shape, - JPC_SubShapeID in_sub_shape_id, - const float in_position_com[3], - const float in_rotation[4], - const float in_scale[3]); +JPC_FixedConstraintSettings_SetSpace(JPC_FixedConstraintSettings *in_settings, JPC_ConstraintSpace in_space); JPC_API void -JPC_Shape_GetSubmergedVolume(const JPC_Shape *in_shape, - const float in_com_transform[16], - const float in_scale[3], - const float in_surface_normal[3], - float in_surface_constant, - float *out_total_volume, - float *out_submerged_volume, - float *out_center_of_buoyancy[3]); - -JPC_API bool -JPC_Shape_GetCastRay(const JPC_Shape *in_shape, - const JPC_RayCast *in_ray, - const JPC_SubShapeIDCreator *in_sub_shape_id_creator, - JPC_RayCastResult *io_hit); - +JPC_FixedConstraintSettings_SetAutoDetectPoint(JPC_FixedConstraintSettings *in_settings, bool in_enabled); +//-------------------------------------------------------------------------------------------------- +// +// JPC_Constraint +// +//-------------------------------------------------------------------------------------------------- JPC_API void -JPC_Shape_CollectCastRay(const JPC_Shape *in_shape, - const JPC_RayCast *in_ray, - const JPC_RayCastSettings *in_settings, - const JPC_SubShapeIDCreator *in_sub_shape_id_creator, - void *io_collector, - void *in_shape_filter); +JPC_Constraint_AddRef(JPC_Constraint *in_shape); JPC_API void -JPC_Shape_CollidePoint(const JPC_Shape *in_shape, - const float in_point[3], - const JPC_SubShapeIDCreator *in_sub_shape_id_creator, - void *io_collector, - void *in_shape_filter); +JPC_Constraint_Release(JPC_Constraint *in_shape); -JPC_API void -JPC_Shape_CollectTransformedShapes(const JPC_Shape *in_shape, - const JPC_AABox *in_box, - const float in_position_com[3], - const float in_rotation[4], - const float in_scale[3], - const JPC_SubShapeIDCreator *in_sub_shape_id_creator, - void *io_collector, - void *in_shape_filter); +JPC_API uint32_t +JPC_Constraint_GetRefCount(const JPC_Constraint *in_shape); -JPC_API void -JPC_Shape_TransformShape(const JPC_Shape *in_shape, - const float in_com_transform[16], - void *io_collector); +JPC_API JPC_ConstraintType +JPC_Constraint_GetType(const JPC_Constraint *in_shape); -JPC_API JPC_ShapeResult -JPC_Shape_ScaleShape(const JPC_Shape *in_shape, const float in_scale[3]); +JPC_API JPC_ConstraintSubType +JPC_Constraint_GetSubType(const JPC_Constraint *in_shape); -JPC_API float -JPC_Shape_GetVolume(const JPC_Shape *in_shape); +JPC_API uint64_t +JPC_Constraint_GetUserData(const JPC_Constraint *in_shape); -JPC_API bool -JPC_Shape_IsValidScale(const JPC_Shape *in_shape, const float in_scale[3]); +JPC_API void +JPC_Constraint_SetUserData(JPC_Constraint *in_shape, uint64_t in_user_data); //-------------------------------------------------------------------------------------------------- // -// JPC_ConvexShape (-> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_ConvexShape_SetMaterial(JPC_ConvexShape *in_shape, const JPC_PhysicsMaterial *in_material); - -JPC_API const JPC_PhysicsMaterial * -JPC_ConvexShape_GetMaterial(const JPC_ConvexShape *in_shape); - -JPC_API void -JPC_ConvexShape_SetDensity(JPC_ConvexShape *in_shape, float in_density); - -JPC_API float -JPC_ConvexShape_GetDensity(const JPC_ConvexShape *in_shape); -//-------------------------------------------------------------------------------------------------- -// -// JPC_DecoratedShape (-> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API const JPC_Shape * -JPC_DecoratedShape_GetInnerShape(const JPC_DecoratedShape *in_shape); -//-------------------------------------------------------------------------------------------------- -// -// JPC_ScaledShape (-> JPC_DecoratedShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_ScaledShape * -JPC_ScaledShape_Create(const JPC_Shape *in_shape, const float in_scale[3]); - -JPC_API void -JPC_ScaledShape_GetScale(const JPC_ScaledShape *in_shape, float out_scale[3]); -//-------------------------------------------------------------------------------------------------- -// -// JPC_RotatedTranslatedShape (-> JPC_DecoratedShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_RotatedTranslatedShape * -JPC_RotatedTranslatedShape_Create(const JPC_Shape *in_shape, const float in_position[3], const float in_rotation[4]); - -JPC_API void -JPC_RotatedTranslatedShape_GetPosition(const JPC_RotatedTranslatedShape *in_shape, float out_position[3]); - -JPC_API void -JPC_RotatedTranslatedShape_GetRotation(const JPC_RotatedTranslatedShape *in_shape, float out_rotation[4]); -//-------------------------------------------------------------------------------------------------- -// -// JPC_OffsetCenterOfMassShape (-> JPC_DecoratedShape -> JPC_Shape) -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_OffsetCenterOfMassShapeSettings * -JPC_OffsetCenterOfMassShape_Create(const JPC_Shape *in_shape, const float in_offset[3]); - -JPC_API void -JPC_OffsetCenterOfMassShape_GetOffset(const JPC_OffsetCenterOfMassShape *in_shape, float out_offset[3]); -//-------------------------------------------------------------------------------------------------- -// -// JPC_BodyInterface +// JPC_BodyInterface // //-------------------------------------------------------------------------------------------------- JPC_API JPC_Body * @@ -2239,189 +1660,21 @@ JPC_BodyInterface_CreateBodyWithID(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, const JPC_BodyCreationSettings *in_settings); -JPC_API JPC_Body * -JPC_BodyInterface_CreateBodyWithoutID(JPC_BodyInterface *in_iface, - const JPC_BodyCreationSettings *in_settings); - -JPC_API void -JPC_BodyInterface_DestroyBodyWithoutID(JPC_BodyInterface *in_iface, JPC_Body *in_body); - -JPC_API bool -JPC_BodyInterface_AssignNextBodyID(JPC_BodyInterface *in_iface, JPC_Body *in_body); - -JPC_API bool -JPC_BodyInterface_AssignBodyID(JPC_BodyInterface *in_iface, JPC_Body *in_body, JPC_BodyID in_body_id); - -JPC_API JPC_Body * -JPC_BodyInterface_UnassignBodyID(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); - -JPC_API void -JPC_BodyInterface_UnassignBodyIDs(JPC_BodyInterface *in_iface, - const JPC_BodyID *in_body_ids, - int in_number, - JPC_Body **out_bodies); - JPC_API void JPC_BodyInterface_DestroyBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); -JPC_API void -JPC_BodyInterface_DestroyBodies(JPC_BodyInterface *in_iface, const JPC_BodyID *in_body_ids, int in_number); - JPC_API void JPC_BodyInterface_AddBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, JPC_Activation in_mode); JPC_API void JPC_BodyInterface_RemoveBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); -JPC_API bool -JPC_BodyInterface_IsAdded(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); - JPC_API JPC_BodyID JPC_BodyInterface_CreateAndAddBody(JPC_BodyInterface *in_iface, const JPC_BodyCreationSettings *in_settings, JPC_Activation in_mode); - -JPC_API JPC_BodyInterfaceAddState -JPC_BodyInterface_AddBodiesPrepare(JPC_BodyInterface *in_iface, - JPC_BodyID *io_bodies, - int in_number); - -JPC_API void -JPC_BodyInterface_AddBodiesFinalize(JPC_BodyInterface *in_iface, - JPC_BodyID *io_bodies, - int in_number, - JPC_BodyInterfaceAddState *in_add_state, - JPC_Activation in_activation_mode); - -JPC_API void -JPC_BodyInterface_AddBodiesAbort(JPC_BodyInterface *in_iface, - JPC_BodyID *io_bodies, - int in_number, - JPC_BodyInterfaceAddState *in_add_state); - -JPC_API void -JPC_BodyInterface_RemoveBodies(JPC_BodyInterface *in_iface, - JPC_BodyID *io_bodies, - int in_number); - -JPC_API void -JPC_BodyInterface_ActivateBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); - -JPC_API void -JPC_BodyInterface_ActivateBodies(JPC_BodyInterface *in_iface, - const JPC_BodyID *in_body_ids, - int in_number); - -JPC_API void -JPC_BodyInterface_DeactivateBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); - -JPC_API void -JPC_BodyInterface_DeactivateBodies(JPC_BodyInterface *in_iface, - const JPC_BodyID *in_body_ids, - int in_number); - JPC_API bool -JPC_BodyInterface_IsActive(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); - -// TODO constraint -//JPC_API JPC_TwoBodyConstraint * -//JPC_BodyInterface_CreateConstraint(JPC_BodyInterface *in_iface, -// const JPC_TwoBodyConstraintSettings *in_settings, -// JPC_BodyID in_body_id1, -// JPC_BodyID in_body_id2); -// -//JPC_API void -//JPC_BodyInterface_ActivateConstraint(JPC_BodyInterface *in_iface, -// const JPC_TwoBodyConstraint *in_constraint); - -JPC_API const JPC_Shape * -JPC_BodyInterface_GetShape(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); - -JPC_API void -JPC_BodyInterface_SetShape(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const JPC_Shape *in_shape, - bool in_update_mass_properties, - JPC_Activation in_activation_mode); - -JPC_API void -JPC_BodyInterface_NotifyShapeChanged(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const float in_previous_center_of_mass[3], - bool in_update_mass_properties, - JPC_Activation in_activation_mode); - -JPC_API void -JPC_BodyInterface_SetObjectLayer(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, JPC_ObjectLayer in_layer); - -JPC_API JPC_ObjectLayer -JPC_BodyInterface_GetObjectLayer(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); - -JPC_API void -JPC_BodyInterface_SetPositionAndRotation(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const JPC_Real in_position[3], - const float in_rotation[4], - JPC_Activation in_activation_mode); - -JPC_API void -JPC_BodyInterface_SetPositionAndRotationWhenChanged(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const JPC_Real in_position[3], - const float in_rotation[4], - JPC_Activation in_activation_mode); - -JPC_API void -JPC_BodyInterface_GetPositionAndRotation(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - JPC_Real out_position[3], - float out_rotation[4]); - -JPC_API void -JPC_BodyInterface_SetPosition(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const JPC_Real in_position[3], - JPC_Activation in_activation_mode); - -JPC_API void -JPC_BodyInterface_GetPosition(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - JPC_Real out_position[3]); - -JPC_API void -JPC_BodyInterface_GetCenterOfMassPosition(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - JPC_Real out_position[3]); - -JPC_API void -JPC_BodyInterface_SetRotation(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const float in_rotation[4], - JPC_Activation in_activation_mode); - -JPC_API void -JPC_BodyInterface_GetRotation(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float out_rotation[4]); - -JPC_API void -JPC_BodyInterface_GetWorldTransform(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float out_rotation[9], - JPC_Real out_translation[3]); - -JPC_API void -JPC_BodyInterface_GetCenterOfMassTransform(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float out_rotation[9], - JPC_Real out_translation[3]); - -JPC_API void -JPC_BodyInterface_MoveKinematic(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - const JPC_Real in_target_position[3], - const float in_target_rotation[4], - float in_delta_time); +JPC_BodyInterface_IsAdded(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); JPC_API void JPC_BodyInterface_SetLinearAndAngularVelocity(JPC_BodyInterface *in_iface, @@ -2463,6 +1716,36 @@ JPC_BodyInterface_GetPointVelocity(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, const JPC_Real in_point[3], float out_velocity[3]); +JPC_API void +JPC_BodyInterface_GetPosition(const JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + JPC_Real out_position[3]); +JPC_API void +JPC_BodyInterface_SetPosition(JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + const JPC_Real in_position[3], + JPC_Activation in_activation); +JPC_API void +JPC_BodyInterface_GetCenterOfMassPosition(const JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + JPC_Real out_position[3]); +JPC_API void +JPC_BodyInterface_GetRotation(const JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + float out_rotation[4]); +JPC_API void +JPC_BodyInterface_SetRotation(JPC_BodyInterface *in_iface, + JPC_BodyID in_body_id, + const JPC_Real in_rotation[4], + JPC_Activation in_activation); +JPC_API void +JPC_BodyInterface_ActivateBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); + +JPC_API void +JPC_BodyInterface_DeactivateBody(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); + +JPC_API bool +JPC_BodyInterface_IsActive(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); JPC_API void JPC_BodyInterface_SetPositionRotationAndVelocity(JPC_BodyInterface *in_iface, @@ -2471,7 +1754,6 @@ JPC_BodyInterface_SetPositionRotationAndVelocity(JPC_BodyInterface *in_iface, const float in_rotation[4], const float in_linear_velocity[3], const float in_angular_velocity[3]); - JPC_API void JPC_BodyInterface_AddForce(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, const float in_force[3]); @@ -2499,74 +1781,17 @@ JPC_BodyInterface_AddImpulseAtPosition(JPC_BodyInterface *in_iface, JPC_API void JPC_BodyInterface_AddAngularImpulse(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, const float in_impulse[3]); -JPC_API void -JPC_BodyInterface_SetMotionType(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - JPC_MotionType in_motion_type, - JPC_Activation in_activation_mode); - -JPC_API JPC_MotionType -JPC_BodyInterface_GetMotionType(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id); - -JPC_API void -JPC_BodyInterface_SetMotionQuality(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - JPC_MotionQuality in_motion_quality); - -JPC_API JPC_MotionQuality -JPC_BodyInterface_GetMotionQuality(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id); - -JPC_API void -JPC_BodyInterface_GetInverseInertia(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float out_inverse_inertia[16]); - -JPC_API void -JPC_BodyInterface_SetRestitution(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float in_restitution); - -JPC_API float -JPC_BodyInterface_GetRestitution(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id); - -JPC_API void -JPC_BodyInterface_SetFriction(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float in_friction); - -JPC_API float -JPC_BodyInterface_GetFriction(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id); - -JPC_API void -JPC_BodyInterface_SetGravityFactor(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - float in_gravity_factor); - -JPC_API float -JPC_BodyInterface_GetGravityFactor(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id); +JPC_API JPC_MotionType +JPC_BodyInterface_GetMotionType(const JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); JPC_API void -JPC_BodyInterface_GetTransformedShape(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - JPC_TransformedShape *out_shape); +JPC_BodyInterface_SetMotionType(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, JPC_MotionType motion_type, JPC_Activation activation); -JPC_API uint64_t -JPC_BodyInterface_GetUserData(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id); - -JPC_API const JPC_PhysicsMaterial * -JPC_BodyInterface_GetMaterial(const JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id, - JPC_SubShapeID in_sub_shape_id); +JPC_API JPC_ObjectLayer +JPC_BodyInterface_GetObjectLayer(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id); JPC_API void -JPC_BodyInterface_InvalidateContactCache(JPC_BodyInterface *in_iface, - JPC_BodyID in_body_id); +JPC_BodyInterface_SetObjectLayer(JPC_BodyInterface *in_iface, JPC_BodyID in_body_id, JPC_ObjectLayer in_layer); //-------------------------------------------------------------------------------------------------- // // JPC_Body @@ -2596,15 +1821,6 @@ JPC_Body_SetIsSensor(JPC_Body *in_body, bool in_is_sensor); JPC_API bool JPC_Body_IsSensor(const JPC_Body *in_body); -JPC_API void -JPC_Body_SetUseManifoldReduction(JPC_Body *in_body, bool in_use_reduction); - -JPC_API bool -JPC_Body_GetUseManifoldReduction(const JPC_Body *in_body); - -JPC_API bool -JPC_Body_GetUseManifoldReductionWithBody(const JPC_Body *in_body, const JPC_Body *in_other); - JPC_API JPC_MotionType JPC_Body_GetMotionType(const JPC_Body *in_body); @@ -2654,10 +1870,10 @@ JPC_API void JPC_Body_GetAngularVelocity(const JPC_Body *in_body, float out_angular_velocity[3]); JPC_API void -JPC_Body_SetAngularVelocity(JPC_Body *in_body, const float in_angular_velocity[3]); +JPC_Body_SetAnglularVelocity(JPC_Body *in_body, const float in_angular_velocity[3]); JPC_API void -JPC_Body_SetAngularVelocityClamped(JPC_Body *in_body, const float in_angular_velocity[3]); +JPC_Body_SetAnglularVelocityClamped(JPC_Body *in_body, const float in_angular_velocity[3]); JPC_API void JPC_Body_GetPointVelocityCOM(const JPC_Body *in_body, @@ -2675,12 +1891,6 @@ JPC_Body_AddForceAtPosition(JPC_Body *in_body, const float in_force[3], const JP JPC_API void JPC_Body_AddTorque(JPC_Body *in_body, const float in_torque[3]); -JPC_API void -JPC_Body_GetAccumulatedForce(JPC_Body *in_body, float out_force[3]); - -JPC_API void -JPC_Body_GetAccumulatedTorque(JPC_Body *in_body, float out_torque[3]); - JPC_API void JPC_Body_GetInverseInertia(const JPC_Body *in_body, float out_inverse_inertia[16]); @@ -2698,7 +1908,7 @@ JPC_Body_MoveKinematic(JPC_Body *in_body, const JPC_Real in_target_position[3], const float in_target_rotation[4], float in_delta_time); -JPC_API bool +JPC_API void JPC_Body_ApplyBuoyancyImpulse(JPC_Body *in_body, const JPC_Real in_surface_position[3], const float in_surface_normal[3], @@ -2749,20 +1959,11 @@ JPC_Body_GetUserData(const JPC_Body *in_body); JPC_API void JPC_Body_SetUserData(JPC_Body *in_body, uint64_t in_user_data); -JPC_API void -JPC_Body_GetTransformedShape(JPC_Body *in_body, JPC_TransformedShape *out_shape); - -JPC_API void -JPC_Body_GetBodyCreationSettings(JPC_Body *in_body, JPC_BodyCreationSettings *out_settings); - JPC_API void JPC_Body_GetWorldSpaceSurfaceNormal(const JPC_Body *in_body, JPC_SubShapeID in_sub_shape_id, const JPC_Real in_position[3], // world space float out_normal_vector[3]); - -JPC_API JPC_Body * -JPC_Body_FixedToWorld(); //-------------------------------------------------------------------------------------------------- // // JPC_BodyID @@ -2778,1086 +1979,113 @@ JPC_API bool JPC_BodyID_IsInvalid(JPC_BodyID in_body_id); //-------------------------------------------------------------------------------------------------- // -// JPC_Constraint +// JPC_CharacterSettings // //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_Constraint_Release(JPC_Constraint *in_constraint); - -JPC_API JPC_ConstraintType -JPC_Constraint_GetType(const JPC_Constraint *in_constraint); - -JPC_API JPC_ConstraintSubType -JPC_Constraint_GetSubType(const JPC_Constraint *in_constraint); - -JPC_API void -JPC_Constraint_SetNumVelocityStepsOverride(JPC_Constraint *in_constraint, int in_num_velocity_steps_override); - -JPC_API int -JPC_Constraint_GetNumVelocityStepsOverride(const JPC_Constraint *in_constraint); +JPC_API JPC_CharacterSettings * +JPC_CharacterSettings_Create(); JPC_API void -JPC_Constraint_SetNumPositionStepsOverride(JPC_Constraint *in_constraint, int in_num_position_steps_override); - -JPC_API int -JPC_Constraint_GetNumPositionStepsOverride(const JPC_Constraint *in_constraint); +JPC_CharacterSettings_Release(JPC_CharacterSettings *in_settings); JPC_API void -JPC_Constraint_SetEnabled(JPC_Constraint *in_constraint, bool in_enabled); - -JPC_API bool -JPC_Constraint_GetEnabled(const JPC_Constraint *in_constraint); +JPC_CharacterSettings_AddRef(JPC_CharacterSettings *in_settings); //-------------------------------------------------------------------------------------------------- // -// JPC_TwoBodyConstraint +// JPC_Character // //-------------------------------------------------------------------------------------------------- -JPC_API JPC_Body * -JPC_TwoBodyConstraint_GetBody1(const JPC_TwoBodyConstraint *in_constraint); +JPC_API JPC_Character * +JPC_Character_Create(const JPC_CharacterSettings *in_settings, + const JPC_Real in_position[3], + const float in_rotation[4], + uint64_t in_user_data, + JPC_PhysicsSystem *in_physics_system); -JPC_API JPC_Body * -JPC_TwoBodyConstraint_GetBody2(const JPC_TwoBodyConstraint *in_constraint); +JPC_API void +JPC_Character_Destroy(JPC_Character *in_character); JPC_API void -JPC_TwoBodyConstraint_GetConstraintToBody1Matrix(const JPC_TwoBodyConstraint *in_constraint, float out_matrix[16]); +JPC_Character_AddToPhysicsSystem(JPC_Character *in_character, JPC_Activation in_activation, bool in_lock_bodies); JPC_API void -JPC_TwoBodyConstraint_GetConstraintToBody2Matrix(const JPC_TwoBodyConstraint *in_constraint, float out_matrix[16]); -//-------------------------------------------------------------------------------------------------- -// -// JPC_FixedConstraint -// -//-------------------------------------------------------------------------------------------------- +JPC_Character_RemoveFromPhysicsSystem(JPC_Character *in_character, bool in_lock_bodies); + JPC_API void -JPC_FixedConstraint_GetTotalLambdaPosition(const JPC_FixedConstraint *in_constraint, float out_lambda[3]); +JPC_Character_GetPosition(const JPC_Character *in_character, JPC_Real out_position[3]); JPC_API void -JPC_FixedConstraint_GetTotalLambdaRotation(const JPC_FixedConstraint *in_constraint, float out_lambda[3]); +JPC_Character_SetPosition(JPC_Character *in_character, const JPC_Real in_position[3]); + +JPC_API void +JPC_Character_GetLinearVelocity(const JPC_Character *in_character, float out_linear_velocity[3]); + +JPC_API void +JPC_Character_SetLinearVelocity(JPC_Character *in_character, const float in_linear_velocity[3]); //-------------------------------------------------------------------------------------------------- // -// JPC_DistanceConstraint +// JPC_CharacterVirtualSettings // //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_DistanceConstraint_SetDistance(JPC_DistanceConstraint *in_constraint, float in_min_distance, float in_max_distance); - -JPC_API float -JPC_DistanceConstraint_GetMinDistance(const JPC_DistanceConstraint *in_constraint); - -JPC_API float -JPC_DistanceConstraint_GetMaxDistance(const JPC_DistanceConstraint *in_constraint); - -JPC_API void -JPC_DistanceConstraint_SetFrequency(JPC_DistanceConstraint *in_constraint, float in_frequency); - -JPC_API float -JPC_DistanceConstraint_GetFrequency(const JPC_DistanceConstraint *in_constraint); +JPC_API JPC_CharacterVirtualSettings * +JPC_CharacterVirtualSettings_Create(); JPC_API void -JPC_DistanceConstraint_SetDamping(JPC_DistanceConstraint *in_constraint, float in_damping); - -JPC_API float -JPC_DistanceConstraint_GetDamping(const JPC_DistanceConstraint *in_constraint); - -JPC_API float -JPC_DistanceConstraint_GetTotalLambdaPosition(const JPC_DistanceConstraint *in_constraint); +JPC_CharacterVirtualSettings_Release(JPC_CharacterVirtualSettings *in_settings); //-------------------------------------------------------------------------------------------------- // -// JPC_PointConstraint +// JPC_CharacterVirtual // //-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_PointConstraint_SetPoint1(JPC_PointConstraint *in_constraint, const JPC_ConstraintSpace in_space, const JPC_Real in_point1[3]); +JPC_API JPC_CharacterVirtual * +JPC_CharacterVirtual_Create(const JPC_CharacterVirtualSettings *in_settings, + const JPC_Real in_position[3], + const float in_rotation[4], + JPC_PhysicsSystem *in_physics_system); JPC_API void -JPC_PointConstraint_SetPoint2(JPC_PointConstraint *in_constraint, const JPC_ConstraintSpace in_space, const JPC_Real in_point2[3]); +JPC_CharacterVirtual_Destroy(JPC_CharacterVirtual *in_character); JPC_API void -JPC_PointConstraint_GetLocalSpacePoint1(const JPC_PointConstraint *in_constraint, float out_point[3]); +JPC_CharacterVirtual_Update(JPC_CharacterVirtual *in_character, + float in_delta_time, + const float in_gravity[3], + const void *in_broad_phase_layer_filter, + const void *in_object_layer_filter, + const void *in_body_filter, + const void *in_shape_filter, + JPC_TempAllocator *in_temp_allocator); JPC_API void -JPC_PointConstraint_GetLocalSpacePoint2(const JPC_PointConstraint *in_constraint, float out_point[3]); +JPC_CharacterVirtual_SetListener(JPC_CharacterVirtual *in_character, void *in_listener); JPC_API void -JPC_PointConstraint_GetTotalLambdaPosition(const JPC_PointConstraint *in_constraint, float out_lambda[3]); -//-------------------------------------------------------------------------------------------------- -// -// JPC_HingeConstraint -// -//-------------------------------------------------------------------------------------------------- -JPC_API float -JPC_HingeConstraint_GetCurrentAngle(const JPC_HingeConstraint *in_constraint); +JPC_CharacterVirtual_UpdateGroundVelocity(JPC_CharacterVirtual *in_character); JPC_API void -JPC_HingeConstraint_SetMaxFrictionTorque(JPC_HingeConstraint *in_constraint, float in_friction_torque); - -JPC_API float -JPC_HingeConstraint_GetMaxFrictionTorque(const JPC_HingeConstraint *in_constraint); +JPC_CharacterVirtual_GetGroundVelocity(const JPC_CharacterVirtual *in_character, float out_ground_velocity[3]); -JPC_API JPC_MotorSettings * -JPC_HingeConstraint_GetMotorSettings(JPC_HingeConstraint *in_constraint); +JPC_API JPC_CharacterGroundState +JPC_CharacterVirtual_GetGroundState(JPC_CharacterVirtual *in_character); JPC_API void -JPC_HingeConstraint_SetMotorState(JPC_HingeConstraint *in_constraint, JPC_MotorState in_state); - -JPC_API JPC_MotorState -JPC_HingeConstraint_GetMotorState(const JPC_HingeConstraint *in_constraint); +JPC_CharacterVirtual_GetPosition(const JPC_CharacterVirtual *in_character, JPC_Real out_position[3]); JPC_API void -JPC_HingeConstraint_SetTargetAngularVelocity(JPC_HingeConstraint *in_constraint, float in_angular_velocity); - -JPC_API float -JPC_HingeConstraint_GetTargetAngularVelocity(const JPC_HingeConstraint *in_constraint); +JPC_CharacterVirtual_SetPosition(JPC_CharacterVirtual *in_character, const JPC_Real in_position[3]); JPC_API void -JPC_HingeConstraint_SetTargetAngle(JPC_HingeConstraint *in_constraint, float in_angle); - -JPC_API float -JPC_HingeConstraint_GetTargetAngle(const JPC_HingeConstraint *in_constraint); +JPC_CharacterVirtual_GetRotation(const JPC_CharacterVirtual *in_character, float out_rotation[4]); JPC_API void -JPC_HingeConstraint_SetLimits(JPC_HingeConstraint *in_constraint, float in_limits_min, float in_limits_max); +JPC_CharacterVirtual_SetRotation(JPC_CharacterVirtual *in_character, const float in_rotation[4]); -JPC_API float -JPC_HingeConstraint_GetLimitsMin(const JPC_HingeConstraint *in_constraint); - -JPC_API float -JPC_HingeConstraint_GetLimitsMax(const JPC_HingeConstraint *in_constraint); - -JPC_API bool -JPC_HingeConstraint_HasLimits(const JPC_HingeConstraint *in_constraint); - -JPC_API void -JPC_HingeConstraint_GetTotalLambdaPosition(const JPC_HingeConstraint *in_constraint, float out_lambda[3]); - -JPC_API void -JPC_HingeConstraint_GetTotalLambdaRotation(const JPC_HingeConstraint *in_constraint, float *out_x, float *out_y); - -JPC_API float -JPC_HingeConstraint_GetTotalLambdaRotationLimits(const JPC_HingeConstraint *in_constraint); - -JPC_API float -JPC_HingeConstraint_GetTotalLambdaMotor(const JPC_HingeConstraint *in_constraint); -//-------------------------------------------------------------------------------------------------- -// -// JPC_ConeConstraint -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_ConeConstraint_SetHalfConeAngle(JPC_ConeConstraint *in_self, float in_half_cone_angle); - -JPC_API float -JPC_ConeConstraint_GetCosHalfConeAngle(const JPC_ConeConstraint *in_self); - -JPC_API void -JPC_ConeConstraint_GetTotalLambdaPosition(const JPC_ConeConstraint *in_self, float out_lambda[3]); - -JPC_API float -JPC_ConeConstraint_GetTotalLambdaRotation(const JPC_ConeConstraint *in_self); -//-------------------------------------------------------------------------------------------------- -// -// JPC_SliderConstraint -// -//-------------------------------------------------------------------------------------------------- -JPC_API float -JPC_SliderConstraint_GetCurrentPosition(const JPC_SliderConstraint *in_self); - -JPC_API float -JPC_SliderConstraint_GetMaxFrictionForce(const JPC_SliderConstraint *in_self); - -JPC_API void -JPC_SliderConstraint_SetMaxFrictionForce(JPC_SliderConstraint *in_self, float in_friction); - -JPC_API JPC_MotorSettings * -JPC_SliderConstraint_GetMotorSettings(JPC_SliderConstraint *in_self); - -JPC_API void -JPC_SliderConstraint_SetMotorState(JPC_SliderConstraint *in_self, JPC_MotorState in_state); - -JPC_API JPC_MotorState -JPC_SliderConstraint_GetMotorState(const JPC_SliderConstraint *in_self); - -JPC_API void -JPC_SliderConstraint_SetTargetVelocity(JPC_SliderConstraint *in_self, float in_velocity); - -JPC_API float -JPC_SliderConstraint_GetTargetVelocity(const JPC_SliderConstraint *in_self); - -JPC_API void -JPC_SliderConstraint_SetTargetPosition(JPC_SliderConstraint *in_self, float in_position); - -JPC_API float -JPC_SliderConstraint_GetTargetPosition(const JPC_SliderConstraint *in_self); - -JPC_API void -JPC_SliderConstraint_SetLimits(JPC_SliderConstraint *in_self, float in_limits_min, float in_limits_max); - -JPC_API float -JPC_SliderConstraint_GetLimitsMin(const JPC_SliderConstraint *in_self); - -JPC_API float -JPC_SliderConstraint_GetLimitsMax(const JPC_SliderConstraint *in_self); - -JPC_API bool -JPC_SliderConstraint_HasLimits(const JPC_SliderConstraint *in_self); - -JPC_API void -JPC_SliderConstraint_SetFrequency(JPC_SliderConstraint *in_self, float in_frequency); - -JPC_API float -JPC_SliderConstraint_GetFrequency(const JPC_SliderConstraint *in_self); - -JPC_API void -JPC_SliderConstraint_SetDamping(JPC_SliderConstraint *in_self, float in_damping); - -JPC_API float -JPC_SliderConstraint_GetDamping(const JPC_SliderConstraint *in_self); - -JPC_API void -JPC_SliderConstraint_GetTotalLambdaPosition(const JPC_SliderConstraint *in_self, float *out_x, float *out_y); - -JPC_API float -JPC_SliderConstraint_GetTotalLambdaPositionLimits(const JPC_SliderConstraint *in_self); - -JPC_API void -JPC_SliderConstraint_GetTotalLambdaRotation(const JPC_SliderConstraint *in_self, float out_rotation[3]); - -JPC_API float -JPC_SliderConstraint_GetTotalLambdaMotor(const JPC_SliderConstraint *in_self); -//-------------------------------------------------------------------------------------------------- -// -// JPC_SwingTwistConstraint -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_SwingTwistConstraint_GetLocalSpacePosition1(const JPC_SwingTwistConstraint *in_self, float out_position[3]); - -JPC_API void -JPC_SwingTwistConstraint_GetLocalSpacePosition2(const JPC_SwingTwistConstraint *in_self, float out_position[3]); - -JPC_API void -JPC_SwingTwistConstraint_GetConstraintToBody1(const JPC_SwingTwistConstraint *in_self, float out_rotation[4]); - -JPC_API void -JPC_SwingTwistConstraint_GetConstraintToBody2(const JPC_SwingTwistConstraint *in_self, float out_rotation[4]); - -JPC_API float -JPC_SwingTwistConstraint_GetNormalHalfConeAngle(const JPC_SwingTwistConstraint *in_self); - -JPC_API void -JPC_SwingTwistConstraint_SetNormalHalfConeAngle(JPC_SwingTwistConstraint *in_self, float in_angle); - -JPC_API float -JPC_SwingTwistConstraint_GetPlaneHalfConeAngle(const JPC_SwingTwistConstraint *in_self); - -JPC_API void -JPC_SwingTwistConstraint_SetPlaneHalfConeAngle(JPC_SwingTwistConstraint *in_self, float in_angle); - -JPC_API float -JPC_SwingTwistConstraint_GetTwistMinAngle(const JPC_SwingTwistConstraint *in_self); - -JPC_API void -JPC_SwingTwistConstraint_SetTwistMinAngle(JPC_SwingTwistConstraint *in_self, float in_angle); - -JPC_API float -JPC_SwingTwistConstraint_GetTwistMaxAngle(const JPC_SwingTwistConstraint *in_self); - -JPC_API void -JPC_SwingTwistConstraint_SetTwistMaxAngle(JPC_SwingTwistConstraint *in_self, float in_angle); - -JPC_API JPC_MotorSettings * -JPC_SwingTwistConstraint_GetSwingMotorSettings(JPC_SwingTwistConstraint *in_self); - -JPC_API JPC_MotorSettings * -JPC_SwingTwistConstraint_GetTwistMotorSettings(JPC_SwingTwistConstraint *in_self); - -JPC_API void -JPC_SwingTwistConstraint_SetMaxFrictionTorque(JPC_SwingTwistConstraint *in_self, float in_friction_torque); - -JPC_API float -JPC_SwingTwistConstraint_GetMaxFrictionTorque(const JPC_SwingTwistConstraint *in_self); - -JPC_API void -JPC_SwingTwistConstraint_SetSwingMotorState(JPC_SwingTwistConstraint *in_self, JPC_MotorState in_state); - -JPC_API JPC_MotorState -JPC_SwingTwistConstraint_GetSwingMotorState(const JPC_SwingTwistConstraint *in_self); - -JPC_API void -JPC_SwingTwistConstraint_SetTwistMotorState(JPC_SwingTwistConstraint *in_self, JPC_MotorState in_state); - -JPC_API JPC_MotorState -JPC_SwingTwistConstraint_GetTwistMotorState(const JPC_SwingTwistConstraint *in_self); - -JPC_API void -JPC_SwingTwistConstraint_SetTargetAngularVelocityCS(JPC_SwingTwistConstraint *in_self, const float in_angular_velocity[3]); - -JPC_API void -JPC_SwingTwistConstraint_GetTargetAngularVelocityCS(const JPC_SwingTwistConstraint *in_self, float out_angular_velocity[3]); - -JPC_API void -JPC_SwingTwistConstraint_SetTargetOrientationCS(JPC_SwingTwistConstraint *in_self, const float in_orientation[4]); - -JPC_API void -JPC_SwingTwistConstraint_GetTargetOrientationCS(const JPC_SwingTwistConstraint *in_self, float out_orientation[4]); - -JPC_API void -JPC_SwingTwistConstraint_SetTargetOrientationBS(JPC_SwingTwistConstraint *in_self, const float in_orientation[4]); - -// JPC_API void -// JPC_SwingTwistConstraint_GetRotationInConstraintSpace(const JPC_SwingTwistConstraint *in_self, float out_rotation[4]); - -JPC_API void -JPC_SwingTwistConstraint_GetTotalLambdaPosition(const JPC_SwingTwistConstraint *in_self, float out_position[3]); - -JPC_API float -JPC_SwingTwistConstraint_GetTotalLambdaTwist(const JPC_SwingTwistConstraint *in_self); - -JPC_API float -JPC_SwingTwistConstraint_GetTotalLambdaSwingY(const JPC_SwingTwistConstraint *in_self); - -JPC_API float -JPC_SwingTwistConstraint_GetTotalLambdaSwingZ(const JPC_SwingTwistConstraint *in_self); - -JPC_API void -JPC_SwingTwistConstraint_GetTotalLambdaMotor(const JPC_SwingTwistConstraint *in_self, float out_motor[3]); -//-------------------------------------------------------------------------------------------------- -// -// JPC_SixDOFConstraint -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_SixDOFConstraint_SetTranslationLimits(JPC_SixDOFConstraint *in_self, const float in_limit_min[3], const float in_limit_max[3]); - -JPC_API void -JPC_SixDOFConstraint_SetRotationLimits(JPC_SixDOFConstraint *in_self, const float in_limit_min[3], const float in_limit_max[3]); - -JPC_API float -JPC_SixDOFConstraint_GetLimitsMin(const JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis); - -JPC_API float -JPC_SixDOFConstraint_GetLimitsMax(const JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis); - -JPC_API bool -JPC_SixDOFConstraint_IsFixedAxis(const JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis); - -JPC_API bool -JPC_SixDOFConstraint_IsFreeAxis(const JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis); - -JPC_API void -JPC_SixDOFConstraint_SetMaxFriction(JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis, float in_friction); - -JPC_API float -JPC_SixDOFConstraint_GetMaxFriction(const JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis); - -// JPC_API void -// JPC_SixDOFConstraint_GetRotationInConstraintSpace(const JPC_SixDOFConstraint *in_self, float out_rotation[4]); - -JPC_API JPC_MotorSettings * -JPC_SixDOFConstraint_GetMotorSettings(JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis); - -JPC_API void -JPC_SixDOFConstraint_SetMotorState(JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis, JPC_MotorState in_state); - -JPC_API JPC_MotorState -JPC_SixDOFConstraint_GetMotorState(const JPC_SixDOFConstraint *in_self, JPC_SixDOFConstraintAxis in_axis); - -JPC_API void -JPC_SixDOFConstraint_GetTargetVelocityCS(const JPC_SixDOFConstraint *in_self, float out_velocity[3]); - -JPC_API void -JPC_SixDOFConstraint_SetTargetVelocityCS(JPC_SixDOFConstraint *in_self, const float in_velocity[3]); - -JPC_API void -JPC_SixDOFConstraint_SetTargetAngularVelocityCS(JPC_SixDOFConstraint *in_self, const float in_angular_velocity[3]); - -JPC_API void -JPC_SixDOFConstraint_GetTargetAngularVelocityCS(const JPC_SixDOFConstraint *in_self, float out_angular_velocity[3]); - -JPC_API void -JPC_SixDOFConstraint_GetTargetPositionCS(const JPC_SixDOFConstraint *in_self, float out_position[3]); - -JPC_API void -JPC_SixDOFConstraint_SetTargetPositionCS(JPC_SixDOFConstraint *in_self, const float in_position[3]); - -JPC_API void -JPC_SixDOFConstraint_SetTargetOrientationCS(JPC_SixDOFConstraint *in_self, const float in_orientation[4]); - -JPC_API void -JPC_SixDOFConstraint_GetTargetOrientationCS(const JPC_SixDOFConstraint *in_self, float out_orientation[4]); - -JPC_API void -JPC_SixDOFConstraint_SetTargetOrientationBS(JPC_SixDOFConstraint *in_self, const float in_orientation[4]); - -JPC_API void -JPC_SixDOFConstraint_GetTotalLambdaPosition(const JPC_SixDOFConstraint *in_self, float out_position[3]); - -JPC_API void -JPC_SixDOFConstraint_GetTotalLambdaRotation(const JPC_SixDOFConstraint *in_self, float out_rotation[3]); - -JPC_API void -JPC_SixDOFConstraint_GetTotalLambdaMotorTranslation(const JPC_SixDOFConstraint *in_self, float out_translation[3]); - -JPC_API void -JPC_SixDOFConstraint_GetTotalLambdaMotorRotation(const JPC_SixDOFConstraint *in_self, float out_rotation[3]); -//-------------------------------------------------------------------------------------------------- -// -// JPC_MotorSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_MotorSettings_SetForceLimits(JPC_MotorSettings *in_settings, float in_min, float in_max); - -JPC_API void -JPC_MotorSettings_SetTorqueLimits(JPC_MotorSettings *in_settings, float in_min, float in_max); - -JPC_API void -JPC_MotorSettings_SetForceLimit(JPC_MotorSettings *in_settings, float in_limit); - -JPC_API void -JPC_MotorSettings_SetTorqueLimit(JPC_MotorSettings *in_settings, float in_limit); - -JPC_API bool -JPC_MotorSettings_IsValid(const JPC_MotorSettings *in_settings); -//-------------------------------------------------------------------------------------------------- -// -// JPC_ConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API void -JPC_ConstraintSettings_Release(JPC_ConstraintSettings *in_self); - -JPC_API bool -JPC_ConstraintSettings_GetEnabled(const JPC_ConstraintSettings *in_self); - -JPC_API void -JPC_ConstraintSettings_SetEnabled(JPC_ConstraintSettings *in_self, bool in_enabled); - -JPC_API int -JPC_ConstraintSettings_GetNumVelocityStepsOverride(const JPC_ConstraintSettings *in_self); - -JPC_API void -JPC_ConstraintSettings_SetNumVelocityStepsOverride(JPC_ConstraintSettings *in_self, int in_num_velocity_steps_override); - -JPC_API int -JPC_ConstraintSettings_GetNumPositionStepsOverride(const JPC_ConstraintSettings *in_self); - -JPC_API void -JPC_ConstraintSettings_SetNumPositionStepsOverride(JPC_ConstraintSettings *in_self, int in_num_position_steps_override); -//-------------------------------------------------------------------------------------------------- -// -// JPC_TwoBodyConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_TwoBodyConstraint * -JPC_TwoBodyConstraintSettings_CreateConstraint(const JPC_TwoBodyConstraintSettings *in_self, JPC_Body *in_body1, JPC_Body *in_body2); -//-------------------------------------------------------------------------------------------------- -// -// JPC_FixedConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_FixedConstraintSettings * -JPC_FixedConstraintSettings_Create(); - -JPC_API JPC_ConstraintSpace -JPC_FixedConstraintSettings_GetSpace(const JPC_FixedConstraintSettings *in_self); - -JPC_API void -JPC_FixedConstraintSettings_SetSpace(JPC_FixedConstraintSettings *in_self, JPC_ConstraintSpace in_space); - -JPC_API bool -JPC_FixedConstraintSettings_GetAutoDetectPoint(const JPC_FixedConstraintSettings *in_self); - -JPC_API void -JPC_FixedConstraintSettings_SetAutoDetectPoint(JPC_FixedConstraintSettings *in_self, bool in_auto_detect_point); - -JPC_API void -JPC_FixedConstraintSettings_GetPoint1(const JPC_FixedConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_FixedConstraintSettings_SetPoint1(JPC_FixedConstraintSettings *in_self, const JPC_Real in_point[3]); - -JPC_API void -JPC_FixedConstraintSettings_GetAxisX1(const JPC_FixedConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_FixedConstraintSettings_SetAxisX1(JPC_FixedConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_FixedConstraintSettings_GetAxisY1(const JPC_FixedConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_FixedConstraintSettings_SetAxisY1(JPC_FixedConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_FixedConstraintSettings_GetPoint2(const JPC_FixedConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_FixedConstraintSettings_SetPoint2(JPC_FixedConstraintSettings *in_self, const JPC_Real in_point[3]); - -JPC_API void -JPC_FixedConstraintSettings_GetAxisX2(const JPC_FixedConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_FixedConstraintSettings_SetAxisX2(JPC_FixedConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_FixedConstraintSettings_GetAxisY2(const JPC_FixedConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_FixedConstraintSettings_SetAxisY2(JPC_FixedConstraintSettings *in_self, const float in_axis[3]); -//-------------------------------------------------------------------------------------------------- -// -// JPC_DistanceConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_DistanceConstraintSettings * -JPC_DistanceConstraintSettings_Create(); - -JPC_API JPC_ConstraintSpace -JPC_DistanceConstraintSettings_GetSpace(const JPC_DistanceConstraintSettings *in_self); - -JPC_API void -JPC_DistanceConstraintSettings_SetSpace(JPC_DistanceConstraintSettings *in_self, JPC_ConstraintSpace in_space); - -JPC_API void -JPC_DistanceConstraintSettings_GetPoint1(const JPC_DistanceConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_DistanceConstraintSettings_SetPoint1(JPC_DistanceConstraintSettings *in_self, const JPC_Real in_point[3]); - -JPC_API void -JPC_DistanceConstraintSettings_GetPoint2(const JPC_DistanceConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_DistanceConstraintSettings_SetPoint2(JPC_DistanceConstraintSettings *in_self, const JPC_Real in_point[3]); - -JPC_API float -JPC_DistanceConstraintSettings_GetMinDistance(const JPC_DistanceConstraintSettings *in_self); - -JPC_API void -JPC_DistanceConstraintSettings_SetMinDistance(JPC_DistanceConstraintSettings *in_self, float in_distance); - -JPC_API float -JPC_DistanceConstraintSettings_GetMaxDistance(const JPC_DistanceConstraintSettings *in_self); - -JPC_API void -JPC_DistanceConstraintSettings_SetMaxDistance(JPC_DistanceConstraintSettings *in_self, float in_distance); - -JPC_API float -JPC_DistanceConstraintSettings_GetFrequency(const JPC_DistanceConstraintSettings *in_self); - -JPC_API void -JPC_DistanceConstraintSettings_SetFrequency(JPC_DistanceConstraintSettings *in_self, float in_frequency); - -JPC_API float -JPC_DistanceConstraintSettings_GetDamping(const JPC_DistanceConstraintSettings *in_self); - -JPC_API void -JPC_DistanceConstraintSettings_SetDamping(JPC_DistanceConstraintSettings *in_self, float in_damping); -//-------------------------------------------------------------------------------------------------- -// -// JPC_PointConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_PointConstraintSettings * -JPC_PointConstraintSettings_Create(); - -JPC_API JPC_ConstraintSpace -JPC_PointConstraintSettings_GetSpace(const JPC_PointConstraintSettings *in_self); - -JPC_API void -JPC_PointConstraintSettings_SetSpace(JPC_PointConstraintSettings *in_self, JPC_ConstraintSpace in_space); - -JPC_API void -JPC_PointConstraintSettings_GetPoint1(const JPC_PointConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_PointConstraintSettings_SetPoint1(JPC_PointConstraintSettings *in_self, const JPC_Real in_point[3]); - -JPC_API void -JPC_PointConstraintSettings_GetPoint2(const JPC_PointConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_PointConstraintSettings_SetPoint2(JPC_PointConstraintSettings *in_self, const JPC_Real in_point[3]); -//-------------------------------------------------------------------------------------------------- -// -// JPC_HingeConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_HingeConstraintSettings * -JPC_HingeConstraintSettings_Create(); - -JPC_API JPC_ConstraintSpace -JPC_HingeConstraintSettings_GetSpace(const JPC_HingeConstraintSettings *in_self); - -JPC_API void -JPC_HingeConstraintSettings_SetSpace(JPC_HingeConstraintSettings *in_self, JPC_ConstraintSpace in_space); - -JPC_API void -JPC_HingeConstraintSettings_GetPoint1(const JPC_HingeConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_HingeConstraintSettings_SetPoint1(JPC_HingeConstraintSettings *in_self, const JPC_Real in_point[3]); - -JPC_API void -JPC_HingeConstraintSettings_GetHingeAxis1(const JPC_HingeConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_HingeConstraintSettings_SetHingeAxis1(JPC_HingeConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_HingeConstraintSettings_GetNormalAxis1(const JPC_HingeConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_HingeConstraintSettings_SetNormalAxis1(JPC_HingeConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_HingeConstraintSettings_GetPoint2(const JPC_HingeConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_HingeConstraintSettings_SetPoint2(JPC_HingeConstraintSettings *in_self, const JPC_Real in_point[3]); - -JPC_API void -JPC_HingeConstraintSettings_GetHingeAxis2(const JPC_HingeConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_HingeConstraintSettings_SetHingeAxis2(JPC_HingeConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_HingeConstraintSettings_GetNormalAxis2(const JPC_HingeConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_HingeConstraintSettings_SetNormalAxis2(JPC_HingeConstraintSettings *in_self, const float in_axis[3]); - -JPC_API float -JPC_HingeConstraintSettings_GetLimitsMin(const JPC_HingeConstraintSettings *in_self); - -JPC_API void -JPC_HingeConstraintSettings_SetLimitsMin(JPC_HingeConstraintSettings *in_self, float in_limits); - -JPC_API float -JPC_HingeConstraintSettings_GetLimitsMax(const JPC_HingeConstraintSettings *in_self); - -JPC_API void -JPC_HingeConstraintSettings_SetLimitsMax(JPC_HingeConstraintSettings *in_self, float in_limits); - -JPC_API float -JPC_HingeConstraintSettings_GetMaxFrictionTorque(const JPC_HingeConstraintSettings *in_self); - -JPC_API void -JPC_HingeConstraintSettings_SetMaxFrictionTorque(JPC_HingeConstraintSettings *in_self, float in_max_friction_torque); - -JPC_API JPC_MotorSettings * -JPC_HingeConstraintSettings_GetMotorSettings(JPC_HingeConstraintSettings *in_self); -//-------------------------------------------------------------------------------------------------- -// -// JPC_ConeConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_ConeConstraintSettings * -JPC_ConeConstraintSettings_Create(); - -JPC_API JPC_ConstraintSpace -JPC_ConeConstraintSettings_GetSpace(const JPC_ConeConstraintSettings *in_self); - -JPC_API void -JPC_ConeConstraintSettings_SetSpace(JPC_ConeConstraintSettings *in_self, JPC_ConstraintSpace in_space); - -JPC_API void -JPC_ConeConstraintSettings_GetPoint1(const JPC_ConeConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_ConeConstraintSettings_SetPoint1(JPC_ConeConstraintSettings *in_self, const JPC_Real in_point[3]); - -JPC_API void -JPC_ConeConstraintSettings_GetTwistAxis1(const JPC_ConeConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_ConeConstraintSettings_SetTwistAxis1(JPC_ConeConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_ConeConstraintSettings_GetPoint2(const JPC_ConeConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_ConeConstraintSettings_SetPoint2(JPC_ConeConstraintSettings *in_self, const JPC_Real in_point[3]); - -JPC_API void -JPC_ConeConstraintSettings_GetTwistAxis2(const JPC_ConeConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_ConeConstraintSettings_SetTwistAxis2(JPC_ConeConstraintSettings *in_self, const float in_axis[3]); - -JPC_API float -JPC_ConeConstraintSettings_GetHalfConeAngle(const JPC_ConeConstraintSettings *in_self); - -JPC_API void -JPC_ConeConstraintSettings_SetHalfConeAngle(JPC_ConeConstraintSettings *in_self, float in_half_cone_angle); -//-------------------------------------------------------------------------------------------------- -// -// JPC_SliderConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_SliderConstraintSettings * -JPC_SliderConstraintSettings_Create(); - -JPC_API void -JPC_SliderConstraintSettings_SetSliderAxis(JPC_SliderConstraintSettings *in_self, const float in_axis[3]); - -JPC_API JPC_ConstraintSpace -JPC_SliderConstraintSettings_GetSpace(const JPC_SliderConstraintSettings *in_self); - -JPC_API void -JPC_SliderConstraintSettings_SetSpace(JPC_SliderConstraintSettings *in_self, JPC_ConstraintSpace in_space); - -JPC_API bool -JPC_SliderConstraintSettings_GetAutoDetectPoint(const JPC_SliderConstraintSettings *in_self); - -JPC_API void -JPC_SliderConstraintSettings_SetAutoDetectPoint(JPC_SliderConstraintSettings *in_self, bool in_auto_detect_point); - -JPC_API void -JPC_SliderConstraintSettings_GetPoint1(const JPC_SliderConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_SliderConstraintSettings_SetPoint1(JPC_SliderConstraintSettings *in_self, const JPC_Real in_point[3]); - -JPC_API void -JPC_SliderConstraintSettings_GetSliderAxis1(const JPC_SliderConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_SliderConstraintSettings_SetSliderAxis1(JPC_SliderConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_SliderConstraintSettings_GetNormalAxis1(const JPC_SliderConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_SliderConstraintSettings_SetNormalAxis1(JPC_SliderConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_SliderConstraintSettings_GetPoint2(const JPC_SliderConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_SliderConstraintSettings_SetPoint2(JPC_SliderConstraintSettings *in_self, const JPC_Real in_point[3]); - -JPC_API void -JPC_SliderConstraintSettings_GetSliderAxis2(const JPC_SliderConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_SliderConstraintSettings_SetSliderAxis2(JPC_SliderConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_SliderConstraintSettings_GetNormalAxis2(const JPC_SliderConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_SliderConstraintSettings_SetNormalAxis2(JPC_SliderConstraintSettings *in_self, const float in_axis[3]); - -JPC_API float -JPC_SliderConstraintSettings_GetLimitsMin(const JPC_SliderConstraintSettings *in_self); - -JPC_API void -JPC_SliderConstraintSettings_SetLimitsMin(JPC_SliderConstraintSettings *in_self, float in_limits); - -JPC_API float -JPC_SliderConstraintSettings_GetLimitsMax(const JPC_SliderConstraintSettings *in_self); - -JPC_API void -JPC_SliderConstraintSettings_SetLimitsMax(JPC_SliderConstraintSettings *in_self, float in_limits); - -JPC_API float -JPC_SliderConstraintSettings_GetFrequency(const JPC_SliderConstraintSettings *in_self); - -JPC_API void -JPC_SliderConstraintSettings_SetFrequency(JPC_SliderConstraintSettings *in_self, float in_frequency); - -JPC_API float -JPC_SliderConstraintSettings_GetDamping(const JPC_SliderConstraintSettings *in_self); - -JPC_API void -JPC_SliderConstraintSettings_SetDamping(JPC_SliderConstraintSettings *in_self, float in_damping); - -JPC_API float -JPC_SliderConstraintSettings_GetMaxFrictionForce(const JPC_SliderConstraintSettings *in_self); - -JPC_API void -JPC_SliderConstraintSettings_SetMaxFrictionForce(JPC_SliderConstraintSettings *in_self, float in_max_friction_force); - -JPC_API JPC_MotorSettings * -JPC_SliderConstraintSettings_GetMotorSettings(JPC_SliderConstraintSettings *in_self); -//-------------------------------------------------------------------------------------------------- -// -// JPC_SwingTwistConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_SwingTwistConstraintSettings * -JPC_SwingTwistConstraintSettings_Create(); - -JPC_API JPC_ConstraintSpace -JPC_SwingTwistConstraintSettings_GetSpace(const JPC_SwingTwistConstraintSettings *in_self); - -JPC_API void -JPC_SwingTwistConstraintSettings_SetSpace(JPC_SwingTwistConstraintSettings *in_self, JPC_ConstraintSpace in_space); - -JPC_API void -JPC_SwingTwistConstraintSettings_GetPosition1(const JPC_SwingTwistConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_SwingTwistConstraintSettings_SetPosition1(JPC_SwingTwistConstraintSettings *in_self, const JPC_Real in_point[3]); +JPC_API void +JPC_CharacterVirtual_GetLinearVelocity(const JPC_CharacterVirtual *in_character, float out_linear_velocity[3]); JPC_API void -JPC_SwingTwistConstraintSettings_GetTwistAxis1(const JPC_SwingTwistConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_SwingTwistConstraintSettings_SetTwistAxis1(JPC_SwingTwistConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_SwingTwistConstraintSettings_GetPlaneAxis1(const JPC_SwingTwistConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_SwingTwistConstraintSettings_SetPlaneAxis1(JPC_SwingTwistConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_SwingTwistConstraintSettings_GetPosition2(const JPC_SwingTwistConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_SwingTwistConstraintSettings_SetPosition2(JPC_SwingTwistConstraintSettings *in_self, const JPC_Real in_point[3]); - -JPC_API void -JPC_SwingTwistConstraintSettings_GetTwistAxis2(const JPC_SwingTwistConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_SwingTwistConstraintSettings_SetTwistAxis2(JPC_SwingTwistConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_SwingTwistConstraintSettings_GetPlaneAxis2(const JPC_SwingTwistConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_SwingTwistConstraintSettings_SetPlaneAxis2(JPC_SwingTwistConstraintSettings *in_self, const float in_axis[3]); - -JPC_API float -JPC_SwingTwistConstraintSettings_GetNormalHalfConeAngle(const JPC_SwingTwistConstraintSettings *in_self); - -JPC_API void -JPC_SwingTwistConstraintSettings_SetNormalHalfConeAngle(JPC_SwingTwistConstraintSettings *in_self, float in_angle); - -JPC_API float -JPC_SwingTwistConstraintSettings_GetPlaneHalfConeAngle(const JPC_SwingTwistConstraintSettings *in_self); - -JPC_API void -JPC_SwingTwistConstraintSettings_SetPlaneHalfConeAngle(JPC_SwingTwistConstraintSettings *in_self, float in_angle); - -JPC_API float -JPC_SwingTwistConstraintSettings_GetTwistMinAngle(const JPC_SwingTwistConstraintSettings *in_self); - -JPC_API void -JPC_SwingTwistConstraintSettings_SetTwistMinAngle(JPC_SwingTwistConstraintSettings *in_self, float in_angle); - -JPC_API float -JPC_SwingTwistConstraintSettings_GetTwistMaxAngle(const JPC_SwingTwistConstraintSettings *in_self); - -JPC_API void -JPC_SwingTwistConstraintSettings_SetTwistMaxAngle(JPC_SwingTwistConstraintSettings *in_self, float in_angle); - -JPC_API float -JPC_SwingTwistConstraintSettings_GetMaxFrictionTorque(const JPC_SwingTwistConstraintSettings *in_self); - -JPC_API void -JPC_SwingTwistConstraintSettings_SetMaxFrictionTorque(JPC_SwingTwistConstraintSettings *in_self, float in_max_friction_torque); - -JPC_API JPC_MotorSettings * -JPC_SwingTwistConstraintSettings_GetSwingMotorSettings(JPC_SwingTwistConstraintSettings *in_self); - -JPC_API JPC_MotorSettings * -JPC_SwingTwistConstraintSettings_GetTwistMotorSettings(JPC_SwingTwistConstraintSettings *in_self); -//-------------------------------------------------------------------------------------------------- -// -// JPC_SixDOFConstraintSettings -// -//-------------------------------------------------------------------------------------------------- -JPC_API JPC_SixDOFConstraintSettings * -JPC_SixDOFConstraintSettings_Create(); - -JPC_API JPC_ConstraintSpace -JPC_SixDOFConstraintSettings_GetSpace(const JPC_SixDOFConstraintSettings *in_self); - -JPC_API void -JPC_SixDOFConstraintSettings_SetSpace(JPC_SixDOFConstraintSettings *in_self, JPC_ConstraintSpace in_space); - -JPC_API void -JPC_SixDOFConstraintSettings_GetPosition1(const JPC_SixDOFConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_SixDOFConstraintSettings_SetPosition1(JPC_SixDOFConstraintSettings *in_self, const JPC_Real in_point[3]); - -JPC_API void -JPC_SixDOFConstraintSettings_GetAxisX1(const JPC_SixDOFConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_SixDOFConstraintSettings_SetAxisX1(JPC_SixDOFConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_SixDOFConstraintSettings_GetAxisY1(const JPC_SixDOFConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_SixDOFConstraintSettings_SetAxisY1(JPC_SixDOFConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_SixDOFConstraintSettings_GetPosition2(const JPC_SixDOFConstraintSettings *in_self, JPC_Real out_point[3]); - -JPC_API void -JPC_SixDOFConstraintSettings_SetPosition2(JPC_SixDOFConstraintSettings *in_self, const JPC_Real in_point[3]); - -JPC_API void -JPC_SixDOFConstraintSettings_GetAxisX2(const JPC_SixDOFConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_SixDOFConstraintSettings_SetAxisX2(JPC_SixDOFConstraintSettings *in_self, const float in_axis[3]); - -JPC_API void -JPC_SixDOFConstraintSettings_GetAxisY2(const JPC_SixDOFConstraintSettings *in_self, float out_axis[3]); - -JPC_API void -JPC_SixDOFConstraintSettings_SetAxisY2(JPC_SixDOFConstraintSettings *in_self, const float in_axis[3]); - -JPC_API float * -JPC_SixDOFConstraintSettings_GetMaxFriction(JPC_SixDOFConstraintSettings *in_self); - -JPC_API float * -JPC_SixDOFConstraintSettings_GetLimitMin(JPC_SixDOFConstraintSettings *in_self); - -JPC_API float * -JPC_SixDOFConstraintSettings_GetLimitMax(JPC_SixDOFConstraintSettings *in_self); - -JPC_API void -JPC_SixDOFConstraintSettings_MakeFreeAxis(JPC_SixDOFConstraintSettings *in_self, JPC_SixDOFConstraintAxis in_axis); - -JPC_API bool -JPC_SixDOFConstraintSettings_IsFreeAxis(const JPC_SixDOFConstraintSettings *in_self, JPC_SixDOFConstraintAxis in_axis); - -JPC_API void -JPC_SixDOFConstraintSettings_MakeFixedAxis(JPC_SixDOFConstraintSettings *in_self, JPC_SixDOFConstraintAxis in_axis); - -JPC_API bool -JPC_SixDOFConstraintSettings_IsFixedAxis(const JPC_SixDOFConstraintSettings *in_self, JPC_SixDOFConstraintAxis in_axis); - -JPC_API void -JPC_SixDOFConstraintSettings_SetLimitedAxis(JPC_SixDOFConstraintSettings *in_self, JPC_SixDOFConstraintAxis in_axis, float in_min, float in_max); - -JPC_API JPC_MotorSettings ** -JPC_SixDOFConstraintSettings_GetMotorSettings(JPC_SixDOFConstraintSettings *in_self); -//-------------------------------------------------------------------------------------------------- -// -// JPC_GJKClosestPoint -// +JPC_CharacterVirtual_SetLinearVelocity(JPC_CharacterVirtual *in_character, const float in_linear_velocity[3]); //-------------------------------------------------------------------------------------------------- -#define GJK(Name1, Name2, JpcA, JpcB, JphA, JphB) \ -JPC_API bool \ -Name1(JPC_GJKClosestPoint *in_gjk, \ - const JpcA *in_a, \ - const JpcB *in_b, \ - float in_tolerance, \ - float io_v[3]); \ - \ -JPC_API float \ -Name2(JPC_GJKClosestPoint *in_gjk, \ - const JpcA *in_a, \ - const JpcB *in_b, \ - float in_tolerance, \ - float in_max_dist_sq, \ - float io_v[3], \ - float out_point_a[3], \ - float out_point_b[3]); - -GJK(JPC_GJKClosestPoint_IntersectsConvexConvex, JPC_GJKClosestPoint_GetClosestPointsConvexConvex, JPC_ConvexShapeSupport, JPC_ConvexShape, JPH::ConvexShape::Support, JPH::ConvexShape::Support) -GJK(JPC_GJKClosestPoint_IntersectsConvexPoint, JPC_GJKClosestPoint_GetClosestPointsConvexPoint, JPC_ConvexShapeSupport, JPC_PointConvexSupport, JPH::ConvexShape::Support, JPH::PointConvexSupport) - -#undef GJK -//-------------------------------------------------------------------------------------------------- -// JoltJava: Java support -JPC_API uint32_t -JPJ_GetFeatures(); - -struct JPJ_BroadPhaseLayerInterface { - const JPC_BroadPhaseLayerInterfaceVTable *vtable; -}; - -struct JPJ_ObjectVsBroadPhaseLayerFilter { - const JPC_ObjectVsBroadPhaseLayerFilterVTable *vtable; -}; - -struct JPJ_BroadPhaseLayerFilter { - const JPC_BroadPhaseLayerFilterVTable *vtable; -}; - -struct JPJ_ObjectLayerPairFilter { - const JPC_ObjectLayerPairFilterVTable *vtable; -}; - -struct JPJ_ObjectLayerFilter { - const JPC_ObjectLayerFilterVTable *vtable; -}; - -struct JPJ_BodyActivationListener { - const JPC_BodyActivationListenerVTable *vtable; -}; - -struct JPJ_BodyFilter { - const JPC_BodyFilterVTable *vtable; -}; - -struct JPJ_ShapeFilter { - const JPC_ShapeFilterVTable *vtable; - JPC_BodyID body_id; -}; - -struct JPJ_ContactListener { - const JPC_ContactListenerVTable *vtable; -}; - -struct JPJ_PhysicsStepListener { - const JPC_PhysicsStepListenerVTable *vtable; -}; - -struct JPJ_RayCastBodyCollector { - const JPC_RayCastBodyCollectorVTable *vtable; - JPC_CollisionCollector collector; -}; - -struct JPJ_CollideShapeBodyCollector { - const JPC_CollideShapeBodyCollectorVTable *vtable; - JPC_CollisionCollector collector; -}; - -struct JPJ_CastShapeBodyCollector { - const JPC_CastShapeBodyCollectorVTable *vtable; - JPC_CollisionCollector collector; -}; - -struct JPJ_CastRayCollector { - const JPC_CastRayCollectorVTable *vtable; - JPC_CollisionCollector collector; -}; - -struct JPJ_CastShapeCollector { - const JPC_CastShapeCollectorVTable *vtable; - JPC_CollisionCollector collector; -}; - -struct JPJ_CollidePointCollector { - const JPC_CollidePointCollectorVTable *vtable; - JPC_CollisionCollector collector; -}; - -struct JPJ_CollideShapeCollector { - const JPC_CollideShapeCollectorVTable *vtable; - JPC_CollisionCollector collector; -}; - -struct JPJ_TransformedShapeCollector { - const JPC_TransformedShapeCollectorVTable *vtable; - JPC_CollisionCollector collector; -}; -// END JoltJava #ifdef __cplusplus } #endif diff --git a/JoltPhysicsC/JoltC/JoltPhysicsC_Extensions.cpp b/JoltPhysicsC/JoltC/JoltPhysicsC_Extensions.cpp index 121f06a9..c30a392d 100644 --- a/JoltPhysicsC/JoltC/JoltPhysicsC_Extensions.cpp +++ b/JoltPhysicsC/JoltC/JoltPhysicsC_Extensions.cpp @@ -2,12 +2,14 @@ #include "JoltPhysicsC.h" #include +#ifdef _MSC_VER +#define _ALLOW_KEYWORD_MACROS +#endif // We do this because we add some low-level functions which need access to private fields. // Also, we static assert offsets of some private fields (see bottom of this file). -//#define private public // JoltJava: changing access of stdlib stuff +#define private public #include -#define private public // JoltJava: redefine access here instead #include #include #include @@ -29,6 +31,10 @@ #include #include +#if defined(_MSC_VER) && defined(_DEBUG) +#include +#endif + JPH_SUPPRESS_WARNINGS //-------------------------------------------------------------------------------------------------- JPC_API JPC_Body ** @@ -141,7 +147,6 @@ ENSURE_SIZE_ALIGN(JPH::Body, JPC_Body) ENSURE_SIZE_ALIGN(JPH::BodyLockRead, JPC_BodyLockRead) ENSURE_SIZE_ALIGN(JPH::BodyLockWrite, JPC_BodyLockWrite) -ENSURE_SIZE_ALIGN(JPH::RayCast, JPC_RayCast) ENSURE_SIZE_ALIGN(JPH::RRayCast, JPC_RRayCast) ENSURE_SIZE_ALIGN(JPH::RayCastResult, JPC_RayCastResult) ENSURE_SIZE_ALIGN(JPH::RayCastSettings, JPC_RayCastSettings) @@ -180,6 +185,14 @@ ENSURE_ENUM_EQ(JPC_SHAPE_SUB_TYPE_USER5, JPH::EShapeSubType::Use ENSURE_ENUM_EQ(JPC_SHAPE_SUB_TYPE_USER6, JPH::EShapeSubType::User6); ENSURE_ENUM_EQ(JPC_SHAPE_SUB_TYPE_USER7, JPH::EShapeSubType::User7); ENSURE_ENUM_EQ(JPC_SHAPE_SUB_TYPE_USER8, JPH::EShapeSubType::User8); +ENSURE_ENUM_EQ(JPC_SHAPE_SUB_TYPE_USER_CONVEX1, JPH::EShapeSubType::UserConvex1); +ENSURE_ENUM_EQ(JPC_SHAPE_SUB_TYPE_USER_CONVEX2, JPH::EShapeSubType::UserConvex2); +ENSURE_ENUM_EQ(JPC_SHAPE_SUB_TYPE_USER_CONVEX3, JPH::EShapeSubType::UserConvex3); +ENSURE_ENUM_EQ(JPC_SHAPE_SUB_TYPE_USER_CONVEX4, JPH::EShapeSubType::UserConvex4); +ENSURE_ENUM_EQ(JPC_SHAPE_SUB_TYPE_USER_CONVEX5, JPH::EShapeSubType::UserConvex5); +ENSURE_ENUM_EQ(JPC_SHAPE_SUB_TYPE_USER_CONVEX6, JPH::EShapeSubType::UserConvex6); +ENSURE_ENUM_EQ(JPC_SHAPE_SUB_TYPE_USER_CONVEX7, JPH::EShapeSubType::UserConvex7); +ENSURE_ENUM_EQ(JPC_SHAPE_SUB_TYPE_USER_CONVEX8, JPH::EShapeSubType::UserConvex8); ENSURE_ENUM_EQ(JPC_MOTION_TYPE_STATIC, JPH::EMotionType::Static); ENSURE_ENUM_EQ(JPC_MOTION_TYPE_KINEMATIC, JPH::EMotionType::Kinematic); @@ -247,7 +260,7 @@ static_assert(offsetof(JPH::MotionProperties, mForce) == offsetof(JPC_MotionProp static_assert(offsetof(JPH::MotionProperties, mTorque) == offsetof(JPC_MotionProperties, torque)); static_assert(offsetof(JPH::MotionProperties, mMotionQuality) == offsetof(JPC_MotionProperties, motion_quality)); static_assert(offsetof(JPH::MotionProperties, mGravityFactor) == offsetof(JPC_MotionProperties, gravity_factor)); -#ifdef JPH_ENABLE_ASSERTS +#if JPC_ENABLE_ASSERTS == 1 static_assert( offsetof(JPH::MotionProperties, mCachedMotionType) == offsetof(JPC_MotionProperties, cached_motion_type)); #endif @@ -270,6 +283,10 @@ static_assert(offsetof(JPH::BodyLockRead, mBodyLockInterface) == offsetof(JPC_Bo static_assert(offsetof(JPH::BodyLockRead, mBodyLockMutex) == offsetof(JPC_BodyLockRead, mutex)); static_assert(offsetof(JPH::BodyLockRead, mBody) == offsetof(JPC_BodyLockRead, body)); +static_assert(offsetof(JPH::RayCastResult, mBodyID) == offsetof(JPC_RayCastResult, body_id)); +static_assert(offsetof(JPH::RayCastResult, mFraction) == offsetof(JPC_RayCastResult, fraction)); +static_assert(offsetof(JPH::RayCastResult, mSubShapeID2) == offsetof(JPC_RayCastResult, sub_shape_id)); + static_assert(offsetof(JPH::RayCastSettings, mBackFaceMode) == offsetof(JPC_RayCastSettings, back_face_mode)); static_assert(offsetof(JPH::RayCastSettings, mTreatConvexAsSolid) == offsetof(JPC_RayCastSettings, treat_convex_as_solid)); diff --git a/JoltPhysicsC/JoltC/JoltPhysicsC_Tests.c b/JoltPhysicsC/JoltC/JoltPhysicsC_Tests.c new file mode 100644 index 00000000..5b8a8cbd --- /dev/null +++ b/JoltPhysicsC/JoltC/JoltPhysicsC_Tests.c @@ -0,0 +1,856 @@ +#include "JoltPhysicsC.h" + +#include +#include +#include + +//#define PRINT_OUTPUT + +// Object layers +#define NUM_OBJ_LAYERS 2 +#define OBJ_LAYER_NON_MOVING 0 +#define OBJ_LAYER_MOVING 1 + +// Broad phase layers +#define NUM_BP_LAYERS 2 +#define BP_LAYER_NON_MOVING 0 +#define BP_LAYER_MOVING 1 +//-------------------------------------------------------------------------------------------------- +// BPLayerInterface +//-------------------------------------------------------------------------------------------------- +typedef struct BPLayerInterfaceImpl +{ + const JPC_BroadPhaseLayerInterfaceVTable *vtable; // VTable has to be the first field in the struct. + JPC_BroadPhaseLayer object_to_broad_phase[NUM_OBJ_LAYERS]; +} BPLayerInterfaceImpl; + +static uint32_t +BPLayerInterface_GetNumBroadPhaseLayers(const void *in_self) +{ +#ifdef PRINT_OUTPUT + fprintf(stderr, "BPLayerInterface_GetNumBroadPhaseLayers()\n"); +#endif + return NUM_BP_LAYERS; +} + +#ifdef _MSC_VER +static const JPC_BroadPhaseLayer * +BPLayerInterface_GetBroadPhaseLayer(const void *in_self, JPC_BroadPhaseLayer *out_layer, JPC_ObjectLayer in_layer) +#else +static JPC_BroadPhaseLayer +BPLayerInterface_GetBroadPhaseLayer(const void *in_self, JPC_ObjectLayer in_layer) +#endif +{ +#ifdef PRINT_OUTPUT + fprintf(stderr, "BPLayerInterface_GetBroadPhaseLayer()\n"); +#endif + assert(in_layer < NUM_BP_LAYERS); + const BPLayerInterfaceImpl *self = (BPLayerInterfaceImpl *)in_self; +#ifdef _MSC_VER + *out_layer = self->object_to_broad_phase[in_layer]; + return out_layer; +#else + return self->object_to_broad_phase[in_layer]; +#endif +} + +static BPLayerInterfaceImpl +BPLayerInterface_Init(void) +{ + static const JPC_BroadPhaseLayerInterfaceVTable vtable = + { + .GetNumBroadPhaseLayers = BPLayerInterface_GetNumBroadPhaseLayers, + .GetBroadPhaseLayer = BPLayerInterface_GetBroadPhaseLayer, + }; + BPLayerInterfaceImpl impl = + { + .vtable = &vtable, + }; + impl.object_to_broad_phase[OBJ_LAYER_NON_MOVING] = BP_LAYER_NON_MOVING; + impl.object_to_broad_phase[OBJ_LAYER_MOVING] = BP_LAYER_MOVING; + + return impl; +} +//-------------------------------------------------------------------------------------------------- +// MyContactListener +//-------------------------------------------------------------------------------------------------- +typedef struct MyContactListener +{ + const JPC_ContactListenerVTable *vtable; // VTable has to be the first field in the struct. +} MyContactListener; + +static JPC_ValidateResult +MyContactListener_OnContactValidate(void *in_self, + const JPC_Body *in_body1, + const JPC_Body *in_body2, + const JPC_Real in_base_offset[3], + const JPC_CollideShapeResult *in_collision_result) +{ + const JPC_BodyID body1_id = JPC_Body_GetID(in_body1); + const JPC_BodyID body2_id = JPC_Body_GetID(in_body2); +#ifdef PRINT_OUTPUT + fprintf(stderr, "\tOnContactValidate(): First BodyID is (%d, %d), second BodyID is (%d, %d)\n", + JPC_BodyID_GetSequenceNumber(body1_id), JPC_BodyID_GetIndex(body1_id), + JPC_BodyID_GetSequenceNumber(body2_id), JPC_BodyID_GetIndex(body2_id)); + fprintf(stderr, + "\tOnContactValidate(): in_base_offset (%f, %f, %f)\n", + in_base_offset[0], in_base_offset[1], in_base_offset[2]); + fprintf(stderr, "\tOnContactValidate(): penetration_depth (%f)\n", in_collision_result->penetration_depth); + fprintf(stderr, "\tOnContactValidate(): shape1_sub_shape_id (%d)\n", in_collision_result->shape1_sub_shape_id); + fprintf(stderr, "\tOnContactValidate(): shape2_sub_shape_id (%d)\n", in_collision_result->shape2_sub_shape_id); + fprintf(stderr, "\tOnContactValidate(): body2_id (%d)\n", in_collision_result->body2_id); +#endif + return JPC_VALIDATE_RESULT_ACCEPT_ALL_CONTACTS; +} + +static void +MyContactListener_OnContactAdded(void *in_self, + const JPC_Body *in_body1, + const JPC_Body *in_body2, + const JPC_ContactManifold *in_manifold, + JPC_ContactSettings *io_settings) +{ + const JPC_BodyID body1_id = JPC_Body_GetID(in_body1); + const JPC_BodyID body2_id = JPC_Body_GetID(in_body2); +#ifdef PRINT_OUTPUT + fprintf(stderr, "\tOnContactAdded(): First BodyID is (%d, %d), second BodyID is (%d, %d)\n", + JPC_BodyID_GetSequenceNumber(body1_id), JPC_BodyID_GetIndex(body1_id), + JPC_BodyID_GetSequenceNumber(body2_id), JPC_BodyID_GetIndex(body2_id)); +#endif +} + +static void +MyContactListener_OnContactPersisted(void *in_self, + const JPC_Body *in_body1, + const JPC_Body *in_body2, + const JPC_ContactManifold *in_manifold, + JPC_ContactSettings *io_settings) +{ + const JPC_BodyID body1_id = JPC_Body_GetID(in_body1); + const JPC_BodyID body2_id = JPC_Body_GetID(in_body2); +#ifdef PRINT_OUTPUT + fprintf(stderr, "\tOnContactPersisted(): First BodyID is (%d, %d), second BodyID is (%d, %d)\n", + JPC_BodyID_GetSequenceNumber(body1_id), JPC_BodyID_GetIndex(body1_id), + JPC_BodyID_GetSequenceNumber(body2_id), JPC_BodyID_GetIndex(body2_id)); +#endif +} + +static void +MyContactListener_OnContactRemoved(void *in_self, const JPC_SubShapeIDPair *in_sub_shape_pair) +{ + const JPC_BodyID body1_id = in_sub_shape_pair->first.body_id; + const JPC_BodyID body2_id = in_sub_shape_pair->second.body_id; +#ifdef PRINT_OUTPUT + fprintf(stderr, "\tOnContactRemoved(): First BodyID is (%d, %d), second BodyID is (%d, %d)\n", + JPC_BodyID_GetSequenceNumber(body1_id), JPC_BodyID_GetIndex(body1_id), + JPC_BodyID_GetSequenceNumber(body2_id), JPC_BodyID_GetIndex(body2_id)); +#endif +} + +static MyContactListener +MyContactListener_Init(void) +{ + static const JPC_ContactListenerVTable vtable = + { + .OnContactValidate = MyContactListener_OnContactValidate, + .OnContactAdded = MyContactListener_OnContactAdded, + .OnContactPersisted = MyContactListener_OnContactPersisted, + .OnContactRemoved = MyContactListener_OnContactRemoved, + }; + MyContactListener impl = + { + .vtable = &vtable, + }; + return impl; +} +//-------------------------------------------------------------------------------------------------- +// MyDebugRenderer +//-------------------------------------------------------------------------------------------------- +#if JPC_DEBUG_RENDERER == 1 + +typedef struct MyRenderPrimitive +{ + // Actual render data goes here + int foobar; +} MyRenderPrimitive; + +typedef struct MyDebugRenderer +{ + const JPC_DebugRendererVTable *vtable; // VTable has to be the first field in the struct. + struct MyRenderPrimitive prims[32]; + int prim_head; +} MyDebugRenderer; + +static void +MyDebugRenderer_DrawLine(void *in_self, JPC_Real in_from[3], JPC_Real in_to[3], JPC_Color in_color) +{ +#ifdef PRINT_OUTPUT + fprintf(stderr, "\tDebugRenderer: DrawLine called.\n"); +#endif +} + +static void +MyDebugRenderer_DrawTriangle(void *in_self, JPC_Real in_v1[3], JPC_Real in_v2[3], JPC_Real in_v3[3], JPC_Color in_color) +{ +#ifdef PRINT_OUTPUT + fprintf(stderr, "\tDebugRenderer: DrawTriangle called.\n"); +#endif +} + +static JPC_DebugRenderer_TriangleBatch * +MyDebugRenderer_CreateTriangleBatch(void *in_self, + const JPC_DebugRenderer_Triangle *in_triangles, + uint32_t in_triangle_count) +{ + struct MyDebugRenderer *self = (struct MyDebugRenderer*) in_self; + struct MyRenderPrimitive *prim = &self->prims[self->prim_head++]; + JPC_DebugRenderer_TriangleBatch *batch = JPC_DebugRenderer_TriangleBatch_Create( + (JPC_DebugRenderer_Primitive *)prim + ); +#ifdef PRINT_OUTPUT + fprintf(stderr, "\tDebugRenderer: CreateTriangleBatch called. Created primitive %x\n", prim); +#endif + return batch; +} + +static JPC_DebugRenderer_TriangleBatch * +MyDebugRenderer_CreateTriangleBatchIndexed(void *in_self, + const JPC_DebugRenderer_Vertex *in_vertices, + uint32_t in_vertex_count, + const uint32_t *in_indices, + uint32_t in_index_count) +{ + struct MyDebugRenderer *self = (struct MyDebugRenderer*) in_self; + struct MyRenderPrimitive *prim = &self->prims[self->prim_head++]; + JPC_DebugRenderer_TriangleBatch *batch = JPC_DebugRenderer_TriangleBatch_Create( + (JPC_DebugRenderer_Primitive *)prim + ); +#ifdef PRINT_OUTPUT + fprintf(stderr, "\tDebugRenderer: CreateTriangleBatchIndexed called. Created primitive %x\n", prim); +#endif + return batch; +} + +static void +MyDebugRenderer_DrawGeometry(void *in_self, + const float inModelMatrix[16], + const JPC_AABox *inWorldSpaceBounds, + float inLODScaleSq, + JPC_Color inColor, + const JPC_DebugRenderer_Geometry *in_geometry, + JPC_CullMode in_cull_mode, + JPC_CastShadow in_cast_shadow, + JPC_DrawMode in_draw_mode) +{ + if (in_geometry->num_LODs == 0) return; + JPC_DebugRenderer_TriangleBatch *batch = in_geometry->LODs[0].batch; + const JPC_DebugRenderer_Primitive *prim = JPC_DebugRenderer_TriangleBatch_GetPrimitive(batch); +#ifdef PRINT_OUTPUT + fprintf(stderr, "\tDebugRenderer: DrawGeometry called for %x\n", prim); +#endif +} + +static void +MyDebugRenderer_DrawText3D(void *in_self, + JPC_Real in_position[3], + const char *in_string, + JPC_Color in_color, + float in_height) +{ +#ifdef PRINT_OUTPUT + fprintf(stderr, "\tDebugRenderer: DrawText3D called.\n"); +#endif +} + +static MyDebugRenderer +MyDebugRenderer_Init(void) +{ + static const JPC_DebugRendererVTable vtable = + { + .DrawLine = MyDebugRenderer_DrawLine, + .DrawTriangle = MyDebugRenderer_DrawTriangle, + .CreateTriangleBatch = MyDebugRenderer_CreateTriangleBatch, + .CreateTriangleBatchIndexed = MyDebugRenderer_CreateTriangleBatchIndexed, + .DrawGeometry = MyDebugRenderer_DrawGeometry, + .DrawText3D = MyDebugRenderer_DrawText3D, + }; + MyDebugRenderer impl = + { + .vtable = &vtable, + .prim_head = 0 + }; + return impl; +} + +/// This function can be passed to JPC_PhysicsSystem.DrawBodies as the filter, deciding which bodies draw. +static bool BodyShouldDraw(const JPC_Body *) { + return true; +} +#endif //JPC_DEBUG_RENDERER +//-------------------------------------------------------------------------------------------------- +// MyActivationListener +//-------------------------------------------------------------------------------------------------- +typedef struct MyActivationListener +{ + const JPC_BodyActivationListenerVTable *vtable; // VTable has to be the first field in the struct. +} MyActivationListener; + +static void +MyActivationListener_OnBodyActivated(void *in_self, const JPC_BodyID *in_body_id, uint64_t in_user_data) +{ +#ifdef PRINT_OUTPUT + fprintf(stderr, "\tOnBodyActivated(): BodyID is (%d, %d)\n", + JPC_BodyID_GetSequenceNumber(*in_body_id), + JPC_BodyID_GetIndex(*in_body_id)); +#endif +} + +static void +MyActivationListener_OnBodyDeactivated(void *in_self, const JPC_BodyID *in_body_id, uint64_t in_user_data) +{ +#ifdef PRINT_OUTPUT + fprintf(stderr, "\tOnBodyDeactivated(): BodyID is (%d, %d)\n", + JPC_BodyID_GetSequenceNumber(*in_body_id), + JPC_BodyID_GetIndex(*in_body_id)); +#endif +} + +static MyActivationListener +MyActivationListener_Init(void) +{ + static const JPC_BodyActivationListenerVTable vtable = + { + .OnBodyActivated = MyActivationListener_OnBodyActivated, + .OnBodyDeactivated = MyActivationListener_OnBodyDeactivated, + }; + MyActivationListener impl = + { + .vtable = &vtable, + }; + return impl; +} +//-------------------------------------------------------------------------------------------------- +// MyObjectFilter +//-------------------------------------------------------------------------------------------------- +typedef struct MyObjectFilter +{ + const JPC_ObjectLayerPairFilterVTable *vtable; // VTable has to be the first field in the struct. +} MyObjectFilter; + +static bool +MyObjectFilter_ShouldCollide(const void *in_self, JPC_ObjectLayer in_object1, JPC_ObjectLayer in_object2) +{ + switch (in_object1) + { + case OBJ_LAYER_NON_MOVING: + return in_object2 == OBJ_LAYER_MOVING; + case OBJ_LAYER_MOVING: + return true; + default: + assert(false); + return false; + } +} + +static MyObjectFilter +MyObjectFilter_Init(void) +{ + static const JPC_ObjectLayerPairFilterVTable vtable = + { + .ShouldCollide = MyObjectFilter_ShouldCollide, + }; + MyObjectFilter impl = + { + .vtable = &vtable, + }; + return impl; +} +//-------------------------------------------------------------------------------------------------- +// MyBroadPhaseFilter +//-------------------------------------------------------------------------------------------------- +typedef struct MyBroadPhaseFilter +{ + const JPC_ObjectVsBroadPhaseLayerFilterVTable *vtable; // VTable has to be the first field in the struct. +} MyBroadPhaseFilter; + +static bool +MyBroadPhaseFilter_ShouldCollide(const void *in_self, JPC_ObjectLayer in_layer1, JPC_BroadPhaseLayer in_layer2) +{ + switch (in_layer1) + { + case OBJ_LAYER_NON_MOVING: + return in_layer2 == BP_LAYER_MOVING; + case OBJ_LAYER_MOVING: + return true; + default: + assert(false); + return false; + } +} + +static MyBroadPhaseFilter +MyBroadPhaseFilter_Init(void) +{ + static const JPC_ObjectVsBroadPhaseLayerFilterVTable vtable = + { + .ShouldCollide = MyBroadPhaseFilter_ShouldCollide, + }; + MyBroadPhaseFilter impl = + { + .vtable = &vtable, + }; + return impl; +} +//-------------------------------------------------------------------------------------------------- +// Basic1 +//-------------------------------------------------------------------------------------------------- +uint32_t +JoltCTest_Basic1(void) +{ + JPC_RegisterDefaultAllocator(); + JPC_CreateFactory(); + JPC_RegisterTypes(); + + const uint32_t max_bodies = 1024; + const uint32_t num_body_mutexes = 0; + const uint32_t max_body_pairs = 1024; + const uint32_t max_contact_constraints = 1024; + + BPLayerInterfaceImpl *broad_phase_layer_interface = malloc(sizeof(BPLayerInterfaceImpl)); + *broad_phase_layer_interface = BPLayerInterface_Init(); + + MyBroadPhaseFilter *broad_phase_filter = malloc(sizeof(MyBroadPhaseFilter)); + *broad_phase_filter = MyBroadPhaseFilter_Init(); + + MyObjectFilter *object_filter = malloc(sizeof(MyObjectFilter)); + *object_filter = MyObjectFilter_Init(); + + JPC_PhysicsSystem *physics_system = JPC_PhysicsSystem_Create( + max_bodies, + num_body_mutexes, + max_body_pairs, + max_contact_constraints, + broad_phase_layer_interface, + broad_phase_filter, + object_filter); + + JPC_BoxShapeSettings *box_settings = JPC_BoxShapeSettings_Create((float[]){ 10.0, 20.0, 30.0 }); + + if (JPC_ShapeSettings_GetRefCount((JPC_ShapeSettings *)box_settings) != 1) return 0; + JPC_ShapeSettings_AddRef((JPC_ShapeSettings *)box_settings); + JPC_ShapeSettings_Release((JPC_ShapeSettings *)box_settings); + if (JPC_ShapeSettings_GetRefCount((JPC_ShapeSettings *)box_settings) != 1) return 0; + + JPC_BoxShapeSettings_SetConvexRadius(box_settings, 1.0); + if (JPC_BoxShapeSettings_GetConvexRadius(box_settings) != 1.0) return 0; + + JPC_ConvexShapeSettings_SetDensity((JPC_ConvexShapeSettings *)box_settings, 100.0); + if (JPC_ConvexShapeSettings_GetDensity((JPC_ConvexShapeSettings *)box_settings) != 100.0) return 0; + + JPC_Shape *box_shape = JPC_ShapeSettings_CreateShape((JPC_ShapeSettings *)box_settings); + if (box_shape == NULL) return 0; + if (JPC_Shape_GetType(box_shape) != JPC_SHAPE_TYPE_CONVEX) return 0; + if (JPC_Shape_GetSubType(box_shape) != JPC_SHAPE_SUB_TYPE_BOX) return 0; + + if (JPC_Shape_GetRefCount(box_shape) != 2) return 0; + + JPC_ShapeSettings_CreateShape((JPC_ShapeSettings *)box_settings); + if (JPC_Shape_GetRefCount(box_shape) != 3) return 0; + JPC_Shape_Release(box_shape); + if (JPC_Shape_GetRefCount(box_shape) != 2) return 0; + + if (JPC_ShapeSettings_GetRefCount((JPC_ShapeSettings *)box_settings) != 1) return 0; + JPC_ShapeSettings_Release((JPC_ShapeSettings *)box_settings); + box_settings = NULL; + + if (JPC_Shape_GetRefCount(box_shape) != 1) return 0; + JPC_Shape_Release(box_shape); + box_shape = NULL; + + JPC_PhysicsSystem_Destroy(physics_system); + physics_system = NULL; + + JPC_DestroyFactory(); + + return 1; +} +//-------------------------------------------------------------------------------------------------- +// Basic2 +//-------------------------------------------------------------------------------------------------- +uint32_t +JoltCTest_Basic2(void) +{ + JPC_RegisterDefaultAllocator(); + JPC_CreateFactory(); + JPC_RegisterTypes(); + + JPC_TempAllocator *temp_allocator = JPC_TempAllocator_Create(10 * 1024 * 1024); + JPC_JobSystem *job_system = JPC_JobSystem_Create(JPC_MAX_PHYSICS_JOBS, JPC_MAX_PHYSICS_BARRIERS, -1); + + const uint32_t max_bodies = 1024; + const uint32_t num_body_mutexes = 0; + const uint32_t max_body_pairs = 1024; + const uint32_t max_contact_constraints = 1024; + + BPLayerInterfaceImpl broad_phase_layer_interface = BPLayerInterface_Init(); + MyBroadPhaseFilter broad_phase_filter = MyBroadPhaseFilter_Init(); + MyObjectFilter object_filter = MyObjectFilter_Init(); + + JPC_PhysicsSystem *physics_system = JPC_PhysicsSystem_Create( + max_bodies, + num_body_mutexes, + max_body_pairs, + max_contact_constraints, + &broad_phase_layer_interface, + &broad_phase_filter, + &object_filter); + + MyActivationListener body_activation_listener = MyActivationListener_Init(); + JPC_PhysicsSystem_SetBodyActivationListener(physics_system, &body_activation_listener); + + MyContactListener contact_listener = MyContactListener_Init(); + JPC_PhysicsSystem_SetContactListener(physics_system, &contact_listener); + JPC_PhysicsSystem_SetContactListener(physics_system, NULL); + JPC_PhysicsSystem_SetContactListener(physics_system, &contact_listener); + + JPC_BoxShapeSettings *floor_shape_settings = JPC_BoxShapeSettings_Create((float[]){ 100.0f, 1.0f, 100.0f }); + if (JPC_ShapeSettings_GetRefCount((JPC_ShapeSettings *)floor_shape_settings) != 1) return 0; + + JPC_Shape *floor_shape = JPC_ShapeSettings_CreateShape((JPC_ShapeSettings *)floor_shape_settings); + if (floor_shape == NULL) return 0; + if (JPC_ShapeSettings_GetRefCount((JPC_ShapeSettings *)floor_shape_settings) != 1) return 0; + if (JPC_Shape_GetRefCount(floor_shape) != 2) return 0; + + JPC_BodyCreationSettings floor_settings; + JPC_BodyCreationSettings_Set( + &floor_settings, + floor_shape, + (JPC_Real[]){ 0.0f, -1.0f, 0.0f }, + (float[]){ 0.0f, 0.0f, 0.0f, 1.0f }, + JPC_MOTION_TYPE_STATIC, + OBJ_LAYER_NON_MOVING); + + JPC_BodyInterface *body_interface = JPC_PhysicsSystem_GetBodyInterface(physics_system); + + JPC_Body *floor = JPC_BodyInterface_CreateBody(body_interface, &floor_settings); + if (floor == NULL) return 0; + const JPC_BodyID floor_id = JPC_Body_GetID(floor); + if (((floor_id & JPC_BODY_ID_SEQUENCE_BITS) >> JPC_BODY_ID_SEQUENCE_SHIFT) != 1) return 0; + if ((floor_id & JPC_BODY_ID_INDEX_BITS) != 0) return 0; + if (JPC_Body_IsStatic(floor) == false) return 0; + if (JPC_Body_IsDynamic(floor) == true) return 0; + + if (JPC_Shape_GetRefCount(floor_shape) != 3) return 0; + + JPC_Body *floor1 = JPC_BodyInterface_CreateBody(body_interface, &floor_settings); + if (floor1 == NULL) return 0; + const JPC_BodyID floor1_id = JPC_Body_GetID(floor1); + if (((floor1_id & JPC_BODY_ID_SEQUENCE_BITS) >> JPC_BODY_ID_SEQUENCE_SHIFT) != 1) return 0; + if ((floor1_id & JPC_BODY_ID_INDEX_BITS) != 1) return 0; + + if (JPC_BodyInterface_IsAdded(body_interface, floor_id) != false) return 0; + if (JPC_BodyInterface_IsAdded(body_interface, floor1_id) != false) return 0; + + JPC_BodyInterface_AddBody(body_interface, floor_id, JPC_ACTIVATION_ACTIVATE); + if (JPC_BodyInterface_IsAdded(body_interface, floor_id) != true) return 0; + + JPC_PhysicsSystem_OptimizeBroadPhase(physics_system); + JPC_PhysicsUpdateError update_err = JPC_PhysicsSystem_Update(physics_system, 1.0f / 60.0f, 1, 1, temp_allocator, job_system); + if (update_err != JPC_PHYSICS_UPDATE_NO_ERROR) return 0; + + JPC_BodyInterface_RemoveBody(body_interface, floor_id); + if (JPC_BodyInterface_IsAdded(body_interface, floor_id) != false) return 0; + + if (JPC_Shape_GetRefCount(floor_shape) != 4) return 0; + + if (JPC_ShapeSettings_GetRefCount((JPC_ShapeSettings *)floor_shape_settings) != 1) return 0; + JPC_ShapeSettings_Release((JPC_ShapeSettings *)floor_shape_settings); + if (JPC_Shape_GetRefCount(floor_shape) != 3) return 0; + + JPC_BodyInterface_DestroyBody(body_interface, floor_id); + if (JPC_Shape_GetRefCount(floor_shape) != 2) return 0; + + JPC_BodyInterface_DestroyBody(body_interface, floor1_id); + if (JPC_Shape_GetRefCount(floor_shape) != 1) return 0; + + JPC_Shape_Release(floor_shape); + + JPC_PhysicsSystem_Destroy(physics_system); + JPC_JobSystem_Destroy(job_system); + JPC_TempAllocator_Destroy(temp_allocator); + + JPC_DestroyFactory(); + + return 1; +} +//-------------------------------------------------------------------------------------------------- +// HelloWorld +//-------------------------------------------------------------------------------------------------- +uint32_t +JoltCTest_HelloWorld(void) +{ + JPC_RegisterDefaultAllocator(); + JPC_CreateFactory(); + JPC_RegisterTypes(); + + JPC_TempAllocator *temp_allocator = JPC_TempAllocator_Create(10 * 1024 * 1024); + JPC_JobSystem *job_system = JPC_JobSystem_Create(JPC_MAX_PHYSICS_JOBS, JPC_MAX_PHYSICS_BARRIERS, -1); + + const uint32_t max_bodies = 1024; + const uint32_t num_body_mutexes = 0; + const uint32_t max_body_pairs = 1024; + const uint32_t max_contact_constraints = 1024; + + BPLayerInterfaceImpl broad_phase_layer_interface = BPLayerInterface_Init(); + MyBroadPhaseFilter broad_phase_filter = MyBroadPhaseFilter_Init(); + MyObjectFilter object_filter = MyObjectFilter_Init(); + + JPC_PhysicsSystem *physics_system = JPC_PhysicsSystem_Create( + max_bodies, + num_body_mutexes, + max_body_pairs, + max_contact_constraints, + &broad_phase_layer_interface, + &broad_phase_filter, + &object_filter); + + MyActivationListener body_activation_listener = MyActivationListener_Init(); + JPC_PhysicsSystem_SetBodyActivationListener(physics_system, &body_activation_listener); + + MyContactListener contact_listener = MyContactListener_Init(); + JPC_PhysicsSystem_SetContactListener(physics_system, &contact_listener); + + JPC_BodyInterface *body_interface = JPC_PhysicsSystem_GetBodyInterface(physics_system); + +#if JPC_DEBUG_RENDERER == 1 + MyDebugRenderer debug_renderer = MyDebugRenderer_Init(); + enum JPC_DebugRendererResult result = JPC_CreateDebugRendererSingleton(&debug_renderer); + assert(result == JPC_DEBUGRENDERER_SUCCESS); + JPC_BodyManager_DrawSettings *body_draw_settings = JPC_BodyManager_DrawSettings_Create(); + JPC_BodyDrawFilter *body_draw_filter = JPC_BodyDrawFilter_Create(&BodyShouldDraw); +#endif //JPC_DEBUG_RENDERER + + // + // Static floor + // + JPC_BoxShapeSettings *floor_shape_settings = JPC_BoxShapeSettings_Create((float[]){ 100.0, 1.0, 100.0 }); + JPC_Shape *floor_shape = JPC_ShapeSettings_CreateShape((JPC_ShapeSettings *)floor_shape_settings); + + JPC_BodyCreationSettings floor_settings; + JPC_BodyCreationSettings_Set( + &floor_settings, + floor_shape, + (JPC_Real[]){ 0.0f, -1.0f, 0.0f }, + (float[]){ 0.0f, 0.0f, 0.0f, 1.0f }, + JPC_MOTION_TYPE_STATIC, + OBJ_LAYER_NON_MOVING); + + JPC_Body *floor = JPC_BodyInterface_CreateBody(body_interface, &floor_settings); + const JPC_BodyID floor_id = JPC_Body_GetID(floor); + JPC_BodyInterface_AddBody(body_interface, floor_id, JPC_ACTIVATION_DONT_ACTIVATE); + + // + // Falling sphere + // + JPC_SphereShapeSettings *sphere_shape_settings = JPC_SphereShapeSettings_Create(0.5f); + JPC_Shape *sphere_shape = JPC_ShapeSettings_CreateShape((JPC_ShapeSettings *)sphere_shape_settings); + + JPC_BodyCreationSettings sphere_settings; + JPC_BodyCreationSettings_Set( + &sphere_settings, + sphere_shape, + (JPC_Real[]){ 0.0f, 2.0f, 0.0f }, + (float[]){ 0.0f, 0.0f, 0.0f, 1.0f }, + JPC_MOTION_TYPE_DYNAMIC, + OBJ_LAYER_MOVING); + + const JPC_BodyID sphere_id = JPC_BodyInterface_CreateAndAddBody( + body_interface, + &sphere_settings, + JPC_ACTIVATION_ACTIVATE); + + if (JPC_Body_IsStatic(floor) == false) return 0; + if (JPC_Body_IsDynamic(floor) == true) return 0; + + JPC_BodyInterface_SetLinearVelocity(body_interface, sphere_id, (float[]){ 0.0f, -5.0f, 0.0f }); + + JPC_PhysicsSystem_OptimizeBroadPhase(physics_system); + + // Test JPC_PhysicsSystem_GetBodyIDs() + { + JPC_BodyID body_ids[2]; + uint32_t num_body_ids = 0; + JPC_PhysicsSystem_GetBodyIDs(physics_system, 2, &num_body_ids, &body_ids[0]); + if (num_body_ids != 2) return 0; + if (body_ids[0] != floor_id) return 0; + if (body_ids[1] != sphere_id) return 0; + } + + // Test JPC_PhysicsSystem_GetActiveBodyIDs() + { + JPC_BodyID body_ids[2]; + uint32_t num_body_ids = 0; + JPC_PhysicsSystem_GetActiveBodyIDs(physics_system, 2, &num_body_ids, &body_ids[0]); + if (num_body_ids != 1) return 0; + if (body_ids[0] != sphere_id) return 0; + } + +#ifdef PRINT_OUTPUT + if (sizeof(JPC_Real) == 8) + fprintf(stderr, "Using double precision computation...\n"); +#endif + + uint32_t step = 0; + while (JPC_BodyInterface_IsActive(body_interface, sphere_id)) + { + step += 1; + + JPC_Real position[3]; + JPC_BodyInterface_GetCenterOfMassPosition(body_interface, sphere_id, &position[0]); + + float velocity[3]; + JPC_BodyInterface_GetLinearVelocity(body_interface, sphere_id, &velocity[0]); + + const float delta_time = 1.0f / 60.0f; + const int collision_steps = 1; + const int integration_sub_steps = 1; + + JPC_PhysicsUpdateError update_err = JPC_PhysicsSystem_Update( + physics_system, + delta_time, + collision_steps, + integration_sub_steps, + temp_allocator, + job_system); + + if (update_err != JPC_PHYSICS_UPDATE_NO_ERROR) { + return 0; + } + +#ifdef PRINT_OUTPUT + fprintf(stderr, "Step %d\n\tPosition = (%f, %f, %f), Velocity(%f, %f, %f)\n", + step, + position[0], position[1], position[2], + velocity[0], velocity[1], velocity[2]); +#endif + + // Safe, lock protected way of accessing all bodies (use when you interact with Jolt from multiple threads). + { + JPC_BodyID body_ids[16]; // You can use JPC_PhysicsSystem_GetMaxBodies() to pre-allocate storage + uint32_t num_body_ids = 0; + JPC_PhysicsSystem_GetBodyIDs(physics_system, 16, &num_body_ids, &body_ids[0]); + + const JPC_BodyLockInterface *lock_iface = JPC_PhysicsSystem_GetBodyLockInterface(physics_system); + //const JPC_BodyLockInterface *lock_iface = JPC_PhysicsSystem_GetBodyLockInterfaceNoLock(physics_system); + + for (uint32_t i = 0; i < num_body_ids; ++i) + { + JPC_BodyLockRead lock; + JPC_BodyLockInterface_LockRead(lock_iface, body_ids[i], &lock); + //JPC_BodyLockWrite lock; + //JPC_BodyLockInterface_LockWrite(lock_iface, body_ids[i], &lock); + if (lock.body) + { + // Body has been locked, you can safely use `JPC_Body_*()` functions. + } + JPC_BodyLockInterface_UnlockRead(lock_iface, &lock); + //JPC_BodyLockInterface_UnlockWrite(lock_iface, &lock); + } + } + + // Low-level, advanced way of accessing body data. Not protected by a lock, no function calls overhead. + // Use when you interact with Jolt only from one thread or when you are sure that JPC_PhysicsSystem_Update() + // has already completed in a given frame. + { + JPC_Body **bodies = JPC_PhysicsSystem_GetBodiesUnsafe(physics_system); + + // Access a single body (get the body pointer from a body id). + { + JPC_Body *sphere = JPC_TRY_GET_BODY(bodies, sphere_id); + if (sphere) + { + sphere->friction = 0.2f; + } + } + + // Access all body pointers. + for (uint32_t i = 0; i < JPC_PhysicsSystem_GetNumBodies(physics_system); ++i) + { + JPC_Body *body = bodies[i]; + if (JPC_IS_VALID_BODY_POINTER(body)) + { + // Body pointer is valid (not freed) you can access the data. + } + } + } + + // Test body access. + { + JPC_Body **bodies = JPC_PhysicsSystem_GetBodiesUnsafe(physics_system); + + const JPC_BodyLockInterface *lock_iface = JPC_PhysicsSystem_GetBodyLockInterface(physics_system); + + JPC_BodyLockRead lock; + JPC_BodyLockInterface_LockRead(lock_iface, sphere_id, &lock); + if (lock.body) + { + JPC_Body *body = bodies[sphere_id & JPC_BODY_ID_INDEX_BITS]; + if (!JPC_IS_VALID_BODY_POINTER(body)) return 0; + + if (JPC_Body_IsDynamic(body) != true) return 0; + + JPC_Body *body_checked = JPC_TRY_GET_BODY(bodies, sphere_id); + if (body_checked == NULL) return 0; + + if (body_checked != body) return 0; + if (body_checked->id != body->id) return 0; + + if (body != lock.body) return 0; + if (body->id != sphere_id) return 0; + } + JPC_BodyLockInterface_UnlockRead(lock_iface, &lock); + } + +#if JPC_DEBUG_RENDERER == 1 + // Test Debug Renderer - should get calls to DrawGeometry each frame, once for floor, once for ball. + JPC_PhysicsSystem_DrawBodies(physics_system, body_draw_settings, body_draw_filter); +#endif // JPC_DEBUG_RENDERER + + } + +#if JPC_DEBUG_RENDERER == 1 + // Test other drawing functions besides DrawBodies at least once at the end + JPC_PhysicsSystem_DrawConstraints(physics_system); + JPC_PhysicsSystem_DrawConstraintLimits(physics_system); + JPC_PhysicsSystem_DrawConstraintReferenceFrame(physics_system); +#endif // JPC_DEBUG_RENDERER + +#if JPC_DEBUG_RENDERER == 1 + JPC_BodyDrawFilter_Destroy(body_draw_filter); + JPC_BodyManager_DrawSettings_Destroy(body_draw_settings); + JPC_DestroyDebugRendererSingleton(); +#endif // JPC_DEBUG_RENDERER + + JPC_BodyInterface_RemoveBody(body_interface, sphere_id); + JPC_BodyInterface_DestroyBody(body_interface, sphere_id); + + JPC_BodyInterface_RemoveBody(body_interface, floor_id); + JPC_BodyInterface_DestroyBody(body_interface, floor_id); + + JPC_ShapeSettings_Release((JPC_ShapeSettings *)floor_shape_settings); + if (JPC_Shape_GetRefCount(floor_shape) != 1) return 0; + JPC_Shape_Release(floor_shape); + + JPC_ShapeSettings_Release((JPC_ShapeSettings *)sphere_shape_settings); + if (JPC_Shape_GetRefCount(sphere_shape) != 1) return 0; + JPC_Shape_Release(sphere_shape); + + JPC_PhysicsSystem_Destroy(physics_system); + JPC_JobSystem_Destroy(job_system); + JPC_TempAllocator_Destroy(temp_allocator); + + JPC_DestroyFactory(); + + return 1; +} +//-------------------------------------------------------------------------------------------------- diff --git a/JoltPhysicsC/README.md b/JoltPhysicsC/README.md index be1279f3..6d5774ec 100644 --- a/JoltPhysicsC/README.md +++ b/JoltPhysicsC/README.md @@ -1,4 +1,4 @@ -# JoltPhysicsC v0.0.4 - C API for Jolt Physics C++ library +# JoltPhysicsC v0.0.6 - C API for Jolt Physics C++ library [Jolt Physics](https://github.com/jrouwe/JoltPhysics) is a fast and modern physics library written in C++. diff --git a/gradle.properties b/gradle.properties index a664792f..d2fee6c9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,3 @@ buildType=distribution + buildFlavor=dp