109
|
1 #include <libxml/parser.h>
|
|
2
|
|
3 #ifndef INCLUDED_POLYGON
|
|
4 #define INCLUDED_POLYGON
|
|
5
|
|
6 #ifndef INCLUDED_VIEWER
|
|
7 #include "viewer.h"
|
|
8 #endif
|
|
9
|
|
10 #ifndef INCLUDED_SCENE_GRAPH_PACK
|
|
11 #include "scene_graph_pack.h"
|
|
12 #endif
|
|
13
|
|
14 #ifndef INCLUDED_POLYGON_PACK
|
|
15 #include "polygon_pack.h"
|
|
16 #endif
|
|
17
|
|
18 #ifndef INCLUDED_SPAN_PACK
|
|
19 #include "SpanPack.h"
|
|
20 #endif
|
|
21
|
|
22 class Polygon{
|
|
23 public:
|
|
24 long long size;
|
|
25 char *name;
|
|
26 char *parent_name;
|
|
27 float *data; //"vertex" and "normal" and "texture"
|
|
28 float xyz[4]; // position
|
|
29 float angle[4]; // angle
|
|
30 float c_xyz[4]; // center of rotation
|
|
31 float matrix[16];
|
|
32 float *anim;
|
|
33 int frame; // anime frame num
|
|
34 //int *texture; // pointer of this surface's texture
|
|
35 static SDL_Surface* texture_image; // pointer of this surface's texture
|
|
36 //SDL_Surface *screen;
|
|
37 //char image_name[20]; // texture image name
|
|
38 Polygon *next;
|
|
39 Polygon *child;
|
|
40 Polygon *parent;
|
|
41 Polygon *brother;
|
|
42 Viewer *viewer;
|
|
43 //SceneGraphPack *sgp;
|
|
44
|
|
45 Polygon();
|
|
46 void tree_check();
|
|
47 void print_member();
|
|
48 void parameter_change(char *name, float x, float y, float z, float ax, float ay, float az);
|
|
49 //void load_texture(char *image_name);
|
|
50 void draw(float *stack);
|
|
51 void draw(SceneGraphPack *sgp);
|
|
52 void draw(PolygonPack *pp);
|
|
53 void draw(SpanPack *sp);
|
|
54 void delete_data();
|
|
55 void tree_draw();
|
|
56 void get_data(xmlNodePtr cur);
|
|
57 void pickup_coordinate(char *cont);
|
|
58 void pickup_normal(char *cont);
|
|
59 void pickup_model(char *cont);
|
|
60 void pickup_texture(char *cont);
|
|
61 Uint32 get_rgb(int tx, int ty);
|
|
62 //void sgp_update();
|
|
63 //void sgp_draw();
|
|
64 //void create_scene_graph_pack();
|
|
65 void create_data(xmlNodePtr doc);
|
|
66 void set_data(char *file_name);
|
|
67 void add_next();
|
|
68 void create_tree();
|
|
69
|
|
70 /* added by kent. */
|
|
71 Polygon(xmlNodePtr);
|
|
72 Polygon *addChild(Polygon *);
|
|
73 Polygon *children;
|
|
74 Polygon *lastChild;
|
|
75 Polygon *searchPolygon(char *);
|
|
76 static Polygon *createFromXMLfile(char *);
|
|
77 };
|
|
78 #endif
|