Skip to content

Commit

Permalink
WebGPURenderer: More constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Sep 6, 2020
1 parent fcde309 commit b0f4546
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/jsm/renderers/webgpu/WebGPURenderPipelines.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GPUPrimitiveTopology, GPUIndexFormat, GPUTextureFormat, GPUCompareFunction, GPUFrontFace, GPUCullMode, GPUVertexFormat } from './constants.js';
import { GPUPrimitiveTopology, GPUIndexFormat, GPUTextureFormat, GPUCompareFunction, GPUFrontFace, GPUCullMode, GPUVertexFormat, GPUBlendFactor, GPUBlendOperation } from './constants.js';
import { FrontSide, BackSide, DoubleSide } from '../../../../build/three.module.js';

class WebGPURenderPipelines {
Expand Down Expand Up @@ -131,9 +131,9 @@ class WebGPURenderPipelines {
// @TODO: Should be customizable with material.blend* properties.

colorBlend = {
srcFactor: 'src-alpha',
dstFactor: 'one-minus-src-alpha',
operation: 'add'
srcFactor: GPUBlendFactor.SrcAlpha,
dstFactor: GPUBlendFactor.OneMinusSrcAlpha,
operation: GPUBlendOperation.Add
};

}
Expand Down
24 changes: 24 additions & 0 deletions examples/jsm/renderers/webgpu/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,27 @@ export const GPUFilterMode = {
Linear: 'linear',
Nearest: 'nearest'
};

export const GPUBlendFactor = {
Zero: 'zero',
One: 'one',
SrcColor: 'src-color',
OneMinusSrcColor: 'one-minus-src-color',
SrcAlpha: 'src-alpha',
OneMinusSrcAlpha: 'one-minus-src-alpha',
DstColor: 'dst-color',
OneMinusDstColor: 'one-minus-dst-color',
DstAlpha: 'dst-alpha',
OneMinusDstAlpha: 'one-minus-dst-alpha',
SrcAlphaSaturated: 'src-alpha-saturated',
BlendColor: 'blend-color',
OneMinusBlendColor: 'one-minus-blend-color'
};

export const GPUBlendOperation = {
Add: 'add',
Subtract: 'subtract',
ReverseSubtract: 'reverse-subtract',
Min: 'min',
Max: 'max'
};

0 comments on commit b0f4546

Please sign in to comment.