default voxel colors and transparency fixed

This commit is contained in:
azykov@mail.ru
2026-06-02 13:29:08 +03:00
parent 7ebccba199
commit 742e841ce0
3 changed files with 23 additions and 9 deletions
+7 -1
View File
@@ -56,10 +56,16 @@ export const ObjectView = observer(function ({ object }: ObjectViewProps) {
{
objectType.voxels.map((v, idx) => {
const vt = state.world.getVoxelTypeById(v.typeId);
const color = (v.color ?? vt?.color) ?? 'white';
const opacity = (v.opacity ?? vt?.opacity) ?? 1;
return (
<mesh key={idx} position={v.position}>
<boxGeometry args={[1, 1, 1]} />
<meshStandardMaterial color={(v.color ?? vt?.color) ?? 'white'} opacity={(v.opacity ?? vt?.opacity) ?? 1} />
<meshStandardMaterial
color={color}
opacity={opacity}
transparent={opacity < 1}
/>
{isSelected && <Edges color="white" lineWidth={3} stencilWrite={false} />}
</mesh>
);