[Orxonox-commit 4275] r8946 - in code/branches/environment3: data/levels data/levels/includes src/libraries/util

fmauro at orxonox.net fmauro at orxonox.net
Wed Nov 23 15:13:31 CET 2011


Author: fmauro
Date: 2011-11-23 15:13:31 +0100 (Wed, 23 Nov 2011)
New Revision: 8946

Modified:
   code/branches/environment3/data/levels/asteroidField.oxw
   code/branches/environment3/data/levels/includes/asteroidField.lua
   code/branches/environment3/src/libraries/util/SignalHandler.cc
Log:
asteroidBelt function added

Modified: code/branches/environment3/data/levels/asteroidField.oxw
===================================================================
--- code/branches/environment3/data/levels/asteroidField.oxw	2011-11-23 13:52:32 UTC (rev 8945)
+++ code/branches/environment3/data/levels/asteroidField.oxw	2011-11-23 14:13:31 UTC (rev 8946)
@@ -36,7 +36,8 @@
     <!-- Generate asteroid field with diameter 12000 containing 250 asteroids -->    
     <?lua
     	dofile("includes/asteroidField.lua")
-    	asteroidField(0, 0, 0, 150, 50, 12000, 250)
+    	asteroidField(0, 0, 5000, 100, 150, 2000, 50);
+    	asteroidBelt(0, 0, 0, -48, -34, 30, 100, 200, 17000, 21000, 900)
     ?>
     
   </Scene>

Modified: code/branches/environment3/data/levels/includes/asteroidField.lua
===================================================================
--- code/branches/environment3/data/levels/includes/asteroidField.lua	2011-11-23 13:52:32 UTC (rev 8945)
+++ code/branches/environment3/data/levels/includes/asteroidField.lua	2011-11-23 14:13:31 UTC (rev 8946)
@@ -9,20 +9,59 @@
 	for i = 1, count, 1
 	do
 		size = (math.random() * (maxSize - minSize)) + minSize
+		pX = (2 * math.random() * radius) - radius + posX
+		pY = (2 * math.random() * radius) - radius + posY
+		pZ = (2 * math.random() * radius) - radius + posZ
 		print("<StaticEntity ")
 		
 		print("position = \"") 
-		print((2 * math.random() * radius) - radius + posX) print(",") 
-		print((2 * math.random() * radius) - radius + posY) print(",") 
-		print((2 * math.random() * radius) - radius + posZ) print("\"")
+		print(pX) print(",") 
+		print(pY) print(",") 
+		print(pZ) print("\"")
 		
 		print("scale = \"") print(size) print("\"")
 		
-		print("collisionType = static linearDamping = 0.8 angularDamping = 0 collisiondamage = 1 enablecollisiondamage = true>")
+		print("collisionType = static linearDamping = 0.8 angularDamping = 1 collisiondamage = 1000 enablecollisiondamage = true>")
 		print("<attached> <Model mass=\"") print(size * 10) print("\" mesh=\"ast") print(math.mod(i,6) + 1) print(".mesh\" /> </attached>")
-		print("<attached> <ForceField position=\"0,0,0\" mode=\"newtonianGravity\" diameter=\"") print(size + (size * 0.2)) print("\" massDiameter=\"") print(size) print("\" mass=\"") print(size * 1000) print("\" /> </attached>")
-		print("<collisionShapes> <SphereCollisionShape radius=\"") print(size) print("\" /> </collisionShapes>")
+		print("<attached> <ForceField position=\"0,0,0\" mode=\"newtonianGravity\" diameter=\"") print(size * 2.7) print("\" massDiameter=\"") print(size * 2) print("\" mass=\"") print(size * 1000) print("\" /> </attached>")
+		print("<collisionShapes> <SphereCollisionShape radius=\"") print(size*2.5) print("\" /> </collisionShapes>")
 		print("</StaticEntity>")
 	end
+end
+
+
+--[[ asteroid belt generator
+generates asteroid belt
+	posX, posY, posZ - position in space
+	yaw, pitch - rotation
+	minSize, maxSize - size boundaries of each asteroid
+	radius0, radius1 - inner/outer radius
+	count - number of asteroids
+--]]
+function asteroidBelt(centerX, centerY, centerZ, yaw, pitch, segments, minSize, maxSize, radius0, radius1, count)
+	dPhi = (2 * math.pi) / segments
+	width = math.abs(radius1 - radius0)
+	radius = (radius1 + radius0) / 2
+	segmentCount = count / segments
 	
+	print("<StaticEntity collisionType=static yaw=")
+	print(yaw)
+	print(" pitch=")
+	print(pitch)
+	print(" position = \"") 
+		print(centerX) print(",") 
+		print(centerY) print(",") 
+		print(centerZ) print("\"") 
+	print(">")
+	print("<attached>")
+	
+	for i = 0, segments - 1, 1
+	do
+		asteroidField((radius * math.cos(i * dPhi)),
+					(radius * math.sin(i * dPhi)),
+					0, minSize, maxSize, width,segmentCount)
+	end
+	
+	print("</attached>")
+	print("</StaticEntity>")
 end

Modified: code/branches/environment3/src/libraries/util/SignalHandler.cc
===================================================================
--- code/branches/environment3/src/libraries/util/SignalHandler.cc	2011-11-23 13:52:32 UTC (rev 8945)
+++ code/branches/environment3/src/libraries/util/SignalHandler.cc	2011-11-23 14:13:31 UTC (rev 8946)
@@ -69,7 +69,7 @@
       assert( sigRecList.size() == 0 );
 
       catchSignal( SIGSEGV );
-//      catchSignal( SIGABRT );
+//      catchSignal( SIGABRT );  // CEGUI nasty bugfix
       catchSignal( SIGILL );
     }
 
@@ -126,7 +126,7 @@
       // if the signalhandler has already been destroyed then don't do anything
       if( SignalHandler::singletonPtr_s == 0 )
       {
-        orxout(user_error) << "Received signal(sigHandler already destroyed) " << sigName.c_str() << endl << "Can't write backtrace because SignalHandler is already destroyed" << endl;
+        orxout(user_error) << "Received signal " << sigName.c_str() << endl << "Can't write backtrace because SignalHandler is already destroyed" << endl;
         exit(EXIT_FAILURE);
       }
 
@@ -136,7 +136,7 @@
       }
 
 
-      orxout(user_error) << "Received signal(second error) " << sigName.c_str() << endl << "Try to write backtrace to file orxonox_crash.log" << endl;
+      orxout(user_error) << "Received signal " << sigName.c_str() << endl << "Try to write backtrace to file orxonox_crash.log" << endl;
 
       
       // First start GDB which will be attached to this process later on
@@ -674,7 +674,7 @@
     }
 
     /// Returns a description of the given exception.
-    // Based on code from Dr. Mingw by José Fonseca
+    // Based on code from Dr. Mingw by Jos\E9 Fonseca
     /* static */ std::string SignalHandler::getExceptionType(PEXCEPTION_POINTERS pExceptionInfo)
     {
         PEXCEPTION_RECORD pExceptionRecord = pExceptionInfo->ExceptionRecord;
@@ -744,7 +744,7 @@
     }
 
     /// Retrieves the base address of the module that contains the specified address.
-    // Code from Dr. Mingw by José Fonseca
+    // Code from Dr. Mingw by Jos\E9 Fonseca
     /* static */ DWORD SignalHandler::getModuleBase(DWORD dwAddress)
     {
         MEMORY_BASIC_INFORMATION Buffer;




More information about the Orxonox-commit mailing list