Ejemplo n.º 1
0
        private void CreateRandomLight(int id, Node parent)
        {
            Color diffuse = new Color((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());

            Sphere lightSphere = new Sphere("LightSphere " + id.ToString(), 5, 5, .5f);

            lightSphere.SceneHints.LightCombineHint = LightCombineHint.Off;
            lightSphere.SetSolidColor(diffuse);
            lightSphere.Material = ContentManager.Load <Material>("BasicVertColor.tem");


            PointLight pl = new PointLight();

            pl.Attenuate = true;
            pl.Constant  = .1f;
            pl.Linear    = .001f;
            pl.Quadratic = 0.001f;
            pl.IsEnabled = true;
            pl.Diffuse   = diffuse;
            pl.Ambient   = Color.Black;// new Color(.1f, .1f, .1f);

            RootNode.AddLight(pl);

            lightSphere.AddController(new LightSpatialController(pl, random));
            parent.AddChild(lightSphere);
        }