Mercurial > hg > Members > kono > Cerium
comparison Renderer/Engine/task/CreatePolygonFromSceneGraph.cc @ 738:510424e175ae
light
author | yutaka@localhost.localdomain |
---|---|
date | Thu, 31 Dec 2009 04:07:18 +0900 |
parents | 42c94f85c779 |
children | 10a8a80c2ea7 |
comparison
equal
deleted
inserted
replaced
737:50220f219341 | 738:510424e175ae |
---|---|
72 */ | 72 */ |
73 static int | 73 static int |
74 run(SchedTask *smanager, void *rbuf, void *wbuf) | 74 run(SchedTask *smanager, void *rbuf, void *wbuf) |
75 { | 75 { |
76 float xyz1[4], xyz2[4], xyz3[4]; | 76 float xyz1[4], xyz2[4], xyz3[4]; |
77 /* | |
78 *頂点毎に法線ベクトルがある | |
79 *面毎じゃない | |
80 *なにかに使うのかな?わからないから、一応とっておく。 | |
81 *by yutaka | |
82 */ | |
83 float normal1[4],normal2[4],normal3[4]; | 77 float normal1[4],normal2[4],normal3[4]; |
84 | 78 |
85 SceneGraphPtr sg_top = (SceneGraphPtr)smanager->get_param(0); | 79 SceneGraphPtr sg_top = (SceneGraphPtr)smanager->get_param(0); |
86 SceneGraphPtr sg = sg_top; | 80 SceneGraphPtr sg = sg_top; |
87 | 81 |
169 triangle->ver3.y = xyz3[1]; | 163 triangle->ver3.y = xyz3[1]; |
170 triangle->ver3.z = xyz3[2]; | 164 triangle->ver3.z = xyz3[2]; |
171 triangle->ver3.tex_x = sg->coord_tex[(i+2)*3]; | 165 triangle->ver3.tex_x = sg->coord_tex[(i+2)*3]; |
172 triangle->ver3.tex_y = sg->coord_tex[(i+2)*3+1]; | 166 triangle->ver3.tex_y = sg->coord_tex[(i+2)*3+1]; |
173 | 167 |
174 | |
175 normal1[0] = sg->normal[(i+0)*3]; | 168 normal1[0] = sg->normal[(i+0)*3]; |
176 normal1[1] = sg->normal[(i+0)*3+1]; | 169 normal1[1] = sg->normal[(i+0)*3+1]; |
177 normal1[2] = sg->normal[(i+0)*3+2]*-1.0f; | 170 normal1[2] = sg->normal[(i+0)*3+2]*-1.0f; |
178 normal1[3] = 1.0f; | 171 normal1[3] = 1.0f; |
179 | 172 |
185 normal3[0] = sg->normal[(i+2)*3]; | 178 normal3[0] = sg->normal[(i+2)*3]; |
186 normal3[1] = sg->normal[(i+2)*3+1]; | 179 normal3[1] = sg->normal[(i+2)*3+1]; |
187 normal3[2] = sg->normal[(i+2)*3+2]*-1.0f; | 180 normal3[2] = sg->normal[(i+2)*3+2]*-1.0f; |
188 normal3[3] = 1.0f; | 181 normal3[3] = 1.0f; |
189 | 182 |
190 ApplyNormalMatrix(normal1,sg->matrix); | 183 ApplyNormalMatrix(normal1,sg->real_matrix); |
184 ApplyNormalMatrix(normal2,sg->real_matrix); | |
185 ApplyNormalMatrix(normal3,sg->real_matrix); | |
186 | |
187 normal1[0] /= normal1[2]; | |
188 normal1[1] /= normal1[2]; | |
189 | |
190 normal2[0] /= normal2[2]; | |
191 normal2[1] /= normal2[2]; | |
192 | |
193 normal3[0] /= normal3[2]; | |
194 normal3[1] /= normal3[2]; | |
191 | 195 |
192 //ここでpolygonに法線ベクトルの情報がわたった | 196 //ここでpolygonに法線ベクトルの情報がわたった |
193 | 197 |
194 triangle->normal1.x = normal1[0]; | 198 triangle->normal1.x = normal1[0]; |
195 triangle->normal1.y = normal1[1]; | 199 triangle->normal1.y = normal1[1]; |
201 | 205 |
202 triangle->normal3.x = normal3[0]; | 206 triangle->normal3.x = normal3[0]; |
203 triangle->normal3.y = normal3[1]; | 207 triangle->normal3.y = normal3[1]; |
204 triangle->normal3.z = normal3[2]; | 208 triangle->normal3.z = normal3[2]; |
205 | 209 |
206 | |
207 | |
208 triangle->tex_info.addr = sg->texture_info.pixels; | 210 triangle->tex_info.addr = sg->texture_info.pixels; |
209 triangle->tex_info.width = sg->texture_info.t_w; | 211 triangle->tex_info.width = sg->texture_info.t_w; |
210 triangle->tex_info.height = sg->texture_info.t_h; | 212 triangle->tex_info.height = sg->texture_info.t_h; |
211 triangle->tex_info.scale_max = sg->texture_info.scale_max; | 213 triangle->tex_info.scale_max = sg->texture_info.scale_max; |
212 } | 214 } |