修改粗糙金属度
This commit is contained in:
@ -97,9 +97,6 @@ export class AppGround extends Monobehiver {
|
||||
this.ground.position = this.config.position;
|
||||
}
|
||||
|
||||
if (this.config.receiveShadows) {
|
||||
this.ground.receiveShadows = true;
|
||||
}
|
||||
this.ground.isPickable = false;
|
||||
}
|
||||
|
||||
|
||||
@ -36,6 +36,6 @@ export class AppLight extends Monobehiver {
|
||||
Awake(): void {
|
||||
// 主光源(模拟太阳)
|
||||
const light = new DirectionalLight("sun", new Vector3(-1, -2, -1), this.mainApp.appScene.object);
|
||||
light.intensity = 1.2;
|
||||
light.intensity = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,18 +215,6 @@ export class AppModel extends Monobehiver {
|
||||
}
|
||||
|
||||
|
||||
setupShadows(meshes: AbstractMesh[]): void {
|
||||
const appLight = this.mainApp.appLight;
|
||||
if (!appLight) return;
|
||||
|
||||
meshes.forEach(mesh => {
|
||||
if (mesh.getTotalVertices() > 0) {
|
||||
appLight.addShadowCaster(mesh);
|
||||
mesh.receiveShadows = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取缓存的网格 */
|
||||
getCachedMeshes(name: string): AbstractMesh[] | undefined {
|
||||
return this.modelDic.Get(name);
|
||||
|
||||
@ -19,5 +19,6 @@ export class AppScene extends Monobehiver {
|
||||
this.object = new Scene(this.mainApp.appEngin.object);
|
||||
this.object.clearColor = new Color4(0, 0, 0, 0); // 透明背景
|
||||
this.object.skipFrustumClipping = true; // 跳过视锥剔除优化性能
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -810,7 +810,8 @@ export class GameManager extends Monobehiver {
|
||||
material.albedoColor.copyFrom(color);
|
||||
}
|
||||
|
||||
// 应用反照率纹理(颜色贴图)
|
||||
|
||||
//应用反照率纹理(颜色贴图)
|
||||
if (options.albedoTexture !== undefined) {
|
||||
if (options.albedoTexture) {
|
||||
material.albedoTexture = new Texture(options.albedoTexture);
|
||||
@ -820,42 +821,16 @@ export class GameManager extends Monobehiver {
|
||||
}
|
||||
}
|
||||
|
||||
// // 应用法线贴图
|
||||
// if (options.normalMap !== undefined) {
|
||||
// if (options.normalMap) {
|
||||
// material.bumpTexture = new Texture(options.normalMap);
|
||||
// } else {
|
||||
// // 传入空字符串或 null 时清空贴图
|
||||
// material.bumpTexture = null;
|
||||
// }
|
||||
// }
|
||||
material.roughness = 0.8;
|
||||
material.metallic = 0;
|
||||
|
||||
// // 应用金属度贴图
|
||||
// if (options.metallicTexture !== undefined) {
|
||||
// if (options.metallicTexture) {
|
||||
// material.metallicTexture = new Texture(options.metallicTexture);
|
||||
// } else {
|
||||
// // 传入空字符串或 null 时清空贴图
|
||||
// material.metallicTexture = null;
|
||||
// }
|
||||
// }
|
||||
console.log(options);
|
||||
|
||||
// 应用粗糙度值
|
||||
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