283
|
1 #ifndef INCLUDED_SPAN_PACK
|
|
2 #define INCLUDED_SPAN_PACK
|
|
3
|
|
4 #ifndef INCLUDED_SPAN
|
|
5 # include "Span.h"
|
|
6 #endif
|
|
7
|
|
8 #define MAX_SIZE_SPAN 64
|
|
9
|
|
10 class SpanPack {
|
|
11 public: /* fields */
|
|
12 struct SpanInfo {
|
|
13 int start;
|
|
14 int size;
|
|
15 int y_top;
|
|
16 int light_pos[3];
|
|
17 int light_rgb[3];
|
|
18 } info; // 36
|
|
19
|
|
20 Span span[MAX_SIZE_SPAN]; // 48*MAX_SIZE_SPAN = 3072
|
|
21 SpanPack *next; // 4
|
|
22
|
|
23 int pad[2]; // 8
|
|
24
|
|
25 void init(int ytop) {
|
|
26 this->info.start = 0;
|
|
27 this->info.size = 0;
|
|
28 this->info.y_top = ytop;
|
|
29 this->next = NULL;
|
|
30 }
|
|
31
|
|
32 void reinit(int ytop) {
|
|
33 SpanPack* top = this;
|
|
34 SpanPack* p;
|
|
35 SpanPack* p1;
|
|
36
|
|
37 p = top->next;
|
|
38 while (p != NULL) {
|
|
39 p1 = p->next;
|
|
40 free(p);
|
|
41 p = p1;
|
|
42 }
|
|
43
|
|
44 this->info.start = 0;
|
|
45 this->info.size = 0;
|
|
46 this->info.y_top = ytop;
|
|
47 this->next = NULL;
|
|
48 }
|
|
49 };
|
|
50
|
|
51 typedef SpanPack* SpanPackPtr;
|
|
52
|
|
53 #endif
|