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!"); }
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)); }
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); }
public void SetStencilFunction(bool IsFrontFace, GalComparisonOp Func, int Ref, int Mask) { GL.StencilFuncSeparate( IsFrontFace ? StencilFace.Front : StencilFace.Back, OGLEnumConverter.GetStencilFunc(Func), Ref, Mask); }
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)); }
public void SetDepthFunction(GalComparisonOp Func) { GL.DepthFunc(OGLEnumConverter.GetDepthFunc(Func)); }
public static StencilFunction GetStencilFunc(GalComparisonOp func) { return((StencilFunction)GetFunc(func)); }
public static DepthFunction GetDepthFunc(GalComparisonOp func) { return((DepthFunction)GetFunc(func)); }
public static StencilFunction GetStencilFunc(GalComparisonOp Func) { //OGL comparison values match, it's just an enum cast return((StencilFunction)GetDepthFunc(Func)); }