修复材质导入问题

This commit is contained in:
2025-05-29 19:00:36 +08:00
parent 26f1c60a43
commit 99613dbc83
4 changed files with 40 additions and 38 deletions

View File

@@ -167,15 +167,17 @@ export class MaterialEditor
private Material: PhysicalMaterialRecord;
setMaterial(mat: PhysicalMaterialRecord)
{
console.log("set", mat.Material);
this.Material = mat;
this._MeshMaterial.copy(mat.Material);
// for (const child of this.ShowObject.children) {
// if (child instanceof Mesh) {
// child.material = mat.Material;
// }
// }
let mtl = this._MeshMaterial;
console.log("set2", this._MeshMaterial)
console.log(mat.Material);
this.ShowMesh.material = mtl;
this._MeshMaterial.copy(mat.Material);
let mtl = this._MeshMaterial;
if (mtl.metalness > 0.8)
this.LoadMetalEnv().then(env =>
{
@@ -214,6 +216,7 @@ export class MaterialEditor
async Update()
{
console.log("copy:", this.Material.Material.metalness);
let mat = this.ShowMesh.material as MeshPhysicalMaterial;
mat.needsUpdate = true;