Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1000 for code/branches


Ignore:
Timestamp:
Apr 6, 2008, 6:06:32 PM (17 years ago)
Author:
rgrieder
Message:
  • added a Factory to create OverlayElements by the ourselves
  • added a 3D ogre head to demonstrate the ability to use 3D content in an Overlay (could be used in a radar or whatever needs 3D)
Location:
code/branches/hud2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hud2/src/orxonox/hud/Bar.cc

    r991 r1000  
    2525*
    2626*/
     27
     28#include "OrxonoxStableHeaders.h"
    2729
    2830#include <OgreOverlayManager.h>
     
    9496
    9597  SmartBar::SmartBar(Ogre::Real left, Ogre::Real top, Ogre::Real width, Ogre::Real height,
    96         int dir, std::string name) : Bar::Bar(left, top, width, height, dir, Bar::YELLOW, name){
     98        int dir, std::string name) : Bar(left, top, width, height, dir, Bar::YELLOW, name){
    9799  }
    98100
  • code/branches/hud2/src/orxonox/hud/HUD.cc

    r991 r1000  
    3131#include <OgreOverlayContainer.h>
    3232#include <OgreOverlayManager.h>
     33#include <OgreSceneNode.h>
    3334
    3435#include "HUD.h"
    3536#include "Bar.h"
     37#include "TestElement.h"
     38// ugly hack
     39#include "Orxonox.h"
    3640
    3741
     
    6064    energyCounterPanel->addChild(energyCounter->element);
    6165
     66    TestOverlayElementFactory *factory = new TestOverlayElementFactory();
     67    overlayManager.addOverlayElementFactory(factory);
     68    Ogre::OverlayElement* testElement = overlayManager.createOverlayElementFromFactory("Test", "testElement");
     69
    6270    Ogre::Overlay* orxonoxOverlay = overlayManager.create("Orxonox/HUD");
    6371    orxonoxOverlay->add2D(energyCounterPanel);
     72
     73    // important: don't use SceneManager to create the node! but register the creator scene manager.
     74    ogreNode_ = new Ogre::SceneNode(Orxonox::getSingleton()->getSceneManager(), "hudNoedely");
     75   
     76    ogreNode_->setPosition(80,-60,-200);
     77    ogreNode_->setScale(0.4,0.4,0.4);
     78    // ugly hack, but I haven't figured out yet how we could change this, since we really need the
     79    // scene manager..
     80    ogreNode_->attachObject(Orxonox::getSingleton()->getSceneManager()->createEntity("head", "ogrehead.mesh"));
     81    orxonoxOverlay->add3D(ogreNode_);
     82
    6483    orxonoxOverlay->show();
     84  }
     85
     86  void HUD::tick(float dt)
     87  {
     88    if (this->ogreNode_)
     89    {
     90      this->ogreNode_->roll(Ogre::Degree(dt*200),Ogre::Node::TS_LOCAL);
     91      this->ogreNode_->yaw(Ogre::Degree(dt*200),Ogre::Node::TS_LOCAL);     
     92      this->ogreNode_->pitch(Ogre::Degree(dt*200),Ogre::Node::TS_LOCAL);     
     93    }
    6594  }
    6695
  • code/branches/hud2/src/orxonox/hud/HUD.h

    r991 r1000  
    3434#include <OgreTextAreaOverlayElement.h>
    3535#include <OgrePrerequisites.h>
    36 #include "../OrxonoxPrereqs.h"
    3736
     37#include "OrxonoxPrereqs.h"
     38
     39#include "core/Tickable.h"
    3840#include "Bar.h"
    3941
     
    4143namespace orxonox
    4244{
    43   class _OrxonoxExport HUD
     45  class _OrxonoxExport HUD : Tickable
    4446  {
    4547  private:
     
    4951    ~HUD();
    5052
     53    virtual void tick(float);
     54
    5155    Bar* energyCounter;
     56    Ogre::SceneNode* ogreNode_;
    5257  };
    5358}       
  • code/branches/hud2/visual_studio/vc8/orxonox.vcproj

    r991 r1000  
    195195                                        >
    196196                                </File>
     197                                <File
     198                                        RelativePath="..\..\src\orxonox\hud\TestElement.cc"
     199                                        >
     200                                </File>
    197201                        </Filter>
    198202                        <Filter
     
    345349                                        >
    346350                                </File>
     351                                <File
     352                                        RelativePath="..\..\src\orxonox\hud\TestElement.h"
     353                                        >
     354                                </File>
    347355                        </Filter>
    348356                        <Filter
Note: See TracChangeset for help on using the changeset viewer.