/**
  * @GET
  */
 public function poke($pk_, Color $color_ = null, Boolean $log_ = null)
 {
     if (null === $color_) {
         $color_ = Color::white();
     }
     Log::info('rest/resource/test', 'Poke %s', $color_);
     return $color_->toRgbString();
 }
Пример #2
0
        $color->g = self::legalize($c->g);
        $color->b = self::legalize($c->b);
        return $color;
    }
    static function legalize($c)
    {
        if ($c < 0) {
            $c = 0;
        }
        if ($c > 1) {
            $c = 1;
        }
        return (int) ($c * 255);
    }
}
Color::$white = new Color(1.0, 1.0, 1.0);
Color::$grey = new Color(0.5, 0.5, 0.5);
Color::$black = new Color(0.0, 0.0, 0.0);
Color::$background = Color::$black;
Color::$defaultColor = Color::$black;
class Camera
{
    public $forward;
    public $right;
    public $up;
    public $pos;
    public function __construct(Vector $pos, Vector $lookAt)
    {
        $this->pos = $pos;
        $down = new Vector(0.0, -1.0, 0.0);
        $this->forward = Vector::norm(Vector::minus($lookAt, $this->pos));