Guest User

Untitled

a guest
Feb 19th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. // say you have a 2D map
  2. // like so
  3. // X X X X X X
  4. // X X X X X X
  5. // X X X X X X
  6. // X X X X X X
  7. // X X X X X X
  8. // X X X X X X
  9.  
  10. // you can splitup the map into pieces
  11. // as many as you see fit, but keep them
  12. // large, and don't bother sorting them
  13. // either
  14.  
  15. // so now you can have something like
  16. // X X X X X X
  17. // X X X X X X
  18. // X X X X X X
  19. //
  20. // X X X X X X
  21. // X X X X X X
  22. // X X X X X X
  23.  
  24. // you generate 4 VBOs for this since you have _four_ sections
  25. // these sections can be your PORTALS!
  26. // lets give them ids 0-3
  27.  
  28. // now you have 4 VBOs, it can be 5,6,7,8 does not matter
  29. // map size can be anything, you just break it down into
  30. // smaller chunks, that are farily large, but not too
  31. // large that the portal culling would be useless
  32.  
  33. // now you implement yout actual PVS culling
  34. // for(vbos_in_map)
  35. // if(camera_is_in_portal_or_visible_to_portal)
  36. // add_vbo_to_instance_data
  37.  
  38. // finally your render it!
  39. // this way only VBO's you can see or are in
  40. // will be rendered, everything else will not
Add Comment
Please, Sign In to add comment