Пример #1
0
    def __init__(self):
        viz.EventClass.__init__(self)

        self.EH = 1.2
        Proj_Dist = 1.0  #front projection distance to Eye

        Proj_V_F = 1.115  #vertical extent of projection (m)
        Proj_H_F = 1.985  #1.96#horizontal extent of projection (m)

        Proj_HfG = .665  #Front projection height from ground.

        FB = Proj_HfG  #FrontBottom
        FT = Proj_HfG + Proj_V_F  #FrontTop

        FL = -Proj_H_F / 2  #Front Left
        FR = Proj_H_F / 2  #Front Right

        FC0 = FL, FB, Proj_Dist  # Front  Wall: FC0,FC1,FC2,FC3
        FC1 = FR, FB, Proj_Dist
        FC2 = FL, FT, Proj_Dist
        FC3 = FR, FT, Proj_Dist

        self.FrontWall = vizcave.Wall(upperLeft=FC2,
                                      upperRight=FC3,
                                      lowerLeft=FC0,
                                      lowerRight=FC1,
                                      name='Front Wall')  #Create front wall

        viz.setMultiSample(8)  #set anti-aliasing

        #Initialize graphics window
        viz.go()
        #	viz.eyeheight(1.2)
        #for monitor in viz.window.getMonitorList():
        #    print monitor.name
        #    print '   ',monitor

        viz.window.setFullscreenMonitor(2)
        viz.window.setFullscreen(viz.ON)

        self.cave = vizcave.Cave(stereo=0)
        self.cave.addWall(self.FrontWall)  #,window=self.frontWindow)

        # print ("1_N: ", self.cave.getNearPlane()) #default is [.1, -1.]
        # print ("1_F: ", self.cave.getFarPlane())

        #set near and far plane.
        self.cave.setNearPlane(1.0)
        self.cave.setFarPlane(100.0)

        view = viz.MainView

        self.track = viztracker.Keyboard6DOF()  #tracker object
        self.track.setPosition(0, self.EH, 0)
        viz.link(self.track, view)  #linked to mainview
        self.cave.setTracker(pos=self.track)
        ##Create CaveView object for manipulating the entire cave environment
        ##The caveorigin is a node that can be adjusted to move the entire cave around the virtual environment, it needs a tracker object to initialise it.
        self.caveview = vizcave.CaveView(self.track)
Пример #2
0
subject = viz.input('Please enter the subject number:','')
subject = str(subject).zfill(2)



# Use keyboard controls
# Controls:
# q - Strafe L		w - Forward		e - Strafe R
# a - Turn L		s - Back		d - Turn R
#
# y - Face Up		r - Fly Up
# h - Face Down		f - Fly Down
if controlType == MONITOR:
	HZ = 60
	headTrack = viztracker.Keyboard6DOF()
	link = viz.link(headTrack, viz.MainView)
	headTrack.eyeheight(1.6)
	link.setEnabled(True)
	viz.go()

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	
# Use HMD
elif controlType == HMD:
	HZ = 90
	# viz.fullscreen.x is the inital x position when run	
	# add Odyssey tracker
	ODTracker = steamvr.HMD().getSensor()

	# add the virtual tracker, link it to the MainView and set an offset to get the eye position
	link = viz.link(ODTracker, viz.MainView)