Panda3D

antialiasAttrib.h

00001 // Filename: antialiasAttrib.h
00002 // Created by:  drose (26Jan05)
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 ANTIALIASATTRIB_H
00016 #define ANTIALIASATTRIB_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "renderAttrib.h"
00021 
00022 class FactoryParams;
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //       Class : AntialiasAttrib
00026 // Description : Specifies whether or how to enable antialiasing, if
00027 //               supported by the backend renderer.
00028 ////////////////////////////////////////////////////////////////////
00029 class EXPCL_PANDA_PGRAPH AntialiasAttrib : public RenderAttrib {
00030 PUBLISHED:
00031   enum Mode {
00032     M_none        = 0x0000,
00033     M_point       = 0x0001,
00034     M_line        = 0x0002,
00035     M_polygon     = 0x0004,
00036     M_multisample = 0x0008,
00037     M_auto        = 0x001f,
00038     M_type_mask   = 0x001f,
00039 
00040     // Extra add-on bits for performance/quality hints.
00041     M_faster      = 0x0020,
00042     M_better      = 0x0040,
00043     M_dont_care   = 0x0060,
00044   };
00045 
00046 private:
00047   INLINE AntialiasAttrib(unsigned short mode);
00048 
00049 PUBLISHED:
00050   static CPT(RenderAttrib) make(unsigned short mode);
00051   static CPT(RenderAttrib) make_default();
00052 
00053   INLINE unsigned short get_mode() const;
00054   INLINE unsigned short get_mode_type() const;
00055   INLINE unsigned short get_mode_quality() const;
00056 
00057 public:
00058   virtual void output(ostream &out) const;
00059 
00060 protected:
00061   virtual int compare_to_impl(const RenderAttrib *other) const;
00062   virtual CPT(RenderAttrib) compose_impl(const RenderAttrib *other) const;
00063 
00064 private:
00065   unsigned short _mode;
00066 
00067 PUBLISHED:
00068   static int get_class_slot() {
00069     return _attrib_slot;
00070   }
00071   virtual int get_slot() const {
00072     return get_class_slot();
00073   }
00074 
00075 public:
00076   static void register_with_read_factory();
00077   virtual void write_datagram(BamWriter *manager, Datagram &dg);
00078 
00079 protected:
00080   static TypedWritable *make_from_bam(const FactoryParams &params);
00081   void fillin(DatagramIterator &scan, BamReader *manager);
00082   
00083 public:
00084   static TypeHandle get_class_type() {
00085     return _type_handle;
00086   }
00087   static void init_type() {
00088     RenderAttrib::init_type();
00089     register_type(_type_handle, "AntialiasAttrib",
00090                   RenderAttrib::get_class_type());
00091     _attrib_slot = register_slot(_type_handle, 100, make_default);
00092   }
00093   virtual TypeHandle get_type() const {
00094     return get_class_type();
00095   }
00096   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00097 
00098 private:
00099   static TypeHandle _type_handle;
00100   static int _attrib_slot;
00101 };
00102 
00103 #include "antialiasAttrib.I"
00104 
00105 #endif
00106 
 All Classes Functions Variables Enumerations