00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
00031
00032
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 ¶ms);
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