pushPoint method

void pushPoint(
  1. Vector4 vector4,
  2. Object3D object,
  3. Camera camera
)

Implementation

void pushPoint(Vector4 vector4, Object3D object, Camera camera) {
  double invW = 1 / vector4.w;
  vector4.z *= invW;
  if (vector4.z >= -1 && vector4.z <= 1) {
    _sprite = getNextSpriteInPool();
    _sprite.id = object.id;
    _sprite.x = vector4.x * invW;
    _sprite.y = vector4.y * invW;
    _sprite.z = vector4.z;
    _sprite.renderOrder = object.renderOrder;
    _sprite.object = object;
    _sprite.rotation = object.rotation;
    _sprite.scale.x = object.scale.x *
        Math.abs(_sprite.x -
            (vector4.x + camera.projectionMatrix.elements[0]) / (vector4.w + camera.projectionMatrix.elements[12]));
    _sprite.scale.y = object.scale.y *
        Math.abs(_sprite.y -
            (vector4.y + camera.projectionMatrix.elements[5]) / (vector4.w + camera.projectionMatrix.elements[13]));
    _sprite.material = object.material;
    _renderData.elements.add(_sprite);
  }
}