283
|
1 #ifndef INCLUDED_POLYGON_PACK
|
|
2 #define INCLUDED_POLYGON_PACK
|
|
3
|
539
|
4 #include "types.h"
|
283
|
5
|
|
6 #define MAX_SIZE_TRIANGLE 128
|
|
7
|
|
8 typedef struct VertexPack {
|
|
9 float x;
|
|
10 float y;
|
|
11 float z;
|
|
12 float tex_x;
|
|
13 float tex_y;
|
|
14 } VertexPack, *VertexPackPtr; // 20
|
|
15
|
539
|
16 typedef struct NormalPack {
|
|
17 float x;
|
|
18 float y;
|
|
19 float z;
|
|
20 } NormalPack, *NormalPackPtr; // 12
|
|
21
|
283
|
22 typedef struct TriTexInfo {
|
|
23 uint32 *addr;
|
|
24 int width;
|
|
25 int height;
|
|
26 int scale_max;
|
|
27 } TriangleTexInfo, *TriangleTexInfoPtr; // 16
|
|
28
|
|
29 typedef struct TrianglePack {
|
|
30 TriTexInfo tex_info;
|
|
31 VertexPack ver1;
|
|
32 VertexPack ver2;
|
|
33 VertexPack ver3;
|
539
|
34 NormalPack normal1;
|
|
35 NormalPack normal2;
|
|
36 NormalPack normal3;
|
283
|
37 } TrianglePack, *TrianglePackPtr;
|
|
38
|
|
39
|
|
40 typedef struct PolygonPack {
|
539
|
41 struct POLYGON_info {
|
283
|
42 int size;
|
|
43 int light_pos[3];
|
|
44 int light_rgb[3];
|
|
45 }info;
|
|
46
|
|
47 TrianglePack tri[MAX_SIZE_TRIANGLE];
|
|
48
|
|
49 PolygonPack* next;
|
|
50
|
|
51 void init(void) {
|
|
52 info.size = 0;
|
|
53 next = 0;
|
|
54 }
|
|
55
|
|
56 void clear(void) {
|
|
57 PolygonPack *q = 0;
|
|
58 PolygonPack *q1 = 0;
|
|
59
|
|
60 q = this->next;
|
|
61 while (q) {
|
|
62 q1 = q->next;
|
|
63 delete(q);
|
|
64 q = q1;
|
|
65 }
|
|
66 this->init();
|
|
67 }
|
|
68 } PolygonPack, *PolygonPackPtr; // 4*7 + 76*128 + 4 = 9760
|
|
69
|
|
70 typedef struct PolygonPackList {
|
|
71 int size;
|
|
72 PolygonPack *list;
|
|
73 } PolygonPackList;
|
|
74
|
|
75 #endif
|