00001 // Filename: builderFuncs.h 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 #ifndef BUILDERFUNCS_H 00019 #define BUILDERFUNCS_H 00020 00021 #include "pandabase.h" 00022 #include "pvector.h" 00023 00024 class BuilderBucket; 00025 class GeomNode; 00026 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: expand 00030 // Description: Receives a single primitive as a BuilderPrim or 00031 // BuilderPrimI object, as input by the user. Does some 00032 // initial processing on the primitive to verify 00033 // internal consistency (for instance, that a quad has 00034 // four vertices), and returns a new BuilderPrim or 00035 // series of BuilderPrim objects, suitable for building 00036 // with. 00037 // 00038 // More than one primitive might be returned because 00039 // higher-order polygons may be broken up into 00040 // triangles, and linestrips and points are broken into 00041 // their component pieces. The output primitives are 00042 // written into the STL container defined by result. 00043 //////////////////////////////////////////////////////////////////// 00044 template <class PrimType, class OutputIterator> 00045 bool 00046 expand(const PrimType &prim, BuilderBucket &bucket, 00047 OutputIterator result); 00048 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: mesh_and_build 00052 // Description: Accepts a list of BuilderPrim or BuilderPrimI 00053 // objects, defined by the iterators first and list, 00054 // runs them through the mesher if specified by the 00055 // bucket, and builds them into the indicated GeomNode. 00056 //////////////////////////////////////////////////////////////////// 00057 template<class InputIterator> 00058 int 00059 mesh_and_build(InputIterator first, InputIterator last, 00060 BuilderBucket &bucket, GeomNode *geom_node); 00061 00062 00063 00064 //////////////////////////////////////////////////////////////////// 00065 // Function: split 00066 // Description: Splits an STL list into two other lists, according to 00067 // the return value from pred. 00068 //////////////////////////////////////////////////////////////////// 00069 template <class InputIterator, class OutputIterator, class Predicate> 00070 OutputIterator split(InputIterator first, InputIterator last, 00071 OutputIterator true_result, OutputIterator false_result, 00072 Predicate pred); 00073 00074 #include "builderFuncs.I" 00075 00076 #endif