




版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、實(shí)驗(yàn)一一. 實(shí)驗(yàn)名稱(chēng)Ogre部分仿真實(shí)驗(yàn)二. 實(shí)驗(yàn)過(guò)程或?qū)嶒?yàn)程序(增加的代碼及代碼注解)1.從3Dmax8中導(dǎo)出mesh并添加mesh到場(chǎng)景1.1啟動(dòng)3Dmax1.在安裝有3Dmax8的計(jì)算機(jī)上,可以使用兩種不同的方法來(lái)啟動(dòng)3Dmax8: (1)在桌面上雙擊“3Dmax8”圖標(biāo) (2)點(diǎn)擊“開(kāi)始”菜單,在“程序”中的選擇“3Dmax8”2. 觀察3Dmax8主窗口的布局。3Dmax8主要由若干元素組成:菜單欄、工具欄、以及停靠在右邊的命令面板和底部的各種工具窗口。1.2使用3Dmax8建模并導(dǎo)出mesh1.2.1導(dǎo)出mesh的步驟如下: 1.啟動(dòng)3Dmax8 2.在停靠在右邊的命令面板中,點(diǎn)擊
2、幾何體按鈕 3.選擇標(biāo)準(zhǔn)幾何體 4.在對(duì)象類(lèi)型中選擇對(duì)象(如:長(zhǎng)方體),在“前”視口中,通過(guò)單擊鼠標(biāo)左鍵,創(chuàng)建出模型 5.在工具欄中單擊“材質(zhì)編輯器”按鈕,通過(guò)上步操作,可開(kāi)啟“材質(zhì)編輯器”對(duì)話(huà)框 6.在“材質(zhì)編輯器”對(duì)話(huà)框中,點(diǎn)擊漫反射旁方形按鈕,進(jìn)入到“材質(zhì)/貼圖瀏覽器” 7.在“材質(zhì)/貼圖瀏覽器”中選擇位圖,鼠標(biāo)左鍵雙擊位圖 8.彈出選擇位圖圖像文件對(duì)話(huà)框,從本地電腦中選擇一張圖片 9.選擇好圖片,在材質(zhì)編輯器對(duì)話(huà)框中,點(diǎn)擊將材質(zhì)指令給選定對(duì)象 10.點(diǎn)擊菜單欄上的oFusion按鈕,在彈出的菜單欄中選擇Export Scene 11選擇文件夾并輸入文件名qiu,點(diǎn)擊保存,在彈出的對(duì)話(huà)框
3、中勾選Copy Textures,點(diǎn)擊Export按鈕,此時(shí)mesh文件已成功導(dǎo)出1.3導(dǎo)出的mesh文件放入到指定位置 1.找到mesh文件,把mesh文件放到當(dāng)前電腦的OgreSDK的models中,以我的電腦為例,OgerSDK放在C盤(pán)中; 2.打開(kāi)C盤(pán),找到OgreSDK,打開(kāi)OgreSDK,找到media,打開(kāi)media文件夾,找到models,打開(kāi)models文件夾,將mesh文件復(fù)制到此文件夾中; 3.將導(dǎo)出mesh文件附帶的材質(zhì)文件qiu.material放到OgreSDK的scripts(C:OgreSDKmediamaterialsscripts)中;4.將導(dǎo)出mesn文件
4、時(shí)同時(shí)導(dǎo)出的圖片放到OgreSDK的textures(C:OgreSDKmediamaterialstextures)中。1.4 mesh文件導(dǎo)入到場(chǎng)景中1.4.1 mesh文件導(dǎo)入到場(chǎng)景中步驟: 1.啟動(dòng)vs2008 2.在“文件”菜單中選擇“打開(kāi)”,然后單擊“項(xiàng)目/解決方案” 3.找到項(xiàng)目MFCOgre1,選擇MFCOgre1.sln,點(diǎn)擊打開(kāi)按鈕 4.打開(kāi)MFCOgre1View.h,創(chuàng)建節(jié)點(diǎn)變量,SceneNode *node1(MFCOgre1View.h 中的第55行),創(chuàng)建實(shí)體變量 Entity* ent1(MFCOgre1View.h 中的第57行); 5.打開(kāi)MFCOgre1
5、View.cpp, 在MFCOgre1View.cpp的構(gòu)造函數(shù)中對(duì)創(chuàng)建的節(jié)點(diǎn)和實(shí)體對(duì)象初始化node1(NULL)、 ent1(NULL)(在MFCOgre1View.cpp 的第37行和第39行) 6.獲取根節(jié)點(diǎn)的子節(jié)點(diǎn),并將其賦值給節(jié)點(diǎn)node1( MFCOgre1View.cpp 的第225行) 7.給創(chuàng)建的實(shí)體對(duì)象ent1賦值( MFCOgre1View.cpp 的第224行) 8.設(shè)置節(jié)點(diǎn)的位置( MFCOgre1View.cpp 的第226行)9.將實(shí)體附在節(jié)點(diǎn)上( MFCOgre1View.cpp 的第227行)1.5生成項(xiàng)目 使用“生成項(xiàng)目”功能可以將程序的源代碼文件編譯為可
6、執(zhí)行的二進(jìn)制文件,方法十分簡(jiǎn)單:在“生成”菜單中選擇“生成解決方案”。 在項(xiàng)目生成過(guò)程中,“輸出”窗口會(huì)實(shí)時(shí)顯示生成的進(jìn)度和結(jié)果。如果源代碼中不包含語(yǔ)法錯(cuò)誤,會(huì)在最后提示生成成功,如下圖所示:1.6執(zhí)行項(xiàng)目 在MFCOgre1中選擇“調(diào)試”菜單中的“開(kāi)始執(zhí)行(不調(diào)試)”,可以執(zhí)行剛剛生成的程序,運(yùn)行出實(shí)驗(yàn)要求的結(jié)果。2. 鍵盤(pán)輸入控制攝像機(jī)的移動(dòng)2.1添加按鍵消息響應(yīng) 1.在菜單欄中選擇視圖 2.點(diǎn)擊視圖,在彈出的菜單窗口中,選擇類(lèi)視圖 3.在類(lèi)視圖中,選擇類(lèi)MFCOgre1View 4.再次選擇菜單欄中的視圖,在菜單的菜單窗口中,選擇其他窗口 5.在其他窗口中,選擇屬性窗口 6.在屬性窗口中
7、,點(diǎn)擊消息按鈕7.找到WM_KEYDOWN,添加OnKeyDown()消息響應(yīng)函數(shù)2.2在OnKeyDown()消息響應(yīng)函數(shù)中,添加按鍵控制1.找到MFCOgre1View.cpp的onKeyDown()( MFCOgre1View.cpp 的第296行)2.創(chuàng)建一個(gè)3維變量Vector3 trans = Vector3:ZERO;2.使用switch語(yǔ)句,判斷用戶(hù)按下的按鍵3.如果用戶(hù)按下的是A鍵,將變量trans的x坐標(biāo)減10,然后將攝像機(jī)移動(dòng)到當(dāng)前的trans坐標(biāo)處(注:按鍵消息獲取的都是大寫(xiě)字母),則攝像機(jī)向左移動(dòng),代碼如下:case'A': trans.x -=10;
8、 m_pCamera->moveRelative(trans); break;4. 如果用戶(hù)按下的是D鍵,將變量trans的x坐標(biāo)加10,然后將攝像機(jī)移動(dòng)到當(dāng)前的trans坐標(biāo)處(注:按鍵消息獲取的都是大寫(xiě)字母),則攝像機(jī)向左移動(dòng)caseD': trans.x +=10; m_pCamera->moveRelative(trans); break;2.3生成項(xiàng)目 使用“生成項(xiàng)目”功能可以將程序的源代碼文件編譯為可執(zhí)行的二進(jìn)制文件,方法十分簡(jiǎn)單:在“生成”菜單中選擇“生成解決方案”。 在項(xiàng)目生成過(guò)程中,“輸出”窗口會(huì)實(shí)時(shí)顯示生成的進(jìn)度和結(jié)果。如果源代碼中不包含語(yǔ)法錯(cuò)誤,會(huì)在最
9、后提示生成成功,如下圖所示:2.4執(zhí)行項(xiàng)目 在MFCOgre1中選擇“調(diào)試”菜單中的“開(kāi)始執(zhí)行(不調(diào)試)”,可以執(zhí)行剛剛生成的程序,運(yùn)行出實(shí)驗(yàn)要求的結(jié)果。3. 添加動(dòng)畫(huà)3.1添加動(dòng)畫(huà) 1.在MFCOgreView1.h中創(chuàng)建void CreateAnimation(Ogre:String MyAnimation);( MFCOgreView1 中第77行) 2.創(chuàng)建一個(gè)全局變量AnimationState *as( MFCOgreView1.cpp 中第17行) 3.實(shí)現(xiàn)void CreateAnimation(Ogre:String MyAnimation);(MFCOgre1View.cp
10、p中第319行) 4.判斷動(dòng)畫(huà)是否存在,如果動(dòng)畫(huà)存在,刪除已有的動(dòng)畫(huà) 5.使用sceneManager來(lái)創(chuàng)建一個(gè)animation,同時(shí)指定動(dòng)畫(huà)的名字和幀的長(zhǎng)度 6. 設(shè)置該段動(dòng)畫(huà)的關(guān)鍵幀間幀的插值方式,這里使用線(xiàn)性 7. 使用animation創(chuàng)建為每個(gè)要驅(qū)動(dòng)的node創(chuàng)建一個(gè)track, 比如這里我們只想讓一個(gè)結(jié)點(diǎn)(node,比如它上面掛著攝像機(jī))運(yùn)動(dòng),就只為他創(chuàng)建一個(gè)track就行了,第一個(gè)參數(shù)是這個(gè)track的編號(hào) 8. 對(duì)于每個(gè)track創(chuàng)建它的每個(gè)關(guān)鍵幀 9. 設(shè)置該幀的時(shí)間點(diǎn) 10. 設(shè)置該幀處這個(gè)結(jié)點(diǎn)的位置和其他幾何狀態(tài) 11.設(shè)置動(dòng)畫(huà)運(yùn)動(dòng)狀態(tài) 12.在項(xiàng)目解決方案資源管理器中
11、,找到MFCOgre1 13.右擊MFCOgre1,在彈出的界面中,選擇添加類(lèi) 14.選擇MFC類(lèi),點(diǎn)擊添加,在類(lèi)名中輸入MyFrameListener 15.在MyFrameListener.h中類(lèi)MyFrameListener繼承FrameListener 16.在MyFrameListener.h中添加virtual bool frameStarted(const FrameEvent &evt);( 在MyFrameListener.h的第12行 ) 17.在MyFrameListener.cpp中重寫(xiě)frameStart()函數(shù)(在MyFrameListener.cpp第14
12、行),代碼如下:bool MyFrameListener:frameStarted(const FrameEvent &evt) if(NULL != as) as->addTime(evt.timeSinceLastFrame); return true; 18.在MFCOgre1View.cpp的構(gòu)造函數(shù)中創(chuàng)建關(guān)聯(lián)監(jiān)聽(tīng)類(lèi)對(duì)象(m_pRoot->addFrameListener(new MyFrameListener();)(在MFCOgre1View.cpp第50行) 19. 找到MFCOgre1View.cpp的onKeyDown()( MFCOgre1View.cp
13、p 的第296行)使用switch語(yǔ)句,判斷用戶(hù)按下的按鍵,代碼如下:case'M': CreateAnimation("MyAnimation");break;三. 實(shí)驗(yàn)結(jié)果(包括必要的截圖)根據(jù)前面的實(shí)驗(yàn)步驟,最終得到下面的截圖:1. 將桌子這個(gè)實(shí)體模型導(dǎo)入到Ogre中,如下圖所示:該截圖說(shuō)明mesh文件添加到場(chǎng)景中成功。2. 將場(chǎng)景分別繞X軸、Y軸和Z軸旋轉(zhuǎn),如下圖所示(1) 繞X軸旋轉(zhuǎn):(2)繞Y軸旋轉(zhuǎn):(2) 繞Z軸旋轉(zhuǎn):同樣可以通過(guò)添加如下代碼控制攝像機(jī)的移動(dòng):case'A': trans.x -=10; m_pCamera-&g
14、t;moveRelative(trans); break;因此,在執(zhí)行程序的時(shí)候,按鍵“A”可以實(shí)現(xiàn)場(chǎng)景的向左移動(dòng);caseD': trans.x +=10; m_pCamera->moveRelative(trans); break;因此執(zhí)行程序的時(shí)候,按鍵“D”可以實(shí)現(xiàn)場(chǎng)景的向右移動(dòng)。四. 實(shí)驗(yàn)體會(huì)1、 思考題解答:(1) 如何控制攝像機(jī)的上下移動(dòng)、前后移動(dòng)?解:控制攝像機(jī)的上下移動(dòng)可以通過(guò)控制攝像機(jī)的Z坐標(biāo),例如要是想要向上移動(dòng),則可以使tran.z+=10,向下移動(dòng)的話(huà)則可以使tran.z-=10;控制攝像機(jī)的前后移動(dòng)則需要改變攝像機(jī)的Y坐標(biāo),例如要是想要向前移動(dòng),則可以
15、使tran.y+=10,向后移動(dòng)的話(huà)則可以使tran.y-=10。(2)如何控制攝像機(jī)的旋轉(zhuǎn)?(函數(shù) void pitch(const Radian& angle); /繞X軸旋轉(zhuǎn) 函數(shù) void yaw(const Radian& angle); /繞Y軸旋轉(zhuǎn) 函數(shù) void roll(const Radian& angle); /繞Z軸旋轉(zhuǎn))解:控制攝像機(jī)的旋轉(zhuǎn)已經(jīng)在程序中實(shí)現(xiàn),如上面的截圖所示,通過(guò)函數(shù) void pitch(const Radian& angle),使得攝像機(jī)繞軸X旋轉(zhuǎn),具體每次旋轉(zhuǎn)的角度可以在函數(shù)的參數(shù)中進(jìn)行設(shè)置;通過(guò)函數(shù) void y
16、aw(const Radian& angle),使得攝像機(jī)繞軸Y旋轉(zhuǎn);通過(guò)函數(shù) void roll(const Radian& angle),使得攝像機(jī)繞軸Z旋轉(zhuǎn)。(3) 按下M鍵,實(shí)體球可以沿著直線(xiàn)運(yùn)動(dòng),通過(guò)鍵盤(pán)控制實(shí)體球,實(shí)體球是否可以沿著曲線(xiàn)運(yùn)動(dòng)?解:通過(guò)鍵盤(pán)控制實(shí)體球,實(shí)體球是可以沿著曲線(xiàn)運(yùn)動(dòng)的,只需要在相應(yīng)的控制按鍵的開(kāi)關(guān)語(yǔ)句中調(diào)用一個(gè)能夠讓實(shí)體球沿著曲線(xiàn)運(yùn)動(dòng)的函數(shù),該實(shí)體球的運(yùn)動(dòng)曲線(xiàn)可以設(shè)置為BS曲線(xiàn)等等。2、 實(shí)驗(yàn)感想 通過(guò)本次實(shí)驗(yàn),我初步認(rèn)識(shí)和了解了Ogre這款軟件,該軟件能夠創(chuàng)建三維場(chǎng)景,所以被用于游戲等等場(chǎng)合中。本次實(shí)驗(yàn),我自己按照實(shí)驗(yàn)指導(dǎo)書(shū)一步步的從用3D
17、max創(chuàng)建三維實(shí)體模型,然后生成mesh文件,將mesh文件導(dǎo)入到Ogre場(chǎng)景中,給實(shí)體模型添加材質(zhì),并且通過(guò)添加相應(yīng)的代碼使得實(shí)體球能夠運(yùn)動(dòng)起來(lái),添加相應(yīng)的代碼使得場(chǎng)景左右移動(dòng)、上下移動(dòng)、前后移動(dòng)和繞軸旋轉(zhuǎn)等等,這些所有的內(nèi)容雖然做的不是很漂亮,但是讓自己嘗試了在Ogre中如何完整的創(chuàng)建簡(jiǎn)單的三維模型。 實(shí)驗(yàn)二 一. 實(shí)驗(yàn)名稱(chēng)PathFinder疏散仿真實(shí)驗(yàn)二. 實(shí)驗(yàn)過(guò)程或?qū)嶒?yàn)程序(增加的代碼及代碼注解)1、Create Geometry1. On the View menu, click Units and select EN to display measurements using t
18、he English system.To specify snap grid spacing:1. On the View menu, click Edit Snap Grid.2. In the Specify snap grid spacing menu, type 2.0. By default, length units will be in feet, however, you can type a value followed by a unit (e.g.: "in" or "m") and the length will be conve
19、rted to feet.3. Click OK.To define the default floor height:1. In the Floor Height box(on the above Toolbar), type 12.0.To create the room:1. In the View toolbar, click Top View ( ).2. In the Tools toolbar, click Add a Rectangular Room ( ).3. In the Z Plane box, type 0.0.4. In the coordinate boxes e
20、nter the following values: X1: 0.0, Y1: 0.0, X2: 60.0, Y2: 40.0. 5. Click Create.Replicate the room to create three floors.1. In the View toolbar, click the Selection Tool icon . 2. Select the room.3. In the Tools toolbar, click the Move Objects icon .4. Select Copy Mode. 5. In the Copies box type 2
21、.6. In the Move Z box, type 12.0.7. Click Copy/Move.8. Click the Zoom Fit icon to rescale the view.Your model should now look like Figure 1. Figure 1: The floors in the modelTo define the landings:1. Create the first landing at Z=6.0 ft. In the View toolbar, click Top View ( ). In the Tools toolbar,
22、 click Add a Rectangular Room ( ). In the Z Plane box, type 6.0. In the coordinate boxes enter the following values: X1: -13.5, Y1: 16.0, X2: -9.5, Y2: 24.0. Click Create.2. Replicate the landing. In the View toolbar, click the Selection Tool icon . Select the landing. In the Tools toolbar, click th
23、e Move Objects icon . Select Copy Mode. In the Copies box type 1.In the Move Z box, type 12.0. Click Copy/Move.3. Repeat for the landing on the opposite side. In the View toolbar, click Top View ( ). In the Tools toolbar, click Add a Rectangular Room ( ). In the Z Plane box, type 6.0. In the coordin
24、ate boxes enter the following values: X1: 69.5, Y1: 16.0, X2: 73.5, Y2: 24.0. Click Create.4. Replicate the landing. In the View toolbar, click the Selection Tool icon . Select the landing. In the Tools toolbar, click the Move Objects icon . Select Copy Mode. In the Copies box type 1. In the Move Z
25、box, type 12.0. Click Copy/Move.Your model should now look like Figure 2. Figure 2:The floors and landings in the modelTo add the first stairway on the left side of the building:1. In the Tools toolbar, click Create Stairs between two edges ( ).2. In the Stair Width box, type 44.0 in. In the Door 1
26、Width box and the Door 2 Width box, type 32.0 in. 3. Click on the lower landing and position the stair towards the front side of the landing. Click on the lower floor to create the stairs from the landing to the lower floor, Figure 3.4. Use the Move Objects tool to make 1 copies of the stair, separa
27、ted by 12 ft in the Z direction.5. Add the stairs that go up from the landing. Click on the lower landing and position the stair opposite the first stairs. Click on the second floor to create the stairs from the landing to the second floor.6. Use the Move Objects tool to make a copy of the stair, se
28、parated by 12 ft in the Z direction.7. Repeat on the other side of the model. This time, position the first stairs on the back side of the landing. Figure 3 : First stairs on left side of buildingAdd the exit doors:1. Select the door tool ( ) and in the Max Width box, type 120.0 in.2. Place a door a
29、djacent to both stairs on the lowest floor. These doors are wide enough that exit from the first floor does not affect the egress time. 3. Name the doors Right Exit and Left Exit to aid in later plotting of the exit rates through each door, Figure 4. Figure 4: The left ExitAdd OccupantsTo add occupa
30、nts:1. Select the first (lowest) floor. On the Model menu click Add Occupants. For Occupant Count select By Number and type 100. Click OK.2. Repeat for each floor, selecting the corresponding profile for each floor. When finished, your model should look like Figure 5Figure 5: Pathfinder model with o
31、ccupants三實(shí)驗(yàn)結(jié)果(包括必要的截圖)1、實(shí)驗(yàn)最終結(jié)果截圖顯示:2、仿真截圖顯示:3、 人群疏散仿真模擬截圖顯示:四實(shí)驗(yàn)體會(huì)本次實(shí)驗(yàn)主要就是熟悉Pathfinder軟件的使用,在本次實(shí)驗(yàn)的過(guò)程中,我覺(jué)得這款軟件的功能還是很強(qiáng)大的,也很有趣,我們可以在這個(gè)平臺(tái)上來(lái)進(jìn)行人群疏散的仿真。該平臺(tái)能夠很好的將模型疏散和人群疏散顯示出來(lái)。但是我覺(jué)得這款軟件有一個(gè)缺點(diǎn),那就是樓梯的邊緣檢測(cè)做的不夠細(xì)致,直接導(dǎo)致人群疏散的時(shí)候下樓的人們的腳可以被看見(jiàn)。 實(shí)驗(yàn)三 一實(shí)驗(yàn)名稱(chēng)基于OGRE的Boids算法實(shí)驗(yàn)二實(shí)驗(yàn)過(guò)程或?qū)嶒?yàn)程序(增加的代碼及代碼注解)3.1基于OGRE的Boids算法實(shí)現(xiàn)1.拷貝MyBoid
32、s.h,MyBoids.cpp到E:MFCOgre1MFCOgre1(對(duì)應(yīng)的項(xiàng)目位置)2.添加MyBoids.h、MyBoids.cpp到工程中3.在MFCOgre1View.h中引入頭文件MyBoids.h(#include "MyBoids.h")4.在MFCOgre1View.cpp的OnInitialUpdate()函數(shù)(OnInitialUpdate()在MFCOgre1View的第115行)中,添加函數(shù)AllInit();5.打開(kāi)MFCOgre1View.h,在類(lèi)中創(chuàng)建節(jié)點(diǎn)變量SceneNode* node,實(shí)體變量Entity* ent,節(jié)點(diǎn)變量數(shù)組Scene
33、Node* node4BoidsNum,實(shí)體變量數(shù)組Entity* ent4BoidsNum,字符串?dāng)?shù)組Ogre:String NameBoidsNum。6.打開(kāi)MFCOgre1View.cpp,在MFCOgre1View.cpp的構(gòu)造函數(shù)中對(duì)創(chuàng)建的節(jié)點(diǎn)和實(shí)體對(duì)象以及字符串?dāng)?shù)組初始化7.在MFCOgre1View.cpp的CreateEntity函數(shù)中創(chuàng)建實(shí)體,并將實(shí)體綁定到節(jié)點(diǎn)上8.在MFCOgre1View.cpp的OnTimer消息響應(yīng)函數(shù)中添加CubMotion(), 設(shè)置節(jié)點(diǎn)的node的位置;添加BoidsMotion(),設(shè)置節(jié)點(diǎn)數(shù)組node4BoidsNum的位置3.2生成項(xiàng)目使
34、用“生成項(xiàng)目”功能可以將程序的源代碼文件編譯為可執(zhí)行的二進(jìn)制文件,方法十分簡(jiǎn)單:在“生成”菜單中選擇“生成解決方案”。 在項(xiàng)目生成過(guò)程中,“輸出”窗口會(huì)實(shí)時(shí)顯示生成的進(jìn)度和結(jié)果。如果源代碼中不包含語(yǔ)法錯(cuò)誤,會(huì)在最后提示生成成功,如下圖所示:3.3執(zhí)行項(xiàng)目在MFCOgre1中選擇“調(diào)試”菜單中的“開(kāi)始執(zhí)行(不調(diào)試)”,可以執(zhí)行剛剛生成的程序,運(yùn)行出實(shí)驗(yàn)要求的結(jié)果。3.4添加代碼及注解1、添加代碼 (1)for(int i=0;i<BoidsNum;i+)/給每個(gè)Boids模型初始化名稱(chēng) if(i=0) Namei="a" else Namei=Namei-1+"
35、;a" for(int i=0;i<BoidsNum;i+)/為每個(gè)實(shí)體初始化 ent4i=NULL; for(int i=0;i<BoidsNum;i+)/為每個(gè)節(jié)點(diǎn)初始化 node4i=NULL; (2)void CMFCOgre1View:OnInitialUpdate()/為場(chǎng)景進(jìn)行初始化 AllInit();CFormView:OnInitialUpdate();GetParentFrame()->RecalcLayout();ResizeParentToFit();(3)void CMFCOgre1View:CreateEntity(void)/將每個(gè)實(shí)
36、體附著在結(jié)點(diǎn)上,并且給結(jié)點(diǎn)賦值 /ent1 = m_pSceneManager->createEntity("Sphere","qiu.mesh");/獲取實(shí)體對(duì)象,第一個(gè)參數(shù)是實(shí)體的名字,第二個(gè)參數(shù)是要導(dǎo)入的mesh文件 /node1 = m_pSceneManager->getRootSceneNode()->createChildSceneNode();/創(chuàng)建結(jié)點(diǎn) /node1->translate(Vector3(-20,0,30);/設(shè)置實(shí)體的位置 /node1->attachObject(ent1);/將實(shí)體附在
37、節(jié)點(diǎn)上 /ent1->setMaterialName("Examples/Chrome1");/設(shè)置實(shí)體的材質(zhì) /ent2 = m_pSceneManager->createEntity("tree","tree02.mesh"); /node2 = m_pSceneManager->getRootSceneNode()->createChildSceneNode(); /node2->translate(Vector3(0,500,0);/設(shè)置實(shí)體的位置 /node2->attachObject(ent2);/將實(shí)體附在場(chǎng)景上 ent =m_pSceneManager->createEntity("cube","ninja.mesh"); node = m_pSceneManager->getRootSceneNode()->createChildSceneNode("node"); node->setScale(0.02f,0.02f,0.02f); node->setPosition
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年企業(yè)軟件定制策劃開(kāi)發(fā)服務(wù)委托合同
- 2025年合作策劃共管店鋪運(yùn)營(yíng)合同書(shū)
- 2025年汽車(chē)電器產(chǎn)品制造加工合同
- 上海市存量房交易合同樣本2025年
- 2025年住宅重建拆除合同規(guī)范文本
- 2025年公寓室內(nèi)裝飾工程合同
- 2025年綠植租用合同規(guī)范
- 2025年企業(yè)產(chǎn)品代銷(xiāo)合作合同范文
- 2025年中外合作企業(yè)股權(quán)分配策劃合同書(shū)
- 能源項(xiàng)目風(fēng)險(xiǎn)控制-深度研究
- 《化工設(shè)備機(jī)械基礎(chǔ)(第8版)》完整全套教學(xué)課件
- 代理記賬業(yè)務(wù)內(nèi)部規(guī)范制度-代理記賬業(yè)務(wù)規(guī)范
- 山東虛擬電廠商業(yè)模式介紹
- 2024-2025學(xué)年高中思想政治選擇性必修2 法律與生活統(tǒng)編版(部編版)教學(xué)設(shè)計(jì)合集
- 第09講二元一次方程組中的新定義題型(原卷版+解析)-2021-2022學(xué)年下學(xué)期七年級(jí)數(shù)學(xué)下冊(cè)期末復(fù)習(xí)高頻考點(diǎn)專(zhuān)題(人教版)
- 全國(guó)職業(yè)院校技能大賽高職組(商務(wù)數(shù)據(jù)分析賽項(xiàng))備賽試題庫(kù)(含答案)
- 八年級(jí)道德與法治下冊(cè) 第三單元 人民當(dāng)家作主教案 新人教版
- JGJ153-2016 體育場(chǎng)館照明設(shè)計(jì)及檢測(cè)標(biāo)準(zhǔn)
- 【年產(chǎn)100噸植物乳桿菌菌劑生產(chǎn)線(xiàn)設(shè)計(jì)10000字(論文)】
- 《湖南省醫(yī)療保險(xiǎn)“雙通道”管理藥品使用申請(qǐng)表》
- 中醫(yī)內(nèi)科學(xué)歌訣355首 內(nèi)科歌訣完整
評(píng)論
0/150
提交評(píng)論