Add PhysicsEffects to Extras. The build is only tested on Windows and Android.

The Android/NEON optimized version of Physics Effects is thanks to Graham Rhodes and Anthony Hamilton, See Issue 587
This commit is contained in:
erwin.coumans
2012-03-05 04:59:58 +00:00
parent 6cf8dfc202
commit a93a661b94
462 changed files with 86626 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
/*
Physics Effects Copyright(C) 2010 Sony Computer Entertainment Inc.
All rights reserved.
Physics Effects is open software; you can redistribute it and/or
modify it under the terms of the BSD License.
Physics Effects is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the BSD License for more details.
A copy of the BSD License is distributed with
Physics Effects under the filename: physics_effects_license.txt
*/
#ifndef _SCE_PFX_BROADPHASE_PAIR_H
#define _SCE_PFX_BROADPHASE_PAIR_H
#include "../sort/pfx_sort_data.h"
namespace sce {
namespace PhysicsEffects {
typedef PfxSortData16 PfxBroadphasePair;
SCE_PFX_FORCE_INLINE void pfxSetObjectIdA(PfxBroadphasePair &pair,PfxUInt16 i) {pair.set16(0,i);}
SCE_PFX_FORCE_INLINE void pfxSetObjectIdB(PfxBroadphasePair &pair,PfxUInt16 i) {pair.set16(1,i);}
SCE_PFX_FORCE_INLINE void pfxSetMotionMaskA(PfxBroadphasePair &pair,PfxUInt8 i) {pair.set8(4,i);}
SCE_PFX_FORCE_INLINE void pfxSetMotionMaskB(PfxBroadphasePair &pair,PfxUInt8 i) {pair.set8(5,i);}
SCE_PFX_FORCE_INLINE void pfxSetBroadphaseFlag(PfxBroadphasePair &pair,PfxUInt8 f) {pair.set8(6,(pair.get8(6)&0xf0)|(f&0x0f));}
SCE_PFX_FORCE_INLINE void pfxSetActive(PfxBroadphasePair &pair,PfxBool b) {pair.set8(6,(pair.get8(6)&0x0f)|((b?1:0)<<4));}
SCE_PFX_FORCE_INLINE void pfxSetContactId(PfxBroadphasePair &pair,PfxUInt32 i) {pair.set32(2,i);}
SCE_PFX_FORCE_INLINE PfxUInt16 pfxGetObjectIdA(const PfxBroadphasePair &pair) {return pair.get16(0);}
SCE_PFX_FORCE_INLINE PfxUInt16 pfxGetObjectIdB(const PfxBroadphasePair &pair) {return pair.get16(1);}
SCE_PFX_FORCE_INLINE PfxUInt8 pfxGetMotionMaskA(const PfxBroadphasePair &pair) {return pair.get8(4);}
SCE_PFX_FORCE_INLINE PfxUInt8 pfxGetMotionMaskB(const PfxBroadphasePair &pair) {return pair.get8(5);}
SCE_PFX_FORCE_INLINE PfxUInt8 pfxGetBroadphaseFlag(const PfxBroadphasePair &pair) {return pair.get8(6)&0x0f;}
SCE_PFX_FORCE_INLINE PfxBool pfxGetActive(const PfxBroadphasePair &pair) {return (pair.get8(6)>>4)!=0;}
SCE_PFX_FORCE_INLINE PfxUInt32 pfxGetContactId(const PfxBroadphasePair &pair) {return pair.get32(2);}
} //namespace PhysicsEffects
} //namespace sce
#endif // _SCE_PFX_BROADPHASE_PAIR_H

View File

