Ejemplo n.º 1
0
def start():


    ## create scenegraph
    scenegraph = avango.gua.nodes.SceneGraph(Name = "scenegraph")
    #physics = avango.gua.nodes.Physics()

    ## init scene
    scene = Scene(PARENT_NODE = scenegraph.Root.value)
    #scene.Physics.value = physics


    ## init navigation technique
    deviceInput = NewSpacemouseInput()
    deviceInput.my_constructor("gua-device-spacemouse")
        
    steeringNavigation = SteeringNavigation()
    steeringNavigation.my_constructor(deviceInput.mf_dof, deviceInput.mf_buttons, 0.15, 1.0) # connect navigation with spacemouse input
    steeringNavigation.set_start_matrix(avango.gua.make_trans_mat(-2.1, 0.96, 0.705))

    ## init viewing setup
    ## init viewing and interaction setups
    hostname = open('/etc/hostname', 'r').readline()
    hostname = hostname.strip(" \n")
    
    print("wokstation:", hostname)

    if hostname == "medusa": # Samsung 3D-TV workstation
        _tracking_transmitter_offset = avango.gua.make_trans_mat(-2.1, 0.96, 0.705) * avango.gua.make_rot_mat(90.0, 0, 1, 0) * avango.gua.make_rot_mat(90.0, -1, 0, 0) # transformation into tracking coordinate system

        viewingSetup = MultiUserViewingSetup(
            SCENEGRAPH = scenegraph,
            WINDOW_RESOLUTION = avango.gua.Vec2ui(1400, 1050),
            SCREEN_DIMENSIONS = avango.gua.Vec2(1.135, 0.85),
            SCREEN_MATRIX = avango.gua.make_trans_mat(-2.1, 0.96, 0.705) * avango.gua.make_rot_mat(90.0, 0, 1, 0) * avango.gua.make_rot_mat(90.0, -1, 0, 0),
            # TRACKING_TRANSMITTER_OFFSET = _tracking_transmitter_offset,
            LEFT_POSITION = avango.gua.Vec2ui(0, 0),
            LEFT_RESOLUTION = avango.gua.Vec2ui(1400, 1050),
            RIGHT_POSITION = avango.gua.Vec2ui(1400, 0),
            RIGHT_RESOLUTION = avango.gua.Vec2ui(1400, 1050),
            DISPLAY_STRING_LIST = [[":0.0"], [":0.1"], [":0.2"]], # 3 user slots (left and right eye on same GPU)
            WARP_MATRIX_RED_RIGHT = "/opt/dlp-warpmatrices/dlp_6_warp_P1.warp",
            WARP_MATRIX_GREEN_RIGHT = "/opt/dlp-warpmatrices/dlp_6_warp_P2.warp",
            WARP_MATRIX_BLUE_RIGHT = "/opt/dlp-warpmatrices/dlp_6_warp_P3.warp",
            WARP_MATRIX_RED_LEFT = "/opt/dlp-warpmatrices/dlp_6_warp_P1.warp",
            WARP_MATRIX_GREEN_LEFT = "/opt/dlp-warpmatrices/dlp_6_warp_P2.warp",
            WARP_MATRIX_BLUE_LEFT = "/opt/dlp-warpmatrices/dlp_6_warp_P3.warp",
            )

        viewingSetup.init_user(HEADTRACKING_SENSOR_STATION = "tracking-dlp-glasses-1")
        viewingSetup.init_user(HEADTRACKING_SENSOR_STATION = "tracking-dlp-glasses-2")
        viewingSetup.init_user(HEADTRACKING_SENSOR_STATION = "tracking-dlp-glasses-3")

        # manipulationManager = ManipulationManager()
        # manipulationManager.my_constructor(
        #     SCENEGRAPH = scenegraph,
        #     NAVIGATION_NODE = viewingSetup.navigation_node,
        #     POINTER_TRACKING_STATION = "tracking-pst-pointer-1",
        #     TRACKING_TRANSMITTER_OFFSET = _tracking_transmitter_offset,
        #     POINTER_DEVICE_STATION = "device-pointer-1",
        #     HEAD_NODE = viewingSetup.head_node,            
        #     )
            
    else:
        print("No Viewing Setup available for this workstation")
        quit()

    # viewingSetup.connect_navigation_matrix(steeringNavigation.sf_nav_mat)
    # steeringNavigation.set_rotation_center_offset(viewingSetup.get_head_position())

    print_graph(scenegraph.Root.value)

    # leap = LeapSensor()
    # leap.my_constructor(SCENE = scene, SCENEGRAPH = scenegraph, TRACKING_TRANSMITTER_OFFSET = _tracking_transmitter_offset)

    ## start application/render loop
    viewingSetup.run(locals(), globals())
