setProperty method

LightShadow setProperty(
  1. String propertyName,
  2. dynamic newValue
)

Implementation

LightShadow setProperty(String propertyName, dynamic newValue) {
  if (propertyName == "camera") {
    if(camera is Map){
      camera = Camera.fromJson(newValue);
      return this;

    }
    camera = newValue;
  } else if (propertyName == "bias") {
    bias = newValue;
  } else if (propertyName == "normalBias") {
    normalBias = newValue;
  } else if (propertyName == "radius") {
    radius = newValue;
  } else if (propertyName == "blurSamples") {
    blurSamples = newValue;
  } else if (propertyName == "intensity") {
    intensity = newValue;
  } else if (propertyName == "mapSize") {
    if(newValue is List) {
      mapSize = Vector2(newValue[0].toDouble(), newValue[1].toDouble());
      return this;
    }
    mapSize = newValue;
  } else if (propertyName == "map") {
    map = newValue;
  } else if (propertyName == "mapPass") {
    mapPass = newValue;
  } else if (propertyName == "matrix") {
    matrix = newValue;
  } else if (propertyName == "autoUpdate") {
    autoUpdate = newValue;
  } else if (propertyName == "needsUpdate") {
    needsUpdate = newValue;
  } else if (propertyName == "viewportCount") {
    viewportCount = newValue;
  }
  else if (propertyName == "frameExtents") {
    if(newValue is List) {
      frameExtents.setFrom(Vector2(newValue[0].toDouble(), newValue[1].toDouble()));
      return this;
    }
    frameExtents.setFrom(newValue);
  }
  else if (propertyName == "viewports") {
    viewports.clear();
    if(newValue is List) {
      for(var v in newValue) {
        if(v is List) {
          viewports.add(Vector4(v[0].toDouble(), v[1].toDouble(), v[2].toDouble(), v[3].toDouble()));
        } else {
          viewports.add(v);
        }
      }
    }
  }
  else if (propertyName == "frustum") {
    if(newValue is Frustum) {
      frustum.copy(newValue);
    }
    else if(newValue is List) {
      frustum.set(newValue[0].toDouble(), newValue[1].toDouble(), newValue[2].toDouble(), newValue[3].toDouble(), newValue[4].toDouble(), newValue[5].toDouble());
    }
  }
  else if (propertyName == "lightPositionWorld") {
    if(newValue is List) {
      lightPositionWorld.setFrom(Vector3(newValue[0].toDouble(), newValue[1].toDouble(), newValue[2].toDouble()));
      return this;
    }
    lightPositionWorld.setFrom(newValue);
  }
  else if (propertyName == "lookTarget") {
    if(newValue is List) {
      lookTarget.setFrom(Vector3(newValue[0].toDouble(), newValue[1].toDouble(), newValue[2].toDouble()));
      return this;
    }
    lookTarget.setFrom(newValue);
  }
  else if (propertyName == "projScreenMatrix") {
    if(newValue is List) {
      projScreenMatrix.setFrom(Matrix4().copyFromUnknown(newValue));
      return this;
    }
    projScreenMatrix.setFrom(newValue);
  }
  else if (propertyName == "focus") {
    focus = newValue;
  }

  return this;
}