• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            清源游民 gameogre@gmail.com
            日志系統(tǒng)
            日志記錄了基于ogre的程序每次運(yùn)行時的所有事件,系統(tǒng)初始化,狀態(tài),性能信息。輸出的內(nèi)容被放在磁盤文件上,文件缺省名是ogre.log。也可以手動顯示創(chuàng)建日志系統(tǒng),這需要在創(chuàng)建Root對象之前實施。
            // create an instance of LogManager prior to using LogManager::getSingleton()
            LogManager* logMgr = new LogManager;
            Log *log = LogManager::getSingleton().createLog("mylog.log", true, true, false);
            // third param is not used since we already created a log in the previous step
            Root *root = new Root("", "");
            可以用Ogre LogManager注冊一個Log Listener, 以任何方式重定向log data。可以用這種方式來屏蔽任何日志信息。然后還一個更簡單的方法達(dá)到上述目的:在實例化Root之前,當(dāng)實例化一個LogManager后,不調(diào)用createLog()方法。
            以下是實現(xiàn)日志信息截流的代碼片斷:
            class MyLogListener : public LogListener
            {
            public:
            void write (const String& name, const String& message,
            LogMessageLevel level, bool maskDebug)
            {
            // redirect log output here as needed
            };
            MyLogListener *myListener = new MyLogListener;
            // this is the same as calling LogManager::getSingletonPtr() after the
            // LogManager has first been instanced; the same pointer value is returned
            LogManager *logMgr = new LogManager;
            LogMgr->addListener(myListener);
            logMgr->createLog("mylog.log", true, false, true);
            logMgr->setLogDetail(LL_NORMAL);
            Root *root = new Root("", "", "mylog.log");
            Ogre手動初始化
            int main(int argc, char *argv[])
            {

            ?// tell Root not to load from any plugins or settings file
            ?Root *root = new Root("", "");

            ?// Load feature plugins. Scene managers will register
            ?// themselves for all scene types they support
            ?root->loadPlugin("Plugin_CgProgramManager");
            ?root->loadPlugin("Plugin_OctreeSceneManager");

            ?// load rendersystem plugin(s). The order is important in that GL
            ?// should be available on on platforms, while D3D9 would be available
            ?// only on Windows -- the try/catch will intercept the exception in this
            ?// case where D3D9 is not available and continue gracefully
            .
            ?try {
            ??root->loadPlugin("RenderSystem_GL");
            ??root->loadPlugin("RenderSystem_Direct3D9");
            ?}
            ?catch (...) {}

            ?try {
            ??// We'll simulate the selection of a rendersystem on an arbirtary basis; normally
            ??// you would have your own code to present the user with options and select the
            ??// rendersystem on that basis. Since a GUI is beyond the scope of this example, we'll
            ??// just assume the user selected OpenGL.
            ??RenderSystemList *rList = root->getAvailableRenderers();
            ??RenderSystemList::iterator it = rList->begin();
            ??RenderSystem *rSys = 0;

            ??while (it != rList->end()) {
            ???
            ???rSys = *(it++);
            ???if (rSys->getName().find("OpenGL")) {
            ???
            ????root->setRenderSystem(rSys);
            ????break;
            ???}
            ??}

            ??// check to see if a render system was selected; if we reached the end of the list
            ??// without selecting a render system then none was found
            .
            ??if (rSys == 0) {
            ???delete root;
            ???std::cerr << "No RenderSystem available, exiting..." << std::endl;
            ???return -1;
            ??}

            ??// We can initialize Root here if we want. "false" tells Root NOT to create
            ??// a render window for us
            ??root->initialise(false);

            ??// set up the render window with all default params
            ??RenderWindow *window = rSys->createRenderWindow(
            ???"Manual Ogre Window",?// window title
            ???800,?????// window width, in pixels
            ???600,?????// window height, in pixels
            ???false,?????// fullscreen or not
            ???0);??????// use defaults for all other values

            ??// from here you can set up your camera and viewports as normal
            ??// get a pointer to the default base scene manager -- sufficient for our purposes

            ??SceneManager *sceneMgr = root->createSceneManager(ST_GENERIC);

            ??// create a single camera, and a viewport that takes up the whole window (default behavior)
            ??Camera *camera = sceneMgr->createCamera("MainCam");
            ??Viewport *vp = window->addViewport(camera);
            ??vp->setDimensions(0.0f, 0.0f, 1.0f, 1.0f);
            ??camera->setAspectRatio((float)vp->getActualWidth() / (float) vp->getActualHeight());
            ??camera->setFarClipDistance(1000.0f);
            ??camera->setNearClipDistance(5.0f);

            ??// Run the manual render loop. Since we are not using a frame listener in this case, we
            ??// will count to 15 seconds and then instead of exiting, we'll change the render window settings
            ??// and re-initialize it.
            ??bool renderLoop = true;
            ??Timer *timer = Ogre::PlatformManager::getSingleton().createTimer();
            ??timer->reset();
            ??float s = 0.0f;

            ??while (renderLoop && window->isActive()) {

            ???renderLoop = root->renderOneFrame();

            ???// accumulate total elapsed time
            ???s += (float)timer->getMilliseconds() / 1000.0f;

            ???// if greater than 15 seconds, break out of the loop
            ???if (s >= 15.0f)
            ????renderLoop = false;

            ???// we must call the windowing system's message pump each frame to
            ???// allow Ogre to process messages
            ???//PlatformManager::getSingleton().messagePump();
            ??}
            ?}
            ?catch (Exception &e) {
            ??std::cerr << e.getFullDescription() << std::endl;
            ?}

            ?delete root;
            ?return 0;
            }

            視口
            通過視口上的一點與相機(jī)的原點產(chǎn)生世界空間中的一條光線
            // x and y are in "normalized" (0.0 to 1.0) screen coordinates
            Ray getCameraToViewportRay(Real x, Real y) const;

            視口,創(chuàng)建多個視口,通過Z序(越高越在上) 確定覆蓋效果,每個視口可以有不同的背景。
            // assume window is a valid pointer to an existing render window, and
            // a valid pointer to an existing camera instance
            Viewport *vpTop, *vpBottom;
            // second parameter is z-order, remaining params are position and size,
            vpBottom = window->addViewport(camera, 0);
            // create a smaller viewport on top, in the center, 25% of main vp size
            vpTop = window->addViewport(camera, 1,
            0.375f, 0.375f,
            0.25, 0.25);
            // set the background of the top window to blue (the default is black
            // need to set the bottom window explicitly)
            vpTop->setBackgroundColour(ColourValue(0.0f, 0.0f, 1.0f));
            // an alternate way to set the color is to use the manifest constant
            // vpTop->setBackgroundColour(ColourValue::Blue);

            在多視口情況下,overlay缺省在每個視口中渲染。可以關(guān)掉。Skybox, Shadow也是如此。
            vpTop->setOverlaysEnabled(false);
            vpTop->setSkiesEnabled(false);
            vpTop->setShadowsEnabled(true);

            posted on 2007-03-07 14:14 清源游民 閱讀(2188) 評論(0)  編輯 收藏 引用 所屬分類: OGRE
            <2007年9月>
            2627282930311
            2345678
            9101112131415
            16171819202122
            23242526272829
            30123456

            留言簿(35)

            隨筆分類(78)

            隨筆檔案(74)

            文章檔案(5)

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            久久超碰97人人做人人爱| 亚洲欧美一区二区三区久久| 亚洲精品无码久久久久久| 人妻无码精品久久亚瑟影视| 亚洲精品乱码久久久久久自慰| 久久天天躁狠狠躁夜夜躁2O2O| 狠狠色丁香婷婷综合久久来| 蜜臀久久99精品久久久久久| 99久久精品免费看国产一区二区三区| 伊人久久久AV老熟妇色| 99久久国产主播综合精品| 久久精品国产亚洲AV香蕉| 香蕉久久夜色精品国产小说| 久久久久亚洲AV片无码下载蜜桃| 国产精品女同久久久久电影院| 久久无码AV中文出轨人妻| 国产91久久精品一区二区| 久久久久精品国产亚洲AV无码| 99久久99久久精品国产| 久久精品99久久香蕉国产色戒| 亚洲性久久久影院| 久久综合丝袜日本网| 久久国产乱子伦免费精品| 亚洲国产视频久久| 无码8090精品久久一区 | 麻豆av久久av盛宴av| 91精品国产高清久久久久久91| 人妻少妇久久中文字幕| 欧美久久天天综合香蕉伊| 日韩精品久久久久久| AV狠狠色丁香婷婷综合久久| 香蕉久久夜色精品国产尤物| 久久精品二区| 激情综合色综合久久综合| 欧美一区二区精品久久| 久久久青草久久久青草| 国产精品天天影视久久综合网| 精品久久久久久久久午夜福利| 亚洲欧洲日产国码无码久久99| 久久精品卫校国产小美女| 狠狠色婷婷久久一区二区|