Skip to content

Commit 01a610e

Browse files
committed
fix(@typegpu/three): Let Three.js infer type of new THREE.Color() passed into t3.uniform() (#2035)
1 parent 8171be6 commit 01a610e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

packages/typegpu-three/src/uniform.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import {
33
uniform as uniformImpl,
44
uniformArray as uniformArrayImpl,
55
} from 'three/tsl';
6-
import type { Node, TSL, UniformArrayNode, UniformNode } from 'three/webgpu';
6+
import type {
7+
Color,
8+
Node,
9+
TSL,
10+
UniformArrayNode,
11+
UniformNode,
12+
} from 'three/webgpu';
713
import * as d from 'typegpu/data';
814
import { wgslTypeToGlslType } from './common.ts';
915
import { fromTSL, type TSLAccessor } from './typegpu-node.ts';
@@ -28,7 +34,7 @@ export function uniform<TValue, TDataType extends d.AnyWgslData>(
2834
let glslType: string | undefined =
2935
wgslTypeToGlslType[dataType.type as keyof typeof wgslTypeToGlslType];
3036

31-
if ((value as TSL.NodeObject<Node>).isNode) {
37+
if ((value as TSL.NodeObject<Node>).isNode || (value as Color).isColor) {
3238
// The type sometimes interferes with the node's inherent type
3339
glslType = undefined;
3440
}

0 commit comments

Comments
 (0)