本文整理汇总了Python中viz.addGroup函数的典型用法代码示例。如果您正苦于以下问题:Python addGroup函数的具体用法?Python addGroup怎么用?Python addGroup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addGroup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpSound
def setUpSound():
global windAudio, endingAudio, aboveLocation, endingAudioBasic, trumpetAudio
if USE_HMD_F:
#Adjusted head location to spatalize towards center of room
#Next, create 4 subviews to attach sounds to around the room for whooshing
userView = viz.addView()
userView.setPosition(0,1.6,0)
headLocation = viz.addGroup()
viz.link(userView, headLocation)
#Good adjustment for reverb and room, might not work as well for the city
#vizsonic.setReverb (30.0, 0.2, 0.5, 0.9, 0.1)
vizsonic.setSimulatedRoomRadius(30,30)
vizsonic.setShaker(1.0)
viz.setOption('sound3d.useViewRotation', 0)
#Set auarlizer to play towards center of room
viz.setListenerSound3D(headLocation)
#Turn on sound debugging?
viz.setDebugSound3D(False)
#Turn on windy city sounds
vizsonic.setAmbient('windy_edit.wav', 0.75, 0)
#Configure wind playing based on speed, play at higher location
aboveView = viz.addView()
aboveView.setPosition(0,3,0)
aboveLocation = viz.addGroup()
viz.link(aboveView, aboveLocation)
windAudio = aboveLocation.playsound('windMono.wav', viz.STOP, volume=WIND_MIN_VOLUME)
trumpetAudio = aboveLocation.playsound('audio/hero_trumpet.wav', viz.STOP, volume = 0.75)
chooseExpStateNLoadSound()
示例2: initTrackers
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
#VC: place any general initialization code here
rawTracker = vizconnect.getRawTrackerDict()
#VC: initialize a new tracker
_name = 'head_tracker'
if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
#VC: init the raw object
if initFlag&vizconnect.INIT_RAW:
#VC: set some parameters
group = None
#VC: create the raw object
if group is None:
group = viz.addGroup()
rawTracker[_name] = group
#VC: init the wrapper (DO NOT EDIT)
if initFlag&vizconnect.INIT_WRAPPERS:
vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Group')
#VC: initialize a new tracker
_name = 'rift_tracker'
if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
#VC: init the raw object
if initFlag&vizconnect.INIT_RAW:
#VC: set some parameters
index = 0
#VC: create the raw object
import oculus
sensorList = oculus.getSensors()
if index < len(sensorList):
orientationTracker = sensorList[index]
else:
viz.logWarn("** WARNING: Oculus VR Rift Orientation Tracker not present.")
orientationTracker = viz.addGroup()
orientationTracker.invalidTracker = True
rawTracker[_name] = orientationTracker
#VC: init the wrapper (DO NOT EDIT)
if initFlag&vizconnect.INIT_WRAPPERS:
vizconnect.addTracker(rawTracker[_name], _name, make='Oculus VR', model='DK2')
#VC: init the offsets
if initFlag&vizconnect.INIT_OFFSETS:
_link = vizconnect.getTracker(_name).getLink()
#VC: clear link offsets
_link.reset(viz.RESET_OPERATORS)
#VC: reset orientation
_link.preEuler([0, 0, 0], target=viz.LINK_ORI_OP, priority=-20)
#VC: return values can be modified here
return None
示例3: addAppendages
def addAppendages(avatar, numberOfArms):
global chestHorn, leftShoulderHorn, rightShoulderHorn, headHorn
#adding virtual models of arms
if some_global_variables.isLeftHanded == 0:
#right-handed
some_global_variables.appendage3 = addArm(PATH_TO_STUFF + "skin_tones/thirdArm.png", resources.RIGHT_ARM)
some_global_variables.appendage4 = addArm(PATH_TO_STUFF + "skin_tones/fourthArm.png", resources.LEFT_ARM)
some_global_variables.appendage5 = addArm(PATH_TO_STUFF + "skin_tones/fifthArm.png", resources.RIGHT_ARM)
else:
#left-handed
some_global_variables.appendage3 = addArm(PATH_TO_STUFF + "skin_tones/thirdArm.png", resources.LEFT_ARM)
some_global_variables.appendage4 = addArm(PATH_TO_STUFF + "skin_tones/fourthArm.png", resources.RIGHT_ARM)
some_global_variables.appendage5 = addArm(PATH_TO_STUFF + "skin_tones/fifthArm.png", resources.LEFT_ARM)
TouchCube.thirdAppendage = some_global_variables.appendage3
#adding horns for attaching the arms to
chestHorn = viz.addGroup()
chestHornLink = viz.link(avatar.getBone('Bip01 Spine2'), chestHorn)
chestHornLink.preTrans([0.0, 0.0, 0.0])
chestHornLink.preEuler([-90.0, 0.0, 0.0])
leftShoulderHorn = viz.addGroup()
leftShoulderHornLink = viz.link(avatar.getBone('Bip01 L Clavicle'), leftShoulderHorn)
leftShoulderHornLink.preTrans([-0.2, 0.0, 0.1])
leftShoulderHornLink.preEuler([-90.0, 0.0, 0.0])
rightShoulderHorn = viz.addGroup()
rightShoulderHornLink = viz.link(avatar.getBone('Bip01 R Clavicle'), rightShoulderHorn)
rightShoulderHornLink.preTrans([0.2, 0.0, 0.1])
rightShoulderHornLink.preEuler([-90.0, 0.0, 0.0])
headHorn = viz.addGroup()
headHornLink = viz.link(avatar.getBone('Bip01 Head'), headHorn)
headHornLink.preTrans([0.0, 0.2, 0.1])
headHornLink.preEuler([-90.0, 0.0, 0.0])
#setting the horns for fourth and fifth arms
if some_global_variables.isLeftHanded == 0:
#right-handed
some_global_variables.appendage4.setParent(leftShoulderHorn)
else:
#left-handed
some_global_variables.appendage4.setParent(rightShoulderHorn)
some_global_variables.appendage5.setParent(headHorn)
#switching horn attachment to the appendages based on the number of arms to be used
switchControlSchema(numberOfArms)
示例4: __init__
def __init__(self,**kw):
viz.EventClass.__init__(self)
node = viz.addGroup()
viz.VizNode.__init__(self,node.id)
# viz.EventClass.callback(self,viz.UPDATE_EVENT,self.onUpdate)
self.sPos = [0,0]
self.length = 100
示例5: addAppendage
def addAppendage(avatar, skinChoices, skin = 0, appendage = 0):
global thirdAppendage, usingInvisibleRod
thirdAppendageHorn = viz.addGroup()
if(appendage == 0):
#Third Arm
usingInvisibleRod = False
thirdAppendage = viz.addChild(resources.ARM)
if skin == 9:
texture = viz.addTexture("skin_tones/010.png")
texture.wrap(viz.WRAP_S,viz.REPEAT)
texture.wrap(viz.WRAP_T,viz.REPEAT)
else:
texture = viz.addTexture("skin_tones/00" + skinChoices[skin] + ".png")
texture.wrap(viz.WRAP_S,viz.REPEAT)
texture.wrap(viz.WRAP_T,viz.REPEAT)
thirdAppendage.texture(texture)
thirdAppendage.emissive([.75, .75, .75])
thirdAppendage.setScale(resources.ARM_SCALE)
elif(appendage == 1):
#Cylinder
usingInvisibleRod = False
thirdAppendage = viz.addChild(resources.CYLINDER)
thirdAppendage.setScale(resources.ARM_SCALE)
thirdAppendage.setParent(thirdAppendageHorn)
global tahLink
tahLink = viz.link(avatar.getBone('Bip01 Spine'), thirdAppendageHorn)
global offsetOp
offsetOp = tahLink.preTrans([0, 0.3, 0.1])
tahLink.preEuler([-90.0, 0.0, 0.0])
thirdAppendage.collideBox()
thirdAppendage.disable(viz.DYNAMICS)
TouchCube.thirdAppendage = thirdAppendage
示例6: addCaveWall
def addCaveWall(cave):
"""Create visualization of cave walls"""
walls = cave.getWalls()
group = viz.addGroup()
for w in walls:
mat = viz.Matrix()
mat.setQuat(w.getQuat())
mat.setPosition(w.getCenter())
wall_node = vizshape.addQuad([w.getWidth(),w.getHeight()],transform=mat,parent=group)
wall_node.color(viz.GRAY)
wall_node.alpha(0.3)
wire_node = vizshape.addQuad([w.getWidth(),w.getHeight()],transform=mat,parent=group)
wire_node.color(viz.BLACK)
wire_node.polyMode(viz.POLY_WIRE)
wire_node.zoffset()
group.disable(viz.LIGHTING)
return group
示例7: BridgeRoot
def BridgeRoot(pos=([0,0,0]),euler=([0,0,0])):
bridge_root = viz.addGroup()
# axes = vizshape.addAxes(parent=bridge_root)
# X = viz.addText3D('X',pos=[1.1,0,0],color=viz.RED,scale=[0.3,0.3,0.3],parent=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=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=axes)
bridge_root.setPosition(pos)
bridge_root.setEuler(euler)
return bridge_root
示例8: toggleMenu
def toggleMenu(node=viz.addGroup(),view=viz.MainView,menu=viz.addGUICanvas(),val=viz.TOGGLE):
menu.visible(val)
menuLink = None
if menu.getVisible() is True:
pos = view.getPosition()
menu.setPosition(pos[0],pos[1]-1,pos[2]+5)
# menuLink.remove()
else:
menuLink = viz.grab(node,menu)
示例9: __init__
def __init__(self, canvas, controller):
super(ModeMenu, self).__init__(canvas, 'mode', 'Mode Selection')
# Store controller instance
self.controller = controller
#Store modes from config to populate modemenu with
self.modes = config.MenuConfig.Modes
self.getPanel().fontSize(50)
##########################
"""creating modes panel"""
##########################
#creating labels for modes
self.modeLabels = {}
for l in self.modes.iterkeys():
self.modeLabels[l] = viz.addText(l, parent = canvas)
#creating radio buttons for modes
self.modeGroup = viz.addGroup(parent = canvas)
self.radioButtons = {}
for rb in self.modes.iterkeys():
self.radioButtons[rb] = viz.addRadioButton(self.modeGroup, parent = canvas)
self.radioButtons['Free Play'].set(1)
#creating grid panel to add mode to
modeGrid = vizdlg.GridPanel(parent = canvas)
#adding modes and radio buttons to grid panel
for i in self.modes.iterkeys():
modeGrid.addRow([self.modeLabels[i], self.radioButtons[i]])
##############################
"""next and back buttons"""
##############################
#creating grid panels to add next and back buttons to
setGrid = vizdlg.GridPanel(parent = canvas)
#create back and next buttons and add to grid panel
backButton = viz.addButtonLabel('Back')
startButton = viz.addButtonLabel('Next')
setGrid.addRow([backButton, startButton])
#add back and state button actions
self.backward = vizact.onbuttondown(backButton, self.controller.backMenu)
self.forward = vizact.onbuttondown(startButton, self.controller.nextMenu)
###############################
"""add items to ModeMenu"""
###############################
self.addItem(modeGrid)
self.addItem(setGrid)
示例10: getHUD
def getHUD(self):
"""Returns the root HUD node"""
if not self._hud_root:
root = viz.addGroup()
root.setReferenceFrame(viz.RF_VIEW)
root.drawOrder(100000)
root.disable(viz.DEPTH_TEST)
root.disable(viz.LIGHTING)
self._hud_root = root
return self._hud_root
示例11: __init__
def __init__(self):
super(self.__class__, self).__init__()
self._day = viz.add('resources/sky_day.osgb',parent=self._root)
self._day.renderToBackground(order=8)
self._environment = vizfx.addChild('resources/environment.osgb',parent=self._root)
# self._environment.renderToBackground()
self._waveGroup = viz.addGroup(parent=self._root)
# self._wave_M = viz.addChild('resources/wave.osgb',cache=viz.CACHE_CLONE,pos=([0,1.5,0]),parent=self._waveGroup)
# self._wave_B = viz.addChild('resources/wave.osgb',cache=viz.CACHE_CLONE,pos=([0,1.5,-50]),parent=self._waveGroup)
self._newWalkway = vizfx.addChild('resources/walkway.osgb',pos=[0,0.25,0], parent=self._root)
示例12: show
def show(self):
"""Turns on the grid, destroys any prior grid, and writes the current grid to file."""
if not self.previousMatrix:
self.previousMatrix = viz.MainView.getMatrix()
self.state = viz.ON
viz.MainView.reset(viz.HEAD_POS | viz.HEAD_ORI)
if (self.grid):
self.grid.remove()
self.grid = viz.addGroup()
m = viz.MainWindow.getMatrix()
horizOffset = math.tan(self.centerHorizAngle)*self.distance + self.offset[0]
vertOffset = math.tan(self.centerVertAngle)*self.distance + self.offset[1]
horizDelta = math.tan(self.horizAngle) * self.distance + self.dx
vertDelta = math.tan(self.vertAngle) * self.distance + self.dy
topLeftPos = [horizOffset - horizDelta * (self.numCols -1) / 2, vertOffset - vertDelta * (self.numRows - 1) / 2, self.distance]
self.pos = [[[0, 0, 0]] * self.numRows for k in range(self.numCols)]
self.pos_screen_left = [[[0, 0, 0]] * self.numRows for k in range(self.numCols)]
self.pos_screen_right = [[[0, 0, 0]] * self.numRows for k in range(self.numCols)]
for i in range(0, self.numCols):
for j in range(0, self.numRows):
#print i,j
self.pos[i][j] = [topLeftPos[0] + i * horizDelta, topLeftPos[1] + j * vertDelta, self.distance]
pt = viz.MainWindow.worldToScreen(self.pos[i][j], eye=viz.LEFT_EYE)
pt[2] = 0
self.pos_screen_left[i][j] = pt
#print pt
pt = viz.MainWindow.worldToScreen(self.pos[i][j], eye=viz.RIGHT_EYE)
pt[2] = 0
self.pos_screen_right[i][j] = pt
q = viz.addTexQuad(parent=self.grid)
q.texture(self.cross_tex)
q.setScale(self.stimScale, self.stimScale, 1)
q.setPosition(self.pos[i][j])
q.billboard() #Makes always visible to viewer
#print self.pos
self.writeoutSettings()
self.writeCustomCalPoints()
示例13: __init__
def __init__(self,tracker):
# Initialize using group node
group = viz.addGroup()
viz.VizNode.__init__(self,group.id)
self._offset = viz.Vector()
self._tracker = tracker
self._velocity = 0.0
# Update tracker every frame
self._updater = vizact.onupdate(0,self.update)
示例14: __init__
def __init__(self):
# --Key commands
self.KEYS = { 'forward' : 'w'
,'back' : 's'
,'left' : 'a'
,'right' : 'd'
,'down' : 'z'
,'up' : 'x'
,'reset' : 'r'
,'camera' : 'c'
,'restart' : viz.KEY_END
,'home' : viz.KEY_HOME
,'builder' : 'b'
,'viewer' : 'v'
,'env' : 't'
,'grid' : 'g'
,'hand' : 'h'
,'showMenu' : ' '
,'snapMenu' : viz.KEY_CONTROL_L
,'interact' : viz.MOUSEBUTTON_LEFT
,'utility' : viz.MOUSEBUTTON_MIDDLE
,'rotate' : viz.MOUSEBUTTON_RIGHT
,'orient' : viz.KEY_TAB
,'mode' : viz.KEY_SHIFT_L
,'proxi' : 'p'
,'collide' : 'c'
,'walk' : ','
,'angles' : '.'
,'road' : 'n'
,'esc' : viz.KEY_ESCAPE
,'stereo' : '='
,'capslock' : viz.KEY_CAPS_LOCK
,'slideFar' : '2'
,'slideNear': '1'
}
self.MOVE_SPEED = 1.4
self.MIN_SPEED = 0.7
self.MAX_SPEED = 2.8
self.STRAFE_SPEED = 2.0
self.TURN_SPEED = 90
self.ORIGIN_POS = [0,0,0]
self.ORIGIN_ROT = [0,0,0]
self.EYE_HEIGHT = 1.8
self.FOV = 100
self.CAN_ELEVATE = True
self.CAN_STRAFE = True
self.NODE = viz.addGroup()
self.VIEW = viz.MainView
self.VIEW_LINK = viz.link(self.NODE,self.VIEW)
示例15: initTrackers
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
#VC: place any general initialization code here
rawTracker = vizconnect.getRawTrackerDict()
#VC: initialize a new tracker
_name = 'head_tracker'
if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
#VC: init the raw object
if initFlag&vizconnect.INIT_RAW:
#VC: set some parameters
addMouseOrientation = True
positionSensitivity = 2.5
heightOffset = 1.82
sensorIndex = 0
#VC: create the raw object
import oculus
sensorList = oculus.getSensors()
if sensorIndex < len(sensorList):
dk2Tracker = sensorList[sensorIndex]
from vizconnect.util import virtual_trackers
tracker = virtual_trackers.TrackerAndKeyboardWalking(dk2Tracker, addMouseOrientation=addMouseOrientation, positionSensitivity=positionSensitivity, heightOffset=heightOffset)
else:
viz.logWarn("** WARNING: Oculus Tracker not present.")
tracker = viz.addGroup()
tracker.invalidTracker = True
rawTracker[_name] = tracker
#VC: init the wrapper (DO NOT EDIT)
if initFlag&vizconnect.INIT_WRAPPERS:
vizconnect.addTracker(rawTracker[_name], _name, make='Oculus VR', model='Rift With Mouse And Keyboard')
#VC: init the offsets
if initFlag&vizconnect.INIT_OFFSETS:
_link = vizconnect.getTracker(_name).getLink()
#VC: clear link offsets
_link.reset(viz.RESET_OPERATORS)
#VC: reset orientation
_link.preEuler([0, 0, 0], target=viz.LINK_ORI_OP, priority=-20)
#VC: init the mappings for the wrapper
if initFlag&vizconnect.INIT_WRAPPER_MAPPINGS:
#VC: on-state mappings
if initFlag&vizconnect.INIT_MAPPINGS_ON_STATE:
vizconnect.getTracker(_name).setOnStateEventList([
vizconnect.onstate(lambda rawInput: rawInput['keyboard'].isButtonDown(19), vizconnect.getTracker(_name).resetHeading),# make=Generic, model=Keyboard, name=keyboard, signal=Key R
])
#VC: return values can be modified here
return None