Skip to content

Commit

Permalink
Merge #1221 from @shartte - resolution scaling, fixes #1172
Browse files Browse the repository at this point in the history
  • Loading branch information
Cervator committed Sep 27, 2014
2 parents 22cbebc + eace9c3 commit a4544d1
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class RenderingConfig {
private boolean inscattering = true;
private boolean localReflections;
private boolean vSync;
private int fboScale = 100;
private PerspectiveCameraSettings cameraSettings = new PerspectiveCameraSettings(CameraSetting.NORMAL);

private RenderingDebugConfig debug = new RenderingDebugConfig();
Expand Down Expand Up @@ -411,6 +412,14 @@ public void setFrameLimit(int frameLimit) {
this.frameLimit = frameLimit;
}

public int getFboScale() {
return fboScale;
}

public void setFboScale(int fboScale) {
this.fboScale = fboScale;
}

@Override
public String toString() {
return Config.createGson().toJsonTree(this).toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,31 @@ public void set(Float value) {
});
}

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();
}

@Override
public void set(Float value) {
config.getRendering().setFboScale(value.intValue());
}
});
}

UIDropdown<CameraSetting> cameraSetting = find("camera", UIDropdown.class);
if (cameraSetting != null) {
cameraSetting.setOptions(Arrays.asList(CameraSetting.values()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.slf4j.LoggerFactory;
import org.terasology.asset.Assets;
import org.terasology.config.Config;
import org.terasology.config.RenderingConfig;
import org.terasology.editor.EditorRange;
import org.terasology.monitoring.PerformanceMonitor;
import org.terasology.registry.CoreRegistry;
Expand Down Expand Up @@ -263,7 +264,12 @@ private void createOrUpdateFullscreenFbos() {
rtFullHeight = org.lwjgl.opengl.Display.getHeight();
}

if (CoreRegistry.get(Config.class).getRendering().isOculusVrSupport()) {
RenderingConfig renderingConfig = CoreRegistry.get(Config.class).getRendering();

rtFullWidth *= renderingConfig.getFboScale() / 100f;
rtFullHeight *= renderingConfig.getFboScale() / 100f;

if (renderingConfig.isOculusVrSupport()) {
if (overwriteRtWidth == 0) {
rtFullWidth *= OculusVrHelper.getScaleFactor();
}
Expand Down
8 changes: 4 additions & 4 deletions engine/src/main/resources/assets/ui/menu/videoMenuScreen.ui
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,12 @@
"id": "frameLimit"
},
{
"type": "UISpace",
"size": [1, 13]
"type": "UILabel",
"text": "Render Quality: "
},
{
"type": "UISpace",
"size": [1, 13]
"type": "UISlider",
"id": "fboScale"
},
{
"type": "UISpace",
Expand Down

0 comments on commit a4544d1

Please sign in to comment.