Exemplo n.º 1
0
        public Lights(Texture2D back, Texture2D textureNormal, Effect def)
        {
            this.back = back;
            normal    = textureNormal;
            deferred  = def;

            lightRadius = 320f;
            lightZ      = 50f;
            lightC      = 1f;

            lights[0]           = new LightEmmiter();
            lights[0].color     = new Vector3(0f, 1f, 0f);
            lights[0].position  = new Vector3(100, 400, lightZ);
            lights[0].radius    = lightRadius;
            lights[0].corrector = lightC;

            lights[1]           = new LightEmmiter();
            lights[1].color     = new Vector3(1f, 0f, 0f);
            lights[1].position  = new Vector3(500, 400, lightZ);
            lights[1].radius    = lightRadius;
            lights[1].corrector = lightC;

            deferred.CurrentTechnique = deferred.Techniques["Deferred"];

            deferred.Parameters["screenWidth"].SetValue(800);
            deferred.Parameters["screenHeight"].SetValue(600);
            deferred.Parameters["ambientColor"].SetValue(new Vector3(1, 1, 1) * 0.1f);
            deferred.Parameters["numberOfLights"].SetValue(2);

            deferred.Parameters["normaltexture"].SetValue(textureNormal);

            lightParameter = deferred.Parameters["lights"];
        }
Exemplo n.º 2
0
 public void Update(Vector2 pos1, Vector2 pos2)
 {
     for (int i = 0; i < lights.Length; i++)
     {
         LightEmmiter l = lights[i];
         l.UpdateEffect(lightParameter.Elements[i]);
     }
     lights[0].position = new Vector3(pos1.X, pos1.Y, lightZ);
     lights[1].position = new Vector3(pos2.X, pos2.Y, lightZ);
 }