Exemplo n.º 1
0
        /// <summary>
        /// Applies a new depth information.
        /// </summary>
        /// <param name="depthInfo">The depth information.</param>
        public static void PushDepthInfo(DepthInfo depthInfo)
        {
            depth_stack.Push(depthInfo);

            if (CurrentDepthInfo.Equals(depthInfo))
            {
                return;
            }

            CurrentDepthInfo = depthInfo;
            setDepthInfo(CurrentDepthInfo);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Applies the last depth information.
        /// </summary>
        public static void PopDepthInfo()
        {
            Trace.Assert(depth_stack.Count > 1);

            depth_stack.Pop();
            DepthInfo depthInfo = depth_stack.Peek();

            if (CurrentDepthInfo.Equals(depthInfo))
            {
                return;
            }

            CurrentDepthInfo = depthInfo;
            setDepthInfo(CurrentDepthInfo);
        }
Exemplo n.º 3
0
        private static void setDepthInfo(DepthInfo depthInfo)
        {
            FlushCurrentBatch();

            if (depthInfo.DepthTest)
            {
                GL.Enable(EnableCap.DepthTest);
                GL.DepthFunc(depthInfo.Function);
            }
            else
            {
                GL.Disable(EnableCap.DepthTest);
            }

            GL.DepthMask(depthInfo.WriteDepth);
        }