screenMode=viz.FULLSCREEN if data["hmd"]["resolutions"][0]["display_mode"] != "full_screen": if data["hmd"]["resolutions"][0]["display_mode"]== "vert_side_by_side": screenMode=viz.FULLSCREEN | viz.STEREO_VERT else: screenMode=viz.FULLSCREEN | viz.STEREO_HORZ hmd=CustomHMD(data["hmd"]["field_of_view"]["monocular_horizontal"], data["hmd"]["field_of_view"]["monocular_vertical"], overlap=1.0*data["hmd"]["field_of_view"]["overlap_percent"]*data["hmd"]["field_of_view"]["monocular_horizontal"]/100, leftRollShift=data["hmd"]["rendering"]["left_roll"], rightRollShift=data["hmd"]["rendering"]["right_roll"], verticalShift=data["hmd"]["field_of_view"]["pitch_tilt"], stereo=screenMode); viz.window.setFullscreenMonitor(1) viz.enable(viz.AUTO_COMPUTE) viz.go(screenMode) #Create skylight sky_light = viz.addLight(euler=(0,0,0)) sky_light.position(0,0,0,0) sky_light.color(viz.WHITE) sky_light.ambient([5,5,5]) # necessary to light up images in Vizard 5 #Add the gallery mode gallery = viz.addChild('gallery.osgb')
def main(): # global variables global debug global pieces global shape global sidebar global sidebarBG global blockState global cursor global cursorPos global highlightedObj global highlightedObjType global selectedObj global selectedObjType global animRot global identity global selectedIndex global won global is900Sensor1 global old_data global all_data global iSenseMode # --------------------------------------------------------------------------- # init vizard # initialize pdb if debugging is needed # pdb.set_trace() # init intersense tracker iSenseMode = False # isense = viz.add('intersense.dle') # # wand. # if isense.valid() == True : # iSenseMode = True # is900Sensor1 = isense.addTracker(port=1,station=2) # viz.add('court.ive') """ Set the pivot point 2 meters above the origin. Set the rotation mode to blend its orientation from its current orientation to that associated with the pivot. """ # gotoRight = vizact.goto([2,1,-2],rotate_mode=viz.BLEND_ROTATE,pivot=[0,2,0],ori_mask=viz.BODY_ORI) # gotoLeft = vizact.goto([-2,2,-2],rotate_mode=viz.BLEND_ROTATE,pivot=[0,2,0],ori_mask=viz.BODY_ORI) # Use keyboard actions to move the viewpoint. # vizact.onkeydown(viz.KEY_ALT_L, viz.MainView.runAction, gotoRight ) # # vizact.onkeydown(viz.KEY_ALT_R, viz.MainView.runAction, gotoLeft ) # cam = vizcam.PivotNavigate(center=[0,1,0],distance=4) # viz.cam.setHandler(cam) # # cam.enabled = True # viz.cam.setHandler(vizcam.KeyboardCamera()) # vizcam.PivotNavigate(center=[0,1,0],distance=5) # assign space mouse callbacks # viz.callback(vizspace.ROTATE_EVENT,spaceRot) old_data = [] all_data = [] # set the maximum frame rate to something lower than the minimum the application runs # so that the FPS is constant throughout the run viz.setOption("viz.max_frame_rate", "60") # set the full screen monitor to 1 viz.setOption("viz.fullscreen.monitor", 2) # start in full screen # viz.go(viz.FULLSCREEN) viz.go() # vizcam.PivotNavigate(center=[0,1,0],distance=5) # set cursor visibility # viz.mouse.setVisible(viz.OFF) # enable backface culling viz.enable(viz.CULL_FACE) # set clear color for raster viz.clearcolor(Colors.WHITE) # --------------------------------------------------------------------------- # init variables # flag to toggle debug breakpoints - Use 'x' to toggle debug = False # list of pieces available pieces = [] # won the game won = False # group with all cubes in their final position - read from file shape = viz.add(viz.GROUP, viz.WORLD) # input file with description of pieces and # input_file = open('puzzle.txt','r') # parseInputFile(input_file) # since we still don't have an input format, we build the puzzle manually buildPuzzle(3, 3, 3) # create sidebar to indicate existing pieces/possibilities sidebar = [] sidebarBG = createQuad([0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]) sidebarBG.depthFunc(viz.GL_ALWAYS) sidebarBG.drawOrder(100) buildSideBar() animRot = 0 identity = vizmat.Transform() identity.makeIdent() cursor = vizshape.addSphere(radius=0.2) cursor.color(Colors.LIGHT_BLUE) cursorPos = [0.0, 0.0, 3.0] selectedObj = None selectedObjType = None selectedIndex = -1 highlightedObj = None highlightedObjType = None # assign keyDown and keyUp as callback functions for events viz.callback(viz.KEYDOWN_EVENT, keyDown) viz.callback(viz.KEYUP_EVENT, keyUp) # register the update function to be called every iteration of the main loop vizact.ontimer(0, update)
def main(): # global variables global debug global pieces global shape global sidebar global sidebarBG global blockState global cursor global cursorPos global highlightedObj global highlightedObjType global selectedObj global selectedObjType global animRot global identity global selectedIndex global won #--------------------------------------------------------------------------- # init vizard # initialize pdb if debugging is needed #pdb.set_trace() # set the maximum frame rate to something lower than the minimum the application runs # so that the FPS is constant throughout the run viz.setOption('viz.max_frame_rate','60') # set the full screen monitor to 1 viz.setOption('viz.fullscreen.monitor',2) # start in full screen #viz.go(viz.FULLSCREEN) viz.go() # set cursor visibility #viz.mouse.setVisible(viz.OFF) # enable backface culling viz.enable(viz.CULL_FACE) # set clear color for raster viz.clearcolor(Colors.WHITE) #--------------------------------------------------------------------------- # init variables # flag to toggle debug breakpoints - Use 'x' to toggle debug = False # list of pieces available pieces = [] # won the game won = False # group with all cubes in their final position - read from file shape = viz.add(viz.GROUP,viz.WORLD) # input file with description of pieces and #input_file = open('puzzle.txt','r') #parseInputFile(input_file) # since we still don't have an input format, we build the puzzle manually buildPuzzle(3,3,3) # create sidebar to indicate existing pieces/possibilities sidebar = [] sidebarBG = createQuad([0,0,0],[0,0,0],[0,0,0],[0,0,0]) sidebarBG.depthFunc(viz.GL_ALWAYS) sidebarBG.drawOrder(100) buildSideBar() animRot = 0 identity = vizmat.Transform() identity.makeIdent() cursor = vizshape.addSphere(radius=0.2) cursor.color(Colors.LIGHT_BLUE) cursorPos = [0.0,0.0,3.0] selectedObj = None selectedObjType = None selectedIndex = -1 highlightedObj = None highlightedObjType = None # assign keyDown and keyUp as callback functions for events viz.callback(viz.KEYDOWN_EVENT, keyDown) viz.callback(viz.KEYUP_EVENT, keyUp) # register the update function to be called every iteration of the main loop vizact.ontimer(0,update)