tailieunhanh - 3d game engine programming phần 2

Nếu bạn đã có con trỏ chuột, gọi chức năng và giao cho các đối tượng cần xóa. Một lần nữa, không có phép thuật đằng sau này. Có thể định nghĩa CREATERENDERDEVICE vàRELEASERENDERDEVICE là một chút bối rối cho bạn, nhưng họ thực sự nói | 58 Chapter 3 Engineering the Engine Release As you will see in a moment the object that implements the interface is created inside the DLL. Therefore I let the DLL do the release job of this object as well because the object s memory has been allocated on the DLL s heap. To do this you have to get the pointer to the release function that is exported. If you have that pointer call the function and hand to it the object that should be deleted. Again there s no magic behind this. Maybe the definitions CREATERENDERDEVICE and RELEASERENDERDEVICE are a bit confusing for you but they actually tell the compiler which parameter list belongs to that function pointer. Without that the compiler would not be able to verify if you called the function in a way that doesn t blow up the call stack. Now for the good news. I m glad you made it so far. As far as I can see we just suffered slight losses in taking that hill here. Good job Soldier. You re done with the static library loading a DLL now. The bad news Well there is another hill to be taken tonight. Now move it Implementing the DLL Change the active project to the ZFXD3D project. I ll show you now how to encapsulate Direct3D inside this project. The benefit of the encapsulation is that anyone using our engine does not need to know a single piece of information about Direct3D. He does not need to have the DirectX SDK Software Development Kit installed and there is no need to mess around with Direct3D data types or classes. Note the attribute m_pChain MAX_3DHWND in the following class definition. Even if the engine we implement in this book is a small demo project I want to make it as complete as possible. One of the frequently asked questions in bulletin boards about game programming goes like this I want to render graphics into multiple child views for my editor. How do I do that There are a number of ways to achieve this goal using DirectX but the way it s meant to be done is to use the so-called Direct3D swap chains which

TỪ KHÓA LIÊN QUAN