From 25fd9e6baa03ad25a15c3029911cd9f3899046c9 Mon Sep 17 00:00:00 2001 From: yuanjiajia <1139393632@qq.com> Date: Wed, 7 Jun 2023 22:19:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B2=E6=9F=93=E6=B5=8B=E5=BC=8F=20?= =?UTF-8?q?=E6=A1=88=E4=BE=8B=20=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/renderTest.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/examples/renderTest.php b/examples/renderTest.php index f79547c..e5eced7 100644 --- a/examples/renderTest.php +++ b/examples/renderTest.php @@ -38,6 +38,7 @@ const CLOSE = false | 0; * 标准材质长宽 */ 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( [ '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", 'autofocusEnable' => 0, 'fieldofview' => $taskCamera->fov,