• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ogre::ResourceGroupManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ogre::ResourceGroupManager的典型用法代码示例。如果您正苦于以下问题:C++ ResourceGroupManager类的具体用法?C++ ResourceGroupManager怎么用?C++ ResourceGroupManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ResourceGroupManager类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: _makeOgre

  void _makeOgre()
  {
   srand(time(0));
   
   mRoot = new Ogre::Root("","");
   mRoot->addFrameListener(this);
#if 1
#ifdef _DEBUG
   mRoot->loadPlugin("RenderSystem_Direct3D9_d");
#else
   mRoot->loadPlugin("RenderSystem_Direct3D9");
#endif
#else
#ifdef _DEBUG
   mRoot->loadPlugin("RenderSystem_GL_d.dll");
#else
   mRoot->loadPlugin("RenderSystem_GL.dll");
#endif
#endif
   
   mRoot->setRenderSystem(mRoot->getAvailableRenderers()[0]);
    
   Ogre::ResourceGroupManager* rgm = Ogre::ResourceGroupManager::getSingletonPtr();
   rgm->addResourceLocation(".", "FileSystem");
   
   mRoot->initialise(false);
   
   mWindow = mRoot->createRenderWindow("Monkey", 1024, 768, false);
   mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC);
   mCamera = mSceneMgr->createCamera("Camera");
   mViewport = mWindow->addViewport(mCamera);
   mViewport->setBackgroundColour(Gorilla::rgb(128, 70, 27));
   
   rgm->initialiseAllResourceGroups();
  }
开发者ID:betajaen,项目名称:monkey,代码行数:35,代码来源:example.cpp


示例2: load

//---------------------------------------------------------------------------------
bool CSkyxEditor::load(bool async)
{
    if(mLoaded->get())
        return true;

    Ogre::ResourceGroupManager *mngr = Ogre::ResourceGroupManager::getSingletonPtr();
    Ogre::String value = mOgitorsRoot->GetProjectFile()->getFileSystemName() + "::/SkyX/";
    mngr->addResourceLocation(value, "Ofs", "SkyX");
    mngr->initialiseResourceGroup("SkyX");

	// Create SkyX
    mBasicController = new SkyX::BasicController(true);
    mHandle = new SkyX::SkyX(mOgitorsRoot->GetSceneManager(), mBasicController);
	mHandle->create();

    mHandle->getVCloudsManager()->getVClouds()->registerCamera(mOgitorsRoot->GetViewport()->getCameraEditor()->getCamera());

    mHandle->getVCloudsManager()->getVClouds()->setDistanceFallingParams(Ogre::Vector2(2, -1));

    _restoreState();

    registerForUpdates();

    mLoaded->set(true);
    return true;
}
开发者ID:jacmoe,项目名称:ogitor,代码行数:27,代码来源:SkyxEditor.cpp


示例3: addEditorResources

//-----------------------------------------------------------------------------------------
void CTerrainGroupEditorFactory::addEditorResources(bool changeDefaultNames)
{
    OgitorsRoot* ogitorsRoot = OgitorsRoot::getSingletonPtr();
    Ogre::String terrainDir = ogitorsRoot->GetProjectOptions()->TerrainDirectory;
    // create Terrain project folder and folder to hold the terrain
    ogitorsRoot->GetProjectFile()->createDirectory(terrainDir.c_str());
    ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/terrain/").c_str());

    // copy default plant textures
    ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/plants/").c_str());
    Ogre::String copydir = Ogitors::Globals::MEDIA_PATH + "/plants/";
    OgitorsUtils::CopyDirOfs(copydir, (terrainDir+"/plants/").c_str());

    // copy default terrain textures sorting them into two different folders
    ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/textures/").c_str());
    ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/textures/diffusespecular").c_str());
    ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/textures/normalheight").c_str());

    Ogre::ResourceGroupManager *mngr = Ogre::ResourceGroupManager::getSingletonPtr();
    copydir = Ogitors::Globals::MEDIA_PATH + "/terrainTextures/";
    mngr->addResourceLocation(copydir,"FileSystem","CopyTerrain");

    Ogre::FileInfoListPtr resList = mngr->listResourceFileInfo("CopyTerrain");

    // copy the files to the different directories
    OFS::OfsPtr& file = ogitorsRoot->GetProjectFile();
    for (Ogre::FileInfoList::const_iterator it = resList->begin(); it != resList->end(); ++it)
    {
        Ogre::FileInfo fInfo = (*it);
        Ogre::String loc = copydir + fInfo.path + fInfo.filename;
        Ogre::String newName = fInfo.filename;
        
        if(fInfo.archive->getType() == "FileSystem")
        {
            if(fInfo.filename.find("diffusespecular") != -1)
            {
                /* since we're using different resource groups for the terrain lets
                remove the naming scheme from the filenames except if the project
                is being upgraded, in which case leave the name alone. */
                if (changeDefaultNames) {
                    newName = Ogre::StringUtil::replaceAll(newName, "_diffusespecular", "");
                }
                OgitorsUtils::CopyFileOfs(loc, terrainDir+"/textures/diffusespecular/"+newName);
            }
            
            if(fInfo.filename.find("normalheight") != -1)
            {
                if (changeDefaultNames) {
                    newName = Ogre::StringUtil::replaceAll(newName, "_normalheight", "");
                }
                OgitorsUtils::CopyFileOfs(loc, terrainDir+"/textures/normalheight/"+newName);
            }
        }
    }
    resList.setNull();
    
    ogitorsRoot->DestroyResourceGroup("CopyTerrain");
}
开发者ID:xubingyue,项目名称:Ogitor,代码行数:59,代码来源:TerrainGroupEditor.cpp


