ShaderMaterial: are uniform's types needed?

I thought that uniform’s types weren’t necessary anymore since in the docs there’s no reference to them and even in the related class (Uniform.js#L9) there’s the following warning:

'THREE.Uniform: Type parameter is no longer needed.'

Actually, in the ShaderMaterial examples, there are some of them in which the uniform’s types are specified and some in which they aren’t.

This question arose because of the last @Mugen87’s pull request #14598, since it’s based on a type checking for textures:

material.uniforms[ name ].value = ( uniform.type === 't' ) ? getTexture( uniform.value ) : uniform.value;
if ( uniform.type === 't' && uniform.value.isTexture ) { ... }

The question is: should I add types in my ShaderMaterial uniforms?

No, it’s not necessary. I’ve changed the PR in order to avoid this confusion.

2 Likes