Beispiel #1
0
 public void UnRegPointLight(GamePlay.Component.GPointLightComponent light)
 {
     if (light.IndexInScene == -1)
     {
         return;
     }
     lock (PointLights)
     {
         PointLights[light.IndexInScene] = null;
         light.IndexInScene = -1;
     }
     PointLightsSerialId++;
     BuildDynPointLights();
 }
Beispiel #2
0
        private void TryAddLight(List <AffectLight> outLights, GamePlay.Component.GPointLightComponent light, float factor)
        {
            if (outLights.Count < 4)
            {
                var al = new AffectLight();
                al.Light  = light;
                al.Factor = factor;
                outLights.Add(al);
                return;
            }
            for (int i = 0; i < outLights.Count; i++)
            {
                if (outLights[i].Factor > factor)
                {
                    var al = new AffectLight();
                    al.Light  = light;
                    al.Factor = factor;

                    outLights[i] = al;
                    return;
                }
            }
        }
Beispiel #3
0
 public int RegPointLight(GamePlay.Component.GPointLightComponent light)
 {
     if (light.IndexInScene != -1)
     {
         return(light.IndexInScene);
     }
     lock (PointLights)
     {
         PointLightsSerialId++;
         for (int i = 0; i < PointLights.Count; i++)
         {
             if (PointLights[i] == null)
             {
                 light.IndexInScene = i;
                 PointLights[i]     = light;
                 return(i);
             }
         }
         light.IndexInScene = PointLights.Count;
         PointLights.Add(light);
         BuildDynPointLights();
         return(light.IndexInScene);
     }
 }