def displayInputPanel(): global inputPanel, names inputPanel = viz.addGUIGroup() # endG = viz.addGroup(viz.SCREEN) splashScreen = viz.addTexQuad(parent=viz.SCREEN,pos=[0.5,0.5,0],scale=[13,10.5,1]) splashScreen.texture(viz.addTexture('textures/splash_screen'+LANG+'.jpg')) splashScreen.setParent(inputPanel) names = [] pl = range(condition%2*2+1) pl.reverse() for i,p in enumerate(pl): name = viz.addTextbox() nameText = {'':'Player %s name:', 'GR':'Όνομα παίκτη %s:'} title = viz.addText(nameText[LANG]%str(i+1), viz.SCREEN) title.fontSize(24) title.addParent(inputPanel) title.setPosition([.4, .53+.1*p, 0]) name.setPosition([.5, .5+.1*p, 0]) name.addParent(inputPanel) names.append(name) startB = viz.addButtonLabel('START') startB.setPosition(.5,.4) startB.addParent(inputPanel) vizact.onbuttonup(startB, initialize)
def Pau(): #Menu principal global current_scene current_scene = 4 bgTexture = viz.add(image['pau']) quad_bgtexture = viz.addTexQuad(parent=viz.SCREEN, scene=scenePau) quad_bgtexture.texture(bgTexture) quad_bgtexture.setScale(12.8, 10.24, 0) quad_bgtexture.setPosition(0.5, 0.5) viz.scene(scenePau) #Botones de interaccion btn_atras = viz.addButton(scene=scenePau) btn_atras.setPosition(0.60, 0.05) btn_atras.setScale(7, 1.6) btn_atras.downpicture(button['regresar']) btn_atras.uppicture(button['regresar']) #Botones de interaccion btn_sig = viz.addButton(scene=scenePau) btn_sig.setPosition(0.87, 0.05) btn_sig.setScale(7, 1.6) btn_sig.downpicture(button['portada_A']) btn_sig.uppicture(button['portada_A']) vizact.onbuttonup(btn_atras, Conant) vizact.onbuttonup(btn_sig, Diego)
def Controls(): #Menu principal global current_scene current_scene = 1 bgTexture = viz.add(image['controles']) quad_bgtexture = viz.addTexQuad(parent=viz.SCREEN, scene=sceneControls) quad_bgtexture.texture(bgTexture) quad_bgtexture.setScale(12.8, 10.24, 0) quad_bgtexture.setPosition(0.5, 0.5) viz.scene(sceneControls) #Botones de interaccion btn_atras = viz.addButton(scene=sceneControls) btn_atras.setPosition(0.85, 0.05) btn_atras.setScale(7, 1.6) btn_atras.downpicture(button['regresar']) btn_atras.uppicture(button['regresar']) vizact.onbuttonup(btn_atras, MainMenu)
def MainMenu(): #Menu principal global current_scene current_scene = 0 isActive[6] = True bgTexture = viz.add(image['portada']) quad_bgtexture = viz.addTexQuad(parent=viz.SCREEN, scene=viz.Scene6) quad_bgtexture.texture(bgTexture) quad_bgtexture.setScale(12.8, 10.24, 0) quad_bgtexture.setPosition(0.5, 0.5) viz.scene(viz.Scene6) #Botones de interaccion btn_juego = viz.addButton(scene=viz.Scene6) btn_juego.setPosition(0.75, 0.50) btn_juego.setScale(8, 2.3) btn_juego.downpicture(button['portada_A']) btn_juego.uppicture(button['portada_A']) #Botones de interaccion btn_controles = viz.addButton(scene=viz.Scene6) btn_controles.setPosition(0.75, 0.35) btn_controles.setScale(8, 2.3) btn_controles.downpicture(button['portada_B']) btn_controles.uppicture(button['portada_B']) #Botones de interaccion btn_creditos = viz.addButton(scene=viz.Scene6) btn_creditos.setPosition(0.75, 0.20) btn_creditos.setScale(8, 2.3) btn_creditos.downpicture(button['portada_C']) btn_creditos.uppicture(button['portada_C']) vizact.onbuttonup(btn_juego, accionbuttonNewGame) vizact.onbuttonup(btn_controles, Controls) vizact.onbuttonup(btn_creditos, Daniel)
canvas.setRenderWorld([bb.width, bb.height],[1,viz.AUTO_COMPUTE]) print(canvas.getNodeNames()) import vizshape import tools from tools import highlighter from tools import ray_caster ray = ray_caster.Simple3DRay(0.0025) ray.setColor(viz.CYAN) rayCaster = ray_caster.RayCaster() rayCaster.setIntersectAll(False) rayCaster.setStartingOffset([0,0,0]) rayCaster.setRay(ray) highlighter = highlighter.Highlighter() highlighter.setRayCaster(rayCaster) viz.link(nav.VIEW_LINK, highlighter) highlighter.setUpdateFunction(updateHighlightTool) viztask.schedule(ClickTask(highlighter, canvas)) print pick([0, 1], 0) viz.callback(viz.MOUSEUP_EVENT, OnMouseUp) viz.callback(viz.MOUSEDOWN_EVENT, OnMouseDown) import vizact vizact.onbuttonup(click_button, OnButtonClicked)
rock = viz.addChild(item['gem'], scene = viz.Scene1) rock.setScale(2.5,2.5,2.5) rock.setPosition(-30,4) canvas = viz.addGUICanvas() canvas.alignment(viz.ALIGN_CENTER) viz.MainWindow.setDefaultGUICanvas(canvas) info = vizinfo.InfoPanel('AVERNO', align=viz.ALIGN_RIGHT_TOP, icon=False) info.setTitle( 'Ejemplo' ) info.setPanelVisible(False) #canvas.setRenderWorldOverlay([600,500],50,3) canvas.setRenderWorld([600,500],[3,viz.AUTO_COMPUTE]) canvas.setPosition([-30,5,2]) canvas.setEuler(0,0,0) vizact.onbuttonup(btn_regresa, returntoMenu) ################################################################# ################################################################# #Escenario2 mine2 = viz.addChild(model['mundo2'], scene = viz.Scene2) gem2 = viz.addChild(item['gem'], scene = viz.Scene2) gem2.setScale(2.5,2.5,2.5) gem2.setPosition(10,5) btn_regresa2 = viz.addButtonLabel("regresar", scene = viz.Scene2) btn_regresa2.setPosition(0.9,0.1) vizact.onbuttonup(btn_regresa2, returntoMenu) #################################################################
gem11.setScale(2.5, 2.5, 2.5) gem11.setPosition(-4, 3, 15) gem12 = viz.addChild(item['gem2'], scene=viz.Scene1) gem12.setScale(2.5, 2.5, 2.5) gem12.setPosition(4, 3, 15) gem13 = viz.addChild(item['gem3'], scene=viz.Scene1) gem13.setScale(2.5, 2.5, 2.5) gem13.setPosition(15, 5, 4) gem14 = viz.addChild(item['gem4'], scene=viz.Scene1) gem14.setScale(2.5, 2.5, 2.5) gem14.setPosition(-2, 4, -12) vizact.onbuttonup(btn_regresa1, returntoMenu) ################################################################# ################################################################# #Escenario2 [56.73809051513672, 5.440362930297852, -3.700538396835327] mine2 = viz.addChild(model['mundo2'], scene=viz.Scene2) plane2 = viz.addChild(item['gem'], scene=viz.Scene2) plane2.setScale(2.5, 2.5, 2.5) plane2.setPosition(123, 5, -24) plane2.visible(False) btn_regresa2 = viz.addButton(scene=viz.Scene2) btn_regresa2.setPosition(0.9, 0.1) btn_regresa2.setScale(4, 1.5) btn_regresa2.downpicture(button['regresar']) btn_regresa2.uppicture(button['regresar'])
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)
#Add main viewpoint as proximity target target = vizproximity.Target(viz.MainView) manager.addTarget(target) listaGems1 = model1.getGemSensorList() for i in listaGems1: manager.addSensor(i) manager.onEnter(i, model1.enterGem) #listaPlanes1 = model1.getPlaneSensorList() ''' for i in listaPlanes1: manager.onEnter(i, model1.enterPlane(manager)) ''' vizact.onbuttonup(model1.getReturnButton(), returntoMenu) vizact.onbuttonup(model2.getReturnButton(), returntoMenu) #sensor = vizproximity.addBoundingSphereSensor(lamp,scale=2) #sensor = vizproximity.Sensor( vizproximity.RectangleArea([2,2],center=[lamp.getPosition(0)[0],0]), None ) #sensor = vizproximity.Sensor( vizproximity.RectangleArea([2,10],center=[gem.getPosition(0)[0],0]), None ) #sensor2 = vizproximity.Sensor( vizproximity.RectangleArea([2,10],center=[gem2.getPosition(0)[0],0]), None ) #sensor3 = vizproximity.Sensor( vizproximity.RectangleArea([2,10],center=[gem3.getPosition(0)[0],0]), None ) #sensor4 = vizproximity.Sensor( vizproximity.RectangleArea([2,10],center=[gem4.getPosition(0)[0],0]), None ) #manager.removeSensor(sensor) ''' manager.onEnter(sensor,EnterProximity) manager.onExit(sensor,ExitProximity) manager.onEnter(sensor2,EnterProximity) manager.onExit(sensor2,ExitProximity) manager.onEnter(sensor3,EnterProximity)