Mercurial > hg > Members > kono > Cerium
changeset 1035:ff0e6d00c060
bledenr script
author | tkaito |
---|---|
date | Mon, 29 Nov 2010 18:27:06 +0900 |
parents | a0faa0cfc271 |
children | 153dd7b4b8a6 1e243714cf3c |
files | Renderer/Engine/viewer.cc Renderer/Engine/viewer.h SceneGraph/BlenderScript/export_xml.py |
diffstat | 3 files changed, 53 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/viewer.cc Fri Nov 26 04:35:34 2010 +0900 +++ b/Renderer/Engine/viewer.cc Mon Nov 29 18:27:06 2010 +0900 @@ -699,14 +699,16 @@ k = spe_num; } pptask[k] = task_array[k]->next_task_array(CreatePolygonFromSceneGraph,pptask[k]); - pptask[k]->set_inData(0, &sg->coord_xyz, sizeof(float)*sg->size/3); - pptask[k]->set_inData(1, &sg->coord_tex, sizeof(float)*sg->size/3); - pptask[k]->set_inData(2, &sg->normal , sizeof(float)*sg->size/3); - pptask[k]->set_inData(3, &sg->matrix , sizeof(float)*12); - pptask[k]->set_inData(4, &sg->real_matrix, sizeof(float)*8); - pptask[k]->set_inData(5, &sg->texture_info.pixels, sizeof(uint32)); - - pptask[k]->set_param(0,(memaddr)sg->size); + + pptask[k]->set_inData(0, &sg->coord_xyz, sizeof(float)*sg->size); + pptask[k]->set_inData(1, &sg->coord_tex, sizeof(float)*sg->size); + pptask[k]->set_inData(2, &sg->normal , sizeof(float)*sg->size); + pptask[k]->set_inData(3, &sg->matrix , sizeof(float)*16); + pptask[k]->set_inData(4, &sg->real_matrix, sizeof(float)*12); + pptask[k]->set_inData(5, &sg->texture_info.pixels, sizeof(uint32)); // 4 byte + + // 4 byte * 4 = 16 byte + pptask[k]->set_param(0,(memaddr)sg->size); // 4byte pptask[k]->set_param(1,(memaddr)sg->texture_info.t_w); pptask[k]->set_param(2,(memaddr)sg->texture_info.t_h); pptask[k]->set_param(3,(memaddr)sg->texture_info.scale_max); @@ -763,7 +765,7 @@ #else //SceneGraphPtr sg = sgroot->getDrawSceneGraph(); - //printf("sg->size = %lld\n", sg->size); + //printf("sg->size = %lld\n", sizeof(pixels)); HTaskPtr task_create_pp = manager->create_task(CreatePolygonFromSceneGraph); // SceneGraph(木構造) -> PolygonPack
--- a/Renderer/Engine/viewer.h Fri Nov 26 04:35:34 2010 +0900 +++ b/Renderer/Engine/viewer.h Mon Nov 29 18:27:06 2010 +0900 @@ -16,6 +16,27 @@ 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; SpanPackPtr spackList;
--- a/SceneGraph/BlenderScript/export_xml.py Fri Nov 26 04:35:34 2010 +0900 +++ b/SceneGraph/BlenderScript/export_xml.py Mon Nov 29 18:27:06 2010 +0900 @@ -1,6 +1,6 @@ #!BPY """Registration info for Blender menus: -Name: 'Libps3 (.xml)' +Name: 'Libps+x (.xml)' Blender: 240 Group: 'Export' Tooltip: 'Export to (.xml) for libps3' @@ -144,7 +144,7 @@ #str = "" file.write("") matrix = obj.getMatrix() - + big = 6 for mindex in range(len(flist)): fl = flist[mindex] if fl != []: @@ -166,9 +166,9 @@ tri_second = vlist[f[1]] tri_third = vlist[f[2]] - file.write("\t\t\t%f %f %f\n" %(tri_first[0][0] + matrix[3][0], tri_first[0][1] + matrix[3][1], tri_first[0][2] + matrix[3][2]) ) - file.write("\t\t\t%f %f %f\n" %(tri_second[0][0] + matrix[3][0], tri_second[0][1] + matrix[3][1], tri_second[0][2] + matrix[3][2]) ) - file.write("\t\t\t%f %f %f\n" %(tri_third[0][0] + matrix[3][0], tri_third[0][1] + matrix[3][1], tri_third[0][2] + matrix[3][2]) ) + file.write("\t\t\t%f %f %f\n" %(big*(tri_first[0][0] + matrix[3][0]), big*(tri_first[0][1] + matrix[3][1]), big*(tri_first[0][2] + matrix[3][2])) ) + file.write("\t\t\t%f %f %f\n" %(big*(tri_second[0][0] + matrix[3][0]), big*(tri_second[0][1] + matrix[3][1]), big*(tri_second[0][2] + matrix[3][2])) ) + file.write("\t\t\t%f %f %f\n" %(big*(tri_third[0][0] + matrix[3][0]), big*(tri_third[0][1] + matrix[3][1]), big*(tri_third[0][2] + matrix[3][2])) ) file.write("\t\t</coordinate>\n") file.write("\t\t<normal>\n") @@ -177,9 +177,9 @@ tri_second = vlist[f[1]] tri_third = vlist[f[2]] - file.write("\t\t\t%f %f %f\n" %(tri_first[1][0], tri_first[1][1], tri_first[1][2]) ) - file.write("\t\t\t%f %f %f\n" %(tri_second[1][0], tri_second[1][1], tri_second[1][2]) ) - file.write("\t\t\t%f %f %f\n" %(tri_third[1][0], tri_third[1][1], tri_third[1][2]) ) + file.write("\t\t\t%f %f %f\n" %(big*(tri_first[1][0]), big*(tri_first[1][1]), big*(tri_first[1][2])) ) + file.write("\t\t\t%f %f %f\n" %(big*(tri_second[1][0]), big*(tri_second[1][1]), big*(tri_second[1][2])) ) + file.write("\t\t\t%f %f %f\n" %(big*(tri_third[1][0]), big*(tri_third[1][1]), big*(tri_third[1][2])) ) file.write("\t\t</normal>\n" ) file.write("\t\t<model>\n" ) @@ -193,28 +193,26 @@ tri_first = vlist[f[0]] tri_second = vlist[f[1]] tri_third = vlist[f[2]] - - file.write("\t\t\t%f %f\n" %(tri_first[2][0], tri_first[2][1]) ) - file.write("\t\t\t%f %f\n" %(tri_second[2][0], tri_second[2][1]) ) - file.write("\t\t\t%f %f\n" %(tri_third[2][0], tri_third[2][1]) ) + file.write("\t\t\t%f %f\n" %(tri_first[2][0], (-1*(tri_first[2][1])+1 ))) + file.write("\t\t\t%f %f\n" %(tri_second[2][0], (-1*(tri_second[2][1])+1 ))) + file.write("\t\t\t%f %f\n" %(tri_third[2][0], (-1*(tri_third[2][1])+1 ))) file.write("\t\t</texture>\n") else: - file.write("\t\t<texture/>\n") - - + file.write("\t\t<texture>\n") + for f in fl: + file.write("\t\t\t0.000000 0.000000\n") + file.write("\t\t\t0.000000 0.000000\n") + file.write("\t\t\t0.000000 0.000000\n") + file.write("\t\t</texture>\n") ### get texture_image and change base64 data texture = mesh.faces[0].image if texture: - file.write(loadTexture(texture)) - + file.write(loadTexture(texture)) else: - file.write("\t\t<image name=\"%s\">\n" %("sample_white.png") ) - - file.write("\t\t\tiVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAAAAADhZOFXAAAAEElEQVQImWP8zwABTAwUMQBJQQEP\n"); - file.write("\t\t\tlYH+agAAAABJRU5ErkJggg==\n"); - + file.write("\t\t<image name=\"%s\">\n" %("dummy.png") ) + file.write("\t\t\tiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAGUlEQVQokWP8/fs3AymAiSTVoxpG\n"); + file.write("\t\t\tNQwpDQAwxQMRlevqcQAAAABJRU5ErkJggg==\n"); file.write("\t\t</image>\n") - #return str vdata = []