diff SgoexCerium.cc @ 34:b65f6fc9c84f

position is correct now.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 21 May 2011 20:44:24 +0900
parents 9a5300cedb14
children 3b92a4b17049
line wrap: on
line diff
--- a/SgoexCerium.cc	Sat May 21 18:52:56 2011 +0900
+++ b/SgoexCerium.cc	Sat May 21 20:44:24 2011 +0900
@@ -76,24 +76,29 @@
     //object->c_xyz[1] = m->my;
     root->addChild(object);
 
-    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->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+m->mx;
+    object->xyz[1] += y+m->my;
+    object->xyz[2] += zorder * 0.01;
+
+    float scale[] = {my_scale,my_scale,1};
+    //float c_xyz[] = {0,0,0};
+    //scale_matrix(object->matrix, scale, c_xyz);
 
     /*親の回転、座標から、子の回転、座標を算出*/
-    get_matrix(object->matrix, object->angle, object->xyz, root->matrix);
+    get_matrix_scale(object->matrix, object->angle, object->xyz, scale, root->matrix);
 
-    float scale[] = {my_scale,my_scale,1};
-    float c_xyz[] = {0,0,0};
-    scale_matrix(object->matrix, scale, c_xyz);
     /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
-    get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix);
+    // 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) {
+ if (1) {
     PutSprite(1, x, y, number);
     return;
  }
@@ -120,7 +125,7 @@
     float c_xyz[] = {0,0,0};
     scale_matrix(object->matrix, scale, c_xyz);
     /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
-    get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix);
+    // get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix);
 }