refreshUniformsSprites method

dynamic refreshUniformsSprites(
  1. dynamic uniforms,
  2. dynamic material
)

Implementation

refreshUniformsSprites(uniforms, material) {
  uniforms["diffuse"]["value"].copy(material.color);
  uniforms["opacity"]["value"] = material.opacity;
  uniforms["rotation"]["value"] = material.rotation;

  if (material.map != null) {
    uniforms["map"]["value"] = material.map;
  }

  if (material.alphaMap != null) {
    uniforms["alphaMap"]["value"] = material.alphaMap;
  }

  if (material.alphaTest > 0) {
    uniforms["alphaTest"]["value"] = material.alphaTest;
  }

  // uv repeat and offset setting priorities
  // 1. color map
  // 2. alpha map

  var uvScaleMap;

  if (material.map != null) {
    uvScaleMap = material.map;
  } else if (material.alphaMap != null) {
    uvScaleMap = material.alphaMap;
  }

  if (uvScaleMap != null) {
    if (uvScaleMap.matrixAutoUpdate == true) {
      uvScaleMap.updateMatrix();
    }

    uniforms["uvTransform"]["value"].copy(uvScaleMap.matrix);
  }
}