changeset 1092:b99abedb5523 draft

fix h w in makeTapestry
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 23 Dec 2010 11:02:06 +0900
parents 49f404f9d51c
children 3e1caef39798
files Renderer/Engine/Makefile.def Renderer/Engine/SceneGraph.cc Renderer/Engine/task/DrawSpan.cc Renderer/Test/Makefile.macosx
diffstat 4 files changed, 30 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/Makefile.def	Wed Dec 22 08:04:58 2010 +0900
+++ b/Renderer/Engine/Makefile.def	Thu Dec 23 11:02:06 2010 +0900
@@ -5,7 +5,7 @@
 ABIBIT = 64 
 ABI = -m$(ABIBIT)
 CC      = g++
-OPT	= -O9 #-DSPE_CREATE_POLYGON_CHECK -DSPE_CREATE_POLYGON=1
+OPT	= -g  #-DSPE_CREATE_POLYGON_CHECK -DSPE_CREATE_POLYGON=1
 CFLAGS  = -Wall $(ABI) $(OPT)  #  -DDEBUG
 
 INCLUDE = -I$(CERIUM)/include/TaskManager -I.
--- a/Renderer/Engine/SceneGraph.cc	Wed Dec 22 08:04:58 2010 +0900
+++ b/Renderer/Engine/SceneGraph.cc	Thu Dec 23 11:02:06 2010 +0900
@@ -88,8 +88,10 @@
     uint32 p_diff = 1;
 
     uint32 *tex_dest = (uint32*)manager->allocate(sizeof(int)*all_pixel_num);
+    // uint32 *tex_src_max = (uint32*)( tex_src + tex_h*tex_w);
 
-    uint32 alpha =  SDL_BYTEORDER == SDL_LIL_ENDIAN? 0xff000000 : 0xff; /* OpenGL RGBA masks */
+    // uint32 alpha =  SDL_BYTEORDER == SDL_LIL_ENDIAN? 0xff000000 : 0xff; /* OpenGL RGBA masks */
+    uint32 alpha =  tex_src[0];
 
     while (scale_cnt) {
 	// we should use average, except clear one
@@ -98,14 +100,13 @@
                 for (uint32 j = 0; j < diff; j += p_diff) {
                     for (uint32 i = 0; i < diff; i += p_diff) {
                         tex_dest[t++] = 
-			    (x+i<=tex_h && y+j<=tex_w) ? tex_src[(x+i) + tex_w*(y+j)]: alpha;
+			    (x+i<tex_w && y+j<tex_h) ? tex_src[(x+i) + tex_w*(y+j)]: alpha;
                     }
                 }
             }
         }
 
-        diff <<= 1;
-        p_diff <<= 1;
+        diff <<= 1; p_diff <<= 1;
         scale_cnt >>= 1;
     }
 
--- a/Renderer/Engine/task/DrawSpan.cc	Wed Dec 22 08:04:58 2010 +0900
+++ b/Renderer/Engine/task/DrawSpan.cc	Thu Dec 23 11:02:06 2010 +0900
@@ -253,7 +253,7 @@
     int tex_localy;
     memaddr tex_addr;
 
