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; }