comparison Dandy.cc @ 29:606bdb2f721d

not working scale...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 25 Dec 2010 18:52:11 +0900
parents 789e845ea192
children 00ef8386edd6
comparison
equal deleted inserted replaced
28:789e845ea192 29:606bdb2f721d
260 root->xyz[0] = 0; 260 root->xyz[0] = 0;
261 root->xyz[1] = 0; 261 root->xyz[1] = 0;
262 root->xyz[2] = 30.0f; 262 root->xyz[2] = 30.0f;
263 263
264 /*親の回転、座標から、子の回転、座標を算出*/ 264 /*親の回転、座標から、子の回転、座標を算出*/
265 get_matrix(root->matrix, root->angle, root->xyz, root->scale, camera->matrix); 265 get_matrix(root->matrix, root->angle, root->xyz, camera->matrix);
266 /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/ 266 /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
267 get_matrix(root->real_matrix, root->angle, root->xyz, root->scale, camera->real_matrix); 267 get_matrix(root->real_matrix, root->angle, root->xyz, camera->real_matrix);
268 268
269 sgroot->setSceneData(root); 269 sgroot->setSceneData(root);
270 } 270 }
271 271
272 272
458 // RECT *recp; 458 // RECT *recp;
459 if ((jiki.ccount > 0) && (cf == 0)) { 459 if ((jiki.ccount > 0) && (cf == 0)) {
460 cf = 1; 460 cf = 1;
461 count++; 461 count++;
462 //cgcg(2); 462 //cgcg(2);
463 PutSprite(2, 480, 480, 110); 463 PutSprite(count, 480, 480, 110);
464 count++; 464 count++;
465 //cgcg(1); 465 //cgcg(1);
466 } 466 }
467 if ((jiki.ccount > 0) && (cf == 1)) { 467 if ((jiki.ccount > 0) && (cf == 1)) {
468 while (1) { 468 while (1) {
563 if (!name) { 563 if (!name) {
564 printf("PutSprite %d unknown\n",number); 564 printf("PutSprite %d unknown\n",number);
565 return; 565 return;
566 } 566 }
567 SceneGraphPtr object = sgroot->createSceneGraph(name); 567 SceneGraphPtr object = sgroot->createSceneGraph(name);
568 object->xyz[0] = x - object->c_xyz[0] * my_scale; 568 object->xyz[0] = x; // - object->c_xyz[0] * my_scale;
569 object->xyz[1] = y - object->c_xyz[1] * my_scale; 569 object->xyz[1] = y; // - object->c_xyz[1] * my_scale;
570 object->xyz[2] = 0; 570 object->xyz[2] = zorder * 0.01;
571 //object->c_xyz[0] = m->mx; 571 //object->c_xyz[0] = m->mx;
572 //object->c_xyz[1] = m->my; 572 //object->c_xyz[1] = m->my;
573 root->addChild(object); 573 root->addChild(object);
574 574
575 float scale[] = {my_scale,my_scale,1}; 575 float scale[] = {my_scale,my_scale,1};
576 /*親の回転、座標から、子の回転、座標を算出*/ 576 /*親の回転、座標から、子の回転、座標を算出*/
577 get_matrix(object->matrix, object->angle, object->xyz, scale, root->matrix); 577 scale_matrix(object->matrix, root->matrix, scale, object->c_xyz);
578 get_matrix(object->matrix, object->angle, object->xyz, object->matrix);
578 /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/ 579 /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
579 get_matrix(object->real_matrix, object->angle, object->xyz, scale, root->real_matrix); 580 get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix);
580 } 581 }
581 582
582 void 583 void
583 PutSpriteEx(int number, int x, int y, float scalex, float scaley, float angle) 584 PutSpriteEx(int number, int x, int y, float scalex, float scaley, float angle)
584 { 585 {
586 if (1) {
587 PutSprite(1, x, y, number);
588 return;
589 }
590
585 SpriteTable *m = &sptable[number]; 591 SpriteTable *m = &sptable[number];
586 char *name = (char *) m->texture; 592 char *name = (char *) m->texture;
587 if (!name) { 593 if (!name) {
588 printf("PutSpriteEx %d unknown\n",number); 594 printf("PutSpriteEx %d unknown\n",number);
589 return; 595 return;
590 } 596 }
591 SceneGraphPtr object = sgroot->createSceneGraph(name); 597 SceneGraphPtr object = sgroot->createSceneGraph(name);
592 object->xyz[0] = x - object->c_xyz[0] * my_scale-m->w*my_scale; 598 object->xyz[0] = x ; // - object->c_xyz[0] * my_scale*scalex;
593 object->xyz[1] = y - object->c_xyz[1] * my_scale-m->h*my_scale; 599 object->xyz[1] = y ; // - object->c_xyz[1] * my_scale*scaley;
594 object->xyz[2] = 0; 600 object->xyz[2] = number * 0.01;
595 //object->c_xyz[0] = m->mx; 601 //object->c_xyz[0] = m->mx;
596 //object->c_xyz[1] = m->my; 602 //object->c_xyz[1] = m->my;
597 object->angle[3] = angle; 603 object->angle[3] = angle * (3.1415926*2/4096);
598 root->addChild(object); 604 root->addChild(object);
599 605
600 float scale[] = {my_scale*scalex,my_scale*scaley,1}; 606 float scale[] = {my_scale*scalex*4,my_scale*scaley*4,1};
601 /*親の回転、座標から、子の回転、座標を算出*/ 607 /*親の回転、座標から、子の回転、座標を算出*/
602 get_matrix(object->matrix, object->angle, object->xyz, scale, root->matrix); 608 scale_matrix(object->matrix, root->matrix, scale, object->c_xyz);
609 get_matrix(object->matrix, object->angle, object->xyz, object->matrix);
603 /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/ 610 /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
604 get_matrix(object->real_matrix, object->angle, object->xyz, scale, root->real_matrix); 611 get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix);
605 } 612 }
606 613
607 614
608 struct SGO_PAD pad[2]; 615 struct SGO_PAD pad[2];
609 616