cvs: pear /Image_3D/Image 3D.php /Image_3D/Image/3D Color.php Coordinate.php Driver.php Enlightenable.php Matrix.php Point.php Renderer.php
Vector.php /Image_3D/Image/3D/Color Metal.php /Image_3D/Image/3D/Driver ASCII.php GD.php ImageCanvas.php ImageMagick.php SVG.php SVGRotate.php
ZBuffer.php /Image_3D/Image/3D/Matrix Move.php Rotation.php Scale.php /Image_3D/Image/3D/Paintable Light.php Object.php Polygon.php
/Image_3D/Image/3D/Paintable/Light Ambient.php Point.php Spotlight.php /Image_3D/Image/3D/Paintable/Object 3ds.php 3dsChunks.php Cone.php Cube.php
Map.php Pie.php Polygon.php Sphere.php Text.php Torus.php /Image_3D/Image/3D/Renderer Isometric.php Perspectively.php /Image_3D/docs/examples
cone.php cubes.php map.php pie.php pointlight.php sphere.php spotlights.php text.php torus.php zbuffer.php

From: Date: Tue, 29 Nov 2005 13:20:10 +0000
Subject: cvs: pear /Image_3D/Image 3D.php /Image_3D/Image/3D Color.php Coordinate.php Driver.php Enlightenable.php Matrix.php Point.php Renderer.php
Vector.php /Image_3D/Image/3D/Color Metal.php /Image_3D/Image/3D/Driver ASCII.php GD.php ImageCanvas.php ImageMagick.php SVG.php SVGRotate.php
ZBuffer.php /Image_3D/Image/3D/Matrix Move.php Rotation.php Scale.php /Image_3D/Image/3D/Paintable Light.php Object.php Polygon.php
/Image_3D/Image/3D/Paintable/Light Ambient.php Point.php Spotlight.php /Image_3D/Image/3D/Paintable/Object 3ds.php 3dsChunks.php Cone.php Cube.php
Map.php Pie.php Polygon.php Sphere.php Text.php Torus.php /Image_3D/Image/3D/Renderer Isometric.php Perspectively.php /Image_3D/docs/examples
cone.php cubes.php map.php pie.php pointlight.php sphere.php spotlights.php text.php torus.php zbuffer.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-36591@lists.php.net to get a copy of this message
kore Tue Nov 29 08:20:10 2005 EDT Modified files: /pear/Image_3D/Image 3D.php /pear/Image_3D/Image/3D Color.php Coordinate.php Driver.php Enlightenable.php Matrix.php Point.php Renderer.php Vector.php /pear/Image_3D/Image/3D/Color Metal.php /pear/Image_3D/Image/3D/Driver ASCII.php GD.php ImageCanvas.php ImageMagick.php SVG.php SVGRotate.php ZBuffer.php /pear/Image_3D/Image/3D/Matrix Move.php Rotation.php Scale.php /pear/Image_3D/Image/3D/Paintable Light.php Object.php Polygon.php /pear/Image_3D/Image/3D/Paintable/Light Ambient.php Point.php Spotlight.php /pear/Image_3D/Image/3D/Paintable/Object 3ds.php 3dsChunks.php Cone.php Cube.php Map.php Pie.php Polygon.php Sphere.php Text.php Torus.php /pear/Image_3D/Image/3D/Renderer Isometric.php Perspectively.php /pear/Image_3D/docs/examples cone.php cubes.php map.php pie.php pointlight.php sphere.php spotlights.php text.php torus.php zbuffer.php Log: - Fixed @link in php-doc comments

