Example #1
0
def benchmark():
    # store current canvas size and camera settings
    prevDim = voreen.getPropertyValue(canvas, "canvasSize")
    prevCam = voreen.getPropertyValue(processor, cameraProp)

    # resize canvas and initialize camera
    voreen.setPropertyValue(canvas, "canvasSize", canvasDim)
    voreen.setPropertyValue(processor, cameraProp, initCam)
    voreen.repaint()

    # make sure all Qt events have been processed before starting
    voreenqt.processEvents()

    # start loop for animation
    counter = 0
    angleIncr = 2 * math.pi / frames  # do a full rotation
    start = time.time()
    while (counter < frames):
        counter = counter + 1

        # update camera for current frame
        voreen.rotateCamera(processor, cameraProp, angleIncr, rotAxis)

        # render network state
        voreen.repaint()
    end = time.time()

    # restore canvas and camera
    voreen.setPropertyValue(canvas, "canvasSize", prevDim)
    voreen.setPropertyValue(processor, cameraProp, prevCam)
    voreen.repaint()

    # evaluate results
    runtime = (end - start)
    if runtime > 0:
        fps = frames / runtime
    else:
        fps = -1

    message = 'frames: %i\n' % (frames)
    message += 'total runtime: %f\n' % (runtime)
    message += 'fps: %f' % (fps)
    print message
    voreenqt.messageBox("Finished!\n" + message)
Example #2
0
def benchmark():
    # store current canvas size and camera settings
    prevDim = voreen.getPropertyValue(canvas, "canvasSize")
    prevCam = voreen.getPropertyValue(processor, cameraProp)

    # resize canvas and initialize camera
    voreen.setPropertyValue(canvas, "canvasSize", canvasDim)
    voreen.setPropertyValue(processor, cameraProp, initCam)
    voreen.repaint()

    # make sure all Qt events have been processed before starting
    voreenqt.processEvents()  

    # start loop for animation
    counter = 0
    angleIncr = 2*math.pi / frames  # do a full rotation
    start = time.time()
    while (counter < frames):
        counter = counter + 1

        # update camera for current frame
        voreen.rotateCamera(processor, cameraProp, angleIncr, rotAxis)

        # render network state
        voreen.repaint()
    end = time.time()

    # restore canvas and camera
    voreen.setPropertyValue(canvas, "canvasSize", prevDim)
    voreen.setPropertyValue(processor, cameraProp, prevCam)
    voreen.repaint()

    # evaluate results
    runtime = (end - start)
    if runtime > 0:
        fps = frames / runtime
    else:
        fps = -1

    message =  'frames: %i\n' % (frames)
    message += 'total runtime: %f\n' % (runtime)
    message += 'fps: %f' %(fps)
    print message
    voreenqt.messageBox("Finished!\n" + message)
def bottom():
    initCam    = ((0.0, 0.0, 2.75), (0.0, 0.0, 0.0), (0.0, 1.0, 0.0))
    # store current canvas size and camera settings
    prevDim = voreen.getPropertyValue(canvas, "canvasSize")
    prevCam = voreen.getPropertyValue(processor, cameraProp)
    print(prevCam)
    # resize canvas and initialize camera
    voreen.setPropertyValue(canvas, "canvasSize", canvasDim)
    voreen.setPropertyValue(processor, cameraProp, initCam)
    voreen.repaint()
    # make sure all Qt events have been processed before starting
    voreenqt.processEvents()  
    # start loop for animation
    counter = 0
    angleIncr = 2*math.pi / frames  # do a full rotation
    start = time.time()
    while (counter < frames):
        counter = counter + 1
        # update camera for current frame
        voreen.rotateCamera(processor, cameraProp, angleIncr, rotAxis)
        # render network state
        voreen.repaint()
    end = time.time()
def back():
    print(voreen.getPropertyValue(processor, cameraProp))
    initCam = ((70, -150, 80), (70.0, 60.0, 80), (0.0, 0.0, -1.0))
    voreen.setPropertyValue(processor, cameraProp, initCam)
    voreen.repaint()
    voreenqt.processEvents()
    # start loop for animation
    counter = 0
    angleIncr = 2 * math.pi / frames  # do a full rotation
    start = time.time()
    while (counter < frames):
        counter = counter + 1
        # update camera for current frame
        voreen.rotateCamera(processor, cameraProp, angleIncr, rotAxis)
        # render network state
        voreen.repaint()
    end = time.time()
        voreen.repaint()
    end = time.time()


def right():
    print(voreen.getPropertyValue(processor, cameraProp))
    initCam = ((280, 60, 80), (70.0, 60.0, 80), (0.0, 0.0, -1.0))
    voreen.setPropertyValue(processor, cameraProp, initCam)
    voreen.repaint()
    voreenqt.processEvents()
    # start loop for animation
    counter = 0
    angleIncr = 2 * math.pi / frames  # do a full rotation
    start = time.time()
    while (counter < frames):
        counter = counter + 1
        # update camera for current frame
        voreen.rotateCamera(processor, cameraProp, angleIncr, rotAxis)
        # render network state
        voreen.repaint()
    end = time.time()


#front()
#back()
#top()
#bottom()
left()
#right()
print(voreen.getPropertyValue(processor, cameraProp))