Browse Source

WebGPURenderer: More constants.

Mugen87 4 năm trước cách đây
mục cha
commit
b0f454610f

+ 4 - 4
examples/jsm/renderers/webgpu/WebGPURenderPipelines.js

@@ -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 {
@@ -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
 				};
 
 			}

+ 24 - 0
examples/jsm/renderers/webgpu/constants.js

@@ -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'
+};