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
Esempio n. 2
0
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
Esempio n. 3
0
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
Esempio n. 4
0
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
Esempio n. 6
0
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
Esempio n. 8
0
def hide():
    """Function used to remove/hide/disable non vizard resources. This is
	necessary to supply context switching between multiple, demos or scripts.
	"""
    for proxyWrapper in vizconnect.getToolsWithMode('Proxy'):
        proxyWrapper.getRaw().clear()
    vp.remove(vizconnect.getDisplay())
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
Esempio n. 10
0
def show():
    """Function used to add/show/enable non vizard resources. This is
	necessary to supply context switching between multiple, demos or scripts.
	"""
    for proxyWrapper in vizconnect.getToolsWithMode('Proxy'):
        grabberTool = vizconnect.getTool('grabber_tool_based_on_' +
                                         proxyWrapper.getName()).getRaw()
        # for proxies: set obj, function, action index
        proxyWrapper.getRaw().setCallback(grabberTool, grabberTool.grabAndHold,
                                          1)
    vp.add(vizconnect.getDisplay())
    resetMovedObjects(playAudio=False)
Esempio n. 11
0
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: set the parent of the node
        if initFlag & vizconnect.INIT_PARENTS:
            vizconnect.getDisplay(_name).setParent(
                vizconnect.getTracker('dk2'))

    #VC: return values can be modified here
    return None
