apply method

dynamic apply(
  1. dynamic accuIndex
)

Implementation

apply(accuIndex) {
  var stride = valueSize,
      buffer = this.buffer,
      offset = accuIndex * stride + stride,
      weight = cumulativeWeight,
      weightAdditive = cumulativeWeightAdditive,
      binding = this.binding;

  cumulativeWeight = 0;
  cumulativeWeightAdditive = 0;

  if (weight < 1) {
    // accuN := accuN + original * ( 1 - cumulativeWeight )

    var originalValueOffset = stride * _origIndex;

    _mixBufferRegion(buffer, offset, originalValueOffset, 1 - weight, stride);
  }

  if (weightAdditive > 0) {
    // accuN := accuN + additive accuN

    _mixBufferRegionAdditive(buffer, offset, _addIndex * stride, 1, stride);
  }

  for (var i = stride, e = stride + stride; i != e; ++i) {
    if (buffer[i] != buffer[i + stride]) {
      // value has changed -> update scene graph
      binding.setValue(buffer, offset);
      break;
    }
  }
}