Skip to content

Instantly share code, notes, and snippets.

@jon-grangien
Created July 10, 2018 18:47
Show Gist options
  • Save jon-grangien/b544da54623f3cf992befb1e0c7cf081 to your computer and use it in GitHub Desktop.
Save jon-grangien/b544da54623f3cf992befb1e0c7cf081 to your computer and use it in GitHub Desktop.
local nextSunTexture = function()
local textures = {
'${DATA}/mas/br_photo_bas05_trans_20G_offset.png',
'${DATA}/mas/br_photo_bas05_trans_100G_offset.png',
'${DATA}/mas/br_photo_bas05_trans_1000G_offset.png'
}
local currentTex = openspace.getPropertyValue('Scene.Sun.renderable.ColorTexture')
local newIndex = 1
for i, tex in ipairs(textures) do
if (currentTex == tex) then
newIndex = 3
end
end
-- if (newIndex > #textures) then
-- newIndex = 1
-- end
local texToSet = "\'" .. textures[newIndex] .. "\'"
return "openspace.setPropertyValueSingle('Scene.Sun.renderable.ColorTexture', " .. texToSet .. ");"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment