Mercurial > hg > Members > koba > t_dandy
changeset 68:b99e4366b913
fix position
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 21 May 2011 21:22:48 +0900 |
parents | 21ac9f57a6d4 |
children | 1c57e38fb9b5 |
files | Dandy.cc |
diffstat | 1 files changed, 43 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/Dandy.cc Sat May 21 16:27:41 2011 +0900 +++ b/Dandy.cc Sat May 21 21:22:48 2011 +0900 @@ -608,53 +608,67 @@ { SpriteTable *m = &sptable[number]; char *name = (char *) m->texture; - - if (!name) { -// printf("PutSprite %d unknown\n",number); - return; - } - +if (!name) { + printf("PutSprite %d unknown\n",number); + return; +} SceneGraphPtr object = sgroot->createSceneGraph(name); - object->xyz[0] = x; - object->xyz[1] = y; - object->xyz[2] = 0; + //object->c_xyz[0] = m->mx; + //object->c_xyz[1] = m->my; root->addChild(object); + object->xyz[0] -= object->c_xyz[0]*my_scale; + object->xyz[1] -= object->c_xyz[1]*my_scale; + object->xyz[2] -= object->c_xyz[2]; + + object->xyz[0] += x; + object->xyz[1] += y; + object->xyz[2] += zorder * 0.01; + float scale[] = {my_scale,my_scale,1}; + /*親の回転、座標から、子の回転、座標を算出*/ - get_matrix(object->matrix, object->angle, object->xyz, root->matrix); - scale_matrix(object->matrix, scale, object->c_xyz); + get_matrix_scale(object->matrix, object->angle, object->xyz, scale, root->matrix); + /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/ - get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix); - scale_matrix(object->real_matrix, scale, object->c_xyz); + // get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix); } void PutSpriteEx(int number, int x, int y, float scalex, float scaley, float angle) { + if (0) { + PutSprite(1, x, y, number); + return; + } + + int zorder = count++; + SpriteTable *m = &sptable[number]; char *name = (char *) m->texture; - if (!name) { -// printf("PutSpriteEx %d unknown\n",number); - return; - } - +if (!name) { + printf("PutSpriteEx %d unknown\n",number); + return; +} SceneGraphPtr object = sgroot->createSceneGraph(name); - object->xyz[0] = x - m->w*my_scale; - object->xyz[1] = y - m->h*my_scale; - object->xyz[2] = 0; - object->c_xyz[0] = m->mx; - object->c_xyz[1] = m->my; - object->angle[3] = angle; root->addChild(object); - float scale[] = {5*scalex,5*scaley,1}; + object->xyz[0] -= object->c_xyz[0]*my_scale*scalex; + object->xyz[1] -= object->c_xyz[1]*my_scale*scaley; + object->xyz[2] -= object->c_xyz[2]; + + object->xyz[0] += x; + object->xyz[1] += y; + object->xyz[2] += zorder * 0.01; + + + float scale[] = {my_scale*scalex,my_scale*scaley,1}; /*親の回転、座標から、子の回転、座標を算出*/ - get_matrix(object->matrix, object->angle, object->xyz, root->matrix); - scale_matrix(object->matrix, scale, object->c_xyz); + get_matrix_scale(object->matrix, object->angle, object->xyz, scale, root->matrix); + /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/ - get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix); - scale_matrix(object->real_matrix, scale, object->c_xyz); + // get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix); + }