forked from mirror/openmw-tes3mp
Revert "Merged pull request #1573"
This reverts commit7324bd368f
, reversing changes made to810e4416f6
.
This commit is contained in:
parent
99ffaafe30
commit
cfdf99f601
14 changed files with 23 additions and 143 deletions
|
@ -5,9 +5,6 @@
|
|||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include <osg/ref_ptr>
|
||||
#include <osg/Node>
|
||||
|
||||
#include <components/esm/cellid.hpp>
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
@ -537,7 +534,7 @@ namespace MWBase
|
|||
/// Spawn a blood effect for \a ptr at \a worldPosition
|
||||
virtual void spawnBloodEffect (const MWWorld::Ptr& ptr, const osg::Vec3f& worldPosition) = 0;
|
||||
|
||||
virtual void spawnEffect (const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPos, float scale = 1.f, bool isMagicVFX = true) = 0;
|
||||
virtual void spawnEffect (const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPos) = 0;
|
||||
|
||||
virtual void explodeSpell(const osg::Vec3f& origin, const ESM::EffectList& effects, const MWWorld::Ptr& caster,
|
||||
const MWWorld::Ptr& ignore, ESM::RangeType rangeType, const std::string& id,
|
||||
|
@ -579,8 +576,6 @@ namespace MWBase
|
|||
|
||||
/// Preload VFX associated with this effect list
|
||||
virtual void preloadEffects(const ESM::EffectList* effectList) = 0;
|
||||
|
||||
virtual osg::ref_ptr<osg::Node> getInstance (const std::string& modelName) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -833,7 +833,6 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim
|
|||
refreshCurrentAnims(mIdleState, mMovementState, mJumpState, true);
|
||||
|
||||
mAnimation->runAnimation(0.f);
|
||||
mAnimation->updateEffects(0.f);
|
||||
|
||||
unpersistAnimationState();
|
||||
}
|
||||
|
@ -1997,13 +1996,6 @@ void CharacterController::update(float duration)
|
|||
}
|
||||
|
||||
osg::Vec3f moved = mAnimation->runAnimation(mSkipAnim ? 0.f : duration);
|
||||
|
||||
// treat player specifically since he is not in rendering mObjects
|
||||
if (mPtr == getPlayer())
|
||||
{
|
||||
mAnimation->updateEffects(mSkipAnim ? 0.f : duration);
|
||||
}
|
||||
|
||||
if(duration > 0.0f)
|
||||
moved /= duration;
|
||||
else
|
||||
|
@ -2199,7 +2191,6 @@ void CharacterController::forceStateUpdate()
|
|||
}
|
||||
|
||||
mAnimation->runAnimation(0.f);
|
||||
mAnimation->updateEffects(0.f);
|
||||
}
|
||||
|
||||
CharacterController::KillResult CharacterController::kill()
|
||||
|
|
|
@ -6,12 +6,8 @@
|
|||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include <osg/BoundingBox>
|
||||
#include <osg/ComputeBoundsVisitor>
|
||||
|
||||
#include <components/misc/rng.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
@ -28,7 +24,6 @@
|
|||
#include "../mwworld/inventorystore.hpp"
|
||||
|
||||
#include "../mwrender/animation.hpp"
|
||||
#include "../mwrender/vismask.hpp"
|
||||
|
||||
#include "npcstats.hpp"
|
||||
#include "actorutil.hpp"
|
||||
|
@ -997,13 +992,11 @@ namespace MWMechanics
|
|||
return true;
|
||||
}
|
||||
|
||||
void CastSpell::playSpellCastingEffects(const std::string &spellid)
|
||||
{
|
||||
void CastSpell::playSpellCastingEffects(const std::string &spellid){
|
||||
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Spell *spell = store.get<ESM::Spell>().find(spellid);
|
||||
|
||||
std::vector<std::string> addedEffects;
|
||||
|
||||
for (std::vector<ESM::ENAMstruct>::const_iterator iter = spell->mEffects.mList.begin();
|
||||
iter != spell->mEffects.mList.end(); ++iter)
|
||||
{
|
||||
|
@ -1012,6 +1005,8 @@ namespace MWMechanics
|
|||
|
||||
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(mCaster);
|
||||
|
||||
if (animation && mCaster.getClass().isActor()) // TODO: Non-actors should also create a spell cast vfx even if they are disabled (animation == NULL)
|
||||
{
|
||||
const ESM::Static* castStatic;
|
||||
|
||||
if (!effect->mCasting.empty())
|
||||
|
@ -1019,65 +1014,9 @@ namespace MWMechanics
|
|||
else
|
||||
castStatic = store.get<ESM::Static>().find ("VFX_DefaultCast");
|
||||
|
||||
// check if the effect was already added
|
||||
if (std::find(addedEffects.begin(), addedEffects.end(), "meshes\\" + castStatic->mModel) != addedEffects.end())
|
||||
continue;
|
||||
|
||||
std::string texture = effect->mParticle;
|
||||
|
||||
float scale = 1.0f;
|
||||
osg::Vec3f pos (mCaster.getRefData().getPosition().asVec3());
|
||||
|
||||
if (animation && mCaster.getClass().isNpc())
|
||||
{
|
||||
// For NOC we should take race height as scaling factor
|
||||
const ESM::NPC *npc = mCaster.get<ESM::NPC>()->mBase;
|
||||
const MWWorld::ESMStore &esmStore =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
const ESM::Race *race =
|
||||
esmStore.get<ESM::Race>().find(npc->mRace);
|
||||
|
||||
scale = npc->isMale() ? race->mData.mHeight.mMale : race->mData.mHeight.mFemale;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string casterModel = mCaster.getClass().getModel(mCaster);
|
||||
osg::ref_ptr<osg::Node> model = MWBase::Environment::get().getWorld()->getInstance(casterModel);
|
||||
|
||||
osg::ComputeBoundsVisitor computeBoundsVisitor;
|
||||
computeBoundsVisitor.setTraversalMask(~(MWRender::Mask_ParticleSystem|MWRender::Mask_Effect));
|
||||
model->accept(computeBoundsVisitor);
|
||||
osg::BoundingBox bounds = computeBoundsVisitor.getBoundingBox();
|
||||
|
||||
if (bounds.valid())
|
||||
{
|
||||
float meshSizeX = std::abs(bounds.xMax() - bounds.xMin());
|
||||
float meshSizeY = std::abs(bounds.yMax() - bounds.yMin());
|
||||
float meshSizeZ = std::abs(bounds.zMax() - bounds.zMin());
|
||||
|
||||
// TODO: take a size of particle or NPC with height and weight = 1.0 as scale = 1.0
|
||||
float scaleX = meshSizeX/60.f;
|
||||
float scaleY = meshSizeY/60.f;
|
||||
float scaleZ = meshSizeZ/120.f;
|
||||
|
||||
scale = std::max({ scaleX, scaleY, scaleZ });
|
||||
|
||||
//pos = bounds.center();
|
||||
//pos[2] = bounds.zMin();
|
||||
}
|
||||
}
|
||||
|
||||
// If the caster has no animation, add the effect directly to the effectManager
|
||||
if (animation)
|
||||
{
|
||||
animation->addEffect("meshes\\" + castStatic->mModel, effect->mIndex, false, "", texture, scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We should set scale for effect manager manually
|
||||
float meshScale = !mCaster.getClass().isActor() ? mCaster.getCellRef().getScale() : 1.0f;
|
||||
MWBase::Environment::get().getWorld()->spawnEffect("meshes\\" + castStatic->mModel, effect->mParticle, pos, scale * meshScale);
|
||||
animation->addEffect("meshes\\" + castStatic->mModel, effect->mIndex, false, "", texture);
|
||||
}
|
||||
|
||||
if (animation && !mCaster.getClass().isActor())
|
||||
|
@ -1087,8 +1026,6 @@ namespace MWMechanics
|
|||
"alteration", "conjuration", "destruction", "illusion", "mysticism", "restoration"
|
||||
};
|
||||
|
||||
addedEffects.push_back("meshes\\" + castStatic->mModel);
|
||||
|
||||
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
||||
if(!effect->mCastSound.empty())
|
||||
sndMgr->playSound3D(mCaster, effect->mCastSound, 1.0f, 1.0f);
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#include <osg/MatrixTransform>
|
||||
#include <osg/BlendFunc>
|
||||
#include <osg/Material>
|
||||
#include <osg/ComputeBoundsVisitor>
|
||||
#include <osg/PositionAttitudeTransform>
|
||||
|
||||
#include <osgParticle/ParticleSystem>
|
||||
#include <osgParticle/ParticleProcessor>
|
||||
|
@ -1117,6 +1115,8 @@ namespace MWRender
|
|||
++stateiter;
|
||||
}
|
||||
|
||||
updateEffects(duration);
|
||||
|
||||
if (mHeadController)
|
||||
{
|
||||
const float epsilon = 0.001f;
|
||||
|
@ -1366,7 +1366,7 @@ namespace MWRender
|
|||
useQuadratic, quadraticValue, quadraticRadiusMult, useLinear, linearRadiusMult, linearValue);
|
||||
}
|
||||
|
||||
void Animation::addEffect (const std::string& model, int effectId, bool loop, const std::string& bonename, const std::string& texture, float scale)
|
||||
void Animation::addEffect (const std::string& model, int effectId, bool loop, const std::string& bonename, const std::string& texture)
|
||||
{
|
||||
if (!mObjectRoot.get())
|
||||
return;
|
||||
|
@ -1417,13 +1417,7 @@ namespace MWRender
|
|||
|
||||
overrideFirstRootTexture(texture, mResourceSystem, node);
|
||||
|
||||
osg::Vec3f scale3f (scale, scale, scale);
|
||||
|
||||
osg::ref_ptr<osg::PositionAttitudeTransform> trans = new osg::PositionAttitudeTransform;
|
||||
trans->setScale(scale3f);
|
||||
trans->addChild(node);
|
||||
parentNode->removeChild(node);
|
||||
parentNode->addChild(trans);
|
||||
// TODO: in vanilla morrowind the effect is scaled based on the host object's bounding box.
|
||||
|
||||
mEffects.push_back(params);
|
||||
}
|
||||
|
|
|
@ -364,7 +364,7 @@ public:
|
|||
* @param texture override the texture specified in the model's materials - if empty, do not override
|
||||
* @note Will not add an effect twice.
|
||||
*/
|
||||
void addEffect (const std::string& model, int effectId, bool loop = false, const std::string& bonename = "", const std::string& texture = "", float scale = 1.0f);
|
||||
void addEffect (const std::string& model, int effectId, bool loop = false, const std::string& bonename = "", const std::string& texture = "");
|
||||
void removeEffect (int effectId);
|
||||
void getLoopingEffects (std::vector<int>& out) const;
|
||||
|
||||
|
@ -446,6 +446,7 @@ public:
|
|||
|
||||
void setLoopingEnabled(const std::string &groupname, bool enabled);
|
||||
|
||||
/// This is typically called as part of runAnimation, but may be called manually if needed.
|
||||
void updateEffects(float duration);
|
||||
|
||||
/// Return a node with the specified name, or NULL if not existing.
|
||||
|
|
|
@ -26,13 +26,6 @@ EffectManager::~EffectManager()
|
|||
}
|
||||
|
||||
void EffectManager::addEffect(const std::string &model, const std::string& textureOverride, const osg::Vec3f &worldPosition, float scale, bool isMagicVFX)
|
||||
{
|
||||
osg::Vec3f scale3f (scale, scale, scale);
|
||||
|
||||
addEffect(model, textureOverride, worldPosition, scale3f, isMagicVFX);
|
||||
}
|
||||
|
||||
void EffectManager::addEffect(const std::string &model, const std::string& textureOverride, const osg::Vec3f &worldPosition, const osg::Vec3f &scale, bool isMagicVFX)
|
||||
{
|
||||
osg::ref_ptr<osg::Node> node = mResourceSystem->getSceneManager()->getInstance(model);
|
||||
|
||||
|
@ -47,7 +40,7 @@ void EffectManager::addEffect(const std::string &model, const std::string& textu
|
|||
|
||||
osg::ref_ptr<osg::PositionAttitudeTransform> trans = new osg::PositionAttitudeTransform;
|
||||
trans->setPosition(worldPosition);
|
||||
trans->setScale(scale);
|
||||
trans->setScale(osg::Vec3f(scale, scale, scale));
|
||||
trans->addChild(node);
|
||||
|
||||
SceneUtil::AssignControllerSourcesVisitor assignVisitor(effect.mAnimTime);
|
||||
|
|
|
@ -33,7 +33,6 @@ namespace MWRender
|
|||
|
||||
/// Add an effect. When it's finished playing, it will be removed automatically.
|
||||
void addEffect (const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPosition, float scale, bool isMagicVFX = true);
|
||||
void addEffect (const std::string &model, const std::string& textureOverride, const osg::Vec3f &worldPosition, const osg::Vec3f &scale3f, bool isMagicVFX);
|
||||
|
||||
void update(float dt);
|
||||
|
||||
|
|
|
@ -138,14 +138,6 @@ bool Objects::removeObject (const MWWorld::Ptr& ptr)
|
|||
return false;
|
||||
}
|
||||
|
||||
void Objects::updateEffects(float duration)
|
||||
{
|
||||
for(PtrAnimationMap::iterator iter = mObjects.begin();iter != mObjects.end();)
|
||||
{
|
||||
iter->second->updateEffects(duration);
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
void Objects::removeCell(const MWWorld::CellStore* store)
|
||||
{
|
||||
|
|
|
@ -88,8 +88,6 @@ public:
|
|||
bool removeObject (const MWWorld::Ptr& ptr);
|
||||
///< \return found?
|
||||
|
||||
void updateEffects(float duration);
|
||||
|
||||
void removeCell(const MWWorld::CellStore* store);
|
||||
|
||||
/// Updates containing cell for object rendering data
|
||||
|
|
|
@ -557,7 +557,6 @@ namespace MWRender
|
|||
mEffectManager->update(dt);
|
||||
mSky->update(dt);
|
||||
mWater->update(dt);
|
||||
mObjects->updateEffects(dt);
|
||||
}
|
||||
|
||||
mCamera->update(dt, paused);
|
||||
|
@ -844,9 +843,7 @@ namespace MWRender
|
|||
|
||||
void RenderingManager::spawnEffect(const std::string &model, const std::string &texture, const osg::Vec3f &worldPosition, float scale, bool isMagicVFX)
|
||||
{
|
||||
osg::Vec3f scale3f (scale, scale, scale);
|
||||
|
||||
mEffectManager->addEffect(model, texture, worldPosition, scale3f, isMagicVFX);
|
||||
mEffectManager->addEffect(model, texture, worldPosition, scale, isMagicVFX);
|
||||
}
|
||||
|
||||
void RenderingManager::notifyWorldSpaceChanged()
|
||||
|
@ -1125,12 +1122,6 @@ namespace MWRender
|
|||
updateProjectionMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Node> RenderingManager::getInstance(const std::string& modelName)
|
||||
{
|
||||
return mResourceSystem->getSceneManager()->getInstance(modelName);
|
||||
}
|
||||
|
||||
void RenderingManager::exportSceneGraph(const MWWorld::Ptr &ptr, const std::string &filename, const std::string &format)
|
||||
{
|
||||
osg::Node* node = mViewer->getSceneData();
|
||||
|
|
|
@ -205,8 +205,6 @@ namespace MWRender
|
|||
|
||||
LandManager* getLandManager() const;
|
||||
|
||||
osg::ref_ptr<osg::Node> getInstance(const std::string& modelName);
|
||||
|
||||
private:
|
||||
void updateProjectionMatrix();
|
||||
void updateTextureFiltering();
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <components/esm/loadcrea.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/scriptmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -1052,7 +1051,6 @@ namespace MWScript
|
|||
MWWorld::Ptr target = MWBase::Environment::get().getWorld()->getPtr (targetId, false);
|
||||
|
||||
MWMechanics::CastSpell cast(ptr, target);
|
||||
cast.playSpellCastingEffects(spell);
|
||||
cast.mHitPosition = target.getRefData().getPosition().asVec3();
|
||||
cast.mAlwaysSucceed = true;
|
||||
cast.cast(spell);
|
||||
|
|
|
@ -1535,11 +1535,6 @@ namespace MWWorld
|
|||
}
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Node> World::getInstance (const std::string& modelName)
|
||||
{
|
||||
return mRendering->getInstance(modelName);
|
||||
}
|
||||
|
||||
const ESM::Potion *World::createRecord (const ESM::Potion& record)
|
||||
{
|
||||
return mStore.insert(record);
|
||||
|
@ -3329,9 +3324,9 @@ namespace MWWorld
|
|||
mRendering->spawnEffect(model, texture, worldPosition, 1.0f, false);
|
||||
}
|
||||
|
||||
void World::spawnEffect(const std::string &model, const std::string &textureOverride, const osg::Vec3f &worldPos, float scale, bool isMagicVFX)
|
||||
void World::spawnEffect(const std::string &model, const std::string &textureOverride, const osg::Vec3f &worldPos)
|
||||
{
|
||||
mRendering->spawnEffect(model, textureOverride, worldPos, scale, isMagicVFX);
|
||||
mRendering->spawnEffect(model, textureOverride, worldPos);
|
||||
}
|
||||
|
||||
void World::explodeSpell(const osg::Vec3f& origin, const ESM::EffectList& effects, const Ptr& caster, const Ptr& ignore, ESM::RangeType rangeType,
|
||||
|
|
|
@ -640,7 +640,7 @@ namespace MWWorld
|
|||
/// Spawn a blood effect for \a ptr at \a worldPosition
|
||||
void spawnBloodEffect (const MWWorld::Ptr& ptr, const osg::Vec3f& worldPosition) override;
|
||||
|
||||
void spawnEffect (const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPos, float scale = 1.f, bool isMagicVFX = true) override;
|
||||
void spawnEffect (const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPos) override;
|
||||
|
||||
void explodeSpell(const osg::Vec3f& origin, const ESM::EffectList& effects, const MWWorld::Ptr& caster, const MWWorld::Ptr& ignore,
|
||||
ESM::RangeType rangeType, const std::string& id, const std::string& sourceName,
|
||||
|
@ -680,8 +680,6 @@ namespace MWWorld
|
|||
|
||||
/// Preload VFX associated with this effect list
|
||||
void preloadEffects(const ESM::EffectList* effectList) override;
|
||||
|
||||
osg::ref_ptr<osg::Node> getInstance (const std::string& modelName);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue