public AtmosphereCalculator( Point3 cameraPos, AtmosphereCalculatorModel model ) { m_CameraPos = cameraPos; m_Model = model; m_Inner = new Sphere3( Point3.Origin, model.PlanetRadius ); m_Outer = new Sphere3( Point3.Origin, model.AtmosphereRadius ); float heightRange = model.AtmosphereRadius - model.PlanetRadius; m_InvRH0 = -1.0f / ( heightRange * model.RayleighDensityScaleHeightFraction ); m_InvMH0 = -1.0f / ( heightRange * model.MieDensityScaleHeightFraction ); }
/// <summary> /// Sets up stored and derived parameters from an atmosphere model /// </summary> /// <remarks> /// The inner radius is diminished by a constant amount, because otherwise, the quantised /// view directions hit the inner sphere and cause a blue band to appear when the actual /// view direction approaches it. /// </remarks> private void SetupModelAndParameters( AtmosphereBuildParameters parameters, AtmosphereBuildModel model ) { m_RayleighCoefficients = ( float[] )model.RayleighCoefficients.Clone( ); m_MieCoefficients = ( float[] )model.MieCoefficients.Clone( ); m_InnerRadius = model.InnerRadiusMetres; m_OuterRadius = model.InnerRadiusMetres + model.AtmosphereThicknessMetres; m_InnerSphere = new Sphere3( Point3.Origin, m_InnerRadius * model.GroundRadiusMultiplier ); // NOTE: AP: See remarks m_OuterSphere = new Sphere3( Point3.Origin, m_OuterRadius ); m_AttenuationSamples = parameters.AttenuationSamples; float heightRange = ( m_OuterRadius - m_InnerRadius ); m_InvRH0 = -1.0f / ( heightRange * model.RayleighDensityScaleHeightFraction ); m_InvMH0 = -1.0f / ( heightRange * model.MieDensityScaleHeightFraction ); m_InscatterDistanceFudgeFactor = model.InscatterDistanceFudgeFactor; m_OutscatterDistanceFudgeFactor = model.OutscatterDistanceFudgeFactor; m_MieFudge = model.MieFudgeFactor; m_RayleighFudge = model.RayleighFudgeFactor; m_OutscatterFudge = model.OutscatterFudgeFactor; }