Example #1
0
        internal SimpleLineDrawer(bool doDepthTest)
        {
            _drawer = this;

            var shader = Shader.Find("Hidden/Internal-Colored");

            _material = new Material(shader)
            {
                hideFlags = HideFlags.HideAndDontSave
            };
            // Set blend mode to show destination alpha channel.
            var blend = doDepthTest
                ? UnityEngine.Rendering.BlendMode.OneMinusDstAlpha
                : UnityEngine.Rendering.BlendMode.Zero;

            _material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.DstAlpha);
            _material.SetInt("_DstBlend", (int)blend);

            // Turn off backface culling, depth writes, depth test.
            if (!doDepthTest)
            {
                _material.SetInt("_Cull", (int)UnityEngine.Rendering.CullMode.Off);
                _material.SetInt("_ZWrite", 0);
                _material.SetInt("_ZTest", (int)UnityEngine.Rendering.CompareFunction.Always);
            }

            _color = Color.white;
        }
Example #2
0
 protected override void OnFinishWhenNotForced()
 {
     if (_lineDrawer != null)
     {
         _lineDrawer.Dispose();
         _lineDrawer = null;
     }
 }
Example #3
0
 public DrawLinesAni Set(double seconds, bool doDepthTest)
 {
     _seconds    = (float)seconds;
     _lineDrawer = new SimpleLineDrawer(doDepthTest);
     return(this);
 }