package finale;

import javax.media.opengl.GL;

import object.Light;

import world.GameObject;


public class GameLight extends GameObject {
	
	private Light light;
	
	public GameLight(int GLIndex) {
		light = new Light(GLIndex);
	}
	
	public void setPosition(float x, float y, float z) {
		light.setPosition(x, y, z);
	}
	
	public void render(GL gl) {
		
		light.render(gl);
		
		float ambient[]= {0.2f, 0.2f, 0.2f, 1};
		gl.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT , ambient, 0);
		
		gl.glEnable(GL.GL_LIGHT2);
		
		float position[]= {2500, 2500, 2500, 1};
		gl.glLightfv(GL.GL_LIGHT2, GL.GL_POSITION, position, 0);
		
		float intensity[]= {1, 1, 1, 1};
		gl.glLightfv(GL.GL_LIGHT2, GL.GL_DIFFUSE, intensity, 0);
		
		gl.glEnable(GL.GL_LIGHT1);
		
		float position2[]= {2500, 2500, 2500, 1};
		gl.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, position2, 0);
		
		float intensity2[]= {1, 0, 0, 0};
		gl.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, intensity2, 0);
		
		float specIntensity2[]= {1, 1, 1, 1};
		gl.glLightfv(GL.GL_LIGHT1, GL.GL_SPECULAR, specIntensity2, 0);
		
		gl.glEnable(GL.GL_COLOR_MATERIAL);
		gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE);
	}
}