-
Bug
-
Resolution: Not an Issue
-
P3
-
8
Shape3D.setMaterial(material) seems to be required to get the color to update
If this line isn't called inside the handle method:
pointLight2Geo.setMaterial(pointLight2Material); // <-- this is required for color to update
then the color doesn't update.
final private Sphere pointLight2Geo = new Sphere(0.1);
...
final PhongMaterial pointLight2Material = new PhongMaterial();
pointLight2Material.setDiffuseColor(Color.LIGHTGREY);
pointLight2Geo.setMaterial(pointLight2Material);
...
final ColorPicker light2ColorPicker = new ColorPicker(pointLight2.getColor());
light2ColorPicker.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
Color c = light2ColorPicker.getValue();
pointLight2.setColor(c);
pointLight2Material.setDiffuseColor(c);
pointLight2Geo.setMaterial(pointLight2Material); // <-- this is required for color to update
}
});
If this line isn't called inside the handle method:
pointLight2Geo.setMaterial(pointLight2Material); // <-- this is required for color to update
then the color doesn't update.
final private Sphere pointLight2Geo = new Sphere(0.1);
...
final PhongMaterial pointLight2Material = new PhongMaterial();
pointLight2Material.setDiffuseColor(Color.LIGHTGREY);
pointLight2Geo.setMaterial(pointLight2Material);
...
final ColorPicker light2ColorPicker = new ColorPicker(pointLight2.getColor());
light2ColorPicker.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
Color c = light2ColorPicker.getValue();
pointLight2.setColor(c);
pointLight2Material.setDiffuseColor(c);
pointLight2Geo.setMaterial(pointLight2Material); // <-- this is required for color to update
}
});