00001 // Filename: colorWriteAttrib.h 00002 // Created by: drose (04Mar02) 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 COLORWRITEATTRIB_H 00020 #define COLORWRITEATTRIB_H 00021 00022 #include "pandabase.h" 00023 00024 #include "renderAttrib.h" 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : ColorWriteAttrib 00028 // Description : Enables or disables writing to the color buffer. 00029 // This is primarily useful for certain special effects 00030 // in which it is important to write to the depth buffer 00031 // without affecting the color buffer. 00032 //////////////////////////////////////////////////////////////////// 00033 class EXPCL_PANDA ColorWriteAttrib : public RenderAttrib { 00034 PUBLISHED: 00035 enum Mode { 00036 M_off, 00037 M_on 00038 }; 00039 00040 private: 00041 INLINE ColorWriteAttrib(Mode mode = M_on); 00042 00043 PUBLISHED: 00044 static CPT(RenderAttrib) make(Mode mode); 00045 00046 INLINE Mode get_mode() const; 00047 00048 public: 00049 virtual void issue(GraphicsStateGuardianBase *gsg) const; 00050 virtual void output(ostream &out) const; 00051 00052 protected: 00053 virtual int compare_to_impl(const RenderAttrib *other) const; 00054 virtual RenderAttrib *make_default_impl() const; 00055 00056 private: 00057 Mode _mode; 00058 00059 public: 00060 static void register_with_read_factory(); 00061 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00062 00063 protected: 00064 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00065 void fillin(DatagramIterator &scan, BamReader *manager); 00066 00067 public: 00068 static TypeHandle get_class_type() { 00069 return _type_handle; 00070 } 00071 static void init_type() { 00072 RenderAttrib::init_type(); 00073 register_type(_type_handle, "ColorWriteAttrib", 00074 RenderAttrib::get_class_type()); 00075 } 00076 virtual TypeHandle get_type() const { 00077 return get_class_type(); 00078 } 00079 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00080 00081 private: 00082 static TypeHandle _type_handle; 00083 }; 00084 00085 #include "colorWriteAttrib.I" 00086 00087 #endif 00088