[Orxonox-commit 4774] r9443 - in code/branches/spaceNavigation: data/levels data/overlays src/modules/overlays/hud

mottetb at orxonox.net mottetb at orxonox.net
Mon Nov 12 16:37:08 CET 2012


Author: mottetb
Date: 2012-11-12 16:37:08 +0100 (Mon, 12 Nov 2012)
New Revision: 9443

Modified:
   code/branches/spaceNavigation/data/levels/missionOne.oxw
   code/branches/spaceNavigation/data/overlays/HUDTemplates3.oxo
   code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc
   code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.h
Log:
was fuer einen Fortschritt heute!

Modified: code/branches/spaceNavigation/data/levels/missionOne.oxw
===================================================================
--- code/branches/spaceNavigation/data/levels/missionOne.oxw	2012-11-12 15:21:51 UTC (rev 9442)
+++ code/branches/spaceNavigation/data/levels/missionOne.oxw	2012-11-12 15:37:08 UTC (rev 9443)
@@ -635,11 +635,11 @@
 
 <!-- @Objects: 2 pirates moving in squares, nonlethal -->
                 <SpaceShip position="0,2000,200" lookat="0,0,0" name="movingtarget" radarname="Pirate">
-                            <events>
+                            <!--events>
                                 <visibility>
                                     <EventListener event="boxtrigger4" />
                                 </visibility>
-                            </events>
+                            </events-->
                     <templates>
                       <Template link=spaceshippirate />
                     </templates>
@@ -656,11 +656,11 @@
                 </SpaceShip>
 
                 <SpaceShip position="0,2000,400" lookat="0,0,0" name="movingtarget" radarname="Pirate">
-                            <events>
+                            <!--events>
                                 <visibility>
                                     <EventListener event="boxtrigger4" />
                                 </visibility>
-                            </events>
+                            </events-->
                   <templates>
                     <Template link=spaceshippirate />
                   </templates>

Modified: code/branches/spaceNavigation/data/overlays/HUDTemplates3.oxo
===================================================================
--- code/branches/spaceNavigation/data/overlays/HUDTemplates3.oxo	2012-11-12 15:21:51 UTC (rev 9442)
+++ code/branches/spaceNavigation/data/overlays/HUDTemplates3.oxo	2012-11-12 15:37:08 UTC (rev 9443)
@@ -104,7 +104,7 @@
      font          = "Monofur"
      textsize      = 0.05
      navMarkerSize = 0.03
-     aimMarkerSize = 0.04
+     aimMarkerSize = 0.02
     />
 
     <HUDRadar

Modified: code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc	2012-11-12 15:21:51 UTC (rev 9442)
+++ code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc	2012-11-12 15:37:08 UTC (rev 9443)
@@ -70,7 +70,7 @@
         // Set default values
         this->setFont("Monofur");
         this->setTextSize(0.05f);
-        this->setNavMarkerSize(0.05f);
+        this->setNavMarkerSize(0.03f);
         this->setAimMarkerSize(0.02f);
 
         this->setDetectionLimit(10000.0f);
@@ -180,6 +180,7 @@
         unsigned int markerCount = 0;
         bool closeEnough = false; // only display objects that are close enough to be relevant for the player
 
+
         for (std::list<std::pair<RadarViewable*, unsigned int> >::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++markerCount, ++listIt)
         {
             std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.find(listIt->first);
@@ -226,7 +227,7 @@
                     pos.y = -pos.y;
                 }
                 else
-                outOfView = pos.x < -1.0 || pos.x > 1.0 || pos.y < -1.0 || pos.y > 1.0;
+                    outOfView = pos.x < -1.0 || pos.x > 1.0 || pos.y < -1.0 || pos.y > 1.0;
 
                 if (outOfView)
                 {
@@ -314,10 +315,10 @@
                     it->second.text_->setTop((-pos.y + 1.0f + it->second.panel_->getHeight()) * 0.5f);
 
                     // Target marker
-                    if(it->second.selected_)
+                    if(it->second.selected_ && it->first->getRVOrientedVelocity().squaredLength() != 0)
                     {
                         Vector3* targetPos = this->toAimPosition(it->first);
-                        Vector3 screenPos = camTransform * *targetPos;
+                        Vector3 screenPos = camTransform * (*targetPos);
                         // Check if the target marker is in view too
                         if(screenPos.z > 1 || screenPos.x < -1.0 || screenPos.x > 1.0
                                 || screenPos.y < -1.0 || screenPos.y > 1.0)
@@ -490,21 +491,22 @@
 
         // munSpeed*time = lengthBetween(wePosition, targetPosition + targetSpeed*time)
         // from this we extract:
-        float a = pow(targetSpeed.length(),2) - pow(this->currentMunitionSpeed_,2);
+        float a = targetSpeed.squaredLength() - this->currentMunitionSpeed_ * this->currentMunitionSpeed_;
         float b = 2*((targetPosition.x - wePosition.x)*targetSpeed.x
                     +(targetPosition.y - wePosition.y)*targetSpeed.y
                     +(targetPosition.z - wePosition.z)*targetSpeed.z);
-        float c = pow((targetPosition-wePosition).length(),2);
+        float c = (wePosition-targetPosition).squaredLength();
 
         // calculate smallest time solution, in case it exists
-        if(pow(b,2) - 4*a*c < 0)
+        float det = b * b - 4 * a * c;
+        if(det < 0)
             return NULL;
-        float time = (-b - sqrt(pow(b,2) - 4*a*c))/(2*a);
+        float time = (-b - sqrt(det))/(2*a);
         if(time < 0)
-            time = (-b + sqrt(pow(b,2) - 4*a*c))/(2*a);
+            time = (-b + sqrt(det))/(2*a);
         if(time < 0)
             return NULL;
-        Vector3* result = new Vector3(targetPosition + targetSpeed * time);
+        Vector3* result = new Vector3(targetPosition + time * targetSpeed);
         return result;
     }
 }

Modified: code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.h
===================================================================
--- code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.h	2012-11-12 15:21:51 UTC (rev 9442)
+++ code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.h	2012-11-12 15:37:08 UTC (rev 9443)
@@ -86,14 +86,14 @@
             // XMLPort accessors
             inline void setNavMarkerSize(float size)
             {
-                navMarkerSize_ = size;
+                this->navMarkerSize_ = size;
                 this->sizeChanged();
             }
             inline float getNavMarkerSize() const
                 { return navMarkerSize_; }
             inline void setAimMarkerSize(float size)
             {
-                aimMarkerSize_ = size;
+                this->aimMarkerSize_ = size;
                 this->sizeChanged();
             }
             inline float getAimMarkerSize() const




More information about the Orxonox-commit mailing list