示例4: CBaseEditor

//--------------------------------------------------------------------------------------------------
CCaelumEditor::CCaelumEditor(CBaseEditorFactory *factory) : CBaseEditor(factory),
    _mUpdateCounter(0)
{
    mHandle = 0;
    mSceneManager = 0;
    
    mName->init("CaelumSky");

    Ogre::ResourceGroupManager *resmngr = Ogre::ResourceGroupManager::getSingletonPtr();
    Ogre::String value = mOgitorsRoot->GetProjectFile()->getFileSystemName() + "::/" + mOgitorsRoot->GetProjectOptions()->CaelumDirectory + "/";
    resmngr->addResourceLocation(value,"Ofs","Caelum");
    resmngr->initialiseResourceGroup("Caelum");
}
开发者ID:ZelconGames,项目名称:Ogitor-Facade,代码行数:14,代码来源:CaelumEditor.cpp


示例5: init

    bool OgreModel::init(Ogre::String meshName,
                         Ogre::Vector3 pos, Ogre::Quaternion rot, Ogre::Vector3 scale,
                         Ogre::SceneNode *levelRoot,
                         Ogre::SceneManager *sceneManager,
                         Ogre::String const &resourceGroupName
                        )
    {
        mSceneManager = sceneManager;
        // handle
        Ogre::ResourceGroupManager *rgm = Ogre::ResourceGroupManager::getSingletonPtr();

        if(!rgm->resourceExists(resourceGroupName, meshName))
            rgm->declareResource(meshName, "FileSystem", resourceGroupName);

        const bool withRestore = nullptr != mSceneNode;
        Ogre::Any any;

        if(withRestore)
        {
            any = mSceneNode->getUserObjectBindings().getUserAny();

            if(mEntity != nullptr)
            {
                mEntity->detachFromParent();
                mSceneManager->destroyEntity(mEntity);
                mEntity = nullptr;
            }

            if(mSceneNode != nullptr)
            {
                OgreUtils::destroySceneNode(mSceneNode);
                mSceneNode = nullptr;
            }
        }

        mEntity = sceneManager->createEntity(meshName);

        mSceneNode = levelRoot->createChildSceneNode(pos, rot);
        mSceneNode->attachObject(mEntity);
        mSceneNode->setInheritScale(false);
        mSceneNode->setScale(scale);

        if(withRestore)
        {
            mSceneNode->getUserObjectBindings().setUserAny(any);
        }

        return true;
    }
开发者ID:onze,项目名称:Steel,代码行数:49,代码来源:OgreModel.cpp


示例6: openFile

void SoundBank::openFile(std::string path, std::string id, int index)
{
	std::string foundPath = path;
	Ogre::ResourceGroupManager* groupManager = Ogre::ResourceGroupManager::getSingletonPtr() ;
	Ogre::String group = groupManager->findGroupContainingResource(path) ;
	Ogre::FileInfoListPtr fileInfos = groupManager->findResourceFileInfo(group,foundPath);
	Ogre::FileInfoList::iterator it = fileInfos->begin();
	if(it != fileInfos->end())
	{
		foundPath = it->archive->getName() + "/" + foundPath;
	}
	else
	{
		foundPath = "";
	}

	this->addSound(new SoundChunk(foundPath), id, index);
}
开发者ID:simonkwong,项目名称:Shamoov,代码行数:18,代码来源:Sound.cpp


示例7: findFilePath

        std::string findFilePath(const std::string& filename)
        {
          // on demand init
          Model::initRessources() ;
          
          std::string foundPath = filename;
          Ogre::ResourceGroupManager* groupManager = Ogre::ResourceGroupManager::getSingletonPtr() ;
          Ogre::String group = groupManager->findGroupContainingResource(filename) ;
          Ogre::FileInfoListPtr fileInfos = groupManager->findResourceFileInfo(group,foundPath);
          Ogre::FileInfoList::iterator it = fileInfos->begin();
          if(it != fileInfos->end())
          {
            foundPath = it->archive->getName() + "/" + foundPath;
            foundPath;
          }
          else
            foundPath = "";

          return foundPath;
        }
开发者ID:BackupTheBerlios,项目名称:projet-univers-svn,代码行数:20,代码来源:manager.cpp


示例8: CBaseEditor

