Image_3D
[ class tree: Image_3D ] [ index: Image_3D ] [ all elements ]

Source for file dynamic_cubes.php

Documentation is available at dynamic_cubes.php

  1. <?php
  2.  
  3. require_once('Image/3D.php');
  4.  
  5. $world = new Image_3D();
  6. $world->setColor(new Image_3D_Color(000));
  7.  
  8. $light1 $world->createLight('Light'array(-3000-300));
  9. $light1->setColor(new Image_3D_Color(25217562));
  10.  
  11. $light2 $world->createLight('Light'array(300-300-300));
  12. $light2->setColor(new Image_3D_Color(16400));
  13.  
  14. $count = 3;
  15.  
  16. $size = 20;
  17. $offset = 10;
  18.  
  19. for ($x = -($count - 1/ 2; $x <= ($count - 1/ 2; ++$x{
  20.     for ($y = -($count - 1/ 2; $y <= ($count - 1/ 2; ++$y{
  21.         for ($z = -($count - 1/ 2; $z <= ($count - 1/ 2; ++$z{
  22. //            if (max(abs($x), abs($y), abs($z)) < ($count - 1) / 2) continue;
  23.             if (max($x$y$z<= 0continue;
  24.             
  25.             $cube $world->createObject('quadcube'array($size$size$size));
  26.             $cube->setColor(new Image_3D_Color(25525525575));            
  27.             $cube->transform($world->createMatrix('Move'array($x ($size $offset)$y ($size $offset)$z ($size $offset))));
  28.         }
  29.     }
  30. }
  31.  
  32. $world->transform($world->createMatrix('Rotation'array(220500)));
  33. $world->transform($world->createMatrix('Scale'array(222)));
  34.  
  35. $world->setOption(Image_3D::IMAGE_3D_OPTION_BF_CULLINGtrue);
  36. $world->setOption(Image_3D::IMAGE_3D_OPTION_FILLEDtrue);
  37.  
  38. $world->createRenderer('perspectively');
  39. $world->createDriver('DynamicCanvas');
  40. $world->render(250250'Image_3D_Dynamic_Cubes.js');
  41.  
  42. echo $world->stats();

Documentation generated on Mon, 11 Mar 2019 15:48:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.