00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef RENDERMODEATTRIB_H
00016 #define RENDERMODEATTRIB_H
00017
00018 #include "pandabase.h"
00019
00020 #include "renderAttrib.h"
00021 #include "geom.h"
00022
00023 class FactoryParams;
00024
00025
00026
00027
00028
00029 class EXPCL_PANDA_PGRAPH RenderModeAttrib : public RenderAttrib {
00030 PUBLISHED:
00031 enum Mode {
00032 M_unchanged,
00033
00034
00035 M_filled,
00036
00037
00038 M_wireframe,
00039
00040
00041
00042 M_point,
00043
00044
00045
00046
00047 M_filled_flat
00048 };
00049
00050 private:
00051 INLINE RenderModeAttrib(Mode mode, PN_stdfloat thickness, bool perspective);
00052
00053 PUBLISHED:
00054 static CPT(RenderAttrib) make(Mode mode, PN_stdfloat thickness = 1.0f,
00055 bool perspective = false);
00056 static CPT(RenderAttrib) make_default();
00057
00058 INLINE Mode get_mode() const;
00059 INLINE PN_stdfloat get_thickness() const;
00060 INLINE bool get_perspective() const;
00061
00062 INLINE int get_geom_rendering(int geom_rendering) const;
00063
00064 public:
00065 virtual void output(ostream &out) const;
00066
00067 protected:
00068 virtual int compare_to_impl(const RenderAttrib *other) const;
00069 virtual size_t get_hash_impl() const;
00070 virtual CPT(RenderAttrib) compose_impl(const RenderAttrib *other) const;
00071
00072 private:
00073 Mode _mode;
00074 PN_stdfloat _thickness;
00075 bool _perspective;
00076
00077 PUBLISHED:
00078 static int get_class_slot() {
00079 return _attrib_slot;
00080 }
00081 virtual int get_slot() const {
00082 return get_class_slot();
00083 }
00084
00085 public:
00086 static void register_with_read_factory();
00087 virtual void write_datagram(BamWriter *manager, Datagram &dg);
00088
00089 protected:
00090 static TypedWritable *make_from_bam(const FactoryParams ¶ms);
00091 void fillin(DatagramIterator &scan, BamReader *manager);
00092
00093 public:
00094 static TypeHandle get_class_type() {
00095 return _type_handle;
00096 }
00097 static void init_type() {
00098 RenderAttrib::init_type();
00099 register_type(_type_handle, "RenderModeAttrib",
00100 RenderAttrib::get_class_type());
00101 _attrib_slot = register_slot(_type_handle, 100, make_default);
00102 }
00103 virtual TypeHandle get_type() const {
00104 return get_class_type();
00105 }
00106 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00107
00108 private:
00109 static TypeHandle _type_handle;
00110 static int _attrib_slot;
00111 };
00112
00113 #include "renderModeAttrib.I"
00114
00115 #endif
00116