WebGLShadowMap constructor

WebGLShadowMap(
  1. WebGLRenderer _renderer,
  2. WebGLObjects _objects,
  3. WebGLCapabilities _capabilities
)

Implementation

WebGLShadowMap(this._renderer, this._objects, this._capabilities) {
  _maxTextureSize = _capabilities.maxTextureSize;

  _depthMaterial = MeshDepthMaterial.fromMap({"depthPacking": RGBADepthPacking});
  _distanceMaterial = MeshDistanceMaterial(null);

  shadowMaterialVertical = ShaderMaterial.fromMap({
    "defines": {"VSM_SAMPLES": 8},
    "uniforms": {
      "shadow_pass": <String,dynamic>{"value": null},
      "resolution": {"value": Vector2.zero()},
      "radius": {"value": 4.0}
    },
    "vertexShader": vsmVert,
    "fragmentShader": vsmFrag
  });

  final float32List = Float32List.fromList([-1.0, -1.0, 0.5, 3.0, -1.0, 0.5, -1.0, 3.0, 0.5]);

  fullScreenTri.setAttributeFromString('position', Float32BufferAttribute.fromList(float32List, 3, false));

  fullScreenMesh = Mesh(fullScreenTri, shadowMaterialVertical);

  shadowMaterialHorizontal = shadowMaterialVertical.clone();
  shadowMaterialHorizontal.defines!["HORIZONTAL_PASS"] = 1;

  scope = this;
}