package com.badlogic.gdx.graphics.g3d;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Vector3;

public class Light {
	public final Color color = new Color();
	public Vector3 position;
	public Vector3 direction;
	public float angle = 0f;
	public float power = 1f;
	
	/** Create a new directional light */
	public Light(final Color color, final Vector3 direction) {
		this.color.set(color);
		this.direction = new Vector3(direction);
	}
	
	/** Create a new directional light */
	public Light(float r, float g, float b, float a, float x, float y, float z) {
		this.color.set(r, g, b, a);
		this.direction = new Vector3(x, y, z);
	}
	
	/** Create a new point light */
	public Light(final Color color, final Vector3 position, final float power) {
		this(color.r, color.g, color.b, color.a, position.x, position.y, position.z, power);
	}
	
	/** Create a new point light */
	public Light(final float red, final float green, final float blue, final float alpha, 
					final float x, final float y, final float z, final float power) {
		color.set(red, green, blue, alpha);
		this.position = new Vector3(x, y, z);
		this.power = power;
	}
	
	/** Create a new spot light */
	public Light(final Color color, final Vector3 position, final Vector3 direction, final float angle, final float power) {
		this.color.set(color);
		this.position = new Vector3(position);
		this.direction = new Vector3(direction);
		this.angle = angle;
		this.power = power;
	}
	
	public boolean equals(Light other) {
		if (other == null) return false;
		if (other == this) return true;
		return color.equals(other.color) && position.equals(other.position) && power == other.power;
	}
	
	@Override
	public boolean equals (Object arg0) {
		if (arg0 == null) return false;
		if (arg0 == this) return true;
		if (!(arg0 instanceof Light)) return false;
		return equals((Light)arg0);
	}
	
	public boolean isPointLight() {
		return position != null && direction == null;
	}
	
	public boolean isDirectionalLight() {
		return position == null && direction != null;
	}
	
	public boolean isSpotLight() {
		return position != null && direction != null;
	}
}

@@ -116,174 +116,855 @@
 3;%0A%0A
-public class Light %7B%0A%09public final Color color = new Color();%0A%09public Vector3 position;%0A%09public Vector3 direction;%0A%09public float angle = 0f;%0A%09public float power = 1f;
+/** Basic general light class which can represent an ambient, directional, point and spot light.%0A * Extend this class to add additional data.%0A * @author Xoppa */%0Apublic class Light %7B%0A%09/** The (diffuse) color of the light */%0A%09public final Color color = new Color();%0A%09/** The position of the light or null of not applicable. */ %0A%09public Vector3 position;%0A%09/** The direction of the light or null of not applicable. */%0A%09public Vector3 direction;%0A%09/** The cut off angle of the light, only applicable if both direction and position aren't null. */ %0A%09public float angle = 0f;%0A%09/** The power of the light */%0A%09public float power = 1f;%0A%09%0A%09/** Create a new ambient light */%0A%09public Light(final Color color) %7B%0A%09%09this.color.set(color);%0A%09%7D%0A%09%0A%09/** Create a new ambient light */%0A%09public Light(float r, float g, float b, float a) %7B%0A%09%09this.color.set(r, g, b, a);%0A%09%7D
 %0A%09%0A%09
@@ -2541,24 +2541,112 @@
 arg0);%0A%09%7D%0A%09%0A
+%09public boolean isAmbientLight() %7B%0A%09%09return position == null && direction == null;%0A%09%7D%0A%09%0A
 %09public bool

Add ambient light