@@ -275,6 +275,7 @@ ModelSceneGraph.prototype.initialize = function (model, components) {
275
275
) ;
276
276
277
277
this . _projectTo2D = model . _projectTo2D ;
278
+ this . _computedModelScale = model . _computedScale ;
278
279
// TODO: 2DBoundingSphere?
279
280
280
281
// If the model has a height reference that modifies the model matrix,
@@ -283,6 +284,7 @@ ModelSceneGraph.prototype.initialize = function (model, components) {
283
284
this . _rootTransform = computeRootTransform ( this , this . _rootTransform ) ;
284
285
this . _computedModelMatrix = computeModelMatrix (
285
286
modelMatrix ,
287
+ this . _computedModelScale ,
286
288
this . _rootTransform ,
287
289
this . _computedModelMatrix ,
288
290
) ;
@@ -390,13 +392,17 @@ function computeRootTransform(sceneGraph, result) {
390
392
* @param {Matrix4 } result
391
393
* @returns {Matrix4 }
392
394
*/
393
- function computeModelMatrix ( modelMatrix , rootTransform , result ) {
394
- // TODO: include model scaling
395
- // modelMatrix = Matrix4.multiplyByUniformScale(
396
- // modelMatrix,
397
- // computedModelScale,
398
- // result,
399
- // );
395
+ function computeModelMatrix (
396
+ modelMatrix ,
397
+ computedModelScale ,
398
+ rootTransform ,
399
+ result ,
400
+ ) {
401
+ modelMatrix = Matrix4 . multiplyByUniformScale (
402
+ modelMatrix ,
403
+ computedModelScale ,
404
+ result ,
405
+ ) ;
400
406
401
407
const transform = Matrix4 . multiplyTransformation (
402
408
modelMatrix ,
@@ -767,11 +773,14 @@ ModelSceneGraph.prototype.update = function (frameState, updateForAnimations) {
767
773
768
774
ModelSceneGraph . prototype . updateModelMatrix = function (
769
775
modelMatrix ,
776
+ computedScale ,
770
777
frameState ,
771
778
) {
772
779
this . _rootTransform = computeRootTransform ( this , this . _rootTransform ) ;
780
+ this . _computedModelScale = computedScale ;
773
781
this . _computedModelMatrix = computeModelMatrix (
774
782
modelMatrix ,
783
+ this . _computedModelScale ,
775
784
this . _rootTransform ,
776
785
this . _computedModelMatrix ,
777
786
) ;
0 commit comments