Changeset 9779 for code/branches
- Timestamp:
- Nov 11, 2013, 4:13:02 PM (11 years ago)
- Location:
- code/branches/radarDreiD
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/radarDreiD/data/levels/radar3D_test.oxw
r9771 r9779 18 18 ?> 19 19 20 <Level> 20 <Level 21 gametype = "Mission" 22 > 21 23 <templates> 22 24 <Template link=lodtemplate_default /> … … 30 32 31 33 <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"/> 32 <SpawnPoint team=0 position="- 200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />34 <SpawnPoint team=0 position="-500,0,0" lookat="-500,0,1" spawnclass=SpaceShip pawndesign=spaceshipescort /> 33 35 34 36 35 37 36 <Pawn team= 1 health=30 position="0,0,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box radarname = "Box 1" >38 <Pawn team=0 health=30 position="0,0,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box radarname = "0,0,0" > 37 39 <attached> 38 40 <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /> … … 43 45 </Pawn> 44 46 45 <Pawn team=1 health=30 position="0, 200,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box radarname = "Box 2" >47 <Pawn team=1 health=30 position="0,1000,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box radarname = "0,1000,0" > 46 48 <attached> 47 49 <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /> … … 53 55 54 56 55 <Pawn team= 1 health=30 position="0,0,200" direction="0,-1,0" collisionType=dynamic mass=100000 name=box radarname = "Box 3" >57 <Pawn team=2 health=30 position="0,0,1000" direction="0,-1,0" collisionType=dynamic mass=100000 name=box radarname = "0,0,1000" > 56 58 <attached> 57 59 <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /> … … 62 64 </Pawn> 63 65 64 <Pawn team= 1 health=30 position="200,0,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box radarname = "Box 4" >66 <Pawn team=3 health=30 position="1000,0,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box radarname = "1000,0,0" > 65 67 <attached> 66 68 <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /> -
code/branches/radarDreiD/src/libraries/util/Math.cc
r9770 r9779 207 207 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) 208 208 { 209 // 209 // Orxonox Vectors: x_direction you are looking, y_direction points up, z_direction points to the right 210 210 orxonox::Vector3 distance = otherposition - myposition; 211 211 212 // new coordinate system base y_coordinate 213 orxonox::Vector3 myside = -(mydirection.crossProduct(myorthonormal)); 212 // new coordinate system: x_axsis: mydirection (points front) 213 // y_axsis: myorthonormal (points up) 214 // z_axsis: myside (points right) 215 orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); 216 orxout() << "mydirection " << mydirection << endl; 217 orxout() << "mydirection.lenght " << mydirection.length() << endl; 218 orxout() << "myorthonormal " << myorthonormal << endl; 219 orxout() << "myorthonormal.lenght " << myorthonormal.length() << endl; 220 orxout() << "myside " << myside << endl; 221 orxout() << "myside.lenght " << myside.length() << endl; 222 223 distance = 5 * distance / detectionlimit; // shrink vector on map 214 224 215 225 // inverse of the transform matrix 216 float determinant = +mydirection.x * (my side.y*myorthonormal.z - myorthonormal.y*myside.z)217 -mydirection.y * (my side.x*myorthonormal.z - myside.z*myorthonormal.x)218 +mydirection.z * (my side.x*myorthonormal.y - myside.y*myorthonormal.x);226 float determinant = +mydirection.x * (myorthonormal.y*myside.z - myside.y*myorthonormal.z) 227 -mydirection.y * (myorthonormal.x*myside.z - myorthonormal.z*myside.x) 228 +mydirection.z * (myorthonormal.x*myside.y - myorthonormal.y*myside.x); 219 229 float invdet = 1/determinant; 220 230 … … 224 234 orxonox::Vector3 zinvtransform; 225 235 226 xinvtransform.x = (my side.y * myorthonormal.z - myorthonormal.y * myside.z)*invdet;227 xinvtransform.y = (mydirection.z * my orthonormal.y - mydirection.y * myorthonormal.z)*invdet;228 xinvtransform.z = (mydirection.y * my side.z - mydirection.z * myside.y)*invdet;229 yinvtransform.x = (my side.z * myorthonormal.x - myside.x * myorthonormal.z)*invdet;230 yinvtransform.y = (mydirection.x * my orthonormal.z - mydirection.z * myorthonormal.x)*invdet;231 yinvtransform.z = (my side.x * mydirection.z - mydirection.x * myside.z)*invdet;232 zinvtransform.x = (my side.x * myorthonormal.y - myorthonormal.x * myside.y)*invdet;233 zinvtransform.y = (my orthonormal.x * mydirection.y - mydirection.x * myorthonormal.y)*invdet;234 zinvtransform.z = (mydirection.x * my side.y - myside.x* mydirection.y )*invdet;236 xinvtransform.x = (myorthonormal.y * myside.z - myside.y * myorthonormal.z)*invdet; 237 xinvtransform.y = (mydirection.z * myside.y - mydirection.y * myside.z )*invdet; 238 xinvtransform.z = (mydirection.y * myorthonormal.z - mydirection.z * myorthonormal.y)*invdet; 239 yinvtransform.x = (myorthonormal.z * myside.x - myorthonormal.x * myside.z )*invdet; 240 yinvtransform.y = (mydirection.x * myside.z - mydirection.z * myside.x )*invdet; 241 yinvtransform.z = (myorthonormal.x * mydirection.z - mydirection.x * myorthonormal.z)*invdet; 242 zinvtransform.x = (myorthonormal.x * myside.y - myside.x * myorthonormal.y)*invdet; 243 zinvtransform.y = (myside.x * mydirection.y - mydirection.x * myside.y )*invdet; 244 zinvtransform.z = (mydirection.x * myorthonormal.y - myorthonormal.x * mydirection.y )*invdet; 235 245 236 246 // coordinate transformation 237 distance.x = (xinvtransform.x + yinvtransform.x + zinvtransform.x) * distance.x;238 distance.y = (xinvtransform.y + yinvtransform.y + zinvtransform.y) * distance.y;239 distance.z = (xinvtransform.z + yinvtransform.z + zinvtransform.z)* distance.z;247 distance.x = xinvtransform.x * distance.x + yinvtransform.x * distance.y + zinvtransform.x * distance.z; 248 distance.y = xinvtransform.y * distance.x + yinvtransform.y * distance.y + zinvtransform.y * distance.z; 249 distance.z = xinvtransform.z * distance.x + yinvtransform.z * distance.y + zinvtransform.z * distance.z; 240 250 241 251 // cap vector for map … … 244 254 //distance.z = clamp<float>(distance.z, -detectionlimit/5, detectionlimit/5); 245 255 //float distancelength = distance.length(); 246 distance = 5 * distance / detectionlimit; 256 247 257 248 258 // project vector for the rotated 3DMap on screen 249 float xcoordinate = distance.z; // z; cause z direction is to the side 250 float ycoordinate = (distance.x*sin(mapangle)+distance.y*cos(mapangle)); 259 float xcoordinate = distance.z; 260 float ycoordinate = distance.y; 261 262 //float xcoordinate = distance.z; // z; cause z direction is to the side 263 //float ycoordinate = distance.x*sin(mapangle)+distance.y*cos(mapangle);// -; cause on screen y coordinate points down 251 264 return orxonox::Vector2(xcoordinate , ycoordinate); 252 265 } -
code/branches/radarDreiD/src/modules/overlays/hud/HUDRadar.cc
r9742 r9779 173 173 coord *= math::pi / 3.5f; // small adjustment to make it fit the texture 174 174 it->second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f); 175 175 176 if( distance < detectionLimit_ || detectionLimit_ < 0 ) 176 177 it->second->show();
Note: See TracChangeset
for help on using the changeset viewer.