@@ -27,7 +27,7 @@ namespace VisualPinball.Engine.Unity.Hdrp
27
27
{
28
28
public class LightConverter : ILightConverter
29
29
{
30
- public void UpdateLight ( Light light , LightData data )
30
+ public void UpdateLight ( Light light , LightData data , bool isInsert )
31
31
{
32
32
// retrieve hdrp light
33
33
var hdLight = light . GetComponent < HDAdditionalLightData > ( ) ;
@@ -38,13 +38,39 @@ public void UpdateLight(Light light, LightData data)
38
38
39
39
// color and position
40
40
hdLight . color = data . Color2 . ToUnityColor ( ) ;
41
- hdLight . intensity = data . Intensity / 4f ;
42
- hdLight . range = data . Falloff * 0.001f ;
41
+ if ( ! isInsert ) {
42
+ hdLight . intensity = data . Intensity / 4f ;
43
+ hdLight . range = data . Falloff * 0.001f ;
43
44
44
- // TODO: vpe specific data for height
45
- light . transform . localPosition = new Vector3 ( 0f , 0f , 25f ) ;
45
+ // TODO: vpe specific data for height
46
+ light . transform . localPosition = new Vector3 ( 0f , 0f , 25f ) ;
47
+ }
46
48
47
49
hdLight . EnableShadows ( false ) ;
48
50
}
51
+
52
+ public void SetColor ( Light light , Color color )
53
+ {
54
+ var hdLight = light . GetComponent < HDAdditionalLightData > ( ) ;
55
+ if ( hdLight != null ) {
56
+ hdLight . color = color ;
57
+ }
58
+ }
59
+
60
+ public void SetIntensity ( Light light , float intensityLumen )
61
+ {
62
+ var hdLight = light . GetComponent < HDAdditionalLightData > ( ) ;
63
+ if ( hdLight != null ) {
64
+ hdLight . SetIntensity ( intensityLumen , LightUnit . Lumen ) ;
65
+ }
66
+ }
67
+
68
+ public void SpotLight ( Light light , float outer , float innerPercent )
69
+ {
70
+ var hdLight = light . GetComponent < HDAdditionalLightData > ( ) ;
71
+ if ( hdLight != null ) {
72
+ hdLight . SetSpotAngle ( outer , innerPercent ) ;
73
+ }
74
+ }
49
75
}
50
76
}
0 commit comments