def setAsMain(self): viz.logStatus("""Setting KeyboardMouse as main""") # self.VIEW_LINK.preTrans([0,-self.EYE_HEIGHT,0]) viz.mouse.setOverride(viz.ON) viz.fov(self.FOV) # self.MOVE_SPEED = 2 vizact.ontimer(0,self.updateView) vizact.onkeyup(self.KEYS['reset'],self.reset) def onMouseMove(e): euler = self.VIEW.getEuler(viz.HEAD_ORI) euler[0] += e.dx*0.05 euler[1] += -e.dy*0.05 euler[1] = viz.clamp(euler[1],-85.0,85.0) self.VIEW.setEuler(euler,viz.HEAD_ORI) viz.callback(viz.MOUSE_MOVE_EVENT, onMouseMove)
def main(): global wingl global wingr viz.cam.setHandler(vizcam.KeyboardCamera()) myo.init() gyrolist = [[0,0,0]] viz.fov(150) #wingl.setScale([10,0.3,1]) #wingl.setCenter([100,100,100]) wingl.setEuler([0,90,0]) wingl.collideSphere(0.5) lStartPOS = [ 0, 2.5, 2 ] wingl.setPosition( lStartPOS ) #wingr.setScale([10,0.3,1]) #wingr.setCenter([100,100,100]) wingr.setEuler([0,90,0]) wingr.collideSphere(0.5) rStartPOS = [ 0, 2.5, 2 ] wingr.setPosition( rStartPOS ) hub = myo.Hub() hub.set_locking_policy(myo.locking_policy.none) hub.run(1000, Listener()) vizact.ontimer(0.01 ,updateMyo, [gy, gy2, gy3, wingl, orx, ory, orz, orw, or1x, or1y, or1z, or1w, wingr]) vizact.ontimer(0, updateEuler) FileReader() initializeObjectFiles() initializeLocations() getCurrentTestingLocationOrder() vizact.ontimer(0.1, update)
def initialise_display(): # viz.message('Calibration on Pupil Capture must be set to Manual Marker') #load scene for luminance. # start empty world EH = 1.2 #metres from ground. Eye_ScreenDist = 1 #distance from screen of ocular point Proj_V = 1.12 #measured on 18/01/18 #vertical extent of projection (m) Proj_H = 1.965 #horizontal extent of projection (m) # setting Field-of-View fov(vertical degree, horizontal ratio(vertical*ratio[deg])) vfov = ((np.arctan((Proj_V/2)/Eye_ScreenDist))*2) * (180/np.pi) h2v = Proj_H/Proj_V #viz.setDisplayMode(1920,1080) viz.go() viz.window.setSize(1920,1080) #viz.fov(vfov,h2v) #sets window aspect ratio. viz.fov(vfov,h2v) #sets window aspect ratio. #viz.window.setSize([1920,1080]) #viz.window.setBorder(viz.BORDER_NONE) #viz.window.setFullscreen(1) #viz.window.setFullscreenMonitor(2) #viz.window.setFullscreenRectangle( [0,0,1920,1080] ) viz.eyeheight(1.2)#viz.MainView.setPosition(0,EH,0) viz.clip(1,60) #clips world at 60m # background color viz.clearcolor(viz.SKYBLUE)
def main(): global wingl global wingr viz.cam.setHandler(vizcam.KeyboardCamera()) myo.init() gyrolist = [[0,0,0]] viz.setMultiSample(4) viz.fov(150) wingl = viz.addChild('basketball.osgb') wingl.setScale([10,0.3,1]) wingl.setCenter([100,100,100]) wingl.setEuler([0,90,0]) wingl.collideSphere(0.5) lStartPOS = [ 0, 2.5, 2 ] wingl.setPosition( lStartPOS ) wingr = viz.addChild('basketball.osgb') wingr.setScale([10,0.3,1]) wingr.setCenter([100,100,100]) wingr.setEuler([0,90,0]) wingr.collideSphere(0.5) rStartPOS = [ 0, 2.5, 2 ] wingr.setPosition( rStartPOS ) #viz.MainView.setPosition([0,2,-15]) hub = myo.Hub() hub.set_locking_policy(myo.locking_policy.none) hub.run(1000, Listener()) vizact.ontimer(0.01 ,updateMyo, [gy, gy2, gy3, wingl, orx, ory, orz, orw, or1x, or1y, or1z, or1w, wingr])
def display(self): """ Initialize the display Mode selection: 0 - Regular computer 1 - 3D TV 2 - Oculus rift """ if self.displayMode == 0: viz.setMultiSample(4) viz.fov(60) viz.window.setSize([1280,720]) viz.go() viz.window.setFullscreenMonitor(1) # viz.go(viz.FULLSCREEN) #viz.FULLSCREEN elif self.displayMode == 1: viz.setMultiSample(4) viz.go(viz.STEREO_HORZ | viz.FULLSCREEN) elif self.displayMode == 2: viz.go(viz.STEREO_HORZ) viz.setMultiSample(16) viz.window.setSize([1280,720]) KEYS = { 'reset' : 'r', 'camera' : 'c'} # Helps reduce latency #do not use ? makes things worse. #viz.setOption('viz.glFinish',1) elif self.displayMode == 3: viz.setMultiSample(4) viz.fov(60) viz.go(viz.FULLSCREEN) #viz.FULLSCREEN viz.window.setFullscreenMonitor(2) # Initial direction of main view viz.MainView.setEuler([0,0,0]) viz.MainView.setPosition([0,0,-3], viz.ABS_GLOBAL)
def setup_view(): # turn off headlight headLight = viz.MainView.getHeadLight() headLight.disable() # setup view point collision with a large buffer to account for large maze size viz.MainView.collision(viz.ON) viz.collisionbuffer(10) # Create a larger FOV to make the maze seem wider viz.fov(80, 1.1) # Set position, orientation, and eyeheight, and stepsize viz.MainView.setPosition(start_coords, viz.ABS_GLOBAL) viz.MainView.setEuler((0, 0, 0), viz.ABS_GLOBAL) viz.MainView.setEuler(start_ori, viz.BODY_ORI, viz.ABS_GLOBAL) viz.eyeheight(40) viz.stepsize(10)
def setAsMain(self): # self.VIEW_LINK.setOffset([0,self.EYE_HEIGHT,0]) self.VIEW_LINK.preTrans([0,-self.EYE_HEIGHT,0]) viz.mouse.setOverride(viz.ON) viz.fov(self.FOV) val = mathlite.getNewRange(self.joy.getSlider(),1,-1,self.MIN_SPEED,self.MAX_SPEED) self.MOVE_SPEED = val vizact.ontimer(0, self.updateView) vizact.onsensorup(self.joy, self.KEYS['reset'], self.reset) viz.callback(getExtension().SLIDER_EVENT,self.onSliderChange) def onMouseMove(e): euler = self.VIEW.getEuler() euler[0] += e.dx*0.05 euler[1] += -e.dy*0.05 euler[1] = viz.clamp(euler[1],-85.0,85.0) self.VIEW.setEuler(euler) viz.callback(viz.MOUSE_MOVE_EVENT, onMouseMove)
import viz import vizinfo import vizact import math import vizshape from config import * viz.setMultiSample(4) viz.fov(60) viz.go() viz.MainView.move([5, 0, -25]) #sphere = vizshape.addSphere(radius=1); #sphere.setPosition([0, 0, 0]); ar = viz.add('./ar/artoolkit.dle') camera = ar.addWebCamera() marker = camera.addMatrixMarker(47, width=1000) #id works for 0-63 endMarker = camera.addMatrixMarker(40, width=1000) #id works for 0-63 current = 1 def main(): triangle = viz.addChild('thesis/triangle_1.dae') triangle2 = viz.addChild('thesis/triangle_1.dae')
# print 'Tracker euler',headTracker.getEuler() # print 'Hand Tracker position',handTracker.getPosition() #just added this # print 'Hand Tracker euler',handTracker.getEuler() #and this # print 'Viewpoint position',viewpoint.getPosition() # print 'Movable position',movable.getPosition(),'\n' #vizact.ontimer(5, printData) ## Setup tracking if this is the main script #if __name__ == "__main__": # import viztracker # viztracker.DEFAULT_HANDS = True # viztracker.go() #so far so good viz.setMultiSample(4) viz.fov(60) viz.go() #Add a world axis with X,Y,Z labels world_axes = vizshape.addAxes() X = viz.addText3D('X',pos=[1.1,0,0],color=viz.RED,scale=[0.3,0.3,0.3],parent=world_axes) 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=world_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=world_axes) #grids are good grid = vizshape.addGrid(color=[0.2]*3) viz.clearcolor(viz.GRAY) #Create proximity manager manager = vizproximity.Manager() manager.setDebug(viz.ON)
""" Welcome to our art gallery! Please walk around and visit each of the paintings at your own pace. """ 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) #------------------------------------------------
4: Zoom in to model 5: Zoom out from model Navigate using mouse + WASD keys """ import viz import steve import vizact import vizcam import vizshape import _winreg import viztip import viztask viz.setMultiSample(8) viz.fov(50) viz.go(viz.FULLSCREEN) #viz.collision(viz.ON) # Simulate head tracker using keyboard/mouse navigator head_tracker = vizcam.addWalkNavigate() head_tracker.setPosition([0, 1.5, 0]) viz.mouse.setVisible(False) # Add pit model model = viz.add('pit.osgb') model.hint(viz.OPTIMIZE_INTERSECT_HINT) for x in [-4, -2, 2, 4]: male = viz.addAvatar('vcc_male2.cfg', pos=(x, 0.05, 0), euler=(0, 0, 0))
4: Zoom in to model 5: Zoom out from model Navigate using mouse + WASD keys """ import viz import steve import vizact import vizcam import vizshape import _winreg import viztip import viztask viz.setMultiSample(8) viz.fov(50) viz.go(viz.FULLSCREEN) #viz.collision(viz.ON) # Simulate head tracker using keyboard/mouse navigator head_tracker = vizcam.addWalkNavigate() head_tracker.setPosition([0,1.5,0]) viz.mouse.setVisible(False) # Add pit model model = viz.add('pit.osgb') model.hint(viz.OPTIMIZE_INTERSECT_HINT) for x in [-4,-2,2,4]: male = viz.addAvatar('vcc_male2.cfg',pos=(x,0.05,0),euler=(0,0,0))
np.set_printoptions(precision=5) #check vizard4/bin/vizconfig to change which monitor displays the VR window viz.splashScreen('C:\Users\Gelsey Torres-Oviedo\Desktop\VizardFolderVRServer\Logo_final.jpg') viz.go( #viz.FULLSCREEN ) view = viz.addView hmd = oculus.Rift() hmd.getSensor viz.link(hmd.getSensor(),viz.MainView) viz.MainView.collision(viz.ON) viz.MainView.collisionBuffer(0.5) viz.fov(90) im = viz.addTexture('801109.jpg') im2 = viz.addTexture('galaxy.jpg') background = viz.addTexQuad() background.setPosition(0,2,6) background.setScale(21,7,1) background.texture(im) roof = viz.addTexQuad() roof.setPosition(0.5,2.9,-4) roof.setEuler(0,90,0) roof.setScale(6,12,1) roof.texture(im2)
driver = vizdriver.Driver() out = "-1" # start empty world ################### PERSPECTIVE CORRECT ################## ###SET UP PHYSICAL DIMENSIONS OF SCREEN#### EH = 1.2 #metres from ground. Eye_ScreenDist = 1 #distance from screen of ocular point Proj_V = 1.115 #vertical extent of projection (m) Proj_H = 1.965 #horizontal extent of projection (m) # setting Field-of-View fov(vertical degree, horizontal ratio(vertical*ratio[deg])) vfov = ((np.arctan((Proj_V / 2) / Eye_ScreenDist)) * 2) * (180 / np.pi) h2v = Proj_H / Proj_V viz.go() viz.fov(vfov, h2v) #sets window aspect ratio. viz.eyeheight(1.2) #viz.MainView.setPosition(0,EH,0) viz.clip(1, 150) #Further clip means higher band of dots. ##Create array of trials. global radiiPool, occlPool #radiiPool = [50, 150, 250, 900, 1100, 1300, 2500, 3000, 3500, -1] #This was the selection used for Pilot. radiiPool = [ 300, 600, 900, 1200, 1500, 1800, 2100, 2400, 2700, 3000, 3300, 3600, -1 ] #13 radii conditions. 300m steps. occlPool = [0, .5, 1] #3 occlusion conditions N = len(radiiPool) * len(occlPool) ###Number of conditions. TRIALS = 10 #is this enough? Let's see. TotalN = N * TRIALS TRIALSEQ = range(1, N + 1) * TRIALS
""" Welcome to our art gallery! Please walk around and visit each of the paintings at your own pace. """ 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)
giveDirs = viz.get(viz.OPTION1) skipTraining = viz.get(viz.OPTION2) movie = viz.get(viz.TRACKER) if viz.get(viz.HMD): group = 1 else: group = 0 else: viz.go(viz.FULLSCREEN) InitMsg = "MTM Grid D 1 1" giveDirs = 0 skipTraining = 0 movie = 0 movement = 0 group = 0 viz.mouse(viz.OFF) viz.cursor(viz.OFF) viz.fov(70, 1) sys.argv = ('-c') debug = 0 if InitMsg: print InitMsg, giveDirs, group params = InitMsg.split() prefix, env = params[:2] if env == 'All': giveDirs = True if len(params) > 2: if params[2] == 'D': movement = 'Discrete' elif params[2] == 'C': movement = 'Continuous' else: print 'UNKNOWN MOVEMENT TYPE', params[2] else:
load_scene(current_node, global_sphere, global_plane) # viz.playSound('sounds/click.wav',viz.SOUND_PRELOAD) elif (current_node.left is not None): current_node = current_node.left load_scene(current_node, global_sphere, global_plane) # viz.playSound('sounds/click.wav',viz.SOUND_PRELOAD) getHostName() # globalAudio() #=========================== #Enable full screnn anti-aliasing (FSAA) to smooth out edges viz.setMultiSample(4) viz.fov(60) #***How do we lock fov? global_sphere = vizshape.addSphere(radius=128, slices=256) global_sphere.setPosition([0,0,0]) global_sphere.setEuler(180,0,0) #rotating #Setting hints for Vizard renderer global_sphere.disable(viz.CULL_FACE) #Render interior, not exterior of sphere global_sphere.disable(viz.LIGHTING) #Show full brightness of image, ignoring shading global_plane = vizshape.addPlane(size=(5,5), axis=vizshape.AXIS_Z, cullFace = True) global_plane.setEuler(-180,0,0) global_plane.setPosition(5,0,10) global_plane.disable(viz.LIGHTING) global_plane.visible(viz.OFF)
# f.close() # f = open('C:\Users\Gelsey Torres-Oviedo\Desktop\VizardFolderVRServer\ErrorClamps.csv','r') # print('numline: ',numline) # for z in range(0,numline,1): # line = f.readline() # line = line.replace('\n','') # line2 = line.split(',') # Rclamp[z] = float(line2[0]) # Lclamp[z] = float(line2[1]) # f.close() #else: # print('ERROR: Error clamp definition file not available, cannot determine error clamps...\n') #print(Rclamp) viz.fov(110) pincushion = vizlens.PincushionDistortion() pincushion.setK1(0.2) global hmd view = viz.addView hmd = oculus.Rift() hmd.getSensor global targetL targetL = 0.5099501 global targetR6 targetR = 0.5237383 global targetmeann
import viz import vizact """viz.setMultiSample(4) viz.fov(60) viz.go() import vizinfo info = vizinfo.add( 'The view is controlled by custom camera handler class.\nControls:\n--Left / Right mouse buttons: move up/down.\n--Mouse wheel: pan left / right.\n--W / S keys: forward / back' ) #Initialize world viz.clearcolor( viz.GRAY ) ground = viz.addChild( 'ground.osgb' )""" #Create custom camera handler class MyCameraHandler( viz.CameraHandler ): def _camKeyDown(self,e): print "Bin im eigenen cam handler ", print dir(e) def _camMouseDown( self, e ): if e.button == viz.MOUSEBUTTON_LEFT: #move view down e.view.move( [0, -1, 0] ) elif e.button == viz.MOUSEBUTTON_RIGHT: #move view up e.view.move( [0, 1, 0] ) def _camMouseWheel( self, e ): if e.dir > 0:
left_array_fix = np.arange(0.0, np.pi*1000)/1000 right_array_fix = np.arange(np.pi*1000, 0.0, -1)/1000 ##arange(start,stop,step). Array with 3142(/1000) numbers c = 0 while c < 3142: x_right_mid[c] = ( ( (r)*np.cos(right_array_fix[c]) ) + r) z_right_mid[c] = ( ( (r)*np.sin(right_array_fix[c]) ) + straight_road ) x_left_mid[c] = ( ( (r)*np.cos(left_array_fix[c]) ) - r) z_left_mid[c] = ( ( (r)*np.sin(left_array_fix[c]) ) + straight_road ) c += 1 # start empty world viz.go() # setting Field-of-View fov(vertical degree, horizontal ratio(vertical*ratio[deg])) viz.fov(77,1.25) #sets window aspect ratio. # clipping distance clip(near[m], far[m]) viz.clip(1,60) #clips world at 60m ##Create array of trials. N = 1 ###Number of conditions, for this code we only have one. TRIALS = 10 TotalN = N*TRIALS TRIALSEQ = range(1,N+1)*TRIALS direc = [1,-1]*(TotalN/2) TRIALSEQ = np.sort(TRIALSEQ) TRIALSEQ_signed = np.array(direc)*np.array(TRIALSEQ) random.shuffle(TRIALSEQ_signed) # background color