|
1 | | -#pragma once |
2 | | -#include <map> |
3 | | -#include <optional> |
4 | | -#include <string> |
5 | | -#include <thread> |
6 | | -#include <vector> |
7 | | - |
8 | | - |
9 | | -class Obj { |
10 | | - explicit Obj(); |
11 | | - |
12 | | -public: |
13 | | - static Obj &getInstance() { |
14 | | - static Obj instance; |
15 | | - return instance; |
16 | | - } |
17 | | - |
18 | | - std::string loadObjName; |
19 | | - std::string saveObjName; |
20 | | - std::string lastObjFileName; |
21 | | - std::string lastSaveObjFileName; |
22 | | - std::string generatedObjName; |
23 | | - bool objLoaded; |
24 | | - bool showObj; |
25 | | - bool loadObj; |
26 | | - std::vector<std::string> files; |
27 | | - const std::string meshesFolder = "Obj"; |
28 | | - std::string objToLoad; |
29 | | - std::vector<bool> objLoadDone; |
30 | | - int objScroll; |
31 | | - bool startedObjGeneration; |
32 | | - bool blenderObjStarted; |
33 | | - bool blenderObjGenerationDone; |
34 | | - bool glacier2ObjDebugLogsEnabled; |
35 | | - bool blenderSet; |
36 | | - bool errorBuilding; |
37 | | - std::string blenderPath; |
38 | | - std::map<std::string, std::pair<int, int> > objectTriangleRanges; |
39 | | - bool doObjHitTest; |
40 | | - |
41 | | - static char *openSetBlenderFileDialog(const char *lastBlenderFile); |
42 | | - |
43 | | - void loadObjMesh(); |
44 | | - |
45 | | - static void copyObjFile(const std::string &from, const std::string &to); |
46 | | - |
47 | | - void saveObjMesh(char *objToCopy, char *newFileName); |
48 | | - |
49 | | - void setBlenderFile(const std::string &fileName); |
50 | | - |
51 | | - void buildObjFromNavp(bool alsoLoadIntoUi); |
52 | | - |
53 | | - void buildObj(const char *blenderPath, const char *sceneFilePath, const char *outputFolder); |
54 | | - |
55 | | - void finalizeObjBuild(); |
56 | | - |
57 | | - static void renderObj(); |
58 | | - |
59 | | - static char *openLoadObjFileDialog(const char *lastObjFolder); |
60 | | - |
61 | | - static char *openSaveObjFileDialog(char *lastObjFolder); |
62 | | - |
63 | | - void setLastLoadFileName(const char *fileName); |
64 | | - |
65 | | - void setLastSaveFileName(const char *fileName); |
66 | | - |
67 | | - void handleOpenObjClicked(); |
68 | | - |
69 | | - void handleSaveObjClicked(); |
70 | | - |
71 | | - bool canLoad() const; |
72 | | - |
73 | | - bool canBuildObjFromNavp() const; |
74 | | - |
75 | | - bool canBuildObjFromScene() const; |
76 | | - |
77 | | - void handleBuildObjFromSceneClicked(); |
78 | | - |
79 | | - void handleBuildObjFromNavpClicked(); |
80 | | - |
81 | | - void finalizeLoad(); |
82 | | - |
83 | | - std::optional<std::jthread> backgroundWorker; |
84 | | -}; |
| 1 | +#pragma once |
| 2 | +#include <map> |
| 3 | +#include <optional> |
| 4 | +#include <string> |
| 5 | +#include <thread> |
| 6 | +#include <vector> |
| 7 | +#define WIN32_LEAN_AND_MEAN |
| 8 | +#include <windows.h> |
| 9 | + |
| 10 | +enum MeshType { |
| 11 | + ALOC, |
| 12 | + PRIM |
| 13 | +}; |
| 14 | + |
| 15 | +class Obj { |
| 16 | + explicit Obj(); |
| 17 | + |
| 18 | + static void updateObjDialogControls(HWND hDlg); |
| 19 | + |
| 20 | +public: |
| 21 | + static Obj &getInstance() { |
| 22 | + static Obj instance; |
| 23 | + return instance; |
| 24 | + } |
| 25 | + |
| 26 | + std::string loadObjName; |
| 27 | + std::string saveObjName; |
| 28 | + std::string lastObjFileName; |
| 29 | + std::string lastSaveObjFileName; |
| 30 | + std::string generatedObjName; |
| 31 | + bool objLoaded; |
| 32 | + bool showObj; |
| 33 | + bool loadObj; |
| 34 | + std::vector<std::string> files; |
| 35 | + const std::string meshesFolder = "Obj"; |
| 36 | + std::string objToLoad; |
| 37 | + std::vector<bool> objLoadDone; |
| 38 | + bool startedObjGeneration; |
| 39 | + bool blenderObjStarted; |
| 40 | + bool blenderObjGenerationDone; |
| 41 | + bool glacier2ObjDebugLogsEnabled; |
| 42 | + bool errorBuilding; |
| 43 | + bool errorExtracting; |
| 44 | + bool extractingAlocsOrPrims; |
| 45 | + bool doneExtractingAlocsOrPrims; |
| 46 | + std::map<std::string, std::pair<int, int> > objectTriangleRanges; |
| 47 | + bool doObjHitTest; |
| 48 | + MeshType meshTypeForBuild; |
| 49 | + bool primLods[8]; |
| 50 | + static HWND hObjDialog; |
| 51 | + |
| 52 | + static char *openSetBlenderFileDialog(const char *lastBlenderFile); |
| 53 | + |
| 54 | + void loadObjMesh(); |
| 55 | + |
| 56 | + static void copyObjFile(const std::string &from, const std::string &to); |
| 57 | + |
| 58 | + void saveObjMesh(char *objToCopy, char *newFileName); |
| 59 | + |
| 60 | + void buildObjFromNavp(bool alsoLoadIntoUi); |
| 61 | + |
| 62 | + void buildObj(); |
| 63 | + |
| 64 | + void finalizeObjBuild(); |
| 65 | + |
| 66 | + static void renderObj(); |
| 67 | + |
| 68 | + static char *openLoadObjFileDialog(const char *lastObjFolder); |
| 69 | + |
| 70 | + static char *openSaveObjFileDialog(char *lastObjFolder); |
| 71 | + |
| 72 | + void setLastLoadFileName(const char *fileName); |
| 73 | + |
| 74 | + void setLastSaveFileName(const char *fileName); |
| 75 | + |
| 76 | + void handleOpenObjClicked(); |
| 77 | + |
| 78 | + void handleSaveObjClicked(); |
| 79 | + |
| 80 | + bool canLoad() const; |
| 81 | + |
| 82 | + static bool canBuildObjFromNavp(); |
| 83 | + |
| 84 | + bool canBuildObjFromScene() const; |
| 85 | + |
| 86 | + void handleBuildObjFromSceneClicked(); |
| 87 | + |
| 88 | + void handleBuildObjFromNavpClicked(); |
| 89 | + |
| 90 | + void finalizeLoad(); |
| 91 | + |
| 92 | + [[nodiscard]] std::string buildPrimLodsString() const; |
| 93 | + |
| 94 | + void saveObjSettings() const; |
| 95 | + |
| 96 | + static INT_PTR ObjSettingsDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); |
| 97 | + |
| 98 | + void showObjDialog(); |
| 99 | + |
| 100 | + std::optional<std::jthread> backgroundWorker; |
| 101 | + |
| 102 | + void finalizeExtractAlocsOrPrims(); |
| 103 | + |
| 104 | +private: |
| 105 | + void extractAlocsOrPrims(); |
| 106 | +}; |
0 commit comments