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

panda/src/gsgmisc/geomIssuer.h

Go to the documentation of this file.
00001 // Filename: geomIssuer.h
00002 // Created by:  drose (03Feb99)
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 GEOMISSUER_H
00020 #define GEOMISSUER_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "luse.h"
00025 #include "typedef.h"
00026 #include "geom.h"
00027 
00028 class GraphicsStateGuardianBase;
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //       Class : GeomIssuer
00032 // Description : This is a utility class used by the various
00033 //               GraphicsStateGuardians to issue the vertex/normal/etc
00034 //               commands to the rendering engine.  Given a geom and a
00035 //               gsg, as well as a set of functions that actually do
00036 //               the work of issuing vertices etc. to the rendering
00037 //               backend, it configures itself so that subsequent
00038 //               calls to issue_normal() (for instance) will either do
00039 //               nothing or issue a normal, depending on whether the
00040 //               requested binding type matches the geom's actual
00041 //               binding type for normals, and on whether vertices are
00042 //               required by the current state.
00043 ////////////////////////////////////////////////////////////////////
00044 class EXPCL_PANDA GeomIssuer {
00045 public:
00046 
00047   // Declare some function types.  This declares several typenames
00048   // which are pointers to function types--these are not themselves
00049   // functions.  A function pointed to by a variable of this type,
00050   // when given a Geom and an associated iterator, will issue the
00051   // vertex (or whatever) referenced by the iterator to the rendering
00052   // backend, and increment the iterator.
00053   typedef void IssueVertex(const Geom *, Geom::VertexIterator &, GraphicsStateGuardianBase *gsg);
00054   typedef void IssueNormal(const Geom *, Geom::NormalIterator &, GraphicsStateGuardianBase *gsg);
00055   typedef void IssueTexCoord(const Geom *, Geom::TexCoordIterator &, GraphicsStateGuardianBase *gsg);
00056   typedef void IssueColor(const Geom *, Geom::ColorIterator &, GraphicsStateGuardianBase *gsg);
00057 
00058   GeomIssuer();
00059   GeomIssuer(const Geom *geom,
00060              GraphicsStateGuardianBase *gsg,
00061              IssueVertex *vertex,
00062              IssueNormal *normal,
00063              IssueTexCoord *texcoord,
00064              IssueColor *color);
00065 
00066   INLINE void issue_vertex(GeomBindType bind,
00067                            Geom::VertexIterator &i);
00068   INLINE void issue_normal(GeomBindType bind,
00069                            Geom::NormalIterator &i);
00070   INLINE void issue_texcoord(GeomBindType bind,
00071                              Geom::TexCoordIterator &i);
00072   INLINE void issue_color(GeomBindType bind,
00073                           Geom::ColorIterator &i);
00074 
00075 protected:
00076   const Geom *_geom;
00077   GraphicsStateGuardianBase *_gsg;
00078   IssueVertex *_vertex_command[num_GeomBindTypes];
00079   IssueNormal *_normal_command[num_GeomBindTypes];
00080   IssueTexCoord *_texcoord_command[num_GeomBindTypes];
00081   IssueColor *_color_command[num_GeomBindTypes];
00082 };
00083 
00084 #include "geomIssuer.I"
00085 
00086 #endif

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