apply method

void apply(
  1. FragmentShader shader
)

Implementation

void apply(FragmentShader shader) {
  _indexFloat = startFloatIndex;
  _indexImage = startImageIndex;
  for (var item in values) {
    if (item is SetterDouble) {
      _setFloat(shader, item.value);
    }
    if (item is SetterImage) {
      _setSampler(shader, item.value);
    }

    if (item is SetterVector2) {
      _setFloat(shader, item.value.x);
      _setFloat(shader, item.value.y);
    }

    if (item is SetterColor) {
      final color = item.value;
      _setFloat(shader, color.red / 255 * color.opacity);
      _setFloat(shader, color.green / 255 * color.opacity);
      _setFloat(shader, color.blue / 255 * color.opacity);
      _setFloat(shader, color.opacity);
    }
  }
}