Browse Source

渲染测式 案例 开发

master
yuanjiajia 1 year ago
parent
commit
25fd9e6baa
  1. 16
      examples/renderTest.php

16
examples/renderTest.php

@ -38,6 +38,7 @@ const CLOSE = false | 0;
* 标准材质长宽 * 标准材质长宽
*/ */
const MAT_STANDARD_SIZE = 1000; const MAT_STANDARD_SIZE = 1000;
const UNIT_CONVERSION_MM_TO_M = 0.001;
@ -246,12 +247,21 @@ foreach($taskModel->childsParams as $childParams){
// 三、创建相机 // 三、创建相机
$position = $taskCamera->position;
$position->x = $position->x * UNIT_CONVERSION_MM_TO_M;
$position->y = $position->y * UNIT_CONVERSION_MM_TO_M;
$position->z = $position->z * UNIT_CONVERSION_MM_TO_M;
$target = $taskCamera->target;
$target->x = $target->x * UNIT_CONVERSION_MM_TO_M;
$target->y = $target->y * UNIT_CONVERSION_MM_TO_M;
$target->z = $target->z * UNIT_CONVERSION_MM_TO_M;
$rotation = $taskCamera->rotation;
$camera = new camera\Perspective( $camera = new camera\Perspective(
[ [
'autovolumeEnable' => 0, 'autovolumeEnable' => 0,
'lookatOrig' => "{$taskCamera->position->x} {$taskCamera->position->y} {$taskCamera->position->z}",
'lookatTarget' => "{$taskCamera->target->x} {$taskCamera->target->y} {$taskCamera->target->z}",
'up' => "{$taskCamera->rotation->x} {$taskCamera->rotation->y} {$taskCamera->rotation->z}",
'lookatOrig' => "{$position->x} {$position->y} {$position->z}",
'lookatTarget' => "{$target->x} {$target->y} {$target->z}",
'up' => "{$rotation->x} {$rotation->y} {$rotation->z}",
'screenwindow' => "-1 1 -1 1", 'screenwindow' => "-1 1 -1 1",
'autofocusEnable' => 0, 'autofocusEnable' => 0,
'fieldofview' => $taskCamera->fov, 'fieldofview' => $taskCamera->fov,

Loading…
Cancel
Save