Browse Source

修改了“print.php”、“VolumesBase.php”文件,增加一个体积类文件“Clear.php”,,,,在业务层演示一个有体积效果的材质

master
yuanjiajia 3 years ago
parent
commit
58e381e38f
  1. 20
      examples/print.php
  2. 10
      src/scene/volumes/Clear.php
  3. 19
      src/scene/volumes/VolumesBase.php

20
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); //将模型添加到场景中

10
src/scene/volumes/Clear.php

@ -0,0 +1,10 @@
<?php
namespace Blobt\Luxcore\scene\volumes;
class Clear extends VolumesBase
{
}
?>

19
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;
}
?>
Loading…
Cancel
Save