Ejemplo n.º 2
0
def start():

    ## create scenegraph
    scenegraph = avango.gua.nodes.SceneGraph(Name="scenegraph")

    ## init scene
    scene = Scene(PARENT_NODE=scenegraph.Root.value)

    ## init navigation technique
    deviceInput = NewSpacemouseInput()
    deviceInput.my_constructor("gua-device-spacemouse")

    steeringNavigation = SteeringNavigation()
    steeringNavigation.my_constructor(
        deviceInput.mf_dof, deviceInput.mf_buttons, 0.15,
        1.0)  # connect navigation with spacemouse input
    steeringNavigation.set_start_matrix(
        avango.gua.make_trans_mat(0.0, 0.2, 0.25))

    ## init viewing setup
    ## init viewing and interaction setups
    hostname = open('/etc/hostname', 'r').readline()
    hostname = hostname.strip(" \n")

    print("wokstation:", hostname)

    if hostname == "orestes":  # Mitsubishi 3D-TV workstation
        _tracking_transmitter_offset = avango.gua.make_trans_mat(
            -0.98, -(0.58 + 0.975), 0.27 + 3.48) * avango.gua.make_rot_mat(
                90.0, 0, 1,
                0)  # transformation into tracking coordinate system

        viewingSetup = StereoViewingSetup(
            SCENEGRAPH=scenegraph,
            WINDOW_RESOLUTION=avango.gua.Vec2ui(1920, 1080),
            SCREEN_DIMENSIONS=avango.gua.Vec2(1.445, 0.81),
            LEFT_SCREEN_RESOLUTION=avango.gua.Vec2ui(1920, 1080),
            RIGHT_SCREEN_RESOLUTION=avango.gua.Vec2ui(1920, 1080),
            STEREO_FLAG=True,
            STEREO_MODE=avango.gua.StereoMode.CHECKERBOARD,
            HEADTRACKING_FLAG=True,
            HEADTRACKING_STATION=
            "tracking-art-glasses-1",  # wired 3D-TV glasses on Mitsubishi 3D-TV workstation
            TRACKING_TRANSMITTER_OFFSET=_tracking_transmitter_offset,
        )

        manipulationManager = ManipulationManager()
        manipulationManager.my_constructor(
            SCENEGRAPH=scenegraph,
            NAVIGATION_NODE=viewingSetup.navigation_node,
            POINTER_TRACKING_STATION="tracking-art-pointer-3",
            TRACKING_TRANSMITTER_OFFSET=_tracking_transmitter_offset,
            POINTER_DEVICE_STATION="device-pointer-3",  # gyromouse
            HEAD_NODE=viewingSetup.head_node,
        )

    elif hostname == "athena":  # small powerwall workstation
        _tracking_transmitter_offset = avango.gua.make_trans_mat(
            0.0, -1.42, 1.6)  # transformation into tracking coordinate system

        viewingSetup = StereoViewingSetup(
            SCENEGRAPH=scenegraph,
            WINDOW_RESOLUTION=avango.gua.Vec2ui(1920 * 2, 1200),
            SCREEN_DIMENSIONS=avango.gua.Vec2(3.0, 2.0),
            LEFT_SCREEN_POSITION=avango.gua.Vec2ui(140, 0),
            LEFT_SCREEN_RESOLUTION=avango.gua.Vec2ui(1780, 1185),
            RIGHT_SCREEN_POSITION=avango.gua.Vec2ui(1920, 0),
            RIGHT_SCREEN_RESOLUTION=avango.gua.Vec2ui(1780, 1185),
            STEREO_FLAG=True,
            STEREO_MODE=avango.gua.StereoMode.SIDE_BY_SIDE,
            HEADTRACKING_FLAG=True,
            HEADTRACKING_STATION=
            "tracking-art-glasses-2",  # small powerwall polarization glasses
            TRACKING_TRANSMITTER_OFFSET=_tracking_transmitter_offset,
        )

        manipulationManager = ManipulationManager()
        manipulationManager.my_constructor(
            SCENEGRAPH=scenegraph,
            NAVIGATION_NODE=viewingSetup.navigation_node,
            POINTER_TRACKING_STATION="tracking-art-pointer-2",
            TRACKING_TRANSMITTER_OFFSET=_tracking_transmitter_offset,
            POINTER_DEVICE_STATION="device-pointer-2",
            HEAD_NODE=viewingSetup.head_node,
        )

    elif hostname == "kronos":  # Samsung 3D-TV workstation
        _tracking_transmitter_offset = avango.gua.make_trans_mat(
            0.0, -0.5, 0.6)  # transformation into tracking coordinate system

        viewingSetup = StereoViewingSetup(
            SCENEGRAPH=scenegraph,
            WINDOW_RESOLUTION=avango.gua.Vec2ui(1920, 1080),
            SCREEN_DIMENSIONS=avango.gua.Vec2(1.235, 0.7),
            LEFT_SCREEN_RESOLUTION=avango.gua.Vec2ui(1920, 1080),
            RIGHT_SCREEN_RESOLUTION=avango.gua.Vec2ui(1920, 1080),
            STEREO_FLAG=True,
            STEREO_MODE=avango.gua.StereoMode.CHECKERBOARD,
            HEADTRACKING_FLAG=True,
            HEADTRACKING_STATION=
            "tracking-pst-glasses-1",  # wired 3D-TV glasses on Samsung 3D-TV workstation
            TRACKING_TRANSMITTER_OFFSET=_tracking_transmitter_offset,
        )

        manipulationManager = ManipulationManager()
        manipulationManager.my_constructor(
            SCENEGRAPH=scenegraph,
            NAVIGATION_NODE=viewingSetup.navigation_node,
            POINTER_TRACKING_STATION="tracking-pst-pointer-1",
            TRACKING_TRANSMITTER_OFFSET=_tracking_transmitter_offset,
            POINTER_DEVICE_STATION="device-pointer-1",
            HEAD_NODE=viewingSetup.head_node,
        )

    else:
        print("No Viewing Setup available for this workstation")
        quit()

    viewingSetup.connect_navigation_matrix(steeringNavigation.sf_nav_mat)
    steeringNavigation.set_rotation_center_offset(
        viewingSetup.get_head_position())

    print_graph(scenegraph.Root.value)

    ## start application/render loop
    viewingSetup.run(locals(), globals())