예제 #1
0
def init_settings(mainSceneWindow, cameraWindow, cameraWindowView, cam, pause_screen, nunchuck_disconnect_screen, message_screen, wiimote, nunchuck_wiimote, should_it_run):
	viz.MainWindow.visible(viz.OFF) #Hago invisible la main window
	viz.setMultiSample(8) # FSAA de 8
	viz.fogcolor = viz.BLACK # Color de sombra = negro
	viz.fog(0.15) # Agrega sombra de tipo exponencial
	viz.collision(viz.ON) # Habilita colisiones en el mundo
	viz.phys.enable() # Habilita la fisica

	#Desabilita mouse
	viz.mouse.setOverride(viz.ON)

	#Mouse invisible
	viz.mouse.setVisible(viz.OFF)

	#Subventana que renderea viz.MainWindow
	mainSceneWindow = viz.addWindow()
	mainSceneWindow.setSize(0.7,1)
	mainSceneWindow.setPosition(0,1)
	mainSceneWindow.fov(40, 1.3) # Coloca el FOV de la ventana principal en la actual con los valores de default (40 grados verticales, 1.3 aspect ratio)

	#Creando una ventana y un punto de vista para la camara
	cameraWindow = viz.addWindow(pos =[.7,1],size=(0.4,1)) #Creando la ventana
	cameraWindowView = viz.addView() #Creando un viewpoint
	cameraWindowView.setScene(2) #Poniendo la nueva ventana en la escena 2
	cameraWindow.setView(cameraWindowView) #Ligando el viewpoint con la nueva ventana

	#Vincular camara web a plugin de AR
	cam = ar.addWebCamera(window=cameraWindow) #Agregando una camara en la ventada nueva

	# Configuracion de mensajes de la pantalla
	message_screen = viz.addTexQuad(parent=viz.SCREEN, pos=[0.5,0.5,1], scale=[12.80,10.24,1]) 
	pause_screen = viz.add("PAUSA.png")
	nunchuck_disconnect_screen = viz.add("NUNCHUCK_DISCONNECTED.png")
	message_screen.texture(pause_screen)
	message_screen.visible(viz.OFF) #Cuando should_it_run sea False, viz.ON es el valor a usar.

	# Conecta al primer wiimote disponible
	wiimote = wii.addWiimote()
	# Prende el LED 1 del wiimote
	wiimote.led = wii.LED_1
	# Obten el nunchuck del wiimote
	nunchuck_wiimote = wiimote.nunchuk 

	#Determines wheter the program should run or not.
	#It will run if the Nunchuck is connected; otherwise, it won't.
	should_it_run = True

	#Ensures that the program won't run without the NUNCHUCK plug'd in.
	if(wiimote.getExtension() == wii.EXT_NUNCHUK):
		should_it_run = True
	else:
		print "Please plug-in the Wii NUNCHUCK."
		message_screen.texture(nunchuck_disconnect_screen)
		message_screen.visible(viz.ON)
		should_it_run = False
	
	return mainSceneWindow, cameraWindow, cameraWindowView, cam, pause_screen, nunchuck_disconnect_screen, message_screen, wiimote, nunchuck_wiimote, should_it_run
예제 #2
0
import viz
import vizact
import viztask
import vizcam
import random

viz.setMultiSample(4)
viz.fov(40)
viz.go()

# 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)
viz.collision(viz.ON)

viz.MainView.setPosition([4, 0, 2])
gallery = viz.addChild('gallery.osgb')

#-----------Info panel set up--------------------
import vizinfo
#Add info panel to display messages to participant
instructions = vizinfo.InfoPanel(icon=False, key=None)
#------------------------------------------------

#-----------Sensor creation----------------------
import vizproximity
target = vizproximity.Target(viz.MainView)

viewPath = []
예제 #3
0
import viz
import viztask
import vizjoy
import math
import random
import time
import vizshape
import vizact
import datetime
import time
import Queue


