updated lua bindings and added rotate sun script

This commit is contained in:
Turanszki Janos
2021-07-11 14:54:37 +02:00
parent 40cafdf455
commit 7b182ccb37
5 changed files with 35 additions and 6 deletions
@@ -561,14 +561,10 @@ Describes an orientation in 3D space.
- [outer]DIRECTIONAL : int
- [outer]POINT : int
- [outer]SPOT : int
- [outer]SPHERE : int
- [outer]DISC : int
- [outer]RECTANGLE : int
- [outer]TUBE : int
- SetRange(float value)
- SetEnergy(float value)
- SetColor(Vector value)
- SetCastShadow(bool value)
- GetType() : int result
#### ObjectComponent
- GetMeshID() : Entity
+24
View File
@@ -0,0 +1,24 @@
-- This script will check for directional lights and begin rotating them slowly if there are any
killProcesses() -- stops all running lua coroutine processes
backlog_post("---> START SCRIPT: rotate_sun.lua")
scene = GetScene()
runProcess(function()
while true do
local lights = scene.Component_GetLightArray()
for i,light in ipairs(lights) do
if light.GetType() == DIRECTIONAL then
local entity = scene.Entity_GetLightArray()[i]
local transform_component = scene.Component_GetTransform(entity)
transform_component.Rotate(Vector(0.0015 * getDeltaTime() * GetGameSpeed(), 0, 0)) -- rotate around x axis
end
end
update()
end
end)
backlog_post("---> END SCRIPT: rotate_sun.lua")
+7
View File
@@ -2135,6 +2135,7 @@ Luna<LightComponent_BindLua>::FunctionType LightComponent_BindLua::methods[] = {
lunamethod(LightComponent_BindLua, SetEnergy),
lunamethod(LightComponent_BindLua, SetColor),
lunamethod(LightComponent_BindLua, SetCastShadow),
lunamethod(LightComponent_BindLua, GetType),
{ NULL, NULL }
};
Luna<LightComponent_BindLua>::PropertyType LightComponent_BindLua::properties[] = {
@@ -2236,6 +2237,12 @@ int LightComponent_BindLua::SetCastShadow(lua_State* L)
return 0;
}
int LightComponent_BindLua::GetType(lua_State* L)
{
wiLua::SSetInt(L, (int)component->GetType());
return 1;
}
+2
View File
@@ -275,6 +275,8 @@ namespace wiScene_BindLua
int SetEnergy(lua_State* L);
int SetColor(lua_State* L);
int SetCastShadow(lua_State* L);
int GetType(lua_State* L);
};
class ObjectComponent_BindLua
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wiVersion
// minor features, major updates, breaking compatibility changes
const int minor = 56;
// minor bug fixes, alterations, refactors, updates
const int revision = 66;
const int revision = 67;
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);