if (dynamicShadows != null) {
dynamicShadows.setOptions(Arrays.asList(DynamicShadows.values()));
dynamicShadows.bindSelection(new DynamicShadowsBinding(config.getRendering()));
}
final UISlider fovSlider = find("fov", UISlider.class);
if (fovSlider != null) {
fovSlider.setIncrement(5.0f);
fovSlider.setPrecision(0);
fovSlider.setMinimum(70);
fovSlider.setRange(50);
fovSlider.bindValue(BindHelper.bindBeanProperty("fieldOfView", config.getRendering(), Float.TYPE));
}
final UISlider frameLimitSlider = find("frameLimit", UISlider.class);
if (frameLimitSlider != null) {
frameLimitSlider.setIncrement(5.0f);
frameLimitSlider.setPrecision(0);
frameLimitSlider.setMinimum(30);
frameLimitSlider.setRange(175); // Goes up to 205 (which is off)
// Frame limit > 200 is just displayed and treated as "off"
frameLimitSlider.setLabelFunction(new Function<Float, String>() {
@Override
public String apply(Float input) {
if (input > 200) {
return " Off "; // Spaces to get wider than "200" (otherwise the display jumps around)
} else {
return String.valueOf(input.intValue());
}
}
});
frameLimitSlider.bindValue(new Binding<Float>() {
@Override
public Float get() {
if (config.getRendering().getFrameLimit() == -1) {
return 205f;
} else {
return (float) config.getRendering().getFrameLimit();
}
}
@Override
public void set(Float value) {
int frameLimit = value.intValue();
if (frameLimit > 200) {
config.getRendering().setFrameLimit(-1);
} else {
config.getRendering().setFrameLimit(frameLimit);
}
}
});
}
final UISlider fboScaleSlider = find("fboScale", UISlider.class);
if (fboScaleSlider != null) {
fboScaleSlider.setIncrement(5.0f);
fboScaleSlider.setPrecision(0);
fboScaleSlider.setMinimum(25);
fboScaleSlider.setRange(200);
fboScaleSlider.setLabelFunction(new Function<Float, String>() {
@Override
public String apply(Float input) {
return String.valueOf(input.intValue()) + "%";
}
});
fboScaleSlider.bindValue(new Binding<Float>() {
@Override
public Float get() {
return (float) config.getRendering().getFboScale();
}