From 37f1e7fabeae39d94acb1448d017c4e4ddda4edf Mon Sep 17 00:00:00 2001 From: jayfella Date: Wed, 22 Apr 2020 09:38:58 +0100 Subject: [PATCH] Add methods to modify each channel (RGBA) that return 'this'. --- .../main/java/com/jme3/math/ColorRGBA.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/jme3-core/src/main/java/com/jme3/math/ColorRGBA.java b/jme3-core/src/main/java/com/jme3/math/ColorRGBA.java index f3b1f5350..1d0411c9a 100644 --- a/jme3-core/src/main/java/com/jme3/math/ColorRGBA.java +++ b/jme3-core/src/main/java/com/jme3/math/ColorRGBA.java @@ -204,6 +204,46 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable return this; } + /** + * Sets the red color to the specified value. + * @param value the value to set the red channel. + * @return the ColorRGBA object with the modified value. + */ + public ColorRGBA setRed(float value) { + r = value; + return this; + } + + /** + * Sets the green color to the specified value. + * @param value the value to set the green channel. + * @return the ColorRGBA object with the modified value. + */ + public ColorRGBA setGreen(float value) { + g = value; + return this; + } + + /** + * Sets the blue color to the specified value. + * @param value the value to set the blue channel. + * @return the ColorRGBA object with the modified value. + */ + public ColorRGBA setBlue(float value) { + b = value; + return this; + } + + /** + * Sets the alpha color to the specified value. + * @param value the value to set the alpha channel. + * @return the ColorRGBA object with the modified value. + */ + public ColorRGBA setAlpha(float value) { + a = value; + return this; + } + /** * Saturate that color ensuring all channels have a value between 0 and 1 */