From 218eb3c3cc953b6f8bb4fd93600bcfc6f22c8f79 Mon Sep 17 00:00:00 2001 From: jrbudda Date: Tue, 29 Nov 2016 13:08:31 -0500 Subject: [PATCH] 32pre Roomscale and seated changes --- .../vivecraft-1.7.10-forge-shadersmod.json | 2 +- installer/vivecraft-1.7.10-forge.json | 2 +- installer/vivecraft-1.7.10-shadersmod.json | 2 +- installer/vivecraft-1.7.10.json | 2 +- minecriftversion.py | 2 +- .../net/minecraft/client/Minecraft.java.patch | 48 +- .../client/entity/EntityPlayerSP.java.patch | 47 +- .../minecraft/client/gui/GuiIngame.java.patch | 45 +- .../client/gui/GuiNewChat.java.patch | 48 - .../client/renderer/EntityRenderer.java.patch | 73 +- .../client/renderer/RenderGlobal.java.patch | 81 +- patches/net/minecraft/util/Vec3.java.patch | 40 + .../minecrift/api/IRoomscaleAdapter.java | 2 + .../mtbs3d/minecrift/api/NetworkHelper.java | 6 +- src/com/mtbs3d/minecrift/api/Vec3History.java | 134 ++ .../mtbs3d/minecrift/gameplay/BowTracker.java | 2 +- .../minecrift/gameplay/ClimbTracker.java | 150 +++ .../minecrift/gameplay/EatingTracker.java | 94 ++ .../minecrift/gameplay/JumpTracker.java | 42 + .../mtbs3d/minecrift/gameplay/RunTracker.java | 124 ++ .../minecrift/gameplay/SneakTracker.java | 43 + .../minecrift/gameplay/SwimTracker.java | 156 +++ .../mtbs3d/minecrift/gui/GuiHUDSettings.java | 8 +- .../minecrift/gui/GuiLocomotionSettings.java | 239 ++-- .../minecrift/gui/GuiMinecriftSettings.java | 158 ++- .../minecrift/gui/GuiOtherHUDSettings.java | 20 +- .../gui/GuiOtherRenderOpticsSettings.java | 307 ++--- .../gui/GuiRenderOpticsSettings.java | 117 +- .../minecrift/gui/GuiSeatedOptions.java | 201 +++ .../mtbs3d/minecrift/main/VivecraftMain.java | 10 + .../mtbs3d/minecrift/provider/MCOpenVR.java | 360 +++--- .../minecrift/provider/OpenVRPlayer.java | 168 ++- .../minecrift/render/RenderVRPlayer.java | 2 +- .../minecrift/settings/AutoCalibration.java | 125 ++ .../mtbs3d/minecrift/settings/VRHotkeys.java | 22 +- .../mtbs3d/minecrift/settings/VRSettings.java | 1096 ++++------------- 36 files changed, 2264 insertions(+), 1714 deletions(-) delete mode 100644 patches/net/minecraft/client/gui/GuiNewChat.java.patch create mode 100644 patches/net/minecraft/util/Vec3.java.patch create mode 100644 src/com/mtbs3d/minecrift/api/Vec3History.java create mode 100644 src/com/mtbs3d/minecrift/gameplay/ClimbTracker.java create mode 100644 src/com/mtbs3d/minecrift/gameplay/EatingTracker.java create mode 100644 src/com/mtbs3d/minecrift/gameplay/JumpTracker.java create mode 100644 src/com/mtbs3d/minecrift/gameplay/RunTracker.java create mode 100644 src/com/mtbs3d/minecrift/gameplay/SneakTracker.java create mode 100644 src/com/mtbs3d/minecrift/gameplay/SwimTracker.java create mode 100644 src/com/mtbs3d/minecrift/gui/GuiSeatedOptions.java create mode 100644 src/com/mtbs3d/minecrift/settings/AutoCalibration.java diff --git a/installer/vivecraft-1.7.10-forge-shadersmod.json b/installer/vivecraft-1.7.10-forge-shadersmod.json index e2559e1a..13cdfe7f 100644 --- a/installer/vivecraft-1.7.10-forge-shadersmod.json +++ b/installer/vivecraft-1.7.10-forge-shadersmod.json @@ -153,7 +153,7 @@ }, { "name": "com.sun:jna:4.2.1", - "url": "http://automat-gh.github.io/minecrift/" + "url": "http://vivecraft.org/jar/" }, { "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1", diff --git a/installer/vivecraft-1.7.10-forge.json b/installer/vivecraft-1.7.10-forge.json index 23bc8452..5740472e 100644 --- a/installer/vivecraft-1.7.10-forge.json +++ b/installer/vivecraft-1.7.10-forge.json @@ -150,7 +150,7 @@ }, { "name": "com.sun:jna:4.2.1", - "url": "http://automat-gh.github.io/minecrift/" + "url": "http://vivecraft.org/jar/" }, { "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1", diff --git a/installer/vivecraft-1.7.10-shadersmod.json b/installer/vivecraft-1.7.10-shadersmod.json index 0a86a69e..b21c9aba 100644 --- a/installer/vivecraft-1.7.10-shadersmod.json +++ b/installer/vivecraft-1.7.10-shadersmod.json @@ -20,7 +20,7 @@ "name": "net.minecraft:launchwrapper:1.12" }, { - "url": "http://automat-gh.github.io/minecrift/", + "url": "http://vivecraft.org/jar/", "name": "com.sun:jna:4.2.1" }, { diff --git a/installer/vivecraft-1.7.10.json b/installer/vivecraft-1.7.10.json index 27ad74f0..95325af8 100644 --- a/installer/vivecraft-1.7.10.json +++ b/installer/vivecraft-1.7.10.json @@ -17,7 +17,7 @@ "name": "net.minecraft:launchwrapper:1.12" }, { - "url": "http://automat-gh.github.io/minecrift/", + "url": "http://vivecraft.org/jar/", "name": "com.sun:jna:4.2.1" }, { diff --git a/minecriftversion.py b/minecriftversion.py index a13fd9e9..59c8aebb 100644 --- a/minecriftversion.py +++ b/minecriftversion.py @@ -4,7 +4,7 @@ of_json_name = "1.7.10_HD_U_D1" of_file_md5 = "57c724fe8335c82aef8d54c101043e60" minecrift_version_num = "1.7.10" -minecrift_build = "Vivecraft-jrbudda31r3" +minecrift_build = "Vivecraft-jrbudda32" of_file_extension = ".jar" mcp_version = "mcp908" mcp_uses_generics = False diff --git a/patches/net/minecraft/client/Minecraft.java.patch b/patches/net/minecraft/client/Minecraft.java.patch index 96136138..3fd32921 100644 --- a/patches/net/minecraft/client/Minecraft.java.patch +++ b/patches/net/minecraft/client/Minecraft.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/Minecraft.java +++ b/net/minecraft/client/Minecraft.java -@@ -1,40 +1,102 @@ +@@ -1,40 +1,108 @@ package net.minecraft.client; -import com.google.common.collect.Iterables; @@ -84,6 +84,12 @@ +import com.mtbs3d.minecrift.api.IRoomscaleAdapter; +import com.mtbs3d.minecrift.api.IStereoProvider; +import com.mtbs3d.minecrift.gameplay.BowTracker; ++import com.mtbs3d.minecrift.gameplay.ClimbTracker; ++import com.mtbs3d.minecrift.gameplay.EatingTracker; ++import com.mtbs3d.minecrift.gameplay.JumpTracker; ++import com.mtbs3d.minecrift.gameplay.RunTracker; ++import com.mtbs3d.minecrift.gameplay.SneakTracker; ++import com.mtbs3d.minecrift.gameplay.SwimTracker; +import com.mtbs3d.minecrift.provider.MCOpenVR; +import com.mtbs3d.minecrift.provider.NullStereoRenderer; +import com.mtbs3d.minecrift.provider.OpenVRPlayer; @@ -113,7 +119,7 @@ import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiChat; -@@ -68,6 +130,8 @@ +@@ -68,6 +136,8 @@ import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; @@ -122,7 +128,7 @@ import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.renderer.texture.TextureManager; -@@ -97,6 +161,7 @@ +@@ -97,6 +167,7 @@ import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.shader.Framebuffer; @@ -130,7 +136,7 @@ import net.minecraft.client.stream.IStream; import net.minecraft.client.stream.NullStream; import net.minecraft.client.stream.TwitchStream; -@@ -127,6 +192,8 @@ +@@ -127,6 +198,8 @@ import net.minecraft.profiler.Profiler; import net.minecraft.server.MinecraftServer; import net.minecraft.server.integrated.IntegratedServer; @@ -139,7 +145,7 @@ import net.minecraft.stats.AchievementList; import net.minecraft.stats.IStatStringFormat; import net.minecraft.stats.StatFileWriter; -@@ -142,6 +209,7 @@ +@@ -142,6 +215,7 @@ import net.minecraft.util.Session; import net.minecraft.util.Timer; import net.minecraft.util.Util; @@ -147,7 +153,7 @@ import net.minecraft.world.EnumDifficulty; import net.minecraft.world.WorldProviderEnd; import net.minecraft.world.WorldProviderHell; -@@ -150,2988 +218,4803 @@ +@@ -150,2988 +224,4801 @@ import net.minecraft.world.storage.ISaveFormat; import net.minecraft.world.storage.ISaveHandler; import net.minecraft.world.storage.WorldInfo; @@ -1751,8 +1757,14 @@ + // VIVE START - teleport movement + public OpenVRPlayer vrPlayer; + public IRoomscaleAdapter roomScale; -+ public BowTracker bowTracker = new BowTracker(); -+ ++ public BowTracker bowTracker = new BowTracker(); ++ public SwimTracker swimTracker = new SwimTracker(); ++ public EatingTracker autoFood=new EatingTracker(); ++ public JumpTracker jumpTracker=new JumpTracker(); ++ public SneakTracker sneakTracker=new SneakTracker(); ++ public ClimbTracker climbTracker = new ClimbTracker(); ++ public RunTracker runTracker = new RunTracker(); ++ + // VIVE END - teleport movement + + // VIVE START - vive ui debugging @@ -1971,7 +1983,7 @@ + * The minecriftVerString will be automatically updated by the build scripts, do not modify here. + * Modify minecriftversion.py in root minecrift dir. + */ -+ public final String minecriftVerString = "Vivecraft 1.7.10 Vivecraft-jrbudda31r3"; ++ public final String minecriftVerString = "Vivecraft 1.7.10 Vivecraft-jrbudda32"; + /* end version */ + /** END MINECRIFT */ + @@ -2414,13 +2426,6 @@ + this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); + } + } -+ else if (this.vrSettings.firstLoad) { -+ // VIVE START - don't force options screen, player should try defaults first -+ //this.displayGuiScreen(new GuiMinecriftSettings(new GuiMainMenu(), vrSettings, gameSettings) ); -+ this.displayGuiScreen(new GuiMainMenu()); -+ // VIVE END - don't force options screen, player should try defaults first -+ this.vrSettings.firstLoad = false; -+ } + else + { + this.displayGuiScreen(new GuiMainMenu()); @@ -2776,6 +2781,7 @@ + finally + { + Display.destroy(); ++ MCOpenVR.destroy(); + + if (!this.hasCrashed) + { @@ -5577,7 +5583,8 @@ + { + if (!this.gameSettings.keyBindUseItem.getIsKeyPressed() && (bowTracker.isActive(thePlayer) == false || vrSettings.seated)) + { -+ this.playerController.onStoppedUsingItem(this.thePlayer); ++ if(!autoFood.isEating()) ++ this.playerController.onStoppedUsingItem(this.thePlayer); + } + + label391: @@ -5603,7 +5610,7 @@ + } + } + } -+ else ++ else //not using item + { + if (this.gameSettings.keyBindAttack.getIsKeyPressed() && currentScreen == null) + { @@ -6913,8 +6920,6 @@ + { + boolean changeNonDestructiveRenderConfig = false; + -+ glConfig.mirrorDisplay = this.vrSettings.displayMirrorMode == VRSettings.MIRROR_OFF ? false : true; -+ glConfig.usePositionalTimewarp = this.vrSettings.usePositionalTimewarp; + + if (clipPlanesChanged()) + { @@ -7193,7 +7198,6 @@ + { + // We had an issue. Set the usual suspects to defaults... + this.vrSettings.useFsaa = false; -+ this.vrSettings.fsaaScaleFactor = 1.4f; + this.vrSettings.saveOptions(); + System.out.println("[Minecrift] FAILED to setup FSAA: " + ex.getMessage()); + reinitFramebuffers = true; @@ -7216,7 +7220,7 @@ + "\nRender target width: " + (this.stereoProvider.isStereo() ? EyeTextureSize.w + EyeTextureSize.w: this.displayWidth) + + ", height: " + (this.stereoProvider.isStereo() ? Math.max(EyeTextureSize.h, EyeTextureSize.h) : this.displayHeight) + + (this.stereoProvider.isStereo() ? " [Render scale: " + this.vrSettings.renderScaleFactor + "]" : "") + -+ (this.vrSettings.useFsaa ? " [FSAA Scale: " + this.vrSettings.fsaaScaleFactor + "]" : "") + ++ (this.vrSettings.useFsaa ? " [FSAA Scale: " + this.vrSettings.renderScaleFactor + "]" : "") + + "\nDisplay target width: " + this.displayFBWidth + ", height: " + displayFBHeight); + + // Init shaders diff --git a/patches/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/net/minecraft/client/entity/EntityPlayerSP.java.patch index b9ef9c29..5788d957 100644 --- a/patches/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -430,7 +430,7 @@ this.worldObj.playSound(this.posX, this.posY - (double)this.yOffset, this.posZ, name, volume, pitch, false); } -@@ -662,4 +854,268 @@ +@@ -662,4 +854,285 @@ } protected void sendHorseJump() {} @@ -529,20 +529,36 @@ + IRoomscaleAdapter con = mc.roomScale; + + // Account for pitch if required -+ if(this.capabilities.isFlying || this.inWater) -+ if (Minecraft.getMinecraft().vrSettings.allowPitchAffectsHeightWhileFlying) { -+ if (vr.useLControllerForRestricedMovement) {//these are negative cause directionvec is backwards in the z direction. -+ directionVec.rotateAroundX(con.getControllerOffhandPitch_World() * PIOVER180); -+ } else { -+ directionVec.rotateAroundX(con.getHMDPitch_World()* PIOVER180); -+ } -+ } -+ -+ // Account for yaw -+ if (vr.useLControllerForRestricedMovement) { //these are negative cause directionvec is backwards in the z direction. -+ directionVec.rotateAroundY(-con.getControllerOffhandYaw_World() * PIOVER180); -+ } else { -+ directionVec.rotateAroundY(-con.getHMDYaw_World()* PIOVER180); ++ if(mc.vrSettings.seated){ ++ directionVec=directionVec.rotateYaw(-con.getControllerOffhandYaw_World() * PIOVER180); ++ }else{ ++ if(this.capabilities.isFlying || this.inWater){ ++ switch (mc.vrSettings.vrFreeMoveMode){ ++ case VRSettings.FREEMOVE_CONTROLLER: ++ directionVec.rotateAroundX(con.getControllerOffhandPitch_World() * PIOVER180); ++ break; ++ case VRSettings.FREEMOVE_HMD: ++ directionVec.rotateAroundX(con.getHMDPitch_World()* PIOVER180); ++ break; ++ case VRSettings.FREEMOVE_RUNINPLACE: ++ //hmd pitch ++ directionVec.rotateAroundX(con.getHMDPitch_World()* PIOVER180); ++ break; ++ } ++ } ++ ++ switch (mc.vrSettings.vrFreeMoveMode){ ++ case VRSettings.FREEMOVE_CONTROLLER: ++ directionVec.rotateAroundY(-con.getControllerOffhandYaw_World() * PIOVER180); ++ break; ++ case VRSettings.FREEMOVE_HMD: ++ directionVec.rotateAroundY(-con.getHMDYaw_World() * PIOVER180); ++ break; ++ case VRSettings.FREEMOVE_RUNINPLACE: ++ directionVec.rotateAroundY((float) (-mc.runTracker.getYaw() * PIOVER180)); ++ directionVec = OpenVRPlayer.vecMult(directionVec, (float)mc.runTracker.getSpeed()); ++ break; ++ } + } + + mX = directionVec.xCoord; @@ -663,6 +679,7 @@ + boolean client = this instanceof EntityPlayerSP; + boolean freemove = OpenVRPlayer.get().getFreeMoveMode(); + boolean doY = freemove || (Minecraft.getMinecraft().vrSettings.simulateFalling && !this.isOnLadder()) && !this.isSneaking(); ++ + Vec3 roomOrigin = OpenVRPlayer.get().getRoomOriginPos_World(); + // Vec3 camloc = Minecraft.getMinecraft().roomScale.getHMDPos_World(); + diff --git a/patches/net/minecraft/client/gui/GuiIngame.java.patch b/patches/net/minecraft/client/gui/GuiIngame.java.patch index ea271206..4c3337de 100644 --- a/patches/net/minecraft/client/gui/GuiIngame.java.patch +++ b/patches/net/minecraft/client/gui/GuiIngame.java.patch @@ -365,7 +365,7 @@ int var25 = MathHelper.floor_double((double)(this.mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; this.drawString(var8, "f: " + var25 + " (" + Direction.directions[var25] + ") / " + MathHelper.wrapAngleTo180_float(this.mc.thePlayer.rotationYaw), 2, 88, 14737632); -@@ -347,11 +421,29 @@ +@@ -347,11 +421,28 @@ { this.drawString(var8, String.format("shader: %s", new Object[] {this.mc.entityRenderer.getShaderGroup().getShaderGroupName()}), 2, 112, 14737632); } @@ -381,8 +381,7 @@ + this.drawString(var8,"Offhand Look: " + v3Format(mc.roomScale.getControllerOffhandDir_World()) , 2, 188 , 14737632); + this.drawString(var8,"World Scale: " + mc.vrSettings.vrWorldScale + " World Rotation " + mc.vrSettings.vrWorldRotation , 2, 196 , 14737632); + // this.drawString(var8,"Gui " + MCOpenVR.guiPos_World.x + " " + MCOpenVR.guiPos_World.y + " " + MCOpenVR.guiPos_World.z, 2, 204 , 14737632); -+ this.drawString(var8,"Swing " + mc.vrPlayer.tickDist * 20, 2, 204 , 14737632); -+ this.drawString(var8,"R Touchpad x " + String.format("%.2f",MCOpenVR.rtbX) + " y " + String.format("%.2f",MCOpenVR.rtbY), 2, 212 , 14737632); ++ this.drawString(var8,"R Touchpad x " + String.format("%.2f",MCOpenVR.rtbX) + " y " + String.format("%.2f",MCOpenVR.rtbY), 2, 212 , 14737632); + this.drawString(var8,"3rd Person Camera: " + v3Format(mc.entityRenderer.getEyeRenderPos(renderPass.Third)), 2, 220 , 14737632); + //this.drawString(var8,"Depth: " + mc.getDepthOfPosition(mc.roomScale.getHMDPos_World()), 2, 228 , 14737632); + @@ -396,7 +395,7 @@ if (this.recordPlayingUpFor > 0) { this.mc.mcProfiler.startSection("overlayMessage"); -@@ -366,7 +458,7 @@ +@@ -366,7 +457,7 @@ if (var13 > 8) { GL11.glPushMatrix(); @@ -405,7 +404,7 @@ GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); var14 = 16777215; -@@ -388,14 +480,14 @@ +@@ -388,14 +479,14 @@ if (var37 != null) { @@ -422,7 +421,7 @@ this.mc.mcProfiler.startSection("chat"); this.persistantChatGUI.drawChat(this.updateCounter); this.mc.mcProfiler.endSection(); -@@ -422,7 +514,7 @@ +@@ -422,7 +513,7 @@ var46 = 150; } @@ -431,7 +430,7 @@ byte var47 = 10; drawRect(var19 - 1, var47 - 1, var19 + var46 * var17, var47 + 9 * var16, Integer.MIN_VALUE); -@@ -501,9 +593,10 @@ +@@ -501,9 +592,10 @@ { this.streamIndicator.render((int)(p_152126_1_ - 10.0F), 10); } @@ -445,7 +444,7 @@ Scoreboard var5 = p_96136_1_.getScoreboard(); Collection var6 = var5.getSortedScores(p_96136_1_); -@@ -549,9 +642,10 @@ +@@ -549,9 +641,10 @@ } } } @@ -459,7 +458,7 @@ boolean var3 = this.mc.thePlayer.hurtResistantTime / 3 % 2 == 1; if (this.mc.thePlayer.hurtResistantTime < 10) -@@ -559,52 +653,52 @@ +@@ -559,52 +652,52 @@ var3 = false; } @@ -536,7 +535,7 @@ { this.drawTexturedModalRect(var23, var18, 16, 9, 9, 9); } -@@ -616,7 +710,7 @@ +@@ -616,7 +709,7 @@ int var26; int var27; @@ -545,7 +544,7 @@ { var23 = 16; -@@ -636,16 +730,16 @@ +@@ -636,16 +729,16 @@ var24 = 1; } @@ -566,7 +565,7 @@ { var27 -= 2; } -@@ -661,12 +755,12 @@ +@@ -661,12 +754,12 @@ if (var3) { @@ -581,7 +580,7 @@ { this.drawTexturedModalRect(var26, var27, var23 + 63, 9 * var28, 9, 9); } -@@ -674,7 +768,7 @@ +@@ -674,7 +767,7 @@ if (var19 > 0.0F) { @@ -590,7 +589,7 @@ { this.drawTexturedModalRect(var26, var27, var23 + 153, 9 * var28, 9, 9); } -@@ -687,22 +781,22 @@ +@@ -687,22 +780,22 @@ } else { @@ -617,7 +616,7 @@ { this.mc.mcProfiler.endStartSection("food"); -@@ -718,7 +812,7 @@ +@@ -718,7 +811,7 @@ var38 = 13; } @@ -626,7 +625,7 @@ { var36 = var13 + (this.rand.nextInt(3) - 1); } -@@ -733,32 +827,32 @@ +@@ -733,32 +826,32 @@ if (var6) { @@ -665,7 +664,7 @@ var36 = (int)Math.ceil((double)var35.getHealth()); float var37 = var35.getMaxHealth(); var26 = (int)(var37 + 0.5F) / 2; -@@ -830,7 +924,9 @@ +@@ -830,7 +923,9 @@ /** * Renders dragon's (boss) health on the HUD */ @@ -676,7 +675,7 @@ { if (BossStatus.bossName != null && BossStatus.statusBarTime > 0) { -@@ -856,9 +952,15 @@ +@@ -856,9 +951,15 @@ this.mc.getTextureManager().bindTexture(icons); } } @@ -694,7 +693,7 @@ GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); OpenGlHelper.glBlendFunc(770, 771, 1, 0); -@@ -881,8 +983,15 @@ +@@ -881,8 +982,15 @@ /** * Renders the vignette. Args: vignetteBrightness, width, height */ @@ -711,16 +710,16 @@ p_73829_1_ = 1.0F - p_73829_1_; if (p_73829_1_ < 0.0F) -@@ -913,44 +1022,22 @@ +@@ -913,44 +1021,22 @@ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); OpenGlHelper.glBlendFunc(770, 771, 1, 0); } - - private void func_130015_b(float p_130015_1_, int p_130015_2_, int p_130015_3_) + -+ //unused ++ //unused (IMPORTANT: Do not rename or delete because Forge breaks!) + /** MINECRIFT FORGE **/ -+ protected void renderPortal(float p_130015_1_, int p_130015_2_, int p_130015_3_) ++ protected void func_130015_b(float p_130015_1_, int p_130015_2_, int p_130015_3_) + /** END MINECRIFT FORGE **/ { - if (p_130015_1_ < 1.0F) @@ -766,7 +765,7 @@ { ItemStack var5 = this.mc.thePlayer.inventory.mainInventory[p_73832_1_]; -@@ -1039,4 +1126,23 @@ +@@ -1039,4 +1125,23 @@ { return this.updateCounter; } diff --git a/patches/net/minecraft/client/gui/GuiNewChat.java.patch b/patches/net/minecraft/client/gui/GuiNewChat.java.patch deleted file mode 100644 index 8c71b109..00000000 --- a/patches/net/minecraft/client/gui/GuiNewChat.java.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- a/net/minecraft/client/gui/GuiNewChat.java -+++ b/net/minecraft/client/gui/GuiNewChat.java -@@ -4,8 +4,11 @@ - import java.util.ArrayList; - import java.util.Iterator; - import java.util.List; -+ -+import com.mtbs3d.minecrift.settings.VRSettings; - import net.minecraft.client.Minecraft; - import net.minecraft.entity.player.EntityPlayer; -+import net.minecraft.src.Reflector; - import net.minecraft.util.ChatComponentText; - import net.minecraft.util.EnumChatFormatting; - import net.minecraft.util.IChatComponent; -@@ -51,10 +54,19 @@ - var3 = true; - } - -+ /** MINECRIFT **/ -+ if (!Minecraft.getMinecraft().vrSettings.chatFadeAway) -+ var3 = true; - float var7 = this.getChatScale(); -- int var8 = MathHelper.ceiling_float_int((float)this.getChatWidth() / var7); -+ int chatWidthPixels = this.getChatWidth() ; -+ int chatFullHeightPixels = calculateChatboxHeight( this.mc.gameSettings.chatHeightFocused ); -+ int var8 = MathHelper.ceiling_float_int((float)chatWidthPixels/ var7); -+ ScaledResolution res = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); -+ int offsetX = (int)(VRSettings.inst.chatOffsetX*(res.getScaledWidth() - chatWidthPixels -2 )); -+ int offsetY = -(int)(VRSettings.inst.chatOffsetY*(res.getScaledHeight() - chatFullHeightPixels -20 )); - GL11.glPushMatrix(); -- GL11.glTranslatef(2.0F, 20.0F, 0.0F); -+ GL11.glTranslatef(2.0F + offsetX, 20 + offsetY, 0.0F); -+ /** END MINECRIFT **/ - GL11.glScalef(var7, var7, 1.0F); - int var9; - int var11; -@@ -100,6 +112,11 @@ - byte var15 = 0; - int var16 = -var9 * 9; - drawRect(var15, var16 - 9, var15 + var8 + 4, var16, var14 / 2 << 24); -+ /** MINECRIFT FORGE **/ -+ if (Reflector.forgeExists()) { -+ GL11.glEnable(GL11.GL_BLEND); // FORGE: BugFix MC-36812 Chat Opacity Broken in 1.7.x -+ } -+ /** END MINECRIFT FORGE **/ - String var17 = var10.getChatComponent().getFormattedText(); - this.mc.fontRendererObj.drawStringWithShadow(var17, var15, var16 - 8, 16777215 + (var14 << 24)); - GL11.glDisable(GL11.GL_ALPHA_TEST); diff --git a/patches/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/net/minecraft/client/renderer/EntityRenderer.java.patch index 6f80ebe9..d5b9acd9 100644 --- a/patches/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -86,7 +86,7 @@ import net.minecraft.potion.Potion; import net.minecraft.server.integrated.IntegratedServer; import net.minecraft.src.Config; -@@ -61,2593 +99,4851 @@ +@@ -61,2593 +99,4840 @@ import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraft.world.biome.BiomeGenBase; @@ -1477,7 +1477,7 @@ + + float var4; + -+ if (this.mc.playerController.enableEverythingIsScrewedUpMode() && !this.mc.vrSettings.debugPos) ++ if (this.mc.playerController.enableEverythingIsScrewedUpMode()) + { + var4 = 0.6666667F; + GL11.glScalef(1.0F, var4, 1.0F); @@ -1488,7 +1488,7 @@ + + var4 = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * par1; + -+ if (var4 > 0.0F && !this.mc.vrSettings.debugPos) ++ if (var4 > 0.0F ) + { + byte var7 = 20; + @@ -1506,7 +1506,7 @@ + + this.orientCamera(par1); + -+ if (this.debugViewDirection > 0 && !this.mc.vrSettings.debugPos) ++ if (this.debugViewDirection > 0) + { + int var71 = this.debugViewDirection - 1; + @@ -1636,10 +1636,10 @@ + if(eyeCollision ){ + int was = GL11.glGetInteger(GL11.GL_DEPTH_FUNC); + GL11.glDepthFunc(GL11.GL_ALWAYS); -+ renderCircle(pos, 0.05f * mc.vrSettings.vrWorldScale, 32, 0, 255, 255, 128, 1); ++ renderCircle(pos, 0.05f * mc.vrPlayer.worldScale, 32, 0, 255, 255, 128, 1); + GL11.glDepthFunc(was); + } else { -+ renderCircle(pos, .05f * mc.vrSettings.vrWorldScale, 32, 0, 255, 255, 48, 1); ++ renderCircle(pos, .05f * mc.vrPlayer.worldScale, 32, 0, 255, 255, 48, 1); + } + + setupPolyRendering(false); @@ -1673,7 +1673,7 @@ + GL11.glRotatef(mc.vrSettings.vrFixedCamrotPitch, 1.0F, 0.0F, 0.0F); + + setupPolyRendering(true); -+ renderDebugAxes(0, 0, 0, 0.08f * mc.vrSettings.vrWorldScale); //TODO: camera model? ++ renderDebugAxes(0, 0, 0, 0.08f * mc.vrPlayer.worldScale); //TODO: camera model? + setupPolyRendering(false); + + GL11.glMatrixMode(GL11.GL_PROJECTION); @@ -4051,7 +4051,7 @@ + float rows = wrapped.size(); + float shift = rows / 2f; + -+ float x = isGuiOrtho ? 0f : -this.mc.vrSettings.getHalfIPD(EyeType.ovrEye_Center); ++ float x = isGuiOrtho ? 0f : 0f; + float y = shift * COLUMN_GAP * 0.003f; // Move up + float z = -0.6f; + @@ -4132,7 +4132,7 @@ + // forward, you can hit further away... + + this.mc.pointedEntity = null; -+ double blockReachDistance = mc.vrSettings.vrWorldScale * (double)this.mc.playerController.getBlockReachDistance(); ++ double blockReachDistance = mc.vrPlayer.worldScale * (double)this.mc.playerController.getBlockReachDistance(); + double entityReachDistance = (double)this.mc.playerController.getBlockReachDistance(); + // Darktemp's crosshair fix + // VIVE START - interact source @@ -4156,7 +4156,7 @@ + if (this.mc.objectMouseOver == null || this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) + { + // Get MISS distance -+ if (!this.mc.vrSettings.maxCrosshairDistanceAtBlockReach) { ++ + endPos = aimsoucecopy.addVector(aim.xCoord * MAX_CROSSHAIR_DISTANCE, aim.yCoord * MAX_CROSSHAIR_DISTANCE, aim.zCoord * MAX_CROSSHAIR_DISTANCE); + MovingObjectPosition crossPos = this.mc.theWorld.rayTraceBlocks(aimsoucecopy, endPos, false, false, true); + if (crossPos != null) { @@ -4166,7 +4166,7 @@ + crossVec = Vec3.createVectorHelper(endPos.xCoord, endPos.yCoord, endPos.zCoord); + maxreach = crossVec.distanceTo(aimsourcecopy2); + } -+ } ++ + this.mc.objectMouseOver = null; + } + else @@ -4280,7 +4280,7 @@ + } + + -+ private Vec3 getControllerRenderPos(int c){ ++ public Vec3 getControllerRenderPos(int c){ + Vec3 out ; + + if(mc.vrSettings.seated){ @@ -4289,7 +4289,7 @@ + dir.yCoord = 0; + dir =dir.normalize(); + if(mc.renderViewEntity != null && mc.theWorld != null){ -+ out = mc.renderViewEntity.getPosition(0).addVector(dir.xCoord*0.3 * mc.vrSettings.vrWorldScale, -0.4* mc.vrSettings.vrWorldScale ,dir.zCoord*0.3* mc.vrSettings.vrWorldScale); ++ out = mc.renderViewEntity.getPosition(0).addVector(dir.xCoord*0.3 * mc.vrPlayer.worldScale, -0.4* mc.vrPlayer.worldScale,dir.zCoord*0.3* mc.vrPlayer.worldScale); + } else { + out = mc.roomScale.getHMDPos_Room().addVector(dir.xCoord*0.3 , -0.4 ,dir.zCoord*0.3); + } @@ -4308,7 +4308,7 @@ + out.rotateAroundY(mc.vrPlayer.worldRotationRadians); + return out.addVector(interPolatedRoomOrigin.xCoord, interPolatedRoomOrigin.yCoord, interPolatedRoomOrigin.zCoord); + } else if (currentPass == renderPass.Third){ -+ Vec3 out = Vec3.createVectorHelper(mc.vrSettings.vrFixedCamposX *mc.vrSettings.vrWorldScale, mc.vrSettings.vrFixedCamposY *mc.vrSettings.vrWorldScale, mc.vrSettings.vrFixedCamposZ *mc.vrSettings.vrWorldScale); ++ Vec3 out = Vec3.createVectorHelper(mc.vrSettings.vrFixedCamposX *mc.vrPlayer.worldScale, mc.vrSettings.vrFixedCamposY *mc.vrPlayer.worldScale, mc.vrSettings.vrFixedCamposZ *mc.vrPlayer.worldScale); + out.rotateAroundY(mc.vrPlayer.worldRotationRadians); + return interPolatedRoomOrigin.addVector(out.xCoord, out.yCoord, out.zCoord); + } else { @@ -4346,12 +4346,12 @@ + if(mc.currentPass != renderPass.Third) + eye = mc.roomScale.getEyePos_World(currentPass); //dont need interpolation. + else { -+ eye = Vec3.createVectorHelper(mc.vrSettings.vrFixedCamposX *mc.vrSettings.vrWorldScale , mc.vrSettings.vrFixedCamposY *mc.vrSettings.vrWorldScale, mc.vrSettings.vrFixedCamposZ *mc.vrSettings.vrWorldScale); ++ eye = Vec3.createVectorHelper(mc.vrSettings.vrFixedCamposX *mc.vrPlayer.worldScale , mc.vrSettings.vrFixedCamposY *mc.vrPlayer.worldScale, mc.vrSettings.vrFixedCamposZ *mc.vrPlayer.worldScale); + eye.rotateAroundY(mc.vrPlayer.worldRotationRadians); + eye = mc.roomScale.getRoomOriginPos_World().addVector(eye.xCoord, eye.yCoord, eye.zCoord); + } + -+ MCOpenVR.guiScale = mc.vrSettings.vrWorldScale; ++ MCOpenVR.guiScale = mc.vrPlayer.worldScale; + if (mc.vrSettings.seated || mc.vrSettings.vrHudLockMode == mc.vrSettings.HUD_LOCK_HEAD) + { + Matrix4f rot = Matrix4f.rotationY((float) Math.toRadians(mc.vrSettings.vrWorldRotation)); @@ -4359,9 +4359,9 @@ + + Vec3 v = mc.vrPlayer.getHMDPos_World(); + Vec3 d = mc.vrPlayer.getHMDDir_World(); -+ guipos.x = (float) (v.xCoord + d.xCoord*mc.vrSettings.vrWorldScale); -+ guipos.y = (float) (v.yCoord + d.yCoord*mc.vrSettings.vrWorldScale); -+ guipos.z = (float) (v.zCoord + d.zCoord*mc.vrSettings.vrWorldScale); ++ guipos.x = (float) (v.xCoord + d.xCoord*mc.vrPlayer.worldScale); ++ guipos.y = (float) (v.yCoord + d.yCoord*mc.vrPlayer.worldScale); ++ guipos.z = (float) (v.zCoord + d.zCoord*mc.vrPlayer.worldScale); + + Quatf orientationQuat = OpenVRUtil.convertMatrix4ftoRotationQuat(max); + @@ -4385,7 +4385,7 @@ + guirot = Matrix4f.multiply(guirot, Matrix4f.rotationY((float) Math.PI * 0.1F * i)); + guirot.M[3][3] = 1.7f; + -+ guiLocal.yCoord = 0.5*mc.vrSettings.vrWorldScale; ++ guiLocal.yCoord = 0.5*mc.vrPlayer.worldScale; + + Vec3 v =mc.vrPlayer.getControllerPos_World(1); + guipos.x = (float) v.xCoord; @@ -4416,9 +4416,9 @@ + guipos.x = (float) v.xCoord; + guipos.y = (float) v.yCoord; + guipos.z = (float) v.zCoord; -+ guiLocal.xCoord = -0.005*mc.vrSettings.vrWorldScale; -+ guiLocal.yCoord = 0.16*mc.vrSettings.vrWorldScale; -+ guiLocal.zCoord = 0.17*mc.vrSettings.vrWorldScale; ++ guiLocal.xCoord = -0.005*mc.vrPlayer.worldScale; ++ guiLocal.yCoord = 0.16*mc.vrPlayer.worldScale; ++ guiLocal.zCoord = 0.17*mc.vrPlayer.worldScale; + + + @@ -4436,12 +4436,12 @@ + } + + if(MCOpenVR.hudPopup){ -+ MCOpenVR.guiScale = .5f*mc.vrSettings.vrWorldScale; ++ MCOpenVR.guiScale = .5f*mc.vrPlayer.worldScale; + }else { -+ MCOpenVR.guiScale = 0.33f*mc.vrSettings.vrWorldScale; -+ guiLocal.xCoord = i*-0.12f*mc.vrSettings.vrWorldScale; -+ guiLocal.yCoord = 0.1*mc.vrSettings.vrWorldScale; -+ guiLocal.zCoord = 0.04*mc.vrSettings.vrWorldScale; ++ MCOpenVR.guiScale = 0.33f*mc.vrPlayer.worldScale; ++ guiLocal.xCoord = i*-0.12f*mc.vrPlayer.worldScale; ++ guiLocal.yCoord = 0.1*mc.vrPlayer.worldScale; ++ guiLocal.zCoord = 0.04*mc.vrPlayer.worldScale; + guirot = Matrix4f.multiply(guirot, Matrix4f.rotationY((float) Math.PI * 0.2f*i)); + } + @@ -4893,16 +4893,7 @@ + } + } + -+ public Vector3f getViewAdjust(EyeType eye) -+ { -+ Vector3f viewAdjust = new Vector3f(); -+ // VIVE START - had to remove negative in x viewadjust for this to be correct -+ viewAdjust.x = this.mc.vrSettings.getHalfIPD(eye); -+ viewAdjust.y = 1f; + -+ return viewAdjust; -+ } -+ + //please push your matrix first. and pop after. + public void SetupRenderingAtController(int controller){ + @@ -4918,7 +4909,7 @@ + (float) (-aimSource.zCoord )); + } + -+ GL11.glScalef(mc.vrSettings.vrWorldScale , mc.vrSettings.vrWorldScale , mc.vrSettings.vrWorldScale ); ++ GL11.glScalef(mc.vrPlayer.worldScale , mc.vrPlayer.worldScale , mc.vrPlayer.worldScale ); + + // Vector3f fore = new Vector3f(0,0,1); + // Matrix4f rotation = this.mc.vrPlayer.get.getAimRotation(controller); @@ -5571,7 +5562,7 @@ + float crossDepth =(float)crossVec.subtract(mc.roomScale.getControllerPos_World(0)).lengthVector(); + if (crossDepth > MAX_CROSSHAIR_DISTANCE) crossDepth = MAX_CROSSHAIR_DISTANCE; + float depthscale = 0.4f + 0.6f*( (MAX_CROSSHAIR_DISTANCE - crossDepth) / MAX_CROSSHAIR_DISTANCE); -+ float scale = (float) (0.15f* this.mc.vrSettings.crosshairScale * Math.sqrt(mc.vrSettings.vrWorldScale)); ++ float scale = (float) (0.15f* this.mc.vrSettings.crosshairScale * Math.sqrt(mc.vrPlayer.worldScale)); + scale/=(depthscale); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glPushMatrix(); @@ -5581,9 +5572,7 @@ + GL11.glTranslatef(crossX, crossY, crossZ); + GL11.glRotatef(-mc.vrPlayer.getControllerMainYaw_World(), 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-mc.roomScale.getControllerMainPitch_World(), 1.0F, 0.0F, 0.0F); -+ if (this.mc.vrSettings.crosshairRollsWithHead) -+ GL11.glRotated(this.cameraRoll, 0.0F, 0.0F, 1.0F); -+ if (this.mc.vrSettings.crosshairScalesWithDistance) ++ if (false) + { + // VIVE START - adjust depth scaling to handle far crosshair positions + scale = -0.05f; diff --git a/patches/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/net/minecraft/client/renderer/RenderGlobal.java.patch index 511c4aca..d27292fe 100644 --- a/patches/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -272,7 +272,7 @@ ++this.countTileEntitiesRendered; fr.enabled = true; continue; -@@ -726,14 +782,55 @@ +@@ -726,14 +782,54 @@ } } @@ -305,7 +305,7 @@ + Reflector.callVoid(Reflector.ShadersMod_Shaders_beginEntities, new Object[] {}); + } + ++this.countEntitiesRendered; -+ renderplayer.setVR(true,this.mc.vrSettings.renderHeadWear, this.mc.vrSettings.renderPlayerOffset); ++ renderplayer.setVR(true,true,0); + this.renderedEntity = thePlayer; + if (shadersMod) { + Reflector.callVoid(Reflector.ShadersMod_Shaders_nextEntity, new Object[] {}); @@ -317,12 +317,11 @@ + Reflector.callVoid(Reflector.ShadersMod_Shaders_endEntities, new Object[] {}); + } + } - -- this.mc.entityRenderer.disableLightmap((double)p_147589_3_); + + /** END MINECRIFT SHADERS MOD **/ + /** END MINECRIFT */ -+ + +- this.mc.entityRenderer.disableLightmap((double)p_147589_3_); + this.mc.entityRenderer.disableLightmap((double)nano); this.theWorld.theProfiler.endSection(); + @@ -330,7 +329,7 @@ } } -@@ -1023,7 +1120,9 @@ +@@ -1023,7 +1119,9 @@ if (this.mc.gameSettings.ofSmoothFps && renderPass == 0) { @@ -341,7 +340,7 @@ } byte var35 = 0; -@@ -1076,14 +1175,27 @@ +@@ -1076,14 +1174,27 @@ endIndex = this.countSortedWorldRenderers; } @@ -372,7 +371,7 @@ profiler.endSection(); GL11.glPushMatrix(); float sumTX = 0.0F; -@@ -1145,9 +1257,9 @@ +@@ -1145,9 +1256,9 @@ } profiler.startSection("bb"); @@ -385,7 +384,7 @@ profiler.endSection(); wr.isWaitingOnOcclusionQuery = true; ++var37; -@@ -1177,12 +1289,21 @@ +@@ -1177,12 +1288,21 @@ { GL11.glColorMask(true, true, true, true); } @@ -408,7 +407,7 @@ } } else -@@ -1422,13 +1543,13 @@ +@@ -1422,13 +1542,13 @@ this.glListBuffer.flip(); EntityLivingBase var18 = this.mc.renderViewEntity; @@ -425,7 +424,7 @@ this.mc.entityRenderer.disableLightmap(partialTicks); return l; } -@@ -1475,7 +1596,11 @@ +@@ -1475,7 +1595,11 @@ */ public void renderSky(float par1) { @@ -438,7 +437,7 @@ { WorldProvider var2 = this.mc.theWorld.provider; Object var3 = Reflector.call(var2, Reflector.ForgeWorldProvider_getSkyRenderer, new Object[0]); -@@ -1487,7 +1612,7 @@ +@@ -1487,7 +1611,7 @@ } } @@ -447,7 +446,7 @@ { if (!Config.isSkyEnabled()) { -@@ -1495,6 +1620,10 @@ +@@ -1495,6 +1619,10 @@ } GL11.glDisable(GL11.GL_FOG); @@ -458,7 +457,7 @@ GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); -@@ -1544,13 +1673,24 @@ +@@ -1544,13 +1672,24 @@ GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); @@ -484,7 +483,7 @@ float var231 = (float)var21.xCoord; float var4 = (float)var21.yCoord; float var5 = (float)var21.zCoord; -@@ -1570,186 +1710,242 @@ +@@ -1570,186 +1709,242 @@ Tessellator var241 = Tessellator.instance; GL11.glDepthMask(false); GL11.glEnable(GL11.GL_FOG); @@ -904,7 +903,7 @@ } } -@@ -1781,6 +1977,7 @@ +@@ -1781,6 +1976,7 @@ par1 = 0.0F; GL11.glDisable(GL11.GL_CULL_FACE); float var21 = (float)(this.mc.renderViewEntity.lastTickPosY + (this.mc.renderViewEntity.posY - this.mc.renderViewEntity.lastTickPosY) * (double)par1); @@ -912,7 +911,7 @@ byte var3 = 32; int var4 = 256 / var3; Tessellator var5 = Tessellator.instance; -@@ -1788,7 +1985,7 @@ +@@ -1788,7 +1984,7 @@ GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); double dc; @@ -921,7 +920,7 @@ if (this.isFancyGlListClouds || this.cloudTickCounter >= this.cloudTickCounterGlList + 20) { -@@ -1810,8 +2007,8 @@ +@@ -1810,8 +2006,8 @@ } var10 = 4.8828125E-4F; @@ -932,7 +931,7 @@ double cdx = this.mc.renderViewEntity.prevPosZ + (this.mc.renderViewEntity.posZ - this.mc.renderViewEntity.prevPosZ) * (double)par1; int cdz = MathHelper.floor_double(dc / 2048.0D); int var18 = MathHelper.floor_double(cdx / 2048.0D); -@@ -1839,16 +2036,17 @@ +@@ -1839,16 +2035,17 @@ GL11.glEndList(); this.isFancyGlListClouds = false; this.cloudTickCounterGlList = this.cloudTickCounter; @@ -954,7 +953,7 @@ float cdx1 = (float)(exactPlayerX1 - this.cloudPlayerX + dc * 0.03D); float cdy = (float)(exactPlayerY1 - this.cloudPlayerY); float cdz1 = (float)(exactPlayerZ1 - this.cloudPlayerZ); -@@ -1879,7 +2077,9 @@ +@@ -1879,7 +2076,9 @@ float partialTicks = par1; par1 = 0.0F; GL11.glDisable(GL11.GL_CULL_FACE); @@ -965,7 +964,7 @@ Tessellator var3 = Tessellator.instance; float var4 = 12.0F; float var5 = 4.0F; -@@ -1900,29 +2100,29 @@ +@@ -1900,29 +2099,29 @@ if (!this.isFancyGlListClouds || this.cloudTickCounter >= this.cloudTickCounterGlList + 20) { GL11.glNewList(this.glListClouds, GL11.GL_COMPILE); @@ -1013,7 +1012,7 @@ float dc = (float)(var8 - (double)MathHelper.floor_double(var8)); float var23 = (float)(var10 - (double)MathHelper.floor_double(var10)); byte cdx = 8; -@@ -1964,25 +2164,25 @@ +@@ -1964,25 +2163,25 @@ if (var12 > -var5 - 1.0F) { @@ -1050,7 +1049,7 @@ int var34; if (var28 > -1) -@@ -1991,10 +2191,10 @@ +@@ -1991,10 +2190,10 @@ for (var34 = 0; var34 < cdx; ++var34) { @@ -1065,7 +1064,7 @@ } } -@@ -2004,14 +2204,14 @@ +@@ -2004,14 +2203,14 @@ for (var34 = 0; var34 < cdx; ++var34) { @@ -1085,7 +1084,7 @@ if (var29 > -1) { -@@ -2019,10 +2219,10 @@ +@@ -2019,10 +2218,10 @@ for (var34 = 0; var34 < cdx; ++var34) { @@ -1100,7 +1099,7 @@ } } -@@ -2032,10 +2232,10 @@ +@@ -2032,10 +2231,10 @@ for (var34 = 0; var34 < cdx; ++var34) { @@ -1115,7 +1114,7 @@ } } -@@ -2047,15 +2247,18 @@ +@@ -2047,15 +2246,18 @@ GL11.glEndList(); this.isFancyGlListClouds = true; this.cloudTickCounterGlList = this.cloudTickCounter; @@ -1141,7 +1140,7 @@ double var40 = (double)((float)(this.cloudTickCounter - this.cloudTickCounterGlList) + partialTicks); float var41 = (float)(var37 - this.cloudPlayerX + var40 * 0.03D); float var42 = (float)(var38 - this.cloudPlayerY); -@@ -2075,7 +2278,9 @@ +@@ -2075,7 +2277,9 @@ { this.renderViewEntity = entityliving; @@ -1152,7 +1151,7 @@ { return WrUpdates.updateRenderers(this, entityliving, flag); } -@@ -2093,7 +2298,7 @@ +@@ -2093,7 +2297,7 @@ maxNum *= 3; } @@ -1161,7 +1160,7 @@ int numValid = 0; WorldRenderer wrBest = null; float distSqBest = Float.MAX_VALUE; -@@ -2129,6 +2334,7 @@ +@@ -2129,6 +2333,7 @@ break; } @@ -1169,7 +1168,7 @@ if (!i.isInFrustum) { wr *= (float)NOT_IN_FRUSTRUM_MUL; -@@ -2167,6 +2373,7 @@ +@@ -2167,6 +2372,7 @@ { float distSq = var17.distanceToEntitySquared(entityliving); @@ -1177,7 +1176,7 @@ if (!var17.isInFrustum) { distSq *= (float)NOT_IN_FRUSTRUM_MUL; -@@ -2202,6 +2409,8 @@ +@@ -2202,6 +2408,8 @@ public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityLivingBase par2EntityPlayer, float par3) { @@ -1186,7 +1185,7 @@ double var4 = par2EntityPlayer.lastTickPosX + (par2EntityPlayer.posX - par2EntityPlayer.lastTickPosX) * (double)par3; double var6 = par2EntityPlayer.lastTickPosY + (par2EntityPlayer.posY - par2EntityPlayer.lastTickPosY) * (double)par3; double var8 = par2EntityPlayer.lastTickPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.lastTickPosZ) * (double)par3; -@@ -2216,6 +2425,10 @@ +@@ -2216,6 +2424,10 @@ GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glEnable(GL11.GL_ALPHA_TEST); @@ -1197,7 +1196,7 @@ par1Tessellator.startDrawingQuads(); par1Tessellator.setTranslation(-var4, -var6, -var8); par1Tessellator.disableColor(); -@@ -2245,6 +2458,10 @@ +@@ -2245,6 +2457,10 @@ par1Tessellator.draw(); par1Tessellator.setTranslation(0.0D, 0.0D, 0.0D); @@ -1208,7 +1207,7 @@ GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glPolygonOffset(0.0F, 0.0F); GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL); -@@ -2252,6 +2469,7 @@ +@@ -2252,6 +2468,7 @@ GL11.glDepthMask(true); GL11.glPopMatrix(); } @@ -1216,7 +1215,7 @@ } /** -@@ -2259,6 +2477,8 @@ +@@ -2259,6 +2476,8 @@ */ public void drawSelectionBox(EntityPlayer par1EntityPlayer, MovingObjectPosition par2MovingObjectPosition, int par3, float par4) { @@ -1225,7 +1224,7 @@ if (par3 == 0 && par2MovingObjectPosition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { GL11.glEnable(GL11.GL_BLEND); -@@ -2266,6 +2486,10 @@ +@@ -2266,6 +2485,10 @@ GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); @@ -1236,7 +1235,7 @@ GL11.glDepthMask(false); float var5 = 0.002F; Block var6 = this.theWorld.getBlock(par2MovingObjectPosition.blockX, par2MovingObjectPosition.blockY, par2MovingObjectPosition.blockZ); -@@ -2281,8 +2505,13 @@ +@@ -2281,8 +2504,13 @@ GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); @@ -1250,7 +1249,7 @@ } /** -@@ -2932,7 +3161,7 @@ +@@ -2932,7 +3160,7 @@ { this.theWorld.playSound((double)par3 + 0.5D, (double)par4 + 0.5D, (double)par5 + 0.5D, "random.door_close", 1.0F, this.theWorld.rand.nextFloat() * 0.1F + 0.9F, false); } @@ -1259,7 +1258,7 @@ break; case 1004: -@@ -3026,12 +3255,13 @@ +@@ -3026,12 +3254,13 @@ case 2001: var8 = Block.getBlockById(par6 & 4095); @@ -1275,7 +1274,7 @@ this.mc.effectRenderer.addBlockDestroyEffects(par3, par4, par5, var8, par6 >> 12 & 255); break; -@@ -3128,6 +3358,9 @@ +@@ -3128,6 +3357,9 @@ for (int var24 = 0; var24 < var23; ++var24) { diff --git a/patches/net/minecraft/util/Vec3.java.patch b/patches/net/minecraft/util/Vec3.java.patch new file mode 100644 index 00000000..55868e96 --- /dev/null +++ b/patches/net/minecraft/util/Vec3.java.patch @@ -0,0 +1,40 @@ +--- a/net/minecraft/util/Vec3.java ++++ b/net/minecraft/util/Vec3.java +@@ -21,7 +21,8 @@ + return new Vec3(x, y, z); + } + +- protected Vec3(double x, double y, double z) ++ //vivecraft ++ public Vec3(double x, double y, double z) + { + if (x == -0.0D) + { +@@ -240,4 +241,27 @@ + double var8 = this.zCoord; + this.setComponents(var4, var6, var8); + } ++ ++ //VIVECRAFT ADDITIONS ++ public Vec3 scale(double d) { ++ return new Vec3(this.xCoord*d, this.yCoord*d, this.zCoord*d); ++ } ++ ++ public Vec3 add(Vec3 other) { ++ return new Vec3(this.xCoord*+other.xCoord, this.yCoord+other.yCoord, this.zCoord+other.zCoord); ++ } ++ ++ public Vec3 subtract(double i, double d, double j) { ++ return new Vec3(this.xCoord-i, this.yCoord-d, this.zCoord-j); ++ } ++ ++ public Vec3 rotateYaw(float angle) { ++ float var2 = MathHelper.cos(angle); ++ float var3 = MathHelper.sin(angle); ++ double var4 = this.xCoord * (double)var2 + this.zCoord * (double)var3; ++ double var6 = this.yCoord; ++ double var8 = this.zCoord * (double)var2 - this.xCoord * (double)var3; ++ return new Vec3(var4, var6, var8); ++ } ++ + } diff --git a/src/com/mtbs3d/minecrift/api/IRoomscaleAdapter.java b/src/com/mtbs3d/minecrift/api/IRoomscaleAdapter.java index 75fcb59d..3f7b7024 100644 --- a/src/com/mtbs3d/minecrift/api/IRoomscaleAdapter.java +++ b/src/com/mtbs3d/minecrift/api/IRoomscaleAdapter.java @@ -60,6 +60,8 @@ public interface IRoomscaleAdapter { public void triggerHapticPulse(int controller, int duration); public Vec3 getControllerPos_Room(int i); public Vec3 getControllerPos_World(int c); + public Vec3 getControllerDir_World(int c); + public Vec3 getControllerDir_Room(int c); } diff --git a/src/com/mtbs3d/minecrift/api/NetworkHelper.java b/src/com/mtbs3d/minecrift/api/NetworkHelper.java index 5787a1ab..c83753be 100644 --- a/src/com/mtbs3d/minecrift/api/NetworkHelper.java +++ b/src/com/mtbs3d/minecrift/api/NetworkHelper.java @@ -26,7 +26,9 @@ public enum PacketDiscriminators { CONTROLLER0DATA, CONTROLLER1DATA, WORLDSCALE, - DRAW + DRAW, + MOVEMODE, + UBERPACKET } private final static String channel = "Vivecraft"; @@ -48,7 +50,7 @@ public static S3FPacketCustomPayload getVivecraftServerPacket(PacketDiscriminato private static float worldScallast = 0; public static void sendVRPlayerPositions(IRoomscaleAdapter player) { if(!serverWantsData) return; - float worldScale = Minecraft.getMinecraft().vrSettings.vrWorldScale; + float worldScale = Minecraft.getMinecraft().vrPlayer.worldScale; if (worldScale != worldScallast) { ByteBuf payload = Unpooled.buffer(); payload.writeFloat(worldScale); diff --git a/src/com/mtbs3d/minecrift/api/Vec3History.java b/src/com/mtbs3d/minecrift/api/Vec3History.java new file mode 100644 index 00000000..3806cf2c --- /dev/null +++ b/src/com/mtbs3d/minecrift/api/Vec3History.java @@ -0,0 +1,134 @@ +package com.mtbs3d.minecrift.api; + +import java.awt.List; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.ListIterator; +import java.util.Map; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.Vec3; + + +public class Vec3History { + + private class entry{ + public long ts; + public Vec3 data; + public entry(Vec3 in){ + this.ts = Minecraft.getSystemTime(); + this.data = in; + } + } + + private int _capacity = 90*5; + private LinkedList _data = new LinkedList(); + + + public void add(Vec3 in){ + _data.add(new entry(in)); + if (_data.size() > _capacity) _data.removeFirst(); + } + + public void clear(){ + _data.clear(); + } + + public Vec3 latest(){ + return _data.getLast().data; + } + + + /** + * Get the total integrated device translation for the specified time period. Return value is in meters. + */ + public double totalMovement(double seconds){ + long now = Minecraft.getSystemTime(); + ListIterator it = _data.listIterator(_data.size()); + entry last = null; + double sum = 0; + int count = 0; + while (it.hasPrevious()){ + entry i = it.previous(); + count++; + if(now - i.ts > seconds *1000) + break; + if (last == null){ + last = i; + continue; + } + sum += (last.data.distanceTo(i.data)); + } + return sum; + } + + /** + * Get the vector representing the difference in position from now to @seconds ago. + */ + public Vec3 netMovement(double seconds){ + long now = Minecraft.getSystemTime(); + ListIterator it = _data.listIterator(_data.size()); + entry last = null; + entry thing = null; + double sum = 0; + + while (it.hasPrevious()){ + entry i = it.previous(); + if(now - i.ts > seconds *1000) break; + if (last == null){ + last = i; + continue; + } + thing = i; + } + if(last == null || thing == null) return Vec3.createVectorHelper(0, 0, 0); + return thing.data.subtract(last.data); + } + + /** + * Get the average scalar speed of the device over the specified length of time. Returns m/s. + */ + public double averageSpeed(double seconds){ + long now = Minecraft.getSystemTime(); + ListIterator it = _data.listIterator(_data.size()); + double out = 0; + entry last = null; + int j = 0; + while (it.hasPrevious()){ + entry i = it.previous(); + if(now - i.ts > seconds *1000) break; + if (last == null){ + last = i; + continue; + } + j++; + double tdelta = (.001*(last.ts - i.ts)); + double ddelta = (last.data.subtract(i.data).lengthVector()); + out = out + ddelta/tdelta; + } + if(j == 0) return out; + + return out/j; + } + + /** + * Get the average room position for the last @seconds. + */ + public Vec3 averagePosition(double seconds){ + long now = Minecraft.getSystemTime(); + ListIterator it = _data.listIterator(_data.size()); + Vec3 out = Vec3.createVectorHelper(0, 0, 0); + int j = 0; + while (it.hasPrevious()){ + entry i = it.previous(); + if(now - i.ts > seconds *1000) break; + j++; + out=out.addVector(i.data.xCoord, i.data.yCoord, i.data.zCoord); + } + if(j==0) return out; + return Vec3.createVectorHelper(out.xCoord/j, out.yCoord/j, out.yCoord/j); + } + +} diff --git a/src/com/mtbs3d/minecrift/gameplay/BowTracker.java b/src/com/mtbs3d/minecrift/gameplay/BowTracker.java index 03eb3170..3069b4df 100644 --- a/src/com/mtbs3d/minecrift/gameplay/BowTracker.java +++ b/src/com/mtbs3d/minecrift/gameplay/BowTracker.java @@ -111,7 +111,7 @@ public void doProcess(IRoomscaleAdapter provider, EntityPlayerSP player){ pressed = Minecraft.getMinecraft().gameSettings.keyBindAttack.getIsKeyPressed(); - float notchDistThreshold = (float) (0.3 * Minecraft.getMinecraft().vrSettings.vrWorldScale); + float notchDistThreshold = (float) (0.3 * Minecraft.getMinecraft().vrPlayer.worldScale); boolean infiniteAmmo = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, bow) > 0; diff --git a/src/com/mtbs3d/minecrift/gameplay/ClimbTracker.java b/src/com/mtbs3d/minecrift/gameplay/ClimbTracker.java new file mode 100644 index 00000000..e0696653 --- /dev/null +++ b/src/com/mtbs3d/minecrift/gameplay/ClimbTracker.java @@ -0,0 +1,150 @@ +package com.mtbs3d.minecrift.gameplay; + +import javax.swing.LayoutStyle; + +import com.mtbs3d.minecrift.api.IRoomscaleAdapter; +import com.mtbs3d.minecrift.provider.MCOpenVR; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; + +public class ClimbTracker { + + private boolean c0Latched = false; + private boolean c1Latched = false; + + private boolean gravityOverride=false; + + + public Vec3[] latchStart = new Vec3[]{Vec3.createVectorHelper(0, 0, 0), Vec3.createVectorHelper(0, 0, 0)}; + public double[] latchStartBodyY = new double[2]; + public int latchStartController = -1; + + public boolean isGrabbingLadder(){ + return c0Latched || c1Latched; + } + + public boolean isActive(EntityPlayerSP p){ + if(Minecraft.getMinecraft().vrSettings.seated) + return false; + if(!Minecraft.getMinecraft().vrSettings.vrFreeMove && !Minecraft.getMinecraft().vrSettings.simulateFalling) + return false; + if(!Minecraft.getMinecraft().vrSettings.realisticClimbEnabled) + return false; + if(p==null || p.isDead) + return false; + if(p.isRiding()) + return false; + if(p.moveForward > 0) + return false; + return true; + } + + public void doProcess(Minecraft minecraft, EntityPlayerSP player){ + if(!isActive(player)) { + latchStartController = -1; + c1Latched = false; + c0Latched = false; + return; + } + + IRoomscaleAdapter provider = minecraft.roomScale; + + boolean[] ok = new boolean[2]; + + for(int c=0;c<2;c++){ + Vec3 controllerPos=minecraft.roomScale.getControllerPos_World(c); + + int bx = (int) MathHelper.floor_double(controllerPos.xCoord); + int by = (int) MathHelper.floor_double(controllerPos.yCoord); + int bz = (int) MathHelper.floor_double(controllerPos.zCoord); + + Block b = minecraft.theWorld.getBlock(bx, by, bz); + if(b == Blocks.ladder || b ==Blocks.vine){ + int meta = b.getDamageValue(minecraft.theWorld, bx, by, bz); + Vec3 cpos = Vec3.createVectorHelper(controllerPos.xCoord - bx, controllerPos.yCoord - by, controllerPos.zCoord - bz); + + if(meta == 2){ + ok[c] = cpos.zCoord > .9 && (cpos.xCoord > .1 && cpos.xCoord < .9); + } else if (meta == 3){ + ok[c] = cpos.zCoord < .1 && (cpos.xCoord > .1 && cpos.xCoord < .9); + } else if (meta == 4){ + ok[c] = cpos.xCoord > .9 && (cpos.zCoord > .1 && cpos.zCoord < .9); + } else if (meta == 5){ + ok[c] = cpos.xCoord < .1 && (cpos.zCoord > .1 && cpos.zCoord < .9); + } + } else { + if(latchStart[c].squareDistanceTo(controllerPos) > 0.25) + ok[c] = false; + else + ok[c] = c==0?c0Latched:c1Latched; //dont let go when leaving block, only when not on ladder in ladder block. + } + } + + + if(!ok[0] && c0Latched){ + minecraft.vrPlayer.triggerHapticPulse(0, 200); + } + + if(ok[0] && !c0Latched){ + latchStart[0] = minecraft.roomScale.getControllerPos_World(0); + latchStartBodyY[0] = player.posY; + latchStartController = 0; + minecraft.vrPlayer.triggerHapticPulse(0, 1000); + } + + if(!ok[1] && c1Latched){ + minecraft.vrPlayer.triggerHapticPulse(1, 200); + } + + if(ok[1] && !c1Latched){ + latchStart[1] = minecraft.roomScale.getControllerPos_World(1); + latchStartBodyY[1] = player.posY; + latchStartController = 1; + minecraft.vrPlayer.triggerHapticPulse(1, 1000); + } + + c0Latched = ok[0]; + c1Latched = ok[1]; + + if(c0Latched || c1Latched ) { + //player.setNoGravity(true); + player.motionY = 0; //maybe? + gravityOverride=true; + } + if(!c0Latched && !c1Latched && gravityOverride){ + //player.setNoGravity(false); + gravityOverride=false; + } + + if(!c0Latched && !c1Latched){ + latchStartController = -1; + return; //fly u fools + } + + int c =0; + + if(c0Latched && c1Latched){ //y u do dis? + if(latchStartController >=0) + c = latchStartController; //use whichever one grabbed most recently. + //if u manage to get both controllers onto the ladder in one tick.. congratz, use c0. + } else if (c1Latched){ + c =1; + } + + double now = minecraft.roomScale.getControllerPos_World(c).yCoord; + + double delta= -(now - latchStart[c].yCoord); + + player.motionY = delta; + + } + +} diff --git a/src/com/mtbs3d/minecrift/gameplay/EatingTracker.java b/src/com/mtbs3d/minecrift/gameplay/EatingTracker.java new file mode 100644 index 00000000..0a688c61 --- /dev/null +++ b/src/com/mtbs3d/minecrift/gameplay/EatingTracker.java @@ -0,0 +1,94 @@ +package com.mtbs3d.minecrift.gameplay; + +import java.util.Random; + +import com.mtbs3d.minecrift.api.IRoomscaleAdapter; +import com.mtbs3d.minecrift.provider.MCOpenVR; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Vec3; + +/** + * Created by Hendrik on 02-Aug-16. + */ +public class EatingTracker { + float mouthtoEyeDistance=0.0f; + float threshold=0.25f; + public boolean[] eating= new boolean[2]; + int eattime=2100; + long eatStart; + + public boolean isEating(){ + return eating[0] || eating[1]; + } + + public boolean isActive(EntityPlayerSP p){ + if(Minecraft.getMinecraft().vrSettings.seated) + return false; + if(p == null) return false; + if(p.isDead) return false; + if(p.isPlayerSleeping()) return false; + if(p.getHeldItem()!= null){ + EnumAction action=p.getHeldItem().getItemUseAction(); + if( action == EnumAction.eat || action == EnumAction.drink) return true; + } + return false; + } + +private Random r = new Random(); + + +public void doProcess(Minecraft minecraft, EntityPlayerSP player){ + if(!isActive(player)) { + eating[0]=false; + eating[1]=false; + return; + } + IRoomscaleAdapter provider = minecraft.roomScale; + + Vec3 hmdPos=provider.getHMDPos_Room(); + Vec3 mouthPos=provider.getCustomHMDVector(new Vec3(0,-mouthtoEyeDistance,0)).add(hmdPos); + + int c = 0; + + Vec3 controllerPos=MCOpenVR.controllerHistory[c].averagePosition(0.333).add(provider.getCustomControllerVector(c,new Vec3(0,0,-0.1))); + controllerPos = controllerPos.add(minecraft.roomScale.getControllerDir_Room(c).scale(0.1)); + + if(mouthPos.distanceTo(controllerPos) 0) return; + } + + if(!eating[c]){ + if( Minecraft.getMinecraft().playerController.onPlayerRightClick(player, player.worldObj,is,0,0,0,0, new Vec3(0,0,0))){ + minecraft.entityRenderer.itemRenderer.resetEquippedProgress(); + eating[c]=true; + eatStart=Minecraft.getSystemTime(); + } + } + int crunchiness; + if(is.getItemUseAction() == EnumAction.drink){ + crunchiness=0; + }else + crunchiness=2; + + long t = player.getItemInUseCount(); + if(t>0) + if(t%5 <= crunchiness) + minecraft.vrPlayer.triggerHapticPulse(c, 700 ); + + if(Minecraft.getSystemTime()-eatStart > eattime) + eating[c]=false; + + }else { + eating[c]=false; + } +} + +} diff --git a/src/com/mtbs3d/minecrift/gameplay/JumpTracker.java b/src/com/mtbs3d/minecrift/gameplay/JumpTracker.java new file mode 100644 index 00000000..69a6d330 --- /dev/null +++ b/src/com/mtbs3d/minecrift/gameplay/JumpTracker.java @@ -0,0 +1,42 @@ +package com.mtbs3d.minecrift.gameplay; + +import com.mtbs3d.minecrift.api.IRoomscaleAdapter; +import com.mtbs3d.minecrift.provider.MCOpenVR; + +import com.mtbs3d.minecrift.settings.AutoCalibration; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; + +public class JumpTracker { + + + public boolean isActive(EntityPlayerSP p){ + if(Minecraft.getMinecraft().vrSettings.seated) + return false; + if(!Minecraft.getMinecraft().vrSettings.vrFreeMove && !Minecraft.getMinecraft().vrSettings.simulateFalling) + return false; + if(!Minecraft.getMinecraft().vrSettings.realisticJumpEnabled) + return false; + if(p==null || p.isDead || !p.onGround) + return false; + if(p.isInWater()) + return false; + if(p.isSneaking() || p.isRiding()) + return false; + return true; + } + + public void doProcess(Minecraft minecraft, EntityPlayerSP player){ + if(!isActive(player)) { + return; + } + + if(MCOpenVR.hmdPivotHistory.netMovement(0.25).yCoord > 0.1 && + MCOpenVR.hmdPivotHistory.latest().yCoord-AutoCalibration.getPlayerHeight() > minecraft.vrSettings.jumpThreshold + ){ + player.jump(); + } + } +} diff --git a/src/com/mtbs3d/minecrift/gameplay/RunTracker.java b/src/com/mtbs3d/minecrift/gameplay/RunTracker.java new file mode 100644 index 00000000..625d4653 --- /dev/null +++ b/src/com/mtbs3d/minecrift/gameplay/RunTracker.java @@ -0,0 +1,124 @@ +package com.mtbs3d.minecrift.gameplay; + +import com.mtbs3d.minecrift.api.IRoomscaleAdapter; +import com.mtbs3d.minecrift.provider.MCOpenVR; +import com.mtbs3d.minecrift.settings.VRSettings; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.util.Vec3; + + +public class RunTracker { + + + public boolean isActive(EntityPlayerSP p){ + if(!Minecraft.getMinecraft().vrSettings.vrFreeMove || Minecraft.getMinecraft().vrSettings.seated) + return false; + if(Minecraft.getMinecraft().vrSettings.vrFreeMoveMode != VRSettings.FREEMOVE_RUNINPLACE) + return false; + if(p==null || p.isDead) + return false; + if(!p.onGround && (p.isInWater())) + return false; + if(p.isOnLadder()) + return false; + return true; + } + + public double direction = 0; + private double speed = 0; + private Vec3 movedir; + + public double getYaw(){ + return direction; + } + + public double getSpeed(){ + return speed; + } + public void doProcess(Minecraft minecraft, EntityPlayerSP player){ + if(!isActive(player)) { + speed = 0; + return; + } + + Vec3 controllerR= minecraft.roomScale.getControllerPos_World(0); + Vec3 controllerL= minecraft.roomScale.getControllerPos_World(1); + + //Vec3d middle= controllerL.subtract(controllerR).scale(0.5).add(controllerR); + + double c0move = MCOpenVR.controllerHistory[0].averageSpeed(.5); + double c1move = MCOpenVR.controllerHistory[1].averageSpeed(.5); + + if(speed > 0) { + if(c0move < 0.1 && c1move < 0.1){ + speed = 0; + return; + } + }else { + if(c0move < 0.6 && c1move < 0.6){ + speed = 0; + return; + } + } + + if(Math.abs(c0move - c1move) > .5){ + speed = 0; + return; + } //2 hands plz. + + +// Vec3d hmdPos = minecraft.roomScale.getHMDPos_World(); +// +// Vec3d Hmddir = minecraft.roomScale.getHMDDir_World(); +// Hmddir= new Vec3d(Hmddir.xCoord,0, Hmddir.zCoord).normalize(); +// +// if(speed < 0) Hmddir = movedir; //maybe? +// +// Vec3d r = MCOpenVR.controllerHistory[0].netMovement(0.33).rotateYaw(minecraft.vrPlayer.worldRotationRadians); +// Vec3d l = MCOpenVR.controllerHistory[1].netMovement(0.33).rotateYaw(minecraft.vrPlayer.worldRotationRadians); +// +// r = new Vec3d(r.xCoord,0, r.zCoord).normalize(); +// l = new Vec3d(l.xCoord,0, l.zCoord).normalize(); +// +// double dotr = r.dotProduct(Hmddir); +// double dotl = l.dotProduct(Hmddir); +// +// if(dotr <0) r = r.scale(-1); +// if(dotl <0) l = l.scale(-1); +// +// // if(Math.abs(dotr) < 0.5 || Math.abs(dotl) < 0.5) return; +// +// movedir = new Vec3d((r.xCoord + l.xCoord) / 2, 0, (r.zCoord + l.zCoord) / 2); +// +// Vec3d movedir= new Vec3d(middle.xCoord - hmdPos.xCoord, 0, middle.zCoord - hmdPos.zCoord); +// //TODO: do this betterer. Use actual controller movement dir in x-z plane. +// movedir = movedir.normalize(); + + //todo: skip entries? is this computationally expensive? + Vec3 r = MCOpenVR.controllerHistory[0].averagePosition(.5); + Vec3 l = MCOpenVR.controllerHistory[1].averagePosition(.5); + + Vec3 diff; + + if(Minecraft.getMinecraft().vrSettings.vrReverseHands){ + diff = l.subtract(r).rotateYaw(minecraft.getMinecraft().vrPlayer.worldRotationRadians); + } else { + diff = r.subtract(l).rotateYaw(minecraft.getMinecraft().vrPlayer.worldRotationRadians); + } + + + double ltor = Math.toDegrees(Math.atan2(-diff.xCoord, diff.zCoord)); + + direction = ltor + (Minecraft.getMinecraft().vrSettings.vrReverseHands ? -1 : 1) * 90; + + double spd = (c0move + c1move) / 2; + this.speed = spd * 1 * 1.3; + if(this.speed > 1.3) this.speed = 1.3f; + + } + +} diff --git a/src/com/mtbs3d/minecrift/gameplay/SneakTracker.java b/src/com/mtbs3d/minecrift/gameplay/SneakTracker.java new file mode 100644 index 00000000..f5ece038 --- /dev/null +++ b/src/com/mtbs3d/minecrift/gameplay/SneakTracker.java @@ -0,0 +1,43 @@ +package com.mtbs3d.minecrift.gameplay; + +import com.mtbs3d.minecrift.api.IRoomscaleAdapter; +import com.mtbs3d.minecrift.provider.MCOpenVR; + +import com.mtbs3d.minecrift.settings.AutoCalibration; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; + + +public class SneakTracker { + public boolean sneakOverride=false; + + public boolean isActive(EntityPlayerSP p){ + if(Minecraft.getMinecraft().vrSettings.seated) + return false; + if(!Minecraft.getMinecraft().vrSettings.vrFreeMove && !Minecraft.getMinecraft().vrSettings.simulateFalling) + return false; + if(!Minecraft.getMinecraft().vrSettings.realisticSneakEnabled) + return false; + if(p==null || p.isDead || !p.onGround) + return false; + if(p.isRiding()) + return false; + return true; + } + + public void doProcess(Minecraft minecraft, EntityPlayerSP player){ + if(!isActive(player)) { + sneakOverride = false; + return; + } + + if(( AutoCalibration.getPlayerHeight() - MCOpenVR.hmdPivotHistory.latest().yCoord )> minecraft.vrSettings.sneakThreshold){ + sneakOverride=true; + }else{ + sneakOverride=false; + } + } + +} diff --git a/src/com/mtbs3d/minecrift/gameplay/SwimTracker.java b/src/com/mtbs3d/minecrift/gameplay/SwimTracker.java new file mode 100644 index 00000000..3ff6aebc --- /dev/null +++ b/src/com/mtbs3d/minecrift/gameplay/SwimTracker.java @@ -0,0 +1,156 @@ +package com.mtbs3d.minecrift.gameplay; + +import com.mtbs3d.minecrift.provider.MCOpenVR; +import com.mtbs3d.minecrift.provider.OpenVRPlayer; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; + +/** + * Created by Hendrik on 02-Aug-16. + */ +public class SwimTracker { + + Vec3 motion = Vec3.createVectorHelper(0, 0, 0); + double friction=0.9f; + + double lastDist; + + final double riseSpeed=0.005f; + double swimspeed=0.8f; + + public boolean isActive(EntityPlayerSP p){ + if(!Minecraft.getMinecraft().vrSettings.vrFreeMove || Minecraft.getMinecraft().vrSettings.seated) + return false; + if(p==null || p.isDead) + return false; + if(!p.isInWater()) //) && !p.isInLava()) + return false; + + //Block block=p.worldObj.getBlockState(p.getPosition().add(0,0.7,0)).getBlock(); + return true; + } + + public void doProcess(Minecraft minecraft, EntityPlayerSP player){ + if(!isActive(player)) { + return; + } + + Vec3 face = minecraft.roomScale.getHMDPos_World(); + Vec3 off = Vec3.createVectorHelper(0,minecraft.roomScale.getHMDPos_Room().yCoord * 0.9, 0); + Vec3 feets = off.subtract(face); + double waterLine=256; + + int bx = (int) MathHelper.floor_double(feets.xCoord); + int by = (int) MathHelper.floor_double(feets.yCoord); + int bz = (int) MathHelper.floor_double(feets.zCoord); + + Block bp = player.worldObj.getBlock(bx, by, bz); + for (int i = 0; i < 4; i++) { + Material mat=bp.getMaterial(); + + if(!mat.isLiquid()) + { + waterLine=bp.getBlockBoundsMinY(); + break; + } + by++; + bp = player.worldObj.getBlock(bx, by, bz); + } + + double percent = (waterLine - feets.yCoord) / (face.yCoord - feets.yCoord); + + if(percent < 0){ + //how did u get here, drybones? + return; + } + + if(percent < 0.5 && player.onGround){ + return; + //no diving in the kiddie pool. + } + + player.addVelocity(0, 0.018D , 0); //counteract most gravity. + + double neutal = player.isCollidedHorizontally? 0.5 : 1; + + if(percent > neutal && percent < 2){ //between halfway submerged and 1 body length under. + //rise! + double buoyancy = 2 - percent; + if(player.isCollidedHorizontally) player.addVelocity(0, 00.03f, 0); + player.addVelocity(0, 0.0015 + buoyancy/100 , 0); + } + + +// gravityOverride=true; +// player.setNoGravity(true); +// +// Vec3d playerpos=player.getPositionVector(); +// +// double swimHeight= MCOpenVR.hmdPivotHistory.latest().yCoord;//new Vec3d(0,1.5,0); +// double maxSwim= swimHeight/2; +// +// double depth=2; +// +// for (int i = 0; i < 4; i++) { +// BlockPos blockpos=new BlockPos(playerpos.add(new Vec3d(0,i+0.5,0))); +// Material block=player.worldObj.getBlockState(blockpos).getMaterial(); +// if(!block.isLiquid()) +// { +// depth=blockpos.getY()-playerpos.yCoord-2; +// break; +// } +// } +// +// if (depth > 2) +// depth = 2; +// +// double buoyancy=(1-depth); +// +// Material block1=player.worldObj.getBlockState(new BlockPos(playerpos.addVector(0,swimHeight,0))).getMaterial(); +// if(!block1.isLiquid()){ +// //we are at the surface +// Material block2=player.worldObj.getBlockState(new BlockPos(playerpos.addVector(0,maxSwim,0))).getMaterial(); +// if(!block2.isLiquid()){ +// //Too high +// player.setNoGravity(false); +// } +// +// }else{ +// player.addVelocity(0, buoyancy<0 ? sinkspeed*buoyancy : riseSpeed*buoyancy, 0); +// } + + Vec3 controllerR= minecraft.roomScale.getControllerPos_World(0); + Vec3 controllerL= minecraft.roomScale.getControllerPos_World(1); + + Vec3 middle= controllerL.subtract(controllerR).scale(0.5).add(controllerR); + + Vec3 hmdPos=minecraft.roomScale.getHMDPos_World().subtract(0,0.3,0); + + Vec3 movedir=middle.subtract(hmdPos).normalize().add( + minecraft.roomScale.getHMDDir_World()).scale(0.5); + + Vec3 contollerDir= minecraft.roomScale.getCustomControllerVector(0,new Vec3(0,0,-1)).add( + minecraft.roomScale.getCustomControllerVector(1,new Vec3(0,0,-1))).scale(0.5); + double dirfactor=contollerDir.add(movedir).lengthVector()/2; + + double distance= hmdPos.distanceTo(middle); + double distDelta=lastDist-distance; + + if(distDelta>0){ + Vec3 velo= OpenVRPlayer.vecMult(movedir, (float)(distDelta*swimspeed*dirfactor)); + + motion=motion.add(OpenVRPlayer.vecMult(velo,0.15f)); + } + + lastDist=distance; + player.addVelocity(motion.xCoord,motion.yCoord,motion.zCoord); + motion=motion.scale(friction); + + } + +} diff --git a/src/com/mtbs3d/minecrift/gui/GuiHUDSettings.java b/src/com/mtbs3d/minecrift/gui/GuiHUDSettings.java index ca57188f..c40b7381 100644 --- a/src/com/mtbs3d/minecrift/gui/GuiHUDSettings.java +++ b/src/com/mtbs3d/minecrift/gui/GuiHUDSettings.java @@ -37,8 +37,8 @@ public void initGui() { this.buttonList.clear(); this.buttonList.add(new GuiSmallButtonEx(VRSettings.VrOptions.HUD_HIDE.returnEnumOrdinal(), this.width / 2 - 78, this.height / 6 - 14, VRSettings.VrOptions.HUD_HIDE, this.guivrSettings.getKeyBinding(VRSettings.VrOptions.HUD_HIDE))); - this.buttonList.add(new GuiButtonEx(201, this.width / 2 - 100, this.height / 6 + 148, "Reset To Defaults")); - this.buttonList.add(new GuiButtonEx(200, this.width / 2 - 100, this.height / 6 + 168, "Done")); + this.buttonList.add(new GuiButtonEx(ID_GENERIC_DEFAULTS, this.width / 2 - 155 , this.height -25 ,150,20, "Reset To Defaults")); + this.buttonList.add(new GuiButtonEx(ID_GENERIC_DONE, this.width / 2 - 155 + 160, this.height -25,150,20, "Done")); VRSettings.VrOptions[] buttons = hudOptions; for (int var12 = 2; var12 < buttons.length + 2; ++var12) @@ -109,12 +109,12 @@ protected void actionPerformed(GuiButton par1GuiButton) this.guivrSettings.setOptionValue(((GuiSmallButtonEx)par1GuiButton).returnVrEnumOptions(), 1); par1GuiButton.displayString = this.guivrSettings.getKeyBinding(VRSettings.VrOptions.getEnumOptions(par1GuiButton.id)); } - else if (par1GuiButton.id == 200) + else if (par1GuiButton.id == ID_GENERIC_DONE) { Minecraft.getMinecraft().vrSettings.saveOptions(); this.mc.displayGuiScreen(this.parentGuiScreen); } - else if (par1GuiButton.id == 201) + else if (par1GuiButton.id == ID_GENERIC_DEFAULTS) { this.guivrSettings.hudDistance = 1.25f; this.guivrSettings.hudScale = 1.5f; diff --git a/src/com/mtbs3d/minecrift/gui/GuiLocomotionSettings.java b/src/com/mtbs3d/minecrift/gui/GuiLocomotionSettings.java index 638aab5a..a19ad531 100644 --- a/src/com/mtbs3d/minecrift/gui/GuiLocomotionSettings.java +++ b/src/com/mtbs3d/minecrift/gui/GuiLocomotionSettings.java @@ -11,30 +11,32 @@ public class GuiLocomotionSettings extends BaseGuiSettings implements GuiEventEx { static VRSettings.VrOptions[] locomotionSettings = new VRSettings.VrOptions[] { - // VIVE START - hide options not relevant for standing - //VRSettings.VrOptions.ALLOW_FORWARD_PLUS_STRAFE, - VRSettings.VrOptions.WALK_UP_BLOCKS, - VRSettings.VrOptions.MOVEMENT_MULTIPLIER, - //VRSettings.VrOptions.STRAFE_MULTIPLIER, - VRSettings.VrOptions.INERTIA_FACTOR, - //VRSettings.VrOptions.VIEW_BOBBING, - VRSettings.VrOptions.PITCH_AFFECTS_FLYING, - VRSettings.VrOptions.SIMULATE_FALLING, // VIVE new option - VRSettings.VrOptions.WEAPON_COLLISION, // VIVE new option - // VIVE END - hide options not relevant for standing - //JRBUDDA - VRSettings.VrOptions.ALLOW_CRAWLING, - VRSettings.VrOptions.FREE_MOVE_DEFAULT, - VRSettings.VrOptions.LIMIT_TELEPORT, + VRSettings.VrOptions.WEAPON_COLLISION, + VRSettings.VrOptions.REALISTIC_JUMP, VRSettings.VrOptions.ALLOW_MODE_SWITCH, + VRSettings.VrOptions.REALISTIC_SNEAK, VRSettings.VrOptions.BCB_ON, - - //END JRBUDDA - - - + VRSettings.VrOptions.REALISTIC_CLIMB, + VRSettings.VrOptions.WALK_MULTIPLIER, + VRSettings.VrOptions.REALISTIC_SWIM, + VRSettings.VrOptions.DUMMY, + VRSettings.VrOptions.REALISTIC_ROW, }; + static VRSettings.VrOptions[] teleportSettings = new VRSettings.VrOptions[] + { + VRSettings.VrOptions.WALK_UP_BLOCKS, + VRSettings.VrOptions.LIMIT_TELEPORT, + VRSettings.VrOptions.SIMULATE_FALLING + + }; + static VRSettings.VrOptions[] freeMoveSettings = new VRSettings.VrOptions[] + { + VRSettings.VrOptions.FREEMOVE_MODE, + VRSettings.VrOptions.MOVEMENT_MULTIPLIER, + VRSettings.VrOptions.INERTIA_FACTOR, + }; + public GuiLocomotionSettings(GuiScreen guiScreen, VRSettings guivrSettings) { super( guiScreen, guivrSettings ); screenTitle = "Locomotion Settings"; @@ -46,11 +48,21 @@ public GuiLocomotionSettings(GuiScreen guiScreen, VRSettings guivrSettings) { public void initGui() { this.buttonList.clear(); - this.buttonList.add(new GuiButtonEx(ID_GENERIC_DEFAULTS, this.width / 2 - 100, this.height / 6 + 148, "Reset To Defaults")); - this.buttonList.add(new GuiButtonEx(ID_GENERIC_DONE, this.width / 2 - 100, this.height / 6 + 168, "Done")); + this.buttonList.add(new GuiButtonEx(ID_GENERIC_DEFAULTS, this.width / 2 - 155 , this.height -25 ,150,20, "Reset To Defaults")); + this.buttonList.add(new GuiButtonEx(ID_GENERIC_DONE, this.width / 2 - 155 + 160, this.height -25,150,20, "Done")); VRSettings.VrOptions[] buttons = locomotionSettings; + addButtons(buttons,0); + GuiSmallButtonEx mode = new GuiSmallButtonEx(VRSettings.VrOptions.MOVE_MODE.returnEnumOrdinal(), this.width / 2 - 68, this.height / 6 + 102,VRSettings.VrOptions.MOVE_MODE, this.guivrSettings.getKeyBinding(VRSettings.VrOptions.MOVE_MODE)); + mode.setEventHandler(this); + this.buttonList.add(mode); + if(mc.vrSettings.vrFreeMove) + addButtons(freeMoveSettings,134); + else + addButtons(teleportSettings,134); + } - int extra = 0; + private void addButtons(VRSettings.VrOptions[] buttons, int startY) { + int extra = startY; for (int var12 = 2; var12 < buttons.length + 2; ++var12) { VRSettings.VrOptions var8 = buttons[var12 - 2]; @@ -83,17 +95,10 @@ public void initGui() maxValue = 1.0f; increment = 0.01f; } - else if ( var8 == VRSettings.VrOptions.VR_COMFORT_TRANSITION_ANGLE_DEGS) - { - minValue = 15f; - maxValue = 45f; - increment = 15f; - } - else if ( var8 == VRSettings.VrOptions.VR_COMFORT_TRANSITION_TIME_SECS) - { - minValue = 0f; - maxValue = 0.75f; - increment = 0.005f; + else if (var8 == VRSettings.VrOptions.WALK_MULTIPLIER){ + minValue=1f; + maxValue=10f; + increment=0.1f; } // VIVE START - new options GuiSliderEx slider = new GuiSliderEx(var8.returnEnumOrdinal(), width, height - 20, var8, this.guivrSettings.getKeyBinding(var8), minValue, maxValue, increment, this.guivrSettings.getOptionFloatValue(var8)); @@ -109,13 +114,16 @@ else if ( var8 == VRSettings.VrOptions.VR_COMFORT_TRANSITION_TIME_SECS) this.buttonList.add(smallButton); } } - } + } private boolean getEnabledState(VRSettings.VrOptions var8) { String s = var8.getEnumString(); if(s==VRSettings.VrOptions.ALLOW_CRAWLING.getEnumString()) return false; + if(s.equals(VRSettings.VrOptions.REALISTIC_JUMP.getEnumString()) || + s.equals(VRSettings.VrOptions.REALISTIC_SNEAK.getEnumString())) + return !Minecraft.getMinecraft().vrSettings.seated; return true; @@ -152,16 +160,23 @@ protected void actionPerformed(GuiButton par1GuiButton) else if (par1GuiButton.id == ID_GENERIC_DEFAULTS) { vr.inertiaFactor = VRSettings.INERTIA_NORMAL; - vr.allowPitchAffectsHeightWhileFlying = false; - vr.useKeyBindingForComfortYaw = false; vr.movementSpeedMultiplier = 1f; vr.simulateFalling = false; //jrbudda// + vr.weaponCollision = true; vr.vrAllowCrawling = false; vr.vrAllowLocoModeSwotch = true; - vr.vrFreeMove = true; + vr.vrFreeMove = false; vr.vrLimitedSurvivalTeleport = true; vr.vrShowBlueCircleBuddy = true; + vr.walkMultiplier=1; + vr.vrFreeMoveMode = vr.FREEMOVE_CONTROLLER; + vr.realisticClimbEnabled = true; + vr.realisticJumpEnabled = true; + vr.realisticSneakEnabled = true; + vr.realisticSwimEnabled = true; + vr.realisticRowEnabled = true; + vr.vehicleRotation = false; //end jrbudda Minecraft.getMinecraft().gameSettings.viewBobbing = true; @@ -173,8 +188,13 @@ else if (par1GuiButton.id == ID_GENERIC_DEFAULTS) else if (par1GuiButton instanceof GuiSmallButtonEx) { VRSettings.VrOptions num = VRSettings.VrOptions.getEnumOptions(par1GuiButton.id); - this.guivrSettings.setOptionValue(((GuiSmallButtonEx)par1GuiButton).returnVrEnumOptions(), 1); - par1GuiButton.displayString = this.guivrSettings.getKeyBinding(VRSettings.VrOptions.getEnumOptions(par1GuiButton.id)); + this.guivrSettings.setOptionValue(((GuiSmallButtonEx)par1GuiButton).returnVrEnumOptions(), 1); + par1GuiButton.displayString = this.guivrSettings.getKeyBinding(VRSettings.VrOptions.getEnumOptions(par1GuiButton.id)); + + if(num == VRSettings.VrOptions.MOVE_MODE){ + this.reinit = true; + } + } } } @@ -182,11 +202,6 @@ else if (par1GuiButton instanceof GuiSmallButtonEx) @Override public boolean event(int id, VRSettings.VrOptions enumm) { - if (enumm == VRSettings.VrOptions.USE_VR_COMFORT) - { - this.reinit = true; - } - return true; } @@ -233,59 +248,6 @@ protected String[] getTooltipLines(String displayString, int buttonId) " ON: You can walk up single blocks. May reduce", " locomotion induced simulator sickness for some." } ; - case USE_VR_COMFORT: - return new String[] { - "Enables view ratcheting on controller yaw or pitch input.", - "For some people this can allow a more comfortable", - "viewing experience while moving around. Known as", - "'VR Comfort Mode' (with thanks to Cloudhead Games)!", - " OFF: (Default) No view ratcheting is applied.", - " Yaw Only: View ratcheting applied to Yaw only.", - " Pitch Only: View ratcheting applied to Pitch only.", - " Yaw and Pitch: You guessed it...", - } ; - case VR_COMFORT_TRANSITION_LINEAR: - return new String[] { - "Determines how the view transitions from one ratchet", - "angle to the next.", - " Sinusoidal: (default) The view movement accelerates", - " and then decelerates to the required position. Can", - " feel more natural to some.", - " Linear: The view transitions to the next angle at a", - " constant velocity." - } ; - case VR_COMFORT_TRANSITION_BLANKING_MODE: - return new String[] { - "Determines if the view is blanked as the view", - "transitions from one ratchet angle to the next. This can", - "relieve locomotion induced motion sickness for some.", - " None: (Default) No view blanking is applied.", - " Black: The view is completely black during transition.", - " Blink: A simulated blink. The view fades to black, and", - " and then fades in again over the transition period." - } ; - case VR_COMFORT_TRANSITION_TIME_SECS: - return new String[] { - "Determines how long a ratchet transition takes, in ms.", - " 0ms: Instant transition.", - " 200-400ms: Human blink speed." - } ; - case VR_COMFORT_TRANSITION_ANGLE_DEGS: - return new String[]{ - "Determines how many degrees a ratchet transition", - "rotates." - }; - case ALLOW_FORWARD_PLUS_STRAFE: - return new String[] { - "Determines if strafing (or sideways movement) is", - "allowed while moving forward or backwards.", - " Allowed: (Default) Forwards and strafe movement is", - " allowed at the same time. May cause motion sickness", - " for some.", - " Disallowed: Anything more than a small forward", - " movement will cause any strafe input to be zeroed.", - " This can help make movement more 'natural'." - } ; case INERTIA_FACTOR: return new String[]{ "Sets the player's movement inertia in single player", @@ -297,38 +259,6 @@ protected String[] getTooltipLines(String displayString, int buttonId) " Automan < Normal < A lot < Even More. Does not", " affect lava, water or jumping movement currently." }; - case VIEW_BOBBING: - return new String[]{ - "If enabled, makes player movement more realistic by", - "simulating the players view changing subtly as they", - "walk along. Can cause motion sickness when ON for", - "some. Yet others need this ON for a comfortable", - "experience!", - " ON: (Default) View bobs up and down while moving.", - " OFF: No view bobbing, the player view 'floats' at", - " a constant height above the ground." - }; - case PITCH_AFFECTS_FLYING: - return new String[]{ - "If enabled, uses controller pitch or HMD orientation", - "pitch to create height changes while flying. Pitch up", - "to move up, pitch down to move down.", - " OFF: (Default) No elevation changes based on pitch", - " input. Normal Minecraft operation.", - " ON: (Recommended) Pitch input affects elevation", - " while flying. An enjoyable travel experience!" - }; - case VR_COMFORT_USE_KEY_BINDING_FOR_YAW: - return new String[]{ - "Determines how a comfort mode yaw transition (player", - "turn to the left or right) is triggered.", - " Crosshair: (Default) Moving the crosshair to the edge", - " of the keyhole will trigger a yaw", - " transition.", - " Key: The 'Cycle Item Left / Right' key or", - " controller binding wil instead be used to", - " trigger a yaw transition." - }; // VIVE START - new options case SIMULATE_FALLING: return new String[] { @@ -351,9 +281,9 @@ protected String[] getTooltipLines(String displayString, int buttonId) return new String[] { "If enabled the player will be able to duck under block" } ; - case FREE_MOVE_DEFAULT: + case MOVE_MODE: return new String[] { - "Defaults to free move mode instead of teleport mode." + "Current move mode. Teleport or Free Move." } ; case LIMIT_TELEPORT: return new String[] { @@ -368,6 +298,51 @@ protected String[] getTooltipLines(String displayString, int buttonId) "This is your Blue Circle Buddy (tm).", "Do not lose your Blue Circle Buddy." }; + case REALISTIC_JUMP: + return new String[]{ + "If turned on, once you jump in real life", + "Your player will also jump" + }; + case REALISTIC_SNEAK: + return new String[]{ + "If turned on, once you duck in real life", + "Your player will also sneak" + }; + case REALISTIC_CLIMB: + return new String[]{ + "If turned on, allow climbing ladders and vines", + "by touching them." + }; + case REALISTIC_SWIM: + return new String[]{ + "If turned on, allow swimming by doing the breaststoke", + "with the controllers." + }; + case REALISTIC_ROW: + return new String[]{ + "Row, row, row your boat... by flapping your arms like mad." + }; + case WALK_MULTIPLIER: + return new String[]{ + "Multiplies your position in the room by a factor", + "Allows you to walk around more,", + "but may cause motion sickness" + }; + case FREEMOVE_MODE: + return new String[] { + "The source for freemove direction. Options are", + "Controller: Uses left controller direction, max speed", + "HMD: Uses head direction, max speed", + "Run In Place: Use average controllers direction. Speed based", + "on controller motion." + + } ; + case VEHICLE_ROTATION: + return new String[] { + "Riding in a vehicle will rotate the world", + "as the vehicle rotates. May be disorienting." + + } ; default: return null; } diff --git a/src/com/mtbs3d/minecrift/gui/GuiMinecriftSettings.java b/src/com/mtbs3d/minecrift/gui/GuiMinecriftSettings.java index 4f729781..5fd70cb2 100644 --- a/src/com/mtbs3d/minecrift/gui/GuiMinecriftSettings.java +++ b/src/com/mtbs3d/minecrift/gui/GuiMinecriftSettings.java @@ -11,6 +11,7 @@ import com.mtbs3d.minecrift.gui.framework.GuiSliderEx; import com.mtbs3d.minecrift.gui.framework.GuiSmallButtonEx; import com.mtbs3d.minecrift.gui.framework.VROption; +import com.mtbs3d.minecrift.provider.MCOpenVR; import com.mtbs3d.minecrift.settings.VRSettings; import com.mtbs3d.minecrift.settings.VRSettings.VrOptions; @@ -24,27 +25,41 @@ public class GuiMinecriftSettings extends BaseGuiSettings implements GuiEventEx { public static final int PROFILES_ID = 915; + - static VROption[] vrOnDeviceList = new VROption[] + static VROption[] vrAlwaysOptions = new VROption[] { - // VIVE START - hide options not relevant to teleport/room scale new VROption(202, VROption.Position.POS_RIGHT, 2, VROption.ENABLED, "HUD Settings..."), new VROption(206, VROption.Position.POS_LEFT, 1f, VROption.ENABLED, "Stereo Rendering..."), - new VROption(207, VROption.Position.POS_RIGHT, 1f, VROption.ENABLED, "Quick Commands"), - new VROption(209, VROption.Position.POS_LEFT, 2f, VROption.ENABLED, "Locomotion Settings..."), + new VROption(207, VROption.Position.POS_RIGHT, 1f, VROption.ENABLED, "Quick Commands..."), new VROption(210, VROption.Position.POS_RIGHT, 3f, VROption.ENABLED, "Chat/Crosshair Settings..."), - new VROption(220, VROption.Position.POS_LEFT, 3f, VROption.ENABLED, "Controller Buttons..."), new VROption(VRSettings.VrOptions.PLAY_MODE_SEATED, VROption.Position.POS_LEFT, 4.5f, VROption.ENABLED, null), - new VROption(VRSettings.VrOptions.REVERSE_HANDS, VROption.Position.POS_RIGHT, 4.5f, VROption.ENABLED, null), new VROption(VRSettings.VrOptions.WORLD_SCALE, VROption.Position.POS_LEFT, 6f, VROption.ENABLED, null), new VROption(VRSettings.VrOptions.WORLD_ROTATION, VROption.Position.POS_RIGHT, 6f, VROption.ENABLED, null), - new VROption(VRSettings.VrOptions.WORLD_ROTATION_INCREMENT,VROption.Position.POS_RIGHT, 7f, VROption.ENABLED, null), - new VROption(221, VROption.Position.POS_LEFT, 7f, VROption.ENABLED, "Reset to Defaults"), - - - // VIVE END - hide options not relevant to teleport/room scale + new VROption(VRSettings.VrOptions.RESET_ORIGIN, VROption.Position.POS_LEFT, 7f, VROption.ENABLED, null), + }; - + + static VROption[] vrStandingOptions = new VROption[] + { + new VROption(209, VROption.Position.POS_LEFT, 2f, VROption.ENABLED, "Locomotion Settings..."), + new VROption(220, VROption.Position.POS_LEFT, 3f, VROption.ENABLED, "Controller Buttons..."), + new VROption(VRSettings.VrOptions.REVERSE_HANDS, VROption.Position.POS_RIGHT, 4.5f, VROption.ENABLED, null), + new VROption(VRSettings.VrOptions.WORLD_ROTATION_INCREMENT,VROption.Position.POS_RIGHT, 7f, VROption.ENABLED, null) + }; + + static VROption[] vrSeatedOptions = new VROption[] + { + new VROption(211, VROption.Position.POS_LEFT, 3f, VROption.ENABLED, "Seated Settings..."), + }; + + static VROption[] vrConfirm = new VROption[] + { + new VROption(222, VROption.Position.POS_RIGHT, 2, VROption.ENABLED, "Cancel"), + new VROption(223, VROption.Position.POS_LEFT, 2, VROption.ENABLED, "OK"), + }; + + boolean isConfirm = false; /** An array of all of EnumOption's video options. */ GameSettings settings; @@ -67,18 +82,40 @@ public void initGui() { this.buttonList.clear(); int profileButtonWidth = 240; - GuiSmallButtonEx profilesButton = new GuiSmallButtonEx(PROFILES_ID, (this.width / 2 - 155 + 1 * 160 / 2) - ((profileButtonWidth - 150) / 2), this.height / 6 - 14, profileButtonWidth, 20, "Profile: " + VRSettings.getCurrentProfile()); - this.buttonList.add(profilesButton); - this.buttonList.add(new GuiButtonEx(200, this.width / 2 - 100, this.height / 6 + 168, "Done")); - VROption[] buttons = null; - buttons = vrOnDeviceList; + if(!isConfirm){ + screenTitle = "VR Settings"; + GuiSmallButtonEx profilesButton = new GuiSmallButtonEx(PROFILES_ID, (this.width / 2 - 155 + 1 * 160 / 2) - ((profileButtonWidth - 150) / 2), this.height / 6 - 14, profileButtonWidth, 20, "Profile: " + VRSettings.getCurrentProfile()); + this.buttonList.add(profilesButton); + this.buttonList.add(new GuiButtonEx(ID_GENERIC_DEFAULTS, this.width / 2 - 155 , this.height -25 ,150,20, "Reset To Defaults")); + this.buttonList.add(new GuiButtonEx(ID_GENERIC_DONE, this.width / 2 - 155 + 160, this.height -25,150,20, "Done")); + VROption[] buttons = null; - for (VROption var8 : buttons) + buttons = vrAlwaysOptions; + + processButtons(buttons); + + if(mc.vrSettings.seated) { + processButtons(vrSeatedOptions); + }else + processButtons(vrStandingOptions); + + } + else { + this.screenTitle = "Switching to Seated Mode will disable controller input. Continue?"; + processButtons(vrConfirm); + } + } + + private void processButtons(VROption[] buttons) { + for (VROption var8 : buttons) { int width = var8.getWidth(this.width); int height = var8.getHeight(this.height); VrOptions o = VrOptions.getEnumOptions(var8.getOrdinal()); + + if(o==VrOptions.RESET_ORIGIN && (!guivrSettings.seated && MCOpenVR.isVive)) continue; + if(o==null || o.getEnumBoolean() ){ GuiSmallButtonEx button = new GuiSmallButtonEx(var8.getOrdinal(), width, height, var8._e, var8.getButtonText()); button.enabled = var8._enabled; @@ -107,18 +144,12 @@ else if (o == VrOptions.WORLD_ROTATION_INCREMENT){ GuiSliderEx slider = new GuiSliderEx(o.returnEnumOrdinal(), width, height, o, this.guivrSettings.getKeyBinding(o), minValue, maxValue, increment, this.guivrSettings.getOptionFloatValue(o)); slider.setEventHandler(this); slider.enabled = true; + this.buttonList.add(slider); if (o == VrOptions.WORLD_ROTATION)rotationSlider = slider; } - - } - - { - - - } - - } + } + } /** * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). @@ -135,15 +166,26 @@ protected void actionPerformed(GuiButton par1GuiButton) if (par1GuiButton.id < 200 && par1GuiButton instanceof GuiSmallButtonEx) { - VRSettings.VrOptions num = VRSettings.VrOptions.getEnumOptions(par1GuiButton.id); + VRSettings.VrOptions num = VRSettings.VrOptions.getEnumOptions(par1GuiButton.id); + + if (num == VRSettings.VrOptions.PLAY_MODE_SEATED) + { + this.reinit = true; + if(mc.vrSettings.seated == false){ + this.isConfirm = true; + return; + } + } + else if(num== VRSettings.VrOptions.RESET_ORIGIN){ + MCOpenVR.resetPosition(); + Minecraft.getMinecraft().vrSettings.saveOptions(); + this.mc.displayGuiScreen(null); + this.mc.setIngameFocus(); + } + this.guivrSettings.setOptionValue(((GuiSmallButtonEx)par1GuiButton).returnVrEnumOptions(), 1); par1GuiButton.displayString = this.guivrSettings.getKeyBinding(VRSettings.VrOptions.getEnumOptions(par1GuiButton.id)); - if (num == VRSettings.VrOptions.USE_VR) - { - Minecraft.getMinecraft().reinitFramebuffers = true; - this.reinit = true; - } } else if (par1GuiButton.id == 201) { @@ -171,7 +213,7 @@ else if (par1GuiButton.id == 207) this.mc.displayGuiScreen(new GuiQuickCommandEditor(this, this.guivrSettings)); } - else if (par1GuiButton.id == 200) + else if (par1GuiButton.id == ID_GENERIC_DONE) { Minecraft.getMinecraft().vrSettings.saveOptions(); this.mc.displayGuiScreen(this.parentGuiScreen); @@ -186,20 +228,40 @@ else if (par1GuiButton.id == 210) this.guivrSettings.saveOptions(); this.mc.displayGuiScreen(new GuiOtherHUDSettings(this, this.guivrSettings)); } + else if (par1GuiButton.id == 211) + { + this.guivrSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiSeatedOptions(this, this.guivrSettings)); + } else if (par1GuiButton.id == 220) { this.guivrSettings.saveOptions(); this.mc.displayGuiScreen(new GuiVRControls(this, this.guivrSettings)); } - else if (par1GuiButton.id == 221) + else if (par1GuiButton.id == 222) + { + mc.vrSettings.seated = false; + this.guivrSettings.saveOptions(); + this.isConfirm = false; + this.reinit = true; + } + else if (par1GuiButton.id == 223) + { + mc.vrSettings.seated = true; + this.guivrSettings.saveOptions(); + this.isConfirm = false; + this.reinit = true; + } + else if (par1GuiButton.id == ID_GENERIC_DEFAULTS) { mc.vrSettings.vrReverseHands = false; mc.vrSettings.vrWorldRotation = 0; mc.vrSettings.vrWorldScale = 1; mc.vrSettings.vrWorldRotationIncrement = 45f; mc.vrSettings.seated = false; + MCOpenVR.clearOffset(); this.guivrSettings.saveOptions(); - this.initGui(); + this.reinit = true; } else if (par1GuiButton.id == PROFILES_ID) { @@ -217,29 +279,12 @@ protected String[] getTooltipLines(String displayString, int buttonId) if( e != null ) switch(e) { - case USE_VR: - return new String[] { - "Whether to enable all the fun new Virtual Reality features", - " ON: Yay Fun!", - " OFF: Sad vanilla panda: gameplay unchanged" - }; case REVERSE_HANDS: return new String[] { "Swap left/right hands as dominant", " ON: Left dominant, weirdo.", " OFF: Right dominant" }; - case USE_VR_COMFORT: - return new String[] { - "Enables view ratcheting on controller yaw or pitch input.", - "For some people this can allow a more comfortable", - "viewing experience while moving around. Known as", - "'VR Comfort Mode' (with thanks to Cloudhead Games)!", - " OFF: (Default) No view ratcheting is applied.", - " Yaw Only: View ratcheting applied to Yaw only.", - " Pitch Only: View ratcheting applied to Pitch only.", - " Yaw and Pitch: You guessed it...", - } ; case WORLD_SCALE: return new String[] { "Scales the player in the world.", @@ -266,6 +311,11 @@ protected String[] getTooltipLines(String displayString, int buttonId) "Standing is vastly superior." }; + case RESET_ORIGIN: + return new String[] { + "Recenter the player's feet in the world to 1.62m below the current", + "HMD position. For non-lighthouse tracking systems." + }; default: return null; } @@ -355,4 +405,4 @@ public boolean event(int id, String s) { return false; } -} +} \ No newline at end of file diff --git a/src/com/mtbs3d/minecrift/gui/GuiOtherHUDSettings.java b/src/com/mtbs3d/minecrift/gui/GuiOtherHUDSettings.java index 08de1bd0..9613862d 100644 --- a/src/com/mtbs3d/minecrift/gui/GuiOtherHUDSettings.java +++ b/src/com/mtbs3d/minecrift/gui/GuiOtherHUDSettings.java @@ -1,7 +1,5 @@ package com.mtbs3d.minecrift.gui; -import javax.swing.plaf.ToolBarUI; - import com.mtbs3d.minecrift.gui.framework.BaseGuiSettings; import com.mtbs3d.minecrift.gui.framework.GuiButtonEx; import com.mtbs3d.minecrift.gui.framework.GuiSliderEx; @@ -24,10 +22,8 @@ public class GuiOtherHUDSettings extends BaseGuiSettings VRSettings.VrOptions.CROSSHAIR_OCCLUSION, //VRSettings.VrOptions.MAX_CROSSHAIR_DISTANCE_AT_BLOCKREACH, //VRSettings.VrOptions.CROSSHAIR_SCALES_WITH_DISTANCE, - VRSettings.VrOptions.CHAT_FADE_AWAY, + // VRSettings.VrOptions.CHAT_FADE_AWAY, VRSettings.VrOptions.DUMMY, - VRSettings.VrOptions.CHAT_OFFSET_X, - VRSettings.VrOptions.CHAT_OFFSET_Y, }; // VIVE END - hide options not supported by tracked controller UI @@ -42,8 +38,9 @@ public GuiOtherHUDSettings(GuiScreen guiScreen, VRSettings guivrSettings) { public void initGui() { this.buttonList.clear(); - this.buttonList.add(new GuiButtonEx(ID_GENERIC_DEFAULTS, this.width / 2 - 100, this.height / 6 + 148, "Reset To Defaults")); - this.buttonList.add(new GuiButtonEx(ID_GENERIC_DONE, this.width / 2 - 100, this.height / 6 + 168, "Done")); + this.buttonList.add(new GuiButtonEx(ID_GENERIC_DEFAULTS, this.width / 2 - 155 , this.height -25 ,150,20, "Reset To Defaults")); + this.buttonList.add(new GuiButtonEx(ID_GENERIC_DONE, this.width / 2 - 155 + 160, this.height -25,150,20, "Done")); + VRSettings.VrOptions[] buttons = hudOptions; for (int var12 = 2; var12 < buttons.length + 2; ++var12) @@ -100,15 +97,9 @@ else if (par1GuiButton.id == ID_GENERIC_DEFAULTS) this.guivrSettings.crosshairScale = 1.0f; this.guivrSettings.renderBlockOutlineMode = VRSettings.RENDER_BLOCK_OUTLINE_MODE_ALWAYS; this.guivrSettings.renderInGameCrosshairMode = VRSettings.RENDER_CROSSHAIR_MODE_ALWAYS; - this.guivrSettings.crosshairRollsWithHead = false; this.guivrSettings.menuCrosshairScale = 1f; this.guivrSettings.useCrosshairOcclusion = false; - this.guivrSettings.maxCrosshairDistanceAtBlockReach = false; - this.guivrSettings.crosshairScalesWithDistance = false; - this.guivrSettings.chatOffsetX = 0; - this.guivrSettings.chatOffsetY = 0.4f; - this.guivrSettings.chatFadeAway = true; - this.guivrSettings.vrTouchHotbar = true; + Minecraft.getMinecraft().vrSettings.saveOptions(); this.reinit = true; @@ -179,7 +170,6 @@ protected String[] getTooltipLines(String displayString, int buttonId) " Stays: A number of the latest chat lines will always", " be visible." }; - default: return null; } diff --git a/src/com/mtbs3d/minecrift/gui/GuiOtherRenderOpticsSettings.java b/src/com/mtbs3d/minecrift/gui/GuiOtherRenderOpticsSettings.java index 629bfb61..cac6fd12 100644 --- a/src/com/mtbs3d/minecrift/gui/GuiOtherRenderOpticsSettings.java +++ b/src/com/mtbs3d/minecrift/gui/GuiOtherRenderOpticsSettings.java @@ -12,27 +12,12 @@ public class GuiOtherRenderOpticsSettings extends BaseGuiSettings implements Gui { static VRSettings.VrOptions[] oculusOptionsUseSingleIpd = new VRSettings.VrOptions[] { - VRSettings.VrOptions.USE_PROFILE_IPD, - VRSettings.VrOptions.CONFIG_IPD_MODE, - VRSettings.VrOptions.TOTAL_IPD, - VRSettings.VrOptions.DUMMY, - VRSettings.VrOptions.EYE_RELIEF_PLACEHOLDER, - VRSettings.VrOptions.EYE_RELIEF_ADJUST, - VRSettings.VrOptions.MAX_FOV, - VRSettings.VrOptions.FOV_CHANGE, + }; static VRSettings.VrOptions[] oculusOptionsUseTwinIpd = new VRSettings.VrOptions[] { - VRSettings.VrOptions.USE_PROFILE_IPD, - VRSettings.VrOptions.CONFIG_IPD_MODE, - VRSettings.VrOptions.LEFT_HALF_IPD, - VRSettings.VrOptions.RIGHT_HALF_IPD, - VRSettings.VrOptions.EYE_RELIEF_PLACEHOLDER, - VRSettings.VrOptions.EYE_RELIEF_ADJUST, - VRSettings.VrOptions.DUMMY, - VRSettings.VrOptions.MAX_FOV, - VRSettings.VrOptions.FOV_CHANGE, + }; public GuiOtherRenderOpticsSettings(GuiScreen guiScreen, VRSettings guivrSettings) { @@ -45,100 +30,90 @@ public GuiOtherRenderOpticsSettings(GuiScreen guiScreen, VRSettings guivrSetting */ public void initGui() { - this.buttonList.clear(); - this.buttonList.add(new GuiButtonEx(ID_GENERIC_DEFAULTS, this.width / 2 - 100, this.height / 6 + 148, "Reset To Defaults")); - this.buttonList.add(new GuiButtonEx(ID_GENERIC_DONE, this.width / 2 - 100, this.height / 6 + 168, "Done")); - String eyeRelief = "";//String.format("Base Eye Relief: %.3fmm ", new Object[] { this.mc.entityRenderer.getBaseEyeRelief() * 1000f }); - VRSettings.VrOptions[] buttons = null; - if (Minecraft.getMinecraft().vrSettings.useHalfIpds == false) - buttons = oculusOptionsUseSingleIpd; - else - buttons = oculusOptionsUseTwinIpd; - - for (int var12 = 2; var12 < buttons.length + 2; ++var12) - { - VRSettings.VrOptions var8 = buttons[var12 - 2]; - int width = this.width / 2 - 155 + var12 % 2 * 160; - int height = this.height / 6 + 21 * (var12 / 2) - 10; - - if (var8 == VRSettings.VrOptions.DUMMY) - continue; - - if (var8.getEnumFloat()) - { - float minValue = 0.0f; - float maxValue = 1.0f; - float increment = 0.01f; - - if (var8 == VRSettings.VrOptions.EYE_RELIEF_ADJUST) - { - minValue = -0.035f; - maxValue = 0.035f; - increment = 0.00001f; - } - else if (var8 == VRSettings.VrOptions.FOV_CHANGE) - { - minValue = -10f; - maxValue = 10f; - increment = 0.1f; - } - else if (var8 == VRSettings.VrOptions.TOTAL_IPD) - { - minValue = 0.055f; - maxValue = 0.075f; - increment = 0.0001f; - } - else if (var8 == VRSettings.VrOptions.LEFT_HALF_IPD) - { - minValue = -0.0375f; - maxValue = -0.0225f; - increment = 0.0001f; - } - else if (var8 == VRSettings.VrOptions.RIGHT_HALF_IPD) - { - minValue = 0.0225f; - maxValue = 0.0375f; - increment = 0.0001f; - } - - GuiSliderEx slider = new GuiSliderEx(var8.returnEnumOrdinal(), width, height, var8, this.guivrSettings.getKeyBinding(var8), minValue, maxValue, increment, this.guivrSettings.getOptionFloatValue(var8)); - slider.setEventHandler(this); - slider.enabled = getEnabledState(var8); - this.buttonList.add(slider); - } - else - { - if (var8 == VRSettings.VrOptions.EYE_RELIEF_PLACEHOLDER) - { - GuiSmallButtonEx button = new GuiSmallButtonEx(9999, width, height, var8, eyeRelief); - button.enabled = false; - this.buttonList.add(button); - } - else - { - GuiSmallButtonEx smallButton = new GuiSmallButtonEx(var8.returnEnumOrdinal(), width, height, var8, this.guivrSettings.getKeyBinding(var8)); - smallButton.setEventHandler(this); - smallButton.enabled = getEnabledState(var8); - this.buttonList.add(smallButton); - } - } - } +// this.buttonList.clear(); +// this.buttonList.add(new GuiButtonEx(ID_GENERIC_DEFAULTS, this.width / 2 - 155 , this.height -25 ,150,20, "Reset To Defaults")); +// this.buttonList.add(new GuiButtonEx(ID_GENERIC_DONE, this.width / 2 - 155 + 160, this.height -25,150,20, "Done")); +// String eyeRelief = "";//String.format("Base Eye Relief: %.3fmm ", new Object[] { this.mc.entityRenderer.getBaseEyeRelief() * 1000f }); +// VRSettings.VrOptions[] buttons = null; +// if (Minecraft.getMinecraft().vrSettings.useHalfIpds == false) +// buttons = oculusOptionsUseSingleIpd; +// else +// buttons = oculusOptionsUseTwinIpd; +// +// for (int var12 = 2; var12 < buttons.length + 2; ++var12) +// { +// VRSettings.VrOptions var8 = buttons[var12 - 2]; +// int width = this.width / 2 - 155 + var12 % 2 * 160; +// int height = this.height / 6 + 21 * (var12 / 2) - 10; +// +// if (var8 == VRSettings.VrOptions.DUMMY) +// continue; +// +// if (var8.getEnumFloat()) +// { +// float minValue = 0.0f; +// float maxValue = 1.0f; +// float increment = 0.01f; +// +// if (var8 == VRSettings.VrOptions.EYE_RELIEF_ADJUST) +// { +// minValue = -0.035f; +// maxValue = 0.035f; +// increment = 0.00001f; +// } +// else if (var8 == VRSettings.VrOptions.FOV_CHANGE) +// { +// minValue = -10f; +// maxValue = 10f; +// increment = 0.1f; +// } +// else if (var8 == VRSettings.VrOptions.TOTAL_IPD) +// { +// minValue = 0.055f; +// maxValue = 0.075f; +// increment = 0.0001f; +// } +// else if (var8 == VRSettings.VrOptions.LEFT_HALF_IPD) +// { +// minValue = -0.0375f; +// maxValue = -0.0225f; +// increment = 0.0001f; +// } +// else if (var8 == VRSettings.VrOptions.RIGHT_HALF_IPD) +// { +// minValue = 0.0225f; +// maxValue = 0.0375f; +// increment = 0.0001f; +// } +// +// GuiSliderEx slider = new GuiSliderEx(var8.returnEnumOrdinal(), width, height, var8, this.guivrSettings.getKeyBinding(var8), minValue, maxValue, increment, this.guivrSettings.getOptionFloatValue(var8)); +// slider.setEventHandler(this); +// slider.enabled = getEnabledState(var8); +// this.buttonList.add(slider); +// } +// else +// { +// if (var8 == VRSettings.VrOptions.EYE_RELIEF_PLACEHOLDER) +// { +// GuiSmallButtonEx button = new GuiSmallButtonEx(9999, width, height, var8, eyeRelief); +// button.enabled = false; +// this.buttonList.add(button); +// } +// else +// { +// GuiSmallButtonEx smallButton = new GuiSmallButtonEx(var8.returnEnumOrdinal(), width, height, var8, this.guivrSettings.getKeyBinding(var8)); +// smallButton.setEventHandler(this); +// smallButton.enabled = getEnabledState(var8); +// this.buttonList.add(smallButton); +// } +// } +// } } private boolean getEnabledState(VRSettings.VrOptions var8) { String s = var8.getEnumString(); - if (this.guivrSettings.useOculusProfileIpd) - { - if (var8 == VRSettings.VrOptions.TOTAL_IPD || - var8 == VRSettings.VrOptions.LEFT_HALF_IPD || - var8 == VRSettings.VrOptions.RIGHT_HALF_IPD) - { - return false; - } - } - return true; } @@ -169,11 +144,6 @@ protected void actionPerformed(GuiButton par1GuiButton) } else if (par1GuiButton.id == ID_GENERIC_DEFAULTS) { - this.guivrSettings.useOculusProfileIpd = true; - this.guivrSettings.setMinecraftIpd(this.guivrSettings.getOculusProfileHalfIPD(EyeType.ovrEye_Left), this.guivrSettings.getOculusProfileHalfIPD(EyeType.ovrEye_Right)); - this.guivrSettings.fovChange = 0f; - this.guivrSettings.useMaxFov = false; - this.guivrSettings.eyeReliefAdjust = 0f; Minecraft.getMinecraft().vrSettings.saveOptions(); this.reinit = true; @@ -190,17 +160,6 @@ else if (par1GuiButton instanceof GuiSmallButtonEx) @Override public boolean event(int id, VRSettings.VrOptions enumm) { - if (enumm == VRSettings.VrOptions.FOV_CHANGE || - enumm == VRSettings.VrOptions.MAX_FOV ) - { - this.mc.reinitFramebuffers = true; - } - - if (enumm == VRSettings.VrOptions.CONFIG_IPD_MODE || - enumm == VRSettings.VrOptions.USE_PROFILE_IPD) - { - this.reinit = true; - } return true; } @@ -216,59 +175,59 @@ protected String[] getTooltipLines(String displayString, int buttonId) VRSettings.VrOptions e = VRSettings.VrOptions.getEnumOptions(buttonId); if( e != null ) switch(e) - { - case EYE_RELIEF_PLACEHOLDER: - return new String[] { - "The current un-adjusted eye relief value, as reported", - "from the Oculus Profile.", - "Positive values are towards your face, negative away.", - }; - case EYE_RELIEF_ADJUST: - return new String[] { - "Adjusts the eye relief value (the distance of the HMD", - "screen from the center eye position). Positive values", - "are towards your face, negative away.", - " Adjust this if vertical lines do not seem to maintain", - " their position in the world (as you slowly rotate your", - " head from side-to-side; while keeping your gaze fixed", - " on the line).", - " Can account for squashed foam padding on the HMD etc.", - }; - case FOV_CHANGE: - return new String[] { - "Adjusts the position of the rendered distortion border.", - " Positive values: reduce the size of the distortion", - " border, possibly increasing Field-of-View (FOV) at", - " the expense of increased rendering cost.", - " Negative values: increase the size of the distortion", - " border, reducing render cost at the expense of a", - " noticeable reduction in FOV.", - }; - case USE_PROFILE_IPD: - case CONFIG_IPD_MODE: - case LEFT_HALF_IPD: - case RIGHT_HALF_IPD: - case TOTAL_IPD: - return new String[] { - "Allows adjustment of IPD if not using Oculus profile", - "settings. NOTE: It is STRONGLY RECOMMENDED to use", - "the Oculus Profile settings!!", - " Select total or half IPD configuration.", - " Adjusting the IPD manually may alter in game scale;", - " however various HMD parameters configured by", - " Oculus will not be correct. USE AT YOUR OWN RISK." - }; - case MAX_FOV: - return new String[] { - "Toggles use of the default Field-of-View (FOV),", - "or the maximum FOV possible with the specified HMD.", - " Default: Default HMD FOV. A balance of FOV versus", - " render cost.", - " Maximum: *MAY* enlarge viewable FOV at the expense of", - " increased rendering cost.", - " NOTE with the DK2, Default and Max are almost", - " identical.", - }; + { +// case EYE_RELIEF_PLACEHOLDER: +// return new String[] { +// "The current un-adjusted eye relief value, as reported", +// "from the Oculus Profile.", +// "Positive values are towards your face, negative away.", +// }; +// case EYE_RELIEF_ADJUST: +// return new String[] { +// "Adjusts the eye relief value (the distance of the HMD", +// "screen from the center eye position). Positive values", +// "are towards your face, negative away.", +// " Adjust this if vertical lines do not seem to maintain", +// " their position in the world (as you slowly rotate your", +// " head from side-to-side; while keeping your gaze fixed", +// " on the line).", +// " Can account for squashed foam padding on the HMD etc.", +// }; +// case FOV_CHANGE: +// return new String[] { +// "Adjusts the position of the rendered distortion border.", +// " Positive values: reduce the size of the distortion", +// " border, possibly increasing Field-of-View (FOV) at", +// " the expense of increased rendering cost.", +// " Negative values: increase the size of the distortion", +// " border, reducing render cost at the expense of a", +// " noticeable reduction in FOV.", +// }; +// case USE_PROFILE_IPD: +// case CONFIG_IPD_MODE: +// case LEFT_HALF_IPD: +// case RIGHT_HALF_IPD: +// case TOTAL_IPD: +// return new String[] { +// "Allows adjustment of IPD if not using Oculus profile", +// "settings. NOTE: It is STRONGLY RECOMMENDED to use", +// "the Oculus Profile settings!!", +// " Select total or half IPD configuration.", +// " Adjusting the IPD manually may alter in game scale;", +// " however various HMD parameters configured by", +// " Oculus will not be correct. USE AT YOUR OWN RISK." +// }; +// case MAX_FOV: +// return new String[] { +// "Toggles use of the default Field-of-View (FOV),", +// "or the maximum FOV possible with the specified HMD.", +// " Default: Default HMD FOV. A balance of FOV versus", +// " render cost.", +// " Maximum: *MAY* enlarge viewable FOV at the expense of", +// " increased rendering cost.", +// " NOTE with the DK2, Default and Max are almost", +// " identical.", +// }; default: return null; } diff --git a/src/com/mtbs3d/minecrift/gui/GuiRenderOpticsSettings.java b/src/com/mtbs3d/minecrift/gui/GuiRenderOpticsSettings.java index bd7c220b..b108f3ea 100644 --- a/src/com/mtbs3d/minecrift/gui/GuiRenderOpticsSettings.java +++ b/src/com/mtbs3d/minecrift/gui/GuiRenderOpticsSettings.java @@ -30,7 +30,6 @@ public class GuiRenderOpticsSettings extends BaseGuiSettings implements GuiEven VRSettings.VrOptions.MONO_FOV, VRSettings.VrOptions.DUMMY, VRSettings.VrOptions.FSAA, - VRSettings.VrOptions.FSAA_SCALEFACTOR, }; static VRSettings.VrOptions[] openVRDisplayOptions = new VRSettings.VrOptions[] { @@ -75,9 +74,8 @@ public void initGui() // this.screenTitle = var1.translateKey("options.videoTitle"); this.buttonList.clear(); - this.buttonList.add(new GuiButtonEx(ID_GENERIC_DONE, this.width / 2 - 100, this.height / 6 + 170, "Done")); - this.buttonList.add(new GuiButtonEx(ID_GENERIC_DEFAULTS, this.width / 2 - 100, this.height / 6 + 150, "Reset To Defaults")); - + this.buttonList.add(new GuiButtonEx(ID_GENERIC_DEFAULTS, this.width / 2 - 155 , this.height -25 ,150,20, "Reset To Defaults")); + this.buttonList.add(new GuiButtonEx(ID_GENERIC_DONE, this.width / 2 - 155 + 160, this.height -25,150,20, "Done")); VRSettings.VrOptions[] var10 = null; if( Minecraft.getMinecraft().stereoProvider.isStereo() ) @@ -111,12 +109,6 @@ public void initGui() maxValue = 4.0f; increment = 0.1f; } - else if (var8 == VRSettings.VrOptions.FSAA_SCALEFACTOR) - { - minValue = 0.5f; - maxValue = 2.0f; - increment = 0.1f; - } else if (var8 == VRSettings.VrOptions.MONO_FOV) { minValue = 1f; @@ -130,7 +122,7 @@ else if (var8 == VRSettings.VrOptions.MONO_FOV) } else { - if (var8 == VRSettings.VrOptions.HMD_NAME_PLACEHOLDER) + if (false) { GuiSmallButtonEx button = new GuiSmallButtonEx(9999, width, height, var8, productName); button.enabled = false; @@ -164,21 +156,14 @@ protected void actionPerformed(GuiButton par1GuiButton) } else if (par1GuiButton.id == ID_GENERIC_DEFAULTS) { - minecraft.vrSettings.useTimewarp = true; - minecraft.vrSettings.useTimewarpJitDelay = false; - minecraft.vrSettings.useVignette = true; - minecraft.vrSettings.useLowPersistence = true; - minecraft.vrSettings.useDynamicPrediction = true; + minecraft.vrSettings.renderScaleFactor = 1.0f; minecraft.vrSettings.displayMirrorMode = VRSettings.MIRROR_ON_ONE_THIRD_FRAME_RATE; minecraft.vrSettings.mixedRealityKeyColor = new Color(); minecraft.vrSettings.mixedRealityRenderHands = false; minecraft.vrSettings.insideBlockSolidColor = false; minecraft.gameSettings.fovSetting = 70f; - minecraft.vrSettings.useDisplayOverdrive = true; - minecraft.vrSettings.useHighQualityDistortion = true; minecraft.vrSettings.useFsaa = false; - minecraft.vrSettings.fsaaScaleFactor = 1.4f; minecraft.vrSettings.vrUseStencil = true; minecraft.reinitFramebuffers = true; this.guivrSettings.saveOptions(); @@ -200,13 +185,7 @@ else if (par1GuiButton instanceof GuiSmallButtonEx) par1GuiButton.displayString = this.guivrSettings.getKeyBinding(VRSettings.VrOptions.getEnumOptions(par1GuiButton.id)); } - if (num == VRSettings.VrOptions.TIMEWARP || - num == VRSettings.VrOptions.TIMEWARP_JIT_DELAY || - num == VRSettings.VrOptions.VIGNETTE || - num == VRSettings.VrOptions.MIRROR_DISPLAY || - num == VRSettings.VrOptions.LOW_PERSISTENCE || - num == VRSettings.VrOptions.DYNAMIC_PREDICTION || - num == VRSettings.VrOptions.OVERDRIVE_DISPLAY || + if (num == VRSettings.VrOptions.MIRROR_DISPLAY || num == VRSettings.VrOptions.FSAA) { minecraft.reinitFramebuffers = true; @@ -232,8 +211,7 @@ public boolean event(int id, VRSettings.VrOptions enumm) { boolean ret = false; - if (enumm == VRSettings.VrOptions.RENDER_SCALEFACTOR || - enumm == VRSettings.VrOptions.FSAA_SCALEFACTOR) + if ( enumm == VRSettings.VrOptions.RENDER_SCALEFACTOR) { Minecraft.getMinecraft().reinitFramebuffers = true; ret = true; @@ -295,33 +273,7 @@ protected String[] getTooltipLines(String displayString, int buttonId) "Uses a fancier method of resampling the", "game before sending it to the HMD. Works best", "at high render scales. "}; - case CHROM_AB_CORRECTION: - return new String[] { - "Chromatic aberration correction", - "Corrects for color distortion due to lenses", - " OFF - no correction", - " ON - correction applied"} ; - case TIMEWARP: - return new String[] { - "Reduces perceived head track latency by sampling sensor", - "position just before the view is presented to your eyes,", - "and rotating the rendered view subtly to match the new", - "sensor orientation.", - " ON - Timewarp applied. Some ghosting may be observed", - " during fast changes of head position.", - " OFF - No timewarp applied, higher latency head", - " tracking." - }; - case TIMEWARP_JIT_DELAY: - return new String[] { - "Enables a spin-wait that tries to push time-warp to", - "be as close to V-sync as possible. WARNING - this", - "may backfire and cause framerate loss and / or","" + - "judder- use with caution.", - " ON - Timewarp JIT delay applied. Lowest latency.", - " OFF - (Default) No timewarp JIT delay applied,", - " slightly higher latency head tracking." - }; + case RENDER_SCALEFACTOR: return new String[] { "The internal rendering scale of the game, relative", @@ -357,55 +309,7 @@ protected String[] getTooltipLines(String displayString, int buttonId) "The FOV used for the mixed reality and", "undistorted mirror modes." }; - case DYNAMIC_PREDICTION: - return new String[]{ - "If supported by your HMD, reduces perceived head", - " track latency by continually monitoring to head", - "to screen latency, and adjusting the frame-timing", - "appropriately.", - " ON - Dynamic prediction applied. A small", - " coloured square will be seen in the top", - " right of any mirrored display", - " OFF - Not applied." - }; - case OVERDRIVE_DISPLAY: - return new String[] { - "If supported by your HMD, attempts to reduce", - "perceived image smearing during black-to-", - "bright transitions.", - " ON - Smearing may be reduced.", - " OFF - Not applied." - }; - case LOW_PERSISTENCE: - return new String[] { - "If supported by your HMD, displays each frame on the", - "the HMDs OLED screen for a very short period of time.", - "This greatly reduces perceived blurring during head", - "motion.", - " ON - Low persistence reduces image blur on", - " head movement.", - " OFF - Not applied." - }; - case VIGNETTE: - return new String[] { - "If enabled, blurs the edges of the distortion", - "displayed for each eye, making the edges less", - "noticeable at the edges of your field of view.", - " ON - FOV edges blurred.", - " OFF - No burring of distortion edges. The edge", - " of distortion may be more noticeable", - " within your field of view." - }; - case HIGH_QUALITY_DISTORTION: - return new String[] { - "If enabled, and render scale is greater than one,", - "uses an improved downsampling algorithm to anti-", - "alias the image.", - " ON - Higher quality if render scale is increased", - " above 1. May increase perceived latency", - " slightly.", - " OFF - Standard downsampling algorithm used. Faster." - }; + case OTHER_RENDER_SETTINGS: return new String[] { "Configure IPD and FOV border settings." @@ -434,11 +338,6 @@ private boolean getEnabledState(VRSettings.VrOptions var8) { String s = var8.getEnumString(); - if (var8 == VRSettings.VrOptions.CHROM_AB_CORRECTION) - { - return false; - } - return true; } } diff --git a/src/com/mtbs3d/minecrift/gui/GuiSeatedOptions.java b/src/com/mtbs3d/minecrift/gui/GuiSeatedOptions.java new file mode 100644 index 00000000..7e0b8114 --- /dev/null +++ b/src/com/mtbs3d/minecrift/gui/GuiSeatedOptions.java @@ -0,0 +1,201 @@ +package com.mtbs3d.minecrift.gui; + +import com.mtbs3d.minecrift.gui.framework.BaseGuiSettings; +import com.mtbs3d.minecrift.gui.framework.GuiButtonEx; +import com.mtbs3d.minecrift.gui.framework.GuiEventEx; +import com.mtbs3d.minecrift.gui.framework.GuiSliderEx; +import com.mtbs3d.minecrift.gui.framework.GuiSmallButtonEx; +import com.mtbs3d.minecrift.provider.MCOpenVR; +import com.mtbs3d.minecrift.settings.VRSettings; +import com.mtbs3d.minecrift.settings.VRSettings.VrOptions; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; + +public class GuiSeatedOptions extends BaseGuiSettings implements GuiEventEx +{ + static VRSettings.VrOptions[] seatedOptions = new VRSettings.VrOptions[] { + VRSettings.VrOptions.X_SENSITIVITY, + VRSettings.VrOptions.Y_SENSITIVITY, + VRSettings.VrOptions.KEYHOLE, + + }; + + + static VRSettings.VrOptions[] teleportSettings = new VRSettings.VrOptions[] + { + VRSettings.VrOptions.LIMIT_TELEPORT, + VRSettings.VrOptions.SIMULATE_FALLING + + }; + static VRSettings.VrOptions[] freeMoveSettings = new VRSettings.VrOptions[] + { + + }; + + public GuiSeatedOptions(GuiScreen guiScreen, VRSettings guivrSettings) { + super( guiScreen, guivrSettings ); + screenTitle = "Seated Settings"; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + this.buttonList.add(new GuiButtonEx(ID_GENERIC_DEFAULTS, this.width / 2 - 155 , this.height -25 ,150,20, "Reset To Defaults")); + this.buttonList.add(new GuiButtonEx(ID_GENERIC_DONE, this.width / 2 - 155 + 160, this.height -25,150,20, "Done")); + + GuiSmallButtonEx mode = new GuiSmallButtonEx(VRSettings.VrOptions.MOVE_MODE.returnEnumOrdinal(), this.width / 2 - 68, this.height / 6 + 80,VRSettings.VrOptions.MOVE_MODE, this.guivrSettings.getKeyBinding(VRSettings.VrOptions.MOVE_MODE)); + mode.setEventHandler(this); + this.buttonList.add(mode); + + VRSettings.VrOptions[] buttons = seatedOptions; + + addButtons(buttons, 0); + + if(mc.vrSettings.vrFreeMove) + addButtons(freeMoveSettings,105); + else + addButtons(teleportSettings,105); + + } + + private void addButtons(VRSettings.VrOptions[] buttons, int y) { + for (int var12 = 2; var12 < buttons.length + 2; ++var12) + { + VRSettings.VrOptions var8 = buttons[var12 - 2]; + int width = this.width / 2 - 155 + var12 % 2 * 160; + int height = this.height / 6 + 21 * (var12 / 2) - 10 + y; + + if (var8 == VRSettings.VrOptions.DUMMY) + continue; + + if (var8.getEnumFloat()) + { + float minValue = 0.0f; + float maxValue = 1.0f; + float increment = 0.01f; + + if (var8 == VRSettings.VrOptions.X_SENSITIVITY) + { + minValue = 0.1f; + maxValue = 5f; + increment = 0.01f; + } + else if (var8 == VRSettings.VrOptions.Y_SENSITIVITY) + { + minValue = 0.1f; + maxValue = 5f; + increment = 0.01f; + } + else if (var8 == VRSettings.VrOptions.KEYHOLE) + { + minValue = 0f; + maxValue = 40f; + increment = 5f; + } + + this.buttonList.add(new GuiSliderEx(var8.returnEnumOrdinal(), width, height, var8, this.guivrSettings.getKeyBinding(var8), minValue, maxValue, increment, this.guivrSettings.getOptionFloatValue(var8))); + } + else + { + this.buttonList.add(new GuiSmallButtonEx(var8.returnEnumOrdinal(), width, height, var8, this.guivrSettings.getKeyBinding(var8))); + } + } + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == ID_GENERIC_DONE) + { + Minecraft.getMinecraft().vrSettings.saveOptions(); + this.mc.displayGuiScreen(this.parentGuiScreen); + } + else if (par1GuiButton.id == ID_GENERIC_DEFAULTS) + { + VRSettings vrSettings=Minecraft.getMinecraft().vrSettings; + vrSettings.keyholeX=15; + vrSettings.xSensitivity=1; + vrSettings.ySensitivity=1; + vrSettings.vrFreeMove = true; + + Minecraft.getMinecraft().vrSettings.saveOptions(); + this.reinit = true; + } + + else if (par1GuiButton instanceof GuiSmallButtonEx) + { + VRSettings.VrOptions num = VRSettings.VrOptions.getEnumOptions(par1GuiButton.id); + this.guivrSettings.setOptionValue(((GuiSmallButtonEx)par1GuiButton).returnVrEnumOptions(), 1); + par1GuiButton.displayString = this.guivrSettings.getKeyBinding(VRSettings.VrOptions.getEnumOptions(par1GuiButton.id)); + + if(num == VRSettings.VrOptions.MOVE_MODE){ + this.reinit = true; + } + } + } + } + + @Override + protected String[] getTooltipLines(String displayString, int buttonId) + { + VRSettings.VrOptions e = VRSettings.VrOptions.getEnumOptions(buttonId); + if( e != null ) + switch(e) + { + case KEYHOLE: + return new String[] { + "The number of degrees to the left and right of center", + "Where the view will begin to rotate." + }; + case X_SENSITIVITY: + return new String[] { + "Speed the view will rotate when pushed on the edge of the keyhole" + }; + case Y_SENSITIVITY: + return new String[] { + "Vertical speed of the crosshair related to the mouse" + }; + case MOVE_MODE: + return new String[] { + "Free Move with WASD or Teleport with W" + }; + case LIMIT_TELEPORT: + return new String[] { + "If enabled the arc teleporter will be have restrictions", + "in survival mode. It will not be able to jump up the side", + "of blocks, it will consume food, and it will have an energy", + "bar that refills over time." + } ; + case SIMULATE_FALLING: + return new String[] { + "If enabled the player will falls to the ground in TP mode", + "when standing above empty space. Also allows jumping" + } ; + default: + return null; + } + else{ + + } + return null; + } + + @Override + public boolean event(int id, VrOptions enumm) { + return true; + } + + @Override + public boolean event(int id, String s) { + return true; + } +} diff --git a/src/com/mtbs3d/minecrift/main/VivecraftMain.java b/src/com/mtbs3d/minecrift/main/VivecraftMain.java index 8f3d6e8e..9ea31fe4 100644 --- a/src/com/mtbs3d/minecrift/main/VivecraftMain.java +++ b/src/com/mtbs3d/minecrift/main/VivecraftMain.java @@ -23,6 +23,7 @@ public class VivecraftMain private static final String smcName = "shadersmodcore.transform.SMCClassTransformer"; private static final String[] encapsulatedTransformers = new String[]{ smcName, + "jp.mc.ancientred.starminer.core.SMTransformer", // lol this is so not going to work }; private static final String[] removedTransformers = new String[]{ "com.pau101.fairylights.core.FairyLightsClassTransformer", // Get out of our EntityRenderer @@ -52,6 +53,15 @@ public static void main(String[] p_main_0_) if (t.getClass().getName().equals("cpw.mods.fml.common.asm.transformers.DeobfuscationTransformer")) { passedDeobf = true; } + if (t.getClass().getName().equals("jp.mc.ancientred.starminer.core.SMTransformer")) { + System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + System.out.println("WARNING: STARMINER DETECTED - STUFF IS PROBABLY GOING TO EXPLODE HORRIBLY"); + System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + } for (String dt : encapsulatedTransformers) { if (t.getClass().getName().equals(dt)) { if (passedDeobf || t.getClass().getName().equals(smcName)) { diff --git a/src/com/mtbs3d/minecrift/provider/MCOpenVR.java b/src/com/mtbs3d/minecrift/provider/MCOpenVR.java index bbab5866..cedbd978 100644 --- a/src/com/mtbs3d/minecrift/provider/MCOpenVR.java +++ b/src/com/mtbs3d/minecrift/provider/MCOpenVR.java @@ -37,6 +37,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.network.play.client.C16PacketClientStatus; import net.minecraft.src.VertexData; +import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import optifine.Utils; @@ -107,6 +108,14 @@ public class MCOpenVR private static double timePerFrame, frameCountRun; private static long frameCount; + public static Vec3History hmdHistory = new Vec3History(); + public static Vec3History hmdPivotHistory = new Vec3History(); + public static Vec3History[] controllerHistory = new Vec3History[] { new Vec3History(), new Vec3History()}; + + public static boolean isVive=true; + + static Vector3f offset=new Vector3f(0,0,0); + // TextureIDs of framebuffers for each eye private int LeftEyeTextureId; @@ -269,11 +278,30 @@ public static boolean init() throws Exception mc = Minecraft.getMinecraft(); // look in .minecraft first for openvr_api.dll File minecraftDir = Utils.getWorkingDirectory(); + + String osname = System.getProperty("os.name").toLowerCase(); + String osarch= System.getProperty("os.arch").toLowerCase(); + String osFolder = "win32"; - if (System.getProperty("os.arch").contains("64")) - { - osFolder = "win64"; + + if (osname.contains("windows")){ + if (osarch.contains("64")) + { + osFolder = "win64"; + } } + else if( osname.contains("linux")){ + osFolder = "linux32"; + if (osarch.contains("64")) + { + osFolder = "linux64"; + } + } + else if( osname.contains("mac")){ + osFolder = "osx32"; + } + + File openVRDir = new File( minecraftDir, osFolder ); String openVRPath = openVRDir.getPath(); System.out.println( "Adding OpenVR search path: "+openVRPath); @@ -291,6 +319,7 @@ public static boolean init() throws Exception initOpenVROverlay() ; initOpenVROSettings(); } catch (Exception e) { + e.printStackTrace(); initSuccess = false; initStatus = e.getLocalizedMessage(); return false; @@ -303,7 +332,7 @@ public static boolean init() throws Exception for(int i=0;i 0 ) ; boolean lastpressedRAppMenu = (lastControllerState[RIGHT_CONTROLLER].ulButtonPressed & k_buttonAppMenu) > 0; boolean lastpressedRTrigger = lastControllerState[RIGHT_CONTROLLER].rAxis[k_EAxis_Trigger].x > triggerThreshold; - boolean lastpressedRTriggerClick =( lastControllerState[RIGHT_CONTROLLER].ulButtonPressed & k_buttonTrigger )>0; + boolean lastpressedRTriggerClick = lastControllerState[RIGHT_CONTROLLER].rAxis[k_EAxis_Trigger].x > 0.99F; //current boolean pressedRGrip = (controllerStateReference[RIGHT_CONTROLLER].ulButtonPressed & k_buttonGrip) > 0; boolean pressedRtouchpadBottomLeft = (controllerStateReference[RIGHT_CONTROLLER].ulButtonPressed & k_buttonTouchpad) > 0 && @@ -1071,67 +1147,68 @@ private static void processControllerButtons() (controllerStateReference[RIGHT_CONTROLLER].rAxis[k_EAxis_TouchPad].x > 0 ) ; boolean pressedRAppMenu = (controllerStateReference[RIGHT_CONTROLLER].ulButtonPressed & k_buttonAppMenu) > 0; boolean pressedRTrigger = controllerStateReference[RIGHT_CONTROLLER].rAxis[k_EAxis_Trigger].x > triggerThreshold; - boolean pressedRTriggerClick =( controllerStateReference[RIGHT_CONTROLLER].ulButtonPressed & k_buttonTrigger )>0; + boolean pressedRTriggerClick = controllerStateReference[RIGHT_CONTROLLER].rAxis[k_EAxis_Trigger].x > 0.99F; rtbX = controllerStateReference[RIGHT_CONTROLLER].rAxis[k_EAxis_TouchPad].x; rtbY = controllerStateReference[RIGHT_CONTROLLER].rAxis[k_EAxis_TouchPad].y; - //R GRIP - if (pressedRGrip && !lastpressedRGrip) { - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_GRIP.ordinal()].press(); - } + boolean gui = (mc.currentScreen != null); + + if(!gui){ + //R GRIP + if (pressedRGrip && !lastpressedRGrip) { + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_GRIP.ordinal()].press(); + } + //R TOUCHPAD + if (pressedRtouchpadBottomLeft && !lastpressedRtouchpadBottomLeft){ + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TOUCHPAD_BL.ordinal()].press(); + } + if (pressedRtouchpadBottomRight && !lastpressedRtouchpadBottomRight){ + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TOUCHPAD_BR.ordinal()].press(); + } + if (pressedRtouchpadTopLeft && !lastpressedRtouchpadTopLeft){ + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TOUCHPAD_UL.ordinal()].press(); + } + if (pressedRtouchpadTopRight && !lastpressedRtouchpadTopRight ){ + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TOUCHPAD_UR.ordinal()].press(); + } + //R TRIGGER + if (pressedRTrigger && !lastpressedRTrigger) { + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TRIGGER.ordinal()].press(); + } + //R AppMenu + if (pressedRAppMenu && !lastpressedRAppMenu) { + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_APPMENU.ordinal()].press(); + } + //R triggerclick + if (pressedRTriggerClick && !lastpressedRTriggerClick) { + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TRIGGER_FULLCLICK.ordinal()].press(); + } + } + if(!pressedRGrip && lastpressedRGrip) { mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_GRIP.ordinal()].unpress(); } - //R TOUCHPAD - - //if(!gui){ //this are the mouse buttons. ummm do I need this? it causes the key to stick down. - - if (pressedRtouchpadBottomLeft && !lastpressedRtouchpadBottomLeft){ - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TOUCHPAD_BL.ordinal()].press(); - } if (!pressedRtouchpadBottomLeft && lastpressedRtouchpadBottomLeft){ mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TOUCHPAD_BL.ordinal()].unpress(); - } - if (pressedRtouchpadBottomRight && !lastpressedRtouchpadBottomRight){ - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TOUCHPAD_BR.ordinal()].press(); - } + } if (!pressedRtouchpadBottomRight && lastpressedRtouchpadBottomRight){ mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TOUCHPAD_BR.ordinal()].unpress(); } - if (pressedRtouchpadTopLeft && !lastpressedRtouchpadTopLeft){ - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TOUCHPAD_UL.ordinal()].press(); } if (!pressedRtouchpadTopLeft && lastpressedRtouchpadTopLeft){ mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TOUCHPAD_UL.ordinal()].unpress(); - } - if (pressedRtouchpadTopRight && !lastpressedRtouchpadTopRight ){ - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TOUCHPAD_UR.ordinal()].press(); } + } if (!pressedRtouchpadTopRight && lastpressedRtouchpadTopRight ){ mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TOUCHPAD_UR.ordinal()].unpress(); } - - //R TRIGGER - if (pressedRTrigger && !lastpressedRTrigger) { - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TRIGGER.ordinal()].press(); - } - if(!pressedRTrigger && lastpressedRTrigger) { - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TRIGGER.ordinal()].unpress(); - } - // } - - //R AppMenu - if (pressedRAppMenu && !lastpressedRAppMenu) { - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_APPMENU.ordinal()].press(); - } + //R TRIGGER + if(!pressedRTrigger && lastpressedRTrigger) { + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TRIGGER.ordinal()].unpress(); + } if(!pressedRAppMenu && lastpressedRAppMenu) { mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_APPMENU.ordinal()].unpress(); } - - //R triggerclick - if (pressedRTriggerClick && !lastpressedRTriggerClick) { - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TRIGGER_FULLCLICK.ordinal()].press(); - } if(!pressedRTriggerClick && lastpressedRTriggerClick) { mc.vrSettings.buttonMappings[ViveButtons.BUTTON_RIGHT_TRIGGER_FULLCLICK.ordinal()].unpress(); } @@ -1155,7 +1232,7 @@ private static void processControllerButtons() (lastControllerState[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].x > 0 ) ; boolean lastpressedLAppMenu = (lastControllerState[LEFT_CONTROLLER].ulButtonPressed & k_buttonAppMenu) > 0; boolean lastpressedLTrigger = lastControllerState[LEFT_CONTROLLER].rAxis[k_EAxis_Trigger].x > triggerThreshold; - boolean lastpressedLTriggerClick =( lastControllerState[LEFT_CONTROLLER].ulButtonPressed & k_buttonTrigger )>0; + boolean lastpressedLTriggerClick = lastControllerState[LEFT_CONTROLLER].rAxis[k_EAxis_Trigger].x > 0.99F; //current boolean pressedLGrip = (controllerStateReference[LEFT_CONTROLLER].ulButtonPressed & k_buttonGrip) > 0; boolean pressedLtouchpadBottomLeft = (controllerStateReference[LEFT_CONTROLLER].ulButtonPressed & k_buttonTouchpad) > 0 && @@ -1172,68 +1249,67 @@ private static void processControllerButtons() (controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_TouchPad].x > 0 ) ; boolean pressedLAppMenu = (controllerStateReference[LEFT_CONTROLLER].ulButtonPressed & k_buttonAppMenu) > 0; boolean pressedLTrigger = controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_Trigger].x > triggerThreshold; - boolean pressedLTriggerClick =( controllerStateReference[LEFT_CONTROLLER].ulButtonPressed & k_buttonTrigger )>0; + boolean pressedLTriggerClick = controllerStateReference[LEFT_CONTROLLER].rAxis[k_EAxis_Trigger].x > 0.99F; - //l GRIP - if (pressedLGrip && !lastpressedLGrip) { - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_GRIP.ordinal()].press(); - } - if(!pressedLGrip && lastpressedLGrip) { - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_GRIP.ordinal()].unpress(); - } - //l TOUCHPAD + if(!gui){ + //l GRIP - no gui cause shift. + if (pressedLGrip && !lastpressedLGrip) { + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_GRIP.ordinal()].press(); + } + } if (pressedLtouchpadBottomLeft && !lastpressedLtouchpadBottomLeft){ mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TOUCHPAD_BL.ordinal()].press(); - } + } + if (pressedLtouchpadBottomRight && !lastpressedLtouchpadBottomRight){ + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TOUCHPAD_BR.ordinal()].press(); + } + if (pressedLtouchpadTopLeft && !lastpressedLtouchpadTopLeft){ + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TOUCHPAD_UL.ordinal()].press(); + } + if (pressedLtouchpadTopRight && !lastpressedLtouchpadTopRight ){ + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TOUCHPAD_UR.ordinal()].press(); + } + //L TRIGGER + if (pressedLTrigger && !lastpressedLTrigger) { + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TRIGGER.ordinal()].press(); + } + if (pressedLAppMenu && !lastpressedLAppMenu) { + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_APPMENU.ordinal()].press(); + } + //L triggerclick + if (pressedLTriggerClick && !lastpressedLTriggerClick) { + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TRIGGER_FULLCLICK.ordinal()].press(); + } + + + if(!pressedLGrip && lastpressedLGrip) { + mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_GRIP.ordinal()].unpress(); + } if (!pressedLtouchpadBottomLeft && lastpressedLtouchpadBottomLeft){ mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TOUCHPAD_BL.ordinal()].unpress(); } - if (pressedLtouchpadBottomRight && !lastpressedLtouchpadBottomRight){ - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TOUCHPAD_BR.ordinal()].press(); - } if (!pressedLtouchpadBottomRight && lastpressedLtouchpadBottomRight){ mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TOUCHPAD_BR.ordinal()].unpress(); } - if (pressedLtouchpadTopLeft && !lastpressedLtouchpadTopLeft){ - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TOUCHPAD_UL.ordinal()].press(); } if (!pressedLtouchpadTopLeft && lastpressedLtouchpadTopLeft){ mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TOUCHPAD_UL.ordinal()].unpress(); } - if (pressedLtouchpadTopRight && !lastpressedLtouchpadTopRight ){ - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TOUCHPAD_UR.ordinal()].press(); } if (!pressedLtouchpadTopRight && lastpressedLtouchpadTopRight ){ mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TOUCHPAD_UR.ordinal()].unpress(); } - - //L TRIGGER - if (pressedLTrigger && !lastpressedLTrigger) { - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TRIGGER.ordinal()].press(); - } if(!pressedLTrigger && lastpressedLTrigger) { mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TRIGGER.ordinal()].unpress(); } - - //L AppMenu - if (pressedLAppMenu && !lastpressedLAppMenu) { - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_APPMENU.ordinal()].press(); - } if(!pressedLAppMenu && lastpressedLAppMenu) { mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_APPMENU.ordinal()].unpress(); } - - //L triggerclick - if (pressedLTriggerClick && !lastpressedLTriggerClick) { - mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TRIGGER_FULLCLICK.ordinal()].press(); - } if(!pressedLTriggerClick && lastpressedLTriggerClick) { mc.vrSettings.buttonMappings[ViveButtons.BUTTON_LEFT_TRIGGER_FULLCLICK.ordinal()].unpress(); } - boolean gui = (mc.currentScreen != null); - //VIVE SPECIFIC FUNCTIONALITY //TODO: Find a better home for these in Minecraft.java @@ -1339,17 +1415,14 @@ private static void processControllerButtons() mc.thePlayer.closeScreen(); } + //handle movementtoggle if (pressedRGrip) { if(mc.vrSettings.vrAllowLocoModeSwotch){ moveModeSwitchcount++; if (moveModeSwitchcount >= 20 * 4) { - moveModeSwitchcount = 0; - if(mc.vrPlayer.noTeleportClient && mc.vrPlayer.getFreeMoveMode()){ - mc.printChatMessage("Warning: This server may not allow teleporting."); - } + moveModeSwitchcount = 0; mc.vrPlayer.setFreeMoveMode(!mc.vrPlayer.getFreeMoveMode()); - mc.printChatMessage("Movement mode set to: " + (mc.vrPlayer.getFreeMoveMode() ? "Free Move" : "Teleport")); } } } else { @@ -1419,6 +1492,9 @@ private static void pollInputEvents() String str = new String(inbytes,0,len, StandardCharsets.UTF_8); KeyboardSimulator.type(str); //holy shit it works. break; + case EVREventType.EVREventType_VREvent_Quit: + Minecraft.getMinecraft().shutdown(); + break; default: break; } @@ -1592,8 +1668,7 @@ private static void updatePose() static Vec3 getCenterEyePosition() { Vector3f pos = OpenVRUtil.convertMatrix4ftoTranslationVector(hmdPose); - // not sure why the negative y is required here - no more! - return Vec3.createVectorHelper(pos.x, pos.y, pos.z); + return Vec3.createVectorHelper(pos.x + offset.x, pos.y + offset.y, pos.z + offset.z); } /** @@ -1616,40 +1691,14 @@ static Vec3 getEyePosition(renderPass eye) if(hmdToEye == null){ Matrix4f pose = hmdPose; Vector3f pos = OpenVRUtil.convertMatrix4ftoTranslationVector(pose); - return Vec3.createVectorHelper(pos.x, pos.y, pos.z); + return Vec3.createVectorHelper(pos.x + offset.x, pos.y + offset.y, pos.z + offset.z); } else { Matrix4f pose = Matrix4f.multiply( hmdPose, hmdToEye ); Vector3f pos = OpenVRUtil.convertMatrix4ftoTranslationVector(pose); - return Vec3.createVectorHelper(pos.x, pos.y, pos.z); + return Vec3.createVectorHelper(pos.x + offset.x, pos.y + offset.y, pos.z + offset.z); } } - /** - * Resets the current origin position - */ - - public void resetOrigin() - { - // not needed with Lighthouse - } - - /** - * Resets the current origin rotation - */ - - public void resetOriginRotation() - { - // not needed with Lighthouse - } - - /** - * Enables prediction/filtering - */ - - public void setPrediction(float delta, boolean enable) - { - // n/a - } /** * Gets the Yaw(Y) from YXZ Euler angle representation of orientation @@ -1727,18 +1776,18 @@ static void onGuiScreenChanged(GuiScreen previousScreen, GuiScreen newScreen) } - // i am dead view / now uses main menu room + // i am dead view if (mc.thePlayer!=null && !mc.thePlayer.isEntityAlive()) { Matrix4f rot = Matrix4f.rotationY((float) Math.toRadians(mc.vrSettings.vrWorldRotation)); Matrix4f max = Matrix4f.multiply(rot, MCOpenVR.hmdRotation); - MCOpenVR.guiScale = 1.0f*mc.vrSettings.vrWorldScale; + MCOpenVR.guiScale = 1.0f*mc.vrPlayer.worldScale; Vec3 v = mc.entityRenderer.getEyeRenderPos(renderPass.Center); Vec3 d = mc.roomScale.getHMDDir_World(); guiPos_World = new Vector3f( - (float) (v.xCoord + d.xCoord*mc.vrSettings.vrWorldScale), - (float) (v.yCoord + d.yCoord*mc.vrSettings.vrWorldScale), - (float) (v.zCoord + d.zCoord*mc.vrSettings.vrWorldScale)); + (float) (v.xCoord + d.xCoord*mc.vrPlayer.worldScale), + (float) (v.yCoord + d.yCoord*mc.vrPlayer.worldScale), + (float) (v.zCoord + d.zCoord*mc.vrPlayer.worldScale)); Quatf orientationQuat = OpenVRUtil.convertMatrix4ftoRotationQuat(max); @@ -1767,7 +1816,7 @@ static void onGuiScreenChanged(GuiScreen previousScreen, GuiScreen newScreen) if(appearOverBlock && mc.objectMouseOver !=null){ - guiScale =(float) (Math.sqrt(mc.vrSettings.vrWorldScale) * 2); + guiScale =(float) (Math.sqrt(mc.vrPlayer.worldScale) * 2); guiPos_World =new Vector3f((float) mc.objectMouseOver.blockX + 0.5f, (float) mc.objectMouseOver.blockY + 1.7f, (float) mc.objectMouseOver.blockZ + 0.5f); @@ -1800,16 +1849,16 @@ static void onGuiScreenChanged(GuiScreen previousScreen, GuiScreen newScreen) Vec3 e = mc.roomScale.getCustomHMDVector(adj); guiPos_World = new Vector3f( - (float) (e.xCoord * mc.vrSettings.vrWorldScale / 2 + v.xCoord), - (float) (e.yCoord* mc.vrSettings.vrWorldScale / 2 + v.yCoord), - (float) (e.zCoord* mc.vrSettings.vrWorldScale / 2 + v.zCoord)); + (float) (e.xCoord * mc.vrPlayer.worldScale / 2 + v.xCoord), + (float) (e.yCoord* mc.vrPlayer.worldScale / 2 + v.yCoord), + (float) (e.zCoord* mc.vrPlayer.worldScale / 2 + v.zCoord)); Matrix4f hmd = hmdRotation; Matrix4f cont = controllerRotation[0]; Matrix4f rot = Matrix4f.rotationY((float) Math.toRadians(mc.vrSettings.vrWorldRotation)); hmd = Matrix4f.multiply(hmd, rot); cont = Matrix4f.multiply(cont, rot); - guiScale = mc.vrSettings.vrWorldScale; + guiScale = mc.vrPlayer.worldScale; if(mc.theWorld == null) guiScale = 2.0f; guiRotationPose = Matrix4f.rotationY((float) Math.toRadians( getHeadYawDegrees() + mc.vrSettings.vrWorldRotation)); @@ -1914,6 +1963,7 @@ public Vec3 getSmoothedAimVelocity(int controller) } static Vec3 getAimSource( int controller ) { + if(!mc.vrSettings.seated) return Vec3.createVectorHelper(aimSource[controller].xCoord + offset.x, aimSource[controller].yCoord + offset.y, aimSource[controller].zCoord + offset.z); return Vec3.createVectorHelper(aimSource[controller].xCoord, aimSource[controller].yCoord, aimSource[controller].zCoord); } @@ -1950,8 +2000,13 @@ private static void updateAim() { headDirection = hmdRotation.transform(forward); + Vec3 eye = getCenterEyePosition(); + hmdHistory.add(eye); + Vector3f v3 = MCOpenVR.hmdRotation.transform(new Vector3f(0,-.1f, .1f)); + hmdPivotHistory.add(Vec3.createVectorHelper(v3.x+eye.xCoord, v3.y+eye.yCoord, v3.z+eye.zCoord)); + if(mc.vrSettings.seated){ - controllerPose[0] = hmdPose.inverted().inverted(); + controllerPose[0] = hmdPose.inverted().inverted(); //copy controllerPose[1] = hmdPose.inverted().inverted(); } @@ -1961,6 +2016,8 @@ private static void updateAim() { aimSource[0].yCoord = controllerPos.y; aimSource[0].zCoord = controllerPos.z; + controllerHistory[0].add(aimSource[0]); + // build matrix describing controller rotation controllerRotation[0].M[0][0] = controllerPose[0].M[0][0]; controllerRotation[0].M[0][1] = controllerPose[0].M[0][1]; @@ -1986,25 +2043,41 @@ private static void updateAim() { float vRange = 180; double h = Mouse.getX() / (double) mc.displayWidth * hRange - (hRange / 2); double v = Mouse.getY() / (double) mc.displayHeight * vRange - (vRange / 2); - + + double nPitch=-v; + if(Display.isActive()){ - float rotStart = 30; - float rotSpeed = 180; // Degrees per second + float rotStart = mc.vrSettings.keyholeX; + float rotSpeed = 2000 * mc.vrSettings.xSensitivity; + int leftedge=(int)((-rotStart + (hRange / 2)) *(double) mc.displayWidth / hRange )+1; + int rightedge=(int)((rotStart + (hRange / 2)) *(double) mc.displayWidth / hRange )-1; float rotMul = ((float)Math.abs(h) - rotStart) / ((hRange / 2) - rotStart); // Scaled 0...1 from rotStart to FOV edge + if(rotMul > 0.15) rotMul = 0.15f; + if(h < -rotStart){ mc.vrSettings.vrWorldRotation += rotSpeed * rotMul * mc.getFrameDelta(); mc.vrSettings.vrWorldRotation %= 360; // Prevent stupidly large values hmdForwardYaw = (float)Math.toDegrees(Math.atan2(headDirection.x, headDirection.z)); mc.vrPlayer.checkandUpdateRotateScale(true); + Mouse.setCursorPosition(leftedge,Mouse.getY()); + h=-rotStart; } if(h > rotStart){ mc.vrSettings.vrWorldRotation -= rotSpeed * rotMul * mc.getFrameDelta(); mc.vrSettings.vrWorldRotation %= 360; // Prevent stupidly large values hmdForwardYaw = (float)Math.toDegrees(Math.atan2(headDirection.x, headDirection.z)); mc.vrPlayer.checkandUpdateRotateScale(true); + Mouse.setCursorPosition(rightedge,Mouse.getY()); + h=rotStart; } + + double ySpeed=0.5 * mc.vrSettings.ySensitivity; + nPitch=aimPitch+(v)*ySpeed; + nPitch=MathHelper.clamp_double(nPitch,-90,90); + Mouse.setCursorPosition(Mouse.getX(),mc.displayHeight/2); + } - temp.rotate((float) Math.toRadians(-v), new org.lwjgl.util.vector.Vector3f(1,0,0)); + temp.rotate((float) Math.toRadians(-nPitch), new org.lwjgl.util.vector.Vector3f(1,0,0)); temp.rotate((float) Math.toRadians(-180 + h - hmdForwardYaw), new org.lwjgl.util.vector.Vector3f(0,1,0)); @@ -2034,6 +2107,8 @@ private static void updateAim() { aimSource[1].yCoord = leftControllerPos.y; aimSource[1].zCoord = leftControllerPos.z; + controllerHistory[1].add(aimSource[1]); + // build matrix describing controller rotation controllerRotation[1].M[0][0] = controllerPose[1].M[0][0]; controllerRotation[1].M[0][1] = controllerPose[1].M[0][1]; @@ -2067,11 +2142,14 @@ public static double getCurrentTimeSecs() { return System.nanoTime() / 1000000000d; } -// public static void renderFade(float dur, float r, float g, float b, float a){ -// vrCompositor.FadeToColor.apply(dur, r, g, b, a, (byte)0); -// } -// -// public static void renderGrid(Color4f color){ -// vrCompositor.FadeGrid.apply(0.5f, (byte)0); -// } + + public static void resetPosition() { + Vec3 cp = getCenterEyePosition(); + Vec3 pos = Vec3.createVectorHelper(cp.xCoord*-1 + offset.x,cp.yCoord*-1 + offset.y,cp.zCoord*-1 + offset.z); + offset=new Vector3f((float) pos.xCoord,(float)pos.yCoord+1.62f,(float)pos.zCoord); + } + + public static void clearOffset() { + offset=new Vector3f(0,0,0); + } } diff --git a/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java b/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java index 8422de6c..be3ab2c1 100644 --- a/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java +++ b/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java @@ -51,9 +51,12 @@ import com.google.common.base.Charsets; import com.mtbs3d.minecrift.api.IRoomscaleAdapter; import com.mtbs3d.minecrift.api.NetworkHelper; +import com.mtbs3d.minecrift.api.NetworkHelper.PacketDiscriminators; import com.mtbs3d.minecrift.gameplay.EntityVRTeleportFX; import com.mtbs3d.minecrift.gameplay.VRMovementStyle; import com.mtbs3d.minecrift.render.QuaternionHelper; +import com.mtbs3d.minecrift.settings.AutoCalibration; +import com.mtbs3d.minecrift.settings.VRSettings; import com.mtbs3d.minecrift.utils.Utils; // VIVE @@ -77,6 +80,11 @@ public class OpenVRPlayer implements IRoomscaleAdapter private float teleportEnergy; + private Vec3 walkMultOffset= Vec3.createVectorHelper(0, 0, 0); + + public double wfMode = 0; + public int wfCount = 0; + public static OpenVRPlayer get() { return Minecraft.getMinecraft().vrPlayer; @@ -112,7 +120,7 @@ public void setRoomOrigin(double x, double y, double z, boolean reset, boolean o } //set room - public void snapRoomOriginToPlayerEntity(Entity player, boolean reset, boolean onFrame) + public void snapRoomOriginToPlayerEntity(EntityPlayerSP player, boolean reset, boolean onFrame) { if (Thread.currentThread().getName().equals("Server thread")) return; @@ -148,7 +156,20 @@ public void snapRoomOriginToPlayerEntity(Entity player, boolean reset, boolean o public void checkandUpdateRotateScale(boolean onFrame){ Minecraft mc = Minecraft.getMinecraft(); - if(!onFrame) this.worldScale = mc.vrSettings.vrWorldScale; + if(!onFrame) { + if(this.wfCount > 0){ + if(this.wfCount < 40){ + this.worldScale-=this.wfMode / 2; + if(this.worldScale > mc.vrSettings.vrWorldScale && this.wfMode <0) this.worldScale = mc.vrSettings.vrWorldScale; + if(this.worldScale < mc.vrSettings.vrWorldScale && this.wfMode >0) this.worldScale = mc.vrSettings.vrWorldScale; + }else { + this.worldScale+=this.wfMode / 2; + if(this.worldScale > mc.vrSettings.vrWorldScale*20) this.worldScale = 20; + if(this.worldScale < mc.vrSettings.vrWorldScale/10) this.worldScale = 0.1f; + } + this.wfCount--; + } else this.worldScale = mc.vrSettings.vrWorldScale; + } this.worldRotationRadians = (float) Math.toRadians(mc.vrSettings.vrWorldRotation); if (worldRotationRadians!= lastworldRotation || worldScale != lastWorldScale) { @@ -163,13 +184,27 @@ public void onLivingUpdate(EntityPlayerSP player, Minecraft mc, Random rand) { if(!player.initFromServer) return; updateSwingAttack(); - - if(mc.vrSettings.seated) freeMoveMode = true; + + mc.runTracker.doProcess(mc, player); + + mc.jumpTracker.doProcess(mc, player); + + mc.sneakTracker.doProcess(mc, player); + + mc.autoFood.doProcess(mc,player); this.checkandUpdateRotateScale(false); + mc.swimTracker.doProcess(mc,player); + + mc.climbTracker.doProcess(mc, player); + + AutoCalibration.logHeadPos(MCOpenVR.hmdPivotHistory.latest()); + + NetworkHelper.sendVRPlayerPositions(this); + /** MINECRIFT */ - mc.thePlayer.stepHeight = mc.vrSettings.walkUpBlocks ? 1f * mc.vrSettings.vrWorldScale : 0.5f; + mc.thePlayer.stepHeight = mc.vrSettings.walkUpBlocks ? 1f * mc.vrPlayer.worldScale : 0.5f; if (!this.getFreeMoveMode()) mc.thePlayer.stepHeight = 0.0f; /** END MINECRIFT */ @@ -504,8 +539,7 @@ private void doPlayerMoveInRoom(EntityPlayerSP player){ } // test for climbing up a block - else if (mc.vrSettings.walkUpBlocks && player.fallDistance == 0) - { + else if ((mc.vrSettings.walkUpBlocks || (player.isOnLadder() && mc.vrSettings.realisticClimbEnabled)) && player.fallDistance == 0) { if (torso == null) { torso = getEstimatedTorsoPosition(x, y, z); @@ -530,8 +564,13 @@ else if (mc.vrSettings.walkUpBlocks && player.fallDistance == 0) bb.minX += xOffset; bb.maxX += xOffset; bb.minZ += zOffset; - bb.maxZ += zOffset; - for (int i = 0; i <=10 ; i++) + bb.maxZ += zOffset; + + int extra = 0; + if(player.isOnLadder() && mc.vrSettings.realisticClimbEnabled) + extra = 6; + + for (int i = 0; i <=10 + extra ; i++) { bb.minY += 0.1f; bb.maxY += 0.1f; @@ -603,9 +642,16 @@ public void updateTeleportArc(Minecraft mc, Entity player) Vec3 start = this.getControllerOffhandPos_World(); Vec3 tiltedAim = mc.roomScale.getControllerOffhandDir_World(); Matrix4f handRotation =MCOpenVR.getAimRotation(1); + + if(mc.vrSettings.seated){ + start = mc.entityRenderer.getControllerRenderPos(0); + tiltedAim = mc.roomScale.getControllerDir_World(0); + handRotation =MCOpenVR.getAimRotation(0); + } + Matrix4f rot = Matrix4f.rotationY(this.worldRotationRadians); handRotation = Matrix4f.multiply(rot, handRotation); - + // extract hand roll Quatf handQuat = OpenVRUtil.convertMatrix4ftoRotationQuat(handRotation); EulerOrient euler = OpenVRUtil.getEulerAnglesDegYXZ(handQuat); @@ -898,10 +944,6 @@ public Vec3 getInterpolatedArcPosition(float progress) public float weapongSwingLen; public Vec3 weaponEnd; public Vec3 weaponEndlast; - public Vec3 weaponEnd_room; - public Vec3 weaponEndlast_room; - public float tickDist; - public int disableSwing = 3; @@ -915,6 +957,10 @@ public void updateSwingAttack() if (!mc.vrSettings.weaponCollision) return; + if(mc.vrSettings.vrFreeMoveMode == mc.vrSettings.FREEMOVE_RUNINPLACE && player.moveForward > 0){ + return; //dont hit things while RIPing. + } + mc.mcProfiler.startSection("updateSwingAttack"); Vec3 handPos = this.getControllerMainPos_World(); @@ -923,7 +969,7 @@ public void updateSwingAttack() ItemStack is = player.inventory.getCurrentItem(); Item item = null; - double speedthresh = 2.2f ; + double speedthresh = 1.8f; float weaponLength; float entityReachAdd; @@ -957,30 +1003,19 @@ public void updateSwingAttack() handPos.yCoord + handDirection.yCoord * weaponLength, handPos.zCoord + handDirection.zCoord * weaponLength); - Vec3 localhandPos = this.getControllerPos_Room(0); - - weaponEnd_room = Vec3.createVectorHelper( - localhandPos.xCoord, - localhandPos.yCoord, - localhandPos.zCoord); if (disableSwing > 0 ) { disableSwing--; if(disableSwing<0)disableSwing = 0; weaponEndlast = Vec3.createVectorHelper(weaponEnd.xCoord, weaponEnd.yCoord, weaponEnd.zCoord); - weaponEndlast_room = Vec3.createVectorHelper(weaponEnd_room.xCoord, weaponEnd_room.yCoord, weaponEnd_room.zCoord); return; } - tickDist = (float) (weaponEndlast_room.subtract(weaponEnd_room).lengthVector()); - - float speed = (float) (tickDist * 20); + float speed = (float) MCOpenVR.controllerHistory[0].averageSpeed(0.1); weaponEndlast = Vec3.createVectorHelper(weaponEnd.xCoord, weaponEnd.yCoord, weaponEnd.zCoord); - weaponEndlast_room = Vec3.createVectorHelper(weaponEnd_room.xCoord, weaponEnd_room.yCoord, weaponEnd_room.zCoord); - int passes = (int) (tickDist / .1f); //TODO someday.... - + int bx = (int) MathHelper.floor_double(weaponEnd.xCoord); int by = (int) MathHelper.floor_double(weaponEnd.yCoord); int bz = (int) MathHelper.floor_double(weaponEnd.zCoord); @@ -1052,7 +1087,7 @@ public void updateSwingAttack() } } } else { - if(canact){ + if(canact && (!mc.vrSettings.realisticClimbEnabled || block != Blocks.ladder)) { int p = 3; p += (speed - speedthresh) / 2; @@ -1104,15 +1139,47 @@ public void updateSwingAttack() public boolean getFreeMoveMode() { return freeMoveMode; } public void setFreeMoveMode(boolean free) { - if(Minecraft.getMinecraft().vrSettings.seated) free = true; + + boolean was = freeMoveMode; freeMoveMode = free; - if(free != was) - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C17PacketCustomPayload("MC|Vive|FreeMove", (byte[]) (freeMoveMode ? new byte[]{1} : new byte[]{0} ))); + + if(free != was){ + C17PacketCustomPayload pack1 = NetworkHelper.getVivecraftClientPacket(PacketDiscriminators.MOVEMODE, freeMoveMode ? new byte[]{1} : new byte[]{0}); + C17PacketCustomPayload pack2 = new C17PacketCustomPayload("MC|Vive|FreeMove", (byte[]) (freeMoveMode ? new byte[]{1} : new byte[]{0} )); + + if(Minecraft.getMinecraft().getNetHandler() !=null){ + Minecraft.getMinecraft().getNetHandler().addToSendQueue(pack1); + Minecraft.getMinecraft().getNetHandler().addToSendQueue(pack2); + } + + if(Minecraft.getMinecraft().vrSettings.seated){ + Minecraft.getMinecraft().printChatMessage("Movement mode set to: " + (free ? "Free Move: WASD": "Teleport: W")); + + } else { + Minecraft.getMinecraft().printChatMessage("Movement mode set to: " + (free ? Minecraft.getMinecraft().vrSettings.getKeyBinding(VRSettings.VrOptions.FREEMOVE_MODE): "Teleport")); + + } + + if(noTeleportClient && !free){ + Minecraft.getMinecraft().printChatMessage("Warning: This server may not allow teleporting."); + } + } + } public float getTeleportEnergy () {return teleportEnergy;} + Vec3 getWalkMultOffset() + { + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + if(player==null || !player.initFromServer) + return Vec3.createVectorHelper(0, 0, 0); + float walkmult=Minecraft.getMinecraft().vrSettings.walkMultiplier; + Vec3 pos=vecMult(MCOpenVR.getCenterEyePosition(),worldScale); + return pos.subtract(Vec3.createVectorHelper(pos.xCoord*walkmult,pos.yCoord,pos.zCoord*walkmult)); + } + //================= IROOMSCALEADAPTER ============================= @@ -1124,15 +1191,20 @@ public boolean isHMDTracking() { return MCOpenVR.headIsTracking; } - private Vec3 vecMult(Vec3 in, float factor){ + public static Vec3 vecMult(Vec3 in, float factor){ return Vec3.createVectorHelper(in.xCoord * factor, in.yCoord * factor, in.zCoord*factor); } + public static Vec3 vecAdd(Vec3 in, Vec3 in2){ + return Vec3.createVectorHelper(in.xCoord + in2.xCoord, in.yCoord + in2.yCoord, in.zCoord + in2.zCoord); + } + @Override public Vec3 getHMDPos_World() { Vec3 out = vecMult(MCOpenVR.getCenterEyePosition(),worldScale); out.rotateAroundY(worldRotationRadians); - return out.addVector(roomOrigin.xCoord, roomOrigin.yCoord, roomOrigin.zCoord); + Vec3 w = getWalkMultOffset(); + return out.addVector(roomOrigin.xCoord + w.xCoord, roomOrigin.yCoord + w.yCoord, roomOrigin.zCoord + w.zCoord); } @Override @@ -1164,7 +1236,7 @@ public boolean isControllerMainTracking() { public Vec3 getControllerMainPos_World() { Vec3 out = vecMult(MCOpenVR.getAimSource(0),worldScale); out.rotateAroundY(worldRotationRadians); - return out.addVector(roomOrigin.xCoord, roomOrigin.yCoord, roomOrigin.zCoord); + return vecAdd(out.addVector(roomOrigin.xCoord, roomOrigin.yCoord, roomOrigin.zCoord), getWalkMultOffset()); } @Override @@ -1195,7 +1267,7 @@ public boolean isControllerOffhandTracking() { public Vec3 getControllerOffhandPos_World() { Vec3 out = vecMult(MCOpenVR.getAimSource(1),worldScale); out.rotateAroundY(worldRotationRadians); - return out.addVector(roomOrigin.xCoord, roomOrigin.yCoord, roomOrigin.zCoord); + return vecAdd(out.addVector(roomOrigin.xCoord, roomOrigin.yCoord, roomOrigin.zCoord), getWalkMultOffset()); } @Override @@ -1244,7 +1316,8 @@ public FloatBuffer getHMDMatrix_World() { public Vec3 getEyePos_World(renderPass eye) { Vec3 out = vecMult(MCOpenVR.getEyePosition(eye),worldScale); out.rotateAroundY(worldRotationRadians); - return out.addVector(roomOrigin.xCoord, roomOrigin.yCoord, roomOrigin.zCoord); + Vec3 w = getWalkMultOffset(); + return out.addVector(roomOrigin.xCoord + w.xCoord, roomOrigin.yCoord + w.yCoord, roomOrigin.zCoord + w.zCoord); } @@ -1273,17 +1346,23 @@ public Vec3 getCustomControllerVector(int controller, Vec3 axis) { @Override public Vec3 getHMDPos_Room() { - return vecMult(MCOpenVR.getCenterEyePosition(),worldScale); + return vecAdd(vecMult(MCOpenVR.getCenterEyePosition(),worldScale), getWalkMultOffset()); } @Override public Vec3 getControllerPos_Room(int i) { - return vecMult(MCOpenVR.getAimSource(i),worldScale); + return vecAdd(vecMult(MCOpenVR.getAimSource(i),worldScale), getWalkMultOffset()); + } + + @Override + public Vec3 getControllerDir_Room(int c) { + Vector3f v3 = c==0?MCOpenVR.controllerDirection : MCOpenVR.lcontrollerDirection; + return Vec3.createVectorHelper(v3.x, v3.y, v3.z); } @Override public Vec3 getEyePos_Room(renderPass eye) { - return vecMult(MCOpenVR.getEyePosition(eye),worldScale); + return vecAdd(vecMult(MCOpenVR.getEyePosition(eye),worldScale), getWalkMultOffset()); } @Override @@ -1308,6 +1387,13 @@ public Vec3 getControllerPos_World(int c) { return c == 0 ? this.getControllerMainPos_World() : this.getControllerOffhandPos_World(); } + @Override + public Vec3 getControllerDir_World(int c) { + Vector3f v3 = c==0?MCOpenVR.controllerDirection : MCOpenVR.lcontrollerDirection; + Vec3 out = new Vec3(v3.x, v3.y, v3.z).rotateYaw(worldRotationRadians); + return out; + } + private void hackPCMP(){ hitBlockDelay = Utils.getDeclaredField(Minecraft.getMinecraft().playerController.getClass(), @@ -1367,5 +1453,7 @@ private void clearBlockHitDelay() { } // VIVE END - function to allow damaging blocks immediately + + } diff --git a/src/com/mtbs3d/minecrift/render/RenderVRPlayer.java b/src/com/mtbs3d/minecrift/render/RenderVRPlayer.java index 831d017e..ccf71484 100644 --- a/src/com/mtbs3d/minecrift/render/RenderVRPlayer.java +++ b/src/com/mtbs3d/minecrift/render/RenderVRPlayer.java @@ -60,7 +60,7 @@ public RenderVRPlayer() public void setVR(boolean vrMode, boolean renderHeadWear, float offset) { vrOffset = vrMode? offset : 0.0F; - if (Minecraft.getMinecraft().vrSettings.allowAvatarIK) { + if (false) { this.modelBipedMain.vrMode = vrMode; } else { diff --git a/src/com/mtbs3d/minecrift/settings/AutoCalibration.java b/src/com/mtbs3d/minecrift/settings/AutoCalibration.java new file mode 100644 index 00000000..ca3b14c0 --- /dev/null +++ b/src/com/mtbs3d/minecrift/settings/AutoCalibration.java @@ -0,0 +1,125 @@ +package com.mtbs3d.minecrift.settings; + +import com.mtbs3d.minecrift.provider.MCOpenVR; +import net.minecraft.client.Minecraft; +import net.minecraft.util.Vec3; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +public class AutoCalibration { + + static double magnetDistance=0.05; + static int weightCap =100; + public static MagnetPoint currentCalibration; + public static final float defaultHeight=1.65f; + + static Set magnetSet=new HashSet(); + + public static void logHeadPos(Vec3 headpos){ + double y=headpos.yCoord; + MagnetPoint p =findPoint(y); + if(p==null){ + p=new MagnetPoint(); + p.center=y; + p.weight=1; + magnetSet.add(p); + }else{ + p.center=(p.center*0.75+y*0.25); + applySucc(p); + applyHeightBonus(); + if(p.weight > weightCap) + p.weight = weightCap; + } + + getBestEstimate(); + } + + private static void applyHeightBonus() { + double highest=-1; + MagnetPoint href=null; + for (MagnetPoint m: magnetSet) { + if(highest i=magnetSet.iterator(); + while(i.hasNext()){ + MagnetPoint m=i.next(); + if(m.equals(href)){ + if(m.succ>0) + m.weight++; + else + if(m.weightprocessGui() - public float fovChange = 0f; - public float lensSeparationScaleFactor = 1.0f; - private IOculusRift.AspectCorrectionType aspectRatioCorrectionMode = IOculusRift.AspectCorrectionType.CORRECTION_AUTO; - private int aspectRatioCorrection = aspectRatioCorrectionMode.getValue(); - protected float headTrackSensitivity = 1.0f; public boolean useFsaa = false; // default to off - public float fsaaScaleFactor = 1.4f; - public boolean useOculusProfileIpd = true; - public boolean useHalfIpds = false; - public String headPositionPluginID = "openvr"; - public String headTrackerPluginID = "openvr"; - public String hmdPluginID = "openvr"; public String stereoProviderPluginID = "openvr"; public String badStereoProviderPluginID = ""; - public String controllerPluginID = "openvr"; // VIVE use openVR for controller public float crosshairScale = 1.0f; public int renderInGameCrosshairMode = RENDER_CROSSHAIR_MODE_ALWAYS; public int renderBlockOutlineMode = RENDER_BLOCK_OUTLINE_MODE_ALWAYS; - public boolean showEntityOutline = false; - public boolean crosshairRollsWithHead = false; - public boolean crosshairScalesWithDistance = false; public boolean hudOcclusion = false; - public boolean soundOrientWithHead = true; - public float chatOffsetX = 0; - public float chatOffsetY = 0.4f; public int inertiaFactor = INERTIA_NORMAL; - public boolean allowPitchAffectsHeightWhileFlying = true; public boolean storeDebugAim = false; public int smoothRunTickCount = 20; public boolean smoothTick = false; - public static final String LEGACY_OPTIONS_VR_FILENAME = "optionsvr.txt"; - public boolean allowAvatarIK = false; public boolean hideGui = false; // VIVE show gui - public boolean useKeyBindingForComfortYaw = false; - //Jrbudda's Options public boolean vrFreeMove = false; public boolean vrAllowLocoModeSwotch = true; @@ -195,9 +134,27 @@ public class VRSettings public boolean vrTouchHotbar = true; public boolean seated = false; private Minecraft mc; - - private File optionsVRFile; - private File optionsVRBackupFile; + public float jumpThreshold=0.05f; + public float sneakThreshold=0.4f; + public boolean realisticJumpEnabled=true; + public boolean realisticSneakEnabled=true; + public boolean realisticClimbEnabled=true; + public boolean realisticSwimEnabled=true; + public boolean realisticRowEnabled=true; + public float walkMultiplier=1; + public int vrFreeMoveMode = this.FREEMOVE_CONTROLLER; + + public double headToHmdLength=0.10f; + + public float xSensitivity=1f; + public float ySensitivity=1f; + public float keyholeX=15; + + public float autoCalibration=-1; + public float manualCalibration=-1; + public float playerEyeHeight = 1.62f; + public boolean vehicleRotation = false; + public boolean loadMumbleLib; public VRSettings( Minecraft minecraft, File dataDir ) { @@ -248,66 +205,11 @@ public void loadOptions(JSONObject theProfiles) this.version = Integer.parseInt(optionTokens[1]); } - if (optionTokens[0].equals("newlyCreated")) - { - this.newlyCreated = optionTokens[1].equals("true"); - } - // if (optionTokens[0].equals("firstLoad")) // { // this.firstLoad = optionTokens[1].equals("true"); // } - if (optionTokens[0].equals("useVRRenderer")) - { - this.useVRRenderer = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("debugPose")) - { - this.debugPose = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("playerEyeHeight")) - { - this.playerEyeHeight = this.parseFloat(optionTokens[1]); - } - - if (optionTokens[0].equals("neckBaseToEyeHeight")) - { - this.neckBaseToEyeHeight = this.parseFloat(optionTokens[1]); - } - - if (optionTokens[0].equals("eyeReliefAdjust")) - { - this.eyeReliefAdjust = this.parseFloat(optionTokens[1]); - } - - if (optionTokens[0].equals("leftHalfIpd")) - { - this.leftHalfIpd = this.parseFloat(optionTokens[1]); - } - - if (optionTokens[0].equals("rightHalfIpd")) - { - this.rightHalfIpd = this.parseFloat(optionTokens[1]); - } - - if (optionTokens[0].equals("headTrackerPluginID")) - { - this.headTrackerPluginID = optionTokens[1]; - } - - if (optionTokens[0].equals("headPositionPluginID")) - { - this.headPositionPluginID = optionTokens[1]; - } - - if (optionTokens[0].equals("hmdPluginID")) - { - this.hmdPluginID = optionTokens[1]; - } - if (optionTokens[0].equals("stereoProviderPluginID")) { this.stereoProviderPluginID = optionTokens[1]; @@ -320,33 +222,12 @@ public void loadOptions(JSONObject theProfiles) } } - if (optionTokens[0].equals("controllerPluginID")) - { - this.controllerPluginID = optionTokens[1]; - } - if (optionTokens[0].equals("hudOpacity")) { this.hudOpacity = this.parseFloat(optionTokens[1]); if(hudOpacity< 0.15f) hudOpacity = 1.0f; } - - if (optionTokens[0].equals("useDistortion")) - { - this.useDistortion = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("loadMumbleLib")) - { - this.loadMumbleLib = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("renderHeadWear")) - { - this.renderHeadWear = optionTokens[1].equals("true"); - } - if (optionTokens[0].equals("menuBackground")) { this.menuBackground = optionTokens[1].equals("true"); @@ -362,51 +243,11 @@ public void loadOptions(JSONObject theProfiles) this.shaderIndex = Integer.parseInt(optionTokens[1]); } - if (optionTokens[0].equals("useTimewarp")) - { - this.useTimewarp = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("useTimewarpJitDelay")) - { - this.useTimewarpJitDelay = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("useVignette")) - { - this.useVignette = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("posTrackBlankOnCollision")) - { - this.posTrackBlankOnCollision = optionTokens[1].equals("true"); - } - if (optionTokens[0].equals("walkUpBlocks")) { this.walkUpBlocks = optionTokens[1].equals("true"); } - if (optionTokens[0].equals("allowPitchAffectsHeightWhileFlying")) - { - this.allowPitchAffectsHeightWhileFlying = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("useLowPersistence")) - { - this.useLowPersistence = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("useDynamicPrediction")) - { - this.useDynamicPrediction = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("useDisplayOverdrive")) - { - this.useDisplayOverdrive = optionTokens[1].equals("true"); - } - if (optionTokens[0].equals("displayMirrorMode")) { this.displayMirrorMode = Integer.parseInt(optionTokens[1]); @@ -428,36 +269,16 @@ public void loadOptions(JSONObject theProfiles) this.insideBlockSolidColor = optionTokens[1].equals("true"); } - if (optionTokens[0].equals("useDistortionTextureLookupOptimisation")) - { - this.useDistortionTextureLookupOptimisation = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("useFXAA")) - { - this.useFXAA = optionTokens[1].equals("true"); - } - if (optionTokens[0].equals("hudScale")) { this.hudScale = this.parseFloat(optionTokens[1]); } - if (optionTokens[0].equals("renderPlayerOffset")) - { - this.renderPlayerOffset = this.parseFloat(optionTokens[1]); - } - if (optionTokens[0].equals("renderScaleFactor")) { this.renderScaleFactor = this.parseFloat(optionTokens[1]); } - if (optionTokens[0].equals("allowMousePitchInput")) - { - this.allowMousePitchInput = optionTokens[1].equals("true"); - } - if (optionTokens[0].equals("vrHudLockMode")) { this.vrHudLockMode = Integer.parseInt(optionTokens[1]); @@ -483,37 +304,6 @@ public void loadOptions(JSONObject theProfiles) this.useFsaa = optionTokens[1].equals("true"); } - if (optionTokens[0].equals("useHighQualityDistortion")) - { - this.useHighQualityDistortion = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("fsaaScaleFactor")) - { - this.fsaaScaleFactor = this.parseFloat(optionTokens[1]); - } - - if (optionTokens[0].equals("fovChange")) - { - this.fovChange = this.parseFloat(optionTokens[1]); - } - - if (optionTokens[0].equals("lensSeparationScaleFactor")) - { - this.lensSeparationScaleFactor = this.parseFloat(optionTokens[1]); - } - - if (optionTokens[0].equals("aspectRatioCorrection")) - { - this.aspectRatioCorrection = Integer.parseInt(optionTokens[1]); - setAspectCorrectionMode(this.aspectRatioCorrection); - } - - if (optionTokens[0].equals("headTrackSensitivity")) - { - this.headTrackSensitivity = this.parseFloat(optionTokens[1]); - } - if (optionTokens[0].equals("movementSpeedMultiplier")) { this.movementSpeedMultiplier = this.parseFloat(optionTokens[1]); @@ -539,16 +329,6 @@ public void loadOptions(JSONObject theProfiles) this.menuCrosshairScale = this.parseFloat(optionTokens[1]); } - if (optionTokens[0].equals("useOculusProfileIpd")) - { - this.useOculusProfileIpd = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("useHalfIpds")) - { - this.useHalfIpds = optionTokens[1].equals("true"); - } - if (optionTokens[0].equals("renderInGameCrosshairMode")) { this.renderInGameCrosshairMode = Integer.parseInt(optionTokens[1]); @@ -559,21 +339,6 @@ public void loadOptions(JSONObject theProfiles) this.renderBlockOutlineMode = Integer.parseInt(optionTokens[1]); } - if (optionTokens[0].equals("showEntityOutline")) - { - this.showEntityOutline = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("crosshairRollsWithHead")) - { - this.crosshairRollsWithHead = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("crosshairScalesWithDistance")) - { - this.crosshairScalesWithDistance = optionTokens[1].equals("true"); - } - if (optionTokens[0].equals("hudOcclusion")) { this.hudOcclusion = optionTokens[1].equals("true"); @@ -584,52 +349,11 @@ public void loadOptions(JSONObject theProfiles) this.useCrosshairOcclusion = optionTokens[1].equals("true"); } - if (optionTokens[0].equals("maxCrosshairDistanceAtBlockReach")) - { - this.maxCrosshairDistanceAtBlockReach = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("useMaxFov")) - { - this.useMaxFov = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("chatFadeAway")) - { - this.chatFadeAway = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("soundOrientWithHead")) - { - this.soundOrientWithHead = optionTokens[1].equals("true"); - } - - if (optionTokens[0].equals("chatOffsetX")) - { - this.chatOffsetX = this.parseFloat(optionTokens[1]); - } - - if (optionTokens[0].equals("chatOffsetY")) - { - this.chatOffsetY = this.parseFloat(optionTokens[1]); - } - if (optionTokens[0].equals("inertiaFactor")) { this.inertiaFactor = Integer.parseInt(optionTokens[1]); } - - if (optionTokens[0].equals("oculusProfileLeftHalfIpd")) - { - this.oculusProfileLeftHalfIpd = this.parseFloat(optionTokens[1]); - } - - if (optionTokens[0].equals("oculusProfileRightHalfIpd")) - { - this.oculusProfileRightHalfIpd = this.parseFloat(optionTokens[1]); - } - if (optionTokens[0].equals("smoothRunTickCount")) { this.smoothRunTickCount = Integer.parseInt(optionTokens[1]); @@ -640,11 +364,6 @@ public void loadOptions(JSONObject theProfiles) this.smoothTick = optionTokens[1].equals("true"); } - if (optionTokens[0].equals("allowAvatarIK")) - { - this.allowAvatarIK = optionTokens[1].equals("true"); - } - if (optionTokens[0].equals("hideGui")) { this.hideGui = optionTokens[1].equals("true"); @@ -733,6 +452,69 @@ public void loadOptions(JSONObject theProfiles) { this.seated = optionTokens[1].equals("true"); } + + if(optionTokens[0].equals("jumpThreshold")){ + this.jumpThreshold=this.parseFloat(optionTokens[1]); + } + + if(optionTokens[0].equals("sneakThreshold")){ + this.sneakThreshold=this.parseFloat(optionTokens[1]); + } + + if(optionTokens[0].equals("realisticSneakEnabled")){ + this.realisticSneakEnabled=optionTokens[1].equals("true"); + } + + if(optionTokens[0].equals("realisticJumpEnabled")){ + this.realisticJumpEnabled=optionTokens[1].equals("true"); + } + if(optionTokens[0].equals("realisticClimbEnabled")){ + this.realisticClimbEnabled=optionTokens[1].equals("true"); + } + if(optionTokens[0].equals("realisticSwimEnabled")){ + this.realisticSwimEnabled=optionTokens[1].equals("true"); + } + if(optionTokens[0].equals("realisticRowEnabled")){ + this.realisticRowEnabled=optionTokens[1].equals("true"); + } + + if(optionTokens[0].equals("headToHmdLength")){ + this.headToHmdLength=parseFloat(optionTokens[1]); + } + + if(optionTokens[0].equals("walkMultiplier")){ + this.walkMultiplier=parseFloat(optionTokens[1]); + } + + if (optionTokens[0].equals("vrFreeMoveMode")) + { + this.vrFreeMoveMode = Integer.parseInt(optionTokens[1]); + } + + if(optionTokens[0].equals("xSensitivity")){ + this.xSensitivity=parseFloat(optionTokens[1]); + } + + if(optionTokens[0].equals("ySensitivity")){ + this.ySensitivity=parseFloat(optionTokens[1]); + } + + if(optionTokens[0].equals("keyholeX")){ + this.keyholeX=parseFloat(optionTokens[1]); + } + + if(optionTokens[0].equals("autoCalibration")){ + this.autoCalibration=parseFloat(optionTokens[1]); + } + + if(optionTokens[0].equals("manualCalibration")){ + this.manualCalibration=parseFloat(optionTokens[1]); + } + + if(optionTokens[0].equals("vehicleRotation")){ + this.vehicleRotation=optionTokens[1].equals("true"); + } + if (optionTokens[0].startsWith("BUTTON_")) { VRControllerButtonMapping vb = new VRControllerButtonMapping( @@ -831,34 +613,12 @@ public String getKeyBinding( VRSettings.VrOptions par1EnumOptions ) return var2; case LOCOMOTION_SETTINGS: return var2; - case USE_VR: - return var4 + "ON"; // Always ON - this is Minecrift after all - case EYE_RELIEF_ADJUST: - return var4 + String.format("%.2fmm", new Object[] { Float.valueOf(this.eyeReliefAdjust) * 1000f }); - case NECK_LENGTH: - return var4 + String.format("%.3fm", new Object[] { Float.valueOf(this.neckBaseToEyeHeight) }); case MOVEMENT_MULTIPLIER: return var4 + String.format("%.2f", new Object[] { Float.valueOf(this.movementSpeedMultiplier) }); - case USE_DISTORTION: - return this.useDistortion ? var4 + "ON" : var4 + "OFF"; - case LOAD_MUMBLE_LIB: - return this.loadMumbleLib ? var4 + "YES" : var4 + "NO"; - case USE_PROFILE_IPD: - return this.useOculusProfileIpd ? var4 + "Profile" : var4 + "Manual"; - case CONFIG_IPD_MODE: - return this.useHalfIpds ? var4 + "Per Eye" : var4 + "Both"; - case TOTAL_IPD: - return var4 + String.format("%.1fmm", new Object[] { Float.valueOf(getIPD() * 1000) }); - case LEFT_HALF_IPD: - return var4 + String.format("%.1fmm", new Object[] { Float.valueOf(getHalfIPD(EyeType.ovrEye_Left) * 1000) }); - case RIGHT_HALF_IPD: - return var4 + String.format("%.1fmm", new Object[] { Float.valueOf(getHalfIPD(EyeType.ovrEye_Right) * 1000) }); case HUD_OPACITY: if( this.hudOpacity > 0.99) return var4 + "Opaque"; return var4 + String.format("%.2f", new Object[] { Float.valueOf(this.hudOpacity) }); - case RENDER_OWN_HEADWEAR: - return this.renderHeadWear ? var4 + "ON" : var4 + "OFF"; case RENDER_MENU_BACKGROUND: return this.menuBackground ? var4 + "ON" : var4 + "OFF"; case HUD_HIDE: @@ -870,23 +630,6 @@ else if (this.renderFullFirstPersonModelMode == RENDER_FIRST_PERSON_HAND) return var4 + "Hand"; else if (this.renderFullFirstPersonModelMode == RENDER_FIRST_PERSON_NONE) return var4 + "None"; - case CHROM_AB_CORRECTION: - return var4 + "ON"; - // 0.4.0 - case TIMEWARP: - return this.useTimewarp ? var4 + "ON" : var4 + "OFF"; - case TIMEWARP_JIT_DELAY: - return this.useTimewarpJitDelay ? var4 + "ON" : var4 + "OFF"; - case VIGNETTE: - return this.useVignette ? var4 + "ON" : var4 + "OFF"; - case LOW_PERSISTENCE: - return this.useLowPersistence ? var4 + "ON" : var4 + "OFF"; - case DYNAMIC_PREDICTION: - return this.useDynamicPrediction ? var4 + "ON" : var4 + "OFF"; - case OVERDRIVE_DISPLAY: - return this.useDisplayOverdrive ? var4 + "ON" : var4 + "OFF"; - //case ENABLE_DIRECT: - // return this.mc.isDirectMode ? var4 + "Direct" : var4 + "Extended"; case MIRROR_DISPLAY: switch(this.displayMirrorMode) { case MIRROR_OFF: @@ -922,41 +665,14 @@ else if (this.renderFullFirstPersonModelMode == RENDER_FIRST_PERSON_NONE) return var4 + "MAGENTA"; } return var4 + this.mixedRealityKeyColor.getRed() + " " + this.mixedRealityKeyColor.getGreen() + " " + this.mixedRealityKeyColor.getBlue(); - case POS_TRACK_HIDE_COLLISION: - return this.posTrackBlankOnCollision ? var4 + "YES" : var4 + "NO"; - case MIXED_REALITY_RENDER_HANDS: + case MIXED_REALITY_RENDER_HANDS: return this.mixedRealityRenderHands ? var4 + "YES" : var4 + "NO"; case INSIDE_BLOCK_SOLID_COLOR: return this.insideBlockSolidColor ? var4 + "SOLID COLOR" : var4 + "TEXTURE"; case WALK_UP_BLOCKS: return this.walkUpBlocks ? var4 + "YES" : var4 + "NO"; - case PITCH_AFFECTS_FLYING: - return this.allowPitchAffectsHeightWhileFlying ? var4 + "YES" : var4 + "NO"; - case VIEW_BOBBING: - return this.mc.gameSettings.viewBobbing ? var4 + "YES" : var4 + "NO"; - case RENDER_SCALEFACTOR: - return var4 + String.format("%.1f", new Object[] { Float.valueOf(this.renderScaleFactor) }); - - case TEXTURE_LOOKUP_OPT: - return this.useDistortionTextureLookupOptimisation ? var4 + "Texture Lookup" : var4 + "Brute Force"; - case FXAA: - return this.useFXAA ? var4 + "ON" : var4 + "OFF"; - case HUD_SCALE: + case HUD_SCALE: return var4 + String.format("%.2f", new Object[] { Float.valueOf(this.hudScale) }); - case RENDER_PLAYER_OFFSET: - if (this.renderPlayerOffset < 0.01f) - return var4 + "None"; - else - return var4 + String.format("%.2fcm", new Object[] { Float.valueOf(this.renderPlayerOffset) }); - case MONO_FOV: - /*if(this.mc.gameSettings.fovSetting==110f) - return var4 + "Quake Pro"; - else if(this.mc.gameSettings.fovSetting==70f) - return var4 + "Normal"; - else*/ - return var4 + String.format("%.0f\u00B0", new Object[] { Float.valueOf(this.mc.gameSettings.fovSetting) }); - case PITCH_AFFECTS_CAMERA: - return this.allowMousePitchInput ? var4 + "ON" : var4 + "OFF"; case HUD_LOCK_TO: switch (this.vrHudLockMode) { // VIVE - lock to hand instead of body @@ -966,33 +682,20 @@ else if(this.mc.gameSettings.fovSetting==70f) return var4 + " head"; case HUD_LOCK_WRIST: return var4 + " wrist"; + case HUD_LOCK_BODY: + return var4 + " body"; } case HUD_DISTANCE: return var4 + String.format("%.2f", new Object[] { Float.valueOf(this.hudDistance) }); case HUD_PITCH: return var4 + String.format("%.0f", new Object[] { Float.valueOf(this.hudPitchOffset) }); case HUD_YAW: - return var4 + String.format("%.0f", new Object[] { Float.valueOf(this.hudYawOffset) }); - case FOV_CHANGE: - return var4 + String.format("%.1f%s", new Object[] { Float.valueOf(this.fovChange), DEGREE }); - case LENS_SEPARATION_SCALE_FACTOR: - return var4 + String.format("%.3f", new Object[] { Float.valueOf(this.lensSeparationScaleFactor) }); - case FSAA: - return this.useFsaa ? var4 + "ON" : var4 + "OFF"; - case HIGH_QUALITY_DISTORTION: - return this.useHighQualityDistortion ? var4 + "ON" : var4 + "OFF"; - case FSAA_SCALEFACTOR: - return var4 + String.format("%.1fX", new Object[] { Float.valueOf(this.fsaaScaleFactor * this.fsaaScaleFactor) }); - case ASPECT_RATIO_CORRECTION: - if (this.aspectRatioCorrection == IOculusRift.AspectCorrectionType.CORRECTION_16_10_TO_16_9.getValue()) - return var4 + "16:10->16:9"; - else if (this.aspectRatioCorrection == IOculusRift.AspectCorrectionType.CORRECTION_16_9_TO_16_10.getValue()) - return var4 + "16:9->16:10"; - else if (this.aspectRatioCorrection == IOculusRift.AspectCorrectionType.CORRECTION_AUTO.getValue()) - return var4 + "Auto"; - else - return var4 + "None"; - case CROSSHAIR_SCALE: + return var4 + String.format("%.0f", new Object[] { Float.valueOf(this.hudYawOffset) }); + case RENDER_SCALEFACTOR: + return var4 + String.format("%.1f", new Object[] { Float.valueOf(this.renderScaleFactor) }); + case FSAA: + return this.useFsaa ? var4 + "ON" : var4 + "OFF"; + case CROSSHAIR_SCALE: return var4 + String.format("%.2f", new Object[] { Float.valueOf(this.crosshairScale) }); case MENU_CROSSHAIR_SCALE: return var4 + String.format("%.2f", new Object[] { Float.valueOf(this.menuCrosshairScale) }); @@ -1010,31 +713,17 @@ else if (this.renderBlockOutlineMode == RENDER_BLOCK_OUTLINE_MODE_ALWAYS) return var4 + "Always"; else if (this.renderBlockOutlineMode == RENDER_BLOCK_OUTLINE_MODE_NEVER) return var4 + "Never"; - case CROSSHAIR_ROLL: - return this.crosshairRollsWithHead ? var4 + "With Head" : var4 + "With HUD"; - case CROSSHAIR_SCALES_WITH_DISTANCE: - return this.crosshairScalesWithDistance ? var4 + "Distance" : var4 + "Static"; case HUD_OCCLUSION: - return this.hudOcclusion ? var4 + "ON" : var4 + "OFF"; - case CROSSHAIR_OCCLUSION: - return this.useCrosshairOcclusion ? var4 + "ON" : var4 + "OFF"; - case MAX_CROSSHAIR_DISTANCE_AT_BLOCKREACH: - return this.maxCrosshairDistanceAtBlockReach ? var4 + "Reach" : var4 + "Far"; - case MAX_FOV: - return this.useMaxFov ? var4 + "Max" : var4 + "Default"; - case CHAT_FADE_AWAY: - return this.chatFadeAway ? var4 + "Fades" : var4 + "Stays"; - case SOUND_ORIENT: - return this.soundOrientWithHead ? var4 + "Headphones" : var4 + "Speakers"; - case CHAT_OFFSET_X: - return var4 + String.format("%.0f%%", new Object[] { Float.valueOf(100*this.chatOffsetX) }); - case CHAT_OFFSET_Y: - return var4 + String.format("%.0f%%", new Object[] { Float.valueOf(100*this.chatOffsetY) }); - case INERTIA_FACTOR: - if (this.inertiaFactor == INERTIA_NONE) - return var4 + "Automan"; - else if (this.inertiaFactor == INERTIA_NORMAL) - return var4 + "Normal"; + return this.hudOcclusion ? var4 + "ON" : var4 + "OFF"; + case CROSSHAIR_OCCLUSION: + return this.useCrosshairOcclusion ? var4 + "ON" : var4 + "OFF"; + case MONO_FOV: + return var4 + String.format("%.0f\u00B0", new Object[] { Float.valueOf(this.mc.gameSettings.fovSetting) }); + case INERTIA_FACTOR: + if (this.inertiaFactor == INERTIA_NONE) + return var4 + "Automan"; + else if (this.inertiaFactor == INERTIA_NORMAL) + return var4 + "Normal"; else if (this.inertiaFactor == INERTIA_LARGE) return var4 + "A lot"; else if (this.inertiaFactor == INERTIA_MASSIVE) @@ -1048,8 +737,10 @@ else if (this.inertiaFactor == INERTIA_MASSIVE) //JRBUDDA case ALLOW_MODE_SWITCH: return this.vrAllowLocoModeSwotch ? var4 + "ON" : var4 + "OFF"; - case FREE_MOVE_DEFAULT: - return this.vrFreeMove ? var4 + "ON" : var4 + "OFF"; + case MOVE_MODE: + if(this.vrFreeMove == false){ + return var4 + "Teleport"; + } else return var4+ "Free Move"; case ALLOW_CRAWLING: return this.vrAllowCrawling ? var4 + "ON" : var4 + "OFF"; case LIMIT_TELEPORT: @@ -1071,6 +762,40 @@ else if (this.inertiaFactor == INERTIA_MASSIVE) case PLAY_MODE_SEATED: return this.seated ? var4 + "SEATED" : var4 + "STANDING"; //END JRBUDDA + case REALISTIC_JUMP: + return this.realisticJumpEnabled ? var4 + "ON" : var4 + "OFF"; + case REALISTIC_SNEAK: + return this.realisticSneakEnabled ? var4 + "ON" : var4 + "OFF"; + case REALISTIC_CLIMB: + return this.realisticClimbEnabled ? var4 + "ON" : var4 + "OFF"; + case REALISTIC_SWIM: + return this.realisticSwimEnabled ? var4 + "ON" : var4 + "OFF"; + case REALISTIC_ROW: + return this.realisticRowEnabled ? var4 + "ON" : var4 + "OFF"; + case VEHICLE_ROTATION: + return this.vehicleRotation ? var4 + "ON" : var4 + "OFF"; + case CALIBRATE_HEIGHT: + return var2; + case WALK_MULTIPLIER: + return var4+ String.format("%.1f",walkMultiplier); + case X_SENSITIVITY: + return var4+ String.format("%.2f",xSensitivity); + case Y_SENSITIVITY: + return var4+ String.format("%.2f",ySensitivity); + case KEYHOLE: + return var4+ String.format("%.0f",keyholeX); + case RESET_ORIGIN: + return var2; + case FREEMOVE_MODE: + switch (this.vrFreeMoveMode) { + // VIVE - lock to hand instead of body + case FREEMOVE_CONTROLLER: + return var4 + " Controller"; + case FREEMOVE_HMD: + return var4 + " HMD"; + case FREEMOVE_RUNINPLACE: + return var4 + " RunInPlace"; + } default: return ""; } @@ -1079,51 +804,32 @@ else if (this.inertiaFactor == INERTIA_MASSIVE) public float getOptionFloatValue(VRSettings.VrOptions par1EnumOptions) { switch( par1EnumOptions ) { - case EYE_RELIEF_ADJUST: - return this.eyeReliefAdjust; - case NECK_LENGTH : - return this.neckBaseToEyeHeight ; case MOVEMENT_MULTIPLIER : return this.movementSpeedMultiplier ; - case TOTAL_IPD: - return getIPD(); - case LEFT_HALF_IPD: - return getHalfIPD(EyeType.ovrEye_Left) ; - case RIGHT_HALF_IPD: - return getHalfIPD(EyeType.ovrEye_Right) ; case HUD_SCALE : return this.hudScale ; case HUD_OPACITY : return this.hudOpacity ; - case RENDER_PLAYER_OFFSET : - return this.renderPlayerOffset ; - case MONO_FOV: - return this.mc.gameSettings.fovSetting; - case RENDER_SCALEFACTOR: - return this.renderScaleFactor; case HUD_DISTANCE : return this.hudDistance ; case HUD_PITCH : return this.hudPitchOffset ; case HUD_YAW : return this.hudYawOffset ; - case FOV_CHANGE: - return this.fovChange; - case LENS_SEPARATION_SCALE_FACTOR: - return this.lensSeparationScaleFactor ; - case FSAA_SCALEFACTOR: - return this.fsaaScaleFactor; case CROSSHAIR_SCALE : return this.crosshairScale ; case MENU_CROSSHAIR_SCALE : return this.menuCrosshairScale ; - case CHAT_OFFSET_X: - return this.chatOffsetX; - case CHAT_OFFSET_Y: - return this.chatOffsetY; + case WALK_MULTIPLIER: + return this.walkMultiplier; + case X_SENSITIVITY: + return this.xSensitivity; + case Y_SENSITIVITY: + return this.ySensitivity; + case KEYHOLE: + return this.keyholeX; // VIVE START - new options - case WORLD_SCALE: - + case WORLD_SCALE: if(vrWorldScale == 0.1f) return 0; if(vrWorldScale == 0.25f) return 1; if(vrWorldScale >= 0.5f && vrWorldScale <= 2.0f) return (vrWorldScale / 0.1f) - 3f; @@ -1140,7 +846,6 @@ public float getOptionFloatValue(VRSettings.VrOptions par1EnumOptions) if(vrWorldScale == 75) return 28; if(vrWorldScale == 100) return 29; return 7; - case WORLD_ROTATION: return vrWorldRotation; case WORLD_ROTATION_INCREMENT: @@ -1149,8 +854,12 @@ public float getOptionFloatValue(VRSettings.VrOptions par1EnumOptions) if(vrWorldRotationIncrement == 45f) return 2; if(vrWorldRotationIncrement == 90f) return 3; if(vrWorldRotationIncrement == 180f) return 4; + return 0; + case MONO_FOV: + return this.mc.gameSettings.fovSetting; + case RENDER_SCALEFACTOR: + return this.renderScaleFactor; // VIVE END - new options - default: return 0.0f; } @@ -1162,19 +871,6 @@ public void setOptionValue(VRSettings.VrOptions par1EnumOptions, int par2) { switch( par1EnumOptions ) { - case USE_VR: - this.useVRRenderer = !this.useVRRenderer; - //mc.setUseVRRenderer(useVRRenderer); // TODO: - break; - case USE_DISTORTION: - this.useDistortion = !this.useDistortion; - break; - case LOAD_MUMBLE_LIB: - this.loadMumbleLib = !this.loadMumbleLib; - break; - case RENDER_OWN_HEADWEAR: - this.renderHeadWear = !this.renderHeadWear; - break; case RENDER_MENU_BACKGROUND: this.menuBackground = !this.menuBackground; break; @@ -1186,25 +882,7 @@ public void setOptionValue(VRSettings.VrOptions par1EnumOptions, int par2) if (this.renderFullFirstPersonModelMode > RENDER_FIRST_PERSON_NONE) this.renderFullFirstPersonModelMode = RENDER_FIRST_PERSON_FULL; break; - case TIMEWARP: - this.useTimewarp = !this.useTimewarp; - break; - case TIMEWARP_JIT_DELAY: - this.useTimewarpJitDelay = !this.useTimewarpJitDelay; - break; - case VIGNETTE: - this.useVignette = !this.useVignette; - break; - case LOW_PERSISTENCE: - this.useLowPersistence = !this.useLowPersistence; - break; - case DYNAMIC_PREDICTION: - this.useDynamicPrediction = !this.useDynamicPrediction; - break; - case OVERDRIVE_DISPLAY: - this.useDisplayOverdrive = !this.useDisplayOverdrive; - break; - case MIRROR_DISPLAY: + case MIRROR_DISPLAY: this.displayMirrorMode++; if (this.displayMirrorMode > MIRROR_FIRST_PERSON) this.displayMirrorMode = MIRROR_OFF; @@ -1234,28 +912,10 @@ public void setOptionValue(VRSettings.VrOptions par1EnumOptions, int par2) case INSIDE_BLOCK_SOLID_COLOR: this.insideBlockSolidColor = !this.insideBlockSolidColor; break; - case POS_TRACK_HIDE_COLLISION: - this.posTrackBlankOnCollision = !this.posTrackBlankOnCollision; - break; case WALK_UP_BLOCKS: this.walkUpBlocks = !this.walkUpBlocks; break; - case PITCH_AFFECTS_FLYING: - this.allowPitchAffectsHeightWhileFlying = !this.allowPitchAffectsHeightWhileFlying; - break; - case VIEW_BOBBING: - this.mc.gameSettings.viewBobbing = !this.mc.gameSettings.viewBobbing; - break; - case TEXTURE_LOOKUP_OPT: - this.useDistortionTextureLookupOptimisation = !this.useDistortionTextureLookupOptimisation; - break; - case FXAA: - this.useFXAA = !this.useFXAA; - break; - case PITCH_AFFECTS_CAMERA: - this.allowMousePitchInput = !this.allowMousePitchInput; - break; - case HUD_LOCK_TO: + case HUD_LOCK_TO: switch (this.vrHudLockMode) { // VIVE - lock to hand instead of body case HUD_LOCK_HAND: @@ -1265,30 +925,16 @@ public void setOptionValue(VRSettings.VrOptions par1EnumOptions, int par2) this.vrHudLockMode = HUD_LOCK_WRIST; break; case HUD_LOCK_WRIST: - this.vrHudLockMode = HUD_LOCK_HAND; + this.vrHudLockMode = HUD_LOCK_BODY; break; + case HUD_LOCK_BODY: + this.vrHudLockMode = HUD_LOCK_HAND; } break; case FSAA: this.useFsaa = !this.useFsaa; break; - case HIGH_QUALITY_DISTORTION: - this.useHighQualityDistortion = !this.useHighQualityDistortion; - break; - case ASPECT_RATIO_CORRECTION: - this.aspectRatioCorrection += 1; - if (this.aspectRatioCorrection > IOculusRift.AspectCorrectionType.CORRECTION_AUTO.getValue()) - this.aspectRatioCorrection = IOculusRift.AspectCorrectionType.CORRECTION_NONE.getValue(); - - setAspectCorrectionMode(this.aspectRatioCorrection); - break; - case USE_PROFILE_IPD: - this.useOculusProfileIpd = !this.useOculusProfileIpd; - break; - case CONFIG_IPD_MODE: - this.useHalfIpds = !this.useHalfIpds; - break; - case RENDER_CROSSHAIR_MODE: + case RENDER_CROSSHAIR_MODE: this.renderInGameCrosshairMode++; if (this.renderInGameCrosshairMode > RENDER_CROSSHAIR_MODE_NEVER) this.renderInGameCrosshairMode = RENDER_CROSSHAIR_MODE_ALWAYS; @@ -1298,30 +944,14 @@ public void setOptionValue(VRSettings.VrOptions par1EnumOptions, int par2) if (this.renderBlockOutlineMode > RENDER_BLOCK_OUTLINE_MODE_NEVER) this.renderBlockOutlineMode = RENDER_BLOCK_OUTLINE_MODE_ALWAYS; break; - case CROSSHAIR_ROLL: - this.crosshairRollsWithHead = !this.crosshairRollsWithHead; - break; - case CROSSHAIR_SCALES_WITH_DISTANCE: - this.crosshairScalesWithDistance = !this.crosshairScalesWithDistance; - break; + case HUD_OCCLUSION: this.hudOcclusion = !this.hudOcclusion; break; case CROSSHAIR_OCCLUSION: this.useCrosshairOcclusion = !this.useCrosshairOcclusion; break; - case MAX_CROSSHAIR_DISTANCE_AT_BLOCKREACH: - this.maxCrosshairDistanceAtBlockReach = !this.maxCrosshairDistanceAtBlockReach; - break; - case MAX_FOV: - this.useMaxFov = !this.useMaxFov; - break; - case CHAT_FADE_AWAY: - this.chatFadeAway = !this.chatFadeAway; - case SOUND_ORIENT: - this.soundOrientWithHead = !this.soundOrientWithHead; - break; - case INERTIA_FACTOR: + case INERTIA_FACTOR: this.inertiaFactor +=1; if (this.inertiaFactor > INERTIA_MASSIVE) this.inertiaFactor = INERTIA_NONE; @@ -1338,7 +968,7 @@ public void setOptionValue(VRSettings.VrOptions par1EnumOptions, int par2) case ALLOW_MODE_SWITCH: this.vrAllowLocoModeSwotch = !this.vrAllowLocoModeSwotch; break; - case FREE_MOVE_DEFAULT: + case MOVE_MODE: this.vrFreeMove = !this.vrFreeMove; Minecraft.getMinecraft().vrPlayer.setFreeMoveMode(vrFreeMove); break; @@ -1364,6 +994,43 @@ public void setOptionValue(VRSettings.VrOptions par1EnumOptions, int par2) this.seated = !this.seated; break; //JRBUDDA + case REALISTIC_JUMP: + realisticJumpEnabled = !realisticJumpEnabled; + break; + case REALISTIC_SWIM: + realisticSwimEnabled = !realisticSwimEnabled; + break; + case REALISTIC_CLIMB: + realisticClimbEnabled = !realisticClimbEnabled; + break; + case REALISTIC_ROW: + realisticRowEnabled = !realisticRowEnabled; + break; + case REALISTIC_SNEAK: + realisticSneakEnabled = !realisticSneakEnabled; + break; + case VEHICLE_ROTATION: + vehicleRotation = !vehicleRotation; + break; + case CALIBRATE_HEIGHT: + if(seated) { + MCOpenVR.resetPosition(); + } + playerEyeHeight = (float) Minecraft.getMinecraft().roomScale.getHMDPos_Room().yCoord; + break; + case FREEMOVE_MODE: + switch (this.vrFreeMoveMode) { + case FREEMOVE_CONTROLLER: + this.vrFreeMoveMode = FREEMOVE_HMD; + break; + case FREEMOVE_HMD: + this.vrFreeMoveMode = FREEMOVE_RUNINPLACE; + break; + case FREEMOVE_RUNINPLACE: + this.vrFreeMoveMode = FREEMOVE_CONTROLLER; + break; + } + break; default: break; @@ -1375,42 +1042,15 @@ public void setOptionValue(VRSettings.VrOptions par1EnumOptions, int par2) public void setOptionFloatValue(VRSettings.VrOptions par1EnumOptions, float par2) { switch( par1EnumOptions ) { - case EYE_HEIGHT: - setMinecraftPlayerEyeHeight(par2); - break; - case EYE_RELIEF_ADJUST: - this.eyeReliefAdjust = par2; - break; - case NECK_LENGTH: - this.neckBaseToEyeHeight = par2; - break; case MOVEMENT_MULTIPLIER: this.movementSpeedMultiplier = par2; break; - case TOTAL_IPD: - setIPD(par2); - break; - case LEFT_HALF_IPD: - setIPD(par2, this.rightHalfIpd); - break; - case RIGHT_HALF_IPD: - setIPD(this.leftHalfIpd, par2); - break; case HUD_SCALE: this.hudScale = par2; break; case HUD_OPACITY: this.hudOpacity = par2; break; - case RENDER_PLAYER_OFFSET: - this.renderPlayerOffset = par2; - break; - case MONO_FOV: - this.mc.gameSettings.fovSetting = par2; - break; - case RENDER_SCALEFACTOR: - this.renderScaleFactor = par2; - break; case HUD_DISTANCE: this.hudDistance = par2; break; @@ -1420,27 +1060,15 @@ public void setOptionFloatValue(VRSettings.VrOptions par1EnumOptions, float par2 case HUD_YAW: this.hudYawOffset = par2; break; - case FOV_CHANGE: - this.fovChange = par2; - break; - case LENS_SEPARATION_SCALE_FACTOR: - this.lensSeparationScaleFactor = par2; - break; - case FSAA_SCALEFACTOR: - this.fsaaScaleFactor = par2; - break; case CROSSHAIR_SCALE: this.crosshairScale = par2; break; case MENU_CROSSHAIR_SCALE: this.menuCrosshairScale = par2; break; - case CHAT_OFFSET_X: - this.chatOffsetX = par2; - break; - case CHAT_OFFSET_Y: - this.chatOffsetY = par2; - break; + case WALK_MULTIPLIER: + this.walkMultiplier=par2; + break; // VIVE START - new options case WORLD_SCALE: if(par2 == 0) vrWorldScale = 0.1f; @@ -1470,9 +1098,24 @@ public void setOptionFloatValue(VRSettings.VrOptions par1EnumOptions, float par2 if(par2 == 3f) this.vrWorldRotationIncrement = 90f; if(par2 == 4f) this.vrWorldRotationIncrement = 180f; break; - // VIVE END - new options + case X_SENSITIVITY: + this.xSensitivity=par2; + break; + case Y_SENSITIVITY: + this.ySensitivity=par2; + break; + case KEYHOLE: + this.keyholeX=par2; + break; + case MONO_FOV: + this.mc.gameSettings.fovSetting = par2; + break; + case RENDER_SCALEFACTOR: + this.renderScaleFactor = par2; + break; + // VIVE END - new options default: - break; + break; } this.saveOptions(); @@ -1499,83 +1142,36 @@ private void saveOptions(JSONObject theProfiles) var5.println("version:" + version); var5.println("newlyCreated:" + false ); - //var5.println("firstLoad:" + this.firstLoad ); - var5.println("useVRRenderer:"+ this.useVRRenderer ); - var5.println("debugPose:"+ this.debugPose ); + //var5.println("firstLoad:" + this.firstLoad ); var5.println("playerEyeHeight:" + this.playerEyeHeight); - var5.println("eyeReliefAdjust:" + this.eyeReliefAdjust); - var5.println("neckBaseToEyeHeight:" + this.neckBaseToEyeHeight ); - var5.println("headTrackerPluginID:"+ this.headTrackerPluginID); - var5.println("headPositionPluginID:"+ this.headPositionPluginID); - var5.println("hmdPluginID:"+ this.hmdPluginID); var5.println("stereoProviderPluginID:"+ this.stereoProviderPluginID); var5.println("badStereoProviderPluginID:"+ this.badStereoProviderPluginID); - var5.println("controllerPluginID:"+ this.controllerPluginID); - var5.println("leftHalfIpd:" + this.leftHalfIpd); - var5.println("rightHalfIpd:" + this.rightHalfIpd); var5.println("hudOpacity:" + this.hudOpacity); - var5.println("useDistortion:" + this.useDistortion); - var5.println("loadMumbleLib:" + this.loadMumbleLib); - var5.println("renderHeadWear:" + this.renderHeadWear); var5.println("menuBackground:" + this.menuBackground); var5.println("renderFullFirstPersonModelMode:" + this.renderFullFirstPersonModelMode); var5.println("shaderIndex:" + this.shaderIndex); - // 0.4.0 - var5.println("useTimewarp:" + this.useTimewarp); - var5.println("useTimewarpJitDelay:" + this.useTimewarpJitDelay); - var5.println("useVignette:" + this.useVignette); - var5.println("useLowPersistence:" + this.useLowPersistence); - var5.println("useDynamicPrediction:" + this.useDynamicPrediction); - var5.println("useDisplayOverdrive:" + this.useDisplayOverdrive); var5.println("displayMirrorMode:" + this.displayMirrorMode); var5.println("mixedRealityKeyColor:" + this.mixedRealityKeyColor.getRed() + "," + this.mixedRealityKeyColor.getGreen() + "," + this.mixedRealityKeyColor.getBlue()); var5.println("mixedRealityRenderHands:" + this.mixedRealityRenderHands); var5.println("insideBlockSolidColor:" + this.insideBlockSolidColor); - var5.println("posTrackBlankOnCollision:" + this.posTrackBlankOnCollision); var5.println("walkUpBlocks:" + this.walkUpBlocks); - var5.println("allowPitchAffectsHeightWhileFlying:" + this.allowPitchAffectsHeightWhileFlying); - var5.println("useDistortionTextureLookupOptimisation:" + this.useDistortionTextureLookupOptimisation); - var5.println("useFXAA:" + this.useFXAA); var5.println("hudScale:" + this.hudScale); - var5.println("renderPlayerOffset:" + this.renderPlayerOffset); var5.println("renderScaleFactor:" + this.renderScaleFactor); - var5.println("allowMousePitchInput:" + this.allowMousePitchInput); var5.println("vrHudLockMode:" + this.vrHudLockMode); var5.println("hudDistance:" + this.hudDistance); var5.println("hudPitchOffset:" + this.hudPitchOffset); var5.println("hudYawOffset:" + this.hudYawOffset); var5.println("useFsaa:" + this.useFsaa); - var5.println("useHighQualityDistortion:" + this.useHighQualityDistortion); - var5.println("fsaaScaleFactor:" + this.fsaaScaleFactor); - var5.println("fovChange:" + this.fovChange); - var5.println("lensSeparationScaleFactor:" + this.lensSeparationScaleFactor); - var5.println("headTrackSensitivity:" + this.headTrackSensitivity); var5.println("movementSpeedMultiplier:" + this.movementSpeedMultiplier); - var5.println("aspectRatioCorrection:" + this.aspectRatioCorrection); var5.println("renderInGameCrosshairMode:" + this.renderInGameCrosshairMode); var5.println("renderBlockOutlineMode:" + this.renderBlockOutlineMode); - var5.println("showEntityOutline:" + this.showEntityOutline); - var5.println("crosshairRollsWithHead:" + this.crosshairRollsWithHead); - var5.println("crosshairScalesWithDistance:" + this.crosshairScalesWithDistance); var5.println("hudOcclusion:" + this.hudOcclusion); var5.println("useCrosshairOcclusion:" + this.useCrosshairOcclusion); - var5.println("maxCrosshairDistanceAtBlockReach:" + this.maxCrosshairDistanceAtBlockReach); - var5.println("useMaxFov:" + this.useMaxFov); - var5.println("chatFadeAway:" + this.chatFadeAway); - var5.println("soundOrientWithHead:" + this.soundOrientWithHead); - var5.println("useOculusProfileIpd:" + this.useOculusProfileIpd); - var5.println("useHalfIpds:" + this.useHalfIpds); - var5.println("oculusProfileLeftHalfIpd:" + this.oculusProfileLeftHalfIpd); - var5.println("oculusProfileRightHalfIpd:" + this.oculusProfileRightHalfIpd); var5.println("crosshairScale:" + this.crosshairScale); var5.println("menuCrosshairScale:" + this.menuCrosshairScale); - var5.println("chatOffsetX:" + this.chatOffsetX); - var5.println("chatOffsetY:" + this.chatOffsetY); var5.println("inertiaFactor:" + this.inertiaFactor); - var5.println("useKeyBindingForComfortYaw:" + this.useKeyBindingForComfortYaw); var5.println("smoothRunTickCount:" + this.smoothRunTickCount); var5.println("smoothTick:" + this.smoothTick); - var5.println("allowAvatarIK:" + this.allowAvatarIK); var5.println("hideGui:" + this.hideGui); //VIVE var5.println("simulateFalling:" + this.simulateFalling); @@ -1601,6 +1197,22 @@ private void saveOptions(JSONObject theProfiles) var5.println("vrFixedCamrotRoll:" + this.vrFixedCamrotRoll); var5.println("vrTouchHotbar:" + this.vrTouchHotbar); var5.println("seated:" + this.seated); + var5.println("jumpThreshold:" + this.jumpThreshold); + var5.println("sneakThreshold:" + this.sneakThreshold); + var5.println("realisticJumpEnabled:" + this.realisticJumpEnabled); + var5.println("realisticSwimEnabled:" + this.realisticSwimEnabled); + var5.println("realisticClimbEnabled:" + this.realisticClimbEnabled); + var5.println("realisticRowEnabled:" + this.realisticRowEnabled); + var5.println("realisticSneakEnabled:" + this.realisticSneakEnabled); + var5.println("headToHmdLength:" + this.headToHmdLength); + var5.println("walkMultiplier:" + this.walkMultiplier); + var5.println("vrFreeMoveMode:" + this.vrFreeMoveMode); + var5.println("xSensitivity:" + this.xSensitivity); + var5.println("ySensitivity:" + this.ySensitivity); + var5.println("keyholeX:" + this.keyholeX); + var5.println("autoCalibration:" + this.autoCalibration); + var5.println("manualCalibration:" + this.manualCalibration); + var5.println("vehicleRotation:" + this.vehicleRotation); if (vrQuickCommands == null) vrQuickCommands = getQuickCommandsDefaults(); //defaults @@ -1631,95 +1243,16 @@ public void resetBindings(){ processBindings(); } - public void setMinecraftIpd(float leftHalfIpd, float rightHalfIpd) - { - this.leftHalfIpd = Math.abs(leftHalfIpd); - this.rightHalfIpd = Math.abs(rightHalfIpd); - } - - public void setMinecraftIpd(float Ipd) - { - this.leftHalfIpd = Math.abs(Ipd)/2f; - this.rightHalfIpd = Math.abs(Ipd)/2f; - } - - public void setOculusProfileIpd(float leftHalfIpd, float rightHalfIpd) - { - this.oculusProfileLeftHalfIpd = Math.abs(leftHalfIpd); - this.oculusProfileRightHalfIpd = Math.abs(rightHalfIpd); - } - - public void setOculusProfileIpd(float Ipd) - { - this.oculusProfileLeftHalfIpd = Math.abs(Ipd)/2f; - this.oculusProfileRightHalfIpd = Math.abs(Ipd)/2f; - } - - public void setIPD(float leftHalfIpd, float rightHalfIpd) - { - if (!this.useOculusProfileIpd) - { - setMinecraftIpd(leftHalfIpd, rightHalfIpd); - } - } - - public void setIPD(float Ipd) - { - if (!this.useOculusProfileIpd) - { - setMinecraftIpd(Ipd); - } - } - - public float getHalfIPD(EyeType eye) - { - if (this.useOculusProfileIpd) - { - if (eye == EyeType.ovrEye_Center) - return 0f; - else if (eye == EyeType.ovrEye_Left) - return -Math.abs(this.oculusProfileLeftHalfIpd); - else - return Math.abs(this.oculusProfileRightHalfIpd); - } - else - { - if (eye == EyeType.ovrEye_Center) - return 0f; - else if (eye == EyeType.ovrEye_Left) - return -Math.abs(this.leftHalfIpd); - else - return Math.abs(this.rightHalfIpd); - } - } - - public float getOculusProfileHalfIPD(EyeType eye) - { - if (eye == EyeType.ovrEye_Center) - return 0f; - else if (eye == EyeType.ovrEye_Left) - return -Math.abs(this.oculusProfileLeftHalfIpd); - else - return Math.abs(this.oculusProfileRightHalfIpd); - } - - public float getIPD() - { - if (this.useOculusProfileIpd) - { - return Math.abs(this.oculusProfileLeftHalfIpd) + Math.abs(this.oculusProfileRightHalfIpd); - } - else - { - return Math.abs(this.leftHalfIpd) + Math.abs(this.rightHalfIpd); - } - } - + public void setMinecraftPlayerEyeHeight(float eyeHeight) { this.playerEyeHeight = eyeHeight; } + public float getMinecraftPlayerEyeHeight(){ + return playerEyeHeight; + } + /** @@ -1730,40 +1263,6 @@ private float parseFloat(String par1Str) return par1Str.equals("true") ? 1.0F : (par1Str.equals("false") ? 0.0F : Float.parseFloat(par1Str)); } - private void setAspectCorrectionMode(int mode) - { - switch(mode) - { - case 1: - this.aspectRatioCorrectionMode = IOculusRift.AspectCorrectionType.CORRECTION_16_9_TO_16_10; - break; - case 2: - this.aspectRatioCorrectionMode = IOculusRift.AspectCorrectionType.CORRECTION_16_10_TO_16_9; - break; - case 3: - this.aspectRatioCorrectionMode = IOculusRift.AspectCorrectionType.CORRECTION_AUTO; - break; - default: - this.aspectRatioCorrectionMode = IOculusRift.AspectCorrectionType.CORRECTION_NONE; - break; - } - } - - public IOculusRift.AspectCorrectionType getAspectRatioCorrectionMode() - { - return this.aspectRatioCorrectionMode; - } - - public void setAspectRatioCorrectionMode(IOculusRift.AspectCorrectionType mode) - { - this.aspectRatioCorrection = mode.getValue(); - } - - public void setHeadTrackSensitivity(float value) - { - this.headTrackSensitivity = value; - } - public float getHeadTrackSensitivity() { //if (this.useQuaternions) @@ -1798,7 +1297,6 @@ public static enum VrOptions // TODO: Port to Mark's excellent VROption implementation //General - USE_VR("VR mode", false, true), HUD_SCALE("HUD Size", true, false), HUD_DISTANCE("HUD Distance", true, false), HUD_PITCH("HUD Vertical Offset", true, false), @@ -1809,10 +1307,7 @@ public static enum VrOptions HUD_HIDE("Hide HUD (F1)", false, true), HUD_OCCLUSION("HUD Occlusion", false, true), CROSSHAIR_OCCLUSION("Crosshair Occlusion", false, true), - MAX_CROSSHAIR_DISTANCE_AT_BLOCKREACH("Max. Crosshair Dist.", false, true), - MAX_FOV("Use FOV", false, true), CHAT_FADE_AWAY("Chat Persistence", false, true), - SOUND_ORIENT("Sound Source", false, true), DUMMY("Dummy", false, true), DUMMY_SMALL("Dummy", false, true), VR_RENDERER("Stereo Renderer", false, true), @@ -1825,64 +1320,21 @@ public static enum VrOptions CROSSHAIR_ROLL("Roll Crosshair", false, true), CROSSHAIR_SCALES_WITH_DISTANCE("Crosshair Scaling", false, true), RENDER_BLOCK_OUTLINE_MODE("Show Block Outline", false, true), - CHAT_OFFSET_X("Chat Offset X",true,false), - CHAT_OFFSET_Y("Chat Offset Y",true,false), LOAD_MUMBLE_LIB("Load Mumble Lib", false, true), // Player - EYE_HEIGHT("Eye Height", true, false), - EYE_PROTRUSION("Eye Protrusion", true, false), - EYE_RELIEF_ADJUST("Eye Relief Adjust", true, false), - NECK_LENGTH("Neck Length", true, false), - RENDER_OWN_HEADWEAR("Render Own Headwear", false, true), + RENDER_OWN_HEADWEAR("Render Own Headwear", false, true), RENDER_FULL_FIRST_PERSON_MODEL_MODE("First Person Model", false, true), RENDER_PLAYER_OFFSET("View Body Offset", true, false), - MONO_FOV("Mirror/MR FOV", true, false), - CONFIG_IPD_MODE("Set IPD", false, true), - USE_PROFILE_PLAYER_HEIGHT("Use Height from", false, true), - USE_PROFILE_IPD("Use IPD from", false, true), - TOTAL_IPD("IPD", true, false), - LEFT_HALF_IPD("Left Half IPD", true, false), - RIGHT_HALF_IPD("Right Half IPD", true, false), - //IPD_SCALE("IPD Scale", true, false), - OCULUS_PROFILE_NAME("Oculus Profile", false, true), - OCULUS_PROFILE_GENDER("Gender", false, true), + //HMD/render - USE_DISTORTION("Distortion", false, true), - CHROM_AB_CORRECTION("Chrom. Ab. Correction", false, true), - TIMEWARP("Timewarp", false, true), - TIMEWARP_JIT_DELAY("Timewarp JIT Delay", false, true), - VIGNETTE("Vignette", false, true), - TEXTURE_LOOKUP_OPT("Dist. Method", false, true), - FXAA("FXAA", false, true), - FOV_CHANGE("FOV Border Change", true, false), - LENS_SEPARATION_SCALE_FACTOR("Lens Sep. Scale", true, false), - ASPECT_RATIO_CORRECTION("Asp. Correction", false, false), FSAA("FSAA", false, true), - HIGH_QUALITY_DISTORTION("HQ Distortion", false, true), - FSAA_SCALEFACTOR("FSAA", true, false), - USE_QUATERNIONS("Orient. Mode", false, true), - DELAYED_RENDER("Render Mode", false, true), - // SDK 0.4.0 up - RENDER_SCALEFACTOR("Render Scale", true, false), - //ENABLE_DIRECT("Render Mode", false, true), MIRROR_DISPLAY("Mirror Display", false, true), MIXED_REALITY_KEY_COLOR("MR Key Color", false, false), MIXED_REALITY_RENDER_HANDS("MR Show Hands", false, true), INSIDE_BLOCK_SOLID_COLOR("Inside Block", false, true), - LOW_PERSISTENCE("Low Persistence", false, true), - DYNAMIC_PREDICTION("Dynamic Prediction", false, true), - OVERDRIVE_DISPLAY("Overdrive Display", false, true), - HMD_NAME_PLACEHOLDER("", false, true), - EYE_RELIEF_PLACEHOLDER("", false, true), - - POS_TRACK_Y_AXIS_DISTANCE_SKEW("Distance Skew Angle", true, false), - // SDK 0.4.0 up - POS_TRACK_HIDE_COLLISION("Blank on collision", false, true), WALK_UP_BLOCKS("Walk up blocks", false, true), - VIEW_BOBBING("View Bobbing", false, true), - PITCH_AFFECTS_FLYING("Pitch Affects Flying", false, true), //Movement/aiming controls DECOUPLE_LOOK_MOVE("Decouple Look/Move", false, true), MOVEMENT_MULTIPLIER("Move. Speed Multiplier", true, false), @@ -1896,14 +1348,6 @@ public static enum VrOptions JOYSTICK_AIM_TYPE("Aim Type", false, false), AIM_PITCH_OFFSET("Vertical Cursor Offset",true,false), INERTIA_FACTOR("Player Inertia",false,true), - USE_VR_COMFORT("VR Comfort", false, true), - ALLOW_FORWARD_PLUS_STRAFE("Forward + Strafe", false, true), - VR_COMFORT_USE_KEY_BINDING_FOR_YAW("Trigger Yaw With", false, true), - VR_COMFORT_TRANSITION_LINEAR("Transition Mode", false, true), - MOVEMENT_ACCELERATION_SCALE_FACTOR("Player Accel.", true, false), - VR_COMFORT_TRANSITION_TIME_SECS("Transition Time", true, false), - VR_COMFORT_TRANSITION_ANGLE_DEGS("Transition Angle", true, false), - VR_COMFORT_TRANSITION_BLANKING_MODE("Transition Blanking", false, false), // VIVE START - new options SIMULATE_FALLING("Simulate falling", false, true), @@ -1913,7 +1357,7 @@ public static enum VrOptions //JRBUDDA VIVE ALLOW_CRAWLING("Allow crawling",false, true), ALLOW_MODE_SWITCH("Allow Mode Switch",false, true), - FREE_MOVE_DEFAULT("Default to Free Move",false, true), + MOVE_MODE("Move Mode",false, true), LIMIT_TELEPORT("Limit TP in Survival",false, true), REVERSE_HANDS("Reverse Hands",false, true), STENCIL_ON("Use Eye Stencil", false, true), @@ -1923,7 +1367,23 @@ public static enum VrOptions WORLD_ROTATION_INCREMENT("Rotation Increment", true, false), TOUCH_HOTBAR("Touch Hotbar Enabled", false, true), PLAY_MODE_SEATED("Play Mode", false, true), + RENDER_SCALEFACTOR("Render Scale Factor", true, false), + MONO_FOV("Mono FOV", true, false), //END JRBUDDA + REALISTIC_JUMP("Roomscale Jumping",false,true), + REALISTIC_SNEAK("Roomscale Sneaking",false,true), + REALISTIC_CLIMB("Roomscale Climbing",false,true), + REALISTIC_SWIM("Roomscale Swimming",false,true), + REALISTIC_ROW("Roomscale Rowing",false,true), + CALIBRATE_HEIGHT("Calibrate Height",false,true), + WALK_MULTIPLIER("Walking Multipier",true,false), + FREEMOVE_MODE("Move Type", false, true), + VEHICLE_ROTATION("Vechile Rotation",false,true), + //SEATED + RESET_ORIGIN("Reset Origin",false,true), + X_SENSITIVITY("Rotation Speed",true,false), + Y_SENSITIVITY("Y Sensitivity",true,false), + KEYHOLE("Keyhole",true,false), // OTher buttons OTHER_HUD_SETTINGS("Overlay/Crosshair/Chat...", false, true), @@ -2011,22 +1471,6 @@ public void setValueMax(float p_148263_1_) this.valueMax = p_148263_1_; } - public float normalizeValue(float p_148266_1_) - { - return MathHelper.clamp_float((this.snapToStepClamp(p_148266_1_) - this.valueMin) / (this.valueMax - this.valueMin), 0.0F, 1.0F); - } - - public float denormalizeValue(float p_148262_1_) - { - return this.snapToStepClamp(this.valueMin + (this.valueMax - this.valueMin) * MathHelper.clamp_float(p_148262_1_, 0.0F, 1.0F)); - } - - public float snapToStepClamp(float p_148268_1_) - { - p_148268_1_ = this.snapToStep(p_148268_1_); - return MathHelper.clamp_float(p_148268_1_, this.valueMin, this.valueMax); - } - protected float snapToStep(float p_148264_1_) { if (this.valueStep > 0.0F)