예제 #1
0
void SFXFMODDevice::setListener( U32 index, const SFXListenerProperties& listener )
{
   FMOD_VECTOR position, forward, up, velocity;
   
   TorqueTransformToFMODVectors( listener.getTransform(), position, forward, up );
   TorqueVectorToFMODVector( listener.getVelocity(), velocity );

	// Do the listener state update, then update!
	smFunc->FMOD_System_Set3DListenerAttributes( smSystem, index, &position, &velocity, &forward, &up );
}
void SFX3DWorld::updateObject( SceneObjectLink* object )
{
   SFX3DObject* sfxObject = dynamic_cast< SFX3DObject* >( object );
   AssertFatal( sfxObject, "SFX3DWorld::updateObject - invalid object type" );
   
   mSFXWorld.updateObject( sfxObject );
   
   // If this is the listener object, update its
   // properties on the SFX system.
   
   if( sfxObject->isListener() )
   {
      SFXListenerProperties listener;
      sfxObject->getEarTransform( listener.getTransform() );
      listener.getVelocity() = sfxObject->getObject()->getVelocity();
      
      SFX->setListener( 0, listener );
   }
}
예제 #3
0
void SFXALDevice::setListener( U32 index, const SFXListenerProperties& listener )
{
   if( index != 0 )
      return;

   // Torque and OpenAL are both right handed 
   // systems, so no coordinate flipping is needed.

   const MatrixF &transform = listener.getTransform();
   Point3F pos, tupple[2];
   transform.getColumn( 3, &pos );
   transform.getColumn( 1, &tupple[0] );
   transform.getColumn( 2, &tupple[1] );

   const VectorF &velocity = listener.getVelocity();

   mOpenAL.alListenerfv( AL_POSITION, pos );
   mOpenAL.alListenerfv( AL_VELOCITY, velocity );
   mOpenAL.alListenerfv( AL_ORIENTATION, (const F32 *)&tupple[0] );
}