Changeset 9877 for code/branches/radarDreiD
- Timestamp:
- Dec 9, 2013, 2:06:55 PM (11 years ago)
- Location:
- code/branches/radarDreiD
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/radarDreiD/data/overlays/HUDTemplates3.oxo
r9847 r9877 108 108 /> 109 109 110 <!-- 111 <HUDRadar 112 name = "Radar" 113 background = "Orxonox/Radar" 114 correctaspect = true 115 size = "0.17, 0.17" 116 position = "1.0, 1.0" 117 pickpoint = "1.0, 1.0" 118 rotation = 0 119 sensitivity = 1.0 120 halfDotSizeDistance = 3000 121 maximumDotSize = 0.1 122 /> 123 --> 124 125 126 127 <HUDRadar 110 <HUDRadar 128 111 name = "Radar" 129 112 background = "Orxonox/Radar3D" … … 140 123 halfDotSizeDistance = 3000 141 124 maximumDotSize = 0.1 142 maximumDotSize3D = 0.0 7125 maximumDotSize3D = 0.06 143 126 mapAngle3D = 0.6435011 144 127 /> 145 128 146 147 129 <HUDTimer 148 130 name = "Timer" -
code/branches/radarDreiD/src/libraries/util/Math.cc
r9792 r9877 208 208 { 209 209 // Orxonox Vectors: x_direction you are looking, y_direction points up, z_direction points to the right 210 orxonox::Vector3 distance = otherposition - myposition; 210 orxonox::Vector3 distance = otherposition - myposition; // get vector from Ship to object 211 211 212 212 // new coordinate system: x_axsis: mydirection (points front) … … 214 214 // z_axsis: myside (points right) 215 215 216 orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get vector from Ship to object216 orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get 3. base vector 217 217 218 218 distance = 4*distance / detectionlimit; // shrink vector on map … … 263 263 else 264 264 return false; 265 } 266 267 /** 268 @brief A value between 0 and 10, in order how other object is in front or in back 269 @param myposition My position 270 @param mydirection My viewing direction 271 @param myorthonormal My orthonormalvector (pointing upwards through my head) 272 @param otherposition The position of the other object 273 @param detectionlimit The limit in which objects are shown on the map 274 @return value between 0 and 100 275 */ 276 int determineMap3DZOrder(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float detectionlimit) 277 { 278 orxonox::Vector3 distance = otherposition - myposition; // get vector from Ship to object 279 orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get vector to the side 280 281 distance = 4*distance / detectionlimit; // shrink vector on map 282 if(distance.length() > 1.0f) // if object would wander outside of the map 283 { 284 distance = distance / distance.length(); 285 } 286 287 // perform a coordinate transformation to get distance in relation of the position of the ship 288 orxonox::Vector3 distanceShip = getTransformedVector(distance, mydirection, myorthonormal, myside); 289 290 return (int) 50 - 100*distanceShip.x; 265 291 } 266 292 -
code/branches/radarDreiD/src/libraries/util/Math.h
r9792 r9877 94 94 _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); 95 95 _UtilExport bool isObjectHigherThanShipOnMap(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle); 96 _UtilExport int determineMap3DZOrder(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float detectionlimit); 96 97 _UtilExport orxonox::Vector3 getTransformedVector(const orxonox::Vector3& distance, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& myside); 97 98 _UtilExport orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity); -
code/branches/radarDreiD/src/modules/overlays/hud/HUDRadar.cc
r9852 r9877 193 193 { 194 194 this->setBackgroundMaterial(material3D_); 195 this->map3DFront_->_notifyZOrder(this->overlay_->getZOrder() * 100 + 10);196 this->map3DBack_->_notifyZOrder(this->overlay_->getZOrder() * 100 - 10);195 this->map3DFront_->_notifyZOrder(this->overlay_->getZOrder() * 100 + 250); // it seems that the ZOrder of overlayelements is 100 times the ZOrder of the overlay 196 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 197 197 this->map3DFront_->show(); 198 198 this->map3DBack_->show(); … … 235 235 bool overXZPlain = isObjectHigherThanShipOnMap(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), this->mapAngle_); 236 236 237 if(overXZPlain == false && (it->second->getZOrder() > 100 * this->overlay_->getZOrder())) // it appears that zOrder of attached Overlayelements is 100 times the zOrder of the Overlay238 it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 - 1);239 if(overXZPlain == true && (it->second->getZOrder() <= 100 * this->overlay_->getZOrder()))240 it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 + 1);237 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 238 it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 - 70 + determineMap3DZOrder(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), detectionLimit_)); 239 if(overXZPlain == true /*&& (it->second->getZOrder() <= 100 * this->overlay_->getZOrder())*/) 240 it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 + 70 + determineMap3DZOrder(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), detectionLimit_)); 241 241 } 242 242 else
Note: See TracChangeset
for help on using the changeset viewer.