Browse Source

发现材质相关的类有三个公有属性,已三个公有属性及其对应set函数移入父类中

master
yuanjiajia 3 years ago
parent
commit
6e065d49e7
  1. 19
      src/scene/materials/Disney.php
  2. 55
      src/scene/materials/Glass.php
  3. 54
      src/scene/materials/GlassArch.php
  4. 54
      src/scene/materials/GlassRough.php
  5. 56
      src/scene/materials/Glossy.php
  6. 58
      src/scene/materials/GlossyTranslucent.php
  7. 110
      src/scene/materials/MaterialsBase.php
  8. 54
      src/scene/materials/Matte.php
  9. 56
      src/scene/materials/MatteRough.php
  10. 56
      src/scene/materials/MatteTranslucent.php
  11. 54
      src/scene/materials/Metal.php
  12. 56
      src/scene/materials/Mirror.php
  13. 9
      src/scene/materials/Mix.php
  14. 56
      src/scene/materials/NullMaterial.php

19
src/scene/materials/Disney.php

@ -65,16 +65,6 @@ class Disney extends MaterialsBase
*/
public $clearcoatgloss = 1;
/**
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyFront = 1;
/**
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyBack = 1;
/**
* @var float 薄膜数量,一个0-1的小数,1表示一层,最多一层,或是一个textures(贴图数组)中的某个键名(默认:1)
*/
@ -90,15 +80,6 @@ class Disney extends MaterialsBase
*/
public $filmior;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
/**
* @param $emissio
* @param $visibility
*/
public function __construct($config = [])
{
$this->type = self::TYPE_DISNEY;

55
src/scene/materials/Glass.php

@ -29,7 +29,6 @@ class Glass extends MaterialsBase
/**
* @var float 色散,一个0-0.01342的小数,或是一个textures(贴图数组)中的某个键名,如果设置为0,则不使用此参数,也不需要输出此字符串
* 当此玻下材质被设置为 archglass类型时,此参数必须禁用
*/
public $cauchyb;
@ -45,21 +44,6 @@ class Glass extends MaterialsBase
*/
public $filmior;
/**
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyFront = 1;
/**
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyBack = 1;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
public function __construct($config = [])
{
$this->type = self::TYPE_GLASS;
@ -67,45 +51,6 @@ class Glass extends MaterialsBase
Base::__construct($config);
}
public function setTransparencyFront($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyFront = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyFront = $color;
}
public function setTransparencyBack($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyBack = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyBack = $color;
}
public function setBumptex($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->bumptex = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->bumptex = $color;
}
public function setFilmthickness($color)
{
if( is_object($color) )

54
src/scene/materials/GlassArch.php

@ -41,21 +41,6 @@ class GlassArch extends MaterialsBase
*/
public $filmior;
/**
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyFront = 1;
/**
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyBack = 1;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
public function __construct($config = [])
{
$this->type = self::TYPE_ARCHGLASS;
@ -63,45 +48,6 @@ class GlassArch extends MaterialsBase
Base::__construct($config);
}
public function setTransparencyFront($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyFront = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyFront = $color;
}
public function setTransparencyBack($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyBack = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyBack = $color;
}
public function setBumptex($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->bumptex = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->bumptex = $color;
}
public function setFilmthickness($color)
{
if( is_object($color) )

54
src/scene/materials/GlassRough.php

@ -49,21 +49,6 @@ class GlassRough extends MaterialsBase
*/
public $filmior;
/**
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyFront;
/**
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyBack;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
public function __construct($config = [])
{
$this->type = self::TYPE_ROUGHGLASS;
@ -97,45 +82,6 @@ class GlassRough extends MaterialsBase
else $this->vroughness = $color;
}
public function setTransparencyFront($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyFront = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyFront = $color;
}
public function setTransparencyBack($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyBack = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyBack = $color;
}
public function setBumptex($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->bumptex = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->bumptex = $color;
}
public function setFilmthickness($color)
{
if( is_object($color) )

56
src/scene/materials/Glossy.php

@ -50,21 +50,6 @@ class Glossy extends MaterialsBase
*/
public $multibounce = false;
/**
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyFront = 1;
/**
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyBack = 1;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
public function __construct($config = [])
{
$this->type = self::TYPE_GLOSSY;
@ -96,46 +81,7 @@ class Glossy extends MaterialsBase
}
}
else $this->vroughness = $color;
}
public function setTransparencyFront($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyFront = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyFront = $color;
}
public function setTransparencyBack($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyBack = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyBack = $color;
}
public function setBumptex($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->bumptex = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->bumptex = $color;
}
}
public function setBaseColor($color)
{

58
src/scene/materials/GlossyTranslucent.php

@ -53,22 +53,7 @@ class Glossy extends MaterialsBase
/**
* @var bool TODO:否是使用多弹射,具体作用尚未明确,(默认取值:false)
*/
public $multibounce = false;
/**
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyFront = 1;
/**
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyBack = 1;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
public $multibounce = false;
@ -142,46 +127,7 @@ class Glossy extends MaterialsBase
}
else $this->vroughness = $color;
}
public function setTransparencyFront($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyFront = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyFront = $color;
}
public function setTransparencyBack($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyBack = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyBack = $color;
}
public function setBumptex($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->bumptex = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->bumptex = $color;
}
public function setBaseColor($color)
{
if( is_object($color) )

110
src/scene/materials/MaterialsBase.php

@ -13,6 +13,54 @@ class MaterialsBase extends BaseCfg
*/
public $type;
/**
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyFront;
/**
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyBack;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
/**
* @var string 一个色值,表示材质的自发光颜色,如果为空,则关闭材质的自发光,
*/
public $emission;
/**
* @var object 一个 Emission类 的实例,
*/
public $emissionCfg;
/**
* @var object 一个 Visibility类 的实例
*/
public $visibility;
/**
* @var string 内部体积材质,(体积材质数组的某个键名)
*/
public $volumeInterior;
/**
* @var string 外部体积材质,(体积材质数组的某个键名)
*/
public $volumeExterior;
/**
* @var string 此参数控制材质与光线作用时,产生阴影的透明度,或控制阴影的颜色(取值,小数形式的色值)
*/
@ -56,33 +104,45 @@ class MaterialsBase extends BaseCfg
/**
* @var string 一个色值,表示材质的自发光颜色,如果为空,则关闭材质的自发光,
*/
public $emission;
/**
* @var object 一个 Emission类 的实例,
*/
public $emissionCfg;
/**
* @var object 一个 Visibility类 的实例
*/
public $visibility;
public function setTransparencyFront($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyFront = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyFront = $color;
}
/**
* @var string 内部体积材质,(体积材质数组的某个键名)
*/
public $volumeInterior;
public function setTransparencyBack($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyBack = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyBack = $color;
}
/**
* @var string 外部体积材质,(体积材质数组的某个键名)
*/
public $volumeExterior;
public function setBumptex($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->bumptex = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->bumptex = $color;
}
public function setEmission($color,Emission $emissionCfg = null,Visibility $visibility = null)
{
@ -127,7 +187,7 @@ class MaterialsBase extends BaseCfg
}
else $this->volumeExterior = $volumeExterior;
}
}
?>

