Ogre::NameValuePairList misc; std::string s = Ogre::StringConverter::toString((long)info.info.x11.display); s +=":"+ tokens[1] +":"; s += Ogre::StringConverter::toString((long)info.info.x11.window); misc["parentWindowHandle"] = s; win = root->createRenderWindow("ogre", width, height, fullscreen, &misc);
///we need to set the window to be active by ourselves, since GLX by default sets it to false, but then activates it upon recieving some X event (which it will never recieve since we'll use SDL). ///see OgreGLXWindow.cpp win->setActive(true); win->setAutoUpdated(true); } else { win = root->initialise( true ); }
root->addFrameListener( new AppListener( win ) ); root->startRendering(); return0; }
涓鏃﹀満鏅腑鐨勮繖涓偣琚壘鍒幫紝闂鐨勫叧閿氨鏄緩绔嬩竴涓粠鎽勮薄鏈轟綅緗埌榪欎釜鐐圭殑鍏夌嚎錛岀劧鍚庡鎵捐繖涓厜綰垮拰榪欎釜杞ㄨ抗鐞冪殑浜ょ偣銆傝繖涓厜綰挎槸E + t * ( P - E )鐨勭偣闆嗭紝榪欓噷E鏄溂鐫涚偣浣嶇疆錛孭鏄満鏅腑鐨勯偅涓偣錛宼鏄竴涓彉閲忥紝鑰岃建榪圭悆鏄疭鐨勭偣闆嗭紝榪欓噷S^2 = r錛宺鏄建榪圭悆鐨勫崐寰勩傚鏋淪 = E + t * ( P - E )錛岄偅涔堝瓨鍦ㄤ竴涓偣鏃㈠湪杞ㄨ抗鐞冧笂錛屽張鍦ㄥ厜綰夸笂錛岃繖鏍鳳紝鎴戜滑鍙互閫氳繃甯﹀叆娉曟帹鍑猴細( E + t * ( P - E ) ) ^ 2 = r銆傛垜浠煡閬撳悜閲廍銆丳浠ュ強鏍囬噺r錛屾墍浠ュ彲浠ユ帹鍑烘潵t錛岃繖鏄竴涓簩嬈℃柟紼嬶紝濡傛灉鏃犺В錛岃鏄庡厜綰垮拰杞ㄨ抗鐞冩棤浜ょ偣銆傚鏋滄湁2涓В錛屽簲褰撻夋嫨鏈闈犺繎鐪肩潧鐨勯偅涓В銆?br> 杞ㄨ抗鐞冪殑鏃嬭漿闂錛?br>濡傛灉浣犲崟鍑繪嫋鎷借建榪圭悆涓婄殑涓涓偣鍒板彟涓涓綅緗紝璇ュ浣曞仛鍛紵 涓涓畝鍗曠殑鏂規硶錛屽仛璧風偣鍒扮粨鏉熺偣鐨剎涔樹負鏃嬭漿杞達紝鐒跺悗瀵繪壘灝嗚鏃嬭漿鐨勮搴︼紝榪欎釜鍙互閫氳繃鍋氱偣涔樺緱鍒般?br> 璁$畻鏃嬭漿鐭╅樀錛?br>鎴戜滑閫氳繃鍥涘厓鏁版潵瑙e喅瀹冦傚洓鍏冩暟鏄簩緇村鏁扮殑鎵╁睍錛岀壒鍒傚悎鍋氭棆杞?br>濡傛灉鎴戜滑鏈変竴涓崟浣嶅悜閲? x, y, z )錛屾垜浠彲浠ラ氳繃涔樹互鏃嬭漿瑙掑害鐨勬寮︾殑涓鍗婅幏寰楀洓鍏冩暟鐨剎, y, z閮ㄥ垎鐨勪慨姝e鹼紝w鏄敱鏃嬭漿瑙掔殑鐨勪綑寮︾殑涓鍗婂喅瀹氥傚ぇ瀹剁煡閬撴墍鏈夌殑榪欎箞鍊煎彲浠ヨ緇勮榪涗竴涓棆杞煩闃碉細
w * w + x *x - y * y - z * z, 2* x * y +2* w * z, 2* x * z -2* w * y, 0 2* x * y -2* w * z, w * w - x * x + y * y - z * z, 2* y * z +2* w * x, 0 2* x * z +2* w * y, 2* y * z -2* w * x, w * w - x * x - y * y + z * z, 0 0, 0, 0, w * w + x * x + y * y + z * z
]]>Ogre鍦ㄦ父鎴忓紑鍙戜腑閫愬撫鏇存柊http://www.shnenglu.com/brilyf/archive/2008/09/24/62714.htmlbrilyfbrilyfWed, 24 Sep 2008 14:11:00 GMThttp://www.shnenglu.com/brilyf/archive/2008/09/24/62714.htmlhttp://www.shnenglu.com/brilyf/comments/62714.htmlhttp://www.shnenglu.com/brilyf/archive/2008/09/24/62714.html#Feedback2http://www.shnenglu.com/brilyf/comments/commentRss/62714.htmlhttp://www.shnenglu.com/brilyf/services/trackbacks/62714.html鏈鏂扮殑Ogre紼沖畾鐗堟湰鏄?.6.0RC1[shoggoth],鍦?.6.0鐗堟湰涓璒greFrameListener.h涓殑綾籉rameListener澶氬嚭浜嗕竴涓彨virtual bool frameRenderingQueued( const FrameEvent& evt ) { return true; }鐨勫嚱鏁般傝繖涓嚱鏁板拰virtual bool frameStarted( const FrameEvent& evt ) { return true; }鏈夋槑鏄劇殑鍖哄埆銆?br>鍦ㄦ簮浠g爜涓frameStarted鐨勬敞閲婃槸錛?br> /** Called when a frame is about to begin rendering. @remarks This event happens before any render targets have begun updating. @return True to go ahead, false to abort rendering and drop out of the rendering loop. */ 澶т綋緲昏瘧鏄細 褰撲竴甯у皢瑕佸紑濮嬫覆鏌撶殑鏃跺欒璋冪敤銆?br>榪欎釜浜嬩歡鍙戠敓鍦ㄦ墍鏈夋覆鏌撶洰鏍囧凡緇忓紑濮嬫洿鏂頒箣鍓嶃?br>鑰屽湪婧愪唬鐮佷腑瀵筬rameRenderingQueued鐨勬敞閲婃槸錛?br> /** Called after all render targets have had their rendering commands issued, but before render windows have been asked to flip their buffers over. @remarks The usefulness of this event comes from the fact that rendering commands are queued for the GPU to process. These can take a little while to finish, and so while that is happening the CPU can be doing useful things. Once the request to 'flip buffers' happens, the thread requesting it will block until the GPU is ready, which can waste CPU cycles. Therefore, it is often a good idea to use this callback to perform per-frame processing. Of course because the frame's rendering commands have already been issued, any changes you make will only take effect from the next frame, but in most cases that's not noticeable. @return True to continue rendering, false to drop out of the rendering loop. */ 緲昏瘧涓猴細 鍦ㄦ墍鏈夋覆鏌撶洰鏍囧凡緇忎紶鍑轟粬浠殑娓叉煋鍛戒護涔嬪悗錛屽茍涓斿湪娓叉煋紿楀彛琚姹傚幓閲婃斁浠栦滑鐨勫撫涔嬪墠銆?br>榪欎釜浜嬩歡鐨勭敤閫斿叾瀹炴槸涓轟簡鎶奊PU澶勭悊鐨勬覆鏌撳懡浠ゆ帹鍏ラ槦鍒楋紝榪欎簺鍙姳璐逛竴鐐瑰姛澶幓瀹屾垚錛?br>鑰屽氨榪欎竴孌墊椂闂碿pu鍙互琚敤鏉ュ鐞嗕竴浜涙湁鐢ㄧ殑浜嬫儏銆備竴鏃﹂噴鏀懼撫榪欎釜鏃墮棿鍙戠敓錛岃繖鏉$嚎紼嬭姹傚皢瑕佽 鍫靛鐩村埌GPU鍑嗗濂戒簡錛岃繖鍙兘嫻垂浜哻pu鐨勬覆鏌撴椂闂達紝鐒惰岋紝浣滀負鍥炶皟鍑芥暟鍘婚愬撫澶勭悊涔熸槸涓涓ソ娉ㄦ剰銆?br>褰撶劧鍥犱負甯х殑娓叉煋鍛戒護宸茬粡琚斁鍑猴紝浠諱綍浣犲仛鐨勬敼鍙樺彧瀵逛笅涓甯ф湁鏁堬紝浣嗘槸澶у鏁版儏鍐典笅榪欎笉鏄緢鏄庢樉鐨勩?br> 鍔犲叆浜嗚繖涓嚱鏁頒篃璇存槑浜哋gre1.6.0瀵筭pu閲嶈浜嗐?br>鍦╫gre鑷甫鐨勪緥瀛愪腑錛屽嚑涔庨兘鏄敤examplelistener鏉ュ鐞嗘父鎴忓驚鐜傝繖鏄庢樉涓嶇鍚堟瘮杈冨ぇ鐐圭殑娓告垙寮鍙戙傝屽鏋?br>浣犳兂瑕佸湪澶у瀷娓告垙涓簲鐢ㄨ繖涓父鎴忓驚鐜傛垜鎰熻棣栧厛搴旇鏈変竴涓崟浠剁殑甯х洃鍚郴緇熼氳繃娓告垙涓誨簲鐢ㄧ▼搴忔潵鍒濆鍖栥傜劧鍚庡氨鏄敤璁捐妯″紡涓殑Bridge鐨勫皢澹版槑鍜屾墽琛屽垎寮鐨勫姛鑳芥潵澶勭悊榪欎釜鏂規硶銆?br>浼唬鐮侊細
//涓涓儴浠剁殑綾?/span> class BrilyfWidgets { bool frameRenderingQueued( const FrameEvent& evt ); }; //綾葷殑鍓嶅悜澹版槑 class BrilyfApplication; class BrilyfListenSystem : public Singleton<BrilyfListenSystem>, public FrameListener { bool frameRenderingQueued( const FrameEvent& evt ) { //涓浜涚郴緇熺己鐪佺殑璁劇疆 //鍏抽敭閮ㄥ垎 BrilyfApplication::getSingletonPtr()->frameRenderQueued( const FrameEvent& evt ); BrilyfApplication::getSingletonPtr()->frameEnded( const FrameEvent& evt ); } bool frameEnded( const FrameEvent& evt ); }; //鎵鏈夌殑鍏朵粬涓浜涢儴浠剁殑鍒濆鍖栭兘瑕侀氳繃BrilyfApplication,瀹冨氨鏄父鎴忕殑涓葷閬擄紝鎺у埗鐫鎵鏈夐儴浠剁殑鐢熷懡鍛ㄦ湡錛屾彁渚涗簡 //frameRenderingQueued鍜宖rameEnded鐨勬帴鍙d緵鍏朵粬鐨勯儴浠舵潵濉厖銆?/span> class BrilyfApplication : public Singleton<BrilyfApplication> { //涓浜涘浜庡崟浠跺垵濮嬪寲鐨勫鐞?/span> //瀵瑰簲鐨勪簨浠?/span> bool frameRenderingQueued( const FrameEvent& evt ) { for ( int i =0; i <16; i++ ) BrilyfWidgets.frameRenderingQueued( ); } bool frameEnded( const FrameEvent& evt ); BrilyfWidgets mWidgets[16]; };