Skip to content

Commit ba03f59

Browse files
authoredJan 4, 2023
fix: Support vector values for material textures (#290)
1 parent e920e49 commit ba03f59

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎src/rendering/renderers/webGpu/WebGpuRenderer.js

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {WebGpuChunkedBuffer} from "./bufferHelper/WebGpuChunkedBuffer.js";
55
import {CachedCameraData} from "./CachedCameraData.js";
66
import {CachedMeshData} from "./CachedMeshData.js";
77
import {Mat4} from "../../../math/Mat4.js";
8+
import {Vec2} from "../../../math/Vec2.js";
9+
import {Vec3} from "../../../math/Vec3.js";
810
import {Vec4} from "../../../math/Vec4.js";
911
import {LightComponent} from "../../../components/builtIn/LightComponent.js";
1012
import {MeshComponent} from "../../../components/builtIn/MeshComponent.js";
@@ -399,9 +401,12 @@ export class WebGpuRenderer extends Renderer {
399401
if (view) textureView = view;
400402
}
401403
if (!textureView) {
404+
/** @type {number[]} */
402405
let color;
403406
if (Array.isArray(value)) {
404407
color = value;
408+
} else if (value instanceof Vec2 || value instanceof Vec3 || value instanceof Vec4) {
409+
color = value.toArray();
405410
} else {
406411
color = [0, 0, 0];
407412
}

0 commit comments

Comments
 (0)