虛擬現(xiàn)實與仿真技術(shù)-實驗報告20_第1頁
虛擬現(xiàn)實與仿真技術(shù)-實驗報告20_第2頁
虛擬現(xiàn)實與仿真技術(shù)-實驗報告20_第3頁
虛擬現(xiàn)實與仿真技術(shù)-實驗報告20_第4頁
虛擬現(xiàn)實與仿真技術(shù)-實驗報告20_第5頁
已閱讀5頁,還剩30頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、實驗一實驗名稱Ogre部分仿仿真實驗實驗過程或?qū)嶒烌灣绦颍ㄔ黾蛹拥拇a及代代碼注解)1.從3Dmaax8中導(dǎo)出出mesh并并添加messh到場景1.1啟動3DDmax1.在安裝有33Dmax88的計算機上上,可以使用用兩種不同的的方法來啟動動3Dmaxx8: (1)在桌桌面上雙擊“3Dmaxx8”圖標 (2)點擊擊“開始”菜單,在“程序”中的選擇“3Dmaxx8”觀察3Dmaxx8主窗口的的布局。3DDmax8主主要由若干元元素組成:菜菜單欄、工具具欄、以及停??吭谟疫叺牡拿蠲姘搴秃偷撞康母鞣N種工具窗口。1.2使用3DDmax8建建模并導(dǎo)出mmesh1.2.1導(dǎo)出出mesh的的步驟如下: 1

2、.啟啟動3Dmaax8 2.在在??吭谟疫呥叺拿蠲姘灏逯?,點擊幾幾何體按鈕 3.選選擇標準幾何何體 4.在在對象類型中中選擇對象(如如:長方體),在在“前”視口中,通通過單擊鼠標標左鍵,創(chuàng)建建出模型 5.在在工具欄中單單擊“材質(zhì)編輯器器”按鈕,通過上上步操作,可可開啟“材質(zhì)編輯器器”對話框 6.在在“材質(zhì)編輯器器”對話框中,點點擊漫反射旁旁方形按鈕,進進入到“材質(zhì)/貼圖圖瀏覽器” 7.在在“材質(zhì)/貼圖圖瀏覽器”中選擇位圖圖,鼠標左鍵鍵雙擊位圖 8.彈彈出選擇位圖圖圖像文件對對話框,從本本地電腦中選選擇一張圖片片 9.選選擇好圖片,在在材質(zhì)編輯器器對話框中,點點擊將材質(zhì)指指令給選定對對象 10

3、.點擊菜單欄欄上的oFuusion按按鈕,在彈出出的菜單欄中中選擇Expport SScene 11選擇文件夾夾并輸入文件件名qiu,點點擊保存,在在彈出的對話話框中勾選CCopy TTexturres,點擊擊Exporrt按鈕,此此時meshh文件已成功功導(dǎo)出1.3導(dǎo)出的mmesh文件件放入到指定定位置 1.找找到meshh文件,把mmesh文件件放到當前電電腦的OgrreSDK的的modells中,以我的電腦腦為例,OggerSDKK放在C盤中; 2.打打開C盤,找到OggreSDKK,打開OgrreSDK,找找到mediia,打開meddia文件夾夾,找到moodels,打打開modee

4、ls文件夾夾,將messh文件復(fù)制制到此文件夾夾中; 3.將將導(dǎo)出messh文件附帶帶的材質(zhì)文件件qiu.mmateriial放到OOgreSDDK的scrripts(C:OggreSDKKmediiamatteriallsscrripts)中中;4.將導(dǎo)出meesn文件時時同時導(dǎo)出的的圖片放到OOgreSDDK的texxturess(C:OggreSDKKmediiamatteriallstexxturess)中。1.4 messh文件導(dǎo)入入到場景中1.4.1 mmesh文件件導(dǎo)入到場景景中步驟: 1.啟啟動vs20008 2.在在“文件”菜單中選擇擇“打開”,然后單擊擊“項目/解決決方案”

