mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-01 05:45:33 +00:00
Merge remote-tracking branch 'scrawl/mapfixes'
This commit is contained in:
commit
0d74c8574d
2 changed files with 6 additions and 7 deletions
|
@ -134,7 +134,7 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell,
|
||||||
mAngle = angle.valueRadians();
|
mAngle = angle.valueRadians();
|
||||||
|
|
||||||
mCellCamera->setOrientation(Quaternion::IDENTITY);
|
mCellCamera->setOrientation(Quaternion::IDENTITY);
|
||||||
mCameraRotNode->setOrientation(Quaternion(Math::Cos(angle/2.f), 0, 0, -Math::Sin(angle/2.f)));
|
mCameraRotNode->setOrientation(Quaternion(Math::Cos(mAngle/2.f), 0, 0, -Math::Sin(mAngle/2.f)));
|
||||||
|
|
||||||
// rotate the cell and merge the rotated corners to the bounding box
|
// rotate the cell and merge the rotated corners to the bounding box
|
||||||
Vector2 _center(bounds.getCenter().x, bounds.getCenter().y);
|
Vector2 _center(bounds.getCenter().x, bounds.getCenter().y);
|
||||||
|
@ -156,6 +156,9 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell,
|
||||||
mBounds.merge(Vector3(c3.x, c3.y, 0));
|
mBounds.merge(Vector3(c3.x, c3.y, 0));
|
||||||
mBounds.merge(Vector3(c4.x, c4.y, 0));
|
mBounds.merge(Vector3(c4.x, c4.y, 0));
|
||||||
|
|
||||||
|
// apply a little padding
|
||||||
|
mBounds.scale ((mBounds.getSize ()+Ogre::Vector3(1000,1000,0)) / mBounds.getSize ());
|
||||||
|
|
||||||
Vector2 center(mBounds.getCenter().x, mBounds.getCenter().y);
|
Vector2 center(mBounds.getCenter().x, mBounds.getCenter().y);
|
||||||
|
|
||||||
Vector2 min(mBounds.getMinimum().x, mBounds.getMinimum().y);
|
Vector2 min(mBounds.getMinimum().x, mBounds.getMinimum().y);
|
||||||
|
|
|
@ -113,12 +113,8 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool
|
||||||
Ogre::AxisAlignedBox bounds = Ogre::AxisAlignedBox::BOX_NULL;
|
Ogre::AxisAlignedBox bounds = Ogre::AxisAlignedBox::BOX_NULL;
|
||||||
NifOgre::EntityList entities = NifOgre::Loader::createEntities(insert, mesh);
|
NifOgre::EntityList entities = NifOgre::Loader::createEntities(insert, mesh);
|
||||||
for(size_t i = 0;i < entities.mEntities.size();i++)
|
for(size_t i = 0;i < entities.mEntities.size();i++)
|
||||||
{
|
bounds.merge(entities.mEntities[i]->getWorldBoundingBox(true));
|
||||||
const Ogre::AxisAlignedBox &tmp = entities.mEntities[i]->getBoundingBox();
|
|
||||||
bounds.merge(Ogre::AxisAlignedBox(insert->_getDerivedPosition() + tmp.getMinimum(),
|
|
||||||
insert->_getDerivedPosition() + tmp.getMaximum())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Ogre::Vector3 extents = bounds.getSize();
|
Ogre::Vector3 extents = bounds.getSize();
|
||||||
extents *= insert->getScale();
|
extents *= insert->getScale();
|
||||||
float size = std::max(std::max(extents.x, extents.y), extents.z);
|
float size = std::max(std::max(extents.x, extents.y), extents.z);
|
||||||
|
|
Loading…
Reference in a new issue