Mercurial > hg > Members > kono > tree_dandy2
diff Dandy.cc @ 30:00ef8386edd6
scale_matrix does not work
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 25 Dec 2010 21:04:59 +0900 |
parents | 606bdb2f721d |
children | 3b7e57614d93 |
line wrap: on
line diff
--- a/Dandy.cc Sat Dec 25 18:52:11 2010 +0900 +++ b/Dandy.cc Sat Dec 25 21:04:59 2010 +0900 @@ -565,17 +565,20 @@ return; } SceneGraphPtr object = sgroot->createSceneGraph(name); - object->xyz[0] = x; // - object->c_xyz[0] * my_scale; - object->xyz[1] = y; // - object->c_xyz[1] * my_scale; - object->xyz[2] = zorder * 0.01; //object->c_xyz[0] = m->mx; //object->c_xyz[1] = m->my; root->addChild(object); - float scale[] = {my_scale,my_scale,1}; + object->xyz[0] = x - object->c_xyz[0]*my_scale; + object->xyz[1] = y - object->c_xyz[1]*my_scale; + object->xyz[2] = zorder * 0.01; + /*親の回転、座標から、子の回転、座標を算出*/ - scale_matrix(object->matrix, root->matrix, scale, object->c_xyz); - get_matrix(object->matrix, object->angle, object->xyz, object->matrix); + get_matrix(object->matrix, object->angle, object->xyz, root->matrix); + + float scale[] = {my_scale,my_scale,1}; + float c_xyz[] = {0,0,0}; + //scale_matrix(object->matrix, object->matrix, scale, c_xyz); /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/ get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix); } @@ -595,18 +598,20 @@ return; } SceneGraphPtr object = sgroot->createSceneGraph(name); - object->xyz[0] = x ; // - object->c_xyz[0] * my_scale*scalex; - object->xyz[1] = y ; // - object->c_xyz[1] * my_scale*scaley; + root->addChild(object); + + float scale[] = {my_scale*scalex*4,my_scale*scaley*4,1}; + + /*親の回転、座標から、子の回転、座標を算出*/ + object->xyz[0] = x - object->c_xyz[0] * my_scale - m->w*my_scale; + object->xyz[1] = y - object->c_xyz[1] * my_scale - m->h*my_scale; object->xyz[2] = number * 0.01; //object->c_xyz[0] = m->mx; //object->c_xyz[1] = m->my; object->angle[3] = angle * (3.1415926*2/4096); - root->addChild(object); - - float scale[] = {my_scale*scalex*4,my_scale*scaley*4,1}; - /*親の回転、座標から、子の回転、座標を算出*/ - scale_matrix(object->matrix, root->matrix, scale, object->c_xyz); - get_matrix(object->matrix, object->angle, object->xyz, object->matrix); + get_matrix(object->matrix, object->angle, object->xyz, root->matrix); + float c_xyz[] = {0,0,0}; + //scale_matrix(object->matrix, object->matrix, scale, c_xyz); /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/ get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix); }