Class RenderParams

渲染参数

Hierarchy

  • RenderParams

Constructors

Properties

blendEquation: BlendEquation = 'FUNC_ADD'
colorMask: [boolean, boolean, boolean, boolean] = ...

控制那些颜色分量是否可以被写入到帧缓冲器。

[red, green, blue, alpha]

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/colorMask

cullFace: CullFace = 'BACK'

剔除面,默认 BACK,剔除背面。

默认情况下,逆时针的顶点连接顺序被定义为三角形的正面。 使用gl.frontFace(gl.CW);调整顺时针为正面

  • NONE 关闭裁剪面
  • FRONT 正面
  • BACK 背面
  • FRONT_AND_BACK 正面与背面

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/cullFace

depthFunc: DepthFunc = 'LESS'

指定深度比较函数的枚举,该函数设置绘制像素的条件,默认 LESS,如果传入值小于深度缓冲区值则通过。

A GLenum specifying the depth comparison function, which sets the conditions under which the pixel will be drawn. The default value is gl.LESS.

See

depthMask: boolean = true
depthtest: boolean = true

是否开启深度检查,默认 true,开启深度检测。

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/depthFunc

dfactor: BlendFactor = 'ONE_MINUS_SRC_ALPHA'

目标混合因子,默认 ONE_MINUS_SRC_ALPHA,将所有颜色乘以1减去源alpha值。

See

enableBlend: boolean = false

是否开启混合,默认 false,不开启混合。

<混合后的颜色> = <源颜色>*sfactor + <目标颜色>*dfactor

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/blendEquation

frontFace: FrontFace = 'CW'

正向方向,默认 CW。三角形顺时针方向为正面。

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/frontFace

polygonOffsetFactor: number = 0

为每个多边形设置可变深度偏移的比例因子。缺省值为0。

A GLfloat which sets the scale factor for the variable depth offset for each polygon. The default value is 0.

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/polygonOffset

polygonOffsetUnits: number = 0

它设置特定于实现的值乘以的乘数,以创建恒定的深度偏移量。缺省值为0。

A GLfloat which sets the multiplier by which an implementation-specific value is multiplied with to create a constant depth offset. The default value is 0.

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/polygonOffset

renderMode: RenderMode = 'TRIANGLES'

渲染模式,默认 TRIANGLES,每三个顶点绘制一个三角形。

  • POINTS 绘制单个点。
  • LINE_LOOP 绘制循环连线。
  • LINE_STRIP 绘制连线
  • LINES 每两个顶点绘制一条线段。
  • TRIANGLES 每三个顶点绘制一个三角形。
  • TRIANGLE_STRIP 绘制三角形条带。
  • TRIANGLE_FAN 绘制三角扇形。

A GLenum specifying the type primitive to render. Possible values are:

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements

scissor: {
    height: number;
    width: number;
    x: number;
    y: number;
} = ...

WebGL API的WebGLRenderingContext.scissor()方法设置了一个剪刀盒,它将绘图限制为一个指定的矩形。

The WebGLRenderingContext.scissor() method of the WebGL API sets a scissor box, which limits the drawing to a specified rectangle.

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/scissor

Type declaration

  • height: number
  • width: number
  • x: number
  • y: number
sfactor: BlendFactor = 'SRC_ALPHA'

源混合因子,默认 SRC_ALPHA,将所有颜色乘以源alpha值。

See

stencilFunc: StencilFunc = 'ALWAYS'

描述模板测试的方法。默认ALWAYS,总是通过。

A GLenum specifying the test function. The default function is gl.ALWAYS.

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/stencilFunc

stencilFuncMask: number = 1

模板测试时使用的mask值,默认1。

A GLuint specifying a bit-wise mask that is used to AND the reference value and the stored stencil value when the test is done. The default value is all 1.

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/stencilFunc

stencilFuncRef: number = 0

一个为模板测试指定参考值。这个值被限制在0到2^n -1的范围内,其中n是模板缓冲区中的位数。默认0。

A GLint specifying the reference value for the stencil test. This value is clamped to the range 0 to 2^n -1 where n is the number of bitplanes in the stencil buffer. The default value is 0.

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/stencilFunc

stencilMask: number = 1

指定位掩码以启用或禁用在模板平面中写入单个位的正整数。默认1。

A GLuint specifying a bit mask to enable or disable writing of individual bits in the stencil planes. By default, the mask is all 1.

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/stencilMask

stencilOpFail: StencilOp = 'KEEP'

指定模板测试失败时使用的函数的枚举。默认KEEP,保持当前值。

A GLenum specifying the function to use when the stencil test fails. The default value is gl.KEEP.

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/stencilMask

stencilOpZFail: StencilOp = 'KEEP'

指定在模板测试通过但深度测试失败时使用的函数枚举。默认KEEP,保持当前值。

A GLenum specifying the function to use when the stencil test passes, but the depth test fails. The default value is gl.KEEP.

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/stencilMask

stencilOpZPass: StencilOp = 'KEEP'

指定在模板测试和深度测试通过时使用的函数枚举,或在模板测试通过且没有深度缓冲或禁用深度测试时使用的函数枚举。默认KEEP,保持当前值。

A GLenum specifying the function to use when both the stencil test and the depth test pass, or when the stencil test passes and there is no depth buffer or depth testing is disabled. The default value is gl.KEEP.

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/stencilMask

usePolygonOffset: boolean = false

是否开启 gl.POLYGON_OFFSET_FILL,默认不开启。

WebGL API的WebGLRenderingContext.polygonOffset()方法指定了计算深度值的比例因子和单位。 在执行深度测试和将值写入深度缓冲区之前添加偏移量。

The WebGLRenderingContext.polygonOffset() method of the WebGL API specifies the scale factors and units to calculate depth values. The offset is added before the depth test is performed and before the value is written into the depth buffer.

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/polygonOffset

useScissor: boolean = false
useStencil: boolean = false

是否开启模板测试与更新模板缓冲。

Activates stencil testing and updates to the stencil buffer.

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/stencilFunc

useViewPort: boolean = false

是否使用 viewport,默认不使用,不使用时viewport为画布区域。

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/viewport

viewPort: {
    height: number;
    width: number;
    x: number;
    y: number;
} = ...

通过WebGL API的WebGLRenderingContext.viewport()方法设置了viewport,指定了x和y从标准化设备坐标到窗口坐标的仿射变换。

The WebGLRenderingContext.viewport() method of the WebGL API sets the viewport, which specifies the affine transformation of x and y from normalized device coordinates to window coordinates.

See

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/viewport

Type declaration

  • height: number
  • width: number
  • x: number
  • y: number

Generated using TypeDoc