upload static method

void upload(
  1. dynamic gl,
  2. List seq,
  3. Map<String, dynamic> values,
  4. dynamic textures,
)

Implementation

static void upload(gl, List seq, Map<String, dynamic> values, textures) {
  for (var i = 0, n = seq.length; i != n; ++i) {
    var u = seq[i];
    var v = values[u.id];

    // var value = v["value"];
    // var _vt = value.runtimeType.toString();
    // print("WebGLUniforms.upload ${_vt} name: ${u.id}  value: ${value} ");
    // if(_vt == "Matrix4" || _vt == "Matrix3" || _vt == "Color" || _vt == "Vector2" || _vt == "Vector3") {
    //   print(value.toJSON());
    // } else if(_vt == "List<Vector3>") {
    //   print(value.map((e) => e.toJSON()));
    // } else if( u.id == "lightProbe" ) {
    //   print(value.map((e) => e.toJSON() ) );
    // } else if( u.id == "directionalLights" ) {
    //   print(value.map((e) => e["color"].toJSON() ) );
    //   print(value.map((e) => e["direction"].toJSON() ) );
    // } else if(u.id == "spotLights") {
    //   print("spotLights... ");
    //   print(value.map((e) => e["position"].toJSON() ) );
    //   print(value.map((e) => e["direction"].toJSON() ) );
    //   print(value.map((e) => e["color"].toJSON() ) );
    // } else if(u.id == "spotShadowMatrix" || u.id == "directionalShadowMatrix") {
    //   print(value.map((e) => e.toJSON()));
    // } else {
    //   print(value);
    // }

    if (v["needsUpdate"] != false) {
      // note: always updating when .needsUpdate is null
      u.setValue(gl, v["value"], textures);
    }
  }
}