Allow all camera rotation axis to be ignored separately during rendering

This commit is contained in:
johni0702
2015-07-17 12:43:02 +02:00
parent d360ee5e2e
commit fdd2c7ecf7
3 changed files with 18 additions and 7 deletions

View File

@@ -523,7 +523,7 @@ public class GuiRenderSettings extends GuiScreen {
} }
options.setMode(pipePreset); options.setMode(pipePreset);
options.setIgnoreCameraRotation(ignoreCamDir.isChecked()); options.setIgnoreCameraRotation(ignoreCamDir.isChecked(), ignoreCamDir.isChecked(), ignoreCamDir.isChecked());
if (isCtrlKeyDown()) { if (isCtrlKeyDown()) {
options.setHighPerformance(true); options.setHighPerformance(true);

View File

@@ -5,6 +5,7 @@ import lombok.Data;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import java.io.File; import java.io.File;
import java.util.Arrays;
import static org.apache.commons.lang3.Validate.isTrue; import static org.apache.commons.lang3.Validate.isTrue;
@@ -16,7 +17,10 @@ public final class RenderOptions {
private File outputFile; private File outputFile;
private boolean ignoreCameraRotation; /**
* Whether to ignore camera rotation. On yaw, pitch, roll axis.
*/
private boolean[] ignoreCameraRotation = new boolean[3];
// Advanced // Advanced
private boolean waitForChunks = true; private boolean waitForChunks = true;
@@ -44,12 +48,16 @@ public final class RenderOptions {
return skyColor == -1; return skyColor == -1;
} }
public void setIgnoreCameraRotation(boolean yaw, boolean pitch, boolean roll) {
ignoreCameraRotation = new boolean[]{yaw, pitch, roll};
}
public RenderOptions copy() { public RenderOptions copy() {
RenderOptions copy = new RenderOptions(); RenderOptions copy = new RenderOptions();
copy.mode = this.mode; copy.mode = this.mode;
copy.bitrate = this.bitrate; copy.bitrate = this.bitrate;
copy.fps = this.fps; copy.fps = this.fps;
copy.ignoreCameraRotation = this.ignoreCameraRotation; copy.ignoreCameraRotation = Arrays.copyOf(this.ignoreCameraRotation, 3);
copy.waitForChunks = this.waitForChunks; copy.waitForChunks = this.waitForChunks;
copy.isLinearMovement = this.isLinearMovement; copy.isLinearMovement = this.isLinearMovement;
copy.hideNameTags = this.hideNameTags; copy.hideNameTags = this.hideNameTags;

View File

@@ -373,11 +373,14 @@ public class CustomEntityRenderer<D extends CaptureData> implements eu.crushedpi
} }
protected void orientCamera(float partialTicks) { protected void orientCamera(float partialTicks) {
if (options.isIgnoreCameraRotation()) { Entity entity = mc.getRenderViewEntity();
Entity entity = mc.getRenderViewEntity(); if (options.getIgnoreCameraRotation()[0]) {
// Stop the minecraft code from doing any rotation
entity.prevRotationPitch = entity.rotationPitch = 0;
entity.prevRotationYaw = entity.rotationYaw = 0; entity.prevRotationYaw = entity.rotationYaw = 0;
}
if (options.getIgnoreCameraRotation()[1]) {
entity.prevRotationPitch = entity.rotationPitch = 0;
}
if (options.getIgnoreCameraRotation()[2]) {
ReplayHandler.setCameraTilt(0); ReplayHandler.setCameraTilt(0);
} }