Source for file dynamic_cubes.php
Documentation is available at dynamic_cubes.php
require_once('Image/3D.php');
$light1 = $world->createLight ('Light', array (-300 , 0 , -300 ));
$light2 = $world->createLight ('Light', array (300 , -300 , -300 ));
for ($x = - ($count - 1 ) / 2; $x <= ($count - 1 ) / 2; ++ $x) {
for ($y = - ($count - 1 ) / 2; $y <= ($count - 1 ) / 2; ++ $y) {
for ($z = - ($count - 1 ) / 2; $z <= ($count - 1 ) / 2; ++ $z) {
// if (max(abs($x), abs($y), abs($z)) < ($count - 1) / 2) continue;
if (max($x, $y, $z) <= 0 ) continue;
$cube = $world->createObject ('quadcube', array ($size, $size, $size));
$cube->transform ($world->createMatrix ('Move', array ($x * ($size + $offset), $y * ($size + $offset), $z * ($size + $offset))));
$world->transform ($world->createMatrix ('Rotation', array (220 , 50 , 0 )));
$world->transform ($world->createMatrix ('Scale', array (2 , 2 , 2 )));
$world->setOption (Image_3D::IMAGE_3D_OPTION_BF_CULLING , true );
$world->setOption (Image_3D::IMAGE_3D_OPTION_FILLED , true );
$world->createRenderer ('perspectively');
$world->createDriver ('DynamicCanvas');
$world->render (250 , 250 , 'Image_3D_Dynamic_Cubes.js');
Documentation generated on Mon, 11 Mar 2019 15:48:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|