comparison TaskManager/Test/test_render/SpanPack.h @ 180:5cde66c926b4

いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
author gongo@localhost.localdomain
date Mon, 22 Dec 2008 16:09:57 +0900
parents 2284efc89f63
children 25c820b6060e
comparison
equal deleted inserted replaced
179:434846aef389 180:5cde66c926b4
3 3
4 #ifndef INCLUDED_SPAN 4 #ifndef INCLUDED_SPAN
5 # include "Span.h" 5 # include "Span.h"
6 #endif 6 #endif
7 7
8 #define MAX_SIZE_SPAN 70 8 #define MAX_SIZE_SPAN 64
9 9
10 class SpanPack { 10 class SpanPack {
11 public: /* fields */ 11 public: /* fields */
12 struct SpanInfo { 12 struct SpanInfo {
13 int size; // 4 13 int start;
14 int y_top; // 4 14 int size;
15 int light_pos[3]; // 4*3 15 int y_top;
16 int light_rgb[3]; // 4*3 16 int light_pos[3];
17 } info; // 32 17 int light_rgb[3];
18 } info; // 36
18 19
19 Span span[MAX_SIZE_SPAN]; // 48*MAX_SIZE_SPAN = 3360 20 Span span[MAX_SIZE_SPAN]; // 48*MAX_SIZE_SPAN = 3072
20 SpanPack *next; // 4 21 SpanPack *next; // 4
21 22
22 int pad[3]; // 12 23 int pad[2]; // 8
23 24
24 void init(int ytop) { 25 void init(int ytop) {
26 this->info.start = 0;
25 this->info.size = 0; 27 this->info.size = 0;
26 this->info.y_top = ytop; 28 this->info.y_top = ytop;
27 this->next = NULL; 29 this->next = NULL;
28 } 30 }
29 31
30 void reinit(int ytop) { 32 void reinit(int ytop) {
31 /**
32 * かっこわるすぐる
33 */
34 SpanPack* top = this; 33 SpanPack* top = this;
35 SpanPack* p; 34 SpanPack* p;
36 SpanPack* p1; 35 SpanPack* p1;
37 36
38 p = top->next; 37 p = top->next;
39 while (p != NULL) { 38 while (p != NULL) {
40 p1 = p->next; 39 p1 = p->next;
41 for (int i = 0; i < p->info.size; i++) {
42 Span* span = &p->span[i];
43 span->reinit();
44 }
45 free(p); 40 free(p);
46 p = p1; 41 p = p1;
47 } 42 }
48
49 for (int i = 0; i < this->info.size; i++) {
50 Span* span = &this->span[i];
51 span->reinit();
52 }
53 43
44 this->info.start = 0;
54 this->info.size = 0; 45 this->info.size = 0;
55 this->info.y_top = ytop; 46 this->info.y_top = ytop;
56 this->next = NULL; 47 this->next = NULL;
57 } 48 }
58 }; 49 };