![]()  | 
  
    Skyline Lua API
    Version 1.0 RC1
    
   Lua Script Reference for Skyline Game Engine. 
   | 
 
#include <LUA_API_Environment.h>
Public Member Functions | |
| void | setTOD_Time (float time) | 
| Set the time of day in a 24 hr clock.  More... | |
| float | getTOD_Time () | 
| Get the time of day in a 24 hr clock mode.  More... | |
| void | setTOD_TimeMultiplier (float speedMulti) | 
| Set the time speed multiplier.  More... | |
| float | getTOD_TimeMultiplier () | 
| Get the time of day speed multiplier.  More... | |
| void | setTOD_Enabled (int enabled) | 
| Set whether the TOD Sky Movement is enabled or not.  More... | |
| int | getTOD_Enabled () | 
| Get whether the TOD Sky Movement is enabled.  More... | |
| void | loadTODFile (string filename) | 
| Load a sky configuration file during runtime.  More... | |
| void | setTOD_VolCloudsEnabled (int enabled) | 
| Set whether Volume Clouds are enabled. This can be used as a performance throttling.  More... | |
| int | getTOD_VolCloudsEnabled () | 
| Get whether the Volume Clouds are enabled.  More... | |
| void | setTOD_LightEnabled (int enabled) | 
| Set whether Sky Lighting is enabled.  More... | |
| int | getTOD_LightEnabled () | 
| Get whether the Sky Lighting is enabled or not.  More... | |
| void | setTOD_DiffuseStrength (float strength) | 
| Set the Diffuse Lighting Strength.  More... | |
| float | getTOD_DiffuseStrength () | 
| Get the current Lighting diffuse strength.  More... | |
| void | setTOD_SpecularStrength (float strength) | 
| Set the Specular Lighting Strength.  More... | |
| float | getTOD_SpecularStrength () | 
| Get the current Lighting specular strength.  More... | |
This area covers Environemnt functions to control Time of day and Ocean systems. Use as env.function(); For more information on how these functions can be used please visit the User Manual - http://www.chi-ad.com/Skyline/SDN/
To use these functions, you will need to activate the dynamic sky.
obj = 0;
function onInit(objID)
    obj = objID;
    sky.print("Scene Script Acitve");
    env.setTOD_Enabled(1);
    env.setTOD_TimeMultiplier(50);
end
function onUpdate( td )
    TOD_time = env.getTOD_Time();
    sky.print("TOD_time:"..TOD_time,1);
end
function onKeyDown( key )
    if(key == "1")then
        sky.print("Setting sky to morning",1);
        env.setTOD_Time(6);
    end
    
    if(key == "2")then
        sky.print("Setting sky to noon",1);
        env.setTOD_Time(12);
    end
    
    if(key == "3")then
        sky.print("Setting sky to evening",1);
        env.setTOD_Time(20);
    end 
    
    if(key == "4")then
        sky.print("Setting sky to midnight",1);
        env.setTOD_Time(24);
    end
end
function onStop( )
    env.setTOD_Enabled(0);
end | float env::getTOD_DiffuseStrength | ( | ) | 
Get the current Lighting diffuse strength.
Here is a Small Example of how to use this function:
function onUpdate(td)
    strength = env.getTOD_DiffuseStrength();
    sky.print("strength: "..strength, 1);
end 
| int env::getTOD_Enabled | ( | ) | 
Get whether the TOD Sky Movement is enabled.
Here is a Small Example of how to use this function:
function onUpdate(td)
    enabled = env.getTOD_Enabled();
    sky.print("enabled: "..enabled, 1);
end 
| int env::getTOD_LightEnabled | ( | ) | 
Get whether the Sky Lighting is enabled or not.
Here is a Small Example of how to use this function:
function onUpdate(td)
    enabled = env.getTOD_LightEnabled();
    sky.print("enabled: "..enabled, 1);
end 
| float env::getTOD_SpecularStrength | ( | ) | 
Get the current Lighting specular strength.
Here is a Small Example of how to use this function:
function onUpdate(td)
    strength = env.getTOD_SpecularStrength();
    sky.print("strength: "..strength, 1);
