def main():
    # Specify Blender file.
    fname_blender = 'models/sample/sample.blend'
    fname_blender = os.path.join(os.path.dirname(__file__), fname_blender)

    # Parse the command line.
    param = parseCommandLine()

    # Helper class to start/stop Azrael stack and other processes.
    az = azrael.startup.AzraelStack(param.loglevel)
    az.start()
    print('Azrael now live')

    # Connect to Azrael.
    client = azrael.clerk.Clerk()

    # Load the model and convert it to fragments and collision shapes.
    frags, cshapes = loadBlender(fname_blender)

    # Create a template and spawn an object from it.
    spawnObject(client, frags, cshapes)

    # Wait for the user to terminate the program.
    if param.noviewer:
        # Wait until <Ctrl-C>
        demolib.waitForever()
    else:
        # Launch Qt Viewer in new process and wait until the user quits it.
        demolib.launchQtViewer().wait()

    # Stop Azrael stack.
    az.stop()
    print('Clean shutdown')
Beispiel #2
0
def main():
    # Parse the command line.
    param = parseCommandLine()

    # Helper class to start/stop Azrael stack and other processes.
    az = azrael.startup.AzraelStack(param.loglevel)
    az.start()
    print('Azrael now live')

    # Connect to Azrael.
    client = azrael.clerk.Clerk()

    # Spawn the line of cubes that will serve as the plot markers.
    objName = 'PlotObject'
    addLineOfCubes(client, objName, 15)

    # Create the Sine wave generator and wait until it found the object.
    swg = SineWaveGenerator(client)
    swg.waitForObject(objName)

    # Wait for the user to terminate the program.
    if param.noviewer:
        # Wait until <Ctrl-C>
        demolib.waitForever()
    else:
        # Launch Qt Viewer in new process and wait until the user quits it.
        viewer = demolib.launchQtViewer()
        while viewer.poll() is None:
            time.sleep(0.1)
            swg.updatePlot()
        viewer.wait()

    # Stop Azrael stack.
    az.stop()
    print('Clean shutdown')
Beispiel #3
0
def main():
    # Parse the command line.
    param = parseCommandLine()

    assert vectorgrid.resetGrid('force').ok

    # 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:
            # Spawn four cubes in a row.
            spawnCubes(4, 1, 1, center=(0, 0, 10))

        # Launch a dedicated process to periodically reset the simulation.
        time.sleep(2)

    print('Azrael now live')

    # 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 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')
Beispiel #5
0
def main():
    # Parse the command line.
    param = parseCommandLine()

    # Helper class to start/stop Azrael stack and other processes.
    az = azrael.startup.AzraelStack(param.loglevel)
    az.start()
    print('Azrael now live')

    # Connect to Azrael.
    client = azrael.clerk.Clerk()

    # Spawn the line of cubes that will serve as the plot markers.
    objName = 'PlotObject'
    addLineOfCubes(client, objName, 15)

    # Create the Sine wave generator and wait until it found the object.
    swg = SineWaveGenerator(client)
    swg.waitForObject(objName)

    # Wait for the user to terminate the program.
    if param.noviewer:
        # Wait until <Ctrl-C>
        demolib.waitForever()
    else:
        # Launch Qt Viewer in new process and wait until the user quits it.
        viewer = demolib.launchQtViewer()
        while viewer.poll() is None:
            time.sleep(0.1)
            swg.updatePlot()
        viewer.wait()

    # Stop Azrael stack.
    az.stop()
    print('Clean shutdown')
Beispiel #6
0
def main():
    # Parse the command line.
    param = parseCommandLine()

    assert vectorgrid.resetGrid('force').ok

    # 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:
            # Spawn four cubes in a row.
            spawnCubes(4, 1, 1, center=(0, 0, 10))

        # Launch a dedicated process to periodically reset the simulation.
        time.sleep(2)

    print('Azrael now live')

    # 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')
