Beispiel #1
0
    IntroState::IntroState(Engine* p_engine) :
        GameState(p_engine),
        m_totalMilliseconds(std::time_t(2000)),
        m_elapsedMilliseconds(0)
    {
        std::clog << "Entering intro state..." << std::endl;

        // do one input state capture just to hide the mouse cursor
        InputSystem* inputSystem = m_engine->getInputSystem();
        inputSystem->capture();

        // get the material by name
        std::clog << "Loading fade overlay material..." << std::endl;
        Ogre::ResourcePtr resptr = Ogre::MaterialManager::getSingleton().
            getByName("Materials/FadeOverlay");
        Ogre::Material* material = dynamic_cast<Ogre::Material*>(resptr.getPointer());
        Ogre::Technique* tech = material->getTechnique(0);
        Ogre::Pass* pass = tech->getPass(0);

        m_textureUnitState = pass->getTextureUnitState(0);

        // get the overlay
        std::clog << "Loading fade overlay..." << std::endl;
        m_fadeOverlay = Ogre::OverlayManager::getSingleton().getByName("Overlays/FadeOverlay");

        m_alpha = 1.0;
        m_fadeOverlay->show();
    }
Beispiel #2
0
void CaelumPlugin::loadCaelumSystemFromScript(CaelumSystem* sys, const Ogre::String& objectName, const Ogre::String& groupName)
{
  assert(sys);
  assert(this->isInstalled () && "Must install CaelumPlugin before loading scripts");

  // Fetch raw resource ptr. Attempt to support explicit resource groups currently in Ogre trunk.
#if OGRE_VERSION >= 0x00010700
  Ogre::ResourcePtr res = getPropScriptResourceManager()->getByName(objectName, groupName);
#else
  Ogre::ResourcePtr res = getPropScriptResourceManager ()->getByName (objectName);
#endif

  // Check a PropScriptResource was found.
  PropScriptResource* propRes = static_cast<PropScriptResource*>(res.get());
  if (!propRes) {
    OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND, "Could not find caelum_sky_system " + objectName, "CaelumPlugin::loadCaelumSystemFromScript");
  }

  // Fetch the resource stream. Look in the actual group of the resource!
  const Ogre::String& scriptFileName = propRes->getOrigin();
  const Ogre::String& scriptFileGroup = propRes->getGroup();
  Ogre::DataStreamPtr streamPtr = Ogre::ResourceGroupManager::getSingleton().openResource(scriptFileName, scriptFileGroup, false);

  // Feed it into the compiler.
  this->getScriptTranslatorManager()->getCaelumSystemTranslator()->setTranslationTarget(sys, objectName);
  Ogre::ScriptCompilerManager::getSingleton().parseScript(streamPtr, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
  bool found = this->getScriptTranslatorManager()->getCaelumSystemTranslator()->foundTranslationTarget();

  // This shouldn't normally happen.
  if (!found) {
    OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND, "Could not find caelum_sky_system " + objectName + " in file " + scriptFileName + " on reparsing. "
    "Perhaps information in PropScriptResourceManager is out of date?", "CaelumPlugin::loadCaelumSystemFromScript");
  }
  this->getScriptTranslatorManager()->getCaelumSystemTranslator()->clearTranslationTarget();
}
Beispiel #3
0
void GUIManager::runCommand(const std::string &command, const std::string &args)
{
	if (command == ToggleInputMode.getCommand()) {
		getInput().toggleInputMode();
	} else if (command == ToggleGui.getCommand()) {

		S_LOG_VERBOSE("Toggle Gui Initiated -- " << getInput().getInputMode());

		if (mEnabled) {
			S_LOG_INFO("Disabling GUI");
			mEnabled = false;

			getInput().removeAdapter(mCEGUIAdapter);

		} else {
			S_LOG_INFO("Enabling GUI");
			mEnabled = true;

			getInput().addAdapter(mCEGUIAdapter);
		}
	} else if (command == ReloadGui.getCommand()) {
		Ogre::TextureManager* texMgr = Ogre::TextureManager::getSingletonPtr();
		Ogre::ResourcePtr resource = texMgr->getByName("cegui/" + getDefaultScheme() + ".png");
		if (!resource.isNull()) {
			resource->reload();
		}
	}
}
void ManualBulletShapeLoader::load(const std::string &name,const std::string &group)
{
    // Check if the resource already exists
    Ogre::ResourcePtr ptr = BulletShapeManager::getSingleton().getByName(name, group);
    if (!ptr.isNull())
        return;
    BulletShapeManager::getSingleton().create(name,group,true,this);
}
Beispiel #5
0
Ogre::ResourcePtr EntityRecipeManager::create(const Ogre::String& name, const Ogre::String& group, bool isManual, Ogre::ManualResourceLoader* loader, const Ogre::NameValuePairList* createParams)
{
	Ogre::ResourcePtr ret = getByName(name);
	if (ret.isNull()) {
		return Ogre::ResourceManager::create(name, group, isManual, loader, createParams);
	}
	S_LOG_WARNING("EntityRecipe with name " << name << " already exists.");
	return Ogre::ResourcePtr();
}
Beispiel #6
0
Icon* IconManager::getIcon(int, EmberEntity* entity)
{

	std::string key = "entity_" + entity->getId();
	if (mIconStore.hasIcon(key)) {
		return mIconStore.getIcon(key);
	} else {
		IconActionCreator actionCreator(*entity);
		std::unique_ptr<EntityMapping::EntityMapping> modelMapping(Mapping::EmberEntityMappingManager::getSingleton().getManager().createMapping(*entity, actionCreator, &EmberOgre::getSingleton().getWorld()->getView()));
		std::string modelName;
		if (modelMapping.get()) {
			modelMapping->initialize();
			modelName = actionCreator.getModelName();
		}
		//if there's no model defined for this use the placeholder model
		if (modelName == "") {
			modelName = "placeholder";
		}
		Ogre::ResourcePtr modelDefPtr = Model::ModelDefinitionManager::getSingleton().getByName(modelName);
		if (!modelDefPtr.isNull()) {
			Model::ModelDefinition* modelDef = static_cast<Model::ModelDefinition*> (modelDefPtr.get());
			const std::string& iconPath(modelDef->getIconPath());
			if (iconPath != "") {

				Ogre::TexturePtr texPtr;
				try {
					if (Ogre::TextureManager::getSingleton().resourceExists(iconPath)) {
						texPtr = static_cast<Ogre::TexturePtr> (Ogre::TextureManager::getSingleton().getByName(iconPath));
						//try to load it to make sure that's it a working image
						texPtr->load();
					}
					if (texPtr.isNull()) {
						texPtr = Ogre::TextureManager::getSingleton().load(iconPath, "Gui");
					}
				} catch (...) {
					S_LOG_WARNING("Error when trying to load the icon " << iconPath <<". The icon will be rendered dynamically.");
					texPtr.setNull();
				}
				if (!texPtr.isNull()) {
					Icon* icon = mIconStore.createIcon(key, texPtr);
					return icon;
				}
			}
		}
		Icon* icon = mIconStore.createIcon(key);
		if (icon) {
			//update the model preview window
			// 				Model::Model* model = Model::Model::createModel(mIconRenderer.getRenderContext()->getSceneManager(), modelName);
			render(*icon, modelName);
			// 				mIconRenderer.getRenderContext()->getSceneManager()->destroyMovableObject(model);
		}
		return icon;
	}

	return 0;
}
Beispiel #7
0
void ResourceManager::ResourcesLoader::loadingComplete( Ogre::ResourcePtr pResource )
{
    mResources.erase( std::make_pair( pResource->getCreator()->getResourceType(), 
        pResource->getHandle() ) );
    if( !mResources.size() )
    {
        mCompletedSlot();
        delete this;
    }
}
 Ogre::ResourcePtr
 FLevelFileSerializer::createResource( FLevelFile *pDest, const String &extension )
 {
     assert( pDest );
     Ogre::ResourceManager &mgr( ResourceManagerType::getSingleton() );
     String name( getBaseName( pDest ) + extension );
     Ogre::ResourcePtr resource =  mgr.createResource( name, pDest->getGroup(), true );
     resource->_notifyOrigin( pDest->getName() );
     return resource;
 }