def initGroups(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawGroup = vizconnect.getRawGroupDict()

	#VC: initialize a new group
	_name = 'cave_manual_configuration'
	if vizconnect.isPendingInit('group', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: create the raw object
			rawGroup[_name] = viz.addGroup()
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addGroup(rawGroup[_name], _name, make='Virtual', model='Origin')
	
		#VC: set the parent of the node
		if initFlag&vizconnect.INIT_PARENTS:
			vizconnect.getGroup(_name).setParent(vizconnect.getDisplay('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 = '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 initTransports(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTransport = vizconnect.getRawTransportDict()

	#VC: initialize a new transport
	_name = 'wandmagiccarpet'
	if vizconnect.isPendingInit('transport', _name, initFlag, initList):
		#VC: request that any dependencies be created
		if initFlag&vizconnect.INIT_INDEPENDENT:
			initTrackers(vizconnect.INIT_INDEPENDENT, ['merged'])
	
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			orientationTracker = vizconnect.getTracker('merged').getNode3d()
			debug = False
			acceleration = 2.0
			maxSpeed = 2.0
			rotationAcceleration = 60.0
			maxRotationSpeed = 65.0
			autoBreakingDragCoef = 0.1
			dragCoef = 0.0001
			rotationAutoBreakingDragCoef = 0.2
			rotationDragCoef = 0.0001
			usingPhysics = False
			parentedTracker = False
			transportationGroup = None
			
			#VC: create the raw object
			from transportation import wand_magic_carpet
			rawTransport[_name] = wand_magic_carpet.WandMagicCarpet(	orientationTracker=orientationTracker,
																					debug=debug,
																					acceleration=acceleration,
																					maxSpeed=maxSpeed,
																					rotationAcceleration=rotationAcceleration,
																					maxRotationSpeed=maxRotationSpeed,
																					autoBreakingDragCoef=autoBreakingDragCoef,
																					dragCoef=dragCoef,
																					rotationAutoBreakingDragCoef=rotationAutoBreakingDragCoef,
																					rotationDragCoef=rotationDragCoef,
																					usingPhysics=usingPhysics,
																					parentedTracker=parentedTracker,
																					node=transportationGroup)
	
		#VC: init the mappings for the raw object
		if initFlag&vizconnect.INIT_MAPPINGS:
			#VC: per frame mappings
			if initFlag&vizconnect.INIT_MAPPINGS_PER_FRAME:
				#VC: get the raw input dict so we have access to signals
				import vizact
				rawInput = vizconnect.getConfiguration().getRawDict('input')
				#VC: set the update function which checks for input signals
				def update(transport):
					if rawInput['keyboard'].isButtonDown(17):# make=Generic, model=Keyboard, name=keyboard, signal=Key W
						transport.moveForward(mag=1)
					if rawInput['keyboard'].isButtonDown(31):# make=Generic, model=Keyboard, name=keyboard, signal=Key S
						transport.moveBackward(mag=1)
					if rawInput['keyboard'].isButtonDown(30):# make=Generic, model=Keyboard, name=keyboard, signal=Key A
						transport.moveLeft(mag=1)
					if rawInput['keyboard'].isButtonDown(32):# make=Generic, model=Keyboard, name=keyboard, signal=Key D
						transport.moveRight(mag=1)
					if rawInput['keyboard'].isButtonDown(57):# make=Generic, model=Keyboard, name=keyboard, signal=Key SPACE
						transport.moveUp(mag=1)
					if rawInput['keyboard'].isButtonDown(29):# make=Generic, model=Keyboard, name=keyboard, signal=Key CONTROL_L
						transport.moveDown(mag=1)
					if rawInput['keyboard'].isButtonDown(16):# make=Generic, model=Keyboard, name=keyboard, signal=Key Q
						transport.turnLeft(mag=1)
					if rawInput['keyboard'].isButtonDown(18):# make=Generic, model=Keyboard, name=keyboard, signal=Key E
						transport.turnRight(mag=1)
				rawTransport[_name].setUpdateFunction(update)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTransport(rawTransport[_name], _name, make='Virtual', model='WandMagicCarpet')
	
		#VC: set the pivot of the node
		if initFlag&vizconnect.INIT_PIVOTS:
			vizconnect.getTransport(_name).setPivot(vizconnect.getDisplay('rift').getNode3d())

	#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
    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
#x_translate_shifted2=x_translate1+1.5
#x_translate_shifted3=x_translate1+1.5


height1= 1
#height2= .025
#height3=.025

#tracking data
import hand

    
vizconnect.go('./vizconnect_config.py')
headTracker = vizconnect.getRawTracker('optical_heading')
handTracker = vizconnect.getRawTracker('ppt_hand')
viewpoint = vizconnect.getDisplay().getNode3d()
movable = vizconnect.getMovableNode()
main_sphere=vizshape.addSphere(radius=.005,slices=20,stacks=20)
viz.link(handTracker, main_sphere)
#viztracker.go()
#
#
#composite = viztracker.getManager().getCompositeList()[0]
#headTracker = composite.getRawTracker(composite.HEAD)
#handTracker = composite.getRawTracker(composite.RHAND)
#handTracker = viztracker.main_sphere
#stupidhand = viztracker.get('righthand') 
#stupidhand.setScale(.01,.01,.01)
#viewpoint = viztracker.get('viewpoint')
#movable = viztracker.get("movable")
print('viewpoint')
Esempio n. 18
0
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
Esempio n. 19
0
vp = vizconnect.addViewpoint(
    pos=[5, 0, 8.83],
    euler=[90, 0, 0],
    posMode=posMode,
    oriMode=oriMode,
)

vp2 = vizconnect.addViewpoint(
    pos=[5, -.5, 8.83],
    euler=[90, 0, 0],
    posMode=posMode,
    oriMode=oriMode,
)

# Displays are added to vizconnect viewpoints
vp.add(vizconnect.getDisplay())
vp2.add(vizconnect.getDisplay())
vp.setEnabled(viz.ON)

# Call reset viewpoints, which forces the display into the vizconnect viewpoint position.
vizconnect.resetViewpoints()
# add a reset key so when r is pressed the user is moved back to the viewpoint
vizact.onkeydown('r', vizconnect.resetViewpoints)
#crouch key
vizact.onkeydown('c', fc)

inorderprompt = viz.addText3D('It must be done in order', viz.SCREEN)

#made grabbable rbg spheres
sphere1 = vizshape.addSphere(radius=.1)
sphere1.setPosition(10.62, .3, 12)
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
Esempio n. 21
0
for i, pos in enumerate(scene2_pos):
    vp = vizconnect.addViewpoint(pos=pos,
                                 euler=scene2_ori[i],
                                 oriMode=oriMode,
                                 posMode=posMode)
    vp2.append(vp)

vp3 = []
for pos in scene3_pos:
    vp = vizconnect.addViewpoint(pos=pos,
                                 euler=[0, 0, 0],
                                 oriMode=oriMode,
                                 posMode=posMode)
    vp3.append(vp)

display = vizconnect.getDisplay()

scene1.setActive(True)
scene2.setActive(False)
scene3.setActive(False)

# Create quad to signal jump
jump_signal = viz.addTexQuad(size=0.3, pos=[-1.5, -0.8, 3])
jump_signal.visible(0)
jump_signal.setReferenceFrame(viz.RF_EYE)
jump_signal.disable(
    [viz.LIGHTING, viz.INTERSECTION, viz.DEPTH_TEST, viz.SHADOW_CASTING])
jump_signal.drawOrder(100)
jump_texture = viz.addTexture('art/jump.png')
jump_signal.texture(jump_texture)