5、 3.找找到項目MFFCOgree1,選擇MMFCOgrre1.slln,點擊打打開按鈕 4.打打開MFCOOgre1VView.hh,創(chuàng)建節(jié)點點變量,ScceneNoode *nnode1(MFCOggre1Viiew.h 中的第55行),創(chuàng)創(chuàng)建實體變量量 Entiity* eent1(MFCOggre1Viiew.h 中的第57行); 5.打打開MFCOOgre1VView.ccpp, 在MFCOggre1Viiew.cppp的構(gòu)造函函數(shù)中對創(chuàng)建建的節(jié)點和實實體對象初始始化nodee1(NULLL)、 ent11(NULLL)(在MFCOOgre1VView.ccpp 的第第37行和第39

6、行) 6.獲獲取根節(jié)點的的子節(jié)點,并并將其賦值給給節(jié)點nodde1( MFCOOgre1VView.ccpp 的第第225行) 7.給給創(chuàng)建的實體體對象entt1賦值( MFFCOgree1Vieww.cpp 的第224行) 8.設(shè)設(shè)置節(jié)點的位位置( MFFCOgree1Vieww.cpp 的第226行)9.將實體附在在節(jié)點上( MFCOggre1Viiew.cppp 的第227行)1.5生成項目目 使用“生成項目”功能可以將將程序的源代代碼文件編譯譯為可執(zhí)行的的二進制文件件,方法十分分簡單:在“生成”菜單中選擇擇“生成解決方方案”。 在項目目生成過程中中,“輸出”窗口會實時時顯示生成的的進度

7、和結(jié)果果。如果源代代碼中不包含含語法錯誤,會會在最后提示示生成成功,如如下圖所示:1.6執(zhí)行項目目 在MFFCOgree1中選擇“調(diào)試”菜單中的“開始執(zhí)行(不調(diào)試)”,可以執(zhí)執(zhí)行剛剛生成成的程序,運運行出實驗要要求的結(jié)果。鍵盤輸入控制攝攝像機的移動動2.1添加按鍵鍵消息響應(yīng) 1.在在菜單欄中選選擇視圖 2.點點擊視圖,在在彈出的菜單單窗口中,選選擇類視圖 3.在在類視圖中,選選擇類MFCCOgre11View 4.再再次選擇菜單單欄中的視圖圖,在菜單的的菜單窗口中中,選擇其他他窗口 5.在在其他窗口中中,選擇屬性性窗口 6.在在屬性窗口中中,點擊消息息按鈕7.找到WM_KEYDOOWN,添加加

8、OnKeyyDown()消消息響應(yīng)函數(shù)數(shù)2.2在OnKKeyDowwn()消息息響應(yīng)函數(shù)中中,添加按鍵鍵控制1.找到MFCCOgre11View.cpp的onKeyyDown()( MFCOOgre1VView.ccpp 的第第296行)2.創(chuàng)建一個33維變量Veector33 tranns = VVectorr3:ZEERO;2.使用swiitch語句句,判斷用戶戶按下的按鍵鍵3.如果用戶按按下的是A鍵,將變量量transs的x坐標減10,然后將將攝像機移動動到當前的ttrans坐坐標處(注:按鍵消息獲獲取的都是大大寫字母),則則攝像機向左左移動,代碼碼如下:caseA: ttrans.x

9、-=110; m_pCaamera-moveeRelattive(ttrans); breakk;4. 如果用戶戶按下的是DD鍵,將變量量transs的x坐標加10,然后將將攝像機移動動到當前的ttrans坐坐標處(注:按鍵消息獲獲取的都是大大寫字母),則則攝像機向左左移動caseD: tranns.x +=10; m_pCCameraa-movveRelaative(transs); breaak;2.3生成項目目 使用“生成項目”功能可以將將程序的源代代碼文件編譯譯為可執(zhí)行的的二進制文件件,方法十分分簡單:在“生成”菜單中選擇擇“生成解決方方案”。 在項目生成過程程中,“輸出”窗口會實時時

10、顯示生成的的進度和結(jié)果果。如果源代代碼中不包含含語法錯誤,會會在最后提示示生成成功,如如下圖所示:2.4執(zhí)行項目目 在MFFCOgree1中選擇“調(diào)試”菜單中的“開始執(zhí)行(不調(diào)試)”,可以執(zhí)執(zhí)行剛剛生成成的程序,運運行出實驗要要求的結(jié)果。添加動畫3.1添加動畫畫 1.在在MFCOggreVieew1.h中中創(chuàng)建voiid CrreateAAnimattion(OOgre:Strinng MyAAnimattion);( MFCCOgreVView1 中第77行行) 2.創(chuàng)創(chuàng)建一個全局局變量AniimatioonStatte *ass( MFCCOgreVView1.cpp 中中第17行) 3.

