00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef CULLFACEATTRIB_H
00016 #define CULLFACEATTRIB_H
00017
00018 #include "pandabase.h"
00019
00020 #include "renderAttrib.h"
00021
00022 class FactoryParams;
00023
00024
00025
00026
00027
00028
00029 class EXPCL_PANDA_PGRAPH CullFaceAttrib : public RenderAttrib {
00030 PUBLISHED:
00031 enum Mode {
00032 M_cull_none,
00033 M_cull_clockwise,
00034 M_cull_counter_clockwise,
00035 M_cull_unchanged,
00036 };
00037
00038 private:
00039 INLINE CullFaceAttrib(Mode mode, bool reverse);
00040
00041 PUBLISHED:
00042 static CPT(RenderAttrib) make(Mode mode = M_cull_clockwise);
00043 static CPT(RenderAttrib) make_reverse();
00044 static CPT(RenderAttrib) make_default();
00045
00046 INLINE Mode get_actual_mode() const;
00047 INLINE bool get_reverse() const;
00048 Mode get_effective_mode() const;
00049
00050 public:
00051 virtual void output(ostream &out) const;
00052
00053 protected:
00054 virtual int compare_to_impl(const RenderAttrib *other) const;
00055 virtual size_t get_hash_impl() const;
00056 virtual CPT(RenderAttrib) compose_impl(const RenderAttrib *other) const;
00057 virtual CPT(RenderAttrib) invert_compose_impl(const RenderAttrib *other) const;
00058
00059 private:
00060 Mode _mode;
00061 bool _reverse;
00062
00063 PUBLISHED:
00064 static int get_class_slot() {
00065 return _attrib_slot;
00066 }
00067 virtual int get_slot() const {
00068 return get_class_slot();
00069 }
00070
00071 public:
00072 static void register_with_read_factory();
00073 virtual void write_datagram(BamWriter *manager, Datagram &dg);
00074
00075 protected:
00076 static TypedWritable *make_from_bam(const FactoryParams ¶ms);
00077 void fillin(DatagramIterator &scan, BamReader *manager);
00078
00079 public:
00080 static TypeHandle get_class_type() {
00081 return _type_handle;
00082 }
00083 static void init_type() {
00084 RenderAttrib::init_type();
00085 register_type(_type_handle, "CullFaceAttrib",
00086 RenderAttrib::get_class_type());
00087 _attrib_slot = register_slot(_type_handle, 100, make_default);
00088 }
00089 virtual TypeHandle get_type() const {
00090 return get_class_type();
00091 }
00092 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00093
00094 private:
00095 static TypeHandle _type_handle;
00096 static int _attrib_slot;
00097 };
00098
00099 #include "cullFaceAttrib.I"
00100
00101 #endif
00102