00001 // Filename: textureAttrib.h 00002 // Created by: drose (21Feb02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef TEXTUREATTRIB_H 00020 #define TEXTUREATTRIB_H 00021 00022 #include "pandabase.h" 00023 00024 #include "renderAttrib.h" 00025 #include "texture.h" 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Class : TextureAttrib 00029 // Description : Indicates which texture should be applied as the 00030 // primary texture. Also see TextureAttrib2 for the 00031 // secondary texture. 00032 //////////////////////////////////////////////////////////////////// 00033 class EXPCL_PANDA TextureAttrib : public RenderAttrib { 00034 private: 00035 INLINE TextureAttrib(); 00036 00037 PUBLISHED: 00038 static CPT(RenderAttrib) make(Texture *tex); 00039 static CPT(RenderAttrib) make_off(); 00040 00041 INLINE bool is_off() const; 00042 INLINE Texture *get_texture() const; 00043 00044 public: 00045 virtual void issue(GraphicsStateGuardianBase *gsg) const; 00046 virtual void output(ostream &out) const; 00047 00048 protected: 00049 virtual int compare_to_impl(const RenderAttrib *other) const; 00050 virtual RenderAttrib *make_default_impl() const; 00051 00052 private: 00053 PT(Texture) _texture; 00054 00055 public: 00056 static void register_with_read_factory(); 00057 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00058 virtual int complete_pointers(TypedWritable **plist, BamReader *manager); 00059 00060 protected: 00061 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00062 void fillin(DatagramIterator &scan, BamReader *manager); 00063 00064 public: 00065 static TypeHandle get_class_type() { 00066 return _type_handle; 00067 } 00068 static void init_type() { 00069 RenderAttrib::init_type(); 00070 register_type(_type_handle, "TextureAttrib", 00071 RenderAttrib::get_class_type()); 00072 } 00073 virtual TypeHandle get_type() const { 00074 return get_class_type(); 00075 } 00076 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00077 00078 private: 00079 static TypeHandle _type_handle; 00080 }; 00081 00082 #include "textureAttrib.I" 00083 00084 #endif 00085