annotate TaskManager/Test/test_render/polygon.cpp @ 228:c254a2bd1b34

remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
author gongo@gendarme.cr.ie.u-ryukyu.ac.jp
date Thu, 12 Feb 2009 16:31:38 +0900
parents fc314f28b66e
children e1d24c951408
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
1 #include <iostream>
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
2 #include <SDL.h>
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
3 #include <SDL_opengl.h>
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
4 #include <SDL_image.h>
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
5 #include "polygon.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
6 #include "xml.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
7 #include "sys.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
8 #include "triangle.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
9 #include "vertex.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
10 #include "Span.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
11 #include "SpanC.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
12 #include "scene_graph_pack.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
13 #include "error.h"
120
a52e193f9a42 fix Load Texture
gongo@gendarme.local
parents: 109
diff changeset
14 #include "viewer_types.h"
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
15 using namespace std;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
16
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
17 //extern int decode(char *cont, char *file_name);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
18 extern int decode(char *cont, FILE *outfile);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
19
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
20
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
21 SDL_Surface* Polygon::texture_image;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
22
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
23 Polygon::Polygon(void)
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
24 {
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
25 xyz[0] = 0;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
26 xyz[1] = 0;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
27 xyz[2] = 0;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
28 xyz[3] = 1;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
29 c_xyz[0] = 0;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
30 c_xyz[1] = 0;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
31 c_xyz[2] = 0;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
32 c_xyz[3] = 1;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
33 angle[0] = 0;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
34 angle[1] = 0;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
35 angle[2] = 0;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
36 angle[3] = 1;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
37
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
38 for (int i = 0; i < 16; i++) {
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
39 matrix[i] = 0;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
40 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
41 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
42
138
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
43 void
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
44 Polygon::position_init(void)
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
45 {
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
46 xyz[0] = 0;
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
47 xyz[1] = 0;
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
48 xyz[2] = 0;
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
49 xyz[3] = 1;
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
50 c_xyz[0] = 0;
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
51 c_xyz[1] = 0;
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
52 c_xyz[2] = 0;
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
53 c_xyz[3] = 1;
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
54 angle[0] = 0;
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
55 angle[1] = 0;
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
56 angle[2] = 0;
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
57 angle[3] = 1;
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
58
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
59 for (int i = 0; i < 16; i++) {
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
60 matrix[i] = 0;
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
61 }
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
62 }
3fd24be89d02 オブジェクトを増やして複数の表示に成功。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
63
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
64 #if 0
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
65 void Polygon::draw(SceneGraphPack *sgp)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
66 {
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
67 float xyz1[4],xyz2[4],xyz3[4];
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
68
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
69 /***SceneGraphUpdate***/
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
70 //sgp_update();
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
71 for (int i = 0; i < sgp->info.size; i++) {
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
72 SceneGraphNode node = sgp->node[i];
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
73
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
74 /***draw***/
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
75 int n,nt;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
76 for(n=0,nt=0; n<node.size*3; n+=9,nt+=6) {
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
77 xyz1[0] = node.vertex[n];
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
78 xyz1[1] = node.vertex[n+1];
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
79 xyz1[2] = node.vertex[n+2]*-1;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
80 xyz1[3] = 1;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
81 xyz2[0] = node.vertex[n+3];
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
82 xyz2[1] = node.vertex[n+3+1];
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
83 xyz2[2] = node.vertex[n+3+2]*-1;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
84 xyz2[3] = 1;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
85 xyz3[0] = node.vertex[n+6];
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
86 xyz3[1] = node.vertex[n+6+1];
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
87 xyz3[2] = node.vertex[n+6+2]*-1;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
88 xyz3[3] = 1;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
89
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
90 rotate(xyz1, node.translation);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
91 rotate(xyz2, node.translation);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
92 rotate(xyz3, node.translation);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
93
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
94 Vertex *ver1 = new Vertex(xyz1[0],xyz1[1],xyz1[2],node.texture[nt],node.texture[nt+1]);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
95 Vertex *ver2 = new Vertex(xyz2[0],xyz2[1],xyz2[2],node.texture[nt+2],node.texture[nt+2+1]);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
96 Vertex *ver3 = new Vertex(xyz3[0],xyz3[1],xyz3[2],node.texture[nt+4],node.texture[nt+4+1]);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
97
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
98 Triangle *tri = new Triangle(ver1,ver2,ver3);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
99 Span_c *span = new Span_c();
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
100 span->viewer = viewer;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
101 span->p = this;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
102 span->create_span(tri,texture_image);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
103 delete ver1;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
104 delete ver2;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
105 delete ver3;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
106 delete tri;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
107 delete span;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
108 }
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
109 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
110 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
111
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
112
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
113 void Polygon::draw(PolygonPack *pp)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
114 {
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
115 for(int n=0; n<pp->info.size; n++)
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
116 {
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
117 Vertex *ver1 = new Vertex(pp->tri[n].ver1.x,pp->tri[n].ver1.y,pp->tri[n].ver1.z,pp->tri[n].ver1.tex_x,pp->tri[n].ver1.tex_y);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
118 Vertex *ver2 = new Vertex(pp->tri[n].ver2.x,pp->tri[n].ver2.y,pp->tri[n].ver2.z,pp->tri[n].ver2.tex_x,pp->tri[n].ver2.tex_y);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
119 Vertex *ver3 = new Vertex(pp->tri[n].ver3.x,pp->tri[n].ver3.y,pp->tri[n].ver3.z,pp->tri[n].ver3.tex_x,pp->tri[n].ver3.tex_y);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
120
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
121 Triangle *tri = new Triangle(ver1,ver2,ver3);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
122 Span_c *span = new Span_c();
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
123 span->viewer = viewer;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
124 span->p = this;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
125 span->create_span(tri,texture_image);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
126 delete ver1;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
127 delete ver2;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
128 delete ver3;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
129 delete tri;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
130 delete span;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
131 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
132 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
133
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
134 void Polygon::draw(SpanPack *sp)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
135 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
136 Span *span;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
137
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
138 for (int n = 0; n < sp->info.size; n++) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
139 span = &sp->span[n];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
140
123
f515436feb71 delete scene_graph->child (instead use "children")
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 120
diff changeset
141 //int x = span->x;
f515436feb71 delete scene_graph->child (instead use "children")
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 120
diff changeset
142 //int y = span->y;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
143 float z = span->start_z;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
144 int end = span->length_x;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
145 float zpos = span->end_z;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
146 float tex1 = span->tex_x1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
147 float tex2 = span->tex_x2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
148 float tey1 = span->tex_y1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
149 float tey2 = span->tex_y2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
150 Uint32 rgb;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
151 int tex_xpos;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
152 int tex_ypos;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
153 int tex_zpos;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
154 float tex_x, tex_y, tex_z;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
155
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
156 if (end == 1) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
157 tex_xpos = (int)((span->tex_height-1) * tex1);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
158 tex_ypos = (int)((span->tex_width-1) * tey1);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
159 tex_zpos = (int)z;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
160 rgb = get_rgb(tex_xpos, tex_ypos);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
161 //viewer->write_pixel(x, y, zpos, rgb);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
162 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
163 for (int j = 0; j < end; j++) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
164 tex_x = tex1*(end-1-j)/(end-1) + tex2*j/(end-1);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
165 tex_y = tey1*(end-1-j)/(end-1) + tey2*j/(end-1);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
166 tex_z = z*(end-1-j)/(end-1) + zpos*j/(end-1);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
167 if (tex_x > 1) tex_x = 1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
168 if (tex_y > 1) tex_y = 1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
169 tex_xpos = (int)((span->tex_height-1) * tex_x);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
170 tex_ypos = (int)((span->tex_width-1) * tex_y);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
171 rgb = get_rgb(tex_xpos,tex_ypos);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
172 //viewer->write_pixel(j + x, y, tex_z, rgb);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
173 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
174 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
175 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
176 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
177
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
178 #endif
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
179
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
180 void Polygon::pickup_coordinate(char *cont)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
181 {
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
182 for(int n=0; n<size*3; n+=3)
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
183 {
228
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
184 cont = pickup_float(cont, coord_xyz+n);
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
185 cont = pickup_float(cont, coord_xyz+n+1);
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
186 cont = pickup_float(cont, coord_xyz+n+2);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
187
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
188 if (cont == NULL)
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
189 {
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
190 cout << "Analyzing obj data failed coordinate\n";
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
191 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
192 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
193 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
194
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
195 void Polygon::pickup_normal(char *cont)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
196 {
228
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
197 for (int n = 0; n<size*3; n += 3)
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
198 {
228
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
199 cont = pickup_float(cont, normal+n);
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
200 cont = pickup_float(cont, normal+n+1);
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
201 cont = pickup_float(cont, normal+n+2);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
202
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
203 if (cont == NULL)
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
204 {
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
205 cout << "Analyzing obj data failed normal\n";
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
206 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
207 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
208 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
209
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
210 void Polygon::pickup_model(char *cont)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
211 {
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
212 cont = pickup_float(cont,c_xyz);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
213 cont = pickup_float(cont,c_xyz+1);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
214 cont = pickup_float(cont,c_xyz+2);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
215
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
216 if (cont == NULL)
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
217 {
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
218 cout << "Analyzing obj data failed model\n";
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
219 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
220 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
221
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
222 void Polygon::pickup_texture(char *cont)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
223 {
228
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
224 for (int n = 0; n < size*3; n += 3)
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
225 {
228
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
226 cont = pickup_float(cont, coord_tex+n);
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
227 cont = pickup_float(cont, coord_tex+n+1);
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
228 coord_tex[n+2] = 1.0;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
229
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
230 if (cont == NULL)
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
231 {
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
232 cout << "Analyzing obj data failed texture\n";
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
233 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
234 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
235 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
236
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
237 char *get_pixel(int tx, int ty, SDL_Surface *texture_image)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
238 {
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
239 return (char*)texture_image->pixels+(texture_image->format->BytesPerPixel*((texture_image->w)*ty+tx));
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
240 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
241
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
242 unsigned my_ntohl(unsigned u) {
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
243 // rr gg bb 00
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
244 // rr
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
245 // bb gg rr
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
246 //unsigned u1 = ((u&0xff)<<24) +
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
247 // ((u&0xff00)<<8) +
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
248 // ((u&0xff0000)>>8) +
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
249 // ((u&0xff000000)>>24);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
250 unsigned u1;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
251 unsigned b = (u&0xff000000)>>24;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
252 unsigned g = (u&0xff0000)>>16;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
253 unsigned r = (u&0xff00)>>8;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
254 u1 = r + (g<<8) + (b<<16);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
255 //printf("pixel %x->%x\n",u,u1);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
256 return u1;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
257 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
258
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
259 Uint32 Polygon::get_rgb(int tx, int ty)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
260 {
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
261 SDL_PixelFormat *fmt;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
262 //Uint32 temp, pixel;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
263 Uint8 red, green, blue;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
264
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
265 fmt = texture_image->format;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
266
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
267 if (tx<0) tx = 0;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
268 if (texture_image->w-1< tx) tx = texture_image->w-1 ;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
269 if (ty<0) ty = 0;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
270 if (texture_image->h-1< ty) ty = texture_image->h-1 ;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
271
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
272
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
273
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
274 //SDL_LockSurface(texture_image);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
275 char *p = get_pixel(tx,ty,texture_image);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
276 #if 0
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
277 pixel = my_ntohl(*(Uint32*)p);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
278 //printf("pixel = %d\n", pixel);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
279 //printf("pixel %x bpp = %d ",p, fmt->BytesPerPixel);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
280 //SDL_UnlockSurface(texture_image);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
281
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
282 temp = pixel&fmt->Rmask;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
283 temp = temp>>fmt->Rshift;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
284 temp = temp<<fmt->Rloss;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
285 red = (Uint8)temp;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
286
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
287 temp = pixel&fmt->Gmask;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
288 temp = temp>>fmt->Gshift;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
289 temp = temp<<fmt->Gloss;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
290 green = (Uint8)temp;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
291
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
292 temp = pixel&fmt->Bmask;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
293 temp = temp>>fmt->Bshift;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
294 temp = temp<<fmt->Bloss;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
295 blue = (Uint8)temp;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
296 #endif
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
297 blue = (Uint8) p[0];
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
298 green = (Uint8) p[1];
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
299 red = (Uint8) p[2];
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
300
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
301 //printf("tx = %d ty = %d ", tx,ty);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
302 //printf("pixel color => R: %d, G: %d, B: %d\n", red, green, blue);
123
f515436feb71 delete scene_graph->child (instead use "children")
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 120
diff changeset
303
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
304 SDL_PixelFormat *pf;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
305 //pf = viewer->screen->format;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
306
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
307 //cout << SDL_MapRGB(pf, red, green, blue) << endl;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
308 return SDL_MapRGB(pf, red, green, blue);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
309 }