Đang chuẩn bị liên kết để tải về tài liệu:
Beginning XNA 2.0 Game Programming From Novice to Professional phần 7
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
hoặc các thông tin vector bình thường, tùy thuộc vào định dạng đỉnh được sử dụng . Bảng 7-1 trình bày các định nghĩa đỉnh được cung cấp bởi Khung XNA.Định nghĩa một đỉnh với vị trí và màu sắc dựng hình Xác định một đỉnh với vị trí và tọa độ kết cấu, trong đó xác định làm thế nào để bản đồ kết cấu được đưa ra trên đỉnh này, | CHAPTER 9 Lights Camera Transformations In this chapter you re going to create a basic framework to manage cameras lights and object transformations. A 3-D scene might have many cameras lights and objects scattered around it. Because you might have a few different types of cameras and lights in your scene creating base classes and managers for them is very helpful. For the objects in the scene it s useful to create a class to store its transformation translation rotation and scale. The basic concepts related to transformations cameras and lights were presented in Chapter 7 here you re going to create some classes to represent and manage these objects. You ll use the classes created in this chapter in Chapters 10 11 and 12. Cameras Depending on the genre of the game that you re going to create you might want to use a different type of camera such as a fixed-position camera a first-person camera a third-person camera a Real Time Strategy RTS camera and so on. With so many different types of cameras it is helpful to create a basic camera that can be extended to create more specific types of cameras. BaseCamera Class In this section you re going to create a generic base class for the cameras named BaseCamera. This class will handle the camera view and projection matrices and its visualization volume a frustum truncated pyramid . You can use the camera s frustum to identify which objects are not inside the camera s visualization volume keeping these objects out of the rendering process. The camera s frustum is generated based on the camera s view and projection matrices. 245 246 CHAPTER 9 LIGHTS CAMERA TRANSFORMATIONS Camera Perspective Projection The BaseCamera class only supports perspective projection. You ll create the SetPerspectiveFov method to set the camera s perspective projection and the Projection property to retrieve it. You can use the following code to create and update the camera perspective projection matrix Perspective projection parameters float fovy .