Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/builder/builderBucket.h

Go to the documentation of this file.
00001 // Filename: builderBucket.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 
00019 #ifndef BUILDERBUCKET_H
00020 #define BUILDERBUCKET_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "builderProperties.h"
00025 
00026 #include "namable.h"
00027 #include "pointerToArray.h"
00028 #include "luse.h"
00029 #include "pta_Vertexf.h"
00030 #include "pta_Normalf.h"
00031 #include "pta_Colorf.h"
00032 #include "pta_TexCoordf.h"
00033 #include "renderState.h"
00034 
00035 #include "stdlib.h"
00036 
00037 class Geom;
00038 class PandaNode;
00039 class GeomNode;
00040 
00041 ///////////////////////////////////////////////////////////////////
00042 //       Class : BuilderBucket
00043 // Description : The main grouping tool for BuilderPrims.  See the
00044 //               comments at the beginning of builder.h.
00045 //
00046 //               As each primitive is added to the builder, it is
00047 //               associated with a bucket.  The bucket stores the
00048 //               scene-graph properties of the primitive, and is used
00049 //               to identify primitives that have the same properties
00050 //               and thus may be joined into a common triangle strip.
00051 //
00052 //               This grouping is done via the ordering operator, <,
00053 //               which defines an arbitrary ordering for buckets and
00054 //               identifies those buckets which are equivalent to each
00055 //               other.  By subclassing off of BuilderBucket and
00056 //               redefining this operator, you can change the grouping
00057 //               behavior to suit your needs, if necessary.
00058 ////////////////////////////////////////////////////////////////////
00059 class EXPCL_PANDAEGG BuilderBucket : public BuilderProperties, public Namable {
00060 public:
00061   BuilderBucket();
00062   BuilderBucket(const BuilderBucket &copy);
00063   BuilderBucket &operator = (const BuilderBucket &copy);
00064   virtual ~BuilderBucket();
00065 
00066   virtual BuilderBucket *make_copy() const;
00067   virtual GeomNode *make_geom_node();
00068   virtual Geom *done_geom(Geom *geom);
00069   void add_attrib(const RenderAttrib *attrib);
00070 
00071   virtual bool operator < (const BuilderBucket &other) const;
00072 
00073   INLINE void set_coords(const PTA_Vertexf &coords);
00074   INLINE PTA_Vertexf get_coords() const;
00075 
00076   INLINE void set_normals(const PTA_Normalf &normals);
00077   INLINE PTA_Normalf get_normals() const;
00078 
00079   INLINE void set_texcoords(const PTA_TexCoordf &texcoords);
00080   INLINE PTA_TexCoordf get_texcoords() const;
00081 
00082   INLINE void set_colors(const PTA_Colorf &colors);
00083   INLINE PTA_Colorf get_colors() const;
00084 
00085   INLINE static BuilderBucket *get_default_bucket();
00086 
00087   virtual void output(ostream &out) const;
00088 
00089   PandaNode *_node;
00090 
00091   short _drawBin;
00092   unsigned int _drawOrder;
00093 
00094   CPT(RenderState) _state;
00095 
00096 protected:
00097   PTA_Vertexf _coords;
00098   PTA_Normalf _normals;
00099   PTA_TexCoordf _texcoords;
00100   PTA_Colorf _colors;
00101 
00102   static BuilderBucket *_default_bucket;
00103 
00104 private:
00105   BuilderBucket(int);
00106 };
00107 
00108 INLINE ostream &operator << (ostream &out, const BuilderBucket &bucket) {
00109   bucket.output(out);
00110   return out;
00111 }
00112 
00113 #include "builderBucket.I"
00114 
00115 #endif
00116 

Generated on Fri May 2 00:34:41 2003 for Panda by doxygen1.3