@@ -0,0 +1,42 @@
/*
Physics Effects Copyright(C) 2010 Sony Computer Entertainment Inc.
All rights reserved.
Physics Effects is open software; you can redistribute it and/or
modify it under the terms of the BSD License.
Physics Effects is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the BSD License for more details.
A copy of the BSD License is distributed with
Physics Effects under the filename: physics_effects_license.txt
*/
#ifndef _SCE_PFX_BROADPHASE_PROXY_H
#define _SCE_PFX_BROADPHASE_PROXY_H
namespace sce {
namespace PhysicsEffects {
typedef PfxSortData32 PfxBroadphaseProxy;
//J AABBパラメータはPfxAabbと共通
//E PfxBroadphaseProxy shares AABB parameters with PfxAabb32
SCE_PFX_FORCE_INLINE void pfxSetObjectId(PfxBroadphaseProxy &proxy,PfxUInt16 i) {proxy.set16(6,i);}
SCE_PFX_FORCE_INLINE void pfxSetMotionMask(PfxBroadphaseProxy &proxy,PfxUInt8 i) {proxy.set8(14,i);}
SCE_PFX_FORCE_INLINE void pfxSetProxyFlag(PfxBroadphaseProxy &proxy,PfxUInt8 i) {proxy.set8(15,i);}
SCE_PFX_FORCE_INLINE void pfxSetSelf(PfxBroadphaseProxy &proxy,PfxUInt32 i) {proxy.set32(5,i);}
SCE_PFX_FORCE_INLINE void pfxSetTarget(PfxBroadphaseProxy &proxy,PfxUInt32 i) {proxy.set32(6,i);}
SCE_PFX_FORCE_INLINE PfxUInt16 pfxGetObjectId(const PfxBroadphaseProxy &proxy) {return proxy.get16(6);}
SCE_PFX_FORCE_INLINE PfxUInt8 pfxGetMotionMask(const PfxBroadphaseProxy &proxy) {return proxy.get8(14);}
SCE_PFX_FORCE_INLINE PfxUInt8 pfxGetProxyFlag(const PfxBroadphaseProxy &proxy) {return proxy.get8(15);}
SCE_PFX_FORCE_INLINE PfxUInt32 pfxGetSelf(const PfxBroadphaseProxy &proxy) {return proxy.get32(5);}
SCE_PFX_FORCE_INLINE PfxUInt32 pfxGetTarget(const PfxBroadphaseProxy &proxy) {return proxy.get32(6);}
} //namespace PhysicsEffects
} //namespace sce
#endif // _SCE_PFX_BROADPHASE_PROXY_H

View File

@@ -0,0 +1,80 @@
/*
Physics Effects Copyright(C) 2010 Sony Computer Entertainment Inc.
All rights reserved.
Physics Effects is open software; you can redistribute it and/or
modify it under the terms of the BSD License.
Physics Effects is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the BSD License for more details.
A copy of the BSD License is distributed with
Physics Effects under the filename: physics_effects_license.txt
*/
#ifndef _SCE_PFX_UPDATE_BROADPHASE_PROXY_H
#define _SCE_PFX_UPDATE_BROADPHASE_PROXY_H
#include "pfx_broadphase_pair.h"
#include "pfx_broadphase_proxy.h"
#include "../rigidbody/pfx_rigid_state.h"
#include "../collision/pfx_collidable.h"
namespace sce {
namespace PhysicsEffects {
///////////////////////////////////////////////////////////////////////////////
// Update Broadphase Proxy
//E For single axis
//J 単一軸に対して作成
PfxInt32 pfxUpdateBroadphaseProxy(
PfxBroadphaseProxy &proxy,
const PfxRigidState &state,
const PfxCollidable &coll,
const PfxVector3 &worldCenter,
const PfxVector3 &worldExtent,
PfxUInt32 axis);
PfxInt32 pfxUpdateBroadphaseProxy(
PfxBroadphaseProxy &proxy,
const PfxRigidState &state,
const PfxVector3 &objectCenter,
const PfxVector3 &objectHalf,
const PfxVector3 &worldCenter,
const PfxVector3 &worldExtent,
PfxUInt32 axis);
//E For all axes
//J 全軸に対して作成
PfxInt32 pfxUpdateBroadphaseProxy(
PfxBroadphaseProxy &proxyX,
PfxBroadphaseProxy &proxyY,
PfxBroadphaseProxy &proxyZ,
PfxBroadphaseProxy &proxyXb,
PfxBroadphaseProxy &proxyYb,
PfxBroadphaseProxy &proxyZb,
const PfxRigidState &state,
const PfxCollidable &coll,
const PfxVector3 &worldCenter,
const PfxVector3 &worldExtent);
PfxInt32 pfxUpdateBroadphaseProxy(
PfxBroadphaseProxy &proxyX,
PfxBroadphaseProxy &proxyY,
PfxBroadphaseProxy &proxyZ,
PfxBroadphaseProxy &proxyXb,
PfxBroadphaseProxy &proxyYb,
PfxBroadphaseProxy &proxyZb,
const PfxRigidState &state,
const PfxVector3 &objectCenter,
const PfxVector3 &objectHalf,
const PfxVector3 &worldCenter,
const PfxVector3 &worldExtent);
} // namespace PhysicsEffects
} // namespace sce
#endif // _SCE_PFX_UPDATE_BROADPHASE_PROXY_H