scripting updates

This commit is contained in:
Turánszki János
2022-06-23 10:39:25 +02:00
parent 0fad3b5111
commit d17a3f1fbe
6 changed files with 23 additions and 1 deletions
+1
View File
@@ -595,6 +595,7 @@
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
</None>
<None Include="$(MSBuildThisFileDirectory)scripts\spawn_many_lights.lua" />
</ItemGroup>
<ItemGroup>
<Image Include="$(MSBuildThisFileDirectory)models\billboardredflowers.png" />
+3
View File
@@ -201,6 +201,9 @@
<None Include="$(MSBuildThisFileDirectory)scripts\set_material_all.lua">
<Filter>scripts</Filter>
</None>
<None Include="$(MSBuildThisFileDirectory)scripts\spawn_many_lights.lua">
<Filter>scripts</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Image Include="$(MSBuildThisFileDirectory)models\Sponza\textures\background.png">
@@ -585,6 +585,7 @@ Describes an orientation in 3D space.
- SetEnergy(float value)
- SetColor(Vector value)
- SetCastShadow(bool value)
- SetVolumetricsEnabled(bool value)
- SetFOV(float value)
- GetType() : int result
+2 -1
View File
@@ -12,7 +12,7 @@ local bounds_max = scene.GetBounds().GetMax()
for i=1,200 do
local entity = CreateEntity()
entities[i] = entity
velocities[i] = math.lerp(0.1, 0.5, math.random())
velocities[i] = math.lerp(0.1, 0.2, math.random())
local light_transform = scene.Component_CreateTransform(entity)
light_transform.Translate(Vector(
math.lerp(bounds_min.GetX(), bounds_max.GetX(), math.random()),
@@ -25,6 +25,7 @@ for i=1,200 do
light_component.SetEnergy(6)
light_component.SetColor(Vector(1,0.5,0)) -- orange color
--light_component.SetColor(Vector(math.random(),math.random(),math.random())) -- random color
--light_component.SetVolumetricsEnabled(true)
light_component.SetCastShadow(true)
end
+15
View File
@@ -2160,6 +2160,7 @@ Luna<LightComponent_BindLua>::FunctionType LightComponent_BindLua::methods[] = {
lunamethod(LightComponent_BindLua, SetEnergy),
lunamethod(LightComponent_BindLua, SetColor),
lunamethod(LightComponent_BindLua, SetCastShadow),
lunamethod(LightComponent_BindLua, SetVolumetricsEnabled),
lunamethod(LightComponent_BindLua, GetType),
lunamethod(LightComponent_BindLua, SetFOV),
{ NULL, NULL }
@@ -2262,6 +2263,20 @@ int LightComponent_BindLua::SetCastShadow(lua_State* L)
return 0;
}
int LightComponent_BindLua::SetVolumetricsEnabled(lua_State* L)
{
int argc = wi::lua::SGetArgCount(L);
if (argc > 0)
{
component->SetVolumetricsEnabled(wi::lua::SGetBool(L, 1));
}
else
{
wi::lua::SError(L, "SetVolumetricsEnabled(bool value) not enough arguments!");
}
return 0;
}
int LightComponent_BindLua::SetFOV(lua_State* L)
{
int argc = wi::lua::SGetArgCount(L);
+1
View File
@@ -280,6 +280,7 @@ namespace wi::lua::scene
int SetEnergy(lua_State* L);
int SetColor(lua_State* L);
int SetCastShadow(lua_State* L);
int SetVolumetricsEnabled(lua_State* L);
int SetFOV(lua_State* L);
int GetType(lua_State* L);