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 size_t get_hash_impl() const;
00063   virtual CPT(RenderAttrib) compose_impl(const RenderAttrib *other) const;
00064 
00065 private:
00066   unsigned short _mode;
00067 
00068 PUBLISHED:
00069   static int get_class_slot() {
00070     return _attrib_slot;
00071   }
00072   virtual int get_slot() const {
00073     return get_class_slot();
00074   }
00075 
00076 public:
00077   static void register_with_read_factory();
00078   virtual void write_datagram(BamWriter *manager, Datagram &dg);
00079 
00080 protected:
00081   static TypedWritable *make_from_bam(const FactoryParams &params);
00082   void fillin(DatagramIterator &scan, BamReader *manager);
00083   
00084 public:
00085   static TypeHandle get_class_type() {
00086     return _type_handle;
00087   }
00088   static void init_type() {
00089     RenderAttrib::init_type();
00090     register_type(_type_handle, "AntialiasAttrib",
00091                   RenderAttrib::get_class_type());
00092     _attrib_slot = register_slot(_type_handle, 100, make_default);
00093   }
00094   virtual TypeHandle get_type() const {
00095     return get_class_type();
00096   }
00097   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00098 
00099 private:
00100   static TypeHandle _type_handle;
00101   static int _attrib_slot;
00102 };
00103 
00104 #include "antialiasAttrib.I"
00105 
00106 #endif
00107 
 All Classes Functions Variables Enumerations