viz.go(viz.PROMPT)
viz.collision(viz.ON)


''' *************************** KINECT CODE ***************************** '''
#myHead = vrpn.addTracker( 'Tracker0@localhost', HEAD)
HEAD = 0
NECK = 1
TORSO = 2
WAIST = 3
LEFTCOLLAR = 4
LEFTSHOULDER = 5
LEFTELBOW = 6
LEFTWRIST = 7
LEFTHAND = 8
LEFTFINGERTIP = 9
RIGHTCOLLAR = 10
RIGHTSHOULDER = 11
예제 #4
0
import viz
import viztask
import vizjoy
import math
import random
import time
import vizshape
import vizact
import datetime
import time
#import Queue


viz.go(viz.PROMPT)
viz.collision(viz.OFF)


''' *************************** KINECT CODE ***************************** '''
#myHead = vrpn.addTracker( 'Tracker0@localhost', HEAD)
HEAD = 0
NECK = 1
TORSO = 2
WAIST = 3
LEFTCOLLAR = 4
LEFTSHOULDER = 5
LEFTELBOW = 6
LEFTWRIST = 7
LEFTHAND = 8
LEFTFINGERTIP = 9
RIGHTCOLLAR = 10
RIGHTSHOULDER = 11
예제 #5
0
        print "We made it to Ramesses"
        info.setText('Lets get started')
    elif e.sensor == sensorAvatar3:
        print "We made it to Taharqa!"
        info.setText('Lets get started')
    elif e.sensor == sensorAvatar4:
        print "we made it to Amun!"
        info.setText('Lets get started')
    #Michael's additions
    elif e.sensor == sensorAvatarGreatHallSethosRamesses:
        print "We made it to the Great Hypostyle Hall of Sethos II"
        info.setText('Lets get started')
    elif e.sensor == sensorAvatarKioskOfSethos:
        print "We made it to the Kiosk of Sethos II"
        info.setText('Lets get started')
    elif e.sensor == sensorAvatarOpetTemple:
        print "We made it to the Opet Temple "
        info.setText('Lets get started')
    elif e.sensor == sensorAvatarTempleOfKhons:
        print "We made it to the Temple of Khons"
        info.setText('Lets get started')
    elif e.sensor == sensorAvatarHallOfThutmose:
        print "We made it to the Festival Hall of Thutmose III"
        info.setText('Lets get started')
    #end Michael's edits


manager.onEnter(None, EnterProximity)
#manager.onExit(None,LeaveProximity)
viz.collision(viz.ON)  #user will collide with walls and stop moving
viz.MainView.gravity(0)
#Import module to gain access to enture Vizard Code library
import viz
import vizact
import time
import serial
import viztracker

viz.setMultiSample(4)
viz.fov(60)
viz.go()  # Start an empty world

gallery = viz.addChild(
    'ground.osgb')  # Add a model of a gallery into the virtual world
viz.collision(viz.ON)  # Stop navigation through 3D models

hand = viz.add('white_ball.wrl')  # Add the object that will do the grabbing

# Link the hand to a 3D mousetracker
mouseTracker = viztracker.MouseTracker()
mouseTracker.scroll(-8)
viz.link(mouseTracker, hand)

viz.mouse(viz.OFF)  # Disable mouse navigation

# Add a box model and set its position
basketball = viz.addChild('basketball.osgb')
basketball.setPosition([0, 2, 1.5])

ser = serial.Serial('COM3', 9600,
                    timeout=1)  # Open serial channel or selected port
