2022-04-11 21:59:37 -04:00
|
|
|
#pragma once
|
|
|
|
|
2022-04-17 20:02:06 -04:00
|
|
|
#include <QComboBox>
|
2022-08-11 17:53:56 -04:00
|
|
|
#include <QMainWindow>
|
|
|
|
#include <fmt/format.h>
|
2022-08-10 14:52:28 -04:00
|
|
|
#include <physis.hpp>
|
2022-08-11 17:53:56 -04:00
|
|
|
#include <unordered_map>
|
2022-04-11 21:59:37 -04:00
|
|
|
|
2022-04-11 23:11:33 -04:00
|
|
|
#include "renderer.hpp"
|
2022-04-12 12:39:33 -04:00
|
|
|
|
|
|
|
struct ModelInfo {
|
2022-04-12 15:28:29 -04:00
|
|
|
int primaryID;
|
2022-08-11 17:53:56 -04:00
|
|
|
int gearVersion = 1;
|
2022-04-12 12:39:33 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GearInfo {
|
|
|
|
std::string name;
|
|
|
|
Slot slot;
|
|
|
|
ModelInfo modelInfo;
|
2022-08-11 17:53:56 -04:00
|
|
|
|
|
|
|
std::string getMtrlPath(int raceID) {
|
|
|
|
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)));
|
|
|
|
}
|
2022-04-12 12:39:33 -04:00
|
|
|
};
|
|
|
|
|
2022-04-11 21:59:37 -04:00
|
|
|
class GameData;
|
2022-04-12 12:39:33 -04:00
|
|
|
class VulkanWindow;
|
2022-04-12 16:19:06 -04:00
|
|
|
class StandaloneWindow;
|
2022-04-11 21:59:37 -04:00
|
|
|
|
|
|
|
class MainWindow : public QMainWindow {
|
|
|
|
public:
|
2022-08-10 14:52:28 -04:00
|
|
|
MainWindow(GameData* data);
|
2022-04-11 21:59:37 -04:00
|
|
|
|
2022-08-10 14:52:28 -04:00
|
|
|
void exportModel(physis_MDL& model, physis_Skeleton& skeleton, QString fileName);
|
2022-04-12 20:02:50 -04:00
|
|
|
|
2022-04-11 21:59:37 -04:00
|
|
|
private:
|
2022-04-17 20:02:06 -04:00
|
|
|
void loadInitialGearInfo(GearInfo& info);
|
|
|
|
void reloadGearModel();
|
|
|
|
void reloadGearAppearance();
|
2022-08-10 14:52:28 -04:00
|
|
|
void calculate_bone_inverse_pose(physis_Skeleton& skeleton, physis_Bone& bone, physis_Bone* parent_bone);
|
|
|
|
void calculate_bone(physis_Skeleton& skeleton, physis_Bone& bone, const physis_Bone* parent_bone);
|
2022-04-17 20:02:06 -04:00
|
|
|
|
2022-04-12 12:39:33 -04:00
|
|
|
std::vector<GearInfo> gears;
|
2022-04-17 20:02:06 -04:00
|
|
|
|
|
|
|
struct LoadedGear {
|
|
|
|
GearInfo* gearInfo;
|
2022-08-10 14:52:28 -04:00
|
|
|
physis_MDL model;
|
2022-08-11 17:53:56 -04:00
|
|
|
physis_Material material;
|
2022-04-17 20:02:06 -04:00
|
|
|
RenderModel renderModel;
|
2022-08-11 17:53:56 -04:00
|
|
|
RenderTexture renderTexture;
|
2022-04-17 20:02:06 -04:00
|
|
|
};
|
|
|
|
|
2022-08-10 14:52:28 -04:00
|
|
|
struct BoneExtra {
|
|
|
|
glm::mat4 localTransform, finalTransform, inversePose;
|
|
|
|
};
|
|
|
|
|
2022-04-17 20:02:06 -04:00
|
|
|
LoadedGear loadedGear;
|
|
|
|
|
|
|
|
QComboBox* raceCombo, *lodCombo;
|
2022-04-12 12:39:33 -04:00
|
|
|
|
2022-08-10 14:52:28 -04:00
|
|
|
Race currentRace = Race::Hyur;
|
|
|
|
Subrace currentSubrace = Subrace::Midlander;
|
|
|
|
Gender currentGender = Gender::Male;
|
2022-04-14 10:32:41 -04:00
|
|
|
int currentLod = 0;
|
2022-04-28 17:50:05 -04:00
|
|
|
glm::vec3 currentScale = glm::vec3(1);
|
2022-08-10 14:52:28 -04:00
|
|
|
physis_Bone* currentEditedBone = nullptr;
|
2022-04-12 12:39:33 -04:00
|
|
|
|
2022-04-11 21:59:37 -04:00
|
|
|
GameData& data;
|
2022-04-11 23:11:33 -04:00
|
|
|
|
|
|
|
Renderer* renderer;
|
2022-04-12 12:39:33 -04:00
|
|
|
VulkanWindow* vkWindow;
|
2022-04-12 16:19:06 -04:00
|
|
|
StandaloneWindow* standaloneWindow;
|
2022-04-28 17:50:05 -04:00
|
|
|
|
2022-08-10 14:52:28 -04:00
|
|
|
physis_Skeleton skeleton;
|
|
|
|
std::vector<BoneExtra> extraBone;
|
2022-04-11 21:59:37 -04:00
|
|
|
};
|