Beispiel #7
0
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 a model to the otherwise empty simulation. The sphere is
            # in the repo whereas the Vatican model is available here:
            # http://artist-3d.com/free_3d_models/dnm/model_disp.php?\
            # uid=3290&count=count
            # p = os.path.dirname(os.path.abspath(__file__))
            # fname = os.path.join(p, 'models', 'sphere', 'sphere.obj')
            # fname = os.path.join(p, 'house', 'house.obj')
            # fname = os.path.join(p, 'test.obj')
            # scale, model_name = (1.25, fname)
            # scale, model_name = (
            #     50, 'viewer/models/vatican/vatican-cathedral.3ds')
            # scale, model_name = (
            #     1.25, 'viewer/models/house/house.3ds')
            # vert, uv, rgb = demolib.loadModel(model_name)

            # Load the Booster Cube Model created in Blender.
            scale, (vert, uv, rgb) = 1, demolib.loadBoosterCubeBlender()

            # Wrap the UV data into a BoosterCube template and add it to
            # Azrael.
            addBoosterCubeTemplate(scale, vert, uv, rgb)

            # Define additional templates, in this case the wall of cubes.
            # Spawn them a bit to the right and back.
            spawnCubes(*param.cubes, center=(5, 0, -5))
#            del p, fname, model_name

        # Launch a dedicated process to periodically reset the simulation.
        time.sleep(2)
        az.startProcess(ResetSim(period=param.reset))

    print('Azrael now live')

    # 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)
    az.start()
    print('Azrael now live')

    # Spawn the viewer.
    if param.noviewer:
        viewer = None
    else:
        viewer = demolib.launchQtViewer()

    # Start the games...
    Simulation(viewer, param.N, param.reset_interval, topics=['#']).run()

    # 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)
    az.start()
    print('Azrael now live')

    # Spawn the molecule object.
    addMolecule()

    # 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)
    az.start()
    print('Azrael now live')

    # Spawn the molecule object.
    addMolecule()

    # 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')
Beispiel #11
0
def main():
    # Parse the command line.
    param = parseCommandLine()

    # Guess Azrael's IP address on the local computer.
    host = demolib.azService['clerk'].ip
    print('Assuming Azrael services on <{}>'.format(host))

    # Helper class to start/stop Azrael stack and other processes.
    az = azrael.startup.AzraelStack(param.loglevel)
    az.start()
    print('Azrael now live')

    # Connect to Azrael.
    client = pyazrael.AzraelClient(host)

    # Create the template for the asteroid and spawn one instance.
    asteroidID = spawnAsteroid(client)

    # Create the template for our ship and spawn one instance thereof.
    rosetta = Rosetta(host)
    rosetta.spawn((0, 50, -100))

    # Start the Qt viewer unless the user specified '--noviewer'.
    if param.noviewer:
        viewer = None
    else:
        viewer = demolib.launchQtViewer()

    # Conduct the Rosetta mission.
    conductMission(client, viewer, asteroidID, rosetta)

    # Stop Azrael stack and exit.
    rosetta.removeShip()
    az.stop()
    print('Clean shutdown')
Beispiel #12
0
def main():
    # Parse the command line.
    param = parseCommandLine()

    # Guess Azrael's IP address on the local computer.
    host = demolib.azService['clerk'].ip
    print('Assuming Azrael services on <{}>'.format(host))

    # Helper class to start/stop Azrael stack and other processes.
    az = azrael.startup.AzraelStack(param.loglevel)
    az.start()
    print('Azrael now live')

    # Connect to Azrael.
    client = pyazrael.AzraelClient(host)

    # Create the template for the asteroid and spawn one instance.
    asteroidID = spawnAsteroid(client)

    # Create the template for our ship and spawn one instance thereof.
    rosetta = Rosetta(host)
    rosetta.spawn((0, 50, -100))

    # Start the Qt viewer unless the user specified '--noviewer'.
    if param.noviewer:
        viewer = None
    else:
        viewer = demolib.launchQtViewer()

    # Conduct the Rosetta mission.
    conductMission(client, viewer, asteroidID, rosetta)

    # Stop Azrael stack and exit.
    rosetta.removeShip()
    az.stop()
    print('Clean shutdown')
def main():
    # Parse the command line.
    param = demo_default.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:
            # Define a sphere with boosters and spawn an instance thereof.
            p = os.path.dirname(os.path.abspath(__file__))
            fname = os.path.join(p, 'models', 'sphere', 'sphere.obj')
            spawnSpaceship(scale=1.0, fname=fname)

            # Add the specified number of cubes in a grid layout.
            demo_default.addTexturedCubeTemplates(2, 2, 1)
            del p, fname

        # Launch a dedicated process to periodically reset the simulation.
        time.sleep(2)
        az.startProcess(demo_default.ResetSim(period=param.reset))

    print('Azrael now live')

    # 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')