예제 #7
0
def createEnvironment():	
	global point 
	global arrow 
	global goal	 
	global thrust
	global shadow

	#create 3D environment
	if parameters.dreiDEnvironment:

		piazza = viz.addChild('piazza.osgb')
	
		#look from above
		viz.MainView.setPosition([0,1.8,-5])
		viz.MainView.setEuler([0,20,0])
		viz.collision(viz.ON)
		# gorund for collision
		ground = viz.add('tut_ground.wrl')  # Add ground
		ground.collidePlane()   # Make collideable plane 
		ground.disable(viz.RENDERING)
		ground.disable(viz.DEPTH_WRITE)
		
		# point
		#point = viz.add('ball.wrl')
		point = vizshape.addSphere(radius = parameters.pointRadius, slices = 20, stacks = 20, axis = vizshape.AXIS_Y)
		pointPhys = point.collideSphere()   # Define ball's physical properties 
	
		point.setEuler(0,90,0)
		point.setPosition(0,parameters.point_height,0)
		point.color(viz.RED)
		point.setScale(0.5,0.5,0.5)
		point.enable( viz.COLLIDE_NOTIFY )
		
		#goal
		goal = vizshape.addCircle(slices=100, radius=0.3)		
		goal.setEuler(0,90,0)
		goal.color(viz.GREEN)		
		goal.setPosition(0,parameters.goal_height,0)
		goal.setScale(parameters.goal_scale3D,parameters.goal_scale3D,parameters.goal_scale3D)
		
		#shadow
		shadow = vizshape.addCircle(slices=100, radius=0.3)		
		shadow.setEuler(0,90,0)
		shadow.color(viz.GRAY)		
		shadow.setPosition(0,parameters.shadow_height,0)
		shadow.setScale(parameters.shadow_scale3D,parameters.shadow_scale3D,parameters.shadow_scale3D)

		#arrow
		arrow = vizshape.addArrow()	
		arrow.setPosition(0,parameters.arrow_height3D,0)
		arrow.color(viz.BLUE)
		
		#thrust
		thrust = point.addThruster(force=[0,0,0]) 

	#or create 2d environment
	else:
		viz.clearcolor(viz.WHITE)

		#look from above
		viz.MainView.setPosition([0,8,0])
		viz.MainView.setEuler([0,90,0])
		
		#point = viz.add('ball.wrl')
		point = vizshape.addSphere(radius = parameters.pointRadius, slices = 20, stacks = 20, axis = vizshape.AXIS_Y)
		pointPhys = point.collideSphere()   # Define ball's physical properties 		
		point.setEuler(0,90,0)
		point.setPosition(0,parameters.point_height,0)
		point.color(viz.RED)	
		point.visible(False)
		point.enable( viz.COLLIDE_NOTIFY )

		#wind force
		thrust = point.addThruster(force=[0,0,0]) 
		
		#goal
		goal = vizshape.addCircle(slices=100, radius=0.2)
		goal.setEuler(0,90,0)
		goal.color(viz.GREEN)
		goal.visible(False)
		goal.setScale(parameters.goal_scale2D,parameters.goal_scale2D,parameters.goal_scale2D)
		
		#arrow
		arrow = vizshape.addArrow()
		viz.mouse(viz.OFF)
		arrow.setPosition(0,parameters.arrow_height2D,0)
		arrow.color(viz.BLUE)
		arrow.visible(False)
예제 #8
0
import vizact
import vizfx
import viztask

### Vizard
### User

import World
import BahnhofContent

### User
### Initialisierung

myWorld = World.World()
viz.move(-80, 2.5, -41)  #Fraport
viz.collision(True)

### Initialisierung
### Scene static

hbf = vizfx.addChild('FFM-HBhf.osgb')
#hbf.setPosition(80, -2.5, 41)
hbf.anisotropy(8)

uhren = BahnhofContent.GleisUhren()
uhren.loadModel(hbf)
uhren.setTime(12, 20)

### Scene static
### Scene dynamic
예제 #9
0
	turn = vizact.spin(0,1,0,180,1)
	danceMove = vizact.sequence(jump,turn,-1)
	backupDancer.addAction(danceMove)



armBone = performer.getBone('Bip01 R Hand') 
#armBone.lock()
#armBone.setEuler(0, 45, 0)
#viz.link(armBone,mic)