void ResourceManager::reloadResource(Ogre::ResourceManager* resMgr, const std::string& resourceName, const std::string& resourceGroup)
{
    Ogre::ResourcePtr rPtr = resMgr->load(resourceName, resourceGroup);
    if (rPtr.isNull()) LOG_META(FORMAT("The resource '%1%' no longer exists!", resourceName));

    rPtr->reload();
    if (rPtr->isLoaded())
        LOG_META(FORMAT("The resource '%1%' wasn`t unloaded!", resourceName));
    else
        LOG_META(FORMAT("The resource '%1%' was unloaded!", resourceName));
}
Beispiel #10
0
void UnloadResource(Ogre::ResourceManager* resMgr, const std::string& resourceName)
{
    Ogre::ResourcePtr rPtr = resMgr->getResourceByName(resourceName);
    if (rPtr.isNull())
    {
        StringUtil::StrStreamType msg;
        msg << "Resource no longer exists: " << resourceName;
        Ogre::LogManager::getSingleton().logMessage(msg.str());
        return;
    }
 
    rPtr->unload();
    if (rPtr->isLoaded())
    {
        StringUtil::StrStreamType msg;
        msg << "Resource was not unloaded: " << resourceName;
        Ogre::LogManager::getSingleton().logMessage(msg.str());
    }
    else
    {
        StringUtil::StrStreamType msg;
        msg << "Resource was unloaded: " << resourceName;
        Ogre::LogManager::getSingleton().logMessage(msg.str());
    }
 
    resMgr->remove(resourceName);
    rPtr = resMgr->getResourceByName(resourceName);
    if (rPtr.isNull())
    {
        StringUtil::StrStreamType msg;
        msg << "Resource was removed: " << resourceName;
        Ogre::LogManager::getSingleton().logMessage(msg.str());
    }
    else
    {
        StringUtil::StrStreamType msg;
        msg << "Resource was not removed: " << resourceName;
        Ogre::LogManager::getSingleton().logMessage(msg.str());
    }
 
    if (resMgr->resourceExists(resourceName))
    {
        StringUtil::StrStreamType msg;
        msg << "Resource still exists: " << resourceName;
        Ogre::LogManager::getSingleton().logMessage(msg.str());
    }
    else
    {
        StringUtil::StrStreamType msg;
        msg << "Resource no longer exists: " << resourceName;
        Ogre::LogManager::getSingleton().logMessage(msg.str());
    }
}
Beispiel #11
0
void ResourceManager::loadResources( const ResourceList& rResources, 
    const SimpleResourceCallback& rCallbackSlot )
{
    // Convert to set to remove duplicates.
    ResourceSet resources = ResourceInfo::toResourceSet( rResources );

    if( resources.empty() )
    {
        // If there are no resources to be loaded, call the slot and return immediately.
        rCallbackSlot();
        return;
    }

    ResourceManager::ResourcesLoader* resourceLoader = 
        ResourceManager::ResourcesLoader::create( rCallbackSlot );

    unsigned short loaded = 0;
    for( ResourceSet::const_iterator i = resources.begin(); i != resources.end(); ++i )
    {
        // Add resources to resource loader.
        Ogre::ResourcePtr resource = ResourceManager::getResource( *i, true );

        if( resource.isNull() )
        {
            DIVERSIA_EXCEPT( Exception::ERR_FILE_NOT_FOUND, "Cannot load resource " + 
                (*i).mFile.string() + ", file does not exist.", 
                "ResourceManager::loadResource" );
        }

        if( resource->isLoaded() )
            loaded++;
        else
            resourceLoader->addResource( resource );
    }

    // All resources are already loaded.
    if( loaded == resources.size() )
    {
        rCallbackSlot();
        delete resourceLoader;
        return;
    }

    for( ResourceSet::const_iterator j = resources.begin(); j != resources.end(); ++j )
    {
        // Load all resources and callback to the resource loader. If all resources are loaded
        // the rCallbackSlot will be called and the resource loader will be destroyed.
        ResourceManager::loadResource( *j, sigc::mem_fun( resourceLoader, 
            &ResourceManager::ResourcesLoader::loadingComplete ) );
    }
}
Ogre::ResourcePtr ModelDefinitionManager::create(const Ogre::String& name, const Ogre::String& group,
bool isManual, Ogre::ManualResourceLoader* loader,
const Ogre::NameValuePairList* createParams)
{
	Ogre::ResourcePtr ret = getByName(name);
	if (ret.isNull())
	{
		return Ogre::ResourceManager::create(name, group, isManual, loader, createParams);
	}
	//Report this. We count on this happening a lot (user media overriding shared media for example), so we will not consider it a failure.
	S_LOG_INFO("ModelDefinition with name " << name << " already exists.");
	return Ogre::ResourcePtr();

}
Beispiel #13
0
void LodManager::loadLod(Ogre::MeshPtr mesh)
{
    assert(mesh->getNumLodLevels() == 1);
    std::string lodDefName = convertMeshNameToLodName(mesh->getName());

    try {
        Ogre::ResourcePtr resource = LodDefinitionManager::getSingleton().load(lodDefName, "General");
        const LodDefinition& def = *static_cast<const LodDefinition*>(resource.get());
        loadLod(mesh, def);
    } catch (Ogre::FileNotFoundException ex) {
        // Exception is thrown if a mesh hasn't got a loddef.
        // By default, use the automatic mesh lod management system.
        loadAutomaticLod(mesh);
    }
}
    void run()
    {
        Meru::ResourceLoadingQueue *queue = &ResourceLoadingQueue::getSingleton();

        Ogre::ResourcePtr skeletonPtr = Ogre::SkeletonManager::getSingleton().getByName(mName);
        if (skeletonPtr.isNull() || !skeletonPtr->isLoaded()) {
            SILOG(resource,insane, "Skeleton Load Task run(), waiting for " << mName << " To queue");
            SILOG(resource,debug,"Queueing " << mName << " for OGRE load ");
            queue->load(Ogre::SkeletonManager::getSingleton().getResourceType(), mName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, false, NULL, NULL, this);
        }
        else {
            SILOG(resource,insane, "Skeleton Load Task run() AND complete, waited for " << mName << " To queue");
            signalCompletion();
        }
    }
