def addFlickeringLight(model=MODEL, scene=viz.MainScene): global flickerOff fanLight = model.getChild("Sphere001") if flickerOff: vizfx.setAmbientColor(viz.BLACK) fanLight.emissive(viz.BLACK) else: vizfx.setAmbientColor(viz.SLATE) fanLight.emissive(viz.WHITE) flickerOff = not flickerOff flickering = fanLight.playsound("Audio/Apartment Scene/light_flicker.wav") flickering.play()
def setupLighting(self): viz.MainView.getHeadLight().remove() # Create Sky viz.clearcolor(viz.SKYBLUE) sky = viz.add('sky_day.osgb') sky.setScale(2, 2, 2) sky.setPosition(0, 0, 0) lightColor = [0.8, 0.7, 0.6] # Create directional lights sun = vizfx.addDirectionalLight(euler=([-120.00000, 24.50000, 0.00000]), color=lightColor) # Adjust ambient color vizfx.setAmbientColor([0.95, 0.95, 0.95])
def addFlickeringLight(model=MODEL, scene=viz.MainScene): global flickerOff fanLight = model.getChild("Sphere001") if flickerOff: vizfx.setAmbientColor(viz.BLACK) fanLight.emissive(viz.BLACK) else: vizfx.setAmbientColor(viz.SLATE) fanLight.emissive(viz.WHITE) flickerOff = not flickerOff flickering = fanLight.playsound("Audio/Apartment Scene/light_flicker.wav") flickering.play() if __name__ == "__main__": vhilGo(rift=False) SCENE = viz.Scene1 MODEL = "Apartment_Final.OSGB" apartment = vizfx.addChild(MODEL, scene=SCENE) control.control(viz.MainView) apartment.setPosition([0, 0.17, 0]) apartment.setScale([30, 30, 30]) vizfx.setAmbientColor([0.1, 0.1, 0.1]) viz.MainView.setPosition([-2.2, 1.6, -1.2]) viz.MainView.setEuler([90, 0, 0]) viz.MainView.setEuler([90, 0, 0]) viz.MainView.getHeadLight().disable() rotateFan(model=apartment, scene=SCENE) addOutsideLighting(apartment, SCENE) vizact.ontimer2(0.1, 10, addFlickeringLight, apartment, SCENE)
# Add directional shadow light pointing down. light1 = vizfx.addDirectionalLight(shadow=viz.SHADOW_DEPTH_MAP, pos=[6, 3, 0], euler=(0, 45, 0)) light2 = vizfx.addDirectionalLight(shadow=viz.SHADOW_DEPTH_MAP, pos=[-6, 3, 0], euler=(90, 45, 0)) light3 = vizfx.addDirectionalLight(shadow=viz.SHADOW_DEPTH_MAP, pos=[0, 3, 6], euler=(180, 45, 0)) light4 = vizfx.addDirectionalLight(shadow=viz.SHADOW_DEPTH_MAP, pos=[0, 3, -6], euler=(270, 45, 0)) # Set ambient light color. vizfx.setAmbientColor([.6] * 3) # Add the drum kit xylo = viz.addChild('./art/models/xylophone.dae', pos=[-.5, 0, 1.5], scale=[1, 1, 1]) xylo.setEuler([340, 0, 0]) print("--------") for entry in vizconnect.ConfigurationManager.get().getDict('tracker'): print(entry) print("--------") #Add sounds class SoundPlayer:
WATER_RISE_EVENT = viz.getEventID('WATER_RISE_EVENT') HEIGHT = 0 obj_vis = [] waterSound = viz.addAudio('fountain.wav') waterSound.volume(0.2) choirLocation = viz.addGroup(pos=[0.2, 1.8, -53]) choir_sound = choirLocation.playsound('art/scene1 choir.wav') #scene1 = viz.addChild('art/scene1.osgb') scene1 = vizfx.addChild('art/scene1.osgb') viz.MainView.getHeadLight().disable() # Disable ambient light vizfx.setAmbientColor(viz.BLACK) #scene1.disable(viz.LIGHTING) scene1.hint(viz.ALLOW_NPOT_TEXTURE_HINT) scene1.disable(0x3000) #Disable clip plane on model waterPlane = vizshape.addPlane(size=[400, 400], pos=[0, 0.2, 0]) obj_vis.append(scene1) obj_vis.append(waterPlane) sky = viz.addChild('sky_day.osgb') obj_vis.append(sky) #bellSensorLocation = viz.addGroup(pos=[0.74121, 0.61385, -74.72057]) #bellSensor = vizproximity.Sensor(vizproximity.Box(size=[6,10,6]),source=bellSensorLocation) #bellLocation = viz.addGroup(pos=[0.90712, 4.80442, -91.77573]) #bell_sound = bellLocation.playsound('bells.wav',flag=viz.PAUSE)