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