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