changeset 1403:95b114c66e14 draft

unify RenderTask
author sugi
date Wed, 15 Feb 2012 16:52:00 +0900
parents 815dd5f2d150
children 0f8bee7eed3c
files Renderer/Engine/spe/CreatePolygonFromSceneGraph.cc Renderer/Engine/spe/CreateSpan.cc Renderer/Engine/spe/DataAllocate.cc Renderer/Engine/spe/DataUpdate.cc Renderer/Engine/task/Bridge.cc Renderer/Engine/task/Bridge.h Renderer/Engine/task/DataAllocate.cc Renderer/Engine/task/DataUpdate.cc Renderer/Engine/task/Draw.cc Renderer/Engine/task/Draw.h
diffstat 10 files changed, 267 insertions(+), 213 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/spe/CreatePolygonFromSceneGraph.cc	Wed Feb 15 15:14:52 2012 +0900
+++ b/Renderer/Engine/spe/CreatePolygonFromSceneGraph.cc	Wed Feb 15 16:52:00 2012 +0900
@@ -1,4 +1,7 @@
 /**
+ * SceneGraphを読み込んでpolygonの座標に変換行列を掛けて
+ * 実座標のpolygonを生成する。
+ *
  * SceneGraph が増えてくると動かなくなるかもしれない。
  * 一応 mainMem とかで動くようになるとは思うけど。
  * だめだったら、そこら辺が怪しいと思うべき
@@ -7,16 +10,19 @@
 #include "CreatePolygonFromSceneGraph.h"
 #include "polygon_pack.h"
 #include "texture.h"
+#include "matrix_calc.h"
+#include "Func.h"
 
 #define  STATUS_NUM 3
 
-SchedDefineTask(CreatePolygonFromSceneGraph);
+SchedDefineTask1(CreatePolygonFromSceneGraph,createPolygon);
 
 /**
  *  ベクトルに行列を乗算する
  * @param[out] v vector (float[4])
  * @param[in] m matrix (float[16])
  */
+/*
 static void
 ApplyMatrix(float *v, float *m)
 {
@@ -31,18 +37,89 @@
 	v[i] = t[0]*m[i] + t[1]*m[i+4] + t[2]*m[i+8] + t[3]*m[i+12];
     }
 }
+*/
+
+
+static int
+compare_value(float *val, int num) {
+
+    float max = 0;
+    float min = 0;
+    max = val[0];
+    min = val[0];
+
+    for (int i = 1; i < num; i++) {
+        if (max < val[i]) {
+            max = val[i];
+        } else if (min > val[i]) {
+            min = val[i];
+        }
+    }
+
+    return (max - min);
+}
+
+/**
+ * 輝度の計算
+ * @param[in] vertexs polygon vertex position
+ * @param[in] normal normal vector
+ * @param[in] light light object position
+ * @return diffuse
+ */
+
+// test
+static float
+lighting(const float *vertex, const float *normal, const float *light) {
+    
+    float light_vector[4];
+    float normal_vector[4];
+
+    light_vector[0] = vertex[0] - light[0];
+    light_vector[1] = vertex[1] - light[1];
+    light_vector[2] = vertex[2] - light[2];
+    light_vector[3] = 0;
+
+    normal_vector[0] = normal[0];
+    normal_vector[1] = normal[1];
+    normal_vector[2] = normal[2];
+    normal_vector[3] = 0;
+
+    normalize(light_vector, light_vector);
+    normalize(normal_vector, normal_vector);
+
+    float diffuse = innerProduct(light_vector, normal_vector);
+
+    if ( diffuse < 0 ) {
+        diffuse = 0;
+    }
+
+    return diffuse;
+}
 
 
 static int 
