2017-03-11 31 views
0

我試圖從this tutorial運行TinyOgre但我仍然得到以下信息:食人魔 - 無法找到請求的發射器類型。在ParticleSystemManager :: _ createEmitter

OGRE EXCEPTION(2:拋出:InvalidParameterException):找不到請求的發射器類型。在ParticleSystemManager :: _ createEmitter在 C:/Intel/INDE/OgreSDK_1-9-0/Ogre/OgreMain/src/OgreParticleSystemManager.cpp (線270)

這是我的代碼:

TinyOgre的.cpp

/* 
----------------------------------------------------------------------------- 
Filename: TinyOgre.cpp 
----------------------------------------------------------------------------- 

This source file is part of the 
    ___     __ __ _ _ _ 
    /___\__ _ _ __ ___// /\ \ (_) | _(_) 
// // _` | '__/ _ \ \ \/ \//| |//| 
/\_// (_| | | | __/ \ /\ /| | <| | 
\___/ \__, |_| \___| \/ \/ |_|_|\_\_| 
     |___/        
     Tutorial Framework 
     http://www.ogre3d.org/tikiwiki/ 
----------------------------------------------------------------------------- 
*/ 
#include "TinyOgre.h" 

#include <OgreLogManager.h> 
#include <OgreViewport.h> 
#include <OgreConfigFile.h> 
#include <OgreEntity.h> 
#include <OgreWindowEventUtilities.h> 

//------------------------------------------------------------------------------------- 
TinyOgre::TinyOgre(void) 
    : mRoot(0), 
    mCamera(0), 
    mSceneMgr(0), 
    mWindow(0), 
    mResourcesCfg(Ogre::StringUtil::BLANK), 
    mPluginsCfg(Ogre::StringUtil::BLANK) 
{ 
} 
//------------------------------------------------------------------------------------- 
TinyOgre::~TinyOgre(void) 
{ 
    delete mRoot; 
} 

bool TinyOgre::go(void) 
{ 
#ifdef _DEBUG 
    mResourcesCfg = "resources_d.cfg"; 
    mPluginsCfg = "plugins_d.cfg"; 
#else 
    mResourcesCfg = "resources.cfg"; 
    mPluginsCfg = "plugins.cfg"; 
#endif 

    // construct Ogre::Root 
    mRoot = new Ogre::Root(mPluginsCfg); 

//------------------------------------------------------------------------------------- 
    // setup resources 
    // Load resource paths from config file 
    Ogre::ConfigFile cf; 
    cf.load(mResourcesCfg); 

    // Go through all sections & settings in the file 
    Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator(); 

    Ogre::String secName, typeName, archName; 
    while (seci.hasMoreElements()) 
    { 
     secName = seci.peekNextKey(); 
     Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext(); 
     Ogre::ConfigFile::SettingsMultiMap::iterator i; 
     for (i = settings->begin(); i != settings->end(); ++i) 
     { 
      typeName = i->first; 
      archName = i->second; 
      Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
       archName, typeName, secName); 
     } 
    } 
//------------------------------------------------------------------------------------- 
    // configure 
    // Show the configuration dialog and initialise the system 
    // You can skip this and use root.restoreConfig() to load configuration 
    // settings if you were sure there are valid ones saved in ogre.cfg 
    if(mRoot->restoreConfig() || mRoot->showConfigDialog()) 
    { 
     // If returned true, user clicked OK so initialise 
     // Here we choose to let the system create a default rendering window by passing 'true' 
     mWindow = mRoot->initialise(true, "TinyOgre Render Window"); 
    } 
    else 
    { 
     return false; 
    } 
//------------------------------------------------------------------------------------- 
    // choose scenemanager 
    // Get the SceneManager, in this case a generic one 
    mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC); 
//------------------------------------------------------------------------------------- 
    // create camera 
    // Create the camera 
    mCamera = mSceneMgr->createCamera("PlayerCam"); 

    // Position it at 500 in Z direction 
    mCamera->setPosition(Ogre::Vector3(0,0,80)); 
    // Look back along -Z 
    mCamera->lookAt(Ogre::Vector3(0,0,-300)); 
    mCamera->setNearClipDistance(5); 

