@@ -120,13 +120,21 @@ public class UIEffect : UIEffectBase
120
120
[ SerializeField ]
121
121
protected float m_ShadowFade = 0.9f ;
122
122
123
- [ SerializeField ]
124
- protected bool m_ShadowEffectOnOrigin = false ;
125
-
126
123
[ Range ( 0 , 2 ) ]
127
124
[ SerializeField ]
128
125
protected float m_ShadowMirrorScale = 0.5f ;
129
126
127
+ [ Range ( 0 , 1 ) ]
128
+ [ SerializeField ]
129
+ protected float m_ShadowBlurIntensity = 1 ;
130
+
131
+ [ SerializeField ]
132
+ protected ColorFilter m_ShadowColorFilter = ColorFilter . Replace ;
133
+
134
+ [ ColorUsage ( false , true ) ]
135
+ [ SerializeField ]
136
+ protected Color m_ShadowColor = Color . white ;
137
+
130
138
[ SerializeField ]
131
139
protected bool m_AllowExtendVertex = true ;
132
140
@@ -501,26 +509,49 @@ public int shadowIteration
501
509
}
502
510
}
503
511
504
- public bool shadowEffectOnOrigin
512
+ public float shadowMirrorScale
505
513
{
506
- get => m_ShadowEffectOnOrigin ;
514
+ get => m_ShadowMirrorScale ;
507
515
set
508
516
{
509
- if ( m_ShadowEffectOnOrigin == value ) return ;
510
- m_ShadowEffectOnOrigin = value ;
517
+ value = Mathf . Clamp ( value , 0f , 2f ) ;
518
+ if ( Mathf . Approximately ( m_ShadowMirrorScale , value ) ) return ;
519
+ context . shadowMirrorScale = m_ShadowMirrorScale = value ;
511
520
SetVerticesDirty ( ) ;
512
521
}
513
522
}
514
523
515
- public float shadowMirrorScale
524
+ public float shadowBlurIntensity
516
525
{
517
- get => m_ShadowMirrorScale ;
526
+ get => m_ShadowBlurIntensity ;
518
527
set
519
528
{
520
- value = Mathf . Clamp ( value , 0f , 2f ) ;
521
- if ( Mathf . Approximately ( m_ShadowMirrorScale , value ) ) return ;
522
- context . shadowMirrorScale = m_ShadowMirrorScale = value ;
523
- SetVerticesDirty ( ) ;
529
+ value = Mathf . Clamp ( value , 0 , 1 ) ;
530
+ if ( Mathf . Approximately ( m_ShadowBlurIntensity , value ) ) return ;
531
+ context . shadowBlurIntensity = m_ShadowBlurIntensity = value ;
532
+ ApplyContextToMaterial ( ) ;
533
+ }
534
+ }
535
+
536
+ public ColorFilter shadowColorFilter
537
+ {
538
+ get => m_ShadowColorFilter ;
539
+ set
540
+ {
541
+ if ( m_ShadowColorFilter == value ) return ;
542
+ context . shadowColorFilter = m_ShadowColorFilter = value ;
543
+ ApplyContextToMaterial ( ) ;
544
+ }
545
+ }
546
+
547
+ public Color shadowColor
548
+ {
549
+ get => m_ShadowColor ;
550
+ set
551
+ {
552
+ if ( m_ShadowColor == value ) return ;
553
+ context . shadowColor = m_ShadowColor = value ;
554
+ ApplyContextToMaterial ( ) ;
524
555
}
525
556
}
526
557
@@ -616,8 +647,10 @@ protected override void UpdateContext(UIEffectContext c)
616
647
c . shadowDistance = m_ShadowDistance ;
617
648
c . shadowIteration = m_ShadowIteration ;
618
649
c . shadowFade = m_ShadowFade ;
619
- c . shadowEffectOnOrigin = m_ShadowEffectOnOrigin ;
620
650
c . shadowMirrorScale = m_ShadowMirrorScale ;
651
+ c . shadowBlurIntensity = m_ShadowBlurIntensity ;
652
+ c . shadowColorFilter = m_ShadowColorFilter ;
653
+ c . shadowColor = m_ShadowColor ;
621
654
c . allowExtendVertex = m_AllowExtendVertex ;
622
655
}
623
656
@@ -713,8 +746,10 @@ public void LoadPreset(UIEffect preset)
713
746
m_ShadowDistance = preset . m_ShadowDistance ;
714
747
m_ShadowIteration = preset . m_ShadowIteration ;
715
748
m_ShadowFade = preset . m_ShadowFade ;
716
- m_ShadowEffectOnOrigin = preset . m_ShadowEffectOnOrigin ;
717
749
m_ShadowMirrorScale = preset . m_ShadowMirrorScale ;
750
+ m_ShadowBlurIntensity = preset . m_ShadowBlurIntensity ;
751
+ m_ShadowColorFilter = preset . m_ShadowColorFilter ;
752
+ m_ShadowColor = preset . m_ShadowColor ;
718
753
719
754
UpdateContext ( context ) ;
720
755
ApplyContextToMaterial ( ) ;
@@ -761,8 +796,10 @@ internal void CopyFrom(UIEffectContext c)
761
796
m_ShadowDistance = c . shadowDistance ;
762
797
m_ShadowIteration = c . shadowIteration ;
763
798
m_ShadowFade = c . shadowFade ;
764
- m_ShadowEffectOnOrigin = c . shadowEffectOnOrigin ;
765
799
m_ShadowMirrorScale = c . shadowMirrorScale ;
800
+ m_ShadowBlurIntensity = c . shadowBlurIntensity ;
801
+ m_ShadowColorFilter = c . shadowColorFilter ;
802
+ m_ShadowColor = c . shadowColor ;
766
803
767
804
m_AllowExtendVertex = c . allowExtendVertex ;
768
805
0 commit comments