getNextRenderItem method

dynamic getNextRenderItem(
  1. dynamic object,
  2. dynamic geometry,
  3. dynamic material,
  4. dynamic groupOrder,
  5. dynamic z,
  6. dynamic group,
)

Implementation

getNextRenderItem(object, geometry, material, groupOrder, z, group) {
  var renderItem = null;

  if (this.renderItemsIndex < this.renderItems.length) {
    renderItem = this.renderItems[this.renderItemsIndex];
  }

  if (renderItem == undefined) {
    renderItem = RenderItem(
        id: object.id,
        object: object,
        geometry: geometry,
        material: material,
        groupOrder: groupOrder,
        renderOrder: object.renderOrder,
        z: z,
        group: group);

    // this.renderItems[ this.renderItemsIndex ] = renderItem;
    this.renderItems.add(renderItem);
  } else {
    renderItem.id = object.id;
    renderItem.object = object;
    renderItem.geometry = geometry;
    renderItem.material = material;
    renderItem.groupOrder = groupOrder;
    renderItem.renderOrder = object.renderOrder;
    renderItem.z = z;
    renderItem.group = group;
  }

  this.renderItemsIndex++;

  return renderItem;
}