2 Physics Effects Copyright(C) 2010 Sony Computer Entertainment Inc.
\r
5 Physics Effects is open software; you can redistribute it and/or
\r
6 modify it under the terms of the BSD License.
\r
8 Physics Effects is distributed in the hope that it will be useful,
\r
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\r
11 See the BSD License for more details.
\r
13 A copy of the BSD License is distributed with
\r
14 Physics Effects under the filename: physics_effects_license.txt
\r
17 #ifndef _SCE_PFX_JOINT_H
\r
18 #define _SCE_PFX_JOINT_H
\r
20 #include "../rigidbody/pfx_rigid_state.h"
\r
21 #include "pfx_joint_constraint.h"
\r
22 #include "pfx_constraint_pair.h"
\r
25 namespace PhysicsEffects {
\r
28 enum ePfxJointType {
\r
30 kPfxJointSwingtwist,
\r
44 kPfxJointCount // = 15
\r
48 struct SCE_PFX_ALIGNED(128) PfxJoint {
\r
50 PfxUInt8 m_numConstraints;
\r
52 SCE_PFX_PADDING(1,1)
\r
53 PfxUInt16 m_rigidBodyIdA;
\r
54 PfxUInt16 m_rigidBodyIdB;
\r
55 SCE_PFX_PADDING(2,8)
\r
56 PfxJointConstraint m_constraints[6];
\r
58 SCE_PFX_PADDING(3,12)
\r
59 PfxVector3 m_param[4]; // Used by some joints for specific features
\r
60 PfxVector3 m_anchorA;
\r
61 PfxVector3 m_anchorB;
\r
62 PfxMatrix3 m_frameA;
\r
63 PfxMatrix3 m_frameB;
\r
64 SCE_PFX_PADDING(4,32)
\r
67 SCE_PFX_FORCE_INLINE
\r
68 void pfxUpdateJointPairs(
\r
69 PfxConstraintPair &pair,
\r
71 const PfxJoint &joint,
\r
72 const PfxRigidState &stateA,
\r
73 const PfxRigidState &stateB
\r
76 SCE_PFX_ALWAYS_ASSERT(stateA.getRigidBodyId()==joint.m_rigidBodyIdA);
\r
77 SCE_PFX_ALWAYS_ASSERT(stateB.getRigidBodyId()==joint.m_rigidBodyIdB);
\r
78 pfxSetObjectIdA(pair,stateA.getRigidBodyId());
\r
79 pfxSetObjectIdB(pair,stateB.getRigidBodyId());
\r
80 pfxSetMotionMaskA(pair,stateA.getMotionMask());
\r
81 pfxSetMotionMaskB(pair,stateB.getMotionMask());
\r
82 pfxSetConstraintId(pair,jointId);
\r
83 pfxSetNumConstraints(pair,joint.m_numConstraints);
\r
84 pfxSetActive(pair,joint.m_active>0);
\r
86 } //namespace PhysicsEffects
\r
90 #endif // _PFX_JOINT_H
\r