-run(SchedTask *smanager, void *rbuf, void *wbuf)
+createPolygon(SchedTask *smanager, void *rbuf, void *wbuf)
 {
+
     float xyz1[4], xyz2[4], xyz3[4];
     float normal1[4],normal2[4],normal3[4];
 
-    //pp, matrix, real_matrix を受け取る
+    //pp, matrix, を受け取る
     PolygonPackPtr in_pp      = (PolygonPackPtr)smanager->get_input(rbuf, 0);
-    float *matrix             = (float*)smanager->get_input(rbuf, 1);
-    float *real_matrix        = (float*)smanager->get_input(rbuf, 2);
+    // w = world, v = view, p = perspective
+    float *wvp_matrix         = (float*)smanager->get_input(rbuf, 1);
+    float *m_screen           = (float*)smanager->get_input(rbuf, 2);
+
+    float normal_matrix[16]; 
+  
+    for (int i = 0; i<16; i++) normal_matrix[i] = wvp_matrix[i];
+    normal_matrix[4*0+3] = normal_matrix[4*1+3] = normal_matrix[4*2+3] = 0;
+    normal_matrix[4*3] = normal_matrix[4*3+1] = normal_matrix[4*3+2] = 0;
+    normal_matrix[4*3+3] = 1;
+
+    float matrix[16]; // wvps matrix
+    matrix4x4(matrix, wvp_matrix, m_screen);
+
     texture_list *tritexinfo  = (texture_list*)smanager->get_input(rbuf, 3);
     
     PolygonPackPtr next = (PolygonPackPtr)smanager->get_param(0);
@@ -55,8 +132,17 @@
       printf("in_pp->info.size = 0\n");
     }
 
