initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
73
thirdparty/jolt_physics/Jolt/Physics/Constraints/Constraint.cpp
vendored
Normal file
73
thirdparty/jolt_physics/Jolt/Physics/Constraints/Constraint.cpp
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
|
||||
// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include <Jolt/Jolt.h>
|
||||
|
||||
#include <Jolt/Physics/Constraints/Constraint.h>
|
||||
#include <Jolt/Physics/StateRecorder.h>
|
||||
#include <Jolt/ObjectStream/TypeDeclarations.h>
|
||||
#include <Jolt/Core/StreamUtils.h>
|
||||
|
||||
JPH_NAMESPACE_BEGIN
|
||||
|
||||
JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL(ConstraintSettings)
|
||||
{
|
||||
JPH_ADD_BASE_CLASS(ConstraintSettings, SerializableObject)
|
||||
|
||||
JPH_ADD_ATTRIBUTE(ConstraintSettings, mEnabled)
|
||||
JPH_ADD_ATTRIBUTE(ConstraintSettings, mDrawConstraintSize)
|
||||
JPH_ADD_ATTRIBUTE(ConstraintSettings, mConstraintPriority)
|
||||
JPH_ADD_ATTRIBUTE(ConstraintSettings, mNumVelocityStepsOverride)
|
||||
JPH_ADD_ATTRIBUTE(ConstraintSettings, mNumPositionStepsOverride)
|
||||
JPH_ADD_ATTRIBUTE(ConstraintSettings, mUserData)
|
||||
}
|
||||
|
||||
void ConstraintSettings::SaveBinaryState(StreamOut &inStream) const
|
||||
{
|
||||
inStream.Write(GetRTTI()->GetHash());
|
||||
inStream.Write(mEnabled);
|
||||
inStream.Write(mDrawConstraintSize);
|
||||
inStream.Write(mConstraintPriority);
|
||||
inStream.Write(mNumVelocityStepsOverride);
|
||||
inStream.Write(mNumPositionStepsOverride);
|
||||
}
|
||||
|
||||
void ConstraintSettings::RestoreBinaryState(StreamIn &inStream)
|
||||
{
|
||||
// Type hash read by sRestoreFromBinaryState
|
||||
inStream.Read(mEnabled);
|
||||
inStream.Read(mDrawConstraintSize);
|
||||
inStream.Read(mConstraintPriority);
|
||||
inStream.Read(mNumVelocityStepsOverride);
|
||||
inStream.Read(mNumPositionStepsOverride);
|
||||
}
|
||||
|
||||
ConstraintSettings::ConstraintResult ConstraintSettings::sRestoreFromBinaryState(StreamIn &inStream)
|
||||
{
|
||||
return StreamUtils::RestoreObject<ConstraintSettings>(inStream, &ConstraintSettings::RestoreBinaryState);
|
||||
}
|
||||
|
||||
void Constraint::SaveState(StateRecorder &inStream) const
|
||||
{
|
||||
inStream.Write(mEnabled);
|
||||
}
|
||||
|
||||
void Constraint::RestoreState(StateRecorder &inStream)
|
||||
{
|
||||
inStream.Read(mEnabled);
|
||||
}
|
||||
|
||||
void Constraint::ToConstraintSettings(ConstraintSettings &outSettings) const
|
||||
{
|
||||
outSettings.mEnabled = mEnabled;
|
||||
outSettings.mConstraintPriority = mConstraintPriority;
|
||||
outSettings.mNumVelocityStepsOverride = mNumVelocityStepsOverride;
|
||||
outSettings.mNumPositionStepsOverride = mNumPositionStepsOverride;
|
||||
outSettings.mUserData = mUserData;
|
||||
#ifdef JPH_DEBUG_RENDERER
|
||||
outSettings.mDrawConstraintSize = mDrawConstraintSize;
|
||||
#endif // JPH_DEBUG_RENDERER
|
||||
}
|
||||
|
||||
JPH_NAMESPACE_END
|
Reference in New Issue
Block a user