public SilverLiningSky ()
    {
        sunDistance *= (float)SilverLining.unitScale;
        moonDistance *= (float)SilverLining.unitScale;
        H *= (float)SilverLining.unitScale;

        ephemeris = new SilverLiningEphemeris ();
        InitTwilightLuminances ();
        sunSpectrum = new SilverLiningSolarSpectrum ();
        lunarSpectrum = new SilverLiningLunarSpectrum ();
        XYZ2RGB = new SilverLiningMatrix3 (3.240479, -0.969256, 0.055648, -1.537150, 1.875992, -0.204043, -0.498535, 0.041556, 1.057311);

        XYZ2RGB4 = new Matrix4x4 ();
        XYZ2RGB4[0, 0] = 3.240479f;
        XYZ2RGB4[0, 1] = -0.969256f;
        XYZ2RGB4[0, 2] = 0.055648f;
        XYZ2RGB4[0, 3] = 0.0f;
        XYZ2RGB4[1, 0] = -1.537150f;
        XYZ2RGB4[1, 1] = 1.875992f;
        XYZ2RGB4[1, 2] = -0.204043f;
        XYZ2RGB4[1, 3] = 0.0f;
        XYZ2RGB4[2, 0] = -0.498535f;
        XYZ2RGB4[2, 1] = 0.041556f;
        XYZ2RGB4[2, 2] = 1.057311f;
        XYZ2RGB4[2, 3] = 0.0f;
        XYZ2RGB4[3, 0] = 0.0f;
        XYZ2RGB4[3, 1] = 0.0f;
        XYZ2RGB4[3, 2] = 0.0f;
        XYZ2RGB4[3, 3] = 1.0f;
		
		hosekWilkieRadiances = new double[3];
		hosekWilkieCoeffs = new double[3,9];
		
		datasetsXYZ = new double[][]
		{
			datasetXYZ1,
			datasetXYZ2,
			datasetXYZ3
		};
		
		datasetsXYZRad = new double[][]
		{
			datasetXYZRad1,
			datasetXYZRad2,
			datasetXYZRad3
		};
    }
    public SilverLiningStars (SilverLiningEphemeris pEphemeris)
    {
        starDistance *= (float)SilverLining.unitScale;

        ephemeris = pEphemeris;

        int totalStars = starData.GetLength (0);
        for (int i = 0; i < totalStars; i++) {
            double magnitude = starData[i, 0];
            if (magnitude < minimumStarMagnitude) {
                numStars++;
            }
        }
        
        double epochCenturies = ephemeris.GetEpochCenturies ();
        double yearCorrection = 50.0 + epochCenturies * 100.0;
        
        starParticles = new Star[numStars];
        int j = 0;
        for (int i = 0; i < totalStars; i++) {
            double magnitude = starData[i, 0];
            if (magnitude < minimumStarMagnitude) {
                double nra = starData[i, 1];
                double ndec = starData[i, 2];
                double r = starData[i, 3];
                double g = starData[i, 4];
                double b = starData[i, 5];
                double raProperMotion = starData[i, 6];
                double decProperMotion = starData[i, 7];
                
                double ra = nra + raProperMotion * yearCorrection;
                double dec = ndec + decProperMotion * yearCorrection;
                
                Vector3 starPos = new Vector3 ();
                starPos.x = starDistance * (float)(Math.Cos (ra) * Math.Cos (dec));
                starPos.y = starDistance * (float)(Math.Sin (ra) * Math.Cos (dec));
                starPos.z = starDistance * (float)(Math.Sin (dec));
                starParticles[j].position = starPos;
                
                Color starColor = new Color ((float)(r / 255.0), (float)(g / 255.0), (float)(b / 255.0));
                
                float luminance = (float)Math.Pow (100.0, (-magnitude / 5.0));
                float r2 = luminance / (float)Math.Pow (luminance, 2.0 / 3.0) + brightness;
                
                starParticles[j].color = starColor * r2;
                j++;
            }
        }
        
        stars = GameObject.Find ("SilverLiningStars");
        stars.renderer.material.renderQueue = 2001;
        ParticleRenderer ren = stars.GetComponent<ParticleRenderer> ();
        ren.enabled = false;
    }
    public SilverLiningSky()
    {
        sunDistance *= (float)SilverLining.unitScale;
        moonDistance *= (float)SilverLining.unitScale;
        H *= (float)SilverLining.unitScale;

        ephemeris = new SilverLiningEphemeris ();
        InitTwilightLuminances ();
        sunSpectrum = new SilverLiningSolarSpectrum ();
        lunarSpectrum = new SilverLiningLunarSpectrum ();
        XYZ2RGB = new SilverLiningMatrix3 (3.240479, -0.969256, 0.055648, -1.537150, 1.875992, -0.204043, -0.498535, 0.041556, 1.057311);

        XYZ2RGB4 = new Matrix4x4 ();
        XYZ2RGB4[0, 0] = 3.240479f;
        XYZ2RGB4[0, 1] = -0.969256f;
        XYZ2RGB4[0, 2] = 0.055648f;
        XYZ2RGB4[0, 3] = 0.0f;
        XYZ2RGB4[1, 0] = -1.537150f;
        XYZ2RGB4[1, 1] = 1.875992f;
        XYZ2RGB4[1, 2] = -0.204043f;
        XYZ2RGB4[1, 3] = 0.0f;
        XYZ2RGB4[2, 0] = -0.498535f;
        XYZ2RGB4[2, 1] = 0.041556f;
        XYZ2RGB4[2, 2] = 1.057311f;
        XYZ2RGB4[2, 3] = 0.0f;
        XYZ2RGB4[3, 0] = 0.0f;
        XYZ2RGB4[3, 1] = 0.0f;
        XYZ2RGB4[3, 2] = 0.0f;
        XYZ2RGB4[3, 3] = 1.0f;
    }