pushLine method

void pushLine(
  1. num a,
  2. num b
)

Implementation

void pushLine(num a, num b) {
  RenderableVertex v1 = _vertexPool[a.toInt()];
  RenderableVertex v2 = _vertexPool[b.toInt()]; // Clip

  v1.positionScreen.copyFromVector3(v1.position).applyMatrix4(_modelViewProjectionMatrix);
  v2.positionScreen.copyFromVector3(v2.position).applyMatrix4(_modelViewProjectionMatrix);

  if (clipLine(v1.positionScreen, v2.positionScreen)) {
    // Perform the perspective divide
    v1.positionScreen.multiplyScalar(1 / v1.positionScreen.w);
    v2.positionScreen.multiplyScalar(1 / v2.positionScreen.w);

    _line = getNextLineInPool();
    _line.id = object.id;
    _line.v1.copy(v1);
    _line.v2.copy(v2);
    _line.z = Math.max(v1.positionScreen.z, v2.positionScreen.z);
    _line.renderOrder = object.renderOrder;
    _line.material = object.material;

    if (object.material.vertexColors) {
      _line.vertexColors[0].fromArray(colors, (a * 3).toInt());
      _line.vertexColors[1].fromArray(colors, (b * 3).toInt());
    }
    _renderData.elements.add(_line);
  }
}