00001 // Filename: builder.I 00002 // Created by: drose (09Sep97) 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: Builder::add_prim 00023 // Access: Public 00024 // Description: Adds the indicated nonindexed primitive, along with 00025 // its associated bucket, to the builder's internal 00026 // structures. This copies all relevant information 00027 // into the builder. 00028 // 00029 // Returns true if the primitive was successfully added, 00030 // false if it was invalid for some reason (for 00031 // instance, a polygon with two vertices). 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE bool Builder:: 00034 add_prim(const BuilderBucket &bucket, 00035 const BuilderPrim &prim) { 00036 add_bucket(bucket); 00037 return ((BuilderBucketNode &)(*_bi)).add_prim(prim); 00038 } 00039 00040 00041 //////////////////////////////////////////////////////////////////// 00042 // Function: Builder::add_prim 00043 // Access: Public 00044 // Description: Adds the indicated indexed primitive, along with 00045 // its associated bucket, to the builder's internal 00046 // structures. This copies all relevant information 00047 // into the builder. 00048 // 00049 // Returns true if the primitive was successfully added, 00050 // false if it was invalid for some reason (for 00051 // instance, a polygon with two vertices). 00052 //////////////////////////////////////////////////////////////////// 00053 INLINE bool Builder:: 00054 add_prim(const BuilderBucket &bucket, 00055 const BuilderPrimI &prim) { 00056 add_bucket(bucket); 00057 return ((BuilderBucketNode &)(*_bi)).add_prim(prim); 00058 } 00059 00060 00061 //////////////////////////////////////////////////////////////////// 00062 // Function: Builder::add_prim_nonindexed 00063 // Access: Public 00064 // Description: Adds the specified indexed primitive as if it were 00065 // nonindexed. This simply looks up each coordinate 00066 // value on the prim in its associated array and stores 00067 // a nonindexed primitive with the actual coordinate 00068 // values, instead of the index numbers. 00069 // 00070 // This is handy for having code that calls the builder 00071 // and might want to build either indexed or nonindexed 00072 // geometry, as selected by the user at run-time. 00073 // Simply build indexed geometry in all cases, then call 00074 // either add_prim or add_prim_nonindexed, according to 00075 // the user's selection. 00076 //////////////////////////////////////////////////////////////////// 00077 INLINE bool Builder:: 00078 add_prim_nonindexed(const BuilderBucket &bucket, 00079 const BuilderPrimI &prim) { 00080 add_bucket(bucket); 00081 return ((BuilderBucketNode &)(*_bi)).add_prim_nonindexed(prim); 00082 }