TAILIEUCHUNG - Focus On 3D Terrain Programming phần 7

Điều cuối cùng chúng ta sẽ làm là thêm hình cụt chọn lọc để triển khai thực hiện của chúng tôi, mà là một cách đơn giản để tăng tốc độ thực hiện của chúng tôi. Để thêm hình cụt tiêu huỷ, chức năng duy nhất chúng ta cần phải chỉnh sửa là RefineNode. | Summaru 125 Speeding Things Up a Bit The final thing we are going to do is add frustum culling to our implementation which is a simple way to speed up our implementation. To add frustum culling the only function we need to edit is RefineNode. Our frustum test is the same thing as Chapter 5. We re going to make a cube out of the current node and then test it against the viewport. If the node is in view we ll continue refining the node. If it s not in view we ll set the node s quadtree matrix to 0 and eliminate that node and all of its children from the updating and rendering queue. test the node s bounding box against the view frustum if m_pCamera- CubeFrustumTest x m_vecScale 0 GetScaledHeightAtPoint x z z m_vecScale 2 iEdgeLength m_vecScale 0 disable this node and return since the parent node is disabled we don t need to waste any CPU cycles by traversing down the tree even further m_ucpQuadMtrx GetMatrixIndex int x i nt z 0 return With that we end our coverage of the quadtree algorithm and implementation. Check out demo6_3 and witness the result of all of your hard work. Good job Summary It s been a fun chapter and we covered almost everything to do with Stefan Roetgger s quadtree algorithm. We talked about what a general quadtree is and then discussed all the theory behind the quadtree algorithm. From there we implemented all the theory. We ended up with a fast flexible and good-looking terrain implementation We have only one more terrain algorithm to cover so let s get to it 126 6. Climbing the Quadtree References 1 Roettger Stefan Wolfgang Heidrich Philipp Slusallek and Hans-Peter Seidel. Real-Time Generation of Continuous Levels of Detail for Height Fields. In V. Skala editor Proc. WSCG 98 pages 315-322 1998. http roettger data Papers . Team-Fly CHAPTER 7 Wherever You May .

Đã 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.