http://cvs.php.net/diff.php/pear/Image_3D/Image/3D.php?r1=1.7&r2=1.8&ty=u Index: pear/Image_3D/Image/3D.php diff -u pear/Image_3D/Image/3D.php:1.7 pear/Image_3D/Image/3D.php:1.8 --- pear/Image_3D/Image/3D.php:1.7 Sat Nov 12 07:40:35 2005 +++ pear/Image_3D/Image/3D.php Tue Nov 29 08:20:08 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: 3D.php,v 1.7 2005/11/12 12:40:35 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: 3D.php,v 1.8 2005/11/29 13:20:08 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -59,7 +59,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ class Image_3D { @@ -165,267 +165,4 @@ * * @param string $type Objectname * @param array $parameter Parameters - * @return Image_3D_Object Object instance - */ - public function createObject($type, $parameter = array()) { - $name = ucfirst($type); - $class = 'Image_3D_Object_' . $name; - $absolute_path = dirname(__FILE__) . '/3D/Paintable/Object/' . $name . '.php'; - $user_path = dirname(__FILE__) . '/3D/User/Object/' . $name . '.php'; - - if (is_file($absolute_path) && is_readable($absolute_path)) { - include_once $absolute_path; - } elseif (is_file($user_path) && is_readable($user_path)) { - include_once $user_path; - } else { - throw new Exception("Class for object $name not found (Searched: $absolute_path, $user_path)."); - } - - return $this->_objects[] = new $class($parameter); - } - - // }}} - // {{{ createLight() - - /** - * Factory method for lights - * - * Creates and returns a light. Needs only the position of the lights as a - * parameter. - * - * @param float $x X-Position - * @param float $y Y-Position - * @param float $z Z-Position - * @return Image_3D_Light Object instance - */ - public function createLight($type, $parameter = array()) { - $name = ucfirst($type); - if ($name != 'Light') { - $class = 'Image_3D_Light_' . $name; - $absolute_path = dirname(__FILE__) . '/3D/Paintable/Light/' . $name . '.php'; - $user_path = dirname(__FILE__) . '/3D/User/Light/' . $name . '.php'; - - if (is_file($absolute_path) && is_readable($absolute_path)) { - include_once $absolute_path; - } elseif (is_file($user_path) && is_readable($user_path)) { - include_once $user_path; - } else { - throw new Exception("Class for object $name not found (Searched: $absolute_path, $user_path)."); - } - - return $this->_lights[] = new $class($parameter[0], $parameter[1], $parameter[2], array_slice($parameter, 3)); - } else { - return $this->_lights[] = new Image_3D_Light($parameter[0], $parameter[1], $parameter[2]); - } - } - - // }}} - // {{{ createMatrix() - - /** - * Factory method for transformation matrixes - * - * Creates a transformation matrix - * Known matrix types: - * - rotation array(float $x, float $y, float $z) - * - scale array(float $x, float $y, float $z) - * - move array(float $x, float $y, float $z) - * - * @param string $type Matrix type - * @param array $parameter Parameters - * @return Image_3D_Matrix Object instance - */ - public function createMatrix($type, $parameter = array()) { - $name = ucfirst($type); - $class = 'Image_3D_Matrix_' . $name; - $absolute_path = dirname(__FILE__) . '/3D/Matrix/' . $name . '.php'; - - if (is_file($absolute_path) && is_readable($absolute_path)) { - include_once $absolute_path; - } else { - throw new Exception("Class for matrix $name not found (Searched: $absolute_path, $user_path)."); - } - - return new $class($parameter); - } - - // }}} - // {{{ setColor() - - /** - * Sets world backgroundcolor - * - * Sets the backgroundcolor for final image. Transparancy is not supported - * by all drivers - * - * @param Image_3D_Color $color Backgroundcolor - * @return void - */ - public function setColor(Image_3D_Color $color) { - $this->_color = $color; - } - - // }}} - // {{{ createRenderer() - - /** - * Factory method for renderer - * - * Creates and returns a renderer. - * Avaible renderers - * - Isometric - * - Perspektively - * - * @param string $type Renderer type - * @return Image_3D_Renderer Object instance - */ - public function createRenderer($type) { - $name = ucfirst($type); - $class = 'Image_3D_Renderer_' . $name; - $absolute_path = dirname(__FILE__) . '/3D/Renderer/' . $name . '.php'; - $user_path = dirname(__FILE__) . '/3D/User/Renderer/' . $name . '.php'; - - if (is_file($absolute_path) && is_readable($absolute_path)) { - include_once $absolute_path; - } elseif (is_file($user_path) && is_readable($user_path)) { - include_once $user_path; - } else { - throw new Exception("Class for renderer $name not found (Searched: $absolute_path, $user_path)."); - } - - return $this->_renderer = new $class(); - } - - // }}} - // {{{ createDriver() - - /** - * Factory method for drivers - * - * Creates and returns a new driver - * Standrad available drivers: - * - GD - * - SVG - * - * @param string $type Driver type - * @return Image_3D_Driver Object instance - */ - public function createDriver($type) { - $name = ucfirst($type); - $class = 'Image_3D_Driver_' . $name; - $absolute_path = dirname(__FILE__) . '/3D/Driver/' . $name . '.php'; - $user_path = dirname(__FILE__) . '/3D/User/Driver/' . $name . '.php'; - - if (is_file($absolute_path) && is_readable($absolute_path)) { - include_once $absolute_path; - } elseif (is_file($user_path) && is_readable($user_path)) { - include_once $user_path; - } else { - throw new Exception("Class for driver $name not found (Searched: $absolute_path, $user_path)."); - } - - return $this->_driver = new $class(); - } - - // }}} - // {{{ setOption() - - /** - * Sets an option for all known objects - * - * Sets one of the Image_3D options for all known objects - * - * @param integer $option Option - * @param mixed $value Value - * @return void - */ - public function setOption($option, $value) { - $this->_option[$option] = $value; - $this->_optionSet[$option] = true; - foreach ($this->_objects as $object) $object->setOption($option, $value); - } - - // }}} - // {{{ transform() - - /** - * Transform all known objects - * - * Transform all known objects with the given transformation matrix. - * Can be interpreted as a transformation of the viewpoint. - * - * The id is an optional value which shouldn't be set by the user to - * avoid double calculations, if a point is related to more than one - * object. - * - * @param Image_3D_Matrix $matrix Transformation matrix - * @param mixed $id Transformation ID - * @return void - */ - public function transform(Image_3D_Matrix $matrix, $id = null) { - - if ($id === null) $id = substr(md5(microtime()), 0, 8); - foreach ($this->_objects as $object) $object->transform($matrix, $id); - } - - // }}} - // {{{ render() - - /** - * Renders the image - * - * Starts rendering an image with given size into the given file. - * - * @param integer $x Width - * @param integer $y Height - * @param string $file Filename - * @return boolean Success - */ - public function render($x, $y, $file) { - if ( (is_file($file) || !is_writeable(dirname($file))) - && (!is_file($file) || !is_writeable($file)) - && !preg_match('/^\s*php:\/\/(stdout|output)\s*$/i', $file)) // Hack because stdout is not writeable - throw new Exception('Cannot write outputfile.'); - - $x = min(1280, max(0, (int) $x)); - $y = min(1280, max(0, (int) $y)); - - $this->_renderer->setSize($x, $y); - $this->_renderer->setBackgroundColor($this->_color); - $this->_renderer->addObjects($this->_objects); - $this->_renderer->addLights($this->_lights); - $this->_renderer->setDriver($this->_driver); - - return $this->_renderer->render($file); - } - - // }}} - // {{{ stats() - - /** - * Statistics for Image_3D - * - * Returns simple statisics for Image_3D as a string. - * - * @return string Statistics - */ - public function stats() { - return sprintf(' -Image 3D - -objects: %d -lights: %d -polygones: %d -points: %d -', - count($this->_objects), - $this->_renderer->getLightCount(), - $this->_renderer->getPolygonCount(), - $this->_renderer->getPointCount() - ); - } - - // }}} -} - -// }}} + * @return Image_3D_ http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Color.php?r1=1.4&r2=1.5&ty=u Index: pear/Image_3D/Image/3D/Color.php diff -u pear/Image_3D/Image/3D/Color.php:1.4 pear/Image_3D/Image/3D/Color.php:1.5 --- pear/Image_3D/Image/3D/Color.php:1.4 Sun Nov 6 15:32:43 2005 +++ pear/Image_3D/Image/3D/Color.php Tue Nov 29 08:20:08 2005 @@ -1,235 +0,0 @@ -<?php - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * 3d Library - * - * PHP versions 5 - * - * LICENSE: - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Color.php,v 1.4 2005/11/06 20:32:43 kore Exp $ - * @link http://pear.php.net/package/PackageName - * @since File available since Release 0.1.0 - */ - -// {{{ Image_3D_Color - -/** - * Image_3D_Color - * - * Base class for colors and textures. - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName - * @since Class available since Release 0.1.0 - */ -class Image_3D_Color { - - // {{{ properties - - /** - * Color values - * - * @var array - */ - protected $_rgbaValue; - - /** - * Array with lights which influence this color - * - * @var array - */ - protected $_lights; - - /** - * Resulting light for this color - * - * @var array - */ - protected $_light; - - // }}} - // {{{ __construct() - - /** - * Constructor for Image_3D_Color - * - * All colors accept values in integer (0 - 255) or float (0 - 1) - * - * @param mixed $red red - * @param mixed $green green - * @param mixed $blue blue - * @param mixed $alpha alpha - * @return Image_3D_Color Instance of Color - */ - public function __construct($red = 0., $green = 0., $blue = 0., $alpha = 0.) { - $this->_rgbaValue = array(); - - $this->_lights = array(); - $this->_light = array(0, 0, 0); - - $arglist = func_get_args(); - $argcount = func_num_args(); - - for ($i = 0; $i < 4; $i++) { - if ($i >= $argcount) { - $this->_rgbaValue[$i] = 0; - } elseif (is_int($arglist[$i])) { - $this->_rgbaValue[$i] = (float) min(1, max(0, (float) $arglist[$i] / 255)); - } elseif (is_float($arglist[$i])) { - $this->_rgbaValue[$i] = (float) min(1, max(0, $arglist[$i])); - } else { - $this->_rgbaValue[$i] = 0; - } - } - } - - // }}} - // {{{ mixAlpha() - - /** - * Apply alphavalue to color - * - * Apply alpha value to color. It may be int or float. 255 / 1. means full - * oppacity - * - * @param mixed $alpha Alphavalue - * @return void - */ - public function mixAlpha($alpha = 1.) { - if (is_int($arglist[$i])) { - $this->_rgbaValue[3] *= (float) min(1, max(0, (float) $alpha / 255)); - } else { - $this->_rgbaValue[3] *= (float) min(1, max(0, (float) $alpha)); - } - } - - // }}} - // {{{ getValues() - - /** - * return RGBA values - * - * Return an array with rgba-values - * 0 => (float) red - * 1 => (float) green - * 2 => (float) blue - * 3 => (float) alpha - * - * @param mixed $alpha Aplhavalue - * @return array RGBA-Values - */ - public function getValues() { - return $this->_rgbaValue; - } - - // }}} - // {{{ getValues() - - /** - * Add light - * - * Add an light which influence the object this color is created for - * - * @param Image_3D_Color $color Lightcolor - * @param mixed $intensity Intensity - * @return void - */ - public function addLight(Image_3D_Color $color, $intensity = .5) { - $this->_lights[] = array($intensity, $color); - } - - // }}} - // {{{ _calcLights() - - /** - * Calculate lights - * - * Calculate light depending an all lights which influence this object - * - * @return void - */ - protected function _calcLights() { - foreach ($this->_lights as $light) { - list($intensity, $color) = $light; - $colorArray = $color->getValues(); - $this->_light[0] += $colorArray[0] * $intensity * (1 - $colorArray[3]); - $this->_light[1] += $colorArray[1] * $intensity * (1 - $colorArray[3]); - $this->_light[2] += $colorArray[2] * $intensity * (1 - $colorArray[3]); - } - } - - // }}} - // {{{ _mixColor() - - /** - * Mix Color with light - * - * Recalculate color depending on the lights - * - * @return void - */ - protected function _mixColor() { - $this->_rgbaValue[0] = min(1, $this->_rgbaValue[0] * $this->_light[0]); - $this->_rgbaValue[1] = min(1, $this->_rgbaValue[1] * $this->_light[1]); - $this->_rgbaValue[2] = min(1, $this->_rgbaValue[2] * $this->_light[2]); - } - - // }}} - // {{{ calculateColor() - - /** - * Calculate new color - * - * Calculate color depending on the lights - * - * @return void - */ - public function calculateColor() { - $this->_calcLights(); - $this->_mixColor(); - } - - // }}} - // {{{ calculateColor() - - /** - * Return Color as string - * - * Return a string representation of the color - * - * @return string String representation of color - */ - public function __toString() { - return sprintf("Color: r %.2f g %.2f b %.2f a %.2f\n", $this->_rgbaValue[0], $this->_rgbaValue[1], $this->_rgbaValue[2], $this->_rgbaValue[3]); - } - - // }}} -} - -// }}} \ No newline at end of file http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Coordinate.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/Image/3D/Coordinate.php diff -u pear/Image_3D/Image/3D/Coordinate.php:1.3 pear/Image_3D/Image/3D/Coordinate.php:1.4 --- pear/Image_3D/Image/3D/Coordinate.php:1.3 Sun Nov 6 15:32:43 2005 +++ pear/Image_3D/Image/3D/Coordinate.php Tue Nov 29 08:20:08 2005 @@ -1,267 +0,0 @@ -<?php - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * 3d Library - * - * PHP versions 5 - * - * LICENSE: - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Coordinate.php,v 1.3 2005/11/06 20:32:43 kore Exp $ - * @link http://pear.php.net/package/PackageName - * @since File available since Release 0.1.0 - */ - -// {{{ Image_3D_Coordinate - -/** - * Image_3D_Coordinate - * - * Base class for coordinates eg. points in the space - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName - * @since Class available since Release 0.1.0 - */ -class Image_3D_Coordinate { - - // {{{ properties - - /** - * X Coordiante - * - * @var float - */ - protected $_x; - - /** - * Y Coordiante - * - * @var float - */ - protected $_y; - - /** - * Z Coordiante - * - * @var float - */ - protected $_z; - - /** - * ID of the last transformation - * - * @var string - */ - protected $_lastTransformation; - - /** - * Variable saves if all relevant calculations for this point are done - * - * @var boolean - */ - protected $_processed; - - /** - * Screen coordinates (2d) of 3d-point - * - * @var array - */ - protected $_screenCoordinates; - - // }}} - // {{{ __construct() - - /** - * Constructor for Image_3D_Coordinate - * - * Create a Point with the given coordinates - * - * @param mixed $x X Coordinate - * @param mixed $y Y Coordinate - * @param mixed $z Z Coordinate - * @return Image_3D_Coordinate Instance of Coordinate - */ - public function __construct($x, $y, $z) { - $this->_x = (float) $x; - $this->_y = (float) $y; - $this->_z = (float) $z; - } - - // }}} - // {{{ transform() - - /** - * Transform the Coordinate - * - * Use a transformationmatrix to transform (move) the point - * - * @param Image_3D_Matrix $matrix Transformationmatrix - * @param string $id Transformationid - * @return void - */ - public function transform(Image_3D_Matrix $matrix, $id = null) { - // Point already transformed? - if (($id !== null) && ($this->_lastTransformation === $id)) return false; - $this->_lastTransformation = $id; - - $point = clone($this); - - $this->_x = $point->getX() * $matrix->getValue(0, 0) + - $point->getY() * $matrix->getValue(1, 0) + - $point->getZ() * $matrix->getValue(2, 0) + - $matrix->getValue(3, 0); - $this->_y = $point->getX() * $matrix->getValue(0, 1) + - $point->getY() * $matrix->getValue(1, 1) + - $point->getZ() * $matrix->getValue(2, 1) + - $matrix->getValue(3, 1); - $this->_z = $point->getX() * $matrix->getValue(0, 2) + - $point->getY() * $matrix->getValue(1, 2) + - $point->getZ() * $matrix->getValue(2, 2) + - $matrix->getValue(3, 2); - $this->_screenCoordinates = null; - } - - // }}} - // {{{ processed() - - /** - * Set Coordinate processed - * - * Store the coordinate as processed - * - * @return void - */ - public function processed() { - $this->_processed = true; - } - - // }}} - // {{{ isProcessed() - - /** - * Coordinate already processed - * - * Return if coordinate already was processsed - * - * @return bool processed - */ - public function isProcessed() { - return $this->_processed; - } - - // }}} - // {{{ getX() - - /** - * Return X coordinate - * - * Returns the X coordinate of the coordinate - * - * @return float X coordinate - */ - public function getX() { - return $this->_x; - } - - // }}} - // {{{ getY() - - /** - * Return Y coordinate - * - * Returns the Y coordinate of the coordinate - * - * @return float Y coordinate - */ - public function getY() { - return $this->_y; - } - - // }}} - // {{{ getZ() - - /** - * Return Z coordinate - * - * Returns the Z coordinate of the coordinate - * - * @return float Z coordinate - */ - public function getZ() { - return $this->_z; - } - - // }}} - // {{{ setScreenCoordinates() - - /** - * Set precalculated screen coordinates - * - * Store the screen coordinates calculated by the Renderer - * - * @param float $x X coordinate - * @param float $y X coordinate - * @return void - */ - public function setScreenCoordinates($x, $y) { - $this->_screenCoordinates = array((float) $x, (float) $y); - } - - // }}} - // {{{ getScreenCoordinates() - - /** - * Get screen coordinates - * - * Return an array with the screen coordinates - * array ( 0 => (float) $x, - 1 => (float) $y ) - * - * @return array Screen coordinates - */ - public function getScreenCoordinates() { - return $this->_screenCoordinates; - } - - // }}} - // {{{ __toString() - - /** - * Returns coordinate as string - * - * @return string Coordinate - */ - public function __toString() { - return sprintf('Coordinate: %2.f %2.f %2.f', $this->_x, $this->_y, $this->_z); - } - - // }}} -} - -// }}} http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Driver.php?r1=1.2&r2=1.3&ty=u Index: pear/Image_3D/Image/3D/Driver.php diff -u pear/Image_3D/Image/3D/Driver.php:1.2 pear/Image_3D/Image/3D/Driver.php:1.3 --- pear/Image_3D/Image/3D/Driver.php:1.2 Sun Nov 6 15:32:43 2005 +++ pear/Image_3D/Image/3D/Driver.php Tue Nov 29 08:20:08 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Driver.php,v 1.2 2005/11/06 20:32:43 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Driver.php,v 1.3 2005/11/29 13:20:08 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -45,7 +45,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ abstract class Image_3D_Driver { http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Enlightenable.php?r1=1.2&r2=1.3&ty=u Index: pear/Image_3D/Image/3D/Enlightenable.php diff -u pear/Image_3D/Image/3D/Enlightenable.php:1.2 pear/Image_3D/Image/3D/Enlightenable.php:1.3 --- pear/Image_3D/Image/3D/Enlightenable.php:1.2 Sun Nov 6 15:32:43 2005 +++ pear/Image_3D/Image/3D/Enlightenable.php Tue Nov 29 08:20:08 2005 @@ -1,91 +0,0 @@ -<?php - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * 3d Library - * - * PHP versions 5 - * - * LICENSE: - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Enlightenable.php,v 1.2 2005/11/06 20:32:43 kore Exp $ - * @link http://pear.php.net/package/PackageName - * @since File available since Release 0.1.0 - */ - -// {{{ Image_3D_Interface_Enlightenable - -/** - * Image_3D_Interface_Enlightenable - * - * - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName - * @since Class available since Release 0.1.0 - */ -interface Image_3D_Interface_Enlightenable { - - // {{{ getColor() - - /** - * Get Color from object - * - * Return the color for the object - * - * @return Image_3D_Color Color of object - */ - public function getColor(); - - // }}} - // {{{ getNormale() - - /** - * Get normale vector from object - * - * Return normale vector for the object - * - * @return Image_3D_Vector Normale vector - */ - public function getNormale(); - - // }}} - // {{{ getPosition() - - /** - * Get position from object - * - * Return position for the object - * - * @return Image_3D_Coordinate Coordinate - */ - public function getPosition(); - - // }}} -} - -// }}} \ No newline at end of file http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Matrix.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/Image/3D/Matrix.php diff -u pear/Image_3D/Image/3D/Matrix.php:1.3 pear/Image_3D/Image/3D/Matrix.php:1.4 --- pear/Image_3D/Image/3D/Matrix.php:1.3 Sun Nov 6 15:32:43 2005 +++ pear/Image_3D/Image/3D/Matrix.php Tue Nov 29 08:20:08 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Matrix.php,v 1.3 2005/11/06 20:32:43 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Matrix.php,v 1.4 2005/11/29 13:20:08 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -44,7 +44,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ class Image_3D_Matrix { @@ -137,54 +137,4 @@ } if (!empty($rotationZ)) { - // Normalisierung der Rotation von Grad auf radiale Berechnung - $rotationZ = (float) $rotationZ; - $rotationZ *= pi() / 180; - // Setzen der Rotationsmatrix fuer Drehungen an der X-Achse - $matrix = new Image_3D_Matrix(); - - $matrix->setValue(0, 0, cos($rotationZ)); - $matrix->setValue(0, 1, sin($rotationZ)); - $matrix->setValue(1, 0, -sin($rotationZ)); - $matrix->setValue(1, 1, cos($rotationZ)); - - // Setzen der Transformationsmatrix - $this->_multiply($matrix); - unset($matrix); - } - } - - public function setMoveMatrix($moveX, $moveY, $moveZ) { - $matrix = new Image_3D_Matrix(); - $matrix->setValue(3, 0, (float) $moveX); - $matrix->setValue(3, 1, (float) $moveY); - $matrix->setValue(3, 2, (float) $moveZ); - - $this->_multiply($matrix); - } - - public function setScaleMatrix($scaleX, $scaleY, $scaleZ) { - $matrix = new Image_3D_Matrix(); - $matrix->setValue(0, 0, (float) $scaleX); - $matrix->setValue(1, 1, (float) $scaleY); - $matrix->setValue(2, 2, (float) $scaleZ); - - $this->_multiply($matrix); - } - - protected function _multiply(Image_3D_Matrix $matrix) { - $new = clone($this); - - for ($i = 0; $i < 4; $i++) { - for ($j = 0; $j < 4; $j++) { - $sum = 0; - for ($k = 0; $k < 4; $k++) { - $sum += $new->getValue($i, $k) * $matrix->getValue($k, $j); - } - $this->setValue($i, $j, $sum); - } - } - } -} - -?> + // Normalisierung der Rotation von Grad auf r \ No newline at end of file http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Point.php?r1=1.4&r2=1.5&ty=u Index: pear/Image_3D/Image/3D/Point.php diff -u pear/Image_3D/Image/3D/Point.php:1.4 pear/Image_3D/Image/3D/Point.php:1.5 --- pear/Image_3D/Image/3D/Point.php:1.4 Mon Nov 7 08:43:24 2005 +++ pear/Image_3D/Image/3D/Point.php Tue Nov 29 08:20:08 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Point.php,v 1.4 2005/11/07 13:43:24 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Point.php,v 1.5 2005/11/29 13:20:08 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -44,7 +44,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ class Image_3D_Point extends Image_3D_Coordinate implements Image_3D_Interface_Enlightenable { http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Renderer.php?r1=1.6&r2=1.7&ty=u Index: pear/Image_3D/Image/3D/Renderer.php diff -u pear/Image_3D/Image/3D/Renderer.php:1.6 pear/Image_3D/Image/3D/Renderer.php:1.7 --- pear/Image_3D/Image/3D/Renderer.php:1.6 Mon Nov 7 08:43:24 2005 +++ pear/Image_3D/Image/3D/Renderer.php Tue Nov 29 08:20:08 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Renderer.php,v 1.6 2005/11/07 13:43:24 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Renderer.php,v 1.7 2005/11/29 13:20:08 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -45,7 +45,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ abstract class Image_3D_Renderer { @@ -187,283 +187,4 @@ } // }}} - // {{{ _calculateScreenCoordiantes() - - /** - * Caclulate Screen Coordinates - * - * Calculate screen coordinates for a point according to the perspektive - * the renderer should display - * - * @param Image_3D_Point $point Point to process - * @return void - */ - abstract protected function _calculateScreenCoordiantes(Image_3D_Point $point); - - // }}} - // {{{ _sortPolygones() - - /** - * Sort polygones - * - * Set the order the polygones will be displayed - * - * @return void - */ - abstract protected function _sortPolygones(); - - // }}} - // {{{ addObjects() - - /** - * Add objects to renderer - * - * Add objects to renderer. Only objects which are added will be - * displayed - * - * @param array $objetcs Array of objects - * @return void - */ - public function addObjects($objects) { - if (is_array($objects)) { - foreach ($objects as $object) { - if ($object instanceof Image_3D_Object) { - $this->_getPolygones($object); - } - } - } elseif ($objects instanceof Image_3D_Object) { - $this->_getPolygones($objects); - } - } - - // }}} - // {{{ addObjects() - - /** - * Add objects to renderer - * - * Add objects to renderer. Only objects which are added will be - * displayed - * - * @param array $objetcs Array of objects - * @return void - */ - public function addLights($lights) { - $this->_lights = array_merge($this->_lights, $lights); - } - - // }}} - // {{{ setSize() - - /** - * Set image size - * - * Set the size of the destination image. - * - * @param integer $x Width - * @param integer $y Height - * @return void - */ - public function setSize($x, $y) { - $this->_size = array($x / 2, $y / 2); - } - - // }}} - // {{{ setBackgroundColor() - - /** - * Set the Backgroundcolor - * - * Set the backgroundcolor of the destination image. - * - * @param Image_3D_Color $color Backgroundcolor - * @return void - */ - public function setBackgroundColor(Image_3D_Color $color) { - $this->_background = $color; - } - - // }}} - // {{{ setShading() - - /** - * Set the quality of the shading - * - * Set the quality of the shading. Standard value is the maximum shading - * quality the driver is able to render. - * - * @param integer $shading Shading quality - * @return void - */ - public function setShading($shading) { - $this->_shading = min($this->_shading, (int) $shading); - } - - // }}} - // {{{ setDriver() - - /** - * Set the driver - * - * Set the driver the image should be rendered with - * - * @param Image_3D_Driver $driver Driver to use - * @return void - */ - public function setDriver(Image_3D_Driver $driver) { - $this->_driver = $driver; - - $this->setShading(max($driver->getSupportedShading())); - } - - // }}} - // {{{ getPolygonCount() - - /** - * Return polygon count - * - * Return the number of used polygones in this image - * - * @return integer Number of Polygones - */ - public function getPolygonCount() { - return count($this->_polygones); - } - - // }}} - // {{{ getPointCount() - - /** - * Return point count - * - * Return the number of used points in this image - * - * @return integer Number of Points - */ - public function getPointCount() { - return count($this->_points); - } - - // }}} - // {{{ getLightCount() - - /** - * Return light count - * - * Return the number of used lights in this image - * - * @return integer Number of Lights - */ - public function getLightCount() { - return count($this->_lights); - } - - // }}} - // {{{ _calculatePolygonColors() - - /** - * Calculate the color of all polygones - * - * Let each polygon calculate his color based on the lights which are - * registered for this image - * - * @return void - */ - protected function _calculatePolygonColors() { - foreach ($this->_polygones as $polygon) { - $polygon->calculateColor($this->_lights); - } - } - - // }}} - // {{{ _calculatePointColors() - - /** - * Calculate the colors of all points - * - * Let each point calculate his color based on his normale which is - * calculated on his surrounding polygones and the lights which are - * registered for this image - * - * @return void - */ - protected function _calculatePointColors() { - foreach ($this->_polygones as $polygon) { - $normale = $polygon->getNormale(); - $color = $polygon->getColor(); - - $points = $polygon->getPoints(); - foreach ($points as $point) { - $point->addVector($normale); - $point->addColor($color); - } - } - - foreach ($this->_points as $point) $point->calculateColor($this->_lights); - } - - // }}} - // {{{ _shade() - - /** - * Draw all polygones - * - * Draw all polygones concerning the type of shading wich was set for the renderer - * - * @return void - */ - protected function _shade() { - switch ($this->_shading) { - case self::SHADE_NO: - foreach ($this->_polygones as $polygon) $this->_driver->drawPolygon($polygon); - break; - - case self::SHADE_FLAT: - $this->_calculatePolygonColors(); - foreach ($this->_polygones as $polygon) $this->_driver->drawPolygon($polygon); - break; - - case self::SHADE_GAUROUD: - $this->_calculatePointColors(); - foreach ($this->_polygones as $polygon) $this->_driver->drawGradientPolygon($polygon); - break; - - default: - throw new Exception('Shading type not supported.'); - break; - } - } - - // }}} - // {{{ render() - - /** - * Render the image - * - * Render the image into the metioned file - * - * @param string $file Filename - * @return void - */ - public function render($file) { - if (empty($this->_driver)) return false; - - // Calculate screen coordinates - foreach ($this->_points as $point) $this->_calculateScreenCoordiantes($point); - $this->_sortPolygones(); - - // Draw background - $this->_driver->createImage($this->_size[0] * 2, $this->_size[1] * 2); - $this->_driver->setBackground($this->_background); - - // Create polygones in driver - $this->_shade(); - - // Save image - $this->_driver->save($file); - } - - // }}} -} - -// }}} + // {{{ _calculateScreenCoordiantes() \ No newline at end of file http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Vector.php?r1=1.4&r2=1.5&ty=u Index: pear/Image_3D/Image/3D/Vector.php diff -u pear/Image_3D/Image/3D/Vector.php:1.4 pear/Image_3D/Image/3D/Vector.php:1.5 --- pear/Image_3D/Image/3D/Vector.php:1.4 Tue Nov 15 05:54:01 2005 +++ pear/Image_3D/Image/3D/Vector.php Tue Nov 29 08:20:08 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Vector.php,v 1.4 2005/11/15 10:54:01 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Vector.php,v 1.5 2005/11/29 13:20:08 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -45,7 +45,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ class Image_3D_Vector extends Image_3D_Coordinate { http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Color/Metal.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/Image/3D/Color/Metal.php diff -u pear/Image_3D/Image/3D/Color/Metal.php:1.3 pear/Image_3D/Image/3D/Color/Metal.php:1.4 --- pear/Image_3D/Image/3D/Color/Metal.php:1.3 Sun Nov 6 15:44:27 2005 +++ pear/Image_3D/Image/3D/Color/Metal.php Tue Nov 29 08:20:08 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Metal.php,v 1.3 2005/11/06 20:44:27 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Metal.php,v 1.4 2005/11/29 13:20:08 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -45,7 +45,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ class Image_3D_Color_Metal extends Image_3D_Color { http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Driver/ASCII.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/Image/3D/Driver/ASCII.php diff -u pear/Image_3D/Image/3D/Driver/ASCII.php:1.3 pear/Image_3D/Image/3D/Driver/ASCII.php:1.4 --- pear/Image_3D/Image/3D/Driver/ASCII.php:1.3 Sun Nov 6 15:37:56 2005 +++ pear/Image_3D/Image/3D/Driver/ASCII.php Tue Nov 29 08:20:08 2005 @@ -1,239 +0,0 @@ -<?php - -define('IMAGE_3D_DRIVER_ASCII_GRAY', 0.01); - -class Image_3D_Driver_ASCII extends Image_3D_Driver { - - protected $_size; - protected $_filetype; - protected $_points; - protected $_heigth; - protected $_image; - - protected $_charArray = array( - 0 => ' ', - 1 => '`', - 2 => '\'', - 3 => '^', - 4 => '-', - 5 => '`', - 6 => '/', - 7 => '/', - 8 => '-', - 9 => '\\', - 10 => '\'', - 11 => '\\', - 12 => '~', - 13 => '+', - 14 => '+', - 15 => '*', - 16 => '.', - 17 => '|', - 18 => '/', - 19 => '/', - 20 => '|', - 21 => '|', - 22 => '/', - 23 => '/', - 24 => '/', - 25 => ')', - 26 => '/', - 27 => 'Y', - 28 => 'r', - 29 => '}', - 30 => '/', - 31 => 'P', - 32 => '.', - 33 => '\\', - 34 => '|', - 35 => '^', - 36 => '\\', - 37 => '\\', - 38 => '(', - 39 => '(', - 40 => ':', - 41 => '\\', - 42 => '|', - 43 => 'I', - 44 => ';', - 45 => '\\', - 46 => '{', - 47 => '9', - 48 => '_', - 49 => '_', - 50 => '_', - 51 => 'C', - 52 => '<', - 53 => 'L', - 54 => 'l', - 55 => 'C', - 56 => '>', - 57 => 'J', - 58 => 'J', - 59 => 'J', - 60 => 'o', - 61 => 'b', - 62 => 'd', - 63 => '#', - ); - - public function __construct() { - parent::__construct(); - $this->_filetype = 'txt'; - - $this->reset(); - } - - public function reset() { - $this->_points = array(); - $this->_heigth = array(); - - $this->_image = array(); - } - - public function createImage($x, $y) { - $this->_size = array($x, $y); - } - - protected function _getColor(Image_3D_Color $color, $alpha = 1.) { - $values = $color->getValues(); - return array($values[0], $values[1], $values[2], (1 - $values[3]) * $alpha); - } - - protected function _mixColor($old, $new) { - $faktor = (1 - $new[3]) * $old[3]; // slight speed improvement - return array( - $old[0] * $faktor + $new[0] * $new[3], - $old[1] * $faktor + $new[1] * $new[3], - $old[2] * $faktor + $new[2] * $new[3], - $old[3] * $old[3] + $new[3] - ); - - } - - public function setBackground(Image_3D_Color $color) { - $bg = $this->_getColor($color); - - for ($x = 0; $x < $this->_size[0]; ++$x) { - for ($y = 0; $y < $this->_size[1]; ++$y) { - $this->_image[$x][$y] = $bg; - } - } - } - - protected function _drawLine(Image_3D_Point $p1, Image_3D_Point $p2) { - list($x1, $y1) = $p1->getScreenCoordinates(); - list($x2, $y2) = $p2->getScreenCoordinates(); - - $steps = ceil(max(abs($x1 - $x2), abs($y1 - $y2))); - - $xdiff = ($x2 - $x1) / $steps; - $ydiff = ($y2 - $y1) / $steps; - - $points = array(); - for ($i = 0; $i < $steps; ++$i) $points[(int) round($x1 + $i * $xdiff)][(int) round($y1 + $i * $ydiff)] = true; - return $points; - } - - protected function _getPolygonOutlines($pointArray) { - $map = array(); - - $last = end($pointArray); - foreach ($pointArray as $point) { - $line = $this->_drawLine($last, $point); - $last = $point; - // Merge line to map - foreach ($line as $x => $row) - foreach ($row as $y => $height) - $map[(int) $x][(int) $y] = $height; - } - - return $map; - } - - public function drawPolygon(Image_3D_Polygon $polygon) { - $points = $this->_getPolygonOutlines($polygon->getPoints()); - - foreach ($points as $x => $row) { - if (count($row) < 2) continue; - - $start = min(array_keys($row)); - $end = max(array_keys($row)); - - // Starting point - $this->_heigth[$x][$start] = $this->_getColor($polygon->getColor()); - - // the way between - for ($y = $start + 1; $y < $end; ++$y) { - $this->_heigth[$x][$y] = $this->_getColor($polygon->getColor()); - } - - // Ending point - $this->_points[$x][$end] = $this->_getColor($polygon->getColor()); - } - } - - public function drawGradientPolygon(Image_3D_Polygon $polygon) { - $this->drawPolygon($polygon); - } - - public function setFiletye($type) { - $type = strtolower($type); - if (in_array($type, array('png', 'jpeg'))) { - $this->_filetype = $type; - return true; - } else { - return false; - } - } - - public function _getAnsiColorCode($color, $last = '') { - $code = "\033[0;" . (30 + bindec((int) round($color[2]) . (int) round($color[1]) . (int) round($color[0]))) . 'm'; - if ($last !== $code) return $code; - return ''; - } - - public function save($file) { - - $asciiWidth = (int) ceil($this->_size[0] / 2); - $asciiHeight = (int) ceil($this->_size[1] / 6); - - $output = "\033[2J"; - $lastColor = ''; - - for ($y = 0; $y < $asciiHeight; ++$y) { - for ($x = 0; $x < $asciiWidth; ++$x) { - // Get pixelarray - $char = 0; - $charColor = array(0, 0, 0); - for ($xi = 0; $xi < 2; ++$xi) { - for ($yi = 0; $yi < 3; ++$yi) { - $xPos = $x * 2 + $xi; - $yPos = $y * 6 + $yi; - $color = $this->_mixColor($this->_image[$xPos][$yPos], $this->_heigth[$xPos][$yPos]); - if ((($color[0] + $color[1] + $color[2]) / 3) > IMAGE_3D_DRIVER_ASCII_GRAY) $char |= pow(2, $yi + ($xi * 3)); - $charColor[0] += $color[0]; - $charColor[1] += $color[1]; - $charColor[2] += $color[2]; - } - } - $lastColor = $this->_getAnsiColorCode(array($charColor[0] / 6, $charColor[1] / 6, $charColor[2] / 6), $lastColor); - $output .= $lastColor . $this->_charArray[$char]; - } - $lastColor = ''; - $output .= "\n"; - } - $fp = fopen($file, 'w'); - fwrite($fp, $output); - fclose($fp); - } - - public function getSupportedShading() { - return array( Image_3D_Renderer::SHADE_NO, - Image_3D_Renderer::SHADE_FLAT, -// Image_3D_Renderer::SHADE_GAUROUD, - ); - } -} - -?> http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Driver/GD.php?r1=1.2&r2=1.3&ty=u Index: pear/Image_3D/Image/3D/Driver/GD.php diff -u pear/Image_3D/Image/3D/Driver/GD.php:1.2 pear/Image_3D/Image/3D/Driver/GD.php:1.3 --- pear/Image_3D/Image/3D/Driver/GD.php:1.2 Sun Nov 6 15:49:27 2005 +++ pear/Image_3D/Image/3D/Driver/GD.php Tue Nov 29 08:20:08 2005 @@ -1,92 +0,0 @@ -<?php - -class Image_3D_Driver_GD extends Image_3D_Driver { - - protected $_filetype; - - public function __construct() { - parent::__construct(); - - $this->_filetype = 'png'; - } - - public function createImage($x, $y) { - $this->_image = imagecreatetruecolor($x, $y); - } - - protected function _getColor(Image_3D_Color $color) { - $values = $color->getValues(); - - $values[0] = (int) round($values[0] * 255); - $values[1] = (int) round($values[1] * 255); - $values[2] = (int) round($values[2] * 255); - $values[3] = (int) round($values[3] * 127); - - if ($values[3] > 0) { - // Tranzparente Farbe allokieren - $color = imageColorExactAlpha($this->_image, $values[0], $values[1], $values[2], $values[3]); - if ($color === -1) { - // Wenn nicht Farbe neu alloziieren - $color = imageColorAllocateAlpha($this->_image, $values[0], $values[1], $values[2], $values[3]); - } - } else { - // Deckende Farbe allozieren - $color = imageColorExact($this->_image, $values[0], $values[1], $values[2]); - if ($color === -1) { - // Wenn nicht Farbe neu alloziieren - $color = imageColorAllocate($this->_image, $values[0], $values[1], $values[2]); - } - } - - return $color; - } - - public function setBackground(Image_3D_Color $color) { - $bg = $this->_getColor($color); - imagefill($this->_image, 1, 1, $bg); - } - - public function drawPolygon(Image_3D_Polygon $polygon) { - // Get points - $points = $polygon->getPoints(); - $coords = array(); - foreach ($points as $point) $coords = array_merge($coords, $point->getScreenCoordinates()); - $coordCount = (int) (count($coords) / 2); - - if (true) { - imageFilledPolygon($this->_image, $coords, $coordCount, $this->_getColor($polygon->getColor())); - } else { - imagePolygon($this->_image, $coords, $coordCount, $this->_getColor($polygon->getColor())); - } - - } - - public function drawGradientPolygon(Image_3D_Polygon $polygon) { - $this->drawPolygon($polygon); - } - - public function setFiletye($type) { - $type = strtolower($type); - if (in_array($type, array('png', 'jpeg'))) { - $this->_filetype = $type; - return true; - } else { - return false; - } - } - - public function save($file) { - switch ($this->_filetype) { - case 'png': - return imagepng($this->_image, $file); - case 'jpeg': - return imagejpeg($this->_image, $file); - } - } - - public function getSupportedShading() { - return array(Image_3D_Renderer::SHADE_NO, Image_3D_Renderer::SHADE_FLAT); - } -} - -?> \ No newline at end of file http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Driver/ImageCanvas.php?r1=1.1&r2=1.2&ty=u Index: pear/Image_3D/Image/3D/Driver/ImageCanvas.php diff -u pear/Image_3D/Image/3D/Driver/ImageCanvas.php:1.1 pear/Image_3D/Image/3D/Driver/ImageCanvas.php:1.2 --- pear/Image_3D/Image/3D/Driver/ImageCanvas.php:1.1 Mon Nov 7 15:24:05 2005 +++ pear/Image_3D/Image/3D/Driver/ImageCanvas.php Tue Nov 29 08:20:08 2005 @@ -1,59 +0,0 @@ -<?php - -require_once 'Image/Canvas.php'; - -class Image_3D_Driver_ImageCanvas extends Image_3D_Driver { - - protected $_filetype; - protected $_type; - - public function __construct() { - parent::__construct(); - } - - public function setImageType($type) { - $this->_type = (string) $type; - } - - public function createImage($x, $y) { - $this->_image = Image_Canvas::factory($this->_type, array('width' => $x, 'height' => $y, 'antialias' => 'driver')); - } - - protected function _getColor(Image_3D_Color $color) { - $values = $color->getValues(); - return sprintf('#%02x%02x%02x@%f', (int) ($values[0] * 255), (int) ($values[1] * 255), (int) ($values[2] * 255), 1 - $values[3]); - } - - public function setBackground(Image_3D_Color $color) { - $this->_image->setFillColor($this->_getColor($color)); - $this->_image->rectangle(array('x0' => 0, 'y0' => 0, 'x1' => $this->_image->getWidth(), 'y1' => $this->_image->getHeight())); - } - - public function drawPolygon(Image_3D_Polygon $polygon) { - - // Build pointarray - $pointArray = array(); - $points = $polygon->getPoints(); - foreach ($points as $point) { - $screenCoordinates = $point->getScreenCoordinates(); - $this->_image->addVertex(array('x' => $screenCoordinates[0], 'y' => $screenCoordinates[1])); - } - $this->_image->setFillColor($this->_getColor($polygon->getColor())); - $this->_image->setLineColor(false); - $this->_image->polygon(array('connect' => true)); - } - - public function drawGradientPolygon(Image_3D_Polygon $polygon) { - $this->drawPolygon($polygon); - } - - public function save($file) { - $this->_image->save(array('filename' => $file)); - } - - public function getSupportedShading() { - return array(Image_3D_Renderer::SHADE_NO, Image_3D_Renderer::SHADE_FLAT); - } -} - -?> \ No newline at end of file http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Driver/ImageMagick.php?r1=1.1&r2=1.2&ty=u Index: pear/Image_3D/Image/3D/Driver/ImageMagick.php diff -u pear/Image_3D/Image/3D/Driver/ImageMagick.php:1.1 pear/Image_3D/Image/3D/Driver/ImageMagick.php:1.2 --- pear/Image_3D/Image/3D/Driver/ImageMagick.php:1.1 Tue Nov 8 10:37:38 2005 +++ pear/Image_3D/Image/3D/Driver/ImageMagick.php Tue Nov 29 08:20:08 2005 @@ -1,106 +0,0 @@ -<?php - -class Image_3D_Driver_ImageMagick extends Image_3D_Driver { - - /** - * Array of parameter strings passed to 'convert' binary. - * - * @var array - * @access protected - */ - protected $_commandQueue = array(); - - public function __construct() { - parent::__construct(); - } - - public function createImage($x, $y) { - $this->_image = tempnam(); - $this->_dimensions = array('x' => $x, 'y' => $y); - $this->_commandQueue[] = "-size {$x}x{$y} xc:transparent"; - } - - protected function _getColor(Image_3D_Color $color) { - $values = $color->getValues(); - - $values[0] = (int) round($values[0] * 255); - $values[1] = (int) round($values[1] * 255); - $values[2] = (int) round($values[2] * 255); - $values[3] = (int) round($values[3] * 127); - - $color = ''; - if ($values[3] > 0) { - $color = 'rgba('.implode(',', $values).')'; - } else { - unset($values[3]); - $color = 'rgb('.implode(',', $values).')'; - } - - return $color; - } - - public function setBackground(Image_3D_Color $color) { - $colorString = $this->_getColor($color); - array_splice( - $this->_commandQueue, - 1, - 0, - '-fill '.escapeshellarg($colorString).' '. - '-draw '.escapeshellarg('rectangle 0,0 '.implode(',', $this->_dimensions)) - ); - } - - public function drawPolygon(Image_3D_Polygon $polygon) { - // Get points - $points = $polygon->getPoints(); - $coords = array(); - - $coords = ''; - foreach ($points as $point) { - $pointCoords = $point->getScreenCoordinates(); - $coords .= (int)$pointCoords[0].','.(int)$pointCoords[1].' '; - } - - $command = '-fill '.escapeshellarg($this->_getColor($polygon->getColor())); - $command .= ' -draw '.escapeshellarg('polygon '.trim($coords)); - $this->_commandQueue[] = $command; - } - - public function drawGradientPolygon(Image_3D_Polygon $polygon) { - $this->drawPolygon($polygon); - } - - public function setFiletye($type) { - $type = strtolower($type); - if (in_array($type, array('png', 'jpeg'))) { - $this->_filetype = $type; - return true; - } else { - return false; - } - } - - public function save($file) { - $command = ''; - $commandCount = 1; - $firstRun = true; - for ($i = 0; $i < count($this->_commandQueue); $i++) { - $command .= ' '.$this->_commandQueue[$i].' '; - if (strlen($command) > 1000 || $i == count($this->_commandQueue) - 1) { - $firstRun === false ? $command = $file . ' ' . $command : $firstRun = false; - - $command = 'convert ' . $command . ' ' . $file; - // echo "Excuting command run <".$commandCount++.">\n"; - shell_exec($command); - $command = ''; - } - } - shell_exec($command); - } - - public function getSupportedShading() { - return array(Image_3D_Renderer::SHADE_NO, Image_3D_Renderer::SHADE_FLAT); - } -} - -?> http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Driver/SVG.php?r1=1.1&r2=1.2&ty=u Index: pear/Image_3D/Image/3D/Driver/SVG.php diff -u pear/Image_3D/Image/3D/Driver/SVG.php:1.1 pear/Image_3D/Image/3D/Driver/SVG.php:1.2 --- pear/Image_3D/Image/3D/Driver/SVG.php:1.1 Mon Jul 18 11:35:30 2005 +++ pear/Image_3D/Image/3D/Driver/SVG.php Tue Nov 29 08:20:08 2005 @@ -120,29 +120,4 @@ $this->_addPolygon(sprintf("\t<polygon id=\"[id]\" points=\"%s\" style=\"fill: url(#%s); stroke: none; fill-opacity: 1;\" />\n", $list, $lg)); // Overlay Polygon - $lg = $this->_addGradient(sprintf("\t\t<linearGradient id=\"[id]\" x1=\"%.2f\" y1=\"%.2f\" x2=\"%.2f\" y2=\"%.2f\">\n%s\t\t</linearGradient>\n", - ($pointarray[2][0] - $xOffset) / $xSize, - ($pointarray[2][1] - $yOffset) / $ySize, - ((($pointarray[0][0] + $pointarray[1][0]) / 2) - $xOffset) / $xSize, - ((($pointarray[0][1] + $pointarray[1][1]) / 2) - $yOffset) / $ySize, - $this->_getStop($points[2]->getColor()) . $this->_getStop($points[2]->getColor(), 1, 1))); - - $this->_addPolygon(sprintf("\t<polygon id=\"[id]\" points=\"%s\" style=\"fill: url(#%s); stroke: none; fill-opacity: 1;\" />\n", $list, $lg)); - } - - public function save($file) { - $this->_image .= sprintf("\t<defs id=\"defs%d\">\n", $this->_id++); - $this->_image .= implode('', $this->_gradients); - $this->_image .= sprintf("\t</defs>\n\n"); - - $this->_image .= implode('', $this->_polygones); - $this->_image .= "</svg>\n"; - file_put_contents($file, $this->_image); - } - - public function getSupportedShading() { - return array(Image_3D_Renderer::SHADE_NO, Image_3D_Renderer::SHADE_FLAT, Image_3D_Renderer::SHADE_GAUROUD); - } -} - -?> + $lg = $this->_addGradient(sprintf("\t\t<linearGradient id=\"[id]\" x \ No newline at end of file http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Driver/SVGRotate.php?r1=1.1&r2=1.2&ty=u Index: pear/Image_3D/Image/3D/Driver/SVGRotate.php diff -u pear/Image_3D/Image/3D/Driver/SVGRotate.php:1.1 pear/Image_3D/Image/3D/Driver/SVGRotate.php:1.2 --- pear/Image_3D/Image/3D/Driver/SVGRotate.php:1.1 Sun Jul 24 07:41:09 2005 +++ pear/Image_3D/Image/3D/Driver/SVGRotate.php Tue Nov 29 08:20:08 2005 @@ -1,82 +0,0 @@ -<?php - -class Image_3D_Driver_SVGRotate extends Image_3D_Driver { - - protected $_x; - protected $_y; - - protected $_id; - - protected $_gradients; - protected $_polygones; - - public function __construct() { - $this->_image = ''; - $this->_id = 1; - $this->_gradients = array(); - $this->_polygones = array(); - } - - public function createImage($x, $y) { - $this->_x = (int) $x; - $this->_y = (int) $y; - - $this->_image = <<<EOF -<?xml version="1.0" ?> -EOF; - $this->_image .= "\n\n"; - } - - public function setBackground(Image_3D_Color $color) { - } - - protected function _getStyle(Image_3D_Color $color) { - } - - protected function _getStop(Image_3D_Color $color, $offset = 0, $alpha = null) { - } - - protected function _addGradient($string) { - } - - protected function _addPolygon($string) { - $id = 'polygon' . $this->_id++; - $this->_polygones[] = str_replace('[id]', $id, $string); - return $id; - } - - public function drawPolygon(Image_3D_Polygon $polygon) { - - $list = ''; - $array = array(); - $points = $polygon->getPoints(); - foreach ($points as $point) { - $array[0][] = $point->getX(); - $array[1][] = $point->getY(); - $array[2][] = $point->getZ(); - } - - $this->_addPolygon(sprintf('<polygon id="[id]" - x1="%.2f" x2="%.2f" x3="%.2f" - y1="%.2f" y2="%.2f" y3="%.2f" - z1="%.2f" z2="%.2f" z3="%.2f" />' . "\n", - $array[0][0], $array[0][1], $array[0][2], - $array[1][0], $array[1][1], $array[1][2], - $array[2][0], $array[2][1], $array[2][2] )); - } - - public function drawGradientPolygon(Image_3D_Polygon $polygon) { - $this->drawPolygon($polygon); - } - - public function save($file) { - $this->_image .= implode('', $this->_polygones); - file_put_contents($file, $this->_image); - } - - public function getSupportedShading() { - return array(Image_3D_Renderer::SHADE_NO, Image_3D_Renderer::SHADE_FLAT); - } -} - -?> http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Driver/ZBuffer.php?r1=1.2&r2=1.3&ty=u Index: pear/Image_3D/Image/3D/Driver/ZBuffer.php diff -u pear/Image_3D/Image/3D/Driver/ZBuffer.php:1.2 pear/Image_3D/Image/3D/Driver/ZBuffer.php:1.3 --- pear/Image_3D/Image/3D/Driver/ZBuffer.php:1.2 Thu Aug 11 14:11:28 2005 +++ pear/Image_3D/Image/3D/Driver/ZBuffer.php Tue Nov 29 08:20:08 2005 @@ -1,193 +0,0 @@ -<?php - -class Image_3D_Driver_ZBuffer extends Image_3D_Driver { - - protected $_filetype; - protected $_points; - protected $_heigth; - - public function __construct() { - parent::__construct(); - - $this->_filetype = 'png'; - $this->_points = array(); - $this->_heigth = array(); - } - - public function createImage($x, $y) { - $this->_image = imagecreatetruecolor($x, $y); - imagealphablending($this->_image, true); - imageSaveAlpha($this->_image, true); - } - - protected function _getColor(Image_3D_Color $color, $alpha = 1.) { - $values = $color->getValues(); - - $values[0] = (int) round($values[0] * 255); - $values[1] = (int) round($values[1] * 255); - $values[2] = (int) round($values[2] * 255); - $values[3] = (int) round((1 - ((1 - $values[3]) * $alpha)) * 127); - - if ($values[3] > 0) { - // Tranzparente Farbe allokieren - $color = imageColorExactAlpha($this->_image, $values[0], $values[1], $values[2], $values[3]); - if ($color === -1) { - // Wenn nicht Farbe neu alloziieren - $color = imageColorAllocateAlpha($this->_image, $values[0], $values[1], $values[2], $values[3]); - } - } else { - // Deckende Farbe allozieren - $color = imageColorExact($this->_image, $values[0], $values[1], $values[2]); - if ($color === -1) { - // Wenn nicht Farbe neu alloziieren - $color = imageColorAllocate($this->_image, $values[0], $values[1], $values[2]); - } - } - - return $color; - } - - public function setBackground(Image_3D_Color $color) { - $bg = $this->_getColor($color); - imagefill($this->_image, 1, 1, $bg); - } - - protected function _drawLine(Image_3D_Point $p1, Image_3D_Point $p2) { - list($x1, $y1) = $p1->getScreenCoordinates(); - list($x2, $y2) = $p2->getScreenCoordinates(); - $z1 = $p1->getZ(); $z2 = $p2->getZ(); - - $steps = ceil(max(abs($x1 - $x2), abs($y1 - $y2))); - - $xdiff = ($x2 - $x1) / $steps; - $ydiff = ($y2 - $y1) / $steps; - $zdiff = ($z2 - $z1) / $steps; - - $points = array('height' => array(), 'coverage' => array()); - for ($i = 0; $i < $steps; $i++) { - $x = $x1 + $i * $xdiff; - $xFloor = floor($x); - $xCeil = ceil($x); - $xOffset = $x - $xFloor; - - $y = $y1 + $i * $ydiff; - $yFloor = floor($y); - $yCeil = ceil($y); - $yOffset = $y - $yFloor; - - if (!isset($points['coverage'][(int) $xFloor][(int) $yCeil])) { - $points['height'][(int) $xFloor][(int) $yCeil] = $z1 + $i * $zdiff; - $points['coverage'][(int) $xFloor][(int) $yCeil] = (1 - $xOffset) * $yOffset; - } else { - $points['coverage'][(int) $xFloor][(int) $yCeil] += (1 - $xOffset) * $yOffset; - } - - if (!isset($points['coverage'][(int) $xFloor][(int) $yFloor])) { - $points['height'][(int) $xFloor][(int) $yFloor] = $z1 + $i * $zdiff; - $points['coverage'][(int) $xFloor][(int) $yFloor] = (1 - $xOffset) * (1 - $yOffset); - } else { - $points['coverage'][(int) $xFloor][(int) $yFloor] += (1 - $xOffset) * (1 - $yOffset); - } - - if (!isset($points['coverage'][(int) $xCeil][(int) $yCeil])) { - $points['height'][(int) $xCeil][(int) $yCeil] = $z1 + $i * $zdiff; - $points['coverage'][(int) $xCeil][(int) $yCeil] = $xOffset * $yOffset; - } else { - $points['coverage'][(int) $xCeil][(int) $yCeil] += $xOffset * $yOffset; - } - - if (!isset($points['coverage'][(int) $xCeil][(int) $yFloor])) { - $points['height'][(int) $xCeil][(int) $yFloor] = $z1 + $i * $zdiff; - $points['coverage'][(int) $xCeil][(int) $yFloor] = $xOffset * (1 - $yOffset); - } else { - $points['coverage'][(int) $xCeil][(int) $yFloor] += $xOffset * (1 - $yOffset); - } - } - return $points; - } - - protected function _getPolygonOutlines($pointArray) { - $map = array('height' => array(), 'coverage' => array()); - - $last = end($pointArray); - foreach ($pointArray as $point) { - $line = $this->_drawLine($last, $point); - $last = $point; - // Merge line to map - foreach ($line['height'] as $x => $row) { - foreach ($row as $y => $height) { - $map['height'][(int) $x][(int) $y] = $height; - $map['coverage'][(int) $x][(int) $y] = $line['coverage'][(int) $x][(int) $y]; - } - } - } - - return $map; - } - - public function drawPolygon(Image_3D_Polygon $polygon) { - $points = $this->_getPolygonOutlines($polygon->getPoints()); - - foreach ($points['coverage'] as $x => $row) { - if (count($row) < 2) continue; - - $start = min(array_keys($row)); - $end = max(array_keys($row)); - - $zStart = $points['height'][$x][$start]; - $zEnd = $points['height'][$x][$end]; - $zStep = ($zEnd - $zStart) / ($end - $start); - - // Starting point - $this->_heigth[$x][$start][(int) ($zStart * 100)] = $this->_getColor($polygon->getColor(), $points['coverage'][$x][$start]); - - // the way between - for ($y = $start + 1; $y < $end; $y++) { - $this->_heigth[$x][$y][(int) (($zStart + $zStep * ($y - $start)) * 100)] = $this->_getColor($polygon->getColor()); - } - - // Ending point - $this->_points[$x][$end][(int) ($zEnd * 100)] = $this->_getColor($polygon->getColor(), $points['coverage'][$x][$end]); - } - } - - public function drawGradientPolygon(Image_3D_Polygon $polygon) { - $this->drawPolygon($polygon); - } - - public function setFiletye($type) { - $type = strtolower($type); - if (in_array($type, array('png', 'jpeg'))) { - $this->_filetype = $type; - return true; - } else { - return false; - } - } - - public function save($file) { - - foreach ($this->_heigth as $x => $row) { - foreach ($row as $y => $points) { - krsort($points); - foreach ($points as $color) imagesetpixel($this->_image, $x, $y, $color); - } - } - - switch ($this->_filetype) { - case 'png': - return imagepng($this->_image, $file); - case 'jpeg': - return imagejpeg($this->_image, $file); - } - } - - public function getSupportedShading() { - return array( Image_3D_Renderer::SHADE_NO, - Image_3D_Renderer::SHADE_FLAT, -// Image_3D_Renderer::SHADE_GAUROUD, - ); - } -} - -?> http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Matrix/Move.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/Image/3D/Matrix/Move.php diff -u pear/Image_3D/Image/3D/Matrix/Move.php:1.3 pear/Image_3D/Image/3D/Matrix/Move.php:1.4 --- pear/Image_3D/Image/3D/Matrix/Move.php:1.3 Sun Nov 6 15:44:26 2005 +++ pear/Image_3D/Image/3D/Matrix/Move.php Tue Nov 29 08:20:09 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Move.php,v 1.3 2005/11/06 20:44:26 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Move.php,v 1.4 2005/11/29 13:20:09 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -45,7 +45,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ class Image_3D_Matrix_Move extends Image_3D_Matrix { http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Matrix/Rotation.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/Image/3D/Matrix/Rotation.php diff -u pear/Image_3D/Image/3D/Matrix/Rotation.php:1.3 pear/Image_3D/Image/3D/Matrix/Rotation.php:1.4 --- pear/Image_3D/Image/3D/Matrix/Rotation.php:1.3 Sun Nov 6 15:44:26 2005 +++ pear/Image_3D/Image/3D/Matrix/Rotation.php Tue Nov 29 08:20:09 2005 @@ -1,57 +0,0 @@ -<?php - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * 3d Library - * - * PHP versions 5 - * - * LICENSE: - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Rotation.php,v 1.3 2005/11/06 20:44:26 kore Exp $ - * @link http://pear.php.net/package/PackageName - * @since File available since Release 0.1.0 - */ - -require_once('Image/3D/Matrix.php'); - -/** - * Image_3D_Matrix_Rotation - * - * - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName - * @since Class available since Release 0.1.0 - */ -class Image_3D_Matrix_Rotation extends Image_3D_Matrix { - - public function __construct($parameter) { - $this->setUnitMatrix(); - $this->setRotationMatrix((float) @$parameter[0], (float) @$parameter[1], (float) @$parameter[2]); - } -} http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Matrix/Scale.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/Image/3D/Matrix/Scale.php diff -u pear/Image_3D/Image/3D/Matrix/Scale.php:1.3 pear/Image_3D/Image/3D/Matrix/Scale.php:1.4 --- pear/Image_3D/Image/3D/Matrix/Scale.php:1.3 Sun Nov 6 15:44:26 2005 +++ pear/Image_3D/Image/3D/Matrix/Scale.php Tue Nov 29 08:20:09 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Scale.php,v 1.3 2005/11/06 20:44:26 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Scale.php,v 1.4 2005/11/29 13:20:09 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -45,7 +45,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ class Image_3D_Matrix_Scale extends Image_3D_Matrix { http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Light.php?r1=1.4&r2=1.5&ty=u Index: pear/Image_3D/Image/3D/Paintable/Light.php diff -u pear/Image_3D/Image/3D/Paintable/Light.php:1.4 pear/Image_3D/Image/3D/Paintable/Light.php:1.5 --- pear/Image_3D/Image/3D/Paintable/Light.php:1.4 Sat Nov 12 07:40:36 2005 +++ pear/Image_3D/Image/3D/Paintable/Light.php Tue Nov 29 08:20:09 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Light.php,v 1.4 2005/11/12 12:40:36 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Light.php,v 1.5 2005/11/29 13:20:09 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -44,7 +44,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ class Image_3D_Light extends Image_3D_Coordinate implements Image_3D_Interface_Paintable { http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Object.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/Image/3D/Paintable/Object.php diff -u pear/Image_3D/Image/3D/Paintable/Object.php:1.3 pear/Image_3D/Image/3D/Paintable/Object.php:1.4 --- pear/Image_3D/Image/3D/Paintable/Object.php:1.3 Sun Nov 6 15:40:56 2005 +++ pear/Image_3D/Image/3D/Paintable/Object.php Tue Nov 29 08:20:09 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Object.php,v 1.3 2005/11/06 20:40:56 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Object.php,v 1.4 2005/11/29 13:20:09 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -44,7 +44,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ class Image_3D_Object implements Image_3D_Interface_Paintable { http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Polygon.php?r1=1.4&r2=1.5&ty=u Index: pear/Image_3D/Image/3D/Paintable/Polygon.php diff -u pear/Image_3D/Image/3D/Paintable/Polygon.php:1.4 pear/Image_3D/Image/3D/Paintable/Polygon.php:1.5 --- pear/Image_3D/Image/3D/Paintable/Polygon.php:1.4 Mon Nov 7 08:43:24 2005 +++ pear/Image_3D/Image/3D/Paintable/Polygon.php Tue Nov 29 08:20:09 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Polygon.php,v 1.4 2005/11/07 13:43:24 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Polygon.php,v 1.5 2005/11/29 13:20:09 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -44,7 +44,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ class Image_3D_Polygon implements Image_3D_Interface_Paintable, Image_3D_Interface_Enlightenable { @@ -131,48 +131,4 @@ return 1; } - public function setColor(Image_3D_Color $color) { - $this->_color = $color; - } - - public function isVisible() { - return $this->isVisible(); - } - - public function setInvisible() { - $this->_visible = false; - } - - public function setOption($option, $value) { - $this->_option[$option] = $value; - foreach ($this->_points as $point) $point->setOption($option, $value); - } - - public function addPoint(Image_3D_Point $point) { - $this->_points[] = $point; - } - - public function getPoints() { - return $this->_points; - } - - public function transform(Image_3D_Matrix $matrix, $id = null) { - - if ($id === null) $id = substr(md5(microtime()), 0, 8); - foreach ($this->_points as $point) $point->transform($matrix, $id); - } - - public function getMidZ() { - $z = 0; - foreach ($this->_points as $point) $z += $point->getZ(); - return $z / count($this->_points); - } - - public function getMaxZ() { - $z = -500; - foreach ($this->_points as $point) $z = max($point->getZ(), $z); - return $z; - } -} - -?> + public function setColor(Image_3D_Col \ No newline at end of file http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Light/Ambient.php?r1=1.1&r2=1.2&ty=u Index: pear/Image_3D/Image/3D/Paintable/Light/Ambient.php diff -u pear/Image_3D/Image/3D/Paintable/Light/Ambient.php:1.1 pear/Image_3D/Image/3D/Paintable/Light/Ambient.php:1.2 --- pear/Image_3D/Image/3D/Paintable/Light/Ambient.php:1.1 Tue Nov 15 05:13:05 2005 +++ pear/Image_3D/Image/3D/Paintable/Light/Ambient.php Tue Nov 29 08:20:09 2005 @@ -1,63 +0,0 @@ -<?php - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * 3d Library - * - * PHP versions 5 - * - * LICENSE: - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Ambient.php,v 1.1 2005/11/15 10:13:05 kore Exp $ - * @link http://pear.php.net/package/PackageName - * @since File available since Release 0.1.0 - */ - - -/** - * Image_3D_Light - * - * - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName - * @since Class available since Release 0.1.0 - */ -class Image_3D_Light_Ambient extends Image_3D_Light { - - public function __construct($x = 0, $y = 0, $z = 0, $parameter = array()) { - parent::__construct(0, 0, 0); - } - - public function getColor(Image_3D_Interface_Enlightenable $polygon) { - $color = clone ($polygon->getColor()); - - $color->addLight($this->_color, 1); - return $color; - } -} - http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Light/Point.php?r1=1.1&r2=1.2&ty=u Index: pear/Image_3D/Image/3D/Paintable/Light/Point.php diff -u pear/Image_3D/Image/3D/Paintable/Light/Point.php:1.1 pear/Image_3D/Image/3D/Paintable/Light/Point.php:1.2 --- pear/Image_3D/Image/3D/Paintable/Light/Point.php:1.1 Tue Nov 15 05:54:00 2005 +++ pear/Image_3D/Image/3D/Paintable/Light/Point.php Tue Nov 29 08:20:09 2005 @@ -1,86 +0,0 @@ -<?php - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * 3d Library - * - * PHP versions 5 - * - * LICENSE: - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Point.php,v 1.1 2005/11/15 10:54:00 kore Exp $ - * @link http://pear.php.net/package/PackageName - * @since File available since Release 0.1.0 - */ - - -/** - * Image_3D_Light_Point - * - * - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName - * @since Class available since Release 0.1.0 - */ -class Image_3D_Light_Point extends Image_3D_Light { - - protected $_color; - protected $_falloff; - protected $_distance; - - public function __construct($x, $y, $z, $parameter) { - parent::__construct($x, $y, $z); - - $this->_falloff = max(0, (float) $parameter['falloff']); - $this->_distance = (float) $parameter['distance']; - } - - public function getColor(Image_3D_Interface_Enlightenable $polygon) { - $color = clone ($polygon->getColor()); - - $light = new Image_3D_Vector($this->_x, $this->_y, $this->_z); - $light->sub($polygon->getPosition()); - - $distance = $light->length(); - - if ($distance > $this->_distance) return $color; - $factor = 1 - pow($distance / $this->_distance, $this->_falloff); - - $light->unify(); - $light->add(new Image_3D_Vector(0, 0, -1)); - - $normale = $polygon->getNormale(); - - $angle = abs(1 - $normale->getAngle($light)); - - $color->addLight($this->_color, $angle * $factor); - return $color; - } -} - -?> http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Light/Spotlight.php?r1=1.1&r2=1.2&ty=u Index: pear/Image_3D/Image/3D/Paintable/Light/Spotlight.php diff -u pear/Image_3D/Image/3D/Paintable/Light/Spotlight.php:1.1 pear/Image_3D/Image/3D/Paintable/Light/Spotlight.php:1.2 --- pear/Image_3D/Image/3D/Paintable/Light/Spotlight.php:1.1 Sat Nov 12 07:40:36 2005 +++ pear/Image_3D/Image/3D/Paintable/Light/Spotlight.php Tue Nov 29 08:20:09 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Spotlight.php,v 1.1 2005/11/12 12:40:36 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Spotlight.php,v 1.2 2005/11/29 13:20:09 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -44,7 +44,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ class Image_3D_Light_Spotlight extends Image_3D_Light { http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Object/3ds.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/Image/3D/Paintable/Object/3ds.php diff -u pear/Image_3D/Image/3D/Paintable/Object/3ds.php:1.3 pear/Image_3D/Image/3D/Paintable/Object/3ds.php:1.4 --- pear/Image_3D/Image/3D/Paintable/Object/3ds.php:1.3 Sun Nov 6 15:40:56 2005 +++ pear/Image_3D/Image/3D/Paintable/Object/3ds.php Tue Nov 29 08:20:09 2005 @@ -1,133 +0,0 @@ -<?php - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * 3d Library - * - * PHP versions 5 - * - * LICENSE: - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: 3ds.php,v 1.3 2005/11/06 20:40:56 kore Exp $ - * @link http://pear.php.net/package/PackageName - * @since File available since Release 0.1.0 - */ - -require_once('Image/3D/Paintable/Object.php'); -require_once('Image/3D/Paintable/Object/3dsChunks.php'); - -/** - * Image_3D_Object_3ds - * - * - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName - * @since Class available since Release 0.1.0 - */ -class Image_3D_Object_3ds extends Image_3D_Object { - - protected $_file; - protected $_fileSize; - protected $_objects; - - protected $_chunks; - - public function __construct($file) { - parent::__construct(); - $this->_points = array(); - $this->_chunks = array(); - $this->_objects = array(); - - if (!is_file($file) || !is_readable($file)) { - throw new exception('3ds file could not be loaded.'); - } - $this->_file = $file; - - $this->_readChunks(); - } - - protected function _readChunks() { - $this->_chunks = new Image_3D_Chunk(Image_3D_Chunk::MAIN3DS, substr(file_get_contents($this->_file), 6)); - $this->_chunks->readChunks(); - - $editor = $this->_chunks->getFirstChunkByType(Image_3D_Chunk::EDIT3DS); - $editor->readChunks(); - - $objects = $editor->getChunksByType(Image_3D_Chunk::EDIT_OBJECT); - foreach ($objects as $object) { - $object = new Image_3D_Chunk_Object($object->getType(), $object->getContent()); - $object->readChunks($this); - } - } - - public function addObject($id) { - $id = (string) $id; - $this->_objects[$id] = new Image_3D_Object_3ds_Object(); - return $this->_objects[$id]; - } - - public function getObjectIDs() { - return array_keys($this->_objects); - } - - public function getObject($id) { - if (!@isset($this->_objects[$id])) return false; - return $this->_objects[$id]; - } - - public function paint() { - foreach ($this->_objects as $object) $object->paint(); - } - - public function getPolygonCount() { - $count = 0; - foreach ($this->_objects as $object) $count += $object->getPolygonCount(); - return $count; - } - - public function setColor(Image_3D_Color $color) { - foreach ($this->_objects as $object) $object->setColor($color); - } - - public function setOption($option, $value) { - foreach ($this->_objects as $object) $object->setOption($option, $value); - } - - public function transform(Image_3D_Matrix $matrix, $id = null) { - if ($id === null) $id = substr(md5(microtime()), 0, 8); - foreach ($this->_objects as $object) $object->transform($matrix, $id); - } - - public function getPolygones() { - $polygones = array(); - foreach ($this->_objects as $object) $polygones = array_merge($polygones, $object->getPolygones()); - return $polygones; - } -} - -?> http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Object/3dsChunks.php?r1=1.1&r2=1.2&ty=u Index: pear/Image_3D/Image/3D/Paintable/Object/3dsChunks.php diff -u pear/Image_3D/Image/3D/Paintable/Object/3dsChunks.php:1.1 pear/Image_3D/Image/3D/Paintable/Object/3dsChunks.php:1.2 --- pear/Image_3D/Image/3D/Paintable/Object/3dsChunks.php:1.1 Mon Jul 18 11:35:30 2005 +++ pear/Image_3D/Image/3D/Paintable/Object/3dsChunks.php Tue Nov 29 08:20:09 2005 @@ -150,132 +150,4 @@ } } -class Image_3D_Chunk_Object extends Image_3D_Chunk { - - protected $name; - - public function __construct($type, $content) { - parent::__construct($type, $content); - $this->getName(); - } - - protected function getName() { - $i = 0; - while ((ord($this->content{$i}) !== 0) && ($i < $this->size)) $this->name .= $this->content{$i++}; - $this->content = substr($this->content, $i + 1); - } - - public function readChunks(Image_3D_Object_3ds $k3ds) { - $subtype = $this->getWord(substr($this->content, 0, 2)); - $subcontent = substr($this->content, 6); - - switch ($subtype) { - case self::OBJ_TRIMESH: - $object = $k3ds->addObject($this->name); - $this->chunks[] = new Image_3D_Chunk_TriMesh($subtype, $subcontent, $object); - break; - } - } - - public function debug() { - echo 'Object: ', $this->name, "\n"; - parent::debug(); - } -} - -class Image_3D_Chunk_TriMesh extends Image_3D_Chunk { - - protected $matrix; - - protected $object; - - public function __construct($type, $content, $object) { - parent::__construct($type, $content); - - $this->object = $object; - - $this->readChunks(); - - $this->getPoints(); - $this->getFaces(); - } - - protected function getPoints() { - $vertexlists = $this->getChunksByType(Image_3D_Chunk::TRI_VERTEXL); - foreach ($vertexlists as $vertexlist) { - $points = $vertexlist->getContent(); - $count = $this->getWord(substr($points, 0, 2)); - $points = substr($points, 2); - - for ($i = 0; $i < $count; $i++) { - $x = $this->getFloat(substr($points, 0, 4)); - $y = $this->getFloat(substr($points, 4, 4)); - $z = $this->getFloat(substr($points, 8, 4)); - $this->object->newPoint($x, $y, $z); - $points = substr($points, 12); - } - } - } - - protected function getFaces() { - $facelists = $this->getChunksByType(Image_3D_Chunk::TRI_FACEL1); - foreach ($facelists as $facelist) { - $faces = $facelist->getContent(); - $count = $this->getWord(substr($faces, 0, 2)); - $faces = substr($faces, 2); - - for ($i = 0; $i < $count; $i++) { - $p1 = $this->getWord(substr($faces, 0, 2)); - $p2 = $this->getWord(substr($faces, 2, 2)); - $p3 = $this->getWord(substr($faces, 4, 2)); - $this->object->newPolygon($p1, $p2, $p3); - $faces = substr($faces, 8); - } - } - } - - protected function getTranslations() { - $translists = $this->getChunksByType(Image_3D_Chunk::TRI_LOCAL); - foreach ($translists as $translist) { - $trans = $translist->getContent(); - - echo "Trans: " . strlen($trans), "\n"; - } - } - - public function debug() { - parent::debug(); - printf("Trimesh with %d (0x%04x) points - Pointsize: %.2f\n", $this->pointCount, $this->pointCount, $this->size / $this->pointCount); - } -} - -class Image_3D_Object_3ds_Object extends Image_3D_Object { - - protected $_points; - - public function __construct() { - parent::__construct(); - - $this->_points = array(); - } - - public function newPoint($x, $y, $z) { - $this->_points[] = new Image_3D_Point($x, $y, $z); -// echo "New Point: $x, $y, $z -> ", count($this->_points), "\n"; - } - - public function newPolygon($p1, $p2, $p3) { - if (!isset($this->_points[$p1]) || !isset($this->_points[$p2]) || !isset($this->_points[$p3])) { -// printf("ERROR: Unknown point (%d, %d, %d of %d)\n", $p1, $p2, $p3, count($this->_points) - 1); - return false; - } - $this->_addPolygon(new Image_3D_Polygon($this->_points[$p1], $this->_points[$p2], $this->_points[$p3])); -// echo "New Polygon: $p1, $p2, $p3 -> ", count($this->_polygones), "\n"; - } - - public function debug() { - printf("Points: %d | Polygones: %d (%d)\n", count($this->_points), count($this->_polygones), $this->_polygonCount); - } -} - -?> \ No newline at end of file +class Image_3D_Chunk_Obj \ No newline at end of file http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Object/Cone.php?r1=1.2&r2=1.3&ty=u Index: pear/Image_3D/Image/3D/Paintable/Object/Cone.php diff -u pear/Image_3D/Image/3D/Paintable/Object/Cone.php:1.2 pear/Image_3D/Image/3D/Paintable/Object/Cone.php:1.3 --- pear/Image_3D/Image/3D/Paintable/Object/Cone.php:1.2 Sun Nov 6 18:07:54 2005 +++ pear/Image_3D/Image/3D/Paintable/Object/Cone.php Tue Nov 29 08:20:09 2005 @@ -1,35 +0,0 @@ -<?php - -require_once('Image/3D/Paintable/Object.php'); - -class Image_3D_Object_Cone extends Image_3D_Object { - - public function __construct($parameter) { - parent::__construct(); - - $radius = 1; - $height = 1; - $detail = max(3, (int) $parameter['detail']); - - // Generate points according to parameters - $top = new Image_3D_Point(0, $height, 0); - $bottom = new Image_3D_Point(0, 0, 0); - - $last = new Image_3D_Point(1, 0, 0); - $points[] = $last; - - for ($i = 1; $i <= $detail; ++$i) { - $actual = new Image_3D_Point(cos($i / $detail * 2 * pi()), 0, sin($i / $detail * 2 * pi())); - $points[] = $actual; - - // Build polygon - $this->_addPolygon(new Image_3D_Polygon($top, $last, $actual)); - $this->_addPolygon(new Image_3D_Polygon($bottom, $last, $actual)); - $last = $actual; - } - - // Build closing polygon - $this->_addPolygon(new Image_3D_Polygon($top, $last, $points[0])); - $this->_addPolygon(new Image_3D_Polygon($bottom, $last, $points[0])); - } -} http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Object/Cube.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/Image/3D/Paintable/Object/Cube.php diff -u pear/Image_3D/Image/3D/Paintable/Object/Cube.php:1.3 pear/Image_3D/Image/3D/Paintable/Object/Cube.php:1.4 --- pear/Image_3D/Image/3D/Paintable/Object/Cube.php:1.3 Sun Nov 6 15:40:56 2005 +++ pear/Image_3D/Image/3D/Paintable/Object/Cube.php Tue Nov 29 08:20:09 2005 @@ -1,105 +0,0 @@ -<?php - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * 3d Library - * - * PHP versions 5 - * - * LICENSE: - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Cube.php,v 1.3 2005/11/06 20:40:56 kore Exp $ - * @link http://pear.php.net/package/PackageName - * @since File available since Release 0.1.0 - */ - -require_once('Image/3D/Paintable/Object.php'); - -/** - * Image_3D_Object_Cube - * - * - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName - * @since Class available since Release 0.1.0 - */ -class Image_3D_Object_Cube extends Image_3D_Object { - - protected $_points; - - public function __construct($parameter) { - parent::__construct(); - - $x = (float) @$parameter[0]; - $y = (float) @$parameter[1]; - $z = (float) @$parameter[2]; - - $this->_points = array(); - - $this->_points[1] = new Image_3D_Point(-$x / 2, -$y / 2, -$z / 2); - $this->_points[2] = new Image_3D_Point(-$x / 2, -$y / 2, $z / 2); - - $this->_points[3] = new Image_3D_Point(-$x / 2, $y / 2, -$z / 2); - $this->_points[4] = new Image_3D_Point(-$x / 2, $y / 2, $z / 2); - - $this->_points[5] = new Image_3D_Point( $x / 2, -$y / 2, -$z / 2); - $this->_points[6] = new Image_3D_Point( $x / 2, -$y / 2, $z / 2); - - $this->_points[7] = new Image_3D_Point( $x / 2, $y / 2, -$z / 2); - $this->_points[8] = new Image_3D_Point( $x / 2, $y / 2, $z / 2); - - // Oben & Unten - $this->_addPolygon(new Image_3D_Polygon($this->_points[3], $this->_points[4], $this->_points[8])); - $this->_addPolygon(new Image_3D_Polygon($this->_points[3], $this->_points[8], $this->_points[7])); - - $this->_addPolygon(new Image_3D_Polygon($this->_points[2], $this->_points[1], $this->_points[6])); - $this->_addPolygon(new Image_3D_Polygon($this->_points[1], $this->_points[5], $this->_points[6])); - - // Links & Rechts - $this->_addPolygon(new Image_3D_Polygon($this->_points[3], $this->_points[2], $this->_points[4])); - $this->_addPolygon(new Image_3D_Polygon($this->_points[3], $this->_points[1], $this->_points[2])); - - $this->_addPolygon(new Image_3D_Polygon($this->_points[8], $this->_points[5], $this->_points[7])); - $this->_addPolygon(new Image_3D_Polygon($this->_points[8], $this->_points[6], $this->_points[5])); - - // Rueck- & Frontseite - $this->_addPolygon(new Image_3D_Polygon($this->_points[2], $this->_points[8], $this->_points[4])); - $this->_addPolygon(new Image_3D_Polygon($this->_points[2], $this->_points[6], $this->_points[8])); - - $this->_addPolygon(new Image_3D_Polygon($this->_points[1], $this->_points[7], $this->_points[5])); - $this->_addPolygon(new Image_3D_Polygon($this->_points[1], $this->_points[3], $this->_points[7])); - } - - public function getPoint($int) { - if (isset($this->_points[$int])) { - return $this->_points[$int]; - } else { - return false; - } - } -} \ No newline at end of file http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Object/Map.php?r1=1.4&r2=1.5&ty=u Index: pear/Image_3D/Image/3D/Paintable/Object/Map.php diff -u pear/Image_3D/Image/3D/Paintable/Object/Map.php:1.4 pear/Image_3D/Image/3D/Paintable/Object/Map.php:1.5 --- pear/Image_3D/Image/3D/Paintable/Object/Map.php:1.4 Mon Nov 7 08:43:24 2005 +++ pear/Image_3D/Image/3D/Paintable/Object/Map.php Tue Nov 29 08:20:09 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Map.php,v 1.4 2005/11/07 13:43:24 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Map.php,v 1.5 2005/11/29 13:20:09 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -45,7 +45,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ class Image_3D_Object_Map extends Image_3D_Object { http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Object/Pie.php?r1=1.4&r2=1.5&ty=u Index: pear/Image_3D/Image/3D/Paintable/Object/Pie.php diff -u pear/Image_3D/Image/3D/Paintable/Object/Pie.php:1.4 pear/Image_3D/Image/3D/Paintable/Object/Pie.php:1.5 --- pear/Image_3D/Image/3D/Paintable/Object/Pie.php:1.4 Mon Nov 7 08:43:24 2005 +++ pear/Image_3D/Image/3D/Paintable/Object/Pie.php Tue Nov 29 08:20:09 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Pie.php,v 1.4 2005/11/07 13:43:24 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Pie.php,v 1.5 2005/11/29 13:20:09 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -45,7 +45,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ class Image_3D_Object_Pie extends Image_3D_Object { http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Object/Polygon.php?r1=1.2&r2=1.3&ty=u Index: pear/Image_3D/Image/3D/Paintable/Object/Polygon.php diff -u pear/Image_3D/Image/3D/Paintable/Object/Polygon.php:1.2 pear/Image_3D/Image/3D/Paintable/Object/Polygon.php:1.3 --- pear/Image_3D/Image/3D/Paintable/Object/Polygon.php:1.2 Sun Nov 6 15:40:56 2005 +++ pear/Image_3D/Image/3D/Paintable/Object/Polygon.php Tue Nov 29 08:20:09 2005 @@ -1,60 +0,0 @@ -<?php - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * 3d Library - * - * PHP versions 5 - * - * LICENSE: - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Polygon.php,v 1.2 2005/11/06 20:40:56 kore Exp $ - * @link http://pear.php.net/package/PackageName - * @since File available since Release 0.1.0 - */ - -require_once('Image/3D/Paintable/Object.php'); - -/** - * Image_3D_Object_Cube - * - * - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName - * @since Class available since Release 0.1.0 - */ -class Image_3D_Object_Polygon extends Image_3D_Object { - - public function __construct($points) { - parent::__construct(); - - $polygon = new Image_3D_Polygon(); - foreach ($points as $point) $polygon->addPoint($point); - $this->_addPolygon($polygon); - } -} \ No newline at end of file http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Object/Sphere.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/Image/3D/Paintable/Object/Sphere.php diff -u pear/Image_3D/Image/3D/Paintable/Object/Sphere.php:1.3 pear/Image_3D/Image/3D/Paintable/Object/Sphere.php:1.4 --- pear/Image_3D/Image/3D/Paintable/Object/Sphere.php:1.3 Sun Nov 6 15:40:56 2005 +++ pear/Image_3D/Image/3D/Paintable/Object/Sphere.php Tue Nov 29 08:20:09 2005 @@ -27,8 +27,8 @@ * @author Kore Nordmann <3d@kore-nordmann.de> * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Sphere.php,v 1.3 2005/11/06 20:40:56 kore Exp $ - * @link http://pear.php.net/package/PackageName + * @version CVS: $Id: Sphere.php,v 1.4 2005/11/29 13:20:09 kore Exp $ + * @link http://pear.php.net/package/Image_3D * @since File available since Release 0.1.0 */ @@ -45,7 +45,7 @@ * @copyright 1997-2005 Kore Nordmann * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName + * @link http://pear.php.net/package/Image_3D * @since Class available since Release 0.1.0 */ class Image_3D_Object_Sphere extends Image_3D_Object { @@ -115,13 +115,4 @@ $this->_virtualPolygon[] = array(0, 1, 3); $this->_virtualPolygon[] = array(1, 2, 3); - $this->_virtualPolygon[] = array(0, 2, 1); - $this->_virtualPolygon[] = array(0, 3, 2); - } - - protected function _getRealPolygones() { - foreach ($this->_virtualPolygon as $points) { - $this->_addPolygon(new Image_3D_Polygon($this->_points[$points[0]], $this->_points[$points[1]], $this->_points[$points[2]])); - } - } -} \ No newline at end of file + $this->_virtualPolygo \ No newline at end of file http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Object/Text.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/Image/3D/Paintable/Object/Text.php diff -u pear/Image_3D/Image/3D/Paintable/Object/Text.php:1.3 pear/Image_3D/Image/3D/Paintable/Object/Text.php:1.4 --- pear/Image_3D/Image/3D/Paintable/Object/Text.php:1.3 Sun Nov 6 15:40:56 2005 +++ pear/Image_3D/Image/3D/Paintable/Object/Text.php Tue Nov 29 08:20:09 2005 @@ -1,102 +0,0 @@ -<?php - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * 3d Library - * - * PHP versions 5 - * - * LICENSE: - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Text.php,v 1.3 2005/11/06 20:40:56 kore Exp $ - * @link http://pear.php.net/package/PackageName - * @since File available since Release 0.1.0 - */ - -require_once('Image/3D/Matrix/Move.php'); -require_once('Image/3D/Paintable/Object.php'); -require_once('Image/3D/Paintable/Object/Cube.php'); - -/** - * Image_3D_Object_Text - * - * - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName - * @since Class available since Release 0.1.0 - */ -class Image_3D_Object_Text extends Image_3D_Object { - - protected $_text; - protected $_characterSpacing; - - protected $_chars; - - public function __construct($string) { - parent::__construct(); - - $this->_text = (string) $string; - $this->_points = array(); - $this->_characterSpacing = 5.5; - - $textdata = '@data_dir@/Image_3D/data/TextData.dat'; - if (is_readable($textdata)) { - $this->_chars = unserialize(file_get_contents($textdata)); - } elseif (is_readable('data/TextData.dat')) { - $this->_chars = unserialize(file_get_contents('data/TextData.dat')); - } else { - throw new Exception('File for textdata not found.'); - } - - $this->_generateCubes(); - } - - public function setCharSpacing($charSpacing) { - $this->_characterSpacing = 5 + (float) $charSpacing; - } - - protected function _generateCubes() { - $length = strlen($this->_text); - - for ($i = 0; $i < $length; $i++) { - $char = $this->_chars[ord($this->_text{$i})]; - foreach ($char as $x => $row) { - foreach ($row as $y => $pixel) { -//printf("Dot %d %.1f %.1f\n", $pixel, $x + $i * $this->_characterSpacing, $y); - if ($pixel) { - $tmp = new Image_3D_Object_Cube(array(1, 1, 1)); - $tmp->transform(new Image_3D_Matrix_Move(array($x + $i * $this->_characterSpacing, $y, 0))); - $polygones = $tmp->getPolygones(); - foreach ($polygones as $polygon) $this->_addPolygon($polygon); - unset($tmp); - } - } - } - } - } -} http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Paintable/Object/Torus.php?r1=1.1&r2=1.2&ty=u Index: pear/Image_3D/Image/3D/Paintable/Object/Torus.php diff -u pear/Image_3D/Image/3D/Paintable/Object/Torus.php:1.1 pear/Image_3D/Image/3D/Paintable/Object/Torus.php:1.2 --- pear/Image_3D/Image/3D/Paintable/Object/Torus.php:1.1 Sun Nov 6 15:46:35 2005 +++ pear/Image_3D/Image/3D/Paintable/Object/Torus.php Tue Nov 29 08:20:09 2005 @@ -1,93 +0,0 @@ -<?php - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * 3d Library - * - * PHP versions 5 - * - * LICENSE: - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Torus.php,v 1.1 2005/11/06 20:46:35 kore Exp $ - * @link http://pear.php.net/package/PackageName - * @since File available since Release 0.1.0 - */ - -require_once('Image/3D/Paintable/Object.php'); - -/** - * Image_3D_Object_Sphere - * - * - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName - * @since Class available since Release 0.1.0 - */ -class Image_3D_Object_Torus extends Image_3D_Object { - - public function __construct($options) { - parent::__construct(); - - $inner_radius = (float) $options['inner_radius']; - $outer_radius = (float) $options['outer_radius']; - - $r1 = ($outer_radius - $inner_radius) / 2; - $r2 = $inner_radius + $r1; - - $d1 = (int) round(max(1, $options['detail_1']) * 4); - $d2 = (int) round(max(1, $options['detail_2']) * 4); - - $rings = array(); - for ($i = 0; $i < $d1; ++$i) { - $rings[$i] = array(); - for ($j = 0; $j < $d2; ++$j) { - $_i = $i / $d1; - $_j = $j / $d2; - - $z = cos($_j * pi() * 2) * $r1; - $z2 = sin($_j * pi() * 2) * $r1; - - $x = ($r2 + $z2) * cos($_i * pi() * 2); - $y = ($r2 + $z2) * sin($_i * pi() * 2); - - $rings[$i][] = new Image_3D_Point($x, $y, $z); - } - } - - foreach($rings as $i => $ring) { - $i_next = ($i + 1) % count($rings); - foreach($ring as $j => $point) { - $j_next = ($j + 1) % count($ring); - - $this->_addPolygon(new Image_3D_Polygon($rings[$i_next][$j], $rings[$i][$j], $rings[$i][$j_next])); - $this->_addPolygon(new Image_3D_Polygon($rings[$i_next][$j], $rings[$i][$j_next], $rings[$i_next][$j_next])); - } - } - } - -} \ No newline at end of file http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Renderer/Isometric.php?r1=1.4&r2=1.5&ty=u Index: pear/Image_3D/Image/3D/Renderer/Isometric.php diff -u pear/Image_3D/Image/3D/Renderer/Isometric.php:1.4 pear/Image_3D/Image/3D/Renderer/Isometric.php:1.5 --- pear/Image_3D/Image/3D/Renderer/Isometric.php:1.4 Sun Nov 6 15:40:56 2005 +++ pear/Image_3D/Image/3D/Renderer/Isometric.php Tue Nov 29 08:20:09 2005 @@ -1,90 +0,0 @@ -<?php - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * 3d Library - * - * PHP versions 5 - * - * LICENSE: - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Isometric.php,v 1.4 2005/11/06 20:40:56 kore Exp $ - * @link http://pear.php.net/package/PackageName - * @since File available since Release 0.1.0 - */ - -// {{{ Image_3D_Renderer_Isometric - -/** - * Image_3D_Renderer_Isometric - * - * - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName - * @since Class available since Release 0.1.0 - */ -class Image_3D_Renderer_Isometric extends Image_3D_Renderer { - - // {{{ _calculateScreenCoordiantes() - - /** - * Caclulate Screen Coordinates - * - * Calculate isometric screen coordinates for a point - * - * @param Image_3D_Point $point Point to process - * @return void - */ - protected function _calculateScreenCoordiantes(Image_3D_Point $point) { - $point->setScreenCoordinates( - $point->getX() - ($point->getZ() * .35) + $this->_size[0], - $point->getY() + ($point->getZ() * .35) + $this->_size[1] - ); - } - - // }}} - // {{{ _sortPolygones() - - /** - * Sort polygones - * - * Sort the polygones depending on their medium depth - * - * @return void - */ - protected function _sortPolygones() { - $polygoneDepth = array(); - foreach ($this->_polygones as $polygon) $polygoneDepth[] = $polygon->getMidZ(); - - array_multisort($polygoneDepth, SORT_DESC, SORT_NUMERIC, $this->_polygones); - } - - // }}} -} - -// }}} http://cvs.php.net/diff.php/pear/Image_3D/Image/3D/Renderer/Perspectively.php?r1=1.5&r2=1.6&ty=u Index: pear/Image_3D/Image/3D/Renderer/Perspectively.php diff -u pear/Image_3D/Image/3D/Renderer/Perspectively.php:1.5 pear/Image_3D/Image/3D/Renderer/Perspectively.php:1.6 --- pear/Image_3D/Image/3D/Renderer/Perspectively.php:1.5 Sun Nov 6 15:40:56 2005 +++ pear/Image_3D/Image/3D/Renderer/Perspectively.php Tue Nov 29 08:20:09 2005 @@ -1,93 +0,0 @@ -<?php - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -/** - * 3d Library - * - * PHP versions 5 - * - * LICENSE: - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version CVS: $Id: Perspectively.php,v 1.5 2005/11/06 20:40:56 kore Exp $ - * @link http://pear.php.net/package/PackageName - * @since File available since Release 0.1.0 - */ - -// {{{ Image_3D_Renderer_Perspectively - -/** - * Image_3D_Renderer_Perspectively - * - * - * - * @category Image - * @package Image_3D - * @author Kore Nordmann <3d@kore-nordmann.de> - * @copyright 1997-2005 Kore Nordmann - * @license http://www.gnu.org/licenses/lgpl.txt lgpl 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/PackageName - * @since Class available since Release 0.1.0 - */ -class Image_3D_Renderer_Perspectively extends Image_3D_Renderer { - - // {{{ _calculateScreenCoordiantes() - - /** - * Caclulate Screen Coordinates - * - * Calculate perspectively screen coordinates for a point - * - * @param Image_3D_Point $point Point to process - * @return void - */ - protected function _calculateScreenCoordiantes(Image_3D_Point $point) { - $viewpoint = 500.; - $distance = 500.; - - $point->setScreenCoordinates( - $viewpoint * $point->getX() / ($point->getZ() + $distance) + $this->_size[0], - $viewpoint * $point->getY() / ($point->getZ() + $distance) + $this->_size[1] - ); - } - - // }}} - // {{{ _sortPolygones() - - /** - * Sort polygones - * - * Sort the polygones depending on their medium depth - * - * @return void - */ - protected function _sortPolygones() { - $polygoneDepth = array(); - foreach ($this->_polygones as $polygon) $polygoneDepth[] = $polygon->getMidZ(); - - array_multisort($polygoneDepth, SORT_DESC, SORT_NUMERIC, $this->_polygones); - } - - // }}} -} - -// }}} http://cvs.php.net/diff.php/pear/Image_3D/docs/examples/cone.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/docs/examples/cone.php diff -u pear/Image_3D/docs/examples/cone.php:1.3 pear/Image_3D/docs/examples/cone.php:1.4 --- pear/Image_3D/docs/examples/cone.php:1.3 Sat Nov 12 07:57:55 2005 +++ pear/Image_3D/docs/examples/cone.php Tue Nov 29 08:20:09 2005 @@ -1,27 +0,0 @@ -<?php - -set_time_limit(0); -require_once('Image/3D.php'); - -$world = new Image_3D(); -$world->setColor(new Image_3D_Color(255, 255, 255)); - -$light = $world->createLight('Light', array(-200, -200, -200)); -$light->setColor(new Image_3D_Color(0, 0, 255)); - -$light2 = $world->createLight('Light', array(200, -200, -200)); -$light2->setColor(new Image_3D_Color(255, 0, 0)); - -$cone = $world->createObject('cone', array('detail' => 20)); -$cone->setColor(new Image_3D_Color(255, 255, 255, 200)); - -$cone->transform($world->createMatrix('Scale', array(100, 400, 100))); -$cone->transform($world->createMatrix('Move', array(0, -80, 0))); -$cone->transform($world->createMatrix('Rotation', array(150, 30, 30))); - -$world->createRenderer('perspectively'); -$world->createDriver('GD'); -$world->render(400, 400, 'Image_3D_Object_Cone.png'); - -echo $world->stats( ); - http://cvs.php.net/diff.php/pear/Image_3D/docs/examples/cubes.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/docs/examples/cubes.php diff -u pear/Image_3D/docs/examples/cubes.php:1.3 pear/Image_3D/docs/examples/cubes.php:1.4 --- pear/Image_3D/docs/examples/cubes.php:1.3 Sat Nov 12 07:57:55 2005 +++ pear/Image_3D/docs/examples/cubes.php Tue Nov 29 08:20:09 2005 @@ -1,44 +0,0 @@ -<?php - -set_time_limit(0); -require_once('Image/3D.php'); - -$world = new Image_3D(); -$world->setColor(new Image_3D_Color(240, 240, 240)); - -$light1 = $world->createLight('Light', array(-300, 0, -300)); -$light1->setColor(new Image_3D_Color(100, 100, 255)); - -$light2 = $world->createLight('Light', array(300, -300, -300)); -$light2->setColor(new Image_3D_Color(100, 255, 100)); - -$count = 3; - -$size = 20; -$offset = 10; - -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('cube', array($size, $size, $size)); - $cube->setColor(new Image_3D_Color(255, 255, 255)); - $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('GD'); -$world->render(400, 400, 'Image_3D_Cubes.png'); - -echo $world->stats(); - http://cvs.php.net/diff.php/pear/Image_3D/docs/examples/map.php?r1=1.6&r2=1.7&ty=u Index: pear/Image_3D/docs/examples/map.php diff -u pear/Image_3D/docs/examples/map.php:1.6 pear/Image_3D/docs/examples/map.php:1.7 --- pear/Image_3D/docs/examples/map.php:1.6 Sat Nov 12 07:57:55 2005 +++ pear/Image_3D/docs/examples/map.php Tue Nov 29 08:20:09 2005 @@ -1,41 +0,0 @@ -<?php - -set_time_limit(0); -require_once('Image/3D.php'); - -$world = new Image_3D(); -$world->setColor(new Image_3D_Color(255, 255, 255)); - -$light1 = $world->createLight('Light', array(-20, -20, -20)); -$light1->setColor(new Image_3D_Color(255, 255, 255)); - -$light2 = $world->createLight('Light', array(20, 20, -20)); -$light2->setColor(new Image_3D_Color(0, 200, 0)); - -$map = $world->createObject('map'); - -$detail = 30; -$size = 150; -$height = 40; - -$raster = 1 / $detail; -for ($x = -1; $x <= 1; $x += $raster) { - $row = array(); - for ($y = -1; $y <= 1; $y += $raster) { - $row[] = new Image_3D_Point($x * $size, $y * $size, sin($x * pi()) * sin($y * 2 * pi()) * $height); - } - $map->addRow($row); -} - -$map->setColor(new Image_3D_Color(150, 150, 150, 0)); -$map->transform($world->createMatrix('Rotation', array(-40, 20, -10))); - -$world->setOption(Image_3D::IMAGE_3D_OPTION_BF_CULLING, false); -$world->setOption(Image_3D::IMAGE_3D_OPTION_FILLED, true); - -$world->createRenderer('perspectively'); -$world->createDriver('GD'); -$world->render(400, 400, 'Image_3D_Object_Map.png'); - -echo $world->stats(); - http://cvs.php.net/diff.php/pear/Image_3D/docs/examples/pie.php?r1=1.4&r2=1.5&ty=u Index: pear/Image_3D/docs/examples/pie.php diff -u pear/Image_3D/docs/examples/pie.php:1.4 pear/Image_3D/docs/examples/pie.php:1.5 --- pear/Image_3D/docs/examples/pie.php:1.4 Sat Nov 12 07:57:55 2005 +++ pear/Image_3D/docs/examples/pie.php Tue Nov 29 08:20:09 2005 @@ -1,35 +0,0 @@ -<?php - -set_time_limit(0); -require_once('Image/3D.php'); - -$world = new Image_3D(); -$world->setColor(new Image_3D_Color(255, 255, 255)); - -$light = $world->createLight('Light', array(0, 1000, 1000)); -$light->setColor(new Image_3D_Color(255, 255, 255)); - -$pie = $world->createObject('pie', array('start' => 0, 'end' => 120, 'detail' => 20, 'outside' => 150)); -$pie->setColor(new Image_3D_Color(0, 0, 255)); - -$pie = $world->createObject('pie', array('start' => 120, 'end' => 165, 'detail' => 20, 'outside' => 150)); -$pie->setColor(new Image_3D_Color(255, 0, 0)); - -$pie = $world->createObject('pie', array('start' => 165, 'end' => 240, 'detail' => 20, 'outside' => 150)); -$pie->setColor(new Image_3D_Color(255, 255, 0)); - -$pie = $world->createObject('pie', array('start' => 240, 'end' => 360, 'detail' => 20, 'outside' => 150)); -$pie->setColor(new Image_3D_Color(0, 255, 0)); - -$world->setOption(Image_3D::IMAGE_3D_OPTION_BF_CULLING, false); -$world->setOption(Image_3D::IMAGE_3D_OPTION_FILLED, true); - -$world->transform($world->createMatrix('Scale', array(1, 1, 10))); -$world->transform($world->createMatrix('Rotation', array(-60, 0, 0))); - -$world->createRenderer('perspectively'); -$world->createDriver('ZBuffer'); -$world->render(400, 400, 'Image_3D_Object_Pie.png'); - -echo $world->stats( ); - http://cvs.php.net/diff.php/pear/Image_3D/docs/examples/pointlight.php?r1=1.1&r2=1.2&ty=u Index: pear/Image_3D/docs/examples/pointlight.php diff -u pear/Image_3D/docs/examples/pointlight.php:1.1 pear/Image_3D/docs/examples/pointlight.php:1.2 --- pear/Image_3D/docs/examples/pointlight.php:1.1 Tue Nov 15 05:53:58 2005 +++ pear/Image_3D/docs/examples/pointlight.php Tue Nov 29 08:20:09 2005 @@ -1,31 +0,0 @@ -<?php - -set_time_limit(0); -require_once('Image/3D.php'); - -$world = new Image_3D(); -$world->setColor(new Image_3D_Color(250, 250, 250)); - -$light = $world->createLight('Point', array(0, -200, 0, 'distance' => 300, 'falloff' => 2)); -$light->setColor(new Image_3D_Color(150, 150, 255)); - -$steps = 10; -$step = 20; - -for ($i = 0; $i < $steps; ++$i) { - $y = ($steps * $step / -2) + $i * $step; - $p = $world->createObject('polygon', array(new Image_3D_Point(-100, $y, -30), new Image_3D_Point(-100, $y, 50), new Image_3D_Point(100, $y, 40))); - $p->setColor(new Image_3D_Color(255, 255, 255)); -} - -$world->transform($world->createMatrix('Rotation', array(20, 0, 0))); - -$world->setOption(Image_3D::IMAGE_3D_OPTION_BF_CULLING, false); -$world->setOption(Image_3D::IMAGE_3D_OPTION_FILLED, true); - -$world->createRenderer('perspectively'); -$world->createDriver('ZBuffer'); -$world->render(400, 400, 'Image_3D_Pointlight.png'); - -echo $world->stats( ); - http://cvs.php.net/diff.php/pear/Image_3D/docs/examples/sphere.php?r1=1.4&r2=1.5&ty=u Index: pear/Image_3D/docs/examples/sphere.php diff -u pear/Image_3D/docs/examples/sphere.php:1.4 pear/Image_3D/docs/examples/sphere.php:1.5 --- pear/Image_3D/docs/examples/sphere.php:1.4 Sat Nov 12 07:57:55 2005 +++ pear/Image_3D/docs/examples/sphere.php Tue Nov 29 08:20:09 2005 @@ -1,24 +0,0 @@ -<?php - -set_time_limit(0); -require_once('Image/3D.php'); - -$world = new Image_3D(); -$world->setColor(new Image_3D_Color(255, 255, 255)); - -$light = $world->createLight('Light', array(-2000, -2000, -2000)); -$light->setColor(new Image_3D_Color(255, 255, 255)); - -$redLight = $world->createLight('Light', array(90, 0, 50)); -$redLight->setColor(new Image_3D_Color(255, 0, 0)); - -$sphere = $world->createObject('sphere', array('r' => 150, 'detail' => 4)); -$sphere->setColor(new Image_3D_Color(150, 150, 150)); - -$renderer = $world->createRenderer('perspectively'); - -$world->createDriver('GD'); -$world->render(400, 400, 'example.png'); - -echo $world->stats(); - http://cvs.php.net/diff.php/pear/Image_3D/docs/examples/spotlights.php?r1=1.1&r2=1.2&ty=u Index: pear/Image_3D/docs/examples/spotlights.php diff -u pear/Image_3D/docs/examples/spotlights.php:1.1 pear/Image_3D/docs/examples/spotlights.php:1.2 --- pear/Image_3D/docs/examples/spotlights.php:1.1 Sat Nov 12 07:40:36 2005 +++ pear/Image_3D/docs/examples/spotlights.php Tue Nov 29 08:20:09 2005 @@ -1,46 +0,0 @@ -<?php - -set_time_limit(0); -set_include_path(dirname(__FILE__) . '/../..'); -require_once('Image/3D.php'); - -$world = new Image_3D(); -$world->setColor(new Image_3D_Color(255, 255, 255)); - -$light = $world->createLight('Light', array(-2000, -2000, -2000)); -$light->setColor(new Image_3D_Color(255, 255, 255)); - -$redSpot = $world->createLight('Spotlight', array(0, 0, -200, 'aim' => array(0, -25, 0), 'angle' => 30, 'float' => 2)); -$redSpot->setColor(new Image_3D_Color(255, 0, 0)); - -$blueSpot = $world->createLight('Spotlight', array(0, 0, -200, 'aim' => array(-35, 25, 0), 'angle' => 30, 'float' => 2)); -$blueSpot->setColor(new Image_3D_Color(0, 0, 255)); - -$greenSpot = $world->createLight('Spotlight', array(0, 0, -200, 'aim' => array(35, 25, 0), 'angle' => 30, 'float' => 2)); -$greenSpot->setColor(new Image_3D_Color(0, 255, 0)); - -$map = $world->createObject('map'); - -$detail = 80; -$size = 200; -$height = 40; - -$raster = 1 / $detail; -for ($x = -1; $x <= 1; $x += $raster) { - $row = array(); - for ($y = -1; $y <= 1; $y += $raster) { - $row[] = new Image_3D_Point($x * $size, $y * $size, sin($x * pi()) * sin($y * 2 * pi()) * $height); - } - $map->addRow($row); -} - -$map->setColor(new Image_3D_Color(150, 150, 150, 0)); - -$world->transform($world->createMatrix('Rotation', array(-20, 10, -10))); - -$world->createRenderer('perspectively'); -$world->createDriver('GD'); -$world->render(400, 400, 'Image_3D_Spotlights.png'); - -echo $world->stats(); - http://cvs.php.net/diff.php/pear/Image_3D/docs/examples/text.php?r1=1.5&r2=1.6&ty=u Index: pear/Image_3D/docs/examples/text.php diff -u pear/Image_3D/docs/examples/text.php:1.5 pear/Image_3D/docs/examples/text.php:1.6 --- pear/Image_3D/docs/examples/text.php:1.5 Sat Nov 12 07:57:55 2005 +++ pear/Image_3D/docs/examples/text.php Tue Nov 29 08:20:09 2005 @@ -1,26 +0,0 @@ -<?php - -set_time_limit(0); -require_once('Image/3D.php'); - -$world = new Image_3D(); -$world->setColor(new Image_3D_Color(240, 240, 240)); - -$light = $world->createLight('Light', array(-20, -20, -20)); -$light->setColor(new Image_3D_Color(100, 100, 255)); - -$text = $world->createObject('text', 'Image_3D_Object_Text'); -$text->setColor(new Image_3D_Color(150, 150, 150)); -$text->transform($world->createMatrix('Rotation', array(0, 10, 0))); -$text->transform($world->createMatrix('Move', array(-50, 0, 20))); -$text->transform($world->createMatrix('Scale', array(3, 3, 3))); - -$world->setOption(Image_3D::IMAGE_3D_OPTION_BF_CULLING, false); -$world->setOption(Image_3D::IMAGE_3D_OPTION_FILLED, true); - -$world->createRenderer('perspectively'); -$world->createDriver('GD'); -$world->render(400, 50, 'Image_3D_Object_Text.png'); - -echo $world->stats( ); - http://cvs.php.net/diff.php/pear/Image_3D/docs/examples/torus.php?r1=1.3&r2=1.4&ty=u Index: pear/Image_3D/docs/examples/torus.php diff -u pear/Image_3D/docs/examples/torus.php:1.3 pear/Image_3D/docs/examples/torus.php:1.4 --- pear/Image_3D/docs/examples/torus.php:1.3 Sat Nov 12 07:57:55 2005 +++ pear/Image_3D/docs/examples/torus.php Tue Nov 29 08:20:09 2005 @@ -1,25 +0,0 @@ -<?php - -set_time_limit(0); -require_once('Image/3D.php'); - -$world = new Image_3D(); -$world->setColor(new Image_3D_Color(255, 255, 255)); - -$light = $world->createLight('Light', array(-2000, -2000, -2000)); -$light->setColor(new Image_3D_Color(255, 255, 255)); - -$redLight = $world->createLight('Light', array(90, 0, 50)); -$redLight->setColor(new Image_3D_Color(255, 0, 0)); - -$torus = $world->createObject('torus', array('inner_radius' => 110, 'outer_radius' => 170, 'detail_1' => 60, 'detail_2' => 30)); -$torus->setColor(new Image_3D_Color(150, 150, 150)); -$torus->transform($world->createMatrix('Rotation', array(60, -10, 0))); - -$renderer = $world->createRenderer('perspectively'); - -$world->createDriver('GD'); -$world->render(500, 500, 'Image_3D_Object_Torus.png'); - -echo $world->stats(); - http://cvs.php.net/diff.php/pear/Image_3D/docs/examples/zbuffer.php?r1=1.5&r2=1.6&ty=u Index: pear/Image_3D/docs/examples/zbuffer.php diff -u pear/Image_3D/docs/examples/zbuffer.php:1.5 pear/Image_3D/docs/examples/zbuffer.php:1.6 --- pear/Image_3D/docs/examples/zbuffer.php:1.5 Sat Nov 12 07:57:55 2005 +++ pear/Image_3D/docs/examples/zbuffer.php Tue Nov 29 08:20:09 2005 @@ -1,32 +0,0 @@ -<?php - -set_time_limit(0); -require_once('Image/3D.php'); - -$world = new Image_3D(); -$world->setColor(new Image_3D_Color(50, 50, 50)); - -$light1 = $world->createLight('Light', array(-20, -20, -20)); -$light1->setColor(new Image_3D_Color(255, 255, 255)); - -$light2 = $world->createLight('Light', array(20, 20, -20)); -$light2->setColor(new Image_3D_Color(0, 200, 0)); - -$p1 = $world->createObject('polygon', array(new Image_3D_Point(-30, 100, 0), new Image_3D_Point(-30, -150, 0), new Image_3D_Point(80, 0, 30))); -$p1->setColor(new Image_3D_Color(100, 200, 100)); -$p2 = $world->createObject('polygon', array(new Image_3D_Point(-100, 50, 30), new Image_3D_Point(-70, -100, -20), new Image_3D_Point(150, 90, 0))); -$p2->setColor(new Image_3D_Color(100, 100, 200)); -$p2 = $world->createObject('polygon', array(new Image_3D_Point(-30, 20, -50), new Image_3D_Point(-50, -30, -80), new Image_3D_Point(50, 30, 40))); -$p2->setColor(new Image_3D_Color(200, 100, 100, 100)); - -$world->transform($world->createMatrix('Rotation', array(90, 90, 0))); - -$world->setOption(Image_3D::IMAGE_3D_OPTION_BF_CULLING, false); -$world->setOption(Image_3D::IMAGE_3D_OPTION_FILLED, true); - -$world->createRenderer('perspectively'); -$world->createDriver('ZBuffer'); -$world->render(400, 400, 'Image_3D_ZBuffer.png'); - -echo $world->stats( ); -
« previous php.pear.cvs (#36591) next »