Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit f3b7537

Browse files
committed
Forced implicit casting for Vector/Color parameters (see #567)
1 parent f584f5a commit f3b7537

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

PostProcessing/Runtime/ParameterOverride.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ public override void Interp(Color from, Color to, float t)
142142
value.b = from.b + (to.b - from.b) * t;
143143
value.a = from.a + (to.a - from.a) * t;
144144
}
145+
146+
public static implicit operator Vector4(ColorParameter prop)
147+
{
148+
return prop.value;
149+
}
145150
}
146151

147152
[Serializable]
@@ -152,6 +157,16 @@ public override void Interp(Vector2 from, Vector2 to, float t)
152157
value.x = from.x + (to.x - from.x) * t;
153158
value.y = from.y + (to.y - from.y) * t;
154159
}
160+
161+
public static implicit operator Vector3(Vector2Parameter prop)
162+
{
163+
return prop.value;
164+
}
165+
166+
public static implicit operator Vector4(Vector2Parameter prop)
167+
{
168+
return prop.value;
169+
}
155170
}
156171

157172
[Serializable]
@@ -163,6 +178,16 @@ public override void Interp(Vector3 from, Vector3 to, float t)
163178
value.y = from.y + (to.y - from.y) * t;
164179
value.z = from.z + (to.z - from.z) * t;
165180
}
181+
182+
public static implicit operator Vector2(Vector3Parameter prop)
183+
{
184+
return prop.value;
185+
}
186+
187+
public static implicit operator Vector4(Vector3Parameter prop)
188+
{
189+
return prop.value;
190+
}
166191
}
167192

168193
[Serializable]
@@ -175,6 +200,16 @@ public override void Interp(Vector4 from, Vector4 to, float t)
175200
value.z = from.z + (to.z - from.z) * t;
176201
value.w = from.w + (to.w - from.w) * t;
177202
}
203+
204+
public static implicit operator Vector2(Vector4Parameter prop)
205+
{
206+
return prop.value;
207+
}
208+
209+
public static implicit operator Vector3(Vector4Parameter prop)
210+
{
211+
return prop.value;
212+
}
178213
}
179214

180215
[Serializable]

0 commit comments

Comments
 (0)