diff --git a/src/scene/texture/transform/NormalMap.php b/src/scene/texture/transform/NormalMap.php index fc9dcfd..8711544 100644 --- a/src/scene/texture/transform/NormalMap.php +++ b/src/scene/texture/transform/NormalMap.php @@ -29,6 +29,13 @@ class NormalMap extends TextureBase Base::__construct($config); } + /** + * @param object $texture 接收一个纹理对象,设置 texture 属性 + */ + public function setTexture($texture) + { + $this->texture = $this->judgeAttribute($texture); + } } ?> diff --git a/src/utils/MatHelper.php b/src/utils/MatHelper.php index dbe1b68..d14a934 100644 --- a/src/utils/MatHelper.php +++ b/src/utils/MatHelper.php @@ -115,7 +115,7 @@ class MatHelper{ $scene->registerTexture($bumpTexture); $normalTexture = new NormalMap(); - $normalTexture->texture = $bumpTexture; + $normalTexture->setTexture($bumpTexture); $normalTexture->scale = $matOriginal->matParams->bumpLevel; $scene->registerTexture($normalTexture); $material->setBumptex($normalTexture);