Esempio n. 1
0
        public void AddHitPoint(PPMHitPoint hp)
        {
            if (this.hitPoints.Count <= MaxHitPoints)
            {
                this.hitPoints.Add(hp);
#if VERBOSE
                if (hitPoints.Count % 1000 == 0)
                    Tracer.TraceLine("HitPoints -Collected {0} / Needed {1}", hitPoints.Count, MaxHitPoints);
#endif
            }
            else
            {
                if (Grid == null)
                {
                    lock (build_lock)
                    {
                        Tracer.TraceLine("Start building photons hashgrid");
                        Grid = new HashGrid(hitPoints, Width, Height);
                        Grid.ReHash();
                        Tracer.TraceLine("Complete!");
                    }
                }
            }

        }
Esempio n. 2
0
 public static void SampleHitPoint(this SampleBuffer sampleBuffer, PPMHitPoint hp, int photonTraced)
 {
     switch (hp.type)
     {
         case HitPointType.Constant:
             {
                 sampleBuffer.SplatSample(hp.scrX, hp.scrY,ref hp.throughput);
                 break;
             }
         case HitPointType.Surface:
             {
                 var rad = RgbSpectrum.ZeroSpectrum();
                 if (hp.accumPhotonCount == 0)
                 {                            
                     sampleBuffer.SplatSample(hp.scrX, hp.scrY,ref rad);
                 }
                 else
                 {
                     float k = 1.0f / (MathLab.M_PI * hp.photonRadius2 * photonTraced);
                     rad = hp.accumReflectedFlux * k;
                     sampleBuffer.SplatSample(hp.scrX, hp.scrY, ref rad);
                 }
                 break;
             }
     }
 }