forked from teamnwah/openmw-tes3coop
More renaming of TextureManager -> ImageManager
This commit is contained in:
parent
5ee3d1698f
commit
9e53e12c70
20 changed files with 85 additions and 85 deletions
|
@ -194,7 +194,7 @@ namespace MWGui
|
||||||
, mVersionDescription(versionDescription)
|
, mVersionDescription(versionDescription)
|
||||||
{
|
{
|
||||||
float uiScale = Settings::Manager::getFloat("scaling factor", "GUI");
|
float uiScale = Settings::Manager::getFloat("scaling factor", "GUI");
|
||||||
mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getTextureManager(), uiScale);
|
mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getImageManager(), uiScale);
|
||||||
mGuiPlatform->initialise(resourcePath, logpath);
|
mGuiPlatform->initialise(resourcePath, logpath);
|
||||||
|
|
||||||
mGui = new MyGUI::Gui;
|
mGui = new MyGUI::Gui;
|
||||||
|
@ -2015,7 +2015,7 @@ namespace MWGui
|
||||||
continue;
|
continue;
|
||||||
std::string tex_name = imgSetPointer->getImageSet()->getIndexInfo(0,0).texture;
|
std::string tex_name = imgSetPointer->getImageSet()->getIndexInfo(0,0).texture;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Image> image = mResourceSystem->getTextureManager()->getImage(tex_name);
|
osg::ref_ptr<osg::Image> image = mResourceSystem->getImageManager()->getImage(tex_name);
|
||||||
|
|
||||||
if(image.valid())
|
if(image.valid())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1059,7 +1059,7 @@ namespace MWRender
|
||||||
stream << i;
|
stream << i;
|
||||||
stream << ".dds";
|
stream << ".dds";
|
||||||
|
|
||||||
osg::ref_ptr<osg::Image> image = mResourceSystem->getTextureManager()->getImage(stream.str());
|
osg::ref_ptr<osg::Image> image = mResourceSystem->getImageManager()->getImage(stream.str());
|
||||||
osg::ref_ptr<osg::Texture2D> tex (new osg::Texture2D(image));
|
osg::ref_ptr<osg::Texture2D> tex (new osg::Texture2D(image));
|
||||||
tex->setWrap(osg::Texture::WRAP_S, osg::Texture2D::REPEAT);
|
tex->setWrap(osg::Texture::WRAP_S, osg::Texture2D::REPEAT);
|
||||||
tex->setWrap(osg::Texture::WRAP_T, osg::Texture2D::REPEAT);
|
tex->setWrap(osg::Texture::WRAP_T, osg::Texture2D::REPEAT);
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace
|
||||||
{
|
{
|
||||||
std::ostringstream texname;
|
std::ostringstream texname;
|
||||||
texname << "textures/water/" << tex << std::setw(2) << std::setfill('0') << i << ".dds";
|
texname << "textures/water/" << tex << std::setw(2) << std::setfill('0') << i << ".dds";
|
||||||
osg::ref_ptr<osg::Texture2D> tex (new osg::Texture2D(resourceSystem->getTextureManager()->getImage(texname.str())));
|
osg::ref_ptr<osg::Texture2D> tex (new osg::Texture2D(resourceSystem->getImageManager()->getImage(texname.str())));
|
||||||
tex->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
tex->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
||||||
tex->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
|
tex->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
|
||||||
resourceSystem->getSceneManager()->applyFilterSettings(tex);
|
resourceSystem->getSceneManager()->applyFilterSettings(tex);
|
||||||
|
|
|
@ -134,10 +134,10 @@ private:
|
||||||
class AtmosphereNightUpdater : public SceneUtil::StateSetUpdater
|
class AtmosphereNightUpdater : public SceneUtil::StateSetUpdater
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AtmosphereNightUpdater(Resource::ImageManager* textureManager)
|
AtmosphereNightUpdater(Resource::ImageManager* imageManager)
|
||||||
{
|
{
|
||||||
// we just need a texture, its contents don't really matter
|
// we just need a texture, its contents don't really matter
|
||||||
mTexture = new osg::Texture2D(textureManager->getWarningImage());
|
mTexture = new osg::Texture2D(imageManager->getWarningImage());
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFade(const float fade)
|
void setFade(const float fade)
|
||||||
|
@ -469,14 +469,14 @@ const float CelestialBody::mDistance = 1000.0f;
|
||||||
class Sun : public CelestialBody
|
class Sun : public CelestialBody
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Sun(osg::Group* parentNode, Resource::ImageManager& textureManager)
|
Sun(osg::Group* parentNode, Resource::ImageManager& imageManager)
|
||||||
: CelestialBody(parentNode, 1.0f, 1)
|
: CelestialBody(parentNode, 1.0f, 1)
|
||||||
, mUpdater(new Updater)
|
, mUpdater(new Updater)
|
||||||
{
|
{
|
||||||
mTransform->addUpdateCallback(mUpdater);
|
mTransform->addUpdateCallback(mUpdater);
|
||||||
mTransform->setNodeMask(Mask_Sun);
|
mTransform->setNodeMask(Mask_Sun);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Texture2D> sunTex (new osg::Texture2D(textureManager.getImage("textures/tx_sun_05.dds")));
|
osg::ref_ptr<osg::Texture2D> sunTex (new osg::Texture2D(imageManager.getImage("textures/tx_sun_05.dds")));
|
||||||
sunTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
sunTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
||||||
sunTex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
sunTex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ public:
|
||||||
mOcclusionQueryVisiblePixels = createOcclusionQueryNode(queryNode, true);
|
mOcclusionQueryVisiblePixels = createOcclusionQueryNode(queryNode, true);
|
||||||
mOcclusionQueryTotalPixels = createOcclusionQueryNode(queryNode, false);
|
mOcclusionQueryTotalPixels = createOcclusionQueryNode(queryNode, false);
|
||||||
|
|
||||||
createSunFlash(textureManager);
|
createSunFlash(imageManager);
|
||||||
createSunGlare();
|
createSunGlare();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,9 +602,9 @@ private:
|
||||||
return oqn;
|
return oqn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void createSunFlash(Resource::ImageManager& textureManager)
|
void createSunFlash(Resource::ImageManager& imageManager)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Texture2D> tex (new osg::Texture2D(textureManager.getImage("textures/tx_sun_flash_grey_05.dds")));
|
osg::ref_ptr<osg::Texture2D> tex (new osg::Texture2D(imageManager.getImage("textures/tx_sun_flash_grey_05.dds")));
|
||||||
tex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
tex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
||||||
tex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
tex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
||||||
|
|
||||||
|
@ -932,11 +932,11 @@ public:
|
||||||
Type_Secunda
|
Type_Secunda
|
||||||
};
|
};
|
||||||
|
|
||||||
Moon(osg::Group* parentNode, Resource::ImageManager& textureManager, float scaleFactor, Type type)
|
Moon(osg::Group* parentNode, Resource::ImageManager& imageManager, float scaleFactor, Type type)
|
||||||
: CelestialBody(parentNode, scaleFactor, 2)
|
: CelestialBody(parentNode, scaleFactor, 2)
|
||||||
, mType(type)
|
, mType(type)
|
||||||
, mPhase(MoonState::Phase_Unspecified)
|
, mPhase(MoonState::Phase_Unspecified)
|
||||||
, mUpdater(new Updater(textureManager))
|
, mUpdater(new Updater(imageManager))
|
||||||
{
|
{
|
||||||
setPhase(MoonState::Phase_Full);
|
setPhase(MoonState::Phase_Full);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
@ -1001,7 +1001,7 @@ public:
|
||||||
private:
|
private:
|
||||||
struct Updater : public SceneUtil::StateSetUpdater
|
struct Updater : public SceneUtil::StateSetUpdater
|
||||||
{
|
{
|
||||||
Resource::ImageManager& mTextureManager;
|
Resource::ImageManager& mImageManager;
|
||||||
osg::ref_ptr<osg::Texture2D> mPhaseTex;
|
osg::ref_ptr<osg::Texture2D> mPhaseTex;
|
||||||
osg::ref_ptr<osg::Texture2D> mCircleTex;
|
osg::ref_ptr<osg::Texture2D> mCircleTex;
|
||||||
float mTransparency;
|
float mTransparency;
|
||||||
|
@ -1009,8 +1009,8 @@ private:
|
||||||
osg::Vec4f mAtmosphereColor;
|
osg::Vec4f mAtmosphereColor;
|
||||||
osg::Vec4f mMoonColor;
|
osg::Vec4f mMoonColor;
|
||||||
|
|
||||||
Updater(Resource::ImageManager& textureManager)
|
Updater(Resource::ImageManager& imageManager)
|
||||||
: mTextureManager(textureManager)
|
: mImageManager(imageManager)
|
||||||
, mPhaseTex()
|
, mPhaseTex()
|
||||||
, mCircleTex()
|
, mCircleTex()
|
||||||
, mTransparency(1.0f)
|
, mTransparency(1.0f)
|
||||||
|
@ -1055,10 +1055,10 @@ private:
|
||||||
|
|
||||||
void setTextures(const std::string& phaseTex, const std::string& circleTex)
|
void setTextures(const std::string& phaseTex, const std::string& circleTex)
|
||||||
{
|
{
|
||||||
mPhaseTex = new osg::Texture2D(mTextureManager.getImage(phaseTex));
|
mPhaseTex = new osg::Texture2D(mImageManager.getImage(phaseTex));
|
||||||
mPhaseTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
mPhaseTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
||||||
mPhaseTex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
mPhaseTex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
||||||
mCircleTex = new osg::Texture2D(mTextureManager.getImage(circleTex));
|
mCircleTex = new osg::Texture2D(mImageManager.getImage(circleTex));
|
||||||
mCircleTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
mCircleTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
||||||
mCircleTex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
mCircleTex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
||||||
|
|
||||||
|
@ -1165,14 +1165,14 @@ void SkyManager::create()
|
||||||
atmosphereNight->getOrCreateStateSet()->setAttributeAndModes(createAlphaTrackingUnlitMaterial(), osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
|
atmosphereNight->getOrCreateStateSet()->setAttributeAndModes(createAlphaTrackingUnlitMaterial(), osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
|
||||||
ModVertexAlphaVisitor modStars(2);
|
ModVertexAlphaVisitor modStars(2);
|
||||||
atmosphereNight->accept(modStars);
|
atmosphereNight->accept(modStars);
|
||||||
mAtmosphereNightUpdater = new AtmosphereNightUpdater(mSceneManager->getTextureManager());
|
mAtmosphereNightUpdater = new AtmosphereNightUpdater(mSceneManager->getImageManager());
|
||||||
atmosphereNight->addUpdateCallback(mAtmosphereNightUpdater);
|
atmosphereNight->addUpdateCallback(mAtmosphereNightUpdater);
|
||||||
|
|
||||||
mSun.reset(new Sun(mEarlyRenderBinRoot, *mSceneManager->getTextureManager()));
|
mSun.reset(new Sun(mEarlyRenderBinRoot, *mSceneManager->getImageManager()));
|
||||||
|
|
||||||
const Fallback::Map* fallback=MWBase::Environment::get().getWorld()->getFallback();
|
const Fallback::Map* fallback=MWBase::Environment::get().getWorld()->getFallback();
|
||||||
mMasser.reset(new Moon(mEarlyRenderBinRoot, *mSceneManager->getTextureManager(), fallback->getFallbackFloat("Moons_Masser_Size")/125, Moon::Type_Masser));
|
mMasser.reset(new Moon(mEarlyRenderBinRoot, *mSceneManager->getImageManager(), fallback->getFallbackFloat("Moons_Masser_Size")/125, Moon::Type_Masser));
|
||||||
mSecunda.reset(new Moon(mEarlyRenderBinRoot, *mSceneManager->getTextureManager(), fallback->getFallbackFloat("Moons_Secunda_Size")/125, Moon::Type_Secunda));
|
mSecunda.reset(new Moon(mEarlyRenderBinRoot, *mSceneManager->getImageManager(), fallback->getFallbackFloat("Moons_Secunda_Size")/125, Moon::Type_Secunda));
|
||||||
|
|
||||||
mCloudNode = new osg::PositionAttitudeTransform;
|
mCloudNode = new osg::PositionAttitudeTransform;
|
||||||
mEarlyRenderBinRoot->addChild(mCloudNode);
|
mEarlyRenderBinRoot->addChild(mCloudNode);
|
||||||
|
@ -1347,7 +1347,7 @@ void SkyManager::createRain()
|
||||||
|
|
||||||
osg::ref_ptr<osg::StateSet> stateset (mRainParticleSystem->getOrCreateStateSet());
|
osg::ref_ptr<osg::StateSet> stateset (mRainParticleSystem->getOrCreateStateSet());
|
||||||
|
|
||||||
osg::ref_ptr<osg::Texture2D> raindropTex (new osg::Texture2D(mSceneManager->getTextureManager()->getImage("textures/tx_raindrop_01.dds")));
|
osg::ref_ptr<osg::Texture2D> raindropTex (new osg::Texture2D(mSceneManager->getImageManager()->getImage("textures/tx_raindrop_01.dds")));
|
||||||
raindropTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
raindropTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
||||||
raindropTex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
raindropTex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
||||||
|
|
||||||
|
@ -1557,7 +1557,7 @@ void SkyManager::setWeather(const WeatherResult& weather)
|
||||||
|
|
||||||
std::string texture = Misc::ResourceHelpers::correctTexturePath(mClouds, mSceneManager->getVFS());
|
std::string texture = Misc::ResourceHelpers::correctTexturePath(mClouds, mSceneManager->getVFS());
|
||||||
|
|
||||||
osg::ref_ptr<osg::Texture2D> cloudTex (new osg::Texture2D(mSceneManager->getTextureManager()->getImage(texture)));
|
osg::ref_ptr<osg::Texture2D> cloudTex (new osg::Texture2D(mSceneManager->getImageManager()->getImage(texture)));
|
||||||
cloudTex->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
cloudTex->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
||||||
cloudTex->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
|
cloudTex->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
|
||||||
|
|
||||||
|
@ -1572,7 +1572,7 @@ void SkyManager::setWeather(const WeatherResult& weather)
|
||||||
{
|
{
|
||||||
std::string texture = Misc::ResourceHelpers::correctTexturePath(mNextClouds, mSceneManager->getVFS());
|
std::string texture = Misc::ResourceHelpers::correctTexturePath(mNextClouds, mSceneManager->getVFS());
|
||||||
|
|
||||||
osg::ref_ptr<osg::Texture2D> cloudTex (new osg::Texture2D(mSceneManager->getTextureManager()->getImage(texture)));
|
osg::ref_ptr<osg::Texture2D> cloudTex (new osg::Texture2D(mSceneManager->getImageManager()->getImage(texture)));
|
||||||
cloudTex->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
cloudTex->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
||||||
cloudTex->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
|
cloudTex->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ void overrideTexture(const std::string &texture, Resource::ResourceSystem *resou
|
||||||
return;
|
return;
|
||||||
std::string correctedTexture = Misc::ResourceHelpers::correctTexturePath(texture, resourceSystem->getVFS());
|
std::string correctedTexture = Misc::ResourceHelpers::correctTexturePath(texture, resourceSystem->getVFS());
|
||||||
// Not sure if wrap settings should be pulled from the overridden texture?
|
// Not sure if wrap settings should be pulled from the overridden texture?
|
||||||
osg::ref_ptr<osg::Texture2D> tex = new osg::Texture2D(resourceSystem->getTextureManager()->getImage(correctedTexture));
|
osg::ref_ptr<osg::Texture2D> tex = new osg::Texture2D(resourceSystem->getImageManager()->getImage(correctedTexture));
|
||||||
tex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
tex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
||||||
tex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
tex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
||||||
|
|
||||||
|
|
|
@ -556,7 +556,7 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha)
|
||||||
{
|
{
|
||||||
std::ostringstream texname;
|
std::ostringstream texname;
|
||||||
texname << "textures/water/" << texture << std::setw(2) << std::setfill('0') << i << ".dds";
|
texname << "textures/water/" << texture << std::setw(2) << std::setfill('0') << i << ".dds";
|
||||||
osg::ref_ptr<osg::Texture2D> tex (new osg::Texture2D(mResourceSystem->getTextureManager()->getImage(texname.str())));
|
osg::ref_ptr<osg::Texture2D> tex (new osg::Texture2D(mResourceSystem->getImageManager()->getImage(texname.str())));
|
||||||
tex->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
tex->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
||||||
tex->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
|
tex->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
|
||||||
textures.push_back(tex);
|
textures.push_back(tex);
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
namespace osgMyGUI
|
namespace osgMyGUI
|
||||||
{
|
{
|
||||||
|
|
||||||
Platform::Platform(osgViewer::Viewer *viewer, osg::Group *guiRoot, Resource::ImageManager *textureManager, float uiScalingFactor)
|
Platform::Platform(osgViewer::Viewer *viewer, osg::Group *guiRoot, Resource::ImageManager *imageManager, float uiScalingFactor)
|
||||||
: mRenderManager(nullptr)
|
: mRenderManager(nullptr)
|
||||||
, mDataManager(nullptr)
|
, mDataManager(nullptr)
|
||||||
, mLogManager(nullptr)
|
, mLogManager(nullptr)
|
||||||
, mLogFacility(nullptr)
|
, mLogFacility(nullptr)
|
||||||
{
|
{
|
||||||
mLogManager = new MyGUI::LogManager();
|
mLogManager = new MyGUI::LogManager();
|
||||||
mRenderManager = new RenderManager(viewer, guiRoot, textureManager, uiScalingFactor);
|
mRenderManager = new RenderManager(viewer, guiRoot, imageManager, uiScalingFactor);
|
||||||
mDataManager = new DataManager();
|
mDataManager = new DataManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace osgMyGUI
|
||||||
class Platform
|
class Platform
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Platform(osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ImageManager* textureManager, float uiScalingFactor);
|
Platform(osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ImageManager* imageManager, float uiScalingFactor);
|
||||||
|
|
||||||
~Platform();
|
~Platform();
|
||||||
|
|
||||||
|
|
|
@ -353,10 +353,10 @@ void OSGVertexBuffer::create()
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
RenderManager::RenderManager(osgViewer::Viewer *viewer, osg::Group *sceneroot, Resource::ImageManager* textureManager, float scalingFactor)
|
RenderManager::RenderManager(osgViewer::Viewer *viewer, osg::Group *sceneroot, Resource::ImageManager* imageManager, float scalingFactor)
|
||||||
: mViewer(viewer)
|
: mViewer(viewer)
|
||||||
, mSceneRoot(sceneroot)
|
, mSceneRoot(sceneroot)
|
||||||
, mTextureManager(textureManager)
|
, mImageManager(imageManager)
|
||||||
, mUpdate(false)
|
, mUpdate(false)
|
||||||
, mIsInitialise(false)
|
, mIsInitialise(false)
|
||||||
, mInvScalingFactor(1.f)
|
, mInvScalingFactor(1.f)
|
||||||
|
@ -523,7 +523,7 @@ MyGUI::ITexture* RenderManager::createTexture(const std::string &name)
|
||||||
mTextures.erase(item);
|
mTextures.erase(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
OSGTexture* texture = new OSGTexture(name, mTextureManager);
|
OSGTexture* texture = new OSGTexture(name, mImageManager);
|
||||||
mTextures.insert(std::make_pair(name, texture));
|
mTextures.insert(std::make_pair(name, texture));
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ class RenderManager : public MyGUI::RenderManager, public MyGUI::IRenderTarget
|
||||||
osg::ref_ptr<osgViewer::Viewer> mViewer;
|
osg::ref_ptr<osgViewer::Viewer> mViewer;
|
||||||
osg::ref_ptr<osg::Group> mSceneRoot;
|
osg::ref_ptr<osg::Group> mSceneRoot;
|
||||||
osg::ref_ptr<Drawable> mDrawable;
|
osg::ref_ptr<Drawable> mDrawable;
|
||||||
Resource::ImageManager* mTextureManager;
|
Resource::ImageManager* mImageManager;
|
||||||
|
|
||||||
MyGUI::IntSize mViewSize;
|
MyGUI::IntSize mViewSize;
|
||||||
bool mUpdate;
|
bool mUpdate;
|
||||||
|
@ -54,7 +54,7 @@ class RenderManager : public MyGUI::RenderManager, public MyGUI::IRenderTarget
|
||||||
void destroyAllResources();
|
void destroyAllResources();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RenderManager(osgViewer::Viewer *viewer, osg::Group *sceneroot, Resource::ImageManager* textureManager, float scalingFactor);
|
RenderManager(osgViewer::Viewer *viewer, osg::Group *sceneroot, Resource::ImageManager* imageManager, float scalingFactor);
|
||||||
virtual ~RenderManager();
|
virtual ~RenderManager();
|
||||||
|
|
||||||
void initialise();
|
void initialise();
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
namespace osgMyGUI
|
namespace osgMyGUI
|
||||||
{
|
{
|
||||||
|
|
||||||
OSGTexture::OSGTexture(const std::string &name, Resource::ImageManager* textureManager)
|
OSGTexture::OSGTexture(const std::string &name, Resource::ImageManager* imageManager)
|
||||||
: mName(name)
|
: mName(name)
|
||||||
, mTextureManager(textureManager)
|
, mImageManager(imageManager)
|
||||||
, mFormat(MyGUI::PixelFormat::Unknow)
|
, mFormat(MyGUI::PixelFormat::Unknow)
|
||||||
, mUsage(MyGUI::TextureUsage::Default)
|
, mUsage(MyGUI::TextureUsage::Default)
|
||||||
, mNumElemBytes(0)
|
, mNumElemBytes(0)
|
||||||
|
@ -20,7 +20,7 @@ namespace osgMyGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
OSGTexture::OSGTexture(osg::Texture2D *texture)
|
OSGTexture::OSGTexture(osg::Texture2D *texture)
|
||||||
: mTextureManager(NULL)
|
: mImageManager(NULL)
|
||||||
, mTexture(texture)
|
, mTexture(texture)
|
||||||
, mFormat(MyGUI::PixelFormat::Unknow)
|
, mFormat(MyGUI::PixelFormat::Unknow)
|
||||||
, mUsage(MyGUI::TextureUsage::Default)
|
, mUsage(MyGUI::TextureUsage::Default)
|
||||||
|
@ -83,10 +83,10 @@ namespace osgMyGUI
|
||||||
|
|
||||||
void OSGTexture::loadFromFile(const std::string &fname)
|
void OSGTexture::loadFromFile(const std::string &fname)
|
||||||
{
|
{
|
||||||
if (!mTextureManager)
|
if (!mImageManager)
|
||||||
throw std::runtime_error("No texturemanager set");
|
throw std::runtime_error("No imagemanager set");
|
||||||
|
|
||||||
mTexture = new osg::Texture2D(mTextureManager->getImage(fname));
|
mTexture = new osg::Texture2D(mImageManager->getImage(fname));
|
||||||
mTexture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
mTexture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
||||||
mTexture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
mTexture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
||||||
// disable mip-maps
|
// disable mip-maps
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace osgMyGUI
|
||||||
|
|
||||||
class OSGTexture : public MyGUI::ITexture {
|
class OSGTexture : public MyGUI::ITexture {
|
||||||
std::string mName;
|
std::string mName;
|
||||||
Resource::ImageManager* mTextureManager;
|
Resource::ImageManager* mImageManager;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Image> mLockedImage;
|
osg::ref_ptr<osg::Image> mLockedImage;
|
||||||
osg::ref_ptr<osg::Texture2D> mTexture;
|
osg::ref_ptr<osg::Texture2D> mTexture;
|
||||||
|
@ -30,7 +30,7 @@ namespace osgMyGUI
|
||||||
size_t mNumElemBytes;
|
size_t mNumElemBytes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OSGTexture(const std::string &name, Resource::ImageManager* textureManager);
|
OSGTexture(const std::string &name, Resource::ImageManager* imageManager);
|
||||||
OSGTexture(osg::Texture2D* texture);
|
OSGTexture(osg::Texture2D* texture);
|
||||||
virtual ~OSGTexture();
|
virtual ~OSGTexture();
|
||||||
|
|
||||||
|
|
|
@ -343,7 +343,7 @@ namespace NifOsg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> load(Nif::NIFFilePtr nif, Resource::ImageManager* textureManager)
|
osg::ref_ptr<osg::Node> load(Nif::NIFFilePtr nif, Resource::ImageManager* imageManager)
|
||||||
{
|
{
|
||||||
if (nif->numRoots() < 1)
|
if (nif->numRoots() < 1)
|
||||||
nif->fail("Found no root nodes");
|
nif->fail("Found no root nodes");
|
||||||
|
@ -356,7 +356,7 @@ namespace NifOsg
|
||||||
|
|
||||||
osg::ref_ptr<TextKeyMapHolder> textkeys (new TextKeyMapHolder);
|
osg::ref_ptr<TextKeyMapHolder> textkeys (new TextKeyMapHolder);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> created = handleNode(nifNode, NULL, textureManager, std::vector<int>(), 0, 0, false, &textkeys->mTextKeys);
|
osg::ref_ptr<osg::Node> created = handleNode(nifNode, NULL, imageManager, std::vector<int>(), 0, 0, false, &textkeys->mTextKeys);
|
||||||
|
|
||||||
if (nif->getUseSkinning())
|
if (nif->getUseSkinning())
|
||||||
{
|
{
|
||||||
|
@ -369,13 +369,13 @@ namespace NifOsg
|
||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyNodeProperties(const Nif::Node *nifNode, osg::Node *applyTo, SceneUtil::CompositeStateSetUpdater* composite, Resource::ImageManager* textureManager, std::vector<int>& boundTextures, int animflags)
|
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;
|
const Nif::PropertyList& props = nifNode->props;
|
||||||
for (size_t i = 0; i <props.length();++i)
|
for (size_t i = 0; i <props.length();++i)
|
||||||
{
|
{
|
||||||
if (!props[i].empty())
|
if (!props[i].empty())
|
||||||
handleProperty(props[i].getPtr(), applyTo, composite, textureManager, boundTextures, animflags);
|
handleProperty(props[i].getPtr(), applyTo, composite, imageManager, boundTextures, animflags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ namespace NifOsg
|
||||||
return lod;
|
return lod;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> handleNode(const Nif::Node* nifNode, osg::Group* parentNode, Resource::ImageManager* textureManager,
|
osg::ref_ptr<osg::Node> handleNode(const Nif::Node* nifNode, osg::Group* parentNode, Resource::ImageManager* imageManager,
|
||||||
std::vector<int> boundTextures, int animflags, int particleflags, bool skipMeshes, TextKeyMap* textKeys, osg::Node* rootNode=NULL)
|
std::vector<int> boundTextures, int animflags, int particleflags, bool skipMeshes, TextKeyMap* textKeys, osg::Node* rootNode=NULL)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Group> node = new osg::MatrixTransform(nifNode->trafo.toMatrix());
|
osg::ref_ptr<osg::Group> node = new osg::MatrixTransform(nifNode->trafo.toMatrix());
|
||||||
|
@ -542,7 +542,7 @@ namespace NifOsg
|
||||||
|
|
||||||
osg::ref_ptr<SceneUtil::CompositeStateSetUpdater> composite = new SceneUtil::CompositeStateSetUpdater;
|
osg::ref_ptr<SceneUtil::CompositeStateSetUpdater> composite = new SceneUtil::CompositeStateSetUpdater;
|
||||||
|
|
||||||
applyNodeProperties(nifNode, node, composite, textureManager, boundTextures, animflags);
|
applyNodeProperties(nifNode, node, composite, imageManager, boundTextures, animflags);
|
||||||
|
|
||||||
if (nifNode->recType == Nif::RC_NiTriShape && !skipMeshes)
|
if (nifNode->recType == Nif::RC_NiTriShape && !skipMeshes)
|
||||||
{
|
{
|
||||||
|
@ -588,7 +588,7 @@ namespace NifOsg
|
||||||
{
|
{
|
||||||
if(!children[i].empty())
|
if(!children[i].empty())
|
||||||
{
|
{
|
||||||
handleNode(children[i].getPtr(), node, textureManager, boundTextures, animflags, particleflags, skipMeshes, textKeys, rootNode);
|
handleNode(children[i].getPtr(), node, imageManager, boundTextures, animflags, particleflags, skipMeshes, textKeys, rootNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -682,7 +682,7 @@ namespace NifOsg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleTextureControllers(const Nif::Property *texProperty, SceneUtil::CompositeStateSetUpdater* composite, Resource::ImageManager* textureManager, osg::StateSet *stateset, int animflags)
|
void handleTextureControllers(const Nif::Property *texProperty, SceneUtil::CompositeStateSetUpdater* composite, Resource::ImageManager* imageManager, osg::StateSet *stateset, int animflags)
|
||||||
{
|
{
|
||||||
for (Nif::ControllerPtr ctrl = texProperty->controller; !ctrl.empty(); ctrl = ctrl->next)
|
for (Nif::ControllerPtr ctrl = texProperty->controller; !ctrl.empty(); ctrl = ctrl->next)
|
||||||
{
|
{
|
||||||
|
@ -708,8 +708,8 @@ namespace NifOsg
|
||||||
wrapT = inherit->getWrap(osg::Texture2D::WRAP_T);
|
wrapT = inherit->getWrap(osg::Texture2D::WRAP_T);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string filename = Misc::ResourceHelpers::correctTexturePath(st->filename, textureManager->getVFS());
|
std::string filename = Misc::ResourceHelpers::correctTexturePath(st->filename, imageManager->getVFS());
|
||||||
osg::ref_ptr<osg::Texture2D> texture (new osg::Texture2D(textureManager->getImage(filename)));
|
osg::ref_ptr<osg::Texture2D> texture (new osg::Texture2D(imageManager->getImage(filename)));
|
||||||
texture->setWrap(osg::Texture::WRAP_S, wrapS);
|
texture->setWrap(osg::Texture::WRAP_S, wrapS);
|
||||||
texture->setWrap(osg::Texture::WRAP_T, wrapT);
|
texture->setWrap(osg::Texture::WRAP_T, wrapT);
|
||||||
textures.push_back(texture);
|
textures.push_back(texture);
|
||||||
|
@ -1244,7 +1244,7 @@ namespace NifOsg
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleProperty(const Nif::Property *property,
|
void handleProperty(const Nif::Property *property,
|
||||||
osg::Node *node, SceneUtil::CompositeStateSetUpdater* composite, Resource::ImageManager* textureManager, std::vector<int>& boundTextures, int animflags)
|
osg::Node *node, SceneUtil::CompositeStateSetUpdater* composite, Resource::ImageManager* imageManager, std::vector<int>& boundTextures, int animflags)
|
||||||
{
|
{
|
||||||
switch (property->recType)
|
switch (property->recType)
|
||||||
{
|
{
|
||||||
|
@ -1372,14 +1372,14 @@ namespace NifOsg
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string filename = Misc::ResourceHelpers::correctTexturePath(st->filename, textureManager->getVFS());
|
std::string filename = Misc::ResourceHelpers::correctTexturePath(st->filename, imageManager->getVFS());
|
||||||
|
|
||||||
unsigned int clamp = static_cast<unsigned int>(tex.clamp);
|
unsigned int clamp = static_cast<unsigned int>(tex.clamp);
|
||||||
int wrapT = (clamp) & 0x1;
|
int wrapT = (clamp) & 0x1;
|
||||||
int wrapS = (clamp >> 1) & 0x1;
|
int wrapS = (clamp >> 1) & 0x1;
|
||||||
|
|
||||||
// create a new texture, will later attempt to share using the SharedStateManager
|
// create a new texture, will later attempt to share using the SharedStateManager
|
||||||
osg::ref_ptr<osg::Texture2D> texture2d (new osg::Texture2D(textureManager->getImage(filename)));
|
osg::ref_ptr<osg::Texture2D> texture2d (new osg::Texture2D(imageManager->getImage(filename)));
|
||||||
texture2d->setWrap(osg::Texture::WRAP_S, wrapS ? osg::Texture::REPEAT : osg::Texture::CLAMP);
|
texture2d->setWrap(osg::Texture::WRAP_S, wrapS ? osg::Texture::REPEAT : osg::Texture::CLAMP);
|
||||||
texture2d->setWrap(osg::Texture::WRAP_T, wrapT ? osg::Texture::REPEAT : osg::Texture::CLAMP);
|
texture2d->setWrap(osg::Texture::WRAP_T, wrapT ? osg::Texture::REPEAT : osg::Texture::CLAMP);
|
||||||
|
|
||||||
|
@ -1423,7 +1423,7 @@ namespace NifOsg
|
||||||
|
|
||||||
boundTextures.push_back(tex.uvSet);
|
boundTextures.push_back(tex.uvSet);
|
||||||
}
|
}
|
||||||
handleTextureControllers(texprop, composite, textureManager, stateset, animflags);
|
handleTextureControllers(texprop, composite, imageManager, stateset, animflags);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1543,10 +1543,10 @@ namespace NifOsg
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> Loader::load(Nif::NIFFilePtr file, Resource::ImageManager* textureManager)
|
osg::ref_ptr<osg::Node> Loader::load(Nif::NIFFilePtr file, Resource::ImageManager* imageManager)
|
||||||
{
|
{
|
||||||
LoaderImpl impl(file->getFilename());
|
LoaderImpl impl(file->getFilename());
|
||||||
return impl.load(file, textureManager);
|
return impl.load(file, imageManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Loader::loadKf(Nif::NIFFilePtr kf, KeyframeHolder& target)
|
void Loader::loadKf(Nif::NIFFilePtr kf, KeyframeHolder& target)
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace NifOsg
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Create a scene graph for the given NIF. Auto-detects when skinning is used and wraps the graph in a Skeleton if so.
|
/// Create a scene graph for the given NIF. Auto-detects when skinning is used and wraps the graph in a Skeleton if so.
|
||||||
static osg::ref_ptr<osg::Node> load(Nif::NIFFilePtr file, Resource::ImageManager* textureManager);
|
static osg::ref_ptr<osg::Node> load(Nif::NIFFilePtr file, Resource::ImageManager* imageManager);
|
||||||
|
|
||||||
/// Load keyframe controllers from the given kf file.
|
/// Load keyframe controllers from the given kf file.
|
||||||
static void loadKf(Nif::NIFFilePtr kf, KeyframeHolder& target);
|
static void loadKf(Nif::NIFFilePtr kf, KeyframeHolder& target);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef OPENMW_COMPONENTS_RESOURCE_TEXTUREMANAGER_H
|
#ifndef OPENMW_COMPONENTS_RESOURCE_IMAGEMANAGER_H
|
||||||
#define OPENMW_COMPONENTS_RESOURCE_TEXTUREMANAGER_H
|
#define OPENMW_COMPONENTS_RESOURCE_IMAGEMANAGER_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
|
@ -13,8 +13,8 @@ namespace Resource
|
||||||
{
|
{
|
||||||
mNifFileManager.reset(new NifFileManager(vfs));
|
mNifFileManager.reset(new NifFileManager(vfs));
|
||||||
mKeyframeManager.reset(new KeyframeManager(vfs));
|
mKeyframeManager.reset(new KeyframeManager(vfs));
|
||||||
mTextureManager.reset(new ImageManager(vfs));
|
mImageManager.reset(new ImageManager(vfs));
|
||||||
mSceneManager.reset(new SceneManager(vfs, mTextureManager.get(), mNifFileManager.get()));
|
mSceneManager.reset(new SceneManager(vfs, mImageManager.get(), mNifFileManager.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceSystem::~ResourceSystem()
|
ResourceSystem::~ResourceSystem()
|
||||||
|
@ -27,9 +27,9 @@ namespace Resource
|
||||||
return mSceneManager.get();
|
return mSceneManager.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageManager* ResourceSystem::getTextureManager()
|
ImageManager* ResourceSystem::getImageManager()
|
||||||
{
|
{
|
||||||
return mTextureManager.get();
|
return mImageManager.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
NifFileManager* ResourceSystem::getNifFileManager()
|
NifFileManager* ResourceSystem::getNifFileManager()
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace Resource
|
||||||
~ResourceSystem();
|
~ResourceSystem();
|
||||||
|
|
||||||
SceneManager* getSceneManager();
|
SceneManager* getSceneManager();
|
||||||
ImageManager* getTextureManager();
|
ImageManager* getImageManager();
|
||||||
NifFileManager* getNifFileManager();
|
NifFileManager* getNifFileManager();
|
||||||
KeyframeManager* getKeyframeManager();
|
KeyframeManager* getKeyframeManager();
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ namespace Resource
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::auto_ptr<SceneManager> mSceneManager;
|
std::auto_ptr<SceneManager> mSceneManager;
|
||||||
std::auto_ptr<ImageManager> mTextureManager;
|
std::auto_ptr<ImageManager> mImageManager;
|
||||||
std::auto_ptr<NifFileManager> mNifFileManager;
|
std::auto_ptr<NifFileManager> mNifFileManager;
|
||||||
std::auto_ptr<KeyframeManager> mKeyframeManager;
|
std::auto_ptr<KeyframeManager> mKeyframeManager;
|
||||||
|
|
||||||
|
|
|
@ -227,9 +227,9 @@ namespace Resource
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SceneManager::SceneManager(const VFS::Manager *vfs, Resource::ImageManager* textureManager, Resource::NifFileManager* nifFileManager)
|
SceneManager::SceneManager(const VFS::Manager *vfs, Resource::ImageManager* imageManager, Resource::NifFileManager* nifFileManager)
|
||||||
: mVFS(vfs)
|
: mVFS(vfs)
|
||||||
, mTextureManager(textureManager)
|
, mImageManager(imageManager)
|
||||||
, mNifFileManager(nifFileManager)
|
, mNifFileManager(nifFileManager)
|
||||||
, mMinFilter(osg::Texture::LINEAR_MIPMAP_LINEAR)
|
, mMinFilter(osg::Texture::LINEAR_MIPMAP_LINEAR)
|
||||||
, mMagFilter(osg::Texture::LINEAR)
|
, mMagFilter(osg::Texture::LINEAR)
|
||||||
|
@ -249,8 +249,8 @@ namespace Resource
|
||||||
class ImageReadCallback : public osgDB::ReadFileCallback
|
class ImageReadCallback : public osgDB::ReadFileCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ImageReadCallback(Resource::ImageManager* textureMgr)
|
ImageReadCallback(Resource::ImageManager* imageMgr)
|
||||||
: mTextureManager(textureMgr)
|
: mImageManager(imageMgr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ namespace Resource
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return osgDB::ReaderWriter::ReadResult(mTextureManager->getImage(filename), osgDB::ReaderWriter::ReadResult::FILE_LOADED);
|
return osgDB::ReaderWriter::ReadResult(mImageManager->getImage(filename), osgDB::ReaderWriter::ReadResult::FILE_LOADED);
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
|
@ -267,7 +267,7 @@ namespace Resource
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Resource::ImageManager* mTextureManager;
|
Resource::ImageManager* mImageManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string getFileExtension(const std::string& file)
|
std::string getFileExtension(const std::string& file)
|
||||||
|
@ -278,11 +278,11 @@ namespace Resource
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> load (Files::IStreamPtr file, const std::string& normalizedFilename, Resource::ImageManager* textureMgr, Resource::NifFileManager* nifFileManager)
|
osg::ref_ptr<osg::Node> load (Files::IStreamPtr file, const std::string& normalizedFilename, Resource::ImageManager* imageManager, Resource::NifFileManager* nifFileManager)
|
||||||
{
|
{
|
||||||
std::string ext = getFileExtension(normalizedFilename);
|
std::string ext = getFileExtension(normalizedFilename);
|
||||||
if (ext == "nif")
|
if (ext == "nif")
|
||||||
return NifOsg::Loader::load(nifFileManager->get(normalizedFilename), textureMgr);
|
return NifOsg::Loader::load(nifFileManager->get(normalizedFilename), imageManager);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
osgDB::ReaderWriter* reader = osgDB::Registry::instance()->getReaderWriterForExtension(ext);
|
osgDB::ReaderWriter* reader = osgDB::Registry::instance()->getReaderWriterForExtension(ext);
|
||||||
|
@ -297,7 +297,7 @@ namespace Resource
|
||||||
// Set a ReadFileCallback so that image files referenced in the model are read from our virtual file system instead of the osgDB.
|
// Set a ReadFileCallback so that image files referenced in the model are read from our virtual file system instead of the osgDB.
|
||||||
// Note, for some formats (.obj/.mtl) that reference other (non-image) files a findFileCallback would be necessary.
|
// Note, for some formats (.obj/.mtl) that reference other (non-image) files a findFileCallback would be necessary.
|
||||||
// but findFileCallback does not support virtual files, so we can't implement it.
|
// but findFileCallback does not support virtual files, so we can't implement it.
|
||||||
options->setReadFileCallback(new ImageReadCallback(textureMgr));
|
options->setReadFileCallback(new ImageReadCallback(imageManager));
|
||||||
|
|
||||||
osgDB::ReaderWriter::ReadResult result = reader->readNode(*file, options);
|
osgDB::ReaderWriter::ReadResult result = reader->readNode(*file, options);
|
||||||
if (!result.success())
|
if (!result.success())
|
||||||
|
@ -323,7 +323,7 @@ namespace Resource
|
||||||
{
|
{
|
||||||
Files::IStreamPtr file = mVFS->get(normalized);
|
Files::IStreamPtr file = mVFS->get(normalized);
|
||||||
|
|
||||||
loaded = load(file, normalized, mTextureManager, mNifFileManager);
|
loaded = load(file, normalized, mImageManager, mNifFileManager);
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
|
@ -336,7 +336,7 @@ namespace Resource
|
||||||
{
|
{
|
||||||
std::cerr << "Failed to load '" << name << "': " << e.what() << ", using marker_error." << sMeshTypes[i] << " instead" << std::endl;
|
std::cerr << "Failed to load '" << name << "': " << e.what() << ", using marker_error." << sMeshTypes[i] << " instead" << std::endl;
|
||||||
Files::IStreamPtr file = mVFS->get(normalized);
|
Files::IStreamPtr file = mVFS->get(normalized);
|
||||||
loaded = load(file, normalized, mTextureManager, mNifFileManager);
|
loaded = load(file, normalized, mImageManager, mNifFileManager);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -408,9 +408,9 @@ namespace Resource
|
||||||
return mVFS;
|
return mVFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
Resource::ImageManager* SceneManager::getTextureManager()
|
Resource::ImageManager* SceneManager::getImageManager()
|
||||||
{
|
{
|
||||||
return mTextureManager;
|
return mImageManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneManager::setParticleSystemMask(unsigned int mask)
|
void SceneManager::setParticleSystemMask(unsigned int mask)
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace Resource
|
||||||
class SceneManager
|
class SceneManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SceneManager(const VFS::Manager* vfs, Resource::ImageManager* textureManager, Resource::NifFileManager* nifFileManager);
|
SceneManager(const VFS::Manager* vfs, Resource::ImageManager* imageManager, Resource::NifFileManager* nifFileManager);
|
||||||
~SceneManager();
|
~SceneManager();
|
||||||
|
|
||||||
/// Get a read-only copy of this scene "template"
|
/// Get a read-only copy of this scene "template"
|
||||||
|
@ -70,7 +70,7 @@ namespace Resource
|
||||||
|
|
||||||
const VFS::Manager* getVFS() const;
|
const VFS::Manager* getVFS() const;
|
||||||
|
|
||||||
Resource::ImageManager* getTextureManager();
|
Resource::ImageManager* getImageManager();
|
||||||
|
|
||||||
/// @param mask The node mask to apply to loaded particle system nodes.
|
/// @param mask The node mask to apply to loaded particle system nodes.
|
||||||
void setParticleSystemMask(unsigned int mask);
|
void setParticleSystemMask(unsigned int mask);
|
||||||
|
@ -89,7 +89,7 @@ namespace Resource
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const VFS::Manager* mVFS;
|
const VFS::Manager* mVFS;
|
||||||
Resource::ImageManager* mTextureManager;
|
Resource::ImageManager* mImageManager;
|
||||||
Resource::NifFileManager* mNifFileManager;
|
Resource::NifFileManager* mNifFileManager;
|
||||||
|
|
||||||
osg::Texture::FilterMode mMinFilter;
|
osg::Texture::FilterMode mMinFilter;
|
||||||
|
|
|
@ -142,7 +142,7 @@ osg::ref_ptr<osg::Node> TerrainGrid::buildTerrain (osg::Group* parent, float chu
|
||||||
osg::ref_ptr<osg::Texture2D> tex = mTextureCache[it->mDiffuseMap];
|
osg::ref_ptr<osg::Texture2D> tex = mTextureCache[it->mDiffuseMap];
|
||||||
if (!tex)
|
if (!tex)
|
||||||
{
|
{
|
||||||
tex = new osg::Texture2D(mResourceSystem->getTextureManager()->getImage(it->mDiffuseMap));
|
tex = new osg::Texture2D(mResourceSystem->getImageManager()->getImage(it->mDiffuseMap));
|
||||||
tex->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
tex->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
||||||
tex->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
|
tex->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
|
||||||
mTextureCache[it->mDiffuseMap] = tex;
|
mTextureCache[it->mDiffuseMap] = tex;
|
||||||
|
|
Loading…
Reference in a new issue