本文整理汇总了Python中viz.add函数的典型用法代码示例。如果您正苦于以下问题:Python add函数的具体用法?Python add怎么用?Python add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self,use_keyboard = True, desktop_mode = False):
caveapp.CaveApplication.__init__(self,desktop_mode) #call constructor of super class, you have to do this explicitly in Python
#self.wand = vizshape.addAxes() #load axis model to represent the wand (WALL FFS!)
# Add skybox
sky = viz.add(viz.ENVIRONMENT_MAP,'alien/jajalien1.jpg')
skybox = viz.add('skydome.dlc')
skybox.texture(sky)
# First light added seems to be ignored....
# Add lighting
dummy = viz.addLight()
light = viz.addLight()
light.position(0, 0, 0)
light.color([0.8, 1, 0.8])
self.use_keyboard = use_keyboard #store if we want to use the keyboard
#self.time = 0.0 #note that to 0.0 is important because it is a double precision floating point number
self.speed = 400.0 #--four-- meters per second
originTracker = self.cavelib.getOriginTracker()
#originTracker.setPosition([-100,100,0],viz.REL_LOCAL)
self.returnToStart()
self.yaw = 90
self.startSet=0
self.joystickpressed=0
vizact.onkeydown(' ', viz.setDebugSound3D, viz.TOGGLE)
示例2: __init__
def __init__(self):
viz.mouse.setVisible(viz.OFF)
#Activate NVIS HMD
nvis.nvisorSX111()
#nvis.nvisorSX60()
viz.cursor(viz.OFF)
#isense = viz.add('intersense.dls')
vrpn = viz.add('vrpn7.dle')
view = viz.MainView
self.markers = []
headMarker = vrpn.addTracker('[email protected]' + PPT_HOSTNAME, 0)
self.markers.append(headMarker)
self.markers.append( vrpn.addTracker('[email protected]' + PPT_HOSTNAME, 1) )
self.markers.append( vrpn.addTracker('[email protected]' + PPT_HOSTNAME, 2) )
self.markers.append( vrpn.addTracker('[email protected]' + PPT_HOSTNAME, 3) )
self.markers.append( vrpn.addTracker('[email protected]' + PPT_HOSTNAME, 4) )
filter = viz.add("filter.dle")
headMarker_filter = filter.average(headMarker, samples = 7)
headPos = viz.link(headMarker_filter, view, priority = 0)
headPos.setOffset(DEFAULT_OFFSET)
self.posLink = headPos
#self.posLink.postScale(DEFAULT_SCALE)
self.headMarker = headMarker
示例3: GameFinish
def GameFinish (self, delay):
self.info = vizinfo.add(self.tooltips['congrats'])
self.info.visible(0)
self.info.icon(viz.add('textures/c-olive_icon.png'))
self.info.add(viz.TEXT3D, self.tooltips['finish']+'\n'+self.tooltips['produce'] % self._oil.getMessage())
self.info.add(viz.TEXT3D, self.tooltips['stats'])
self.info.translate(0.1,0.95)
self.info.alignment(vizinfo.UPPER_LEFT)
self.info.scale(2.4,2.6)
self.info.messagecolor(100,100,0)
self.info.bgcolor(viz.BLACK, 0.8)
self.info.bordercolor([100,100,0], .9)
points = self.info.add(viz.TEXQUAD, self.tooltips['score']+': %s' % self._total.getMessage())
points.texture(viz.add('textures/total_icon.png'))
time = self.info.add(viz.TEXQUAD, self.tooltips['time']+': %s' % self.ConvertTime(viz.tick()))
time.texture(viz.add('textures/time_icon.png'))
self.info.shrink()
#hide all other panels
self._scorePanel.visible(0)
self._infoPanel.visible(0)
self._alertPanel.visible(0)
for p in self.PLAYERS.values():
p._infoPanel.visible(0)
p._alertPanel.visible(0)
p._hud.visible(0)
time.addAction(vizact.waittime(delay))
time.addAction(vizact.call(self.info.visible, 1))
time.addAction(vizact.waittime(.1))
time.addAction(vizact.call(self.PlayVictory))
time.addAction(vizact.call(self.info.expand))
示例4: init_settings
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
示例5: setStage
def setStage(self,stage,NAxes,relSpeed,holes,waittime):
self.stage = stage
if holes == True:
self.bridge = viz.add('bridgeHoles.OSGB')
else:
self.bridge = viz.add('bridge.OSGB')
self.tracking_data.write("Stage "+str(stage)+"\n")
yield self.activateHeadTracking(True)
yield self.stageAxes(NAxes,relSpeed,holes)
yield self.activateHeadTracking(False)
yield self.deleteScene()
yield viztask.waitTime(waittime)
yield self.returnToStart()
示例6: initTrackers
def initTrackers():
rawTracker = vizconnect.getRawTrackerDict()
default = ''
# initialization code for ppt which is a WorldVizPPT
pptHostname="localhost"
vrpn7 = viz.add('vrpn7.dle')
# initialization for sub object ppt_Rhead
markerId=1
rawTracker['ppt_Rhead'] = vrpn7.addTracker('[email protected]'+pptHostname, markerId-1)
# initialization for sub object ppt_Lhead
markerId=2
rawTracker['ppt_Lhead'] = vrpn7.addTracker('[email protected]'+pptHostname, markerId-1)
# initialization for sub object ppt_hand
markerId=4
rawTracker['ppt_hand'] = vrpn7.addTracker('[email protected]'+pptHostname, markerId-1)
# initialization code for osv3_sensor_bus which is a InertialLabsOSv3SensorBus
port=11
sensorIndex=0
InertialLabs = viz.add('InertialLabs.dle')
sensors = InertialLabs.addSensorBus(port=port)
try:
sensor = sensors[sensorIndex]
except:
viz.logWarn("** WARNING: can't connect to InertialLabs OSv3 (Sensor Bus) on port {0} with index {1}. It's likely that not enough sensors are connected.".format(port, sensorIndex))
sensor = viz.addGroup()
sensor.invalidTracker = True
rawTracker['osv3_sensor_bus'] = sensor
# transformation offset code for osv3_sensor_bus
link = viz.link(rawTracker['osv3_sensor_bus'], viz.NullLinkable)
link.setSrcMaskOverride(viz.LINK_ORI|viz.LINK_POS)
link.preEuler([90, 0, 180])
rawTracker['osv3_sensor_bus'] = link
# initialization code for optical_heading which is a VirtualOpticalHeading
leftPosTracker=vizconnect.getRawTracker('ppt_Lhead')
rightPosTracker=vizconnect.getRawTracker('ppt_Rhead')
oriTracker=vizconnect.getRawTracker('osv3_sensor_bus')
distance=0.37
from vizconnect.virtual_trackers import OpticalHeading
rawTracker['optical_heading'] = OpticalHeading(leftPosTracker, rightPosTracker, oriTracker, distance=distance)
# setting default
default = 'ppt_Rhead'
return rawTracker, default
示例7: __init__
def __init__(self, offset, particle=None, sensorNum=0, attachTo=viz.MainView, preTrans = [0, 0, 0.1778]) :
viz.EventClass.__init__(self)
self.offset = offset
self.particle = particle
self.sensorNum = sensorNum
self.attachTo = attachTo
self.preTran = preTrans
self.off = True
self.vrpn = viz.add('vrpn6.dle')
self.tracker = self.vrpn.addTracker('[email protected]', sensorNum)
self.tracker.swapPos([1,3,2])
self.tracker.swapQuat([-1,-3,-2,4])
self.preMat = vizmat.Transform()
self.preMat.preEuler([-90, 0, 0]);
self.preMat.preTrans(self.preTran);
self.postMat = vizmat.Transform();
self.postMat.postTrans(offset);
vizact.ontimer(0, self.updateView)
self.pos = [0,0,0]
self.rot = [0, 0, 0, 0]
self.turnOn()
示例8: fadeAndAppear
def fadeAndAppear():
ball = viz.add('soccerball.ive')
ball.setPosition(2,2,0)
yield viztask.addAction( ball, vizact.fadeTo(0,time=2) )
print 'done fading'
yield viztask.addAction( ball, vizact.fadeTo(1,time=2) )
print 'done appearing'
示例9: start_avatar
def start_avatar():
avatar = viz.add('vcc_female.cfg', pos = (0,0,4), euler=(180,0,0))
avatar.state(5)
#Add avatar as a shadow caster
shadow.addCaster(avatar)
示例10: initInputs
def initInputs(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
#VC: place any general initialization code here
rawInput = vizconnect.getRawInputDict()
#VC: initialize a new input
_name = 'keyboard'
if vizconnect.isPendingInit('input', _name, initFlag, initList):
#VC: init the raw object
if initFlag&vizconnect.INIT_RAW:
#VC: set some parameters
index = 0
#VC: create the raw object
d = viz.add('directinput.dle')
device = d.getKeyboardDevices()[index]
rawInput[_name] = d.addKeyboard(device)
#VC: init the wrapper (DO NOT EDIT)
if initFlag&vizconnect.INIT_WRAPPERS:
vizconnect.addInput(rawInput[_name], _name, make='Generic', model='Keyboard')
#VC: initialize a new input
_name = 'mouse_buttons'
if vizconnect.isPendingInit('input', _name, initFlag, initList):
#VC: init the raw object
if initFlag&vizconnect.INIT_RAW:
#VC: create the raw object
rawInput[_name] = viz.mouse
#VC: init the wrapper (DO NOT EDIT)
if initFlag&vizconnect.INIT_WRAPPERS:
vizconnect.addInput(rawInput[_name], _name, make='Generic', model='Mouse Buttons')
#VC: return values can be modified here
return None
示例11: loadDisabledOceanScene
def loadDisabledOceanScene():
# Add environments.
global globeScene, city, skyDome2
globals_oa.ocean = vizfx.addChild(globals_oa.FILE_PATH_TO_WATER)
globals_oa.ocean.setAnimationSpeed(0.5)
globals_oa.terrainZone2 = vizfx.addChild(globals_oa.FILE_PATH_TO_ZONE2)
globals_oa.currentZoneNumber = 1
#underwater collision
transport_vhil.initializeOceanFloorCollision()
transport_vhil.initializeOceanSurfaceCollision()
globals_oa.ocean.disable(viz.RENDERING)
globals_oa.terrainZone2.disable(viz.RENDERING)
#load globescene assets
globeScene = vizfx.addChild(globals_oa.FILE_PATH_TO_GLOBE)
globeScene.setScale([0.2,0.2,0.2])
globeScene.setPosition([0,0,1])
globeScene.disable(viz.RENDERING)
#load city scene assets
city = vizfx.addChild(globals_oa.FILE_PATH_TO_CITY)
city.setPosition([-8,0,11])
skyDome2 = viz.add('sky_day.osgb')
city.disable(viz.RENDERING)
skyDome2.disable(viz.RENDERING)
示例12: initializeObjectFiles
def initializeObjectFiles():
global objectFiles
commonAddress='C:\Users\Bryton\Desktop\Terrain Vizard\TerrainStuff\\'
for i in range(len(objectAddresses)):
objectFiles.append([])
for j in range(len(objectAddresses[i])):
objectFiles[i].append(viz.add(commonAddress + objectAddresses[i][j]))
objectFiles[i][j].visible(viz.OFF)
示例13: setupPathView
def setupPathView ():
import vizcam
# viz.MainWindow.ortho(-25,25,-15,20,-1,1)
viz.MainView.setEuler(0,90,0)
flmap=viz.add('models/floor_map.IVE')
flmap.texture(viz.addTexture('textures/map_view.png'),'',0)
cam = vizcam.PivotNavigate(distance=50)
cam.centerNode(flmap)
示例14: addUser
def addUser():
global mainUser
# ---- Trackers ----
# Initialize an empty composite object to store all the trackers
# The composite.storeTracker() method is used to combine the individual trackers for the user's body within the composite
composite = VU.VUCompositeTrackers()
vrpn = viz.add('vrpn7.dle')
headPos = vrpn.addTracker( '[email protected]'+PPT_MACHINE,PPT_HEAD_ID)
if not OPTICAL_HEADING:
iLabs = viz.addExtension( 'inertiallabs.dle' )
headOri = iLabs.addSensorBus(port=INERTIALLABS_HEAD_PORT)[0]
VU.onkeydownspecial('r', resetHead, headOri, 90 )
# ---- Display ----
import sensics
sensics.zSight_60()
if not OPTICAL_HEADING:
headTracker = viz.mergeLinkable( headPos, headOri )
else:
headTracker = headPos
composite.storeTracker (composite.HEAD, headTracker )
viz.setOption('viz.fullscreen', 1 ) # Go fullscreen on monitor 1
viz.setOption('viz.fov', [37.5, 1.25]) # Set fov to match sensics specs
viz.setOption('viz.setDisplayMode', [1280,1024]) # Change resolution of displays
# ---- Input ----
wandpos = vrpn.addTracker('[email protected]' + PPT_MACHINE, PPT_WAND_ID)
wandori = iLabs.addSensorBus(port=INERTIALLABS_HAND_PORT)[0]
wandtracker = viz.mergeLinkable( wandpos, wandori )
# wandjoy = VU.VUJoystickPPTWandVRPN(hostname=PPT_MACHINE, markerid=PPT_WAND_ID+1)
# wandflyer = VU.VUTrackerWandFlyerSmooth(wandjoy, wandtracker,accelerationSteps=Config.WAND_ACCELERATION_STEPS, decelerationSteps=Config.WAND_DECELERATION_STEPS, speed=Config.WAND_SPEED_SCALE, keystrokes=[Config.WAND_BUTTON1,Config.WAND_BUTTON2,Config.WAND_BUTTON3,Config.WAND_BUTTON4,Config.WAND_BUTTON5,Config.WAND_BUTTON6],buttonReset=None, buttonForward=None, buttonFist=None, oriSteer=False )
# wandflyer.getHandSensor().joystick = wandjoy
# composite.addDriverNode(wandflyer)
# composite.storeTracker( composite.RHAND, wandtracker )
#the following is beta:
global main_sphere
composite.storeTracker(composite.RHAND,wandtracker)
viz.link(wandtracker, main_sphere)
#end beta.
#not sure if u need this in beta: composite.createRightHand(wandori)
VU.onkeydownspecial('r', resetHand, wandori, 90 )
# composite.storeTracker( composite.RHAND, wandtracker )
#composite.createRightHand(wandori)
# viz.link(wandtracker,ball)
# ---- Avatar ----
composite.createAvatarNone()
# ---- Finalize Composite ----
composite.finishTrackers() # Build up internal links for all the tracking devices
composite.defineViewpoint() # Attach viewpoint to default location on the user
mainUser = composite
manager.addComposite(mainUser, 'Main-User')
示例15: AddMap
def AddMap (self):
self.flmap=viz.add('models/floor_map2.IVE')
# self.flmap.texture(viz.addTexture('textures/map_view.png'),'',0)
self.flmap.setPosition(0, .01, 0)
#self.flmap.setScale(1, 1, 1.1)
self.flmap.renderOnlyToWindows([self._window])
self.bg = viz.addTexQuad(parent=viz.ORTHO, scene=self._window)
self.CreateInfoPanels()
self.CreateScorePanel()