mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
fix: initial transparency
This commit is contained in:
1 parent
0cc9089156
commit
ed4658adcc
1 file changed
+6
-2
@@ -93,12 +93,13 @@ export function StaticArmorSceneComponent({
|
|||||||
new MeshStandardMaterial({
|
new MeshStandardMaterial({
|
||||||
color,
|
color,
|
||||||
opacity,
|
opacity,
|
||||||
transparent: true,
|
transparent: opacity < 1,
|
||||||
depthWrite,
|
depthWrite,
|
||||||
...(clip ? { clippingPlanes: [clip] } : {}),
|
...(clip ? { clippingPlanes: [clip] } : {}),
|
||||||
}),
|
}),
|
||||||
[thickness],
|
[thickness],
|
||||||
);
|
);
|
||||||
|
|
||||||
const outlineMaterial = useMemo(
|
const outlineMaterial = useMemo(
|
||||||
() =>
|
() =>
|
||||||
new LineBasicMaterial({
|
new LineBasicMaterial({
|
||||||
@@ -118,6 +119,7 @@ export function StaticArmorSceneComponent({
|
|||||||
if (selectedName === undefined) {
|
if (selectedName === undefined) {
|
||||||
// nothing selected, go back to defaults
|
// nothing selected, go back to defaults
|
||||||
surfaceMaterial.opacity = opacity;
|
surfaceMaterial.opacity = opacity;
|
||||||
|
surfaceMaterial.transparent = opacity < 1;
|
||||||
surfaceMaterial.color = color;
|
surfaceMaterial.color = color;
|
||||||
surfaceMaterial.depthWrite = props.type !== ArmorType.External;
|
surfaceMaterial.depthWrite = props.type !== ArmorType.External;
|
||||||
surfaceMaterial.side = FrontSide;
|
surfaceMaterial.side = FrontSide;
|
||||||
@@ -132,6 +134,7 @@ export function StaticArmorSceneComponent({
|
|||||||
) {
|
) {
|
||||||
// this selected, stand out!
|
// this selected, stand out!
|
||||||
surfaceMaterial.opacity = 1;
|
surfaceMaterial.opacity = 1;
|
||||||
|
surfaceMaterial.transparent = false;
|
||||||
surfaceMaterial.color = color;
|
surfaceMaterial.color = color;
|
||||||
surfaceMaterial.depthWrite = true;
|
surfaceMaterial.depthWrite = true;
|
||||||
surfaceMaterial.side = DoubleSide;
|
surfaceMaterial.side = DoubleSide;
|
||||||
@@ -139,13 +142,14 @@ export function StaticArmorSceneComponent({
|
|||||||
} else {
|
} else {
|
||||||
// something else selected, become background
|
// something else selected, become background
|
||||||
surfaceMaterial.opacity = 1 / 4;
|
surfaceMaterial.opacity = 1 / 4;
|
||||||
|
surfaceMaterial.transparent = true;
|
||||||
surfaceMaterial.color = unselectedColor;
|
surfaceMaterial.color = unselectedColor;
|
||||||
surfaceMaterial.depthWrite = props.type !== ArmorType.External;
|
surfaceMaterial.depthWrite = props.type !== ArmorType.External;
|
||||||
surfaceMaterial.side = FrontSide;
|
surfaceMaterial.side = FrontSide;
|
||||||
outlineMaterial.visible = false;
|
outlineMaterial.visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
surfaceMaterial.transparent = surfaceMaterial.opacity < 1;
|
surfaceMaterial.needsUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsubscribe = tankopediaEphemeralStore.subscribe(
|
const unsubscribe = tankopediaEphemeralStore.subscribe(
|
||||||
|
|||||||
Reference in new issue
Block a user