Mercurial > hg > Members > kono > Cerium
diff TaskManager/Test/test_render/SceneGraph.cpp @ 171:dc68bc5c9e41
Scale-SceneGraph.cpp
author | tkaito@nw0534.st.ie.u-ryukyu.ac.jp |
---|---|
date | Thu, 11 Dec 2008 16:33:39 +0900 |
parents | 1f4c3f3238e6 |
children | 56be4a6e5513 |
line wrap: on
line diff
--- a/TaskManager/Test/test_render/SceneGraph.cpp Thu Dec 11 11:18:44 2008 +0900 +++ b/TaskManager/Test/test_render/SceneGraph.cpp Thu Dec 11 16:33:39 2008 +0900 @@ -323,7 +323,11 @@ texture_image = converted; } - uint32 *tex_dest = (uint32*)manager->malloc(texture_image->w*texture_image->h*4); + int image_tmp = texture_image->w*texture_image->h*4; + int tile_size = image_tmp + image_tmp/2 + image_tmp/4 + image_tmp/8 + image_tmp/16; + //uint32 *tex_dest = (uint32*)manager->malloc(texture_image->w*texture_image->h*4); + uint32 *tex_dest = (uint32*)manager->malloc(tile_size); + { int t = 0; @@ -340,18 +344,63 @@ } } } + + // 1 / 2 + for (int y = 0; y < tex_height; y += TEXTURE_SPLIT_PIXEL*2) { + for (int x = 0; x < tex_width; x += TEXTURE_SPLIT_PIXEL*2) { + for (int j = 0; j < TEXTURE_SPLIT_PIXEL*2; j+=2) { + for (int i = 0; i < TEXTURE_SPLIT_PIXEL*2; i+=2) { + tex_dest[t++] = tex_src[(x+i) + tex_width*(y+j)]; + } + } + } + } + + // 1 / 4 + for (int y = 0; y < tex_height; y += TEXTURE_SPLIT_PIXEL*4) { + for (int x = 0; x < tex_width; x += TEXTURE_SPLIT_PIXEL*4) { + for (int j = 0; j < TEXTURE_SPLIT_PIXEL*4; j+=4) { + for (int i = 0; i < TEXTURE_SPLIT_PIXEL*4; i+=4) { + tex_dest[t++] = tex_src[(x+i) + tex_width*(y+j)]; + } + } + } + } + + // 1 / 8 + for (int y = 0; y < tex_height; y += TEXTURE_SPLIT_PIXEL*8) { + for (int x = 0; x < tex_width; x += TEXTURE_SPLIT_PIXEL*8) { + for (int j = 0; j < TEXTURE_SPLIT_PIXEL*8; j+=8) { + for (int i = 0; i < TEXTURE_SPLIT_PIXEL*8; i+=8) { + tex_dest[t++] = tex_src[(x+i) + tex_width*(y+j)]; + } + } + } + } + + // 1 / 16 + for (int y = 0; y < tex_height; y += TEXTURE_SPLIT_PIXEL*16) { + for (int x = 0; x < tex_width; x += TEXTURE_SPLIT_PIXEL*16) { + for (int j = 0; j < TEXTURE_SPLIT_PIXEL*16; j+=16) { + for (int i = 0; i < TEXTURE_SPLIT_PIXEL*16; i+=16) { + tex_dest[t++] = tex_src[(x+i) + tex_width*(y+j)]; + } + } + } + } + } - list[id_count-1].t_w = texture_image->w; - list[id_count-1].t_h = texture_image->h; + list[id_count-1].t_w = texture_image->w/2; + list[id_count-1].t_h = texture_image->h/2; list[id_count-1].pixels_orig = (Uint32*)texture_image->pixels; - list[id_count-1].pixels = tex_dest; + list[id_count-1].pixels = tex_dest + image_tmp/4; texture_id = id_count-1; - texture_info.t_w = texture_image->w; - texture_info.t_h = texture_image->h; + texture_info.t_w = texture_image->w/2; + texture_info.t_h = texture_image->h/2; texture_info.pixels_orig = (Uint32*)texture_image->pixels; - texture_info.pixels = tex_dest; + texture_info.pixels = tex_dest + image_tmp/4; printf("[%s] %p\n", filename, tex_dest);