annotate Renderer/test_render/SpanPack.h @ 283:15bfacccde99 draft

fix test_render
author e065746@localhost.localdomain
date Fri, 05 Jun 2009 16:49:12 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
1 #ifndef INCLUDED_SPAN_PACK
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
2 #define INCLUDED_SPAN_PACK
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
3
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
4 #ifndef INCLUDED_SPAN
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
5 # include "Span.h"
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
6 #endif
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
7
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
8 #define MAX_SIZE_SPAN 64
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
9
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
10 class SpanPack {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
11 public: /* fields */
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
12 struct SpanInfo {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
13 int start;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
14 int size;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
15 int y_top;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
16 int light_pos[3];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
17 int light_rgb[3];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
18 } info; // 36
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
19
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
20 Span span[MAX_SIZE_SPAN]; // 48*MAX_SIZE_SPAN = 3072
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
21 SpanPack *next; // 4
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
22
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
23 int pad[2]; // 8
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
24
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
25 void init(int ytop) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
26 this->info.start = 0;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
27 this->info.size = 0;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
28 this->info.y_top = ytop;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
29 this->next = NULL;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
30 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
31
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
32 void reinit(int ytop) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
33 SpanPack* top = this;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
34 SpanPack* p;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
35 SpanPack* p1;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
36
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
37 p = top->next;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
38 while (p != NULL) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
39 p1 = p->next;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
40 free(p);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
41 p = p1;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
42 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
43
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
44 this->info.start = 0;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
45 this->info.size = 0;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
46 this->info.y_top = ytop;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
47 this->next = NULL;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
48 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
49 };
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
50
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
51 typedef SpanPack* SpanPackPtr;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
52
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
53 #endif