Skip to content

Commit 2dccd46

Browse files
committed
fix draw command spec
1 parent abe09cb commit 2dccd46

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function buildDrawCommandForModel(
122122
frameState.mode !== SceneMode.SCENE3D && !useBoundingSphere2D;
123123

124124
const runtimeNode = primitiveRenderResources.runtimeNode;
125-
const modelMatrix = ModelDrawCommands.createCommandModelMatrix(
125+
const commandModelMatrix = ModelDrawCommands.createCommandModelMatrix(
126126
model.modelMatrix,
127127
sceneGraph,
128128
runtimeNode,
@@ -135,7 +135,8 @@ function buildDrawCommandForModel(
135135
? runtimePrimitive.boundingSphere2D
136136
: runtimePrimitive.boundingSphere;
137137
const boundingSphere = ModelDrawCommands.createCommandBoundingSphere(
138-
model.modelMatrix,
138+
model,
139+
commandModelMatrix,
139140
sceneGraph,
140141
runtimeNode,
141142
primitiveBoundingSphere,
@@ -150,7 +151,7 @@ function buildDrawCommandForModel(
150151
);
151152

152153
renderState.cull.face = ModelUtility.getCullFace(
153-
modelMatrix,
154+
commandModelMatrix,
154155
primitiveRenderResources.primitiveType,
155156
);
156157
renderState = RenderState.fromCache(renderState);
@@ -170,7 +171,7 @@ function buildDrawCommandForModel(
170171

171172
const command = new DrawCommand({
172173
boundingVolume: boundingSphere,
173-
modelMatrix: modelMatrix,
174+
modelMatrix: commandModelMatrix,
174175
uniformMap: primitiveRenderResources.uniformMap,
175176
renderState: renderState,
176177
vertexArray: vertexArray,
@@ -248,6 +249,7 @@ ModelDrawCommands.createCommandModelMatrix = function (
248249
* @returns {BoundingSphere}
249250
*/
250251
ModelDrawCommands.createCommandBoundingSphere = function (
252+
model,
251253
commandModelMatrix,
252254
sceneGraph,
253255
runtimeNode,
@@ -265,7 +267,7 @@ ModelDrawCommands.createCommandBoundingSphere = function (
265267

266268
for (const modelInstance of sceneGraph.modelInstances._instances) {
267269
const boundingSphere = modelInstance.getPrimitiveBoundingSphere(
268-
commandModelMatrix,
270+
model.modelMatrix,
269271
sceneGraph,
270272
runtimeNode,
271273
primitiveBoundingSphere,
@@ -297,7 +299,7 @@ ModelDrawCommands.updateDrawCommand = function (
297299
const useModelMatrix2D =
298300
frameState.mode !== SceneMode.SCENE3D && !useBoundingSphere2D;
299301

300-
const modelMatrix = ModelDrawCommands.createCommandModelMatrix(
302+
const commandModelMatrix = ModelDrawCommands.createCommandModelMatrix(
301303
model.modelMatrix,
302304
sceneGraph,
303305
runtimeNode,
@@ -306,7 +308,7 @@ ModelDrawCommands.updateDrawCommand = function (
306308
);
307309

308310
drawCommand.cullFace = ModelUtility.getCullFace(
309-
modelMatrix,
311+
commandModelMatrix,
310312
drawCommand.primitiveType,
311313
);
312314

@@ -315,7 +317,8 @@ ModelDrawCommands.updateDrawCommand = function (
315317
? runtimePrimitive.boundingSphere2D
316318
: runtimePrimitive.boundingSphere;
317319
ModelDrawCommands.createCommandBoundingSphere(
318-
model.modelMatrix,
320+
model,
321+
commandModelMatrix,
319322
sceneGraph,
320323
runtimeNode,
321324
primitiveBoundingSphere,

0 commit comments

Comments
 (0)