コード例 #1
0
ファイル: MLK.py プロジェクト: vhilab/VRITS-2015
def setUpNav():
	global RIFT
	global useKeyboard
	global viewLink
	global home
	global navigationNode
	if RIFT: 
		#add oculus settings
		hmd = oculus.Rift()
		viz.link(hmd.getSensor(), viz.MainView)
		viewLink = viz.link(navigationNode, viz.MainView)
		viewLink.setOffset(home)
		viewLink.preMultLinkable(hmd.getSensor())
	else:
		vizcam.addWalkNavigate()
コード例 #2
0
ファイル: Flying_Demo_2015.py プロジェクト: vhilab/Demos
def main():
	global masterTimerG, recordingTimer
	setUp()
	masterTimerG = vizact.ontimer(0, masterTimer)
	#recordingTimer = vizact.ontimer(0, recordCurrentSubjectStatus)
	
	if not KEYBOARD_NAVIGATE:
		addKeyPresses()
	else:
		# Setup keyboard/mouse tracker
		tracker = vizcam.addWalkNavigate(moveScale=10.0)
		tracker.setPosition([0,1.8,0])
		viz.link(tracker,viz.MainView)
		viz.mouse.setVisible(False)
		def printLocation():
			print viz.MainView.getPosition(), viz.MainView.getEuler()
		vizact.onkeydown('p', printLocation)
	
	
	#Add Wiimote support
#	wii = viz.add('wiimote.dle')
#	#Connect to first available wiimote
#	wiimote = wii.addWiimote()
#	wiimote.led = wii.LED_4
#	#Add button functions
#	vizact.onsensordown(wiimote,wii.BUTTON_A,TurnFlyingOn)
#	vizact.onsensordown(wiimote,wii.BUTTON_B,TurnFlyingOff)
#	vizact.onsensordown(wiimote,wii.BUTTON_1,endChildHappy)
#	
	#Hacky bug fix below, I apologize -Mark
	if not FLYING_F and YOKE_F:
		viztask.schedule(fixStartHeliPos) 
コード例 #3
0
def MainTask():
    """Top level task that controls the game"""

    # Display instructions and wait for key press to continue
    yield DisplayInstructionsTask()
    tracker = vizcam.addWalkNavigate(moveScale=2.0)
    tracker.setPosition([0, 2.5, 0])
    viz.link(tracker, viz.MainView)
    viz.mouse.setVisible(False)

    # Create panel to display trial results
    resultPanel = vizinfo.InfoPanel('',
                                    align=viz.ALIGN_CENTER,
                                    fontSize=25,
                                    icon=False,
                                    key=None)
    resultPanel.visible(False)

    # Reset score
    score = 0
    UpdateScore(score)
    sensors()
    found = True
    number = 0

    while found and number < 7:
        # Perform a trial
        found = False
        found = yield TrialTask()

        # Update score and display status text
        if found:
            score += 1
            UpdateScore(score)
            resultPanel.setText(TRIAL_SUCCESS)

        else:
            viztask.schedule(FadeToGrayTask())
            resultPanel.setText(TRIAL_FAIL)
            viz.mouse.setVisible(True)
            Run_function()

        #Display success/failure message
        resultPanel.visible(True)

        # Add delay before starting next trial
        yield viztask.waitTime(TRIAL_DELAY)
        resultPanel.visible(False)
        number += 1

    # Disable gray effect
    gray_effect.setEnabled(False)

    #Display results and ask to quit or play again
    resultPanel.setText(RESULTS.format(score, TRIAL_COUNT))
    resultPanel.visible(True)
    yield viztask.waitTime(5)
    resultPanel.visible(False)
    UpdateScore(10)
コード例 #4
0
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)
#------------------------------------------------

#-----------Sensor creation----------------------
コード例 #5
0
ファイル: D2C3.py プロジェクト: vhilab/VRITS-2015
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
piazza.playsound('fountain.wav',viz.LOOP,node='fountain-sound')

# Swap out sky with animated sky dome
piazza.getChild('pz_skydome').remove()
day = viz.add('sky_day.osgb')
コード例 #6
0
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))
	male.state(6)
	Chair=viz.addChild('chair.ive')
	Chair.setScale([.01,.01,.01])
	Chair.setEuler([180,0,0])
	Chair.setPosition([x,0.05,-.1])
コード例 #7
0
                self._offset[1] = ground_height
                self._clearVelocity()

        # Update position/orientation
        self.setPosition(self._offset + tracker_pos)
        self.setQuat(self._tracker.getQuat())


class PitTrackedFaller(TrackedFaller):
    """Derived tracked faller class for performing action when finished falling"""
    def _onFinishedFalling(self):
        if self.getVelocity() > 6.0:
            FallAction()


head_tracker = vizcam.addWalkNavigate()
# Create tracked faller and link to main view
faller = PitTrackedFaller(head_tracker)
viz.link(faller, viz.MainView)

#initialize Hand/Glove
global GLOVE
GLOVE = viz.addChild('glove.cfg')  #right hand

#for smoothing position/orientation tracking
global alphastack
alphastack = [0] * 5
global betastack
betastack = [0] * 5
global gammastack
gammastack = [0] * 5
コード例 #8
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)