2023-08-06 08:48:11 -04:00
|
|
|
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-04-09 15:31:19 -04:00
|
|
|
#pragma once
|
|
|
|
|
2023-07-09 10:54:27 -04:00
|
|
|
#include "filecache.h"
|
2023-07-07 16:16:21 -04:00
|
|
|
#include "mdlpart.h"
|
|
|
|
#include <QComboBox>
|
2023-04-09 15:31:19 -04:00
|
|
|
#include <QWidget>
|
|
|
|
#include <fmt/format.h>
|
2023-07-07 16:16:21 -04:00
|
|
|
#include <physis.hpp>
|
2023-04-09 15:31:19 -04:00
|
|
|
|
|
|
|
struct ModelInfo {
|
|
|
|
int primaryID;
|
|
|
|
int gearVersion = 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GearInfo {
|
|
|
|
std::string name;
|
|
|
|
Slot slot;
|
|
|
|
ModelInfo modelInfo;
|
|
|
|
|
|
|
|
std::string getMtrlPath(int raceID) {
|
2023-07-07 16:16:21 -04:00
|
|
|
return fmt::format(
|
|
|
|
"chara/equipment/e{gearId:04d}/material/v{gearVersion:04d}/mt_c{raceId:04d}e{gearId:04d}_{slot}_a.mtrl",
|
|
|
|
fmt::arg("gearId", modelInfo.primaryID),
|
|
|
|
fmt::arg("gearVersion", modelInfo.gearVersion),
|
|
|
|
fmt::arg("raceId", raceID),
|
|
|
|
fmt::arg("slot", physis_get_slot_name(slot)));
|
2023-04-09 15:31:19 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GameData;
|
|
|
|
|
|
|
|
class GearView : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2023-07-09 10:54:27 -04:00
|
|
|
explicit GearView(GameData* data, FileCache& cache);
|
2023-04-09 15:31:19 -04:00
|
|
|
|
|
|
|
/// Returns an inclusive list of races supported by the current gearset.
|
2023-07-07 16:01:39 -04:00
|
|
|
std::vector<std::pair<Race, Subrace>> supportedRaces() const;
|
2023-04-09 15:31:19 -04:00
|
|
|
|
|
|
|
/// Returns an inclusive list of genders supported by the current gearset.
|
|
|
|
std::vector<Gender> supportedGenders() const;
|
|
|
|
|
|
|
|
/// Returns an inclusive list of LoDs supported by the current gearset.
|
|
|
|
int lodCount() const;
|
|
|
|
|
2023-07-07 16:16:21 -04:00
|
|
|
void exportModel(const QString& fileName);
|
2023-04-09 15:31:19 -04:00
|
|
|
|
2023-07-07 16:16:21 -04:00
|
|
|
MDLPart& part() const;
|
2023-07-06 17:38:19 -04:00
|
|
|
|
2023-07-07 16:01:39 -04:00
|
|
|
Race currentRace = Race::Hyur;
|
|
|
|
Subrace currentSubrace = Subrace::Midlander;
|
|
|
|
Gender currentGender = Gender::Male;
|
|
|
|
|
2023-07-07 16:16:21 -04:00
|
|
|
Q_SIGNALS:
|
2023-04-09 15:31:19 -04:00
|
|
|
void gearChanged();
|
2023-07-06 17:38:19 -04:00
|
|
|
void modelReloaded();
|
2023-04-09 15:31:19 -04:00
|
|
|
|
|
|
|
void raceChanged();
|
2023-07-07 16:01:39 -04:00
|
|
|
void subraceChanged();
|
2023-04-09 15:31:19 -04:00
|
|
|
void genderChanged();
|
|
|
|
void levelOfDetailChanged();
|
|
|
|
|
2023-07-08 11:58:38 -04:00
|
|
|
void faceChanged();
|
|
|
|
void hairChanged();
|
|
|
|
void earChanged();
|
|
|
|
void tailChanged();
|
|
|
|
|
2023-07-07 16:16:21 -04:00
|
|
|
public Q_SLOTS:
|
2023-04-09 15:31:19 -04:00
|
|
|
void clear();
|
|
|
|
void addGear(GearInfo& gear);
|
|
|
|
|
|
|
|
void setRace(Race race);
|
2023-07-07 16:01:39 -04:00
|
|
|
void setSubrace(Subrace subrace);
|
2023-04-09 15:31:19 -04:00
|
|
|
void setGender(Gender gender);
|
|
|
|
void setLevelOfDetail(int lod);
|
|
|
|
|
2023-07-08 11:58:38 -04:00
|
|
|
void setFace(int bodyVer);
|
|
|
|
void setHair(int bodyVer);
|
|
|
|
void setEar(int bodyVer);
|
|
|
|
void setTail(int bodyVer);
|
|
|
|
|
2023-04-09 15:31:19 -04:00
|
|
|
void reloadModel();
|
2023-07-07 16:01:39 -04:00
|
|
|
void reloadRaceDeforms();
|
2023-04-09 15:31:19 -04:00
|
|
|
|
2023-07-07 16:16:21 -04:00
|
|
|
private:
|
2023-04-09 15:31:19 -04:00
|
|
|
int currentLod = 0;
|
|
|
|
|
|
|
|
uint32_t maxLod = 0;
|
|
|
|
|
|
|
|
std::vector<GearInfo> gears;
|
2023-07-08 11:58:38 -04:00
|
|
|
std::optional<int> face = 1, hair = 1, ear = 1, tail;
|
2023-04-09 15:31:19 -04:00
|
|
|
|
|
|
|
MDLPart* mdlPart = nullptr;
|
|
|
|
|
|
|
|
GameData* data;
|
2023-07-09 10:54:27 -04:00
|
|
|
FileCache& cache;
|
2023-04-09 15:31:19 -04:00
|
|
|
};
|