[Orxonox-commit 1473] r6191 - in code/branches/presentation2: data/levels src/orxonox/controllers src/orxonox/graphics
rgrieder at orxonox.net
rgrieder at orxonox.net
Wed Dec 2 09:06:19 CET 2009
Author: rgrieder
Date: 2009-12-02 09:06:19 +0100 (Wed, 02 Dec 2009)
New Revision: 6191
Modified:
code/branches/presentation2/data/levels/sound.oxw
code/branches/presentation2/src/orxonox/controllers/HumanController.cc
code/branches/presentation2/src/orxonox/graphics/Camera.cc
Log:
Moved sound listener to the active camera and fixed the ambient distance trigger (now acts on cameras and we only have one in a Scene so far).
Modified: code/branches/presentation2/data/levels/sound.oxw
===================================================================
--- code/branches/presentation2/data/levels/sound.oxw 2009-12-02 08:02:49 UTC (rev 6190)
+++ code/branches/presentation2/data/levels/sound.oxw 2009-12-02 08:06:19 UTC (rev 6191)
@@ -21,7 +21,7 @@
<AmbientSound ambientSource="Asteroid_rocks.ogg" loop="true" play="false">
<events>
<activity>
- <DistanceTrigger position="300,100,0" distance=200 target="ControllableEntity">
+ <DistanceTrigger position="300,100,0" distance=200 target="Camera">
<attached>
<ParticleSpawner position="0,0,0" source="Orxonox/fire3" lifetime=0 loop=0 autostart=1 />
</attached>
Modified: code/branches/presentation2/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/branches/presentation2/src/orxonox/controllers/HumanController.cc 2009-12-02 08:02:49 UTC (rev 6190)
+++ code/branches/presentation2/src/orxonox/controllers/HumanController.cc 2009-12-02 08:06:19 UTC (rev 6191)
@@ -35,8 +35,6 @@
#include "gametypes/Gametype.h"
#include "infos/PlayerInfo.h"
#include "overlays/Map.h"
-#include "graphics/Camera.h"
-#include "sound/SoundManager.h"
#include "Radar.h"
#include "Scene.h"
@@ -82,14 +80,8 @@
{
if (GameMode::playsSound() && HumanController::localController_s && HumanController::localController_s->controllableEntity_)
{
- // Update sound listener
Camera* camera = HumanController::localController_s->controllableEntity_->getCamera();
- if (camera)
- {
- SoundManager::getInstance().setListenerPosition(camera->getWorldPosition());
- SoundManager::getInstance().setListenerOrientation(camera->getWorldOrientation());
- }
- else
+ if (!camera)
COUT(3) << "HumanController, Warning: Using a ControllableEntity without Camera" << std::endl;
}
}
Modified: code/branches/presentation2/src/orxonox/graphics/Camera.cc
===================================================================
--- code/branches/presentation2/src/orxonox/graphics/Camera.cc 2009-12-02 08:02:49 UTC (rev 6190)
+++ code/branches/presentation2/src/orxonox/graphics/Camera.cc 2009-12-02 08:06:19 UTC (rev 6191)
@@ -41,6 +41,7 @@
#include "core/GUIManager.h"
#include "Scene.h"
#include "CameraManager.h"
+#include "sound/SoundManager.h"
namespace orxonox
{
@@ -130,6 +131,13 @@
this->cameraNode_->setOrientation(Quaternion::Slerp(coeff, this->cameraNode_->_getDerivedOrientation(), this->getWorldOrientation(), true));
}
+
+ // Update sound listener transformation
+ if (GameMode::playsSound() && this->bHasFocus_)
+ {
+ SoundManager::getInstance().setListenerPosition(this->getWorldPosition());
+ SoundManager::getInstance().setListenerOrientation(this->getWorldOrientation());
+ }
}
void Camera::requestFocus()
More information about the Orxonox-commit
mailing list