//-----------------------------------------------------------------------------------------
CTerrainGroupEditor::CTerrainGroupEditor(CBaseEditorFactory *factory) : CBaseEditor(factory),
mHandle(0), mBrushData(0), mModificationRect(0,0,0,0)
{
    mDecalNode = 0;
    mDecalFrustum = 0;
    mEditMode = EM_NONE;
    mEditActive = false;
    mDecalTexture.setNull();
    mBrushSize = 1;
    mName->init("Terrain Group");
    mTextureGrass = "grass";
    mBrushName = "AllWhite.png";

    mMaxLayersAllowed = 6;

    Ogre::ResourceGroupManager *mngr = Ogre::ResourceGroupManager::getSingletonPtr();
    Ogre::String terrainDir = mOgitorsRoot->GetProjectFile()->getFileSystemName() + "::/" + mOgitorsRoot->GetProjectOptions()->TerrainDirectory + "/terrain";
    mngr->addResourceLocation(terrainDir,"Ofs","TerrainResources");

    mTerrainGlobalOptions = OGRE_NEW Ogre::TerrainGlobalOptions();
}
开发者ID:xubingyue,项目名称:Ogitor,代码行数:22,代码来源:TerrainGroupEditor.cpp


示例9: _makeOgre

  void  _makeOgre()
  {
   srand(time(0));
   
   mRoot = new Ogre::Root("","");
   mRoot->addFrameListener(this);
   
#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
   mRoot->loadPlugin(OGRE_RENDERER);
#else
#if 1
  #ifdef _DEBUG
   mRoot->loadPlugin("RenderSystem_Direct3D9_d");
  #else
   mRoot->loadPlugin("RenderSystem_Direct3D9");
  #endif
#else
  #ifdef _DEBUG
   mRoot->loadPlugin("RenderSystem_GL_d.dll");
  #else
   mRoot->loadPlugin("RenderSystem_GL.dll");
  #endif
#endif
#endif
   
   mRoot->setRenderSystem(mRoot->getAvailableRenderers()[0]);
   
   Ogre::ResourceGroupManager* rgm = Ogre::ResourceGroupManager::getSingletonPtr();
  	rgm->addResourceLocation(".", "FileSystem");
   
   mRoot->initialise(false);
   
   mWindow = mRoot->createRenderWindow("Gorilla - Press 0 to 9 for unit tests. C to Clear.", 1024, 768, false);
   mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC);
   mCamera = mSceneMgr->createCamera("Camera");
   mViewport = mWindow->addViewport(mCamera);
   mViewport->setBackgroundColour(Ogre::ColourValue::Black);
   
   rgm->initialiseAllResourceGroups();
  }
开发者ID:ViteFalcon,项目名称:gorilla,代码行数:40,代码来源:gorilla_tests.cpp


示例10: _makeOgre

  void  _makeOgre()
  {
   srand(time(0));
   
   mRoot = new Ogre::Root("","");
   mRoot->addFrameListener(this);

  #ifdef _DEBUG
    #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
   // Change this to where ever you've squirrelled away your RenderSystem debug library
   mRoot->loadPlugin("/usr/local/lib/OGRE/RenderSystem_GL_d");
    #else
   mRoot->loadPlugin("RenderSystem_Direct3D9_d");
    #endif
  #else
    #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
   // Change this to where ever you've squirrelled away your RenderSystem release library
   mRoot->loadPlugin("/usr/local/lib/OGRE/RenderSystem_GL");
    #else
   mRoot->loadPlugin("RenderSystem_Direct3D9");
   #endif
#endif
   
   mRoot->setRenderSystem(mRoot->getAvailableRenderers()[0]);
   
   Ogre::ResourceGroupManager* rgm = Ogre::ResourceGroupManager::getSingletonPtr();
  	rgm->addResourceLocation(".", "FileSystem");
   
   mRoot->initialise(false);
   
   mWindow = mRoot->createRenderWindow("Gorilla", 1024, 768, false);
   mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC);
   mCamera = mSceneMgr->createCamera("Camera");
   mViewport = mWindow->addViewport(mCamera);
   mViewport->setBackgroundColour(Gorilla::rgb(13, 13, 13));
   
   rgm->initialiseAllResourceGroups();
  }
开发者ID:jlsandell,项目名称:gorilla,代码行数:38,代码来源:gorilla_ogreconsole.cpp


示例11: ExportLevel