/****************************************************************************
**
** Copyright (C) 2016
**
** This file is generated by the Magus toolkit
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
****************************************************************************/

// Include
#include "constants.h"
#include <QString>
#include <QFile>
#include <QTextStream>
#include <QMenuBar>
#include "mainwindow.h"
#include "OgreItem.h"
#include "OgreHlmsPbs.h"
#include "OgreHlmsUnlit.h"
#include "OgreHlmsPbsDatablock.h"
#include "OgreHlmsUnlitDatablock.h"
#include "OgreHlmsManager.h"

//****************************************************************************/
MainWindow::MainWindow(void) :
    mIsClosing(false),
    mFirst(true)
{
    installEventFilter(this);

    // Create the Ogre Manager
    mOgreManager = new Magus::OgreManager();
    mHlmsName = QString("");
    mTempString = QString("");
    
	// Perform standard functions
    createActions();
    createMenus();
    createToolBars();
    createStatusBar();
    createDockWindows();
    mMaterialBrowser = new MaterialBrowserDialog(this);
    loadMaterialBrowserCfg();

    mOgreManager->initialize();

    // Set the title
    setWindowTitle(QString("HLMS editor"));

    // Set the stylesheet of the application
    QFile File(QString("dark.qss"));
    File.open(QFile::ReadOnly);
    QString styleSheet = QLatin1String(File.readAll());
    setStyleSheet(styleSheet);
	showMaximized();
}

//****************************************************************************/
MainWindow::~MainWindow(void)
{
    delete mOgreManager;
}

//****************************************************************************/
bool MainWindow::eventFilter(QObject* object, QEvent* event)
{
    if (event->type()==QEvent::KeyPress)
    {
        QKeyEvent* key = static_cast<QKeyEvent*>(event);
        if (key->key() == Qt::Key_F5)
        {
            // F5 was pressed
            mNodeEditorDockWidget->generateDatablock();
        }
        if (key->key() == Qt::Key_S && (QApplication::keyboardModifiers() & Qt::ControlModifier))
        {
            // CTRL+S was pressed
            doSaveDatablockMenuAction();
        }
    }
    return QObject::eventFilter(object, event);
}

//****************************************************************************/
void MainWindow::closeEvent(QCloseEvent* event)
{
    mIsClosing = true;
}

//****************************************************************************/
void MainWindow::createActions(void)
{
    // File menu
    mNewHlmsPbsAction = new QAction(QString("Pbs"), this);
    connect(mNewHlmsPbsAction, SIGNAL(triggered()), this, SLOT(doNewHlmsPbsAction()));
    mNewHlmsUnlitAction = new QAction(QString("Unlit"), this);
    connect(mNewHlmsUnlitAction, SIGNAL(triggered()), this, SLOT(doNewHlmsUnlitAction()));
    mOpenDatablockMenuAction = new QAction(QString("Open Hlms"), this);
    connect(mOpenDatablockMenuAction, SIGNAL(triggered()), this, SLOT(doOpenDatablockMenuAction()));
    mSaveDatablockMenuAction = new QAction(QString("Save Hlms"), this);
    connect(mSaveDatablockMenuAction, SIGNAL(triggered()), this, SLOT(doSaveDatablockMenuAction()));
    mSaveAsDatablockMenuAction = new QAction(QString("Save Hlms as"), this);
    connect(mSaveAsDatablockMenuAction, SIGNAL(triggered()), this, SLOT(doSaveAsDatablockMenuAction()));
    mQuitMenuAction = new QAction(QString("Quit"), this);
    connect(mQuitMenuAction, SIGNAL(triggered()), this, SLOT(doQuitMenuAction()));

    // Materials menu
    mMaterialBrowserOpenMenuAction = new QAction(QString("Open browser"), this);
    connect(mMaterialBrowserOpenMenuAction, SIGNAL(triggered()), this, SLOT(doMaterialBrowserOpenMenuAction()));
    mMaterialBrowserAddMenuAction = new QAction(QString("Add Hlms to browser"), this);
    connect(mMaterialBrowserAddMenuAction, SIGNAL(triggered()), this, SLOT(doMaterialBrowserAddMenuAction()));

    // Window menu
    mResetWindowLayoutMenuAction = new QAction(QString("Reset Window Layout"), this);
    connect(mResetWindowLayoutMenuAction, SIGNAL(triggered()), this, SLOT(doResetWindowLayoutMenuAction()));
}

