//#region Set scene
 public void SetScene(Scene scene)
 {
     lightMaps = new TextureMap[scene.GetBSP.GetLightMapCount];
     for (int i = 0; i < lightMaps.Length; i++)
     {
         lightMaps[i] = new TextureMap(256, 256);
     }
     this.bsp    = scene.GetBSP;
     this.meshes = scene.GetModels;
     this.lights = scene.GetLights;
     this.maxl   = this.lights.Length;
 }
 public static void QuickSetTexel(short IX, float[] UV, Color colour)
 {
     TextureMap.QuickSetPixel(IX, UV, colour);
 }
 public static void QuickSave()
 {
     TextureMap.QuickSave();
 }
        //#region Photon Collisions
        private void Photon_Collision()
        {
            if (maxl == 0)
            {
                this.Default();
            }

            TimeSpan procT = new TimeSpan(100);

            for (int g = 0; g < maxl; g++)
            {
                if (this.stop)
                {
                    break;
                }

                for (int h = 0; h < maxp; h++)
                {
                    if (this.saveProg)
                    {
                        this.SaveProgress(g);
                        this.stop = true;
                        break;
                    }

                    int    nHits  = 0;
                    Photon photon = this.lights[g].Uniform_Scatter();

                    //Render.Addline(photon.Position, photon.Direction);

                    //if(this.lights[g].LType == LightSource.Type.Directional)
                    //photon = this.lights[g].Spot_Light();

                    DateTime store = DateTime.Now;

                    while (nHits < maxb)
                    {
                        if (this.stop)
                        {
                            break;
                        }

                        for (int l = 0; l < this.meshes.Length; l++)
                        {
                            photon.ProcessCollision(meshes[l]);
                        }
                        photon.ProcessCollision(this.bsp);
                        nHits++;
                    }

                    Thread.Sleep(0);

                    procT = (DateTime.Now - store);
                    this.Progress(procT, g, h);
                }
            }
            this.Progress(procT, maxl, maxp);
            TextureMap.Save();

            MdxRender.GetCurrentBsp.UpdateRadiosityPreview();
        }