![Phân tích tư tưởng của nhân dân qua đoạn thơ: Những người vợ nhớ chồng… Những cuộc đời đã hóa sông núi ta trong Đất nước của Nguyễn Khoa Điềm](https://timtailieu.net/upload/document/136415/phan-tich-tu-tuong-cua-nhan-dan-qua-doan-tho-039-039-nhung-nguoi-vo-nho-chong-nhung-cuoc-doi-da-hoa-song-nui-ta-039-039-trong-dat-nuoc-cua-nguyen-khoa-136415.jpg)
3D Game Programming All in One- P8
Số trang: 30
Loại file: pdf
Dung lượng: 437.66 KB
Lượt xem: 15
Lượt tải: 0
Xem trước 3 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
3D Game Programming All in One- P8: During the past several years while working on the Tubettiland “Online Campaign” softwareand more recently while working on the Tubettiworld game, I figure I’ve receivedmore than a hundred queries from people of all ages about how to get started makinggames. There were queries from 40-year-olds and 13-year-olds and every age in between.Most e-mails were from guys I would estimate to be in their late teens or early 20s.
Nội dung trích xuất từ tài liệu:
3D Game Programming All in One- P8 3D Programming 117 if (%scale < 5.0) // and hasnt gotten too big %scale += 0.3; // make it bigger else $grow = false; // if its too big, dont let it grow more } else // if its shrinking { if (%scale > 3.0) // and isnt too small %scale -= 0.3; // then make it smaller else $grow = true; // if its too small, dont let it grow smaller } %shape.setScale(%scale SPC %scale SPC %scale); %shape.setTransform(%lx SPC %ly SPC %lz SPC %rx SPC %ry SPC %rz SPC %rd); schedule(200,0,AnimShape, %shape, %dist, %angle, %scale);}function DoAnimTest()// ----------------------------------------------------// a function to tie together the instantiation// and the movement in one easy to type function// call.// ----------------------------------------------------{ %as = InsertTestShape(); $grow = true; AnimShape(%as,0.2, 1, 2);}This module is almost identical to the MoveShape() module we worked with earlier.The function AnimShape accepts a shape handle in %shape, a distance step as %dist, an anglevalue as %angle, and a scaling value as %scale and uses these to transform the shape indi-cated by the %shape handle.First, it obtains the current position of the shape using the %shape.getTransform() methodof the Item class.As with the earlier MoveShape() function, the AnimShape() function fetches the transform ofthe shape and updates one of the axis values.Then it updates the rotation value stored %rd. Team LRN118 Chapter 3 ■ 3D Programming Concepts Then it adjusts the scale value by determining if the shape is growing or shrinking. Depending on which way the size is changing, the scale is incremented, unless the scale exceeds the too large or too small limits. When a limit is exceeded, the change direction is reversed. Next, the scale of the shape is changed to the new values using the %shape.setScale() method for the shape. Finally, the function sets the items transform to be the new transform values within the %shape.setTransform() statement. The DoAnimTest() function first inserts the new instance of the shape object using the InsertTestShape() function and saves the handle to the new object in the variable %as. It then calls the AnimShape() function, specifying which shape to animate by passing in the handle to the shape as the first argument and also indicating the discrete movement step distance, the discrete rotation angle, and the discrete size change value with the second, third, and fourth arguments. To use the program, follow these steps: 1. Make sure youve saved the file as 3DGPAi1CH3animshape.cs. 2. Run the Chapter 3 demo using the shortcut in the 3DGPAi1 folder. 3. Press the Start button when the demo screen comes up. 4. Make sure you dont move your player-character after it spawns into the game world. 5. Bring up the console window. 6. Type in the following, and press Enter after the semicolon: exec(CH3/animshape.cs); You should get a response in the console window similar to this: Compiling CH3/animshape.cs... Loading compiled script CH3/animshape.cs. This means that the Torque Engine has compiled your program and then loaded it into memory. The datablock definition and the three functions are in memory, waiting to be used. 7. Now, type the following into the console, and close the console quickly afterward: DoAnimTest(); What you should see now is the heart dropping from the air to the ground; it then begins moving away from you toward the right. Go chase after it if you like, to get a sense of how fast it is moving. Team LRN 3D Programming 119Go ahead and experiment with the program. Try moving the item through several axes atonce, or try changing the distance.3D AudioEnvironmental sounds with a 3D component contribute greatly to the immersive aspectof a game by providing positional cues that mimic the way sounds happen in real life.We can control 3D audio in the scene in much the same way we do 3D visual objects.Type the following program and save it as 3DGPAi1CH3animaudio.cs.// ========================================================================// animaudio.cs//// This module contains the definition of an audio emitter, which uses// a synthetic water drop sound. It also contains functions for placing// the test emitter in th ...
Nội dung trích xuất từ tài liệu:
3D Game Programming All in One- P8 3D Programming 117 if (%scale < 5.0) // and hasnt gotten too big %scale += 0.3; // make it bigger else $grow = false; // if its too big, dont let it grow more } else // if its shrinking { if (%scale > 3.0) // and isnt too small %scale -= 0.3; // then make it smaller else $grow = true; // if its too small, dont let it grow smaller } %shape.setScale(%scale SPC %scale SPC %scale); %shape.setTransform(%lx SPC %ly SPC %lz SPC %rx SPC %ry SPC %rz SPC %rd); schedule(200,0,AnimShape, %shape, %dist, %angle, %scale);}function DoAnimTest()// ----------------------------------------------------// a function to tie together the instantiation// and the movement in one easy to type function// call.// ----------------------------------------------------{ %as = InsertTestShape(); $grow = true; AnimShape(%as,0.2, 1, 2);}This module is almost identical to the MoveShape() module we worked with earlier.The function AnimShape accepts a shape handle in %shape, a distance step as %dist, an anglevalue as %angle, and a scaling value as %scale and uses these to transform the shape indi-cated by the %shape handle.First, it obtains the current position of the shape using the %shape.getTransform() methodof the Item class.As with the earlier MoveShape() function, the AnimShape() function fetches the transform ofthe shape and updates one of the axis values.Then it updates the rotation value stored %rd. Team LRN118 Chapter 3 ■ 3D Programming Concepts Then it adjusts the scale value by determining if the shape is growing or shrinking. Depending on which way the size is changing, the scale is incremented, unless the scale exceeds the too large or too small limits. When a limit is exceeded, the change direction is reversed. Next, the scale of the shape is changed to the new values using the %shape.setScale() method for the shape. Finally, the function sets the items transform to be the new transform values within the %shape.setTransform() statement. The DoAnimTest() function first inserts the new instance of the shape object using the InsertTestShape() function and saves the handle to the new object in the variable %as. It then calls the AnimShape() function, specifying which shape to animate by passing in the handle to the shape as the first argument and also indicating the discrete movement step distance, the discrete rotation angle, and the discrete size change value with the second, third, and fourth arguments. To use the program, follow these steps: 1. Make sure youve saved the file as 3DGPAi1CH3animshape.cs. 2. Run the Chapter 3 demo using the shortcut in the 3DGPAi1 folder. 3. Press the Start button when the demo screen comes up. 4. Make sure you dont move your player-character after it spawns into the game world. 5. Bring up the console window. 6. Type in the following, and press Enter after the semicolon: exec(CH3/animshape.cs); You should get a response in the console window similar to this: Compiling CH3/animshape.cs... Loading compiled script CH3/animshape.cs. This means that the Torque Engine has compiled your program and then loaded it into memory. The datablock definition and the three functions are in memory, waiting to be used. 7. Now, type the following into the console, and close the console quickly afterward: DoAnimTest(); What you should see now is the heart dropping from the air to the ground; it then begins moving away from you toward the right. Go chase after it if you like, to get a sense of how fast it is moving. Team LRN 3D Programming 119Go ahead and experiment with the program. Try moving the item through several axes atonce, or try changing the distance.3D AudioEnvironmental sounds with a 3D component contribute greatly to the immersive aspectof a game by providing positional cues that mimic the way sounds happen in real life.We can control 3D audio in the scene in much the same way we do 3D visual objects.Type the following program and save it as 3DGPAi1CH3animaudio.cs.// ========================================================================// animaudio.cs//// This module contains the definition of an audio emitter, which uses// a synthetic water drop sound. It also contains functions for placing// the test emitter in th ...
Tìm kiếm theo từ khóa liên quan:
thiết kế web giáo trình thiết kế flash CSS cơ bản giáo trình photoshop kỹ thuật cắt htmlTài liệu liên quan:
-
Báo cáo thực tập: Đề tài thiết kế Web
77 trang 578 2 0 -
Đề thi thực hành môn Thiết kế Web - Trường Cao đẳng nghề Vĩnh Phúc
3 trang 287 2 0 -
182 trang 188 0 0
-
MỘT SỐ ĐIỂM CẦN CHÚ Ý KHI THIẾT KẾ WEB
5 trang 116 0 0 -
GIÁO TRÌNH LẬP TRÌNH WEB_PHẦN 2_BÀI 3
3 trang 105 0 0 -
Giáo trình Nhập môn thiết kế website
58 trang 84 0 0 -
81 trang 77 0 0
-
Tài liệu giảng dạy Thiết kế giao diện Web - Trường CĐ Kinh tế - Kỹ thuật Vinatex TP. HCM
88 trang 75 0 0 -
112 trang 69 0 0
-
Hướng dân sử dụng Navicat để Create , Backup , Restore Database
7 trang 68 0 0