Source for file test_all.php
Documentation is available at test_all.php
require_once('Image/3D.php');
'pers' => 'Perspectively',
$bf = array ('bfculling' => true , 'nobfc' => false );
foreach ($renderer as $r_id => $r_class) {
foreach ($driver as $d_id => $d_class) {
foreach ($shading as $s_type) {
foreach ($bf as $b_name => $b_status) {
$filename = dirname(__FILE__ ) . " /tests/TestImage_{$r_id},{$s_name},{$b_name}.{$d_id}";
echo " Render image ({$r_class}, {$d_class}, {$s_name}, {$b_name}) ... ";
createExample($filename, $r_class, $d_class, $s_type, $b_status);
function createExample($filename, $renderer, $driver, $shading, $bfCulling) {
$blueLight = $world->createLight (-500 , -500 , -500 );
$redLight = $world->createLight (-500 , 500 , -500 );
for ($x = -225; $x <= 225; $x += 50 ) {
$cube = $world->createObject ('cube', array (30 , 30 , 30 ));
$cube->transform ($world->createMatrix ('Move', array ($x, 225 , 0 )));
$cube = $world->createObject ('cube', array (30 , 30 , 30 ));
$cube->transform ($world->createMatrix ('Move', array ($x, -225 , 0 )));
$cube = $world->createObject ('cube', array (30 , 30 , 30 ));
$cube->transform ($world->createMatrix ('Move', array ($x, $x, 0 )));
$sphere = $world->createObject ('sphere', array ('r' => 50 , 'detail' => 3 ));
$sphere->transform ($world->createMatrix ('Move', array (100 , 0 , 0 )));
$threeds = $world->createObject ('3ds', 'docs/examples/models/cube.3ds');
$threeds->transform ($world->createMatrix ('Rotation', array (90 , 0 , 0 )));
$threeds->transform ($world->createMatrix ('Scale', array (5 , 5 , 5 )));
$threeds->transform ($world->createMatrix ('Move', array (-100 , 0 , 0 )));
$text = $world->createObject ('text', 'Text');
$text->transform ($world->createMatrix ('Scale', array (10 , 10 , 10 )));
$text->transform ($world->createMatrix ('Move', array (-150 , 100 , 0 )));
$map = $world->createObject ('map');
$detail = 10; $size = 100; $height = 40;
for ($x = -1; $x <= 1; $x += $raster) {
for ($y = -1; $y <= 1; $y += $raster) {
$map->transform ($world->createMatrix ('Rotation', array (120 , -20 , -10 )));
$map->transform ($world->createMatrix ('Move', array (150 , -100 , 0 )));
$world->setOption (Image_3D::IMAGE_3D_OPTION_BF_CULLING , $bfCulling);
$renderer = $world->createRenderer ($renderer);
$driver = $world->createDriver ($driver);
if (!in_array($shading, $driver->getSupportedShading ())) return false;
$renderer->setShading ($shading);
$world->render (500 , 500 , $filename);
Documentation generated on Mon, 11 Mar 2019 14:17:15 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|