Panda3D

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 
00050 private:
00051   Mode _mode;
00052 
00053 PUBLISHED:
00054   static int get_class_slot() {
00055     return _attrib_slot;
00056   }
00057   virtual int get_slot() const {
00058     return get_class_slot();
00059   }
00060 
00061 public:
00062   static void register_with_read_factory();
00063   virtual void write_datagram(BamWriter *manager, Datagram &dg);
00064 
00065 protected:
00066   static TypedWritable *make_from_bam(const FactoryParams &params);
00067   void fillin(DatagramIterator &scan, BamReader *manager);
00068   
00069 public:
00070   static TypeHandle get_class_type() {
00071     return _type_handle;
00072   }
00073   static void init_type() {
00074     RenderAttrib::init_type();
00075     register_type(_type_handle, "DepthWriteAttrib",
00076                   RenderAttrib::get_class_type());
00077     _attrib_slot = register_slot(_type_handle, 100, make_default);
00078   }
00079   virtual TypeHandle get_type() const {
00080     return get_class_type();
00081   }
00082   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00083 
00084 private:
00085   static TypeHandle _type_handle;
00086   static int _attrib_slot;
00087 };
00088 
00089 #include "depthWriteAttrib.I"
00090 
00091 #endif
00092 
 All Classes Functions Variables Enumerations