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