1 struct PackNode 2 { 3 PackNode *child1, *child2; 4 ushort x, y, w, h; 5 int available; 6 PackNodePackNode7 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)) {} 8 discardchildrenPackNode9 void discardchildren() 10 { 11 DELETEP(child1); 12 DELETEP(child2); 13 } 14 forceemptyPackNode15 void forceempty() 16 { 17 discardchildren(); 18 available = 0; 19 } 20 resetPackNode21 void reset() 22 { 23 discardchildren(); 24 available = min(w, h); 25 } 26 resizePackNode27 bool resize(int nw, int nh) 28 { 29 if(w == nw && h == nw) return false; 30 discardchildren(); 31 w = nw; 32 h = nh; 33 available = min(w, h); 34 return true; 35 } 36 ~PackNodePackNode37 ~PackNode() 38 { 39 discardchildren(); 40 } 41 42 bool insert(ushort &tx, ushort &ty, ushort tw, ushort th); 43 void reserve(ushort tx, ushort ty, ushort tw, ushort th); 44 }; 45 46 extern int fullbright, fullbrightlevel; 47 48 extern bool getlightfx(const extentity &e, int *radius = NULL, int *spotlight = NULL, vec *color = NULL, bool normalize = true); 49 50 extern void clearlights(); 51 extern void initlights(); 52 extern void clearlightcache(int id = -1); 53 extern void brightencube(cube &c); 54 extern void setsurfaces(cube &c, const surfaceinfo *surfs, const vertinfo *verts, int numverts); 55 extern void setsurface(cube &c, int orient, const surfaceinfo &surf, const vertinfo *verts, int numverts); 56 extern void previewblends(const ivec &bo, const ivec &bs); 57 58 extern void calcnormals(bool lerptjoints = false); 59 extern void clearnormals(); 60 extern void resetsmoothgroups(); 61 extern int smoothangle(int id, int angle); 62 extern void findnormal(const vec &key, int smooth, const vec &surface, vec &v); 63 extern vector<int> smoothgroups; 64 65 #define CHECK_CALCLIGHT_PROGRESS_LOCKED(exit, show_calclight_progress, before, after) \ 66 if(check_calclight_progress) \ 67 { \ 68 if(!calclight_canceled) \ 69 { \ 70 before; \ 71 show_calclight_progress(); \ 72 check_calclight_canceled(); \ 73 after; \ 74 } \ 75 if(calclight_canceled) { exit; } \ 76 } 77 #define CHECK_CALCLIGHT_PROGRESS(exit, show_calclight_progress) CHECK_CALCLIGHT_PROGRESS_LOCKED(exit, show_calclight_progress, , ) 78 79 extern bool calclight_canceled; 80 extern volatile bool check_calclight_progress; 81 82 extern void check_calclight_canceled(); 83 84 extern const vector<int> &checklightcache(int x, int y); 85 86 extern bvec &getpielight(); 87 extern vec &getpielightdir(); 88 extern float getpielightscale(), getpielightyaw(), getpielightpitch(); 89