graphicsThreadingModel.I 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // Filename: graphicsThreadingModel.I
  2. // Created by: drose (27Jan03)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. ////////////////////////////////////////////////////////////////////
  19. // Function: GraphicsThreadingModel::Copy Constructor
  20. // Access: Published
  21. // Description:
  22. ////////////////////////////////////////////////////////////////////
  23. INLINE GraphicsThreadingModel::
  24. GraphicsThreadingModel(const GraphicsThreadingModel &copy) :
  25. _cull_name(copy._cull_name),
  26. _draw_name(copy._draw_name),
  27. _cull_sorting(copy._cull_sorting)
  28. {
  29. }
  30. ////////////////////////////////////////////////////////////////////
  31. // Function: GraphicsThreadingModel::Copy Assignment Operator
  32. // Access: Published
  33. // Description:
  34. ////////////////////////////////////////////////////////////////////
  35. INLINE void GraphicsThreadingModel::
  36. operator = (const GraphicsThreadingModel &copy) {
  37. _cull_name = copy._cull_name;
  38. _draw_name = copy._draw_name;
  39. _cull_sorting = copy._cull_sorting;
  40. }
  41. ////////////////////////////////////////////////////////////////////
  42. // Function: GraphicsThreadingModel::get_cull_name
  43. // Access: Published
  44. // Description: Returns the name of the thread that will handle
  45. // culling in this model.
  46. ////////////////////////////////////////////////////////////////////
  47. INLINE const string &GraphicsThreadingModel::
  48. get_cull_name() const {
  49. return _cull_name;
  50. }
  51. ////////////////////////////////////////////////////////////////////
  52. // Function: GraphicsThreadingModel::get_draw_name
  53. // Access: Published
  54. // Description: Returns the name of the thread that will handle
  55. // sending the actual graphics primitives to the
  56. // graphics API in this model.
  57. ////////////////////////////////////////////////////////////////////
  58. INLINE const string &GraphicsThreadingModel::
  59. get_draw_name() const {
  60. return _draw_name;
  61. }
  62. ////////////////////////////////////////////////////////////////////
  63. // Function: GraphicsThreadingModel::get_cull_sorting
  64. // Access: Published
  65. // Description: Returns true if the model involves a separate cull
  66. // pass, or false if culling happens implicitly, at the
  67. // same time as draw.
  68. ////////////////////////////////////////////////////////////////////
  69. INLINE bool GraphicsThreadingModel::
  70. get_cull_sorting() const {
  71. return _cull_sorting;
  72. }
  73. ////////////////////////////////////////////////////////////////////
  74. // Function: GraphicsThreadingModel::is_single_threaded
  75. // Access: Published
  76. // Description: Returns true if the threading model is a
  77. // single-threaded model, or false if it involves
  78. // threads.
  79. ////////////////////////////////////////////////////////////////////
  80. INLINE bool GraphicsThreadingModel::
  81. is_single_threaded() const {
  82. return _cull_name.empty() && _draw_name.empty();
  83. }
  84. ////////////////////////////////////////////////////////////////////
  85. // Function: GraphicsThreadingModel::is_default
  86. // Access: Published
  87. // Description: Returns true if the threading model is the default,
  88. // cull-then-draw single-threaded model, or false
  89. // otherwise.
  90. ////////////////////////////////////////////////////////////////////
  91. INLINE bool GraphicsThreadingModel::
  92. is_default() const {
  93. return is_single_threaded() && _cull_sorting;
  94. }
  95. ////////////////////////////////////////////////////////////////////
  96. // Function: GraphicsThreadingModel::output
  97. // Access: Published
  98. // Description:
  99. ////////////////////////////////////////////////////////////////////
  100. INLINE void GraphicsThreadingModel::
  101. output(ostream &out) const {
  102. out << get_model();
  103. }
  104. INLINE ostream &
  105. operator << (ostream &out, const GraphicsThreadingModel &threading_model) {
  106. threading_model.output(out);
  107. return out;
  108. }