Browse Source

新增了两个材质类文件,模型、材质、体积、贴图cards属性已经改为registerId属性

master
yuanjiajia 3 years ago
parent
commit
7943870ed4
  1. 2
      .vscode/launch.json
  2. 61
      examples/PrintRender.php
  3. 79
      examples/PrintScene.php
  4. 12
      src/scene/Scene.php
  5. 24
      src/scene/materials/CarPaint.php
  6. 118
      src/scene/materials/Cloth.php
  7. 34
      src/scene/materials/Disney.php
  8. 12
      src/scene/materials/Glass.php
  9. 10
      src/scene/materials/GlassArch.php
  10. 14
      src/scene/materials/GlassRough.php
  11. 14
      src/scene/materials/Glossy.php
  12. 14
      src/scene/materials/GlossyCoating.php
  13. 28
      src/scene/materials/GlossyTranslucent.php
  14. 14
      src/scene/materials/MaterialsBase.php
  15. 2
      src/scene/materials/Matte.php
  16. 4
      src/scene/materials/MatteRough.php
  17. 4
      src/scene/materials/MatteTranslucent.php
  18. 6
      src/scene/materials/Metal.php
  19. 2
      src/scene/materials/Mirror.php
  20. 6
      src/scene/materials/Mix.php
  21. 111
      src/scene/materials/Velvet.php
  22. 4
      src/scene/objects/Objects.php
  23. 2
      src/scene/texture/TextureBase.php
  24. 4
      src/scene/volumes/HeteroGeneous.php
  25. 4
      src/scene/volumes/HomoGeneous.php
  26. 8
      src/scene/volumes/VolumesBase.php

2
.vscode/launch.json

@ -11,7 +11,7 @@
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${workspaceFolder}/examples/print.php",
"program": "${workspaceFolder}/examples/PrintScene.php",
"cwd": "${workspaceFolder}",
"port": 9055
}

61
examples/PrintRender.php

@ -0,0 +1,61 @@
<?php
namespace Blobt\Luxcore\scene;
include dirname(dirname(__FILE__)) . "/vendor/autoload.php";
//设置打印 渲染引擎 的配置参数
$renderEngine = new render\RenderEngine();
echo $renderEngine;
//设置打印GPU渲染设备的配置参数
$openCL = new render\OpenCL();
echo $openCL;
//设置打印光线跟踪的配置参数
$path = new render\Path();
echo $path;
//设置打印 采样器 配置参数
$sampler = new render\Sampler();
echo $sampler;
//设置打印 灯光策略 配置参数
$lightStrategy = new render\LightStrategy();
echo $lightStrategy;
//设置打印 文件储存格式 配置参数
$filesaver = new render\FileSaver();
echo $filesaver;
//设置打印 渲染终止 配置参数
$batch = new render\Batch();
echo $batch;
//设置打印 场景属性 配置参数
$scene = new render\Scene();
echo $scene;
//设置打印 “胶片” 配置参数
$film = new render\Film();//添加一个胶片,
$img = new render\Image();
$img->effect = [new render\effect\Pretreatment(),new render\effect\ToneMapLinear(),new render\effect\CammaCorrection()];
$film->addImage($img);
$film->addImage(new render\Image(['type' => 'ALBEDO']));
$film->addImage(new render\Image(['type' => 'AVG_SHADING_NORMAL']));
$img = new render\Image();
$img->effect = [new render\effect\NoiseReducerOIDN(),new render\effect\Pretreatment(),new render\effect\ToneMapLinear(),new render\effect\CammaCorrection()];
$film->addImage($img);
echo $film;
?>

examples/print.php → examples/PrintScene.php

12
src/scene/Scene.php

