Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6269


Ignore:
Timestamp:
Dec 8, 2009, 10:07:04 AM (14 years ago)
Author:
rgrieder
Message:

At last, found the sound bug: A long time ago somebody wrote AL_POSITION instead of AL_ORIENTATION and the orientation of the listener was updated AFTER the position.
Also fixed a problem with the wrong quaternion axis for the listener orientation.

Location:
code/branches/presentation2/src/orxonox/sound
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/sound/SoundManager.cc

    r6265 r6269  
    251251    {
    252252        // update listener orientation
    253         Vector3 up = orientation.xAxis(); // just a wild guess
    254         Vector3 at = orientation.zAxis();
    255 
    256         ALfloat orient[6] = { at.x, at.y, at.z,
    257                               up.x, up.y, up.z };
    258 
    259         alListenerfv(AL_POSITION, orient);
     253        const Vector3& direction = -orientation.zAxis();
     254        const Vector3& up = orientation.yAxis();
     255
     256        ALfloat orient[6] = { direction.x, direction.y, direction.z, up.x, up.y, up.z };
     257
     258        alListenerfv(AL_ORIENTATION, orient);
    260259        ALenum error = alGetError();
    261260        if (error == AL_INVALID_VALUE)
  • code/branches/presentation2/src/orxonox/sound/WorldSound.cc

    r6254 r6269  
    8181                COUT(2) << "Sound: OpenAL: Invalid sound velocity" << std::endl;
    8282
    83             const Quaternion& orient = this->getWorldOrientation();
    84             Vector3 at = orient.zAxis();
    85             alSource3f(this->audioSource_, AL_DIRECTION, at.x, at.y, at.z);
     83            const Vector3& direction = -this->getWorldOrientation().zAxis();
     84            alSource3f(this->audioSource_, AL_DIRECTION, direction.x, direction.y, direction.z);
    8685            error = alGetError();
    8786            if (error == AL_INVALID_VALUE)
Note: See TracChangeset for help on using the changeset viewer.