Mercurial > hg > Game > Cerium
changeset 1125:b733c7903d07 draft
remove old code
author | yutaka@localhost.localdomain |
---|---|
date | Sat, 12 Feb 2011 04:03:25 +0900 |
parents | c43f49400c22 |
children | 6043da6e48f1 |
files | Renderer/Engine/SceneGraph.cc Renderer/Engine/matrix.cc Renderer/Engine/matrix.h Renderer/Engine/polygon.cc Renderer/Engine/polygon.h Renderer/Engine/viewer.h TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Cell/spe/CellDmaManager.cc |
diffstat | 8 files changed, 11 insertions(+), 366 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraph.cc Fri Feb 11 20:39:24 2011 +0900 +++ b/Renderer/Engine/SceneGraph.cc Sat Feb 12 04:03:25 2011 +0900 @@ -10,6 +10,7 @@ #include "TextureHash.h" #include "texture.h" #include "TaskManager.h" +#include "polygon_pack.h" using namespace std; @@ -157,7 +158,8 @@ SceneGraph::SceneGraph(TaskManager *manager, xmlNodePtr surface) { init(); - + + //size : 面の数かな size = atoi((char *)xmlGetProp(surface,(xmlChar *)"size")); name = (char *)xmlGetProp(surface,(xmlChar *)"name"); parent_name = (char *)xmlGetProp(surface,(xmlChar *)"parent"); @@ -169,21 +171,13 @@ real_matrix[i] = 0; } -#if SPE_CREATE_POLYGON_CHECK - - for (int i = 0; i < 16; i++) { - printf("%f\n",matrix[i]); - printf("r %f\n",real_matrix[i]); - } - -#endif coord_xyz = (float*)manager->allocate(sizeof(float)*size*3); coord_tex = (float*)manager->allocate(sizeof(float)*size*3); normal = (float*)manager->allocate(sizeof(float)*size*3); - coord_pack_size = sizeof(float)*8*size*3; // coord_pack_vertex size is 32byte. vertex num 3. - coord_pack = (float*)manager->allocate(coord_pack_size); + pp_num = (size + MAX_SIZE_TRIANGLE - 1) / MAX_SIZE_TRIANGLE; + pp = (PolygonPack*)manager->allocate(sizeof(PolygonPack)*pp_num); get_data(manager, surface->children); @@ -213,22 +207,10 @@ size = 0; //data = NULL; -#if SPE_CREATE_POLYGON - - //tri_pack = NULL; - //sg_matrix = NULL; - //matrix = NULL; - //real_matrix = NULL; - //texture_info = NULL; - -#else - coord_xyz = NULL; normal = NULL; coord_tex = NULL; -#endif - texture_info.texture_id = -1; move = no_move; collision = no_collision; @@ -255,21 +237,11 @@ { //delete [] data; -#if SPE_CREATE_POLYGON - - free(coord_pack); - free(coord_xyz); - free(coord_tex); - free(normal); - -#else free(coord_xyz); free(coord_tex); free(normal); -#endif - } /**
--- a/Renderer/Engine/matrix.cc Fri Feb 11 20:39:24 2011 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -#include "matrix.h" - -// 完全にMac仕様。。sg_matrix を allocate してやらないといけないよ。 -float* -copy_matrix(SceneGraphPtr sg, TaskManager *manager) { - - float *matrix = sg->matrix; - float *real_matrix = sg->real_matrix; - - //変換行列は4x4 なんで、16。が二つで32.と言い訳を書いてみる。 - float *sg_matrix = (float*)manager->allocate(sizeof(float)*32); - - for (int i = 0; i < 16; i++) { - sg_matrix[i] = matrix[i]; - sg_matrix[i+16] = real_matrix[i]; - } - - return sg_matrix; - -} - -void -print_matrix(float *matrix) { - - for (int i = 0; i < 32; i++) { - printf("%f\n",matrix[i]); - } - -} - -void -add_matrix_list(SceneGraphPtr sg, TaskManager *manager, MatrixListInfo* info) { - - MatrixList *matrix_list = (MatrixList*)manager->allocate(sizeof(MatrixList)); - -#if SPE_CREATE_POLYGON_CHECK - print_matrix(sg->sg_matrix); -#endif - - matrix_list->matrix = copy_matrix(sg, manager);; - matrix_list->next = NULL; - - - if (info->last != NULL) { - info->last->next = matrix_list; - } - - info->last = matrix_list; - info->list_length += 1; - -} - -void -new_matrix_info(SceneGraphPtr sg, TaskManager *manager, MatrixListInfo* info) { - - MatrixListInfo *next = NULL; - - if (info->id == -1) { - - info->id = sg->sgid; - info->list_length = 1; - info->coord_pack = sg->coord_pack; - info->coord_pack_size = sg->coord_pack_size; - next = info; - - } else { - - MatrixListInfo* t; - - for (t = info; t->next != NULL; t = t->next) { - } - - next = (MatrixListInfo*)manager->allocate(sizeof(MatrixListInfo)); - next->id = sg->sgid; - next->list_length = 1; - next->coord_pack = sg->coord_pack; - next->coord_pack_size = sg->coord_pack_size; - next->next = NULL; - t->next = next; - - } - - MatrixList *new_list = (MatrixList*)manager->allocate(sizeof(MatrixList)); - new_list->matrix = copy_matrix(sg, manager); - -#if SPE_CREATE_POLYGON_CHECK - print_matrix(sg->sg_matrix); -#endif - - new_list->next = NULL; - - next->first = new_list; - next->last = new_list; - -} - -void -collect_matrix(SceneGraphPtr sg, MatrixListInfo *matrix_info, TaskManager *manager) { - - matrix_info->id = -1; - matrix_info->list_length = 0; - matrix_info->next = NULL; - matrix_info->first = NULL; - matrix_info->last = NULL; - - while (sg) { - - if (sg->flag_drawable) { - - int flag = 0; - - for (MatrixListInfo* t = matrix_info; t != NULL; t = t->next) { - if (sg->sgid == t->id) { - add_matrix_list(sg, manager, t); - flag = 1; - } - } - - if (flag != 1) { - new_matrix_info(sg, manager, matrix_info); - } - - // search SceneGraph. でも、ただのリストがあったハズだから、あとでそれに直す。はず・・ - if (sg->children != NULL) { - sg = sg->children; - } else if (sg->brother != NULL) { - sg = sg->brother; - } else { - while (sg) { - if (sg->brother != NULL) { - sg = sg->brother; - break; - } else { - if (sg->parent == NULL) { - sg = NULL; - break; - } else { - sg = sg->parent; - } - } - } - } - } - } -} - -void -check_matrix(MatrixListInfo *matrix_info,SceneGraphPtr sg) { - - for (MatrixListInfo* t = matrix_info; t != NULL; t = t->next) { - for (MatrixList* u = t->first; u != NULL; u = u->next) { - print_matrix(u->matrix); - } - } - -} - - - -/* end */
--- a/Renderer/Engine/matrix.h Fri Feb 11 20:39:24 2011 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -#ifndef INCLUDED_MATRIX -#define INCLUDED_MATRIX - -#include "TaskManager.h" -#include "SceneGraphRoot.h" - - struct MatrixList { - float *matrix; - MatrixList *next; - - }; - - struct MatrixListInfo { - int id; - float *coord_pack; - int coord_pack_size; - int list_length; - MatrixList *first; - MatrixList *last; - MatrixListInfo *next; - }; - - -extern float* copy_matrix(SceneGraphPtr sg, TaskManager *manager) ; - -extern void print_matrix(float *matrix) ; - - -extern void add_matrix_list(SceneGraphPtr sg, TaskManager *manager, MatrixListInfo* info) ; - - -extern void new_matrix_info(SceneGraphPtr sg, TaskManager *manager, MatrixListInfo* info) ; - - -extern void collect_matrix(SceneGraphPtr sg, MatrixListInfo *matrix_info, TaskManager *manager) ; - - -extern void check_matrix(MatrixListInfo *matrix_info,SceneGraphPtr sg) ; - -#endif -
--- a/Renderer/Engine/polygon.cc Fri Feb 11 20:39:24 2011 +0900 +++ b/Renderer/Engine/polygon.cc Sat Feb 12 04:03:25 2011 +0900 @@ -40,22 +40,17 @@ scale[2] = 1; -#if !SPE_CREATE_POLYGON - for (int i = 0; i < 16; i++) { matrix[i] = 0; + real_matrix[i] = 0; } -#endif - } void Polygon::pickup_coordinate(char *cont) { char *tmp_cont = cont; - int bound = 8; // coord_vertex size is 8byte. - int offset = 0; for(int n=0; n<size*3; n+=3) { @@ -69,48 +64,12 @@ } } - tmp_cont = cont; - - for(int n=0; n<size; n++) - { - tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset); - tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset+1); - tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset+2); - - if (tmp_cont == NULL) - { - cout << "Analyzing obj data failed coordinate\n"; - } - } - -#if SPE_CREATE_POLYGON_CHECK - - for (int i = 0; i < size; i++) { - - if (*(coord_xyz+i*3) != *(coord_pack+i*bound+offset)) { - printf("hoge\n"); - } - - if (*(coord_xyz+i*3+1) != *(coord_pack+i*bound+offset+1)) { - printf("hoge\n"); - } - - if (*(coord_xyz+i*3+2) != *(coord_pack+i*bound+offset+2)) { - printf("hoge\n"); - } - - } - -#endif - } void Polygon::pickup_normal(char *cont) { char *tmp_cont = cont; - int bound = 8; // coord_pack size is 8byte. - int offset = 5; // coord_pack (xyz(3) + tex_x,tex_y(2) + n_xyz(3)) for (int n = 0; n<size*3; n += 3) { @@ -124,40 +83,6 @@ } } - tmp_cont = cont; - - for(int n=0; n<size; n++) - { - tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset); - tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset+1); - tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset+2); - - if (tmp_cont == NULL) - { - cout << "Analyzing obj data failed coordinate\n"; - } - } - -#if SPE_CREATE_POLYGON_CHECK - - for (int i = 0; i < size; i++) { - - if (*(normal+i*3) != *(coord_pack+i*bound+offset)) { - printf("hoge\n"); - } - - if (*(normal+i*3+1) != *(coord_pack+i*bound+offset+1)) { - printf("hoge\n"); - } - - if (*(normal+i*3+2) != *(coord_pack+i*bound+offset+2)) { - printf("hoge\n"); - } - - } - -#endif - } void Polygon::pickup_model(char *cont) @@ -176,8 +101,6 @@ { char *tmp_cont = cont; - int bound = 8; // coord_pack size is 8byte. - int offset = 3; // coord_pack (xyz(3) + tex_x,tex_y(2) + n_xyz(3)) for (int n = 0; n < size*3; n += 3) { @@ -192,35 +115,6 @@ } tmp_cont = cont; - - for(int n=0; n<size; n++) - { - tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset); - tmp_cont = pickup_float(tmp_cont, coord_pack+n*bound+offset+1); - - if (tmp_cont == NULL) - { - cout << "Analyzing obj data failed coordinate\n"; - } - } - -#if SPE_CREATE_POLYGON_CHECK - - for (int i = 0; i < size; i++) { - - if (*(coord_tex+i*3) != *(coord_pack+i*bound+offset)) { - printf("hoge\n"); - } - - if (*(coord_tex+i*3+1) != *(coord_pack+i*bound+offset+1)) { - printf("hoge\n"); - } - - - } - -#endif - } char *get_pixel(int tx, int ty, SDL_Surface *texture_image) @@ -259,7 +153,6 @@ if (texture_info.texture_image->h-1< ty) ty = texture_info.texture_image->h-1 ; - //SDL_LockSurface(texture_image); char *p = get_pixel(tx,ty,texture_info.texture_image); blue = (Uint8) p[0];
--- a/Renderer/Engine/polygon.h Fri Feb 11 20:39:24 2011 +0900 +++ b/Renderer/Engine/polygon.h Sat Feb 12 04:03:25 2011 +0900 @@ -14,9 +14,7 @@ const char *parent_name; //float *data; //"vertex" and "normal" and "texture" - int coord_pack_size; - float *coord_pack; //coord_xyz(4*3*size), coord_tex(4*3*size), normal(4*3*size), float *coord_xyz; // vertex coordinate array float *coord_tex; // texture coordinate array float *normal; // normal vector array @@ -24,6 +22,9 @@ float real_matrix[16]; texture_list texture_info; + PolygonPackPtr pp; + int pp_num; + float xyz[4]; // position float angle[4]; // angle float c_xyz[4]; // center of rotation
--- a/Renderer/Engine/viewer.h Fri Feb 11 20:39:24 2011 +0900 +++ b/Renderer/Engine/viewer.h Sat Feb 12 04:03:25 2011 +0900 @@ -10,32 +10,11 @@ #include "Application.h" #include "SceneGraphRoot.h" #include "ViewerDevice.h" -#include "matrix.h" class SceneGraphRoot; class Application; -typedef struct sg_pp { - //13088 - float *coord_xyz; // (361*3) * 4 - float *coord_tex; - float *normal; - - //8 * 16 - float *matrix; // 4 * 16 - float *real_matrix; // 4 * 12 - uint32 pixels; // addr - - int sg_size; // 4 - int width; // 4 - int height; // 4 - int scale_max; // 4 - - int length; // 4 - int start; // 4 - -} SceneGraph2PolygonPack ; typedef struct rendering_data { PolygonPack *ppack;
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Fri Feb 11 20:39:24 2011 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Sat Feb 12 04:03:25 2011 +0900 @@ -169,6 +169,7 @@ } do { + // PPE side ppeManager->poll(); // SPE side
--- a/TaskManager/Cell/spe/CellDmaManager.cc Fri Feb 11 20:39:24 2011 +0900 +++ b/TaskManager/Cell/spe/CellDmaManager.cc Sat Feb 12 04:03:25 2011 +0900 @@ -120,7 +120,7 @@ } -// tasklist おわりに、MailQueue 全部を書き出す +// tasklist がもうない場合に、MailQueue 全部を書き出す void CellDmaManager::mail_write_finish_list(memaddr data) {