first person cam proof of concept

This commit is contained in:
madeline
2026-04-06 22:52:20 -07:00
parent f489cc2786
commit c6d65de5af
4 changed files with 33 additions and 0 deletions
+3
View File
@@ -65,6 +65,9 @@ struct UserSettings {
// Controls
ConfigVar<bool> enableTurboKeybind;
// VR
ConfigVar<bool> vrCamera;
} game;
};
+18
View File
@@ -23,6 +23,10 @@
#include <cmath>
#include <cstring>
#if TARGET_PC
#include "dusk/settings.h"
#endif
#if DEBUG
#include "d/d_debug_pad.h"
#include "d/d_debug_camera.h"
@@ -1355,6 +1359,20 @@ bool dCamera_c::Run() {
clrFlag(0x1000);
mTagCamTool.Clr();
field_0x89c.Clr();
#if TARGET_PC
if (dusk::getSettings().game.vrCamera && link != nullptr) {
MtxP headMtx = link->getHeadMtx();
cXyz headForward(headMtx[0][0], headMtx[1][0], headMtx[2][0]);
// place eye slightly in front of Link's eye position, looking forward
static constexpr f32 EYE_FORWARD_OFFSET = 20.0f;
static constexpr f32 CENTER_DISTANCE = 200.0f;
mEye = mViewCache.mEye = link->eyePos + headForward * EYE_FORWARD_OFFSET;
mCenter = mViewCache.mCenter = mEye + headForward * CENTER_DISTANCE;
}
#endif
return sp0F;
}
+9
View File
@@ -136,6 +136,15 @@ namespace dusk {
ImGui::EndMenu();
}
if (ImGui::BeginMenu("VR")) {
config::ImGuiCheckbox("VR Camera", getSettings().game.vrCamera);
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Places the camera at Link's eyes, facing where his head points");
}
ImGui::EndMenu();
}
ImGui::EndMenu();
}
}
+3
View File
@@ -53,6 +53,8 @@ UserSettings g_userSettings = {
// Controls
.enableTurboKeybind {"game.enableTurboKeybind", true},
.vrCamera {"game.vrCamera", false}
},
};
@@ -95,6 +97,7 @@ void registerSettings() {
Register(g_userSettings.game.midnasLamentNonStop);
Register(g_userSettings.game.enableTurboKeybind);
Register(g_userSettings.game.fastSpinner);
Register(g_userSettings.game.vrCamera);
}
// Transient settings