# HG changeset patch # User Shinji KONO # Date 1291901600 -32400 # Node ID 095e9575cc0ae550ab74f03b1c2e44780326199d # Parent bdc882acda58fc1af9ed5e4c81f27c98a4a74338# Parent 47101546f0304cc77be2cf969083a3e75ee324f7 merge diff -r 47101546f030 -r 095e9575cc0a Dandy.cc --- a/Dandy.cc Tue Dec 07 19:07:05 2010 +0900 +++ b/Dandy.cc Thu Dec 09 22:33:20 2010 +0900 @@ -26,7 +26,7 @@ #include "LoadSprite.h" #include #include "error.h" -#include "sys.h" +#include "matrix_calc.h" #include "Character.h" #include "Character_state.h" @@ -151,6 +151,13 @@ LightSysSwitch(Viewer *sgroot) { if (light_sysswitch == 1) { sgroot->OnLightSysSwitch(); + for (int i = 0; i < light_num; i++) { + SceneGraphPtr light = sgroot->getLight(i); + sgroot->OnLightSwitch(i); + light->xyz[0] = screen_w / 2; + light->xyz[1] = screen_h / 2; + light->xyz[2] = -100; + } } else if (light_sysswitch == 0) { sgroot->OffLightSysSwitch(); } @@ -174,13 +181,6 @@ sgroot->createFromXMLfile("xml/boss.xml"); LightSysSwitch(sgroot); - for (int i = 0; i < light_num; i++) { - SceneGraphPtr light = sgroot->getLight(i); - sgroot->OnLightSwitch(i); - light->xyz[0] = screen_w / 2; - light->xyz[1] = screen_h / 2; - light->xyz[2] = -100; - } init_sprite(0,0,0,0); @@ -231,9 +231,7 @@ SceneGraphPtr root; -extern void get_matrix(float *matrix, float *rxyz, float *txyz, float *stack); -extern void ScaleMatrix(float *matrix, float rxyz); -extern void ScaleMatrixXY(float *matrix, float x, float y); +// extern void get_matrix(float *matrix, float *rxyz, float *txyz, float *scale, float *stack); static void flip() @@ -249,9 +247,9 @@ root->xyz[2] = 30.0f; /*親の回転、座標から、子の回転、座標を算出*/ - get_matrix(root->matrix, root->angle, root->xyz, camera->matrix); + get_matrix(root->matrix, root->angle, root->xyz, root->scale, camera->matrix); /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/ - get_matrix(root->real_matrix, root->angle, root->xyz, camera->real_matrix); + get_matrix(root->real_matrix, root->angle, root->xyz, root->scale, camera->real_matrix); sgroot->setSceneData(root); } @@ -560,11 +558,11 @@ object->xyz[2] = 0; root->addChild(object); + float scale[] = {5,5,1}; /*親の回転、座標から、子の回転、座標を算出*/ - get_matrix(object->matrix, object->angle, object->xyz, root->matrix); - ScaleMatrixXY(object->matrix,5,5); + get_matrix(object->matrix, object->angle, object->xyz, scale, root->matrix); /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/ - get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix); + get_matrix(object->real_matrix, object->angle, object->xyz, scale, root->real_matrix); } @@ -586,11 +584,11 @@ object->angle[3] = angle; root->addChild(object); + float scale[] = {5*scalex,5*scaley,1}; /*親の回転、座標から、子の回転、座標を算出*/ - get_matrix(object->matrix, object->angle, object->xyz, root->matrix); - ScaleMatrixXY(object->matrix,scalex*5,scaley*5); + get_matrix(object->matrix, object->angle, object->xyz, scale, root->matrix); /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/ - get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix); + get_matrix(object->real_matrix, object->angle, object->xyz, scale, root->real_matrix); }