mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-20 19:57:44 +00:00
Add configurable camera distance, set to a smaller minimum in MDLViewer
This commit is contained in:
parent
5eebc2677f
commit
ab1d02b25a
3 changed files with 4 additions and 1 deletions
|
@ -32,6 +32,7 @@ MainWindow::MainWindow(GameData *data)
|
|||
dummyWidget->setLayout(layout);
|
||||
|
||||
part = new MDLPart(data, cache);
|
||||
part->minimumCameraDistance = 0.05f;
|
||||
|
||||
const int raceCode = physis_get_race_code(Race::Hyur, Subrace::Midlander, Gender::Male);
|
||||
|
||||
|
@ -59,6 +60,7 @@ void MainWindow::setupFileMenu(QMenu *menu)
|
|||
openMDLFile->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
|
||||
connect(openMDLFile, &QAction::triggered, [this] {
|
||||
auto fileName = QFileDialog::getOpenFileName(nullptr, i18nc("@title:window", "Open MDL File"), QStringLiteral("~"), i18n("FFXIV Model File (*.mdl)"));
|
||||
setWindowTitle(fileName);
|
||||
|
||||
auto buffer = physis_read_file(fileName.toStdString().c_str());
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
float pitch = 0.0f;
|
||||
float yaw = 0.0f;
|
||||
float cameraDistance = 2.0f;
|
||||
float minimumCameraDistance = 1.0f;
|
||||
glm::vec3 position{0, 0, 0};
|
||||
|
||||
std::unique_ptr<physis_Skeleton> skeleton;
|
||||
|
|
|
@ -108,7 +108,7 @@ bool VulkanWindow::event(QEvent *e)
|
|||
|
||||
if (part->isEnabled()) {
|
||||
part->cameraDistance -= (scrollEvent->angleDelta().y() / 120.0f) * 0.1f; // FIXME: why 120?
|
||||
part->cameraDistance = std::clamp(part->cameraDistance, 1.0f, 4.0f);
|
||||
part->cameraDistance = std::clamp(part->cameraDistance, part->minimumCameraDistance, 4.0f);
|
||||
}
|
||||
} break;
|
||||
case QEvent::KeyPress: {
|
||||
|
|
Loading…
Add table
Reference in a new issue