【正文】
re1View ,在菜單的菜單窗口中,選擇其他窗口 ,選擇屬性窗口 ,點擊消息按鈕,添加OnKeyDown()消息響應(yīng)函數(shù)()消息響應(yīng)函數(shù)中,添加按鍵控制()( 的第296行) trans = Vector3::ZERO。A39。 m_pCameramoveRelative(trans)。4. 如果用戶按下的是D鍵,將變量trans的x坐標加10,然后將攝像機移動到當前的trans坐標處(注:按鍵消息獲取的都是大寫字母),則攝像機向左移動case‘D39。 m_pCameramoveRelative(trans)。 使用“生成項目”功能可以將程序的源代碼文件編譯為可執(zhí)行的二進制文件,方法十分簡單:在“生成”菜單中選擇“生成解決方案”。如果源代碼中不包含語法錯誤,會在最后提示生成成功,如下圖所示: 在MFCOgre1中選擇“調(diào)試”菜單中的“開始執(zhí)行(不調(diào)試)”,可以執(zhí)行剛剛生成的程序,運行出實驗要求的結(jié)果。( MFCOgreView1 中第77行) *as( 中第17行) CreateAnimation(Ogre::String MyAnimation)。evt)。evt){ if(NULL != as) { asaddTime()。} (m_pRootaddFrameListener(new MyFrameListener())。M39。break。2. 將場景分別繞X軸、Y軸和Z軸旋轉(zhuǎn),如下圖所示(1) 繞X軸旋轉(zhuǎn):(2)繞Y軸旋轉(zhuǎn):(2) 繞Z軸旋轉(zhuǎn):同樣可以通過添加如下代碼控制攝像機的移動:case39。: =10。 break。: +=10。 break。四. 實驗體會 思考題解答:(1) 如何控制攝像機的上下移動、前后移動?解:控制攝像機的上下移動可以通過控制攝像機的Z坐標,例如要是想要向上移動,+=10,=10;控制攝像機的前后移動則需要改變攝像機的Y坐標,例如要是想要向前移動,+=10,=10。 angle)。 angle)。 angle)。 angle),使得攝像機繞軸X旋轉(zhuǎn),具體每次旋轉(zhuǎn)的角度可以在函數(shù)的參數(shù)中進行設(shè)置;通過函數(shù) void yaw(const Radianamp。 angle),使得攝像機繞軸Z旋轉(zhuǎn)。 實驗感想 通過本次實驗,我初步認識和了解了Ogre這款軟件,該軟件能夠創(chuàng)建三維場景,所以被用于游戲等等場合中。 實驗二 一. 實驗名稱PathFinder疏散仿真實驗二. 實驗過程或?qū)嶒灣绦颍ㄔ黾拥拇a及代碼注解)Create Geometry1. On the View menu, click Units and select EN to display measurements using the 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 . By default, length units will be in feet, however, you can type a value followed by a unit (.: in or m) and the length will be converted to feet.3. Click OK.To define the default floor height:1. In the Floor Height box(on the above Toolbar), type .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 .4. In the coordinate boxes enter the following values: X1: , Y1: , X2: , Y2: . 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.6. In the Move Z box, type .7. Click Copy/Move.8. Click the Zoom Fit icon to rescale the view.Your model should now l