-    if (span->x < startx || endx < span->x) {
+    if (span->x < startx || endx < span->x || ! span->tex_addr) {
         return -1;
     }
 
@@ -261,7 +261,6 @@
     tex_ypos = (int)((span->tex_height-1) * tey);
 
     if (zpos < g->zRow[localx + (rangex*localy)]) {
-	if (!span->tex_addr) return -1; // broken case, I'd like to write some thing...
         tex_addr = getTile(tex_xpos, tex_ypos,
                            span->tex_width, (memaddr)span->tex_addr);
         tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL;
@@ -342,6 +341,8 @@
     int localx, localy = getLocalY(span->y-1);
 
     int ret = je+1;
+    if (!span->tex_addr) 
+	return -1; // broken case, I'd like to write some thing...
 
     //for (int j = js; j <= je; j++) {
     for (int j = je; j >= js; j--) {
@@ -369,7 +370,6 @@
             int tex_localx;
             int tex_localy;
 
-	    if (!span->tex_addr) continue; // broken case, I'd like to write some thing...
             tex_addr = getTile(tex_xpos, tex_ypos,
                                span->tex_width, (memaddr)span->tex_addr);
             tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL;
--- a/Renderer/Test/Makefile.macosx	Wed Dec 22 08:04:58 2010 +0900
+++ b/Renderer/Test/Makefile.macosx	Thu Dec 23 11:02:06 2010 +0900
@@ -15,93 +15,91 @@
 
 ALL =  ball_bound boss1_action direction gaplant ieshoot node panel universe untitled vacuum property_test send_linda dynamic writer chain_old SgRootChange viewer aquarium network init_aquarium test_linda 
 
-oFLAGS=-g -O2
-CFLAGt=-g -O2
 all: $(ALL)
 
 BALL_BOUND_OBJ = ball_bound.o
 ball_bound : $(BALL_BOUND_OBJ) 
-	$(CC) -o $@ $?   $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?   $(LIBS)
 
 BOSS_OBJ = boss1_action.o
 boss1_action : $(BOSS_OBJ) 
-	$(CC) -o $@ $?   $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?   $(LIBS)
 
 DIRECTION_OBJ = direction.o
 direction : $(DIRECTION_OBJ) 
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 GAPLAN_OBJ = gaplant.o gaplant_action.o back_action.o ball_action.o
 gaplant : $(GAPLAN_OBJ) 
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 IESHOOT_OBJ = ieshoot.o
 ieshoot : $(IESHOOT_OBJ) 
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 NODE_OBJ = node.o
 node : $(NODE_OBJ) 
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 PANEL_OBJ = panel.o
 panel : $(PANEL_OBJ) 
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 UNIV_OBJ = universe.o
 universe : $(UNIV_OBJ) 
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 UNTITLED_OBJ = untitled.o
 untitled : $(UNTITLED_OBJ) 
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 VACUUM_OBJ = vacuum.o cube.o game_over.o title.o
 vacuum : $(VACUUM_OBJ) 
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 PROPERTY_OBJ = property_test.o
 property_test : $(PROPERTY_OBJ)
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 DYNAMIC_OBJ = dynamic_create.o 
 dynamic : $(DYNAMIC_OBJ) 
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 SENDLINDA_OBJ = send_linda.o
 send_linda : $(SENDLINDA_OBJ) 
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 WRITER_OBJ = writer.o
 writer : $(WRITER_OBJ) 
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 CHAIN_OBJ = chain_old.o
 chain_old : $(CHAIN_OBJ) 
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 SGCHANGE_OBJ = SgRootChange.o
 SgRootChange : $(SGCHANGE_OBJ) 
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 VIEWER_OBJ = viewer.o
 viewer : $(VIEWER_OBJ) 
-	$(CC) -o $@ $?    $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS)
 
 AQUARIUM_OBJ = aquarium.pb.o aquarium.o
 aquarium : $(AQUARIUM_OBJ)
-	$(CC) -o $@ $?    $(LIBS) $(PROTOLIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS) $(PROTOLIBS)
 
 NETWORK_OBJ = network_game.pb.o network.o
 network : $(NETWORK_OBJ)
-	$(CC) -o $@ $?    $(LIBS) $(PROTOLIBS)
+	$(CC) $(CFLAGS) -o $@ $?    $(LIBS) $(PROTOLIBS)
 
 INIT_AQUARIUM_OBJ = aquarium.pb.o init_aquarium.o
 init_aquarium : $(INIT_AQUARIUM_OBJ)
-	$(CC) -o $@ $? $(LIBS) $(PROTOLIBS)
+	$(CC) $(CFLAGS) -o $@ $? $(LIBS) $(PROTOLIBS)
 
 TEST_LINDA_OBJ = aquarium.pb.o test_linda.o
 test_linda : $(TEST_LINDA_OBJ)
-	$(CC) -o $@ $? $(LIBS) $(PROTOLIBS)
+	$(CC) $(CFLAGS) -o $@ $? $(LIBS) $(PROTOLIBS)
 
 
 run: $(TARGET)