annotate TaskManager/Test/simple_pack/task/create_pp.cpp @ 69:c9b973f0673e

*** empty log message ***
author chiaki
date Sun, 17 Feb 2008 23:07:52 +0900
parents 35a6cf176c38
children cf36120bc158
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
53
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
1 #include <iostream>
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
2 #include "polygon_pack.h"
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
3 #include "scene_graph_pack.h"
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
4 #include "sys.h"
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
5 using namespace std;
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
6
68
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
7 #include "error.h"
53
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
8
68
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
9 int
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
10 create_pp(SceneGraphPack *sgp, PolygonPack *pp)
53
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
11 {
68
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
12 float xyz1[4],xyz2[4],xyz3[4];
53
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
13
68
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
14 __debug("[%s] sgp = 0x%x, pp = 0x%x\n", __FUNCTION__,
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
15 (unsigned int)sgp,(unsigned int)pp);
53
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
16
68
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
17 for (int i = 0; i < sgp->info.size; i++) {
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
18 SceneGraphNodePtr node = &sgp->node[i];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
19
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
20 int n,nt,pt;
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
21 for(n=0,nt=0,pt=0; n<node->size*3; n+=9,nt+=6,pt++) {
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
22 xyz1[0] = node->vertex[n];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
23 xyz1[1] = node->vertex[n+1];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
24 xyz1[2] = node->vertex[n+2]*-1;
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
25 xyz1[3] = 1;
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
26 xyz2[0] = node->vertex[n+3];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
27 xyz2[1] = node->vertex[n+3+1];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
28 xyz2[2] = node->vertex[n+3+2]*-1;
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
29 xyz2[3] = 1;
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
30 xyz3[0] = node->vertex[n+6];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
31 xyz3[1] = node->vertex[n+6+1];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
32 xyz3[2] = node->vertex[n+6+2]*-1;
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
33 xyz3[3] = 1;
53
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
34
68
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
35 rotate(xyz1, node->translation);
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
36 rotate(xyz2, node->translation);
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
37 rotate(xyz3, node->translation);
53
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
38
68
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
39 pp->tri[pt].ver1.x = xyz1[0];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
40 pp->tri[pt].ver1.y = xyz1[1];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
41 pp->tri[pt].ver1.z = xyz1[2];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
42 pp->tri[pt].ver1.tex_x = node->texture[nt];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
43 pp->tri[pt].ver1.tex_y = node->texture[nt+1];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
44
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
45 pp->tri[pt].ver2.x = xyz2[0];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
46 pp->tri[pt].ver2.y = xyz2[1];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
47 pp->tri[pt].ver2.z = xyz2[2];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
48 pp->tri[pt].ver2.tex_x = node->texture[nt+2];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
49 pp->tri[pt].ver2.tex_y = node->texture[nt+2+1];
53
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
50
68
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
51 pp->tri[pt].ver3.x = xyz3[0];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
52 pp->tri[pt].ver3.y = xyz3[1];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
53 pp->tri[pt].ver3.z = xyz3[2];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
54 pp->tri[pt].ver3.tex_x = node->texture[nt+4];
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
55 pp->tri[pt].ver3.tex_y = node->texture[nt+4+1];
53
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
56
68
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
57 //pp->tri[pt].tex_addr = node->tex_addr;
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
58 pp->tri[pt].tex_width = node->tex_width;
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
59 pp->tri[pt].tex_height = node->tex_height;
53
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
60
68
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
61 }
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
62 pp->info.size = pt;
53
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
63 }
68
35a6cf176c38 *** empty log message ***
chiaki
parents: 53
diff changeset
64 return sizeof(PolygonPack);
53
0c8ae614d421 Initial revision
chiaki
parents:
diff changeset
65 }