1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 17:53:53 +00:00

some work for rotation/scaling

This commit is contained in:
gugus 2012-05-28 16:01:35 +02:00
parent 51b6d5cae0
commit 77084b27c0
2 changed files with 23 additions and 3 deletions

View file

@ -500,6 +500,22 @@ namespace MWScript
} }
}; };
template<class R>
class OpSetScale : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr ptr = R()(runtime);
Interpreter::Type_Float scale = runtime[0].mInteger;
runtime.pop();
MWBase::Environment::get().getWorld()->scaleObject(ptr,scale);
}
};
const int numberOfAttributes = 8; const int numberOfAttributes = 8;
const int opcodeGetAttribute = 0x2000027; const int opcodeGetAttribute = 0x2000027;

View file

@ -619,13 +619,17 @@ namespace MWWorld
scale = scale/ptr.getRefData().getBaseNode()->getScale().x; scale = scale/ptr.getRefData().getBaseNode()->getScale().x;
ptr.getRefData().getBaseNode()->setScale(scale,scale,scale); ptr.getRefData().getBaseNode()->setScale(scale,scale,scale);
mPhysics->scaleObject( Class::get(ptr).getId(ptr), 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) void World::rotateObject (Ptr ptr,float x,float y,float z)
{ {
MWWorld::Class::get(ptr).adjustRotation(ptr,x,y,z);
ptr.getRefData().getPosition().rot[0] = x;
ptr.getRefData().getPosition().rot[0] = y;
ptr.getRefData().getPosition().rot[0] = z;
//ptr.getRefData().getBaseNode()->rotate(ptr.getRefData().getBaseNode()->get
//mPhysics->scaleObject( Class::get(ptr).getId(ptr), scale );
} }
void World::indexToPosition (int cellX, int cellY, float &x, float &y, bool centre) const void World::indexToPosition (int cellX, int cellY, float &x, float &y, bool centre) const