From e0cd2608771520503f1b50d74fdb745b43265ec0 Mon Sep 17 00:00:00 2001 From: yuanjiajia <1139393632@qq.com> Date: Tue, 8 Mar 2022 17:57:54 +0800 Subject: [PATCH] =?UTF-8?q?Scene=E7=B1=BB=E7=9A=84=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E5=87=BD=E6=95=B0=E5=A2=9E=E5=8A=A0=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E8=A6=81=E6=B3=A8=E5=86=8C=E7=9A=84=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E8=B5=8B=E4=BA=88=E6=9D=90=E8=B4=A8=EF=BC=8C?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=EF=BC=8C=E5=88=99new?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E9=BB=98=E8=AE=A4=E7=9A=84=E6=9D=90=E8=B4=A8?= =?UTF-8?q?=E5=B9=B6=E9=BB=98=E8=AE=A4=E7=9A=84=E6=9D=90=E8=B4=A8=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E5=88=B0Scene=EF=BC=8C=E7=84=B6=E5=90=8E=E5=B0=86?= =?UTF-8?q?=E8=BF=99=E4=B8=AA=E9=BB=98=E8=AE=A4=E7=9A=84=E6=9D=90=E8=B4=A8?= =?UTF-8?q?=E8=B5=8B=E4=BA=88=E8=BF=99=E4=B8=AA=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/print.php | 13 +++++++++++-- src/scene/Scene.php | 8 ++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/examples/print.php b/examples/print.php index d1676ff..9725ccd 100644 --- a/examples/print.php +++ b/examples/print.php @@ -119,6 +119,17 @@ $scene->registerObjects($obj); //将模型添加到场景中 //添加第二个模型 +$obj = new objects\Objects( [ 'ply' => 'mesh-119.ply','appliedtransformation' => '1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1' ] ); //创建一个的模型, +$scene->registerObjects($obj); //将模型添加到场景中 + + +$obj = new objects\Objects( [ 'ply' => 'mesh-119.ply','appliedtransformation' => '1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1' ] ); //创建一个的模型, +$scene->registerObjects($obj); //将模型添加到场景中 + + + + + $obj = new objects\Objects( [ 'ply' => 'mesh-119.ply','appliedtransformation' => '1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1' ] ); //创建一个的模型, $ClearVol = new volumes\Clear(); //创建一个 Clear体积效果 @@ -132,8 +143,6 @@ $obj->setMaterial($colorGlass); //将玻璃材质赋值到模型的材质属 $scene->registerObjects($obj); //将模型添加到场景中 - - echo $scene; diff --git a/src/scene/Scene.php b/src/scene/Scene.php index 5496ec7..cc9315f 100644 --- a/src/scene/Scene.php +++ b/src/scene/Scene.php @@ -50,6 +50,14 @@ class Scene extends BaseCfg $temp = null; $temp = sprintf("%014d",$obj->id); $obj->cards = $temp; + if($obj->material == null) + { + if( !array_key_exists('__default',$this->materials ) ) + { + $this->materials['__default'] = new materials\Matte(); + } + $obj->material = '__default'; + } $this->objects[$temp] = $obj; }