Improve model instance synchronization by adding render groups for visible displayed models and applying shadow state.
This commit is contained in:
@@ -5983,18 +5983,42 @@ export class ViewportHost {
|
|||||||
private syncSimulationModelInstances(
|
private syncSimulationModelInstances(
|
||||||
runtimeScene: RuntimeSceneDefinition
|
runtimeScene: RuntimeSceneDefinition
|
||||||
): boolean {
|
): boolean {
|
||||||
|
let addedRenderGroup = false;
|
||||||
|
|
||||||
for (const modelInstance of runtimeScene.modelInstances) {
|
for (const modelInstance of runtimeScene.modelInstances) {
|
||||||
const renderGroup = this.modelRenderObjects.get(
|
const renderGroup = this.modelRenderObjects.get(
|
||||||
modelInstance.instanceId
|
modelInstance.instanceId
|
||||||
);
|
);
|
||||||
|
|
||||||
if (renderGroup === undefined) {
|
if (renderGroup === undefined) {
|
||||||
return false;
|
const displayedModelInstance = this.getDisplayedModelInstanceById(
|
||||||
|
modelInstance.instanceId
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
displayedModelInstance !== null &&
|
||||||
|
displayedModelInstance.enabled &&
|
||||||
|
displayedModelInstance.visible
|
||||||
|
) {
|
||||||
|
this.addModelInstanceRenderGroup(
|
||||||
|
displayedModelInstance,
|
||||||
|
isModelInstanceSelected(
|
||||||
|
this.currentSelection,
|
||||||
|
displayedModelInstance.id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
addedRenderGroup = true;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderGroup.visible = modelInstance.visible;
|
renderGroup.visible = modelInstance.visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (addedRenderGroup) {
|
||||||
|
this.applyShadowState();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user