forked from teamnwah/openmw-tes3coop
InitWorldSpaceParticles fix
This commit is contained in:
parent
987918ca15
commit
7f9f9a32d2
5 changed files with 21 additions and 7 deletions
|
@ -107,12 +107,13 @@ void CreatureWeaponAnimation::updatePart(PartHolderPtr& scene, int slot)
|
||||||
bonename = "Shield Bone";
|
bonename = "Shield Bone";
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> node = mResourceSystem->getSceneManager()->createInstance(item.getClass().getModel(item));
|
osg::ref_ptr<osg::Node> node = mResourceSystem->getSceneManager()->createInstance(item.getClass().getModel(item));
|
||||||
SceneUtil::attach(node, mObjectRoot, bonename, bonename);
|
osg::ref_ptr<osg::Node> attached = SceneUtil::attach(node, mObjectRoot, bonename, bonename);
|
||||||
|
mResourceSystem->getSceneManager()->notifyAttached(attached);
|
||||||
|
|
||||||
scene.reset(new PartHolder(node));
|
scene.reset(new PartHolder(attached));
|
||||||
|
|
||||||
if (!item.getClass().getEnchantment(item).empty())
|
if (!item.getClass().getEnchantment(item).empty())
|
||||||
addGlow(node, getEnchantmentColor(item));
|
addGlow(attached, getEnchantmentColor(item));
|
||||||
|
|
||||||
// Crossbows start out with a bolt attached
|
// Crossbows start out with a bolt attached
|
||||||
// FIXME: code duplicated from NpcAnimation
|
// FIXME: code duplicated from NpcAnimation
|
||||||
|
@ -137,7 +138,7 @@ void CreatureWeaponAnimation::updatePart(PartHolderPtr& scene, int slot)
|
||||||
source.reset(new NullAnimationTime);
|
source.reset(new NullAnimationTime);
|
||||||
|
|
||||||
SceneUtil::AssignControllerSourcesVisitor assignVisitor(source);
|
SceneUtil::AssignControllerSourcesVisitor assignVisitor(source);
|
||||||
node->accept(assignVisitor);
|
attached->accept(assignVisitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatureWeaponAnimation::attachArrow()
|
void CreatureWeaponAnimation::attachArrow()
|
||||||
|
|
|
@ -49,6 +49,7 @@ void EffectManager::addEffect(const std::string &model, const std::string& textu
|
||||||
overrideTexture(textureOverride, mResourceSystem, node);
|
overrideTexture(textureOverride, mResourceSystem, node);
|
||||||
|
|
||||||
mParentNode->addChild(trans);
|
mParentNode->addChild(trans);
|
||||||
|
mResourceSystem->getSceneManager()->notifyAttached(node);
|
||||||
|
|
||||||
mEffects[trans] = effect;
|
mEffects[trans] = effect;
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,6 +628,7 @@ PartHolderPtr NpcAnimation::insertBoundedPart(const std::string& model, const st
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Node> instance = mResourceSystem->getSceneManager()->createInstance(model);
|
osg::ref_ptr<osg::Node> instance = mResourceSystem->getSceneManager()->createInstance(model);
|
||||||
osg::ref_ptr<osg::Node> attached = SceneUtil::attach(instance, mObjectRoot, bonefilter, bonename);
|
osg::ref_ptr<osg::Node> attached = SceneUtil::attach(instance, mObjectRoot, bonefilter, bonename);
|
||||||
|
mResourceSystem->getSceneManager()->notifyAttached(attached);
|
||||||
if (enchantedGlow)
|
if (enchantedGlow)
|
||||||
addGlow(attached, *glowColor);
|
addGlow(attached, *glowColor);
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,10 @@ namespace
|
||||||
|
|
||||||
void transformInitialParticles(osgParticle::ParticleSystem* partsys, osg::Node* node)
|
void transformInitialParticles(osgParticle::ParticleSystem* partsys, osg::Node* node)
|
||||||
{
|
{
|
||||||
osg::Matrix worldMat = node->getWorldMatrices()[0];
|
osg::MatrixList mats = node->getWorldMatrices();
|
||||||
|
if (mats.empty())
|
||||||
|
return;
|
||||||
|
osg::Matrix worldMat = mats[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)
|
||||||
{
|
{
|
||||||
|
@ -140,8 +143,7 @@ namespace Resource
|
||||||
void SceneManager::attachTo(osg::Node *instance, osg::Group *parentNode) const
|
void SceneManager::attachTo(osg::Node *instance, osg::Group *parentNode) const
|
||||||
{
|
{
|
||||||
parentNode->addChild(instance);
|
parentNode->addChild(instance);
|
||||||
InitWorldSpaceParticlesVisitor visitor;
|
notifyAttached(instance);
|
||||||
instance->accept(visitor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneManager::releaseGLObjects(osg::State *state)
|
void SceneManager::releaseGLObjects(osg::State *state)
|
||||||
|
@ -157,6 +159,12 @@ namespace Resource
|
||||||
mIncrementalCompileOperation = ico;
|
mIncrementalCompileOperation = ico;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SceneManager::notifyAttached(osg::Node *node) const
|
||||||
|
{
|
||||||
|
InitWorldSpaceParticlesVisitor visitor;
|
||||||
|
node->accept(visitor);
|
||||||
|
}
|
||||||
|
|
||||||
const VFS::Manager* SceneManager::getVFS() const
|
const VFS::Manager* SceneManager::getVFS() const
|
||||||
{
|
{
|
||||||
return mVFS;
|
return mVFS;
|
||||||
|
|
|
@ -64,6 +64,9 @@ namespace Resource
|
||||||
/// Set up an IncrementalCompileOperation for background compiling of loaded scenes.
|
/// Set up an IncrementalCompileOperation for background compiling of loaded scenes.
|
||||||
void setIncrementalCompileOperation(osgUtil::IncrementalCompileOperation* ico);
|
void setIncrementalCompileOperation(osgUtil::IncrementalCompileOperation* ico);
|
||||||
|
|
||||||
|
/// @note If you used SceneManager::attachTo, this was called automatically.
|
||||||
|
void notifyAttached(osg::Node* node) const;
|
||||||
|
|
||||||
const VFS::Manager* getVFS() const;
|
const VFS::Manager* getVFS() const;
|
||||||
|
|
||||||
Resource::TextureManager* getTextureManager();
|
Resource::TextureManager* getTextureManager();
|
||||||
|
|
Loading…
Reference in a new issue