mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-05 18:57:14 -04:00
first person cam proof of concept
This commit is contained in:
@@ -65,6 +65,9 @@ struct UserSettings {
|
||||
|
||||
// Controls
|
||||
ConfigVar<bool> enableTurboKeybind;
|
||||
|
||||
// VR
|
||||
ConfigVar<bool> vrCamera;
|
||||
} game;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user