+    float *light_xyz = (float*)smanager->global_get(Light);
+    int *light_switch = (int*)smanager->global_get(LightSwitch);
+    int light_num = 4;
+    // test
+
     for (int i = 0; i < in_pp->info.size; i++) {
 
+      float diffuse1 = 0;
+      float diffuse2 = 0;
+      float diffuse3 = 0;
+
       TrianglePack tri = in_pp->tri[i];
       
       xyz1[0] = tri.ver1.x;
@@ -73,39 +159,7 @@
       xyz3[1] = tri.ver3.y;
       xyz3[2] = tri.ver3.z * -1.0f;
       xyz3[3] = 1.0f;
-      
-      // matrix = 回転行列*透視変換行列
-      ApplyMatrix(xyz1, matrix);
-      ApplyMatrix(xyz2, matrix);
-      ApplyMatrix(xyz3, matrix);
-      
-      xyz1[0] /= xyz1[2];
-      xyz1[1] /= xyz1[2];
-      xyz2[0] /= xyz2[2];
-      xyz2[1] /= xyz2[2];
-      xyz3[0] /= xyz3[2];
-      xyz3[1] /= xyz3[2];
-   
-      TrianglePackPtr triangle = &out_pp->tri[i];
 
-      triangle->ver1.x = xyz1[0];
-      triangle->ver1.y = xyz1[1];
-      triangle->ver1.z = xyz1[2];
-      triangle->ver1.tex_x = tri.ver1.tex_x;
-      triangle->ver1.tex_y = tri.ver1.tex_y;
-      
-      triangle->ver2.x = xyz2[0];
-      triangle->ver2.y = xyz2[1];
-      triangle->ver2.z = xyz2[2];
-      triangle->ver2.tex_x = tri.ver2.tex_x;
-      triangle->ver2.tex_y = tri.ver2.tex_y;
-      
-      triangle->ver3.x = xyz3[0];
-      triangle->ver3.y = xyz3[1];
-      triangle->ver3.z = xyz3[2];
-      triangle->ver3.tex_x = tri.ver3.tex_x;
-      triangle->ver3.tex_y = tri.ver3.tex_y;
-      
       normal1[0] = tri.normal1.x;
       normal1[1] = tri.normal1.y;
       normal1[2] = tri.normal1.z * -1.0f;
@@ -123,20 +177,95 @@
       normal3[2] = tri.normal3.z * -1.0f;
       //normal3[3] = 1.0f;
       normal3[3] = 0.0f;
-      
-      ApplyMatrix(normal1,real_matrix);
-      ApplyMatrix(normal2,real_matrix);
-      ApplyMatrix(normal3,real_matrix);
+
+      // matrix = ビュー座標変換行列*射影変換行列
+      ApplyMatrix(xyz1, matrix);
+      ApplyMatrix(xyz2, matrix);
+      ApplyMatrix(xyz3, matrix);
+
+      ApplyMatrix(normal1, normal_matrix);
+      ApplyMatrix(normal2, normal_matrix);
+      ApplyMatrix(normal3, normal_matrix);
+
+      // test
+
+      for (int j = 0; j < light_num; j++) {
+          // 光源のスイッチが入ってたら 
+	if (light_switch[j] == 1) {
+              // 複数の光源の計算, 全部足し合わせてみる.. 
+              // rdb値は255を超えた値は、255にされるからここではいくら足してもいい
+              diffuse1 += lighting(xyz1, normal1, &light_xyz[j*4]);
+              diffuse2 += lighting(xyz2, normal2, &light_xyz[j*4]);
+              diffuse3 += lighting(xyz3, normal3, &light_xyz[j*4]);
+	}
+      }
+
+
+      // このif文は、視錐台カリングに変えられる. 違うやり方があるはず
+      if (xyz1[2] > 100 && xyz2[2] > 100 && xyz3[2] > 100) {
+
+          /*
+           * 同次座標で除算、同次クリップ空間に変換する
+           *
+           */
+
+          xyz1[0] /= xyz1[3];
+          xyz1[1] /= xyz1[3];
+          xyz1[2] /= xyz1[3];
+
+          xyz2[0] /= xyz2[3];
+          xyz2[1] /= xyz2[3];
+          xyz2[2] /= xyz2[3];
+
+          xyz3[0] /= xyz3[3];
+          xyz3[1] /= xyz3[3];
+          xyz3[2] /= xyz3[3];
+
+
+      } else {
+
+          // ここは0じゃなくて、ppに登録しなければいい。pp->info.size をデクリメントすればいいはず
+          xyz1[0] = 0; 
+          xyz1[1] = 0;
+          xyz1[2] = 0;
+          
+          xyz2[0] = 0;
+          xyz2[1] = 0; 
+          xyz2[2] = 0;
+          
+          xyz3[0] = 0; 
+          xyz3[1] = 0;
+          xyz3[2] = 0;
+          
+      }
+
+   
+      TrianglePackPtr triangle = &out_pp->tri[i];
+
+      triangle->ver1.x = xyz1[0];
+      triangle->ver1.y = xyz1[1];
+      triangle->ver1.z = xyz1[2];
+      triangle->ver1.tex_x = tri.ver1.tex_x;
+      triangle->ver1.tex_y = tri.ver1.tex_y;
+      // test
+      triangle->ver1.diffuse = diffuse1;
+
+      triangle->ver2.x = xyz2[0];
+      triangle->ver2.y = xyz2[1];
+      triangle->ver2.z = xyz2[2];
+      triangle->ver2.tex_x = tri.ver2.tex_x;
+      triangle->ver2.tex_y = tri.ver2.tex_y;
+      // test
+      triangle->ver2.diffuse = diffuse2;      
       
-      normal1[0] /= normal1[2];
-      normal1[1] /= normal1[2];
-      
-      normal2[0] /= normal2[2];
-      normal2[1] /= normal2[2];
-      
-      normal3[0] /= normal3[2];
-      normal3[1] /= normal3[2];
-      
+      triangle->ver3.x = xyz3[0];
+      triangle->ver3.y = xyz3[1];
+      triangle->ver3.z = xyz3[2];
+      triangle->ver3.tex_x = tri.ver3.tex_x;
+      triangle->ver3.tex_y = tri.ver3.tex_y;
+      // test
+      triangle->ver3.diffuse = diffuse3;      
+
       triangle->normal1.x = normal1[0];
       triangle->normal1.y = normal1[1];
       triangle->normal1.z = normal1[2];
@@ -154,13 +283,16 @@
       triangle->tex_info.height = tritexinfo->t_h;
       triangle->tex_info.scale_max = tritexinfo->scale_max;
 
+      //spanの数を先に計算しておくと、CreateSpanの時に静的にoutputが割り振れる(Taskの内の dma load がなくせるよ)
+      //polygonの高さが、spanの数と一緒になるはず。
+
       float y[STATUS_NUM] = { xyz1[1], xyz2[1], xyz3[1] };
       int span_num = 0;
       span_num = compare_value(y, STATUS_NUM);
       out_pp->info.span_num += span_num;
 
-
     }
 
     return 0;
 }
