TAILIEUCHUNG - 3d game engine programming phần 9

Một trò chơi có thể là một cái chết đơn giản phù hợp với người đầu tiên bắn súng, trong đó người chơi được yêu cầu để có được frags càng nhiều càng tốt, có nghĩa là bạn nên quét sạch như nhiều cầu thủ đối phương càng tốt. | Class Design of the Tool 681 m_bSelected false m_bHidden false m_bPartOfMesh false m_pDad NULL m_pVerts NULL m_pIndis NULL m_pLineIndis NULL m_Type LOB_POLYGON memset m_Aabb 0 sizeof ZFXAabb Init Note that some of the attributes set here stem from the base class. The most important thing in the Init function is setting the type of the level object so that the query to the ID of the object will be valid. Note that the ID for the skin of this polygon is set to 2 not to an initial 0. Skins 0 and 1 are meant for other purposes as discussed later . Normally the level designer will name a skin that the polygon should use if not the default skin is number 2. If you want to delete a polygon or if you just want to reset it you first have to call its function CPolygon Release. This is done in the destructor of the class too and it will clean up all the memory that was allocated in this class define SAFE_DELETE p if p 0 delete p p 0 define SAFE_DELETE_A p if p 0 delete p p 0 define SAFE_FREE p if p 0 free p p 0 void CPolygon Release void SAFE_DELETE_A m_pVerts SAFE_DELETE_A m_pIndis SAFE_DELETE_A m_pLineIndis Creating an Instance If you want to fill an instance of the polygon class with data you must supply the vertices and the indices to this instance. Doing so requires two separate functions. Therefore you can change only the index list without changing the vertex list for example. Setting the vertices also results in a recalculation of the bounding box that includes the polygon whereas setting the indices involves the calculation of the normal vector which depends on the winding order indicated by the index list. Here are the two functions to feed the polygon with data void CPolygon SetVertices const VERTEX pVerts UINT NumVerts TEAM LinG - Live Informative Non-cost and Genuine 682 Chapter 14 Computer-Aided Design CAD Tools SAFE_DELETE_A m_pVerts SAFE_DELETE_A m_pLineIndis m_pVerts new VERTEX NumVerts m_pLineIndis new WORD NumVerts 2 if m_pVerts m_pLineIndis return memcpy .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.