atmosphere/reference/model.h

This file defines the API to use our atmosphere model on CPU. To use it:

#ifndef ATMOSPHERE_REFERENCE_MODEL_H_
#define ATMOSPHERE_REFERENCE_MODEL_H_

#include <memory>
#include <string>
#include <vector>

#include "atmosphere/reference/definitions.h"

namespace atmosphere {
namespace reference {

class Model {
 public:
  Model(const AtmosphereParameters& atmosphere,
        const std::string& cache_directory);

  void Init(unsigned int num_scattering_orders = 4);

  RadianceSpectrum GetSolarRadiance() const;

  RadianceSpectrum GetSkyRadiance(Position camera, Direction view_ray,
      Length shadow_length, Direction sun_direction,
      DimensionlessSpectrum* transmittance) const;

  RadianceSpectrum GetSkyRadianceToPoint(Position camera, Position point,
      Length shadow_length, Direction sun_direction,
      DimensionlessSpectrum* transmittance) const;

  IrradianceSpectrum GetSunAndSkyIrradiance(Position p, Direction normal,
      Direction sun_direction, IrradianceSpectrum* sky_irradiance) const;

 private:
  const AtmosphereParameters atmosphere_;
  const std::string cache_directory_;
  std::unique_ptr<TransmittanceTexture> transmittance_texture_;
  std::unique_ptr<ReducedScatteringTexture> scattering_texture_;
  std::unique_ptr<ReducedScatteringTexture> single_mie_scattering_texture_;
  std::unique_ptr<IrradianceTexture> irradiance_texture_;
};

}  // namespace reference
}  // namespace atmosphere

#endif  // ATMOSPHERE_REFERENCE_MODEL_H_