Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 11, 2010, 11:34:20 AM (14 years ago)
Author:
rgrieder
Message:

Removed a ton of msvc warnings revealed with OGRE v1.7 (they removed the warning suppressors in OgrePrerequisites.h).
All of them are conversions from one type to another that might be lossy (mostly double to float, please always use "3.7f" instead of "3.7" as constants when using floats).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/controllers/NewHumanController.cc

    r6501 r6502  
    7474        RegisterObject(NewHumanController);
    7575
    76         overlaySize_ = 0.08;
    77         arrowsSize_ = 0.4;
    78 
    79         damageOverlayTime_ = 0.6;
     76        overlaySize_ = 0.08f;
     77        arrowsSize_ = 0.4f;
     78
     79        damageOverlayTime_ = 0.6f;
    8080
    8181        controlMode_ = 0;
     
    101101            centerOverlay_ = new OrxonoxOverlay(this);
    102102            centerOverlay_->setBackgroundMaterial("Orxonox/CenterOverlay");
    103             centerOverlay_->setSize(Vector2(overlaySize_ * 2.5, overlaySize_ * 2.5));
    104             centerOverlay_->setPosition(Vector2(0.5 - overlaySize_*2.5/2.0, 0.5 - overlaySize_*2.5/2.0));
     103            centerOverlay_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
     104            centerOverlay_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
    105105            centerOverlay_->hide();
    106106
     
    109109                damageOverlayTop_ = new OrxonoxOverlay(this);
    110110                damageOverlayTop_->setBackgroundMaterial("Orxonox/DamageOverlayTop");
    111                 damageOverlayTop_->setSize(Vector2(overlaySize_ * 2.5, overlaySize_ * 2.5));
    112                 damageOverlayTop_->setPosition(Vector2(0.5 - overlaySize_*2.5/2.0, 0.5 - overlaySize_*2.5/2.0));
     111                damageOverlayTop_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
     112                damageOverlayTop_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
    113113                damageOverlayTop_->hide();
    114114
    115115                damageOverlayRight_ = new OrxonoxOverlay(this);
    116116                damageOverlayRight_->setBackgroundMaterial("Orxonox/DamageOverlayRight");
    117                 damageOverlayRight_->setSize(Vector2(overlaySize_ * 2.5, overlaySize_ * 2.5));
    118                 damageOverlayRight_->setPosition(Vector2(0.5 - overlaySize_*2.5/2.0, 0.5 - overlaySize_*2.5/2.0));
     117                damageOverlayRight_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
     118                damageOverlayRight_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
    119119                damageOverlayRight_->hide();
    120120
    121121                damageOverlayBottom_ = new OrxonoxOverlay(this);
    122122                damageOverlayBottom_->setBackgroundMaterial("Orxonox/DamageOverlayBottom");
    123                 damageOverlayBottom_->setSize(Vector2(overlaySize_ * 2.5, overlaySize_ * 2.5));
    124                 damageOverlayBottom_->setPosition(Vector2(0.5 - overlaySize_*2.5/2.0, 0.5 - overlaySize_*2.5/2.0));
     123                damageOverlayBottom_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
     124                damageOverlayBottom_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
    125125                damageOverlayBottom_->hide();
    126126
    127127                damageOverlayLeft_ = new OrxonoxOverlay(this);
    128128                damageOverlayLeft_->setBackgroundMaterial("Orxonox/DamageOverlayLeft");
    129                 damageOverlayLeft_->setSize(Vector2(overlaySize_ * 2.5, overlaySize_ * 2.5));
    130                 damageOverlayLeft_->setPosition(Vector2(0.5 - overlaySize_*2.5/2.0, 0.5 - overlaySize_*2.5/2.0));
     129                damageOverlayLeft_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
     130                damageOverlayLeft_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
    131131                damageOverlayLeft_->hide();
    132132            }
     
    136136                arrowsOverlay1_ = new OrxonoxOverlay(this);
    137137                arrowsOverlay1_->setBackgroundMaterial("Orxonox/DirectionArrows1");
    138                 arrowsOverlay1_->setSize(Vector2(0.02727, 0.36 * arrowsSize_));
    139                 arrowsOverlay1_->setPickPoint(Vector2(0.5, 0.5));
    140                 arrowsOverlay1_->setPosition(Vector2(0.5, 0.5));
     138                arrowsOverlay1_->setSize(Vector2(0.02727f, 0.36f * arrowsSize_));
     139                arrowsOverlay1_->setPickPoint(Vector2(0.5f, 0.5f));
     140                arrowsOverlay1_->setPosition(Vector2(0.5f, 0.5f));
    141141                arrowsOverlay1_->hide();
    142142
    143143                arrowsOverlay2_ = new OrxonoxOverlay(this);
    144144                arrowsOverlay2_->setBackgroundMaterial("Orxonox/DirectionArrows2");
    145                 arrowsOverlay2_->setSize(Vector2(0.02727, 0.59 * arrowsSize_));
    146                 arrowsOverlay2_->setPickPoint(Vector2(0.5, 0.5));
    147                 arrowsOverlay2_->setPosition(Vector2(0.5, 0.5));
     145                arrowsOverlay2_->setSize(Vector2(0.02727f, 0.59f * arrowsSize_));
     146                arrowsOverlay2_->setPickPoint(Vector2(0.5f, 0.5f));
     147                arrowsOverlay2_->setPosition(Vector2(0.5f, 0.5f));
    148148                arrowsOverlay2_->hide();
    149149
    150150                arrowsOverlay3_ = new OrxonoxOverlay(this);
    151151                arrowsOverlay3_->setBackgroundMaterial("Orxonox/DirectionArrows3");
    152                 arrowsOverlay3_->setSize(Vector2(0.02727, 0.77 * arrowsSize_));
    153                 arrowsOverlay3_->setPickPoint(Vector2(0.5, 0.5));
    154                 arrowsOverlay3_->setPosition(Vector2(0.5, 0.5));
     152                arrowsOverlay3_->setSize(Vector2(0.02727f, 0.77f * arrowsSize_));
     153                arrowsOverlay3_->setPickPoint(Vector2(0.5f, 0.5f));
     154                arrowsOverlay3_->setPosition(Vector2(0.5f, 0.5f));
    155155                arrowsOverlay3_->hide();
    156156
    157157                arrowsOverlay4_ = new OrxonoxOverlay(this);
    158158                arrowsOverlay4_->setBackgroundMaterial("Orxonox/DirectionArrows4");
    159                 arrowsOverlay4_->setSize(Vector2(0.02727, arrowsSize_));
    160                 arrowsOverlay4_->setPickPoint(Vector2(0.5, 0.5));
    161                 arrowsOverlay4_->setPosition(Vector2(0.5, 0.5));
     159                arrowsOverlay4_->setSize(Vector2(0.02727f, arrowsSize_));
     160                arrowsOverlay4_->setPickPoint(Vector2(0.5f, 0.5f));
     161                arrowsOverlay4_->setPosition(Vector2(0.5f, 0.5f));
    162162                arrowsOverlay4_->hide();
    163163            }
     
    213213                        this->showOverlays();
    214214
    215                     this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5-overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5-overlaySize_/2));
     215                    this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5f-overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5f-overlaySize_/2));
    216216
    217217                    if (this->controlMode_ == 0 || (this->controlMode_ == 1 && this->firemode_ == 1))
     
    299299            relativeHit.normalise();
    300300
    301             float threshold = 0.3;
     301            float threshold = 0.3f;
    302302            if (relativeHit.x > threshold) // Left
    303303            {
     
    343343        Ogre::RaySceneQuery * rsq = HumanController::localController_s->getControllableEntity()->getScene()->getSceneManager()->createRayQuery(Ogre::Ray());
    344344
    345         Ogre::Ray mouseRay = HumanController::localController_s->getControllableEntity()->getCamera()->getOgreCamera()->getCameraToViewportRay(static_cast<float>(this->currentYaw_)/2*-1+.5, static_cast<float>(this->currentPitch_)/2*-1+.5);
     345        Ogre::Ray mouseRay = HumanController::localController_s->getControllableEntity()->getCamera()->getOgreCamera()->getCameraToViewportRay(static_cast<float>(this->currentYaw_)/2*-1+.5f, static_cast<float>(this->currentPitch_)/2*-1+.5f);
    346346
    347347        rsq->setRay(mouseRay);
     
    505505            float distance = sqrt(pow(static_cast<float>(this->currentYaw_)/2*-1,2) + pow(static_cast<float>(this->currentPitch_)/2*-1,2));
    506506
    507             if (distance > 0.04 && distance <= 0.59 * arrowsSize_ / 2.0 )
    508             {
    509                 this->arrowsOverlay1_->setRotation(Degree(-90 + -1.0 * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f));
     507            if (distance > 0.04f && distance <= 0.59f * arrowsSize_ / 2.0f )
     508            {
     509                this->arrowsOverlay1_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f));
    510510                this->arrowsOverlay1_->show();
    511511            }
    512             else if (distance > 0.59 * arrowsSize_ / 2.0 && distance <= 0.77 * arrowsSize_ / 2.0 )
    513             {
    514                 this->arrowsOverlay2_->setRotation(Degree(-90 + -1.0 * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f));
     512            else if (distance > 0.59f * arrowsSize_ / 2.0f && distance <= 0.77f * arrowsSize_ / 2.0f )
     513            {
     514                this->arrowsOverlay2_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f));
    515515                this->arrowsOverlay2_->show();
    516516            }
    517             else if (distance > 0.77 * arrowsSize_ / 2.0 && distance <= arrowsSize_ / 2.0)
    518             {
    519                 this->arrowsOverlay3_->setRotation(Degree(-90 + -1.0 * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f));
     517            else if (distance > 0.77f * arrowsSize_ / 2.0f && distance <= arrowsSize_ / 2.0f)
     518            {
     519                this->arrowsOverlay3_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f));
    520520                this->arrowsOverlay3_->show();
    521521            }
    522             else if (distance > arrowsSize_ / 2.0)
    523             {
    524                 this->arrowsOverlay4_->setRotation(Degree(-90 + -1.0 * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f));
     522            else if (distance > arrowsSize_ / 2.0f)
     523            {
     524                this->arrowsOverlay4_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f));
    525525                this->arrowsOverlay4_->show();
    526526            }
Note: See TracChangeset for help on using the changeset viewer.