Email exchange: On 29.09.2017 14:35 Edouard DUPIN wrote: Hello, I have fork your physic engine and update it to fit better with my 3d game engine and my framework. I do many change: - on assert policy (I do not like it) - the back-end use of the vector3D and quaternion, that I have already an other implementation... - Log management - Other build system (lutin) - organisation of doxygen (all in the header) - remove dependency of the STL (in progress) - some bugs ... - ... And I have a problem with the licence. You use BSD-3 that is a good point, but this licence does not force the user to send your their modification. Then I ask you to permit me to change the licence of the FORK in MPL-2 that have the benefit to force developer to publish the modification and permit to use the software in a proprietary application without contamination. Best regards Edouard DUPIN https://github.com/HeeroYui https://github.com/atria-soft https://github.com/musicdsp answers from chappuis.daniel@XXXXXXX.yyy Hello, I am glad that you have found the ReactPhysics3D library to be useful. You said that you have found bugs. Maybe I have already found and fixed some of them but do not hesitate to report them here (https://github.com/DanielChappuis/reactphysics3d/issues) if not done yet. Concerning the license. The library is not under the BSD-3 license but under the zlib license (https://opensource.org/licenses/Zlib). With this license, it is allowed to use the software in a proprietary application without contamination. Regarding your request to change the license to the MPL-2, you can do it with the following condition : You need to add the following text in all the source files of ReactPhysics3D where the license will change. It must always be clear where the original code is coming from. --------------- TEXT TO ADD TO THE LICENSE IN EACH FILE ------------------------- Original ReactPhysics3D C++ library by Daniel Chappuis <http://www.reactphysics3d.com/> This code is re-licensed with permission from ReactPhysics3D author. --------------------------------------------------------------------------------- For example, you can see here how the flow/react library (java port of ReactPhysics3D) has been re-licensed from ReactPhysics3D (https://github.com/flow/react/blob/develop/src/main/java/com/flowpowered/react/constraint/ContactPoint.java) I hope it fits your needs. Best Regards, Daniel Chappuis
78 lines
3.1 KiB
C++
78 lines
3.1 KiB
C++
/** @file
|
|
* Original ReactPhysics3D C++ library by Daniel Chappuis <http://www.reactphysics3d.com/> This code is re-licensed with permission from ReactPhysics3D author.
|
|
* @author Daniel CHAPPUIS
|
|
* @author Edouard DUPIN
|
|
* @copyright 2010-2016, Daniel Chappuis
|
|
* @copyright 2017, Edouard DUPIN
|
|
* @license MPL v2.0 (see license file)
|
|
*/
|
|
#include <ephysics/engine/ConstraintSolver.hpp>
|
|
#include <ephysics/engine/Profiler.hpp>
|
|
|
|
using namespace ephysics;
|
|
|
|
ConstraintSolver::ConstraintSolver(const etk::Map<RigidBody*, uint32_t>& _mapBodyToVelocityIndex):
|
|
m_mapBodyToConstrainedVelocityIndex(_mapBodyToVelocityIndex),
|
|
m_isWarmStartingActive(true),
|
|
m_constraintSolverData(_mapBodyToVelocityIndex) {
|
|
|
|
}
|
|
|
|
void ConstraintSolver::initializeForIsland(float _dt, Island* _island) {
|
|
PROFILE("ConstraintSolver::initializeForIsland()");
|
|
assert(_island != nullptr);
|
|
assert(_island->getNbBodies() > 0);
|
|
assert(_island->getNbJoints() > 0);
|
|
// Set the current time step
|
|
m_timeStep = _dt;
|
|
// Initialize the constraint solver data used to initialize and solve the constraints
|
|
m_constraintSolverData.timeStep = m_timeStep;
|
|
m_constraintSolverData.isWarmStartingActive = m_isWarmStartingActive;
|
|
// For each joint of the island
|
|
Joint** joints = _island->getJoints();
|
|
for (uint32_t iii=0; iii<_island->getNbJoints(); ++iii) {
|
|
// Initialize the constraint before solving it
|
|
joints[iii]->initBeforeSolve(m_constraintSolverData);
|
|
// Warm-start the constraint if warm-starting is enabled
|
|
if (m_isWarmStartingActive) {
|
|
joints[iii]->warmstart(m_constraintSolverData);
|
|
}
|
|
}
|
|
}
|
|
|
|
void ConstraintSolver::solveVelocityConstraints(Island* _island) {
|
|
PROFILE("ConstraintSolver::solveVelocityConstraints()");
|
|
assert(_island != nullptr);
|
|
assert(_island->getNbJoints() > 0);
|
|
// For each joint of the island
|
|
Joint** joints = _island->getJoints();
|
|
for (uint32_t iii=0; iii<_island->getNbJoints(); ++iii) {
|
|
joints[iii]->solveVelocityConstraint(m_constraintSolverData);
|
|
}
|
|
}
|
|
|
|
void ConstraintSolver::solvePositionConstraints(Island* _island) {
|
|
PROFILE("ConstraintSolver::solvePositionConstraints()");
|
|
assert(_island != nullptr);
|
|
assert(_island->getNbJoints() > 0);
|
|
Joint** joints = _island->getJoints();
|
|
for (uint32_t iii=0; iii < _island->getNbJoints(); ++iii) {
|
|
joints[iii]->solvePositionConstraint(m_constraintSolverData);
|
|
}
|
|
}
|
|
|
|
void ConstraintSolver::setConstrainedVelocitiesArrays(vec3* _constrainedLinearVelocities,
|
|
vec3* _constrainedAngularVelocities) {
|
|
assert(_constrainedLinearVelocities != nullptr);
|
|
assert(_constrainedAngularVelocities != nullptr);
|
|
m_constraintSolverData.linearVelocities = _constrainedLinearVelocities;
|
|
m_constraintSolverData.angularVelocities = _constrainedAngularVelocities;
|
|
}
|
|
|
|
void ConstraintSolver::setConstrainedPositionsArrays(vec3* _constrainedPositions,
|
|
etk::Quaternion* _constrainedOrientations) {
|
|
assert(_constrainedPositions != nullptr);
|
|
assert(_constrainedOrientations != nullptr);
|
|
m_constraintSolverData.positions = _constrainedPositions;
|
|
m_constraintSolverData.orientations = _constrainedOrientations;
|
|
} |