Browse Source

“修改完善“ImageSaverBase.php”、“ImageSaverNumber.php”两个类文件”

master
yuanjiajia 3 years ago
parent
commit
74f768bdbb
  1. 6
      examples/print.php
  2. 70
      src/scene/ImageSaverBase.php
  3. 31
      src/scene/ImageSaverNumber.php

6
examples/print.php

@ -32,7 +32,7 @@ echo $sampler;
$lightStrategy = new LightStrategy();
echo $lightStrategy;
*/
$filesaver = new FileSaver();
@ -45,6 +45,10 @@ $film->outputs[3]['index'] = '中国最牛';
echo $film;
*/
$img = new ImageSaverNumber();
echo $img;
?>

70
src/scene/ImageSaverBase.php

@ -1,9 +1,11 @@
<?php
namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class ImageSaverBase extends BaseCfg
{
/**
* 序列输出,根据需要的效果,进行相应的管线处理。文件保存格式:png
*/
@ -22,8 +24,6 @@ class ImageSaverBase extends BaseCfg
const TYPE_DIRECT_SHADOW_MASK = 'DIRECT_SHADOW_MASK';
const TYPE_INDIRECT_SHADOW_MASK = 'INDIRECT_SHADOW_MASK';
/**
* Basic informatin(基本信息)不需要管线处理,文件保存格式:exr
@ -51,15 +51,75 @@ class ImageSaverBase extends BaseCfg
const TYPE_SAMPLECOUNT = 'SAMPLECOUNT';
const TYPE_CONVERGENCE = 'CONVERGENCE';
const TYPE_NOISE = 'NOISE';
const PNG = [
self::TYPE_RGB_IMAGEPIPELINE,
self::TYPE_MATERIAL_ID,
self::TYPE_OBJECT_ID,
self::TYPE_MATERIAL_ID_COLOR,
self::TYPE_DIRECT_SHADOW_MASK,
self::TYPE_INDIRECT_SHADOW_MASK
];
const EXR = [
self::TYPE_ALBEDO,
self::TYPE_RGB,
self::TYPE_DEPTH,
self::TYPE_RGBA,
self::TYPE_ALPHA,
self::TYPE_POSITION,
self::TYPE_GEOMETRY_NORMAL,
self::TYPE_SHADING_NORMAL,
self::TYPE_UV,
self::TYPE_AVG_SHADING_NORMAL,
self::TYPE_IRRADIANCE,
self::TYPE_RAYCOUNT,
self::TYPE_SAMPLECOUNT,
self::TYPE_CONVERGENCE,
self::TYPE_NOISE
];
/**
* @var string 使用何种渲染引擎(可取值是 PATHCPU、PATHGPU、BIDIRCPU 三个字符串之一)
* @var string 渲染的图像类型
*/
public $type = self::TYPE_RGB_IMAGEPIPELINE;
/**
* @var float 随机种子(取值:大于0的整数)
* @var string 图像输出文件名及格式
*/
public $filename = self::TYPE_RGB_IMAGEPIPELINE."png";
public $filename;
/**
* 设置默认的图像输出文件名及格式
*/
public function __construct($config = [])
{
Base::__construct($config);
if( in_array($this->type,self::PNG ) )
{
$this->filename = "{$this->type}.png";
}
else if ( in_array($this->type,self::EXR) )
{
$this->filename = "{$this->type}.exr";
}
else
{
$this->filename = "{$this->type}.jpg";
}
}
/**
* 用户自定的图像输出文件名及格式
*/
public function setFileName($nameStr)
{
$this->filename = $nameStr;
}
}
?>

31
src/scene/ImageSaverNumber.php

@ -1,6 +1,7 @@
<?php
namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class ImageSaverNumber extends ImageSaverBase
{
@ -8,4 +9,34 @@ class ImageSaverNumber extends ImageSaverBase
* @var integer 图像输出序号,当一幅图像需要管线处理时,处理管线依据此参数处理对应的图像(取值大于0的整数)
*/
public $index = 0;
/**
* 设置默认的图像输出文件名及格式
*/
public function __construct($config = [])
{
Base::__construct($config);
if( in_array($this->type,self::PNG ) )
{
$this->filename = "{$this->type}_{$this->index}.png";
}
else if ( in_array($this->type,self::EXR) )
{
$this->filename = "{$this->type}_{$this->index}.exr";
}
else
{
$this->filename = "{$this->type}_{$this->index}.jpg";
}
}
/**
* 用户自定的图像输出文件名及格式
*/
public function setFileName($nameStr)
{
$this->filename = $nameStr;
}
}
Loading…
Cancel
Save