[Orxonox-commit 5241] r9904 - in code/branches/presentationHS13: . data/gui/scripts data/levels data/overlays src/libraries/util src/modules/overlays/hud

smerkli at orxonox.net smerkli at orxonox.net
Mon Dec 16 14:00:00 CET 2013


Author: smerkli
Date: 2013-12-16 14:00:00 +0100 (Mon, 16 Dec 2013)
New Revision: 9904

Added:
   code/branches/presentationHS13/data/levels/radar3D_test.oxw
Modified:
   code/branches/presentationHS13/
   code/branches/presentationHS13/data/gui/scripts/MiscConfigMenu.lua
   code/branches/presentationHS13/data/overlays/HUD.oxo
   code/branches/presentationHS13/data/overlays/HUDTemplates3.oxo
   code/branches/presentationHS13/src/libraries/util/Math.cc
   code/branches/presentationHS13/src/libraries/util/Math.h
   code/branches/presentationHS13/src/modules/overlays/hud/HUDNavigation.cc
   code/branches/presentationHS13/src/modules/overlays/hud/HUDRadar.cc
   code/branches/presentationHS13/src/modules/overlays/hud/HUDRadar.h
Log:
Merged branch radarDreiD into presentationbranch



Property changes on: code/branches/presentationHS13
___________________________________________________________________
Modified: svn:mergeinfo
   - /code/branches/Racingbot:9388-9513
/code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/core6:9552-9666
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/formationupdate:9580-9624
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/invaders:9694-9896
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/largeShip1:9384-9515
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/libs:9668-9674
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/newlevel2012:9033-9244
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup2012:9029-9189
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation2012merge:9266-9347
/code/branches/presentation3:6913-7162
/code/branches/presentationHS12:9481-9525
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceNavigation:9381-9497
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/steering:5949-6091,8140-8595
/code/branches/surfaceRace:9028-9199
/code/branches/testing:9015-9549
/code/branches/tetris:8100-8563
/code/branches/turret:9380-9501
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
   + /code/branches/Racingbot:9388-9513
/code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/core6:9552-9666
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/formationupdate:9580-9624
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/invaders:9694-9896
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/largeShip1:9384-9515
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/libs:9668-9674
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/newlevel2012:9033-9244
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup2012:9029-9189
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation2012merge:9266-9347
/code/branches/presentation3:6913-7162
/code/branches/presentationHS12:9481-9525
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/radarDreiD:9690-9901
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceNavigation:9381-9497
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/steering:5949-6091,8140-8595
/code/branches/surfaceRace:9028-9199
/code/branches/testing:9015-9549
/code/branches/tetris:8100-8563
/code/branches/turret:9380-9501
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890

Modified: code/branches/presentationHS13/data/gui/scripts/MiscConfigMenu.lua
===================================================================
--- code/branches/presentationHS13/data/gui/scripts/MiscConfigMenu.lua	2013-12-16 12:58:35 UTC (rev 9903)
+++ code/branches/presentationHS13/data/gui/scripts/MiscConfigMenu.lua	2013-12-16 13:00:00 UTC (rev 9904)
@@ -37,6 +37,7 @@
     table.insert(P.commandList, "Core bDevMode_")
     table.insert(P.commandList, "HUDNavigation MarkerLimit_")
     table.insert(P.commandList, "HUDNavigation showDistance")
+    table.insert(P.commandList, "HUDRadar RadarMode_")
 
     P.nameList = {}
     table.insert(P.nameList, "Mouse sensitivity")
@@ -59,6 +60,7 @@
     table.insert(P.nameList, "Developer's Mode")
     table.insert(P.nameList, "Marker Limit")
     table.insert(P.nameList, "Show Distance next to cursor")
+    table.insert(P.nameList, "Set Radar on 3D mode")
 
     P.linesList = {}
 

Copied: code/branches/presentationHS13/data/levels/radar3D_test.oxw (from rev 9901, code/branches/radarDreiD/data/levels/radar3D_test.oxw)
===================================================================
--- code/branches/presentationHS13/data/levels/radar3D_test.oxw	                        (rev 0)
+++ code/branches/presentationHS13/data/levels/radar3D_test.oxw	2013-12-16 13:00:00 UTC (rev 9904)
@@ -0,0 +1,77 @@
+<LevelInfo
+ name = "radar3D_test"
+ description = "A level with absolutely nothing in it."
+ tags = "test"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+  include("stats.oxo")
+  include("HUDTemplates3.oxo")
+  include("templates/lodInformation.oxt")
+?>
+
+<?lua
+  include("templates/spaceshipAssff2.oxt")
+  include("templates/spaceshipPirate.oxt")
+  include("templates/spaceshipEscort.oxt")
+?>
+
+<Level
+  gametype     = "Mission"
+>
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
+  <?lua include("includes/notifications.oxi") ?>
+
+  <Scene
+    ambientlight = "0.8, 0.8, 0.8"
+    skybox       = "Orxonox/Starbox"
+  >
+
+    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+    <SpawnPoint team=0 position="-500,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+    
+
+
+	<Pawn team=0 health=30 position="0,0,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box radarname = "0,0,0" >
+      		<attached>
+        	    <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+        	</attached>
+        	<collisionShapes>
+        	    <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+        	</collisionShapes>
+    	</Pawn>
+
+	<Pawn team=1 health=30 position="0,1000,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box radarname = "0,1000,0" >
+		<attached>
+	            <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+	        </attached>
+	        <collisionShapes>
+	            <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+	        </collisionShapes>
+    	</Pawn>
+
+
+	<Pawn team=2 health=30 position="0,0,1000" direction="0,-1,0" collisionType=dynamic mass=100000 name=box radarname = "0,0,1000" >
+		<attached>
+	            <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+	        </attached>
+	        <collisionShapes>
+	            <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+	        </collisionShapes>
+    	</Pawn>
+
+	<Pawn team=3 health=30 position="1000,0,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box radarname = "1000,0,0" >
+		<attached>
+	            <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+	        </attached>
+	        <collisionShapes>
+	            <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+	        </collisionShapes>
+    	</Pawn>
+
+  </Scene>
+</Level>
+

Modified: code/branches/presentationHS13/data/overlays/HUD.oxo
===================================================================
--- code/branches/presentationHS13/data/overlays/HUD.oxo	2013-12-16 12:58:35 UTC (rev 9903)
+++ code/branches/presentationHS13/data/overlays/HUD.oxo	2013-12-16 13:00:00 UTC (rev 9904)
@@ -67,7 +67,7 @@
 
   <HUDRadar
    name          = "Radar"
-   background    = "Orxonox/Radar"
+   background    = "Orxonox/radar"
    correctAspect = true
    size          = "0.17, 0.17"
    position      = "0.5, 1.0"

Modified: code/branches/presentationHS13/data/overlays/HUDTemplates3.oxo
===================================================================
--- code/branches/presentationHS13/data/overlays/HUDTemplates3.oxo	2013-12-16 12:58:35 UTC (rev 9903)
+++ code/branches/presentationHS13/data/overlays/HUDTemplates3.oxo	2013-12-16 13:00:00 UTC (rev 9904)
@@ -107,19 +107,26 @@
      aimMarkerSize = 0.02
     />
 
-    <HUDRadar
-     name          = "Radar"
-     background    = "Orxonox/Radar"
-     correctaspect = true
-     size          = "0.17, 0.17"
-     position      = "1.0, 1.0"
-     pickpoint     = "1.0, 1.0"
-     rotation      = 0
-     sensitivity   = 1.0
-     halfDotSizeDistance = 3000
-     maximumDotSize      = 0.1
+	<HUDRadar
+     name          			= "Radar"
+     background    			= "Orxonox/Radar3D"
+     material2D    			= "Orxonox/Radar"
+     material3DMiddle   	= "Orxonox/Radar3D"
+     material3DFront		= "Orxonox/Radar3DFront"
+     material3DBack			= "Orxonox/Radar3DBack"
+     correctaspect 			= true
+     size          			= "0.17, 0.17"
+     position      			= "1.0, 1.0"
+     pickpoint     			= "1.0, 1.0"
+     rotation      			= 0
+     sensitivity   			= 1.0
+     halfDotSizeDistance 	= 3000
+     detectionLimit 		= 10000.0
+     maximumDotSize 		= 0.1
+     maximumDotSize3D      	= 0.06
+     mapAngle3D   			= 0.6435011
     />
-
+    
     <HUDTimer
      name     = "Timer"
      position = "0.5, 0.85"

Modified: code/branches/presentationHS13/src/libraries/util/Math.cc
===================================================================
--- code/branches/presentationHS13/src/libraries/util/Math.cc	2013-12-16 12:58:35 UTC (rev 9903)
+++ code/branches/presentationHS13/src/libraries/util/Math.cc	2013-12-16 13:00:00 UTC (rev 9904)
@@ -22,7 +22,7 @@
  *   Author:
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Wolfgang Roenninger
  *
  */
 
@@ -146,7 +146,7 @@
     }
 
     /**
-        @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0° = 0, 180° = 1).
+        @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0� = 0, 180� = 1).
         @param myposition My position
         @param mydirection My viewing direction
         @param myorthonormal My orthonormalvector (pointing upwards through my head)
@@ -190,7 +190,155 @@
             return orxonox::Vector2( -sin_value * radius, cos_value * radius);
     }
 
+
     /**
+            @brief Gets the 2D project vector for the 3D Radar .
+            @param myposition My position
+            @param mydirection My viewing direction
+            @param myorthonormal My orthonormalvector (pointing upwards through my head)
+            @param otherposition The position of the other object
+            @param mapangle The angle between line of sight on screen and the 3Dmap-x/z-plain in radian
+            @param detectionlimit The limit in which objects are shown on the map
+            @return The viewing direction
+    */
+    orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit)
+    {
+    	// Orxonox Vectors: x_direction you are looking, y_direction points up, z_direction points to the right
+    	orxonox::Vector3 distance = otherposition - myposition;	// get vector from Ship to object
+
+    	// new coordinate system:	x_axsis:	mydirection		(points front)
+    	//							y_axsis:	myorthonormal	(points up)
+    	//							z_axsis:	myside			(points right)
+
+    	orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get 3. base vector
+
+    	distance = 4*distance / detectionlimit; // shrink vector on map
+    	if(distance.length() > 1.0f) // if object would wander outside of the map
+    	    	{
+    	    	distance = distance / distance.length();
+    	   		}
+
+    	// perform a coordinate transformation to get distance in relation of the position of the ship
+    	orxonox::Vector3 distanceShip = getTransformedVector(distance, mydirection, myorthonormal, myside);
+
+    	// calculate 2D vector on the map (with angle between x/z - plain and line of sight)
+    	float xcoordinate = distanceShip.z; // z; cause x direction on screen is to the right side
+    	float ycoordinate = distanceShip.x*sin(mapangle)+distanceShip.y*cos(mapangle);
+    	return orxonox::Vector2(xcoordinate , ycoordinate);
+    }
+
+    /**
+               @brief Gets if a object is over the x/z - plain on map
+               @param myposition My position
+               @param mydirection My viewing direction
+               @param myorthonormal My orthonormalvector (pointing upwards through my head)
+               @param otherposition The position of the other object
+               @param mapangle The angle you look on the 3Dmap in radian
+               @return If distancevector to the other object has a positive y-coordinate
+
+               Examples:
+                Returns true if object is over x/z - plain
+                Returns false if object is below x/z -plain
+    */
+    bool isObjectHigherThanShipOnMap(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle)
+    {
+    	// Orxonox Vectors: x_direction you are looking, y_direction points up, z_direction points to the right
+    	orxonox::Vector3 distance = otherposition - myposition;
+
+    	// new coordinate system:	x_axsis:	mydirection		(points front)
+    	//							y_axsis:	myorthonormal	(points up)
+       	//							z_axsis:	myside			(points right)
+
+       	orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get vector from Ship to object
+
+
+       	// perform a coordinate transformation to get distance in relation of the position of the ship
+       	orxonox::Vector3 distanceShip = getTransformedVector(distance, mydirection, myorthonormal, myside);
+
+       	if(distanceShip.y >= 0)
+       		return true;
+       	else
+       		return false;
+    }
+
+    /**
+                   @brief A value between 0 and 10, in order how other object is in front or in back
+                   @param myposition My position
+               	   @param mydirection My viewing direction
+               	   @param myorthonormal My orthonormalvector (pointing upwards through my head)
+               	   @param otherposition The position of the other object
+               	   @param detectionlimit The limit in which objects are shown on the map
+                   @return value between 0 and 100
+    */
+    int determineMap3DZOrder(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float detectionlimit)
+    {
+    	orxonox::Vector3 distance = otherposition - myposition;	// get vector from Ship to object
+    	orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); 	// get vector to the side
+
+    	distance = 4*distance / detectionlimit; // shrink vector on map
+    	if(distance.length() > 1.0f) // if object would wander outside of the map
+    	{
+    		distance = distance / distance.length();
+    	}
+
+    	// perform a coordinate transformation to get distance in relation of the position of the ship
+       	orxonox::Vector3 distanceShip = getTransformedVector(distance, mydirection, myorthonormal, myside);
+
+       	return (int) 50 - 100*distanceShip.x;
+    }
+
+
+    /**
+                @brief Gets the new vector after a coordinate transformation
+                @param distance Vector which will be transformed
+                @param mydirection New x basevector
+                @param myorthonormal New y basevector
+                @param otherposition New z basevector
+                @return direction in the new coordinates
+
+                x is vector in old coordinates
+                y is vector in old coordinates
+                T is transform matrix with:
+                	T = (t1 , t2 , t3)
+                	t1 = mydirection
+                	t2 = myorthonormal
+                	t3 = myside
+
+                y = T^(-1)*x
+            */
+    orxonox::Vector3 getTransformedVector(const orxonox::Vector3& distance, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& myside)
+    {
+    	// inverse of the transform matrix
+    	float determinant = +mydirection.x * (myorthonormal.y*myside.z - myside.y*myorthonormal.z)
+    						-mydirection.y * (myorthonormal.x*myside.z - myorthonormal.z*myside.x)
+    						+mydirection.z * (myorthonormal.x*myside.y - myorthonormal.y*myside.x);
+    	float invdet = 1/determinant;
+
+    	// transform matrix
+    	orxonox::Vector3 xinvtransform;
+    	orxonox::Vector3 yinvtransform;
+    	orxonox::Vector3 zinvtransform;
+
+    	xinvtransform.x = (myorthonormal.y * myside.z        - myside.y        * myorthonormal.z)*invdet;
+    	xinvtransform.y = (mydirection.z   * myside.y        - mydirection.y   * myside.z       )*invdet;
+    	xinvtransform.z = (mydirection.y   * myorthonormal.z - mydirection.z   * myorthonormal.y)*invdet;
+    	yinvtransform.x = (myorthonormal.z * myside.x        - myorthonormal.x * myside.z       )*invdet;
+    	yinvtransform.y = (mydirection.x   * myside.z        - mydirection.z   * myside.x       )*invdet;
+    	yinvtransform.z = (myorthonormal.x * mydirection.z   - mydirection.x   * myorthonormal.z)*invdet;
+    	zinvtransform.x = (myorthonormal.x * myside.y        - myside.x        * myorthonormal.y)*invdet;
+    	zinvtransform.y = (myside.x        * mydirection.y   - mydirection.x   * myside.y       )*invdet;
+    	zinvtransform.z = (mydirection.x   * myorthonormal.y - myorthonormal.x * mydirection.y  )*invdet;
+
+    	// coordinate transformation
+    	orxonox::Vector3 distanceShip;
+    	distanceShip.x = xinvtransform.x * distance.x + yinvtransform.x * distance.y + zinvtransform.x * distance.z;
+    	distanceShip.y = xinvtransform.y * distance.x + yinvtransform.y * distance.y + zinvtransform.y * distance.z;
+    	distanceShip.z = xinvtransform.z * distance.x + yinvtransform.z * distance.y + zinvtransform.z * distance.z;
+
+    	return distanceShip;
+    }
+
+    /**
         @brief Returns the predicted position I have to aim at, if I want to hit a moving target with a moving projectile.
         @param myposition My position
         @param projectilespeed The speed of my projectile

Modified: code/branches/presentationHS13/src/libraries/util/Math.h
===================================================================
--- code/branches/presentationHS13/src/libraries/util/Math.h	2013-12-16 12:58:35 UTC (rev 9903)
+++ code/branches/presentationHS13/src/libraries/util/Math.h	2013-12-16 13:00:00 UTC (rev 9904)
@@ -22,7 +22,7 @@
  *   Author:
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Wolfgang Roenninger
  *
  */
 