11、實實現(xiàn)voidd CreeateAnnimatiion(Oggre:SStringg MyAnnimatiion);(MMFCOgrre1Vieew.cppp中第3199行) 4.判判斷動畫是否否存在,如果果動畫存在,刪刪除已有的動動畫 5.使使用scenneManaager來創(chuàng)創(chuàng)建一個annimatiion,同時時指定動畫的的名字和幀的的長度 6. 設(shè)置該段動動畫的關(guān)鍵幀幀間幀的插值值方式,這里里使用線性 7. 使用aniimatioon創(chuàng)建為每每個要驅(qū)動的的node創(chuàng)創(chuàng)建一個trrack, 比如這這里我們只想想讓一個結(jié)點點(nodee,比如它上上面掛著攝像像機)運動,就只為他創(chuàng)建一一個tr

12、acck就行了,第第一個參數(shù)是是這個traack的編號號 8. 對于每個ttrack創(chuàng)創(chuàng)建它的每個個關(guān)鍵幀 9. 設(shè)置該幀的的時間點 10. 設(shè)置該幀幀處這個結(jié)點點的位置和其其他幾何狀態(tài)態(tài) 11.設(shè)置動畫運運動狀態(tài) 12.在項目解決決方案資源管管理器中,找找到MFCOOgre1 13.右擊MFCCOgre11,在彈出的的界面中,選選擇添加類 14.選擇MFCC類,點擊添添加,在類名名中輸入MyyFrameeListeener 15.在MyFrrameLiisteneer.h中類類MyFraameLisstenerr繼承FraameLisstenerr 16.在MyFrrameLiistenee

13、r.h中添添加virttual bbool fframeSStarteed(connst FrrameEvvent &evt);( 在MyyFrameeListeener.hh的第12行行 ) 17.在MyFrrameLiisteneer.cppp中重寫frrameSttart()函數(shù)(在MMyFrammeListtener.cpp第114行),代代碼如下:bool MyyFrameeListeener:frameeStartted(coonst FFrameEEvent &evt) if(NULL != ass) as-addTiime(evvt.timmeSincceLasttFramee

14、); retturn ttrue; 18.在MFCOOgre1VView.ccpp的構(gòu)造造函數(shù)中創(chuàng)建建關(guān)聯(lián)監(jiān)聽類類對象(m_pRoott-adddFrameeListeener(nnew MyyFrameeListeener();)(在在MFCOggre1Viiew.cppp第50行行) 19. 找到MFFCOgree1Vieww.cpp的的onKeyyDown()( MFFCOgree1Vieww.cpp 的第2966行)使用sswitchh語句,判斷斷用戶按下的的按鍵,代碼碼如下:caseM: CreaateAniimatioon(MyyAnimaation);break;實驗結(jié)果(包括括

15、必要的截圖圖)根據(jù)前面的實驗驗步驟,最終終得到下面的的截圖:將桌子這個實體體模型導(dǎo)入到到Ogre中中,如下圖所所示:該截圖說明meesh文件添添加到場景中中成功。將場景分別繞XX軸、Y軸和和Z軸旋轉(zhuǎn),如如下圖所示繞X軸旋轉(zhuǎn):(2)繞Y軸旋旋轉(zhuǎn):繞Z軸旋轉(zhuǎn):同樣可以通過添添加如下代碼碼控制攝像機機的移動:caseA: ttrans.x -=110; m_pCaamera-moveeRelattive(ttrans); breakk;因此,在執(zhí)行程程序的時候,按按鍵“A”可以實現(xiàn)場場景的向左移移動;caseD: tranns.x +=10; m_pCCameraa-movveRelaative(t

16、ranss); breakk;因此執(zhí)行程序的的時候,按鍵鍵“D”可以實現(xiàn)場場景的向右移移動。實驗體會思考題解答:如何控制攝像機機的上下移動動、前后移動動?解:控制攝像機機的上下移動動可以通過控控制攝像機的的Z坐標,例例如要是想要要向上移動,則則可以使trran.z+=10,向向下移動的話話則可以使ttran.zz-=10;控制攝像機機的前后移動動則需要改變變攝像機的YY坐標,例如如要是想要向向前移動,則則可以使trran.y+=10,向向后移動的話話則可以使ttran.yy-=10。(2)如何控制制攝像機的旋旋轉(zhuǎn)?(函數(shù) vooid piitch(cconst Radiaan& anngle)

17、; /繞X軸旋轉(zhuǎn) 函數(shù)數(shù) voidd yaw(constt Radiian& aangle); /繞繞Y軸旋轉(zhuǎn) 函數(shù)數(shù) voidd rolll(consst Raddian& anglee); /繞Z軸旋轉(zhuǎn))解:控制攝像機機的旋轉(zhuǎn)已經(jīng)經(jīng)在程序中實實現(xiàn),如上面面的截圖所示示,通過函數(shù)數(shù) voidd pitcch(connst Raadian& anglle),使得得攝像機繞軸軸X旋轉(zhuǎn),具具體每次旋轉(zhuǎn)轉(zhuǎn)的角度可以以在函數(shù)的參參數(shù)中進行設(shè)設(shè)置;通過函數(shù) voiid yaww(consst Raddian& anglee),使得攝攝像機繞軸YY旋轉(zhuǎn);通過過函數(shù) void roll(constt Rad

18、iian& aangle),使得攝像像機繞軸Z旋旋轉(zhuǎn)。按下M鍵,實體體球可以沿著著直線運動,通通過鍵盤控制制實體球,實實體球是否可可以沿著曲線線運動?解:通過鍵盤控控制實體球,實實體球是可以以沿著曲線運運動的,只需需要在相應(yīng)的的控制按鍵的的開關(guān)語句中中調(diào)用一個能能夠讓實體球球沿著曲線運運動的函數(shù),該該實體球的運運動曲線可以以設(shè)置為BSS曲線等等。實驗感想 通過本本次實驗,我我初步認識和和了解了Oggre這款軟軟件,該軟件件能夠創(chuàng)建三三維場景,所所以被用于游游戲等等場合合中。本次實實驗,我自己己按照實驗指指導(dǎo)書一步步步的從用3DDmax創(chuàng)建建三維實體模模型,然后生生成meshh文件,將mmesh

19、文件件導(dǎo)入到Oggre場景中中,給實體模模型添加材質(zhì)質(zhì),并且通過過添加相應(yīng)的的代碼使得實實體球能夠運運動起來,添添加相應(yīng)的代代碼使得場景景左右移動、上上下移動、前前后移動和繞繞軸旋轉(zhuǎn)等等等,這些所有有的內(nèi)容雖然然做的不是很很漂亮,但是是讓自己嘗試試了在Ogrre中如何完完整的創(chuàng)建簡簡單的三維模模型。 實驗二 實驗名稱PathFinnder疏散散仿真實驗實驗過程或?qū)嶒烌灣绦颍ㄔ黾蛹拥拇a及代代碼注解)1、Creatte Geoometryy On thee Vieww menuu, cliick Unnits aand seelect EN to displlay meeasureementss

20、 usinng thee Engllish ssystemm.To speccify ssnap ggrid sspacinng:1. On the VView mmenu, clickk Editt Snapp Gridd.2. In the SSpeciffy snaap griid spaacing menu, typee 2.0. By ddefaullt, leength unitss willl be iin feeet, hooweverr, youu can type a vallue foolloweed by a uniit (e.g.: in oor m) andd th

21、e lengtth willl be conveerted to feeet. Click OK.To defiine thhe deffault floorr heigght:1. In the FFloor Heighht boxx(on tthe abbove TToolbaar), ttype 112.0.To creaate thhe rooom:1. In the VView ttoolbaar, cllick TTop Viiew ( ).2. In the TTools toolbbar, cclick Add aa Recttangullar Rooom ( ).3. In

22、the ZZ Planne boxx, typpe 0.00.4. In the ccoordiinate boxess enteer thee folllowingg valuues: XX1: 0.0, Y11: 0.00, X2: 60.00, Y2: 40.00. 5. Cliick Crreate.Replicaate thhe rooom to creatte thrree flloors.1. In the VView ttoolbaar, cllick tthe Seelectiion Toool iccon . 2. Sellect tthe rooom.3. In the

23、TTools toolbbar, cclick the MMove OObjectts icoon .4. Sellect CCopy MMode. 5. In the CCopiess box type 2.6. In the MMove ZZ box, typee 12.00.7. Cliick Coopy/Moove.8. Cliick thhe Zooom Fitt icoon to rescaale thhe vieew.Your moodel sshouldd now look like Figurre 1. Figure 1: Thhe flooors iin thee mode

24、elTo defiine thhe lanndingss:1. Creeate tthe fiirst llandinng at Z=6.00 ft. In thhe Vieew tooolbar, clicck Topp Vieww ( ). In tthe Toools ttoolbaar, cllick AAdd a Rectaangulaar Rooom ( ). In thhe Z PPlane box, type 6.0. In thhe cooordinaate booxes eenter the ffollowwing vvaluess: X1: -113.5, Y1: 166

