Merge branch 'main' into feature/initial-viewer-ui-updates

This commit is contained in:
andrewwallacespeckle
2025-08-08 17:15:34 +01:00
7 changed files with 38 additions and 9 deletions
+2
View File
@@ -625,6 +625,8 @@ const getStream = () => {
// Text with color proxy
// 'https://app.speckle.systems/projects/ebf93a561b/models/0a07bc3231'
// Sum building
// 'https://app.speckle.systems/projects/a2b933a867/models/5b6b6e9360'
// 'https://latest.speckle.systems/projects/9f13b874cf/models/0575b5dcd2'
// Circles of different sizes
@@ -233,7 +233,7 @@ export class InstancedMeshBatch implements Batch {
const offset = transparentGroup.start
const count =
hiddenGroup !== undefined
? hiddenGroup.start
? hiddenGroup.start - transparentGroup.start
: this.getCount() - transparentGroup.start
if (offset === 0 && count === this.getCount()) return AllBatchUpdateRange
return {
@@ -184,7 +184,7 @@ export abstract class PrimitiveBatch implements Batch {
offset: transparentGroup.start,
count:
hiddenGroup !== undefined
? hiddenGroup.start
? hiddenGroup.start - transparentGroup.start
: this.getCount() - transparentGroup.start
}
}
@@ -119,17 +119,24 @@ export default class TextBatch implements Batch {
return AllBatchUpdateRange
}
/** TODO: Need to give this a glow up */
public getOpaque(): BatchUpdateRange {
if (Materials.isOpaque(this.batchMaterial)) return AllBatchUpdateRange
return NoneBatchUpdateRange
}
/** TODO: Need to give this a glow up */
public getDepth(): BatchUpdateRange {
return this.getOpaque()
}
/** TODO: Need to give this a glow up */
public getTransparent(): BatchUpdateRange {
if (Materials.isTransparent(this.batchMaterial)) return AllBatchUpdateRange
return NoneBatchUpdateRange
}
/** TODO: Need to give this a glow up */
public getStencil(): BatchUpdateRange {
if (this.batchMaterial.stencilWrite === true) return AllBatchUpdateRange
return NoneBatchUpdateRange
@@ -7,7 +7,7 @@ import SpeckleLineMaterial from '../materials/SpeckleLineMaterial.js'
import SpecklePointMaterial from '../materials/SpecklePointMaterial.js'
import SpeckleStandardMaterial from '../materials/SpeckleStandardMaterial.js'
import { NodeRenderView } from '../tree/NodeRenderView.js'
import { type IViewer } from '../../IViewer.js'
import { UpdateFlags, type IViewer } from '../../IViewer.js'
import { Extension } from './Extension.js'
import { SpeckleTypeAllRenderables } from '../loaders/GeometryConverter.js'
import { SpeckleLoader } from '../loaders/Speckle/SpeckleLoader.js'
@@ -369,7 +369,15 @@ export class DiffExtension extends Extension {
this._diffMode = mode
}
}
let needsRenderReset = false
if (time !== undefined && time !== this._diffTime) {
/** We only want to do a reset at the edges of the time value
* because that's where materials become to/from visible from/to visible
*/
needsRenderReset =
(this._diffTime === 0) !== (time === 0) ||
(this._diffTime === 1) !== (time === 1)
this.setDiffTime(time)
this._diffTime = time
}
@@ -378,7 +386,11 @@ export class DiffExtension extends Extension {
this._materialGroups.forEach((value) => {
this.viewer.getRenderer().setMaterial(value.rvs, value.material)
})
this.viewer.requestRender()
this.viewer.requestRender(
needsRenderReset
? UpdateFlags.RENDER_RESET | UpdateFlags.SHADOWS
: UpdateFlags.RENDER
)
}
private setDiffTime(time: number) {
@@ -392,6 +404,7 @@ export class DiffExtension extends Extension {
: from
mat.depthWrite = from < 0.5 ? false : true
mat.transparent = mat.opacity < 1
mat.visible = mat.opacity === 0 ? false : true
mat.needsCopy = true
})
@@ -402,6 +415,7 @@ export class DiffExtension extends Extension {
: to
mat.depthWrite = to < 0.5 ? false : true
mat.transparent = mat.opacity < 1
mat.visible = mat.opacity === 0 ? false : true
mat.needsCopy = true
})
@@ -412,6 +426,7 @@ export class DiffExtension extends Extension {
: from
mat.depthWrite = from < 0.5 ? false : true
mat.transparent = mat.opacity < 1
mat.visible = mat.opacity === 0 ? false : true
mat.needsCopy = true
})
@@ -422,6 +437,7 @@ export class DiffExtension extends Extension {
: to
mat.depthWrite = to < 0.5 ? false : true
mat.transparent = mat.opacity < 1
mat.visible = mat.opacity === 0 ? false : true
mat.needsCopy = true
})
}
@@ -319,9 +319,12 @@ export default class SpeckleConverter {
} else {
real.references++
}
if (typeof real.data[0] !== 'number' || isNaN(real.data[0])) {
if (
real.data.length &&
(typeof real.data[0] !== 'number' || isNaN(real.data[0]))
) {
Logger.error(
`Chunk id ${real.id} used for mesh ${ref.referencedId} might not have numeric geometry data. This is not supported!`
`Chunk id ${real.id} might not have numeric geometry data. This is not supported!`
)
}
chunked.push(real)
@@ -620,7 +623,7 @@ export default class SpeckleConverter {
const targetObjects = obj.objects as []
for (let k = 0; k < targetObjects.length; k++) {
if (this.renderMaterialMap[targetObjects[k]]) {
Logger.error(`Overwritting renderMaterial ${targetObjects[k]}`)
Logger.warn(`Overwritting renderMaterial ${targetObjects[k]}`)
}
this.renderMaterialMap[targetObjects[k]] = renderMaterialValue
}
@@ -638,7 +641,7 @@ export default class SpeckleConverter {
const targetObjects = obj.objects as []
for (let k = 0; k < targetObjects.length; k++) {
if (this.colorMap[targetObjects[k]]) {
Logger.error(`Overwritting color ${targetObjects[k]}`)
Logger.warn(`Overwritting color ${targetObjects[k]}`)
}
this.colorMap[targetObjects[k]] = obj
}
@@ -67,6 +67,7 @@ export class EdgesPipeline extends ProgressivePipeline {
const material = batch.materials[value.materialIndex]
return (
Materials.isTransparent(material) &&
material.visible &&
!(material instanceof SpeckleGhostMaterial)
)
})
@@ -81,7 +82,7 @@ export class EdgesPipeline extends ProgressivePipeline {
offset: transparentGroup.start,
count:
hiddenGroup !== undefined
? hiddenGroup.start
? hiddenGroup.start - transparentGroup.start
: batch.getCount() - transparentGroup.start
}
continue