refreshUniformsPoints method

void refreshUniformsPoints(
  1. Map<String, dynamic> uniforms,
  2. Material material,
  3. double pixelRatio,
  4. double height,
)

Implementation

void refreshUniformsPoints(Map<String, dynamic> uniforms, Material material, double pixelRatio, double height) {
  uniforms["diffuse"]["value"].setFrom(material.color);
  uniforms["opacity"]["value"] = material.opacity;
  uniforms["size"]["value"] = material.size! * pixelRatio;
  uniforms["scale"]["value"] = height * 0.5;

  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

  Texture? 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"].setFrom(uvScaleMap.matrix);
  }
}