mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 20:56:39 +00:00 
			
		
		
		
	Merge remote-tracking branch 'origin/master'
This commit is contained in:
		
						commit
						01497ac8db
					
				
					 30 changed files with 100 additions and 116 deletions
				
			
		|  | @ -160,7 +160,6 @@ CSVRender::Object::Object (CSMWorld::Data& data, osg::Group* parentNode, | |||
|     mBaseNode->addCullCallback(new SceneUtil::LightListCallback); | ||||
| 
 | ||||
|     mOutline = new osgFX::Scribe; | ||||
|     mOutline->addChild(mBaseNode); | ||||
| 
 | ||||
|     mBaseNode->setUserData(new ObjectTag(this)); | ||||
| 
 | ||||
|  | @ -194,10 +193,14 @@ void CSVRender::Object::setSelected(bool selected) | |||
| { | ||||
|     mSelected = selected; | ||||
| 
 | ||||
|     mOutline->removeChild(mBaseNode); | ||||
|     mParentNode->removeChild(mOutline); | ||||
|     mParentNode->removeChild(mBaseNode); | ||||
|     if (selected) | ||||
|     { | ||||
|         mOutline->addChild(mBaseNode); | ||||
|         mParentNode->addChild(mOutline); | ||||
|     } | ||||
|     else | ||||
|         mParentNode->addChild(mBaseNode); | ||||
| } | ||||
|  |  | |||
|  | @ -306,18 +306,7 @@ namespace MWClass | |||
|             } | ||||
| 
 | ||||
|             // Apply "On hit" enchanted weapons
 | ||||
|             std::string enchantmentName = !weapon.isEmpty() ? weapon.getClass().getEnchantment(weapon) : ""; | ||||
|             if (!enchantmentName.empty()) | ||||
|             { | ||||
|                 const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find( | ||||
|                             enchantmentName); | ||||
|                 if (enchantment->mData.mType == ESM::Enchantment::WhenStrikes) | ||||
|                 { | ||||
|                     MWMechanics::CastSpell cast(ptr, victim); | ||||
|                     cast.mHitPosition = hitPosition; | ||||
|                     cast.cast(weapon); | ||||
|                 } | ||||
|             } | ||||
|             MWMechanics::applyOnStrikeEnchantment(ptr, victim, weapon, hitPosition); | ||||
|         } | ||||
|         else if (isBipedal(ptr)) | ||||
|         { | ||||
|  |  | |||
|  | @ -56,8 +56,9 @@ namespace MWClass | |||
| 
 | ||||
|     void CreatureLevList::getModelsToPreload(const MWWorld::Ptr &ptr, std::vector<std::string> &models) const | ||||
|     { | ||||
|         // disable for now, too many false positives
 | ||||
|         /*
 | ||||
|         const MWWorld::LiveCellRef<ESM::CreatureLevList> *ref = ptr.get<ESM::CreatureLevList>(); | ||||
| 
 | ||||
|         for (std::vector<ESM::LevelledListBase::LevelItem>::const_iterator it = ref->mBase->mList.begin(); it != ref->mBase->mList.end(); ++it) | ||||
|         { | ||||
|             MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); | ||||
|  | @ -68,6 +69,7 @@ namespace MWClass | |||
|             MWWorld::ManualRef ref(store, it->mId); | ||||
|             ref.getPtr().getClass().getModelsToPreload(ref.getPtr(), models); | ||||
|         } | ||||
|         */ | ||||
|     } | ||||
| 
 | ||||
|     void CreatureLevList::insertObjectRendering(const MWWorld::Ptr &ptr, const std::string& model, MWRender::RenderingInterface &renderingInterface) const | ||||
|  |  | |||
|  | @ -637,18 +637,7 @@ namespace MWClass | |||
|             damage *= store.find("fCombatKODamageMult")->getFloat(); | ||||
| 
 | ||||
|         // Apply "On hit" enchanted weapons
 | ||||
|         std::string enchantmentName = !weapon.isEmpty() ? weapon.getClass().getEnchantment(weapon) : ""; | ||||
|         if (!enchantmentName.empty()) | ||||
|         { | ||||
|             const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find( | ||||
|                         enchantmentName); | ||||
|             if (enchantment->mData.mType == ESM::Enchantment::WhenStrikes) | ||||
|             { | ||||
|                 MWMechanics::CastSpell cast(ptr, victim); | ||||
|                 cast.mHitPosition = hitPosition; | ||||
|                 cast.cast(weapon); | ||||
|             } | ||||
|         } | ||||
|         MWMechanics::applyOnStrikeEnchantment(ptr, victim, weapon, hitPosition); | ||||
| 
 | ||||
|         MWMechanics::applyElementalShields(ptr, victim); | ||||
| 
 | ||||
|  |  | |||
|  | @ -158,7 +158,7 @@ public: | |||
|         } | ||||
| 
 | ||||
