@@ -275,6 +275,7 @@ ModelSceneGraph.prototype.initialize = function (model, components) {
275275 ) ;
276276
277277 this . _projectTo2D = model . _projectTo2D ;
278+ this . _computedModelScale = model . _computedScale ;
278279 // TODO: 2DBoundingSphere?
279280
280281 // If the model has a height reference that modifies the model matrix,
@@ -283,6 +284,7 @@ ModelSceneGraph.prototype.initialize = function (model, components) {
283284 this . _rootTransform = computeRootTransform ( this , this . _rootTransform ) ;
284285 this . _computedModelMatrix = computeModelMatrix (
285286 modelMatrix ,
287+ this . _computedModelScale ,
286288 this . _rootTransform ,
287289 this . _computedModelMatrix ,
288290 ) ;
@@ -390,13 +392,17 @@ function computeRootTransform(sceneGraph, result) {
390392 * @param {Matrix4 } result
391393 * @returns {Matrix4 }
392394 */
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+ ) ;
400406
401407 const transform = Matrix4 . multiplyTransformation (
402408 modelMatrix ,
@@ -767,11 +773,14 @@ ModelSceneGraph.prototype.update = function (frameState, updateForAnimations) {
767773
768774ModelSceneGraph . prototype . updateModelMatrix = function (
769775 modelMatrix ,
776+ computedScale ,
770777 frameState ,
771778) {
772779 this . _rootTransform = computeRootTransform ( this , this . _rootTransform ) ;
780+ this . _computedModelScale = computedScale ;
773781 this . _computedModelMatrix = computeModelMatrix (
774782 modelMatrix ,
783+ this . _computedModelScale ,
775784 this . _rootTransform ,
776785 this . _computedModelMatrix ,
777786 ) ;
0 commit comments