From 5a9da83ccf4d4b34e1498661bcfd5a59f7e8a0c8 Mon Sep 17 00:00:00 2001 From: yuanjiajia <1139393632@qq.com> Date: Mon, 7 Mar 2022 23:03:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=89=E4=B8=AA=E6=9D=90?= =?UTF-8?q?=E8=B4=A8=E7=9B=B8=E5=85=B3=E7=B1=BB=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scene/materials/GlossyTranslucent.php | 367 ++++++++++++++++++++++ src/scene/materials/MatteTranslucent.php | 111 +++++++ src/scene/materials/Mirror.php | 93 ++++++ 3 files changed, 571 insertions(+) create mode 100644 src/scene/materials/GlossyTranslucent.php create mode 100644 src/scene/materials/MatteTranslucent.php create mode 100644 src/scene/materials/Mirror.php diff --git a/src/scene/materials/GlossyTranslucent.php b/src/scene/materials/GlossyTranslucent.php new file mode 100644 index 0000000..a7e2944 --- /dev/null +++ b/src/scene/materials/GlossyTranslucent.php @@ -0,0 +1,367 @@ +type = self::TYPE_GLOSSY; + $this->id = Scene::createID(); + Base::__construct($config); + } + + public function setUroughness($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->uroughness = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->uroughness = $color; + } + + public function setVroughness($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->vroughness = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + 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) ) + { + if( $color->cards != null ) $this->kd = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->kd = $color; + } + + public function setSpecular($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->ks = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->ks = $color; + } + + public function setTransmission($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->kt = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->kt = $color; + } + + public function setAbsorption($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->ka = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->ka = $color; + } + + public function setAbsorptionDepht($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->d = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->d = $color; + } + + public function setIor($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->index = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->index = $color; + } + + public function openMultiBounce() + { + $this->multibounce = true; + } + + public function closeMultiBounce() + { + $this->multibounce = false; + } + + + + + + public function setUroughness_BF($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->uroughness_bf = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->uroughness_bf = $color; + } + + public function setVroughness_BF($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->vroughness_bf = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->vroughness_bf = $color; + } + + public function setSpecular_BF($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->ks_bf = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->ks_bf = $color; + } + + public function setAbsorption_BF($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->ka_bf = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->ka_bf = $color; + } + + public function setAbsorptionDepht_BF($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->d_bf = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->d_bf = $color; + } + + public function setIor_BF($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->index_bf = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->index_bf = $color; + } + + public function openMultiBounce_BF() + { + $this->multibounce_bf = true; + } + + public function closeMultiBounce_BF() + { + $this->multibounce_bf = false; + } + +} + +?> diff --git a/src/scene/materials/MatteTranslucent.php b/src/scene/materials/MatteTranslucent.php new file mode 100644 index 0000000..a512153 --- /dev/null +++ b/src/scene/materials/MatteTranslucent.php @@ -0,0 +1,111 @@ +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) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->kr = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->kr = $color; + } + + public function setTransmission($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->kt = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->kt = $color; + } + +} + +?> diff --git a/src/scene/materials/Mirror.php b/src/scene/materials/Mirror.php new file mode 100644 index 0000000..34129e9 --- /dev/null +++ b/src/scene/materials/Mirror.php @@ -0,0 +1,93 @@ +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) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->kr = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->kr = $color; + } + +} + +?>