Function defineShaderMaterial

  • Define a ShaderMaterial

    Parameters

    • uniforms: {
          [name: string]:
              | CubeTexture
              | Texture
              | Int32Array
              | Float32Array
              | Matrix4
              | Matrix3
              | Quaternion
              | Vector4
              | Vector3
              | Vector2
              | Color
              | number
              | boolean
              | any[]
              | null;
      }
      • [name: string]:
            | CubeTexture
            | Texture
            | Int32Array
            | Float32Array
            | Matrix4
            | Matrix3
            | Quaternion
            | Vector4
            | Vector3
            | Vector2
            | Color
            | number
            | boolean
            | any[]
            | null
    • vertexShader: string
    • fragmentShader: string
    • OptionalonInit: ((material?: ShaderMaterial) => void)
        • (material?): void
        • Parameters

          • Optionalmaterial: ShaderMaterial

          Returns void

    Returns typeof ShaderMaterial & {
        key: string;
    }

    Creates a THREE.ShaderMaterial for you with easier handling of uniforms, which are automatically declared as setter/getters on the object and allowed as constructor arguments. Ported from https://github.com/pmndrs/drei/blob/master/src/core/shaderMaterial.tsx