diff --git a/apps/openmw/mwworld/class.cpp b/apps/openmw/mwworld/class.cpp index 6a6765253..4064a451a 100644 --- a/apps/openmw/mwworld/class.cpp +++ b/apps/openmw/mwworld/class.cpp @@ -203,8 +203,11 @@ namespace MWWorld return ""; } - void adjustScale(float& x, float& y, float& z) + void Class::adjustScale(const MWWorld::Ptr& ptr,float& scale) const { } + void Class::adjustRotation(const MWWorld::Ptr& ptr,float& x,float& y,float& z) const + { + } } diff --git a/apps/openmw/mwworld/class.hpp b/apps/openmw/mwworld/class.hpp index 0ed0b0e0d..a8639daa9 100644 --- a/apps/openmw/mwworld/class.hpp +++ b/apps/openmw/mwworld/class.hpp @@ -197,7 +197,9 @@ namespace MWWorld ///< @return the enchantment ID if the object is enchanted, otherwise an empty string /// (default implementation: return empty string) - virtual void adjustScale(float& x, float& y, float& z); + virtual void adjustScale(const MWWorld::Ptr& ptr,float& scale) const; + + virtual void adjustRotation(const MWWorld::Ptr& ptr,float& x,float& y,float& z) const; }; } diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index c2926c1a3..6be4a13ba 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -611,9 +611,21 @@ namespace MWWorld mPhysics->moveObject (ptr.getRefData().getHandle(), Ogre::Vector3 (x, y, z)); } - void World::scaleObject (Ptr ptr, float x, float y, float z) + void World::scaleObject (Ptr ptr, float scale) + { + MWWorld::Class::get(ptr).adjustScale(ptr,scale); + + ptr.getCellRef().scale = scale; + scale = scale/ptr.getRefData().getBaseNode()->getScale().x; + ptr.getRefData().getBaseNode()->setScale(scale,scale,scale); + mPhysics->scaleObject( Class::get(ptr).getId(ptr), scale ); + /// \todo cell change for non-player ref + + //mRendering->moveObject (ptr, Ogre::Vector3 (x, y, z)); + } + + void World::rotateObject (Ptr ptr,float x,float y,float z) { - MWWorld::Class::get(ptr).adjustScale(x,y,z); } void World::indexToPosition (int cellX, int cellY, float &x, float &y, bool centre) const diff --git a/apps/openmw/mwworld/world.hpp b/apps/openmw/mwworld/world.hpp index cc6a665fc..e684ca39e 100644 --- a/apps/openmw/mwworld/world.hpp +++ b/apps/openmw/mwworld/world.hpp @@ -222,7 +222,9 @@ namespace MWWorld void moveObject (Ptr ptr, float x, float y, float z); - void scaleObject (Ptr ptr, float x, float y, float z); + void scaleObject (Ptr ptr, float scale); + + void rotateObject (Ptr ptr,float x,float y,float z); void indexToPosition (int cellX, int cellY, float &x, float &y, bool centre = false) const; ///< Convert cell numbers to position.