Panda3D
antialiasAttrib.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file antialiasAttrib.h
10  * @author drose
11  * @date 2005-01-26
12  */
13 
14 #ifndef ANTIALIASATTRIB_H
15 #define ANTIALIASATTRIB_H
16 
17 #include "pandabase.h"
18 
19 #include "renderAttrib.h"
20 
21 class FactoryParams;
22 
23 /**
24  * Specifies whether or how to enable antialiasing, if supported by the
25  * backend renderer.
26  */
27 class EXPCL_PANDA_PGRAPH AntialiasAttrib : public RenderAttrib {
28 PUBLISHED:
29  enum Mode {
30  M_none = 0x0000,
31  M_point = 0x0001,
32  M_line = 0x0002,
33  M_polygon = 0x0004,
34  M_multisample = 0x0008,
35  M_auto = 0x001f,
36  M_type_mask = 0x001f,
37 
38  // Extra add-on bits for performancequality hints.
39  M_faster = 0x0020,
40  M_better = 0x0040,
41  M_dont_care = 0x0060,
42  };
43 
44 private:
45  INLINE AntialiasAttrib(unsigned short mode);
46 
47 PUBLISHED:
48  static CPT(RenderAttrib) make(unsigned short mode);
49  static CPT(RenderAttrib) make_default();
50 
51  INLINE unsigned short get_mode() const;
52  INLINE unsigned short get_mode_type() const;
53  INLINE unsigned short get_mode_quality() const;
54 
55 PUBLISHED:
56  MAKE_PROPERTY(mode, get_mode);
57  MAKE_PROPERTY(mode_type, get_mode_type);
58  MAKE_PROPERTY(mode_quality, get_mode_quality);
59 
60 public:
61  virtual void output(std::ostream &out) const;
62 
63 protected:
64  virtual int compare_to_impl(const RenderAttrib *other) const;
65  virtual size_t get_hash_impl() const;
66  virtual CPT(RenderAttrib) compose_impl(const RenderAttrib *other) const;
67 
68 private:
69  unsigned short _mode;
70 
71 PUBLISHED:
72  static int get_class_slot() {
73  return _attrib_slot;
74  }
75  virtual int get_slot() const {
76  return get_class_slot();
77  }
78  MAKE_PROPERTY(class_slot, get_class_slot);
79 
80 public:
81  static void register_with_read_factory();
82  virtual void write_datagram(BamWriter *manager, Datagram &dg);
83 
84 protected:
85  static TypedWritable *make_from_bam(const FactoryParams &params);
86  void fillin(DatagramIterator &scan, BamReader *manager);
87 
88 public:
89  static TypeHandle get_class_type() {
90  return _type_handle;
91  }
92  static void init_type();
93  virtual TypeHandle get_type() const {
94  return get_class_type();
95  }
96  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
97 
98 private:
99  static TypeHandle _type_handle;
100  static int _attrib_slot;
101 };
102 
103 #include "antialiasAttrib.I"
104 
105 #endif
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Definition: renderAttrib.h:51
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
Specifies whether or how to enable antialiasing, if supported by the backend renderer.
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38