mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 07:53:51 +00:00
enable particle shading and force particle normal to (0.3,0.3,0.3)
and update changelog
This commit is contained in:
parent
6e2a651252
commit
886fd5efc9
4 changed files with 34 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
||||||
0.47.0
|
0.47.0
|
||||||
------
|
------
|
||||||
|
|
||||||
|
Bug #3676: NiParticleColorModifier isn't applied properly
|
||||||
|
Bug #4949: Incorrect particle lighting when force shaders = true
|
||||||
Bug #5358: ForceGreeting always resets the dialogue window completely
|
Bug #5358: ForceGreeting always resets the dialogue window completely
|
||||||
Bug #5363: Enchantment autocalc not always 0/1
|
Bug #5363: Enchantment autocalc not always 0/1
|
||||||
Bug #5364: Script fails/stops if trying to startscript an unknown script
|
Bug #5364: Script fails/stops if trying to startscript an unknown script
|
||||||
|
|
|
@ -1078,6 +1078,8 @@ namespace NifOsg
|
||||||
trans->addChild(toAttach);
|
trans->addChild(toAttach);
|
||||||
parentNode->addChild(trans);
|
parentNode->addChild(trans);
|
||||||
}
|
}
|
||||||
|
// create partsys stateset in order to pass in ShaderVisitor like all other Drawables
|
||||||
|
partsys->getOrCreateStateSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triCommonToGeometry(osg::Geometry *geometry, const std::vector<osg::Vec3f>& vertices, const std::vector<osg::Vec3f>& normals, const std::vector<std::vector<osg::Vec2f>>& uvlist, const std::vector<osg::Vec4f>& colors, const std::vector<unsigned int>& boundTextures, const std::string& name)
|
void triCommonToGeometry(osg::Geometry *geometry, const std::vector<osg::Vec3f>& vertices, const std::vector<osg::Vec3f>& normals, const std::vector<std::vector<osg::Vec2f>>& uvlist, const std::vector<osg::Vec4f>& colors, const std::vector<unsigned int>& boundTextures, const std::string& name)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
#include <osg/Version>
|
||||||
#include <osg/MatrixTransform>
|
#include <osg/MatrixTransform>
|
||||||
#include <osg/Geometry>
|
#include <osg/Geometry>
|
||||||
|
|
||||||
|
@ -19,12 +20,19 @@ ParticleSystem::ParticleSystem()
|
||||||
: osgParticle::ParticleSystem()
|
: osgParticle::ParticleSystem()
|
||||||
, mQuota(std::numeric_limits<int>::max())
|
, mQuota(std::numeric_limits<int>::max())
|
||||||
{
|
{
|
||||||
|
mNormalArray = new osg::Vec3Array(1);
|
||||||
|
mNormalArray->setBinding(osg::Array::BIND_OVERALL);
|
||||||
|
(*mNormalArray.get())[0] = osg::Vec3(0.3, 0.3, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleSystem::ParticleSystem(const ParticleSystem ©, const osg::CopyOp ©op)
|
ParticleSystem::ParticleSystem(const ParticleSystem ©, const osg::CopyOp ©op)
|
||||||
: osgParticle::ParticleSystem(copy, copyop)
|
: osgParticle::ParticleSystem(copy, copyop)
|
||||||
, mQuota(copy.mQuota)
|
, mQuota(copy.mQuota)
|
||||||
{
|
{
|
||||||
|
mNormalArray = new osg::Vec3Array(1);
|
||||||
|
mNormalArray->setBinding(osg::Array::BIND_OVERALL);
|
||||||
|
(*mNormalArray.get())[0] = osg::Vec3(0.3, 0.3, 0.3);
|
||||||
|
|
||||||
// For some reason the osgParticle constructor doesn't copy the particles
|
// For some reason the osgParticle constructor doesn't copy the particles
|
||||||
for (int i=0;i<copy.numParticles()-copy.numDeadParticles();++i)
|
for (int i=0;i<copy.numParticles()-copy.numDeadParticles();++i)
|
||||||
ParticleSystem::createParticle(copy.getParticle(i));
|
ParticleSystem::createParticle(copy.getParticle(i));
|
||||||
|
@ -42,6 +50,25 @@ osgParticle::Particle* ParticleSystem::createParticle(const osgParticle::Particl
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) const
|
||||||
|
{
|
||||||
|
osg::State & state = *renderInfo.getState();
|
||||||
|
#if OSG_MIN_VERSION_REQUIRED(3, 5, 6)
|
||||||
|
if(state.useVertexArrayObject(getUseVertexArrayObject()))
|
||||||
|
{
|
||||||
|
state.getCurrentVertexArrayState()->assignNormalArrayDispatcher();
|
||||||
|
state.getCurrentVertexArrayState()->setNormalArray(state, mNormalArray);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
state.getAttributeDispatchers().activateNormalArray(mNormalArray);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
state.Normal(0.3, 0.3, 0.3);
|
||||||
|
#endif
|
||||||
|
osgParticle::ParticleSystem::drawImplementation(renderInfo);
|
||||||
|
}
|
||||||
|
|
||||||
void InverseWorldMatrix::operator()(osg::Node *node, osg::NodeVisitor *nv)
|
void InverseWorldMatrix::operator()(osg::Node *node, osg::NodeVisitor *nv)
|
||||||
{
|
{
|
||||||
if (nv && nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR)
|
if (nv && nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR)
|
||||||
|
|
|
@ -36,8 +36,11 @@ namespace NifOsg
|
||||||
|
|
||||||
void setQuota(int quota);
|
void setQuota(int quota);
|
||||||
|
|
||||||
|
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int mQuota;
|
int mQuota;
|
||||||
|
osg::ref_ptr<osg::Vec3Array> mNormalArray;
|
||||||
};
|
};
|
||||||
|
|
||||||
// HACK: Particle doesn't allow setting the initial age, but we need this for loading the particle system state
|
// HACK: Particle doesn't allow setting the initial age, but we need this for loading the particle system state
|
||||||
|
|
Loading…
Reference in a new issue