setFunc method

void setFunc(
  1. int? depthFunc
)

Implementation

void setFunc(int? depthFunc) {
  if (currentDepthFunc != depthFunc) {
    if (depthFunc != null) {
      switch (depthFunc) {
        case NeverDepth:
          gl.depthFunc(WebGL.NEVER);
          break;

        case AlwaysDepth:
          gl.depthFunc(WebGL.ALWAYS);
          break;

        case LessDepth:
          gl.depthFunc(WebGL.LESS);
          break;

        case LessEqualDepth:
          gl.depthFunc(WebGL.LEQUAL);
          break;

        case EqualDepth:
          gl.depthFunc(WebGL.EQUAL);
          break;

        case GreaterEqualDepth:
          gl.depthFunc(WebGL.GEQUAL);
          break;

        case GreaterDepth:
          gl.depthFunc(WebGL.GREATER);
          break;

        case NotEqualDepth:
          gl.depthFunc(WebGL.NOTEQUAL);
          break;

        default:
          gl.depthFunc(WebGL.LEQUAL);
      }
    } else {
      gl.depthFunc(WebGL.LEQUAL);
    }

    currentDepthFunc = depthFunc;
  }
}