00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef LIGHTRAMPATTRIB_H
00016 #define LIGHTRAMPATTRIB_H
00017
00018 #include "pandabase.h"
00019 #include "renderAttrib.h"
00020
00021 class FactoryParams;
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 class EXPCL_PANDA_PGRAPH LightRampAttrib : public RenderAttrib {
00033 private:
00034 INLINE LightRampAttrib();
00035
00036 PUBLISHED:
00037 enum LightRampMode {
00038 LRT_default,
00039 LRT_identity,
00040 LRT_single_threshold,
00041 LRT_double_threshold,
00042 LRT_hdr0,
00043 LRT_hdr1,
00044 LRT_hdr2,
00045 };
00046 static CPT(RenderAttrib) make_default();
00047 static CPT(RenderAttrib) make_identity();
00048 static CPT(RenderAttrib) make_single_threshold(PN_stdfloat thresh0, PN_stdfloat lev0);
00049 static CPT(RenderAttrib) make_double_threshold(PN_stdfloat thresh0, PN_stdfloat lev0, PN_stdfloat thresh1, PN_stdfloat lev1);
00050 static CPT(RenderAttrib) make_hdr0();
00051 static CPT(RenderAttrib) make_hdr1();
00052 static CPT(RenderAttrib) make_hdr2();
00053
00054
00055 INLINE LightRampMode get_mode() const;
00056 INLINE PN_stdfloat get_level(int n) const;
00057 INLINE PN_stdfloat get_threshold(int n) const;
00058
00059 public:
00060 virtual void output(ostream &out) const;
00061
00062 protected:
00063 virtual int compare_to_impl(const RenderAttrib *other) const;
00064 virtual size_t get_hash_impl() const;
00065 virtual CPT(RenderAttrib) get_auto_shader_attrib_impl(const RenderState *state) const;
00066
00067 private:
00068 LightRampMode _mode;
00069 PN_stdfloat _level[2];
00070 PN_stdfloat _threshold[2];
00071
00072 static CPT(RenderAttrib) _default;
00073
00074 PUBLISHED:
00075 static int get_class_slot() {
00076 return _attrib_slot;
00077 }
00078 virtual int get_slot() const {
00079 return get_class_slot();
00080 }
00081
00082 public:
00083 static void register_with_read_factory();
00084 virtual void write_datagram(BamWriter *manager, Datagram &dg);
00085
00086 protected:
00087 static TypedWritable *make_from_bam(const FactoryParams ¶ms);
00088 void fillin(DatagramIterator &scan, BamReader *manager);
00089
00090 public:
00091 static TypeHandle get_class_type() {
00092 return _type_handle;
00093 }
00094 static void init_type() {
00095 RenderAttrib::init_type();
00096 register_type(_type_handle, "LightRampAttrib",
00097 RenderAttrib::get_class_type());
00098 _attrib_slot = register_slot(_type_handle, 100, make_default);
00099 }
00100 virtual TypeHandle get_type() const {
00101 return get_class_type();
00102 }
00103 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00104
00105 private:
00106 static TypeHandle _type_handle;
00107 static int _attrib_slot;
00108 };
00109
00110 #include "lightRampAttrib.I"
00111
00112 #endif
00113