Update createWireframeDisplayMaterial to handle different material types
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
|||||||
Group,
|
Group,
|
||||||
LineBasicMaterial,
|
LineBasicMaterial,
|
||||||
LineSegments,
|
LineSegments,
|
||||||
|
Material,
|
||||||
Mesh,
|
Mesh,
|
||||||
MeshBasicMaterial,
|
MeshBasicMaterial,
|
||||||
MeshStandardMaterial,
|
MeshStandardMaterial,
|
||||||
@@ -700,12 +701,18 @@ export class ViewportHost {
|
|||||||
this.applyOrthographicCameraPose();
|
this.applyOrthographicCameraPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private createWireframeDisplayMaterial(material: MeshStandardMaterial | MeshBasicMaterial): MeshBasicMaterial {
|
private createWireframeDisplayMaterial(material: Material): MeshBasicMaterial {
|
||||||
|
const source = material as Material & {
|
||||||
|
color?: { getHex(): number };
|
||||||
|
transparent?: boolean;
|
||||||
|
opacity?: number;
|
||||||
|
};
|
||||||
|
|
||||||
return new MeshBasicMaterial({
|
return new MeshBasicMaterial({
|
||||||
color: material.color.getHex(),
|
color: source.color?.getHex() ?? FALLBACK_FACE_COLOR,
|
||||||
wireframe: true,
|
wireframe: true,
|
||||||
transparent: material.transparent === true || material.opacity < 1,
|
transparent: source.transparent === true || (source.opacity ?? 1) < 1,
|
||||||
opacity: material.opacity,
|
opacity: source.opacity ?? 1,
|
||||||
depthWrite: false
|
depthWrite: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user