//------------------------------------------------------------------------------------- 
    // create viewports 
    // Create one viewport, entire window 
    Ogre::Viewport* vp = mWindow->addViewport(mCamera); 
    vp->setBackgroundColour(Ogre::ColourValue(0,0,0)); 

    // Alter the camera aspect ratio to match the viewport 
    mCamera->setAspectRatio(
     Ogre::Real(vp->getActualWidth())/Ogre::Real(vp->getActualHeight())); 
//------------------------------------------------------------------------------------- 
    // Set default mipmap level (NB some APIs ignore this) 
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5); 
//------------------------------------------------------------------------------------- 
    // Create any resource listeners (for loading screens) 
    //createResourceListener(); 
//------------------------------------------------------------------------------------- 
    // load resources 
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); 
//------------------------------------------------------------------------------------- 
    // Create the scene 
    Ogre::Entity* ogreHead = mSceneMgr->createEntity("Head", "ogrehead.mesh"); 

    Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(); 
    headNode->attachObject(ogreHead); 

    // Set ambient light 
    mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5)); 

    // Create a light 
    Ogre::Light* l = mSceneMgr->createLight("MainLight"); 
    l->setPosition(20,80,50); 
//------------------------------------------------------------------------------------- 

    while(true) 
    { 
     // Pump window messages for nice behaviour 
     Ogre::WindowEventUtilities::messagePump(); 

     if(mWindow->isClosed()) 
     { 
      return false; 
     } 

     // Render a frame 
     if(!mRoot->renderOneFrame()) return false; 
    } 

    // We should never be able to reach this corner 
    // but return true to calm down our compiler 
    return true; 
} 


#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 
#define WIN32_LEAN_AND_MEAN 
#include "windows.h" 
#endif 

#ifdef __cplusplus 
extern "C" { 
#endif 

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 
    INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT) 
#else 
    int main(int argc, char *argv[]) 
#endif 
    { 
     // Create application object 
     TinyOgre app; 

     try { 
      app.go(); 
     } catch(Ogre::Exception& e) { 
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 
      MessageBox(NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL); 
#else 
      std::cerr << "An exception has occured: " << 
       e.getFullDescription().c_str() << std::endl; 
#endif 
     } 

     return 0; 
    } 

#ifdef __cplusplus 
} 
#endif 

TinyOgre.h

/* 
----------------------------------------------------------------------------- 
Filename: TinyOgre.h 
----------------------------------------------------------------------------- 

This source file is part of the 
    ___     __ __ _ _ _ 
    /___\__ _ _ __ ___// /\ \ (_) | _(_) 
// // _` | '__/ _ \ \ \/ \//| |//| 
/\_// (_| | | | __/ \ /\ /| | <| | 
\___/ \__, |_| \___| \/ \/ |_|_|\_\_| 
     |___/        
     Tutorial Framework 
     http://www.ogre3d.org/tikiwiki/ 
----------------------------------------------------------------------------- 
*/ 
#ifndef __TinyOgre_h_ 
#define __TinyOgre_h_ 

#include <OgreRoot.h> 
#include <OgreCamera.h> 
#include <OgreSceneManager.h> 
#include <OgreRenderWindow.h> 

class TinyOgre 
{ 
public: 
    TinyOgre(void); 
    virtual ~TinyOgre(void); 
    bool go(void); 
protected: 
    Ogre::Root *mRoot; 
    Ogre::Camera* mCamera; 
    Ogre::SceneManager* mSceneMgr; 
    Ogre::RenderWindow* mWindow; 
    Ogre::String mResourcesCfg; 
    Ogre::String mPluginsCfg; 
}; 

#endif // #ifndef __TinyOgre_h_ 

我resources.cfg是以下(我「已經從網上的一些其他教程)組成的:

