本文整理汇总了C++中ogre::Root::startRendering方法的典型用法代码示例。如果您正苦于以下问题:C++ Root::startRendering方法的具体用法?C++ Root::startRendering怎么用?C++ Root::startRendering使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Root
的用法示例。
在下文中一共展示了Root::startRendering方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startup
int startup(){
_root = new Ogre::Root("plugins_d.cfg");
if(!_root->showConfigDialog()){
return -1;
}
Ogre::RenderWindow* window = _root->initialise(true, "Ventana Ogre");
_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera* camera = _sceneManager->createCamera("Camera");
camera->setPosition(Ogre::Vector3(500,100,500));
camera->lookAt(Ogre::Vector3(0,0,0));
camera->setNearClipDistance(5);
Ogre::Viewport* viewport = window->addViewport(camera);
viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0));
camera->setAspectRatio(Ogre::Real(viewport->getActualWidth()/viewport->getActualHeight()));
_listener = new FrameListenerProyectos(window,camera);
_root->addFrameListener(_listener);
loadResources();
createScene();
_root->startRendering();
return 0;
}
示例2: go
void application::go()
{
resource_cfg = "resources.cfg";
plugin_cfg = "plugins.cfg";
if (!setup()) return;
root->startRendering();
destroy_scene();
}
示例3: startup
int startup(){
_root = new Ogre::Root("plugins_d.cfg");
if(!_root->showConfigDialog()){
return -1;
}
_window = _root->initialise(true,"Collision Object Exporter");
_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);
loadResources();
createScene();
_root->startRendering();
return 0;
}
示例4: startup
int startup(){
_root = new Ogre::Root("plugins_d.cfg");
/*
if(!_root->showConfigDialog()){
return -1;
}
*/
Ogre::RenderSystem* _rs = _root->getRenderSystemByName("Direct3D9 Rendering Subsystem");
// or use "OpenGL Rendering Subsystem"
_root->setRenderSystem(_rs);
_rs->setConfigOption("Full Screen", "No");
_rs->setConfigOption("Video Mode", "800 x 600 @ 32-bit colour");
_rs->setConfigOption("FSAA", "0");
_rs->setConfigOption("Floating-point mode", "Fastest");
_rs->setConfigOption("Use Multihead", "Auto");
_rs->setConfigOption("VSync", "No");
_rs->setConfigOption("VSync Interval", "1");
Ogre::RenderWindow* window = _root->initialise(true, "Ventana Ogre");
_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera* camera = _sceneManager->createCamera("Camera");
camera->setPosition(Ogre::Vector3(0.0f,300.0f,-1000.0f));
camera->lookAt(Ogre::Vector3(0,0,0));
camera->setNearClipDistance(5);
Ogre::Viewport* viewport = window->addViewport(camera);
viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0));
camera->setAspectRatio(Ogre::Real(viewport->getActualWidth()/viewport->getActualHeight()));
_listener = new FrameListenerProyectos(window,camera);
_root->addFrameListener(_listener);
loadResources();
createScene();
_root->startRendering();
return 0;
}
示例5: run
/**
* Application main function:
* Initializes Ogre, creates a window, creates scenes, starts the rendering loop
*/
void run() {
// ----------------------- Create root object & window --------------------- //
// Initialize (~ glutInit)
mRoot = new Ogre::Root();
mRoot->restoreConfig(); // Read config from ogre.cfg
//if(!mRoot->showConfigDialog()) return; // Alternatively, you can show a dialog window here
// Create window (~ glutCreateWindow)
mWindow = mRoot->initialise(true, "Basic OGRE example");
// Register per-frame callbacks (~ glutIdleFunc)
mRoot->addFrameListener(this);
// Register keyboard and mouse callbacks (~ glutMouseFunc, glutKeyboardFunc, glutWindowFunc)
// This class already implements some logic, such as "quit on Escape".
// It is described in input_util.h, feel free to play with that implementation.
mEventListener = new SimpleMouseAndKeyboardListener(mWindow, mRoot, this);
// ----------- Create scene ----------------- //
// Each scene is represented by a "SceneManager" object, which
// combines a SceneGraph (set of objects with their model transforms)
// with a Camera (view-projection transform)
mScene = createTriangleScene(); // Very basic colored triangle
// This is like (~ glViewport), in that you could specify the region of the window to draw to.
// You can have several scenes rendered to different parts in the window.
Ogre::Viewport* vp = mWindow->addViewport(mScene->getCamera("MainCamera"));
// ~ glClearColor
vp->setBackgroundColour(Ogre::ColourValue(0, 0, 0));
// Enable control of a camera with mouse & keyboard using the utility class.
mEventListener->controlCamera(mScene->getCamera("MainCamera"));
// ------------------------ Configuration complete ----------------- //
// Enter the infinite rendering & event processing loop.
// ~ glutMainLoop()
mRoot->startRendering();
}
示例6: test
void test()
{
Ogre::Root* pOgre = new Ogre::Root("", "");
pOgre->loadPlugin(RENDER_SYSTEM);
pOgre->setRenderSystem(pOgre->getAvailableRenderers().front());
pOgre->initialise(false);
Ogre::NameValuePairList lArgs;
//lArgs["externalWindowHandle"] = bk::format("%d", (bk::uint)l_window.get_handle()).astr;
Ogre::RenderWindow* pWindow = pOgre->createRenderWindow("Heart|Dockyard", 1024, 768, false, &lArgs);
Ogre::SceneManager* pSceneManager = pOgre->createSceneManager(Ogre::ST_GENERIC,"SceneManager");
pSceneManager->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
pSceneManager->setShadowCameraSetup(Ogre::ShadowCameraSetupPtr(new Ogre::FocusedShadowCameraSetup()));
pSceneManager->setAmbientLight(Ogre::ColourValue(0.1f, 0.1f, 0.1f));
Ogre::Camera* pCamera = pSceneManager->createCamera("Camera");
pCamera->setFixedYawAxis(true, Ogre::Vector3::UNIT_Z);
pCamera->setPosition(Ogre::Vector3(0.0f, 50.0f, 20.0f));
pCamera->lookAt(Ogre::Vector3(0.0f, 0.0f, 0.0f));
pCamera->setNearClipDistance(0.1f);
pCamera->setFarClipDistance(100.0f);
Ogre::Viewport* pViewport = pWindow->addViewport(pCamera);
pViewport->setBackgroundColour(Ogre::ColourValue(0.0f, 0.0f, 0.0f));
pCamera->setAspectRatio(Ogre::Real(pViewport->getActualWidth()) / Ogre::Real(pViewport->getActualHeight()));
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../data/dockyard.zip", "Zip", "Dockyard", true);
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
Ogre::MeshManager::getSingleton().createPlane("GroundPlane", "Dockyard", Ogre::Plane(0.0f, 0.0f, 1.0f, 0.0f), 100.0f, 100.0f, 100, 100, true, 1, 3.0f, 3.0f);
Ogre::Entity* pGroundEntity = pSceneManager->createEntity("GroundPlane");
pGroundEntity->setMaterialName("Examples/Rockwall");
pGroundEntity->setCastShadows(false);
pGroundEntity->getSubEntity(0)->getMaterial()->setShadingMode(Ogre::SO_PHONG);
Ogre::SceneNode* pGroundNode = pSceneManager->getRootSceneNode()->createChildSceneNode();
pGroundNode->attachObject(pGroundEntity);
Ogre::Entity* pCubeEntity = pSceneManager->createEntity("Cube", Ogre::SceneManager::PT_CUBE);
pCubeEntity->setMaterialName("Examples/10PointBlock");
pCubeEntity->setCastShadows(true);
Ogre::SceneNode* pCubeNode = pSceneManager->getRootSceneNode()->createChildSceneNode();
pCubeNode->attachObject(pCubeEntity);
pCubeNode->setPosition(0.0f, 0.0f, 5.f);
pCubeNode->setScale(0.1f, 0.1f, 0.1f);
Ogre::ColourValue lColour1(1.0f, 1.0f, 1.0f);
Ogre::ColourValue lColour2(1.0f, 1.0f, 1.0f);
Ogre::ColourValue lColour3(1.0f, 1.0f, 1.0f);
Ogre::Light* pLight1 = pSceneManager->createLight();
pLight1->setType(Ogre::Light::LT_SPOTLIGHT);
pLight1->setPosition(30.0f, 30.0f, 30.0f);
pLight1->setDirection(-1.0f, -1.0f, -1.0f);
pLight1->setSpotlightRange(Ogre::Degree(30), Ogre::Degree(50));
pLight1->setDiffuseColour(lColour1 * 0.5f);
Ogre::Light* pLight2 = pSceneManager->createLight();
pLight2->setType(Ogre::Light::LT_SPOTLIGHT);
pLight2->setPosition(-30.0f, 30.0f, 30.0f);
pLight2->setDirection(1.0f, -1.0f, -1.0f);
pLight2->setSpotlightRange(Ogre::Degree(30), Ogre::Degree(50));
pLight2->setDiffuseColour(lColour2 * 0.5f);
Ogre::Light* pLight3 = pSceneManager->createLight();
pLight3->setType(Ogre::Light::LT_SPOTLIGHT);
pLight3->setPosition(30.0f, -30.0f, 30.0f);
pLight3->setDirection(-1.0f, 1.0f, -1.0f);
pLight3->setSpotlightRange(Ogre::Degree(30), Ogre::Degree(50));
pLight3->setDiffuseColour(lColour3 * 0.5f);
Ogre::Overlay* pMenuOverlay = Ogre::OverlayManager::getSingleton().create("Menu");
Ogre::OverlayElement* pMenu = Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "Menu");
pMenu->setMetricsMode(Ogre::GMM_PIXELS);
pMenu->setWidth(200);
pMenu->setHeight(200);
pMenu->setTop(30);
pMenu->setLeft(30);
pMenu->setMaterialName("Examples/BumpyMetal");
if (pMenu->isContainer()) pMenuOverlay->add2D(static_cast<Ogre::OverlayContainer*>(pMenu));
pMenuOverlay->show();
pOgre->startRendering();
}
示例7: _tmain
//.........这里部分代码省略.........
Ogre::TerrainMaterialGeneratorA::SM2Profile* pMatProfile =
static_cast<Ogre::TerrainMaterialGeneratorA::SM2Profile*>(terrainglobals->getDefaultMaterialGenerator()->getActiveProfile());
pMatProfile->setLightmapEnabled(false);
pMatProfile->setCompositeMapEnabled(false);
Ogre::TerrainGroup* terraingroup = OGRE_NEW Ogre::TerrainGroup(scenemgr, Ogre::Terrain::ALIGN_X_Z, terrainsize, worldsize);
terraingroup->setFilenameConvention(Ogre::String("terrain"), Ogre::String("ogt"));
terraingroup->setOrigin(Ogre::Vector3::ZERO);
Ogre::Terrain* terrain = OGRE_NEW Ogre::Terrain(scenemgr);
// terrainsettings
Ogre::Terrain::ImportData& imp = terraingroup->getDefaultImportSettings();
imp.terrainSize = terrainsize;
imp.worldSize = worldsize;
imp.minBatchSize = 33;
imp.maxBatchSize = 65;
// use float RAW heightmap as input
imp.inputFloat = buffer;
// process texture layers
imp.layerList.resize(layercount);
Ogre::StringVector blendmaps(layercount);
for(int i=0;i<layercount;i++)
{
// load layer info
Ogre::String sectionStr = Ogre::StringConverter::toString(i);
Ogre::Real layerworldsize = Ogre::StringConverter::parseReal(terrainconfig->getSetting("worldsize", sectionStr));
if (i==0)
{
// no blendmap at layer 0 (baselayer)
Ogre::String specular = terrainconfig->getSetting("specular", sectionStr);
Ogre::String normal = terrainconfig->getSetting("normal", sectionStr);
// add layer
imp.layerList[i].textureNames.push_back(specular);
imp.layerList[i].textureNames.push_back(normal);
imp.layerList[i].worldSize = layerworldsize;
}
else
{
Ogre::String specular = terrainconfig->getSetting("specular", sectionStr);
Ogre::String normal = terrainconfig->getSetting("normal", sectionStr);
Ogre::String blend = terrainconfig->getSetting("blend", sectionStr);
// add layer
imp.layerList[i].textureNames.push_back(specular);
imp.layerList[i].textureNames.push_back(normal);
imp.layerList[i].worldSize = layerworldsize;
blendmaps[i] = blend;
}
}
// load the terrain
terrain->prepare(imp);
terrain->load();
// load those blendmaps into the layers
for(int j = 1;j < terrain->getLayerCount();j++)
{
Ogre::TerrainLayerBlendMap *blendmap = terrain->getLayerBlendMap(j);
Ogre::Image img;
img.load(blendmaps[j],"General");
int blendmapsize = terrain->getLayerBlendMapSize();
if(img.getWidth() != blendmapsize)
img.resize(blendmapsize, blendmapsize);
float *ptr = blendmap->getBlendPointer();
Ogre::uint8 *data = static_cast<Ogre::uint8*>(img.getPixelBox().data);
for(int bp = 0;bp < blendmapsize * blendmapsize;bp++)
ptr[bp] = static_cast<float>(data[bp]) / 255.0f;
blendmap->dirty();
blendmap->update();
}
// create filename for writing
int pos = heightmapfile.find_last_of('.');
if (pos < 0)
heightmapfile = heightmapfile + ".ogt";
else
heightmapfile = heightmapfile.substr(0, pos) + ".ogt";
// save as Ogre .OGT
terrain->save(heightmapfile);
Ogre::LogManager::getSingletonPtr()->logMessage(Ogre::LogMessageLevel::LML_NORMAL, heightmapfile + " successfully written.");
// debug viewing (exit with CTRL+C)
camera->setPosition(-terrainsize, 7000, -terrainsize);
camera->lookAt(terrainsize/2,0,terrainsize/2);
root->startRendering();
return 0;
}