def main(): # Parse the command line. param = parseCommandLine() # Helper class to start/stop Azrael stack and other processes. az = azrael.startup.AzraelStack(param.loglevel) # Start Azrael services. with azutils.Timeit('Startup Time', True): az.start() if not param.noinit: # Add the specified number of cubes in a grid layout. demo_default.spawnCubes(*param.cubes, center=(0, 0, -10)) # Launch a dedicated process to periodically reset the simulation. time.sleep(2) az.startProcess(demo_default.ResetSim(period=param.reset)) print('Azrael now live') # Start the process that periodically changes the force field. Add the # process handle to the list of processes. az.startProcess( UpdateGrid(period_circ=param.circular, period_lin=param.linear)) # Either wait forever or start the Qt Viewer and wait for it to return. if param.noviewer: demolib.waitForever() else: viewer = demolib.launchQtViewer() viewer.wait() # Stop Azrael stack. az.stop() print('Clean shutdown')
def main(): # Parse the command line. param = parseCommandLine() # Helper class to start/stop Azrael stack and other processes. az = azrael.startup.AzraelStack(param.loglevel) # Start Azrael services. with azrael.util.Timeit('Startup Time', True): az.start() if not param.noinit: # Define a sphere with boosters and spawn an instance thereof. p = os.path.dirname(os.path.abspath(__file__)) p = os.path.join(p, '..', 'viewer', 'models', 'sphere') fname = os.path.join(p, 'sphere.obj') spawnColladaModel(scale=1.25, fname=fname) # Add the specified number of cubes in a grid layout. demolib.spawnCubes(*param.cubes, center=(0, 0, 10)) del p, fname # Launch a dedicated process to periodically reset the simulation. time.sleep(2) az.startProcess(demolib.ResetSim(period=param.reset)) print('Azrael now live') # Start the Qt Viewer. This call will block until the viewer exits. demolib.launchQtViewer(param) # Stop Azrael stack. az.stop() print('Clean shutdown')