diff --git a/packages/fileimport-service/ifc-dotnet/ifc-converter.csproj b/packages/fileimport-service/ifc-dotnet/ifc-converter.csproj index a600eedb5..df2c94ad1 100644 --- a/packages/fileimport-service/ifc-dotnet/ifc-converter.csproj +++ b/packages/fileimport-service/ifc-dotnet/ifc-converter.csproj @@ -10,7 +10,7 @@ - + diff --git a/packages/viewer-sandbox/src/main.ts b/packages/viewer-sandbox/src/main.ts index 92856a5a1..81f5723dc 100644 --- a/packages/viewer-sandbox/src/main.ts +++ b/packages/viewer-sandbox/src/main.ts @@ -474,6 +474,11 @@ const getStream = () => { // Custom normals // 'https://latest.speckle.systems/projects/51c449c440/models/08e97226cf' + + // A LOT of text objects + // 'https://app.speckle.systems/projects/e771a388b1/models/f5c967dfa9' + + // 'https://app.speckle.systems/projects/16cffbc224/models/1e142b07a0' ) } diff --git a/packages/viewer/src/modules/batching/LineBatch.ts b/packages/viewer/src/modules/batching/LineBatch.ts index 4dd1bc61d..e68c1e705 100644 --- a/packages/viewer/src/modules/batching/LineBatch.ts +++ b/packages/viewer/src/modules/batching/LineBatch.ts @@ -31,8 +31,11 @@ export default class LineBatch implements Batch { public renderViews: NodeRenderView[] protected geometry: LineSegmentsGeometry public batchMaterial: SpeckleLineMaterial + protected batchTransparent: boolean + protected batchOpacity: number protected mesh: LineSegments2 - public colorBuffer!: InstancedInterleavedBuffer + public colorBuffer: InstancedInterleavedBuffer + private static readonly vector4Buffer: Vector4 = new Vector4() public get bounds(): Box3 { @@ -94,6 +97,9 @@ export default class LineBatch implements Batch { public setBatchMaterial(material: SpeckleLineMaterial) { this.batchMaterial = material + /** Not a fan of this :( */ + this.batchTransparent = material.transparent + this.batchOpacity = material.opacity } public onUpdate(deltaTime: number) { @@ -169,6 +175,9 @@ export default class LineBatch implements Batch { public setBatchBuffers(ranges: BatchUpdateRange[]): void { const data = this.colorBuffer.array as number[] + /** Reset transparency */ + this.batchMaterial.transparent = this.batchTransparent + this.batchMaterial.opacity = this.batchOpacity for (let i = 0; i < ranges.length; i++) { const material = ranges[i].material as SpeckleLineMaterial @@ -179,6 +188,10 @@ export default class LineBatch implements Batch { : material.color const alpha: number = material.visible ? material.opacity : 0 this.batchMaterial.transparent ||= material.opacity < 1 + this.batchMaterial.opacity = Math.min( + this.batchMaterial.opacity, + material.opacity + ) const start = ranges[i].offset * this.colorBuffer.stride const len = ranges[i].offset * this.colorBuffer.stride + @@ -211,7 +224,8 @@ export default class LineBatch implements Batch { ]) this.mesh.material = this.batchMaterial this.mesh.visible = true - this.batchMaterial.transparent = false + this.batchMaterial.transparent = this.batchTransparent + this.batchMaterial.opacity = this.batchOpacity } public buildBatch() { diff --git a/packages/viewer/src/modules/materials/Materials.ts b/packages/viewer/src/modules/materials/Materials.ts index d6a4c3842..c6d27fd37 100644 --- a/packages/viewer/src/modules/materials/Materials.ts +++ b/packages/viewer/src/modules/materials/Materials.ts @@ -425,6 +425,8 @@ export default class Materials { ;(this.lineGhostMaterial).pixelThreshold = 0.5 ;(this.lineGhostMaterial).resolution = new Vector2() ;(this.lineGhostMaterial).toneMapped = false + ;(this.lineGhostMaterial).opacity = 0.1 + ;(this.lineGhostMaterial).transparent = true this.lineColoredMaterial = new SpeckleLineMaterial( {