Browse Source

修改了“”、“Image”两个文件,“”重 命名为“”并且加了“index”属性,删除了“ImageSaverNumber.php”类文件

master
yuanjiajia 3 years ago
parent
commit
10e53285ec
  1. 14
      examples/print.php
  2. 11
      src/scene/BaseCfg.php
  3. 13
      src/scene/Film.php
  4. 24
      src/scene/file/ImageSaver.php
  5. 36
      src/scene/file/ImageSaverNumber.php

14
examples/print.php

@ -16,7 +16,6 @@ echo $openCL;
//设置打印光线跟踪的配置参数
$path = new Path();
$path->photonGI = new cache\PhotonGI();
echo $path;
//设置打印 采样器 配置参数
@ -24,7 +23,7 @@ $sampler = new Sampler();
echo $sampler;
//设置打印 灯光策略 配置参数
$lightStrategy = new cache\LightStrategy();
$lightStrategy = new LightStrategy();
echo $lightStrategy;
//设置打印 文件储存格式 配置参数
@ -33,21 +32,22 @@ echo $filesaver;
//设置打印 渲染终止 配置参数
$batch = new Batch();
$batch->useNoiseThreshold();
echo $batch;
//设置打印 场景属性 配置参数
$scene = new Scene();
echo $scene;
//设置打印 “胶片” 配置参数
$film = new Film();
$film->outputs[] = new file\ImageSaverBase(['type' => file\ImageSaverBase::TYPE_RGBA ]);
$film->outputs[] = new file\ImageSaverBase(['type' => file\ImageSaverBase::TYPE_MATERIAL_ID ]);
$film->outputs[] = new file\ImageSaver(['type' => file\ImageSaver::TYPE_RGBA ]);
$film->outputs[] = new file\ImageSaver(['type' => file\ImageSaver::TYPE_MATERIAL_ID ]);
$film->outputs[] = new file\ImageSaverNumber(['index' => 2 ]);
$film->imagepipelines['002'] = [new effect\NoiseReducerOIDN(),new effect\Pretreatment(),new effect\ToneMapLinear(),new effect\AnalogFilmSimulation(),new effect\CammaCorrection()];
$film->outputs[] = new file\ImageSaver(['index' => 5 ]);
$film->imagepipelines[5] = [new effect\NoiseReducerOIDN(),new effect\Pretreatment(),new effect\ToneMapLinear(),new effect\AnalogFilmSimulation(),new effect\CammaCorrection()];
echo $film;

11
src/scene/BaseCfg.php

@ -53,8 +53,7 @@ class BaseCfg extends Base
$value = $item->getValue($this);
if (is_string($value))
{
if( count(explode(" ", $value)) != 3
|| in_array(false,array_map('is_numeric',explode(" ", $value))) )
if( count(explode(" ", $value)) != 3 || in_array(false,array_map('is_numeric',explode(" ", $value))) )
{
$ret .= "{$className}.{$name} = \"{$value}\"\n";
}
@ -88,10 +87,18 @@ class BaseCfg extends Base
else if(is_array($value))
{
foreach(StringHelper::arrayToString($value) as $value)
{
if( $name == 'imagepipelines' )
{
$value = sprintf("%03d", substr($value,0,strpos($value,'.'))).substr($value,strpos($value,'.'));
$ret .= "{$className}.{$name}.{$value}\n";
}
else
{
$ret .= "{$className}.{$name}.{$value}\n";
}
}
}
else
{
$ret .= "{$className}.{$name} = \"unknow type\"\n";

13
src/scene/Film.php

@ -61,14 +61,15 @@ class Film extends BaseCfg
$this->noiseEstimation = new NoiseEstimation($config);
$this->filter = new Filter($config);
$this->outputs[] = new file\ImageSaverNumber(['index' => 0]);
$this->imagepipelines['000'] = [new effect\Pretreatment(),new effect\ToneMapLinear(),new effect\CammaCorrection()];
$this->outputs[] = new file\ImageSaver(['index' => 0]);
$this->imagepipelines[0] = [new effect\Pretreatment(),new effect\ToneMapLinear(),new effect\CammaCorrection()];
$this->outputs[] = new file\ImageSaverBase(['type' => 'ALBEDO']);
$this->outputs[] = new file\ImageSaverBase(['type' => 'AVG_SHADING_NORMAL']);
$this->outputs[] = new file\ImageSaver(['type' => 'ALBEDO']);
$this->outputs[] = new file\ImageSaver(['type' => 'AVG_SHADING_NORMAL']);
$this->outputs[] = new file\ImageSaver(['index' => 1]);
$this->imagepipelines[1] = [new effect\NoiseReducerOIDN(),new effect\Pretreatment(),new effect\ToneMapLinear(),new effect\CammaCorrection()];
$this->outputs[] = new file\ImageSaverNumber(['index' => 1]);
$this->imagepipelines['001'] = [new effect\NoiseReducerOIDN(),new effect\Pretreatment(),new effect\ToneMapLinear(),new effect\CammaCorrection()];
Base::__construct($config);
}

src/scene/file/ImageSaverBase.php → src/scene/file/ImageSaver.php

36
src/scene/file/ImageSaverNumber.php

@ -1,36 +0,0 @@
<?php
namespace Blobt\Luxcore\scene\file;
use Blobt\Luxcore\core\Base;
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";
}
}
}
?>
Loading…
Cancel
Save