Browse Source

已写完一个场景,并修复了已发现的bug

master
yuanjiajia 3 years ago
parent
commit
eac84d9f64
  1. 11
      examples/startDome.php
  2. 3
      src/scene/BaseCfg.php
  3. 2
      src/scene/materials/MaterialsBase.php
  4. 1
      src/scene/render/Film.php
  5. 9
      src/scene/render/Image.php
  6. 3
      src/utils/StringHelper.php

11
examples/startDome.php

@ -129,11 +129,12 @@ $light = new lights\env\HdrImage( // new 一个环境光对
[
'gain' => "1.25 1.25 1.25", // 设置颜色增益
'transformation' => "0.1736481 -0.9848078 0 0 -0.9848078 -0.1736481 0 0 0 0 1 0 0 0 0 1", //设置对象变换
'file' => "env.png", // 加载一个全景图像文件
'file' => "./env.png", // 加载一个全景图像文件
'gamma' => 1, // 设置一个校正全景图像文件的 gamma 值
'storage' => "byte" // 声明这个图像文件表示色值的数据类型
]
);
$light->id = 0; // 一个场景只能有一个环境光对象,并且 id 必须为 0
$scene->registerLight($light); // 将环境光注册到 scene 中
@ -154,7 +155,7 @@ $mapping->useUVMapping2d( // 使用"uvmapping2d"类
$texture = new texture\procedural\ImageMap( // 创建一个纹理
[
'file' => "方形阴影遮照.png", // 加载一个图像文件
'file' => "./方形阴影遮照.png", // 加载一个图像文件
'gain' => 0.6, // 设置颜色增益
'gamma' => 1, // 设置校正图像文件的gamma值
]
@ -519,4 +520,10 @@ $handle = fopen( "/home/yuanjiajia/Desktop/blender/blender_test/scene/render.cfg
fwrite($handle,$render);
fclose($handle);
$result = null;
$var = null;
$cmd = 'luxcoreconsole -o /home/yuanjiajia/Desktop/blender/blender_test/scene/render.cfg -f /home/yuanjiajia/Desktop/blender/blender_test/scene/scene.scn';
exec($cmd, $result, $var);
?>

3
src/scene/BaseCfg.php

@ -50,7 +50,8 @@ class BaseCfg extends Base
switch(gettype($value))
{
case 'string':
$ret .= "{$className}.{$name} = \"{$value}\"\n";
// $ret .= "{$className}.{$name} = \"{$value}\"\n";
$ret .= "{$className}.{$name} = {$value}\n";
break;
case 'integer':

2
src/scene/materials/MaterialsBase.php

@ -32,7 +32,7 @@ class MaterialsBase extends BaseCfg
//璃板的边缘可见,效果会更好。)
const TYPE_ROUGHGLASS = 'roughglass'; //粗糙玻离材质类型,高光光泽度流程
const TYPE_NULL = 'null'; //空的材质
const TYPE_METAL = 'matal2'; //金属度流程的金属材质
const TYPE_METAL = 'metal2'; //金属度流程的金属材质
const TYPE_MIRROR = 'mirror'; //镜面材质,金属度
const TYPE_CARPAINT = 'carpaint'; //车漆材质,高光光泽度流程,使用此类材质不能设置不透明度
const TYPE_CLOTH = 'cloth'; //布料材质,高光光泽度流程

1
src/scene/render/Film.php

@ -83,6 +83,7 @@ class Film extends BaseCfg
$this->imagepipelines[ sprintf("%03d",$object->index) ] = $object->effect;
$object->effect = null;
}
$object->filename = "../{$object->type}_{$object->index}.png";
}
$this->outputs[] = $object;
}

9
src/scene/render/Image.php

@ -151,18 +151,15 @@ class Image extends BaseCfg
Base::__construct($config);
if( in_array($this->type,self::PNG ) )
{
if($this->index == null) $this->filename = "../{$this->type}.png";
else $this->filename = "../{$this->type}_{$this->index}.png";
$this->filename = "../{$this->type}.png";
}
else if ( in_array($this->type,self::EXR) )
{
if($this->index == null) $this->filename = "../{$this->type}.exr";
else $this->filename = "../{$this->type}_{$this->index}.exr";
$this->filename = "../{$this->type}.exr";
}
else
{
if($this->index == null) $this->filename = "../{$this->type}.jpg";
else $this->filename = "../{$this->type}_{$this->index}.jpg";
$this->filename = "../{$this->type}.jpg";
}
}

3
src/utils/StringHelper.php

@ -53,7 +53,8 @@ class StringHelper
}
else if( is_string($value) )
{
$retStr[] = "{$key} = \"{$value}\"";
// $retStr[] = "{$key} = \"{$value}\"";
$retStr[] = "{$key} = {$value}";
}
else
{

Loading…
Cancel
Save