1
This commit is contained in:
@ -787,9 +787,11 @@ export class GameManager extends Monobehiver {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
// 没有提供 modelId,全局查找(保持向后兼容)
|
||||
this.materialDic.Values().forEach(material => {
|
||||
if (material.name === options.target || material.name.startsWith(`${options.target}_`)) {
|
||||
console.log(material.name);
|
||||
targetMaterials.push(material);
|
||||
}
|
||||
});
|
||||
@ -799,7 +801,7 @@ export class GameManager extends Monobehiver {
|
||||
console.warn(`Material not found: ${options.target}${options.modelId ? ` in model ${options.modelId}` : ''}`);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(options);
|
||||
// 应用材质属性到目标材质
|
||||
targetMaterials.forEach(material => {
|
||||
// 应用颜色
|
||||
@ -818,36 +820,37 @@ export class GameManager extends Monobehiver {
|
||||
}
|
||||
}
|
||||
|
||||
// 应用法线贴图
|
||||
if (options.normalMap !== undefined) {
|
||||
if (options.normalMap) {
|
||||
material.bumpTexture = new Texture(options.normalMap);
|
||||
} else {
|
||||
// 传入空字符串或 null 时清空贴图
|
||||
material.bumpTexture = null;
|
||||
}
|
||||
}
|
||||
// // 应用法线贴图
|
||||
// if (options.normalMap !== undefined) {
|
||||
// if (options.normalMap) {
|
||||
// material.bumpTexture = new Texture(options.normalMap);
|
||||
// } else {
|
||||
// // 传入空字符串或 null 时清空贴图
|
||||
// material.bumpTexture = null;
|
||||
// }
|
||||
// }
|
||||
|
||||
// 应用金属度贴图
|
||||
if (options.metallicTexture !== undefined) {
|
||||
if (options.metallicTexture) {
|
||||
material.metallicTexture = new Texture(options.metallicTexture);
|
||||
} else {
|
||||
// 传入空字符串或 null 时清空贴图
|
||||
material.metallicTexture = null;
|
||||
}
|
||||
}
|
||||
// // 应用金属度贴图
|
||||
// if (options.metallicTexture !== undefined) {
|
||||
// if (options.metallicTexture) {
|
||||
// material.metallicTexture = new Texture(options.metallicTexture);
|
||||
// } else {
|
||||
// // 传入空字符串或 null 时清空贴图
|
||||
// material.metallicTexture = null;
|
||||
// }
|
||||
// }
|
||||
|
||||
// 应用粗糙度值
|
||||
if (options.roughness !== undefined) {
|
||||
material.roughness = options.roughness;
|
||||
}
|
||||
|
||||
// 应用金属度值
|
||||
if (options.metallic !== undefined) {
|
||||
material.metallic = options.metallic;
|
||||
}
|
||||
// if (options.roughness !== undefined) {
|
||||
// material.roughness = options.roughness;
|
||||
// }
|
||||
|
||||
// // 应用金属度值
|
||||
// if (options.metallic !== undefined) {
|
||||
// material.metallic = options.metallic;
|
||||
// }
|
||||
// alert(typeof options.metallic + ' ' + typeof options.roughness);
|
||||
|
||||
// 强制刷新材质
|
||||
material.markDirty();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user