00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef MATERIALATTRIB_H
00016 #define MATERIALATTRIB_H
00017
00018 #include "pandabase.h"
00019
00020 #include "renderAttrib.h"
00021 #include "material.h"
00022
00023
00024
00025
00026
00027
00028
00029
00030 class EXPCL_PANDA_PGRAPH MaterialAttrib : public RenderAttrib {
00031 private:
00032 INLINE MaterialAttrib();
00033
00034 PUBLISHED:
00035 static CPT(RenderAttrib) make(Material *material);
00036 static CPT(RenderAttrib) make_off();
00037 static CPT(RenderAttrib) make_default();
00038
00039 INLINE bool is_off() const;
00040 INLINE Material *get_material() const;
00041
00042 public:
00043 virtual void output(ostream &out) const;
00044
00045 protected:
00046 virtual int compare_to_impl(const RenderAttrib *other) const;
00047 virtual size_t get_hash_impl() const;
00048 virtual CPT(RenderAttrib) get_auto_shader_attrib_impl(const RenderState *state) const;
00049
00050 private:
00051 PT(Material) _material;
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 virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
00065
00066 protected:
00067 static TypedWritable *make_from_bam(const FactoryParams ¶ms);
00068 void fillin(DatagramIterator &scan, BamReader *manager);
00069
00070 public:
00071 static TypeHandle get_class_type() {
00072 return _type_handle;
00073 }
00074 static void init_type() {
00075 RenderAttrib::init_type();
00076 register_type(_type_handle, "MaterialAttrib",
00077 RenderAttrib::get_class_type());
00078 _attrib_slot = register_slot(_type_handle, 100, make_default);
00079 }
00080 virtual TypeHandle get_type() const {
00081 return get_class_type();
00082 }
00083 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00084
00085 private:
00086 static TypeHandle _type_handle;
00087 static int _attrib_slot;
00088 };
00089
00090 #include "materialAttrib.I"
00091
00092 #endif
00093