tailieunhanh - Microsoft XNA Game Studio Creator’s Guide- P10
Microsoft XNA Game Studio Creator’s Guide- P10:The release of the XNA platform and specifically the ability for anyone to write Xbox 360 console games was truly a major progression in the game-programming world. Before XNA, it was simply too complicated and costly for a student, software hobbyist, or independent game developer to gain access to a decent development kit for a major console platform. | i yi T-1 j math is a branch of linear algebra and all 3D graph- I X I XII li X ics programmers can benefit from understanding it. In video game development matrices are used to store data such as vertices and information about how to transform an object. Matrices are simply grids of rows and columns but they are essential for scaling rotating and translating objects in 3D space. You will have noticed by now that matrix calculations are used throughout your XNA and shader code for performing transformations controlling your camera and even drawing 3D models. Understanding how these matrix methods work will provide you with a better understanding of 3D game engines. Most of the time you can get away with just using XNA matrix methods to automatically create matrices and to implement your transformations. However for complex vector transformations you may need to be able to build your own matrices for the calculations. In Chapter 8 a matrix is manually created to compute the flight path of an airplane. In Chapter 19 a matrix is manually built to implement a vector transformation that determines the starting position and direction of a rocket. In cases like these understanding the matrix math can definitely help to simplify your transformations. ATRiX MULTIPLICATION This section introduces matrix multiplication and prepares you for performing manual transformations later in the chapter. The product of two matrices is obtained by multiplying the rows of matrix A by the columns of matrix B where matrix A is on the left side of the operator . For the multiplication to be possible the total number of columns in matrix A must equal the total number of rows in matrix B. Matrix Types XNA s Matrix type enables storage of 3x3 matrices 3 rows by 3 columns and 4x4 matrices 4 rows by 4 columns . Each cell in the matrix grid can be accessed by referencing the matrix and suffixing it with the cell s row and column where the top-left cell begins at row 1 column 1. Each cell stores a
đang nạp các trang xem trước