@@ -91,6 +91,10 @@
     _UtilExport float getAngle(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition);
     _UtilExport orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
     _UtilExport orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
+    _UtilExport orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit);
+    _UtilExport bool isObjectHigherThanShipOnMap(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle);
+    _UtilExport int determineMap3DZOrder(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float detectionlimit);
+    _UtilExport orxonox::Vector3 getTransformedVector(const orxonox::Vector3& distance, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& myside);
     _UtilExport orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity);
 
     /**

Modified: code/branches/presentationHS13/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/presentationHS13/src/modules/overlays/hud/HUDNavigation.cc	2013-12-16 12:58:35 UTC (rev 9903)
+++ code/branches/presentationHS13/src/modules/overlays/hud/HUDNavigation.cc	2013-12-16 13:00:00 UTC (rev 9904)
@@ -73,8 +73,8 @@
     HUDNavigation::HUDNavigation(Context* context) :
         OrxonoxOverlay(context)
     {
-        RegisterObject(HUDNavigation)
-;        this->setConfigValues();
+        RegisterObject(HUDNavigation);
+        this->setConfigValues();
 
         // Set default values
         this->setFont("Monofur");

Modified: code/branches/presentationHS13/src/modules/overlays/hud/HUDRadar.cc
===================================================================
--- code/branches/presentationHS13/src/modules/overlays/hud/HUDRadar.cc	2013-12-16 12:58:35 UTC (rev 9903)
+++ code/branches/presentationHS13/src/modules/overlays/hud/HUDRadar.cc	2013-12-16 13:00:00 UTC (rev 9904)
@@ -24,6 +24,7 @@
  *      Felix Schulthess
  *   Co-authors:
  *      Reto Grieder
+ *      Wolfgang Roenninger
  *
  */
 
@@ -40,6 +41,7 @@
 #include "worldentities/ControllableEntity.h"
 #include "Scene.h"
 #include "Radar.h"
+#include "core/config/ConfigValueIncludes.h"
 
 namespace orxonox
 {
@@ -49,6 +51,7 @@
         : OrxonoxOverlay(context)
     {
         RegisterObject(HUDRadar);
+        this->setConfigValues();
 
         this->marker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
             .createOverlayElement("Panel", "HUDRadar_marker_" + getUniqueNumberString()));
@@ -59,12 +62,25 @@
         this->setRadarSensitivity(1.0f);
         this->setHalfDotSizeDistance(3000.0f);
         this->setMaximumDotSize(0.1f);
+        this->setMaximumDotSize3D(0.07f);
 
         this->shapeMaterials_[RadarViewable::Dot]      = "RadarDot.png";
         this->shapeMaterials_[RadarViewable::Triangle] = "RadarTriangle.png";
         this->shapeMaterials_[RadarViewable::Square]   = "RadarSquare.png";
-        this->setDetectionLimit( 10000.0f );
         this->owner_ = 0;
+
+        this->map3DFront_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
+        	.createOverlayElement("Panel", "HUDRadar_mapDreiDFront_" + getUniqueNumberString()));
+        this->map3DFront_->setMaterialName("Orxonox/Radar3DFront");
+        this->overlay_->add2D(this->map3DFront_);
+        this->map3DFront_->hide();
+
+        this->map3DBack_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
+        	.createOverlayElement("Panel", "HUDRadar_mapDreiDBack_" + getUniqueNumberString()));
+        this->map3DBack_->setMaterialName("Orxonox/Radar3DBack");
+        this->overlay_->add2D(this->map3DBack_);
+        this->map3DBack_->hide();
+
     }
 
     HUDRadar::~HUDRadar()
@@ -72,6 +88,9 @@
         if (this->isInitialized())
         {
             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->marker_);
+            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DFront_);
+            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DBack_);
+
             for (std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it = this->radarObjects_.begin();
                 it != this->radarObjects_.end(); ++it)
             {
@@ -80,6 +99,13 @@
         }
     }
 
+
+
+    void HUDRadar::setConfigValues()
+       {
+           SetConfigValue(RadarMode_, true);
+       }
+
     void HUDRadar::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
         SUPER(HUDRadar, XMLPort, xmlelement, mode);
@@ -87,6 +113,13 @@
         XMLPortParam(HUDRadar, "sensitivity", setRadarSensitivity, getRadarSensitivity, xmlelement, mode);
         XMLPortParam(HUDRadar, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, xmlelement, mode);
         XMLPortParam(HUDRadar, "maximumDotSize", setMaximumDotSize, getMaximumDotSize, xmlelement, mode);
+        XMLPortParam(HUDRadar, "maximumDotSize3D", setMaximumDotSize3D, getMaximumDotSize3D, xmlelement, mode);
+        XMLPortParam(HUDRadar, "material2D", set2DMaterial, get2DMaterial, xmlelement, mode);
+        XMLPortParam(HUDRadar, "material3DMiddle", set3DMaterial, get3DMaterial, xmlelement, mode);
+        XMLPortParam(HUDRadar, "material3DFront", set3DMaterialFront, get3DMaterialFront, xmlelement, mode);
+        XMLPortParam(HUDRadar, "material3DBack", set3DMaterialBack, get3DMaterialBack, xmlelement, mode);
+        XMLPortParam(HUDRadar, "mapAngle3D", setMapAngle, getMapAngle, xmlelement, mode);
+        XMLPortParam(HUDRadar, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode);
     }
 
     void HUDRadar::addObject(RadarViewable* object)
@@ -151,6 +184,23 @@
 
         // update the distances for all objects
         std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it;
+
+
+        if(RadarMode_)
+        {
+        	this->setBackgroundMaterial(material3D_);
+        	this->map3DFront_->_notifyZOrder(this->overlay_->getZOrder() * 100 + 250); // it seems that the ZOrder of overlayelements is 100 times the ZOrder of the overlay
+        	this->map3DBack_->_notifyZOrder(this->overlay_->getZOrder() * 100 - 250); // 250 a little bit buffer so that the two shels are displayed all in the front / in the back
+        	this->map3DFront_->show();
+        	this->map3DBack_->show();
+        }
+        else
+        {
+        	this->setBackgroundMaterial(material2D_);
+        	this->map3DFront_->hide();
+        	this->map3DBack_->hide();
+        }
+
         for( it = this->radarObjects_.begin(); it != this->radarObjects_.end(); ++it )
         {
             // Make sure the object really is a WorldEntity
@@ -164,13 +214,36 @@
             // set size to fit distance...
             float distance = (wePointer->getWorldPosition() - this->owner_->getPosition()).length();
             // calculate the size with 1/distance dependency for simplicity (instead of exp(-distance * lambda)
-            float size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
+
+            float size;
+            if(RadarMode_)
+            	size = maximumDotSize3D_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
+            else
+            	size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
             it->second->setDimensions(size, size);
 
             // calc position on radar...
-            Vector2 coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition());
+            Vector2 coord;
+
+            if(RadarMode_)
+            {
+            	coord = get3DProjection(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), 0.6435011, detectionLimit_);
+
+            	// set zOrder on screen
+            	bool overXZPlain = isObjectHigherThanShipOnMap(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), this->mapAngle_);
+
+            	int zOrder = determineMap3DZOrder(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), detectionLimit_);
+            	if(overXZPlain == false /*&& (it->second->getZOrder() >  100 * this->overlay_->getZOrder())*/) // it appears that zOrder of attached Overlayelements is 100 times the zOrder of the Overlay
+            		it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 - 70 + zOrder);
+            	if(overXZPlain == true /*&& (it->second->getZOrder() <= 100 * this->overlay_->getZOrder())*/)
+            		it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 + 70 + zOrder);
+            }
+            else
+            	coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition());
+
             coord *= math::pi / 3.5f; // small adjustment to make it fit the texture
             it->second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f);
+
             if( distance < detectionLimit_ || detectionLimit_ < 0 )
                 it->second->show();
             else
@@ -181,6 +254,8 @@
             {
                 this->marker_->setDimensions(size * 1.5f, size * 1.5f);
                 this->marker_->setPosition((1.0f + coord.x - size * 1.5f) * 0.5f, (1.0f - coord.y - size * 1.5f) * 0.5f);
+                if(RadarMode_)
+                	this->marker_->_notifyZOrder(it->second->getZOrder() -1);
                 this->marker_->show();
             }
         }

Modified: code/branches/presentationHS13/src/modules/overlays/hud/HUDRadar.h
===================================================================
--- code/branches/presentationHS13/src/modules/overlays/hud/HUDRadar.h	2013-12-16 12:58:35 UTC (rev 9903)
+++ code/branches/presentationHS13/src/modules/overlays/hud/HUDRadar.h	2013-12-16 13:00:00 UTC (rev 9904)
@@ -34,6 +34,7 @@
 
 #include <map>
 #include <vector>
+#include <string>
 
 #include "util/OgreForwardRefs.h"
 #include "interfaces/RadarListener.h"
@@ -50,24 +51,42 @@
 
         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
         virtual void changedOwner();
+        void setConfigValues();
 
     private:
         // XML accessors
         float getHalfDotSizeDistance() const { return this->halfDotSizeDistance_; }
         void setHalfDotSizeDistance(float distance) { this->halfDotSizeDistance_ = distance; }
 
-        void setDetectionLimit( float limit )
-        { this->detectionLimit_ = limit; }
-        float getDetectionLimit() const
-        { return this->detectionLimit_; }
+        void setDetectionLimit( float limit ) { this->detectionLimit_ = limit; }
+        float getDetectionLimit() const { return this->detectionLimit_; }
 
         float getMaximumDotSize() const { return this->maximumDotSize_; }
         void setMaximumDotSize(float size) { this->maximumDotSize_ = size; }
 
+        float getMaximumDotSize3D() const { return this->maximumDotSize3D_; }
+        void setMaximumDotSize3D(float size) { this->maximumDotSize3D_ = size;}
+
+        std::string get2DMaterial() const {return this->material2D_; }
+        void set2DMaterial(std::string material2D) { this->material2D_ = material2D; }
+
+        std::string get3DMaterial() const {return this->material3D_; }
+        void set3DMaterial(std::string material3D) { this->material3D_ = material3D; }
+
+        std::string get3DMaterialFront() const {return this->material3DFront_; }
+        void set3DMaterialFront(std::string material3DFront) { this->material3DFront_ = material3DFront; }
+
+        std::string get3DMaterialBack() const {return this->material3DBack_; }
+        void set3DMaterialBack(std::string material3DBack) { this->material3DBack_ = material3DBack; }
+
         float getRadarSensitivity() const { return this->sensitivity_; }
         // used also by RadarListener interface!
         void setRadarSensitivity(float sensitivity) { this->sensitivity_ = sensitivity; }
 
+        // Determines angle between line of sight and x/z-plain on the 3D minimap
+        float getMapAngle() const { return this->mapAngle_; }
+        void setMapAngle(float mapAngle) { this->mapAngle_ = mapAngle; }
+
         // RadarListener interface
         virtual void addObject(RadarViewable* viewable);
         virtual void removeObject(RadarViewable* viewable);
@@ -84,9 +103,21 @@
         std::map<RadarViewable*, Ogre::PanelOverlayElement*> radarObjects_;
         Ogre::PanelOverlayElement* marker_;
 
+        bool RadarMode_; // Determines, if Radar runs in 3D or 2D Mode
+
         float halfDotSizeDistance_;
         float maximumDotSize_;
+        float maximumDotSize3D_;
+        float mapAngle_;
 
+        std::string material2D_;		//Material name for 2D map
+        std::string material3D_;		//Material names For the 3D minimap
+        std::string material3DFront_;
+        std::string material3DBack_;
+
+        Ogre::PanelOverlayElement* map3DFront_; //Overlayelements for the 3D minimap to be able to draw the points in a semi 3D matter
+        Ogre::PanelOverlayElement* map3DBack_;
+
         float sensitivity_;
         float detectionLimit_;
         ControllableEntity* owner_;




More information about the Orxonox-commit mailing list