Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8738 for code/trunk


Ignore:
Timestamp:
Jul 9, 2011, 7:45:14 PM (13 years ago)
Author:
landauf
Message:

added "scale" for radar viewables. scale is relative, 1.0 means "normal".
rocket and simple rocket are now visible on the radar as small triangles.
greatly reduced lifetime of simple rocket.
fixed another possible cause for flashing hud radar.

Location:
code/trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/overlays/hud/HUDRadar.cc

    r8737 r8738  
    106106        panel->setMaterialName(TextureGenerator::getMaterialName(
    107107            shapeMaterials_[object->getRadarObjectShape()], object->getRadarObjectColour()));
     108        panel->hide();
    108109        this->radarObjects_[object] = panel;
    109110    }
     
    166167            float distance = (wePointer->getWorldPosition() - this->owner_->getPosition()).length();
    167168            // calculate the size with 1/distance dependency for simplicity (instead of exp(-distance * lambda)
    168             float size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance);
     169            float size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
    169170            it->second->setDimensions(size, size);
    170171
  • code/trunk/src/modules/weapons/projectiles/Rocket.cc

    r8706 r8738  
    5252        Constructor. Registers the object and initializes some default values.
    5353    */
    54     Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator), BasicProjectile()
     54    Rocket::Rocket(BaseObject* creator)
     55        : ControllableEntity(creator)
     56        , BasicProjectile()
     57        , RadarViewable(creator, static_cast<WorldEntity*>(this))
    5558    {
    5659        RegisterObject(Rocket);// - register the Rocket class to the core
     
    106109        camPosition->setAllowMouseLook(true);
    107110        this->addCameraPosition(camPosition);
     111
     112        this->setRadarObjectColour(ColourValue(1.0, 0.5, 0.0)); // orange
     113        this->setRadarObjectShape(RadarViewable::Triangle);
     114        this->setRadarObjectScale(0.5f);
    108115    }
    109116
  • code/trunk/src/modules/weapons/projectiles/Rocket.h

    r8706 r8738  
    3434#include "tools/Timer.h"
    3535#include "worldentities/ControllableEntity.h"
     36#include "interfaces/RadarViewable.h"
    3637
    3738#include "BasicProjectile.h"
     
    4849        Oli Scheuss
    4950    */
    50     class _WeaponsExport Rocket : public ControllableEntity, public BasicProjectile
     51    class _WeaponsExport Rocket : public ControllableEntity, public BasicProjectile, public RadarViewable
    5152    {
    5253        public:
  • code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc

    r8706 r8738  
    4848    CreateFactory(SimpleRocket);
    4949
    50     SimpleRocket::SimpleRocket(BaseObject* creator) : ControllableEntity(creator), BasicProjectile()
     50    SimpleRocket::SimpleRocket(BaseObject* creator)
     51        : ControllableEntity(creator)
     52        , BasicProjectile()
     53        , RadarViewable(creator, static_cast<WorldEntity*>(this))
    5154    {
    5255        RegisterObject(SimpleRocket);// - register the SimpleRocket class to the core
    5356
    5457        this->localAngularVelocity_ = 0;
    55         this->lifetime_ = 120;
     58        this->lifetime_ = 10;
    5659
    5760        this->setMass(15);
     
    8689        }
    8790
     91        this->setRadarObjectColour(ColourValue(1.0, 1.0, 0.0)); // yellow
     92        this->setRadarObjectShape(RadarViewable::Triangle);
     93        this->setRadarObjectScale(0.5f);
    8894    }
    8995
  • code/trunk/src/modules/weapons/projectiles/SimpleRocket.h

    r8706 r8738  
    3535#include "worldentities/ControllableEntity.h"
    3636#include "graphics/ParticleSpawner.h"
     37#include "interfaces/RadarViewable.h"
    3738
    3839#include "BasicProjectile.h"
     
    4849       Gabriel Nadler (Original file: Oli Scheuss)
    4950    */
    50     class _WeaponsExport SimpleRocket : public ControllableEntity, public BasicProjectile
     51    class _WeaponsExport SimpleRocket : public ControllableEntity, public BasicProjectile, public RadarViewable
    5152    {
    5253        public:
  • code/trunk/src/orxonox/interfaces/RadarViewable.cc

    r7163 r8738  
    5050        , radarObjectShape_(Dot)
    5151        , radarObjectDescription_("staticObject")
     52        , scale_(1.0f)
    5253    {
    5354        RegisterRootObject(RadarViewable);
  • code/trunk/src/orxonox/interfaces/RadarViewable.h

    r7163 r8738  
    113113        inline Shape getRadarObjectShape() const
    114114            { return this->radarObjectShape_; }
     115
     116        inline void setRadarObjectScale(float scale)
     117            {
     118                if(this->scale_ != scale)
     119                {
     120                    this->scale_ = scale;
     121                    this->settingsChanged();
     122                }
     123            }
     124        inline float getRadarObjectScale() const
     125            { return this->scale_; }
     126
    115127        void settingsChanged();
    116128
     
    139151        std::string radarObjectDescription_;
    140152        ColourValue radarObjectColour_;
    141 
     153        float scale_;
    142154    };
    143155}
Note: See TracChangeset for help on using the changeset viewer.