summaryrefslogtreecommitdiff
path: root/src/engine/lightmap.h
diff options
context:
space:
mode:
authorxolatile2025-08-06 22:54:55 +0200
committerxolatile2025-08-06 22:54:55 +0200
commit0a1172b75f571685c264a8b9d8ee224bbf11381f (patch)
treed041fdc68a60f0ebb48a3852bbcce6d9432f83d5 /src/engine/lightmap.h
parentaffde05dc07a94643f1fd2751b2b441f57f73d7d (diff)
downloadxolatile-badassbug-0a1172b75f571685c264a8b9d8ee224bbf11381f.tar.xz
xolatile-badassbug-0a1172b75f571685c264a8b9d8ee224bbf11381f.tar.zst
Please do not hate me, it makes sense...
Diffstat (limited to 'src/engine/lightmap.h')
-rw-r--r--src/engine/lightmap.h56
1 files changed, 17 insertions, 39 deletions
diff --git a/src/engine/lightmap.h b/src/engine/lightmap.h
index 0f00d61..d15c6a7 100644
--- a/src/engine/lightmap.h
+++ b/src/engine/lightmap.h
@@ -5,81 +5,62 @@
#define LM_PACKW 512
#define LM_PACKH 512
-struct PackNode
-{
+struct PackNode {
PackNode *child1, *child2;
ushort x, y, w, h;
int available;
-
PackNode() : child1(0), child2(0), x(0), y(0), w(LM_PACKW), h(LM_PACKH), available(min(LM_PACKW, LM_PACKH)) {}
PackNode(ushort x, ushort y, ushort w, ushort h) : child1(0), child2(0), x(x), y(y), w(w), h(h), available(min(w, h)) {}
-
- void clear()
- {
+ void clear() {
DELETEP(child1);
DELETEP(child2);
}
-
- ~PackNode()
- {
+ ~PackNode() {
clear();
}
-
bool insert(ushort &tx, ushort &ty, ushort tw, ushort th);
};
-enum
-{
+enum {
LM_DIFFUSE = 0,
LM_BUMPMAP0,
LM_BUMPMAP1,
LM_TYPE = 0x0F,
-
LM_ALPHA = 1<<4,
LM_FLAGS = 0xF0
};
-struct LightMap
-{
+struct LightMap {
int type, bpp, tex, offsetx, offsety;
PackNode packroot;
uint lightmaps, lumels;
int unlitx, unlity;
uchar *data;
-
LightMap()
: type(LM_DIFFUSE), bpp(3), tex(-1), offsetx(-1), offsety(-1),
lightmaps(0), lumels(0), unlitx(-1), unlity(-1),
- data(NULL)
- {
+ data(NULL) {
}
-
- ~LightMap()
- {
+ ~LightMap() {
if(data) delete[] data;
}
-
- void finalize()
- {
+ void finalize() {
packroot.clear();
packroot.available = 0;
}
-
void copy(ushort tx, ushort ty, uchar *src, ushort tw, ushort th);
bool insert(ushort &tx, ushort &ty, uchar *src, ushort tw, ushort th);
};
extern vector<LightMap> lightmaps;
-struct LightMapTexture
-{
+struct LightMapTexture {
int w, h, type;
GLuint id;
int unlitx, unlity;
-
LightMapTexture()
- : w(0), h(0), type(LM_DIFFUSE), id(0), unlitx(-1), unlity(-1)
- {}
+ : w(0), h(0), type(LM_DIFFUSE), id(0), unlitx(-1), unlity(-1) {
+ }
};
extern vector<LightMapTexture> lightmaptexs;
@@ -95,17 +76,14 @@ extern void brightencube(cube &c);
extern void setsurfaces(cube &c, const surfaceinfo *surfs, const vertinfo *verts, int numverts);
extern void setsurface(cube &c, int orient, const surfaceinfo &surf, const vertinfo *verts, int numverts);
-struct lerpvert
-{
+struct lerpvert {
vec normal;
vec2 tc;
-
bool operator==(const lerpvert &l) const { return tc == l.tc;; }
bool operator!=(const lerpvert &l) const { return tc != l.tc; }
};
-struct lerpbounds
-{
+struct lerpbounds {
const lerpvert *min;
const lerpvert *max;
float u, ustep;
@@ -121,10 +99,10 @@ extern void initlerpbounds(float u, float v, const lerpvert *lv, int numv, lerpb
extern void lerpnormal(float u, float v, const lerpvert *lv, int numv, lerpbounds &start, lerpbounds &end, vec &normal, vec &nstep);
#define CHECK_CALCLIGHT_PROGRESS_LOCKED(exit, show_calclight_progress, before, after) \
- if(check_calclight_progress) \
- { \
- if(!calclight_canceled) \
- { \
+ if(check_calclight_progress) { \
+ \
+ if(!calclight_canceled) { \
+ \
before; \
show_calclight_progress(); \
check_calclight_canceled(); \