diff --git a/examples/print.php b/examples/print.php index 874ea5c..f1ba359 100644 --- a/examples/print.php +++ b/examples/print.php @@ -3,7 +3,7 @@ namespace Blobt\Luxcore\scene; -use Blobt\Luxcore\scene\materials\MaterialsBase; +use Blobt\Luxcore\scene\materials; use Blobt\Luxcore\scene\objects\Objects; include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; @@ -60,9 +60,31 @@ echo $film; $scene = new Scene();//创建一个场景, -$scene->objects[0] = new Objects();//在场景中创建一个编号为0的模型, -$scene->materials[7] = new MaterialsBase();//在场景中创建一个编号为7的材质, -$scene->objects[0]->material = 7;//给编号为0的模型,添加编号为7的材质 + +$scene->materials[7] = new materials\Mix(); //在场景中创建一个编号为7的 Mix材质, +$scene->materials[7]->material1 = 'wood1'; //指定混合材质的第一个材质为 wood1 +$scene->materials[7]->material2 = 'wood2'; //指定混合材质的第二个材质为 wood2 +$scene->materials[7]->amount = 0.6; //指定混合系数为 0.6 + +$scene->objects[0] = new Objects(); //在场景中创建一个编号为0的模型, +$scene->objects[0]->material = 7; //为模型指定编号为7的材质 +$scene->objects[0]->ply = 'mesh-00000.ply'; //为模型指定网格 +$scene->objects[0]->camerainvisible = false; //是否对摄像机隐藏, +$scene->objects[0]->id = 10086; //为模型指定ID +$scene->objects[0]->appliedtransformation = '1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1'; //设置模型的位值参数 + + + + +$scene->materials[8] = new materials\Disney(); //在场景中创建一个编号为8的 Disney材质, + +$scene->objects[1] = new Objects(); //在场景中创建一个编号为1的模型, +$scene->objects[1]->material = 8; //为模型指定编号为8的材质 +$scene->objects[1]->ply = 'mesh-119.ply'; //为模型指定网格 +$scene->objects[1]->camerainvisible = false; //是否对摄像机隐藏, +$scene->objects[1]->id = 911; //为模型指定ID +$scene->objects[1]->appliedtransformation = '1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1'; //设置模型的位值参数 + echo $scene; diff --git a/src/scene/Scene.php b/src/scene/Scene.php index 15a00e0..c5d91bc 100644 --- a/src/scene/Scene.php +++ b/src/scene/Scene.php @@ -15,6 +15,11 @@ class Scene extends BaseCfg */ public $materials; + /** + * @var array 体积材质数组 + */ + public $volumes; + /** * @var array 贴图数组 */ diff --git a/src/scene/materials/Disney.php b/src/scene/materials/Disney.php new file mode 100644 index 0000000..82ff442 --- /dev/null +++ b/src/scene/materials/Disney.php @@ -0,0 +1,104 @@ +type = 'disney'; + $this->emissionCfg = new Emission($config); + $this->visibility = new Visibility($config); + Base::__construct($config); + } + +} + +?> diff --git a/src/scene/materials/Emission.php b/src/scene/materials/Emission.php index 24acc01..a88bc60 100644 --- a/src/scene/materials/Emission.php +++ b/src/scene/materials/Emission.php @@ -7,55 +7,72 @@ class Emission extends BaseCfg { /** - * @var string TODO:一个小数形式的色值,具体作用沿未明明,(固定取值:1 1 1) + * @var string 亮度增益,当发光强度单位是 artistic 类型时,或是 坎德拉类型且坎德拉参数下勾选为(每平方米时),可以设置此参数,分别 + * 控制自发光颜色RGB三个通道的放大倍数;否则固定为 1 1 1 */ public $gain = "1 1 1"; /** - * @var integer TODO:具体作用沿未明明,(固定取值:0) + * @var float 能量强度, 当发光强度单位非 artistic 类型和坎德拉类型且坎德拉参数下勾选为(每平方米时)时,可以设置此参数,此值 由一 + * 个单位是瓦特、流明或坎德拉的数转换而得(取值:大于等于0的小数);否则固定为0 */ public $power = 0; /** - * @var integer TODO:具体作用沿未明明,(固定取值:1) + * @var float 转换效率, 当发光强度单位是 参量乘方 类型时,可以设置此参数,(取值:大于等于0的小数),否则artistic 类型和坎德 + * 拉类型且坎德拉参数下勾选为(每平方米时)时时,固定为0;流明和坎德拉时固定为1 */ - public $normalizebycolor = 1; + public $efficency = 0; /** - * @var integer TODO:具体作用沿未明明,(固定取值:0) + * @var bool TODO:颜色亮度进行规格化,具体作用沿未明确,当发光强度单位非 artistic 类型时,可以设置此参数,(取值:true或false),否则固定为 false */ - public $efficency = 0; + public $normalizebycolor = false; /** - * @var integer TODO:具体作用沿未明明,(固定取值:90) + * @var float 光线的发射时的扩散角度,设置为光源的半角。默认值为90。较小的值意味着在 垂直光源表面 的方向上发射的光更多,而在侧面发射的光更少,反之亦然 */ public $theta = 90; /** - * @var integer TODO:一个ID值,具体作用沿未明明,(固定取值:0) + * @var integer 当材质作为一个光源时的ID值,(固定取值:0) */ public $id = 0; /** - * @var integer TODO:具体作用沿未明明,(固定取值:1) + * @var float TODO:权重,具体作用沿未明确,(取值:大于0的小数) */ public $importance = 1; /** - * @var integer TODO:具体作用沿未明明,(固定取值:-1) + * @var integer TODO:温度,具体作用沿未明确,(固定取值:-1) */ public $temperature = -1; /** - * @var integer TODO:具体作用沿未明明,(固定取值:0) + * @var integer TODO:具体作用沿未明确,(固定取值:0) */ public $temperatureNormalize = 0; /** - * @var string TODO:具体作用沿未明明,(固定取值:AUTO) + * @var string 直接光采样类型,(固定取值:AUTO) */ public $directlightsamplingType = "AUTO"; + /** + * @var string 光域网文件名及路径,如果为空,则表示不使用光域网 + */ + public $mapfile; + + /** + * @var float 校正光域网文件的gamma值,(固定取值:1) + */ + public $gamma; + + /** + * @var string 图片的色值以何种方式表示(固定取值:"float") + */ + public $storage; } ?> diff --git a/src/scene/materials/MaterialsBase.php b/src/scene/materials/MaterialsBase.php index 0c35031..97d76dd 100644 --- a/src/scene/materials/MaterialsBase.php +++ b/src/scene/materials/MaterialsBase.php @@ -24,7 +24,7 @@ class MaterialsBase extends BaseCfg public $id = 1000000; /** - * @var float TODO:具体作用尚未明确,(固定取值:0.001) + * @var float TODO:采样距离,具体作用尚未明确,(固定取值:0.001) */ public $bumpsamplingdistance = 0.001; @@ -48,25 +48,36 @@ class MaterialsBase extends BaseCfg */ public $holdoutEnable = false; + + + /** - * @var object 一个 Emission类 的实例, + * @var string 一个色值,表示材质的自发光颜色,如果为空,则关闭材质的自发光, */ public $emission; + /** + * @var object 一个 Emission类 的实例, + */ + public $emissionCfg; + /** * @var object 一个 Visibility类 的实例 */ public $visibility; + + + + /** + * @var string 内部体积材质,(体积材质数组的某个键名) + */ + public $volumeInterior; + /** - * 实例 Emission类、Visibility类的两个对象 + * @var string 外部体积材质,(体积材质数组的某个键名) */ - public function __construct($config = []) - { - $this->emission = new Emission(); - $this->visibility = new Visibility(); - Base::__construct($config); - } + public $volumeExterior; } diff --git a/src/scene/materials/Mix.php b/src/scene/materials/Mix.php new file mode 100644 index 0000000..7f1b035 --- /dev/null +++ b/src/scene/materials/Mix.php @@ -0,0 +1,39 @@ +type = 'mix'; + $this->emissionCfg = new Emission($config); + $this->visibility = new Visibility($config); + Base::__construct($config); + } + +} + +?> diff --git a/src/scene/objects/Objects.php b/src/scene/objects/Objects.php index e95d855..83432b9 100644 --- a/src/scene/objects/Objects.php +++ b/src/scene/objects/Objects.php @@ -9,27 +9,27 @@ class Objects extends BaseCfg /** * @var string 对应的材质数组键名 */ - public $material = 'chinese'; + public $material; /** * @var string 对应的ply网格文件名称 */ - public $ply = 'usa'; + public $ply; /** * @var bool 是否对摄相机可见 */ - public $camerainvisible = 1; + public $camerainvisible; /** * @var integer 模型的ID(取值:大于0的整数) */ - public $id = 5569; + public $id; /** * @var string 一个山16个数据组成模型的变换参数,包抱位置坐标,旋转参数,缩放参数 */ - public $appliedtransformation = '1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1'; + public $appliedtransformation; }