///
  /// \brief
  ///   Converts a Havok Physics rotation matrix to a Vision rotation matrix.
  ///
  VHAVOK_IMPEXP static HK_FORCE_INLINE void HkRotationToVisMatrix(const hkRotation &hkRot, hkvMat3 &visRotMatrixOut)
  {
	  // Extract matrix columns from Havok, both col-major
	  float* visRot = (float*)visRotMatrixOut.getPointer();
	  hkRot.getColumn<0>().store<3,HK_IO_NATIVE_ALIGNED>(visRot  );
	  hkRot.getColumn<1>().store<3,HK_IO_NATIVE_ALIGNED>(visRot+3);
	  hkRot.getColumn<2>().store<3,HK_IO_NATIVE_ALIGNED>(visRot+6);
  }
예제 #2
0
inline void VGroupInstance::Read(IVFileInStream *pIn, AvailableFlags_e eFlags)
{
  if ((eFlags&INSTANCE_POSITION)>0) pIn->Read(&m_vPosition,sizeof(m_vPosition),"fff");
  if ((eFlags&INSTANCE_ROTATION)>0) pIn->Read(m_Rotation.getPointer(),sizeof(m_Rotation),"9f");
  if ((eFlags&INSTANCE_SCALE)>0) pIn->Read(&m_fScale,sizeof(m_fScale),"f");
  if ((eFlags&INSTANCE_COLOR)>0) {pIn->Read(&m_iColor.r,1);pIn->Read(&m_iColor.g,1);pIn->Read(&m_iColor.b,1);pIn->Read(&m_iColor.a,1);}
  if ((eFlags&INSTANCE_ANIMATION)>0) {pIn->Read(&m_iAnimationIndex,sizeof(m_iAnimationIndex),"s");pIn->Read(&m_fAnimationOffset,sizeof(m_fAnimationOffset),"f");}
  if ((eFlags&INSTANCE_FARCLIP)>0) pIn->Read(&m_fFarClip,sizeof(m_fFarClip),"f");
  if ((eFlags&INSTANCE_SEED)>0) pIn->Read(&m_fSeed,sizeof(m_fSeed),"f");
  if ((eFlags&INSTANCE_SPLITKEY)>0) pIn->Read(&m_iSplitKey,sizeof(m_iSplitKey),"i");
  if ((eFlags&INSTANCE_CONEANGLE)>0) {pIn->Read(&m_fConeAngleX,sizeof(m_fConeAngleX),"f");pIn->Read(&m_fConeAngleY,sizeof(m_fConeAngleY),"f");}
}
  ///
  /// \brief
  ///   Converts a Vision rotation matrix to a Havok Physics rotation matrix.
  ///
  VHAVOK_IMPEXP static HK_FORCE_INLINE void VisMatrixToHkRotation(const hkvMat3 &visRotMatrix, hkRotation &hkRotOut)
  {
	  // Extract matrix columns from Vision
	  const float* visRot = (const float*)visRotMatrix.getPointer();
	  hkRotOut.getColumn<0>().load<3,HK_IO_NATIVE_ALIGNED>(visRot  );
	  hkRotOut.getColumn<0>().zeroComponent<3>();
	  hkRotOut.getColumn<1>().load<3,HK_IO_NATIVE_ALIGNED>(visRot+3);
	  hkRotOut.getColumn<1>().zeroComponent<3>();
	  hkRotOut.getColumn<2>().load<3,HK_IO_NATIVE_ALIGNED>(visRot+6);
	  hkRotOut.getColumn<2>().zeroComponent<3>();
	  HK_ASSERT(0xdee887, hkRotOut.isOk() /*&& hkRotOut.isOrthonormal()*/);
  }