yuanjiajia
3 years ago
26 changed files with 540 additions and 128 deletions
-
27src/scene/Scene.php
-
67src/scene/materials/CarPaint.php
-
19src/scene/materials/Cloth.php
-
99src/scene/materials/Disney.php
-
25src/scene/materials/Glass.php
-
22src/scene/materials/GlassArch.php
-
28src/scene/materials/GlassRough.php
-
40src/scene/materials/Glossy.php
-
40src/scene/materials/GlossyCoating.php
-
84src/scene/materials/GlossyTranslucent.php
-
19src/scene/materials/MaterialsBase.php
-
9src/scene/materials/Matte.php
-
12src/scene/materials/MatteRough.php
-
12src/scene/materials/MatteTranslucent.php
-
16src/scene/materials/Metal.php
-
9src/scene/materials/Mirror.php
-
17src/scene/materials/Mix.php
-
6src/scene/materials/NullMaterial.php
-
69src/scene/materials/TwoSided.php
-
22src/scene/materials/Velvet.php
-
6src/scene/objects/Objects.php
-
3src/scene/texture/mapping/Triplanar.php
-
4src/scene/texture/procedural/Blend.php
-
4src/scene/texture/procedural/Clouds.php
-
5src/scene/texture/procedural/ImageMap.php
-
4src/scene/texture/transform/NormalMap.php
@ -0,0 +1,69 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace Blobt\Luxcore\scene\materials; |
||||
|
use Blobt\Luxcore\core; |
||||
|
use Blobt\Luxcore\scene\Scene; |
||||
|
|
||||
|
class TwoSided extends MaterialsBase |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* 双面材质 |
||||
|
*/ |
||||
|
const TYPE_TWOSIDED = 'twosided'; |
||||
|
|
||||
|
/** |
||||
|
* @var string 正面材质,(材质数组的某个键名) |
||||
|
*/ |
||||
|
public $frontmaterial; |
||||
|
|
||||
|
/** |
||||
|
* @var string 背面材质,(材质数组的某个键名) |
||||
|
*/ |
||||
|
public $backmaterial; |
||||
|
|
||||
|
/** |
||||
|
* @param array $config 接收一个数组,可以初始化当前实例化对象的各种属性 |
||||
|
*/ |
||||
|
public function __construct($config = []) |
||||
|
{ |
||||
|
$this->type = self::TYPE_TWOSIDED; |
||||
|
$this->id = Scene::createID(); |
||||
|
core\Base::__construct($config); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param object $Material 接收一个材质对象,设置双面材质的正面材质通道 |
||||
|
*/ |
||||
|
public function setMaterial1($Material) |
||||
|
{ |
||||
|
if( is_object( $Material ) ) |
||||
|
{ |
||||
|
if( $Material->registerId != null ) $this->frontmaterial = $Material->registerId; |
||||
|
else |
||||
|
{ |
||||
|
throw new \Exception("You use an unregistered ".$Material->getInstanceClassName()." object for the current property"); |
||||
|
} |
||||
|
} |
||||
|
else $this->frontmaterial = $Material; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param object $Material 接收一个材质对象,设置双面材质的背面材质通道 |
||||
|
*/ |
||||
|
public function setMaterial2($Material) |
||||
|
{ |
||||
|
if( is_object( $Material ) ) |
||||
|
{ |
||||
|
if( $Material->registerId != null ) $this->backmaterial = $Material->registerId; |
||||
|
else |
||||
|
{ |
||||
|
throw new \Exception("You use an unregistered ".$Material->getInstanceClassName()." object for the current property"); |
||||
|
} |
||||
|
} |
||||
|
else $this->backmaterial = $Material; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
?>
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue