00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ALPHATESTATTRIB_H
00016 #define ALPHATESTATTRIB_H
00017
00018 #include "pandabase.h"
00019 #include "renderAttrib.h"
00020
00021 class FactoryParams;
00022
00023
00024
00025
00026
00027
00028 class EXPCL_PANDA_PGRAPH AlphaTestAttrib : public RenderAttrib {
00029 private:
00030 INLINE AlphaTestAttrib(PandaCompareFunc mode = M_always,
00031 PN_stdfloat reference_alpha = 1.0f);
00032
00033 PUBLISHED:
00034 static CPT(RenderAttrib) make(PandaCompareFunc mode,
00035 PN_stdfloat reference_alpha);
00036 static CPT(RenderAttrib) make_default();
00037
00038 INLINE PN_stdfloat get_reference_alpha() const;
00039 INLINE PandaCompareFunc get_mode() const;
00040
00041 public:
00042 virtual void output(ostream &out) const;
00043
00044 protected:
00045 virtual int compare_to_impl(const RenderAttrib *other) const;
00046 virtual size_t get_hash_impl() const;
00047 virtual CPT(RenderAttrib) get_auto_shader_attrib_impl(const RenderState *state) const;
00048
00049 private:
00050 PandaCompareFunc _mode;
00051 PN_stdfloat _reference_alpha;
00052
00053 PUBLISHED:
00054 static int get_class_slot() {
00055 return _attrib_slot;
00056 }
00057 virtual int get_slot() const {
00058 return get_class_slot();
00059 }
00060
00061 public:
00062 static void register_with_read_factory();
00063 virtual void write_datagram(BamWriter *manager, Datagram &dg);
00064
00065 protected:
00066 static TypedWritable *make_from_bam(const FactoryParams ¶ms);
00067 void fillin(DatagramIterator &scan, BamReader *manager);
00068
00069 public:
00070 static TypeHandle get_class_type() {
00071 return _type_handle;
00072 }
00073 static void init_type() {
00074 RenderAttrib::init_type();
00075 register_type(_type_handle, "AlphaTestAttrib",
00076 RenderAttrib::get_class_type());
00077 _attrib_slot = register_slot(_type_handle, 100, make_default);
00078 }
00079 virtual TypeHandle get_type() const {
00080 return get_class_type();
00081 }
00082 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00083
00084 private:
00085 static TypeHandle _type_handle;
00086 static int _attrib_slot;
00087 };
00088
00089 #include "alphaTestAttrib.I"
00090
00091 #endif
00092