setEnvironment()
Purpose
Sets the texture used to draw the background and environment reflections in 3D space.
Description
Allows for 6 different background textures. Also allows a custom tint to be applied to the environment.
Syntax
setEnvironment( background, tint )
Arguments
background Integer number of the background (0 - 6)
tint RGBA (red, green, blue, alpha) vector describing the tint applied to the background
Example
c = controls(0)
oldc = c
ink(fuzePink)
obj = placeObject( cube, { 0, 0, 0 }, { 2, 2, 2 } )
setObjectMaterial( obj, white, 0, 1 )
background = 0
tint = { .1, .1, .1, 1 }
loop
clear()
c = controls(0)
if c.right and !oldc.right then
background += 1
endif
if c.left and !oldc.left then
background -= 1
endif
if background > 5 then
background = 0
endif
if background < 0 then
background = 5
endif
tint.rgb += x.ly * 0.01
setEnvironment( background, tint )
rotateObject( obj, { 0, 1, 1 }, 1 )
drawObjects()
oldc = c
printAt(0, 0, "Press the left and right directional buttons to change the background")
printAt(0, 2, "Currently viewing background ", background)
printAt(0, 4, "Push the left control stick up or down to adjust background tint")
printAt(0, 6, "Background tint: ", tint)
update()
repeat
Associated Commands