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 virtual size_t get_hash_impl() const; 00044 00045 private: 00046 PandaCompareFunc _mode; 00047 00048 PUBLISHED: 00049 static int get_class_slot() { 00050 return _attrib_slot; 00051 } 00052 virtual int get_slot() const { 00053 return get_class_slot(); 00054 } 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, "DepthTestAttrib", 00071 RenderAttrib::get_class_type()); 00072 _attrib_slot = register_slot(_type_handle, 100, make_default); 00073 } 00074 virtual TypeHandle get_type() const { 00075 return get_class_type(); 00076 } 00077 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00078 00079 private: 00080 static TypeHandle _type_handle; 00081 static int _attrib_slot; 00082 }; 00083 00084 #include "depthTestAttrib.I" 00085 00086 #endif 00087