pushLine method

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

Implementation

void pushLine(num a,num b) {
  try{
  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.scale( 1 / v1.positionScreen.w );
    v2.positionScreen.scale( 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 != null && colors.length > a*3 && colors.length > b*3) {
      _line.vertexColors[0].copyFromArray( colors, (a * 3).toInt() );
      _line.vertexColors[1].copyFromArray( colors, (b * 3).toInt() );
    }
    _renderData.elements.add( _line );
  }
  }
  catch(e){
    console.warning('projector.dart -> pushLine -> Exception: $e');
  }
}