00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef COLORWRITEATTRIB_H
00016 #define COLORWRITEATTRIB_H
00017
00018 #include "pandabase.h"
00019
00020 #include "renderAttrib.h"
00021
00022 class FactoryParams;
00023
00024
00025
00026
00027
00028
00029
00030
00031 class EXPCL_PANDA_PGRAPH ColorWriteAttrib : public RenderAttrib {
00032 PUBLISHED:
00033 enum Channels {
00034
00035
00036 C_off = 0x000,
00037 C_red = 0x001,
00038 C_green = 0x002,
00039 C_blue = 0x004,
00040 C_rgb = 0x007,
00041 C_alpha = 0x008,
00042 C_all = 0x00f,
00043 };
00044
00045 private:
00046 INLINE ColorWriteAttrib(unsigned int channels = C_all);
00047
00048 PUBLISHED:
00049 static CPT(RenderAttrib) make(unsigned int channels);
00050 static CPT(RenderAttrib) make_default();
00051
00052 INLINE unsigned int get_channels() const;
00053
00054 public:
00055 virtual void output(ostream &out) const;
00056
00057 protected:
00058 virtual int compare_to_impl(const RenderAttrib *other) const;
00059 virtual size_t get_hash_impl() const;
00060
00061 private:
00062 int _channels;
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 PUBLISHED:
00073 static int get_class_slot() {
00074 return _attrib_slot;
00075 }
00076 virtual int get_slot() const {
00077 return get_class_slot();
00078 }
00079
00080 public:
00081 static TypeHandle get_class_type() {
00082 return _type_handle;
00083 }
00084 static void init_type() {
00085 RenderAttrib::init_type();
00086 register_type(_type_handle, "ColorWriteAttrib",
00087 RenderAttrib::get_class_type());
00088 _attrib_slot = register_slot(_type_handle, 100, make_default);
00089 }
00090 virtual TypeHandle get_type() const {
00091 return get_class_type();
00092 }
00093 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00094
00095 private:
00096 static TypeHandle _type_handle;
00097 static int _attrib_slot;
00098 };
00099
00100 #include "colorWriteAttrib.I"
00101
00102 #endif
00103