def main():
    # Initialize window
    viz.setMultiSample(8)
    viz.go()

    # Setup SteamVR HMD
    hmd = steamvr.HMD()
    if not hmd.getSensor():
        sys.exit('SteamVR HMD not detected')

    # Setup navigation node and link to main view
    navigationNode = viz.addGroup()
    viewLink = viz.link(navigationNode, viz.MainView)
    viewLink.preMultLinkable(hmd.getSensor())

    # Load environment
    gallery = vizfx.addChild('gallery.osgb')
    gallery.hint(viz.OPTIMIZE_INTERSECT_HINT)
    gallery.disable(viz.SHADOW_CASTING)

    #Create skylight
    viz.MainView.getHeadLight().disable()
    sky_light = viz.addDirectionalLight(euler=(0,90,0), color=viz.WHITE)
    sky_light.setShadowMode(viz.SHADOW_DEPTH_MAP)
    
    #Start the Leap Motion!
    handGenerator = LeapListener()
    handGenerator.startLeap(hmd.getSensor())
    
    # Add controllers
    for controller in steamvr.getControllerList():

        # Create model for controller
        controller.model = controller.addModel(parent=navigationNode)
        controller.model.disable(viz.INTERSECTION)
        viz.link(controller, controller.model)
Ejemplo n.º 2
0
Use the mouse and WASD keys to move around.
Press spacebar to begin the hunt!""".format(TRIAL_COUNT,TRIAL_DURATION)

RESULTS = """You found {} of {} pigeons.
Press spacebar to start over or escape to exit."""

TRIAL_SUCCESS = 'You caught the pigeon!'
TRIAL_FAIL = 'The pigeon flew away!'

viz.setMultiSample(4)
viz.fov(60)
viz.go(viz.FULLSCREEN)

# Setup directional light
viz.MainView.getHeadLight().disable()
sky_light = viz.addDirectionalLight(euler=(0,20,0))
sky_light.color(viz.WHITE)
sky_light.ambient([0.8]*3)
viz.setOption('viz.lightModel.ambient',[0]*3)

# Setup keyboard/mouse tracker
tracker = vizcam.addWalkNavigate(moveScale=2.0)
tracker.setPosition([0,1.8,0])
viz.link(tracker,viz.MainView)
viz.mouse.setVisible(False)

# Load piazza environment
piazza = viz.addChild('piazza.osgb')
viz.addChild('piazza_animations.osgb')

# Loop fountain sound
Ejemplo n.º 3
0
	def printPos():
		print nav.getPosition()
#	vizact.onkeyup(' ',printPos)
	
#	viz.mouse(viz.OFF)
#	viz.mouse.setVisible(False)
	viz.mouse.setTrap()

	# Add environment
	maze = vizfx.addChild('maze.osgb')
	maze.hint(viz.OPTIMIZE_INTERSECT_HINT)
	maze.disable(viz.SHADOW_CASTING)
	
	#Create skylight
	viz.MainView.getHeadLight().disable()
	sky_light = viz.addDirectionalLight(euler=(0,90,0), color=viz.WHITE)
	sky_light.setShadowMode(viz.SHADOW_DEPTH_MAP)
	
	# Create canvas for displaying GUI objects
	canvas = viz.addGUICanvas(pos=[0, 3.0, 3.0])
	canvas.alignment(viz.ALIGN_CENTER)
	canvasButtonTask = viztask.schedule(CanvasButtonTask(canvas))
	instructions ="""Use the trigger to select
	and jump to painting."""
	panel = vizinfo.InfoPanel(instructions, title='Vizard SteamVR Demo', key=None, icon=False, align=viz.ALIGN_CENTER, parent=canvas)
	click_button = viz.addButton(parent=canvas)
	SetWorld()
	bb = panel.getBoundingBox()
	canvas.setRenderWorld([bb.width, bb.height],[1,viz.AUTO_COMPUTE])	
	print(canvas.getNodeNames())
	
Ejemplo n.º 4
0
#	Y = viz.addText3D('Y',pos=[0,1.1,0],color=viz.GREEN,scale=[0.3,0.3,0.3],align=viz.ALIGN_CENTER_BASE,parent=axes)
#	Z = viz.addText3D('Z',pos=[0,0,1.1],color=viz.BLUE,scale=[0.3,0.3,0.3],align=viz.ALIGN_CENTER_BASE,parent=axes)
	bridge_root.setPosition(pos)
	bridge_root.setEuler(euler)
	return bridge_root
	
if __name__ == '__main__':
	viz.setMultiSample(8)
	
	viz.go()
	
	for window in viz.getWindowList():
		window.getView().getHeadLight().disable()
#		
#	# Create directional light
	sky_light = viz.addDirectionalLight(euler=(-66,37,0),color=[1,1,1])
##	light1 = vizfx.addDirectionalLight(euler=(40,20,0), color=[0.7,0.7,0.7])
##	light2 = vizfx.addDirectionalLight(euler=(-65,15,0), color=[0.5,0.25,0.0])
##	sky_light.color(viz.WHITE)
#	# Adjust ambient color
#	viz.setOption('viz.lightModel.ambient',[0]*3)
#	sky_light.ambient([0.8]*3)
#	vizfx.setAmbientColor([0.3,0.3,0.4])	
	import oculus
	hmd = oculus.Rift()
	if not hmd.getSensor(): 
		viz.logError('**ERROR: Failed to detect Oculus!')
	
	ORIGIN = [0,5,-17]
	
	gridRoot = GridRoot()