Adds a light.
scene = viz.MainScene
If the parent is viz.WORLD or viz.SCREEN, then the argument represents the scene to add the object to.
If the parent is viz.ORTHO, then the argument represents the window to add the object to.
If the parent is a valid node3d object, then the argument is ignored.
Grouping of lights allows different lights to be used for different events. It is not possible to use two light groups at once.
viz.go()
viz.MainView.move(0,0,-10)
room = viz.add('lab.ive')
room.appearance(viz.MODULATE)
def AddLight(lightColor,glareColor,group):
Light = viz.addLight(group=group)
Light.position(0,0,0)
Light.color(lightColor)
Light.linearAttenuation(0.2)
GlareQuad = viz.addTexQuad(parent=Light)
GlareQuad.billboard()
GlareQuad.color(glareColor)
GlareQuad.disable(viz.LIGHTING)
GlareQuad.setScale([0.2,0.2,0.2])
return Light
LIGHT_SPEED = 2
#Add red light group
light1 = AddLight([0.5,0,0],viz.RED,0)
light2 = AddLight([0.5,0,0],viz.RED,0)
light1.setPosition([-1,2,0])
light2.setPosition([1,2,0])
#Add white light group
light3 = AddLight([1,1,1],viz.WHITE,1)
light4 = AddLight([1,1,1],viz.WHITE,1)
light3.setPosition([0,2,-1])
light4.setPosition([0,2,1])
list = viz.addDropList(parent=viz.ORTHO,options=['0','1'],align=viz.TEXT_RIGHT_TOP)
list.fontSize(16)
viz.link(viz.RightTop,list,offset=(-10,-10,0))
def setLightGroup(e):
viz.setLightGroup(e.newSel)
vizact.onlist(list,setLightGroup)