for x in [-3, -1, 1, 3]:
	for z in [4, 2, 0, -2, -4]:
		male = viz.addAvatar('vcc_male.cfg')
		female = viz.addAvatar('vcc_female.cfg')
		male.setPosition([x,0,z])
		female.setPosition([x+1,0,z])
		male.setEuler([180,0,0])
		female.setEuler([180,0,0])
		male.state(randint(3,5))
		female.state(randint(3,5))
		male.setEuler(randint(0,360),0,0)
		female.setEuler(randint(0,360),0,0)



vizshape.addAxes()
viz.collision(viz.ON) #cant navigate off the map
예제 #10
0
파일: GUI.py 프로젝트: kevinsp/DvB
	def __init__(self):
		#viz.window.setFullscreen(True)

		viz.MainWindow.fov(60)
		#viz.window.setFullscreen(True)


		#Popups
		fullscreenItem = vizpopup.Item('Fullscreen')

		mymenu = vizpopup.Menu('Main',[fullscreenItem])



		#Bei Rechtklick Menüaufruf
		vizact.onmouseup(viz.MOUSEBUTTON_RIGHT, self.showMenu)

		#Fullscreen on/off
		vizpopup.onMenuItem(fullscreenItem,viz.window.setFullscreen,viz.TOGGLE)


		#Menübar
		self.menubar = vizmenu.add()
		self.menubar.setVisible(False)

		#Bearbeiten
		self.BearbeitenMenu = self.menubar.add("Bearbeiten")
		self.buttonDateiOeffnen = self.BearbeitenMenu.add(viz.BUTTON_LABEL, "Datei öffnen")
		self.buttonModelEntfernen = self.BearbeitenMenu.add(viz.BUTTON_LABEL, "Model entfernen")

		#Ansicht DropDown
		self.AnsichtsMenu = self.menubar.add("Ansicht")
		self.checkRohre = self.AnsichtsMenu.add(viz.CHECKBOX, "Rohre")
		self.checkWaende = self.AnsichtsMenu.add(viz.CHECKBOX, "Wände")
		self.checkBirdEyeView = self.AnsichtsMenu.add(viz.CHECKBOX, "Vogelperspektive")
		self.checkPointsView = self.AnsichtsMenu.add(viz.CHECKBOX, "Checkpoints")
		self.checkPointSetzen = self.AnsichtsMenu.add(viz.BUTTON_LABEL, "Checkpoint setzen")
		self.checkPointLoeschen = self.AnsichtsMenu.add(viz.BUTTON_LABEL, "Checkpoint löschen")
		self.checkPortButton = self.AnsichtsMenu.add(viz.BUTTON_LABEL, "Zu Checkpoints porten")
		self.noteViewButton = self.AnsichtsMenu.add(viz.CHECKBOX, "Notizen")
		self.deleteNoteButton = self.AnsichtsMenu.add(viz.BUTTON_LABEL, "Lösche 3D Notiz")
		self.notePortButton = self.AnsichtsMenu.add(viz.BUTTON_LABEL, "Zu 3D Notizen porten")
		self.beliebigPortButton = self.AnsichtsMenu.add(viz.BUTTON_LABEL, "Porten")

		#Einfügen DropDown
		self.EinfuegenMenu = self.menubar.add("Einfügen")
		self.buttonNotizEinfuegen = self.EinfuegenMenu.add(viz.BUTTON_LABEL, "Notiz")

		#Optionen DropDown
		self.OptionenMenu = self.menubar.add("Optionen")

		#Alphawert
		self.alphaSlider = self.AnsichtsMenu.add(viz.SLIDER, "Alphawert")
		self.alphaSlider.set(1.0)

		#Steuerung
		viz.mouse(viz.ON)
		viz.mouse.setTrap()
		self.tracker = vizcam.addWalkNavigate(moveScale=2.0)
		self.tracker.setPosition([0,1.8,0])
		self.link = viz.link(self.tracker,viz.MainView)
		viz.mouse.setVisible(False)


		#Erstes Model laden
		self.model = viz.addChild(r'C:\Users\pasca_000\Downloads\CADModellHofner.obj')
		modelIsLoaded = True
		self.model.disable(viz.CULL_FACE)
		self.model.setPosition(0,0,60, viz.ABS_GLOBAL)
		self.model.setEuler([0,0,0])
		viz.collision(viz.ON)

		#Boden laden
		self.ground1 = viz.addChild('ground.osgb')
		self.ground2 = viz.addChild('ground.osgb')
		self.ground2.setPosition(0,0,50)
		
		#Begrüßungsnachricht
		message = """Danke, dass Sie sich für unsere Software entschieden haben.
		\nHier die wichtigsten Shortcuts zum bedienen des Programmes:
		C:   Anzeigen der bereits gesetzten Checkpoints
		N:   Anzeigen der bereits gesetzten 3D Notizen
		V:   Anzeigen der Vogelperspektive
		H:   Anzeigen dieser Hilfe"""
		checkPointsPanel = vizinfo.InfoPanel(message,align=viz.ALIGN_CENTER,fontSize=15,icon=False,key="h")
		checkPointsPanel.visible(True)
		
		
		#Button Definition
		vizact.onbuttondown(self.buttonDateiOeffnen, self.setModel, r'C:\Users\pasca_000\Downloads\CADModellHofner.obj' )
		vizact.onbuttondown(self.buttonModelEntfernen, self.deleteModel)

		#Note Buttons
		vizact.onbuttondown(self.buttonNotizEinfuegen, notes.openTextBox)
		vizact.onbuttondown(self.noteViewButton, notes.noteView, False)
		vizact.onbuttonup(self.noteViewButton, notes.noteView, False)
		vizact.onbuttondown(self.deleteNoteButton, notes.delete3DNote)
		vizact.onbuttondown(self.notePortButton, notes.port3DNote, self.tracker)

		#BirdEyeView Buttons
		vizact.onbuttondown(self.checkBirdEyeView, birdView.enableBirdEyeView)
		vizact.onbuttonup(self.checkBirdEyeView, birdView.enableBirdEyeView)

		#Checkpoints Buttons
		vizact.onbuttondown(self.checkPointsView, checkpoints.checkPoints, False)
		vizact.onbuttonup(self.checkPointsView, checkpoints.checkPoints, False)
		vizact.onbuttondown(self.checkPointSetzen, checkpoints.createCheckpoint)
		vizact.onbuttondown(self.checkPointLoeschen, checkpoints.deleteCheckpoint)
		vizact.onbuttondown(self.checkPortButton, checkpoints.portCheckPoint, self.tracker)

		#Port Button
		vizact.onbuttondown(self.beliebigPortButton, porten.porten, self.tracker)
	
		#Shortcuts
		vizact.onkeydown(viz.KEY_CONTROL_L, mouse.enableDisableMouse, self.tracker, self.link, self.menubar)
		vizact.onkeydown("c", checkpoints.checkPoints, False)
		vizact.onkeydown("v", birdView.enableBirdEyeView)
		vizact.onkeydown("n", notes.noteView, False)
