Exemplo n.º 1
0
 public static void ResetState()
 {
     GL.DepthFunc(DepthFunction.Less);
     stateCache.Function = DepthFunction.Less;
     GL.DepthRange(0.0f, 1.0f);
     stateCache.Near = 0.0f;
     stateCache.Far  = 1.0f;
     GL.Enable(EnableCap.DepthTest);
     stateCache.Enabled = true;
     last = null;
 }
Exemplo n.º 2
0
        public override void Execute()
        {
#if !DISABLE_CACHE
            if (last == this)
            {
                return;
            }
#endif
            if (Enabled)
            {
#if !DISABLE_CACHE
                if (stateCache.Enabled == false)
#endif
                {
                    GL.Enable(EnableCap.DepthTest);
                    stateCache.Enabled = true;
                }
#if !DISABLE_CACHE
                if (stateCache.Function != Function)
#endif
                {
                    GL.DepthFunc(Function);
                    stateCache.Function = Function;
                }
#if !DISABLE_CACHE
                if (
                    (stateCache.Near != Near) ||
                    (stateCache.Far != Far)
                    )
#endif
                {
                    GL.DepthRange(Near, Far);
                    stateCache.Near = Near;
                    stateCache.Far  = Far;
                }
            }
            else
            {
#if !DISABLE_CACHE
                if (stateCache.Enabled == true)
#endif
                {
                    GL.Disable(EnableCap.DepthTest);
                    stateCache.Enabled = false;
                }
            }
            last = this;
        }