예제 #1
0
        private static All GetFunc(GalComparisonOp func)
        {
            if ((int)func >= (int)All.Never &&
                (int)func <= (int)All.Always)
            {
                return((All)func);
            }

            switch (func)
            {
            case GalComparisonOp.Never:    return(All.Never);

            case GalComparisonOp.Less:     return(All.Less);

            case GalComparisonOp.Equal:    return(All.Equal);

            case GalComparisonOp.Lequal:   return(All.Lequal);

            case GalComparisonOp.Greater:  return(All.Greater);

            case GalComparisonOp.NotEqual: return(All.Notequal);

            case GalComparisonOp.Gequal:   return(All.Gequal);

            case GalComparisonOp.Always:   return(All.Always);
            }

            throw new ArgumentException(nameof(func) + " \"" + func + "\" is not valid!");
        }
예제 #2
0
        public static DepthFunction GetDepthFunc(GalComparisonOp Func)
        {
            //Looks like the GPU can take it's own values (described in GalComparisonOp) and OpenGL values alike
            if ((int)Func >= (int)DepthFunction.Never &&
                (int)Func <= (int)DepthFunction.Always)
            {
                return((DepthFunction)Func);
            }

            switch (Func)
            {
            case GalComparisonOp.Never:    return(DepthFunction.Never);

            case GalComparisonOp.Less:     return(DepthFunction.Less);

            case GalComparisonOp.Equal:    return(DepthFunction.Equal);

            case GalComparisonOp.Lequal:   return(DepthFunction.Lequal);

            case GalComparisonOp.Greater:  return(DepthFunction.Greater);

            case GalComparisonOp.NotEqual: return(DepthFunction.Notequal);

            case GalComparisonOp.Gequal:   return(DepthFunction.Gequal);

            case GalComparisonOp.Always:   return(DepthFunction.Always);
            }

            throw new ArgumentException(nameof(Func));
        }
예제 #3
0
        private void SetDepth()
        {
            float ClearDepth = ReadRegisterFloat(NvGpuEngine3dReg.ClearDepth);

            Gpu.Renderer.Rasterizer.SetClearDepth(ClearDepth);

            bool Enable = (ReadRegister(NvGpuEngine3dReg.DepthTestEnable) & 1) != 0;

            if (Enable)
            {
                Gpu.Renderer.Rasterizer.EnableDepthTest();
            }
            else
            {
                Gpu.Renderer.Rasterizer.DisableDepthTest();
            }

            if (!Enable)
            {
                return;
            }

            GalComparisonOp Func = (GalComparisonOp)ReadRegister(NvGpuEngine3dReg.DepthTestFunction);

            Gpu.Renderer.Rasterizer.SetDepthFunction(Func);
        }
예제 #4
0
 public void SetStencilFunction(bool IsFrontFace, GalComparisonOp Func, int Ref, int Mask)
 {
     GL.StencilFuncSeparate(
         IsFrontFace ? StencilFace.Front : StencilFace.Back,
         OGLEnumConverter.GetStencilFunc(Func),
         Ref,
         Mask);
 }
예제 #5
0
        public static DepthFunction GetDepthFunc(GalComparisonOp Func)
        {
            if ((int)Func >= (int)DepthFunction.Never &&
                (int)Func <= (int)DepthFunction.Always)
            {
                return((DepthFunction)Func);
            }

            throw new ArgumentException(nameof(Func));
        }
예제 #6
0
 public void SetDepthFunction(GalComparisonOp Func)
 {
     GL.DepthFunc(OGLEnumConverter.GetDepthFunc(Func));
 }
예제 #7
0
 public static StencilFunction GetStencilFunc(GalComparisonOp func)
 {
     return((StencilFunction)GetFunc(func));
 }
예제 #8
0
 public static DepthFunction GetDepthFunc(GalComparisonOp func)
 {
     return((DepthFunction)GetFunc(func));
 }
예제 #9
0
 public static StencilFunction GetStencilFunc(GalComparisonOp Func)
 {
     //OGL comparison values match, it's just an enum cast
     return((StencilFunction)GetDepthFunc(Func));
 }