da94fa2641
* Add More Properties to Lua Bindings * Fis class_parameters.lua Script * Update Transform Bindings * Update TransformComponent Bindings
46 lines
1.5 KiB
Lua
46 lines
1.5 KiB
Lua
-- This is a script to demonstrate new parameter access to lua c classes in Wicked Engine
|
|
-- Now you can access class parameters like you access table values just like usual, which now retrieves
|
|
-- and change class data without using separate getter-setter functions
|
|
|
|
backlog_post("---> START SCRIPT: class_parameters.lua")
|
|
|
|
ClearWorld()
|
|
|
|
local scene = GetScene()
|
|
|
|
local sun_entity = CreateEntity()
|
|
local sun_name = scene.Component_CreateName(sun_entity)
|
|
sun_name.SetName("THE SUN")
|
|
scene.Component_CreateLayer(sun_entity)
|
|
scene.Component_CreateTransform(sun_entity)
|
|
local sun = scene.Component_CreateLight(sun_entity)
|
|
-- sun.SetType() can now be done like this
|
|
sun.Type = 0
|
|
sun.Intensity = 10.0
|
|
|
|
local weather_entity = CreateEntity()
|
|
local weather_name = scene.Component_CreateName(weather_entity)
|
|
weather_name.SetName("My Animated Weather")
|
|
local weather = scene.Component_CreateWeather(weather_entity)
|
|
weather.SetRealisticSky(true)
|
|
weather.SetVolumetricClouds(true)
|
|
weather.skyExposure = 1.2
|
|
|
|
weather.VolumetricCloudParameters.CloudStartHeight = -100.0
|
|
weather.VolumetricCloudParameters.WeatherScale = 0.04
|
|
weather.VolumetricCloudParameters.WeatherDensityAmount = 0.5
|
|
weather.VolumetricCloudParameters.SkewAlongWindDirection = 5.0
|
|
|
|
runProcess(function()
|
|
while true do
|
|
update()
|
|
if(input.Press(string.byte('R'))) then
|
|
killProcessPID(script_pid(), true)
|
|
backlog_post("RESTART")
|
|
dofile(script_file(), script_pid())
|
|
return
|
|
end
|
|
end
|
|
end)
|
|
|
|
backlog_post("---> END SCRIPT: class_parameters.lua") |