[Orxonox-commit 4488] r9159 - in code/branches/waypoints/src: modules/overlays/hud orxonox/overlays
scmoritz at orxonox.net
scmoritz at orxonox.net
Fri May 4 16:09:25 CEST 2012
Author: scmoritz
Date: 2012-05-04 16:09:25 +0200 (Fri, 04 May 2012)
New Revision: 9159
Modified:
code/branches/waypoints/src/modules/overlays/hud/HUDNavigation.cc
code/branches/waypoints/src/orxonox/overlays/OrxonoxOverlay.cc
code/branches/waypoints/src/orxonox/overlays/OrxonoxOverlay.h
Log:
3DScene added. creation of the arrow doesnt work.
Modified: code/branches/waypoints/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/waypoints/src/modules/overlays/hud/HUDNavigation.cc 2012-05-04 14:07:43 UTC (rev 9158)
+++ code/branches/waypoints/src/modules/overlays/hud/HUDNavigation.cc 2012-05-04 14:09:25 UTC (rev 9159)
@@ -35,6 +35,7 @@
#include <OgreOverlayManager.h>
#include <OgreTextAreaOverlayElement.h>
#include <OgrePanelOverlayElement.h>
+#include <OgreEntity.h>
#include "util/Math.h"
#include "util/Convert.h"
@@ -79,6 +80,10 @@
this->setTextSize ( 0.05f );
this->setNavMarkerSize ( 0.05f );
this->setDetectionLimit( 10000.0f );
+
+ Ogre::Entity* ent = this->getScene()->getSceneManager()->createEntity("Arrow3D", "Arrow3D.mesh");
+ this->add3DMesh(ent);
+ this->overlay3d_->setPosition(0, 0, -10);
}
HUDNavigation::~HUDNavigation()
Modified: code/branches/waypoints/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/branches/waypoints/src/orxonox/overlays/OrxonoxOverlay.cc 2012-05-04 14:07:43 UTC (rev 9158)
+++ code/branches/waypoints/src/orxonox/overlays/OrxonoxOverlay.cc 2012-05-04 14:09:25 UTC (rev 9159)
@@ -41,6 +41,7 @@
#include <OgreMaterialManager.h>
#include <OgreTechnique.h>
#include <OgrePass.h>
+#include <OgreEntity.h>
#include "util/Convert.h"
#include "util/Exception.h"
@@ -83,6 +84,9 @@
"OrxonoxOverlay_background_" + multi_cast<std::string>(hudOverlayCounter_s++)));
this->overlay_->add2D(this->background_);
+ overlay3d_ = new Ogre::SceneNode(NULL);
+ this->overlay_->add3D(overlay3d_);
+
// Get aspect ratio from the render window. Later on, we get informed automatically
this->windowAspectRatio_ = static_cast<float>(this->getWindowWidth()) / this->getWindowHeight();
@@ -447,4 +451,9 @@
Ogre::TextureUnitState* tempTx = ptr->getTechnique(0)->getPass(0)->getTextureUnitState(0);
tempTx->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour);
}
+ void OrxonoxOverlay::add3DMesh(Ogre::Entity* entity)
+ {
+ this->overlay3d_->attachObject(entity);
+ }
+
}
Modified: code/branches/waypoints/src/orxonox/overlays/OrxonoxOverlay.h
===================================================================
--- code/branches/waypoints/src/orxonox/overlays/OrxonoxOverlay.h 2012-05-04 14:07:43 UTC (rev 9158)
+++ code/branches/waypoints/src/orxonox/overlays/OrxonoxOverlay.h 2012-05-04 14:09:25 UTC (rev 9159)
@@ -44,6 +44,7 @@
#include "core/Super.h"
#include "core/WindowEventListener.h"
+
namespace orxonox
{
/**
@@ -185,7 +186,9 @@
{ return this->group_; }
virtual void changedOverlayGroup()
{ this->changedVisibility(); }
+ void add3DMesh(Ogre::Entity* entity);
+
protected:
virtual void angleChanged();
virtual void sizeCorrectionChanged();
@@ -194,6 +197,7 @@
Ogre::Overlay* overlay_; //!< The overlay the entire class is about.
Ogre::PanelOverlayElement* background_; //!< Background image (blank per default).
+ Ogre::SceneNode* overlay3d_; //!< The scene where one can add 3D objects to the overlay
float windowAspectRatio_; //!< Screen.width / screen.height
bool bCorrectAspect_; //!< Whether or not to correct the size. @see setAspectCorrection()
@@ -214,6 +218,7 @@
BaseObject* owner_;
OverlayGroup* group_;
Ogre::Pass* backgroundAlphaPass_;
+
};
SUPER_FUNCTION(6, OrxonoxOverlay, changedOwner, false);
More information about the Orxonox-commit
mailing list