Added fade effect
This commit is contained in:
parent
793b3a99da
commit
e3b9e3165a
16 changed files with 345 additions and 3 deletions
132
src/ei/engine/math/Vector4f.java
Normal file
132
src/ei/engine/math/Vector4f.java
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
package ei.engine.math;
|
||||
|
||||
/**
|
||||
* This class holds 3 float values
|
||||
*
|
||||
* @author Ziver
|
||||
*/
|
||||
|
||||
public class Vector4f {
|
||||
private float r;
|
||||
private float g;
|
||||
private float b;
|
||||
private float a;
|
||||
|
||||
/**
|
||||
* Creates a vector whit the value zero
|
||||
*/
|
||||
public Vector4f(){
|
||||
this(0,0,0,0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Vector by the given values
|
||||
*
|
||||
* @param r The r value
|
||||
* @param g The g value
|
||||
* @param b The b value
|
||||
* @param a The a value
|
||||
*/
|
||||
public Vector4f(float r, float g, float b, float a){
|
||||
this.r = r;
|
||||
this.g = g;
|
||||
this.b = b;
|
||||
this.a = a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the R value
|
||||
*
|
||||
* @return the r value in the vector
|
||||
*/
|
||||
public float getR(){
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the G value
|
||||
*
|
||||
* @return the g value in the vector
|
||||
*/
|
||||
public float getG(){
|
||||
return g;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the B value
|
||||
*
|
||||
* @return the b value in the vector
|
||||
*/
|
||||
public float getB(){
|
||||
return b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the A value
|
||||
*
|
||||
* @return the a value in the vector
|
||||
*/
|
||||
public float getA(){
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the A value
|
||||
*
|
||||
* param the a value in the vector
|
||||
*/
|
||||
public void setA(float a){
|
||||
this.a = a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to the vector
|
||||
*
|
||||
* @param i The amount to add
|
||||
*/
|
||||
public void add(float i){
|
||||
r += i;
|
||||
g += i;
|
||||
b += i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to the vector
|
||||
*
|
||||
* @param i The amount to add
|
||||
*/
|
||||
public void add(Vector4f i){
|
||||
r += i.getR();
|
||||
g += i.getG();
|
||||
b += i.getB();
|
||||
a += i.getA();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to the vector
|
||||
*
|
||||
* @param r The value to add to the r value
|
||||
* @param g The value to add to the g value
|
||||
* @param b The value to add to the b value
|
||||
* @param a The value to add to the a value
|
||||
*/
|
||||
public void add(float r, float g, float b, float a){
|
||||
this.r += r;
|
||||
this.g += g;
|
||||
this.b += b;
|
||||
this.a += a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this vector
|
||||
*
|
||||
* @return A copy of this vector
|
||||
*/
|
||||
public Vector4f getCopy(){
|
||||
return new Vector4f(r,g,b,a);
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "Vector4f["+r+","+g+","+b+","+a+"]";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue