00001 // Filename: builderBucketNode.I 00002 // Created by: drose (10Sep97) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 00021 //////////////////////////////////////////////////////////////////// 00022 // Function: BuilderBucketNode::Constructor 00023 // Access: Public 00024 // Description: 00025 //////////////////////////////////////////////////////////////////// 00026 INLINE BuilderBucketNode:: 00027 BuilderBucketNode(BuilderBucket *bucket) : _bucket(bucket) { 00028 } 00029 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: BuilderBucketNode::Copy constructor 00033 // Access: Public 00034 // Description: 00035 //////////////////////////////////////////////////////////////////// 00036 INLINE BuilderBucketNode:: 00037 BuilderBucketNode(const BuilderBucketNode ©) { 00038 (*this) = copy; 00039 } 00040 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: BuilderBucketNode::Copy assignment operator 00044 // Access: Public 00045 // Description: 00046 //////////////////////////////////////////////////////////////////// 00047 INLINE void BuilderBucketNode:: 00048 operator = (const BuilderBucketNode ©) { 00049 _bucket = copy._bucket; 00050 _prims = copy._prims; 00051 _iprims = copy._iprims; 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: BuilderBucketNode::add_prim_nonindexed 00056 // Access: Public 00057 // Description: Adds the indicated indexed primitive to the bucket as 00058 // if it were nonindexed, and returns true if the 00059 // primitive was valid. Intended to be called from 00060 // Builder::add_prim_nonindexed(). 00061 //////////////////////////////////////////////////////////////////// 00062 INLINE bool BuilderBucketNode:: 00063 add_prim_nonindexed(const BuilderPrimI &prim) { 00064 BuilderPrim nonindexed; 00065 nonindexed.nonindexed_copy(prim, *_bucket); 00066 return add_prim(nonindexed); 00067 } 00068 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: BuilderBucketNode::get_bucket 00072 // Access: Public 00073 // Description: Returns the BuilderBucket object associated with this 00074 // node. 00075 //////////////////////////////////////////////////////////////////// 00076 INLINE BuilderBucket *BuilderBucketNode:: 00077 get_bucket() const { 00078 return _bucket; 00079 } 00080 00081 //////////////////////////////////////////////////////////////////// 00082 // Function: BuilderBucketNode::Ordering operator 00083 // Access: Public 00084 // Description: Returns true if this bucket precedes the indicated 00085 // one in ordering. This function is used by the STL 00086 // set in the Builder object to sort buckets into order, 00087 // and to collect similar buckets together. 00088 //////////////////////////////////////////////////////////////////// 00089 INLINE bool BuilderBucketNode:: 00090 operator < (const BuilderBucketNode &other) const { 00091 return (*_bucket) < (*other._bucket); 00092 } 00093 00094 00095 //////////////////////////////////////////////////////////////////// 00096 // Function: BuilderBucketNode::Equivalence operator 00097 // Access: Public 00098 // Description: Returns true if the two buckets are equivalent, based 00099 // on the ordering operator, above. 00100 //////////////////////////////////////////////////////////////////// 00101 INLINE bool BuilderBucketNode:: 00102 operator == (const BuilderBucketNode &other) const { 00103 return !((*_bucket) < (*other._bucket) || 00104 (*other._bucket) < (*_bucket)); 00105 } 00106 00107 //////////////////////////////////////////////////////////////////// 00108 // Function: BuilderBucketNode::Nonequivalence operator 00109 // Access: Public 00110 // Description: 00111 //////////////////////////////////////////////////////////////////// 00112 INLINE bool BuilderBucketNode:: 00113 operator != (const BuilderBucketNode &other) const { 00114 return !operator == (other); 00115 }