Skip to content

Commit 66a7bd0

Browse files
committed
update: Add new methods.
1 parent 0ef3445 commit 66a7bd0

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

Runtime/LightConverter.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,31 @@ public void SetColor(Light light, Color color)
4545
light.color = color;
4646
}
4747

48+
public void SetShadow(Light light, bool enabled, bool isDynamic, float nearPlane = 0.01f)
49+
{
50+
light.shadows = enabled ? LightShadows.Soft : LightShadows.None;
51+
light.shadowNearPlane = nearPlane;
52+
}
53+
4854
public void SetIntensity(Light light, float intensityLumen)
4955
{
5056
light.intensity = intensityLumen;
5157
}
5258

59+
public void SetTemperature(Light light, float temperature)
60+
{
61+
// todo
62+
}
63+
5364
public void SpotLight(Light light, float outer, float innerPercent)
5465
{
5566
light.spotAngle = outer;
5667
light.innerSpotAngle = outer * innerPercent * 0.01f;
5768
}
69+
70+
public void PyramidAngle(Light light, float angle, float aspectRatio)
71+
{
72+
// urp has no pyramid spot light
73+
}
5874
}
5975
}

Runtime/MaterialConverter.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
using UnityEngine;
2424
using VisualPinball.Engine.VPT;
2525
using Material = UnityEngine.Material;
26-
using Mesh = VisualPinball.Engine.VPT.Mesh;
2726

2827
namespace VisualPinball.Unity.Urp
2928
{
@@ -109,7 +108,7 @@ public Material CreateMaterial(PbrMaterial vpxMaterial, ITextureProvider texture
109108
unityMaterial.SetFloat(Metallic, metallicValue);
110109

111110
// roughness / glossiness
112-
unityMaterial.SetFloat(Smoothness, vpxMaterial.Roughness);
111+
SetSmoothness(unityMaterial, vpxMaterial.Roughness);
113112

114113
// map
115114
if (vpxMaterial.HasMap) {
@@ -127,6 +126,11 @@ public Material CreateMaterial(PbrMaterial vpxMaterial, ITextureProvider texture
127126
return unityMaterial;
128127
}
129128

129+
public void SetSmoothness(Material material, float smoothness)
130+
{
131+
material.SetFloat(Smoothness, smoothness);
132+
}
133+
130134
public Material MergeMaterials(PbrMaterial vpxMaterial, Material texturedMaterial)
131135
{
132136
var nonTexturedMaterial = CreateMaterial(vpxMaterial, null);
@@ -140,5 +144,15 @@ public Material MergeMaterials(PbrMaterial vpxMaterial, Material texturedMateria
140144

141145
return mergedMaterial;
142146
}
147+
148+
public void SetDiffusionProfile(Material material, DiffusionProfileTemplate template)
149+
{
150+
// todo
151+
}
152+
153+
public void SetMaterialType(Material material, MaterialType materialType)
154+
{
155+
// todo
156+
}
143157
}
144158
}

0 commit comments

Comments
 (0)