Skip to content

Commit 29f6f5d

Browse files
committed
spec fixes
1 parent 4debff8 commit 29f6f5d

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

packages/engine/Source/Scene/Model/ModelInstanceCollection.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ import RuntimeError from "../../Core/RuntimeError.js";
4949
function ModelInstanceCollection(options) {
5050
this._instances = [];
5151
this._dirty = false;
52-
this._model = options.model ?? undefined;
52+
this._model = options?.model ?? undefined;
5353

54-
this.initialize(options.instances);
54+
this.initialize(options?.instances);
5555
}
5656

5757
Object.defineProperties(ModelInstanceCollection.prototype, {
@@ -105,7 +105,7 @@ ModelInstanceCollection.prototype.add = function (transform) {
105105
Check.typeOf.object("transform", transform);
106106
//>>includeEnd('debug');
107107

108-
if (this._model._loader._hasMeshGpuInstancing) {
108+
if (this._model?._loader._hasMeshGpuInstancing) {
109109
throw new RuntimeError(
110110
"Models with the EXT_mesh_gpu_instancing extension cannot use the ModelInstanceCollection class.",
111111
);

packages/engine/Specs/Scene/Model/ModelInstanceSpec.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,16 @@ describe(
139139
fixedFrameTransform,
140140
);
141141

142-
const instance = new ModelInstance(instanceModelMatrix);
143-
144142
const model = await loadAndZoomToModelAsync(
145143
{
146144
gltf: sampleGltfUrl,
147-
instances: [instance],
148-
modelMatrix: Matrix4.IDENTITY,
145+
instances: [instanceModelMatrix],
149146
},
150147
scene,
151148
);
152149

150+
const instance = model.instances.get(0);
151+
153152
const boundingSphere = instance.getBoundingSphere(model);
154153

155154
const boundingSphereCenter = new Cartesian3(
@@ -177,12 +176,10 @@ describe(
177176
fixedFrameTransform,
178177
);
179178

180-
const instance = new ModelInstance(instanceModelMatrix);
181-
182179
const model = await loadAndZoomToModelAsync(
183180
{
184181
gltf: sampleGltfUrl,
185-
instances: [instance],
182+
instances: [instanceModelMatrix],
186183
modelMatrix: new Matrix4.fromTranslation(
187184
new Cartesian3(
188185
1253565.1903550967,
@@ -194,6 +191,8 @@ describe(
194191
scene,
195192
);
196193

194+
const instance = model.instances.get(0);
195+
197196
const boundingSphere = instance.getBoundingSphere(model);
198197

199198
const boundingSphereCenter = new Cartesian3(

0 commit comments

Comments
 (0)