From d9a7cfeaeb34747ff0e2dbb987fdf6b7d8bc854b Mon Sep 17 00:00:00 2001 From: yuanjiajia <1139393632@qq.com> Date: Tue, 8 Mar 2022 19:46:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E4=B8=A4=E4=B8=AA?= =?UTF-8?q?=E6=9D=90=E8=B4=A8=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/CarPaint.php | 240 ++++++++++++++++++++++++++ src/scene/materials/GlossyCoating.php | 166 ++++++++++++++++++ 2 files changed, 406 insertions(+) create mode 100644 src/scene/materials/CarPaint.php create mode 100644 src/scene/materials/GlossyCoating.php diff --git a/src/scene/materials/CarPaint.php b/src/scene/materials/CarPaint.php new file mode 100644 index 0000000..fc91c56 --- /dev/null +++ b/src/scene/materials/CarPaint.php @@ -0,0 +1,240 @@ +type = self::TYPE_CARPAINT; + $this->id = Scene::createID(); + Base::__construct($config); + } + + 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 setSpecular1($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->ks1 = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->ks1 = $color; + } + + public function setSpecular2($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->ks2 = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->ks2 = $color; + } + + public function setSpecular3($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->ks3 = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->ks3 = $color; + } + + public function setMicrofacetRoughness1($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->m1 = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->m1 = $color; + } + + public function setMicrofacetRoughness2($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->m2 = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->m2 = $color; + } + + public function setMicrofacetRoughness3($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->m3 = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->m3 = $color; + } + + public function setGlossy1($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->r1 = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->r1 = $color; + } + + public function setGlossy2($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->r2 = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->r2 = $color; + } + + public function setGlossy3($color) + { + if( is_object($color) ) + { + if( $color->cards != null ) $this->r3 = $color->cards; + else + { + throw new \Exception("You use an unregistered ".$color->getInstanceClassName()." object for the current property"); + } + } + else $this->r3 = $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; + } + +} + +?> diff --git a/src/scene/materials/GlossyCoating.php b/src/scene/materials/GlossyCoating.php new file mode 100644 index 0000000..b26c246 --- /dev/null +++ b/src/scene/materials/GlossyCoating.php @@ -0,0 +1,166 @@ +type = self::TYPE_GLOSSYCOATING; + $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 setBase($material) + { + if( is_object($material) ) + { + if( $material->cards != null ) $this->base = $material->cards; + else + { + throw new \Exception("You use an unregistered ".$material->getInstanceClassName()." object for the current property"); + } + } + else $this->base = $material; + } + + 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 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 = self::OPEN; + } + + public function closeMultiBounce() + { + $this->multibounce = self::CLOSE; + } + +} + +?>