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(
|
||||
runtimeScene: RuntimeSceneDefinition
|
||||
): boolean {
|
||||
let addedRenderGroup = false;
|
||||
|
||||
for (const modelInstance of runtimeScene.modelInstances) {
|
||||
const renderGroup = this.modelRenderObjects.get(
|
||||
modelInstance.instanceId
|
||||
);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (addedRenderGroup) {
|
||||
this.applyShadowState();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user