void OgreExporter_c::ExportLevel(const WadLevel_c &level, const WadFile_c &file)
{	
	this->ExportLevelMaterials(level, file);

	Ogre::DefaultHardwareBufferManager hardwareBufferManager;
	Ogre::ManualObject manualMesh(level.GetName());	

	const LineDef_s *lineDefs = level.GetLineDefs();
	const size_t numLineDefs = level.GetNumLineDefs();

	const SideDef_s *sideDefs = level.GetSideDefs();
	const Sector_s *sectors = level.GetSectors();

	const Vertex_s *vertices = level.GetVertices();
	for(size_t i = 0;i < numLineDefs; ++i)
	{
		if(lineDefs[i].iLeftSideDef >= 0)
		{
			const SideDef_s &leftSide = sideDefs[lineDefs[i].iLeftSideDef];
			const Sector_s &leftSideSector = sectors[leftSide.iSector];

			const SideDef_s &rightSide = sideDefs[lineDefs[i].iRightSideDef];
			const Sector_s &rightSideSector = sectors[rightSide.iSector];


			if(leftSide.uMiddleTexture.uName != '-')
			{
				this->ExportWallMesh(manualMesh, leftSideSector.iFloorHeight, leftSideSector.iCeilHeight, leftSide.uMiddleTexture, leftSide.iOffsetX, leftSide.iOffsety, vertices, lineDefs[i], file);				
			}

			if(leftSide.uLowerTexture.uName != '-')
			{
				this->ExportWallMesh(manualMesh, leftSideSector.iFloorHeight, leftSideSector.iFloorHeight, leftSide.uLowerTexture, leftSide.iOffsetX, leftSide.iOffsety, vertices, lineDefs[i], file);				
			}

			if(leftSide.uUpperTexture.uName != '-')
			{
				this->ExportWallMesh(manualMesh, rightSideSector.iCeilHeight, leftSideSector.iCeilHeight, leftSide.uUpperTexture, leftSide.iOffsetX, leftSide.iOffsety, vertices, lineDefs[i], file);				
			}
		}
		
		if(lineDefs[i].iRightSideDef >= 0)
		{			
			const SideDef_s &rightSide = sideDefs[lineDefs[i].iRightSideDef];
			const Sector_s &rightSideSector = sectors[rightSide.iSector];

			if(rightSide.uLowerTexture.uName != '-')
			{
				const SideDef_s &leftSide = sideDefs[lineDefs[i].iLeftSideDef];
				const Sector_s &leftSideSector = sectors[leftSide.iSector];

				this->ExportWallMesh(manualMesh, rightSideSector.iFloorHeight, leftSideSector.iFloorHeight, rightSide.uLowerTexture, rightSide.iOffsetX, rightSide.iOffsety, vertices, lineDefs[i], file);				
			}	

			if(rightSide.uMiddleTexture.uName != '-')
			{
				this->ExportWallMesh(manualMesh, rightSideSector.iFloorHeight, rightSideSector.iCeilHeight, rightSide.uMiddleTexture, rightSide.iOffsetX, rightSide.iOffsety, vertices, lineDefs[i], file);				
			}		

			if(rightSide.uUpperTexture.uName != '-')
			{
				const SideDef_s &leftSide = sideDefs[lineDefs[i].iLeftSideDef];
				const Sector_s &leftSideSector = sectors[leftSide.iSector];

				this->ExportWallMesh(manualMesh, leftSideSector.iCeilHeight, rightSideSector.iCeilHeight, rightSide.uUpperTexture, rightSide.iOffsetX, rightSide.iOffsety, vertices, lineDefs[i], file);				
			}	
		}
	}

	namespace fs = boost::filesystem;

	fs::path path(strLevelDirectory);

	std::string levelName = level.GetName();
	levelName += ".mesh";

	path /= levelName;	

	Ogre::LogManager logManager;
	logManager.createLog("ogre.log", true, true, false);

	Ogre::ResourceGroupManager resourceGroupManager;
	Ogre::MeshManager meshManager;
	Ogre::LodStrategyManager logStrategyManager;
	Ogre::MeshPtr mesh = manualMesh.convertToMesh(level.GetName());

	Ogre::MeshSerializer serializer;
	serializer.exportMesh(mesh.get(), path.string());

	mesh.setNull();

	resourceGroupManager.shutdownAll();	

	this->CreateResourcesCfg();
}
开发者ID:jlsandell,项目名称:wadlib,代码行数:95,代码来源:OgreExporter.cpp


示例12: init

