Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openxr 1.21.4 #339

Draft
wants to merge 36 commits into
base: Multiloader-1.21.4
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
56cbd57
[WIP] Add openXR support (#230)
ferriarnus Aug 1, 2024
d51fea3
add subactionPaths and XR_SWAPCHAIN_CREATE_STATIC_IMAGE_BIT
ferriarnus Nov 1, 2024
2b97efb
test oculus openxr env
ferriarnus Nov 19, 2024
344dbb7
now for real, not with steamVR as default...
ferriarnus Nov 19, 2024
9996980
fix lwjgl openxr version
fayer3 Nov 21, 2024
5aa3faa
Merge remote-tracking branch 'remotes/origin/Multiloader-1.20.4' into…
fayer3 Nov 22, 2024
f09afdd
Fix Conformance Issues (#315)
CADIndie Nov 23, 2024
68d7d90
Create DeviceCompat for QuestCraft (#317)
CADIndie Nov 24, 2024
55aaad9
Merge remote-tracking branch 'remotes/origin/Multiloader-1.20.4' into…
fayer3 Nov 24, 2024
d4b5001
Merge branch 'Multiloader-1.20.4' into openxr
ferriarnus Dec 3, 2024
c154b9d
update after cleanup
ferriarnus Dec 3, 2024
1c77f7b
Merge branch 'Multiloader-1.20.4' into openxr
ferriarnus Dec 4, 2024
7264eed
update + cleanup
ferriarnus Dec 5, 2024
faa5263
fix eye position
ferriarnus Dec 5, 2024
d765122
fix openxr head rotation
fayer3 Dec 10, 2024
c8f298b
fix nullvr eye offset after last change
fayer3 Dec 11, 2024
8c95d05
fix lwjgl dependency declaration, parchment mappings and mixin extras
fayer3 Dec 16, 2024
1ede10d
fix fabric build gradle
fayer3 Dec 23, 2024
cbbe2c4
Merge branch 'openxr' into Multiloader-1.21.4
CADIndie Jan 7, 2025
c934837
Fixes and temp changes
CADIndie Jan 8, 2025
9f1099b
Merge pull request #338 from CADIndie/1.21.4-OpenXR
fayer3 Jan 8, 2025
b73f89f
some formatting, and cleanup
fayer3 Jan 8, 2025
d6205e0
fix binding origin name getting
fayer3 Jan 8, 2025
1a8ea30
change mirror to use framebuffer blits and openvr/nullvr fixes
fayer3 Jan 8, 2025
ad9099b
Merge remote-tracking branch 'remotes/origin/Multiloader-1.21.4' into…
fayer3 Jan 8, 2025
054fb74
handle VR events regardless of active state
fayer3 Jan 8, 2025
b54e705
fix inputs with openvr
fayer3 Jan 8, 2025
ab612fc
projection matrix only once per frame
fayer3 Jan 8, 2025
3a71a9e
fix analog button input
fayer3 Jan 8, 2025
48023e9
add interact/climbey bindings, fix cosoms bindings
fayer3 Jan 8, 2025
6c3a95b
Add Default, Pico, and Index Controller Bindings
CADIndie Jan 28, 2025
a87509b
Totally didn't forget the extension
CADIndie Jan 28, 2025
d61dd16
Merge pull request #348 from CADIndie/Bindings
fayer3 Jan 28, 2025
db061c1
Set Refresh Rate
CADIndie Jan 28, 2025
248facb
Ensure FBRefreshRate Before Usage
CADIndie Feb 15, 2025
beabae1
Merge pull request #349 from CADIndie/Refresh-Rate
fayer3 Feb 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ subprojects {
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.layered() {
// The following line declares the mojmap mappings, you may use other mappings as well
// The following line declares the mojmap mappings
officialMojangMappings()
// The following line declares the yarn mappings you may select this one as well.
// "net.fabricmc:yarn:1.18.2+build.4:v2"
// parchment mappings as backup
parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchment_version}@zip")
}
Expand All @@ -34,6 +32,13 @@ subprojects {
implementation("org.lwjgl:lwjgl-openvr:${rootProject.lwjgl_version}:natives-macos")
implementation("org.lwjgl:lwjgl-openvr:${rootProject.lwjgl_version}:natives-windows")

// Use custom OpenXR lib for Android and GLES bindings
//implementation("QuestCraftPlusPlus:lwjgl3:${rootProject.lwjgl_version}:lwjgl-openxr-${rootProject.lwjgl_version}")

implementation("org.lwjgl:lwjgl-openxr:${rootProject.lwjgl_version}")
implementation("org.lwjgl:lwjgl-openxr:${rootProject.lwjgl_version}:natives-linux")
implementation("org.lwjgl:lwjgl-openxr:${rootProject.lwjgl_version}:natives-windows")

// for OSC tracker support
implementation("com.illposed.osc:javaosc-core:0.9")
}
Expand Down Expand Up @@ -155,17 +160,16 @@ allprojects {
exclusiveContent {
forRepository {
ivy {
name = "Discord"
url = "https://cdn.discordapp.com/attachments/"
name = "GitHub"
url = "https://github.com/"
patternLayout {
artifact '/[organisation]/[module]/[revision].[ext]'
artifact '/[organisation]/[module]/releases/download/[revision]/[classifier].jar'
}
metadataSources { artifact() }
}
}
filter {
// discords are always just numbers
includeGroupByRegex "^\\d*\$"

}
}
}
Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dependencies {
compileOnly('com.electronwill.night-config:toml:3.6.6')

//LaunchPopup
implementation 'com.github.Vivecraft:LaunchPopup:1.1.1'
implementation 'Vivecraft:LaunchPopup:1.1.1:LaunchPopup-1.1.1'
}
// extract the LaunchPopup classes
jar {
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/org/vivecraft/client_vr/VRData.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public VRData(Vec3 origin, float walkMul, float worldScale, float rotation) {
Vector3f scaleOffset = new Vector3f(scaledPos.x - hmd_raw.x, 0.0F, scaledPos.z - hmd_raw.z);

// headset
this.hmd = new VRDevicePose(this, mcVR.hmdRotation, scaledPos, mcVR.getHmdVector());
this.hmd = new VRDevicePose(this, mcVR.getEyeRotation(RenderPass.CENTER), scaledPos, mcVR.getHmdVector());

this.eye0 = new VRDevicePose(this,
mcVR.getEyeRotation(RenderPass.LEFT),
Expand Down
15 changes: 9 additions & 6 deletions common/src/main/java/org/vivecraft/client_vr/VRState.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.vivecraft.client_vr.menuworlds.MenuWorldRenderer;
import org.vivecraft.client_vr.provider.nullvr.NullVR;
import org.vivecraft.client_vr.provider.openvr_lwjgl.MCOpenVR;
import org.vivecraft.client_vr.provider.openxr.MCOpenXR;
import org.vivecraft.client_vr.render.RenderConfigException;
import org.vivecraft.client_vr.settings.VRSettings;
import org.vivecraft.client_xr.render_pass.RenderPassManager;
Expand Down Expand Up @@ -51,11 +52,13 @@ public static void initializeVR() {
}

ClientDataHolderVR dh = ClientDataHolderVR.getInstance();
if (dh.vrSettings.stereoProviderPluginID == VRSettings.VRProvider.OPENVR) {
dh.vr = new MCOpenVR(Minecraft.getInstance(), dh);
} else {
dh.vr = new NullVR(Minecraft.getInstance(), dh);
}
Minecraft instance = Minecraft.getInstance();
dh.vr = switch (dh.vrSettings.stereoProviderPluginID) {
case OPENVR -> new MCOpenVR(instance, dh);
case OPENXR -> new MCOpenXR(instance, dh);
default -> new NullVR(instance, dh);
};

if (!dh.vr.init()) {
throw new RenderConfigException(Component.translatable("vivecraft.messages.vriniterror"),
Component.translatable("vivecraft.messages.rendersetupfailed", dh.vr.initStatus, dh.vr.getName()));
Expand All @@ -66,7 +69,7 @@ public static void initializeVR() {
// everything related to VR is created now
VR_INITIALIZED = true;

dh.vrRenderer.setupRenderConfiguration();
dh.vrRenderer.setupRenderConfiguration(false); //For openXR, setup but don't render yet
RenderPassManager.setVanillaRenderPass();

dh.vrPlayer = new VRPlayer();
Expand Down
28 changes: 28 additions & 0 deletions common/src/main/java/org/vivecraft/client_vr/VRTextureTarget.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package org.vivecraft.client_vr;

import com.mojang.blaze3d.pipeline.RenderTarget;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.platform.TextureUtil;
import com.mojang.blaze3d.systems.RenderSystem;
import org.lwjgl.opengl.GL30;
import org.vivecraft.client.Xplat;
import org.vivecraft.client.extensions.RenderTargetExtension;

Expand Down Expand Up @@ -36,6 +39,31 @@ public VRTextureTarget(
this.setClearColor(0, 0, 0, 0);
}

public VRTextureTarget(String name, int width, int height, int colorId, int index) {
super(false);
this.name = name;
RenderSystem.assertOnRenderThreadOrInit();
this.resize(width, height);

// free the old one when setting a new one
if (this.colorTextureId != -1) {
TextureUtil.releaseTextureId(this.colorTextureId);
}
this.colorTextureId = colorId;

GlStateManager._glBindFramebuffer(GL30.GL_FRAMEBUFFER, this.frameBufferId);
// unset the old GL_COLOR_ATTACHMENT0
GlStateManager._glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL30.GL_TEXTURE_2D, 0,
0);
GL30.glFramebufferTextureLayer(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, colorId, 0, index);

// unbind the framebuffer
this.unbindRead();
this.unbindWrite();

this.setClearColor(0, 0, 0, 0);
}

@Override
public String toString() {
return """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ public static Vec3 applyGUIModelView(RenderPass currentPass, Matrix4f poseMatrix
direction = DH.vrPlayer.vrdata_world_render.getController(0).getDirection();
guirot = guirot.mul(DH.vr.getAimRotation(0), guirot);
} else {
guirot = guirot.mul(DH.vr.hmdRotation, guirot);
guirot = guirot.mul(DH.vr.getEyeRotation(RenderPass.CENTER), guirot);
}

guipos = new Vec3(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import net.minecraft.network.chat.Component;
import org.vivecraft.client.gui.framework.TwoHandedScreen;
import org.vivecraft.client_vr.provider.MCVR;
import org.vivecraft.client_vr.provider.openvr_lwjgl.VRInputAction;
import org.vivecraft.client_vr.provider.control.VRInputAction;

public class GuiRadial extends TwoHandedScreen {
private boolean isShift = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.vivecraft.client_vr.provider;

import org.vivecraft.client_vr.provider.openvr_lwjgl.control.VRInputActionSet;
import org.vivecraft.client_vr.provider.control.VRInputActionSet;

/**
* holds the parameters for a VR action key
Expand Down
Loading