def setUpSound(): global windAudio, endingAudio, aboveLocation, endingAudioBasic, trumpetAudio if USE_HMD_F: #Adjusted head location to spatalize towards center of room #Next, create 4 subviews to attach sounds to around the room for whooshing userView = viz.addView() userView.setPosition(0,1.6,0) headLocation = viz.addGroup() viz.link(userView, headLocation) #Good adjustment for reverb and room, might not work as well for the city #vizsonic.setReverb (30.0, 0.2, 0.5, 0.9, 0.1) vizsonic.setSimulatedRoomRadius(30,30) vizsonic.setShaker(1.0) viz.setOption('sound3d.useViewRotation', 0) #Set auarlizer to play towards center of room viz.setListenerSound3D(headLocation) #Turn on sound debugging? viz.setDebugSound3D(False) #Turn on windy city sounds vizsonic.setAmbient('windy_edit.wav', 0.75, 0) #Configure wind playing based on speed, play at higher location aboveView = viz.addView() aboveView.setPosition(0,3,0) aboveLocation = viz.addGroup() viz.link(aboveView, aboveLocation) windAudio = aboveLocation.playsound('windMono.wav', viz.STOP, volume=WIND_MIN_VOLUME) trumpetAudio = aboveLocation.playsound('audio/hero_trumpet.wav', viz.STOP, volume = 0.75) chooseExpStateNLoadSound()
def initScreen(self): self.subwindow = viz.addWindow() self.subview = viz.addView() self.subwindow.setScene(self.scene) self.subwindow.setView(self.subview) self.subwindow.setPosition([0,1]) self.subwindow.setSize([self.scale,self.scale])
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
def __init__(self, view=None, win=None, winPos=[], player=None, fact=None, data=None, sm=None, fmap=None, lang=None): if view == None: view = viz.addView() self._view = view if win == None: win = viz.addWindow() self._window = win self._window.fov(60) self._window.setSize(.5,.5) self._window.setPosition(winPos) self._window.setView(self._view) self._size = self._window.getSize(viz.WINDOW_ORTHO) self._player = player self.LoadToolTips(lang) #check if this is a player window if player in [1,2,3]: self.PLAYERS[player] = self #list of all player instances (used by FSM_Actions) self._name = data['name'] self._view.setPosition(data['pos']) self._view.stepSize(0.1) self._view.collisionBuffer(0.25) self._view.getHeadLight().disable() self._window.clearcolor(viz.SKYBLUE) self.AddPanel(lang) #reset other variables self._toolbox = OrderedDict() self._selected = None #object name being currently held/selected self._holding = None #object being currently held/selected self._picking = None #object name being intersected by cursor self._iMach = None #machine interacting with (one of its components) self._nearMachine = None#machine being near to (based on proximity) self._updateAlerts = [] #a list of tuples (machine, error) for checking the alert update self._factory = fact #factory object self.AddToToolbox('hand') self._fsm = sm #FSM with all machine states self._mapWin = fmap #the map (storing all alerts and messages) self._pressed = False #True is player presses a button self._pickcolor = viz.GREEN self._feedback = None #feedback message as result of interaction (not in FSM) self._iLog = [] #for logging picked and dropped tools from inventory self._proxLog = [] #for logging proximity to machines (enter, exit) self._pLog = [] #for logging position data self._collabAction = '' #stores the collab action in 1P mode #set an update function to take care of window resizing (priority=0) self._updateFunc = vizact.onupdate(0, self.Update) #FSM_Actions.FSM_Actions.__init__(self) else: #this is the map view self._window.clearcolor([.3,.3,.3]) self._window.ortho(-25,25,-15,20,-1,1) self._view.setPosition(-3.8,0,0) self._view.setEuler(0,90,0) self._alerts = {} self._messages = OrderedDict() self.AddMap()
def configureSound(): global subview subview = viz.addView() subview.setPosition(0,1.6,-1) headLocation = viz.addGroup() viz.link(subview, headLocation) vizsonic.setReverb (6.0, 0.2, 0.5, 0.9, 0.1) vizsonic.setSimulatedRoomRadius(3,1.5) vizsonic.setShaker(1.0) viz.setOption('sound3d.useViewRotation', 0) #Set auarlizer to play towards center of room viz.setListenerSound3D(subview) #Turn on sound debugging? viz.setDebugSound3D(False)
# get graphics window window = viz.MainWindow sound = viz.addAudio('MoonlightSonata.wav') sound.volume(.5) #sound.setTime(1) #sound.setRate(0.7) sound.play() # get mini map miniMap = viz.addWindow() miniMap.setSize([.3, .4]) miniMap.setPosition([0, 1]) miniMap.fov(70) miniMapView = viz.addView() miniMap.setView(miniMapView) miniMapView.setPosition([250, 450, 275]) miniMapView.setEuler([90, 90, 0]) # set background color of window to gray viz.MainWindow.clearcolor([150, 150, 150]) # allows mouse to rotate, translate, and zoom in/out on object #pivotNav = vizcam.PivotNavigate() e = Environment2() vizact.onkeydown('q', viz.window.startRecording, 'test.avi') vizact.onkeydown('e', viz.window.stopRecording)
rm = viz.getFrameElapsed() * ROTATION_SPEED #get move of Joystick x, y, z = joy.getPosition() m.preTrans([0, 0, -y * dm]) navigationNode.setPosition(m.getPosition(), viz.REL_PARENT) #Get the twist of the joystick # twist = joy.getTwist() m.setEuler(x * rm) navigationNode.setEuler(m.getEuler(), viz.REL_LOCAL) current_scene = 0 ARscene = viz.addScene() ARsubWindow = viz.addWindow(pos=[0, 1], size=[0.25, 0.25]) ARsubView = viz.addView() ARsubView.setScene(ARscene) ARsubWindow.setView(ARsubView) cam = ar.addWebCamera(window=ARsubWindow) ARitem = viz.addChild(item['gem3'], scene=ARscene) mark1 = cam.addMatrixMarker(0, width=1000) viz.link(mark1, ARitem) #AR2item = viz.addChild(item['gem4'], scene=ARscene) #mark2 = cam.addMarker("ar\patt.hiro") #viz.link(mark2, AR2item) ARsubWindow.visible(False)
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
import vizact viz.setMultiSample(4) viz.fov(60) viz.go() import vizinfo # Create a new window in the upper left corner UpperLeftWindow = viz.addWindow(pos=(0, 1.0), size=(0.2, 0.2)) #Create a new window in the upper right corner UpperRightWindow = viz.addWindow(pos=(0.7, 1.0), size=(0.2, 0.2)) # Create a new viewpoint BirdView = viz.addView() #Attach the bird's eye view to the upper left window UpperLeftWindow.setView(BirdView) #Move the view above the center of the room BirdView.setPosition([0, 500, 0]) #Rotate the view so that it looks down BirdView.setEuler([0, 90, 0]) #Create another viewpoint RearView = viz.addView() #Attach the rear view to the upper right window UpperRightWindow.setView(RearView)
#The different helicopter models HELI_MODEL1 = 'passenger cockpit' HELI_MODEL2 = 'cockpit2' HELI_MODEL = HELI_MODEL2 # City Model: see CityModel.py for reference cityModel = CityModel() #Sounds to play on building collisions CRASH_SOUND = viz.playSound('BuildingCrashSound.wav', viz.SOUND_PRELOAD) BirdEyeWindow = viz.addWindow() BirdEyeWindow.fov(60) BirdEyeWindow.visible(0,viz.SCREEN) BirdEyeView = viz.addView() BirdEyeWindow.setView(BirdEyeView) BirdEyeWindow.setPosition([0,25,0]) BirdEyeView.setEuler([0,90,0]) ###User tracking with lines### viz.startLayer(viz.LINE_STRIP) viz.vertexColor(viz.YELLOW) lines = viz.endLayer(parent=viz.ORTHO,scene=BirdEyeWindow) lines.dynamic() def UpdatePath(): # Get main view position in bird eye window pixel coordinates x,y,z = BirdEyeWindow.worldToScreen(viz.MainView.getPosition(),mode=viz.WINDOW_PIXELS)
import vizact import vizmat import numpy as np import scipy as sp from scipy.spatial.transform import Rotation as R viz.go() #vizshape.addAxes() SIZE = 20 #viz.MainView.setEuler(-45,0,0) viz.MainView.setPosition(0, 0, 0) viz.MainWindow.fov(100) newView = viz.addView() newView.setPosition([SIZE / 2, SIZE / 2, SIZE / 2]) newView.lookAt([0, 0, 0]) newwindow = viz.addWindow() newwindow.setView(newView) newwindow.fov(80) def build_env(): spaceSize = SIZE half = SIZE / 2 borders = [viz.addTexQuad(size=spaceSize) for x in range(6)] borders[0].setPosition([half, 0, 0]) borders[1].setPosition([-half, 0, 0]) borders[2].setPosition([0, half, 0]) borders[3].setPosition([0, -half, 0])
viz.setMultiSample(8) viz.go() ''' import vizinfo infoWindow = viz.addWindow(pos=(0,1), size=(1,1), clearMask=0, order=10) infoWindow.visible(False,viz.WORLD) vizinfo.InfoPanel(window=infoWindow) ''' # Setup main window viz.MainWindow.setSize([0.5,1]) # Setup cave window caveView = viz.addView() # Setup pivot navigation for main window cam = vizcam.PivotNavigate(distance=10,center=(0,2,0)) cam.rotateUp(25) # Create avatar to simulate person standing in cave #avatar = viz.addAvatar('vcc_male2.cfg') #avatar.state(1) import vizact from mocapInterface import mocapInterface phaseSpaceIP = '192.168.1.230' owlParamMarkerCount = 25