-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimpleLights.lua
64 lines (51 loc) · 1.52 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
require("getScriptFilename")
fn = getScriptFilename()
assert(fn, "Have to load this from file, not copy and paste, or we can't find our models!")
vrjLua.appendToModelSearchPath(fn)
vrjLua.appendToModelSearchPath(vrjLua.findInModelSearchPath("../../models/"))
--RelativeTo.World:addChild(robot)
ss = RelativeTo.World:getOrCreateStateSet()
--RelativeTo.World:addChild(Sphere{radius=.23, position = {0,3,-5}})
--RelativeTo.World:addChild(Sphere{radius=.23, position = {1.5,2,-6}})
function doLight1()
l1 = osg.Light()
l1:setAmbient(osg.Vec4(0.8, 0.8, 0.8, 0.8))
ls1 = osg.LightSource()
ls1:setLight(l1)
ls1:setLocalStateSetModes(osg.StateAttribute.Values.ON)
ss:setAssociatedModes(l1, osg.StateAttribute.Values.ON)
RelativeTo.Room:addChild(
ls1
)
l1:setPosition(osg.Vec4(0, 3, -5, 1.0))
end
-- doLight1()
function doLight1_5()
l3 = osg.Light()
l3:setLightNum(3)
l3:setAmbient(osg.Vec4(.2, .2, .3, 1.0))
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(-1.0, 0.0, 1.25, 1.0))
end
function doLight2()
l2 = osg.Light()
l2:setLightNum(1)
l2:setAmbient(osg.Vec4(.8, .8, 0.6, .50))
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, 2, 0, 1.0))
end
doLight1()
doLight2()
--doLight1_5()