bool Game::init()
{
  try
  {
    // Read config first
    config.read("./config.cfg");

    // Init SDL
    SDL_Init(SDL_INIT_VIDEO);
    SDL_putenv((char*)"SDL_VIDEO_CENTERED=true");
    int flags = SDL_OPENGL;
    if (config.getFullscreen())
      flags |= SDL_FULLSCREEN;
    SDL_SetVideoMode(config.getCanvasWidth(), config.getCanvasHeight(), config.getBits(), flags);
    SDL_WM_SetCaption("Yet Another Rubik's Cube", NULL);

    // Ogre
    root = new Ogre::Root();
    #ifdef _WINDOWS
      root->loadPlugin("./RenderSystem_GL.dll");
    #else
      root->loadPlugin("./RenderSystem_GL.so");
    #endif
    Ogre::RenderSystem *rs = root->getRenderSystemByName("OpenGL Rendering Subsystem");
    root->setRenderSystem(rs);
    rs->setConfigOption("Full Screen", config.getFullscreenStr());
    rs->setConfigOption("Video Mode", config.getVideoModeStr());
    root->initialise(false);

    // Window
    Ogre::NameValuePairList params;
    #ifdef _WINDOWS
      SDL_SysWMinfo info;
      SDL_VERSION(&info.version);
      SDL_GetWMInfo(&info);
      params["externalWindowHandle"] = Ogre::StringConverter::toString(reinterpret_cast<size_t>(info.window));
      params["externalGLContent"] = Ogre::StringConverter::toString(reinterpret_cast<size_t>(info.hglrc));
      params["externalGLControl"] = Ogre::String("True");
    #else
      params["currentGLContext"] = Ogre::String("True");
    #endif
    wnd = root->createRenderWindow("Main window", config.getCanvasWidth(), config.getCanvasHeight(),
        config.getFullscreen(), &params);
    wnd->setVisible(true);

    // Input
    imgr = new InputManager();

    // Hard-code res location
    Ogre::ResourceGroupManager *rgm = Ogre::ResourceGroupManager::getSingletonPtr();
    rgm->addResourceLocation("res.gdat", "Zip", "General");
    rgm->initialiseAllResourceGroups();

    // Window and rendering events listener
    root->addFrameListener(this);
    imgr->regEventListener(this);
    imgr->regKeyboardListener(this);
  }
  catch (std::exception &e)
  {
    #ifdef _WINDOWS
      MessageBoxA(NULL, e.what(), "Exception occured", MB_OK | MB_ICONERROR);
    #else
      std::cout << e.what();
    #endif
    return false;
  }
  return true;
}
开发者ID:0xc0dec,项目名称:yarc,代码行数:69,代码来源:Game.cpp


示例13: _makeOgre

  void  _makeOgre()
  {
   srand(time(0));
   
   mRoot = new Ogre::Root("","");
   mRoot->addFrameListener(this);
   
#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
   mRoot->loadPlugin(OGRE_RENDERER);
#else
#if 1
  #ifdef _DEBUG
   mRoot->loadPlugin("RenderSystem_Direct3D9_d");
  #else
   mRoot->loadPlugin("RenderSystem_Direct3D9");
  #endif
#else
  #ifdef _DEBUG
   mRoot->loadPlugin("RenderSystem_GL_d.dll");
  #else
   mRoot->loadPlugin("RenderSystem_GL.dll");
  #endif
#endif
#endif
   
   mRoot->setRenderSystem(mRoot->getAvailableRenderers()[0]);
   
   Ogre::ResourceGroupManager* rgm = Ogre::ResourceGroupManager::getSingletonPtr();
  	rgm->addResourceLocation(".", "FileSystem");
   
   mRoot->initialise(false);
   
   mWindow = mRoot->createRenderWindow("Gorilla", 1024, 768, false);
   mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC);
   mCamera = mSceneMgr->createCamera("Camera");
   mViewport = mWindow->addViewport(mCamera);

   Ogre::ColourValue BackgroundColour = Ogre::ColourValue(0.1337f, 0.1337f, 0.1337f, 1.0f);
   Ogre::ColourValue GridColour = Ogre::ColourValue(0.2000f, 0.2000f, 0.2000f, 1.0f);

   mViewport->setBackgroundColour(BackgroundColour);
   
   rgm->initialiseAllResourceGroups();
   
   mCamera->setPosition(10,2,10);
   mCamera->lookAt(0,2,0);
   mCamera->setNearClipDistance(0.05f);
   mCamera->setFarClipDistance(1000);
   
   mReferenceObject = new Ogre::ManualObject("ReferenceGrid");

   mReferenceObject->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_LIST);
   
   Ogre::Real step = 1.0f;
   unsigned int count = 200;
   unsigned int halfCount = count / 2;
   Ogre::Real full = (step * count);
   Ogre::Real half = full / 2;
   Ogre::Real y = 0;
   Ogre::ColourValue c;
   for (unsigned i=0;i < count+1;i++)
   {
    
    if (i == halfCount)
     c = Ogre::ColourValue(0.5f,0.3f,0.3f,1.0f);
    else
     c = GridColour;
    
    mReferenceObject->position(-half,y,-half+(step*i));
    mReferenceObject->colour(BackgroundColour);
    mReferenceObject->position(0,y,-half+(step*i));
    mReferenceObject->colour(c);
    mReferenceObject->position(0,y,-half+(step*i));
    mReferenceObject->colour(c);
    mReferenceObject->position(half,y,-half+(step*i));
    mReferenceObject->colour(BackgroundColour);

    if (i == halfCount)
     c = Ogre::ColourValue(0.3f,0.3f,0.5f,1.0f);
    else
     c = GridColour;
    
    mReferenceObject->position(-half+(step*i),y,-half);
    mReferenceObject->colour(BackgroundColour);
    mReferenceObject->position(-half+(step*i),y,0);
    mReferenceObject->colour(c);
    mReferenceObject->position(-half+(step*i),y,0);
    mReferenceObject->colour(c);
    mReferenceObject->position(-half+(step*i),y, half);
    mReferenceObject->colour(BackgroundColour);

   }
   
   mReferenceObject->end();
   mSceneMgr->getRootSceneNode()->attachObject(mReferenceObject);
    
    
    
  }