+
--- a/Renderer/Engine/spe/CreateSpan.cc	Wed Feb 15 15:14:52 2012 +0900
+++ b/Renderer/Engine/spe/CreateSpan.cc	Wed Feb 15 16:52:00 2012 +0900
@@ -15,7 +15,7 @@
 static const int TILE_STORE        = 10;
 
 static SpanPackPtr spack = NULL;
-static SpanPackPtr send_spack = NULL;
+// static SpanPackPtr send_spack = NULL;
 static int prev_index = 0;
 
 
@@ -29,7 +29,6 @@
     return ans;
 }
 
-
 /**
  * TrianglePack から、vMin, vMid, vMax を求める
  *
@@ -41,6 +40,25 @@
 	    VertexPackPtr *vMin, VertexPackPtr *vMid, VertexPackPtr *vMax,
             NormalPackPtr *normal1, NormalPackPtr *normal2, NormalPackPtr *normal3)
 {
+
+    /**
+     *  y座標から、vMax, vMid, vMin, を求める
+     *
+     *      vMax
+     *        |\
+     *        | \
+     *        |  \
+     *        |   \
+     *         ------ vMid
+     *        |   /
+     *        |  /
+     *        | /
+     *        |/
+     *      vMin
+     *
+     */
+
+
     if (triPack->ver1.y <= triPack->ver2.y) {
 	if (triPack->ver2.y <= triPack->ver3.y) {
 	    *vMin = &triPack->ver1;
@@ -93,6 +111,9 @@
     v->x      = calc(vMax->x - vMin->x, d, d1, vMin->x);
     v->y      = vMid->y;
     v->z      = calc(vMax->z - vMin->z, d, d1, vMin->z);
+    // test
+    v->diffuse = calc(vMax->diffuse - vMin->diffuse, d, d1, vMin->diffuse);
+
 }
 
 /**
@@ -197,14 +218,20 @@
 
     float tmp_z,tmp_tex1, tmp_tex2 ,tmp_tey1,tmp_tey2;
     float tmp_xpos,tmp_end,tmp_zpos;
+    float tmp_diffuse_l,tmp_diffuse_r;
     float start_z, end_z;
     float start_tex_x, end_tex_x, start_tex_y, end_tex_y;
+    float diffuse_l, diffuse_r;
+
     int x,length;
 
     tmp_xpos = calc(vMid10->x - vMin->x ,div_y, i, vMin->x);
     tmp_end  = calc(vMid->x  - vMin->x ,div_y, i, vMin->x);
     tmp_z    = calc(vMid10->z - vMin->z ,div_y, i, vMin->z);
     tmp_zpos = calc(vMid->z  - vMin->z ,div_y, i, vMin->z);
+    // test
+    tmp_diffuse_l = calc(vMid10->diffuse - vMin->diffuse, div_y, i, vMin->diffuse);
+    tmp_diffuse_r = calc(vMid->diffuse  - vMin->diffuse, div_y, i, vMin->diffuse);
     
     length = (tmp_xpos > tmp_end)
         ? (int)tmp_xpos - (int)tmp_end : (int)tmp_end - (int)tmp_xpos;
@@ -231,6 +258,9 @@
         end_tex_x = tmp_tex1;
         start_tex_y = tmp_tey2;
         end_tex_y = tmp_tey1;
+        // test
+        diffuse_l = tmp_diffuse_r;
+        diffuse_r = tmp_diffuse_l;
     } else {
         x = (int)tmp_xpos;
         length = (int)(tmp_end)-(int)(tmp_xpos)+1;
@@ -240,6 +270,9 @@
         end_tex_x = tmp_tex2;
         start_tex_y = tmp_tey1;
         end_tex_y = tmp_tey2;
+        // test
+        diffuse_l = tmp_diffuse_l;
+        diffuse_r = tmp_diffuse_r;
     }
     
     // ここいる? load してその後必ず、wait してるように見える。
@@ -257,6 +290,9 @@
     span->tex_x2     = end_tex_x;
     span->tex_y1     = start_tex_y;
     span->tex_y2     = end_tex_y;
+    // test
+    span->diffuse_l  = diffuse_l;
+    span->diffuse_r  = diffuse_r;
     
     /*
      * ここで頂点分法線ベクトルがあったんだけど、
@@ -388,6 +424,7 @@
 
 	/**
 	 * 担当 y 範囲内
+	 * 必要なデータは先読みできるはず
 	 */
 	if (charge_y_top <= y && y <= charge_y_end) {
 	    // 1..8 を index0, 9..16 を index1 にするために y を -1
@@ -403,6 +440,7 @@
 
 #ifdef USE_SEGMENT
 
+
                 smanager->wait_segment(span_put_ms);
 
                 span_put_ms = span_get_ms;
@@ -414,6 +452,13 @@
                 prev_index = index;
                 spack = (SpanPackPtr)span_get_ms->data;
 
+
+#elif defined(USE_ITERATOR)
+                
+                ms = it->get_ms();
+                spack = (SpanPackPtr)ms->data;
+                prev_index = index;
+
 #else
 
 		tmp_spack = spack;
@@ -446,6 +491,7 @@
 	     * Segment領域を確保して、それをsegmentのAPIでやり取りするのが嬉しいのかね。
 	     * 
              * mainMem 追い出すには、ちょっと苦労するかも? 
+             * mainMem するかどうかは予想できはする。 
 	     */
 
 	    if (spack->info.size >= MAX_SIZE_SPAN) {
@@ -472,6 +518,20 @@
                 spack = (SpanPackPtr)span_get_ms->data;
 		spack->init((index+1)*split_screen_h);
 
+
+#elif defined(USE_ITERATOR)
+
+                /*
+                  next は AddrList に直さないといけない
+                  AddrList next_list = make_list(next);
+                  とかいうAPIか、overwrite_list の中でもいいかもね。
+                 */
+
+                overwrite_list(next_ist);
+                ms = it->get_ms();
+                spack = (SpanPackPtr)ms->data;
+                prev_index = index;
+                
 #else
 
 
@@ -582,6 +642,7 @@
 
 #endif
 
+    // ここで AddrList は作れるかな。 
     int charge_y_top = (long)smanager->get_param(1);
     int charge_y_end = (long)smanager->get_param(2);
 
@@ -597,6 +658,10 @@
  
             pp_ms = smanager->get_segment((memaddr)pp->next, pp_ml);
 
+#elif defined(USE_ITERATOR)
+            
+            
+
 #else
 
 	    smanager->dma_load(next_pp, (memaddr)pp->next,
@@ -610,6 +675,9 @@
 
             pp_ms = NULL;
 
+#elif defined(USE_ITERATOR)
+
+
 #else
 	    next_pp = NULL;
 
@@ -691,6 +759,8 @@
         } else {
             pp = NULL;
         }
+
+#elif defined(USE_ITERATOR)
         
 #else
 
@@ -721,13 +791,14 @@
                         sizeof(SpanPack), SPAN_PACK_STORE);
     smanager->dma_wait(SPAN_PACK_STORE);
 
-
 #endif
 
 #ifdef USE_SEGMENT
 
     // Global でSegmentとったので、いつか解放しないといかないなぁ。
 
+#elif defined(USE_ITERATOR)
+
 #else
 
     free(free_pp);
--- a/Renderer/Engine/spe/DataAllocate.cc	Wed Feb 15 15:14:52 2012 +0900
+++ b/Renderer/Engine/spe/DataAllocate.cc	Wed Feb 15 16:52:00 2012 +0900
@@ -1,17 +1,16 @@
-//#include <stdio.h>
 #include <string.h>
 #include "DataAllocate.h"
 #include "Func.h"
 
 /* これは必須 */
-SchedDefineTask(DataAllocate);
+SchedDefineTask1(DataAllocate,dataAllocate);
 
 static int
-run(SchedTask *s, void *rbuf, void *wbuf)
+dataAllocate(SchedTask *s, void *rbuf, void *wbuf)
 {
 
-  int count = (int)s->get_param(0);
-  for(int i=0;i<count;i++) {
+  long count = (long)s->get_param(0);
+  for(long i=0;i<count;i++) {
       void *idata = s->get_input(rbuf, i);
       long size = (long)s->get_param(i*2+1);
       long load_id = (long)s->get_param(i*2+2);
--- a/Renderer/Engine/spe/DataUpdate.cc	Wed Feb 15 15:14:52 2012 +0900
+++ b/Renderer/Engine/spe/DataUpdate.cc	Wed Feb 15 16:52:00 2012 +0900
@@ -1,4 +1,3 @@
-//#include <stdio.h>
 #include "DataUpdate.h"
 #include "Func.h"
 #include "string.h"
@@ -12,7 +11,7 @@
 
   long count = (long)s->get_param(0);
   long id_base = (long)s->get_param(1);
-  for(int i=0; i<count; i++) {
+  for(long i=0; i<count; i++) {
       void *idata = (void*)s->get_input(rbuf, i);
       long size = (long)s->get_inputSize(i);
       void *global_data = (void*)s->global_get(id_base+i);
--- a/Renderer/Engine/task/Bridge.cc	Wed Feb 15 15:14:52 2012 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-//#include <stdio.h>
-#include <string.h>
-#include "Bridge.h"
-#include "Func.h"
-
-/* これは必須 */
-SchedDefineTask(Bridge);
-
-static int
-run(SchedTask *s, void *rbuf, void *wbuf)
-{
-
-/*
-
-DataSegment のグループ化ってことかな。
-依存関係のグループ化ならTaskArrayがやったけど
-Data自体にtagみたいなのを付けて、グループ化するのかね。
-CodeSegmentによっては、依存するDataSegmentが違うから
-そういうbindみたいな風にできればいいか。とりあえず、妄想をコメントに書いていこう
-
-
-
-
-*/
-
-
-
-
-
-
-  return 0;
-}
-
--- a/Renderer/Engine/task/Bridge.h	Wed Feb 15 15:14:52 2012 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#ifndef INCLUDED_TASK_BRIDGE
-#define INCLUDED_TASK_BRIDGE
-
-#ifndef INCLUDED_SCHED_TASK
-#  include "SchedTask.h"
-#endif
-
-
-#endif
--- a/Renderer/Engine/task/DataAllocate.cc	Wed Feb 15 15:14:52 2012 +0900
+++ b/Renderer/Engine/task/DataAllocate.cc	Wed Feb 15 16:52:00 2012 +0900
@@ -1,17 +1,16 @@
-#include <stdio.h>
 #include <string.h>
 #include "DataAllocate.h"
 #include "Func.h"
 
 /* これは必須 */
-SchedDefineTask(DataAllocate);
+SchedDefineTask1(DataAllocate,dataAllocate);
 
 static int
-run(SchedTask *s, void *rbuf, void *wbuf)
+dataAllocate(SchedTask *s, void *rbuf, void *wbuf)
 {
 
-  int count = (long)s->get_param(0);
-  for(int i=0;i<count;i++) {
+  long count = (long)s->get_param(0);
+  for(long i=0;i<count;i++) {
       void *idata = s->get_input(rbuf, i);
       long size = (long)s->get_param(i*2+1);
       long load_id = (long)s->get_param(i*2+2);
--- a/Renderer/Engine/task/DataUpdate.cc	Wed Feb 15 15:14:52 2012 +0900
+++ b/Renderer/Engine/task/DataUpdate.cc	Wed Feb 15 16:52:00 2012 +0900
@@ -1,4 +1,3 @@
-#include <stdio.h>
 #include "DataUpdate.h"
 #include "Func.h"
 #include "string.h"
@@ -12,7 +11,7 @@
 
   long count = (long)s->get_param(0);
   long id_base = (long)s->get_param(1);
-  for(int i=0; i<count; i++) {
+  for(long i=0; i<count; i++) {
       void *idata = (void*)s->get_input(rbuf, i);
       long size = (long)s->get_inputSize(i);
       void *global_data = (void*)s->global_get(id_base+i);
--- a/Renderer/Engine/task/Draw.cc	Wed Feb 15 15:14:52 2012 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-//#include "RunDraw.h"
-#include "SchedTask.h"
-
-SchedDefineTask(Draw);
-
-static int
-run(SchedTask *smanager, void *rbuf, void *wbuf)
-{
-#if 0
-    PolygonPack *pp = (PolygonPack*)smanager->get_input(rbuf, 0);
-    PolygonPack *next_pp = 
-	(PolygonPack*)smanager->allocate(sizeof(PolygonPack));
-    PolygonPack *free_pp = next_pp;
-    PolygonPack *tmp_pp;
-
-    TrianglePackPtr triPack;
-    VertexPackPtr vMin, vMid, vMax;
-    VertexPackPtr vMid10
-	= (VertexPackPtr)smanager->allocate(sizeof(VertexPack));
-    NormalPackPtr normal1,normal2, normal3;
-    SpanPackPtr *spackList = (SpanPackPtr*)smanager->get_input(rbuf, 1);
-    spack = (SpanPackPtr)smanager->get_input(rbuf, 2);
-    send_spack = (SpanPackPtr)smanager->allocate(sizeof(SpanPack));
-    prev_index = (long)smanager->get_param(0);
-
-    // spack と send_spack は swap しながら DMA を繰り返すので
-    // 自分で allocate した send_spack を覚えてないといけない
-    SpanPackPtr free_spack = send_spack;
-
-    int charge_y_top = (long)smanager->get_param(1);
-    int charge_y_end = (long)smanager->get_param(2);
-
-    do {
-	if (pp->next != NULL) {
-	    smanager->dma_load(next_pp, (memaddr)pp->next,
-			       sizeof(PolygonPack), POLYGON_PACK_LOAD);
-	} else {
-	    next_pp = NULL;
-	}
-
-	for (int i = 0; i < pp->info.size; i++) {
-	    triPack = &pp->tri[i];
-
-	    TriangleTexInfoPtr tri_tex_info = &triPack->tex_info;
-
-	    make_vertex(triPack, &vMin, &vMid, &vMax, &normal1, &normal2, &normal3);
-	    make_vMid10(vMid10, vMin, vMid, vMax);
-
-	    /**
-	     * ポリゴンを、x軸に水平に分割して二つの三角形を作り、
-	     * それぞれから Span を求める
-	     *
-	     *      vMax
-	     *        |\
-	     *        | \
-	     *        |  \
-	     *        |   \
-	     * vMid10 ------ vMid
-	     *        |   /
-	     *        |  /
-	     *        | /
-	     *        |/
-	     *      vMin
-	     *
-	     * (vMax, vMid, vMin) という triangle を
-	     * (vMax, vMid, vMid10) (vMin, vMid, vMid10) という
-	     * 二つの Triangle に分けている
-	     */
-	    half_triangle(smanager, spackList, charge_y_top, charge_y_end,
-			  tri_tex_info, vMin, vMid, vMid10,
-                          normal1,normal2,normal3,
-			  (int)(vMax->y - vMin->y), vMax->tex_y - vMin->tex_y);
-	    half_triangle(smanager, spackList, charge_y_top, charge_y_end,
-			  tri_tex_info, vMax, vMid, vMid10,
-                          normal1,normal2,normal3,
-			  (int)(vMax->y - vMin->y), vMax->tex_y - vMin->tex_y);
-	}
-
-	smanager->dma_wait(POLYGON_PACK_LOAD);	
-
-	tmp_pp = pp;
-	pp = next_pp;
-	next_pp = tmp_pp;
-    } while (pp);
-
-    smanager->dma_wait(SPAN_PACK_STORE);
-    smanager->dma_store(spack, (memaddr)spackList[prev_index],
-			sizeof(SpanPack), SPAN_PACK_STORE);
-    smanager->dma_wait(SPAN_PACK_STORE);
-
-    free(free_pp);
-    free(free_spack);
-    free(vMid10);
-#endif
-    return 0;
-}
--- a/Renderer/Engine/task/Draw.h	Wed Feb 15 15:14:52 2012 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#ifndef INCLUDED_TASK_DRAW
-#define INCLUDED_TASK_DRAW
-
-#include "SchedTask.h"
-
-
-#endif