builderBucketNode.I 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // Filename: builderBucketNode.I
  2. // Created by: drose (10Sep97)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, 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://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. ////////////////////////////////////////////////////////////////////
  19. // Function: BuilderBucketNode::Constructor
  20. // Access: Public
  21. // Description:
  22. ////////////////////////////////////////////////////////////////////
  23. INLINE BuilderBucketNode::
  24. BuilderBucketNode(BuilderBucket *bucket) : _bucket(bucket) {
  25. }
  26. ////////////////////////////////////////////////////////////////////
  27. // Function: BuilderBucketNode::Copy constructor
  28. // Access: Public
  29. // Description:
  30. ////////////////////////////////////////////////////////////////////
  31. INLINE BuilderBucketNode::
  32. BuilderBucketNode(const BuilderBucketNode &copy) {
  33. (*this) = copy;
  34. }
  35. ////////////////////////////////////////////////////////////////////
  36. // Function: BuilderBucketNode::Copy assignment operator
  37. // Access: Public
  38. // Description:
  39. ////////////////////////////////////////////////////////////////////
  40. INLINE void BuilderBucketNode::
  41. operator = (const BuilderBucketNode &copy) {
  42. _bucket = copy._bucket;
  43. _prims = copy._prims;
  44. _iprims = copy._iprims;
  45. }
  46. ////////////////////////////////////////////////////////////////////
  47. // Function: BuilderBucketNode::add_prim_nonindexed
  48. // Access: Public
  49. // Description: Adds the indicated indexed primitive to the bucket as
  50. // if it were nonindexed, and returns true if the
  51. // primitive was valid. Intended to be called from
  52. // Builder::add_prim_nonindexed().
  53. ////////////////////////////////////////////////////////////////////
  54. INLINE bool BuilderBucketNode::
  55. add_prim_nonindexed(const BuilderPrimI &prim) {
  56. BuilderPrim nonindexed;
  57. nonindexed.nonindexed_copy(prim, *_bucket);
  58. return add_prim(nonindexed);
  59. }
  60. ////////////////////////////////////////////////////////////////////
  61. // Function: BuilderBucketNode::get_bucket
  62. // Access: Public
  63. // Description: Returns the BuilderBucket object associated with this
  64. // node.
  65. ////////////////////////////////////////////////////////////////////
  66. INLINE BuilderBucket *BuilderBucketNode::
  67. get_bucket() const {
  68. return _bucket;
  69. }
  70. ////////////////////////////////////////////////////////////////////
  71. // Function: BuilderBucketNode::Ordering operator
  72. // Access: Public
  73. // Description: Returns true if this bucket precedes the indicated
  74. // one in ordering. This function is used by the STL
  75. // set in the Builder object to sort buckets into order,
  76. // and to collect similar buckets together.
  77. ////////////////////////////////////////////////////////////////////
  78. INLINE bool BuilderBucketNode::
  79. operator < (const BuilderBucketNode &other) const {
  80. return (*_bucket) < (*other._bucket);
  81. }
  82. ////////////////////////////////////////////////////////////////////
  83. // Function: BuilderBucketNode::Equivalence operator
  84. // Access: Public
  85. // Description: Returns true if the two buckets are equivalent, based
  86. // on the ordering operator, above.
  87. ////////////////////////////////////////////////////////////////////
  88. INLINE bool BuilderBucketNode::
  89. operator == (const BuilderBucketNode &other) const {
  90. return !((*_bucket) < (*other._bucket) ||
  91. (*other._bucket) < (*_bucket));
  92. }
  93. ////////////////////////////////////////////////////////////////////
  94. // Function: BuilderBucketNode::Nonequivalence operator
  95. // Access: Public
  96. // Description:
  97. ////////////////////////////////////////////////////////////////////
  98. INLINE bool BuilderBucketNode::
  99. operator != (const BuilderBucketNode &other) const {
  100. return !operator == (other);
  101. }