开发者ID:ViteFalcon,项目名称:gorilla,代码行数:99,代码来源:gorilla_3d.cpp


示例14: load

//-----------------------------------------------------------------------------------------
bool CTerrainGroupEditor::load(bool async)
{
    if(mLoaded->get())
        return true;

    if(!getParent()->load())
        return false;

    Ogre::ResourceGroupManager *mngr = Ogre::ResourceGroupManager::getSingletonPtr();
    Ogre::String terrainDir = OgitorsRoot::getSingletonPtr()->GetProjectOptions()->TerrainDirectory;
    terrainDir = mOgitorsRoot->GetProjectFile()->getFileSystemName() + "::/" + terrainDir + "/";

    mngr->addResourceLocation(terrainDir + "textures/normalheight", "Ofs", "TerrainGroupNormalHeight");
    mngr->initialiseResourceGroup("TerrainGroupNormalHeight");

    mngr->addResourceLocation(terrainDir + "textures/diffusespecular", "Ofs", "TerrainGroupDiffuseSpecular");
    mngr->initialiseResourceGroup("TerrainGroupDiffuseSpecular");

    mngr->addResourceLocation(terrainDir + "plants", "Ofs", "TerrainGroupPlants");
    mngr->initialiseResourceGroup("TerrainGroupPlants");

    OgitorsRoot::getSingletonPtr()->PrepareTerrainResources();
    OgitorsRoot::getSingletonPtr()->ReloadUserResources();

    mDecalFrustum = OGRE_NEW Ogre::Frustum();
    mDecalNode = getSceneManager()->getRootSceneNode()->createChildSceneNode("OgitorTerrainDecalNode");
    mDecalNode->setPosition(99999, -99999, 99999);
    mDecalNode->attachObject(mDecalFrustum);
    mDecalFrustum->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
    mDecalNode->setOrientation(Ogre::Quaternion(Ogre::Degree(-90), Ogre::Vector3::UNIT_X));
    mDecalFrustum->setFOVy(Ogre::Degree(45));
    mDecalFrustum->setNearClipDistance(10);
    mDecalFrustum->setOrthoWindow(10, 10);
    mDecalFrustum->setVisible(false);
    mDecalTexture = Ogre::TextureManager::getSingletonPtr()->createManual("OgitorDecalTexture", "TerrainResources", 
        Ogre::TEX_TYPE_2D, 256, 256, 1, 1, Ogre::PF_A8R8G8B8, Ogre::TU_DYNAMIC_WRITE_ONLY, this);

    mBrushData = OGRE_ALLOC_T(float, BRUSH_DATA_SIZE * BRUSH_DATA_SIZE, Ogre::MEMCATEGORY_GEOMETRY);

    mTerrainGlobalOptions->setMaxPixelError(mMaxPixelError->get());
    mTerrainGlobalOptions->setCompositeMapSize(mCompositeMapTextureSize->get());
    mTerrainGlobalOptions->setCompositeMapDistance(mCompositeMapDistance->get());
    mTerrainGlobalOptions->setLightMapSize(mLightMapTextureSize->get());
    mTerrainGlobalOptions->setLayerBlendMapSize(mBlendMapTextureSize->get());
    mTerrainGlobalOptions->setUseVertexCompressionWhenAvailable(false);
    mTerrainGlobalOptions->setSkirtSize(mSkirtSize->get());
    mTerrainGlobalOptions->setUseRayBoxDistanceCalculation(mUseRayBoxDistanceCalculation->get());

    if(mMaterialGeneratorType->get() == 1)
    {
        Ogre::TerrainMaterialGeneratorPtr matGenPtr(OGRE_NEW Ogre::TerrainMaterialGeneratorC(this, mDecalFrustum));
        mTerrainGlobalOptions->setDefaultMaterialGenerator(matGenPtr);
        mMaxLayersAllowed = 10;
    }
    else
    {
        Ogre::TerrainMaterialGeneratorPtr matGenPtr(OGRE_NEW Ogre::TerrainMaterialGeneratorB(this, mDecalFrustum));
        mTerrainGlobalOptions->setDefaultMaterialGenerator(matGenPtr);
        mMaxLayersAllowed = 6;
    }

    CSceneManagerEditor *mSceneMgr = static_cast<CSceneManagerEditor*>(mOgitorsRoot->GetSceneManagerEditor());

    if(mSceneMgr->getShadowsEnabled())
    {
        if(mMaterialGeneratorType->get() == 1)
        {
            Ogre::TerrainMaterialGeneratorC::SM2Profile* matProfile = static_cast<Ogre::TerrainMaterialGeneratorC::SM2Profile*>(mTerrainGlobalOptions->getDefaultMaterialGenerator()->getActiveProfile());
            matProfile->setReceiveDynamicShadowsEnabled(true);
            matProfile->setReceiveDynamicShadowsLowLod(false);
            matProfile->setReceiveDynamicShadowsDepth(true);
            matProfile->setReceiveDynamicShadowsPSSM(static_cast<Ogre::PSSMShadowCameraSetup*>(mSceneMgr->getPSSMSetup().get()));
        }
        else
        {
            Ogre::TerrainMaterialGeneratorB::SM2Profile* matProfile = static_cast<Ogre::TerrainMaterialGeneratorB::SM2Profile*>(mTerrainGlobalOptions->getDefaultMaterialGenerator()->getActiveProfile());
            matProfile->setReceiveDynamicShadowsEnabled(true);
            matProfile->setReceiveDynamicShadowsLowLod(false);
            matProfile->setReceiveDynamicShadowsDepth(true);
            matProfile->setReceiveDynamicShadowsPSSM(static_cast<Ogre::PSSMShadowCameraSetup*>(mSceneMgr->getPSSMSetup().get()));
        }
    }

    CONNECT_PROPERTY_MEMFN(mSceneMgr, "shadows::enabled", CTerrainGroupEditor, onShadowsChange, mShadowsConnection[0]);
    CONNECT_PROPERTY_MEMFN(mSceneMgr, "shadows::technique", CTerrainGroupEditor, onShadowsTechniqueChange, mShadowsConnection[1]);

    mHandle = OGRE_NEW Ogre::TerrainGroup(mOgitorsRoot->GetSceneManager(), Ogre::Terrain::ALIGN_X_Z, mMapSize->get(), mWorldSize->get());
    mHandle->setOrigin(Ogre::Vector3::ZERO);
    mHandle->setResourceGroup("TerrainResources");
    mHandle->setFilenameConvention(mPageNamePrefix->get(), "ogt");
    StaticGroupPtr = mHandle;

    mPGHandle = new PagedGeometry(mOgitorsRoot->GetViewport()->getCameraEditor()->getCamera(), mPGPageSize->get());
    mPGHandle->addDetailLevel<GrassPage>(mPGDetailDistance->get());

    //Create a GrassLoader object
    mGrassLoaderHandle = new GrassLoader(mPGHandle);
    mGrassLoaderHandle->setVisibilityFlags(1 << mLayer->get());

//.........这里部分代码省略.........
开发者ID:xubingyue,项目名称:Ogitor,代码行数:101,代码来源:TerrainGroupEditor.cpp


示例15: Init

bool CsBaseApplication::Init() {
	Ogre::String pluginsCfg;
#ifdef _DEBUG
    pluginsCfg = "plugins_d.cfg";
#else
    pluginsCfg = "plugins.cfg";
#endif

    //create ogre root
    mRoot = new Ogre::Root(pluginsCfg);

	SetupResources();
    Ogre::ResourceGroupManager *rgm = Ogre::ResourceGroupManager::getSingletonPtr();

    // set a render system
    Ogre::RenderSystem* rSys;
    rSys = mRoot->getRenderSystemByName("OpenGL Rendering Subsystem");
    mRoot->setRenderSystem(rSys);
    // end gracelessly if the preferred renderer is not available
    if (mRoot->getRenderSystem() == NULL) {
        delete mRoot;
        return false;
    }

    // create a window
    mRoot->initialise(false);
    mWindow = mRoot->createRenderWindow(
        "CsWindow",   // window name
        1366,                    // window width, in pixels
        768,                    // window height, in pixels
        false,                  // fullscreen or not
        0);                     // use defaults for all other values
    Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);

    // extra init
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

	// Startup the GUI section *******************************************************
	try {
		mRenderer = &CEGUI::OgreRenderer::bootstrapSystem(*mRoot->getRenderTarget("CsWindow"));
	} catch ( CEGUI::Exception& e) {
		MessageBoxA( NULL, e.getMessage().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
		return false;
	}
	//CEGUI::OgreRenderer::bootstrapSystem();

	CEGUI::Imageset::setDefaultResourceGroup("Imagesets");
	CEGUI::Font::setDefaultResourceGroup("Fonts");
	CEGUI::Scheme::setDefaultResourceGroup("Schemes");
	CEGUI::WidgetLookManager::setDefaultResourceGroup("LookNFeel");
	CEGUI::WindowManager::setDefaultResourceGroup("Layouts");
	
	CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
	CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
	// *******************************************************************************

	rgm->initialiseAllResourceGroups(); 
	// SceneManager and viewports created in the GameInterface component

	CsAudioManager::Create();
	mAudioManager = CsAudioManager::GetSingletonPtr();
	mAudioManager->Init();

    return true;
}
开发者ID:SabinT,项目名称:Wings-Of-Chaos,代码行数:65,代码来源:CsBaseApplication.cpp


示例16: _init

	void OgreSubsystem::_init()
	{
		if(!mInitialized)
		{
			Logger::getPtr()->logMessage("Ogre Subsystem starting up...");

			mRoot = new Ogre::Root("","");

			// suppress log output (TODO allow this to be redirected and enabled)
			//Ogre::LogManager::getSingleton().getDefaultLog()->setDebugOutputEnabled(false);
			//Ogre::LogManager::getSingleton().getDefaultLog()->setLogDetail(Ogre::LL_LOW);

			//#if (ORYX_PLATFORM == ORYX_PLATFORM_WIN32)
			//mRoot->loadPlugin("OgrePlugins/RenderSystem_GL.dll");
			//mRoot->loadPlugin("OgrePlugins/Plugin_CgProgramManager.dll");
			//mRoot->loadPlugin("OgrePlugins/Plugin_ParticleFX.dll");
			//#else
			mRoot->loadPlugin("OgrePlugins/RenderSystem_GL");
			//mRoot->loadPlugin("OgrePlugins/Plugin_CgProgramManager");
			mRoot->loadPlugin("OgrePlugins/Plugin_ParticleFX");
			//#endif

			Ogre::RenderSystem* rs = mRoot->getRenderSystemByName(
				"OpenGL Rendering Subsystem");
			mRoot->setRenderSystem(rs);

			mRoot->initialise(false);

			Ogre::NameValuePairList miscP;

			miscP["vsync"] = "false";
			miscP["FSAA"] = "0";
			miscP["gamma"] = "false";
			miscP["border"] = "fixed";
			miscP["colourDepth"] = "32";
			miscP["monitorIndex"] = "0";

      for (std::map<String, String>::iterator it = mParams.begin();
        it != mParams.end(); ++it) {
        miscP[it->first] = it->second;
      }

      mCurrentParams = mParams;

      mWindow = mRoot->createRenderWindow((getGfxParameter("window_name") != "")
        ? getGfxParameter("window_name") : "OryxEngine Application",
        mResolutionX,mResolutionY,mFullscreen,&miscP);

			mWindow->setActive(true);

			mSceneManager = mRoot->createSceneManager(Ogre::ST_GENERIC,"mSceneManager");
			Ogre::SceneNode* defaultCamNode = mSceneManager->createSceneNode("DefaultCameraNode");
			mDefaultCamera = new Camera("DefaultCamera",defaultCamNode,mSceneManager
				->createCamera("DefaultCamera"));
			defaultCamNode->attachObject(mDefaultCamera->getCamera());
			mDefaultCamera->setPosition(Vector3(0,0,0));
			mDefaultCamera->getCamera()->setDirection(0,0,-1);
			mDefaultCamera->setFarClip(60);
			mDefaultCamera->setNearClip(0.1f);
			mDefaultCamera->setFOV(60.f);

			mViewport = mWindow->addViewport(mDefaultCamera->getCamera());
			mViewport->setBackgroundColour(Ogre::ColourValue(1.0f,0.5f,0.2f));

			mDefaultCamera->getCamera()->setAspectRatio(Ogre::Real(mViewport->getActualWidth())
									/ Ogre::Real(mViewport->getActualHeight()));

			Ogre::ResourceGroupManager* resourceMgr = Ogre::ResourceGroupManager::getSingletonPtr();
			resourceMgr->addResourceLocation("../media","FileSystem","General");
			resourceMgr->addResourceLocation("../media/models","FileSystem","General");
			resourceMgr->addResourceLocation("../media/materials","FileSystem","General");
			resourceMgr->addResourceLocation("../media/textures","FileSystem","General");
			resourceMgr->addResourceLocation("../media/audio","FileSystem","General");
			resourceMgr->addResourceLocation("../media/gui","FileSystem","General");
			resourceMgr->addResourceLocation("../media/scripts","FileSystem","General");
			resourceMgr->addResourceLocation("../media/fonts","FileSystem","General");
			resourceMgr->initialiseAllResourceGroups();

			mRootSceneNode = new SceneNode(mSceneManager->getRootSceneNode()->getName(),
				mSceneManager->getRootSceneNode());

			Logger::getPtr()->logMessage("Ogre Subsystem started up.");
			mInitialized = true;
      /*mSceneManager->setShadowCameraSetup(Ogre::ShadowCameraSetupPtr(new Ogre::LiSPSMShadowCameraSetup()));
      mSceneManager->setShadowTexturePixelFormat(Ogre::PF_FLOAT16_R);
      mSceneManager->setShadowTextureCasterMaterial("depthcaster");
      mSceneManager->setShadowTextureSelfShadow(true);	
      mSceneManager->setShadowTextureSize(512);	
      mSceneManager->setShadowTextureCount(3);
      mSceneManager->setShadowCasterRenderBackFaces(false);
      mSceneManager->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED);;
      mSceneManager->setShadowFarDistance(1000000.f);*/
		}
	}
开发者ID:67-6f-64,项目名称:OryxEngine,代码行数:94,代码来源:OgreSubsystem.cpp



注:本文中的ogre::ResourceGroupManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ogre::ResourcePtr类代码示例发布时间:2022-05-31
下一篇:
C++ ogre::RenderWindow类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap