Hi, very new here. Just want to say awesome work to everyone. I hope I can create some more tutorials as it is really lacking though.
I’m looking at ColorRGBA to figure out how it works.
- What does mult do? I’ve read the description, but I don’t see it doing anything. I’ve changed Hello SimpleApplication to:
[java] flyCam.setMoveSpeed(10f);
ColorRGBA blue = ColorRGBA.Blue;
Box b = new Box(Vector3f.ZERO, 1, 1, 1);
Geometry geom = new Geometry(“Box”, b);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);
mat.setColor(“m_Color”, blue);
geom.setMaterial(mat);
rootNode.attachChild(geom);
ColorRGBA random = ColorRGBA.randomColor();
ColorRGBA red = ColorRGBA.Red;
//blue.clone().interpolate(red, 0.5f);
blue.mult(red);
mat.setColor(“m_Color”, blue);[/java]
- The description for multLocal and addLocal are the same? I don’t get it. One adds and the other multiplies. This is very confusing for me, especially since trying to find it out for myself doesn’t work like above 1). Can someone please explain?
[java] /**
- Multiplies each r/g/b/a of this color by the r/g/b/a of the given color and
- returns the result as a new ColorRGBA. Used as a way of combining colors and lights.
-
@param scalar scalar to multiply with
-
@return The new ColorRGBA. this*c
*/
public ColorRGBA multLocal(float scalar) {
this.r *= scalar;
this.g *= scalar;
this.b *= scalar;
this.a *= scalar;
return this;
}
/**
- Multiplies each r/g/b/a of this color by the r/g/b/a of the given color and
- returns the result as a new ColorRGBA. Used as a way of combining colors and lights.
-
@param c The color to multiply.
-
@return The new ColorRGBA. this*c
*/
public ColorRGBA addLocal(ColorRGBA c) {
set(c.r + r, c.g + g, c.b + b, c.a + a);
return this;
}[/java]
Thanks! Sorry for asking stupid questions