|
@@ -82,91 +82,91 @@
|
|
|
{
|
|
|
fixed4 col = SampleSpriteTexture(i.texcoord) * i.color;
|
|
|
|
|
|
- float AngleX = _RadiusY / 4;
|
|
|
- float AngleY = AngleX / (_ScreenParams.y / _ScreenParams.x);
|
|
|
+ float AngleX = _RadiusY / 4;
|
|
|
+ float AngleY = AngleX / (_ScreenParams.y / _ScreenParams.x);
|
|
|
|
|
|
- float x = i.screenPos.x - _Center.x;
|
|
|
- float y = i.screenPos.y - _Center.y;
|
|
|
+ float x = i.screenPos.x - _Center.x;
|
|
|
+ float y = i.screenPos.y - _Center.y;
|
|
|
|
|
|
- if (abs(x) < _RadiusX && abs(y) < _RadiusY)
|
|
|
- {
|
|
|
- float2 ulo = _Center + float2(-_RadiusX, _RadiusY);
|
|
|
- float2 uli = ulo + float2(AngleX, -AngleY);
|
|
|
-
|
|
|
- float2 uro = _Center + float2(_RadiusX, _RadiusY);
|
|
|
- float2 uri = uro + float2(-AngleX, -AngleY);
|
|
|
+ if (abs(x) < _RadiusX && abs(y) < _RadiusY)
|
|
|
+ {
|
|
|
+ float2 ulo = _Center + float2(-_RadiusX, _RadiusY);
|
|
|
+ float2 uli = ulo + float2(AngleX, -AngleY);
|
|
|
|
|
|
- float2 lro = _Center + float2(_RadiusX, -_RadiusY);
|
|
|
- float2 lri = lro + float2(-AngleX, AngleY);
|
|
|
+ float2 uro = _Center + float2(_RadiusX, _RadiusY);
|
|
|
+ float2 uri = uro + float2(-AngleX, -AngleY);
|
|
|
|
|
|
- float2 llo = _Center + float2(-_RadiusX, -_RadiusY);
|
|
|
- float2 lli = llo + float2(AngleX, AngleY);
|
|
|
+ float2 lro = _Center + float2(_RadiusX, -_RadiusY);
|
|
|
+ float2 lri = lro + float2(-AngleX, AngleY);
|
|
|
|
|
|
- float ulix = i.screenPos.x - uli.x;
|
|
|
- float uliy = i.screenPos.y - uli.y;
|
|
|
- float ulox = i.screenPos.x - ulo.x;
|
|
|
- float uloy = i.screenPos.y - ulo.y;
|
|
|
+ float2 llo = _Center + float2(-_RadiusX, -_RadiusY);
|
|
|
+ float2 lli = llo + float2(AngleX, AngleY);
|
|
|
|
|
|
- float urix = i.screenPos.x - uri.x;
|
|
|
- float uriy = i.screenPos.y - uri.y;
|
|
|
- float urox = i.screenPos.x - uro.x;
|
|
|
- float uroy = i.screenPos.y - uro.y;
|
|
|
+ float ulix = i.screenPos.x - uli.x;
|
|
|
+ float uliy = i.screenPos.y - uli.y;
|
|
|
+ float ulox = i.screenPos.x - ulo.x;
|
|
|
+ float uloy = i.screenPos.y - ulo.y;
|
|
|
|
|
|
- float lrix = i.screenPos.x - lri.x;
|
|
|
- float lriy = i.screenPos.y - lri.y;
|
|
|
- float lrox = i.screenPos.x - lro.x;
|
|
|
- float lroy = i.screenPos.y - lro.y;
|
|
|
+ float urix = i.screenPos.x - uri.x;
|
|
|
+ float uriy = i.screenPos.y -uri.y;
|
|
|
+ float urox = i.screenPos.x - uro.x;
|
|
|
+ float uroy = i.screenPos.y - uro.y;
|
|
|
|
|
|
- float llix = i.screenPos.x - lli.x;
|
|
|
- float lliy = i.screenPos.y - lli.y;
|
|
|
- float llox = i.screenPos.x - llo.x;
|
|
|
- float lloy = i.screenPos.y - llo.y;
|
|
|
+ float lrix = i.screenPos.x - lri.x;
|
|
|
+ float lriy = i.screenPos.y - lri.y;
|
|
|
+ float lrox = i.screenPos.x - lro.x;
|
|
|
+ float lroy = i.screenPos.y - lro.y;
|
|
|
|
|
|
- if (ulix < 0 && uliy > 0 && ulox > 0 && uloy < 0)
|
|
|
- {
|
|
|
- float2 vec = uli - i.screenPos;
|
|
|
- vec.y *= _ScreenParams.y / _ScreenParams.x;
|
|
|
+ float llix = i.screenPos.x - lli.x;
|
|
|
+ float lliy = i.screenPos.y - lli.y;
|
|
|
+ float llox = i.screenPos.x - llo.x;
|
|
|
+ float lloy = i.screenPos.y - llo.y;
|
|
|
|
|
|
- if (length(vec) < AngleX)
|
|
|
+ if(ulix < 0 && uliy > 0 && ulox > 0 && uloy < 0)
|
|
|
{
|
|
|
- col.a = 0;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (urix > 0 && uriy > 0 && urox < 0 && uroy < 0)
|
|
|
- {
|
|
|
- float2 vec = uri - i.screenPos;
|
|
|
- vec.y *= _ScreenParams.y / _ScreenParams.x;
|
|
|
+ float2 vec = uli - i.screenPos;
|
|
|
+ vec.y *= _ScreenParams.y / _ScreenParams.x;
|
|
|
|
|
|
- if (length(vec) < AngleX)
|
|
|
- {
|
|
|
- col.a = 0;
|
|
|
+ if (length(vec) < AngleX)
|
|
|
+ {
|
|
|
+ col.a = 0;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- else if (lrix > 0 && lriy < 0 && lrox < 0 && lroy > 0)
|
|
|
- {
|
|
|
- float2 vec = lri - i.screenPos;
|
|
|
- vec.y *= _ScreenParams.y / _ScreenParams.x;
|
|
|
+ else if(urix > 0 && uriy > 0 && urox < 0 && uroy < 0)
|
|
|
+ {
|
|
|
+ float2 vec = uri - i.screenPos;
|
|
|
+ vec.y *= _ScreenParams.y / _ScreenParams.x;
|
|
|
|
|
|
- if (length(vec) < AngleX)
|
|
|
+ if (length(vec) < AngleX)
|
|
|
+ {
|
|
|
+ col.a = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (lrix > 0 && lriy < 0 && lrox < 0 && lroy > 0)
|
|
|
{
|
|
|
- col.a = 0;
|
|
|
+ float2 vec = lri - i.screenPos;
|
|
|
+ vec.y *= _ScreenParams.y / _ScreenParams.x;
|
|
|
+
|
|
|
+ if (length(vec) < AngleX)
|
|
|
+ {
|
|
|
+ col.a = 0;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- else if (llix < 0 && lliy < 0 && llox > 0 && lloy > 0)
|
|
|
- {
|
|
|
- float2 vec = lli - i.screenPos;
|
|
|
- vec.y *= _ScreenParams.y / _ScreenParams.x;
|
|
|
+ else if (llix < 0 && lliy < 0 && llox > 0 && lloy > 0)
|
|
|
+ {
|
|
|
+ float2 vec = lli - i.screenPos;
|
|
|
+ vec.y *= _ScreenParams.y / _ScreenParams.x;
|
|
|
|
|
|
- if (length(vec) < AngleX)
|
|
|
+ if (length(vec) < AngleX)
|
|
|
+ {
|
|
|
+ col.a = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
col.a = 0;
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- col.a = 0;
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
return col;
|
|
|
}
|