-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimpleLights.lua
42 lines (38 loc) · 1.16 KB
/
simpleLights.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
ss = RelativeTo.World:getOrCreateStateSet()
function doLight1()
local l3 = osg.Light()
l3:setLightNum(0)
l3:setAmbient(osg.Vec4(.1, .1, .1, 1.0))
local ls3 = osg.LightSource()
ls3:setLight(l3)
ls3:setLocalStateSetModes(osg.StateAttribute.Values.ON)
ss:setAssociatedModes(l3, osg.StateAttribute.Values.ON)
RelativeTo.Room:addChild(ls3)
l3:setPosition(osg.Vec4(2.0, 2, 1, 0.5))
end
function doLight2()
l2 = osg.Light()
l2:setLightNum(1)
l2:setAmbient(osg.Vec4(.1, .1, 0.1, 1.0))
ls2 = osg.LightSource()
ls2:setLight(l2)
ls2:setLocalStateSetModes(osg.StateAttribute.Values.ON)
ss:setAssociatedModes(l2, osg.StateAttribute.Values.ON)
RelativeTo.Room:addChild(ls2)
l2:setPosition(osg.Vec4(1.5, .1, -2, 1.0))
end
-- function doLight3()
-- l4 = osg.Light()
-- l4:setLightNum(2)
-- l4:setAmbient(osg.Vec4(.05, .05, 0.05, 0.5))
-- ls4 = osg.LightSource()
-- ls4:setLight(l4)
-- ls4:setLocalStateSetModes(osg.StateAttribute.Values.ON)
-- ss:setAssociatedModes(l4, osg.StateAttribute.Values.ON)
-- RelativeTo.Room:addChild(ls4)
-- l4:setPosition(osg.Vec4(2.0,.733,-2.55, 1.0))
-- end
doLight1()
doLight2()
-- doLight3()
print("simpleLights added to scene")