-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwmo.h
171 lines (141 loc) · 2.67 KB
/
wmo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#ifndef WMO_H
#define WMO_H
#include "manager.h"
#include "vec3d.h"
#include "mpq.h"
#include "model.h"
#include <vector>
#include <set>
#include "video.h"
class WMO;
class WMOGroup;
class WMOInstance;
class WMOManager;
class Liquid;
class WMOGroup {
WMO *wmo;
int flags;
Vec3D v1,v2;
int nTriangles, nVertices;
GLuint dl,dl_light;
Vec3D center;
float rad;
int num;
int fog;
int nDoodads;
short *ddr;
Liquid *lq;
public:
Vec3D b1,b2;
Vec3D vmin, vmax;
bool indoor, hascv;
bool visible;
bool outdoorLights;
std::string name;
WMOGroup() : dl(0) {}
~WMOGroup();
void init(WMO *wmo, MPQFile &f, int num, char *names);
void initDisplayList();
void initLighting(int nLR, short *useLights);
void draw(const Vec3D& ofs, const float rot);
void drawLiquid();
void drawDoodads(int doodadset, const Vec3D& ofs, const float rot);
void setupFog();
};
struct WMOMaterial {
int flags;
int d1;
int transparent;
int nameStart;
unsigned int col1;
int d3;
int nameEnd;
unsigned int col2;
int d4;
float f1,f2;
int dx[5];
// read up to here -_-
TextureID tex;
};
struct WMOLight {
unsigned int flags, color;
Vec3D pos;
float intensity;
float unk[5];
float r;
Vec4D fcolor;
void init(MPQFile &f);
void setup(GLint light);
static void setupOnce(GLint light, Vec3D dir, Vec3D lcol);
};
struct WMOPV {
Vec3D a,b,c,d;
};
struct WMOPR {
short portal, group, dir, reserved;
};
struct WMODoodadSet {
char name[0x14];
int start;
int size;
int unused;
};
struct WMOLiquidHeader {
int X, Y, A, B;
Vec3D pos;
short type;
};
struct WMOFog {
unsigned int flags;
Vec3D pos;
float r1, r2, fogend, fogstart;
unsigned int color1;
float f2;
float f3;
unsigned int color2;
// read to here (0x30 bytes)
Vec4D color;
void init(MPQFile &f);
void setup();
};
class WMO: public ManagedItem {
public:
WMOGroup *groups;
int nTextures, nGroups, nP, nLights, nModels, nDoodads, nDoodadSets, nX;
WMOMaterial *mat;
Vec3D v1,v2;
bool ok;
std::vector<std::string> textures;
std::vector<std::string> models;
std::vector<ModelInstance> modelis;
std::vector<WMOLight> lights;
std::vector<WMOPV> pvs;
std::vector<WMOPR> prs;
std::vector<WMOFog> fogs;
std::vector<WMODoodadSet> doodadsets;
Model *skybox;
int sbid;
WMO(std::string name);
~WMO();
void draw(int doodadset, const Vec3D& ofs, const float rot);
//void drawPortals();
void drawSkybox();
};
class WMOManager: public SimpleManager {
public:
int add(std::string name);
};
class WMOInstance {
static std::set<int> ids;
public:
WMO *wmo;
Vec3D pos;
Vec3D pos2, pos3, dir;
int id, d2, d3;
int doodadset;
WMOInstance(WMO *wmo, MPQFile &f);
void draw();
//void drawPortals();
static void reset();
};
#endif