//****************************************************************************/
void MainWindow::createMenus(void)
{
    mFileMenu = menuBar()->addMenu(QString("&File"));
    mMaterialBrowserMenu = menuBar()->addMenu(QString("&Materials"));
    QMenu* fileMenuAction = mFileMenu->addMenu("New Hlms");
    fileMenuAction->addAction(mNewHlmsPbsAction);
    fileMenuAction->addAction(mNewHlmsUnlitAction);
    mFileMenu->addAction(mOpenDatablockMenuAction);
    mFileMenu->addAction(mSaveDatablockMenuAction);
    mFileMenu->addAction(mSaveAsDatablockMenuAction);
    mFileMenu->addAction(mQuitMenuAction);
    mMaterialBrowserMenu->addAction(mMaterialBrowserOpenMenuAction);
    mMaterialBrowserMenu->addAction(mMaterialBrowserAddMenuAction);
    mWindowMenu = menuBar()->addMenu(QString("&Window"));
    mWindowMenu->addAction(mResetWindowLayoutMenuAction);

}

//****************************************************************************/
void MainWindow::createToolBars(void)
{

}

//****************************************************************************/
void MainWindow::createStatusBar(void)
{

}

//****************************************************************************/
void MainWindow::createDockWindows(void)
{
    mRenderwindowDockWidget = new RenderwindowDockWidget("Renderwindow", this);
    addDockWidget(Qt::LeftDockWidgetArea, mRenderwindowDockWidget);
    mPropertiesDockWidget = new PropertiesDockWidget("Properties", this);
    addDockWidget(Qt::LeftDockWidgetArea, mPropertiesDockWidget);
    mNodeEditorDockWidget = new NodeEditorDockWidget("NodeEditor", this);
    setCentralWidget(mNodeEditorDockWidget);
}

//****************************************************************************/
void MainWindow::doNewHlmsPbsAction(void)
{
    initDatablocks();
    mPropertiesDockWidget->clear();
    mNodeEditorDockWidget->newHlmsPbsAndSampler();
}

//****************************************************************************/
void MainWindow::doNewHlmsUnlitAction(void)
{
    initDatablocks();
    mPropertiesDockWidget->clear();
    mNodeEditorDockWidget->newHlmsUnlitAndSampler();
}

//****************************************************************************/
void MainWindow::doOpenDatablockMenuAction(void)
{
    // Load the materials
    QString fileName;
    fileName = QFileDialog::getOpenFileName(this, QString("Open Hlms file"),
                                            QString(""),
                                            QString("Json material (*.json)"));
    loadDatablock(fileName);
}

//****************************************************************************/
void MainWindow::loadDatablock(const QString jsonFileName)
{
    // Load the materials
    if (!jsonFileName.isEmpty())
    {
        // Read the json file as text file and feed it to the HlmsManager::loadMaterials() function
        // Note, that the resources (textures, etc.) must be present

        // First, delete all datablocks before loading the new ones
        initDatablocks();
        mPropertiesDockWidget->clear();

        // Read the json file
        Ogre::HlmsManager* hlmsManager = mOgreManager->getOgreRoot()->getHlmsManager();
        QFile file(jsonFileName);
        file.open(QFile::ReadOnly | QFile::Text);
        QTextStream readFile(&file);
        QString jsonString = readFile.readAll();
        QByteArray ba = jsonString.toLatin1();
        char* jsonChar = ba.data();
        Ogre::String fname = jsonFileName.toStdString();
        Ogre::HlmsJson hlmsJson(hlmsManager);
        try
        {
            // Load the datablocks (which also creates them)
            hlmsJson.loadMaterials(fname, jsonChar);
        }
        catch (Ogre::Exception e)
        {
            Ogre::LogManager::getSingleton().logMessage("MainWindow::doOpenDatablockMenuAction(); Could not load the materials\n");
        }
        file.close();
        mHlmsName = jsonFileName;

        // Get the (list of) datablocks and assign the first one to the current 'item' to be rendered
        getAndSetFirstDatablock();
    }
}

//****************************************************************************/
void MainWindow::destroyAllDatablocks(void)
{
    // Get the datablock from the item and remove it
    mOgreManager->getOgreWidget(OGRE_WIDGET_RENDERWINDOW)->setDefaultDatablockItem();
    Ogre::HlmsManager* hlmsManager = mOgreManager->getOgreRoot()->getHlmsManager();
    Ogre::HlmsPbs* hlmsPbs = static_cast<Ogre::HlmsPbs*>( hlmsManager->getHlms(Ogre::HLMS_PBS));
    Ogre::HlmsUnlit* hlmsUnlit = static_cast<Ogre::HlmsUnlit*>( hlmsManager->getHlms(Ogre::HLMS_UNLIT));

    // Iterate through all pbs datablocks and remove them
    Ogre::Hlms::HlmsDatablockMap::const_iterator itorPbs = hlmsPbs->getDatablockMap().begin();
    Ogre::Hlms::HlmsDatablockMap::const_iterator endPbs  = hlmsPbs->getDatablockMap().end();
    Ogre::HlmsPbsDatablock* pbsDatablock;
    while( itorPbs != endPbs)
    {
        pbsDatablock = static_cast<Ogre::HlmsPbsDatablock*>(itorPbs->second.datablock);
        if (pbsDatablock != hlmsPbs->getDefaultDatablock() &&
                pbsDatablock != hlmsUnlit->getDefaultDatablock())
        {
            hlmsPbs->destroyDatablock(pbsDatablock->getName());
            itorPbs = hlmsPbs->getDatablockMap().begin(); // Start from the beginning again
        }
        else
            ++itorPbs;
    }

    // Iterate through all unlit datablocks and remove them
    Ogre::Hlms::HlmsDatablockMap::const_iterator itorUnlit = hlmsUnlit->getDatablockMap().begin();
    Ogre::Hlms::HlmsDatablockMap::const_iterator endUnlit  = hlmsUnlit->getDatablockMap().end();
    Ogre::HlmsUnlitDatablock* unlitDatablock;
    while( itorUnlit != endUnlit)
    {
        unlitDatablock = static_cast<Ogre::HlmsUnlitDatablock*>(itorUnlit->second.datablock);
        if (unlitDatablock != hlmsPbs->getDefaultDatablock() &&
                unlitDatablock != hlmsUnlit->getDefaultDatablock())
        {
            hlmsUnlit->destroyDatablock(unlitDatablock->getName());
            itorUnlit = hlmsUnlit->getDatablockMap().begin(); // Start from the beginning again
        }
        else
            ++itorUnlit;
    }
}

