2015-04-19 15:55:56 +00:00
|
|
|
#ifndef OPENMW_MWRENDER_UTIL_H
|
|
|
|
#define OPENMW_MWRENDER_UTIL_H
|
|
|
|
|
2016-01-29 16:00:18 +00:00
|
|
|
#include <osg/NodeCallback>
|
2020-05-01 19:37:01 +00:00
|
|
|
#include <osg/Camera>
|
2015-04-19 15:55:56 +00:00
|
|
|
#include <osg/ref_ptr>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace osg
|
|
|
|
{
|
|
|
|
class Node;
|
2020-05-01 19:37:01 +00:00
|
|
|
class Texture2D;
|
2015-04-19 15:55:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Resource
|
|
|
|
{
|
|
|
|
class ResourceSystem;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWRender
|
|
|
|
{
|
2016-09-14 14:18:29 +00:00
|
|
|
// Overrides the texture of nodes in the mesh that had the same NiTexturingProperty as the first NiTexturingProperty of the .NIF file's root node,
|
|
|
|
// if it had a NiTexturingProperty. Used for applying "particle textures" to magic effects.
|
2016-09-12 10:20:33 +00:00
|
|
|
void overrideFirstRootTexture(const std::string &texture, Resource::ResourceSystem *resourceSystem, osg::ref_ptr<osg::Node> node);
|
|
|
|
|
2015-04-19 15:55:56 +00:00
|
|
|
void overrideTexture(const std::string& texture, Resource::ResourceSystem* resourceSystem, osg::ref_ptr<osg::Node> node);
|
|
|
|
|
2016-01-29 16:00:18 +00:00
|
|
|
// Node callback to entirely skip the traversal.
|
|
|
|
class NoTraverseCallback : public osg::NodeCallback
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 18:18:54 +00:00
|
|
|
void operator()(osg::Node* node, osg::NodeVisitor* nv) override
|
2016-01-29 16:00:18 +00:00
|
|
|
{
|
|
|
|
// no traverse()
|
|
|
|
}
|
|
|
|
};
|
2020-05-01 19:37:01 +00:00
|
|
|
|
|
|
|
/// Draw callback for RTT that can be used to regenerate mipmaps
|
|
|
|
/// either as a predraw before use or a postdraw after RTT.
|
|
|
|
class MipmapCallback : public osg::Camera::DrawCallback
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MipmapCallback(osg::Texture2D* texture)
|
|
|
|
: mTexture(texture)
|
|
|
|
{}
|
|
|
|
|
|
|
|
~MipmapCallback();
|
|
|
|
|
|
|
|
void operator()(osg::RenderInfo& info) const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::Texture2D> mTexture;
|
|
|
|
};
|
2015-04-19 15:55:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|