end 
| float env::getTOD_Time | ( | ) | 
Get the time of day in a 24 hr clock mode.
24/0 - midnight, 6 - sunrise, 12 - noon, 22 - sunset
Here is a Small Example of how to use this function:
function onUpdate(td)
    dayTime = env.getTOD_Time();
    sky.print("dayTime: "..dayTime, 1);
end 
| float env::getTOD_TimeMultiplier | ( | ) | 
Get the time of day speed multiplier.
Here is a Small Example of how to use this function:
function onUpdate(td)
    speedMulti = env.getTOD_TimeMultiplier();
    sky.print("speedMulti: "..speedMulti, 1);
end 
| int env::getTOD_VolCloudsEnabled | ( | ) | 
Get whether the Volume Clouds are enabled.
Here is a Small Example of how to use this function:
function onUpdate(td)
    enabled = env.getTOD_VolCloudsEnabled();
    sky.print("enabled: "..enabled, 1);
end 
| void env::loadTODFile | ( | string | filename | ) | 
Load a sky configuration file during runtime.
| filename | : The file name to load for the sky. Does not require a path to find the file. | 
Here is a Small Example of how to use this function:
function onKeyDown(key)
    if(key == "1")then
        env.loadTODFile("mySky");
    end
end 
| void env::setTOD_DiffuseStrength | ( | float | strength | ) | 
Set the Diffuse Lighting Strength.
| enabled | : 1 = true; 0 = false | 
Here is a Small Example of how to use this function:
obj = 0;
function onInit( objID )
    objID = obj;
    env.setTOD_DiffuseStrength(1);
end 
| void env::setTOD_Enabled | ( | int | enabled | ) | 
Set whether the TOD Sky Movement is enabled or not.
| enabled | : 1 = true; 0 = false | 
Here is a Small Example of how to use this function:
obj = 0;
function onInit( objID )
    objID = obj;
    env.setTOD_Enabled(1); -- turn movement on
    env.setTOD_Enabled(0); -- turn movement off
end 
| void env::setTOD_LightEnabled | ( | int | enabled | ) | 
Set whether Sky Lighting is enabled.
| enabled | : 1 = true; 0 = false | 
Here is a Small Example of how to use this function:
obj = 0;
function onInit( objID )
    objID = obj;
    env.setTOD_LightEnabled(1);
end 
| void env::setTOD_SpecularStrength | ( | float | strength | ) | 
Set the Specular Lighting Strength.
| strength | : Pass the wanted lighting strength. higher = brighter. lower = darker. | 
Here is a Small Example of how to use this function:
obj = 0;
function onInit( objID )
    objID = obj;
    env.setTOD_SpecularStrength(1);
end 
| void env::setTOD_Time | ( | float | time | ) | 
Set the time of day in a 24 hr clock.
24/0 - midnight, 6 - sunrise, 12 - noon, 22 - sunset
| time | : The time of day to change to. Must be done in 24 hr clock. | 
Here is a Small Example of how to use this function:
function onUpdate(td)
    env.setTOD_Time(12); -- midday , sun rises at 6 and goes down at 10
end 
| void env::setTOD_TimeMultiplier | ( | float | speedMulti | ) | 
Set the time speed multiplier.
| speedMulti | : The speed multiplier for the time of day progress. | 
Here is a Small Example of how to use this function:
function onUpdate(td)
    env.setTOD_TimeMultiplier(2); -- run at 2x speed.
    env.setTOD_Time(12); -- midday , sun rises at 6 and goes down at 10
end 
| void env::setTOD_VolCloudsEnabled | ( | int | enabled | ) | 
Set whether Volume Clouds are enabled. This can be used as a performance throttling.
| enabled | : 1 = true; 0 = false | 
Here is a Small Example of how to use this function:
obj = 0;
function onInit( objID )
    objID = obj;
    env.setTOD_VolCloudsEnabled(1); -- turn movement on
end