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
136 lines
5.0 KiB
C++
136 lines
5.0 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)
|
|
*/
|
|
#pragma once
|
|
|
|
#include <ephysics/body/CollisionBody.hpp>
|
|
#include <ephysics/collision/shapes/CollisionShape.hpp>
|
|
|
|
namespace ephysics {
|
|
/**
|
|
* @breif The CollisionShape instances are supposed to be unique for memory optimization. For instance,
|
|
* consider two rigid bodies with the same sphere collision shape. In this situation, we will have
|
|
* a unique instance of SphereShape but we need to differentiate between the two instances during
|
|
* the collision detection. They do not have the same position in the world and they do not
|
|
* belong to the same rigid body. The ProxyShape class is used for that purpose by attaching a
|
|
* rigid body with one of its collision shape. A body can have multiple proxy shapes (one for
|
|
* each collision shape attached to the body).
|
|
*/
|
|
class ProxyShape {
|
|
protected:
|
|
CollisionBody* m_body; //!< Pointer to the parent body
|
|
CollisionShape* m_collisionShape; //!< Internal collision shape
|
|
etk::Transform3D m_localToBodyTransform; //!< Local-space to parent body-space transform (does not change over time)
|
|
float m_mass; //!< Mass (in kilogramms) of the corresponding collision shape
|
|
ProxyShape* m_next; //!< Pointer to the next proxy shape of the body (linked list)
|
|
int32_t m_broadPhaseID; //!< Broad-phase ID (node ID in the dynamic AABB tree)
|
|
void* m_cachedCollisionData; //!< Cached collision data
|
|
void* m_userData; //!< Pointer to user data
|
|
/**
|
|
* @brief Bits used to define the collision category of this shape.
|
|
* You can set a single bit to one to define a category value for this
|
|
* shape. This value is one (0x0001) by default. This variable can be used
|
|
* together with the m_collideWithMaskBits variable so that given
|
|
* categories of shapes collide with each other and do not collide with
|
|
* other categories.
|
|
*/
|
|
unsigned short m_collisionCategoryBits;
|
|
/**
|
|
* @brief Bits mask used to state which collision categories this shape can
|
|
* collide with. This value is 0xFFFF by default. It means that this
|
|
* proxy shape will collide with every collision categories by default.
|
|
*/
|
|
unsigned short m_collideWithMaskBits;
|
|
/// Private copy-constructor
|
|
ProxyShape(const ProxyShape&) = delete;
|
|
/// Private assignment operator
|
|
ProxyShape& operator=(const ProxyShape&) = delete;
|
|
public:
|
|
/// Constructor
|
|
ProxyShape(CollisionBody* _body,
|
|
CollisionShape* _shape,
|
|
const etk::Transform3D& _transform,
|
|
float _mass);
|
|
|
|
/// Destructor
|
|
virtual ~ProxyShape();
|
|
|
|
/// Return the collision shape
|
|
const CollisionShape* getCollisionShape() const;
|
|
|
|
/// Return the parent body
|
|
CollisionBody* getBody() const;
|
|
|
|
/// Return the mass of the collision shape
|
|
float getMass() const;
|
|
|
|
/// Return a pointer to the user data attached to this body
|
|
void* getUserData() const;
|
|
|
|
/// Attach user data to this body
|
|
void setUserData(void* _userData);
|
|
|
|
/// Return the local to parent body transform
|
|
const etk::Transform3D& getLocalToBodyTransform() const;
|
|
|
|
/// Set the local to parent body transform
|
|
void setLocalToBodyTransform(const etk::Transform3D& _transform);
|
|
|
|
/// Return the local to world transform
|
|
const etk::Transform3D getLocalToWorldTransform() const;
|
|
|
|
/// Return true if a point is inside the collision shape
|
|
bool testPointInside(const vec3& _worldPoint);
|
|
|
|
/// Raycast method with feedback information
|
|
bool raycast(const Ray& _ray, RaycastInfo& _raycastInfo);
|
|
|
|
/// Return the collision bits mask
|
|
unsigned short getCollideWithMaskBits() const;
|
|
|
|
/// Set the collision bits mask
|
|
void setCollideWithMaskBits(unsigned short _collideWithMaskBits);
|
|
|
|
/// Return the collision category bits
|
|
unsigned short getCollisionCategoryBits() const;
|
|
|
|
/// Set the collision category bits
|
|
void setCollisionCategoryBits(unsigned short _collisionCategoryBits);
|
|
|
|
/// Return the next proxy shape in the linked list of proxy shapes
|
|
ProxyShape* getNext();
|
|
|
|
/// Return the next proxy shape in the linked list of proxy shapes
|
|
const ProxyShape* getNext() const;
|
|
|
|
/// Return the pointer to the cached collision data
|
|
void** getCachedCollisionData();
|
|
|
|
/// Return the local scaling vector of the collision shape
|
|
vec3 getLocalScaling() const;
|
|
|
|
/// Set the local scaling vector of the collision shape
|
|
virtual void setLocalScaling(const vec3& _scaling);
|
|
|
|
friend class OverlappingPair;
|
|
friend class CollisionBody;
|
|
friend class RigidBody;
|
|
friend class BroadPhaseAlgorithm;
|
|
friend class DynamicAABBTree;
|
|
friend class CollisionDetection;
|
|
friend class CollisionWorld;
|
|
friend class DynamicsWorld;
|
|
friend class EPAAlgorithm;
|
|
friend class GJKAlgorithm;
|
|
friend class ConvexMeshShape;
|
|
|
|
};
|
|
|
|
}
|
|
|