changeset 20:095e9575cc0a

merge
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 09 Dec 2010 22:33:20 +0900
parents bdc882acda58 (diff) 47101546f030 (current diff)
children b7654db65a34 cd5768022d2b
files
diffstat 1 files changed, 17 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- 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 <SDL_mixer.h>
 #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);
 }