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

panda/src/builder/builderVertex.h

Go to the documentation of this file.
00001 // Filename: builderVertex.h
00002 // Created by:  drose (18Sep97)
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 BUILDERVERTEX_H
00020 #define BUILDERVERTEX_H
00021 
00022 ///////////////////////////////////////////////////////////////////
00023 //
00024 // BuilderVertex, BuilderVertexI
00025 //
00026 // The basic class for passing vertex values to the builder.  See the
00027 // comments at the beginning of builder.h and builderPrim.h.
00028 //
00029 // Like BuilderPrim, the BuilderVertex and BuilderVertexI classes are
00030 // actually two different instantiations of the same template class,
00031 // BuilderVertexTempl.  The difference is in the types of the
00032 // attribute values for the four kinds of attributes: vertices
00033 // (coords), normals, texture coordinates, and colors.  BuilderVertex
00034 // specifies Coordf, Normalf, TexCoordf, and Colorf for each of these
00035 // (actually, it's BuilderV, BuilderN, BuilderTC, and BuilderC, which
00036 // are simply wrappers around the above types), while BuilderVertexI
00037 // specifies ushort for all of them.
00038 //
00039 // It is this templating that drives the whole indexed/nonindexed
00040 // support in this package and in the mesher.  The two kinds of
00041 // BuilderVertex are designed to present largely the same interface,
00042 // regardless of whether its component values are actual vector
00043 // values, or simply index numbers.  Lots of things, therefore, can
00044 // template on the BuilderPrim type (which in turn termplates on the
00045 // BuilderVertex type) and thus easily support both indexed and
00046 // nonindexed geometry.
00047 //
00048 ///////////////////////////////////////////////////////////////////
00049 
00050 #include <pandabase.h>
00051 
00052 #include "builderAttrib.h"
00053 #include "builderVertexTempl.h"
00054 #include "builderBucket.h"
00055 
00056 // We need to define this temporary macro so we can pass a parameter
00057 // containing a comma through the macro.
00058 #define BUILDERVERTEXTEMPL_BUILDERV BuilderVertexTempl<BuilderV, BuilderN, BuilderTC, BuilderC>
00059 EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, BUILDERVERTEXTEMPL_BUILDERV);
00060 #define BUILDERVERTEXTEMPL_USHORT BuilderVertexTempl<ushort, ushort, ushort, ushort>
00061 EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, BUILDERVERTEXTEMPL_USHORT);
00062 
00063 /////////////////////////////////////////////////////////////////////
00064 //       Class : BuilderVertex
00065 // Description : The basic class for passing nonindexed vertices to
00066 //               the builder.  See the comments at the the head of
00067 //               this file, and in builder.h.
00068 //
00069 //               Look in builderVertexTempl.h and builderAttribTempl.h
00070 //               for most of the interface to BuilderVertex.
00071 ////////////////////////////////////////////////////////////////////
00072 class EXPCL_PANDAEGG BuilderVertex
00073   : public BuilderVertexTempl<BuilderV, BuilderN, BuilderTC, BuilderC> {
00074 public:
00075   typedef BuilderAttrib Attrib;
00076 
00077   BuilderVertex() {}
00078   BuilderVertex(const BuilderV &c) :
00079     BuilderVertexTempl<BuilderV, BuilderN, BuilderTC, BuilderC>(c) {}
00080 
00081   INLINE void set_coord_value(const BuilderV *array, ushort index);
00082   INLINE void set_normal_value(const BuilderN *array, ushort index);
00083   INLINE void set_texcoord_value(const BuilderTC *array, ushort index);
00084   INLINE void set_color_value(const BuilderC *array, ushort index);
00085 
00086   INLINE BuilderV get_coord_value(const BuilderBucket &bucket) const;
00087   INLINE BuilderN get_normal_value(const BuilderBucket &bucket) const;
00088   INLINE BuilderTC get_texcoord_value(const BuilderBucket &bucket) const;
00089   INLINE BuilderC get_color_value(const BuilderBucket &bucket) const;
00090 
00091 };
00092 
00093 
00094 /////////////////////////////////////////////////////////////////////
00095 //       Class : BuilderVertexI
00096 // Description : The basic class for passing indexed vertices to the
00097 //               builder.  See the comments at the the head of this
00098 //               file, and in builder.h.
00099 //
00100 //               Look in builderVertexTempl.h and builderAttribTempl.h
00101 //               for most of the interface to BuilderVertex.
00102 ////////////////////////////////////////////////////////////////////
00103 class EXPCL_PANDAEGG BuilderVertexI
00104   : public BuilderVertexTempl<ushort, ushort, ushort, ushort> {
00105 public:
00106   typedef BuilderAttribI Attrib;
00107 
00108   BuilderVertexI() {}
00109   BuilderVertexI(ushort c) :
00110     BuilderVertexTempl<ushort, ushort, ushort, ushort>(c) {}
00111 
00112   INLINE void set_coord_value(const BuilderV *array, ushort index);
00113   INLINE void set_normal_value(const BuilderN *array, ushort index);
00114   INLINE void set_texcoord_value(const BuilderTC *array, ushort index);
00115   INLINE void set_color_value(const BuilderC *array, ushort index);
00116 
00117   INLINE BuilderV get_coord_value(const BuilderBucket &bucket) const;
00118   INLINE BuilderN get_normal_value(const BuilderBucket &bucket) const;
00119   INLINE BuilderTC get_texcoord_value(const BuilderBucket &bucket) const;
00120   INLINE BuilderC get_color_value(const BuilderBucket &bucket) const;
00121 };
00122 
00123 #include "builderVertex.I"
00124 
00125 // Tell GCC that we'll take care of the instantiation explicitly here.
00126 #ifdef __GNUC__
00127 #pragma interface
00128 #endif
00129 
00130 #endif
00131 
00132 

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