54
src/scene/materials/Matte.php

@ -14,65 +14,11 @@ class Matte extends MaterialsBase
*/
public $kd = "0.7 0.7 0.7";
/**
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyFront = 1;
/**
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyBack = 1;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
public function __construct($config = [])
{
$this->type = self::TYPE_MATTE;
$this->id = Scene::createID();
Base::__construct($config);
}
public function setTransparencyFront($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyFront = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyFront = $color;
}
public function setTransparencyBack($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyBack = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyBack = $color;
}
public function setBumptex($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->bumptex = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->bumptex = $color;
}
public function setBaseColor($color)

56
src/scene/materials/MatteRough.php

@ -19,66 +19,12 @@ class MatteRough extends MaterialsBase
*/
public $sigma = 0;
/**
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyFront = 1;
/**
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyBack = 1;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
public function __construct($config = [])
{
$this->type = self::TYPE_ROUGHMATTE;
$this->id = Scene::createID();
Base::__construct($config);
}
public function setTransparencyFront($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyFront = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyFront = $color;
}
public function setTransparencyBack($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyBack = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyBack = $color;
}
public function setBumptex($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->bumptex = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->bumptex = $color;
}
}
public function setBaseColor($color)
{

56
src/scene/materials/MatteTranslucent.php

@ -19,66 +19,12 @@ class Roughmatte extends MaterialsBase
*/
public $kt = "0.7 0.7 0.7";
/**
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyFront = 1;
/**
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyBack = 1;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
public function __construct($config = [])
{
$this->type = self::TYPE_MATTETRANSLUCENT;
$this->id = Scene::createID();
Base::__construct($config);
}
public function setTransparencyFront($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyFront = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyFront = $color;
}
public function setTransparencyBack($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyBack = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyBack = $color;
}
public function setBumptex($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->bumptex = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->bumptex = $color;
}
}
public function setRefraction($color)
{

54
src/scene/materials/Metal.php

@ -25,21 +25,6 @@ class Metal extends MaterialsBase
*/
public $vroughness = 0.05;
/**
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyFront = 1;
/**
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyBack = 1;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
public function __construct($config = [])
{
$this->type = self::TYPE_METAL;
@ -87,45 +72,6 @@ class Metal extends MaterialsBase
else $this->vroughness = $color;
}
public function setTransparencyFront($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyFront = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyFront = $color;
}
public function setTransparencyBack($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyBack = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyBack = $color;
}
public function setBumptex($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->bumptex = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->bumptex = $color;
}
}
?>

56
src/scene/materials/Mirror.php

@ -14,66 +14,12 @@ class Mirror extends MaterialsBase
*/
public $kr = "0.7 0.7 0.7";
/**
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyFront = 1;
/**
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyBack = 1;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
public function __construct($config = [])
{
$this->type = self::TYPE_MIRROR;
$this->id = Scene::createID();
Base::__construct($config);
}
public function setTransparencyFront($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyFront = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyFront = $color;
}
public function setTransparencyBack($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyBack = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyBack = $color;
}
public function setBumptex($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->bumptex = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->bumptex = $color;
}
}
public function setRefraction($color)
{

9
src/scene/materials/Mix.php

@ -23,17 +23,12 @@ class Mix extends MaterialsBase
*/
public $amount = 0.5;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
public function __construct($config = [])
{
$this->type = self::TYPE_MIX;
$this->id = Scene::createID();
core\Base::__construct($config);
}
}
public function setMaterial1($Material)
{
@ -60,7 +55,7 @@ class Mix extends MaterialsBase
}
else $this->material2 = $Material;
}
public function setAmount($color)
{
if( is_object($color) )

56
src/scene/materials/NullMaterial.php

@ -9,67 +9,13 @@ class NullMaterial extends MaterialsBase
const TYPE_NULL = 'null';
/**
* @var float 前向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyFront = 1;
/**
* @var float 后向不透明度,一个0-1的小数,或是一个textures(贴图数组)中的某个键名
*/
public $transparencyBack = 1;
/**
* @var key 是一个textures(贴图数组)中的某个键名
*/
public $bumptex;
public function __construct($config = [])
{
$this->type = self::TYPE_NULL;
$this->id = Scene::createID();
Base::__construct($config);
}
public function setTransparencyFront($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyFront = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyFront = $color;
}
public function setTransparencyBack($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->transparencyBack = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->transparencyBack = $color;
}
public function setBumptex($color)
{
if( is_object($color) )
{
if( $color->cards != null ) $this->bumptex = $color->cards;
else
{
throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property");
}
}
else $this->bumptex = $color;
}
}
?>
Loading…
Cancel
Save