Beginning XNA 2.0 Game Programming From Novice to Professional phần 6

Một phần cơ bản nhất của một đối tượng 3-D là một đỉnh. Toán học, các đỉnh là đại diện duy nhất của 3-D tọa độ của họ (được ánh xạ tới các kiểu dữ liệu Vector3 trong XNA), nhưng XNA chúng bao gồm thông tin thêm, chẳng hạn như kết cấu, màu sắc, | CHAPTER 7 3-D GAME PROGRAMMING BASICS 199 Vertices and Primitives The most basic part of a 3-D object is a vertex. Mathematically vertices are represented solely by their 3-D coordinates which are mapped to the Vectors data type in XNA but in XNA they include extra information such as color texture or normal vector information depending on the vertex format used. Table 7-1 presents the vertex definitions provided by the XNA Framework. Table 7-1. Vertex Format Structure Definition inXNA Vertex Format Description VertexPositionColor Defines a vertex with position and rendering color VertexPositionTexture Defines a vertex with position and texture coordinates which specify how to map a given texture over this vertex with 0 0 being the upper-left coordinate of the texture and 1 1 the bottom-right limit of the texture VertexPositionColorTexture Defines a vertex with position color and texture coordinates VertexPositionNormalTexture Defines a vertex with position and the normal vector 200 CHAPTER 7 3-D GAME PROGRAMMING BASICS Besides the vertices position and additional data when creating 3-D objects you also need to specify how XNA will connect these vertices according to different drawing primitives. Drawing primitives or 3-D primitives define to XNA how a vertices collection known in XNA as a vertex buffer will be rendered when the drawing functions are called. The vertices can be drawn as a set of disconnected points as a set of lines or as triangles. The triangle is used as abase to create any other 2-D or 3-D objects. This is because a primitive defined with only three points is guaranteed to be in a single plane and to be convex a line connecting any two points inside a triangle is always fully inside the triangle which doesn t happen in some figures with four vertices . These characteristics are the key to performing the fastest rendering possible by the graphics cards which always use triangles as the base rendering primitives. So for example if you want to draw

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
30    62    1    03-06-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.