getCameraRatio static method

double getCameraRatio(
  1. Camera camera
)

Implementation

static double getCameraRatio(Camera camera) {
  switch (camera.type) {
    case 'PerspectiveCamera': {
      return camera.aspect;
    }
    case 'OrthographicCamera': {
      final width = (camera.right - camera.left).abs();
      final height = (camera.top - camera.bottom).abs();
      return width / height;
    }
    default: {
      throw ('${camera.type} is currently not supported in ProjectedMaterial');
    }
  }
}