本文整理汇总了C++中ogre::RenderWindow类的典型用法代码示例。如果您正苦于以下问题:C++ RenderWindow类的具体用法?C++ RenderWindow怎么用?C++ RenderWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RenderWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: destroy
void BaseManager::destroy()
{
destroyScene();
destroyPointerManager();
destroyInput();
destroyGui();
// очищаем сцену
if (mSceneManager)
{
mSceneManager->clearScene();
mSceneManager->destroyAllCameras();
mSceneManager = nullptr;
mCamera = nullptr;
}
if (mWindow)
{
mWindow->destroy();
mWindow = nullptr;
}
if (mRoot)
{
Ogre::RenderWindow* window = mRoot->getAutoCreatedWindow();
if (window)
window->removeAllViewports();
delete mRoot;
mRoot = nullptr;
}
}
示例3: setGraphicsLevel
ShaderManager::GraphicsLevel ShaderManager::setGraphicsLevel(ShaderManager::GraphicsLevel newLevel)
{
if (newLevel > mBestGraphicsLevel) {
S_LOG_FAILURE("Cannot set graphics level " << mGraphicSchemes[newLevel]);
return mGraphicsLevel;
}
S_LOG_INFO("Using graphics level " << mGraphicSchemes[newLevel]);
Ogre::MaterialManager::getSingleton().setActiveScheme(mGraphicSchemes[newLevel]);
Ogre::RenderWindow* window = EmberOgre::getSingleton().getRenderWindow();
for (int i = 0; i < window->getNumViewports(); ++i) {
window->getViewport(i)->setMaterialScheme(mGraphicSchemes[newLevel]);
}
switch (newLevel) {
case LEVEL_EXPERIMENTAL:
case LEVEL_HIGH:
setPSSMShadows();
break;
case LEVEL_MEDIUM:
case LEVEL_LOW:
case LEVEL_DEFAULT:
setNoShadows();
break;
}
mGraphicsLevel = newLevel;
EventLevelChanged.emit();
return mGraphicsLevel;
}
示例4: destroyBasisManager
void BasisManager::destroyBasisManager() // очищаем все параметры каркаса приложения
{
destroyGui();
// очищаем сцену
if (mSceneMgr) {
mSceneMgr->clearScene();
mSceneMgr->destroyAllCameras();
mSceneMgr = 0;
}
destroyInput(); // удаляем ввод
if (mWindow) {
mWindow->destroy();
mWindow = 0;
}
if (mRoot) {
Ogre::RenderWindow * mWindow = mRoot->getAutoCreatedWindow();
if (mWindow) mWindow->removeAllViewports();
delete mRoot;
mRoot = 0;
}
}
示例5: start
int Hundir::start() {
_root = new Ogre::Root();
if(!_root->restoreConfig()) {
_root->showConfigDialog();
_root->saveConfig();
}
Ogre::RenderWindow* window = _root->initialise(true,"Hundir Example");
_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera* cam = _sceneManager->createCamera("MainCamera");
cam->setPosition(Ogre::Vector3(-10,30,35));
cam->lookAt(Ogre::Vector3(0,0,0));
cam->setNearClipDistance(5);
cam->setFarClipDistance(10000);
Ogre::Viewport* viewport = window->addViewport(cam);
viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0));
double width = viewport->getActualWidth();
double height = viewport->getActualHeight();
cam->setAspectRatio(width / height);
loadResources();
createScene();
_framelistener = new MyFrameListener(window, cam, _sceneManager);
_root->addFrameListener(_framelistener);
_root->startRendering();
return 0;
}
示例6: createWindow
void OgreRenderer::createWindow(const std::string &title, const WindowSettings& settings)
{
assert(mRoot);
mRoot->initialise(false);
// create a hidden 1x1 background window to keep resources when recreating the secondary (real) window
NameValuePairList params_;
params_.insert(std::make_pair("title", title));
params_.insert(std::make_pair("FSAA", "0"));
params_.insert(std::make_pair("vsync", "false"));
params_.insert(std::make_pair("hidden", "true"));
Ogre::RenderWindow* hiddenWindow = mRoot->createRenderWindow("InactiveHidden", 1, 1, false, ¶ms_);
hiddenWindow->setActive(false);
NameValuePairList params;
params.insert(std::make_pair("title", title));
params.insert(std::make_pair("FSAA", settings.fsaa));
params.insert(std::make_pair("vsync", settings.vsync ? "true" : "false"));
mWindow = mRoot->createRenderWindow(title, settings.window_x, settings.window_y, settings.fullscreen, ¶ms);
// create the semi-transparent black background texture used by the GUI.
// has to be created in code with TU_DYNAMIC_WRITE_ONLY param
// so that it can be modified at runtime.
Ogre::TextureManager::getSingleton().createManual(
"transparent.png",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D,
1, 1,
0,
Ogre::PF_A8R8G8B8,
Ogre::TU_WRITE_ONLY);
}
示例7:
OgreAppFrameListener::~OgreAppFrameListener()
{
Ogre::RenderWindow *window = mApplication->getRenderWindow();
WindowEventUtilities::removeWindowEventListener(window, this);
if(!window->isClosed())
windowClosed(window);
}
示例8: main
int main(int argc, char* argv[]){
cout << "Test Ogre Program blaha" << endl;
//Relative to where its executed from, not binary location
Ogre::Root *mRoot = new Ogre::Root("configs/plugins.cfg","configs/config.cfg","logs/main.log");
if(!(mRoot->restoreConfig() || mRoot->showConfigDialog())){
delete mRoot;
return -1;
}
// setup resources
// Only add the minimally required resource locations to load up the Ogre head mesh
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/programs", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/programs/GLSL", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/scripts", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/textures", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/models", "FileSystem", "General");
//Create the window
Ogre::RenderWindow *mWindow = mRoot->initialise(true, "initial Render Window");
Ogre::SceneManager *sceneManager = mRoot->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera *camera = sceneManager->createCamera("PlayerCam");
camera->setPosition(Ogre::Vector3(0,0,80));
camera->lookAt(Ogre::Vector3(0,0,-300));
camera->setNearClipDistance(5);
Ogre::Viewport* vp = mWindow->addViewport(camera);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0,0));
camera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
Ogre::Entity* ogreHead = sceneManager->createEntity("Head","ogreHead.mesh");
Ogre::SceneNode* headNode = sceneManager->getRootSceneNode()->createChildSceneNode();
headNode->attachObject(ogreHead);
sceneManager->setAmbientLight(Ogre::ColourValue(0.5,0.5,0.5));
//Run the system
bool continueRunning = true;
while(continueRunning){
mRoot->renderOneFrame();
headNode->rotate(Ogre::Vector3(0,1,0),Ogre::Radian(0.005));
if(mWindow->isClosed()){
continueRunning = false;
}
}
delete mRoot;
}
示例9: executeLocalScripts
bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
{
try
{
mEnvironment.setFrameDuration (evt.timeSinceLastFrame);
// update input
MWBase::Environment::get().getInputManager()->update(evt.timeSinceLastFrame, false);
// sound
if (mUseSound)
MWBase::Environment::get().getSoundManager()->update (evt.timeSinceLastFrame);
// global scripts
MWBase::Environment::get().getScriptManager()->getGlobalScripts().run();
bool changed = MWBase::Environment::get().getWorld()->hasCellChanged();
// local scripts
executeLocalScripts(); // This does not handle the case where a global script causes a cell
// change, followed by a cell change in a local script during the same
// frame.
// passing of time
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
MWBase::Environment::get().getWorld()->advanceTime (
mEnvironment.getFrameDuration()*MWBase::Environment::get().getWorld()->getTimeScaleFactor()/3600);
if (changed) // keep change flag for another frame, if cell changed happend in local script
MWBase::Environment::get().getWorld()->markCellAsUnchanged();
// update actors
std::vector<std::pair<std::string, Ogre::Vector3> > movement;
MWBase::Environment::get().getMechanicsManager()->update (movement, mEnvironment.getFrameDuration(),
MWBase::Environment::get().getWindowManager()->isGuiMode());
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
MWBase::Environment::get().getWorld()->doPhysics (movement, mEnvironment.getFrameDuration());
// update world
MWBase::Environment::get().getWorld()->update (evt.timeSinceLastFrame, MWBase::Environment::get().getWindowManager()->isGuiMode());
// update GUI
Ogre::RenderWindow* window = mOgre->getWindow();
unsigned int tri, batch;
MWBase::Environment::get().getWorld()->getTriangleBatchCount(tri, batch);
MWBase::Environment::get().getWindowManager()->wmUpdateFps(window->getLastFPS(), tri, batch);
MWBase::Environment::get().getWindowManager()->onFrame(evt.timeSinceLastFrame);
}
catch (const std::exception& e)
{
std::cerr << "Error in framelistener: " << e.what() << std::endl;
}
return true;
}
示例10: pollEvents
void ApplicationContextAndroid::pollEvents()
{
for(WindowList::iterator it = mWindows.begin(); it != mWindows.end(); ++it)
{
Ogre::RenderWindow* win = it->render;
win->windowMovedOrResized();
windowResized(win);
}
}
示例11: postRenderTargetUpdate
void OculusDisplay::postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt)
{
if ( !oculus_ )
{
return;
}
Ogre::RenderWindow *window = render_widget_->getRenderWindow();
window->swapBuffers();
}
示例12: RenderWindow
OgreWindow::OgreWindow(OgreModule& module, UiWindow& window, Ogre::RenderWindow& context)
: RenderWindow(context.getWidth(), context.getHeight(), context.getName(), 0)
, mModule(module)
, mWindow(window)
, mContext(context)
{
Ogre::WindowEventUtilities::addWindowEventListener(&mContext, this);
mContext.getCustomAttribute("WINDOW", &mHandle);
}
示例13: _fireInputEventAndroid
void ApplicationContextAndroid::_fireInputEventAndroid(AInputEvent* event, int wheel) {
Event evt = {0};
static TouchFingerEvent lastTouch = {0};
if(wheel) {
evt.type = MOUSEWHEEL;
evt.wheel.y = wheel;
_fireInputEvent(evt, 0);
lastTouch.fingerId = -1; // prevent move-jump after pinch is over
return;
}
if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION) {
int32_t action = AMOTION_EVENT_ACTION_MASK & AMotionEvent_getAction(event);
switch (action) {
case AMOTION_EVENT_ACTION_DOWN:
evt.type = FINGERDOWN;
break;
case AMOTION_EVENT_ACTION_UP:
evt.type = FINGERUP;
break;
case AMOTION_EVENT_ACTION_MOVE:
evt.type = FINGERMOTION;
break;
default:
return;
}
Ogre::RenderWindow* win = getRenderWindow();
evt.tfinger.fingerId = AMotionEvent_getPointerId(event, 0);
evt.tfinger.x = AMotionEvent_getRawX(event, 0) / win->getWidth();
evt.tfinger.y = AMotionEvent_getRawY(event, 0) / win->getHeight();
if(evt.type == FINGERMOTION) {
if(evt.tfinger.fingerId != lastTouch.fingerId)
return; // wrong finger
evt.tfinger.dx = evt.tfinger.x - lastTouch.x;
evt.tfinger.dy = evt.tfinger.y - lastTouch.y;
}
lastTouch = evt.tfinger;
} else {
if(AKeyEvent_getKeyCode(event) != AKEYCODE_BACK)
return;
evt.type = AKeyEvent_getAction(event) == AKEY_EVENT_ACTION_DOWN ? KEYDOWN : KEYUP;
evt.key.keysym.sym = SDLK_ESCAPE;
}
_fireInputEvent(evt, 0);
}
示例14: _generateEventOutgoingObject
void SoundDetector::_generateEventOutgoingObject(Ogre::String objectName)
{
if(debug)
{
Ogre::RenderWindow* win = ClassPack::getSingleton()->getRenderWindow();
Ogre::String str = "Outgoing : ";
str.append( objectName );
win->setDebugText( str );
}
eventMng->createDetectionEvent("outgoingSound_" + mName, objectName);
}
示例15: windowAttributes
VIEW_API void windowAttributes(size_t& handle, u32& width, u32& height)
{
Ogre::Root* root = Ogre::Root::getSingletonPtr();
if (! root)
throw std::logic_error
("View::windowAttributes: Ogre hasn't been initialized yet.");
Ogre::RenderWindow* win = root->getAutoCreatedWindow();
win->getCustomAttribute("WINDOW", &handle);
height = win->getHeight();
width = win->getWidth();
}