1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-30 09:36:43 +00:00

Merge remote-tracking branch 'cc9cii/branch_0_29_fixes' into openmw-29

This commit is contained in:
Marc Zinnschlag 2014-02-27 15:45:45 +01:00
commit 0926501717
3 changed files with 9 additions and 11 deletions

View file

@ -980,13 +980,11 @@ void RenderingManager::screenshot(Image &image, int w, int h)
Ogre::PixelFormat pf = rt->suggestPixelFormat(); Ogre::PixelFormat pf = rt->suggestPixelFormat();
std::vector<Ogre::uchar> data; image.loadDynamicImage(
data.resize(w * h * Ogre::PixelUtil::getNumElemBytes(pf)); OGRE_ALLOC_T(Ogre::uchar, w * h * Ogre::PixelUtil::getNumElemBytes(pf), Ogre::MEMCATEGORY_GENERAL),
w, h, 1, pf, true // autoDelete=true, frees memory we allocate
Ogre::PixelBox pb(w, h, 1, pf, &data[0]); );
rt->copyContentsToMemory(pb); rt->copyContentsToMemory(image.getPixelBox()); // getPixelBox returns a box sharing the same memory as the image
image.loadDynamicImage(&data[0], w, h, pf);
Ogre::TextureManager::getSingleton().remove(tempName); Ogre::TextureManager::getSingleton().remove(tempName);
mRendering.getCamera()->setAspectRatio(oldAspect); mRendering.getCamera()->setAspectRatio(oldAspect);

View file

@ -23,7 +23,7 @@ namespace Physic
mBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, position, rotation, &mBoxScaledTranslation, &mBoxRotation); mBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, position, rotation, &mBoxScaledTranslation, &mBoxRotation);
mRaycastingBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, position, rotation, &mBoxScaledTranslation, &mBoxRotation, true); mRaycastingBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, position, rotation, &mBoxScaledTranslation, &mBoxRotation, true);
Ogre::Quaternion inverse = mBoxRotation.Inverse(); Ogre::Quaternion inverse = mBoxRotation.Inverse();
mBoxRotationInverse = btQuaternion(inverse.x, inverse.y, inverse.z,inverse.w); mBoxRotationInverse = Ogre::Quaternion(inverse.w, inverse.x, inverse.y,inverse.z);
mEngine->addRigidBody(mBody, false, mRaycastingBody,true); //Add rigid body to dynamics world, but do not add to object map mEngine->addRigidBody(mBody, false, mRaycastingBody,true); //Add rigid body to dynamics world, but do not add to object map
} }
@ -85,8 +85,8 @@ namespace Physic
Ogre::Quaternion PhysicActor::getRotation() Ogre::Quaternion PhysicActor::getRotation()
{ {
assert(mBody); assert(mBody);
btQuaternion quat = mBody->getWorldTransform().getRotation() * mBoxRotationInverse; btQuaternion quat = mBody->getWorldTransform().getRotation();
return Ogre::Quaternion(quat.getW(), quat.getX(), quat.getY(), quat.getZ()); return Ogre::Quaternion(quat.getW(), quat.getX(), quat.getY(), quat.getZ()) * mBoxRotationInverse;
} }
void PhysicActor::setScale(float scale){ void PhysicActor::setScale(float scale){

View file

@ -162,7 +162,7 @@ namespace Physic
Ogre::Vector3 mBoxScaledTranslation; Ogre::Vector3 mBoxScaledTranslation;
Ogre::Quaternion mBoxRotation; Ogre::Quaternion mBoxRotation;
btQuaternion mBoxRotationInverse; Ogre::Quaternion mBoxRotationInverse;
Ogre::Vector3 mForce; Ogre::Vector3 mForce;
bool mOnGround; bool mOnGround;