changeset 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
files Dandy.cc
diffstat 1 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/Dandy.cc	Sat Dec 18 12:32:06 2010 +0900
+++ b/Dandy.cc	Sat Dec 25 18:52:11 2010 +0900
@@ -262,9 +262,9 @@
     root->xyz[2] = 30.0f;
 
     /*親の回転、座標から、子の回転、座標を算出*/
-    get_matrix(root->matrix, root->angle, root->xyz, root->scale, camera->matrix);
+    get_matrix(root->matrix, root->angle, root->xyz, camera->matrix);
     /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
-    get_matrix(root->real_matrix, root->angle, root->xyz, root->scale, camera->real_matrix);
+    get_matrix(root->real_matrix, root->angle, root->xyz, camera->real_matrix);
 
     sgroot->setSceneData(root);
 }
@@ -460,7 +460,7 @@
 	    cf = 1;
 	    count++;
 	    //cgcg(2);
-	    PutSprite(2, 480, 480, 110);
+	    PutSprite(count, 480, 480, 110);
 	    count++;
 	    //cgcg(1);
 	}
@@ -565,23 +565,29 @@
     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] = 0;
+    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};
     /*親の回転、座標から、子の回転、座標を算出*/
-    get_matrix(object->matrix, object->angle, object->xyz, scale, root->matrix);
+    scale_matrix(object->matrix, root->matrix, scale, object->c_xyz);
+    get_matrix(object->matrix, object->angle, object->xyz, object->matrix);
     /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
-    get_matrix(object->real_matrix, object->angle, object->xyz, scale, 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 (1) {
+    PutSprite(1, x, y, number);
+    return;
+ }
+
     SpriteTable *m = &sptable[number];
     char *name = (char *) m->texture;
 if (!name) {
@@ -589,19 +595,20 @@
     return;
 }
     SceneGraphPtr object = sgroot->createSceneGraph(name);
-    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] = 0;
+    object->xyz[0] = x ; // - object->c_xyz[0] * my_scale*scalex;
+    object->xyz[1] = y ; // - object->c_xyz[1] * my_scale*scaley;
+    object->xyz[2] = number * 0.01;
     //object->c_xyz[0] = m->mx;
     //object->c_xyz[1] = m->my;
-    object->angle[3] = angle;
+    object->angle[3] = angle * (3.1415926*2/4096);
     root->addChild(object);
 
-    float scale[] = {my_scale*scalex,my_scale*scaley,1};
+    float scale[] = {my_scale*scalex*4,my_scale*scaley*4,1};
     /*親の回転、座標から、子の回転、座標を算出*/
-    get_matrix(object->matrix, object->angle, object->xyz, scale, root->matrix);
+    scale_matrix(object->matrix, root->matrix, scale, object->c_xyz);
+    get_matrix(object->matrix, object->angle, object->xyz, object->matrix);
     /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
-    get_matrix(object->real_matrix, object->angle, object->xyz, scale, root->real_matrix);
+    get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix);
 }