Add point lights
This commit is contained in:
@@ -44,6 +44,8 @@ function init()
|
||||
light:SetSpecular(0.1)
|
||||
couch.Node.GetRoot():AddChild(light:Instance())
|
||||
|
||||
init_point_lights()
|
||||
|
||||
local skybox = couch.Skybox.FromFiles(
|
||||
"../resources/skybox/px.png",
|
||||
"../resources/skybox/nx.png",
|
||||
@@ -176,6 +178,22 @@ function update(delta)
|
||||
end
|
||||
end
|
||||
|
||||
function init_point_lights()
|
||||
local colors = {couch.Vector3(1.0, 0.0, 0.0), couch.Vector3(0.0, 1.0, 0.0), couch.Vector3(0.0, 0.0, 1.0)}
|
||||
for i, color in ipairs(colors) do
|
||||
local pointLight = couch.PointLight();
|
||||
pointLight:Translate(couch.Vector3(i * -10.0, 0, -10))
|
||||
pointLight:SetRadius(10.0)
|
||||
pointLight:SetColor(color)
|
||||
pointLight:SetAmbient(1.0)
|
||||
pointLight:SetSpecular(0.1)
|
||||
local lightBox = couch.Mesh.FromFile("../resources/cube.obj")
|
||||
lightBox:UniformScale(0.5);
|
||||
pointLight:AddChild(lightBox);
|
||||
couch.Node.GetRoot():AddChild(pointLight:Instance())
|
||||
end
|
||||
end
|
||||
|
||||
function action_dir(key, action, pos, neg, curr)
|
||||
if key == pos and action == couch.ACTION_PRESS then
|
||||
return 1.0
|
||||
|
||||
Reference in New Issue
Block a user