Skip to content

Commit

Permalink
Visualizer: RcanBackgroundController
Browse files Browse the repository at this point in the history
  • Loading branch information
keijiro committed Sep 23, 2020
1 parent 2341823 commit e6c2ef1
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 127 deletions.
76 changes: 27 additions & 49 deletions RcamVisualizer/Assets/Main.unity
Expand Up @@ -489,7 +489,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Option A
m_Text: NDI Source
--- !u!222 &67799781
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1040,8 +1040,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_ExecuteInEditor: 0
m_Bindings:
- {fileID: 392662326}
- {fileID: 392662330}
- {fileID: 392662326}
m_VisualEffect: {fileID: 392662329}
--- !u!73398921 &392662328
VFXRenderer:
Expand Down Expand Up @@ -1726,8 +1726,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_ExecuteInEditor: 0
m_Bindings:
- {fileID: 643685941}
- {fileID: 643685945}
- {fileID: 643685941}
m_VisualEffect: {fileID: 643685944}
--- !u!73398921 &643685943
VFXRenderer:
Expand Down Expand Up @@ -2052,8 +2052,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_ExecuteInEditor: 0
m_Bindings:
- {fileID: 651696155}
- {fileID: 651696151}
- {fileID: 651696155}
m_VisualEffect: {fileID: 651696154}
--- !u!73398921 &651696153
VFXRenderer:
Expand Down Expand Up @@ -3620,8 +3620,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_ExecuteInEditor: 0
m_Bindings:
- {fileID: 1034916025}
- {fileID: 1034916021}
- {fileID: 1034916025}
m_VisualEffect: {fileID: 1034916024}
--- !u!73398921 &1034916023
VFXRenderer:
Expand Down Expand Up @@ -4041,7 +4041,6 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1049808514}
- component: {fileID: 1049808523}
- component: {fileID: 1049808522}
- component: {fileID: 1049808521}
- component: {fileID: 1049808520}
Expand All @@ -4051,7 +4050,7 @@ GameObject:
- component: {fileID: 1049808516}
- component: {fileID: 1049808515}
m_Layer: 0
m_Name: Control Adapter
m_Name: Control
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand Down Expand Up @@ -4087,9 +4086,9 @@ MonoBehaviour:
_event:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1049808523}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundControllerAdapter, Assembly-CSharp
m_MethodName: set_EffectIntensity
- m_Target: {fileID: 1774963903}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundController, Assembly-CSharp
m_MethodName: set_EffectParameter
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
Expand All @@ -4115,9 +4114,9 @@ MonoBehaviour:
_event:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1049808523}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundControllerAdapter, Assembly-CSharp
m_MethodName: set_EffectParameter
- m_Target: {fileID: 1774963903}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundController, Assembly-CSharp
m_MethodName: set_EffectIntensity
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
Expand All @@ -4143,8 +4142,8 @@ MonoBehaviour:
_onEvent:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1049808523}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundControllerAdapter, Assembly-CSharp
- m_Target: {fileID: 1774963903}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundController, Assembly-CSharp
m_MethodName: set_EffectNumber
m_Mode: 3
m_Arguments:
Expand Down Expand Up @@ -4174,8 +4173,8 @@ MonoBehaviour:
_onEvent:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1049808523}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundControllerAdapter, Assembly-CSharp
- m_Target: {fileID: 1774963903}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundController, Assembly-CSharp
m_MethodName: set_EffectNumber
m_Mode: 3
m_Arguments:
Expand Down Expand Up @@ -4205,8 +4204,8 @@ MonoBehaviour:
_onEvent:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1049808523}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundControllerAdapter, Assembly-CSharp
- m_Target: {fileID: 1774963903}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundController, Assembly-CSharp
m_MethodName: set_EffectNumber
m_Mode: 3
m_Arguments:
Expand Down Expand Up @@ -4236,8 +4235,8 @@ MonoBehaviour:
_onEvent:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1049808523}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundControllerAdapter, Assembly-CSharp
- m_Target: {fileID: 1774963903}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundController, Assembly-CSharp
m_MethodName: set_EffectNumber
m_Mode: 3
m_Arguments:
Expand Down Expand Up @@ -4267,8 +4266,8 @@ MonoBehaviour:
_onEvent:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1049808523}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundControllerAdapter, Assembly-CSharp
- m_Target: {fileID: 1774963903}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundController, Assembly-CSharp
m_MethodName: set_EffectNumber
m_Mode: 3
m_Arguments:
Expand Down Expand Up @@ -4298,9 +4297,9 @@ MonoBehaviour:
_event:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1049808523}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundControllerAdapter, Assembly-CSharp
m_MethodName: set_EnableBackRender
- m_Target: {fileID: 1774963903}
m_TargetAssemblyTypeName: Rcam2.RcamBackgroundController, Assembly-CSharp
m_MethodName: set_BackFill
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
Expand All @@ -4310,19 +4309,6 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &1049808523
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1049808513}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3e4b7c6c99772c240a6e18406cbd980e, type: 3}
m_Name:
m_EditorClassIdentifier:
_target: {fileID: 1774963903}
--- !u!1 &1068503948
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -5017,11 +5003,7 @@ MonoBehaviour:
m_Value: 0
m_Options:
m_Options:
- m_Text: Option A
m_Image: {fileID: 0}
- m_Text: Option B
m_Image: {fileID: 0}
- m_Text: Option C
- m_Text: NDI Source
m_Image: {fileID: 0}
m_OnValueChanged:
m_PersistentCalls:
Expand Down Expand Up @@ -5285,8 +5267,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_ExecuteInEditor: 0
m_Bindings:
- {fileID: 1431082122}
- {fileID: 1431082121}
- {fileID: 1431082122}
m_VisualEffect: {fileID: 1431082125}
--- !u!73398921 &1431082124
VFXRenderer:
Expand Down Expand Up @@ -6398,10 +6380,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 992fe41d48d7b144fadd1bd73bced58c, type: 3}
m_Name:
m_EditorClassIdentifier:
_backOpacity: 1
_frontEffect: 0
_effectParameter: 0
_effectIntensity: 0
_effectGradient:
serializedVersion: 2
key0: {r: 0.20047058, g: 0.213, b: 0.06264705, a: 1}
Expand Down
41 changes: 17 additions & 24 deletions RcamVisualizer/Assets/Script/CustomPass/RcamBackgroundController.cs
Expand Up @@ -8,41 +8,26 @@ namespace Rcam2 {
//
sealed class RcamBackgroundController : MonoBehaviour
{
#region Enum declaration

public enum EffectType { Off, Slit, Marble, Slice, Displace }

#endregion

#region Editable attributes

[Space]
[SerializeField, Range(0, 1)] float _backOpacity = 1;
[Space]
[SerializeField] EffectType _frontEffect = EffectType.Off;
[SerializeField, Range(0, 1)] float _effectParameter = 0;
[SerializeField, Range(0, 1)] float _effectIntensity = 0;
[SerializeField] Gradient _effectGradient = null;

#endregion

#region Public properties

public bool IsActive => true;
public int PassNumber => EffectNumber;
public int EffectNumber { get; set; }
public bool BackFill { get; set; }
public float EffectParameter { get; set; }
public float EffectIntensity { get; set; }

public int PassNumber => (int)_frontEffect;

public EffectType FrontEffect
{ get => _frontEffect; set => _frontEffect = value; }

public float BackOpacity
{ get => _backOpacity; set => _backOpacity = value; }
#endregion

public float EffectParameter
{ get => _effectParameter; set => _effectParameter = value; }
#region Private variables

public float EffectIntensity
{ get => _effectIntensity; set => _effectIntensity = value; }
float _backOpacity;

#endregion

Expand All @@ -56,7 +41,7 @@ MaterialPropertyBlock UpdatePropertyBlock()
{
if (_props == null) _props = new MaterialPropertyBlock();

var eparams = new Vector2(_effectParameter, _effectIntensity);
var eparams = new Vector2(EffectParameter, EffectIntensity);
_props.SetFloat("_BGOpacity", _backOpacity);
_props.SetVector("_EffectParams", eparams);
_props.SetLinearGradient("_EffectGradient", _effectGradient);
Expand All @@ -65,6 +50,14 @@ MaterialPropertyBlock UpdatePropertyBlock()
}

#endregion

#region MonoBehaviour implementation

void Update()
=> _backOpacity = Mathf.Clamp01
(_backOpacity + (BackFill ? 1 : -1) * 10 * Time.deltaTime);

#endregion
}

} // namespace Rcam2

This file was deleted.

This file was deleted.

0 comments on commit e6c2ef1

Please sign in to comment.