Mercurial > hg > old > magoroku_racing
changeset 134:42337585fb7c
fix merge
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 22 Jul 2011 18:32:39 +0900 |
parents | 89231546bae6 |
children | d59f3906e74b |
files | gSprite.cc ps2util.cc |
diffstat | 2 files changed, 1 insertions(+), 209 deletions(-) [+] |
line wrap: on
line diff
--- a/gSprite.cc Fri Jul 22 18:29:56 2011 +0900 +++ b/gSprite.cc Fri Jul 22 18:32:39 2011 +0900 @@ -3,6 +3,7 @@ #include "TaskManager.h" #include "SceneGraph.h" #include "Application.h" +#include <iostream> #include <stdio.h> #include <stdlib.h> @@ -149,48 +150,9 @@ } - -extern Viewer *droot; - -static SceneGraphPtr root; - - -//SgoexCerium.ccより void -<<<<<<< local gSprite_DefSprite(int number, const char *name, float w, float h, int color)//, OBJECT *obj) -======= -flip() { - CameraPtr camera = droot->sgroot->getCamera(); - - droot->sgroot->flip(); - droot->sgroot->lightCalc(); - - root = droot->createSceneGraph(); - //root->xyz[0] = screen_w/2; - //root->xyz[1] = screen_h/2;; - root->xyz[0] = 0; - root->xyz[1] = 0; - root->xyz[2] = 30.0f; - - /*親の回転、座標から、子の回転、座標を算出*/ - get_matrix(root->matrix, root->angle, root->xyz, camera->matrix); - /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/ - get_matrix(root->real_matrix, root->angle, root->xyz, camera->real_matrix); - //出力して、次のものを出力するための準備 - droot->setSceneData(root); -} - - - - - -/*void -gSprite_DefSprite(int number, int tx, int ty, int tw, int th) ->>>>>>> other -{ -<<<<<<< local SpriteTable *m = &sptable[number]; m->w = w; m->h = h; @@ -200,163 +162,17 @@ m->tex_w = power_of_two(m->w); m->tex_h = power_of_two(m->h); m->texture = (int *)name; -======= - sptable[number].tx = tx; - sptable[number].ty = ty; - sptable[number].tw = tw; - sptable[number].th = th; -}*/ -void -gSprite_DefSprite(int number, const char *name, float w, float h, int color, OBJECT *obj) -{ - SpriteTable *m = &sptable[number]; - m->w = w; - m->h = h; - m->color = (color & 32); - m->mx = w / 2; //画像の中心を座標としたいらしい。 - m->my = h / 2; - m->tex_w = power_of_two(m->w); - m->tex_h = power_of_two(m->h); - m->texture = (int *)name; - ->>>>>>> other } -<<<<<<< local void gSprite_PutSprite(bool ScreenPos, int number, int x, int y, int z ) -======= - - - -/*void -gSprite_PutSprite(int number, int x, int y) ->>>>>>> other { SpriteTable *m = &sptable[number]; -<<<<<<< local char *name = (char *) m->texture; if (!name) { -======= - ps2util_sprite_Set_basicAttribute( - p, - (unsigned short)x, (unsigned short)y, - (unsigned short)sptable[number].tw*2, (unsigned short)sptable[number].th*2, - (unsigned short)sptable[number].tx, (unsigned short)sptable[number].ty, - (unsigned short)sptable[number].tw, (unsigned short)sptable[number].th, - SPRITE_PRIO_FOREGROUND); - - ps2util_sprite_Request(p); - sp_counter++; -}*/ -void -gSprite_PutSprite(int number, short x, short y, int zorder) -{ - SpriteTable *m = &sptable[number]; - char *name = (char *) m->texture; -if (!name) { ->>>>>>> other printf("PutSprite %d unknown\n",number); return; -<<<<<<< local -======= -} - SceneGraphPtr object = droot->createSceneGraph(name); - //object->c_xyz[0] = m->mx; - //object->c_xyz[1] = m->my; - root->addChild(object); - - 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_scale(object->matrix, object->angle, object->xyz, scale, root->matrix); - - /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/ - // get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix); -} - - - - - - -/*void -gSprite_PutSpriteEx(int number, int x, int y, float w, float h) -{ - ps2utilSprite *p = &sp[sp_counter]; - - ps2util_sprite_Set_basicAttribute( - p, - (unsigned short)x, (unsigned short)y, - (unsigned short)sptable[number].tw*w, (unsigned short)sptable[number].th*h, - (unsigned short)sptable[number].tx, (unsigned short)sptable[number].ty, - (unsigned short)sptable[number].tw, (unsigned short)sptable[number].th, - SPRITE_PRIO_FOREGROUND); - - ps2util_sprite_Request(p); - sp_counter++; -}*/ -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) { - printf("PutSpriteEx %d unknown\n",number); - return; -} - SceneGraphPtr object = droot->createSceneGraph(name); - root->addChild(object); - - float scale[] = {my_scale*scalex*4,my_scale*scaley*4,1}; - - /*親の回転、座標から、子の回転、座標を算出*/ - 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] = number * 0.01; - //object->c_xyz[0] = m->mx; - //object->c_xyz[1] = m->my; - object->angle[3] = angle * (3.1415926*2/4096); - get_matrix(object->matrix, object->angle, object->xyz, root->matrix); - 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); -} - - - - - - - -//ここいらはどうやら、スプライトを取得する部分。 - -static void -gSprite_Init_Png(const char *texname) -{ - if (!(sprite_tex = read_png_file(texname))) { - fprintf(stderr, - "cannot creat texture - init_png().\n"); - fflush(stderr); - exit(EXIT_FAILURE); ->>>>>>> other } for( int i = 0; i < 3; i ++ ){ @@ -528,7 +344,6 @@ ps2util_graphic_Init(); //gSprite_Init_Png("img/main2.png"); //gSprite_Create(); // スプライト生成 -<<<<<<< local // testCoeler int tc = 1; @@ -546,30 +361,8 @@ gSprite_DefSprite( SELECT_CAR_2, "select_car_2", 165, 140, tc); gSprite_DefSprite( SELECT_CAR_3, "select_car_3", 165, 140, tc); gSprite_DefSprite( SELECT_CORSE_1, "select_corse_1", 148, 114, tc); // 選択画面のコース -======= - - sgroot->createFromXMLfile("./xml_files/boss.xml"); - - /* gSprite_DefSprite(10, 1, 1, 512, 666); // タイトル - gSprite_DefSprite(17, 1, 35, 33, 33); // 選択マーク - gSprite_DefSprite(23, 1, 1, 106, 34); // スピードメーター - gSprite_DefSprite(24, 51, 40, 18, 20); // 右矢印 - gSprite_DefSprite(25, 33, 40, 17, 20); // 左矢印 - gSprite_DefSprite(26, 56, 89, 55, 26); // km/h - gSprite_DefSprite(27, 62, 62, 39, 26); // Rap - gSprite_DefSprite(28, 430, 62, 53, 46); // 1p - gSprite_DefSprite(29, 460, 6, 53, 46); // 2P - gSprite_DefSprite(51, 333, 116, 165, 140); // 選択画面の車 - gSprite_DefSprite(52, 181, 116, 165, 140); - gSprite_DefSprite(53, 12, 116, 165, 140); - gSprite_DefSprite(81, 115, 1, 148, 114); // 選択画面のコース ->>>>>>> other // 本当は (82, 272,...)です。二つ目のコース絵がないので -<<<<<<< local gSprite_DefSprite( SELECT_CORSE_2, "select_corse_2", 148, 114 ,tc); -======= - gSprite_DefSprite(82, 272, 1, 148, 114);*/ ->>>>>>> other }