コード例 #1
0
ファイル: driver.php プロジェクト: eXcomm/alive
 public function Render(ALiVE_Universe $world)
 {
     // do NOT overload me
     $black = new ALiVe_Colour(0, 0, 0);
     $this->Initialize();
     // virtual
     $world->Transform();
     $polygons = $world->GetPolygons();
     $points = $world->GetTransformedPoints();
     foreach ($polygons as $polygon) {
         w_assert(isset($polygon[0]));
         w_assert(isset($polygon[1]));
         w_assert(isset($polygon[2]));
         w_assert(isset($points[$polygon[0]]));
         w_assert(isset($points[$polygon[1]]));
         w_assert(isset($points[$polygon[2]]));
         $a = $points[$polygon[0]];
         $b = $points[$polygon[1]];
         $c = $points[$polygon[2]];
         // TODO: Don't draw polygons to +oo / -oo
         //       (Z-buffer it)
         $this->DrawPolygon($a, $b, $c, $black);
     }
     $this->Finalize();
     // virtual
 }