need help~~~~~~~~

Started by
2 comments, last by north_wolf 22 years, 2 months ago
how to render transparency polygons with solid leaf tree? i think it should be rendered at a back to front order,but how can i sort them in a solid leaf tree?
Advertisement
Because your data is in a structure doesn''t mean you are bound to it.

A possibility :

- Create an appropriately sized array (malloc/new...), once should be enough.
- fill it with pointers to your polys.
- sort the pointer array according to the Z of the pointees.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
thank u. but it is hard to sort polygons by its Z value without using a BSP tree, i think. can you explain to me in a detail please?
With a vector : brute force N^2.

You have a BSP tree ?

- determine which side of the partition is in the back (dot product the view vector with the normal of the partition plane).
- render the back side (recursively)
- render the front side (recursively)

You don''t have a BSP tree ? Build one (with pointers to the actual data).
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

This topic is closed to new replies.

Advertisement