Home | History | Annotate | Download | only in environment
      1 /*******************************************************************************
      2  * Copyright 2011 See AUTHORS file.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *   http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  ******************************************************************************/
     16 
     17 package com.badlogic.gdx.graphics.g3d.environment;
     18 
     19 import com.badlogic.gdx.graphics.Color;
     20 import com.badlogic.gdx.math.Vector3;
     21 
     22 public class PointLight extends BaseLight<PointLight> {
     23 	public final Vector3 position = new Vector3();
     24 	public float intensity;
     25 
     26 	public PointLight setPosition(float positionX, float positionY, float positionZ) {
     27 		this.position.set(positionX, positionY, positionZ);
     28 		return this;
     29 	}
     30 
     31 	public PointLight setPosition(Vector3 position) {
     32 		this.position.set(position);
     33 		return this;
     34 	}
     35 
     36 	public PointLight setIntensity(float intensity) {
     37 		this.intensity = intensity;
     38 		return this;
     39 	}
     40 
     41 	public PointLight set (final PointLight copyFrom) {
     42 		return set(copyFrom.color, copyFrom.position, copyFrom.intensity);
     43 	}
     44 
     45 	public PointLight set (final Color color, final Vector3 position, final float intensity) {
     46 		if (color != null) this.color.set(color);
     47 		if (position != null) this.position.set(position);
     48 		this.intensity = intensity;
     49 		return this;
     50 	}
     51 
     52 	public PointLight set (final float r, final float g, final float b, final Vector3 position, final float intensity) {
     53 		this.color.set(r, g, b, 1f);
     54 		if (position != null) this.position.set(position);
     55 		this.intensity = intensity;
     56 		return this;
     57 	}
     58 
     59 	public PointLight set (final Color color, final float x, final float y, final float z, final float intensity) {
     60 		if (color != null) this.color.set(color);
     61 		this.position.set(x, y, z);
     62 		this.intensity = intensity;
     63 		return this;
     64 	}
     65 
     66 	public PointLight set (final float r, final float g, final float b, final float x, final float y, final float z,
     67 		final float intensity) {
     68 		this.color.set(r, g, b, 1f);
     69 		this.position.set(x, y, z);
     70 		this.intensity = intensity;
     71 		return this;
     72 	}
     73 
     74 	@Override
     75 	public boolean equals (Object obj) {
     76 		return (obj instanceof PointLight) ? equals((PointLight)obj) : false;
     77 	}
     78 
     79 	public boolean equals (PointLight other) {
     80 		return (other != null && (other == this || (color.equals(other.color) && position.equals(other.position) && intensity == other.intensity)));
     81 	}
     82 }
     83