TileSelectionResult.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /**
  2. * Indicates what happened the last time this tile was visited for selection.
  3. * @private
  4. */
  5. var TileSelectionResult = {
  6. /**
  7. * There was no selection result, perhaps because the tile wasn't visited
  8. * last frame.
  9. */
  10. NONE: 0,
  11. /**
  12. * This tile was deemed not visible and culled.
  13. */
  14. CULLED: 1,
  15. /**
  16. * The tile was selected for rendering.
  17. */
  18. RENDERED: 2,
  19. /**
  20. * This tile did not meet the required screen-space error and was refined.
  21. */
  22. REFINED: 3,
  23. /**
  24. * This tile was originally rendered, but it got kicked out of the render list
  25. * in favor of an ancestor because it is not yet renderable.
  26. */
  27. RENDERED_AND_KICKED: 2 | 4,
  28. /**
  29. * This tile was originally refined, but its rendered descendants got kicked out of the
  30. * render list in favor of an ancestor because it is not yet renderable.
  31. */
  32. REFINED_AND_KICKED: 3 | 4,
  33. /**
  34. * This tile was culled because it was not visible, but it still needs to be loaded
  35. * and any heights on it need to be updated because the camera's position or the
  36. * camera's reference frame's origin falls inside this tile. Loading this tile
  37. * could affect the position of the camera if the camera is currently below
  38. * terrain or if it is tracking an object whose height is referenced to terrain.
  39. * And a change in the camera position may, in turn, affect what is culled.
  40. */
  41. CULLED_BUT_NEEDED: 1 | 8,
  42. /**
  43. * Determines if a selection result indicates that this tile or its descendants were
  44. * kicked from the render list. In other words, if it is <code>RENDERED_AND_KICKED</code>
  45. * or <code>REFINED_AND_KICKED</code>.
  46. *
  47. * @param {TileSelectionResult} value The selection result to test.
  48. * @returns {Boolean} true if the tile was kicked, no matter if it was originally rendered or refined.
  49. */
  50. wasKicked: function(value) {
  51. return value >= TileSelectionResult.RENDERED_AND_KICKED;
  52. },
  53. /**
  54. * Determines the original selection result prior to being kicked or CULLED_BUT_NEEDED.
  55. * If the tile wasn't kicked or CULLED_BUT_NEEDED, the original value is returned.
  56. * @param {TileSelectionResult} value The selection result.
  57. * @returns {TileSelectionResult} The original selection result prior to kicking.
  58. */
  59. originalResult: function(value) {
  60. return value & 3;
  61. },
  62. /**
  63. * Converts this selection result to a kick.
  64. * @param {TileSelectionResult} value The original selection result.
  65. * @returns {TileSelectionResult} The kicked form of the selection result.
  66. */
  67. kick: function(value) {
  68. return value | 4;
  69. }
  70. };
  71. export default TileSelectionResult;