//****************************************************************************/
void MainWindow::getAndSetFirstDatablock(void)
{
    // Get the name/fullname from the current item in the renderwindow
    Ogre::Item* item = mOgreManager->getOgreWidget(OGRE_WIDGET_RENDERWINDOW)->getItem();
    Ogre::HlmsDatablock* oldDatablock = item->getSubItem(0)->getDatablock();
    Ogre::String oldDatablockName = *oldDatablock->getFullName();
    Ogre::IdString oldDatablockId = oldDatablock->getName();

    // Determine whether the HlmsManager contains a HLMS_PBS datablock or a HLMS_UNLIT datablock.
    // Depending on the result, the datablock of that type is retrieved and set in the mesh (item).
    Ogre::HlmsManager* hlmsManager = mOgreManager->getOgreRoot()->getHlmsManager();
    Ogre::HlmsPbs* hlmsPbs = static_cast<Ogre::HlmsPbs*>( hlmsManager->getHlms(Ogre::HLMS_PBS));
    Ogre::HlmsUnlit* hlmsUnlit = static_cast<Ogre::HlmsUnlit*>( hlmsManager->getHlms(Ogre::HLMS_UNLIT));
    if (hlmsPbs)
    {
        int size = hlmsPbs->getDatablockMap().size();
        //QMessageBox::information(0, QString("info"), QVariant(size).toString());
        if (size> 1)
        {
            // It is a PBS; Note, that there is also a default (so always 1)
            Ogre::Hlms::HlmsDatablockMap::const_iterator itor = hlmsPbs->getDatablockMap().begin();
            Ogre::Hlms::HlmsDatablockMap::const_iterator end  = hlmsPbs->getDatablockMap().end();
            Ogre::HlmsPbsDatablock* newDatablock;
            Ogre::String newDatablockName;
            while( itor != end )
            {
                newDatablock = static_cast<Ogre::HlmsPbsDatablock*>(itor->second.datablock);
                if (newDatablock != hlmsPbs->getDefaultDatablock() && newDatablock != hlmsUnlit->getDefaultDatablock())
                {
                    // Get the first datablock
                    newDatablockName = *newDatablock->getFullName();
                    if (oldDatablockName != newDatablockName)
                    {
                        // Assign the datablock to the item (and destroy the items' old datablock, if still available)
                        item->setDatablock(newDatablock);
                        if (oldDatablock != hlmsPbs->getDefaultDatablock() && oldDatablock != hlmsUnlit->getDefaultDatablock())
                        {
                            if (oldDatablock->getCreator()->getType() == Ogre::HLMS_PBS)
                                hlmsPbs->destroyDatablock(oldDatablockId);
                            else if (hlmsUnlit && oldDatablock->getCreator()->getType() == Ogre::HLMS_UNLIT)
                                hlmsUnlit->destroyDatablock(oldDatablockId);
                        }

                        // Create the node structure
                        QString s = newDatablockName.c_str();
                        mNodeEditorDockWidget->createPbsNodeStructure(s);
                        mPropertiesDockWidget->setTextureTypePropertyVisible(true);
                        mPropertiesDockWidget->setMapWeightPropertyVisible(true);
                        break;
                    }
                }
                ++itor;
            }
            return;
        }
    }

    if (hlmsUnlit)
    {
        int size = hlmsUnlit->getDatablockMap().size();
        //QMessageBox::information(0, QString("info"), QVariant(size).toString());
        if (size > 1)
        {
            // It is an Unlit; Note, that there is also a default (so always 1)
            Ogre::Hlms::HlmsDatablockMap::const_iterator itor = hlmsUnlit->getDatablockMap().begin();
            Ogre::Hlms::HlmsDatablockMap::const_iterator end  = hlmsUnlit->getDatablockMap().end();
            Ogre::HlmsUnlitDatablock* newDatablock;
            Ogre::String newDatablockName;
            while( itor != end )
            {
                newDatablock = static_cast<Ogre::HlmsUnlitDatablock*>(itor->second.datablock);
                if (newDatablock != hlmsPbs->getDefaultDatablock() && newDatablock != hlmsUnlit->getDefaultDatablock())
                {
                    // Get the first datablock
                    newDatablockName = *newDatablock->getFullName();
                    if (oldDatablockName != newDatablockName)
                    {
                        // Assign the datablock to the item (and destroy the items' old datablock, if still available)
                        item->setDatablock(newDatablock);
                        if (oldDatablock != hlmsPbs->getDefaultDatablock() && oldDatablock != hlmsUnlit->getDefaultDatablock())
                        {
                            if (oldDatablock->getCreator()->getType() == Ogre::HLMS_UNLIT)
                                hlmsUnlit->destroyDatablock(oldDatablockId);
                            else if (hlmsPbs && oldDatablock->getCreator()->getType() == Ogre::HLMS_PBS)
                                hlmsPbs->destroyDatablock(oldDatablockId);
                        }

                        // Create the node structure
                        QString s = newDatablockName.c_str();
                        mNodeEditorDockWidget->createUnlitNodeStructure(s);
                        mPropertiesDockWidget->setTextureTypePropertyVisible(false);
                        mPropertiesDockWidget->setMapWeightPropertyVisible(false);
                        break;
                    }
                }
                ++itor;
            }
            return;
        }
    }
}

