def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'main_display' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set some parameters VFOV = 60 aspect = viz.AUTO_COMPUTE stereo = viz.OFF #VC: create the raw object _window.fov(VFOV,aspect) _window.stereo(stereo) rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Generic', model='Custom Window') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getDisplay(_name).setParent(vizconnect.getAvatar('main_avatar').getAttachmentPoint('head')) #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'dk2' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set some parameters autoDetectMonitor = True #VC: create the raw object import oculus try: display = oculus.Rift(window=_window, autoDetectMonitor=autoDetectMonitor) _window.displayNode = display except AttributeError: _window.displayNode = None rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Oculus VR', model='DK2') #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'dk2' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set some parameters autoDetectMonitor = True #VC: create the raw object import oculus try: display = oculus.Rift(window=_window, autoDetectMonitor=autoDetectMonitor) _window.displayNode = display except AttributeError: _window.displayNode = None rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Oculus VR', model='DK2') #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'custom_window' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set some parameters VFOV = 60 aspect = viz.AUTO_COMPUTE stereo = viz.OFF #VC: create the raw object _window.fov(VFOV,aspect) _window.stereo(stereo) rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Generic', model='Custom Window') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getDisplay(_name).setParent(vizconnect.getAvatar('head_and_hand').getAttachmentPoint('head')) #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'rift' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: create the raw object import oculus _window.displayNode = oculus.Rift(window=_window, autoDetectMonitor=True) viz.window.setFullscreen(True) rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Oculus VR', model='Rift') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getDisplay(_name).setParent(vizconnect.getAvatar('female').getAttachmentPoint('head')) #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'zsight_60' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set the fullscreen monitor viz.window.setFullscreenMonitor(0) viz.window.setFullscreen(True) #VC: set some parameters Hofs = [0, 0] Vofs = [0, 0] Rofs = [0, 0] VerticalSpan = False #VC: create the raw object import sensics sensics.zSight_60(stereo=[viz.STEREO_HORZ, viz.STEREO_VERT][VerticalSpan], leftHorizontalShift=Hofs[0], rightHorizontalShift=Hofs[1], leftVerticalShift=Vofs[0], rightVerticalShift=Vofs[1], leftRollShift=Rofs[0], rightRollShift=Rofs[1], window=_window) rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Sensics', model='zSight 60') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getDisplay(_name).setParent( vizconnect.getTracker('optical_heading')) #VC: set the name of the default vizconnect.setDefault('display', 'zsight_60') #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'main_display' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set some parameters index = 0 #VC: create the raw object import steamvr # Get sensor from extension if not specified hmd = None sensor = None hmdList = steamvr.getExtension().getHMDList() if hmdList: try: sensor = hmdList[index] except IndexError: viz.logError("** ERROR: Not enough HMD's") else: viz.logError('** ERROR: Failed to detect SteamVR HMD') if sensor: hmd = steamvr.HMD(sensor=sensor, window=_window) hmd.setMonoMirror(True) _window.displayNode = hmd rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Valve', model='SteamVR HMD') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getDisplay(_name).setParent( vizconnect.getAvatar('main_avatar').getAttachmentPoint('head')) #VC: set the name of the default vizconnect.setDefault('display', 'main_display') #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'nvisor_st50' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set the fullscreen monitor viz.window.setFullscreenMonitor([3, 2]) viz.window.setFullscreen(True) #VC: set some parameters leftVerticalShift = 0 rightVerticalShift = 0 leftHorizontalShift = 0 rightHorizontalShift = 0 leftRollShift = 0 rightRollShift = 0 #VC: create the raw object import nvis nvis.nvisorST50(window=_window, leftVerticalShift=leftVerticalShift, rightVerticalShift=rightVerticalShift, leftHorizontalShift=leftHorizontalShift, rightHorizontalShift=rightHorizontalShift, leftRollShift=leftRollShift, rightRollShift=rightRollShift) rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='NVIS', model='nVisor ST50') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getDisplay(_name).setParent( vizconnect.getAvatar('male').getAttachmentPoint('head')) #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'main_display' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: make the window visible only for certain clients _clusterMask = viz.MASTER with viz.cluster.MaskedContext(viz.ALLCLIENTS&~_clusterMask):# hide _window.visible(False) with viz.cluster.MaskedContext(_clusterMask):# show _window.visible(True) #VC: set the fullscreen monitor with viz.cluster.MaskedContext(viz.MASTER):# only for clients with this display viz.window.setFullscreenMonitor(1) viz.window.setFullscreen(True) #VC: set some parameters autoDetectMonitor = True timeWarpEnabled = True #VC: create the raw object import oculus try: display = oculus.Rift(window=_window, autoDetectMonitor=autoDetectMonitor) display.setTimeWarp(timeWarpEnabled) _window.displayNode = display viz.window.setFullscreen(True) except AttributeError: _window.displayNode = None rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Oculus VR', model='Rift') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getDisplay(_name).setParent(vizconnect.getAvatar('main_avatar').getAttachmentPoint('head')) #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'steamvr_hmd' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set some parameters index = 0 #VC: create the raw object import steamvr # Get sensor from extension if not specified hmd = None sensor = None hmdList = steamvr.getExtension().getHMDList() if hmdList: try: sensor = hmdList[index] except IndexError: viz.logError("** ERROR: Not enough HMD's") else: viz.logError('** ERROR: Failed to detect SteamVR HMD') if sensor: hmd = steamvr.HMD(sensor=sensor, window=_window) _window.displayNode = hmd rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Valve', model='SteamVR HMD') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getDisplay(_name).setParent(vizconnect.getAvatar('white_male').getAttachmentPoint('head')) #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'projector' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init which needs to happen before viz.go if initFlag & vizconnect.INIT_PREVIZGO: viz.setOption('viz.stereo', viz.QUAD_BUFFER) #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set the fullscreen monitor viz.window.setFullscreenMonitor(3) viz.window.setFullscreen(True) #VC: set some parameters VFOV = 60 aspect = viz.AUTO_COMPUTE stereo = viz.QUAD_BUFFER #VC: create the raw object _window.fov(VFOV, aspect) _window.stereo(stereo) rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Generic', model='Custom Window') #VC: return values can be modified here return None
def initWrappers(): # get all of the raw items from vizconnect rawGroup = vizconnect.getRawGroupDict() rawInput = vizconnect.getRawInputDict() rawDisplay = vizconnect.getRawDisplayDict() rawTracker = vizconnect.getRawTrackerDict() rawTransport = vizconnect.getRawTransportDict() rawEvent = vizconnect.getRawEventDict() rawTool = vizconnect.getRawToolDict() rawAvatar = vizconnect.getRawAvatarDict() rawAnimator = vizconnect.getRawAnimatorDict() # below are listed the wrapped group objects # below are listed the wrapped display objects vizconnect.addDisplay(rawDisplay['zsight_60'], 'zsight_60', '', 'Sensics', 'zSight 60') # below are listed the wrapped tracker objects vizconnect.addTracker(rawTracker['ppt_Rhead'], 'ppt_Rhead', 'ppt', 'WorldViz', 'PPT') vizconnect.addTracker(rawTracker['optical_heading'], 'optical_heading', '', 'Virtual', 'Optical Heading') vizconnect.addTracker(rawTracker['ppt_hand'], 'ppt_hand', 'ppt', 'WorldViz', 'PPT') vizconnect.addTracker(rawTracker['osv3_sensor_bus'], 'osv3_sensor_bus', '', 'Inertial Labs', 'OSv3 (Sensor Bus)') vizconnect.addTracker(rawTracker['ppt_Lhead'], 'ppt_Lhead', 'ppt', 'WorldViz', 'PPT') # below are listed the wrapped input objects # below are listed the wrapped event objects # below are listed the wrapped transport objects # below are listed the wrapped tool objects # below are listed the wrapped avatar objects return True
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'main_display' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set some parameters autoDetectMonitor = True timeWarpEnabled = True #VC: create the raw object import oculus try: display = oculus.Rift(window=_window, autoDetectMonitor=autoDetectMonitor) display.setTimeWarp(timeWarpEnabled) _window.displayNode = display viz.window.setFullscreen(True) except AttributeError: _window.displayNode = None rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Oculus VR', model='DK2') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getDisplay(_name).setParent(vizconnect.getAvatar('main_avatar').getAttachmentPoint('head')) #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display CAVE_CONFIG_NAME = 'cave_manual_configuration' if vizconnect.isPendingInit('display', CAVE_CONFIG_NAME, initFlag, initList): #VC: init which needs to happen before viz.go if initFlag & vizconnect.INIT_PREVIZGO: viz.setOption('viz.stereo', viz.QUAD_BUFFER) #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #APG: constants, 5 total instances running... FRONT_WALL_CLUSTER_CLIENT = viz.CLIENT1 LEFT_WALL_CLUSTER_CLIENT = viz.CLIENT2 RIGHT_WALL_CLUSTER_CLIENT = viz.CLIENT3 FLOOR_LEFT_CLUSTER_CLIENT = viz.CLIENT4 FLOOR_RIGHT_CLUSTER_CLIENT = viz.CLIENT5 #These are determined by testing the monitors FRONT_WALL_MONITOR_ID = 1 LEFT_WALL_MONITOR_ID = 4 RIGHT_WALL_MONITOR_ID = 5 FLOOR_LEFT_MONITOR_ID = 3 FLOOR_RIGHT_MONITOR_ID = 2 #============================================== #Cave calculations #VC: create the raw object # Create a cave object import vizcave cave = vizcave.Cave(stereo=viz.QUAD_BUFFER) # get an origin node originName = CAVE_CONFIG_NAME initGroups(vizconnect.INIT_INDEPENDENT, [originName]) # ensure it's been created originNode = vizconnect.getGroup(originName).getNode3d() frontImageWidth = 5.5372 imageHeight = 2.2225 imageRise = 0.0 originLeft = 3.5503 originRight = 3.5503 sideImageWidth = 2.9591 shiftRight = 0 shiftUp = 0 shiftForward = 0 # get the originLeft angle from the origin measurements import math aOR = math.pi / 4.0 aAOR = (originRight**2 - originLeft**2 - frontImageWidth**2) / (-2 * originLeft * frontImageWidth) if abs(aAOR) <= 1: aOR = math.acos(aAOR) # convert the angle to front and right shifts Sr = -(math.cos(aOR) * originLeft - frontImageWidth / 2.0) Sf = (math.sin(aOR) * originLeft - sideImageWidth / 2.0) # find left/right, up/down, front/back (x,y,z) extent of caves R = frontImageWidth / 2.0 + Sr + shiftRight # right L = -frontImageWidth / 2.0 + Sr + shiftRight # left U = imageRise + imageHeight + shiftUp # up/top D = imageRise + shiftUp # bottom/down F = sideImageWidth / 2.0 + Sf + shiftForward # front B = -sideImageWidth / 2.0 + Sf + shiftForward # back # find corners # e.g. # Front Wall: C1,C2,C5,C6 # Left Wall: C0,C1,C4,C5 # Right Wall: C2,C3,C6,C7 C0 = L, U, B C1 = L, U, F C2 = R, U, F C3 = R, U, B C4 = L, D, B C5 = L, D, F C6 = R, D, F C7 = R, D, B C8 = L, D, 0 C9 = R, D, 0 C10 = -0.19939, D, F C11 = 0.19939, D, F C12 = -0.19939, D, 0 C13 = 0.19939, D, 0 # wall_list = [C0, C1, C2, C3, C4, # C5, C6, C7, C8, # C9, C10, C11, C12, C13] # # for item in wall_list: # print(item) #============================================== WALL_CORNERS = "corners" WALL_NAME = "name" WALL_CLUSTER_ID = "cluster_id" WALL_MONITOR_ID = "monitor_id" #Creates wall, then adds it to the vizcave obj def config_wall(wall_config, window): points = wall_config[WALL_CORNERS] cluster_client_id = wall_config[WALL_CLUSTER_ID] monitor_id = wall_config[WALL_MONITOR_ID] new_wall = vizcave.Wall(upperLeft=points[0], upperRight=points[1], lowerLeft=points[2], lowerRight=points[3], name=wall_config[WALL_NAME]) cave.addWall(new_wall, mask=cluster_client_id, window=window) with viz.cluster.MaskedContext(cluster_client_id): viz.window.setFullscreenMonitor(monitor_id) _window.setStereoSwap(False) viz.window.setFullscreen(True) #Create front wall #================================== wall_config = {} wall_config[WALL_CORNERS] = [C1, C2, C5, C6] wall_config[WALL_NAME] = "Front Wall" wall_config[WALL_CLUSTER_ID] = FRONT_WALL_CLUSTER_CLIENT wall_config[WALL_MONITOR_ID] = FRONT_WALL_MONITOR_ID config_wall(wall_config, _window) #Create right wall #================================== wall_config = {} wall_config[WALL_CORNERS] = [C2, C3, C6, C7] wall_config[WALL_NAME] = "Right Wall" wall_config[WALL_CLUSTER_ID] = RIGHT_WALL_CLUSTER_CLIENT wall_config[WALL_MONITOR_ID] = RIGHT_WALL_MONITOR_ID config_wall(wall_config, _window) # #Create left wall # #================================= wall_config = {} wall_config[WALL_CORNERS] = [C0, C1, C4, C5] wall_config[WALL_NAME] = "Left Wall" wall_config[WALL_CLUSTER_ID] = LEFT_WALL_CLUSTER_CLIENT wall_config[WALL_MONITOR_ID] = LEFT_WALL_MONITOR_ID config_wall(wall_config, _window) #Create floor_left #================================== wall_config = {} wall_config[WALL_CORNERS] = [C5, C11, C8, C13] wall_config[WALL_NAME] = "Floor Left" wall_config[WALL_CLUSTER_ID] = FLOOR_LEFT_CLUSTER_CLIENT wall_config[WALL_MONITOR_ID] = FLOOR_LEFT_MONITOR_ID config_wall(wall_config, _window) #Create floor_right #================================== wall_config = {} wall_config[WALL_CORNERS] = [C10, C6, C12, C9] wall_config[WALL_NAME] = "Floor Right" wall_config[WALL_CLUSTER_ID] = FLOOR_RIGHT_CLUSTER_CLIENT wall_config[WALL_MONITOR_ID] = FLOOR_RIGHT_MONITOR_ID config_wall(wall_config, _window) #================================== # We need to pass an object which will be used to update the projection # or the display to the view's position, typically this would be the # node attached to an avatar's head tracker. viewpoint = viz.addGroup() cave.setTracker(viewpoint) # Create a CaveView object for manipulating the entire cave environment. # The caveView is a node that can be adjusted to move the entire # cave around the virtual environment. caveView = vizcave.CaveView(viewpoint) _window.originLink = viz.link(originNode, caveView, dstFlag=viz.ABS_GLOBAL, srcFlag=viz.ABS_GLOBAL) _window.caveView = caveView _window.originNode = originNode _window.displayNode = cave _window.viewpointNode = viewpoint rawDisplay[CAVE_CONFIG_NAME] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[CAVE_CONFIG_NAME], CAVE_CONFIG_NAME, make='Generic', model='Cave Manual Configuration') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getDisplay(CAVE_CONFIG_NAME).setParent( vizconnect.getAvatar('head_and_hand').getAttachmentPoint( 'head')) #VC: set the name of the default vizconnect.setDefault('display', 'cave_manual_configuration') #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'exp_display' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.addWindow() _window.setView(viz.addView()) #VC: set placement with alignment: free _window.setPosition(0, 1, mode=viz.WINDOW_NORMALIZED) _window.setSize(1, 1, mode=viz.WINDOW_NORMALIZED) #VC: make the window visible only for certain clients _clusterMask = viz.CLIENT1 with viz.cluster.MaskedContext(viz.ALLCLIENTS&~_clusterMask):# hide _window.visible(False) with viz.cluster.MaskedContext(_clusterMask):# show _window.visible(True) #VC: set the fullscreen monitor with viz.cluster.MaskedContext(viz.CLIENT1):# only for clients with this display viz.window.setFullscreenMonitor(3) viz.window.setFullscreen(True) #VC: set some parameters VFOV = 60 aspect = viz.AUTO_COMPUTE stereo = viz.OFF #VC: create the raw object _window.fov(VFOV,aspect) _window.stereo(stereo) rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Generic', model='Custom Window') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getDisplay(_name).setParent(vizconnect.getTracker('head_tracker')) #VC: initialize a new display _name = 'rift_display' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set some parameters autoDetectMonitor = True timeWarpEnabled = True #VC: create the raw object import oculus try: display = oculus.Rift(window=_window, autoDetectMonitor=autoDetectMonitor) _window.displayNode = display viz.window.setFullscreen(True) except AttributeError: _window.displayNode = None rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Oculus VR', model='DK2') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getDisplay(_name).setParent(vizconnect.getTracker('head_tracker')) #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'main_display' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init which needs to happen before viz.go if initFlag & vizconnect.INIT_PREVIZGO: viz.setOption('viz.stereo', viz.QUAD_BUFFER) viz.setOption('viz.fullscreen', 1) #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set some parameters imageWidth = 3 imageHeight = 2.25 imageRise = 0.045 originLeft = 2.897 originRight = 2.934 shiftRight = 0 shiftUp = 0 shiftForward = 0 stereo = viz.QUAD_BUFFER swapStereo = False #VC: create the raw object # Create a cave object import vizcave cave = vizcave.Cave(stereo=stereo) # get an origin node originName = _name initGroups(vizconnect.INIT_INDEPENDENT, [originName]) # ensure it's been created originNode = vizconnect.getGroup(originName).getNode3d() # get the originLeft angle from the origin measurements import math aOR = math.pi / 4.0 aAOR = (originRight**2 - originLeft**2 - imageWidth**2) / (-2 * originLeft * imageWidth) if abs(aAOR) <= 1: aOR = math.acos(aAOR) # convert the angle to front and right shifts Sr = -(math.cos(aOR) * originLeft - imageWidth / 2.0) distanceToFront = math.sin(aOR) * originLeft # find left/right, up/down, front/back (x,y,z) extent of caves R = imageWidth / 2.0 + Sr + shiftRight # right L = -imageWidth / 2.0 + Sr + shiftRight # left U = imageRise + imageHeight + shiftUp # up/top D = imageRise + shiftUp # bottom/down F = distanceToFront + shiftForward # front C0 = L, U, F C1 = R, U, F C2 = L, D, F C3 = R, D, F #Create front wall wall = vizcave.Wall(upperLeft=C0, upperRight=C1, lowerLeft=C2, lowerRight=C3, name='Front Wall') cave.addWall(wall, window=_window) _window.setStereoSwap(swapStereo) #_window.setSize([1, 1]) # We need to pass an object which will be used to update the projection # or the display to the view's position, typically this would be the # node attached to an avatar's head tracker. viewpoint = viz.addGroup() cave.setTracker(viewpoint) # Create a CaveView object for manipulating the entire cave environment. # The caveView is a node that can be adjusted to move the entire # cave around the virtual environment. caveView = vizcave.CaveView(viewpoint, view=_window.getView()) _window.originLink = viz.link(originNode, caveView, dstFlag=viz.ABS_GLOBAL, srcFlag=viz.ABS_GLOBAL) _window.caveView = caveView _window.originNode = originNode _window.displayNode = cave _window.viewpointNode = viewpoint rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Generic', model='Powerwall') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getDisplay(_name).setParent( vizconnect.getAvatar('main_avatar').getAttachmentPoint('head')) #VC: set the name of the default vizconnect.setDefault('display', 'main_display') #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'cave_data_file' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init which needs to happen before viz.go if initFlag & vizconnect.INIT_PREVIZGO: viz.setOption('viz.stereo', viz.QUAD_BUFFER) viz.setOption('viz.fullscreen', 1) #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set some parameters stereo = viz.QUAD_BUFFER filename = 'C:/demos/Cave_settings.txt' #VC: create the raw object # Create a cave object import vizcave cave = vizcave.Cave(stereo=stereo) try: cave.load(filename) except IOError: viz.logError( "** Error: unable to load cave configuration file {}.". format(filename)) # get an origin node originName = _name initGroups(vizconnect.INIT_INDEPENDENT, [originName]) # ensure it's been created originNode = vizconnect.getGroup(originName).getNode3d() # We need to pass an object which will be used to update the projection # or the display to the view's position, typically this would be the # node attached to an avatar's head tracker. viewpoint = viz.addGroup() cave.setTracker(viewpoint) # Create a CaveView object for manipulating the entire cave environment. # The caveView is a node that can be adjusted to move the entire # cave around the virtual environment. caveView = vizcave.CaveView(viewpoint) _window.originLink = viz.link(originNode, caveView, dstFlag=viz.ABS_GLOBAL, srcFlag=viz.ABS_GLOBAL) _window.caveView = caveView _window.originNode = originNode _window.displayNode = cave _window.viewpointNode = viewpoint rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Generic', model='Cave Data File') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getDisplay(_name).setParent( vizconnect.getAvatar('head_and_hand').getAttachmentPoint( 'head')) #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'cave_manual_configuration' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init which needs to happen before viz.go if initFlag&vizconnect.INIT_PREVIZGO: #viz.setOption('viz.stereo', viz.QUAD_BUFFER) viz.setOption('viz.fullscreen', 1) viz.setOption('viz.antialias', 8) #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set some parameters frontWall = [1,2] rightWall = [3,4] backWall = -1 leftWall = [5,6] floor = -1 ceiling = -1 frontImageWidth = 3.6 imageHeight = 2.5 imageRise = 0.02 originLeft = 1.725 originRight = 2.205 sideImageWidth = 4 shiftRight = 0 shiftUp = 0 shiftForward = 0 stereo = viz.QUAD_BUFFER frontWallSwapStereo = False rightWallSwapStereo = False backWallSwapStereo = False leftWallSwapStereo = False floorSwapStereo = False ceilingSwapStereo = False #VC: create the raw object # Create a cave object import vizcave cave = vizcave.Cave(stereo=stereo) # get an origin node originName = _name initGroups(vizconnect.INIT_INDEPENDENT, [originName])# ensure it's been created originNode = vizconnect.getGroup(originName).getNode3d() if sideImageWidth == 0: sideImageWidth = frontImageWidth # extra configuration options to more explicitly control which wall goes where. frontWallClientIndex=-1 rightWallClientIndex=-1 backWallClientIndex=-1 leftWallClientIndex=-1 floorClientIndex=-1 ceilingClientIndex=-1 # get the originLeft angle from the origin measurements import math aOR = math.pi/4.0 aAOR = (originRight**2 - originLeft**2 - frontImageWidth**2)/(-2*originLeft*frontImageWidth) if abs(aAOR) <= 1: aOR = math.acos(aAOR) # convert the angle to front and right shifts Sr =-(math.cos(aOR)*originLeft-frontImageWidth/2.0) Sf = (math.sin(aOR)*originLeft-sideImageWidth/2.0) # find left/right, up/down, front/back (x,y,z) extent of caves R = frontImageWidth/2.0+Sr+shiftRight# right L =-frontImageWidth/2.0+Sr+shiftRight# left U = imageRise+imageHeight+shiftUp# up/top D = imageRise+shiftUp# bottom/down F = sideImageWidth/2.0+Sf+shiftForward# front B =-sideImageWidth/2.0+Sf+shiftForward# back # find corners # e.g. # Front Wall: C1,C2,C5,C6 # Left Wall: C0,C1,C4,C5 # Right Wall: C2,C3,C6,C7 C0 = L, U, B C1 = L, U, F C2 = R, U, F C3 = R, U, B C4 = L, D, B C5 = L, D, F C6 = R, D, F C7 = R, D, B clients = 0 #Create front wall if frontWall >= 0: wall = vizcave.Wall( upperLeft=C1, upperRight=C2, lowerLeft=C5, lowerRight=C6, name='Front Wall' ) if frontWallClientIndex == -1: frontWallClientIndex = clients cave.addWall(wall, mask=2**frontWallClientIndex, window=_window) with viz.cluster.MaskedContext(2**frontWallClientIndex): # check if the fullscreen monitor is defined. viz.window.setFullscreenMonitor(frontWall) _window.setStereoSwap(frontWallSwapStereo) viz.window.setFullscreenRectangle([2563, 15, 2260, 1585]) viz.window.setFullscreen(True) clients += 1 #Create right wall if rightWall >= 0: wall = vizcave.Wall( upperLeft=C2, upperRight=C3, lowerLeft=C6, lowerRight=C7, name='Right Wall' ) if rightWallClientIndex == -1: rightWallClientIndex = clients cave.addWall(wall, mask=2**rightWallClientIndex, window=_window) with viz.cluster.MaskedContext(2**rightWallClientIndex): # check if the fullscreen monitor is defined. viz.window.setFullscreenMonitor(rightWall) _window.setStereoSwap(rightWallSwapStereo) viz.window.setFullscreenRectangle([5120, 12, 2526, 1587]) viz.window.setFullscreen(True) clients += 1 #Create back wall if backWall >= 0: wall = vizcave.Wall( upperLeft=C3, upperRight=C0, lowerLeft=C7, lowerRight=C4, name='Back Wall' ) if backWallClientIndex == -1: backWallClientIndex = clients cave.addWall(wall, mask=2**backWallClientIndex, window=_window) with viz.cluster.MaskedContext(2**backWallClientIndex): # check if the fullscreen monitor is defined. viz.window.setFullscreenMonitor(backWall) _window.setStereoSwap(backWallSwapStereo) viz.window.setFullscreen(True) clients += 1 #Create left wall if leftWall >= 0: wall = vizcave.Wall( upperLeft=C0, upperRight=C1, lowerLeft=C4, lowerRight=C5, name='Left Wall' ) leftWallClientIndex = clients cave.addWall(wall, mask=2**leftWallClientIndex, window=_window) with viz.cluster.MaskedContext(2**leftWallClientIndex): # check if the fullscreen monitor is defined. viz.window.setFullscreenMonitor(leftWall) _window.setStereoSwap(leftWallSwapStereo) viz.window.setFullscreenRectangle([32, 20, 2525, 1580]) viz.window.setFullscreen(True) clients += 1 #Create floor if floor >= 0: wall = vizcave.Wall( upperLeft=C5, upperRight=C6, lowerLeft=C4, lowerRight=C7, name='Floor' ) floorClientIndex = clients cave.addWall(wall, mask=2**floorClientIndex, window=_window) with viz.cluster.MaskedContext(2**floorClientIndex): # check if the fullscreen monitor is defined. viz.window.setFullscreenMonitor(floor) _window.setStereoSwap(floorSwapStereo) viz.window.setFullscreen(True) clients += 1 #Create ceiling if ceiling >= 0: wall = vizcave.Wall( upperLeft=C0, upperRight=C3, lowerLeft=C1, lowerRight=C2, name='Ceiling' ) ceilingClientIndex = clients cave.addWall(wall, mask=2**ceilingClientIndex, window=_window) with viz.cluster.MaskedContext(2**ceilingClientIndex): # check if the fullscreen monitor is defined. viz.window.setFullscreenMonitor(ceiling) _window.setStereoSwap(ceilingSwapStereo) viz.window.setFullscreen(True) clients += 1 # We need to pass an object which will be used to update the projection # or the display to the view's position, typically this would be the # node attached to an avatar's head tracker. viewpoint = viz.addGroup() cave.setTracker(viewpoint) # Create a CaveView object for manipulating the entire cave environment. # The caveView is a node that can be adjusted to move the entire # cave around the virtual environment. caveView = vizcave.CaveView(viewpoint) _window.originLink = viz.link(originNode, caveView, dstFlag=viz.ABS_GLOBAL, srcFlag=viz.ABS_GLOBAL) _window.caveView = caveView _window.originNode = originNode _window.displayNode = cave _window.viewpointNode = viewpoint rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Generic', model='Cave Manual Configuration') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getDisplay(_name).setParent(vizconnect.getAvatar('head_and_hand').getAttachmentPoint('head')) #VC: return values can be modified here return None
def initDisplays(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawDisplay = vizconnect.getRawDisplayDict() #VC: initialize a new display _name = 'cave_manual_configuration' if vizconnect.isPendingInit('display', _name, initFlag, initList): #VC: init which needs to happen before viz.go if initFlag&vizconnect.INIT_PREVIZGO: viz.setOption('viz.stereo', viz.QUAD_BUFFER) #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set the window for the display _window = viz.MainWindow #VC: set some parameters frontWall = 1 rightWall = -1 backWall = -1 leftWall = -1 floor = -1 ceiling = -1 frontImageWidth = 2 imageHeight = 2 imageRise = 0.1 originLeft = 1.4142 originRight = 1.4142 sideImageWidth = 0 shiftRight = 0 shiftUp = 0 shiftForward = 0 stereo = viz.QUAD_BUFFER frontWallSwapStereo = False rightWallSwapStereo = False backWallSwapStereo = False leftWallSwapStereo = False floorSwapStereo = False ceilingSwapStereo = False #VC: create the raw object # Create a cave object import vizcave cave = vizcave.Cave(stereo=stereo) # get an origin node originName = _name initGroups(vizconnect.INIT_INDEPENDENT, [originName])# ensure it's been created originNode = vizconnect.getGroup(originName).getNode3d() if sideImageWidth == 0: sideImageWidth = frontImageWidth # extra configuration options to more explicitly control which wall goes where. frontWallClientIndex=-1 rightWallClientIndex=-1 backWallClientIndex=-1 leftWallClientIndex=-1 floorClientIndex=-1 ceilingClientIndex=-1 # get the originLeft angle from the origin measurements import math aOR = math.pi/4.0 aAOR = (originRight**2 - originLeft**2 - frontImageWidth**2)/(-2*originLeft*frontImageWidth) if abs(aAOR) <= 1: aOR = math.acos(aAOR) # convert the angle to front and right shifts Sr =-(math.cos(aOR)*originLeft-frontImageWidth/2.0) Sf = (math.sin(aOR)*originLeft-sideImageWidth/2.0) # find left/right, up/down, front/back (x,y,z) extent of caves R = frontImageWidth/2.0+Sr+shiftRight# right L =-frontImageWidth/2.0+Sr+shiftRight# left U = imageRise+imageHeight+shiftUp# up/top D = imageRise+shiftUp# bottom/down F = sideImageWidth/2.0+Sf+shiftForward# front B =-sideImageWidth/2.0+Sf+shiftForward# back # find corners # e.g. # Front Wall: C1,C2,C5,C6 # Left Wall: C0,C1,C4,C5 # Right Wall: C2,C3,C6,C7 C0 = L, U, B C1 = L, U, F C2 = R, U, F C3 = R, U, B C4 = L, D, B C5 = L, D, F C6 = R, D, F C7 = R, D, B clients = 0 #Create front wall if frontWall >= 0: wall = vizcave.Wall( upperLeft=C1, upperRight=C2, lowerLeft=C5, lowerRight=C6, name='Front Wall' ) if frontWallClientIndex == -1: frontWallClientIndex = clients cave.addWall(wall, mask=2**frontWallClientIndex, window=_window) with viz.cluster.MaskedContext(2**frontWallClientIndex): # check if the fullscreen monitor is defined. viz.window.setFullscreenMonitor(frontWall) _window.setStereoSwap(frontWallSwapStereo) viz.window.setFullscreen(True) clients += 1 #Create right wall if rightWall >= 0: wall = vizcave.Wall( upperLeft=C2, upperRight=C3, lowerLeft=C6, lowerRight=C7, name='Right Wall' ) if rightWallClientIndex == -1: rightWallClientIndex = clients cave.addWall(wall, mask=2**rightWallClientIndex, window=_window) with viz.cluster.MaskedContext(2**rightWallClientIndex): # check if the fullscreen monitor is defined. viz.window.setFullscreenMonitor(rightWall) _window.setStereoSwap(rightWallSwapStereo) viz.window.setFullscreen(True) clients += 1 #Create back wall if backWall >= 0: wall = vizcave.Wall( upperLeft=C3, upperRight=C0, lowerLeft=C7, lowerRight=C4, name='Back Wall' ) if backWallClientIndex == -1: backWallClientIndex = clients cave.addWall(wall, mask=2**backWallClientIndex, window=_window) with viz.cluster.MaskedContext(2**backWallClientIndex): # check if the fullscreen monitor is defined. viz.window.setFullscreenMonitor(backWall) _window.setStereoSwap(backWallSwapStereo) viz.window.setFullscreen(True) clients += 1 #Create left wall if leftWall >= 0: wall = vizcave.Wall( upperLeft=C0, upperRight=C1, lowerLeft=C4, lowerRight=C5, name='Left Wall' ) leftWallClientIndex = clients cave.addWall(wall, mask=2**leftWallClientIndex, window=_window) with viz.cluster.MaskedContext(2**leftWallClientIndex): # check if the fullscreen monitor is defined. viz.window.setFullscreenMonitor(leftWall) _window.setStereoSwap(leftWallSwapStereo) viz.window.setFullscreen(True) clients += 1 #Create floor if floor >= 0: wall = vizcave.Wall( upperLeft=C5, upperRight=C6, lowerLeft=C4, lowerRight=C7, name='Floor' ) floorClientIndex = clients cave.addWall(wall, mask=2**floorClientIndex, window=_window) with viz.cluster.MaskedContext(2**floorClientIndex): # check if the fullscreen monitor is defined. viz.window.setFullscreenMonitor(floor) _window.setStereoSwap(floorSwapStereo) viz.window.setFullscreen(True) clients += 1 #Create ceiling if ceiling >= 0: wall = vizcave.Wall( upperLeft=C0, upperRight=C3, lowerLeft=C1, lowerRight=C2, name='Ceiling' ) ceilingClientIndex = clients cave.addWall(wall, mask=2**ceilingClientIndex, window=_window) with viz.cluster.MaskedContext(2**ceilingClientIndex): # check if the fullscreen monitor is defined. viz.window.setFullscreenMonitor(ceiling) _window.setStereoSwap(ceilingSwapStereo) viz.window.setFullscreen(True) clients += 1 # We need to pass an object which will be used to update the projection # or the display to the view's position, typically this would be the # node attached to an avatar's head tracker. viewpoint = viz.addGroup() cave.setTracker(viewpoint) # Create a CaveView object for manipulating the entire cave environment. # The caveView is a node that can be adjusted to move the entire # cave around the virtual environment. caveView = vizcave.CaveView(viewpoint) _window.originLink = viz.link(originNode, caveView, dstFlag=viz.ABS_GLOBAL, srcFlag=viz.ABS_GLOBAL) _window.caveView = caveView _window.originNode = originNode _window.displayNode = cave _window.viewpointNode = viewpoint rawDisplay[_name] = _window #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addDisplay(rawDisplay[_name], _name, make='Generic', model='Cave Manual Configuration') #VC: return values can be modified here return None