Skip to content

Commit

Permalink
fix: incorrect shader pass uniform typing code
Browse files Browse the repository at this point in the history
  • Loading branch information
Lutymane committed Nov 29, 2021
1 parent c19a2eb commit ccfe9eb
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions types/three/examples/jsm/postprocessing/ShaderPass.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import { AvoidNullUniforms, ExtractUniforms, ShaderMaterial, TUniforms } from '../../../src/Three';
import {
AvoidNullUniforms,
ExtractUniforms,
ShaderMaterial,
ShaderMaterialParameters,
TUniforms,
} from '../../../src/Three';

import { FullScreenQuad, Pass } from './Pass';

export type TShader<Uniforms extends TUniforms> =
| ShaderMaterial<Uniforms>
| (Required<Pick<ShaderMaterial<Uniforms>, 'fragmentShader'>> &
Partial<Pick<ShaderMaterial<Uniforms>, 'vertexShader' | 'uniforms' | 'defines'>>);
export type ShaderLike<Uniforms extends TUniforms> = {
fragmentShader: ShaderMaterial['fragmentShader'];
vertexShader?: ShaderMaterial['vertexShader'];
defines?: ShaderMaterial['defines'];
} & (Exclude<keyof Uniforms, string> extends never ? { uniforms: Uniforms } : { uniforms?: Uniforms });

export class ShaderPass<T extends {} = TUniforms, Uniforms extends TUniforms = ExtractUniforms<T>> extends Pass {
constructor(shader: TShader<Uniforms>, textureID?: string);
constructor(shader: ShaderLike<Uniforms>, textureID?: string);
textureID: string;
uniforms: AvoidNullUniforms<Uniforms>;
material: ShaderMaterial<Uniforms>;
Expand Down

0 comments on commit ccfe9eb

Please sign in to comment.