changeset 262:64b57b4ba9e2

Add alpha blending
author e065725@yutaka.st.ie.u-ryukyu.ac.jp
date Wed, 03 Jun 2009 22:14:20 +0900
parents ca13cee5fd7c
children f872cc000fe0 e3c6339862f7
files TaskManager/Test/test_render/task/DrawSpan.cpp
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Test/test_render/task/DrawSpan.cpp	Wed Jun 03 21:30:01 2009 +0900
+++ b/TaskManager/Test/test_render/task/DrawSpan.cpp	Wed Jun 03 22:14:20 2009 +0900
@@ -265,10 +265,17 @@
 DrawSpan::updateBuffer(float zpos, int rangex, int x, int y,
 		       int tex_x, int tex_y, uint32 *tex_addr)
 {
+
+
     int rgb = get_rgb(tex_x, tex_y, tex_addr);
-		    
-    zRow[x + (rangex*y)] = zpos;
-    linebuf[x + (rangex*y)] = rgb;
+    /*下位4bitを抽出*/
+    int alpha = rgb & 0x000F;
+    /*完全に透けているか判断*/
+    int flag = (alpha != 0);
+
+    zRow[x + (rangex*y)] = zpos*flag + zRow[x + (rangex*y)]*(1-flag);
+    linebuf[x + (rangex*y)] = rgb*flag + linebuf[x + (rangex*y)]*(1-flag);
+
 }
 
 /**