//****************************************************************************/
void MainWindow::getListOfResources(void)
{
    Ogre::ResourceGroupManager::ResourceManagerIterator it =
        Ogre::ResourceGroupManager::getSingletonPtr()->getResourceManagerIterator();
    while (it.hasMoreElements())
    {
        Ogre::ResourceManager* man = it.getNext();
        Ogre::LogManager::getSingleton().logMessage("Resource Type = " + man->getResourceType());
        Ogre::ResourceManager::ResourceMapIterator mapit = man->getResourceIterator() ;
        while (mapit.hasMoreElements())
        {
            Ogre::ResourcePtr ptr = mapit.getNext();
            Ogre::LogManager::getSingleton().logMessage("Resource Name = " + ptr->getName());
        }
    }
}
/*
bool MeshUnloadTask::mainThreadUnload(String name)
{
  Ogre::MeshManager::getSingleton().unload(name);
//  operationCompleted(Ogre::BackgroundProcessTicket(), Ogre::BackgroundProcessResult());
  return false;
}
*/
void MeshUnloadTask::doRun()
{
  /*I REALLY wish this were true*/
  // SequentialWorkQueue::getSingleton().queueWork(std::tr1::bind(&MeshUnloadTask::mainThreadUnload, this, mHash));

  String hash = mHash; //CDNArchive::canonicalMhashName(mHash);
  Ogre::MeshManager* meshManager = Ogre::MeshManager::getSingletonPtr();
  meshManager->remove(hash);

  Ogre::ResourcePtr meshResource = meshManager->getByName(hash);
  assert(meshResource.isNull());

  SharedResourcePtr resource = mResource.lock();
  if (resource)
    resource->unloaded(true, mEpoch);
}
Beispiel #17
0
Ogre::ResourcePtr
loadCorrelativeResource(const Ogre::String& resourceName, const Ogre::String& groupName,
                        const Ogre::String& baseResourceName, const Ogre::String& baseGroupName,
                        Ogre::ResourceManager& resourceManager)
{
    Ogre::ResourcePtr res;

   Ogre::String name, path;
    Ogre::StringUtil::splitFilename(resourceName, name, path);
    bool existsPath = !path.empty();

    // First, load in correlatived group and path if resource name doesn't exists path
    if (!existsPath)
    {
        Ogre::StringUtil::splitFilename(baseResourceName, name, path);
        if (!path.empty())
        {
            name = path + resourceName;
            res = tryLoadResource(resourceManager, name, baseGroupName);
            if (!res.isNull())
                return res;
        }
    }

    // Second, load in correlatived group
    res = tryLoadResource(resourceManager, resourceName, baseGroupName);
    if (!res.isNull())
        return res;

    // Three, load in user given group
    if (!groupName.empty())
    {
        res = tryLoadResource(resourceManager, resourceName, groupName);
        if (!res.isNull())
            return res;
    }

    // Four, load in global default group
    if (groupName != DEFAULT_RESOURCE_GROUP_NAME)
    {
        res = tryLoadResource(resourceManager, resourceName, groupName);
        if (!res.isNull())
            return res;
    }

    return res;
}
Beispiel #18
0
void TexturePreviewEditor::OpenOgreTexture(const QString& name)
{
    if (name.contains(".dds"))
    {
        LogWarning("currently cannot show .dds files. ");
        // Set black background image that will be replaced once the real image has been received.
        QImage emptyImage = QImage(QSize(256, 256), QImage::Format_ARGB32);
        emptyImage.fill(qRgba(0,0,0,0));
        if ( imageLabel_ != 0)
            imageLabel_->setPixmap(QPixmap::fromImage(emptyImage));

        return;
    }

    Ogre::ResourcePtr res = Ogre::TextureManager::getSingleton().getByName(name.toStdString().c_str());
    Ogre::Texture* tex = static_cast<Ogre::Texture* >(res.get());
    if (!tex)
    {
        LogWarning("Failed to open Ogre texture " + name.toStdString() + " .");
        return;
    }

    int width = tex->getWidth();
    int height = tex->getHeight();
    Ogre::Box bounds(0, 0, width, height);
    Ogre::uchar* pixelData = new Ogre::uchar[width * height * 4];
    Ogre::PixelBox pixels(bounds, Ogre::PF_A8R8G8B8, pixelData);
    tex->getBuffer()->blitToMemory(pixels);
    
    // Create image of texture, and show it into label.

    u8* p = static_cast<u8 *>(pixels.data);
    int widthPixels = pixels.getWidth();
    int heightPixels= pixels.getHeight();
    
    QImage img = ConvertToQImage(p, widthPixels, heightPixels, 4);

    if(!img.isNull() && imageLabel_ != 0)
    {
        imageLabel_->setPixmap(QPixmap::fromImage(img));
        imageLabel_->show();
    }

    delete[] pixelData;
}
void ResourceManager::unloadResource(Ogre::ResourceManager* resMgr, const std::string& resourceName)
{
    Ogre::ResourcePtr rPtr = resMgr->getByName(resourceName);
    if (rPtr.isNull()) return

    rPtr->unload();
    if (rPtr->isLoaded())
        LOG_META(FORMAT("The resource '%1%' wasn`t unloaded!", resourceName));
    else
        LOG_META(FORMAT("The resource '%1%' was unloaded!", resourceName));

    resMgr->remove(resourceName);
    rPtr = resMgr->getByName(resourceName);
    if (!rPtr.isNull())
        LOG_META(FORMAT("The resource '%1%' wasn`t removed!", resourceName));
    else
        LOG_META(FORMAT("The resource '%1%' was removed!", resourceName));
}
Beispiel #20
0
Ogre::ResourcePtr ResourceManager::getResource( const ResourceInfo& rResource, 
    bool create /*= false*/ ) const
{
    Ogre::ResourcePtr resource = mRGM._getResourceManager( 
        ResourceManager::getResourceManagerName( rResource.mType ) )->getByName( 
        rResource.mFile.string(), mGroup );
    if( !create ) return resource;

    if( resource.isNull() )
    {
        if( !mRGM.findResourceNames( mGroup, rResource.mFile.string() )->size() )
            return resource;

        resource = mRGM._getResourceManager( ResourceManager::getResourceManagerName( 
            rResource.mType ) )->create( rResource.mFile.string(), mGroup );
    }

    return resource;
}
Beispiel #21
0
SoundTrackPtr::SoundTrackPtr(const Ogre::ResourcePtr &resourcePtr)
{
	Log *errorLog = OGF::LogFactory::getSingletonPtr()->get(OGF::LOG_ERR);

	if (resourcePtr.isNull()) {
		return;
	}

	OGRE_LOCK_MUTEX(*resourcePtr.OGRE_AUTO_MUTEX_NAME)
	OGRE_COPY_AUTO_SHARED_MUTEX(resourcePtr.OGRE_AUTO_MUTEX_NAME)

	pRep = static_cast<SoundTrack *>(resourcePtr.getPointer());
	pUseCount = resourcePtr.useCountPointer();
	useFreeMethod = resourcePtr.freeMethod();

	// Incremento del contador de referencias.
	if (pUseCount)
		++(*pUseCount);
}
Beispiel #22
0
    Ogre::MaterialPtr
    IntersectGrid::_createIntersectGridMaterial(void)
    {
        String name = "IntersectGridMaterial";

        Ogre::ResourcePtr res = Ogre::MaterialManager::getSingleton().getByName(name);
        if (!res.isNull())
            return res;

        Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create(name, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
       
        material->setLightingEnabled(false);
        material->setSceneBlending(Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);
        material->setDepthWriteEnabled(false);
        // Use wireframe polygon mode
        material->getTechnique(0)->getPass(0)->setPolygonMode(Ogre::PM_WIREFRAME);

        return material;
    }
Beispiel #23
0
 Fader::Fader(const char *OverlayName, const char *MaterialName, FaderCallback *instance)
 {
     _fadeop = FADE_NONE;
     _alpha = 0.0;
     _inst = instance;

     // Get the material by name
     Ogre::ResourcePtr resptr = Ogre::MaterialManager::getSingleton().getByName(MaterialName);
     Ogre::Material * mat = dynamic_cast<Ogre::Material*>(resptr.getPointer());

     Ogre::Technique *tech = mat->getTechnique(0);    // Get the technique
     Ogre::Pass *pass = tech->getPass(0);            // Get the pass
     _tex_unit = pass->getTextureUnitState(0);        // Get the texture_unit state

     // Get the _overlay
     _overlay = Ogre::OverlayManager::getSingleton().getByName(OverlayName);
     _overlay->hide();

 }
bool reloadShaders(std_srvs::Empty::Request&, std_srvs::Empty::Response&)
{
  ROS_INFO("Reloading materials.");
  {
  Ogre::ResourceManager::ResourceMapIterator it = Ogre::MaterialManager::getSingleton().getResourceIterator();
  while (it.hasMoreElements())
  {
    Ogre::ResourcePtr resource = it.getNext();
    resource->reload();
  }
  }
  ROS_INFO("Reloading high-level gpu shaders.");
  {
  Ogre::ResourceManager::ResourceMapIterator it = Ogre::HighLevelGpuProgramManager::getSingleton().getResourceIterator();
  while (it.hasMoreElements())
  {
    Ogre::ResourcePtr resource = it.getNext();
    resource->reload();
  }
  }
  ROS_INFO("Reloading gpu shaders.");
  {
  Ogre::ResourceManager::ResourceMapIterator it = Ogre::GpuProgramManager::getSingleton().getResourceIterator();
  while (it.hasMoreElements())
  {
    Ogre::ResourcePtr resource = it.getNext();
    resource->reload();
  }
  }
  return true;
}
//-----------------------------------------------------------------------------------
    void CompositorDemo_FrameListener::registerCompositors(void)
    {
        Ogre::Viewport *vp = mMain->getRenderWindow()->getViewport(0);
        
        mCompositorSelectorViewManager = new ItemSelectorViewManager("CompositorSelectorWin");
        // tell view manager to notify us when an item changes selection state
        mCompositorSelectorViewManager->setItemSelectorController(this);
        //iterate through Compositor Managers resources and add name keys ast Item selectors to Compositor selector view manager
        Ogre::CompositorManager::ResourceMapIterator resourceIterator =
            Ogre::CompositorManager::getSingleton().getResourceIterator();

        // add all compositor resources to the view container
        while (resourceIterator.hasMoreElements())
        {
            Ogre::ResourcePtr resource = resourceIterator.getNext();
            const Ogre::String& compositorName = resource->getName();
            // Don't add base Ogre/Scene compositor to view
            if (compositorName == "Ogre/Scene")
                continue;
			// Don't add the deferred shading compositors, thats a different demo.
			if (Ogre::StringUtil::startsWith(compositorName, "DeferredShading", false))
				continue;

            mCompositorSelectorViewManager->addItemSelector(compositorName);
			int addPosition = -1;
			if (compositorName == "HDR")
			{
				// HDR must be first in the chain
				addPosition = 0;
			}
			try 
			{
				Ogre::CompositorInstance *instance = Ogre::CompositorManager::getSingleton().addCompositor(vp, compositorName, addPosition);
				Ogre::CompositorManager::getSingleton().setCompositorEnabled(vp, compositorName, false);
			} catch (...) {
			}
            
        }
    }
Beispiel #26
0
//-----------------------------------------------------------------------------------
void Sample_Compositor::registerCompositors(void)
{
	Ogre::Viewport *vp = mViewport;
    
    //iterate through Compositor Managers resources and add name keys to menu
    Ogre::CompositorManager::ResourceMapIterator resourceIterator =
        Ogre::CompositorManager::getSingleton().getResourceIterator();

    // add all compositor resources to the view container
    while (resourceIterator.hasMoreElements())
    {
        Ogre::ResourcePtr resource = resourceIterator.getNext();
        const Ogre::String& compositorName = resource->getName();
        // Don't add base Ogre/Scene compositor to view
        if (compositorName == "Ogre/Scene")
            continue;
		// Don't add the deferred shading compositors, thats a different demo.
		if (Ogre::StringUtil::startsWith(compositorName, "DeferredShading", false))
			continue;

		mCompositorNames.push_back(compositorName);
		int addPosition = -1;
		if (compositorName == "HDR")
		{
			// HDR must be first in the chain
			addPosition = 0;
		}
		try 
		{
			Ogre::CompositorManager::getSingleton().addCompositor(vp, compositorName, addPosition);
			Ogre::CompositorManager::getSingleton().setCompositorEnabled(vp, compositorName, false);
		} catch (...) {
		}
    }

	mNumCompositorPages = (mCompositorNames.size() / COMPOSITORS_PER_PAGE) +
		((mCompositorNames.size() % COMPOSITORS_PER_PAGE == 0) ? 0 : 1);
}
Beispiel #27
0
void Audio::resourceLoaded( Ogre::ResourcePtr pResource )
{
    if( mAudioSource )
    {
        TransitionBase<cAudio::IAudioSource, Audio>::stop( mInstanceNumber );
        mAudioSource->stop();
        GlobalsBase::mAudio->getAudioManager()->release( mAudioSource );
    }

    mAudioSource = GlobalsBase::mAudio->getAudioManager()->create( 
        Component::getGUIDString().c_str(), pResource->getName().c_str() );

    if( !mAudioSource )
    {
        CLOGE << "Could not load audio file.";
        mTransformSignal.disconnect();
    }
    else
    {
        TransitionBase<cAudio::IAudioSource, Audio>::setUpdateSignal( *GlobalsBase::mFrameSignal );
        TransitionBase<cAudio::IAudioSource, Audio>::setInstanceNumberFunction( 
            &Audio::getInstanceNumber );

        PropertySynchronization::processQueuedConstruction();
        PropertySynchronization::processQueue();

        // TODO: Store and load properties when reloading the audio file so all the properties from
        // previous audio component also get set onto the new audio component.

        mAudioSource->setPosition( toVector3<cAudio::cVector3>( 
            Component::getObject()._getDerivedPosition() ) );

        if( mAutoPlay )
            mAudioSource->play();

        if( mTransformSignal.empty() )
            mTransformSignal = Component::getObject().connectTransformChange( sigc::mem_fun( this, 
                &Audio::transformChange ) );
    }
}
Beispiel #28
0
void TheEscape::init()
{
	m_logger.createLog("default.log", true, false, true);

	try
	{
		delete m_config;
		m_config = new LuaConfiguration("config.lua");
	}
	catch(MessageException& e)
	{
		Ogre::LogManager::getSingleton().logMessage(Ogre::LML_NORMAL, e.getMessage());
	}

	if(SDL_Init(SDL_INIT_NOPARACHUTE))
		Ogre::LogManager::getSingleton().logMessage(Ogre::LML_CRITICAL, "Error initializing SDL: " + std::string(SDL_GetError()));


	delete m_renderer;
	m_renderer = new RenderSystem(*this);
  SDL_WM_SetCaption("Escape", NULL);

	/* ResourceGroupManager */
	Ogre::ResourceGroupManager &resGroupMgr = Ogre::ResourceGroupManager::getSingleton();
	resGroupMgr.addResourceLocation("../graphix", "FileSystem");
#ifdef WIN32
#else
	resGroupMgr.addResourceLocation("/usr/share/fonts/TTF", "FileSystem");
#endif
	resGroupMgr.initialiseAllResourceGroups();
	Ogre::FontManager &fontMgr = Ogre::FontManager::getSingleton();
	Ogre::MaterialManager& material_mgr = Ogre::MaterialManager::getSingleton();
	Ogre::ResourcePtr font = fontMgr.create("FreeSans","General");
	font->setParameter("type","truetype");
	font->setParameter("source","DejaVuSans.ttf");
	font->setParameter("size","16");
	font->setParameter("resolution","96");
	font->load();


	delete m_input;
	m_input = new InputSystem(*this);

	m_game_states["main"] = new MainState(*this);
	pushGameState("main");
}
Beispiel #29
0
void ResourceManager::ResourcesLoader::addResource( Ogre::ResourcePtr pResource )
{
    mResources.insert( std::make_pair( pResource->getCreator()->getResourceType(), 
        pResource->getHandle() ) );
}
Beispiel #30
0
Ogre::ResourcePtr ResourceManager::loadResource( const ResourceInfo& rResource, 
    const ResourceCallback& rCallbackSlot )
{
    Ogre::ResourcePtr resource = ResourceManager::getResource( rResource, true );

    if( !resource.isNull() && resource->isLoaded() )
    {
        CLOGD << "Resource " << rResource << " already loaded.";

        // If the resource is already loaded, callback immediately.
        rCallbackSlot( resource );
    }
    else if( !resource.isNull() && mHandleTickets.count( std::make_pair( 
        resource->getCreator()->getResourceType(), resource->getHandle() ) ) )
    {
        // If the resource is loading, add a callback.
        HandleTickets::iterator i = mHandleTickets.find(  std::make_pair( 
            resource->getCreator()->getResourceType(), resource->getHandle() ) );

        if( i != mHandleTickets.end() )
        {
            mTicketCallbacks.insert( TicketCallbacks::value_type( i->second, rCallbackSlot ) );

            CLOGD << "Resource " << rResource << " is loading, ticket callback: " << i->second;
        }
        else
        {
            DIVERSIA_EXCEPT( Exception::ERR_INTERNAL_ERROR, 
                "Could not find ticket for resource that is loading in the background.", 
	            "ResourceManager::loadResource" );
        }
    }
    else if( !resource.isNull() )
    {
        // Load the resource in the background and register the callback.
        resource = ResourceManager::getResource( rResource, true );
        Ogre::BackgroundProcessTicket ticket = 
            mRBQ.load( ResourceManager::getResourceManagerName( rResource.mType ), 
            rResource.mFile.string(), mGroup, false, 0, 0, this );
        mTicketCallbacks.insert( TicketCallbacks::value_type( ticket, rCallbackSlot ) );
        mHandleTickets.insert( std::make_pair( std::make_pair( 
            resource->getCreator()->getResourceType(), resource->getHandle() ), ticket ) );
        mTicketResources.insert( std::make_pair( ticket, resource ) );

        CLOGD << "Resource " << rResource << " will be loaded, ticket: " << ticket;
    }
    else
    {
        DIVERSIA_EXCEPT( Exception::ERR_FILE_NOT_FOUND, "Cannot load resource " + 
            rResource.mFile.string() + ", file does not exist.", 
	        "ResourceManager::loadResource" );
    }

    return resource;
}