While I had fun with shaders I stumbled into some minor problems and proceeded to fixing them. Those are, as I said, minor fixes and include things like parameter formatting when an exception is thrown, or in Logger, so it would be easier to find where the problem was coming from.
Anyway, here’s the list of things and their diffs. I can commit them if they’re accepted.
Material.java
[patch]
— Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -374,7 +374,7 @@
if (type != null && paramDef.getVarType() != type) {
logger.log(Level.WARNING, "Material parameter being set: {0} with "
-
+ "type {1} doesn't match definition type {2}", new Object[]{name, type.name(), paramDef.getVarType()} );<br />
-
+ "type {1} doesn''t match definition types {2}", new Object[]{name, type.name(), paramDef.getVarType()} );<br />
}
return newName;
@@ -439,7 +439,7 @@
MatParamTexture val = getTextureParam(name);
if (val == null) {
-
throw new IllegalArgumentException("The given texture parameter is not set.");<br />
-
throw new IllegalArgumentException("The given texture for parameter "" + name + "" is null.");<br />
}
int texUnit = val.getUnit();
[/patch]
LwjglRenderer.java
[patch]
— Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -792,7 +792,7 @@
if (loc < 0) {
uniform.setLocation(-1);
// uniform is not declared in shader
-
logger.log(Level.INFO, "Uniform {0} is not declared in shader.", uniform.getName());<br />
-
logger.log(Level.INFO, "Uniform {0} is not declared in shader {1}.", new Object[]{uniform.getName(), shader.getSources()});<br />
} else {
uniform.setLocation(loc);
}
[/patch]
VarType.java
[patch]
— Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -54,6 +54,7 @@
TextureBuffer(false,true),
Texture2D(false,true),
- Texture2DArray(false,true),
Texture3D(false,true),
TextureArray(false,true),
TextureCubeMap(false,true),
[/patch]
MatParam.java
[patch]
— Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -181,9 +181,60 @@
case Vector2:
Vector2f v2 = (Vector2f) value;
return v2.getX() + " " + v2.getY();
-
case Vector2Array:<br />
-
Vector2f[] v2Arr = (Vector2f[]) value;<br />
-
String v2str = "";<br />
-
for (int i = 0; i < v2Arr.length ; i++) {<br />
-
v2str += v2Arr<i>.getX() + " " + v2Arr<i>.getY() + "n";<br />
-
}<br />
-
return v2str;<br />
case Vector3:
Vector3f v3 = (Vector3f) value;
return v3.getX() + " " + v3.getY() + " " + v3.getZ();
-
case Vector3Array:<br />
-
Vector3f[] v3Arr = (Vector3f[]) value;<br />
-
String v3str = "";<br />
-
for (int i = 0; i < v3Arr.length ; i++) {<br />
-
v3str += v3Arr<i>.getX() + " "<br />
-
+ v3Arr<i>.getY() + " "<br />
-
+ v3Arr<i>.getZ() + "n";<br />
-
}<br />
-
return v3str;<br />
-
case Vector4Array:<br />
-
// can be either ColorRGBA, Vector4f or Quaternion<br />
-
if (value instanceof Vector4f) {<br />
-
Vector4f[] v4arr = (Vector4f[]) value;<br />
-
String v4str = "";<br />
-
for (int i = 0; i < v4arr.length ; i++) {<br />
-
v4str += v4arr<i>.getX() + " "<br />
-
+ v4arr<i>.getY() + " "<br />
-
+ v4arr<i>.getZ() + " "<br />
-
+ v4arr<i>.getW() + "n";<br />
-
}<br />
-
return v4str;<br />
-
} else if (value instanceof ColorRGBA) {<br />
-
ColorRGBA[] colorArr = (ColorRGBA[]) value;<br />
-
String colStr = "";<br />
-
for (int i = 0; i < colorArr.length ; i++) {<br />
-
colStr += colorArr<i>.getRed() + " "<br />
-
+ colorArr<i>.getGreen() + " "<br />
-
+ colorArr<i>.getBlue() + " "<br />
-
+ colorArr<i>.getAlpha() + "n";<br />
-
}<br />
-
return colStr;<br />
-
} else if (value instanceof Quaternion) {<br />
-
Quaternion[] quatArr = (Quaternion[]) value;<br />
-
String quatStr = "";<br />
-
for (int i = 0; i < quatArr.length ; i++) {<br />
-
quatStr += quatArr<i>.getX() + " "<br />
-
+ quatArr<i>.getY() + " "<br />
-
+ quatArr<i>.getZ() + " "<br />
-
+ quatArr<i>.getW() + "n";<br />
-
}<br />
-
return quatStr;<br />
-
} else {<br />
-
throw new UnsupportedOperationException("Unexpected Vector4Array type: " + value);<br />
-
}<br />
case Vector4:
// can be either ColorRGBA, Vector4f or Quaternion
if (value instanceof Vector4f) {
[/patch]
RenderState.java
[patch]
— Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -140,27 +140,27 @@
/**
- Additive blending. For use with glows and particle emitters.
- <p>
-
* Result = Source Color + Destination Color<br />
-
* Result = Source Color + Destination Color -> (GL_ONE, GL_ONE)<br />
*/
Additive,
/**
- Premultiplied alpha blending, for use with premult alpha textures.
- <p>
-
* Result = Source Color + (Dest Color * (1 - Source Alpha) )<br />
-
* Result = Source Color + (Dest Color * (1 - Source Alpha) ) -> (GL_ONE, GL_ONE_MINUS_SRC_ALPHA)<br />
*/
PremultAlpha,
/**
- Additive blending that is multiplied with source alpha.
- For use with glows and particle emitters.
- <p>
-
* Result = (Source Alpha * Source Color) + Dest Color<br />
-
* Result = (Source Alpha * Source Color) + Dest Color -> (GL_SRC_ALPHA, GL_ONE)<br />
*/
AlphaAdditive,
/**
- Color blending, blends in color from dest color
- using source color.
- <p>
-
* Result = Source Color + (1 - Source Color) * Dest Color<br />
-
* Result = Source Color + (1 - Source Color) * Dest Color -> (GL_ONE, GL_ONE_MINUS_SRC_COLOR)<br />
*/
Color,
/**
@@ -168,19 +168,19 @@
- using source alpha.
- <p>
- Result = Source Alpha * Source Color +
-
* (1 - Source Alpha) * Dest Color<br />
-
* (1 - Source Alpha) * Dest Color -> (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)<br />
*/
Alpha,
/**
- Multiplies the source and dest colors.
- <p>
-
* Result = Source Color * Dest Color<br />
-
* Result = Source Color * Dest Color -> (GL_DST_COLOR, GL_ZERO)<br />
*/
Modulate,
/**
- Multiplies the source and dest colors then doubles the result.
- <p>
-
* Result = 2 * Source Color * Dest Color<br />
-
* Result = 2 * Source Color * Dest Color -> (GL_DST_COLOR, GL_SRC_COLOR)<br />
/
ModulateX2
}
[/patch]
ColorRGBA.java (this one is mostly formatting, but at the end there are 2 new methods. A ColorRBGA to Vector3f and to Vector4f. toVector3f simply drops the Alpha value).
[patch]
— Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -1,35 +1,32 @@
/
-
- Copyright © 2009-2010 jMonkeyEngine
- Copyright © 2009-2010 jMonkeyEngine
-
- All rights reserved.
- All rights reserved.
-
- Copyright © 2009-2010 jMonkeyEngine All rights reserved.
*
- Copyright © 2009-2010 jMonkeyEngine All rights reserved.
- Redistribution and use in source and binary forms, with or without
-
- modification, are permitted provided that the following conditions are
- modification, are permitted provided that the following conditions are
-
- met:
- met:
-
- modification, are permitted provided that the following conditions are met:
- modification, are permitted provided that the following conditions are met:
-
- *
- *
-
-
- Redistributions of source code must retain the above copyright notice,
- Redistributions of source code must retain the above copyright notice,
-
-
- this list of conditions and the following disclaimer.
*
- this list of conditions and the following disclaimer.
-
-
- Redistributions of source code must retain the above copyright
- Redistributions of source code must retain the above copyright
-
-
- notice, this list of conditions and the following disclaimer.
- notice, this list of conditions and the following disclaimer.
- *
-
- Redistributions in binary form must reproduce the above copyright
- Redistributions in binary form must reproduce the above copyright
-
- notice, this list of conditions and the following disclaimer in the
- notice, this list of conditions and the following disclaimer in the
-
- documentation and/or other materials provided with the distribution.
- documentation and/or other materials provided with the distribution.
-
- notice, this list of conditions and the following disclaimer in the
- notice, this list of conditions and the following disclaimer in the
-
- documentation and/or other materials provided with the distribution.
*
- documentation and/or other materials provided with the distribution.
-
- Neither the name of ‘jMonkeyEngine’ nor the names of its contributors
- Neither the name of ‘jMonkeyEngine’ nor the names of its contributors
-
- may be used to endorse or promote products derived from this software
- may be used to endorse or promote products derived from this software
-
- without specific prior written permission.
- without specific prior written permission.
-
- may be used to endorse or promote products derived from this software
- may be used to endorse or promote products derived from this software
-
- without specific prior written permission.
*
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-
- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-
- POSSIBILITY OF SUCH DAMAGE.
*/
-
package com.jme3.math;
import com.jme3.export.InputCapsule;
@@ -39,25 +36,24 @@
import com.jme3.export.Savable;
import java.io.IOException;
-
/**
- POSSIBILITY OF SUCH DAMAGE.
-
- <code>ColorRGBA</code> defines a color made from a collection of
- <code>ColorRGBA</code> defines a color made from a collection of
-
- red, green and blue values. An alpha value determines is transparency.
- red, green and blue values. An alpha value determines is transparency.
-
- All values must be between 0 and 1. If any value is set higher or lower
- All values must be between 0 and 1. If any value is set higher or lower
-
- than these constraints they are clamped to the min or max. That is, if
- than these constraints they are clamped to the min or max. That is, if
-
- a value smaller than zero is set the value clamps to zero. If a value
- a value smaller than zero is set the value clamps to zero. If a value
-
- higher than 1 is passed, that value is clamped to 1. However, because the
- higher than 1 is passed, that value is clamped to 1. However, because the
-
- attributes r, g, b, a are public for efficiency reasons, they can be
- attributes r, g, b, a are public for efficiency reasons, they can be
-
- directly modified with invalid values. The client should take care when
- directly modified with invalid values. The client should take care when
-
- directly addressing the values. A call to clamp will assure that the values
- directly addressing the values. A call to clamp will assure that the values
-
- are within the constraints.
- are within the constraints.
-
- <code>ColorRGBA</code> defines a color made from a collection of red, green
- <code>ColorRGBA</code> defines a color made from a collection of red, green
-
- and blue values. An alpha value determines is transparency. All values must
- and blue values. An alpha value determines is transparency. All values must
-
- be between 0 and 1. If any value is set higher or lower than these
- be between 0 and 1. If any value is set higher or lower than these
-
- constraints they are clamped to the min or max. That is, if a value smaller
- constraints they are clamped to the min or max. That is, if a value smaller
-
- than zero is set the value clamps to zero. If a value higher than 1 is
- than zero is set the value clamps to zero. If a value higher than 1 is
-
- passed, that value is clamped to 1. However, because the attributes r, g, b,
- passed, that value is clamped to 1. However, because the attributes r, g, b,
-
- a are public for efficiency reasons, they can be directly modified with
- a are public for efficiency reasons, they can be directly modified with
-
- invalid values. The client should take care when directly addressing the
- invalid values. The client should take care when directly addressing the
-
- values. A call to clamp will assure that the values are within the
- values. A call to clamp will assure that the values are within the
-
- constraints.
- constraints.
- *
-
@author Mark Powell
-
@version $Id: ColorRGBA.java,v 1.29 2007/09/09 18:25:14 irrisor Exp $
*/
public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable {
static final long serialVersionUID = 1;
-
/**
- the color black (0,0,0).
*/
@@ -105,21 +101,19 @@
/**
- the color orange (251/255, 130/255,0).
*/
- public static final ColorRGBA Orange = new ColorRGBA(251f/255f, 130f/255f, 0f, 1f);
- public static final ColorRGBA Orange = new ColorRGBA(251f / 255f, 130f / 255f, 0f, 1f);
/**
- the color brown (65/255, 40/255, 25/255).
*/
- public static final ColorRGBA Brown = new ColorRGBA(65f/255f, 40f/255f, 25f/255f, 1f);
- public static final ColorRGBA Brown = new ColorRGBA(65f / 255f, 40f / 255f, 25f / 255f, 1f);
/**
- the color pink (1, 0.68, 0.68).
*/
public static final ColorRGBA Pink = new ColorRGBA(1f, 0.68f, 0.68f, 1f);
-
/**
- the black color with no alpha (0, 0, 0, 0);
*/
public static final ColorRGBA BlackNoAlpha = new ColorRGBA(0f, 0f, 0f, 0f);
-
/**
- The red component of the color.
*/
@@ -133,7 +127,7 @@
*/
public float b;
/**
-
* the alpha component of the color. 0 is transparent and 1 is opaque<br />
-
* the alpha component of the color. 0 is transparent and 1 is opaque<br />
*/
public float a;
@@ -201,7 +195,7 @@
-
@return this
*/
public ColorRGBA set(ColorRGBA rgba) {
-
if(rgba == null) {<br />
-
if (rgba == null) {<br />
r = 0;
g = 0;
b = 0;
@@ -254,7 +248,7 @@
-
@return the float array that contains the color elements.
*/
public float[] getColorArray() {
-
return new float[] {r,g,b,a};<br />
-
return new float[]{r, g, b, a};<br />
}
/**
@@ -264,26 +258,26 @@
-
@return The float[] after storage.
*/
public float[] getColorArray(float[] store) {
-
store[0]=r;<br />
-
store[1]=g;<br />
-
store[2]=b;<br />
-
store[3]=a;<br />
-
store[0] = r;<br />
-
store[1] = g;<br />
-
store[2] = b;<br />
-
store[3] = a;<br />
return store;
}
- public float getAlpha(){
- public float getAlpha() {
return a;
}
- public float getRed(){
- public float getRed() {
return r;
}
- public float getBlue(){
- public float getBlue() {
return b;
}
- public float getGreen(){
- public float getGreen() {
return g;
}
@@ -294,11 +288,11 @@
-
@param changeAmnt An amount between 0.0 - 1.0 representing a precentage
- change from this towards finalColor
*/
- public void interpolate(ColorRGBA finalColor,float changeAmnt){
-
this.r=(1-changeAmnt)*this.r + changeAmnt*finalColor.r;<br />
-
this.g=(1-changeAmnt)*this.g + changeAmnt*finalColor.g;<br />
-
this.b=(1-changeAmnt)*this.b + changeAmnt*finalColor.b;<br />
-
this.a=(1-changeAmnt)*this.a + changeAmnt*finalColor.a;<br />
- public void interpolate(ColorRGBA finalColor, float changeAmnt) {
-
this.r = (1 - changeAmnt) * this.r + changeAmnt * finalColor.r;<br />
-
this.g = (1 - changeAmnt) * this.g + changeAmnt * finalColor.g;<br />
-
this.b = (1 - changeAmnt) * this.b + changeAmnt * finalColor.b;<br />
-
this.a = (1 - changeAmnt) * this.a + changeAmnt * finalColor.a;<br />
}
/**
@@ -309,11 +303,11 @@
-
@param changeAmnt An amount between 0.0 - 1.0 representing a precentage
- change from beginColor towards finalColor
*/
- public void interpolate(ColorRGBA beginColor,ColorRGBA finalColor,float changeAmnt){
-
this.r=(1-changeAmnt)*beginColor.r + changeAmnt*finalColor.r;<br />
-
this.g=(1-changeAmnt)*beginColor.g + changeAmnt*finalColor.g;<br />
-
this.b=(1-changeAmnt)*beginColor.b + changeAmnt*finalColor.b;<br />
-
this.a=(1-changeAmnt)*beginColor.a + changeAmnt*finalColor.a;<br />
- public void interpolate(ColorRGBA beginColor, ColorRGBA finalColor, float changeAmnt) {
-
this.r = (1 - changeAmnt) * beginColor.r + changeAmnt * finalColor.r;<br />
-
this.g = (1 - changeAmnt) * beginColor.g + changeAmnt * finalColor.g;<br />
-
this.b = (1 - changeAmnt) * beginColor.b + changeAmnt * finalColor.b;<br />
-
this.a = (1 - changeAmnt) * beginColor.a + changeAmnt * finalColor.a;<br />
}
/**
@@ -394,7 +388,7 @@
-
@return the string representation of this color.
*/
public String toString() {
-
return "Color["+r+", "+g+", "+b+", "+a+"]";<br />
-
return "Color[" + r + ", " + g + ", " + b + ", " + a + "]";<br />
}
@Override
@@ -433,19 +427,27 @@
-
@return true if the colors are equal, false otherwise.
*/
public boolean equals(Object o) {
-
if( !(o instanceof ColorRGBA) ) {<br />
-
if (!(o instanceof ColorRGBA)) {<br />
return false;
}
-
if(this == o) {<br />
-
if (this == o) {<br />
return true;
}
-
ColorRGBA comp = (ColorRGBA)o;<br />
-
if (Float.compare(r, comp.r) != 0) return false;<br />
-
if (Float.compare(g, comp.g) != 0) return false;<br />
-
if (Float.compare(b, comp.b) != 0) return false;<br />
-
if (Float.compare(a, comp.a) != 0) return false;<br />
-
ColorRGBA comp = (ColorRGBA) o;<br />
-
if (Float.compare(r, comp.r) != 0) {<br />
-
return false;<br />
-
}<br />
-
if (Float.compare(g, comp.g) != 0) {<br />
-
return false;<br />
-
}<br />
-
if (Float.compare(b, comp.b) != 0) {<br />
-
return false;<br />
-
}<br />
-
if (Float.compare(a, comp.a) != 0) {<br />
-
return false;<br />
-
}<br />
return true;
}
@@ -464,7 +466,6 @@
return hash;
}
-
public void write(JmeExporter e) throws IOException {
OutputCapsule capsule = e.getCapsule(this);
capsule.write(r, "r", 0);
@@ -481,12 +482,12 @@
a = capsule.readFloat("a", 0);
}
- public byte[] asBytesRGBA(){
- public byte[] asBytesRGBA() {
byte[] store = new byte[4];
-
store[0] = (byte)((int)(r * 255) & 0xFF);<br />
-
store[1] = (byte)((int)(g * 255) & 0xFF);<br />
-
store[2] = (byte)((int)(b * 255) & 0xFF);<br />
-
store[3] = (byte)((int)(a * 255) & 0xFF);<br />
-
store[0] = (byte) ((int) (r * 255) & 0xFF);<br />
-
store[1] = (byte) ((int) (g * 255) & 0xFF);<br />
-
store[2] = (byte) ((int) (b * 255) & 0xFF);<br />
-
store[3] = (byte) ((int) (a * 255) & 0xFF);<br />
return store;
}
@@ -517,14 +518,36 @@
public void fromIntARGB(int color) {
a = ((byte) (color >> 24) & 0xFF) / 255f;
r = ((byte) (color >> 16) & 0xFF) / 255f;
-
g = ((byte) (color >> 8) & 0xFF) / 255f;<br />
-
b = ((byte) (color) & 0xFF) / 255f;<br />
-
g = ((byte) (color >> 8) & 0xFF) / 255f;<br />
-
b = ((byte) (color) & 0xFF) / 255f;<br />
}
public void fromIntRGBA(int color) {
r = ((byte) (color >> 24) & 0xFF) / 255f;
g = ((byte) (color >> 16) & 0xFF) / 255f;
-
b = ((byte) (color >> 8) & 0xFF) / 255f;<br />
-
a = ((byte) (color) & 0xFF) / 255f;<br />
-
b = ((byte) (color >> 8) & 0xFF) / 255f;<br />
-
a = ((byte) (color) & 0xFF) / 255f;<br />
}
+
- /**
-
* Transform the current ColorRGBA to a Vector3f using<br />
-
* x = r, y = g, z = b. The Alpha value is not used.<br />
-
*<br />
-
* This method is useful to use for shaders assignment.<br />
-
* @return A Vector3f containing the RGB value of current color definition.<br />
-
*/<br />
- public Vector3f toVector3f() {
-
return new Vector3f(r, g, b);<br />
}
+
- /**
-
* Transform the current ColorRGBA to a Vector4f using<br />
-
* x = r, y = g, z = b, w = a.<br />
-
*<br />
-
* This method is useful to use for shaders assignment.<br />
-
* @return A Vector4f containing the RGBA value of current color definition.<br />
-
*/<br />
- public Vector4f toVector4f() {
-
return new Vector4f(r, g, b, a);<br />
- }
+}
[/patch]
There are a couple of other files, but they only contain formatting fixes (or missing parameters in Javadoc).
Anyway. Let me know if you want me to commit those or if I should modify/change or forget those additions/mods.