diff --git a/doomsday/apps/client/include/render/modelrenderer.h b/doomsday/apps/client/include/render/modelrenderer.h index ee55683924..3e7c3318c3 100644 --- a/doomsday/apps/client/include/render/modelrenderer.h +++ b/doomsday/apps/client/include/render/modelrenderer.h @@ -53,6 +53,7 @@ class ModelRenderer { StateAnims animations; de::Matrix4f transformation; + bool autoscaleToThingHeight = true; }; public: diff --git a/doomsday/apps/client/src/render/modelrenderer.cpp b/doomsday/apps/client/src/render/modelrenderer.cpp index e3ffd26f7a..e5b0de5e29 100644 --- a/doomsday/apps/client/src/render/modelrenderer.cpp +++ b/doomsday/apps/client/src/render/modelrenderer.cpp @@ -33,6 +33,7 @@ static String const DEF_ANIMATION ("animation"); static String const DEF_MATERIAL ("material"); static String const DEF_UP_VECTOR ("up"); static String const DEF_FRONT_VECTOR("front"); +static String const DEF_AUTOSCALE ("autoscale"); DENG2_PIMPL(ModelRenderer) , DENG2_OBSERVES(filesys::AssetObserver, Availability) @@ -201,6 +202,10 @@ DENG2_PIMPL(ModelRenderer) up = Vector3f(asset.geta(DEF_UP_VECTOR)); } aux->transformation = Matrix4f::unnormalizedFrame(front, up); + if(asset.has(DEF_AUTOSCALE)) + { + aux->autoscaleToThingHeight = !ScriptedInfo::isFalse(asset.get(DEF_AUTOSCALE)); + } // Custom texture maps. if(asset.has(DEF_MATERIAL)) diff --git a/doomsday/apps/client/src/world/clientmobjthinkerdata.cpp b/doomsday/apps/client/src/world/clientmobjthinkerdata.cpp index 6412a60043..858b81801e 100644 --- a/doomsday/apps/client/src/world/clientmobjthinkerdata.cpp +++ b/doomsday/apps/client/src/world/clientmobjthinkerdata.cpp @@ -103,13 +103,16 @@ DENG2_PIMPL(ClientMobjThinkerData) animator.reset(new MobjAnimator(modelId(), model)); // The basic transformation of the model. - modelMatrix = loaded.second->as().transformation; + auto const &aux = loaded.second->as(); + modelMatrix = aux.transformation; Vector3f dims = modelMatrix * model.dimensions(); // Scale to thing height. - // TODO: This should be optional (but the default behavior). - modelMatrix = Matrix4f::scale(self.mobj()->height / dims.y * 1.2f /*aspect correct*/) * modelMatrix; + if(aux.autoscaleToThingHeight) + { + modelMatrix = Matrix4f::scale(self.mobj()->height / dims.y * 1.2f /*aspect correct*/) * modelMatrix; + } } }