Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 12, 2012, 4:37:08 PM (12 years ago)
Author:
mottetb
Message:

was fuer einen Fortschritt heute!

Location:
code/branches/spaceNavigation/src/modules/overlays/hud
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc

    r9434 r9443  
    7171        this->setFont("Monofur");
    7272        this->setTextSize(0.05f);
    73         this->setNavMarkerSize(0.05f);
     73        this->setNavMarkerSize(0.03f);
    7474        this->setAimMarkerSize(0.02f);
    7575
     
    180180        unsigned int markerCount = 0;
    181181        bool closeEnough = false; // only display objects that are close enough to be relevant for the player
     182
    182183
    183184        for (std::list<std::pair<RadarViewable*, unsigned int> >::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++markerCount, ++listIt)
     
    227228                }
    228229                else
    229                 outOfView = pos.x < -1.0 || pos.x > 1.0 || pos.y < -1.0 || pos.y > 1.0;
     230                    outOfView = pos.x < -1.0 || pos.x > 1.0 || pos.y < -1.0 || pos.y > 1.0;
    230231
    231232                if (outOfView)
     
    315316
    316317                    // Target marker
    317                     if(it->second.selected_)
     318                    if(it->second.selected_ && it->first->getRVOrientedVelocity().squaredLength() != 0)
    318319                    {
    319320                        Vector3* targetPos = this->toAimPosition(it->first);
    320                         Vector3 screenPos = camTransform * *targetPos;
     321                        Vector3 screenPos = camTransform * (*targetPos);
    321322                        // Check if the target marker is in view too
    322323                        if(screenPos.z > 1 || screenPos.x < -1.0 || screenPos.x > 1.0
     
    491492        // munSpeed*time = lengthBetween(wePosition, targetPosition + targetSpeed*time)
    492493        // from this we extract:
    493         float a = pow(targetSpeed.length(),2) - pow(this->currentMunitionSpeed_,2);
     494        float a = targetSpeed.squaredLength() - this->currentMunitionSpeed_ * this->currentMunitionSpeed_;
    494495        float b = 2*((targetPosition.x - wePosition.x)*targetSpeed.x
    495496                    +(targetPosition.y - wePosition.y)*targetSpeed.y
    496497                    +(targetPosition.z - wePosition.z)*targetSpeed.z);
    497         float c = pow((targetPosition-wePosition).length(),2);
     498        float c = (wePosition-targetPosition).squaredLength();
    498499
    499500        // calculate smallest time solution, in case it exists
    500         if(pow(b,2) - 4*a*c < 0)
     501        float det = b * b - 4 * a * c;
     502        if(det < 0)
    501503            return NULL;
    502         float time = (-b - sqrt(pow(b,2) - 4*a*c))/(2*a);
     504        float time = (-b - sqrt(det))/(2*a);
    503505        if(time < 0)
    504             time = (-b + sqrt(pow(b,2) - 4*a*c))/(2*a);
     506            time = (-b + sqrt(det))/(2*a);
    505507        if(time < 0)
    506508            return NULL;
    507         Vector3* result = new Vector3(targetPosition + targetSpeed * time);
     509        Vector3* result = new Vector3(targetPosition + time * targetSpeed);
    508510        return result;
    509511    }
  • code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.h

    r9434 r9443  
    8787            inline void setNavMarkerSize(float size)
    8888            {
    89                 navMarkerSize_ = size;
     89                this->navMarkerSize_ = size;
    9090                this->sizeChanged();
    9191            }
     
    9494            inline void setAimMarkerSize(float size)
    9595            {
    96                 aimMarkerSize_ = size;
     96                this->aimMarkerSize_ = size;
    9797                this->sizeChanged();
    9898            }
Note: See TracChangeset for help on using the changeset viewer.