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