@ -49,7 +49,7 @@ class Scene extends BaseCfg
{
$temp = null;
$temp = sprintf("%014d",$obj->id);
$obj->cards = $temp;
$obj->registerId = $temp;
if($obj->material == null)
{
if( !array_key_exists('__default',$this->materials ) )
@ -65,7 +65,7 @@ class Scene extends BaseCfg
{
$temp = null;
$temp = $material->type.'_'.sprintf("%014d",$material->id);
$material->cards = $temp;
$material->registerId = $temp;
$this->materials[$temp] = $material;
}
@ -74,7 +74,7 @@ class Scene extends BaseCfg
{
$temp = null;
$temp = $texture->type.'_'.sprintf("%014d",$texture->id);
$texture->cards = $temp;
$texture->registerId = $temp;
$this->textures[$temp] = $texture;
}
@ -82,7 +82,7 @@ class Scene extends BaseCfg
{
$temp = null;
$temp = $volume->type.'_'.sprintf("%014d",$volume->id);
$volume->cards = $temp;
$volume->registerId = $temp;
$this->volumes[$temp] = $volume;
}
@ -90,7 +90,7 @@ class Scene extends BaseCfg
{
$temp = null;
$temp = $light->type.'_'.sprintf("%014d",$light->id);
$light->cards = $temp;
$light->registerId = $temp;
$this->lights[$temp] = $light;
}
@ -98,7 +98,7 @@ class Scene extends BaseCfg
{
$temp = null;
$temp = $camera->type.'_'.sprintf("%014d",$camera->id);
$camera->cards = $temp;
$camera->registerId = $temp;
$this->cameras[$temp] = $camera;
}

24
src/scene/materials/CarPaint.php

@ -83,7 +83,7 @@ class CarPaint extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kd = $color->cards;
if( $color->registerId != null ) $this->kd = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -96,7 +96,7 @@ class CarPaint extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ks1 = $color->cards;
if( $color->registerId != null ) $this->ks1 = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -109,7 +109,7 @@ class CarPaint extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ks2 = $color->cards;
if( $color->registerId != null ) $this->ks2 = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -122,7 +122,7 @@ class CarPaint extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ks3 = $color->cards;
if( $color->registerId != null ) $this->ks3 = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -135,7 +135,7 @@ class CarPaint extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->m1 = $color->cards;
if( $color->registerId != null ) $this->m1 = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -148,7 +148,7 @@ class CarPaint extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->m2 = $color->cards;
if( $color->registerId != null ) $this->m2 = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -161,7 +161,7 @@ class CarPaint extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->m3 = $color->cards;
if( $color->registerId != null ) $this->m3 = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -174,7 +174,7 @@ class CarPaint extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->r1 = $color->cards;
if( $color->registerId != null ) $this->r1 = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -187,7 +187,7 @@ class CarPaint extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->r2 = $color->cards;
if( $color->registerId != null ) $this->r2 = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -200,7 +200,7 @@ class CarPaint extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->r3 = $color->cards;
if( $color->registerId != null ) $this->r3 = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -213,7 +213,7 @@ class CarPaint extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ka = $color->cards;
if( $color->registerId != null ) $this->ka = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -226,7 +226,7 @@ class CarPaint extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->d = $color->cards;
if( $color->registerId != null ) $this->d = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

118
src/scene/materials/Cloth.php

@ -0,0 +1,118 @@
<?php
namespace Blobt\Luxcore\scene\materials;
use Blobt\Luxcore\core\Base;
use Blobt\Luxcore\scene\Scene;
class Cloth extends MaterialsBase
{
const TYPE_CLOTH = 'cloth';
/**
* 预设的布料,
*/
const TTPE_DENIM = 'denim';
const TTPE_SILK_CHARMEUSE = 'silk_charmeuse';
const TTPE_COTTON_TWILL = 'cotton_twill';
const TTPE_WOOL_GABARDINE = 'wool_gabardine';
const TTPE_POLYESTER_LINING_CLOTH = 'polyester_lining_cloth';
const TTPE_SILK_SHANTUNG = 'silk_shantung';
/**
* @var string 经向漫反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $warp_kd = "0.7 0.05 0.05";
/**
* @var string 经向高光反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $warp_ks = "0.04 0.04 0.04";
/**
* @var string 纬向漫颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $weft_kd = "0.64 0.64 0.64";
/**
* @var string 纬向高光颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $weft_ks = "0.04 0.04 0.04";
/**
* @var float U单位向重复次数,(取值:大于等于0的小数)
*/
public $repeat_u = 100;
/**
* @var float V单位向重复次数,(取值:大于等于0的小数)
*/
public $repeat_v = 100;
/**
* @var string 预设的布料,(取值:预设布料的某一字符串常量)
*/
public $preset = self::TTPE_DENIM;
public function __construct($config = [])
{
$this->type = self::TYPE_CLOTH;
$this->id = Scene::createID();
Base::__construct($config);
}
public function setWarpBaseColor($color)
{
if( is_object($color) )
{
if( $color->registerId != null ) $this->warp_kd = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->warp_kd = $color;
}
public function setWeftBaseColor($color)
{
if( is_object($color) )
{
if( $color->registerId != null ) $this->weft_kd = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->weft_kd = $color;
}
public function setWarpSpecular($color)
{
if( is_object($color) )
{
if( $color->registerId != null ) $this->warp_ks = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->warp_ks = $color;
}
public function setWeftSpecular($color)
{
if( is_object($color) )
{
if( $color->registerId != null ) $this->weft_ks = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->weft_ks = $color;
}
}
?>

34
src/scene/materials/Disney.php

@ -91,7 +91,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->basecolor = $color->cards;
if( $color->registerId != null ) $this->basecolor = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -104,7 +104,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->subsurface = $color->cards;
if( $color->registerId != null ) $this->subsurface = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -117,7 +117,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->metallic = $color->cards;
if( $color->registerId != null ) $this->metallic = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -130,7 +130,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->specular = $color->cards;
if( $color->registerId != null ) $this->specular = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -143,7 +143,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->speculartint = $color->cards;
if( $color->registerId != null ) $this->speculartint = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -156,7 +156,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->roughness = $color->cards;
if( $color->registerId != null ) $this->roughness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -169,7 +169,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->anisotropic = $color->cards;
if( $color->registerId != null ) $this->anisotropic = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -182,7 +182,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->sheen = $color->cards;
if( $color->registerId != null ) $this->sheen = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -195,7 +195,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->sheentint = $color->cards;
if( $color->registerId != null ) $this->sheentint = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -208,7 +208,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->clearcoat = $color->cards;
if( $color->registerId != null ) $this->clearcoat = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -221,7 +221,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->clearcoatgloss = $color->cards;
if( $color->registerId != null ) $this->clearcoatgloss = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -234,7 +234,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyFront = $color->cards;
if( $color->registerId != null ) $this->transparencyFront = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -247,7 +247,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyBack = $color->cards;
if( $color->registerId != null ) $this->transparencyBack = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -260,7 +260,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->filmamount = $color->cards;
if( $color->registerId != null ) $this->filmamount = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -272,7 +272,7 @@ class Disney extends MaterialsBase
public function setFilmthickness($color)
{ if( is_object($color) )
{
if( $color->cards != null ) $this->filmthickness = $color->cards;
if( $color->registerId != null ) $this->filmthickness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -285,7 +285,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->filmior = $color->cards;
if( $color->registerId != null ) $this->filmior = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -298,7 +298,7 @@ class Disney extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->bumptex = $color->cards;
if( $color->registerId != null ) $this->bumptex = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

12
src/scene/materials/Glass.php

@ -55,7 +55,7 @@ class Glass extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->filmthickness = $color->cards;
if( $color->registerId != null ) $this->filmthickness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -68,7 +68,7 @@ class Glass extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->filmior = $color->cards;
if( $color->registerId != null ) $this->filmior = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -81,7 +81,7 @@ class Glass extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kt = $color->cards;
if( $color->registerId != null ) $this->kt = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -94,7 +94,7 @@ class Glass extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kr = $color->cards;
if( $color->registerId != null ) $this->kr = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -107,7 +107,7 @@ class Glass extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->interiorior = $color->cards;
if( $color->registerId != null ) $this->interiorior = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -120,7 +120,7 @@ class Glass extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->cauchyb = $color->cards;
if( $color->registerId != null ) $this->cauchyb = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

10
src/scene/materials/GlassArch.php

@ -52,7 +52,7 @@ class GlassArch extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->filmthickness = $color->cards;
if( $color->registerId != null ) $this->filmthickness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -65,7 +65,7 @@ class GlassArch extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->filmior = $color->cards;
if( $color->registerId != null ) $this->filmior = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -78,7 +78,7 @@ class GlassArch extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kt = $color->cards;
if( $color->registerId != null ) $this->kt = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -91,7 +91,7 @@ class GlassArch extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kr = $color->cards;
if( $color->registerId != null ) $this->kr = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -104,7 +104,7 @@ class GlassArch extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->interiorior = $color->cards;
if( $color->registerId != null ) $this->interiorior = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

14
src/scene/materials/GlassRough.php

@ -60,7 +60,7 @@ class GlassRough extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->uroughness = $color->cards;
if( $color->registerId != null ) $this->uroughness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -73,7 +73,7 @@ class GlassRough extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->vroughness = $color->cards;
if( $color->registerId != null ) $this->vroughness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -86,7 +86,7 @@ class GlassRough extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->filmthickness = $color->cards;
if( $color->registerId != null ) $this->filmthickness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -99,7 +99,7 @@ class GlassRough extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->filmior = $color->cards;
if( $color->registerId != null ) $this->filmior = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -112,7 +112,7 @@ class GlassRough extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kt = $color->cards;
if( $color->registerId != null ) $this->kt = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -125,7 +125,7 @@ class GlassRough extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kr = $color->cards;
if( $color->registerId != null ) $this->kr = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -138,7 +138,7 @@ class GlassRough extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->interiorior = $color->cards;
if( $color->registerId != null ) $this->interiorior = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

14
src/scene/materials/Glossy.php

@ -61,7 +61,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->uroughness = $color->cards;
if( $color->registerId != null ) $this->uroughness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -74,7 +74,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->vroughness = $color->cards;
if( $color->registerId != null ) $this->vroughness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -87,7 +87,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kd = $color->cards;
if( $color->registerId != null ) $this->kd = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -100,7 +100,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ks = $color->cards;
if( $color->registerId != null ) $this->ks = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -113,7 +113,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ka = $color->cards;
if( $color->registerId != null ) $this->ka = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -126,7 +126,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->d = $color->cards;
if( $color->registerId != null ) $this->d = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -139,7 +139,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->index = $color->cards;
if( $color->registerId != null ) $this->index = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

14
src/scene/materials/GlossyCoating.php

@ -64,7 +64,7 @@ class GlossyCoating extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->uroughness = $color->cards;
if( $color->registerId != null ) $this->uroughness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -77,7 +77,7 @@ class GlossyCoating extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->vroughness = $color->cards;
if( $color->registerId != null ) $this->vroughness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -90,7 +90,7 @@ class GlossyCoating extends MaterialsBase
{
if( is_object($material) )
{
if( $material->cards != null ) $this->base = $material->cards;
if( $material->registerId != null ) $this->base = $material->registerId;
else
{
throw new \Exception("You use an unregistered ".$material->getInstanceClassName()." object for the current property");
@ -103,7 +103,7 @@ class GlossyCoating extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ks = $color->cards;
if( $color->registerId != null ) $this->ks = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -116,7 +116,7 @@ class GlossyCoating extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ka = $color->cards;
if( $color->registerId != null ) $this->ka = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -129,7 +129,7 @@ class GlossyCoating extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->d = $color->cards;
if( $color->registerId != null ) $this->d = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -142,7 +142,7 @@ class GlossyCoating extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->index = $color->cards;
if( $color->registerId != null ) $this->index = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

28
src/scene/materials/GlossyTranslucent.php

@ -106,7 +106,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->uroughness = $color->cards;
if( $color->registerId != null ) $this->uroughness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -119,7 +119,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->vroughness = $color->cards;
if( $color->registerId != null ) $this->vroughness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -132,7 +132,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kd = $color->cards;
if( $color->registerId != null ) $this->kd = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -145,7 +145,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ks = $color->cards;
if( $color->registerId != null ) $this->ks = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -158,7 +158,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kt = $color->cards;
if( $color->registerId != null ) $this->kt = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -171,7 +171,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ka = $color->cards;
if( $color->registerId != null ) $this->ka = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -184,7 +184,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->d = $color->cards;
if( $color->registerId != null ) $this->d = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -197,7 +197,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->index = $color->cards;
if( $color->registerId != null ) $this->index = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -224,7 +224,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->uroughness_bf = $color->cards;
if( $color->registerId != null ) $this->uroughness_bf = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -237,7 +237,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->vroughness_bf = $color->cards;
if( $color->registerId != null ) $this->vroughness_bf = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -250,7 +250,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ks_bf = $color->cards;
if( $color->registerId != null ) $this->ks_bf = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -263,7 +263,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ka_bf = $color->cards;
if( $color->registerId != null ) $this->ka_bf = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -276,7 +276,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->d_bf = $color->cards;
if( $color->registerId != null ) $this->d_bf = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -289,7 +289,7 @@ class Glossy extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->index_bf = $color->cards;
if( $color->registerId != null ) $this->index_bf = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

14
src/scene/materials/MaterialsBase.php

@ -74,7 +74,7 @@ class MaterialsBase extends BaseCfg
/**
* @var string TODO:储存个由Scene类颁发的注册信息,后期会屏敝此参数的输出
*/
public $cards;
public $registerId;
/**
* @var float TODO:采样距离,具体作用尚未明确,(固定取值:0.001
@ -109,7 +109,7 @@ class MaterialsBase extends BaseCfg
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyFront = $color->cards;
if( $color->registerId != null ) $this->transparencyFront = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -122,7 +122,7 @@ class MaterialsBase extends BaseCfg
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyBack = $color->cards;
if( $color->registerId != null ) $this->transparencyBack = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -135,7 +135,7 @@ class MaterialsBase extends BaseCfg
{
if( is_object($color) )
{
if( $color->cards != null ) $this->bumptex = $color->cards;
if( $color->registerId != null ) $this->bumptex = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -148,7 +148,7 @@ class MaterialsBase extends BaseCfg
{
if( is_object($color) )
{
if( $color->cards != null ) $this->emission = $color->cards;
if( $color->registerId != null ) $this->emission = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -166,7 +166,7 @@ class MaterialsBase extends BaseCfg
{
if( is_object( $volumeInterior ) )
{
if( $volumeInterior->cards != null ) $this->volumeInterior = $volumeInterior->cards;
if( $volumeInterior->registerId != null ) $this->volumeInterior = $volumeInterior->registerId;
else
{
throw new \Exception("You use an unregistered ".$volumeInterior->getInstanceClassName()." object for the current property");
@ -179,7 +179,7 @@ class MaterialsBase extends BaseCfg
{
if( is_object( $volumeExterior ) )
{
if( $volumeExterior->cards != null ) $this->volumeExterior = $volumeExterior->cards;
if( $volumeExterior->registerId != null ) $this->volumeExterior = $volumeExterior->registerId;
else
{
throw new \Exception("You use an unregistered ".$volumeExterior->getInstanceClassName()." object for the current property");

2
src/scene/materials/Matte.php

@ -25,7 +25,7 @@ class Matte extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kd = $color->cards;
if( $color->registerId != null ) $this->kd = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

4
src/scene/materials/MatteRough.php

@ -30,7 +30,7 @@ class MatteRough extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kd = $color->cards;
if( $color->registerId != null ) $this->kd = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -43,7 +43,7 @@ class MatteRough extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->sigma = $color->cards;
if( $color->registerId != null ) $this->sigma = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

4
src/scene/materials/MatteTranslucent.php

@ -30,7 +30,7 @@ class Roughmatte extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kr = $color->cards;
if( $color->registerId != null ) $this->kr = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -43,7 +43,7 @@ class Roughmatte extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kt = $color->cards;
if( $color->registerId != null ) $this->kt = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

6
src/scene/materials/Metal.php

@ -36,7 +36,7 @@ class Metal extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->fresnel = $color->cards;
if( $color->registerId != null ) $this->fresnel = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -50,7 +50,7 @@ class Metal extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->uroughness = $color->cards;
if( $color->registerId != null ) $this->uroughness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -63,7 +63,7 @@ class Metal extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->vroughness = $color->cards;
if( $color->registerId != null ) $this->vroughness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

2
src/scene/materials/Mirror.php

@ -25,7 +25,7 @@ class Mirror extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->kr = $color->cards;
if( $color->registerId != null ) $this->kr = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

6
src/scene/materials/Mix.php

@ -34,7 +34,7 @@ class Mix extends MaterialsBase
{
if( is_object( $Material ) )
{
if( $Material->cards != null ) $this->material1 = $Material->cards;
if( $Material->registerId != null ) $this->material1 = $Material->registerId;
else
{
throw new \Exception("You use an unregistered ".$Material->getInstanceClassName()." object for the current property");
@ -47,7 +47,7 @@ class Mix extends MaterialsBase
{
if( is_object( $Material ) )
{
if( $Material->cards != null ) $this->material2 = $Material->cards;
if( $Material->registerId != null ) $this->material2 = $Material->registerId;
else
{
throw new \Exception("You use an unregistered ".$Material->getInstanceClassName()." object for the current property");
@ -60,7 +60,7 @@ class Mix extends MaterialsBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->amount = $color->cards;
if( $color->registerId != null ) $this->amount = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

111
src/scene/materials/Velvet.php

@ -0,0 +1,111 @@
<?php
namespace Blobt\Luxcore\scene\materials;
use Blobt\Luxcore\core\Base;
use Blobt\Luxcore\scene\Scene;
class Velvet extends MaterialsBase
{
const TYPE_VELVET = 'velvet';
/**
* @var string 漫反射颜色,一个小数形式的RGB色值,或是一个textures(贴图数组)中的某个键名
*/
public $kd = "0.7 0.05 0.05";
/**
* @var float TODO:具体作用尚未明确,(取值:任意自然数)
*/
public $p1 = "-2";
/**
* @var float TODO:具体作用尚未明确,(取值:任意自然数)
*/
public $p2 = "20";
/**
* @var float TODO:具体作用尚未明确,(取值:任意自然数)
*/
public $p3 = "2";
/**
* @var float 丝绒厚度,(取值:0-1的小数)
*/
public $thickness = "0.1";
public function __construct($config = [])
{
$this->type = self::TYPE_VELVET;
$this->id = Scene::createID();
Base::__construct($config);
}
public function setBaseColor($color)
{
if( is_object($color) )
{
if( $color->registerId != null ) $this->kd = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->kd = $color;
}
public function setP1($color)
{
if( is_object($color) )
{
if( $color->registerId != null ) $this->p1 = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->p1 = $color;
}
public function setP2($color)
{
if( is_object($color) )
{
if( $color->registerId != null ) $this->p2 = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->p2 = $color;
}
public function setP3($color)
{
if( is_object($color) )
{
if( $color->registerId != null ) $this->p3 = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->p3 = $color;
}
public function setThickness($color)
{
if( is_object($color) )
{
if( $color->registerId != null ) $this->thickness = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->thickness = $color;
}
}
?>

4
src/scene/objects/Objects.php

@ -31,7 +31,7 @@ class Objects extends BaseCfg
/**
* @var string TODO:储存个由Scene类颁发的注册信息,后期会屏敝此参数的输出
*/
public $cards;
public $registerId;
/**
* @var string 一个山16个数据组成模型的变换参数,包抱位置坐标,旋转参数,缩放参数
@ -48,7 +48,7 @@ class Objects extends BaseCfg
{
if( is_object( $material ) )
{
if( $material->cards != null ) $this->material = $material->cards;
if( $material->registerId != null ) $this->material = $material->registerId;
else
{
throw new \Exception("You use an unregistered ".$material->getInstanceClassName()." object for the current property");

2
src/scene/texture/TextureBase.php

@ -20,7 +20,7 @@ class TextureBase extends BaseCfg
/**
* @var string TODO:储存个由Scene类颁发的注册信息,后期会屏敝此参数的输出
*/
public $cards;
public $registerId;
}

4
src/scene/volumes/HeteroGeneous.php

@ -45,7 +45,7 @@ class HomoGeneous extends VolumesBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->asymmetry = $color->cards;
if( $color->registerId != null ) $this->asymmetry = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -58,7 +58,7 @@ class HomoGeneous extends VolumesBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->scattering = $color->cards;
if( $color->registerId != null ) $this->scattering = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

4
src/scene/volumes/HomoGeneous.php

@ -35,7 +35,7 @@ class HomoGeneous extends VolumesBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->asymmetry = $color->cards;
if( $color->registerId != null ) $this->asymmetry = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -48,7 +48,7 @@ class HomoGeneous extends VolumesBase
{
if( is_object($color) )
{
if( $color->cards != null ) $this->scattering = $color->cards;
if( $color->registerId != null ) $this->scattering = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

8
src/scene/volumes/VolumesBase.php

@ -39,7 +39,7 @@ class VolumesBase extends BaseCfg
/**
* @var string TODO:储存个由Scene类颁发的注册信息,后期会屏敝此参数的输出
*/
public $cards;
public $registerId;
/**
* @var bool 设置当前材质是否保存和使用全局光缓存,当需要打开时,需要渲染器开启全局光缓存功能(取值:ture false
@ -60,7 +60,7 @@ class VolumesBase extends BaseCfg
{
if( is_object($color) )
{
if( $color->cards != null ) $this->emission = $color->cards;
if( $color->registerId != null ) $this->emission = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -74,7 +74,7 @@ class VolumesBase extends BaseCfg
{
if( is_object($color) )
{
if( $color->cards != null ) $this->absorption = $color->cards;
if( $color->registerId != null ) $this->absorption = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
@ -87,7 +87,7 @@ class VolumesBase extends BaseCfg
{
if( is_object($color) )
{
if( $color->cards != null ) $this->ior = $color->cards;
if( $color->registerId != null ) $this->ior = $color->registerId;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");

Loading…
Cancel
Save