Browse Source

渲染测式 案例 开发

master
yuanjiajia 1 year ago
parent
commit
a7a2d50110
  1. 1
      examples/renderTest.php
  2. 3
      src/utils/MatHelper.php

1
examples/renderTest.php

@ -220,6 +220,7 @@ foreach($taskModel->childsParams as $childParams){
$obj->ply = $plyFileSavaPath; $obj->ply = $plyFileSavaPath;
$obj->setMaterial($material); $obj->setMaterial($material);
$scene->registerObjects($obj); $scene->registerObjects($obj);
fclose($plyFileHandle);
} }

3
src/utils/MatHelper.php

@ -66,6 +66,7 @@ class MatHelper{
$albedoTexture->mapping = $mapping; $albedoTexture->mapping = $mapping;
$scene->registerTexture($albedoTexture); $scene->registerTexture($albedoTexture);
$material->setBaseColor($albedoTexture); $material->setBaseColor($albedoTexture);
fclose($textureHandle);
} }
if($matOriginal->matParams->metallicTexture){ if($matOriginal->matParams->metallicTexture){
$textureUrl = $matOriginal->matParams->metallicTexture; $textureUrl = $matOriginal->matParams->metallicTexture;
@ -86,6 +87,7 @@ class MatHelper{
$roughnessTexture->mapping = $mapping; $roughnessTexture->mapping = $mapping;
$scene->registerTexture($roughnessTexture); $scene->registerTexture($roughnessTexture);
$material->setRoughness($roughnessTexture); $material->setRoughness($roughnessTexture);
fclose($textureHandle);
} }
if($matOriginal->matParams->bumpTexture){ if($matOriginal->matParams->bumpTexture){
$textureUrl = $matOriginal->matParams->bumpTexture; $textureUrl = $matOriginal->matParams->bumpTexture;
@ -104,6 +106,7 @@ class MatHelper{
$normalTexture->scale = $matOriginal->matParams->bumpLevel; $normalTexture->scale = $matOriginal->matParams->bumpLevel;
$scene->registerTexture($normalTexture); $scene->registerTexture($normalTexture);
$material->setBumptex($normalTexture); $material->setBumptex($normalTexture);
fclose($textureHandle);
} }
//TODO: 更多通道贴图处理,待后续完善 //TODO: 更多通道贴图处理,待后续完善

Loading…
Cancel
Save