|
|
|
@ -277,11 +277,13 @@ namespace NifOsg
|
|
|
|
|
public:
|
|
|
|
|
/// @param filename used for warning messages.
|
|
|
|
|
LoaderImpl(const std::string& filename)
|
|
|
|
|
: mFilename(filename)
|
|
|
|
|
: mFilename(filename), mFirstRootTextureIndex(-1), mFoundFirstRootTexturingProperty(false)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
std::string mFilename;
|
|
|
|
|
size_t mFirstRootTextureIndex;
|
|
|
|
|
bool mFoundFirstRootTexturingProperty;
|
|
|
|
|
|
|
|
|
|
static void loadKf(Nif::NIFFilePtr nif, KeyframeHolder& target)
|
|
|
|
|
{
|
|
|
|
@ -372,26 +374,21 @@ namespace NifOsg
|
|
|
|
|
void applyNodeProperties(const Nif::Node *nifNode, osg::Node *applyTo, SceneUtil::CompositeStateSetUpdater* composite, Resource::ImageManager* imageManager, std::vector<int>& boundTextures, int animflags)
|
|
|
|
|
{
|
|
|
|
|
const Nif::PropertyList& props = nifNode->props;
|
|
|
|
|
bool foundFirstRootTexturingProperty = false;
|
|
|
|
|
for (size_t i = 0; i <props.length(); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (!props[i].empty())
|
|
|
|
|
{
|
|
|
|
|
// store the recIndex of the NiTexturingProperty. Used for spells when overriding textures.
|
|
|
|
|
// Get the lowest numbered one for the root node. This is what is overridden when a spell
|
|
|
|
|
// effect "particle texture" is used. For non-root nodes we keep setting until we have the highest
|
|
|
|
|
// numbered one, which is the one that displays in the game and can be overridden if it matches the
|
|
|
|
|
// lowest one on the root.
|
|
|
|
|
if (!foundFirstRootTexturingProperty && nifNode->parent == NULL && props[i].getPtr()->recType == Nif::RC_NiTexturingProperty)
|
|
|
|
|
// Get the lowest numbered recIndex of the NiTexturingProperty root node.
|
|
|
|
|
// This is what is overridden when a spell effect "particle texture" is used.
|
|
|
|
|
if (nifNode->parent == NULL && !mFoundFirstRootTexturingProperty && props[i].getPtr()->recType == Nif::RC_NiTexturingProperty)
|
|
|
|
|
{
|
|
|
|
|
int index = props[i].getPtr()->recIndex;
|
|
|
|
|
applyTo->setUserValue("overrideIndex", index);
|
|
|
|
|
foundFirstRootTexturingProperty = true;
|
|
|
|
|
mFirstRootTextureIndex = props[i].getPtr()->recIndex;
|
|
|
|
|
mFoundFirstRootTexturingProperty = true;
|
|
|
|
|
}
|
|
|
|
|
else if (props[i].getPtr()->recType == Nif::RC_NiTexturingProperty)
|
|
|
|
|
{
|
|
|
|
|
int index = props[i].getPtr()->recIndex;
|
|
|
|
|
applyTo->setUserValue("NiTexturingPropertyIndex", index);
|
|
|
|
|
if (props[i].getPtr()->recIndex == mFirstRootTextureIndex)
|
|
|
|
|
applyTo->setUserValue("overrideFx", 1);
|
|
|
|
|
}
|
|
|
|
|
handleProperty(props[i].getPtr(), applyTo, composite, imageManager, boundTextures, animflags);
|
|
|
|
|
}
|
|
|
|
|