Browse Source

修复 NormalMap 法线贴图 bug

master
yuanjiajia 1 year ago
parent
commit
9c230ad59e
  1. 7
      src/scene/texture/transform/NormalMap.php
  2. 2
      src/utils/MatHelper.php

7
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);
}
}
?>

2
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);

Loading…
Cancel
Save