25、.0, XX2: -99.5, YY2: 244.0. CClick Creatte.2. Repplicatte thee landding. In thhe Vieew tooolbar, clicck thee Seleectionn Tooll iconn . SSelectt the landiing. IIn thee Toolls tooolbar, clicck thee Movee Objeects iicon . Seleect Coopy Moode. IIn thee Copiies boox typpe 1.IIn thee Movee Z boox, tyype 1

26、22.0. CClick Copy/Move.3. Reppeat ffor thhe lannding on thhe opppositee sidee. In the VView ttoolbaar, cllick TTop Viiew ( ). IIn thee Toolls tooolbar, clicck Addd a Reectanggular Room ( ). In tthe Z Planee box, typee 6.0. In tthe cooordinnate bboxes enterr the folloowing valuees: X11: 69.5, Y11: 16

27、.0, X22: 73.5, Y22: 24.0. Cllick CCreatee. Repliccate tthe laandingg. In the VView ttoolbaar, cllick tthe Seelectiion Toool iccon . Seleect thhe lannding. In tthe Toools ttoolbaar, cllick tthe Moove Obbjectss iconn . SSelectt Copyy Modee. In the CCopiess box type 1. Inn the Move Z boxx, typpe 12.0.

28、Cllick CCopy/MMove.Your moodel sshouldd now look like Figurre 2. Figure 2:Thee flooors annd lanndingss in tthe moodelTo add the ffirst stairrway oon thee leftt sidee of tthe buuildinng:1. In the TTools toolbbar, cclick Creatte Staairs bbetweeen twoo edgees ( ).2. In the SStair Widthh box, typee 44.0

29、0 in. In thhe Dooor 1 WWidth box aand thhe Dooor 2 WWidth box, type 32.0 in. 3. Cliick onn the lowerr landding aand poositioon thee staiir towwards the ffront side of thhe lannding. Clicck on the llower floorr to ccreatee the stairrs froom thee landding tto thee loweer flooor, FFiguree 3.4. Usee the

30、 Move Objeccts toool too makee 1 coopies of thhe staair, sseparaated bby 12 ft inn the Z dirrectioon.5. Addd the stairrs thaat go up frrom thhe lannding. Clicck on the llower landiing annd possitionn the stairr oppoosite the ffirst stairrs. Cllick oon thee secoond flloor tto creeate tthe sttairs fro

31、m the llandinng to the ssecondd flooor.6. Usee the Move Objeccts toool too makee a coopy off the stairr, sepparateed by 12 ftt in tthe Z direcction.7. Reppeat oon thee otheer sidde of the mmodel. Thiss timee, possitionn the firstt staiirs onn the back side of thhe lannding. Figure 3 : FFirst stairrs

32、 on left side of buuildinngAdd thee exitt doorrs:1. Sellect tthe dooor toool ( ) aand inn the Max WWidth box, type 120.00 in.2. Plaace a door adjaccent tto botth staairs oon thee loweest flloor. Thesee doorrs aree widee enouugh thhat exxit from thhe firrst flloor ddoes nnot afffect the eegresss time

33、e. 3. Namme thee doorrs Rigght Exxit annd Lefft Exiit to aiid in laterr plottting of thhe exiit rattes thhroughh each dooor, FFiguree 4. Figure 4: Thhe lefft ExiitAdd OcccupanttsTo add occuppants:1. Sellect tthe fiirst (lowesst) flloor. On thhe Moddel meenu cllick AAdd Occcupannts. FFor Occcupannt C

34、ouunt seelect By Nuumber and ttype 1100. CClick OK.2. Reppeat ffor eaach flloor, seleccting the ccorresspondiing prrofilee for each floorr. Wheen finnishedd, youur moddel shhould look like Figurre 5Figure 5: Paathfinnder mmodel with occuppants三實驗結(jié)果(包包括必要的截截圖)1、實驗最終結(jié)結(jié)果截圖顯示示:2、仿真截圖顯顯示:人群疏散仿真模模擬截圖顯示示:四

35、實驗體會本次實驗主要就就是熟悉Paathfinnder軟件件的使用,在在本次實驗的的過程中,我我覺得這款軟軟件的功能還還是很強大的的,也很有趣趣,我們可以以在這個平臺臺上來進行人人群疏散的仿仿真。該平臺臺能夠很好的的將模型疏散散和人群疏散散顯示出來。但但是我覺得這這款軟件有一一個缺點,那那就是樓梯的的邊緣檢測做做的不夠細致致,直接導(dǎo)致致人群疏散的的時候下樓的的人們的腳可可以被看見。 實驗三 一實驗名稱基于OGRE的的Boidss算法實驗二實驗過程或或?qū)嶒灣绦颍ㄔ鲈黾拥拇a及及代碼注解)3.1基于OGGRE的Booids算法法實現(xiàn)1.拷貝MyBBoids.h,MyBBoids.cpp到EE:MF

