From 58e381e38fba4d9a60fbb4aec117f5be6394cab4 Mon Sep 17 00:00:00 2001 From: yuanjiajia <1139393632@qq.com> Date: Tue, 8 Mar 2022 12:37:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E2=80=9Cprint.php?= =?UTF-8?q?=E2=80=9D=E3=80=81=E2=80=9CVolumesBase.php=E2=80=9D=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA=E4=BD=93?= =?UTF-8?q?=E7=A7=AF=E7=B1=BB=E6=96=87=E4=BB=B6=E2=80=9CClear.php=E2=80=9D?= =?UTF-8?q?,,,,=E5=9C=A8=E4=B8=9A=E5=8A=A1=E5=B1=82=E6=BC=94=E7=A4=BA?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=9C=89=E4=BD=93=E7=A7=AF=E6=95=88=E6=9E=9C?= =?UTF-8?q?=E7=9A=84=E6=9D=90=E8=B4=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/print.php | 20 ++++++++++++++------ src/scene/volumes/Clear.php | 10 ++++++++++ src/scene/volumes/VolumesBase.php | 19 ++++++++++++------- 3 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 src/scene/volumes/Clear.php diff --git a/examples/print.php b/examples/print.php index 1d49bc9..625aeb7 100644 --- a/examples/print.php +++ b/examples/print.php @@ -4,6 +4,7 @@ namespace Blobt\Luxcore\scene; + include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; @@ -76,7 +77,7 @@ echo "\n\n\n\n"; $scene = new Scene();//创建一个场景, - +/* //添加第一个模型 $obj = new objects\Objects( [ 'ply' => 'mesh-10086.ply','appliedtransformation' => '1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1' ] ); //创建一个的模型 @@ -100,7 +101,6 @@ $scene->registerMaterial($disney); //将这个对象注册到 Scene $metal = new materials\Metal(); //创建一个 Disney 材质对象 -$metal->setRefraction($imageMap); $metal->setBumptex($cloudsMap); $scene->registerMaterial($metal); //将这个对象注册到 Scene @@ -115,13 +115,21 @@ $scene->registerMaterial($mix); //将这个对象注册到 Scene $obj->setMaterial($mix) ; //为模型的指定一个混合材质 $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体积材质 +$scene->registerVolume($ClearVol); //将体积材质注册到Scene +$colorGlass = new materials\Glass(); //创建一个玻璃材质, +$colorGlass->setVolumeInterior($ClearVol); //将 Clear体积材质赋值到玻璃材质 的 体积属性 +$scene->registerMaterial($colorGlass); //将玻璃材质注册到 Scene -// //添加第二个模型 -// $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' ] ); //创建一个的模型, -// $obj->material = new materials\Metal( ['fresnel' => "2517393611944Fresnel"] ); //为模型创建一个 金属 类型的材质 -// $scene->addObject($obj); //将模型添加到场景中 +$obj->setMaterial($colorGlass); //将玻璃材质赋值到模型的材质属性 +$scene->registerObjects($obj); //将模型添加到场景中 diff --git a/src/scene/volumes/Clear.php b/src/scene/volumes/Clear.php new file mode 100644 index 0000000..87766ab --- /dev/null +++ b/src/scene/volumes/Clear.php @@ -0,0 +1,10 @@ + diff --git a/src/scene/volumes/VolumesBase.php b/src/scene/volumes/VolumesBase.php index 8513789..d80e489 100644 --- a/src/scene/volumes/VolumesBase.php +++ b/src/scene/volumes/VolumesBase.php @@ -2,18 +2,23 @@ namespace Blobt\Luxcore\scene\volumes; use Blobt\Luxcore\scene\BaseCfg; -use Blobt\Luxcore\scene\Scene; -use Blobt\Luxcore\core\Base; class VolumesBase extends BaseCfg { + /** + * @var string 贴图类型 + */ + public $type; - public function __construct($config = []) - { - $this->id = Scene::createID(); - Base::__construct($config); - } + /** + * @var integer 当前贴图的ID号(取值:大于0的整数) + */ + public $id; + /** + * @var string TODO:储存个由Scene类颁发的注册信息,后期会屏敝此参数的输出 + */ + public $cards; } ?>