public SphereAreaLight(Vector3 pos, Vector3 col, float intens, int uniqSamples = 256) : base(pos, col, intens, uniqSamples)
        {
            int a     = 0;
            int steps = (int)Math.Sqrt(uniqSamples);

            for (int i = 0; i < steps; i++)
            {
                for (int j = 0; j < steps; j++)
                {
                    allPoints[a++] = Position + RRandom.RndUnitStratified(steps, i, j) * Radius;
                }
            }
        }
Beispiel #2
0
        public SpotLightMultiSample(Vector3 position, Vector3 colour, float intensity, int uniqSamples = 256)
            : base(position, colour, intensity, uniqSamples)
        {
            int a     = 0;
            int steps = (int)Math.Sqrt(uniqSamples);

            for (int i = 0; i < steps; i++)
            {
                for (int j = 0; j < steps; j++)
                {
                    allPoints[a++] = Position + RRandom.RndUnitStratified(steps, i, j) * Radius;
                }
            }
        }
        //points on surface of a sphere
        public override Vector3[] TrueStratified(uint max)
        {
            int a     = 0;
            int steps = (int)Math.Sqrt(max);

            Vector3[] arr = new Vector3[steps * steps];
            for (int i = 0; i < steps; i++)
            {
                for (int j = 0; j < steps; j++)
                {
                    arr[a++] = Position + RRandom.RndUnitStratified(steps, i, j) * Radius;
                }
            }
            return(arr);
        }