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

panda/src/pgraph/colorAttrib.h

Go to the documentation of this file.
00001 // Filename: colorAttrib.h
00002 // Created by:  drose (22Feb02)
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 COLORATTRIB_H
00020 #define COLORATTRIB_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "renderAttrib.h"
00025 #include "luse.h"
00026 
00027 class FactoryParams;
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //       Class : ColorAttrib
00031 // Description : Indicates what color should be applied to renderable
00032 //               geometry.
00033 ////////////////////////////////////////////////////////////////////
00034 class EXPCL_PANDA ColorAttrib : public RenderAttrib {
00035 PUBLISHED:
00036   enum Type {
00037     T_vertex, T_flat, T_off
00038   };
00039 
00040 private:
00041   INLINE ColorAttrib(Type type = T_vertex, 
00042                      const Colorf &color = Colorf(0.0f, 0.0f, 0.0f, 1.0f));
00043 
00044 PUBLISHED:
00045   static CPT(RenderAttrib) make_vertex();
00046   static CPT(RenderAttrib) make_flat(const Colorf &color);
00047   static CPT(RenderAttrib) make_off();
00048 
00049   INLINE Type get_color_type() const;
00050   INLINE const Colorf &get_color() const;
00051 
00052 public:
00053   virtual void issue(GraphicsStateGuardianBase *gsg) const;
00054   virtual void output(ostream &out) const;
00055 
00056 protected:
00057   virtual int compare_to_impl(const RenderAttrib *other) const;
00058   virtual RenderAttrib *make_default_impl() const;
00059 
00060 private:
00061   Type _type;
00062   Colorf _color;
00063 
00064 public:
00065   static void register_with_read_factory();
00066   virtual void write_datagram(BamWriter *manager, Datagram &dg);
00067 
00068 protected:
00069   static TypedWritable *make_from_bam(const FactoryParams &params);
00070   void fillin(DatagramIterator &scan, BamReader *manager);
00071   
00072 public:
00073   static TypeHandle get_class_type() {
00074     return _type_handle;
00075   }
00076   static void init_type() {
00077     RenderAttrib::init_type();
00078     register_type(_type_handle, "ColorAttrib",
00079                   RenderAttrib::get_class_type());
00080   }
00081   virtual TypeHandle get_type() const {
00082     return get_class_type();
00083   }
00084   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00085 
00086 private:
00087   static TypeHandle _type_handle;
00088 };
00089 
00090 #include "colorAttrib.I"
00091 
00092 #endif
00093 

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