Panda3D
|
00001 // Filename: depthTestAttrib.h 00002 // Created by: drose (04Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef DEPTHTESTATTRIB_H 00016 #define DEPTHTESTATTRIB_H 00017 00018 #include "pandabase.h" 00019 00020 #include "renderAttrib.h" 00021 00022 class FactoryParams; 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : DepthTestAttrib 00026 // Description : Enables or disables writing to the depth buffer. 00027 //////////////////////////////////////////////////////////////////// 00028 class EXPCL_PANDA_PGRAPH DepthTestAttrib : public RenderAttrib { 00029 private: 00030 INLINE DepthTestAttrib(PandaCompareFunc mode = M_less); 00031 00032 PUBLISHED: 00033 static CPT(RenderAttrib) make(PandaCompareFunc mode); 00034 static CPT(RenderAttrib) make_default(); 00035 00036 INLINE PandaCompareFunc get_mode() const; 00037 00038 public: 00039 virtual void output(ostream &out) const; 00040 00041 protected: 00042 virtual int compare_to_impl(const RenderAttrib *other) const; 00043 00044 private: 00045 PandaCompareFunc _mode; 00046 00047 PUBLISHED: 00048 static int get_class_slot() { 00049 return _attrib_slot; 00050 } 00051 virtual int get_slot() const { 00052 return get_class_slot(); 00053 } 00054 00055 public: 00056 static void register_with_read_factory(); 00057 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00058 00059 protected: 00060 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00061 void fillin(DatagramIterator &scan, BamReader *manager); 00062 00063 public: 00064 static TypeHandle get_class_type() { 00065 return _type_handle; 00066 } 00067 static void init_type() { 00068 RenderAttrib::init_type(); 00069 register_type(_type_handle, "DepthTestAttrib", 00070 RenderAttrib::get_class_type()); 00071 _attrib_slot = register_slot(_type_handle, 100, make_default); 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 static int _attrib_slot; 00081 }; 00082 00083 #include "depthTestAttrib.I" 00084 00085 #endif 00086