當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Render::renderMesh方法代碼示例

本文整理匯總了PHP中Render::renderMesh方法的典型用法代碼示例。如果您正苦於以下問題:PHP Render::renderMesh方法的具體用法?PHP Render::renderMesh怎麽用?PHP Render::renderMesh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Render的用法示例。


在下文中一共展示了Render::renderMesh方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Vertex

    $hl = $l / 2.0;
    $a = new Vertex(array('x' => $x - $hl, 'y' => $y + $hl, 'z' => $z + $hl, 'color' => $red));
    $b = new Vertex(array('x' => $x + $hl, 'y' => $y + $hl, 'z' => $z + $hl, 'color' => $green));
    $c = new Vertex(array('x' => $x + $hl, 'y' => $y + $hl, 'z' => $z - $hl, 'color' => $blue));
    $d = new Vertex(array('x' => $x - $hl, 'y' => $y + $hl, 'z' => $z - $hl, 'color' => $yellow));
    $e = new Vertex(array('x' => $x - $hl, 'y' => $y - $hl, 'z' => $z + $hl, 'color' => $magenta));
    $f = new Vertex(array('x' => $x + $hl, 'y' => $y - $hl, 'z' => $z + $hl, 'color' => $cyan));
    $g = new Vertex(array('x' => $x + $hl, 'y' => $y - $hl, 'z' => $z - $hl, 'color' => $grey));
    $h = new Vertex(array('x' => $x - $hl, 'y' => $y - $hl, 'z' => $z - $hl, 'color' => $white));
    return array(new Triangle($a, $c, $b), new Triangle($a, $d, $c), new Triangle($e, $g, $h), new Triangle($e, $f, $g), new Triangle($e, $b, $f), new Triangle($a, $b, $e), new Triangle($d, $g, $c), new Triangle($d, $h, $g), new Triangle($a, $e, $h), new Triangle($a, $h, $d), new Triangle($f, $c, $g), new Triangle($f, $b, $c));
}
$v = new Vector(array('dest' => new Vertex(array('x' => 20.0, 'y' => 20.0, 'z' => 0.0))));
$T = new Matrix(array('preset' => Matrix::TRANSLATION, 'vtc' => $v));
$S = new Matrix(array('preset' => Matrix::SCALE, 'scale' => 10.0));
$RY = new Matrix(array('preset' => Matrix::RY, 'angle' => M_PI_4));
$RX = new Matrix(array('preset' => Matrix::RX, 'angle' => M_PI_4));
$cam = new Camera(array('origin' => new Vertex(array('x' => 15.0, 'y' => 15.0, 'z' => 80.0)), 'orientation' => new Matrix(array('preset' => Matrix::RY, 'angle' => M_PI)), 'width' => 640, 'height' => 480, 'fov' => 60, 'near' => 1.0, 'far' => 100.0));
$renderer = new Render(640, 480, 'pic.png');
$origin = new Vertex(array('x' => 0.0, 'y' => 0.0, 'z' => 0.0));
$origin = $cam->watchVertex($origin);
$repere = makeRepere();
$repere = $S->transformMesh($repere);
$repere = $cam->watchMesh($repere);
$renderer->renderMesh($repere, Render::EDGE);
$renderer->renderVertex($origin);
$cube = makeColoredCube(0.0, 0.0, 0.0, 1.0);
$M = $T->mult($RX)->mult($RY)->mult($S);
$cube = $M->transformMesh($cube);
$cube = $cam->watchMesh($cube);
$renderer->renderMesh($cube, Render::RASTERIZE);
$renderer->develop();
開發者ID:samiateber,項目名稱:42,代碼行數:31,代碼來源:main_05.php


注:本文中的Render::renderMesh方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。