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,123 @@
/*
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_CONSTRAINT_SOLVER_H
#define _SCE_PFX_CONSTRAINT_SOLVER_H
#include "../../base_level/rigidbody/pfx_rigid_body.h"
#include "../../base_level/rigidbody/pfx_rigid_state.h"
#include "../../base_level/solver/pfx_solver_body.h"
#include "../../base_level/solver/pfx_constraint_pair.h"
#include "../../base_level/solver/pfx_joint.h"
#include "../../base_level/collision/pfx_contact_manifold.h"
#include "../task/pfx_task_manager.h"
namespace sce {
namespace PhysicsEffects {
///////////////////////////////////////////////////////////////////////////////
// Setup Solver Bodies
struct PfxSetupSolverBodiesParam {
PfxRigidState *states;
PfxRigidBody *bodies;
PfxSolverBody *solverBodies;
PfxUInt32 numRigidBodies;
};
PfxInt32 pfxSetupSolverBodies(PfxSetupSolverBodiesParam &param);
PfxInt32 pfxSetupSolverBodies(PfxSetupSolverBodiesParam &param,PfxTaskManager *taskManager);
///////////////////////////////////////////////////////////////////////////////
// Setup Constraints
struct PfxSetupContactConstraintsParam {
PfxConstraintPair *contactPairs;
PfxUInt32 numContactPairs;
PfxContactManifold *offsetContactManifolds;
PfxRigidState *offsetRigidStates;
PfxRigidBody *offsetRigidBodies;
PfxSolverBody *offsetSolverBodies;
PfxUInt32 numRigidBodies;
PfxFloat timeStep;
PfxFloat separateBias;
PfxSetupContactConstraintsParam()
{
timeStep = 0.016f;
separateBias = 0.2f;
}
};
PfxInt32 pfxSetupContactConstraints(PfxSetupContactConstraintsParam &param);
PfxInt32 pfxSetupContactConstraints(PfxSetupContactConstraintsParam &param,PfxTaskManager *taskManager);
struct PfxSetupJointConstraintsParam {
PfxConstraintPair *jointPairs;
PfxUInt32 numJointPairs;
PfxJoint *offsetJoints;
PfxRigidState *offsetRigidStates;
PfxRigidBody *offsetRigidBodies;
PfxSolverBody *offsetSolverBodies;
PfxUInt32 numRigidBodies;
PfxFloat timeStep;
PfxSetupJointConstraintsParam()
{
timeStep = 0.016f;
}
};
PfxInt32 pfxSetupJointConstraints(PfxSetupJointConstraintsParam &param);
PfxInt32 pfxSetupJointConstraints(PfxSetupJointConstraintsParam &param,PfxTaskManager *taskManager);
///////////////////////////////////////////////////////////////////////////////
// Solve Constraints
struct PfxSolveConstraintsParam {
void *workBuff;
PfxUInt32 workBytes;
PfxConstraintPair *contactPairs;
PfxUInt32 numContactPairs;
PfxContactManifold *offsetContactManifolds;
PfxConstraintPair *jointPairs;
PfxUInt32 numJointPairs;
PfxJoint *offsetJoints;
PfxRigidState *offsetRigidStates;
PfxSolverBody *offsetSolverBodies;
PfxUInt32 numRigidBodies;
PfxUInt32 iteration;
PfxSolveConstraintsParam()
{
iteration = 5;
}
};
PfxUInt32 pfxGetWorkBytesOfSolveConstraints(PfxUInt32 numRigidBodies,PfxUInt32 numContactPairs,PfxUInt32 numJointPairs,PfxUInt32 maxTasks=1);
PfxInt32 pfxSolveConstraints(PfxSolveConstraintsParam &param);
PfxInt32 pfxSolveConstraints(PfxSolveConstraintsParam &param,PfxTaskManager *taskManager);
} //namespace PhysicsEffects
} //namespace sce
#endif // _SCE_PFX_CONSTRAINT_SOLVER_H

View File

@@ -0,0 +1,69 @@
/*
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_JOINT_CONSTRAINT_FUNC_H_
#define _SCE_PFX_JOINT_CONSTRAINT_FUNC_H_
#include "../../base_level/rigidbody/pfx_rigid_state.h"
#include "../../base_level/solver/pfx_solver_body.h"
#include "../../base_level/solver/pfx_joint.h"
#include "../../base_level/solver/pfx_joint_constraint.h"
namespace sce {
namespace PhysicsEffects {
///////////////////////////////////////////////////////////////////////////////
// Setup Joint Constraint Func
typedef void (*PfxSetupJointConstraintFunc)(
PfxJoint &joint,
const PfxRigidState &stateA,
const PfxRigidState &stateB,
PfxSolverBody &solverBodyA,
PfxSolverBody &solverBodyB,
PfxFloat timeStep);
PfxSetupJointConstraintFunc pfxGetSetupJointConstraintFunc(PfxUInt8 jointType);
int pfxSetSetupJointConstraintFunc(PfxUInt8 jointType,PfxSetupJointConstraintFunc func);
///////////////////////////////////////////////////////////////////////////////
// Warm Start Joint Constraint Func
typedef void (*PfxWarmStartJointConstraintFunc)(
PfxJoint &joint,
PfxSolverBody &solverBodyA,
PfxSolverBody &solverBodyB);
PfxWarmStartJointConstraintFunc pfxGetWarmStartJointConstraintFunc(PfxUInt8 jointType);
int pfxSetWarmStartJointConstraintFunc(PfxUInt8 jointType,PfxWarmStartJointConstraintFunc func);
///////////////////////////////////////////////////////////////////////////////
// Solve Joint Constraint Func
typedef void (*PfxSolveJointConstraintFunc)(
PfxJoint &joint,
PfxSolverBody &solverBodyA,
PfxSolverBody &solverBodyB);
PfxSolveJointConstraintFunc pfxGetSolveJointConstraintFunc(PfxUInt8 jointType);
int pfxSetSolveJointConstraintFunc(PfxUInt8 jointType,PfxSolveJointConstraintFunc func);
} //namespace PhysicsEffects
} //namespace sce
#endif /* _PFX_JOINT_CONSTRAINT_FUNC_H_ */

View File

@@ -0,0 +1,45 @@
/*
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_RIGID_STATES_H_
#define _SCE_PFX_UPDATE_RIGID_STATES_H_
#include "../../base_level/rigidbody/pfx_rigid_body.h"
#include "../../base_level/rigidbody/pfx_rigid_state.h"
#include "../task/pfx_task_manager.h"
namespace sce {
namespace PhysicsEffects {
///////////////////////////////////////////////////////////////////////////////
// Update Rigid Body States
struct PfxUpdateRigidStatesParam {
PfxRigidState *states;
PfxRigidBody *bodies;
PfxUInt32 numRigidBodies;
PfxFloat timeStep;
};
PfxInt32 pfxUpdateRigidStates(PfxUpdateRigidStatesParam &param);
PfxInt32 pfxUpdateRigidStates(PfxUpdateRigidStatesParam &param,PfxTaskManager *taskManager);
} //namespace PhysicsEffects
} //namespace sce
#endif /* _SCE_PFX_UPDATE_RIGID_STATES_H_ */