ShaderPass constructor

ShaderPass(
  1. dynamic shader,
  2. dynamic textureID
)

Implementation

ShaderPass(shader, textureID) : super() {
  this.textureID = (textureID != null) ? textureID : 'tDiffuse';

  if (shader.runtimeType.toString() == "ShaderMaterial") {
    this.uniforms = shader.uniforms;

    this.material = shader;
  } else if (shader != null) {
    this.uniforms = UniformsUtils.clone(shader["uniforms"]);

    Map<String, dynamic> _defines = {};
    _defines.addAll(shader["defines"] ?? {});
    this.material = new ShaderMaterial({
      "defines": _defines,
      "uniforms": this.uniforms,
      "vertexShader": shader["vertexShader"],
      "fragmentShader": shader["fragmentShader"]
    });
  }

  this.fsQuad = new FullScreenQuad(this.material);
}