import hand
import vizproximity
import vizshape
import viztask


#---------------------------------INICIALIZACIÓN-----------------------------------------------------

#viztracker.go() #DESCOMENTAR ESTO PARA LA SALA DE RV

viz.go()
viz.cam.setHandler(vizcam.KeyboardCamera())
#viz.cam.setHandler(vizcam.addWalkNavigate())
viz.phys.enable()

viz.collision(viz.ON) #real time collision detection

#Place the view point
viz.MainView.setPosition(1, 1.8, 3)
viz.MainView.setEuler(30, 0, 0)

viz.MainView.getHeadLight().intensity(0.5) #Para que se vea oscuro mientras no estén encendidas las luces ni las persianas abiertas

label = viz.addText('LifeSTech',parent=viz.SCREEN,pos=[0.005,0.947,0],scale=[0.5,0.5,1], color = viz.PURPLE)

ground = viz.add('tut_ground.wrl') #ground
ground.disable(viz.INTERSECTION)
viz.clearcolor([.5, .6, 1])


lab = viz.add('Living_Lab_Blinds_V2.OSGB')#, scale=[0.002]*3)
예제 #12
0
def createEnvironment():
    global point
    global arrow
    global goal
    global thrust
    global shadow

    #create 3D environment
    if parameters.dreiDEnvironment:

        piazza = viz.addChild('piazza.osgb')

        #look from above
        viz.MainView.setPosition([0, 1.8, -5])
        viz.MainView.setEuler([0, 20, 0])
        viz.collision(viz.ON)
        # gorund for collision
        ground = viz.add('tut_ground.wrl')  # Add ground
        ground.collidePlane()  # Make collideable plane
        ground.disable(viz.RENDERING)
        ground.disable(viz.DEPTH_WRITE)

        # point
        #point = viz.add('ball.wrl')
        point = vizshape.addSphere(radius=parameters.pointRadius,
                                   slices=20,
                                   stacks=20,
                                   axis=vizshape.AXIS_Y)
        pointPhys = point.collideSphere()  # Define ball's physical properties

        point.setEuler(0, 90, 0)
        point.setPosition(0, parameters.point_height, 0)
        point.color(viz.RED)
        point.setScale(0.5, 0.5, 0.5)
        point.enable(viz.COLLIDE_NOTIFY)

        #goal
        goal = vizshape.addCircle(slices=100, radius=0.3)
        goal.setEuler(0, 90, 0)
        goal.color(viz.GREEN)
        goal.setPosition(0, parameters.goal_height, 0)
        goal.setScale(parameters.goal_scale3D, parameters.goal_scale3D,
                      parameters.goal_scale3D)

        #shadow
        shadow = vizshape.addCircle(slices=100, radius=0.3)
        shadow.setEuler(0, 90, 0)
        shadow.color(viz.GRAY)
        shadow.setPosition(0, parameters.shadow_height, 0)
        shadow.setScale(parameters.shadow_scale3D, parameters.shadow_scale3D,
                        parameters.shadow_scale3D)

        #arrow
        arrow = vizshape.addArrow()
        arrow.setPosition(0, parameters.arrow_height3D, 0)
        arrow.color(viz.BLUE)

        #thrust
        thrust = point.addThruster(force=[0, 0, 0])

    #or create 2d environment
    else:
        viz.clearcolor(viz.WHITE)

        #look from above
        viz.MainView.setPosition([0, 8, 0])
        viz.MainView.setEuler([0, 90, 0])

        #point = viz.add('ball.wrl')
        point = vizshape.addSphere(radius=parameters.pointRadius,
                                   slices=20,
                                   stacks=20,
                                   axis=vizshape.AXIS_Y)
        pointPhys = point.collideSphere()  # Define ball's physical properties
        point.setEuler(0, 90, 0)
        point.setPosition(0, parameters.point_height, 0)
        point.color(viz.RED)
        point.visible(False)
        point.enable(viz.COLLIDE_NOTIFY)

        #wind force
        thrust = point.addThruster(force=[0, 0, 0])

        #goal
        goal = vizshape.addCircle(slices=100, radius=0.2)
        goal.setEuler(0, 90, 0)
        goal.color(viz.GREEN)
        goal.visible(False)
        goal.setScale(parameters.goal_scale2D, parameters.goal_scale2D,
                      parameters.goal_scale2D)

        #arrow
        arrow = vizshape.addArrow()
        viz.mouse(viz.OFF)
        arrow.setPosition(0, parameters.arrow_height2D, 0)
        arrow.color(viz.BLUE)
        arrow.visible(False)