# Resources required by the sample browser and most samples. 
[Essential] 
Zip=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/packs/SdkTrays.zip 
Zip=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/packs/profiler.zip 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/thumbnails 

# Common sample resources needed by many of the samples. 
# Rarely used resources should be separately loaded by the 
# samples which require them. 
[Popular] 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/fonts 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/Cg 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/GLSL 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/GLSL150 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/GLSL400 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/GLSLES 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/HLSL 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/scripts 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/textures 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/textures/nvidia 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/scripts/SSAO 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/textures/SSAO 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/RTShaderLib/Cg 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/RTShaderLib/GLSL 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/models 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/particle 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/DeferredShadingMedia 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/PCZAppMedia 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/RTShaderLib 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/RTShaderLib/materials 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/PCZAppMedia 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/volumeTerrain 
Zip=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/packs/cubemap.zip 
Zip=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/packs/cubemapsJS.zip 
Zip=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/packs/dragon.zip 
Zip=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/packs/fresneldemo.zip 
Zip=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/packs/ogretestmap.zip 
Zip=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/packs/ogredance.zip 
Zip=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/packs/Sinbad.zip 
Zip=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/packs/skybox.zip 
Zip=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/volumeTerrain/volumeTerrainBig.zip 

FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/ParticleFX 

[General] 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media 

# Materials for visual tests 
[Tests] 
FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Tests/Media 

我注意到,當我的評論下面幾行:

#FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/GLSL 
#FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/GLSL150 
#FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/GLSL400 
#FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/GLSLES 
#FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/HLSL 
#FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/RTShaderLib/Cg 
#FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/RTShaderLib/GLSL 

然後我得到不同的錯誤信息:

OGRE EXCEPTION(6:FileNotFoundException):無法找到資源組中的資源 DualQuaternion_Common.glsl Popular或任何其他 組。在ResourceGroupManager ::在 ÇopenResource:/Intel/INDE/OgreSDK_1-9-0/Ogre/OgreMain/src/OgreResourceGroupManager.cpp (線756)

如果我的評論下面幾行:

#FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/GLSL 
#FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/GLSL150 
#FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/GLSL400 
#FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/GLSLES 
#FileSystem=C:/Intel/INDE/OgreSDK_1-9-0/Ogre/Samples/Media/materials/programs/HLSL 

然後我收到此錯誤信息:

OGRE EXCEPTION(6:FileNotFoundException異常):在熱門資源組或任何其他組無法找到資源 shadows.glsl。在 ResourceGroupManager :: openResource在 C:/Intel/INDE/OgreSDK_1-9-0/Ogre/OgreMain/src/OgreResourceGroupManager.cpp (線756)

讓我進一步明確了我的情況;我們在我們當前的項目中使用食人魔來提供一些可視化和數學(我個人不會做食人魔但是其他項目部分)。現在我想編譯「hello world」食人魔項目並開始玩。我使用的是VisualStudio 2013和Ogre 1.9。我懷疑這個問題可能是因爲我沒有根據wiki安裝食人魔,而是從另一臺PC上覆制它。但我100%肯定這是安裝工作,因爲我有幾個團隊成員正在使用相同的安裝(相同的路徑,相同的環境變量等),併爲我們的項目工作正常,所以我不會喜歡亂安裝。例如following code這也是使用食人魔工作正常對我來說(但這個例子是不使用resources.cfg)。謝謝

PS:首先我想發佈這個食人魔論壇,但似乎註冊已中斷(註冊後沒有郵件到達),所以如果有人可以重新發布它,我會很高興。

回答

1

聽起來好像你沒有在應用程序中加載「Plugin_ParticleFX」。確保它在你的「plugins.cfg」中列出。然後這個插件將提供dedicated Ogre3D wiki page中列出的發射器類型。


論壇:註冊工作。如果激活郵件以某種方式未能聯繫到您,請撥打get in touch與我們聯繫,我們可以輕鬆地將其排除。

+0

謝謝。將'Plugin = Plugin_ParticleFX'添加到'plugins.cfg'就行。 –