diff TaskManager/Test/test_render/SceneGraph.cpp @ 148:9642aeef298d

Span への Texture List の渡し。じゃっかん texture がバグってるので 要チェック
author gongo@charles.cr.ie.u-ryukyu.ac.jp
date Tue, 02 Dec 2008 18:49:04 +0900
parents ff3fb47c2553
children 6aead32217b7
line wrap: on
line diff
--- a/TaskManager/Test/test_render/SceneGraph.cpp	Tue Dec 02 15:47:25 2008 +0900
+++ b/TaskManager/Test/test_render/SceneGraph.cpp	Tue Dec 02 18:49:04 2008 +0900
@@ -8,6 +8,7 @@
 #include "sys.h"
 #include "TextureHash.h"
 #include "texture.h"
+#include "TaskManager.h"
 
 using namespace std;
 
@@ -326,12 +327,31 @@
 		list[id_count-1].t_h = texture_image->h;
 		list[id_count-1].pixels = (Uint32*)texture_image->pixels;
 
+		uint32 *tex_dest = (uint32*)manager->malloc(texture_image->w*texture_image->h*4);
+
+		{
+		    int t = 0;
+		    int tex_width = texture_image->w;
+		    int tex_height = texture_image->h;
+		    Uint32 *tex_src = (Uint32*)texture_image->pixels;
+		    
+		    for (int y = 0; y < tex_height; y += TEXTURE_SPLIT_PIXEL) {
+			for (int x = 0; x < tex_width; x += TEXTURE_SPLIT_PIXEL) {
+			    for (int j = 0; j < TEXTURE_SPLIT_PIXEL; j++) {
+				for (int i = 0; i < TEXTURE_SPLIT_PIXEL; i++) {
+				    tex_dest[t++] = tex_src[(x+i) + tex_width*(y+j)];
+				}
+			    }
+			}
+		    }
+		}
+
 		texture_id = id_count-1;
 		texture_info.t_w = texture_image->w;
 		texture_info.t_h = texture_image->h;
 		texture_info.pixels_orig = (Uint32*)texture_image->pixels;
-		texture_info.pixels = NULL;
-
+		texture_info.pixels = tex_dest;
+		printf("%p\n", tex_dest);
 		//load_texture(image_name);
 		if(unlink(image_name))
 		{