36、CCOgre11MFCOOgre1(對應(yīng)的項目目位置)2.添加MyBBoids.h、MyBBoids.cpp到工工程中3.在MFCOOgre1VView.hh中引入頭文文件MyBooids.hh(#incllude MyBooids.hh)4.在MFCOOgre1VView.ccpp的OnnInitiialUpddate()函數(shù)(OnIInitiaalUpdaate()在在MFCOggre1Viiew的第1115行)中中,添加函數(shù)數(shù)AllInnit();5.打開MFCCOgre11View.h,在類中中創(chuàng)建節(jié)點變變量ScenneNodee* nodde,實體變變量Entiity* eent,節(jié)

37、點點變量數(shù)組SSceneNNode* node44BoiddsNum,實體變量量數(shù)組Enttity* ent4BoidssNum,字字符串數(shù)組OOgre:Strinng NammeBoiidsNumm。6.打開MFCCOgre11View.cpp,在在MFCOggre1Viiew.cppp的構(gòu)造函函數(shù)中對創(chuàng)建建的節(jié)點和實實體對象以及及字符串數(shù)組組初始化7.在MFCOOgre1VView.ccpp的CrreateEEntityy函數(shù)中創(chuàng)建建實體,并將將實體綁定到到節(jié)點上8.在MFCOOgre1VView.ccpp的OnnTimerr消息響應(yīng)函函數(shù)中添加CCubMottion(), 設(shè)置節(jié)節(jié)點的n

38、odde的位置;添加BoiidsMottion(),設(shè)置節(jié)點數(shù)數(shù)組nodee4BoiidsNumm的位置3.2生成項目目使用“生成項目目”功能可以將將程序的源代代碼文件編譯譯為可執(zhí)行的的二進制文件件,方法十分分簡單:在“生成”菜單中選擇擇“生成解決方方案”。 在項目生成過程程中,“輸出”窗口會實時時顯示生成的的進度和結(jié)果果。如果源代代碼中不包含含語法錯誤,會會在最后提示示生成成功,如如下圖所示:3.3執(zhí)行項目目在MFCOgrre1中選擇擇“調(diào)試”菜單中的“開始執(zhí)行(不調(diào)試)”,可以執(zhí)執(zhí)行剛剛生成成的程序,運運行出實驗要要求的結(jié)果。3.4添加代碼碼及注解1、添加代碼 (1)for(intt i=

39、0;iBoiidsNumm;i+)/給每個個Boidss模型初始化化名稱 if(ii=0) Namei=aa; elsee Namei=Naamei-1+aa; forr(int i=0;iiBoiddsNum;i+)/為每個實實體初始化 ent44i=NNULL; forr(int i=0;iiReccalcLaayout();ResizeeParenntToFiit();(3)void CMMFCOgrre1Vieew:CrreateEEntityy(voidd)/將每每個實體附著著在結(jié)點上,并并且給結(jié)點賦賦值 /ennt1 = m_pScceneMaanagerr-creeateEnnt

40、ity(Spheere,qiu.mmesh);/獲取取實體對象,第第一個參數(shù)是是實體的名字字,第二個參參數(shù)是要導(dǎo)入入的meshh文件 /noode1 = m_pSSceneMManageer-geetRoottSceneeNode()-crreateCChildSSceneNNode();/創(chuàng)建建結(jié)點 /noode1-transslate(Vectoor3(-220,0,330);/設(shè)置實體體的位置 /noode1-attacchObjeect(ennt1);/將實體附附在節(jié)點上 /ennt1-ssetMatteriallName(Exammples/Chromme1);/設(shè)置實實體的材質(zhì) /

41、ennt2 = m_pScceneMaanagerr-creeateEnntity(treee,trree02.mesh); /noode2 = m_pSSceneMManageer-geetRoottSceneeNode()-crreateCChildSSceneNNode(); /noode2-transslate(Vectoor3(0,500,00);/設(shè)置實體的的位置 /noode2-attacchObjeect(ennt2);/將實體附附在場景上 ent =m_pSSceneMManageer-crreateEEntityy(cubbe,nninja.mesh); nodee = m_pScenneManaager-getRoootSceeneNodde()-creatteChilld

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論