00001 // Filename: renderModeAttrib.h 00002 // Created by: drose (14Mar02) 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 RENDERMODEATTRIB_H 00020 #define RENDERMODEATTRIB_H 00021 00022 #include "pandabase.h" 00023 00024 #include "renderAttrib.h" 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : RenderModeAttrib 00028 // Description : Enables or disables writing to the depth buffer. 00029 //////////////////////////////////////////////////////////////////// 00030 class EXPCL_PANDA RenderModeAttrib : public RenderAttrib { 00031 PUBLISHED: 00032 enum Mode { 00033 M_filled, 00034 M_wireframe, 00035 // M_point 00036 00037 // Perhaps others to be added later. 00038 }; 00039 00040 private: 00041 INLINE RenderModeAttrib(Mode mode, float line_width); 00042 00043 PUBLISHED: 00044 static CPT(RenderAttrib) make(Mode mode, float line_width = 1.0f); 00045 00046 INLINE Mode get_mode() const; 00047 INLINE float get_line_width() const; 00048 00049 public: 00050 virtual void issue(GraphicsStateGuardianBase *gsg) const; 00051 virtual void output(ostream &out) const; 00052 00053 protected: 00054 virtual int compare_to_impl(const RenderAttrib *other) const; 00055 virtual RenderAttrib *make_default_impl() const; 00056 00057 private: 00058 Mode _mode; 00059 float _line_width; 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 ¶ms); 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, "RenderModeAttrib", 00076 RenderAttrib::get_class_type()); 00077 } 00078 virtual TypeHandle get_type() const { 00079 return get_class_type(); 00080 } 00081 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00082 00083 private: 00084 static TypeHandle _type_handle; 00085 }; 00086 00087 #include "renderModeAttrib.I" 00088 00089 #endif 00090