|         // resolve overlapping keywords
 | ||||
|         while (matches.size()) | ||||
|         while (!matches.empty()) | ||||
|         { | ||||
|             int longestKeywordSize = 0; | ||||
|             typename std::vector<Match>::iterator longestKeyword = matches.begin(); | ||||
|  |  | |||
|  | @ -240,7 +240,7 @@ namespace MWGui | |||
|             mCommandLine->setCaption(newCaption); | ||||
| 
 | ||||
|             // List candidates if repeatedly pressing tab
 | ||||
|             if (oldCaption == newCaption && matches.size()) | ||||
|             if (oldCaption == newCaption && !matches.empty()) | ||||
|             { | ||||
|                 int i = 0; | ||||
|                 printOK(""); | ||||
|  |  | |||
|  | @ -37,7 +37,7 @@ ContainerItemModel::ContainerItemModel(const std::vector<MWWorld::Ptr>& itemSour | |||
|     : mItemSources(itemSources) | ||||
|     , mWorldItems(worldItems) | ||||
| { | ||||
|     assert (mItemSources.size()); | ||||
|     assert (!mItemSources.empty()); | ||||
| } | ||||
| 
 | ||||
| ContainerItemModel::ContainerItemModel (const MWWorld::Ptr& source) | ||||
|  |  | |||
|  | @ -255,7 +255,7 @@ namespace MWMechanics | |||
|             // Construct a new path if there isn't one
 | ||||
|             if(!storage.mPathFinder.isPathConstructed()) | ||||
|             { | ||||
|                 if (mAllowedNodes.size()) | ||||
|                 if (!mAllowedNodes.empty()) | ||||
|                 { | ||||
|                     setPathToAnAllowedNode(actor, storage, pos); | ||||
|                 } | ||||
|  |  | |||
|  | @ -2140,10 +2140,10 @@ void CharacterController::updateHeadTracking(float duration) | |||
| 
 | ||||
|     if (!mHeadTrackTarget.isEmpty()) | ||||
|     { | ||||
|         osg::MatrixList mats = head->getWorldMatrices(); | ||||
|         if (mats.empty()) | ||||
|         osg::NodePathList nodepaths = head->getParentalNodePaths(); | ||||
|         if (nodepaths.empty()) | ||||
|             return; | ||||
|         osg::Matrixf mat = mats[0]; | ||||
|         osg::Matrixf mat = osg::computeLocalToWorld(nodepaths[0]); | ||||
|         osg::Vec3f headPos = mat.getTrans(); | ||||
| 
 | ||||
|         osg::Vec3f direction; | ||||
|  | @ -2154,9 +2154,9 @@ void CharacterController::updateHeadTracking(float duration) | |||
|                 node = anim->getNode("Bip01 Head"); | ||||
|             if (node != NULL) | ||||
|             { | ||||
|                 osg::MatrixList mats = node->getWorldMatrices(); | ||||
|                 if (mats.size()) | ||||
|                     direction = mats[0].getTrans() - headPos; | ||||
|                 osg::NodePathList nodepaths = node->getParentalNodePaths(); | ||||
|                 if (!nodepaths.empty()) | ||||
|                     direction = osg::computeLocalToWorld(nodepaths[0]).getTrans() - headPos; | ||||
|             } | ||||
|             else | ||||
|                 // no head node to look at, fall back to look at center of collision box
 | ||||
|  |  | |||
|  | @ -29,29 +29,29 @@ float signedAngleRadians (const osg::Vec3f& v1, const osg::Vec3f& v2, const osg: | |||
|     return std::atan2((normal * (v1 ^ v2)), (v1 * v2)); | ||||
| } | ||||
| 
 | ||||
| bool applyEnchantment (const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim, const MWWorld::Ptr& object, const osg::Vec3f& hitPosition) | ||||
| { | ||||
|     std::string enchantmentName = !object.isEmpty() ? object.getClass().getEnchantment(object) : ""; | ||||
|     if (!enchantmentName.empty()) | ||||
|     { | ||||
|         const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find( | ||||
|                     enchantmentName); | ||||
|         if (enchantment->mData.mType == ESM::Enchantment::WhenStrikes) | ||||
|         { | ||||
|             MWMechanics::CastSpell cast(attacker, victim); | ||||
|             cast.mHitPosition = hitPosition; | ||||
|             cast.cast(object); | ||||
|             return true; | ||||
|         } | ||||
|     } | ||||
|     return false; | ||||
| } | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| namespace MWMechanics | ||||
| { | ||||
| 
 | ||||
|     bool applyOnStrikeEnchantment (const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim, const MWWorld::Ptr& object, const osg::Vec3f& hitPosition) | ||||
|     { | ||||
|         std::string enchantmentName = !object.isEmpty() ? object.getClass().getEnchantment(object) : ""; | ||||
|         if (!enchantmentName.empty()) | ||||
|         { | ||||
|             const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find( | ||||
|                         enchantmentName); | ||||
|             if (enchantment->mData.mType == ESM::Enchantment::WhenStrikes) | ||||
|             { | ||||
|                 MWMechanics::CastSpell cast(attacker, victim); | ||||
|                 cast.mHitPosition = hitPosition; | ||||
|                 cast.cast(object, false); | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     bool blockMeleeAttack(const MWWorld::Ptr &attacker, const MWWorld::Ptr &blocker, const MWWorld::Ptr &weapon, float damage, float attackStrength) | ||||
|     { | ||||
|         if (!blocker.getClass().hasInventoryStore(blocker)) | ||||
|  | @ -215,9 +215,9 @@ namespace MWMechanics | |||
|             damage *= gmst.find("fCombatKODamageMult")->getFloat(); | ||||
| 
 | ||||
|         // Apply "On hit" effect of the weapon
 | ||||
|         bool appliedEnchantment = applyEnchantment(attacker, victim, weapon, hitPosition); | ||||
|         bool appliedEnchantment = applyOnStrikeEnchantment(attacker, victim, weapon, hitPosition); | ||||
|         if (weapon != projectile) | ||||
|             appliedEnchantment = applyEnchantment(attacker, victim, projectile, hitPosition); | ||||
|             appliedEnchantment = applyOnStrikeEnchantment(attacker, victim, projectile, hitPosition); | ||||
| 
 | ||||
|         if (damage > 0) | ||||
|             MWBase::Environment::get().getWorld()->spawnBloodEffect(victim, hitPosition); | ||||
|  |  | |||
|  | @ -6,6 +6,8 @@ | |||
| namespace MWMechanics | ||||
| { | ||||
| 
 | ||||
| bool applyOnStrikeEnchantment(const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim, const MWWorld::Ptr& object, const osg::Vec3f& hitPosition); | ||||
| 
 | ||||
| /// @return can we block the attack?
 | ||||
| bool blockMeleeAttack (const MWWorld::Ptr& attacker, const MWWorld::Ptr& blocker, const MWWorld::Ptr& weapon, float damage, float attackStrength); | ||||
| 
 | ||||
|  |  | |||
|  | @ -687,7 +687,7 @@ namespace MWMechanics | |||
|         throw std::runtime_error("ID type cannot be casted"); | ||||
|     } | ||||
| 
 | ||||
|     bool CastSpell::cast(const MWWorld::Ptr &item) | ||||
|     bool CastSpell::cast(const MWWorld::Ptr &item, bool launchProjectile) | ||||
|     { | ||||
|         std::string enchantmentName = item.getClass().getEnchantment(item); | ||||
|         if (enchantmentName.empty()) | ||||
|  | @ -754,15 +754,20 @@ namespace MWMechanics | |||
|             inflict(mTarget, mCaster, enchantment->mEffects, ESM::RT_Touch); | ||||
|         } | ||||
| 
 | ||||
|         std::string projectileModel; | ||||
|         std::string sound; | ||||
|         float speed = 0; | ||||
|         getProjectileInfo(enchantment->mEffects, projectileModel, sound, speed); | ||||
|         if (!projectileModel.empty()) | ||||
|             MWBase::Environment::get().getWorld()->launchMagicBolt(projectileModel, sound, mId, speed, | ||||
|                                                                false, enchantment->mEffects, mCaster, mSourceName, | ||||
|                                                                    // Not needed, enchantments can only be cast by actors
 | ||||
|                                                                    osg::Vec3f(1,0,0)); | ||||
|         if (launchProjectile) | ||||
|         { | ||||
|             std::string projectileModel; | ||||
|             std::string sound; | ||||
|             float speed = 0; | ||||
|             getProjectileInfo(enchantment->mEffects, projectileModel, sound, speed); | ||||
|             if (!projectileModel.empty()) | ||||
|                 MWBase::Environment::get().getWorld()->launchMagicBolt(projectileModel, sound, mId, speed, | ||||
|                                                                    false, enchantment->mEffects, mCaster, mSourceName, | ||||
|                                                                        // Not needed, enchantments can only be cast by actors
 | ||||
|                                                                        osg::Vec3f(1,0,0)); | ||||
|         } | ||||
|         else if (!mTarget.isEmpty()) | ||||
|             inflict(mTarget, mCaster, enchantment->mEffects, ESM::RT_Target); | ||||
| 
 | ||||
|         return true; | ||||
|     } | ||||
|  |  | |||
|  | @ -81,7 +81,8 @@ namespace MWMechanics | |||
|         bool cast (const ESM::Spell* spell); | ||||
| 
 | ||||
|         /// @note mCaster must be an actor
 | ||||
|         bool cast (const MWWorld::Ptr& item); | ||||
|         /// @param launchProjectile If set to false, "on target" effects are directly applied instead of being launched as projectile originating from the caster.
 | ||||
|         bool cast (const MWWorld::Ptr& item, bool launchProjectile=true); | ||||
| 
 | ||||
|         /// @note mCaster must be an NPC
 | ||||
|         bool cast (const ESM::Ingredient* ingredient); | ||||
|  |  | |||
|  | @ -88,10 +88,10 @@ namespace MWRender | |||
|         const osg::Node* trackNode = mTrackingNode; | ||||
|         if (!trackNode) | ||||
|             return osg::Vec3d(); | ||||
|         osg::MatrixList mats = trackNode->getWorldMatrices(); | ||||
|         if (!mats.size()) | ||||
|         osg::NodePathList nodepaths = trackNode->getParentalNodePaths(); | ||||
|         if (nodepaths.empty()) | ||||
|             return osg::Vec3d(); | ||||
|         const osg::Matrix& worldMat = mats[0]; | ||||
|         osg::Matrix worldMat = osg::computeLocalToWorld(nodepaths[0]); | ||||
| 
 | ||||
|         osg::Vec3d position = worldMat.getTrans(); | ||||
|         if (!isFirstPerson()) | ||||
|  |  | |||
|  | @ -365,10 +365,10 @@ namespace MWRender | |||
|             traverse(node, nv); | ||||
| 
 | ||||
|             // Now update camera utilizing the updated head position
 | ||||
|             osg::MatrixList mats = mNodeToFollow->getWorldMatrices(); | ||||
|             if (!mats.size()) | ||||
|             osg::NodePathList nodepaths = mNodeToFollow->getParentalNodePaths(); | ||||
|             if (nodepaths.empty()) | ||||
|                 return; | ||||
|             osg::Matrix worldMat = mats[0]; | ||||
|             osg::Matrix worldMat = osg::computeLocalToWorld(nodepaths[0]); | ||||
|             osg::Vec3 headOffset = worldMat.getTrans(); | ||||
| 
 | ||||
|             cam->setViewMatrixAsLookAt(headOffset + mPosOffset, headOffset + mLookAtOffset, osg::Vec3(0,0,1)); | ||||
|  |  | |||
|  | @ -402,7 +402,7 @@ namespace MWRender | |||
|                 || bounds.mMinY > bounds.mMaxY) | ||||
|             throw std::runtime_error("invalid map bounds"); | ||||
| 
 | ||||
|         if (!map.mImageData.size()) | ||||
|         if (map.mImageData.empty()) | ||||
|             return; | ||||
| 
 | ||||
|         Files::IMemStream istream(&map.mImageData[0], map.mImageData.size()); | ||||
|  |  | |||
|  | @ -632,7 +632,7 @@ void LocalMap::MapSegment::initFogOfWar() | |||
| void LocalMap::MapSegment::loadFogOfWar(const ESM::FogTexture &esm) | ||||
| { | ||||
|     const std::vector<char>& data = esm.mImageData; | ||||
|     if (!data.size()) | ||||
|     if (data.empty()) | ||||
|     { | ||||
|         initFogOfWar(); | ||||
|         return; | ||||
|  |  | |||
|  | @ -44,11 +44,11 @@ void RotateController::operator()(osg::Node *node, osg::NodeVisitor *nv) | |||
| osg::Quat RotateController::getWorldOrientation(osg::Node *node) | ||||
| { | ||||
|     // this could be optimized later, we just need the world orientation, not the full matrix
 | ||||
|     osg::MatrixList worldMats = node->getWorldMatrices(mRelativeTo); | ||||
|     osg::NodePathList nodepaths = node->getParentalNodePaths(mRelativeTo); | ||||
|     osg::Quat worldOrient; | ||||
|     if (!worldMats.empty()) | ||||
|     if (!nodepaths.empty()) | ||||
|     { | ||||
|         osg::Matrixf worldMat = worldMats[0]; | ||||
|         osg::Matrixf worldMat = osg::computeLocalToWorld(nodepaths[0]); | ||||
|         worldOrient = worldMat.getRotate(); | ||||
|     } | ||||
|     return worldOrient; | ||||
|  |  | |||
|  | @ -566,7 +566,7 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha) | |||
|         textures.push_back(tex); | ||||
|     } | ||||
| 
 | ||||
|     if (!textures.size()) | ||||
|     if (textures.empty()) | ||||
|         return; | ||||
| 
 | ||||
|     float fps = mFallback->getFallbackFloat("Water_SurfaceFPS"); | ||||
|  |  | |||
|  | @ -114,10 +114,10 @@ void WeaponAnimation::releaseArrow(MWWorld::Ptr actor, float attackStrength) | |||
|         osg::Node* weaponNode = getWeaponNode(); | ||||
|         if (!weaponNode) | ||||
|             return; | ||||
|         osg::MatrixList mats = weaponNode->getWorldMatrices(); | ||||
|         if (mats.empty()) | ||||
|         osg::NodePathList nodepaths = weaponNode->getParentalNodePaths(); | ||||
|         if (nodepaths.empty()) | ||||
|             return; | ||||
|         osg::Vec3f launchPos = mats[0].getTrans(); | ||||
|         osg::Vec3f launchPos = osg::computeLocalToWorld(nodepaths[0]).getTrans(); | ||||
| 
 | ||||
|         float fThrownWeaponMinSpeed = gmst.find("fThrownWeaponMinSpeed")->getFloat(); | ||||
|         float fThrownWeaponMaxSpeed = gmst.find("fThrownWeaponMaxSpeed")->getFloat(); | ||||
|  | @ -140,10 +140,10 @@ void WeaponAnimation::releaseArrow(MWWorld::Ptr actor, float attackStrength) | |||
|             return; | ||||
| 
 | ||||
|         osg::ref_ptr<osg::Node> ammoNode = mAmmunition->getNode(); | ||||
|         osg::MatrixList mats = ammoNode->getWorldMatrices(); | ||||
|         if (mats.empty()) | ||||
|         osg::NodePathList nodepaths = ammoNode->getParentalNodePaths(); | ||||
|         if (nodepaths.empty()) | ||||
|             return; | ||||
|         osg::Vec3f launchPos = mats[0].getTrans(); | ||||
|         osg::Vec3f launchPos = osg::computeLocalToWorld(nodepaths[0]).getTrans(); | ||||
| 
 | ||||
|         float fProjectileMinSpeed = gmst.find("fProjectileMinSpeed")->getFloat(); | ||||
|         float fProjectileMaxSpeed = gmst.find("fProjectileMaxSpeed")->getFloat(); | ||||
|  |  | |||
|  | @ -318,8 +318,8 @@ namespace MWScript | |||
|                         ptr = MWBase::Environment::get().getWorld()->moveObject(ptr,store,x,y,z); | ||||
|                         dynamic_cast<MWScript::InterpreterContext&>(runtime.getContext()).updatePtr(base,ptr); | ||||
| 
 | ||||
|                         float ax = osg::RadiansToDegrees(ptr.getRefData().getPosition().rot[0]); | ||||
|                         float ay = osg::RadiansToDegrees(ptr.getRefData().getPosition().rot[1]); | ||||
|                         float ax = ptr.getRefData().getPosition().rot[0]; | ||||
|                         float ay = ptr.getRefData().getPosition().rot[1]; | ||||
|                         // Note that you must specify ZRot in minutes (1 degree = 60 minutes; north = 0, east = 5400, south = 10800, west = 16200)
 | ||||
|                         // except for when you position the player, then degrees must be used.
 | ||||
|                         // See "Morrowind Scripting for Dummies (9th Edition)" pages 50 and 54 for reference.
 | ||||
|  | @ -374,14 +374,14 @@ namespace MWScript | |||
|                     } | ||||
|                     dynamic_cast<MWScript::InterpreterContext&>(runtime.getContext()).updatePtr(base,ptr); | ||||
| 
 | ||||
|                     float ax = osg::RadiansToDegrees(ptr.getRefData().getPosition().rot[0]); | ||||
|                     float ay = osg::RadiansToDegrees(ptr.getRefData().getPosition().rot[1]); | ||||
|                     float ax = ptr.getRefData().getPosition().rot[0]; | ||||
|                     float ay = ptr.getRefData().getPosition().rot[1]; | ||||
|                     // Note that you must specify ZRot in minutes (1 degree = 60 minutes; north = 0, east = 5400, south = 10800, west = 16200)
 | ||||
|                     // except for when you position the player, then degrees must be used.
 | ||||
|                     // See "Morrowind Scripting for Dummies (9th Edition)" pages 50 and 54 for reference.
 | ||||
|                     if(ptr != MWMechanics::getPlayer()) | ||||
|                         zRot = zRot/60.0f; | ||||
|                     MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,zRot); | ||||
|                     MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,osg::DegreesToRadians(zRot)); | ||||
|                     ptr.getClass().adjustPosition(ptr, false); | ||||
|                 } | ||||
|         }; | ||||
|  |  | |||
|  | @ -366,7 +366,7 @@ namespace MWSound | |||
|         else | ||||
|             filelist = mMusicFiles[mCurrentPlaylist]; | ||||
| 
 | ||||
|         if(!filelist.size()) | ||||
|         if(filelist.empty()) | ||||
|             return; | ||||
| 
 | ||||
|         int i = Misc::Rng::rollDice(filelist.size()); | ||||
|  |  | |||
|  | @ -1051,9 +1051,9 @@ namespace MWWorld | |||
|             if(!node) node = anim->getNode("Bip01 Head"); | ||||
|             if(node) | ||||
|             { | ||||
|                 osg::MatrixList mats = node->getWorldMatrices(); | ||||
|                 if(!mats.empty()) | ||||
|                     return mats[0]; | ||||
|                 osg::NodePathList nodepaths = node->getParentalNodePaths(); | ||||
|                 if(!nodepaths.empty()) | ||||
|                     return osg::computeLocalToWorld(nodepaths[0]); | ||||
|             } | ||||
|         } | ||||
|         return osg::Matrixf::translate(actor.getRefData().getPosition().asVec3()); | ||||
|  |  | |||
|  | @ -53,14 +53,14 @@ void ESM::Header::load (ESMReader &esm) | |||
|     { | ||||
|         esm.getSubHeader(); | ||||
|         mSCRD.resize(esm.getSubSize()); | ||||
|         if (mSCRD.size()) | ||||
|         if (!mSCRD.empty()) | ||||
|             esm.getExact(&mSCRD[0], mSCRD.size()); | ||||
|     } | ||||
|     if (esm.isNextSub("SCRS")) | ||||
|     { | ||||
|         esm.getSubHeader(); | ||||
|         mSCRS.resize(esm.getSubSize()); | ||||
|         if (mSCRS.size()) | ||||
|         if (!mSCRS.empty()) | ||||
|             esm.getExact(&mSCRS[0], mSCRS.size()); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -962,7 +962,7 @@ namespace NifOsg | |||
|                 if (uvSet >= (int)data->uvlist.size()) | ||||
|                 { | ||||
|                     std::cerr << "Warning: out of bounds UV set " << uvSet << " on TriShape \"" << triShape->name << "\" in " << mFilename << std::endl; | ||||
|                     if (data->uvlist.size()) | ||||
|                     if (!data->uvlist.empty()) | ||||
|                         geometry->setTexCoordArray(textureStage, data->uvlist[0]); | ||||
|                     continue; | ||||
|                 } | ||||
|  | @ -1040,7 +1040,7 @@ namespace NifOsg | |||
|             triShapeToGeometry(triShape, morphGeom, parentNode, composite, boundTextures, animflags); | ||||
| 
 | ||||
|             const std::vector<Nif::NiMorphData::MorphData>& morphs = morpher->data.getPtr()->mMorphs; | ||||
|             if (!morphs.size()) | ||||
|             if (morphs.empty()) | ||||
|                 return morphGeom; | ||||
|             // Note we are not interested in morph 0, which just contains the original vertices
 | ||||
|             for (unsigned int i = 1; i < morphs.size(); ++i) | ||||
|  | @ -1228,7 +1228,7 @@ namespace NifOsg | |||
|                 return NULL; | ||||
|             } | ||||
| 
 | ||||
|             if (!pixelData->mipmaps.size()) | ||||
|             if (pixelData->mipmaps.empty()) | ||||
|                 return NULL; | ||||
| 
 | ||||
|             unsigned char* data = new unsigned char[pixelData->data.size()]; | ||||
|  | @ -1274,7 +1274,7 @@ namespace NifOsg | |||
| 
 | ||||
|         void handleTextureProperty(const Nif::NiTexturingProperty* texprop, osg::StateSet* stateset, SceneUtil::CompositeStateSetUpdater* composite, Resource::ImageManager* imageManager, std::vector<int>& boundTextures, int animflags) | ||||
|         { | ||||
|             if (boundTextures.size()) | ||||
|             if (!boundTextures.empty()) | ||||
|             { | ||||
|                 // overriding a parent NiTexturingProperty, so remove what was previously bound
 | ||||
|                 for (unsigned int i=0; i<boundTextures.size(); ++i) | ||||
|  |  | |||
|  | @ -261,10 +261,10 @@ void Emitter::emitParticles(double dt) | |||
|     osg::Matrix worldToPs; | ||||
| 
 | ||||
|     // maybe this could be optimized by halting at the lowest common ancestor of the particle and emitter nodes
 | ||||
|     osg::MatrixList worldMats = getParticleSystem()->getWorldMatrices(); | ||||
|     if (!worldMats.empty()) | ||||
|     osg::NodePathList partsysNodePaths = getParticleSystem()->getParentalNodePaths(); | ||||
|     if (!partsysNodePaths.empty()) | ||||
|     { | ||||
|         const osg::Matrix psToWorld = worldMats[0]; | ||||
|         osg::Matrix psToWorld = osg::computeLocalToWorld(partsysNodePaths[0]); | ||||
|         worldToPs = osg::Matrix::inverse(psToWorld); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -69,10 +69,10 @@ namespace | |||
| 
 | ||||
|         void transformInitialParticles(osgParticle::ParticleSystem* partsys, osg::Node* node) | ||||
|         { | ||||
|             osg::MatrixList mats = node->getWorldMatrices(); | ||||
|             if (mats.empty()) | ||||
|             osg::NodePathList nodepaths = node->getParentalNodePaths(); | ||||
|             if (nodepaths.empty()) | ||||
|                 return; | ||||
|             osg::Matrixf worldMat = mats[0]; | ||||
|             osg::Matrixf worldMat = osg::computeLocalToWorld(nodepaths[0]); | ||||
|             worldMat.orthoNormalize(worldMat); // scale is already applied on the particle node
 | ||||
|             for (int i=0; i<partsys->numParticles(); ++i) | ||||
|             { | ||||
|  |  | |||
|  | @ -351,7 +351,7 @@ namespace SceneUtil | |||
|                     mLightList.push_back(&l); | ||||
|             } | ||||
|         } | ||||
|         if (mLightList.size()) | ||||
|         if (!mLightList.empty()) | ||||
|         { | ||||
|             unsigned int maxLights = static_cast<unsigned int> (8 - mLightManager->getStartLight()); | ||||
| 
 | ||||
|  |  | |||
|  | @ -87,7 +87,7 @@ osg::ref_ptr<WorkItem> WorkQueue::removeWorkItem() | |||
|     { | ||||
|         mCondition.wait(&mMutex); | ||||
|     } | ||||
|     if (mQueue.size()) | ||||
|     if (!mQueue.empty()) | ||||
|     { | ||||
|         osg::ref_ptr<WorkItem> item = mQueue.front(); | ||||
|         mQueue.pop(); | ||||
|  |  | |||
|  | @ -103,7 +103,7 @@ namespace Shader | |||
|         if (mAllowedToModifyStateSets) | ||||
|             writableStateSet = node.getStateSet(); | ||||
|         const osg::StateSet::TextureAttributeList& texAttributes = stateset->getTextureAttributeList(); | ||||
|         if (texAttributes.size()) | ||||
|         if (!texAttributes.empty()) | ||||
|         { | ||||
|             const osg::Texture* diffuseMap = NULL; | ||||
|             const osg::Texture* normalMap = NULL; | ||||
|  | @ -142,13 +142,6 @@ namespace Shader | |||
|                             std::cerr << "ShaderVisitor encountered unknown texture " << texture << std::endl; | ||||
|                     } | ||||
|                 } | ||||
|                 // remove state that has no effect when rendering with shaders
 | ||||
|                 if (stateset->getTextureAttribute(unit, osg::StateAttribute::TEXENV)) | ||||
|                 { | ||||
|                     if (!writableStateSet) | ||||
|                         writableStateSet = getWritableStateSet(node); | ||||
|                     writableStateSet->removeTextureAttribute(unit, osg::StateAttribute::TEXENV); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             if (mAutoUseNormalMaps && diffuseMap != NULL && normalMap == NULL) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue